"use strict";(self.webpackChunkpowerwiki=self.webpackChunkpowerwiki||[]).push([[2979],{18217(e,r,t){t.d(r,{diagram:()=>g});var a=t(67977),n=t(77454),s=(t(22422),t(32178),t(31293)),o=t(86827),i=t(78731),p=(0,i.Pz)().RailroadPeg.parser.LangiumParser,l=(0,o.K)(e=>{const r=e.alternatives.map(u);return 1===r.length?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),u=(0,o.K)(e=>{const r=e.elements.map(m);return 1===r.length?r[0]:{type:"sequence",elements:r}},"transformSequence"),m=(0,o.K)(e=>{const r=d(e.suffix);return e.operator?{type:"special",text:"&"===e.operator?`&${c(r)}`:`!${c(r)}`}:r},"transformPrefix"),c=(0,o.K)(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),d=(0,o.K)(e=>{const r=f(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),f=(0,o.K)(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return l(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=(0,o.K)(e=>({name:e.name,definition:l(e.definition)}),"transformRule"),P=(0,o.K)(e=>{(0,n.S)(e,a.db),e.title&&a.db.setTitle(e.title),e.rules.map(e=>a.db.addRule(y(e)))},"populateDb"),g={parser:{parse:(0,o.K)(e=>{a.db.clear(),s.R.debug("[PEG Parser] Starting Langium parse");const r=p.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new i.zg(r);const t=r.value;s.R.debug("[PEG Parser] Parsed rules:",t.rules.length),P(t),s.R.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a.db}},db:a.db,renderer:a.U,styles:a.$}}}]);