From 864dc69b915ec79a7823a2d3d583294fe82848a7 Mon Sep 17 00:00:00 2001 From: Christoph Schweppe Date: Mon, 22 Nov 2021 13:25:05 +0100 Subject: [PATCH] Use voyagers marked --- dist/voyager-docs.umd.js | 2 +- src/VoyagerDocs.php | 101 +++++--------------------- src/components/Docs.vue | 153 +++++++++------------------------------ vite.config.js | 5 +- 4 files changed, 55 insertions(+), 206 deletions(-) diff --git a/dist/voyager-docs.umd.js b/dist/voyager-docs.umd.js index 6bbae56..4f84a9a 100644 --- a/dist/voyager-docs.umd.js +++ b/dist/voyager-docs.umd.js @@ -1 +1 @@ -var __vite_style__=document.createElement("style");__vite_style__.innerHTML="pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}\n",document.head.appendChild(__vite_style__),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Vue)}(this,(function(e){"use strict";var t={exports:{}};function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((function(t){var r=e[t];"object"!=typeof r||Object.isFrozen(r)||n(r)})),e}t.exports=n,t.exports.default=n;var r=t.exports;class i{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function o(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function a(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach((function(e){for(const t in e)n[t]=e[t]})),n}const s=e=>!!e.kind;class l{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=o(e)}openNode(e){if(!s(e))return;let t=e.kind;t=e.sublanguage?`language-${t}`:((e,{prefix:t})=>{if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")}return`${t}${e}`})(t,{prefix:this.classPrefix}),this.span(t)}closeNode(e){s(e)&&(this.buffer+="")}value(){return this.buffer}span(e){this.buffer+=``}}class c{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t={kind:e,children:[]};this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{c._collapse(e)})))}}class d extends c{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,t){const n=e.root;n.kind=t,n.sublanguage=!0,this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return!0}}function g(e){return e?"string"==typeof e?e:e.source:null}function u(...e){return e.map((e=>g(e))).join("")}function h(...e){return"("+(function(e){const t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}(e).capture?"":"?:")+e.map((e=>g(e))).join("|")+")"}function f(e){return new RegExp(e.toString()+"|").exec("").length-1}const p=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function b(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n;let r=g(e),i="";for(;r.length>0;){const e=p.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+String(Number(e[1])+t):(i+=e[0],"("===e[0]&&n++)}return i})).map((e=>`(${e})`)).join(t)}const m="[a-zA-Z]\\w*",E="[a-zA-Z_]\\w*",_="\\b\\d+(\\.\\d+)?",y="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",w="\\b(0b[01]+)",v={begin:"\\\\[\\s\\S]",relevance:0},x={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[v]},k={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[v]},N=function(e,t,n={}){const r=a({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=h("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:u(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},S=N("//","$"),O=N("/\\*","\\*/"),A=N("#","$"),I={scope:"number",begin:_,relevance:0},M={scope:"number",begin:y,relevance:0},R={scope:"number",begin:w,relevance:0},j={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[v,{begin:/\[/,end:/\]/,relevance:0,contains:[v]}]}]},T={scope:"title",begin:m,relevance:0},C={scope:"title",begin:E,relevance:0},B={begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0};var L=Object.freeze({__proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:m,UNDERSCORE_IDENT_RE:E,NUMBER_RE:_,C_NUMBER_RE:y,BINARY_NUMBER_RE:w,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=u(t,/.*\b/,e.binary,/\b.*/)),a({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},BACKSLASH_ESCAPE:v,APOS_STRING_MODE:x,QUOTE_STRING_MODE:k,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},COMMENT:N,C_LINE_COMMENT_MODE:S,C_BLOCK_COMMENT_MODE:O,HASH_COMMENT_MODE:A,NUMBER_MODE:I,C_NUMBER_MODE:M,BINARY_NUMBER_MODE:R,REGEXP_MODE:j,TITLE_MODE:T,UNDERSCORE_TITLE_MODE:C,METHOD_GUARD:B,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})}});function D(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function $(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function P(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=D,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,t){Array.isArray(e.illegal)&&(e.illegal=h(...e.illegal))}function z(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function H(e,t){void 0===e.relevance&&(e.relevance=1)}const F=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t]})),e.keywords=n.keywords,e.begin=u(n.beforeMatch,u("(?=",n.begin,")")),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},Z=["of","and","for","in","not","or","if","then","parent","list","value"];function K(e,t,n="keyword"){const r=Object.create(null);return"string"==typeof e?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach((function(n){Object.assign(r,K(e[n],t,n))})),r;function i(e,n){t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((function(t){const n=t.split("|");r[n[0]]=[e,G(n[0],n[1])]}))}}function G(e,t){return t?Number(t):function(e){return Z.includes(e.toLowerCase())}(e)?0:1}const W={},V=e=>{console.error(e)},X=(e,...t)=>{console.log(`WARN: ${e}`,...t)},q=(e,t)=>{W[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),W[`${e}/${t}`]=!0)},Q=new Error;function J(e,t,{key:n}){let r=0;const i=e[n],o={},a={};for(let s=1;s<=t.length;s++)a[s+r]=i[s],o[s+r]=!0,r+=f(t[s-1]);e[n]=a,e[n]._emit=o,e[n]._multi=!0}function Y(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw V("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Q;if("object"!=typeof e.beginScope||null===e.beginScope)throw V("beginScope must be object"),Q;J(e,e.begin,{key:"beginScope"}),e.begin=b(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw V("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Q;if("object"!=typeof e.endScope||null===e.endScope)throw V("endScope must be object"),Q;J(e,e.end,{key:"endScope"}),e.end=b(e.end,{joinWith:""})}}(e)}function ee(e){function t(t,n){return new RegExp(g(t),"m"+(e.case_insensitive?"i":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=f(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map((e=>e[1]));this.matcherRe=t(b(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),function n(i,o){const s=i;if(i.isCompiled)return s;[$,z,Y,F].forEach((e=>e(i,o))),e.compilerExtensions.forEach((e=>e(i,o))),i.__beforeBegin=null,[P,U,H].forEach((e=>e(i,o))),i.isCompiled=!0;let l=null;return"object"==typeof i.keywords&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords),l=i.keywords.$pattern,delete i.keywords.$pattern),l=l||/\w+/,i.keywords&&(i.keywords=K(i.keywords,e.case_insensitive)),s.keywordPatternRe=t(l,!0),o&&(i.begin||(i.begin=/\B|\b/),s.beginRe=t(i.begin),i.end||i.endsWithParent||(i.end=/\B|\b/),i.end&&(s.endRe=t(i.end)),s.terminatorEnd=g(i.end)||"",i.endsWithParent&&o.terminatorEnd&&(s.terminatorEnd+=(i.end?"|":"")+o.terminatorEnd)),i.illegal&&(s.illegalRe=t(i.illegal)),i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map((function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(t){return a(e,{variants:null},t)})));if(e.cachedVariants)return e.cachedVariants;if(te(e))return a(e,{starts:e.starts?a(e.starts):null});if(Object.isFrozen(e))return a(e);return e}("self"===e?i:e)}))),i.contains.forEach((function(e){n(e,s)})),i.starts&&n(i.starts,o),s.matcher=function(e){const t=new r;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(s),s}(e)}function te(e){return!!e&&(e.endsWithParent||te(e.starts))}const ne=o,re=a,ie=Symbol("nomatch");var oe=function(e){const t=Object.create(null),n=Object.create(null),o=[];let a=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function g(e){return c.noHighlightRe.test(e)}function u(e,t,n){let r="",i="";"object"==typeof t?(r=e,n=t.ignoreIllegals,i=t.language):(q("10.7.0","highlight(lang, code, ...args) has been deprecated."),q("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),i=e,r=t),void 0===n&&(n=!0);const o={code:r,language:i};w("before:highlight",o);const a=o.result?o.result:h(o.language,o.code,n);return a.code=o.code,w("after:highlight",a),a}function h(e,n,r,o){const l=Object.create(null);function d(){if(!N.keywords)return void O.addText(A);let e=0;N.keywordPatternRe.lastIndex=0;let t=N.keywordPatternRe.exec(A),n="";for(;t;){n+=A.substring(e,t.index);const i=v.case_insensitive?t[0].toLowerCase():t[0],o=(r=i,N.keywords[r]);if(o){const[e,r]=o;if(O.addText(n),n="",l[i]=(l[i]||0)+1,l[i]<=7&&(I+=r),e.startsWith("_"))n+=t[0];else{const n=v.classNameAliases[e]||e;O.addKeyword(t[0],n)}}else n+=t[0];e=N.keywordPatternRe.lastIndex,t=N.keywordPatternRe.exec(A)}var r;n+=A.substr(e),O.addText(n)}function g(){null!=N.subLanguage?function(){if(""===A)return;let e=null;if("string"==typeof N.subLanguage){if(!t[N.subLanguage])return void O.addText(A);e=h(N.subLanguage,A,!0,S[N.subLanguage]),S[N.subLanguage]=e._top}else e=f(A,N.subLanguage.length?N.subLanguage:null);N.relevance>0&&(I+=e.relevance),O.addSublanguage(e._emitter,e.language)}():d(),A=""}function u(e,t){let n=1;for(;void 0!==t[n];){if(!e._emit[n]){n++;continue}const r=v.classNameAliases[e[n]]||e[n],i=t[n];r?O.addKeyword(i,r):(A=i,d(),A=""),n++}}function p(e,t){return e.scope&&"string"==typeof e.scope&&O.openNode(v.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(O.addKeyword(A,v.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),A=""):e.beginScope._multi&&(u(e.beginScope,t),A="")),N=Object.create(e,{parent:{value:N}}),N}function b(e,t,n){let r=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(e.endRe,n);if(r){if(e["on:end"]){const n=new i(e);e["on:end"](t,n),n.isMatchIgnored&&(r=!1)}if(r){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return b(e.parent,t,n)}function m(e){return 0===N.matcher.regexIndex?(A+=e[0],1):(j=!0,0)}function _(e){const t=e[0],r=n.substr(e.index),i=b(N,e,r);if(!i)return ie;const o=N;N.endScope&&N.endScope._wrap?(g(),O.addKeyword(t,N.endScope._wrap)):N.endScope&&N.endScope._multi?(g(),u(N.endScope,e)):o.skip?A+=t:(o.returnEnd||o.excludeEnd||(A+=t),g(),o.excludeEnd&&(A=t));do{N.scope&&O.closeNode(),N.skip||N.subLanguage||(I+=N.relevance),N=N.parent}while(N!==i.parent);return i.starts&&p(i.starts,e),o.returnEnd?0:t.length}let y={};function w(t,o){const s=o&&o[0];if(A+=t,null==s)return g(),0;if("begin"===y.type&&"end"===o.type&&y.index===o.index&&""===s){if(A+=n.slice(o.index,o.index+1),!a){const t=new Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=y.rule,t}return 1}if(y=o,"begin"===o.type)return function(e){const t=e[0],n=e.rule,r=new i(n),o=[n.__beforeBegin,n["on:begin"]];for(const i of o)if(i&&(i(e,r),r.isMatchIgnored))return m(t);return n.skip?A+=t:(n.excludeBegin&&(A+=t),g(),n.returnBegin||n.excludeBegin||(A=t)),p(n,e),n.returnBegin?0:t.length}(o);if("illegal"===o.type&&!r){const e=new Error('Illegal lexeme "'+s+'" for mode "'+(N.scope||"")+'"');throw e.mode=N,e}if("end"===o.type){const e=_(o);if(e!==ie)return e}if("illegal"===o.type&&""===s)return 1;if(R>1e5&&R>3*o.index){throw new Error("potential infinite loop, way more iterations than matches")}return A+=s,s.length}const v=E(e);if(!v)throw V(s.replace("{}",e)),new Error('Unknown language: "'+e+'"');const x=ee(v);let k="",N=o||x;const S={},O=new c.__emitter(c);!function(){const e=[];for(let t=N;t!==v;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach((e=>O.openNode(e)))}();let A="",I=0,M=0,R=0,j=!1;try{for(N.matcher.considerAll();;){R++,j?j=!1:N.matcher.considerAll(),N.matcher.lastIndex=M;const e=N.matcher.exec(n);if(!e)break;const t=w(n.substring(M,e.index),e);M=e.index+t}return w(n.substr(M)),O.closeAllNodes(),O.finalize(),k=O.toHTML(),{language:e,value:k,relevance:I,illegal:!1,_emitter:O,_top:N}}catch(T){if(T.message&&T.message.includes("Illegal"))return{language:e,value:ne(n),illegal:!0,relevance:0,_illegalBy:{message:T.message,index:M,context:n.slice(M-100,M+100),mode:T.mode,resultSoFar:k},_emitter:O};if(a)return{language:e,value:ne(n),illegal:!1,relevance:0,errorRaised:T,_emitter:O,_top:N};throw T}}function f(e,n){n=n||c.languages||Object.keys(t);const r=function(e){const t={value:ne(e),illegal:!1,relevance:0,_top:l,_emitter:new c.__emitter(c)};return t._emitter.addText(e),t}(e),i=n.filter(E).filter(y).map((t=>h(t,e,!1)));i.unshift(r);const o=i.sort(((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(E(e.language).supersetOf===t.language)return 1;if(E(t.language).supersetOf===e.language)return-1}return 0})),[a,s]=o,d=a;return d.secondBest=s,d}function p(e){let t=null;const r=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=c.languageDetectRe.exec(t);if(n){const t=E(n[1]);return t||(X(s.replace("{}",n[1])),X("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find((e=>g(e)||E(e)))}(e);if(g(r))return;w("before:highlightElement",{el:e,language:r}),!c.ignoreUnescapedHTML&&e.children.length>0&&(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/issues/2886"),console.warn(e)),t=e;const i=t.textContent,o=r?u(i,{language:r,ignoreIllegals:!0}):f(i);e.innerHTML=o.value,function(e,t,r){const i=t&&n[t]||r;e.classList.add("hljs"),e.classList.add(`language-${i}`)}(e,r,o.language),e.result={language:o.language,re:o.relevance,relevance:o.relevance},o.secondBest&&(e.secondBest={language:o.secondBest.language,relevance:o.secondBest.relevance}),w("after:highlightElement",{el:e,result:o,text:i})}let b=!1;function m(){if("loading"===document.readyState)return void(b=!0);document.querySelectorAll(c.cssSelector).forEach(p)}function E(e){return e=(e||"").toLowerCase(),t[e]||t[n[e]]}function _(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{n[e.toLowerCase()]=t}))}function y(e){const t=E(e);return t&&!t.disableAutodetect}function w(e,t){const n=e;o.forEach((function(e){e[n]&&e[n](t)}))}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(function(){b&&m()}),!1),Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:m,highlightElement:p,highlightBlock:function(e){return q("10.7.0","highlightBlock will be removed entirely in v12.0"),q("10.7.0","Please use highlightElement now."),p(e)},configure:function(e){c=re(c,e)},initHighlighting:()=>{m(),q("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){m(),q("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,r){let i=null;try{i=r(e)}catch(o){if(V("Language definition for '{}' could not be registered.".replace("{}",n)),!a)throw o;V(o),i=l}i.name||(i.name=n),t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&_(i.aliases,{languageName:n})},unregisterLanguage:function(e){delete t[e];for(const t of Object.keys(n))n[t]===e&&delete n[t]},listLanguages:function(){return Object.keys(t)},getLanguage:E,registerAliases:_,autoDetection:y,inherit:re,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),o.push(e)}}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString="11.2.0";for(const i in L)"object"==typeof L[i]&&r(L[i]);return Object.assign(e,L),e}({});const ae=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],se=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],le=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],ce=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],de=["align-content","align-items","align-self","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","auto","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","clip-path","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-variant","font-variant-ligatures","font-variation-settings","font-weight","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inherit","initial","justify-content","left","letter-spacing","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","mask","max-height","max-width","min-height","min-width","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","perspective","perspective-origin","pointer-events","position","quotes","resize","right","src","tab-size","table-layout","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-indent","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","white-space","widows","width","word-break","word-spacing","word-wrap","z-index"].reverse();function ge(e){return function(...e){return e.map((e=>function(e){return e?"string"==typeof e?e:e.source:null}(e))).join("")}("(?=",e,")")}const ue="[A-Za-z$_][0-9A-Za-z$_]*",he=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],fe=["true","false","null","undefined","NaN","Infinity"],pe=["Intl","DataView","Number","Math","Date","String","RegExp","Object","Function","Boolean","Error","Symbol","Set","Map","WeakSet","WeakMap","Proxy","Reflect","JSON","Promise","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Float32Array","Array","Uint8Array","Uint8ClampedArray","ArrayBuffer","BigInt64Array","BigUint64Array","BigInt"],be=["EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],me=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ee=["arguments","this","super","console","window","document","localStorage","module","global"],_e=[].concat(me,pe,be);function ye(e){return we("(?=",e,")")}function we(...e){return e.map((e=>{return(t=e)?"string"==typeof t?t:t.source:null;var t})).join("")}oe.registerLanguage("php",(function(e){const t={className:"variable",begin:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*(?![A-Za-z0-9])(?![$])"},n={className:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?[=]?/},{begin:/\?>/}]},r={className:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},i=e.inherit(e.APOS_STRING_MODE,{illegal:null}),o=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(r)}),a=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*(\w+)\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(r)}),s={className:"string",contains:[e.BACKSLASH_ESCAPE,n],variants:[e.inherit(i,{begin:"b'",end:"'"}),e.inherit(o,{begin:'b"',end:'"'}),o,i,a]},l={className:"number",variants:[{begin:"\\b0b[01]+(?:_[01]+)*\\b"},{begin:"\\b0o[0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0x[\\da-f]+(?:_[\\da-f]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:e[+-]?\\d+)?"}],relevance:0},c={keyword:"__CLASS__ __DIR__ __FILE__ __FUNCTION__ __LINE__ __METHOD__ __NAMESPACE__ __TRAIT__ die echo exit include include_once print require require_once array abstract and as binary bool boolean break callable case catch class clone const continue declare default do double else elseif empty enddeclare endfor endforeach endif endswitch endwhile enum eval extends final finally float for foreach from global goto if implements instanceof insteadof int integer interface isset iterable list match|0 mixed new object or private protected public real return string switch throw trait try unset use var void while xor yield",literal:"false null true",built_in:"Error|0 AppendIterator ArgumentCountError ArithmeticError ArrayIterator ArrayObject AssertionError BadFunctionCallException BadMethodCallException CachingIterator CallbackFilterIterator CompileError Countable DirectoryIterator DivisionByZeroError DomainException EmptyIterator ErrorException Exception FilesystemIterator FilterIterator GlobIterator InfiniteIterator InvalidArgumentException IteratorIterator LengthException LimitIterator LogicException MultipleIterator NoRewindIterator OutOfBoundsException OutOfRangeException OuterIterator OverflowException ParentIterator ParseError RangeException RecursiveArrayIterator RecursiveCachingIterator RecursiveCallbackFilterIterator RecursiveDirectoryIterator RecursiveFilterIterator RecursiveIterator RecursiveIteratorIterator RecursiveRegexIterator RecursiveTreeIterator RegexIterator RuntimeException SeekableIterator SplDoublyLinkedList SplFileInfo SplFileObject SplFixedArray SplHeap SplMaxHeap SplMinHeap SplObjectStorage SplObserver SplObserver SplPriorityQueue SplQueue SplStack SplSubject SplSubject SplTempFileObject TypeError UnderflowException UnexpectedValueException UnhandledMatchError ArrayAccess Closure Generator Iterator IteratorAggregate Serializable Stringable Throwable Traversable WeakReference WeakMap Directory __PHP_Incomplete_Class parent php_user_filter self static stdClass"};return{case_insensitive:!0,keywords:c,contains:[e.HASH_COMMENT_MODE,e.COMMENT("//","$",{contains:[n]}),e.COMMENT("/\\*","\\*/",{contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.COMMENT("__halt_compiler.+?;",!1,{endsWithParent:!0,keywords:"__halt_compiler"}),n,{className:"keyword",begin:/\$this\b/},t,{begin:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{className:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{className:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",t,e.C_BLOCK_COMMENT_MODE,s,l]}]},{className:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"use",relevance:0,end:";",contains:[e.UNDERSCORE_TITLE_MODE]},s,l]}})),oe.registerLanguage("css",(function(e){const t=(e=>({IMPORTANT:{scope:"meta",begin:"!important"},HEXCOLOR:{scope:"number",begin:"#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})"},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}}))(e),n=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[e.C_BLOCK_COMMENT_MODE,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/},t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+le.join("|")+")"},{begin:"::("+ce.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+de.join("|")+")\\b"},{begin:":",end:"[;}]",contains:[t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...n,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},{className:"built_in",begin:/[\w-]+(?=\()/}]},{begin:ge(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:se.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...n,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+ae.join("|")+")\\b"}]}})),oe.registerLanguage("json",(function(e){const t={beginKeywords:["true","false","null"].join(" ")};return{name:"JSON",contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,t,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}})),oe.registerLanguage("javascript",(function(e){const t=ue,n="<>",r="",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const n=e[0].length+e.index,r=e.input[n];"<"!==r?">"===r&&(((e,{after:t})=>{const n="",S={match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,ye(N)],className:{1:"keyword",3:"title.function"},contains:[m]};return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:b},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,g,u,h,l,_,{className:"attr",begin:t+ye(":"),relevance:0},S,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[h,e.REGEXP_MODE,{className:"function",begin:N,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:n,end:r},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},y,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[m,e.inherit(e.TITLE_MODE,{begin:t,className:"title.function"})]},{match:/\.\.\./,relevance:0},x,{match:"\\$"+t,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[m]},w,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},E,k,{match:/\$[(.]/}]}}));const ve={props:{title:String,content:String,toc:Object,path:String,current:String},methods:{parseContent(e,t){return this.parseLinks(this.parseImages(this.parseLists(this.parseInfoBlocks(this.parseCode(this.parseHeadings(e))))),t)},parseLinks(e,t){return e.replace(/href=\"(.+)\"/g,((e,n)=>{if(n.startsWith("#"))return`href="${n}"`;if(!n.startsWith("https://")&&!n.startsWith("http://")){if(!t)return n=n.replaceAll("./",""),`href="${route("voyager.voyager-docs")}?path=${n}"`;let e=this.current.substring(0,this.current.lastIndexOf("/"));return n=(n=this.resolveRelativePath(e+"/"+n)).replaceAll("./",""),`href="${route("voyager.voyager-docs")}?path=${n}"`}return`href="${n}" target="_blank"`}))},parseInfoBlocks:e=>e.replace(/{% hint style="([^&]+)" %}([^{]+){% endhint %}/gim,((e,t,n)=>{let r="red";return"info"==t?r="blue":"warning"==t&&(r="yellow"),`
${n}
`})),parseImages:e=>e.replace(/src=\"(.+)\"/g,((e,t)=>t.startsWith("https://")||t.startsWith("http://")?`src="${t}"`:(t=t.replaceAll("../","").replace(".gitbook/assets/",""),`src="${route("voyager.voyager-docs-asset")}?path=${t}" class="mx-auto py-2 w-full lg:w-4/6 cursor-pointer"`))),parseLists:e=>e.replaceAll("
    ",'
      '),parseHeadings:e=>e.replace(/([^<]+)/g,((e,t,n)=>{let r=slugify(n,{lower:!0});return`${n}`})),parseCode(e){return e.replace(/(.*?)<\/code>/gims,((e,t,n)=>`${oe.highlight(this.decodeHtml(n),{language:t}).value}`))},decodeHtml(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value},resolveRelativePath(e){for(var t=e.split("/"),n=1;n0&&".."!==t[n-1]&&(t.splice(n-1,2),n-=2),n++;return t.join("/")},getLink(e){return`${this.route("voyager.voyager-docs")}?path=${e}`}},data:()=>({selectedImageSource:null}),mounted(){document.getElementById("doc-content").getElementsByTagName("img").forEach((e=>{e.src.startsWith(`${route("voyager.voyager-docs-asset")}?path=`)&&e.addEventListener("click",(()=>{this.selectedImageSource=e.src,this.$refs.imageModal.open()}))}))}},xe={class:"w-full my-4 flex flex-wrap space-x-1 space-y-1"},ke=["href"],Ne={key:1,class:"block mx-6 my-3 leading-tight"},Se={class:"block px-6"},Oe=["href"],Ae={class:"button accent"},Ie=["href"],Me=["innerHTML"],Re=["src"];ve.render=function(t,n,r,i,o,a){const s=e.resolveComponent("Icon"),l=e.resolveComponent("Dropdown"),c=e.resolveComponent("Card"),d=e.resolveComponent("Modal");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(c,{title:r.title},{default:e.withCtx((()=>[e.createElementVNode("div",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.toc,((t,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[""!==n?(e.openBlock(),e.createBlock(l,{key:0,class:"self-center",placement:"bottom-start"},{opener:e.withCtx((()=>[e.createElementVNode("button",Ae,[e.createElementVNode("span",null,e.toDisplayString(n),1),e.createVNode(s,{icon:"chevron-down"})])])),default:e.withCtx((()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t,((t,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[t.title?(e.openBlock(),e.createElementBlock("a",{key:0,href:a.getLink(t.href),class:"link rounded"},e.toDisplayString(t.title),9,ke)):(e.openBlock(),e.createElementBlock("div",Ne,[e.createElementVNode("span",Se,e.toDisplayString(n),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t,(t=>(e.openBlock(),e.createElementBlock("a",{href:a.getLink(t.href),class:"link rounded mx-2"},e.toDisplayString(t.title),9,Oe)))),256))]))],64)))),256))])),_:2},1024)):(e.openBlock(),e.createElementBlock("a",{key:1,class:"button accent",href:a.getLink(t[0].href)},e.toDisplayString(t[0].title),9,Ie))],64)))),256))]),e.createElementVNode("div",{id:"doc-content",innerHTML:a.parseContent(r.content,!0)},null,8,Me)])),_:1},8,["title"]),e.createVNode(d,{ref:"imageModal"},{default:e.withCtx((()=>[e.createElementVNode("img",{src:o.selectedImageSource,class:"w-full"},null,8,Re)])),_:1},512)],64)},voyager.component("voyager-docs",ve)})); +var __vite_style__=document.createElement("style");__vite_style__.innerHTML="pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}\n",document.head.appendChild(__vite_style__),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Vue)}(this,(function(e){"use strict";var t={exports:{}};function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((function(t){var r=e[t];"object"!=typeof r||Object.isFrozen(r)||n(r)})),e}t.exports=n,t.exports.default=n;var r=t.exports;class i{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function o(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function a(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach((function(e){for(const t in e)n[t]=e[t]})),n}const s=e=>!!e.kind;class l{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=o(e)}openNode(e){if(!s(e))return;let t=e.kind;t=e.sublanguage?`language-${t}`:((e,{prefix:t})=>{if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")}return`${t}${e}`})(t,{prefix:this.classPrefix}),this.span(t)}closeNode(e){s(e)&&(this.buffer+="")}value(){return this.buffer}span(e){this.buffer+=``}}class c{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t={kind:e,children:[]};this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{c._collapse(e)})))}}class d extends c{constructor(e){super(),this.options=e}addKeyword(e,t){""!==e&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,t){const n=e.root;n.kind=t,n.sublanguage=!0,this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return!0}}function u(e){return e?"string"==typeof e?e:e.source:null}function g(...e){return e.map((e=>u(e))).join("")}function h(...e){return"("+(function(e){const t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}(e).capture?"":"?:")+e.map((e=>u(e))).join("|")+")"}function f(e){return new RegExp(e.toString()+"|").exec("").length-1}const b=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function p(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n;let r=u(e),i="";for(;r.length>0;){const e=b.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+String(Number(e[1])+t):(i+=e[0],"("===e[0]&&n++)}return i})).map((e=>`(${e})`)).join(t)}const m="[a-zA-Z]\\w*",E="[a-zA-Z_]\\w*",_="\\b\\d+(\\.\\d+)?",y="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",w="\\b(0b[01]+)",x={begin:"\\\\[\\s\\S]",relevance:0},v={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[x]},N={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[x]},S=function(e,t,n={}){const r=a({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=h("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:g(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},O=S("//","$"),k=S("/\\*","\\*/"),A=S("#","$"),M={scope:"number",begin:_,relevance:0},I={scope:"number",begin:y,relevance:0},R={scope:"number",begin:w,relevance:0},j={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[x,{begin:/\[/,end:/\]/,relevance:0,contains:[x]}]}]},T={scope:"title",begin:m,relevance:0},C={scope:"title",begin:E,relevance:0},D={begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0};var B=Object.freeze({__proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:m,UNDERSCORE_IDENT_RE:E,NUMBER_RE:_,C_NUMBER_RE:y,BINARY_NUMBER_RE:w,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=g(t,/.*\b/,e.binary,/\b.*/)),a({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},BACKSLASH_ESCAPE:x,APOS_STRING_MODE:v,QUOTE_STRING_MODE:N,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},COMMENT:S,C_LINE_COMMENT_MODE:O,C_BLOCK_COMMENT_MODE:k,HASH_COMMENT_MODE:A,NUMBER_MODE:M,C_NUMBER_MODE:I,BINARY_NUMBER_MODE:R,REGEXP_MODE:j,TITLE_MODE:T,UNDERSCORE_TITLE_MODE:C,METHOD_GUARD:D,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})}});function L(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function $(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function P(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=L,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,t){Array.isArray(e.illegal)&&(e.illegal=h(...e.illegal))}function z(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function H(e,t){void 0===e.relevance&&(e.relevance=1)}const Z=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t]})),e.keywords=n.keywords,e.begin=g(n.beforeMatch,g("(?=",n.begin,")")),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},K=["of","and","for","in","not","or","if","then","parent","list","value"];function F(e,t,n="keyword"){const r=Object.create(null);return"string"==typeof e?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach((function(n){Object.assign(r,F(e[n],t,n))})),r;function i(e,n){t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((function(t){const n=t.split("|");r[n[0]]=[e,G(n[0],n[1])]}))}}function G(e,t){return t?Number(t):function(e){return K.includes(e.toLowerCase())}(e)?0:1}const V={},W=e=>{console.error(e)},X=(e,...t)=>{console.log(`WARN: ${e}`,...t)},q=(e,t)=>{V[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),V[`${e}/${t}`]=!0)},Q=new Error;function J(e,t,{key:n}){let r=0;const i=e[n],o={},a={};for(let s=1;s<=t.length;s++)a[s+r]=i[s],o[s+r]=!0,r+=f(t[s-1]);e[n]=a,e[n]._emit=o,e[n]._multi=!0}function Y(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw W("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Q;if("object"!=typeof e.beginScope||null===e.beginScope)throw W("beginScope must be object"),Q;J(e,e.begin,{key:"beginScope"}),e.begin=p(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw W("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Q;if("object"!=typeof e.endScope||null===e.endScope)throw W("endScope must be object"),Q;J(e,e.end,{key:"endScope"}),e.end=p(e.end,{joinWith:""})}}(e)}function ee(e){function t(t,n){return new RegExp(u(t),"m"+(e.case_insensitive?"i":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=f(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map((e=>e[1]));this.matcherRe=t(p(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),function n(i,o){const s=i;if(i.isCompiled)return s;[$,z,Y,Z].forEach((e=>e(i,o))),e.compilerExtensions.forEach((e=>e(i,o))),i.__beforeBegin=null,[P,U,H].forEach((e=>e(i,o))),i.isCompiled=!0;let l=null;return"object"==typeof i.keywords&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords),l=i.keywords.$pattern,delete i.keywords.$pattern),l=l||/\w+/,i.keywords&&(i.keywords=F(i.keywords,e.case_insensitive)),s.keywordPatternRe=t(l,!0),o&&(i.begin||(i.begin=/\B|\b/),s.beginRe=t(i.begin),i.end||i.endsWithParent||(i.end=/\B|\b/),i.end&&(s.endRe=t(i.end)),s.terminatorEnd=u(i.end)||"",i.endsWithParent&&o.terminatorEnd&&(s.terminatorEnd+=(i.end?"|":"")+o.terminatorEnd)),i.illegal&&(s.illegalRe=t(i.illegal)),i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map((function(e){return function(e){e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(t){return a(e,{variants:null},t)})));if(e.cachedVariants)return e.cachedVariants;if(te(e))return a(e,{starts:e.starts?a(e.starts):null});if(Object.isFrozen(e))return a(e);return e}("self"===e?i:e)}))),i.contains.forEach((function(e){n(e,s)})),i.starts&&n(i.starts,o),s.matcher=function(e){const t=new r;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}(s),s}(e)}function te(e){return!!e&&(e.endsWithParent||te(e.starts))}const ne=o,re=a,ie=Symbol("nomatch");var oe=function(e){const t=Object.create(null),n=Object.create(null),o=[];let a=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function u(e){return c.noHighlightRe.test(e)}function g(e,t,n){let r="",i="";"object"==typeof t?(r=e,n=t.ignoreIllegals,i=t.language):(q("10.7.0","highlight(lang, code, ...args) has been deprecated."),q("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),i=e,r=t),void 0===n&&(n=!0);const o={code:r,language:i};w("before:highlight",o);const a=o.result?o.result:h(o.language,o.code,n);return a.code=o.code,w("after:highlight",a),a}function h(e,n,r,o){const l=Object.create(null);function d(){if(!S.keywords)return void k.addText(A);let e=0;S.keywordPatternRe.lastIndex=0;let t=S.keywordPatternRe.exec(A),n="";for(;t;){n+=A.substring(e,t.index);const i=x.case_insensitive?t[0].toLowerCase():t[0],o=(r=i,S.keywords[r]);if(o){const[e,r]=o;if(k.addText(n),n="",l[i]=(l[i]||0)+1,l[i]<=7&&(M+=r),e.startsWith("_"))n+=t[0];else{const n=x.classNameAliases[e]||e;k.addKeyword(t[0],n)}}else n+=t[0];e=S.keywordPatternRe.lastIndex,t=S.keywordPatternRe.exec(A)}var r;n+=A.substr(e),k.addText(n)}function u(){null!=S.subLanguage?function(){if(""===A)return;let e=null;if("string"==typeof S.subLanguage){if(!t[S.subLanguage])return void k.addText(A);e=h(S.subLanguage,A,!0,O[S.subLanguage]),O[S.subLanguage]=e._top}else e=f(A,S.subLanguage.length?S.subLanguage:null);S.relevance>0&&(M+=e.relevance),k.addSublanguage(e._emitter,e.language)}():d(),A=""}function g(e,t){let n=1;for(;void 0!==t[n];){if(!e._emit[n]){n++;continue}const r=x.classNameAliases[e[n]]||e[n],i=t[n];r?k.addKeyword(i,r):(A=i,d(),A=""),n++}}function b(e,t){return e.scope&&"string"==typeof e.scope&&k.openNode(x.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(k.addKeyword(A,x.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),A=""):e.beginScope._multi&&(g(e.beginScope,t),A="")),S=Object.create(e,{parent:{value:S}}),S}function p(e,t,n){let r=function(e,t){const n=e&&e.exec(t);return n&&0===n.index}(e.endRe,n);if(r){if(e["on:end"]){const n=new i(e);e["on:end"](t,n),n.isMatchIgnored&&(r=!1)}if(r){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return p(e.parent,t,n)}function m(e){return 0===S.matcher.regexIndex?(A+=e[0],1):(j=!0,0)}function _(e){const t=e[0],r=n.substr(e.index),i=p(S,e,r);if(!i)return ie;const o=S;S.endScope&&S.endScope._wrap?(u(),k.addKeyword(t,S.endScope._wrap)):S.endScope&&S.endScope._multi?(u(),g(S.endScope,e)):o.skip?A+=t:(o.returnEnd||o.excludeEnd||(A+=t),u(),o.excludeEnd&&(A=t));do{S.scope&&k.closeNode(),S.skip||S.subLanguage||(M+=S.relevance),S=S.parent}while(S!==i.parent);return i.starts&&b(i.starts,e),o.returnEnd?0:t.length}let y={};function w(t,o){const s=o&&o[0];if(A+=t,null==s)return u(),0;if("begin"===y.type&&"end"===o.type&&y.index===o.index&&""===s){if(A+=n.slice(o.index,o.index+1),!a){const t=new Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=y.rule,t}return 1}if(y=o,"begin"===o.type)return function(e){const t=e[0],n=e.rule,r=new i(n),o=[n.__beforeBegin,n["on:begin"]];for(const i of o)if(i&&(i(e,r),r.isMatchIgnored))return m(t);return n.skip?A+=t:(n.excludeBegin&&(A+=t),u(),n.returnBegin||n.excludeBegin||(A=t)),b(n,e),n.returnBegin?0:t.length}(o);if("illegal"===o.type&&!r){const e=new Error('Illegal lexeme "'+s+'" for mode "'+(S.scope||"")+'"');throw e.mode=S,e}if("end"===o.type){const e=_(o);if(e!==ie)return e}if("illegal"===o.type&&""===s)return 1;if(R>1e5&&R>3*o.index){throw new Error("potential infinite loop, way more iterations than matches")}return A+=s,s.length}const x=E(e);if(!x)throw W(s.replace("{}",e)),new Error('Unknown language: "'+e+'"');const v=ee(x);let N="",S=o||v;const O={},k=new c.__emitter(c);!function(){const e=[];for(let t=S;t!==x;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach((e=>k.openNode(e)))}();let A="",M=0,I=0,R=0,j=!1;try{for(S.matcher.considerAll();;){R++,j?j=!1:S.matcher.considerAll(),S.matcher.lastIndex=I;const e=S.matcher.exec(n);if(!e)break;const t=w(n.substring(I,e.index),e);I=e.index+t}return w(n.substr(I)),k.closeAllNodes(),k.finalize(),N=k.toHTML(),{language:e,value:N,relevance:M,illegal:!1,_emitter:k,_top:S}}catch(T){if(T.message&&T.message.includes("Illegal"))return{language:e,value:ne(n),illegal:!0,relevance:0,_illegalBy:{message:T.message,index:I,context:n.slice(I-100,I+100),mode:T.mode,resultSoFar:N},_emitter:k};if(a)return{language:e,value:ne(n),illegal:!1,relevance:0,errorRaised:T,_emitter:k,_top:S};throw T}}function f(e,n){n=n||c.languages||Object.keys(t);const r=function(e){const t={value:ne(e),illegal:!1,relevance:0,_top:l,_emitter:new c.__emitter(c)};return t._emitter.addText(e),t}(e),i=n.filter(E).filter(y).map((t=>h(t,e,!1)));i.unshift(r);const o=i.sort(((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(E(e.language).supersetOf===t.language)return 1;if(E(t.language).supersetOf===e.language)return-1}return 0})),[a,s]=o,d=a;return d.secondBest=s,d}function b(e){let t=null;const r=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=c.languageDetectRe.exec(t);if(n){const t=E(n[1]);return t||(X(s.replace("{}",n[1])),X("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find((e=>u(e)||E(e)))}(e);if(u(r))return;w("before:highlightElement",{el:e,language:r}),!c.ignoreUnescapedHTML&&e.children.length>0&&(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/issues/2886"),console.warn(e)),t=e;const i=t.textContent,o=r?g(i,{language:r,ignoreIllegals:!0}):f(i);e.innerHTML=o.value,function(e,t,r){const i=t&&n[t]||r;e.classList.add("hljs"),e.classList.add(`language-${i}`)}(e,r,o.language),e.result={language:o.language,re:o.relevance,relevance:o.relevance},o.secondBest&&(e.secondBest={language:o.secondBest.language,relevance:o.secondBest.relevance}),w("after:highlightElement",{el:e,result:o,text:i})}let p=!1;function m(){if("loading"===document.readyState)return void(p=!0);document.querySelectorAll(c.cssSelector).forEach(b)}function E(e){return e=(e||"").toLowerCase(),t[e]||t[n[e]]}function _(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{n[e.toLowerCase()]=t}))}function y(e){const t=E(e);return t&&!t.disableAutodetect}function w(e,t){const n=e;o.forEach((function(e){e[n]&&e[n](t)}))}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(function(){p&&m()}),!1),Object.assign(e,{highlight:g,highlightAuto:f,highlightAll:m,highlightElement:b,highlightBlock:function(e){return q("10.7.0","highlightBlock will be removed entirely in v12.0"),q("10.7.0","Please use highlightElement now."),b(e)},configure:function(e){c=re(c,e)},initHighlighting:()=>{m(),q("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){m(),q("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,r){let i=null;try{i=r(e)}catch(o){if(W("Language definition for '{}' could not be registered.".replace("{}",n)),!a)throw o;W(o),i=l}i.name||(i.name=n),t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&_(i.aliases,{languageName:n})},unregisterLanguage:function(e){delete t[e];for(const t of Object.keys(n))n[t]===e&&delete n[t]},listLanguages:function(){return Object.keys(t)},getLanguage:E,registerAliases:_,autoDetection:y,inherit:re,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}(e),o.push(e)}}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString="11.2.0";for(const i in B)"object"==typeof B[i]&&r(B[i]);return Object.assign(e,B),e}({});const ae=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],se=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],le=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],ce=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],de=["align-content","align-items","align-self","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","auto","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","clip-path","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-variant","font-variant-ligatures","font-variation-settings","font-weight","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inherit","initial","justify-content","left","letter-spacing","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","mask","max-height","max-width","min-height","min-width","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","perspective","perspective-origin","pointer-events","position","quotes","resize","right","src","tab-size","table-layout","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-indent","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","white-space","widows","width","word-break","word-spacing","word-wrap","z-index"].reverse();function ue(e){return function(...e){return e.map((e=>function(e){return e?"string"==typeof e?e:e.source:null}(e))).join("")}("(?=",e,")")}const ge="[A-Za-z$_][0-9A-Za-z$_]*",he=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],fe=["true","false","null","undefined","NaN","Infinity"],be=["Intl","DataView","Number","Math","Date","String","RegExp","Object","Function","Boolean","Error","Symbol","Set","Map","WeakSet","WeakMap","Proxy","Reflect","JSON","Promise","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Float32Array","Array","Uint8Array","Uint8ClampedArray","ArrayBuffer","BigInt64Array","BigUint64Array","BigInt"],pe=["EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],me=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ee=["arguments","this","super","console","window","document","localStorage","module","global"],_e=[].concat(me,be,pe);function ye(e){return we("(?=",e,")")}function we(...e){return e.map((e=>{return(t=e)?"string"==typeof t?t:t.source:null;var t})).join("")}oe.registerLanguage("php",(function(e){const t={className:"variable",begin:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*(?![A-Za-z0-9])(?![$])"},n={className:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?[=]?/},{begin:/\?>/}]},r={className:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},i=e.inherit(e.APOS_STRING_MODE,{illegal:null}),o=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(r)}),a=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*(\w+)\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(r)}),s={className:"string",contains:[e.BACKSLASH_ESCAPE,n],variants:[e.inherit(i,{begin:"b'",end:"'"}),e.inherit(o,{begin:'b"',end:'"'}),o,i,a]},l={className:"number",variants:[{begin:"\\b0b[01]+(?:_[01]+)*\\b"},{begin:"\\b0o[0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0x[\\da-f]+(?:_[\\da-f]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:e[+-]?\\d+)?"}],relevance:0},c={keyword:"__CLASS__ __DIR__ __FILE__ __FUNCTION__ __LINE__ __METHOD__ __NAMESPACE__ __TRAIT__ die echo exit include include_once print require require_once array abstract and as binary bool boolean break callable case catch class clone const continue declare default do double else elseif empty enddeclare endfor endforeach endif endswitch endwhile enum eval extends final finally float for foreach from global goto if implements instanceof insteadof int integer interface isset iterable list match|0 mixed new object or private protected public real return string switch throw trait try unset use var void while xor yield",literal:"false null true",built_in:"Error|0 AppendIterator ArgumentCountError ArithmeticError ArrayIterator ArrayObject AssertionError BadFunctionCallException BadMethodCallException CachingIterator CallbackFilterIterator CompileError Countable DirectoryIterator DivisionByZeroError DomainException EmptyIterator ErrorException Exception FilesystemIterator FilterIterator GlobIterator InfiniteIterator InvalidArgumentException IteratorIterator LengthException LimitIterator LogicException MultipleIterator NoRewindIterator OutOfBoundsException OutOfRangeException OuterIterator OverflowException ParentIterator ParseError RangeException RecursiveArrayIterator RecursiveCachingIterator RecursiveCallbackFilterIterator RecursiveDirectoryIterator RecursiveFilterIterator RecursiveIterator RecursiveIteratorIterator RecursiveRegexIterator RecursiveTreeIterator RegexIterator RuntimeException SeekableIterator SplDoublyLinkedList SplFileInfo SplFileObject SplFixedArray SplHeap SplMaxHeap SplMinHeap SplObjectStorage SplObserver SplObserver SplPriorityQueue SplQueue SplStack SplSubject SplSubject SplTempFileObject TypeError UnderflowException UnexpectedValueException UnhandledMatchError ArrayAccess Closure Generator Iterator IteratorAggregate Serializable Stringable Throwable Traversable WeakReference WeakMap Directory __PHP_Incomplete_Class parent php_user_filter self static stdClass"};return{case_insensitive:!0,keywords:c,contains:[e.HASH_COMMENT_MODE,e.COMMENT("//","$",{contains:[n]}),e.COMMENT("/\\*","\\*/",{contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.COMMENT("__halt_compiler.+?;",!1,{endsWithParent:!0,keywords:"__halt_compiler"}),n,{className:"keyword",begin:/\$this\b/},t,{begin:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{className:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{className:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",t,e.C_BLOCK_COMMENT_MODE,s,l]}]},{className:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"use",relevance:0,end:";",contains:[e.UNDERSCORE_TITLE_MODE]},s,l]}})),oe.registerLanguage("css",(function(e){const t=(e=>({IMPORTANT:{scope:"meta",begin:"!important"},HEXCOLOR:{scope:"number",begin:"#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})"},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}}))(e),n=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[e.C_BLOCK_COMMENT_MODE,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/},t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+le.join("|")+")"},{begin:"::("+ce.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+de.join("|")+")\\b"},{begin:":",end:"[;}]",contains:[t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...n,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},{className:"built_in",begin:/[\w-]+(?=\()/}]},{begin:ue(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:se.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...n,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+ae.join("|")+")\\b"}]}})),oe.registerLanguage("json",(function(e){const t={beginKeywords:["true","false","null"].join(" ")};return{name:"JSON",contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,t,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}})),oe.registerLanguage("javascript",(function(e){const t=ge,n="<>",r="",i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const n=e[0].length+e.index,r=e.input[n];"<"!==r?">"===r&&(((e,{after:t})=>{const n="",O={match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,ye(S)],className:{1:"keyword",3:"title.function"},contains:[m]};return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:p},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,u,g,h,l,_,{className:"attr",begin:t+ye(":"),relevance:0},O,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[h,e.REGEXP_MODE,{className:"function",begin:S,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:p}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:n,end:r},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},y,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[m,e.inherit(e.TITLE_MODE,{begin:t,className:"title.function"})]},{match:/\.\.\./,relevance:0},v,{match:"\\$"+t,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[m]},w,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},E,N,{match:/\$[(.]/}]}}));const xe={props:{title:String,content:String,toc:String,base:String,path:String},methods:{renderer(){let e=this.base;return{heading:(e,t)=>`${e}`,image:(t,n,r)=>`${n||r}`}}},data:()=>({selectedImageSource:null,selectedImageTitle:null}),mounted(){document.getElementById("doc-content").getElementsByTagName("img").forEach((e=>{e.src.startsWith(this.base)&&e.addEventListener("click",(()=>{this.selectedImageSource=e.src,this.selectedImageTitle=e.alt,this.$refs.imageModal.open()}))}))},created(){document.addEventListener("DOMContentLoaded",(e=>{document.querySelectorAll("pre code").forEach((e=>{oe.highlightElement(e)}))}))}},ve=e.createElementVNode("button",{class:"button blue"},"Menu",-1),Ne={id:"doc-content"},Se={class:"w-full inline-flex self-center"},Oe=["src"];xe.render=function(t,n,r,i,o,a){const s=e.resolveComponent("MarkdownView"),l=e.resolveComponent("SlideIn"),c=e.resolveComponent("Card"),d=e.resolveComponent("Modal");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(c,{title:r.title},{actions:e.withCtx((()=>[e.createVNode(l,null,{opener:e.withCtx((()=>[ve])),default:e.withCtx((()=>[e.createVNode(s,{options:{baseUrl:r.base},renderer:a.renderer()},{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString(r.toc),1)])),_:1},8,["options","renderer"])])),_:1})])),default:e.withCtx((()=>[e.createElementVNode("div",Ne,[e.createVNode(s,{options:{baseUrl:r.path},renderer:a.renderer(),ref:"mdcontent"},{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString(r.content),1)])),_:1},8,["options","renderer"])])])),_:1},8,["title"]),e.createVNode(d,{ref:"imageModal",title:o.selectedImageTitle,size:"full"},{default:e.withCtx((()=>[e.createElementVNode("div",Se,[e.createElementVNode("img",{src:o.selectedImageSource,class:"max-w-full"},null,8,Oe)])])),_:1},8,["title"])],64)},voyager.component("voyager-docs",xe)})); diff --git a/src/VoyagerDocs.php b/src/VoyagerDocs.php index 7c23b23..3d0516f 100644 --- a/src/VoyagerDocs.php +++ b/src/VoyagerDocs.php @@ -3,7 +3,6 @@ namespace Emptynick\VoyagerDocs; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Route; use Illuminate\Support\Str; @@ -32,56 +31,36 @@ public function provideProtectedRoutes(): void { Inertia::setRootView('voyager::app'); - Route::get('docs', function (Request $request) { - Event::dispatch('voyager.page'); - $path = $request->get('path', 'introduction.md'); - $currentPath = $path; - $path = str_replace('/', DIRECTORY_SEPARATOR, Str::start(urldecode($path), '/')); + Route::get('docs/{path?}', function ($path = 'introduction.md') { + $path = base_path('vendor/voyager-admin/voyager/docs/').$path; + if (File::exists($path)) { + $content = file_get_contents($path); - if (Str::contains($path, '..')) { - abort(404); - } + if (Str::contains($path, '.gitbook')) { + $extension = Str::afterLast($path, '.'); + $mime = $this->mime_extensions[$extension] ?? File::mimeType($path); - $path = base_path('vendor/voyager-admin/voyager/docs').$path; + $response = response(File::get($path), 200, ['Content-Type' => $mime]); + $response->setSharedMaxAge(31536000); + $response->setMaxAge(31536000); + $response->setExpires(new \DateTime('+1 year')); + + return $response; + } - if (File::exists($path)) { - $content = file_get_contents($path); $title = Str::after(Str::before($content, "\n"), '# '); - $content = $this->parseHTML(Str::markdown(Str::after($content, "\n")), true); - $toc = $this->parseSummary(Str::markdown(Str::after(file_get_contents(base_path('vendor/voyager-admin/voyager/docs/summary.md')), "\n"))); return Inertia::render('voyager-docs', [ 'title' => $title, 'content' => $content, - 'toc' => $toc, - 'path' => $request->get('path', 'introduction.md'), - 'current' => $currentPath, + 'toc' => Str::after(file_get_contents(base_path('vendor/voyager-admin/voyager/docs/summary.md')), "\n"), + 'path' => Str::beforeLast(\Request::url(), '/').'/', + 'base' => route('voyager.voyager-docs').'/', ])->withViewData('title', $title); } abort(404); - })->name('voyager-docs'); - - Route::get('docs-asset', function (Request $request) { - $path = $request->get('path', ''); - $path = str_replace('/', DIRECTORY_SEPARATOR, Str::start(urldecode($path), '/')); - $start = Str::beforeLast(urldecode($path), DIRECTORY_SEPARATOR); - $path = base_path('vendor/voyager-admin/voyager/docs/.gitbook/assets').$path; - - if (File::exists($path)) { - $extension = Str::afterLast($path, '.'); - $mime = $this->mime_extensions[$extension] ?? File::mimeType($path); - - $response = response(File::get($path), 200, ['Content-Type' => $mime]); - $response->setSharedMaxAge(31536000); - $response->setMaxAge(31536000); - $response->setExpires(new \DateTime('+1 year')); - - return $response; - } - - abort(404); - })->name('voyager-docs-asset'); + })->where('path', '.*')->name('voyager-docs'); } public function provideJS(): string @@ -98,48 +77,4 @@ public function provideMenuItems(MenuManager $menumanager): void $item ); } - - private function parseHTML($content, $relative = true) - { - // Replace tables - $content = str_replace(['', '
      ', '

      '], ['

      ', '
      ', '

      '], $content); - - return $content; - } - - private function parseSummary($content) - { - $xml = simplexml_load_string('

      '.$content.'
      '); - $array = []; - $lastMain = ''; - foreach ($xml->children() as $node) { - if (in_array($node->getName(), ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])) { - $array[(string) $node] = []; - $lastMain = (string) $node; - } else { - $array[$lastMain] = $this->ulToArray($node); - } - } - - return $array; - } - - private function ulToArray($ul) - { - $array = []; - if ($ul->getName() == 'ul') { - foreach ($ul->children() as $node) { - if (count($node->children()) > 1) { - $array[(string) $node->children()[0]] = $this->ulToArray($node->children()[1]); - } else { - $array[] = [ - 'title' => (string) $node->children()[0], - 'href' => (string) $node->children()[0]->attributes()['href'] - ]; - } - } - } - - return $array; - } } diff --git a/src/components/Docs.vue b/src/components/Docs.vue index a6f7c90..8dcbf05 100644 --- a/src/components/Docs.vue +++ b/src/components/Docs.vue @@ -1,35 +1,21 @@