@commentray/render 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- "use strict";(()=>{var V=class{static ToInt32Array(e){let t=new Int32Array(e.length);for(let r=0,o=e.length;r<o;r++)t[r]=e[r];return t}},Ce=class{static getHashCode(e){let t=5381,r=t;for(let o=0,i=e.length;o<i&&e[o]!="\0"&&(t=(t<<5)+t^e.charCodeAt(o),o!==i-1&&e[o+1]!=="\0");o+=2)r=(r<<5)+r^e.charCodeAt(o+1);return t+1566083941*r|0}},E=class{constructor(e){this.entries=void 0,this.entries=e!==void 0?e:new Map}add(e,t){if(this.entries.has(e))throw new Error(`A meta entry with key ${e} is already present.`);this.entries.set(e,t)}get(e){return this.entries.get(e)}get allEntries(){return this.entries}toJSON(){return{entries:Object.fromEntries(this.entries)}}},de=class{static mergeMeta(e){if(e.length===0)return new E;if(e.length===1)return e[0];let t=new Map;for(let o of e)for(let[i,s]of o.allEntries){let a=t.get(i);a===void 0?t.set(i,[s]):a.push(s)}let r=new Map;for(let[o,i]of t)if(i.length!==1){if(i.every(s=>typeof s=="number")){let s=i.reduce((a,c)=>a+c,0);r.set(o,s);continue}for(let s=0;s<i.length;s++)r.set(`${o}_${s}`,i[s])}else r.set(o,i[0]);return new E(r)}},Ae=class{static isSurrogate(e){let t=e.charCodeAt(0);return t>=55296&&t<=57343}static isAlphanumeric(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}static isLowerAlpha(e){let t=e.charCodeAt(0);return t>=97&&t<=122}},Be=class{constructor(e,t){this.usableSearchers=void 0,this.usableSearchers=new Map;for(let r of t)e.includes(r.type)&&this.usableSearchers.set(r.type,r)}has(e){return this.usableSearchers.has(e)}minQuality(e){return this.usableSearchers.get(e).minQuality}spec(e){return this.usableSearchers.get(e)}},U=class{constructor(e,t,r){this.matches=void 0,this.query=void 0,this.meta=void 0,this.matches=e,this.query=t,this.meta=r}},T,me;(function(n){n.Fuzzy="fuzzy",n.Substring="substring",n.Prefix="prefix"})(T||(T={}));var he=class{constructor(e,t){this.type=void 0,this.minQuality=void 0,this.type=e,this.minQuality=Math.max(0,t)}},fe=class extends he{constructor(e){super(T.Fuzzy,e)}},te=class extends he{constructor(e){super(T.Substring,e)}},ne=class extends he{constructor(e){super(T.Prefix,e)}},Y=class{constructor(e,t=10,r=[new fe(.3),new te(0),new ne(0)]){this.string=void 0,this.topN=void 0,this.searchers=void 0,this.string=e,this.topN=Math.max(0,t),this.searchers=r}},lt=class{constructor(e,t){this.removedEntities=void 0,this.meta=void 0,this.removedEntities=e,this.meta=t}},ut=class{static mergeResults(e,t){let r=e.query,o=this.mergeMatches(e.matches,t.matches,r.topN),i=de.mergeMeta([e.meta,t.meta]);return new U(o,r,i)}static mergeMatches(e,t,r){if(t.length===0)return e;if(e.length===0)return t;let o=[...e,...t];return o.sort((i,s)=>i.quality>s.quality?-1:i.quality<s.quality?1:0),o.length<=r?o:o.slice(0,r)}},dt=class{constructor(e,t,r){this.maxQueryLength=void 0,this.mainSearcher=void 0,this.secondarySearcher=void 0,this.maxQueryLength=e,this.mainSearcher=t,this.secondarySearcher=r}indexEntities(e,t,r){return this.secondarySearcher.indexEntities([],t,r),this.mainSearcher.indexEntities(e,t,r)}getMatches(e){return e.string?(e.string.length>this.maxQueryLength&&(e=new Y(e.string.substring(0,this.maxQueryLength),e.topN,e.searchers)),ut.mergeResults(this.mainSearcher.getMatches(e),this.secondarySearcher.getMatches(e))):new U([],e,new E)}tryGetTerms(e){let t=this.mainSearcher.tryGetTerms(e);return t!==null?t:this.secondarySearcher.tryGetTerms(e)}getTerms(){return this.mainSearcher.getTerms().concat(this.secondarySearcher.getTerms())}tryGetEntity(e){var t,r;return(t=(r=this.mainSearcher.tryGetEntity(e))!=null?r:this.secondarySearcher.tryGetEntity(e))!=null?t:null}getEntities(){return this.mainSearcher.getEntities().concat(this.secondarySearcher.getEntities())}removeEntities(e){let t=[];for(let o=0,i=e.length;o<i;o++)(this.mainSearcher.removeEntity(e[o])||this.secondarySearcher.removeEntity(e[o]))&&t.push(e[o]);let r=new E;return new lt(t,r)}upsertEntities(e,t,r){let o=[],i=[];for(let s=0,a=e.length;s<a;s++){let c=e[s],l=t(c);this.tryUpdate(c,l,r)||(o.push(l),i.push(c))}return this.removeEntities(o),i.length>0?this.reindexSecondarySearcher(i,t,r):new E}reindexSecondarySearcher(e,t,r){let o=this.secondarySearcher.getEntities().concat(e);return this.secondarySearcher.indexEntities(o,t,r)}tryUpdate(e,t,r){return this.tryUpdateSearcher(e,t,r,this.mainSearcher)||this.tryUpdateSearcher(e,t,r,this.secondarySearcher)}tryUpdateSearcher(e,t,r,o){let i=o.tryGetTerms(t);if(i===null)return!1;if(this.termsAreEqual(i,r(e))){if(!o.replaceEntity(t,e,t))throw new Error(`Entity with id ${t} was not present.`);return!0}return!1}termsAreEqual(e,t){return e===t||e!=null&&t!=null&&e.length===t.length&&e.every((r,o)=>r===t[o])}removeEntity(e){return this.mainSearcher.removeEntity(e)||this.secondarySearcher.removeEntity(e)}replaceEntity(e,t,r){return this.mainSearcher.replaceEntity(e,t,r)||this.secondarySearcher.replaceEntity(e,t,r)}save(e){this.mainSearcher.save(e),this.secondarySearcher.save(e)}load(e){this.mainSearcher.load(e),this.secondarySearcher.load(e)}},mt=class{constructor(e){this.dynamicSearcher=void 0,this.dynamicSearcher=e}removeEntities(e){let t=performance.now(),r=this.dynamicSearcher.removeEntities(e),o=Math.round(performance.now()-t);return r.meta.add("removalDuration",o),r}upsertEntities(e,t,r){let o=performance.now(),i=this.dynamicSearcher.upsertEntities(e,t,r),s=Math.round(performance.now()-o);return i.add("upsertDuration",s),i}indexEntities(e,t,r){let o=performance.now(),i=this.dynamicSearcher.indexEntities(e,t,r),s=Math.round(performance.now()-o);return i.add("indexingDurationTotal",s),i}getMatches(e){let t=performance.now(),r=this.dynamicSearcher.getMatches(e),o=Math.round(performance.now()-t);return r.meta.add("queryDuration",o),r}tryGetEntity(e){return this.dynamicSearcher.tryGetEntity(e)}getEntities(){return this.dynamicSearcher.getEntities()}tryGetTerms(e){return this.dynamicSearcher.tryGetTerms(e)}getTerms(){return this.dynamicSearcher.getTerms()}removeEntity(e){return this.dynamicSearcher.removeEntity(e)}replaceEntity(e,t,r){return this.dynamicSearcher.replaceEntity(e,t,r)}save(e){this.dynamicSearcher.save(e)}load(e){this.dynamicSearcher.load(e)}},ht=class{constructor(e,t,r){this.entity=void 0,this.quality=void 0,this.matchedString=void 0,this.entity=e,this.quality=t,this.matchedString=r}},ft=class{constructor(e){this.query=void 0,this.matchedIndexes=new Set,this.matches=[],this.meta=[],this.query=e}},pe=class{constructor(e,t=0,r){this.string=void 0,this.minQuality=void 0,this.searcherType=void 0,this.string=e,this.minQuality=Math.max(0,Math.min(1,t)),this.searcherType=r}},pt=class{constructor(e,t){this.stringSearcher=void 0,this.searcherTypes=void 0,this.entities=void 0,this.idToIndex=void 0,this.terms=void 0,this.termIndexToEntityIndex=void 0,this.entityIndexToFirstTermIndex=void 0,this.searchersAndQualityOffsets=[{searcherType:T.Prefix,qualityOffset:2},{searcherType:T.Substring,qualityOffset:1},{searcherType:T.Fuzzy,qualityOffset:0}],this.stringSearcher=e,this.searcherTypes=t,this.entities=[],this.idToIndex=new Map,this.terms=[],this.termIndexToEntityIndex=new Int32Array(0),this.entityIndexToFirstTermIndex=new Int32Array(0)}indexEntities(e,t,r){this.entities=[...e],this.idToIndex=new Map,this.terms=[];let o=[],i=[];for(let a=0,c=e.length;a<c;a++){this.idToIndex.set(t(e[a]),a);let l=r(e[a]);i.push(this.terms.length),this.terms.push(...l),o.push(...l.map(()=>a))}this.termIndexToEntityIndex=V.ToInt32Array(o),this.entityIndexToFirstTermIndex=V.ToInt32Array(i);let s=this.stringSearcher.index(this.terms);return s.add("numberOfEntities",this.entities.length),s.add("numberOfTerms",this.terms.length),s}getMatches(e){let t=new ft(e),r=new Be(this.searcherTypes,e.searchers);for(let{searcherType:i,qualityOffset:s}of this.searchersAndQualityOffsets){if(e.topN==t.matches.length)break;r.has(i)&&this.addMatchesFromSearcher(t,r.spec(i),s)}let o=de.mergeMeta(t.meta);return new U(t.matches,e,o)}addMatchesFromSearcher(e,t,r){let o=Math.max(0,t.minQuality-r);if(o>1)return;let i=new pe(e.query.string,o,t.type),s=this.stringSearcher.getMatches(i);this.addMatchesFromResult(e,s,r)}addMatchesFromResult(e,t,r){if(e.meta.push(t.meta),e.query.topN!==0)for(let o=0,i=t.matches.length;o<i;o++){let s=t.matches[o],a=this.termIndexToEntityIndex[s.index];if(!e.matchedIndexes.has(a)&&this.entities[a]!==null&&(e.matchedIndexes.add(a),e.matches.push(new ht(this.entities[a],s.quality+r,this.terms[s.index])),e.matches.length===e.query.topN))break}}tryGetEntity(e){let t=this.idToIndex.get(e);return t===void 0?null:this.entities[t]}getEntities(){return this.entities.filter(e=>e!==null)}tryGetTerms(e){let t=this.idToIndex.get(e);return t===void 0?null:this.terms.slice(this.entityIndexToFirstTermIndex[t],t===this.entities.length-1?this.terms.length:this.entityIndexToFirstTermIndex[t+1])}getTerms(){let e=[];for(let t=0,r=this.termIndexToEntityIndex.length;t<r;t++)this.entities[this.termIndexToEntityIndex[t]]!==null&&e.push(this.terms[t]);return e}removeEntity(e){let t=this.idToIndex.get(e);return t!==void 0&&(this.entities[t]=null,this.idToIndex.delete(e),!0)}replaceEntity(e,t,r){let o=this.idToIndex.get(e);return o!==void 0&&(this.entities[o]=t,this.idToIndex.delete(e),this.idToIndex.set(r,o),!0)}save(e){e.add(this.entities),e.add(this.idToIndex),e.add(this.terms),e.add(this.termIndexToEntityIndex),e.add(this.entityIndexToFirstTermIndex),this.stringSearcher.save(e)}load(e){this.entities=e.get(),this.idToIndex=e.get(),this.terms=e.get(),this.termIndexToEntityIndex=e.get(),this.entityIndexToFirstTermIndex=e.get(),this.stringSearcher.load(e)}},G=class{constructor(e,t){this.strings=void 0,this.meta=void 0,this.strings=e,this.meta=t}},gt=class{constructor(e,t){this.treatCharacterAsSpace=void 0,this.allowCharacter=void 0,this.numberOfSurrogateCharacters=0,this.treatCharacterAsSpace=e,this.allowCharacter=t}normalize(e){let t=new Array(e.length),r=0,o=!1,i=!1;for(let s=0,a=e.length;s<a;s++){let c=this.getNormalizedCharacter(e[s]);c!==""&&(c===" "?o=!0:(o&&i&&(t[r++]=" "),t[r++]=c,i=!0,o=!1))}return i?t.join(""):""}getNormalizedCharacter(e){return e===" "||this.treatCharacterAsSpace(e)?" ":this.isSurrogate(e)||!this.allowCharacter(e)?"":e.toLowerCase()}isSurrogate(e){return!!Ae.isSurrogate(e)&&(this.numberOfSurrogateCharacters++,!0)}normalizeBulk(e){this.numberOfSurrogateCharacters=0;let t=e.map(o=>this.normalize(o)),r=new E;return r.add("numberOfSurrogateCharacters",this.numberOfSurrogateCharacters),new G(t,r)}},yt=class{constructor(e){this.normalizationFunction=void 0,this.normalizationFunction=e}normalize(e){return this.normalizationFunction(e)}normalizeBulk(e){let t=e.map(r=>this.normalize(r));return new G(t,new E)}},bt=class{constructor(e){this.normalizers=void 0,this.normalizers=e}normalize(e){for(let t=0,r=this.normalizers.length;t<r;t++)e=this.normalizers[t].normalize(e);return e}normalizeBulk(e){let t=new E;for(let r=0,o=this.normalizers.length;r<o;r++){let i=this.normalizers[r].normalizeBulk(e);e=i.strings;for(let s of i.meta.allEntries)t.add(s[0],s[1])}return new G(e,t)}},St=class{normalize(e){return e||""}normalizeBulk(e){let t=e.map(r=>this.normalize(r));return new G(t,new E)}},Tt=class{constructor(e,t){this.normalizeVariationsAndInput=void 0,this.replacements=void 0,this.normalizeVariationsAndInput=t,this.replacements=[];for(let r of e){let o=new Map;for(let[i,s]of r)for(let a of s){let c=t(a);o.set(c,i)}this.replacements.push(o)}}normalize(e){e=this.normalizeVariationsAndInput(e);let t=new Array(e.length),r=0;for(let o=0,i=e.length;o<i;o++)for(let s of this.replacements){let a=s.get(e[o]);if(a!==void 0){t[r++]=a;break}t[r++]=e[o]}return t.join("")}normalizeBulk(e){let t=e.map(r=>this.normalize(r));return new G(t,new E)}},wt=class{static create(e){let t=new St,r=new Tt(e.replacements,s=>s.toLowerCase().normalize("NFKC")),o=new yt(s=>s.normalize("NFKD")),i=new gt(e.treatCharacterAsSpace,e.allowCharacter);return new bt([t,r,o,i])}},ge=class{constructor(e,t){this.index=void 0,this.quality=void 0,this.index=e,this.quality=t}},P=class{constructor(e,t,r){this.matches=void 0,this.query=void 0,this.meta=void 0,this.matches=e,this.query=t,this.meta=r}},Et=class{constructor(e){this.stringSearcher=void 0,this.distinctMapping=void 0,this.sortMapping=void 0,this.stringSearcher=e,this.distinctMapping=new Int32Array(0),this.sortMapping=new Int32Array(0)}index(e){let t=e.map((c,l)=>({term:c,index:l}));t.sort((c,l)=>c.term<l.term?-1:c.term>l.term?1:0),this.sortMapping=new Int32Array(t.length);for(let c=0,l=t.length;c<l;c++)this.sortMapping[c]=t[c].index;let r=[],o=[],i=0,s=null;for(let c=0,l=t.length;c<l;c++){let u=t[c].term;u!=s&&(r[i]=u,o[i]=c,i++),s=u}o[i++]=t.length,this.distinctMapping=V.ToInt32Array(o);let a=this.stringSearcher.index(r);return a.add("numberOfDistinctTerms",r.length),a}getMatches(e){let t=this.stringSearcher.getMatches(e),r=new Array(t.matches.length),o=0;return t.matches.forEach(i=>{let s=this.distinctMapping[i.index+1];for(let a=this.distinctMapping[i.index];a<s;a++)r[o++]=new ge(this.sortMapping[a],i.quality)}),new P(r,e,t.meta)}save(e){e.add(this.distinctMapping),e.add(this.sortMapping),this.stringSearcher.save(e)}load(e){this.distinctMapping=e.get(),this.sortMapping=e.get(),this.stringSearcher.load(e)}},vt=class{constructor(e,t){this.entitySearcher=void 0,this.searcherTypes=void 0,this.entitySearcher=e,this.searcherTypes=t}indexEntities(e,t,r){return this.entitySearcher.indexEntities(e,t,r)}getMatches(e){let t=new Be(this.searcherTypes,e.searchers);if(e.topN>200)return this.entitySearcher.getMatches(e);if(e.string.length<=3&&t.has(T.Prefix)&&t.minQuality(T.Prefix)<2.2){let r=new Y(e.string,e.topN,[new ne(2.3)]),o=this.entitySearcher.getMatches(r);if(o.matches.length==e.topN)return new U(o.matches,e,o.meta)}if(e.string.length<=3&&!t.has(T.Prefix)&&t.has(T.Substring)&&t.minQuality(T.Substring)<1.2){let r=new Y(e.string,e.topN,[new te(1.3)]),o=this.entitySearcher.getMatches(r);if(o.matches.length==e.topN)return new U(o.matches,e,o.meta)}return this.entitySearcher.getMatches(e)}tryGetEntity(e){return this.entitySearcher.tryGetEntity(e)}getEntities(){return this.entitySearcher.getEntities()}tryGetTerms(e){return this.entitySearcher.tryGetTerms(e)}getTerms(){return this.entitySearcher.getTerms()}removeEntity(e){return this.entitySearcher.removeEntity(e)}replaceEntity(e,t,r){return this.entitySearcher.replaceEntity(e,t,r)}save(e){return this.entitySearcher.save(e)}load(e){return this.entitySearcher.load(e)}},Ie=class{constructor(){this.ids=void 0,this.frequencies=void 0,this.ids=[],this.frequencies=[]}addId(e,t){this.ids.push(e),this.frequencies.push(t)}seal(){this.ids=V.ToInt32Array(this.ids),this.frequencies=V.ToInt32Array(this.frequencies)}get length(){return this.ids.length}save(e){e.add(this.ids),e.add(this.frequencies)}load(e){this.ids=e.get(),this.frequencies=e.get()}},ue=class{constructor(){this.ngramToTermIds=void 0,this.ngramToTermIds=new Map}add(e,t,r){let o=this.ngramToTermIds.get(e);o||(o=new Ie,this.ngramToTermIds.set(e,o)),o.addId(t,r)}seal(){for(let e of this.ngramToTermIds.values())e.seal()}getIds(e){return this.ngramToTermIds.get(e)}get size(){return this.ngramToTermIds.size}save(e){e.add(this.ngramToTermIds.size);for(let[t,r]of this.ngramToTermIds)e.add(t),r.save(e)}load(e){let t=e.get();for(let r=0;r<t;r++){let o=e.get(),i=new Ie;i.load(e),this.ngramToTermIds.set(o,i)}}},Mt=class{static ComputeJaccardCoefficient(e,t,r){return r/(e+t-r)}static ComputeOverlapMaxCoefficient(e,t,r){return r/Math.max(e,t)}},Lt=class{constructor(e){this.ngramComputer=void 0,this.invertedIndex=void 0,this.numberOfNgrams=void 0,this.commonNgramCounts=void 0,this.ngramComputer=e,this.invertedIndex=new ue,this.numberOfNgrams=new Int32Array(0),this.commonNgramCounts=new Int32Array(0)}index(e){let t=performance.now();this.invertedIndex=new ue,this.commonNgramCounts=new Int32Array(e.length),this.numberOfNgrams=new Int32Array(e.length);let r=0;for(let s=0,a=e.length;s<a;s++){let c=e[s];if(!this.isValidTerm(c)){this.numberOfNgrams[s]=0,r++;continue}let l=this.ngramComputer.computeNgrams(c);this.numberOfNgrams[s]=l.length;let u=this.getNgramsToFrequency(l);for(let[d,m]of u)this.invertedIndex.add(d,s,m)}this.invertedIndex.seal();let o=Math.round(performance.now()-t),i=new E;return i.add("numberOfInvalidTerms",r),i.add("indexingDurationFuzzySearcher",o),i}isValidTerm(e){return e!=null&&e.trim()!==""}getMatches(e){if(this.invertedIndex.size===0)return new P([],e,new E);let t=this.ngramComputer.computeNgrams(e.string),r=this.getNgramsToFrequency(t),o=t.length;this.computeCommonNgramCounts(r);let i=this.getMatchesFromCommonNgrams(o,e.minQuality);return new P(i,e,new E)}computeCommonNgramCounts(e){this.commonNgramCounts.fill(0);for(let[t,r]of e){let o=this.invertedIndex.getIds(t);if(o!=null)for(let i=0,s=o.length;i<s;i++)this.commonNgramCounts[o.ids[i]]+=Math.min(r,o.frequencies[i])}}getNgramsToFrequency(e){let t=new Map;for(let r=0,o=e.length;r<o;r++){let i=e[r],s=t.get(i);t.set(i,s!==void 0?s+1:1)}return t}getMatchesFromCommonNgrams(e,t){let r=[];for(let o=0,i=this.numberOfNgrams.length;o<i;o++){let s=Mt.ComputeOverlapMaxCoefficient(e,this.numberOfNgrams[o],this.commonNgramCounts[o]);s>t&&r.push(new ge(o,s))}return r}save(e){this.invertedIndex.save(e),e.add(this.numberOfNgrams)}load(e){this.invertedIndex=new ue,this.invertedIndex.load(e),this.numberOfNgrams=e.get(),this.commonNgramCounts=new Int32Array(this.numberOfNgrams.length)}},kt=class{constructor(e,t){this.stringSearcher=void 0,this.penaltyFactor=void 0,this.hashCodes=void 0,this.stringSearcher=e,this.penaltyFactor=1-t,this.hashCodes=new Int32Array(0)}index(e){this.hashCodes=new Int32Array(e.length);for(let t=0,r=e.length;t<r;t++)this.hashCodes[t]=Ce.getHashCode(e[t]);return this.stringSearcher.index(e)}getMatches(e){let t=Ce.getHashCode(e.string),r=this.stringSearcher.getMatches(e),o=r.matches.map(i=>this.penalizeMatch(i,t)).filter(i=>i.quality>=e.minQuality);return new P(o,r.query,r.meta)}penalizeMatch(e,t){return e.quality*=this.hashCodes[e.index]===t?1:this.penaltyFactor,e}save(e){e.add(this.hashCodes),this.stringSearcher.save(e)}load(e){this.hashCodes=e.get(),this.stringSearcher.load(e)}},Ht=class{constructor(e,t){this.ngramN=void 0,this.transformNgram=void 0,this.ngramN=e,this.transformNgram=t??(r=>r)}computeNgrams(e){if(e.length===0)return[];if(e.length<=this.ngramN){let r=this.transformNgram(e);return r?[r]:[]}let t=[];for(let r=0,o=this.maximumNumberOfNgrams(e);r<o;r++){let i=this.transformNgram(e.substring(r,r+this.ngramN));i&&t.push(i)}return t}maximumNumberOfNgrams(e){return Math.max(e.length-this.ngramN+1,e.length>0?1:0)}},xt=class{constructor(e,t,r){this.paddingLeft=void 0,this.paddingRight=void 0,this.paddingMiddle=void 0,this.paddingLeft=e,this.paddingRight=t,this.paddingMiddle=r}normalize(e){return e&&`${this.paddingLeft}${e.split(" ").join(this.paddingMiddle)}${this.paddingRight}`}normalizeBulk(e){let t=e.map(o=>this.normalize(o)),r=new E;return new G(t,r)}},Pe=class{};Pe.Value=new Map([["a",["\u1D8F","\u2C65","\u0251","\u1D00","\u0250","\u0252"]],["aa",["\xE5","\uA733"]],["ae",["\xE4","\xE6","\u1D01","\u1D2D","\u1D46","\u01FD","\u01E3","\u1D02"]],["ao",["\uA735"]],["au",["\uA737"]],["av",["\uA739","\uA73B"]],["ay",["\uA73D"]],["b",["\u0180","\u0253","\u0183","\u1D6C","\u1D80","\u0299"]],["c",["\u023C","\u0188","\u0255","\u1D04","\uA73F","\u2184"]],["d",["\u0111","\xF0","\u0256","\u0257","\u018C","\u1D6D","\u1D81","\u1D91","\u0221","\u1D05","\uA77A"]],["db",["\u0238"]],["e",["\u1D92","\u0247","\u2C78","\u1D07","\u0259","\u01DD","\u025B"]],["eo",["\u1D14"]],["f",["\u0192","\u1D6E","\u1D82","\uA730","\uA77C"]],["g",["\u01E5","\u0260","\u1D83","\u0262","\u021D","\u014B","\uA7A1","\u1D79","\uA77F"]],["h",["\u0127","\u2C68","\u0266","\u029C","\u0303","\u0267","\u2C76","\u0265"]],["hv",["\u0195"]],["i",["\u0268","\u1D7B","\u1D96","\u0131","\u026A","\u0269"]],["j",["\u0249","\u0237","\u029D","\u025F","\u0284","\u1D0A"]],["k",["\u0199","\u2C6A","\u1D84","\uA741","\u1D0B","\uA743","\uA745","\uA7A3"]],["l",["\u0142","\u019A","\u2C61","\u026B","\u026C","\u1D85","\u026D","\u0234","\u029F","\uA749","\uA781","\uA747"]],["m",["\u1D6F","\u1D86","\u0271","\u1D0D","\u026F"]],["n",["\u0272","\u019E","\u1D70","\u1D87","\u0273","\u0235","\u0274","\uA791","\uA7A5"]],["o",["\xF8","\u01FF","\u0275","\u0254","\u2C7A","\u1D0F","\uA74B","\uA74D"]],["oe",["\xF6","\u0153"]],["oi",["\u01A3"]],["oo",["\uA74F"]],["ou",["\u0223"]],["p",["\u1D7D","\u01A5","\u1D71","\u1D88","\u1D18","\u01BF","\uA751","\uA753","\uA755"]],["q",["\u024B","\u02A0","\uA757","\uA759"]],["qp",["\u0239"]],["r",["\u024D","\u027D","\uA75B","\u1D72","\u1D89","\u027C","\u027E","\u1D73","\u0280","\u0279","\u0281","\uA7A7","\uA783"]],["s",["\u1D74","\u1D8A","\u0282","\u023F","\uA731","\u0283","\uA7A9","\uA785","\u017F"]],["ss",["\xDF"]],["t",["\u0167","\u2C66","\u01AD","\u0288","\u1D75","\u01AB","\u0236","\u1D1B","\uA787"]],["th",["\xFE"]],["tz",["\uA729"]],["u",["\u0289","\u028A","\u1D7E","\u1D1C","\u1D99"]],["ue",["\xFC","\u1D6B"]],["v",["\u028B","\u1D8C","\u2C71","\u2C74","\u1D20","\u028C","\uA75F"]],["vy",["\uA761"]],["w",["\u2C73","\u1D21","\u028D"]],["x",["\u1D8D"]],["y",["\u024F","\u01B4","\u028F","\u1EFF"]],["z",["\u01B6","\u0225","\u2C6C","\u1D76","\u1D8E","\u0290","\u0291","\u0240","\u1D22","\u0292","\u01B9","\uA763"]]]);var Re=class n{constructor(e,t,r){this.replacements=void 0,this.treatCharacterAsSpace=void 0,this.allowCharacter=void 0,this.replacements=e,this.treatCharacterAsSpace=t,this.allowCharacter=r}static createDefaultConfig(){let e=new Set(["_","-","\u2013","/",","," "]);return new n([Pe.Value],t=>e.has(t),t=>Ae.isAlphanumeric(t))}},De=class{constructor(e,t,r="normalizationDuration"){this.stringSearcher=void 0,this.normalizer=void 0,this.normalizationDurationMetaKey=void 0,this.stringSearcher=e,this.normalizer=t,this.normalizationDurationMetaKey=r}index(e){let t=performance.now(),r=this.normalizer.normalizeBulk(e),o=Math.round(performance.now()-t),i=this.stringSearcher.index(r.strings);i.add(this.normalizationDurationMetaKey,o);for(let s of r.meta.allEntries)i.add(s[0],s[1]);return i}getMatches(e){let t=new pe(this.normalizer.normalize(e.string),e.minQuality,e.searcherType),r=this.stringSearcher.getMatches(t);return new P(r.matches,e,r.meta)}save(e){this.stringSearcher.save(e)}load(e){this.stringSearcher.load(e)}},Ct=class{constructor(e){this.suffixArraySearcher=void 0,this.suffixArraySearcher=e}index(e){return this.suffixArraySearcher.index(e)}getMatches(e){if(!e.string)return new P([],e,new E);let t=this.modifyQueryString(e.string),r=new pe(t,e.minQuality,e.searcherType);return this.suffixArraySearcher.getMatches(r,e.string.length)}modifyQueryString(e){return`${this.suffixArraySearcher.separator}${e}`}save(e){this.suffixArraySearcher.save(e)}load(e){this.suffixArraySearcher.load(e)}},At=class{constructor(e,t,r){this.prefixSearcher=void 0,this.substringSearcher=void 0,this.fuzzySearcher=void 0,this.prefixSearcher=e,this.substringSearcher=t,this.fuzzySearcher=r}index(e){let t=[];if(this.prefixSearcher&&!this.substringSearcher){let r=this.prefixSearcher.index(e);t.push(r)}if(this.substringSearcher){let r=this.substringSearcher.index(e);t.push(r)}if(this.fuzzySearcher){let r=this.fuzzySearcher.index(e);t.push(r)}return de.mergeMeta(t)}getMatches(e){if(!e.searcherType)throw new Error("SearcherSwitch requires a searcher type.");switch(e.searcherType){case T.Prefix:if(!this.prefixSearcher)throw new Error("No prefix searcher has been indexed.");return this.prefixSearcher.getMatches(e);case T.Substring:if(!this.substringSearcher)throw new Error("No substring searcher has been indexed.");return this.substringSearcher.getMatches(e);case T.Fuzzy:if(!this.fuzzySearcher)throw new Error("No fuzzy searcher has been indexed.");return this.fuzzySearcher.getMatches(e);default:throw new Error(`Unknown searcher type: ${e.searcherType}`)}}save(e){this.prefixSearcher&&!this.substringSearcher&&this.prefixSearcher.save(e),this.substringSearcher&&this.substringSearcher.save(e),this.fuzzySearcher&&this.fuzzySearcher.save(e)}load(e){this.prefixSearcher&&!this.substringSearcher&&this.prefixSearcher.load(e),this.substringSearcher&&this.substringSearcher.load(e),this.fuzzySearcher&&this.fuzzySearcher.load(e)}};(function(n){n.QualityAndIndex="qualityAndIndex",n.QualityAndMatchedString="qualityAndMatchedString"})(me||(me={}));var Bt=class{constructor(e,t){this.sortOrder=void 0,this.entitySearcher=void 0,this.collator=new Intl.Collator(void 0,{numeric:!0}),this.sortOrder=e,this.entitySearcher=t}indexEntities(e,t,r){return this.entitySearcher.indexEntities(e,t,r)}getMatches(e){let t=this.entitySearcher.getMatches(e);switch(this.sortOrder){case me.QualityAndIndex:return t;case me.QualityAndMatchedString:return this.sortMatchesByQualityAndMatchedString(t.matches),t;default:throw new Error(`Unsupported sort order: ${this.sortOrder}`)}}sortMatchesByQualityAndMatchedString(e){e.sort((t,r)=>t.quality>r.quality?-1:t.quality<r.quality?1:this.collator.compare(t.matchedString,r.matchedString))}tryGetEntity(e){return this.entitySearcher.tryGetEntity(e)}getEntities(){return this.entitySearcher.getEntities()}tryGetTerms(e){return this.entitySearcher.tryGetTerms(e)}getTerms(){return this.entitySearcher.getTerms()}save(e){this.entitySearcher.save(e)}load(e){this.entitySearcher.load(e)}removeEntity(e){return this.entitySearcher.removeEntity(e)}replaceEntity(e,t,r){return this.entitySearcher.replaceEntity(e,t,r)}},It=class{constructor(e){this.stringSearcher=void 0,this.stringSearcher=e}index(e){return this.stringSearcher.index(e)}getMatches(e){let t=this.stringSearcher.getMatches(e);return t.matches.sort(this.compareMatchesByQualityAndIndex),t}compareMatchesByQualityAndIndex(e,t){return e.quality>t.quality?-1:e.quality<t.quality?1:e.index<t.index?-1:e.index>t.index?1:0}save(e){this.stringSearcher.save(e)}load(e){this.stringSearcher.load(e)}},ye=class{static compareOrdinal(e,t,r,o,i){let s=Math.min(t+i,e.length),a=Math.min(o+i,r.length),c=t,l=o;for(;c<s&&l<a;){let m=e.charCodeAt(c),h=r.charCodeAt(l);if(m<h)return-1;if(m>h)return 1;c++,l++}let u=s-t,d=a-o;return u===d?0:u<d?-1:1}},Pt=class n{static create(e){if(e==null)throw new Error("Input string cannot be null.");let t=new n(e);return t.FormInitialChains(),t.BuildSufixArray(),t.sa}constructor(e){this.inputString=void 0,this.eoc=2147483647,this.sa=void 0,this.isa=void 0,this.chainHeadsDict=void 0,this.chainStack=[],this.subChains=[],this.nextRank=1,this.inputString=e;let t=e.length;this.sa=new Int32Array(t),this.isa=new Int32Array(t),this.chainHeadsDict=new Map}FormInitialChains(){this.FindInitialChains(),this.SortAndPushSubchains()}FindInitialChains(){for(let e=0;e<this.inputString.length;e++){let t=this.inputString.charCodeAt(e),r=this.chainHeadsDict.get(t);this.isa[e]=r!==void 0?r:this.eoc,this.chainHeadsDict.set(t,e)}for(let e of this.chainHeadsDict.values()){let t=new Fe(e,1);this.subChains.push(t)}}BuildSufixArray(){for(;this.chainStack.length>0;){let e=this.chainStack.pop();this.isa[e.head]===this.eoc?this.RankSuffix(e.head):this.RefineChainWithInductionSorting(e)}}RankSuffix(e){this.isa[e]=-this.nextRank,this.sa[this.nextRank-1]=e,this.nextRank++}RefineChainWithInductionSorting(e){let t=[];for(this.chainHeadsDict.clear(),this.subChains=[];e.head!==this.eoc;){let r=this.isa[e.head];if(e.head+e.length>this.inputString.length-1)this.RankSuffix(e.head);else if(this.isa[e.head+e.length]<0){let o=new Rt(e.head,-this.isa[e.head+e.length]);t.push(o)}else this.ExtendChain(e);e.head=r}this.SortAndPushSubchains(),this.SortAndRankNotedSuffixes(t)}ExtendChain(e){let t=this.inputString.charCodeAt(e.head+e.length);if(this.chainHeadsDict.has(t))this.isa[this.chainHeadsDict.get(t)]=e.head,this.isa[e.head]=this.eoc;else{this.isa[e.head]=this.eoc;let r=new Fe(e.head,e.length+1);this.subChains.push(r)}this.chainHeadsDict.set(t,e.head)}SortAndRankNotedSuffixes(e){e.sort((t,r)=>t.rank-r.rank);for(let t=0;t<e.length;t++)this.RankSuffix(e[t].head)}SortAndPushSubchains(){this.subChains.sort((e,t)=>{let r=Math.min(e.length,t.length);return ye.compareOrdinal(this.inputString,e.head,this.inputString,t.head,r)});for(let e=this.subChains.length-1;e>=0;e--)this.chainStack.push(this.subChains[e])}},Rt=class{constructor(e,t){this.head=void 0,this.rank=void 0,this.head=e,this.rank=t}},Fe=class{constructor(e,t){this.head=void 0,this.length=void 0,this.head=e,this.length=t}},Dt=class{constructor(e){this.separator=void 0,this.str=void 0,this.suffixArray=void 0,this.indexToTermIndex=void 0,this.termLengths=void 0,this.separator=e,this.str="",this.suffixArray=new Int32Array(0),this.indexToTermIndex=new Int32Array(0),this.termLengths=new Int32Array(0)}index(e){let t=performance.now();this.str=e.length>0?this.separator+e.join(this.separator)+this.separator:"",this.suffixArray=Pt.create(this.str),this.indexToTermIndex=new Int32Array(this.suffixArray.length),this.termLengths=new Int32Array(e.length);let r=0;for(let s=0;s<e.length;s++){this.termLengths[s]=e[s].length;for(let a=0;a<=e[s].length;a++)this.indexToTermIndex[r++]=s}this.indexToTermIndex[r++]=-1;let o=Math.round(performance.now()-t),i=new E;return i.add("indexingDurationSuffixArraySearcher",o),i}getMatches(e,t){if(!e.string)return new P([],e,new E);let[r,o]=this.GetPositionsInSuffixArray(e.string),i=new Int32Array(o-r),s=new Set,a=0;for(let u=r;u<o;u++){let d=this.indexToTermIndex[this.suffixArray[u]];s.has(d)||(s.add(d),i[a++]=d)}let c=[];t=t??e.string.length;let l=0;for(let u=0;u<a;u++)l=this.computeQuality(t,this.termLengths[i[u]]),l>e.minQuality&&c.push(new ge(i[u],l));return new P(c,e,new E)}computeQuality(e,t){return e/t}GetPositionsInSuffixArray(e){let t=0,r=this.suffixArray.length,o=0;for(;t<r;)o=Math.floor((t+r)/2),ye.compareOrdinal(e,0,this.str,this.suffixArray[o],e.length)>0?t=o+1:r=o;let i=t;for(r=this.suffixArray.length;t<r;)o=Math.floor((t+r)/2),ye.compareOrdinal(e,0,this.str,this.suffixArray[o],e.length)==0?t=o+1:r=o;return[i,r]}save(e){e.add(this.str),e.add(this.suffixArray),e.add(this.indexToTermIndex),e.add(this.termLengths)}load(e){this.str=e.get(),this.suffixArray=e.get(),this.indexToTermIndex=e.get(),this.termLengths=e.get()}},Ne=class{static createSearcher(e){let t=this.createDefaultNormalizer(e),r=this.tryCreateFuzzySearcher(e),o=this.tryCreateSubstringSearcher(e),i=this.tryCreatePrefixSearcher(e,o),s=new At(i,o,r);s=new Et(s),s=new It(s),s=new De(s,t,"normalizationDurationDefault");let a=new pt(s,e.searcherTypes);return a=new vt(a,e.searcherTypes),a=new Bt(e.sortOrder,a),a}static createDefaultNormalizer(e){let t=new Set;e.fuzzySearchConfig&&(e.fuzzySearchConfig.paddingLeft.split("").forEach(o=>t.add(o)),e.fuzzySearchConfig.paddingRight.split("").forEach(o=>t.add(o)),e.fuzzySearchConfig.paddingMiddle.split("").forEach(o=>t.add(o))),e.substringSearchConfig&&e.substringSearchConfig.suffixArraySeparator.split("").forEach(o=>t.add(o));let r=new Re(e.normalizerConfig.replacements,e.normalizerConfig.treatCharacterAsSpace,o=>e.normalizerConfig.allowCharacter(o)&&!t.has(o));return wt.create(r)}static tryCreateFuzzySearcher(e){if(!e.searcherTypes.includes(T.Fuzzy))return null;if(e.fuzzySearchConfig===void 0)throw new Error("Unable to create fuzzy searcher: No fuzzy search config provided.");return this.createFuzzySearcher(e.fuzzySearchConfig)}static createFuzzySearcher(e){let t=new Ht(e.ngramN,e.transformNgram),r=new xt(e.paddingLeft,e.paddingRight,e.paddingMiddle),o=new Lt(t);return o=new kt(o,e.inequalityPenalty),o=new De(o,r,"normalizationDurationNgrams"),o}static tryCreateSubstringSearcher(e){if(!e.searcherTypes.includes(T.Substring))return null;if(e.substringSearchConfig===void 0)throw new Error("Unable to create substring searcher: No substring search config provided.");return this.createSubstringSearcher(e.substringSearchConfig)}static createSubstringSearcher(e){return new Dt(e.suffixArraySeparator)}static tryCreatePrefixSearcher(e,t){if(!e.searcherTypes.includes(T.Prefix))return null;if(e.substringSearchConfig===void 0)throw new Error("Unable to create prefix searcher: No substring search config provided.");return this.createPrefixSearcher(e.substringSearchConfig,t)}static createPrefixSearcher(e,t){return t===null&&(t=this.createSubstringSearcher(e)),new Ct(t)}},Ft=class n{constructor(e,t,r,o,i,s){this.paddingLeft=void 0,this.paddingRight=void 0,this.paddingMiddle=void 0,this.ngramN=void 0,this.transformNgram=void 0,this.inequalityPenalty=void 0,this.paddingLeft=e,this.paddingRight=t,this.paddingMiddle=r,this.ngramN=o,this.transformNgram=i,this.inequalityPenalty=s}static createDefaultConfig(){return new n("$$","!","!$$",3,e=>e.endsWith("$")?null:e.indexOf("$")===-1?e.split("").sort().join(""):e,.05)}};var Nt=class n{constructor(e){this.suffixArraySeparator=void 0,this.suffixArraySeparator=e}static createDefaultConfig(){return new n("$")}},Ot=class n{constructor(e,t,r,o,i,s){this.searcherTypes=void 0,this.maxQueryLength=void 0,this.sortOrder=void 0,this.normalizerConfig=void 0,this.fuzzySearchConfig=void 0,this.substringSearchConfig=void 0,this.searcherTypes=e,this.maxQueryLength=t,this.sortOrder=r,this.normalizerConfig=o,this.fuzzySearchConfig=i,this.substringSearchConfig=s}static createDefaultConfig(){let e=[T.Fuzzy,T.Substring,T.Prefix],t=me.QualityAndMatchedString,r=Re.createDefaultConfig(),o=Ft.createDefaultConfig(),i=Nt.createDefaultConfig();return new n(e,150,t,r,o,i)}},Oe=class{static createSearcher(e){let t=Ne.createSearcher(e),r=Ne.createSearcher(e),o=new dt(e.maxQueryLength,t,r);return o=new mt(o),o}static createDefaultSearcher(){let e=Ot.createDefaultConfig();return this.createSearcher(e)}};function re(n,e){if(n.length===0)return null;let t=[...n].sort((r,o)=>r.markerViewportHalfOpen1Based.lo-o.markerViewportHalfOpen1Based.lo);for(let r of t){let{lo:o,hiExclusive:i}=r.markerViewportHalfOpen1Based;if(o<=e&&e<i)return r}return null}function _t(n,e){if(n.length===0)return!1;let t=1/0;for(let r of n)t=Math.min(t,r.markerViewportHalfOpen1Based.lo);return e<t}function zt(n,e){if(n.length===0)return null;let t=[...n].sort((i,s)=>i.commentrayLine-s.commentrayLine),r=t[0];if(r===void 0)return null;let o=r;for(let i of t)i.commentrayLine<=e&&(o=i);return o}function $t(n,e,t,r,o){let i=Math.max(0,e-t),s=Math.max(0,r-o);return i<=0?0:Math.min(1,Math.max(0,n/i))*s}function N(n,e,t,r=5){let o=e+r,i=e+t-r;return n<o?{y:o-e,clipped:"above"}:n>i?{y:i-e,clipped:"below"}:{y:n-e,clipped:"none"}}function So(n,e,t,r,o={}){let{tension:i=.38,clipStart:s="none",clipEnd:a="none"}=o,l=Math.min(.66,i+.24),u=s==="none"?i:l,d=a==="none"?i:l,m=t-n;return[{x:n,y:e},{x:n+m*u,y:e},{x:t-m*d,y:r},{x:t,y:r}]}function qt(n,e,t,r){return`M ${W(n.x)} ${W(n.y)} C ${W(e.x)} ${W(e.y)} ${W(t.x)} ${W(t.y)} ${W(r.x)} ${W(r.y)}`}function To(n,e,t,r,o){let i=oe(n,e,o),s=oe(e,t,o),a=oe(t,r,o),c=oe(i,s,o),l=oe(s,a,o),u=oe(c,l,o);return[[n,i,c,u],[u,l,a,r]]}function oe(n,e,t){return{x:(1-t)*n.x+t*e.x,y:(1-t)*n.y+t*e.y}}function be(n,e,t,r,o={}){let{tension:i=.38,clipStart:s="none",clipEnd:a="none",splitT:c=.66}=o,l=So(n,e,t,r,{tension:i,clipStart:s,clipEnd:a}),[u,d,m,h]=l;if(!(s!=="none"||a!=="none"))return{solid:qt(u,d,m,h)};let[p,g]=To(u,d,m,h,c),[w,b,y,x]=p,[C,v,H,I]=g;return{solid:qt(w,b,y,x),dotted:qt(C,v,H,I)}}function W(n){return n.toFixed(2)}function _e(n){return[...n].sort((e,t)=>e.sourceStart-t.sourceStart)}function xn(n){let e=new Map;for(let t of _e(n))e.has(t.id)||e.set(t.id,t);return _e([...e.values()])}function Cn(n){return[...n].sort((e,t)=>e.commentrayLine!==t.commentrayLine?e.commentrayLine-t.commentrayLine:e.sourceStart-t.sourceStart)}function An(n,e){let t=Cn([...n]),r=t.findIndex(o=>o.id===e.id);if(!(r<0))return t[r+1]}function Bn(n,e){return n.length===0?null:re(n,e)?.id??null}function In(n,e){if(n.length===0)return null;let t=Cn([...n]),r=t[0];if(r===void 0)return null;let o=r;for(let i of t)i.commentrayLine<=e&&(o=i);return o.id}function Wt(n){return Math.max(0,n-1)}var Vt='.commentray-page-break[data-commentray-page-break="true"]';function ze(n,e){return(n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING)!==0}function Pn(n,e,t){return Array.from(n.querySelectorAll(Vt)).filter(r=>ze(e,r)&&(t===null||ze(r,t)))}var Hn=.5;function wo(n){let e=n.closest(Vt);return!!(e&&!n.isSameNode(e))}function Gt(n,e,t){let r=e.getBoundingClientRect().top+2;for(let o of Array.from(n.querySelectorAll("*"))){if(!(o instanceof HTMLElement)||t!==null&&(o===t||!ze(o,t))||!ze(e,o)||wo(o)||o.matches(Vt))continue;let i=o.getBoundingClientRect();i.width<Hn||i.height<Hn||(r=Math.max(r,i.bottom))}return r}function $e(n,e,t){let r=Pn(n,e,t),o=e.getBoundingClientRect().top+2,i=e;for(let s of r)o=Math.max(o,Gt(n,i,s)),i=s;return t?o=Math.max(o,Gt(n,i,t)):o=Math.max(o,Gt(n,i,null)),o}function Rn(n,e,t){let r=t.getBoundingClientRect().top-3,o=e.getBoundingClientRect().top+4,s=Pn(n,e,t)[0];if(s!==void 0){let c=$e(n,e,s),l=s.getBoundingClientRect().top-2;return Math.min(r,l,Math.max(o,c))}let a=$e(n,e,t);return Math.min(r,Math.max(o,a))}function Dn(n,e){if(n.length===0)return null;let t=null;for(let{line0:r,top:o}of n)o<=e+1+.001&&(t=t===null?r:Math.max(t,r));return t}function R(n){let e=n.trim();if(e==="")return"";try{let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return new TextDecoder("utf-8",{fatal:!1}).decode(r)}catch{return""}}function Fn(n,e){function t(r){let o=n.getAttribute(r);return o!==null&&o.trim()!==""?o:e.getAttribute(r)?.trim()??""}return{rawCodeB64:t("data-raw-code-b64"),rawMdB64:t("data-raw-md-b64")}}function qe(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Nn(n,e){let t=e.map(r=>r.trim()).filter(Boolean);if(t.length===0)return qe(n);try{let r=t.map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),o=new RegExp(`(${r.join("|")})`,"gi");return n.split(o).map((s,a)=>a%2===1?`<mark class="search-hit">${qe(s)}</mark>`:qe(s)).join("")}catch{return qe(n)}}function Ge(n,e){let t=e.map(c=>c.trim()).filter(Boolean);if(t.length===0)return[];let r=n.toLowerCase(),o=t.map(c=>c.toLowerCase()),i=[],s=0,a=0;for(;s<n.length&&a<400;){let c=s,l=-1,u=!0;for(let d of o){if(d.length===0)continue;let m=r.indexOf(d,c);if(m<0){u=!1;break}l<0&&(l=m),c=m+d.length}if(!u||l<0)break;i.push({start:l,end:c}),a++,s=l+1}return i}function On(n,e){let t=Math.max(0,Math.min(e,n.length)),r=0;for(let o=0;o<t;o++)n[o]===`
1
+ "use strict";(()=>{var V=class{static ToInt32Array(e){let t=new Int32Array(e.length);for(let r=0,o=e.length;r<o;r++)t[r]=e[r];return t}},He=class{static getHashCode(e){let t=5381,r=t;for(let o=0,i=e.length;o<i&&e[o]!="\0"&&(t=(t<<5)+t^e.charCodeAt(o),o!==i-1&&e[o+1]!=="\0");o+=2)r=(r<<5)+r^e.charCodeAt(o+1);return t+1566083941*r|0}},v=class{constructor(e){this.entries=void 0,this.entries=e!==void 0?e:new Map}add(e,t){if(this.entries.has(e))throw new Error(`A meta entry with key ${e} is already present.`);this.entries.set(e,t)}get(e){return this.entries.get(e)}get allEntries(){return this.entries}toJSON(){return{entries:Object.fromEntries(this.entries)}}},de=class{static mergeMeta(e){if(e.length===0)return new v;if(e.length===1)return e[0];let t=new Map;for(let o of e)for(let[i,s]of o.allEntries){let a=t.get(i);a===void 0?t.set(i,[s]):a.push(s)}let r=new Map;for(let[o,i]of t)if(i.length!==1){if(i.every(s=>typeof s=="number")){let s=i.reduce((a,c)=>a+c,0);r.set(o,s);continue}for(let s=0;s<i.length;s++)r.set(`${o}_${s}`,i[s])}else r.set(o,i[0]);return new v(r)}},Ce=class{static isSurrogate(e){let t=e.charCodeAt(0);return t>=55296&&t<=57343}static isAlphanumeric(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}static isLowerAlpha(e){let t=e.charCodeAt(0);return t>=97&&t<=122}},xe=class{constructor(e,t){this.usableSearchers=void 0,this.usableSearchers=new Map;for(let r of t)e.includes(r.type)&&this.usableSearchers.set(r.type,r)}has(e){return this.usableSearchers.has(e)}minQuality(e){return this.usableSearchers.get(e).minQuality}spec(e){return this.usableSearchers.get(e)}},U=class{constructor(e,t,r){this.matches=void 0,this.query=void 0,this.meta=void 0,this.matches=e,this.query=t,this.meta=r}},T,me;(function(n){n.Fuzzy="fuzzy",n.Substring="substring",n.Prefix="prefix"})(T||(T={}));var he=class{constructor(e,t){this.type=void 0,this.minQuality=void 0,this.type=e,this.minQuality=Math.max(0,t)}},fe=class extends he{constructor(e){super(T.Fuzzy,e)}},ee=class extends he{constructor(e){super(T.Substring,e)}},te=class extends he{constructor(e){super(T.Prefix,e)}},Y=class{constructor(e,t=10,r=[new fe(.3),new ee(0),new te(0)]){this.string=void 0,this.topN=void 0,this.searchers=void 0,this.string=e,this.topN=Math.max(0,t),this.searchers=r}},lt=class{constructor(e,t){this.removedEntities=void 0,this.meta=void 0,this.removedEntities=e,this.meta=t}},ut=class{static mergeResults(e,t){let r=e.query,o=this.mergeMatches(e.matches,t.matches,r.topN),i=de.mergeMeta([e.meta,t.meta]);return new U(o,r,i)}static mergeMatches(e,t,r){if(t.length===0)return e;if(e.length===0)return t;let o=[...e,...t];return o.sort((i,s)=>i.quality>s.quality?-1:i.quality<s.quality?1:0),o.length<=r?o:o.slice(0,r)}},dt=class{constructor(e,t,r){this.maxQueryLength=void 0,this.mainSearcher=void 0,this.secondarySearcher=void 0,this.maxQueryLength=e,this.mainSearcher=t,this.secondarySearcher=r}indexEntities(e,t,r){return this.secondarySearcher.indexEntities([],t,r),this.mainSearcher.indexEntities(e,t,r)}getMatches(e){return e.string?(e.string.length>this.maxQueryLength&&(e=new Y(e.string.substring(0,this.maxQueryLength),e.topN,e.searchers)),ut.mergeResults(this.mainSearcher.getMatches(e),this.secondarySearcher.getMatches(e))):new U([],e,new v)}tryGetTerms(e){let t=this.mainSearcher.tryGetTerms(e);return t!==null?t:this.secondarySearcher.tryGetTerms(e)}getTerms(){return this.mainSearcher.getTerms().concat(this.secondarySearcher.getTerms())}tryGetEntity(e){var t,r;return(t=(r=this.mainSearcher.tryGetEntity(e))!=null?r:this.secondarySearcher.tryGetEntity(e))!=null?t:null}getEntities(){return this.mainSearcher.getEntities().concat(this.secondarySearcher.getEntities())}removeEntities(e){let t=[];for(let o=0,i=e.length;o<i;o++)(this.mainSearcher.removeEntity(e[o])||this.secondarySearcher.removeEntity(e[o]))&&t.push(e[o]);let r=new v;return new lt(t,r)}upsertEntities(e,t,r){let o=[],i=[];for(let s=0,a=e.length;s<a;s++){let c=e[s],l=t(c);this.tryUpdate(c,l,r)||(o.push(l),i.push(c))}return this.removeEntities(o),i.length>0?this.reindexSecondarySearcher(i,t,r):new v}reindexSecondarySearcher(e,t,r){let o=this.secondarySearcher.getEntities().concat(e);return this.secondarySearcher.indexEntities(o,t,r)}tryUpdate(e,t,r){return this.tryUpdateSearcher(e,t,r,this.mainSearcher)||this.tryUpdateSearcher(e,t,r,this.secondarySearcher)}tryUpdateSearcher(e,t,r,o){let i=o.tryGetTerms(t);if(i===null)return!1;if(this.termsAreEqual(i,r(e))){if(!o.replaceEntity(t,e,t))throw new Error(`Entity with id ${t} was not present.`);return!0}return!1}termsAreEqual(e,t){return e===t||e!=null&&t!=null&&e.length===t.length&&e.every((r,o)=>r===t[o])}removeEntity(e){return this.mainSearcher.removeEntity(e)||this.secondarySearcher.removeEntity(e)}replaceEntity(e,t,r){return this.mainSearcher.replaceEntity(e,t,r)||this.secondarySearcher.replaceEntity(e,t,r)}save(e){this.mainSearcher.save(e),this.secondarySearcher.save(e)}load(e){this.mainSearcher.load(e),this.secondarySearcher.load(e)}},mt=class{constructor(e){this.dynamicSearcher=void 0,this.dynamicSearcher=e}removeEntities(e){let t=performance.now(),r=this.dynamicSearcher.removeEntities(e),o=Math.round(performance.now()-t);return r.meta.add("removalDuration",o),r}upsertEntities(e,t,r){let o=performance.now(),i=this.dynamicSearcher.upsertEntities(e,t,r),s=Math.round(performance.now()-o);return i.add("upsertDuration",s),i}indexEntities(e,t,r){let o=performance.now(),i=this.dynamicSearcher.indexEntities(e,t,r),s=Math.round(performance.now()-o);return i.add("indexingDurationTotal",s),i}getMatches(e){let t=performance.now(),r=this.dynamicSearcher.getMatches(e),o=Math.round(performance.now()-t);return r.meta.add("queryDuration",o),r}tryGetEntity(e){return this.dynamicSearcher.tryGetEntity(e)}getEntities(){return this.dynamicSearcher.getEntities()}tryGetTerms(e){return this.dynamicSearcher.tryGetTerms(e)}getTerms(){return this.dynamicSearcher.getTerms()}removeEntity(e){return this.dynamicSearcher.removeEntity(e)}replaceEntity(e,t,r){return this.dynamicSearcher.replaceEntity(e,t,r)}save(e){this.dynamicSearcher.save(e)}load(e){this.dynamicSearcher.load(e)}},ht=class{constructor(e,t,r){this.entity=void 0,this.quality=void 0,this.matchedString=void 0,this.entity=e,this.quality=t,this.matchedString=r}},ft=class{constructor(e){this.query=void 0,this.matchedIndexes=new Set,this.matches=[],this.meta=[],this.query=e}},pe=class{constructor(e,t=0,r){this.string=void 0,this.minQuality=void 0,this.searcherType=void 0,this.string=e,this.minQuality=Math.max(0,Math.min(1,t)),this.searcherType=r}},pt=class{constructor(e,t){this.stringSearcher=void 0,this.searcherTypes=void 0,this.entities=void 0,this.idToIndex=void 0,this.terms=void 0,this.termIndexToEntityIndex=void 0,this.entityIndexToFirstTermIndex=void 0,this.searchersAndQualityOffsets=[{searcherType:T.Prefix,qualityOffset:2},{searcherType:T.Substring,qualityOffset:1},{searcherType:T.Fuzzy,qualityOffset:0}],this.stringSearcher=e,this.searcherTypes=t,this.entities=[],this.idToIndex=new Map,this.terms=[],this.termIndexToEntityIndex=new Int32Array(0),this.entityIndexToFirstTermIndex=new Int32Array(0)}indexEntities(e,t,r){this.entities=[...e],this.idToIndex=new Map,this.terms=[];let o=[],i=[];for(let a=0,c=e.length;a<c;a++){this.idToIndex.set(t(e[a]),a);let l=r(e[a]);i.push(this.terms.length),this.terms.push(...l),o.push(...l.map(()=>a))}this.termIndexToEntityIndex=V.ToInt32Array(o),this.entityIndexToFirstTermIndex=V.ToInt32Array(i);let s=this.stringSearcher.index(this.terms);return s.add("numberOfEntities",this.entities.length),s.add("numberOfTerms",this.terms.length),s}getMatches(e){let t=new ft(e),r=new xe(this.searcherTypes,e.searchers);for(let{searcherType:i,qualityOffset:s}of this.searchersAndQualityOffsets){if(e.topN==t.matches.length)break;r.has(i)&&this.addMatchesFromSearcher(t,r.spec(i),s)}let o=de.mergeMeta(t.meta);return new U(t.matches,e,o)}addMatchesFromSearcher(e,t,r){let o=Math.max(0,t.minQuality-r);if(o>1)return;let i=new pe(e.query.string,o,t.type),s=this.stringSearcher.getMatches(i);this.addMatchesFromResult(e,s,r)}addMatchesFromResult(e,t,r){if(e.meta.push(t.meta),e.query.topN!==0)for(let o=0,i=t.matches.length;o<i;o++){let s=t.matches[o],a=this.termIndexToEntityIndex[s.index];if(!e.matchedIndexes.has(a)&&this.entities[a]!==null&&(e.matchedIndexes.add(a),e.matches.push(new ht(this.entities[a],s.quality+r,this.terms[s.index])),e.matches.length===e.query.topN))break}}tryGetEntity(e){let t=this.idToIndex.get(e);return t===void 0?null:this.entities[t]}getEntities(){return this.entities.filter(e=>e!==null)}tryGetTerms(e){let t=this.idToIndex.get(e);return t===void 0?null:this.terms.slice(this.entityIndexToFirstTermIndex[t],t===this.entities.length-1?this.terms.length:this.entityIndexToFirstTermIndex[t+1])}getTerms(){let e=[];for(let t=0,r=this.termIndexToEntityIndex.length;t<r;t++)this.entities[this.termIndexToEntityIndex[t]]!==null&&e.push(this.terms[t]);return e}removeEntity(e){let t=this.idToIndex.get(e);return t!==void 0&&(this.entities[t]=null,this.idToIndex.delete(e),!0)}replaceEntity(e,t,r){let o=this.idToIndex.get(e);return o!==void 0&&(this.entities[o]=t,this.idToIndex.delete(e),this.idToIndex.set(r,o),!0)}save(e){e.add(this.entities),e.add(this.idToIndex),e.add(this.terms),e.add(this.termIndexToEntityIndex),e.add(this.entityIndexToFirstTermIndex),this.stringSearcher.save(e)}load(e){this.entities=e.get(),this.idToIndex=e.get(),this.terms=e.get(),this.termIndexToEntityIndex=e.get(),this.entityIndexToFirstTermIndex=e.get(),this.stringSearcher.load(e)}},G=class{constructor(e,t){this.strings=void 0,this.meta=void 0,this.strings=e,this.meta=t}},gt=class{constructor(e,t){this.treatCharacterAsSpace=void 0,this.allowCharacter=void 0,this.numberOfSurrogateCharacters=0,this.treatCharacterAsSpace=e,this.allowCharacter=t}normalize(e){let t=new Array(e.length),r=0,o=!1,i=!1;for(let s=0,a=e.length;s<a;s++){let c=this.getNormalizedCharacter(e[s]);c!==""&&(c===" "?o=!0:(o&&i&&(t[r++]=" "),t[r++]=c,i=!0,o=!1))}return i?t.join(""):""}getNormalizedCharacter(e){return e===" "||this.treatCharacterAsSpace(e)?" ":this.isSurrogate(e)||!this.allowCharacter(e)?"":e.toLowerCase()}isSurrogate(e){return!!Ce.isSurrogate(e)&&(this.numberOfSurrogateCharacters++,!0)}normalizeBulk(e){this.numberOfSurrogateCharacters=0;let t=e.map(o=>this.normalize(o)),r=new v;return r.add("numberOfSurrogateCharacters",this.numberOfSurrogateCharacters),new G(t,r)}},yt=class{constructor(e){this.normalizationFunction=void 0,this.normalizationFunction=e}normalize(e){return this.normalizationFunction(e)}normalizeBulk(e){let t=e.map(r=>this.normalize(r));return new G(t,new v)}},bt=class{constructor(e){this.normalizers=void 0,this.normalizers=e}normalize(e){for(let t=0,r=this.normalizers.length;t<r;t++)e=this.normalizers[t].normalize(e);return e}normalizeBulk(e){let t=new v;for(let r=0,o=this.normalizers.length;r<o;r++){let i=this.normalizers[r].normalizeBulk(e);e=i.strings;for(let s of i.meta.allEntries)t.add(s[0],s[1])}return new G(e,t)}},St=class{normalize(e){return e||""}normalizeBulk(e){let t=e.map(r=>this.normalize(r));return new G(t,new v)}},Tt=class{constructor(e,t){this.normalizeVariationsAndInput=void 0,this.replacements=void 0,this.normalizeVariationsAndInput=t,this.replacements=[];for(let r of e){let o=new Map;for(let[i,s]of r)for(let a of s){let c=t(a);o.set(c,i)}this.replacements.push(o)}}normalize(e){e=this.normalizeVariationsAndInput(e);let t=new Array(e.length),r=0;for(let o=0,i=e.length;o<i;o++)for(let s of this.replacements){let a=s.get(e[o]);if(a!==void 0){t[r++]=a;break}t[r++]=e[o]}return t.join("")}normalizeBulk(e){let t=e.map(r=>this.normalize(r));return new G(t,new v)}},wt=class{static create(e){let t=new St,r=new Tt(e.replacements,s=>s.toLowerCase().normalize("NFKC")),o=new yt(s=>s.normalize("NFKD")),i=new gt(e.treatCharacterAsSpace,e.allowCharacter);return new bt([t,r,o,i])}},ge=class{constructor(e,t){this.index=void 0,this.quality=void 0,this.index=e,this.quality=t}},P=class{constructor(e,t,r){this.matches=void 0,this.query=void 0,this.meta=void 0,this.matches=e,this.query=t,this.meta=r}},Et=class{constructor(e){this.stringSearcher=void 0,this.distinctMapping=void 0,this.sortMapping=void 0,this.stringSearcher=e,this.distinctMapping=new Int32Array(0),this.sortMapping=new Int32Array(0)}index(e){let t=e.map((c,l)=>({term:c,index:l}));t.sort((c,l)=>c.term<l.term?-1:c.term>l.term?1:0),this.sortMapping=new Int32Array(t.length);for(let c=0,l=t.length;c<l;c++)this.sortMapping[c]=t[c].index;let r=[],o=[],i=0,s=null;for(let c=0,l=t.length;c<l;c++){let u=t[c].term;u!=s&&(r[i]=u,o[i]=c,i++),s=u}o[i++]=t.length,this.distinctMapping=V.ToInt32Array(o);let a=this.stringSearcher.index(r);return a.add("numberOfDistinctTerms",r.length),a}getMatches(e){let t=this.stringSearcher.getMatches(e),r=new Array(t.matches.length),o=0;return t.matches.forEach(i=>{let s=this.distinctMapping[i.index+1];for(let a=this.distinctMapping[i.index];a<s;a++)r[o++]=new ge(this.sortMapping[a],i.quality)}),new P(r,e,t.meta)}save(e){e.add(this.distinctMapping),e.add(this.sortMapping),this.stringSearcher.save(e)}load(e){this.distinctMapping=e.get(),this.sortMapping=e.get(),this.stringSearcher.load(e)}},vt=class{constructor(e,t){this.entitySearcher=void 0,this.searcherTypes=void 0,this.entitySearcher=e,this.searcherTypes=t}indexEntities(e,t,r){return this.entitySearcher.indexEntities(e,t,r)}getMatches(e){let t=new xe(this.searcherTypes,e.searchers);if(e.topN>200)return this.entitySearcher.getMatches(e);if(e.string.length<=3&&t.has(T.Prefix)&&t.minQuality(T.Prefix)<2.2){let r=new Y(e.string,e.topN,[new te(2.3)]),o=this.entitySearcher.getMatches(r);if(o.matches.length==e.topN)return new U(o.matches,e,o.meta)}if(e.string.length<=3&&!t.has(T.Prefix)&&t.has(T.Substring)&&t.minQuality(T.Substring)<1.2){let r=new Y(e.string,e.topN,[new ee(1.3)]),o=this.entitySearcher.getMatches(r);if(o.matches.length==e.topN)return new U(o.matches,e,o.meta)}return this.entitySearcher.getMatches(e)}tryGetEntity(e){return this.entitySearcher.tryGetEntity(e)}getEntities(){return this.entitySearcher.getEntities()}tryGetTerms(e){return this.entitySearcher.tryGetTerms(e)}getTerms(){return this.entitySearcher.getTerms()}removeEntity(e){return this.entitySearcher.removeEntity(e)}replaceEntity(e,t,r){return this.entitySearcher.replaceEntity(e,t,r)}save(e){return this.entitySearcher.save(e)}load(e){return this.entitySearcher.load(e)}},Ae=class{constructor(){this.ids=void 0,this.frequencies=void 0,this.ids=[],this.frequencies=[]}addId(e,t){this.ids.push(e),this.frequencies.push(t)}seal(){this.ids=V.ToInt32Array(this.ids),this.frequencies=V.ToInt32Array(this.frequencies)}get length(){return this.ids.length}save(e){e.add(this.ids),e.add(this.frequencies)}load(e){this.ids=e.get(),this.frequencies=e.get()}},ue=class{constructor(){this.ngramToTermIds=void 0,this.ngramToTermIds=new Map}add(e,t,r){let o=this.ngramToTermIds.get(e);o||(o=new Ae,this.ngramToTermIds.set(e,o)),o.addId(t,r)}seal(){for(let e of this.ngramToTermIds.values())e.seal()}getIds(e){return this.ngramToTermIds.get(e)}get size(){return this.ngramToTermIds.size}save(e){e.add(this.ngramToTermIds.size);for(let[t,r]of this.ngramToTermIds)e.add(t),r.save(e)}load(e){let t=e.get();for(let r=0;r<t;r++){let o=e.get(),i=new Ae;i.load(e),this.ngramToTermIds.set(o,i)}}},Mt=class{static ComputeJaccardCoefficient(e,t,r){return r/(e+t-r)}static ComputeOverlapMaxCoefficient(e,t,r){return r/Math.max(e,t)}},Lt=class{constructor(e){this.ngramComputer=void 0,this.invertedIndex=void 0,this.numberOfNgrams=void 0,this.commonNgramCounts=void 0,this.ngramComputer=e,this.invertedIndex=new ue,this.numberOfNgrams=new Int32Array(0),this.commonNgramCounts=new Int32Array(0)}index(e){let t=performance.now();this.invertedIndex=new ue,this.commonNgramCounts=new Int32Array(e.length),this.numberOfNgrams=new Int32Array(e.length);let r=0;for(let s=0,a=e.length;s<a;s++){let c=e[s];if(!this.isValidTerm(c)){this.numberOfNgrams[s]=0,r++;continue}let l=this.ngramComputer.computeNgrams(c);this.numberOfNgrams[s]=l.length;let u=this.getNgramsToFrequency(l);for(let[d,m]of u)this.invertedIndex.add(d,s,m)}this.invertedIndex.seal();let o=Math.round(performance.now()-t),i=new v;return i.add("numberOfInvalidTerms",r),i.add("indexingDurationFuzzySearcher",o),i}isValidTerm(e){return e!=null&&e.trim()!==""}getMatches(e){if(this.invertedIndex.size===0)return new P([],e,new v);let t=this.ngramComputer.computeNgrams(e.string),r=this.getNgramsToFrequency(t),o=t.length;this.computeCommonNgramCounts(r);let i=this.getMatchesFromCommonNgrams(o,e.minQuality);return new P(i,e,new v)}computeCommonNgramCounts(e){this.commonNgramCounts.fill(0);for(let[t,r]of e){let o=this.invertedIndex.getIds(t);if(o!=null)for(let i=0,s=o.length;i<s;i++)this.commonNgramCounts[o.ids[i]]+=Math.min(r,o.frequencies[i])}}getNgramsToFrequency(e){let t=new Map;for(let r=0,o=e.length;r<o;r++){let i=e[r],s=t.get(i);t.set(i,s!==void 0?s+1:1)}return t}getMatchesFromCommonNgrams(e,t){let r=[];for(let o=0,i=this.numberOfNgrams.length;o<i;o++){let s=Mt.ComputeOverlapMaxCoefficient(e,this.numberOfNgrams[o],this.commonNgramCounts[o]);s>t&&r.push(new ge(o,s))}return r}save(e){this.invertedIndex.save(e),e.add(this.numberOfNgrams)}load(e){this.invertedIndex=new ue,this.invertedIndex.load(e),this.numberOfNgrams=e.get(),this.commonNgramCounts=new Int32Array(this.numberOfNgrams.length)}},kt=class{constructor(e,t){this.stringSearcher=void 0,this.penaltyFactor=void 0,this.hashCodes=void 0,this.stringSearcher=e,this.penaltyFactor=1-t,this.hashCodes=new Int32Array(0)}index(e){this.hashCodes=new Int32Array(e.length);for(let t=0,r=e.length;t<r;t++)this.hashCodes[t]=He.getHashCode(e[t]);return this.stringSearcher.index(e)}getMatches(e){let t=He.getHashCode(e.string),r=this.stringSearcher.getMatches(e),o=r.matches.map(i=>this.penalizeMatch(i,t)).filter(i=>i.quality>=e.minQuality);return new P(o,r.query,r.meta)}penalizeMatch(e,t){return e.quality*=this.hashCodes[e.index]===t?1:this.penaltyFactor,e}save(e){e.add(this.hashCodes),this.stringSearcher.save(e)}load(e){this.hashCodes=e.get(),this.stringSearcher.load(e)}},Ht=class{constructor(e,t){this.ngramN=void 0,this.transformNgram=void 0,this.ngramN=e,this.transformNgram=t??(r=>r)}computeNgrams(e){if(e.length===0)return[];if(e.length<=this.ngramN){let r=this.transformNgram(e);return r?[r]:[]}let t=[];for(let r=0,o=this.maximumNumberOfNgrams(e);r<o;r++){let i=this.transformNgram(e.substring(r,r+this.ngramN));i&&t.push(i)}return t}maximumNumberOfNgrams(e){return Math.max(e.length-this.ngramN+1,e.length>0?1:0)}},Ct=class{constructor(e,t,r){this.paddingLeft=void 0,this.paddingRight=void 0,this.paddingMiddle=void 0,this.paddingLeft=e,this.paddingRight=t,this.paddingMiddle=r}normalize(e){return e&&`${this.paddingLeft}${e.split(" ").join(this.paddingMiddle)}${this.paddingRight}`}normalizeBulk(e){let t=e.map(o=>this.normalize(o)),r=new v;return new G(t,r)}},Be=class{};Be.Value=new Map([["a",["\u1D8F","\u2C65","\u0251","\u1D00","\u0250","\u0252"]],["aa",["\xE5","\uA733"]],["ae",["\xE4","\xE6","\u1D01","\u1D2D","\u1D46","\u01FD","\u01E3","\u1D02"]],["ao",["\uA735"]],["au",["\uA737"]],["av",["\uA739","\uA73B"]],["ay",["\uA73D"]],["b",["\u0180","\u0253","\u0183","\u1D6C","\u1D80","\u0299"]],["c",["\u023C","\u0188","\u0255","\u1D04","\uA73F","\u2184"]],["d",["\u0111","\xF0","\u0256","\u0257","\u018C","\u1D6D","\u1D81","\u1D91","\u0221","\u1D05","\uA77A"]],["db",["\u0238"]],["e",["\u1D92","\u0247","\u2C78","\u1D07","\u0259","\u01DD","\u025B"]],["eo",["\u1D14"]],["f",["\u0192","\u1D6E","\u1D82","\uA730","\uA77C"]],["g",["\u01E5","\u0260","\u1D83","\u0262","\u021D","\u014B","\uA7A1","\u1D79","\uA77F"]],["h",["\u0127","\u2C68","\u0266","\u029C","\u0303","\u0267","\u2C76","\u0265"]],["hv",["\u0195"]],["i",["\u0268","\u1D7B","\u1D96","\u0131","\u026A","\u0269"]],["j",["\u0249","\u0237","\u029D","\u025F","\u0284","\u1D0A"]],["k",["\u0199","\u2C6A","\u1D84","\uA741","\u1D0B","\uA743","\uA745","\uA7A3"]],["l",["\u0142","\u019A","\u2C61","\u026B","\u026C","\u1D85","\u026D","\u0234","\u029F","\uA749","\uA781","\uA747"]],["m",["\u1D6F","\u1D86","\u0271","\u1D0D","\u026F"]],["n",["\u0272","\u019E","\u1D70","\u1D87","\u0273","\u0235","\u0274","\uA791","\uA7A5"]],["o",["\xF8","\u01FF","\u0275","\u0254","\u2C7A","\u1D0F","\uA74B","\uA74D"]],["oe",["\xF6","\u0153"]],["oi",["\u01A3"]],["oo",["\uA74F"]],["ou",["\u0223"]],["p",["\u1D7D","\u01A5","\u1D71","\u1D88","\u1D18","\u01BF","\uA751","\uA753","\uA755"]],["q",["\u024B","\u02A0","\uA757","\uA759"]],["qp",["\u0239"]],["r",["\u024D","\u027D","\uA75B","\u1D72","\u1D89","\u027C","\u027E","\u1D73","\u0280","\u0279","\u0281","\uA7A7","\uA783"]],["s",["\u1D74","\u1D8A","\u0282","\u023F","\uA731","\u0283","\uA7A9","\uA785","\u017F"]],["ss",["\xDF"]],["t",["\u0167","\u2C66","\u01AD","\u0288","\u1D75","\u01AB","\u0236","\u1D1B","\uA787"]],["th",["\xFE"]],["tz",["\uA729"]],["u",["\u0289","\u028A","\u1D7E","\u1D1C","\u1D99"]],["ue",["\xFC","\u1D6B"]],["v",["\u028B","\u1D8C","\u2C71","\u2C74","\u1D20","\u028C","\uA75F"]],["vy",["\uA761"]],["w",["\u2C73","\u1D21","\u028D"]],["x",["\u1D8D"]],["y",["\u024F","\u01B4","\u028F","\u1EFF"]],["z",["\u01B6","\u0225","\u2C6C","\u1D76","\u1D8E","\u0290","\u0291","\u0240","\u1D22","\u0292","\u01B9","\uA763"]]]);var Ie=class n{constructor(e,t,r){this.replacements=void 0,this.treatCharacterAsSpace=void 0,this.allowCharacter=void 0,this.replacements=e,this.treatCharacterAsSpace=t,this.allowCharacter=r}static createDefaultConfig(){let e=new Set(["_","-","\u2013","/",","," "]);return new n([Be.Value],t=>e.has(t),t=>Ce.isAlphanumeric(t))}},Re=class{constructor(e,t,r="normalizationDuration"){this.stringSearcher=void 0,this.normalizer=void 0,this.normalizationDurationMetaKey=void 0,this.stringSearcher=e,this.normalizer=t,this.normalizationDurationMetaKey=r}index(e){let t=performance.now(),r=this.normalizer.normalizeBulk(e),o=Math.round(performance.now()-t),i=this.stringSearcher.index(r.strings);i.add(this.normalizationDurationMetaKey,o);for(let s of r.meta.allEntries)i.add(s[0],s[1]);return i}getMatches(e){let t=new pe(this.normalizer.normalize(e.string),e.minQuality,e.searcherType),r=this.stringSearcher.getMatches(t);return new P(r.matches,e,r.meta)}save(e){this.stringSearcher.save(e)}load(e){this.stringSearcher.load(e)}},xt=class{constructor(e){this.suffixArraySearcher=void 0,this.suffixArraySearcher=e}index(e){return this.suffixArraySearcher.index(e)}getMatches(e){if(!e.string)return new P([],e,new v);let t=this.modifyQueryString(e.string),r=new pe(t,e.minQuality,e.searcherType);return this.suffixArraySearcher.getMatches(r,e.string.length)}modifyQueryString(e){return`${this.suffixArraySearcher.separator}${e}`}save(e){this.suffixArraySearcher.save(e)}load(e){this.suffixArraySearcher.load(e)}},At=class{constructor(e,t,r){this.prefixSearcher=void 0,this.substringSearcher=void 0,this.fuzzySearcher=void 0,this.prefixSearcher=e,this.substringSearcher=t,this.fuzzySearcher=r}index(e){let t=[];if(this.prefixSearcher&&!this.substringSearcher){let r=this.prefixSearcher.index(e);t.push(r)}if(this.substringSearcher){let r=this.substringSearcher.index(e);t.push(r)}if(this.fuzzySearcher){let r=this.fuzzySearcher.index(e);t.push(r)}return de.mergeMeta(t)}getMatches(e){if(!e.searcherType)throw new Error("SearcherSwitch requires a searcher type.");switch(e.searcherType){case T.Prefix:if(!this.prefixSearcher)throw new Error("No prefix searcher has been indexed.");return this.prefixSearcher.getMatches(e);case T.Substring:if(!this.substringSearcher)throw new Error("No substring searcher has been indexed.");return this.substringSearcher.getMatches(e);case T.Fuzzy:if(!this.fuzzySearcher)throw new Error("No fuzzy searcher has been indexed.");return this.fuzzySearcher.getMatches(e);default:throw new Error(`Unknown searcher type: ${e.searcherType}`)}}save(e){this.prefixSearcher&&!this.substringSearcher&&this.prefixSearcher.save(e),this.substringSearcher&&this.substringSearcher.save(e),this.fuzzySearcher&&this.fuzzySearcher.save(e)}load(e){this.prefixSearcher&&!this.substringSearcher&&this.prefixSearcher.load(e),this.substringSearcher&&this.substringSearcher.load(e),this.fuzzySearcher&&this.fuzzySearcher.load(e)}};(function(n){n.QualityAndIndex="qualityAndIndex",n.QualityAndMatchedString="qualityAndMatchedString"})(me||(me={}));var Bt=class{constructor(e,t){this.sortOrder=void 0,this.entitySearcher=void 0,this.collator=new Intl.Collator(void 0,{numeric:!0}),this.sortOrder=e,this.entitySearcher=t}indexEntities(e,t,r){return this.entitySearcher.indexEntities(e,t,r)}getMatches(e){let t=this.entitySearcher.getMatches(e);switch(this.sortOrder){case me.QualityAndIndex:return t;case me.QualityAndMatchedString:return this.sortMatchesByQualityAndMatchedString(t.matches),t;default:throw new Error(`Unsupported sort order: ${this.sortOrder}`)}}sortMatchesByQualityAndMatchedString(e){e.sort((t,r)=>t.quality>r.quality?-1:t.quality<r.quality?1:this.collator.compare(t.matchedString,r.matchedString))}tryGetEntity(e){return this.entitySearcher.tryGetEntity(e)}getEntities(){return this.entitySearcher.getEntities()}tryGetTerms(e){return this.entitySearcher.tryGetTerms(e)}getTerms(){return this.entitySearcher.getTerms()}save(e){this.entitySearcher.save(e)}load(e){this.entitySearcher.load(e)}removeEntity(e){return this.entitySearcher.removeEntity(e)}replaceEntity(e,t,r){return this.entitySearcher.replaceEntity(e,t,r)}},It=class{constructor(e){this.stringSearcher=void 0,this.stringSearcher=e}index(e){return this.stringSearcher.index(e)}getMatches(e){let t=this.stringSearcher.getMatches(e);return t.matches.sort(this.compareMatchesByQualityAndIndex),t}compareMatchesByQualityAndIndex(e,t){return e.quality>t.quality?-1:e.quality<t.quality?1:e.index<t.index?-1:e.index>t.index?1:0}save(e){this.stringSearcher.save(e)}load(e){this.stringSearcher.load(e)}},ye=class{static compareOrdinal(e,t,r,o,i){let s=Math.min(t+i,e.length),a=Math.min(o+i,r.length),c=t,l=o;for(;c<s&&l<a;){let m=e.charCodeAt(c),h=r.charCodeAt(l);if(m<h)return-1;if(m>h)return 1;c++,l++}let u=s-t,d=a-o;return u===d?0:u<d?-1:1}},Rt=class n{static create(e){if(e==null)throw new Error("Input string cannot be null.");let t=new n(e);return t.FormInitialChains(),t.BuildSufixArray(),t.sa}constructor(e){this.inputString=void 0,this.eoc=2147483647,this.sa=void 0,this.isa=void 0,this.chainHeadsDict=void 0,this.chainStack=[],this.subChains=[],this.nextRank=1,this.inputString=e;let t=e.length;this.sa=new Int32Array(t),this.isa=new Int32Array(t),this.chainHeadsDict=new Map}FormInitialChains(){this.FindInitialChains(),this.SortAndPushSubchains()}FindInitialChains(){for(let e=0;e<this.inputString.length;e++){let t=this.inputString.charCodeAt(e),r=this.chainHeadsDict.get(t);this.isa[e]=r!==void 0?r:this.eoc,this.chainHeadsDict.set(t,e)}for(let e of this.chainHeadsDict.values()){let t=new Pe(e,1);this.subChains.push(t)}}BuildSufixArray(){for(;this.chainStack.length>0;){let e=this.chainStack.pop();this.isa[e.head]===this.eoc?this.RankSuffix(e.head):this.RefineChainWithInductionSorting(e)}}RankSuffix(e){this.isa[e]=-this.nextRank,this.sa[this.nextRank-1]=e,this.nextRank++}RefineChainWithInductionSorting(e){let t=[];for(this.chainHeadsDict.clear(),this.subChains=[];e.head!==this.eoc;){let r=this.isa[e.head];if(e.head+e.length>this.inputString.length-1)this.RankSuffix(e.head);else if(this.isa[e.head+e.length]<0){let o=new Pt(e.head,-this.isa[e.head+e.length]);t.push(o)}else this.ExtendChain(e);e.head=r}this.SortAndPushSubchains(),this.SortAndRankNotedSuffixes(t)}ExtendChain(e){let t=this.inputString.charCodeAt(e.head+e.length);if(this.chainHeadsDict.has(t))this.isa[this.chainHeadsDict.get(t)]=e.head,this.isa[e.head]=this.eoc;else{this.isa[e.head]=this.eoc;let r=new Pe(e.head,e.length+1);this.subChains.push(r)}this.chainHeadsDict.set(t,e.head)}SortAndRankNotedSuffixes(e){e.sort((t,r)=>t.rank-r.rank);for(let t=0;t<e.length;t++)this.RankSuffix(e[t].head)}SortAndPushSubchains(){this.subChains.sort((e,t)=>{let r=Math.min(e.length,t.length);return ye.compareOrdinal(this.inputString,e.head,this.inputString,t.head,r)});for(let e=this.subChains.length-1;e>=0;e--)this.chainStack.push(this.subChains[e])}},Pt=class{constructor(e,t){this.head=void 0,this.rank=void 0,this.head=e,this.rank=t}},Pe=class{constructor(e,t){this.head=void 0,this.length=void 0,this.head=e,this.length=t}},Dt=class{constructor(e){this.separator=void 0,this.str=void 0,this.suffixArray=void 0,this.indexToTermIndex=void 0,this.termLengths=void 0,this.separator=e,this.str="",this.suffixArray=new Int32Array(0),this.indexToTermIndex=new Int32Array(0),this.termLengths=new Int32Array(0)}index(e){let t=performance.now();this.str=e.length>0?this.separator+e.join(this.separator)+this.separator:"",this.suffixArray=Rt.create(this.str),this.indexToTermIndex=new Int32Array(this.suffixArray.length),this.termLengths=new Int32Array(e.length);let r=0;for(let s=0;s<e.length;s++){this.termLengths[s]=e[s].length;for(let a=0;a<=e[s].length;a++)this.indexToTermIndex[r++]=s}this.indexToTermIndex[r++]=-1;let o=Math.round(performance.now()-t),i=new v;return i.add("indexingDurationSuffixArraySearcher",o),i}getMatches(e,t){if(!e.string)return new P([],e,new v);let[r,o]=this.GetPositionsInSuffixArray(e.string),i=new Int32Array(o-r),s=new Set,a=0;for(let u=r;u<o;u++){let d=this.indexToTermIndex[this.suffixArray[u]];s.has(d)||(s.add(d),i[a++]=d)}let c=[];t=t??e.string.length;let l=0;for(let u=0;u<a;u++)l=this.computeQuality(t,this.termLengths[i[u]]),l>e.minQuality&&c.push(new ge(i[u],l));return new P(c,e,new v)}computeQuality(e,t){return e/t}GetPositionsInSuffixArray(e){let t=0,r=this.suffixArray.length,o=0;for(;t<r;)o=Math.floor((t+r)/2),ye.compareOrdinal(e,0,this.str,this.suffixArray[o],e.length)>0?t=o+1:r=o;let i=t;for(r=this.suffixArray.length;t<r;)o=Math.floor((t+r)/2),ye.compareOrdinal(e,0,this.str,this.suffixArray[o],e.length)==0?t=o+1:r=o;return[i,r]}save(e){e.add(this.str),e.add(this.suffixArray),e.add(this.indexToTermIndex),e.add(this.termLengths)}load(e){this.str=e.get(),this.suffixArray=e.get(),this.indexToTermIndex=e.get(),this.termLengths=e.get()}},De=class{static createSearcher(e){let t=this.createDefaultNormalizer(e),r=this.tryCreateFuzzySearcher(e),o=this.tryCreateSubstringSearcher(e),i=this.tryCreatePrefixSearcher(e,o),s=new At(i,o,r);s=new Et(s),s=new It(s),s=new Re(s,t,"normalizationDurationDefault");let a=new pt(s,e.searcherTypes);return a=new vt(a,e.searcherTypes),a=new Bt(e.sortOrder,a),a}static createDefaultNormalizer(e){let t=new Set;e.fuzzySearchConfig&&(e.fuzzySearchConfig.paddingLeft.split("").forEach(o=>t.add(o)),e.fuzzySearchConfig.paddingRight.split("").forEach(o=>t.add(o)),e.fuzzySearchConfig.paddingMiddle.split("").forEach(o=>t.add(o))),e.substringSearchConfig&&e.substringSearchConfig.suffixArraySeparator.split("").forEach(o=>t.add(o));let r=new Ie(e.normalizerConfig.replacements,e.normalizerConfig.treatCharacterAsSpace,o=>e.normalizerConfig.allowCharacter(o)&&!t.has(o));return wt.create(r)}static tryCreateFuzzySearcher(e){if(!e.searcherTypes.includes(T.Fuzzy))return null;if(e.fuzzySearchConfig===void 0)throw new Error("Unable to create fuzzy searcher: No fuzzy search config provided.");return this.createFuzzySearcher(e.fuzzySearchConfig)}static createFuzzySearcher(e){let t=new Ht(e.ngramN,e.transformNgram),r=new Ct(e.paddingLeft,e.paddingRight,e.paddingMiddle),o=new Lt(t);return o=new kt(o,e.inequalityPenalty),o=new Re(o,r,"normalizationDurationNgrams"),o}static tryCreateSubstringSearcher(e){if(!e.searcherTypes.includes(T.Substring))return null;if(e.substringSearchConfig===void 0)throw new Error("Unable to create substring searcher: No substring search config provided.");return this.createSubstringSearcher(e.substringSearchConfig)}static createSubstringSearcher(e){return new Dt(e.suffixArraySeparator)}static tryCreatePrefixSearcher(e,t){if(!e.searcherTypes.includes(T.Prefix))return null;if(e.substringSearchConfig===void 0)throw new Error("Unable to create prefix searcher: No substring search config provided.");return this.createPrefixSearcher(e.substringSearchConfig,t)}static createPrefixSearcher(e,t){return t===null&&(t=this.createSubstringSearcher(e)),new xt(t)}},Ft=class n{constructor(e,t,r,o,i,s){this.paddingLeft=void 0,this.paddingRight=void 0,this.paddingMiddle=void 0,this.ngramN=void 0,this.transformNgram=void 0,this.inequalityPenalty=void 0,this.paddingLeft=e,this.paddingRight=t,this.paddingMiddle=r,this.ngramN=o,this.transformNgram=i,this.inequalityPenalty=s}static createDefaultConfig(){return new n("$$","!","!$$",3,e=>e.endsWith("$")?null:e.indexOf("$")===-1?e.split("").sort().join(""):e,.05)}};var Nt=class n{constructor(e){this.suffixArraySeparator=void 0,this.suffixArraySeparator=e}static createDefaultConfig(){return new n("$")}},Ot=class n{constructor(e,t,r,o,i,s){this.searcherTypes=void 0,this.maxQueryLength=void 0,this.sortOrder=void 0,this.normalizerConfig=void 0,this.fuzzySearchConfig=void 0,this.substringSearchConfig=void 0,this.searcherTypes=e,this.maxQueryLength=t,this.sortOrder=r,this.normalizerConfig=o,this.fuzzySearchConfig=i,this.substringSearchConfig=s}static createDefaultConfig(){let e=[T.Fuzzy,T.Substring,T.Prefix],t=me.QualityAndMatchedString,r=Ie.createDefaultConfig(),o=Ft.createDefaultConfig(),i=Nt.createDefaultConfig();return new n(e,150,t,r,o,i)}},Fe=class{static createSearcher(e){let t=De.createSearcher(e),r=De.createSearcher(e),o=new dt(e.maxQueryLength,t,r);return o=new mt(o),o}static createDefaultSearcher(){let e=Ot.createDefaultConfig();return this.createSearcher(e)}};function ne(n,e){if(n.length===0)return null;let t=[...n].sort((r,o)=>r.markerViewportHalfOpen1Based.lo-o.markerViewportHalfOpen1Based.lo);for(let r of t){let{lo:o,hiExclusive:i}=r.markerViewportHalfOpen1Based;if(o<=e&&e<i)return r}return null}function _t(n,e){if(n.length===0)return!1;let t=1/0;for(let r of n)t=Math.min(t,r.markerViewportHalfOpen1Based.lo);return e<t}function zt(n,e){if(n.length===0)return null;let t=[...n].sort((i,s)=>i.commentrayLine-s.commentrayLine),r=t[0];if(r===void 0)return null;let o=r;for(let i of t)i.commentrayLine<=e&&(o=i);return o}function $t(n,e,t,r,o){let i=Math.max(0,e-t),s=Math.max(0,r-o);return i<=0?0:Math.min(1,Math.max(0,n/i))*s}function N(n,e,t,r=5){let o=e+r,i=e+t-r;return n<o?{y:o-e,clipped:"above"}:n>i?{y:i-e,clipped:"below"}:{y:n-e,clipped:"none"}}function vo(n,e,t,r,o={}){let{tension:i=.38,clipStart:s="none",clipEnd:a="none"}=o,l=Math.min(.66,i+.24),u=s==="none"?i:l,d=a==="none"?i:l,m=t-n;return[{x:n,y:e},{x:n+m*u,y:e},{x:t-m*d,y:r},{x:t,y:r}]}function qt(n,e,t,r){return`M ${W(n.x)} ${W(n.y)} C ${W(e.x)} ${W(e.y)} ${W(t.x)} ${W(t.y)} ${W(r.x)} ${W(r.y)}`}function Mo(n,e,t,r,o){let i=re(n,e,o),s=re(e,t,o),a=re(t,r,o),c=re(i,s,o),l=re(s,a,o),u=re(c,l,o);return[[n,i,c,u],[u,l,a,r]]}function re(n,e,t){return{x:(1-t)*n.x+t*e.x,y:(1-t)*n.y+t*e.y}}function be(n,e,t,r,o={}){let{tension:i=.38,clipStart:s="none",clipEnd:a="none",splitT:c=.66}=o,l=vo(n,e,t,r,{tension:i,clipStart:s,clipEnd:a}),[u,d,m,h]=l;if(!(s!=="none"||a!=="none"))return{solid:qt(u,d,m,h)};let[p,g]=Mo(u,d,m,h,c),[E,b,y,C]=p,[x,k,H,R]=g;return{solid:qt(E,b,y,C),dotted:qt(x,k,H,R)}}function W(n){return n.toFixed(2)}function Ne(n){return[...n].sort((e,t)=>e.sourceStart-t.sourceStart)}function Cn(n){let e=new Map;for(let t of Ne(n))e.has(t.id)||e.set(t.id,t);return Ne([...e.values()])}function xn(n){return[...n].sort((e,t)=>e.commentrayLine!==t.commentrayLine?e.commentrayLine-t.commentrayLine:e.sourceStart-t.sourceStart)}function An(n,e){let t=xn([...n]),r=t.findIndex(o=>o.id===e.id);if(!(r<0))return t[r+1]}function Bn(n,e){return n.length===0?null:ne(n,e)?.id??null}function In(n,e){if(n.length===0)return null;let t=xn([...n]),r=t[0];if(r===void 0)return null;let o=r;for(let i of t)i.commentrayLine<=e&&(o=i);return o.id}function Wt(n){return Math.max(0,n-1)}var Vt='.commentray-page-break[data-commentray-page-break="true"]';function Oe(n,e){return(n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING)!==0}function Rn(n,e,t){return Array.from(n.querySelectorAll(Vt)).filter(r=>Oe(e,r)&&(t===null||Oe(r,t)))}var Hn=.5;function Lo(n){let e=n.closest(Vt);return!!(e&&!n.isSameNode(e))}function Gt(n,e,t){let r=e.getBoundingClientRect().top+2;for(let o of Array.from(n.querySelectorAll("*"))){if(!(o instanceof HTMLElement)||t!==null&&(o===t||!Oe(o,t))||!Oe(e,o)||Lo(o)||o.matches(Vt))continue;let i=o.getBoundingClientRect();i.width<Hn||i.height<Hn||(r=Math.max(r,i.bottom))}return r}function _e(n,e,t){let r=Rn(n,e,t),o=e.getBoundingClientRect().top+2,i=e;for(let s of r)o=Math.max(o,Gt(n,i,s)),i=s;return t?o=Math.max(o,Gt(n,i,t)):o=Math.max(o,Gt(n,i,null)),o}function Pn(n,e,t){let r=t.getBoundingClientRect().top-3,o=e.getBoundingClientRect().top+4,s=Rn(n,e,t)[0];if(s!==void 0){let c=_e(n,e,s),l=s.getBoundingClientRect().top-2;return Math.min(r,l,Math.max(o,c))}let a=_e(n,e,t);return Math.min(r,Math.max(o,a))}function Dn(n,e){if(n.length===0)return null;let t=null;for(let{line0:r,top:o}of n)o<=e+1+.001&&(t=t===null?r:Math.max(t,r));return t}function D(n){let e=n.trim();if(e==="")return"";try{let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return new TextDecoder("utf-8",{fatal:!1}).decode(r)}catch{return""}}function Fn(n,e){function t(r){let o=n.getAttribute(r);return o!==null&&o.trim()!==""?o:e.getAttribute(r)?.trim()??""}return{rawCodeB64:t("data-raw-code-b64"),rawMdB64:t("data-raw-md-b64")}}function ze(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Nn(n,e){let t=e.map(r=>r.trim()).filter(Boolean);if(t.length===0)return ze(n);try{let r=t.map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),o=new RegExp(`(${r.join("|")})`,"gi");return n.split(o).map((s,a)=>a%2===1?`<mark class="search-hit">${ze(s)}</mark>`:ze(s)).join("")}catch{return ze(n)}}function $e(n,e){let t=e.map(c=>c.trim()).filter(Boolean);if(t.length===0)return[];let r=n.toLowerCase(),o=t.map(c=>c.toLowerCase()),i=[],s=0,a=0;for(;s<n.length&&a<400;){let c=s,l=-1,u=!0;for(let d of o){if(d.length===0)continue;let m=r.indexOf(d,c);if(m<0){u=!1;break}l<0&&(l=m),c=m+d.length}if(!u||l<0)break;i.push({start:l,end:c}),a++,s=l+1}return i}function On(n,e){let t=Math.max(0,Math.min(e,n.length)),r=0;for(let o=0;o<t;o++)n[o]===`
2
2
  `&&r++;return r}function _n(n,e){let t=n.split(`
3
- `);return e<0||e>=t.length?"":t[e]??""}function Se(n){return n.trim().split(/\s+/).filter(Boolean)}function zn(n,e){let t=Se(e);return t.length===0?[...n]:n.filter(r=>{let o=r.sourcePath.replace(/\\/g,"/");return Ge(o,t).length>0})}function $n(n){let e=new Set,t=new Set,r=[],o=0;for(let i of n){let s=i.sourcePath.trim(),a=i.commentrayPath.trim();if(s.length>0){let c=`${s}\0${a}`;e.has(c)||(e.add(c),r.push({kind:"path",line:o++,text:s,spPath:i.sourcePath,crPath:i.commentrayPath}))}a.length>0&&!t.has(a)&&(t.add(a),r.push({kind:"path",line:o++,text:a,spPath:i.sourcePath,crPath:i.commentrayPath}))}return r}var Eo=80;function qn(n,e=Eo){let t=new Map;for(let i of n){let s=i.sourcePath.trim();if(s.length===0)continue;let a=t.get(s),c={sourcePath:i.sourcePath.trim(),commentrayPath:i.commentrayPath.trim()};if(!a){t.set(s,c);continue}c.commentrayPath.localeCompare(a.commentrayPath)<0&&t.set(s,c)}let r=t.size;return{rows:[...t.values()].sort((i,s)=>i.sourcePath.localeCompare(s.sourcePath)).slice(0,e),totalUnique:r}}function k(n){return n.trim().replaceAll("\\","/").replace(/^\.\//,"")}function vo(n){let e=n.indexOf("/browse/");if(e>=0){let r=n.slice(0,e).replace(/\/+$/,"");return r===""?"/":r}let t=n.replace(/\/[^/]*$/,"");return t===""||t==="/"?"/":t.replace(/\/+$/,"")||"/"}var Ut=/^(?:\.\/|\/)?browse\/(.+)\/index\.html$/i,Yt=/^(?:\.\/|\/)?browse\/(.+\.html)$/i;function Mo(n){return Ut.test(n)}function Lo(n){return Yt.test(n)&&!n.toLowerCase().endsWith("/index.html")}function We(n){let e=n.trim();return Mo(e)||Lo(e)}function Q(n,e,t){let r=n.trim();if(r.startsWith("/"))return`${t}${r}`;let o=vo(e),i=Ut.exec(r);if(i?.[1]){let a=i[1],c=o==="/"?`/browse/${a}/index.html`:`${o}/browse/${a}/index.html`;return`${t}${c}`}let s=Yt.exec(r);if(s?.[1]&&!r.toLowerCase().endsWith("/index.html")){let a=o==="/"?`/browse/${s[1]}`:`${o}/browse/${s[1]}`;return`${t}${a}`}return new URL(r,`${t}${e}`).href}function Qt(n,e,t){let r=n.trim();if(r.length===0)return"";let o=Ut.exec(r);if(o?.[1])return`./browse/${o[1]}/index.html`;let i=Yt.exec(r);return i?.[1]&&!r.toLowerCase().endsWith("/index.html")?`./browse/${i[1]}`:Q(r,e,t)}function jt(n,e,t){let r=k(e),o=k(t);if(r.length>0){let i=n.find(s=>k(s.commentrayPath)===r);if(i)return i}if(o.length>0){let i=n.find(s=>k(s.sourcePath)===o);if(i)return i}}function Kt(n,e,t){return k(n.sourcePath)===k(e)&&k(n.commentrayPath)===k(t)}var Jt="commentray.codeCommentrayStatic.colorTheme",Xt=["system","light","dark"];function Gn(n){let e=Xt.indexOf(n),t=(e>=0?e+1:0)%Xt.length;return Xt[t]??"system"}function Ve(n){return n==="light"||n==="dark"||n==="system"?n:"system"}function ko(n){let e=globalThis.document;if(!e)return;let t=e.getElementById("commentray-hljs-light"),r=e.getElementById("commentray-hljs-dark");if(!(!(t instanceof HTMLLinkElement)||!(r instanceof HTMLLinkElement))){if(n==="light"){t.disabled=!1,t.removeAttribute("media"),r.disabled=!0,r.setAttribute("media","(prefers-color-scheme: dark)");return}if(n==="dark"){r.disabled=!1,r.removeAttribute("media"),t.disabled=!0,t.setAttribute("media","(prefers-color-scheme: light)");return}t.disabled=!1,r.disabled=!1,t.media="(prefers-color-scheme: light)",r.media="(prefers-color-scheme: dark)"}}function Zt(n){let e=globalThis.document?.documentElement;e&&(e.dataset.commentrayTheme=n,ko(n))}function Wn(n){let e=n.eps??1.5,{driverDelta:t,partnerBefore:r,partnerAfter:o}=n;return Math.abs(t)<e?!1:t>e&&o<r-e||t<-e&&o>r+e}var Ho=["block-aware-proportional","block-snap-only","filler-blocks"],en="block-aware-proportional";function Vn(n){if(n==null)return en;let e=n.trim();return e.length===0?en:Ho.includes(e)?e:en}function j(n){return Math.max(12,Math.min(48,n*.18))}var K=12,tn=8;function Ue(n,e,t){return Math.max(e,Math.min(t,n))}function Un(n,e){let t=e.getBoundingClientRect(),r=globalThis.innerWidth,o=globalThis.innerHeight,i=n.getBoundingClientRect(),s=i.width>0?i.width:340,a=i.height>0?i.height:160,c=8,l=t.bottom+12+a<=o-c,u=l?Math.max(c,t.bottom+12):Math.max(c,t.top-a-12),d=Ue(t.left,c,r-s-c);n.style.top=`${String(Math.round(u))}px`,n.style.left=`${String(Math.round(d))}px`,n.dataset.side=l?"below":"above";let m=Ue(t.left+t.width/2-d-8,10,s-22);n.style.setProperty("--pointer-left",`${String(Math.round(m))}px`)}function Yn(n,e,t){if(e.replaceChildren(),t.length===0)return;let r=n.getBoundingClientRect(),o=r.left+r.width/2,i=r.top+r.height/2,s=12,a=8,c=12,l=n.dataset.side,u=Number.parseFloat(n.style.getPropertyValue("--pointer-left")),d=Number.isFinite(u)?r.left+u+8:o,m=l==="below"?r.top-a:l==="above"?r.bottom+a:i;for(let[h,f]of t.entries()){let p=f.getBoundingClientRect(),g=p.left+p.width/2,w=p.top+p.height/2,b=g-o,y=w-i,x=Math.abs(b)>=Math.abs(y),C=h-(t.length-1)/2,v,H;t.length===1&&(l==="below"||l==="above")?(v=d,H=m):x?(v=b>=0?r.right+a:r.left-a,H=Ue(w+C*c,r.top+s,r.bottom-s)):(H=y>=0?r.bottom+a:r.top-a,v=Ue(g+C*c,r.left+s,r.right-s));let I=g-v,Z=w-H,ee=Math.hypot(I,Z);if(!Number.isFinite(ee)||ee<12)continue;let F=document.createElement("span");F.className="commentray-wide-intro-arrow",F.style.left=`${String(Math.round(v))}px`,F.style.top=`${String(Math.round(H))}px`,F.style.width=`${String(Math.round(ee))}px`,F.style.setProperty("--wide-intro-arrow-angle",`${String(Math.atan2(Z,I))}rad`);let le=document.createElement("span");le.className="commentray-wide-intro-arrow-head",F.appendChild(le),e.appendChild(F)}}function nn(n,e){let t=e?"#mobile-pane-flip":"#shell",r=n.id.trim().length>0&&typeof globalThis.CSS?.escape=="function"?`#${globalThis.CSS.escape(n.id)}`:"#shell",o=t==="#shell"?r:t;return[{targetSelectors:e?[o]:["#code-pane","#doc-pane"],title:"Welcome",body:"Welcome to commentray, a system to create and view commentaries next to the source tree. Angles are different aspects of these commentaries, so switch between them and keep scrolling while both panes stay aligned."},{targetSelectors:e?[o]:["#code-pane","#doc-pane"],title:"Two views",body:e?"You are in narrow view now. Use the pane flip to switch code and commentary. Wide view shows both panes side by side.":"You are in wide view now. It shows code and commentary side by side. Narrow view uses one pane and a flip control."},{targetSelectors:e?["#mobile-pane-flip","#doc-pane"]:["#code-pane","#doc-pane"],title:e?"Scroll and toggle":"Scroll both panes",body:e?"Try scrolling commentary, then use the pane flip to switch to source and keep exploring.":"Try scrolling in either pane. Source and commentary stay aligned while you read side by side."},{targetSelector:"#search-q",title:"Search quickly",body:"Use this search input to jump to documented source lines and markdown snippets."},{targetSelector:"#angle-select",title:"Angle switch",body:"Change the Commentray angle to view a different narrative for this same source file."},{targetSelector:"#source-markdown-pane-flip",title:"Source view mode",body:"Toggle between raw source and rendered markdown in the source pane."},{targetSelector:"#wrap-lines",title:"Readability controls",body:"Wrap lines to reduce horizontal scrolling in both source and commentary panes.",fallbackActionLabel:"Switch to markdown source",fallbackAction:()=>{let i=document.getElementById("source-markdown-pane-flip");i instanceof HTMLButtonElement&&i.click()}},{targetSelector:"#commentray-theme-trigger",title:"Appearance",body:"Change theme mode from this trigger (menu on left-click, quick cycle on right-click)."},{targetSelector:"#commentray-share-link",title:"Share this view",body:"Use this link button to copy a shareable permalink to the exact page and state you are viewing."},{targetSelector:"#commentray-help-tour",title:"Need a refresher?",body:"You can always go back to this tutorial via the help button."}]}function xo(n,e){let t=n[e];if(!t)return[];let r=Array.isArray(t.targetSelectors)&&t.targetSelectors.length>0?t.targetSelectors:t.targetSelector?[t.targetSelector]:[],o=[],i=new Set;for(let s of r){let a=document.querySelector(s);!(a instanceof HTMLElement)||i.has(a)||(i.add(a),o.push(a))}return o}function Co(n){if(n.hidden)return!1;let e=globalThis.getComputedStyle(n);if(e.display==="none"||e.visibility==="hidden")return!1;let t=n.getBoundingClientRect();return t.width>0&&t.height>0}function Ye(n,e){return xo(n,e).filter(t=>Co(t))}function Qn(){for(let t of Array.from(document.querySelectorAll(".commentray-wide-intro-target")))t instanceof HTMLElement&&t.classList.remove("commentray-wide-intro-target");let n=document.getElementById("commentray-wide-intro");n instanceof HTMLElement&&n.remove();let e=document.getElementById("commentray-wide-intro-arrows");e instanceof HTMLElement&&e.remove()}function jn(){let n=document.createElement("div");n.id="commentray-wide-intro-arrows",n.setAttribute("aria-hidden","true"),document.body.appendChild(n);let e=document.createElement("section");e.id="commentray-wide-intro",e.setAttribute("role","dialog"),e.setAttribute("aria-live","polite"),e.innerHTML=`
3
+ `);return e<0||e>=t.length?"":t[e]??""}function Se(n){return n.trim().split(/\s+/).filter(Boolean)}function zn(n,e){let t=Se(e);return t.length===0?[...n]:n.filter(r=>{let o=r.sourcePath.replace(/\\/g,"/");return $e(o,t).length>0})}function $n(n){let e=new Set,t=new Set,r=[],o=0;for(let i of n){let s=i.sourcePath.trim(),a=i.commentrayPath.trim();if(s.length>0){let c=`${s}\0${a}`;e.has(c)||(e.add(c),r.push({kind:"path",line:o++,text:s,spPath:i.sourcePath,crPath:i.commentrayPath}))}a.length>0&&!t.has(a)&&(t.add(a),r.push({kind:"path",line:o++,text:a,spPath:i.sourcePath,crPath:i.commentrayPath}))}return r}var ko=80;function qn(n,e=ko){let t=new Map;for(let i of n){let s=i.sourcePath.trim();if(s.length===0)continue;let a=t.get(s),c={sourcePath:i.sourcePath.trim(),commentrayPath:i.commentrayPath.trim()};if(!a){t.set(s,c);continue}c.commentrayPath.localeCompare(a.commentrayPath)<0&&t.set(s,c)}let r=t.size;return{rows:[...t.values()].sort((i,s)=>i.sourcePath.localeCompare(s.sourcePath)).slice(0,e),totalUnique:r}}function L(n){return n.trim().replaceAll("\\","/").replace(/^\.\//,"")}function Ho(n){let e=n.indexOf("/browse/");if(e>=0){let r=n.slice(0,e).replace(/\/+$/,"");return r===""?"/":r}let t=n.replace(/\/[^/]*$/,"");return t===""||t==="/"?"/":t.replace(/\/+$/,"")||"/"}var Ut=/^(?:\.\/|\/)?browse\/(.+)\/index\.html$/i,Yt=/^(?:\.\/|\/)?browse\/(.+\.html)$/i;function Co(n){return Ut.test(n)}function xo(n){return Yt.test(n)&&!n.toLowerCase().endsWith("/index.html")}function qe(n){let e=n.trim();return Co(e)||xo(e)}function Q(n,e,t){let r=n.trim();if(r.startsWith("/"))return`${t}${r}`;let o=Ho(e),i=Ut.exec(r);if(i?.[1]){let a=i[1],c=o==="/"?`/browse/${a}/index.html`:`${o}/browse/${a}/index.html`;return`${t}${c}`}let s=Yt.exec(r);if(s?.[1]&&!r.toLowerCase().endsWith("/index.html")){let a=o==="/"?`/browse/${s[1]}`:`${o}/browse/${s[1]}`;return`${t}${a}`}return new URL(r,`${t}${e}`).href}function Qt(n,e,t){let r=n.trim();if(r.length===0)return"";let o=Ut.exec(r);if(o?.[1])return`./browse/${o[1]}/index.html`;let i=Yt.exec(r);return i?.[1]&&!r.toLowerCase().endsWith("/index.html")?`./browse/${i[1]}`:Q(r,e,t)}function Ge(n,e,t){let r=L(e),o=L(t);if(r.length>0){let i=n.find(s=>L(s.commentrayPath)===r);if(i)return i}if(o.length>0){let i=n.find(s=>L(s.sourcePath)===o);if(i)return i}}function jt(n,e,t){return L(n.sourcePath)===L(e)&&L(n.commentrayPath)===L(t)}var Xt="commentray.codeCommentrayStatic.colorTheme",Kt=["system","light","dark"];function Gn(n){let e=Kt.indexOf(n),t=(e>=0?e+1:0)%Kt.length;return Kt[t]??"system"}function We(n){return n==="light"||n==="dark"||n==="system"?n:"system"}function Ao(n){let e=globalThis.document;if(!e)return;let t=e.getElementById("commentray-hljs-light"),r=e.getElementById("commentray-hljs-dark");if(!(!(t instanceof HTMLLinkElement)||!(r instanceof HTMLLinkElement))){if(n==="light"){t.disabled=!1,t.removeAttribute("media"),r.disabled=!0,r.setAttribute("media","(prefers-color-scheme: dark)");return}if(n==="dark"){r.disabled=!1,r.removeAttribute("media"),t.disabled=!0,t.setAttribute("media","(prefers-color-scheme: light)");return}t.disabled=!1,r.disabled=!1,t.media="(prefers-color-scheme: light)",r.media="(prefers-color-scheme: dark)"}}function Jt(n){let e=globalThis.document?.documentElement;e&&(e.dataset.commentrayTheme=n,Ao(n))}function Wn(n){let e=n.eps??1.5,{driverDelta:t,partnerBefore:r,partnerAfter:o}=n;return Math.abs(t)<e?!1:t>e&&o<r-e||t<-e&&o>r+e}var Bo=["block-aware-proportional","block-snap-only","filler-blocks"],Zt="block-aware-proportional";function Vn(n){if(n==null)return Zt;let e=n.trim();return e.length===0?Zt:Bo.includes(e)?e:Zt}function j(n){return Math.max(12,Math.min(48,n*.18))}var K=12,en=8;function Ve(n,e,t){return Math.max(e,Math.min(t,n))}function Un(n,e){let t=e.getBoundingClientRect(),r=globalThis.innerWidth,o=globalThis.innerHeight,i=n.getBoundingClientRect(),s=i.width>0?i.width:340,a=i.height>0?i.height:160,c=8,l=t.bottom+12+a<=o-c,u=l?Math.max(c,t.bottom+12):Math.max(c,t.top-a-12),d=Ve(t.left,c,r-s-c);n.style.top=`${String(Math.round(u))}px`,n.style.left=`${String(Math.round(d))}px`,n.dataset.side=l?"below":"above";let m=Ve(t.left+t.width/2-d-8,10,s-22);n.style.setProperty("--pointer-left",`${String(Math.round(m))}px`)}function Yn(n,e,t){if(e.replaceChildren(),t.length===0)return;let r=n.getBoundingClientRect(),o=r.left+r.width/2,i=r.top+r.height/2,s=12,a=8,c=12,l=n.dataset.side,u=Number.parseFloat(n.style.getPropertyValue("--pointer-left")),d=Number.isFinite(u)?r.left+u+8:o,m=l==="below"?r.top-a:l==="above"?r.bottom+a:i;for(let[h,f]of t.entries()){let p=f.getBoundingClientRect(),g=p.left+p.width/2,E=p.top+p.height/2,b=g-o,y=E-i,C=Math.abs(b)>=Math.abs(y),x=h-(t.length-1)/2,k,H;t.length===1&&(l==="below"||l==="above")?(k=d,H=m):C?(k=b>=0?r.right+a:r.left-a,H=Ve(E+x*c,r.top+s,r.bottom-s)):(H=y>=0?r.bottom+a:r.top-a,k=Ve(g+x*c,r.left+s,r.right-s));let R=g-k,J=E-H,Z=Math.hypot(R,J);if(!Number.isFinite(Z)||Z<12)continue;let F=document.createElement("span");F.className="commentray-wide-intro-arrow",F.style.left=`${String(Math.round(k))}px`,F.style.top=`${String(Math.round(H))}px`,F.style.width=`${String(Math.round(Z))}px`,F.style.setProperty("--wide-intro-arrow-angle",`${String(Math.atan2(J,R))}rad`);let le=document.createElement("span");le.className="commentray-wide-intro-arrow-head",F.appendChild(le),e.appendChild(F)}}function tn(n,e){let t=e?"#mobile-pane-flip":"#shell",r=n.id.trim().length>0&&typeof globalThis.CSS?.escape=="function"?`#${globalThis.CSS.escape(n.id)}`:"#shell",o=t==="#shell"?r:t;return[{targetSelectors:e?[o]:["#code-pane","#doc-pane"],title:"Welcome",body:"Welcome to commentray, a system to create and view commentaries next to the source tree. Angles are different aspects of these commentaries, so switch between them and keep scrolling while both panes stay aligned."},{targetSelectors:e?[o]:["#code-pane","#doc-pane"],title:"Two views",body:e?"You are in narrow view now. Use the pane flip to switch code and commentary. Wide view shows both panes side by side.":"You are in wide view now. It shows code and commentary side by side. Narrow view uses one pane and a flip control."},{targetSelectors:e?["#mobile-pane-flip","#doc-pane"]:["#code-pane","#doc-pane"],title:e?"Scroll and toggle":"Scroll both panes",body:e?"Try scrolling commentary, then use the pane flip to switch to source and keep exploring.":"Try scrolling in either pane. Source and commentary stay aligned while you read side by side."},{targetSelector:"#search-q",title:"Search quickly",body:"Use this search input to jump to documented source lines and markdown snippets."},{targetSelector:"#angle-select",title:"Angle switch",body:"Change the Commentray angle to view a different narrative for this same source file."},{targetSelector:"#source-markdown-pane-flip",title:"Source view mode",body:"Toggle between raw source and rendered markdown in the source pane."},{targetSelector:"#wrap-lines",title:"Readability controls",body:"Wrap lines to reduce horizontal scrolling in both source and commentary panes.",fallbackActionLabel:"Switch to markdown source",fallbackAction:()=>{let i=document.getElementById("source-markdown-pane-flip");i instanceof HTMLButtonElement&&i.click()}},{targetSelector:"#commentray-theme-trigger",title:"Appearance",body:"Change theme mode from this trigger (menu on left-click, quick cycle on right-click)."},{targetSelector:"#commentray-share-link",title:"Share this view",body:"Use this link button to copy a shareable permalink to the exact page and state you are viewing."},{targetSelector:"#commentray-help-tour",title:"Need a refresher?",body:"You can always go back to this tutorial via the help button."}]}function Io(n,e){let t=n[e];if(!t)return[];let r=Array.isArray(t.targetSelectors)&&t.targetSelectors.length>0?t.targetSelectors:t.targetSelector?[t.targetSelector]:[],o=[],i=new Set;for(let s of r){let a=document.querySelector(s);!(a instanceof HTMLElement)||i.has(a)||(i.add(a),o.push(a))}return o}function Ro(n){if(n.hidden)return!1;let e=globalThis.getComputedStyle(n);if(e.display==="none"||e.visibility==="hidden")return!1;let t=n.getBoundingClientRect();return t.width>0&&t.height>0}function Ue(n,e){return Io(n,e).filter(t=>Ro(t))}function Qn(){for(let t of Array.from(document.querySelectorAll(".commentray-wide-intro-target")))t instanceof HTMLElement&&t.classList.remove("commentray-wide-intro-target");let n=document.getElementById("commentray-wide-intro");n instanceof HTMLElement&&n.remove();let e=document.getElementById("commentray-wide-intro-arrows");e instanceof HTMLElement&&e.remove()}function jn(){let n=document.createElement("div");n.id="commentray-wide-intro-arrows",n.setAttribute("aria-hidden","true"),document.body.appendChild(n);let e=document.createElement("section");e.id="commentray-wide-intro",e.setAttribute("role","dialog"),e.setAttribute("aria-live","polite"),e.innerHTML=`
4
4
  <span class="commentray-wide-intro-pointer" aria-hidden="true"></span>
5
5
  <p class="commentray-wide-intro-title"></p>
6
6
  <p class="commentray-wide-intro-body"></p>
@@ -13,14 +13,14 @@
13
13
  <button type="button" data-wide-intro="skip">Skip</button>
14
14
  </div>
15
15
  </div>
16
- `,document.body.appendChild(e);let t=e.querySelector(".commentray-wide-intro-title"),r=e.querySelector(".commentray-wide-intro-body"),o=e.querySelector(".commentray-wide-intro-step-action"),i=e.querySelector(".commentray-wide-intro-progress"),s=e.querySelector('button[data-wide-intro="back"]'),a=e.querySelector('button[data-wide-intro="next"]'),c=e.querySelector('button[data-wide-intro="skip"]');return!(t instanceof HTMLElement)||!(r instanceof HTMLElement)||!(o instanceof HTMLButtonElement)||!(i instanceof HTMLElement)||!(s instanceof HTMLButtonElement)||!(a instanceof HTMLButtonElement)||!(c instanceof HTMLButtonElement)?(n.remove(),e.remove(),null):{bubble:e,arrowLayer:n,titleEl:t,bodyEl:r,stepActionBtn:o,progressEl:i,backBtn:s,nextBtn:a,skipBtn:c}}function D(n,e){try{return n.getItem(e)}catch{return null}}function A(n,e,t){try{n.setItem(e,t)}catch{}}var Kn="commentray.codeCommentrayStatic.wideModeIntro.v1";function Xn(n){let e=n.isNarrowViewport()?"narrow":"wide";e!==n.viewportMode&&(n.viewportMode=e,n.steps=nn(n.shell,e==="narrow"))}function Jn(n){let{bubble:e,arrowLayer:t}=n.elements;Xn(n);let r=Ye(n.steps,n.current),o=r[0];if(!o){e.dataset.side="none",e.style.top="12px",e.style.left="12px",t.replaceChildren();return}Un(e,o),Yn(e,t,r)}function Ao(n){for(Xn(n);n.current<n.steps.length;){let e=n.steps[n.current];if(!e)break;let t=Ye(n.steps,n.current),r=typeof e.fallbackAction=="function";if(t.length>0||r)break;n.current++}}function Bo(n,e,t){let{stepActionBtn:r}=n.elements;if(t.length===0&&typeof e.fallbackAction=="function"&&e.fallbackActionLabel){r.hidden=!1,r.textContent=e.fallbackActionLabel,r.disabled=!1;return}r.hidden=!0,r.textContent="",r.disabled=!0}function Io(n,e){let{titleEl:t,bodyEl:r,progressEl:o,backBtn:i,nextBtn:s}=n.elements;if(Ao(n),n.current>=n.steps.length){e();return}let a=n.steps[n.current];if(!a)return;let c=Ye(n.steps,n.current);for(let l of n.highlighted)l.classList.remove("commentray-wide-intro-target");n.highlighted=c;for(let l of n.highlighted)l.classList.add("commentray-wide-intro-target");t.textContent=a.title,r.textContent=a.body,Bo(n,a,c),o.textContent=`${String(n.current+1)} / ${String(n.steps.length)}`,i.disabled=n.current===0,s.textContent=n.current===n.steps.length-1?"Done":"Next",Jn(n)}function rn(n,e,t){if(!t?.force&&D(localStorage,Kn)==="1")return;Qn();let r=jn();if(!r)return;let o={shell:n,steps:nn(n,e()),viewportMode:e()?"narrow":"wide",current:0,highlighted:[],elements:r,isNarrowViewport:e},{bubble:i,arrowLayer:s,stepActionBtn:a,backBtn:c,nextBtn:l,skipBtn:u}=o.elements,d=()=>{for(let g of o.highlighted)g.classList.remove("commentray-wide-intro-target");o.highlighted=[],s.remove(),i.remove(),globalThis.removeEventListener("resize",f),globalThis.removeEventListener("scroll",m,!0),document.removeEventListener("keydown",p,!0),A(localStorage,Kn,"1")},m=()=>{Jn(o)},h=()=>{Io(o,d)},f=()=>{h()},p=g=>{g.key==="Escape"&&(g.preventDefault(),d())};c.addEventListener("click",()=>{o.current>0&&o.current--,h()}),a.addEventListener("click",()=>{let g=o.steps[o.current];!g||typeof g.fallbackAction!="function"||(g.fallbackAction(),h())}),l.addEventListener("click",()=>{if(o.current>=o.steps.length-1){d();return}o.current++,h()}),u.addEventListener("click",d),globalThis.addEventListener("resize",f),globalThis.addEventListener("scroll",m,!0),document.addEventListener("keydown",p,!0),h()}var Po="__NON_SYNC_TAIL_SLACK__";function Zn(n){return n.reduce((e,t)=>e+t.bufferAbove+t.height+t.bufferBelow,0)}function er(n,e){return n.map(t=>{let r=Te(t.id)?e.get(t.id)??t.height:t.height;return{...t,bufferAbove:t.bufferAbove??0,bufferBelow:Te(t.id)?r-t.height:t.bufferBelow??0,...t.syncRegionContinuationRows!==void 0?{syncRegionContinuationRows:[...t.syncRegionContinuationRows]}:{}}})}function Te(n){return/^R\d+XX$/.test(n)}function tr(n,e){let t=0;for(let o=0;o<e;o++){let i=n[o];i!==void 0&&(t+=i.bufferAbove+i.height+i.bufferBelow)}let r=n[e];return t+(r?.bufferAbove??0)}function nr(n,e){return n.findIndex(t=>t.id===e)}function Ro(n,e,t,r){let o=tr(n,t),i=tr(e,r);if(o===i)return!1;if(o>i){let d=o-i,m=n[t],h=m!==void 0?Math.min(d,m.bufferAbove):0,f=!1;h>0&&m!==void 0&&(m.bufferAbove-=h,f=!0);let p=d-h;if(p>0){let g=e[r];g!==void 0&&(g.bufferAbove+=p,f=!0)}return f}let s=i-o,a=e[r],c=a!==void 0?Math.min(s,a.bufferAbove):0,l=!1;c>0&&a!==void 0&&(a.bufferAbove-=c,l=!0);let u=s-c;if(u>0){let d=n[t];d!==void 0&&(d.bufferAbove+=u,l=!0)}return l}function Do(n,e){let t=new Set;for(let i of n)Te(i.id)&&t.add(i.id);let r=[];for(let i of t){let s=nr(n,i),a=nr(e,i);s>=0&&a>=0&&r.push({id:i,il:s,ir:a})}r.sort((i,s)=>i.il-s.il);let o=r.length+8;for(let i=0;i<o;i++){let s=!1;for(let{il:a,ir:c}of r)Ro(n,e,a,c)&&(s=!0);if(!s)break}}function rr(n){return{id:Po,height:0,bufferAbove:0,bufferBelow:n}}function Fo(n,e){let t=Zn(n),r=Zn(e),o=r-t;if(o>0&&n.length>0){or(n,e,o);return}let i=t-r;i>0&&e.length>0&&or(e,n,i)}function or(n,e,t){if(t<=0)return;let r=n.at(-1);if(r!==void 0&&!Te(r.id)){n[n.length-1]={...r,bufferBelow:r.bufferBelow+t};return}n.push(rr(t)),e.push(rr(0))}function ir(n){return{...n,...n.syncRegionContinuationRows!==void 0?{syncRegionContinuationRows:[...n.syncRegionContinuationRows]}:{}}}function No(n,e){let t=n.map(ir),r=e.map(ir);return Do(t,r),Fo(t,r),{left:t,right:r}}var Qe=class{synchronize(e,t){let r=[...e],o=[...t],i=new Map;for(let a of[...r,...o]){if(!Te(a.id))continue;let c=i.get(a.id)??0;a.height>c&&i.set(a.id,a.height)}let s={left:er(r,i),right:er(o,i)};return No(s.left,s.right)}};var Oo="tbody tr.stretch-row[data-commentray-stretch-sync-id]",on="commentray-mermaid-done",_o=new Qe;function O(n){return!Number.isFinite(n)||n<=0?0:Math.max(0,Math.round(n))}var je=1;function zo(n){let e=n.querySelector(":scope .stretch-doc-inner");if(e===null||e.nodeType!==je)return 0;let t=e,r=t.scrollHeight;if(typeof r=="number"&&r>0)return O(r);let o=O(t.getBoundingClientRect().height);return o>0?o:0}function $o(n){let e=n.querySelector(":scope .stretch-code-stack");if(e===null||e.nodeType!==je)return 0;let t=e,r=t.scrollHeight;if(typeof r=="number"&&r>0)return O(r);let o=O(t.getBoundingClientRect().height);return o>0?o:0}function qo(n){let e=n.querySelectorAll(".code-line");if(e.length===0)return 0;let t=1/0,r=-1/0;for(let i of e){let s=i.getBoundingClientRect();t=Math.min(t,s.top),r=Math.max(r,s.bottom)}if(r<=t||!Number.isFinite(t))return 0;let o=O(r-t);return o>0?o:0}function Go(n){let e=n.querySelector(".stretch-gap-mark");return e===null||e.nodeType!==je?0:O(e.getBoundingClientRect().height)}function sr(n){let e=zo(n);if(e>0)return e;let t=$o(n);if(t>0)return t;let r=n.querySelector(":scope > .stretch-cell-measure");if(r===null||r.nodeType!==je)return O(n.offsetHeight);let o=r,i=qo(o);if(i>0)return i;let s=Go(r);if(s>0)return s;let a=O(o.getBoundingClientRect().height);return a>0?a:O(o.offsetHeight)}function Wo(n){return Array.from(n.querySelectorAll(Oo)).filter(e=>(e.dataset.commentrayStretchSyncId?.trim()??"").length>0)}function Vo(n,e){n.style.paddingBottom="",e.style.paddingBottom="",n.style.paddingTop="",e.style.paddingTop=""}function Uo(n,e,t,r){t.bufferAbove>0&&(n.style.paddingTop=`${String(t.bufferAbove)}px`),r.bufferAbove>0&&(e.style.paddingTop=`${String(r.bufferAbove)}px`),t.bufferBelow>0&&(n.style.paddingBottom=`${String(t.bufferBelow)}px`),r.bufferBelow>0&&(e.style.paddingBottom=`${String(r.bufferBelow)}px`)}function Ke(n){let e=n.querySelectorAll("td"),t=e[0],r=e[1];return t===void 0||r===void 0?null:{codeTd:t,docTd:r}}function Yo(n){for(let e of n){let t=Ke(e);t!==null&&Vo(t.codeTd,t.docTd)}}function Qo(n){let e=[],t=[];for(let r of n){let o=Ke(r);if(o===null)continue;let i=r.dataset.commentrayStretchSyncId?.trim()??"";e.push({id:i,height:sr(o.codeTd),bufferAbove:0,bufferBelow:0}),t.push({id:i,height:sr(o.docTd),bufferAbove:0,bufferBelow:0})}return e.length===0?null:{left:e,right:t}}function jo(n,e){let t=n.length;for(let r=0;r<t;r++){let o=n[r],i=o===void 0?null:Ke(o),s=e.left[r],a=e.right[r];i===null||s===void 0||a===void 0||Uo(i.codeTd,i.docTd,s,a)}}function Ko(n){let e=n.at(-1);if(e===void 0||!e.classList.contains("stretch-row--gap"))return;let t=e===void 0?null:Ke(e);t!==null&&(t.codeTd.style.paddingBottom="",t.docTd.style.paddingBottom="")}function Xo(n){let e=Wo(n);if(e.length===0)return;Yo(e);let t=Qo(e);if(t===null)return;let r=_o.synchronize(t.left,t.right);jo(e,r),Ko(e)}function ar(){globalThis.dispatchEvent(new CustomEvent(on))}function cr(n){let e=0,t,r=()=>{e!==0&&globalThis.cancelAnimationFrame(e),e=globalThis.requestAnimationFrame(()=>{e=0,Xo(n)})},o=()=>{t!==void 0&&globalThis.clearTimeout(t),t=globalThis.setTimeout(()=>{t=void 0,r()},32)},i=new ResizeObserver(()=>{r()});i.observe(n);let s=n.querySelector("tbody"),a=s!==null?new MutationObserver(()=>{o()}):null;a!==null&&s!==null&&a.observe(s,{childList:!0,subtree:!0});let c=()=>{r()};globalThis.addEventListener("resize",c,{passive:!0}),globalThis.visualViewport?.addEventListener("resize",c,{passive:!0});let l=()=>{r()};return globalThis.addEventListener(on,l),queueMicrotask(()=>{r(),globalThis.requestAnimationFrame(()=>{r(),globalThis.requestAnimationFrame(()=>{r()})}),globalThis.setTimeout(()=>{r()},120)}),{disconnect:()=>{e!==0&&globalThis.cancelAnimationFrame(e),t!==void 0&&globalThis.clearTimeout(t),i.disconnect(),a?.disconnect(),globalThis.removeEventListener("resize",c),globalThis.visualViewport?.removeEventListener("resize",c),globalThis.removeEventListener(on,l)}}}var lr="commentray-mermaid-module-ready";function ke(n){let e=globalThis.location.pathname,t=globalThis.location.origin;for(let r of Array.from(n.querySelectorAll("a[href]"))){if(!(r instanceof HTMLAnchorElement))continue;let o=r.getAttribute("href")?.trim()??"";We(o)&&(r.href=Q(o,e,t))}}var Je=new Set,X=new Set,we=null;function Jo(n){let e=new Set;for(let t of n)for(let r of Array.from(t.querySelectorAll("pre.mermaid"))){let o=r.closest(".commentray-mermaid");o!==null&&o.querySelector("svg")!==null||e.add(r)}return Array.from(e)}function Cr(){return we||(we=(async()=>{for(;X.size>0;){let n=globalThis.commentrayMermaid;if(!n){for(let r of X)Je.add(r);X.clear();return}let e=Array.from(X);X.clear();let t=Jo(e);if(t.length!==0)try{await n.run({nodes:t}),ar()}catch(r){console.error("Commentray: mermaid.run failed",r)}}})().finally(()=>{we=null,X.size>0&&Cr()}),we)}function Ar(n){return X.add(n),Cr()}function Zo(){let n=Array.from(Je);Je.clear();for(let e of n)Ar(e)}globalThis.addEventListener(lr,()=>{Zo()});function ce(n){return typeof globalThis.location<"u"&&globalThis.location.protocol==="file:"?Promise.resolve():globalThis.commentrayMermaid?Ar(n):(Je.add(n),Promise.resolve())}function M(n,e,t){return Math.max(e,Math.min(t,n))}function Br(n,e,t){let r=e.getBoundingClientRect(),o=n.getBoundingClientRect();return n.scrollTop+(r.top-o.top)-n.clientTop-t}function ve(n,e){let t=Math.max(0,n.scrollHeight-n.clientHeight),r=M(e,0,t);Math.abs(n.scrollTop-r)<.25||(n.scrollTop=r)}function L(n){if(n.scrollHeight-n.clientHeight<=1)return!1;let t=getComputedStyle(n).overflowY;return t==="auto"||t==="scroll"||t==="overlay"}function q(){let n=document.scrollingElement;return n instanceof HTMLElement?n:document.documentElement}function _(n){return L(n)?n.scrollTop:q().scrollTop}function ei(n,e){if(L(n)){let o=Math.max(0,n.scrollHeight-n.clientHeight);n.scrollTop=M(e,0,o);return}let t=q(),r=Math.max(0,t.scrollHeight-t.clientHeight);t.scrollTop=M(e,0,r)}function Ze(n){let{driverDelta:e,partnerBefore:t,partnerPane:r,axis:o}=n,i=_(r);Wn({driverDelta:e,partnerBefore:t,partnerAfter:i})&&(bn()&&globalThis.console.warn("[commentray:scroll-sync] monotonic.revert",{t:Math.round(performance.now()),axis:o??"?",driverDelta:e,partnerBefore:t,partnerAfter:i}),ei(r,t))}function ie(n){let e=q(),t=Math.max(0,e.scrollHeight-e.clientHeight),r=M(n*t,0,t);Math.abs(e.scrollTop-r)<.25||(e.scrollTop=r)}function yn(n,e,t){if(L(n)){let c=Math.round(Br(n,e,t));ve(n,c);return}let r=q(),o=e.getBoundingClientRect(),i=globalThis.scrollY+o.top-t,s=Math.max(0,r.scrollHeight-r.clientHeight),a=M(i,0,s);Math.abs(r.scrollTop-a)<.25||(r.scrollTop=a)}function Ir(n,e,t){if(L(n)){let o=e.getBoundingClientRect(),i=n.getBoundingClientRect(),s=o.top-i.top-n.clientTop;return Math.abs(s-t)<=tn}let r=e.getBoundingClientRect();return Math.abs(r.top-t)<=tn}function Pr(n,e,t){let r=n.querySelector(`[data-commentray-line="${String(e)}"]`);return r instanceof HTMLElement?Ir(n,r,t):!1}function Rr(n,e,t){let r=n.querySelector(`#${e}${String(t)}`);return r instanceof HTMLElement?r:ro(Oi(e),t)}function ti(n,e,t,r){let o=Rr(n,e,t);return o?Ir(n,o,r):!1}function Dr(n,e,t,r,o){return ti(n,e,t,K)?(S("doc\u2192code.plan",{reason:r,...o,src0:t,lineIdPrefix:e}),{k:"noop",skipProportionalFallbackOnFlip:!0}):null}var Fr=6;function ni(n,e,t){let r=re(n,e);if(r)return r;let o=t.sourceSticky.lockedId;if(o===null)return null;let i=n.find(l=>l.id===o);if(!i)return null;let{lo:s,hiExclusive:a}=i.markerViewportHalfOpen1Based,c=Fr;return e>=s&&e<a+c?i:null}function He(){let n=q(),e=Math.max(0,n.scrollHeight-n.clientHeight);return e>0?M(n.scrollTop/e,0,1):0}var et="commentrayDebugScroll";function ri(){let n=new URLSearchParams(globalThis.location.search).get(et);return n==="1"||n==="true"||n===""}function ur(n){try{let e=n.getItem(et);return e==="1"||e==="true"}catch{return!1}}function oi(){let n=globalThis.location.hash;return n===`#${et}`||n===`#${et}=1`}function ii(){let n=globalThis.location.hostname;return n==="localhost"||n==="127.0.0.1"||n==="0.0.0.0"||n==="::1"}function Nr(){try{return!!(ri()||oi()||ur(globalThis.sessionStorage)||ur(globalThis.localStorage))}catch{return!1}}var si=500,sn=!1,mn=-1/0;function dr(){mn=-1/0}function bn(){let n=performance.now();return n-mn<si||(mn=n,sn=Nr()),sn}typeof globalThis.addEventListener=="function"&&(globalThis.addEventListener("hashchange",dr),globalThis.addEventListener("storage",dr));function ai(){let n=ii(),e=Nr();!n&&!e||globalThis.console.log("[commentray:scroll-sync] boot",{t:Math.round(performance.now()),href:globalThis.location.href,devHost:n,traceVerbose:e})}function S(n,e){bn()&&globalThis.console.log(`[commentray:scroll-sync] ${n}`,{t:Math.round(performance.now()),...e})}function se(n){return n.k==="noop"?n.skipProportionalFallbackOnFlip===!0?"noop(skipFlipFallback)":"noop":n.k==="block"?`block(src0=${String(n.src0)})`:n.k==="mirrorW"?`mirrorW(ratio=${n.ratio.toFixed(4)})`:`mirrorI(docTop=${String(n.docTop)})`}function ae(n){return n.k==="noop"?"noop":n.k==="block"?`block(mdLine0=${String(n.mdLine0)})`:n.k==="mirrorW"?`mirrorW(ratio=${n.ratio.toFixed(4)})`:`mirrorI(codeTop=${String(n.codeTop)})`}function tt(n,e,t,r="code-line-"){if(t.k==="noop")return;let o=globalThis.matchMedia(xe).matches;if(t.k==="block"){let a=Rr(n,r,t.src0);a&&yn(n,a,K);return}if(t.k==="mirrorW"){if(L(n)){let a=Math.max(0,n.scrollHeight-n.clientHeight);ve(n,t.ratio*a),o&&ie(t.ratio)}else ie(t.ratio);return}let i=$t(t.docTop,t.docSH,t.docCH,n.scrollHeight,n.clientHeight);if(L(n)){if(ve(n,i),o){let a=Math.max(1,n.scrollHeight-n.clientHeight);ie(M(i/a,0,1))}return}let s=Math.max(1,n.scrollHeight-n.clientHeight);ie(M(i/s,0,1))}function nt(n,e,t){if(t.k==="noop")return;if(t.k==="block"){let i=e.querySelector(`[data-commentray-line="${String(t.mdLine0)}"]`);i instanceof HTMLElement&&yn(e,i,K);return}if(t.k==="mirrorW"){if(L(e)){let i=Math.max(0,e.scrollHeight-e.clientHeight);ve(e,t.ratio*i)}else ie(t.ratio);return}let r=$t(t.codeTop,t.codeSH,t.codeCH,e.scrollHeight,e.clientHeight);if(L(e)){ve(e,r);return}let o=Math.max(1,e.scrollHeight-e.clientHeight);ie(M(r/o,0,1))}function Or(n,e){let t=e.map(r=>r.id).join("\0");t!==n.linksKey.current&&(n.sourceSticky.lockedId=null,n.commentraySticky.lockedId=null,n.linksKey.current=t)}function ci(n,e,t,r,o,i){if(i===null)return null;let s=zt(e,i),a=s!==null?s.markerViewportHalfOpen1Based.lo-1:null;if(s!==null&&(t.commentraySticky.lockedId=s.id),a===null)return null;let c=Dr(n,r,a,"block-code-anchor-already-aligned-noop",{mdLine0:i,blockId:s?.id??null});if(c)return c;let l={k:"block",src0:a,winRatio:o};return S("doc\u2192code.plan",{reason:"block-from-md-probe",plan:se(l),mdLine0:i,blockId:s?.id??null,markerSpan:s?.markerViewportHalfOpen1Based??null}),l}function li(n,e,t,r,o){let i=Ai(n);if(i===null)return null;let s=Dr(e,t,i,"page-break-pull-code-anchor-already-aligned-noop",{mdLine0:o,pulledSrc0:i});if(s)return s;let a={k:"block",src0:i,winRatio:r};return S("doc\u2192code.plan",{reason:"page-break-pull",plan:se(a),pulledSrc0:i,mdLine0:o}),a}function _r(n,e,t,r,o,i){let s=L(n)?M(n.scrollTop/Math.max(1,n.scrollHeight-n.clientHeight),0,1):He(),a=t();Or(r,a);let c=Sn(n),l=ci(e,a,r,o,s,c);if(l!==null)return l;let u=li(n,e,o,s,c);if(u!==null)return u;if(a.length>0){if(S("doc\u2192code.plan",{reason:i?"indexed-fallback-mirror-no-confident-block":"indexed-noop-no-src0",mdLine0:c,linkCount:a.length,allowProportionalMirror:i}),!i)return{k:"noop"}}else if(!i)return S("doc\u2192code.plan",{reason:"snap-only-no-index-noop",linkCount:0}),{k:"noop"};if(L(n)){let m={k:"mirrorI",docTop:n.scrollTop,docSH:n.scrollHeight,docCH:n.clientHeight};return S("doc\u2192code.plan",{reason:"no-index-mirror-internal",plan:se(m)}),m}let d={k:"mirrorW",ratio:s};return S("doc\u2192code.plan",{reason:"no-index-mirror-window",plan:se(d)}),d}function mr(n,e){return L(n)?{k:"mirrorI",codeTop:n.scrollTop,codeSH:n.scrollHeight,codeCH:n.clientHeight}:{k:"mirrorW",ratio:e}}function ui(n,e,t,r,o,i){let a=[...n].sort((u,d)=>u.markerViewportHalfOpen1Based.lo-d.markerViewportHalfOpen1Based.lo)[0];if(!a)return S("code\u2192doc.plan",{reason:"prelude-missing-first-link",line1:r,lineIdPrefix:o}),{k:"noop"};t.sourceSticky.lockedId=a.id;let c=a.commentrayLine;if(Pr(e,c,K))return S("code\u2192doc.plan",{reason:"prelude-anchor-already-aligned-noop",line1:r,blockId:a.id,mdLine0:c}),{k:"noop"};let l={k:"block",mdLine0:c,winRatio:i};return S("code\u2192doc.plan",{reason:"prelude-first-block",line1:r,blockId:a.id,mdLine0:c,plan:ae(l)}),l}function di(n,e,t,r,o,i){r.sourceSticky.lockedId=n.id;let s=n.commentrayLine,a=e!==null&&e.id===n.id?"strict":"trailing-slack";if(Pr(t,s,K))return S("code\u2192doc.plan",{reason:"active-block-anchor-aligned-noop",line1:o,pickMode:a,blockId:n.id,mdLine0:s}),{k:"noop"};let c={k:"block",mdLine0:s,winRatio:i};return S("code\u2192doc.plan",{reason:"active-block-reveal",line1:o,pickMode:a,blockId:n.id,mdLine0:s,markerSpan:n.markerViewportHalfOpen1Based,plan:ae(c)}),c}function mi(n,e,t){let r=n.sourceSticky.lockedId;if(!r)return;let o=e.find(s=>s.id===r);if(!o){n.sourceSticky.lockedId=null;return}let i=o.markerViewportHalfOpen1Based.hiExclusive;t>=i+Fr&&(n.sourceSticky.lockedId=null)}function zr(n,e,t,r,o,i){let s=He(),a=t();if(Or(o,a),a.length===0){if(!i)return S("code\u2192doc.plan",{reason:"snap-only-no-block-links-noop",lineIdPrefix:r}),{k:"noop"};let m=mr(n,s);return S("code\u2192doc.plan",{reason:m.k==="mirrorI"?"no-block-links-mirror-internal":"no-block-links-mirror-window",lineIdPrefix:r,plan:ae(m)}),m}let c=Xr(n,r);if(_t(a,c))return ui(a,e,o,c,r,s);let l=re(a,c),u=ni(a,c,o);if(u)return di(u,l,e,o,c,s);if(mi(o,a,c),!i)return S("code\u2192doc.plan",{reason:"snap-only-source-gap-noop",line1:c,lineIdPrefix:r,stickyLockAfter:o.sourceSticky.lockedId}),{k:"noop"};let d=mr(n,s);return S("code\u2192doc.plan",{reason:d.k==="mirrorI"?"source-gap-mirror-internal":"source-gap-mirror-window",line1:c,lineIdPrefix:r,stickyLockAfter:o.sourceSticky.lockedId,plan:ae(d)}),d}function hn(n){return L(n)?{k:"mirrorI",docTop:n.scrollTop,docSH:n.scrollHeight,docCH:n.clientHeight}:{k:"mirrorW",ratio:He()}}function fn(n){return L(n)?{k:"mirrorI",codeTop:n.scrollTop,codeSH:n.scrollHeight,codeCH:n.clientHeight}:{k:"mirrorW",ratio:He()}}function B(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function hi(n,e){let t=n.replace(/\s+/g," ").trim();return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function fi(n,e){let t=new Map;for(let r of n){let o=r.kind==="path"?`path:${r.spPath??""}|${r.crPath??""}|${r.text.slice(0,120)}`:`${r.kind}:${r.line}:${r.crPath??""}`,i=t.get(o);(!i||r.score>i.score)&&t.set(o,r)}return[...t.values()].sort((r,o)=>o.score-r.score).slice(0,e)}function an(n,e,t){let r=Ge(n,t),o=new Set,i=[];for(let s of r){let a=On(n,s.start);o.has(a)||(o.add(a),i.push({kind:e,line:a,text:_n(n,a),score:1e3,source:"ordered"}))}return i}function pi(n,e,t){let r=e.trim();if(!r)return[];let o=new Y(r,t,[new fe(.22),new te(0),new ne(0)]),i=n.getMatches(o),s=[];for(let a of i.matches){let c=a.entity;s.push({kind:c.kind,line:c.line,text:c.text,score:100+a.quality,source:"fuzzy",crPath:c.crPath,spPath:c.spPath})}return s}function gi(n,e){if(e.length===0)return[];let t=[];for(let r of n)r.kind!=="path"||Ge(r.text,e).length===0||t.push({kind:"path",line:r.line,text:r.text,score:1e3,source:"ordered",spPath:r.spPath,crPath:r.crPath});return t}function yi(n){let{scope:e,filePathLabel:t,commentrayPathLabel:r,rawCode:o,rawMd:i,searcher:s,queryRaw:a,tokens:c,pathBlobWide:l,pathRowsForOrdering:u}=n,d=(l&&l.trim().length>0?l.trim():[t,r].filter(g=>g.trim().length>0).join(`
17
- `))||"",m=e==="commentray-and-paths"?[]:an(o,"code",c),h=e==="commentray-and-paths"&&u&&u.length>0?gi(u,c):e==="commentray-and-paths"&&d?an(d,"path",c):[],f=an(i,"md",c),p=pi(s,a,60);return fi([...m,...h,...f,...p],80)}function bi(n){return n==="commentray-and-paths"?"Paths + indexed commentray (this page + browse pages when built). Ordered tokens + fuzzy lines.":"Whole source: whitespace tokens in order (may span lines). Per-line fuzzy ranking for typos."}function Si(n,e){if(n.kind==="code")return`Code L${n.line+1}`;if(n.kind==="path")return"Path";let t=n.crPath&&n.crPath!==e.currentCommentrayPath?` \xB7 ${n.crPath}`:"";return`Commentray L${n.line+1}${t}`}function $r(n,e,t){let r=Si(n,t),o=n.source==="ordered"?"ordered":"fuzzy",i=Nn(hi(n.text,320),e),s=B(n.kind==="md"?n.crPath??t.currentCommentrayPath:n.crPath??""),a=B(n.kind==="md"?n.spPath??t.currentSourcePath:n.spPath??"");return`<button type="button" class="hit" data-kind="${n.kind}" data-line="${String(n.line)}" data-cr-path="${s}" data-sp-path="${a}"><span class="meta">${B(r)} <span class="src-tag">(${o})</span></span><div class="snippet">${i}</div></button>`}function Ti(n,e,t,r){if(e.length===0)return'<div class="hint">No matches. Try fewer tokens or looser spelling (fuzzy matches per line).</div>';let o=bi(n),i=[];i.push(`<div class="hint">${o} ${e.length} hit(s).</div>`);for(let s of e)i.push($r(s,t,r));return i.join("")}function cn(n,e,t,r){return n==="full"?"Documented source for this page. Type to search.":r?"Documented source on this page. Type to search the index when it is available.":t>e?`Indexed source files (${String(e)} of ${String(t)} shown). Type to search.`:`Indexed source files (${String(t)}). Type to search.`}function ln(n,e,t){let r=[],o=[`<div class="hint">${B(n)}</div>`],i=e.map((s,a)=>({kind:"path",line:a,text:s.sourcePath,score:1e3,source:"ordered",spPath:s.sourcePath,crPath:s.commentrayPath}));for(let s of i)o.push($r(s,r,t));return o.join("")}function qr(n,e,t){let r=n.querySelector(`#commentray-md-line-${String(e)}`);if(r instanceof HTMLElement){let s=Math.round(Br(n,r,K)),a=Math.round(Math.max(0,n.scrollHeight-n.clientHeight));n.scrollTo({top:M(s,0,a),behavior:"smooth"});return}if(t<=1)return;let o=e/Math.max(1,t-1),i=Math.max(0,n.scrollHeight-n.clientHeight);n.scrollTo({top:o*i,behavior:"smooth"})}function Gr(n,e){if(n.staticBrowseUrl?.trim()){let r=Q(n.staticBrowseUrl.trim(),globalThis.location.pathname,globalThis.location.origin),o=new URL(r);e!==null&&e>=0&&(o.hash=`commentray-md-line-${String(e)}`),globalThis.location.assign(o.toString());return}let t=(n.commentrayOnGithub??"").trim();if(t.length>0){let r=e!==null&&e>=0?`${t}#L${String(e+1)}`:t;globalThis.location.assign(r)}}function wi(n){return{scope:(n.getAttribute("data-search-scope")||"")==="commentray-and-paths"?"commentray-and-paths":"full",filePathLabel:n.getAttribute("data-search-file-path")||"",commentrayPathLabel:n.getAttribute("data-search-commentray-path")||""}}function hr(n,e,t,r,o){let i=t.split(`
16
+ `,document.body.appendChild(e);let t=e.querySelector(".commentray-wide-intro-title"),r=e.querySelector(".commentray-wide-intro-body"),o=e.querySelector(".commentray-wide-intro-step-action"),i=e.querySelector(".commentray-wide-intro-progress"),s=e.querySelector('button[data-wide-intro="back"]'),a=e.querySelector('button[data-wide-intro="next"]'),c=e.querySelector('button[data-wide-intro="skip"]');return!(t instanceof HTMLElement)||!(r instanceof HTMLElement)||!(o instanceof HTMLButtonElement)||!(i instanceof HTMLElement)||!(s instanceof HTMLButtonElement)||!(a instanceof HTMLButtonElement)||!(c instanceof HTMLButtonElement)?(n.remove(),e.remove(),null):{bubble:e,arrowLayer:n,titleEl:t,bodyEl:r,stepActionBtn:o,progressEl:i,backBtn:s,nextBtn:a,skipBtn:c}}function O(n,e){try{return n.getItem(e)}catch{return null}}function I(n,e,t){try{n.setItem(e,t)}catch{}}var Kn="commentray.codeCommentrayStatic.wideModeIntro.v1";function Xn(n){let e=n.isNarrowViewport()?"narrow":"wide";e!==n.viewportMode&&(n.viewportMode=e,n.steps=tn(n.shell,e==="narrow"))}function Jn(n){let{bubble:e,arrowLayer:t}=n.elements;Xn(n);let r=Ue(n.steps,n.current),o=r[0];if(!o){e.dataset.side="none",e.style.top="12px",e.style.left="12px",t.replaceChildren();return}Un(e,o),Yn(e,t,r)}function Po(n){for(Xn(n);n.current<n.steps.length;){let e=n.steps[n.current];if(!e)break;let t=Ue(n.steps,n.current),r=typeof e.fallbackAction=="function";if(t.length>0||r)break;n.current++}}function Do(n,e,t){let{stepActionBtn:r}=n.elements;if(t.length===0&&typeof e.fallbackAction=="function"&&e.fallbackActionLabel){r.hidden=!1,r.textContent=e.fallbackActionLabel,r.disabled=!1;return}r.hidden=!0,r.textContent="",r.disabled=!0}function Fo(n,e){let{titleEl:t,bodyEl:r,progressEl:o,backBtn:i,nextBtn:s}=n.elements;if(Po(n),n.current>=n.steps.length){e();return}let a=n.steps[n.current];if(!a)return;let c=Ue(n.steps,n.current);for(let l of n.highlighted)l.classList.remove("commentray-wide-intro-target");n.highlighted=c;for(let l of n.highlighted)l.classList.add("commentray-wide-intro-target");t.textContent=a.title,r.textContent=a.body,Do(n,a,c),o.textContent=`${String(n.current+1)} / ${String(n.steps.length)}`,i.disabled=n.current===0,s.textContent=n.current===n.steps.length-1?"Done":"Next",Jn(n)}function nn(n,e,t){if(!t?.force&&O(localStorage,Kn)==="1")return;Qn();let r=jn();if(!r)return;let o={shell:n,steps:tn(n,e()),viewportMode:e()?"narrow":"wide",current:0,highlighted:[],elements:r,isNarrowViewport:e},{bubble:i,arrowLayer:s,stepActionBtn:a,backBtn:c,nextBtn:l,skipBtn:u}=o.elements,d=()=>{for(let g of o.highlighted)g.classList.remove("commentray-wide-intro-target");o.highlighted=[],s.remove(),i.remove(),globalThis.removeEventListener("resize",f),globalThis.removeEventListener("scroll",m,!0),document.removeEventListener("keydown",p,!0),I(localStorage,Kn,"1")},m=()=>{Jn(o)},h=()=>{Fo(o,d)},f=()=>{h()},p=g=>{g.key==="Escape"&&(g.preventDefault(),d())};c.addEventListener("click",()=>{o.current>0&&o.current--,h()}),a.addEventListener("click",()=>{let g=o.steps[o.current];!g||typeof g.fallbackAction!="function"||(g.fallbackAction(),h())}),l.addEventListener("click",()=>{if(o.current>=o.steps.length-1){d();return}o.current++,h()}),u.addEventListener("click",d),globalThis.addEventListener("resize",f),globalThis.addEventListener("scroll",m,!0),document.addEventListener("keydown",p,!0),h()}var No="__NON_SYNC_TAIL_SLACK__";function Zn(n){return n.reduce((e,t)=>e+t.bufferAbove+t.height+t.bufferBelow,0)}function er(n,e){return n.map(t=>{let r=Te(t.id)?e.get(t.id)??t.height:t.height;return{...t,bufferAbove:t.bufferAbove??0,bufferBelow:Te(t.id)?r-t.height:t.bufferBelow??0,...t.syncRegionContinuationRows!==void 0?{syncRegionContinuationRows:[...t.syncRegionContinuationRows]}:{}}})}function Te(n){return/^R\d+XX$/.test(n)}function tr(n,e){let t=0;for(let o=0;o<e;o++){let i=n[o];i!==void 0&&(t+=i.bufferAbove+i.height+i.bufferBelow)}let r=n[e];return t+(r?.bufferAbove??0)}function nr(n,e){return n.findIndex(t=>t.id===e)}function Oo(n,e,t,r){let o=tr(n,t),i=tr(e,r);if(o===i)return!1;if(o>i){let d=o-i,m=n[t],h=m!==void 0?Math.min(d,m.bufferAbove):0,f=!1;h>0&&m!==void 0&&(m.bufferAbove-=h,f=!0);let p=d-h;if(p>0){let g=e[r];g!==void 0&&(g.bufferAbove+=p,f=!0)}return f}let s=i-o,a=e[r],c=a!==void 0?Math.min(s,a.bufferAbove):0,l=!1;c>0&&a!==void 0&&(a.bufferAbove-=c,l=!0);let u=s-c;if(u>0){let d=n[t];d!==void 0&&(d.bufferAbove+=u,l=!0)}return l}function _o(n,e){let t=new Set;for(let i of n)Te(i.id)&&t.add(i.id);let r=[];for(let i of t){let s=nr(n,i),a=nr(e,i);s>=0&&a>=0&&r.push({id:i,il:s,ir:a})}r.sort((i,s)=>i.il-s.il);let o=r.length+8;for(let i=0;i<o;i++){let s=!1;for(let{il:a,ir:c}of r)Oo(n,e,a,c)&&(s=!0);if(!s)break}}function rr(n){return{id:No,height:0,bufferAbove:0,bufferBelow:n}}function zo(n,e){let t=Zn(n),r=Zn(e),o=r-t;if(o>0&&n.length>0){or(n,e,o);return}let i=t-r;i>0&&e.length>0&&or(e,n,i)}function or(n,e,t){if(t<=0)return;let r=n.at(-1);if(r!==void 0&&!Te(r.id)){n[n.length-1]={...r,bufferBelow:r.bufferBelow+t};return}n.push(rr(t)),e.push(rr(0))}function ir(n){return{...n,...n.syncRegionContinuationRows!==void 0?{syncRegionContinuationRows:[...n.syncRegionContinuationRows]}:{}}}function $o(n,e){let t=n.map(ir),r=e.map(ir);return _o(t,r),zo(t,r),{left:t,right:r}}var Ye=class{synchronize(e,t){let r=[...e],o=[...t],i=new Map;for(let a of[...r,...o]){if(!Te(a.id))continue;let c=i.get(a.id)??0;a.height>c&&i.set(a.id,a.height)}let s={left:er(r,i),right:er(o,i)};return $o(s.left,s.right)}};var qo="tbody tr.stretch-row[data-commentray-stretch-sync-id]",rn="commentray-mermaid-done",Go=new Ye;function _(n){return!Number.isFinite(n)||n<=0?0:Math.max(0,Math.round(n))}var Qe=1;function Wo(n){let e=n.querySelector(":scope .stretch-doc-inner");if(e===null||e.nodeType!==Qe)return 0;let t=e,r=t.scrollHeight;if(typeof r=="number"&&r>0)return _(r);let o=_(t.getBoundingClientRect().height);return o>0?o:0}function Vo(n){let e=n.querySelector(":scope .stretch-code-stack");if(e===null||e.nodeType!==Qe)return 0;let t=e,r=t.scrollHeight;if(typeof r=="number"&&r>0)return _(r);let o=_(t.getBoundingClientRect().height);return o>0?o:0}function Uo(n){let e=n.querySelectorAll(".code-line");if(e.length===0)return 0;let t=1/0,r=-1/0;for(let i of e){let s=i.getBoundingClientRect();t=Math.min(t,s.top),r=Math.max(r,s.bottom)}if(r<=t||!Number.isFinite(t))return 0;let o=_(r-t);return o>0?o:0}function Yo(n){let e=n.querySelector(".stretch-gap-mark");return e===null||e.nodeType!==Qe?0:_(e.getBoundingClientRect().height)}function sr(n){let e=Wo(n);if(e>0)return e;let t=Vo(n);if(t>0)return t;let r=n.querySelector(":scope > .stretch-cell-measure");if(r===null||r.nodeType!==Qe)return _(n.offsetHeight);let o=r,i=Uo(o);if(i>0)return i;let s=Yo(r);if(s>0)return s;let a=_(o.getBoundingClientRect().height);return a>0?a:_(o.offsetHeight)}function Qo(n){return Array.from(n.querySelectorAll(qo)).filter(e=>(e.dataset.commentrayStretchSyncId?.trim()??"").length>0)}function jo(n,e){n.style.paddingBottom="",e.style.paddingBottom="",n.style.paddingTop="",e.style.paddingTop=""}function Ko(n,e,t,r){t.bufferAbove>0&&(n.style.paddingTop=`${String(t.bufferAbove)}px`),r.bufferAbove>0&&(e.style.paddingTop=`${String(r.bufferAbove)}px`),t.bufferBelow>0&&(n.style.paddingBottom=`${String(t.bufferBelow)}px`),r.bufferBelow>0&&(e.style.paddingBottom=`${String(r.bufferBelow)}px`)}function je(n){let e=n.querySelectorAll("td"),t=e[0],r=e[1];return t===void 0||r===void 0?null:{codeTd:t,docTd:r}}function Xo(n){for(let e of n){let t=je(e);t!==null&&jo(t.codeTd,t.docTd)}}function Jo(n,e){let o=(n[0]?.closest("table")??null)?.closest("[data-dual-mobile-pane]")??null;if(o===null)return e();let i=o.getAttribute("data-dual-mobile-pane");o.removeAttribute("data-dual-mobile-pane");try{return e()}finally{i!==null&&o.setAttribute("data-dual-mobile-pane",i)}}function Zo(n){let e=[],t=[];for(let r of n){let o=je(r);if(o===null)continue;let i=r.dataset.commentrayStretchSyncId?.trim()??"";e.push({id:i,height:sr(o.codeTd),bufferAbove:0,bufferBelow:0}),t.push({id:i,height:sr(o.docTd),bufferAbove:0,bufferBelow:0})}return e.length===0?null:{left:e,right:t}}function ei(n,e){let t=n.length;for(let r=0;r<t;r++){let o=n[r],i=o===void 0?null:je(o),s=e.left[r],a=e.right[r];i===null||s===void 0||a===void 0||Ko(i.codeTd,i.docTd,s,a)}}function ti(n){let e=n.at(-1);if(e===void 0||!e.classList.contains("stretch-row--gap"))return;let t=e===void 0?null:je(e);t!==null&&(t.codeTd.style.paddingBottom="",t.docTd.style.paddingBottom="")}function on(n){let e=Qo(n);if(e.length===0)return;Xo(e);let t=Jo(e,()=>Zo(e));if(t===null)return;let r=Go.synchronize(t.left,t.right);ei(e,r),ti(e)}function ar(){globalThis.dispatchEvent(new CustomEvent(rn))}function cr(n){let e=0,t,r=()=>{e!==0&&globalThis.cancelAnimationFrame(e),e=globalThis.requestAnimationFrame(()=>{e=0,on(n)})},o=()=>{t!==void 0&&globalThis.clearTimeout(t),t=globalThis.setTimeout(()=>{t=void 0,r()},32)},i=new ResizeObserver(()=>{r()});i.observe(n);let s=n.querySelector("tbody"),a=s!==null?new MutationObserver(()=>{o()}):null;a!==null&&s!==null&&a.observe(s,{childList:!0,subtree:!0});let c=()=>{r()};globalThis.addEventListener("resize",c,{passive:!0}),globalThis.visualViewport?.addEventListener("resize",c,{passive:!0});let l=()=>{r()};return globalThis.addEventListener(rn,l),queueMicrotask(()=>{r(),globalThis.requestAnimationFrame(()=>{r(),globalThis.requestAnimationFrame(()=>{r()})}),globalThis.setTimeout(()=>{r()},120)}),{disconnect:()=>{e!==0&&globalThis.cancelAnimationFrame(e),t!==void 0&&globalThis.clearTimeout(t),i.disconnect(),a?.disconnect(),globalThis.removeEventListener("resize",c),globalThis.visualViewport?.removeEventListener("resize",c),globalThis.removeEventListener(rn,l)}}}var lr="commentray-mermaid-module-ready";function Le(n){let e=globalThis.location.pathname,t=globalThis.location.origin;for(let r of Array.from(n.querySelectorAll("a[href]"))){if(!(r instanceof HTMLAnchorElement))continue;let o=r.getAttribute("href")?.trim()??"";qe(o)&&(r.href=Q(o,e,t))}}var Xe=new Set,X=new Set,we=null;function ni(n){let e=new Set;for(let t of n)for(let r of Array.from(t.querySelectorAll("pre.mermaid"))){let o=r.closest(".commentray-mermaid");o!==null&&o.querySelector("svg")!==null||e.add(r)}return Array.from(e)}function Ar(){return we||(we=(async()=>{for(;X.size>0;){let n=globalThis.commentrayMermaid;if(!n){for(let r of X)Xe.add(r);X.clear();return}let e=Array.from(X);X.clear();let t=ni(e);if(t.length!==0)try{await n.run({nodes:t}),ar()}catch(r){console.error("Commentray: mermaid.run failed",r)}}})().finally(()=>{we=null,X.size>0&&Ar()}),we)}function Br(n){return X.add(n),Ar()}function ri(){let n=Array.from(Xe);Xe.clear();for(let e of n)Br(e)}globalThis.addEventListener(lr,()=>{ri()});function ce(n){return typeof globalThis.location<"u"&&globalThis.location.protocol==="file:"?Promise.resolve():globalThis.commentrayMermaid?Br(n):(Xe.add(n),Promise.resolve())}function w(n,e,t){return Math.max(e,Math.min(t,n))}function oi(n,e,t){let r=e.getBoundingClientRect(),o=n.getBoundingClientRect();return n.scrollTop+(r.top-o.top)-n.clientTop-t}function ve(n,e){let t=Math.max(0,n.scrollHeight-n.clientHeight),r=w(e,0,t);Math.abs(n.scrollTop-r)<.25||(n.scrollTop=r)}function M(n){if(n.scrollHeight-n.clientHeight<=1)return!1;let t=getComputedStyle(n).overflowY;return t==="auto"||t==="scroll"||t==="overlay"}function A(){let n=document.scrollingElement;return n instanceof HTMLElement?n:document.documentElement}function z(n){return M(n)?n.scrollTop:A().scrollTop}function ii(n,e){if(M(n)){let o=Math.max(0,n.scrollHeight-n.clientHeight);n.scrollTop=w(e,0,o);return}let t=A(),r=Math.max(0,t.scrollHeight-t.clientHeight);t.scrollTop=w(e,0,r)}function Je(n){let{driverDelta:e,partnerBefore:t,partnerPane:r,axis:o}=n,i=z(r);Wn({driverDelta:e,partnerBefore:t,partnerAfter:i})&&(bn()&&globalThis.console.warn("[commentray:scroll-sync] monotonic.revert",{t:Math.round(performance.now()),axis:o??"?",driverDelta:e,partnerBefore:t,partnerAfter:i}),ii(r,t))}function oe(n){let e=A(),t=Math.max(0,e.scrollHeight-e.clientHeight),r=w(n*t,0,t);Math.abs(e.scrollTop-r)<.25||(e.scrollTop=r)}function ot(n,e,t){if(M(n)){let c=Math.round(oi(n,e,t));ve(n,c);return}let r=A(),o=e.getBoundingClientRect(),i=globalThis.scrollY+o.top-t,s=Math.max(0,r.scrollHeight-r.clientHeight),a=w(i,0,s);Math.abs(r.scrollTop-a)<.25||(r.scrollTop=a)}function Ir(n,e,t){if(M(n)){let o=e.getBoundingClientRect(),i=n.getBoundingClientRect(),s=o.top-i.top-n.clientTop;return Math.abs(s-t)<=en}let r=e.getBoundingClientRect();return Math.abs(r.top-t)<=en}function Rr(n,e,t){let r=n.querySelector(`[data-commentray-line="${String(e)}"]`);return r instanceof HTMLElement?Ir(n,r,t):!1}function Pr(n,e,t){let r=n.querySelector(`#${e}${String(t)}`);return r instanceof HTMLElement?r:ro(Gi(e),t)}function si(n,e,t,r){let o=Pr(n,e,t);return o?Ir(n,o,r):!1}function Dr(n,e,t,r,o){return si(n,e,t,K)?(S("doc\u2192code.plan",{reason:r,...o,src0:t,lineIdPrefix:e}),{k:"noop",skipProportionalFallbackOnFlip:!0}):null}var Fr=6;function ai(n,e,t){let r=ne(n,e);if(r)return r;let o=t.sourceSticky.lockedId;if(o===null)return null;let i=n.find(l=>l.id===o);if(!i)return null;let{lo:s,hiExclusive:a}=i.markerViewportHalfOpen1Based,c=Fr;return e>=s&&e<a+c?i:null}function ke(){let n=A(),e=Math.max(0,n.scrollHeight-n.clientHeight);return e>0?w(n.scrollTop/e,0,1):0}var Ze="commentrayDebugScroll";function ci(){let n=new URLSearchParams(globalThis.location.search).get(Ze);return n==="1"||n==="true"||n===""}function ur(n){try{let e=n.getItem(Ze);return e==="1"||e==="true"}catch{return!1}}function li(){let n=globalThis.location.hash;return n===`#${Ze}`||n===`#${Ze}=1`}function ui(){let n=globalThis.location.hostname;return n==="localhost"||n==="127.0.0.1"||n==="0.0.0.0"||n==="::1"}function Nr(){try{return!!(ci()||li()||ur(globalThis.sessionStorage)||ur(globalThis.localStorage))}catch{return!1}}var di=500,sn=!1,mn=-1/0;function dr(){mn=-1/0}function bn(){let n=performance.now();return n-mn<di||(mn=n,sn=Nr()),sn}typeof globalThis.addEventListener=="function"&&(globalThis.addEventListener("hashchange",dr),globalThis.addEventListener("storage",dr));function mi(){let n=ui(),e=Nr();!n&&!e||globalThis.console.log("[commentray:scroll-sync] boot",{t:Math.round(performance.now()),href:globalThis.location.href,devHost:n,traceVerbose:e})}function S(n,e){bn()&&globalThis.console.log(`[commentray:scroll-sync] ${n}`,{t:Math.round(performance.now()),...e})}function ie(n){return n.k==="noop"?n.skipProportionalFallbackOnFlip===!0?"noop(skipFlipFallback)":"noop":n.k==="block"?`block(src0=${String(n.src0)})`:n.k==="mirrorW"?`mirrorW(ratio=${n.ratio.toFixed(4)})`:`mirrorI(docTop=${String(n.docTop)})`}function se(n){return n.k==="noop"?"noop":n.k==="block"?`block(mdLine0=${String(n.mdLine0)})`:n.k==="mirrorW"?`mirrorW(ratio=${n.ratio.toFixed(4)})`:`mirrorI(codeTop=${String(n.codeTop)})`}function et(n,e,t,r="code-line-"){if(t.k==="noop")return;let o=globalThis.matchMedia(it).matches;if(t.k==="block"){let a=Pr(n,r,t.src0);a&&ot(n,a,K);return}if(t.k==="mirrorW"){if(M(n)){let a=Math.max(0,n.scrollHeight-n.clientHeight);ve(n,t.ratio*a),o&&oe(t.ratio)}else oe(t.ratio);return}let i=$t(t.docTop,t.docSH,t.docCH,n.scrollHeight,n.clientHeight);if(M(n)){if(ve(n,i),o){let a=Math.max(1,n.scrollHeight-n.clientHeight);oe(w(i/a,0,1))}return}let s=Math.max(1,n.scrollHeight-n.clientHeight);oe(w(i/s,0,1))}function tt(n,e,t){if(t.k==="noop")return;if(t.k==="block"){let i=e.querySelector(`[data-commentray-line="${String(t.mdLine0)}"]`);i instanceof HTMLElement&&ot(e,i,K);return}if(t.k==="mirrorW"){if(M(e)){let i=Math.max(0,e.scrollHeight-e.clientHeight);ve(e,t.ratio*i)}else oe(t.ratio);return}let r=$t(t.codeTop,t.codeSH,t.codeCH,e.scrollHeight,e.clientHeight);if(M(e)){ve(e,r);return}let o=Math.max(1,e.scrollHeight-e.clientHeight);oe(w(r/o,0,1))}function Or(n,e){let t=e.map(r=>r.id).join("\0");t!==n.linksKey.current&&(n.sourceSticky.lockedId=null,n.commentraySticky.lockedId=null,n.linksKey.current=t)}function hi(n,e,t,r,o,i){if(i===null)return null;let s=zt(e,i),a=s!==null?s.markerViewportHalfOpen1Based.lo-1:null;if(s!==null&&(t.commentraySticky.lockedId=s.id),a===null)return null;let c=Dr(n,r,a,"block-code-anchor-already-aligned-noop",{mdLine0:i,blockId:s?.id??null});if(c)return c;let l={k:"block",src0:a,winRatio:o};return S("doc\u2192code.plan",{reason:"block-from-md-probe",plan:ie(l),mdLine0:i,blockId:s?.id??null,markerSpan:s?.markerViewportHalfOpen1Based??null}),l}function fi(n,e,t,r,o){let i=Di(n);if(i===null)return null;let s=Dr(e,t,i,"page-break-pull-code-anchor-already-aligned-noop",{mdLine0:o,pulledSrc0:i});if(s)return s;let a={k:"block",src0:i,winRatio:r};return S("doc\u2192code.plan",{reason:"page-break-pull",plan:ie(a),pulledSrc0:i,mdLine0:o}),a}function _r(n,e,t,r,o,i){let s=M(n)?w(n.scrollTop/Math.max(1,n.scrollHeight-n.clientHeight),0,1):ke(),a=t();Or(r,a);let c=Sn(n),l=hi(e,a,r,o,s,c);if(l!==null)return l;let u=fi(n,e,o,s,c);if(u!==null)return u;if(a.length>0){if(S("doc\u2192code.plan",{reason:i?"indexed-fallback-mirror-no-confident-block":"indexed-noop-no-src0",mdLine0:c,linkCount:a.length,allowProportionalMirror:i}),!i)return{k:"noop"}}else if(!i)return S("doc\u2192code.plan",{reason:"snap-only-no-index-noop",linkCount:0}),{k:"noop"};if(M(n)){let m={k:"mirrorI",docTop:n.scrollTop,docSH:n.scrollHeight,docCH:n.clientHeight};return S("doc\u2192code.plan",{reason:"no-index-mirror-internal",plan:ie(m)}),m}let d={k:"mirrorW",ratio:s};return S("doc\u2192code.plan",{reason:"no-index-mirror-window",plan:ie(d)}),d}function mr(n,e){return M(n)?{k:"mirrorI",codeTop:n.scrollTop,codeSH:n.scrollHeight,codeCH:n.clientHeight}:{k:"mirrorW",ratio:e}}function pi(n,e,t,r,o,i){let a=[...n].sort((u,d)=>u.markerViewportHalfOpen1Based.lo-d.markerViewportHalfOpen1Based.lo)[0];if(!a)return S("code\u2192doc.plan",{reason:"prelude-missing-first-link",line1:r,lineIdPrefix:o}),{k:"noop"};t.sourceSticky.lockedId=a.id;let c=a.commentrayLine;if(Rr(e,c,K))return S("code\u2192doc.plan",{reason:"prelude-anchor-already-aligned-noop",line1:r,blockId:a.id,mdLine0:c}),{k:"noop"};let l={k:"block",mdLine0:c,winRatio:i};return S("code\u2192doc.plan",{reason:"prelude-first-block",line1:r,blockId:a.id,mdLine0:c,plan:se(l)}),l}function gi(n,e,t,r,o,i){r.sourceSticky.lockedId=n.id;let s=n.commentrayLine,a=e!==null&&e.id===n.id?"strict":"trailing-slack";if(Rr(t,s,K))return S("code\u2192doc.plan",{reason:"active-block-anchor-aligned-noop",line1:o,pickMode:a,blockId:n.id,mdLine0:s}),{k:"noop"};let c={k:"block",mdLine0:s,winRatio:i};return S("code\u2192doc.plan",{reason:"active-block-reveal",line1:o,pickMode:a,blockId:n.id,mdLine0:s,markerSpan:n.markerViewportHalfOpen1Based,plan:se(c)}),c}function yi(n,e,t){let r=n.sourceSticky.lockedId;if(!r)return;let o=e.find(s=>s.id===r);if(!o){n.sourceSticky.lockedId=null;return}let i=o.markerViewportHalfOpen1Based.hiExclusive;t>=i+Fr&&(n.sourceSticky.lockedId=null)}function zr(n,e,t,r,o,i){let s=ke(),a=t();if(Or(o,a),a.length===0){if(!i)return S("code\u2192doc.plan",{reason:"snap-only-no-block-links-noop",lineIdPrefix:r}),{k:"noop"};let m=mr(n,s);return S("code\u2192doc.plan",{reason:m.k==="mirrorI"?"no-block-links-mirror-internal":"no-block-links-mirror-window",lineIdPrefix:r,plan:se(m)}),m}let c=Xr(n,r);if(_t(a,c))return pi(a,e,o,c,r,s);let l=ne(a,c),u=ai(a,c,o);if(u)return gi(u,l,e,o,c,s);if(yi(o,a,c),!i)return S("code\u2192doc.plan",{reason:"snap-only-source-gap-noop",line1:c,lineIdPrefix:r,stickyLockAfter:o.sourceSticky.lockedId}),{k:"noop"};let d=mr(n,s);return S("code\u2192doc.plan",{reason:d.k==="mirrorI"?"source-gap-mirror-internal":"source-gap-mirror-window",line1:c,lineIdPrefix:r,stickyLockAfter:o.sourceSticky.lockedId,plan:se(d)}),d}function hn(n){return M(n)?{k:"mirrorI",docTop:n.scrollTop,docSH:n.scrollHeight,docCH:n.clientHeight}:{k:"mirrorW",ratio:ke()}}function fn(n){return M(n)?{k:"mirrorI",codeTop:n.scrollTop,codeSH:n.scrollHeight,codeCH:n.clientHeight}:{k:"mirrorW",ratio:ke()}}function B(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function bi(n,e){let t=n.replace(/\s+/g," ").trim();return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function Si(n,e){let t=new Map;for(let r of n){let o=r.kind==="path"?`path:${r.spPath??""}|${r.crPath??""}|${r.text.slice(0,120)}`:`${r.kind}:${r.line}:${r.crPath??""}`,i=t.get(o);(!i||r.score>i.score)&&t.set(o,r)}return[...t.values()].sort((r,o)=>o.score-r.score).slice(0,e)}function an(n,e,t){let r=$e(n,t),o=new Set,i=[];for(let s of r){let a=On(n,s.start);o.has(a)||(o.add(a),i.push({kind:e,line:a,text:_n(n,a),score:1e3,source:"ordered"}))}return i}function Ti(n,e,t){let r=e.trim();if(!r)return[];let o=new Y(r,t,[new fe(.22),new ee(0),new te(0)]),i=n.getMatches(o),s=[];for(let a of i.matches){let c=a.entity;s.push({kind:c.kind,line:c.line,text:c.text,score:100+a.quality,source:"fuzzy",crPath:c.crPath,spPath:c.spPath})}return s}function wi(n,e){if(e.length===0)return[];let t=[];for(let r of n)r.kind!=="path"||$e(r.text,e).length===0||t.push({kind:"path",line:r.line,text:r.text,score:1e3,source:"ordered",spPath:r.spPath,crPath:r.crPath});return t}function Ei(n){let{scope:e,filePathLabel:t,commentrayPathLabel:r,rawCode:o,rawMd:i,searcher:s,queryRaw:a,tokens:c,pathBlobWide:l,pathRowsForOrdering:u}=n,d=(l&&l.trim().length>0?l.trim():[t,r].filter(g=>g.trim().length>0).join(`
17
+ `))||"",m=e==="commentray-and-paths"?[]:an(o,"code",c),h=e==="commentray-and-paths"&&u&&u.length>0?wi(u,c):e==="commentray-and-paths"&&d?an(d,"path",c):[],f=an(i,"md",c),p=Ti(s,a,60);return Si([...m,...h,...f,...p],80)}function vi(n){return n==="commentray-and-paths"?"Paths + indexed commentray (this page + browse pages when built). Ordered tokens + fuzzy lines.":"Whole source: whitespace tokens in order (may span lines). Per-line fuzzy ranking for typos."}function Mi(n,e){if(n.kind==="code")return`Code L${n.line+1}`;if(n.kind==="path")return"Path";let t=n.crPath&&n.crPath!==e.currentCommentrayPath?` \xB7 ${n.crPath}`:"";return`Commentray L${n.line+1}${t}`}function $r(n,e,t){let r=Mi(n,t),o=n.source==="ordered"?"ordered":"fuzzy",i=Nn(bi(n.text,320),e),s=B(n.kind==="md"?n.crPath??t.currentCommentrayPath:n.crPath??""),a=B(n.kind==="md"?n.spPath??t.currentSourcePath:n.spPath??"");return`<button type="button" class="hit" data-kind="${n.kind}" data-line="${String(n.line)}" data-cr-path="${s}" data-sp-path="${a}"><span class="meta">${B(r)} <span class="src-tag">(${o})</span></span><div class="snippet">${i}</div></button>`}function Li(n,e,t,r){if(e.length===0)return'<div class="hint">No matches. Try fewer tokens or looser spelling (fuzzy matches per line).</div>';let o=vi(n),i=[];i.push(`<div class="hint">${o} ${e.length} hit(s).</div>`);for(let s of e)i.push($r(s,t,r));return i.join("")}function cn(n,e,t,r){return n==="full"?"Documented source for this page. Type to search.":r?"Documented source on this page. Type to search the index when it is available.":t>e?`Indexed source files (${String(e)} of ${String(t)} shown). Type to search.`:`Indexed source files (${String(t)}). Type to search.`}function ln(n,e,t){let r=[],o=[`<div class="hint">${B(n)}</div>`],i=e.map((s,a)=>({kind:"path",line:a,text:s.sourcePath,score:1e3,source:"ordered",spPath:s.sourcePath,crPath:s.commentrayPath}));for(let s of i)o.push($r(s,r,t));return o.join("")}function qr(n,e,t){let r=n.querySelector(`#commentray-md-line-${String(e)}`);if(r instanceof HTMLElement){ot(n,r,K);return}if(t<=1)return;let o=w(e,0,Math.max(0,t-1)),i=M(n)?n:A(),s=Math.max(0,i.scrollHeight-i.clientHeight),a=w(o/Math.max(1,t-1)*s,0,s);i.scrollTo({top:a,behavior:"smooth"})}function Gr(n,e){if(n.staticBrowseUrl?.trim()){let r=Q(n.staticBrowseUrl.trim(),globalThis.location.pathname,globalThis.location.origin),o=new URL(r);e!==null&&e>=0&&(o.hash=`commentray-md-line-${String(e)}`),globalThis.location.assign(o.toString());return}let t=(n.commentrayOnGithub??"").trim();if(t.length>0){let r=e!==null&&e>=0?`${t}#L${String(e+1)}`:t;globalThis.location.assign(r)}}function ki(n){return{scope:(n.getAttribute("data-search-scope")||"")==="commentray-and-paths"?"commentray-and-paths":"full",filePathLabel:n.getAttribute("data-search-file-path")||"",commentrayPathLabel:n.getAttribute("data-search-commentray-path")||""}}function hr(n,e,t,r,o){let i=t.split(`
18
18
  `),s=e.split(`
19
- `),a=[];return n==="commentray-and-paths"&&(r.trim()&&a.push({kind:"path",line:a.length,text:r}),o.trim()&&a.push({kind:"path",line:a.length,text:o})),[...n==="full"?s.map((c,l)=>({kind:"code",line:l,text:c})):[],...a,...i.map((c,l)=>({kind:"md",line:l,text:c}))]}function fr(n){let e=Oe.createDefaultSearcher();return e.indexEntities(n,t=>t.kind==="md"&&t.crPath?`md:${t.crPath}:${t.line}`:t.kind==="path"?`path:${t.spPath??""}|${t.crPath??""}|${t.line}|${t.text.slice(0,120)}`:`${t.kind}:${t.line}`,t=>[t.text]),e}function Ei(n,e){let t=n;for(;t;){if(t.classList?.contains("hit"))return t;if(t===e)return null;t=t.parentElement}return null}function pn(n){return[...n.querySelectorAll("button.hit")].filter(e=>e instanceof HTMLButtonElement)}function pr(n){return[...n.querySelectorAll("a.tree-file-link")].filter(e=>e instanceof HTMLAnchorElement)}function vi(n){let e=document.getElementById(`code-line-${String(n)}`);e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Mi(n,e){let t=(n.getAttribute("data-cr-path")??"").trim(),r=(n.getAttribute("data-sp-path")??"").trim(),o=jt(e.mutable.documentedPairs,t,r);if(o&&Kt(o,e.filePathLabel,e.mutable.commentrayPathLabel)){e.docScrollEl.scrollTo({top:0,behavior:"smooth"});return}o&&Gr(o,null)}function Li(n,e,t){let r=t.mutable.commentrayPathLabel.trim(),o=e.trim();if(o.length>0&&k(o)!==k(r)){let i=jt(t.mutable.documentedPairs,o,"");if(i){Gr(i,n);return}return}qr(t.docScrollEl,n,t.mutable.mdLines.length)}function Wr(n,e){let t=n.getAttribute("data-kind"),r=parseInt(n.getAttribute("data-line")||"0",10),o=n.getAttribute("data-cr-path")?.trim()??"";if(t==="code"){vi(r);return}if(t==="path"){Mi(n,e);return}Li(r,o,e)}function ki(n,e,t){let r={currentCommentrayPath:t.commentrayPathLabel,currentSourcePath:e};if(n==="full"){let l=e.trim();if(l.length===0)return null;let u=[{sourcePath:l,commentrayPath:t.commentrayPathLabel.trim()}],d=cn("full",u.length,u.length,!1);return ln(d,u,r)}let{rows:o,totalUnique:i}=qn(t.documentedPairs);if(o.length>0){let l=cn("commentray-and-paths",o.length,i,!1);return ln(l,o,r)}let s=e.trim();if(s.length===0)return null;let a=[{sourcePath:s,commentrayPath:t.commentrayPathLabel.trim()}],c=cn("commentray-and-paths",a.length,a.length,!0);return ln(c,a,r)}function z(n){n.focus({preventScroll:!0}),n.scrollIntoView({block:"nearest",inline:"nearest"})}function Hi(n,e){n.addEventListener("keydown",t=>{if(t.isComposing||n.hidden)return;let r=pn(n);if(r.length===0)return;let o=document.activeElement;if(!(o instanceof HTMLButtonElement)||!o.classList.contains("hit"))return;let i=r.indexOf(o);if(!(i<0)){if(t.key==="ArrowDown"&&i<r.length-1){z(r[i+1]),t.preventDefault();return}if(t.key==="ArrowUp"){if(i>0){z(r[i-1]),t.preventDefault();return}z(e),t.preventDefault()}}})}function xi(n,e,t){let{renderEmptyBrowsePreview:r,runSearch:o,cancelDebounceTimer:i,hitClickDeps:s}=t;n.addEventListener("keydown",a=>{if(a.isComposing)return;if(a.key==="ArrowDown"){if(!e.hidden){let l=pn(e);if(l.length>0&&document.activeElement===n){z(l[0]),a.preventDefault();return}}if(Se(n.value).length>0)return;r(),a.preventDefault();return}if(a.key!=="Enter")return;i(),Se(n.value).length>0&&o();let c=pn(e);!e.hidden&&c.length>0&&document.activeElement===n&&(a.preventDefault(),Wr(c[0],s))})}function Vr(n){let{scope:e,filePathLabel:t,mutable:r,rawCode:o,searchInput:i,searchClear:s,searchResults:a,docScrollEl:c}=n,l;function u(){clearTimeout(l),l=void 0}function d(){u(),i.value="",a.innerHTML="",a.hidden=!0}function m(){let p=ki(e,t,r);p!==null&&(a.hidden=!1,a.innerHTML=p)}function h(){let p=Se(i.value);if(p.length===0){a.hidden=!0,a.innerHTML="";return}let g=yi({scope:e,filePathLabel:t,commentrayPathLabel:r.commentrayPathLabel,rawCode:o,rawMd:r.rawMd,searcher:r.searcher,queryRaw:i.value,tokens:p,pathBlobWide:r.pathBlobWide,pathRowsForOrdering:r.pathRowsForOrdering.length>0?r.pathRowsForOrdering:void 0});a.hidden=!1,a.innerHTML=Ti(e,g,p,{currentCommentrayPath:r.commentrayPathLabel,currentSourcePath:t})}let f={mutable:r,docScrollEl:c,filePathLabel:t};a.addEventListener("click",p=>{let g=Ei(p.target,a);g&&Wr(g,f)}),Hi(a,i),i.addEventListener("input",()=>{clearTimeout(l),l=setTimeout(h,200)}),xi(i,a,{renderEmptyBrowsePreview:m,runSearch:h,cancelDebounceTimer:u,hitClickDeps:f}),s.addEventListener("click",d),document.addEventListener("keydown",p=>{if(p.key!=="Escape")return;let g=i.value.trim().length>0,w=document.activeElement===i,b=!a.hidden;!g&&!w&&!b||(d(),w&&i.blur(),p.preventDefault())})}function Ur(n,e,t,r,...o){let i=o.filter(a=>a instanceof HTMLElement),s=D(localStorage,n)==="1";if(t.checked=s,s){e.classList.add("wrap");for(let a of i)a.classList.add("wrap")}else{e.classList.remove("wrap");for(let a of i)a.classList.remove("wrap")}t.addEventListener("change",()=>{if(t.checked){e.classList.add("wrap");for(let a of i)a.classList.add("wrap");A(localStorage,n,"1")}else{e.classList.remove("wrap");for(let a of i)a.classList.remove("wrap");A(localStorage,n,"0")}r&&queueMicrotask(()=>{requestAnimationFrame(()=>{r(),requestAnimationFrame(()=>{r()})})})})}function Yr(n){let e=n.trim();if(!e)return[];try{let t=JSON.parse(R(e));if(!Array.isArray(t))return[];let r=[];for(let o of t){if(typeof o!="object"||o===null)continue;let i=o;if(typeof i.id=="string"&&typeof i.commentrayLine=="number"&&typeof i.sourceStart=="number"&&typeof i.sourceEnd=="number"){let s=i.markerViewportHalfOpen1Based,a=typeof s=="object"&&s!==null&&typeof s.lo=="number"&&typeof s.hiExclusive=="number"?{lo:s.lo,hiExclusive:s.hiExclusive}:{lo:i.sourceStart,hiExclusive:i.sourceEnd+1};r.push({id:i.id,commentrayLine:i.commentrayLine,sourceStart:i.sourceStart,sourceEnd:i.sourceEnd,markerViewportHalfOpen1Based:a})}}return r}catch{return[]}}function Qr(n=64){let e=q(),t=Math.max(0,e.scrollHeight-e.clientHeight);return t>0&&e.scrollTop>=t-n}function jr(n,e=64){let t=Math.max(0,n.scrollHeight-n.clientHeight);return t>0&&n.scrollTop>=t-e}function Kr(n){let e=n.getAttribute("data-commentray-line");return e===null||e===""?null:Number(e)}function gr(n,e){let t=[];for(let r of n){let o=Kr(r);o!==null&&t.push({line0:o,top:r.getBoundingClientRect().top})}return Dn(t,e)}function yr(n){for(let e=n.length-1;e>=0;e--){let t=n.item(e);if(!t)continue;let r=Kr(t);if(r!==null)return r}return null}function Xr(n,e="code-line-"){let t=n.querySelectorAll(`[id^="${e}"]`);if(t.length===0)return 1;if(!L(n)){if(Qr()){let u=t[t.length-1],d=/^(?:code-line-|code-md-line-)(\d+)$/.exec(u.id);return d?Number(d[1])+1:t.length}let i=n.getBoundingClientRect(),s=globalThis.innerHeight,a=Math.max(0,i.top),c=Math.min(s,i.bottom),l=a+j(c-a);for(let u of t)if(u.getBoundingClientRect().bottom>l-.001){let m=/^(?:code-line-|code-md-line-)(\d+)$/.exec(u.id);return m?Number(m[1])+1:1}return t.length}if(jr(n)){let i=t[t.length-1],s=/^(?:code-line-|code-md-line-)(\d+)$/.exec(i.id);return s?Number(s[1])+1:t.length}let o=n.getBoundingClientRect().top+n.clientTop+j(n.clientHeight);for(let i of t)if(i.getBoundingClientRect().bottom>o-.001){let a=/^(?:code-line-|code-md-line-)(\d+)$/.exec(i.id);return a?Number(a[1])+1:1}return t.length}function Sn(n){let e=n.querySelectorAll(".commentray-block-anchor");if(e.length===0)return null;if(!L(n)){if(Qr()){let l=yr(e);if(l!==null)return l}let o=n.getBoundingClientRect(),i=globalThis.innerHeight,s=Math.max(0,o.top),a=Math.min(i,o.bottom),c=s+j(a-s);return gr(e,c)}if(jr(n)){let o=yr(e);if(o!==null)return o}let r=n.getBoundingClientRect().top+n.clientTop+j(n.clientHeight);return gr(e,r)}function Jr(){let n=document.getElementById("shell");return n instanceof HTMLElement?n.getAttribute("data-page-breaks-enabled")==="true":!1}function Ci(n){if(!L(n)){let t=n.getBoundingClientRect(),r=globalThis.innerHeight,o=Math.max(0,t.top),i=Math.min(r,t.bottom);return o+j(i-o)}return n.getBoundingClientRect().top+n.clientTop+j(n.clientHeight)}function Ai(n){if(!Jr())return null;let e=Ci(n),t=Array.from(n.querySelectorAll(".commentray-page-break[data-next-source-viewport-line]"));for(let r of t){let o=r.getAttribute("data-next-source-viewport-line");if(!o)continue;let i=Number.parseInt(o,10);if(!Number.isFinite(i)||i<=0)continue;let s=r.getBoundingClientRect().top,a=r.getAttribute("data-next-commentray-line"),c=a?Number.parseInt(a,10):Number.NaN,l=Number.isFinite(c)&&c>=0?n.querySelector(`[data-commentray-line="${String(c)}"]`):null,u=l?l.getBoundingClientRect().top:s+r.clientHeight;if(!(s<=e&&e<u))continue;let d=Math.max(1,u-s),m=M((e-s)/d,0,1),f=globalThis.matchMedia("(max-width: 767px)").matches?.2:.35;return m<f?null:i-1}return null}var Bi=Math.max(320,1050);function Ii(n){let e=performance.now()+Bi;n.until=Math.max(n.until,e)}function Zr(n){return performance.now()<n.until}var Pi=200;function Ri(n,e,t,r){let o=performance.now();!bn()||o-e.lastEchoSkipTraceAt<Pi||(e.lastEchoSkipTraceAt=o,S(`wire.${n}.flush-skipped`,{reason:"partner-echo",echoUntilMs:Math.round(t.until),[`${n}ScrollTop`]:r.scrollTop}))}function br(n){let{axis:e,driverPane:t,state:r,syncingRef:o,ownEchoGate:i,partnerEchoGate:s,syncFromDriver:a}=n;return()=>{if(r.pendingRaf=0,Zr(i)){Ri(e,r,i,t),r.lastSeenTop=t.scrollTop;return}if(o.current!=="none"){S(`wire.${e}.flush-skipped`,{reason:"sync-in-progress",syncing:o.current});return}let c=t.scrollTop,l=c-r.lastSeenTop;r.lastSeenTop=c,o.current=e,Ii(s),S(`wire.${e}.driver`,{delta:l,[`${e}ScrollTop`]:c}),a(l),o.current="none"}}function Sr(n){let{driverPane:e,state:t,syncingRef:r,ownEchoGate:o,flush:i}=n;e.addEventListener("scroll",()=>{if(Zr(o)){t.lastSeenTop=e.scrollTop,t.pendingRaf!==0&&(cancelAnimationFrame(t.pendingRaf),t.pendingRaf=0);return}if(r.current!=="none"){t.lastSeenTop=e.scrollTop;return}t.pendingRaf!==0&&cancelAnimationFrame(t.pendingRaf),t.pendingRaf=requestAnimationFrame(i)},{passive:!0})}function eo(n,e,t,r){let o={current:"none"},i={until:0},s={until:0},a={lastSeenTop:n.scrollTop,pendingRaf:0,lastEchoSkipTraceAt:-1/0},c={lastSeenTop:e.scrollTop,pendingRaf:0,lastEchoSkipTraceAt:-1/0},l=br({axis:"code",driverPane:n,state:a,syncingRef:o,ownEchoGate:i,partnerEchoGate:s,syncFromDriver:t}),u=br({axis:"doc",driverPane:e,state:c,syncingRef:o,ownEchoGate:s,partnerEchoGate:i,syncFromDriver:r});Sr({driverPane:n,state:a,syncingRef:o,ownEchoGate:i,flush:l}),Sr({driverPane:e,state:c,syncingRef:o,ownEchoGate:s,flush:u})}function Tr(n,e){let{codePane:t,docPane:r,getLinks:o,lineIdPrefix:i,sticky:s}=n,a=_(r),c=i(),l=zr(t,r,o,c,s,n.allowProportionalMirror);nt(t,r,l);let u=_(r);S("code\u2192doc.apply",{driverDelta:e,lineIdPrefix:c,plan:ae(l),docScrollTopBefore:a,docScrollTopAfter:u,docDelta:u-a,codeScrollTop:t.scrollTop}),Ze({driverDelta:e,partnerBefore:a,partnerPane:r,axis:"code\u2192doc"})}function wr(n,e){let{codePane:t,docPane:r,getLinks:o,lineIdPrefix:i,sticky:s}=n,a=_(t),c=i(),l=_r(r,t,o,s,c,n.allowProportionalMirror);tt(t,r,l,c);let u=_(t);S("doc\u2192code.apply",{driverDelta:e,lineIdPrefix:c,plan:se(l),codeScrollTopBefore:a,codeScrollTopAfter:u,codeDelta:u-a,docScrollTop:r.scrollTop}),Ze({driverDelta:e,partnerBefore:a,partnerPane:t,axis:"doc\u2192code"})}function un(n,e,t,r,o,i){let s=i?.allowProportionalMirror!==!1,a=null,c=null,l={sourceSticky:{lockedId:null},commentraySticky:{lockedId:null},linksKey:{current:""}},u={codePane:n,docPane:e,getLinks:t,lineIdPrefix:r,sticky:l,allowProportionalMirror:s},d=y=>Tr(u,y),m=y=>wr(u,y),h=()=>{Tr(u,0)},f=()=>{wr(u,0)},p=()=>{if(s&&o?.()===!0){a={k:"mirrorW",ratio:He()};return}a=_r(e,n,t,l,r(),s)},g=()=>{if(!a)return;let y=a;a=null,y.k==="noop"&&y.skipProportionalFallbackOnFlip!==!0&&s&&(y=hn(e)),tt(n,e,y,r())},w=()=>{c=zr(n,e,t,r(),l,s)},b=()=>{if(!c)return;let y=c;c=null,y.k==="noop"&&s&&(y=fn(n)),nt(n,e,y)};return eo(n,e,d,m),{syncFromCodeToDoc:h,syncFromDocToCode:f,prepareMobileFlipToCode:p,finishMobileFlipToCode:g,prepareMobileFlipToDoc:w,finishMobileFlipToDoc:b}}function Di(n,e){let t=null,r=null,o=m=>{let h=_(e),f=fn(n);nt(n,e,f),S("code\u2192doc.apply",{mode:"proportional-shell",driverDelta:m,plan:ae(f),docScrollTopBefore:h,docScrollTopAfter:_(e),codeScrollTop:n.scrollTop}),Ze({driverDelta:m,partnerBefore:h,partnerPane:e,axis:"code\u2192doc"})},i=m=>{let h=_(n),f=hn(e);tt(n,e,f),S("doc\u2192code.apply",{mode:"proportional-shell",driverDelta:m,plan:se(f),codeScrollTopBefore:h,codeScrollTopAfter:_(n),docScrollTop:e.scrollTop}),Ze({driverDelta:m,partnerBefore:h,partnerPane:n,axis:"doc\u2192code"})},s=()=>{o(0)},a=()=>{i(0)},c=()=>{t=hn(e)},l=()=>{if(!t)return;let m=t;t=null,tt(n,e,m)},u=()=>{r=fn(n)},d=()=>{if(!r)return;let m=r;r=null,nt(n,e,m)};return eo(n,e,o,i),{syncFromCodeToDoc:s,syncFromDocToCode:a,prepareMobileFlipToCode:c,finishMobileFlipToCode:l,prepareMobileFlipToDoc:u,finishMobileFlipToDoc:d}}function to(n){let e=n.getBoundingClientRect();return(e.top+e.bottom)/2}function Er(n){return to(n)}function Fi(n,e,t,r){if(e){let a=document.getElementById(`commentray-block-${e.id}`);if(!a)return to(t);let c=a.getBoundingClientRect().top-3;return r?Rn(n,t,a):c}let i=n.getBoundingClientRect().bottom-4,s=n.children[n.children.length-1];if(s&&(i=Math.min(i,s.getBoundingClientRect().bottom-4)),r){let a=t.getBoundingClientRect().top+4,c=$e(n,t,null);i=Math.min(i,Math.max(a,c))}return i}function no(n,e){if(!n.startsWith(e))return null;let t=Number.parseInt(n.slice(e.length),10);return Number.isFinite(t)?t:null}function ro(n,e){let t=0,r=n.length-1,o=-1;for(;t<=r;){let i=t+r>>1;(n[i]?.line0??-1)>=e?(o=i,r=i-1):t=i+1}return o>=0?n[o]?.el??null:null}function Ni(n,e){let t=0,r=n.length-1,o=-1;for(;t<=r;){let i=t+r>>1;(n[i]?.line0??-1)<=e?(o=i,t=i+1):r=i-1}return o>=0?n[o]?.el??null:null}function Oi(n){return Array.from(document.querySelectorAll(`[id^="${n}"]`)).map(e=>({line0:no(e.id,n),el:e})).filter(e=>e.line0!==null).sort((e,t)=>e.line0-t.line0)}function _i(n,e,t,r){let o=()=>r();e.addEventListener("scroll",o,{passive:!0}),t.addEventListener("scroll",o,{passive:!0}),globalThis.addEventListener("resize",o);let i=new ResizeObserver(o);i.observe(n),i.observe(e),i.observe(t);let s=n.parentElement;s&&i.observe(s)}function zi(n,e,t){let r=Sn(e);return e.querySelector(".commentray-block-anchor")!==null&&r!==null?In(n,r):Bn(n,t())}function $i(n,e,t,r,o,i){let s=xn(r()),a=_e(s),c=e.getBoundingClientRect(),l=c.width,u=c.height;if(l<=0||u<=0||a.length===0){n.replaceChildren();return}let d=zi(s,t,o),m=Jr();n.setAttribute("viewBox",`0 0 ${String(l)} ${String(u)}`),n.setAttribute("preserveAspectRatio","none");let h=[],f=Array.from(document.querySelectorAll(`[id^="${i}"]`)).map(p=>({line0:no(p.id,i),el:p})).filter(p=>p.line0!==null).sort((p,g)=>p.line0-g.line0);for(let p=0;p<a.length;p++){let g=a[p];if(!g)continue;let w=An(s,g),b=Wt(g.sourceStart),y=Wt(g.sourceEnd),x=document.getElementById(`${i}${String(b)}`)??ro(f,b),C=document.getElementById(`${i}${String(y)}`)??Ni(f,y),v=document.getElementById(`commentray-block-${g.id}`);if(!x||!C||!v)continue;let H=Fi(t,w,v,m),I=Er(x),Z=Er(C),ee=v.getBoundingClientRect().top+2,F=Math.max(H,ee+4),le=N(I,c.top,u),vn=N(ee,c.top,u),Mn=N(Z,c.top,u),Ln=N(F,c.top,u),st=g.id===d?"gutter__rays-path gutter__rays-path--active":"gutter__rays-path",kn=`${st} gutter__rays-path--trail`,at=be(0,le.y,l,vn.y,{tension:.38,clipStart:le.clipped,clipEnd:vn.clipped}),ct=be(0,Mn.y,l,Ln.y,{tension:.38,clipStart:Mn.clipped,clipEnd:Ln.clipped}),yo=at.dotted?`<path class="${kn}" d="${at.dotted}" />`:"",bo=ct.dotted?`<path class="${kn}" d="${ct.dotted}" />`:"";h.push(`<g class="gutter__rays-block" data-commentray-block="${B(g.id)}"><path class="${st}" d="${at.solid}" />`+yo+`<path class="${st}" d="${ct.solid}" />`+bo+"</g>")}n.innerHTML=h.join("")}function qi(n){let{gutter:e,codePane:t,docScrollEl:r,getLinks:o,probeTopSourceLine1Based:i}=n,s=n.sourceLineIdPrefix??(()=>"code-line-"),a="http://www.w3.org/2000/svg",c=document.createElement("div");c.className="gutter__rays",c.setAttribute("aria-hidden","true");let l=document.createElementNS(a,"svg");c.appendChild(l),e.appendChild(c);let u=0;function d(){u===0&&(u=globalThis.requestAnimationFrame(()=>{u=0,$i(l,e,r,o,i,s())}))}return _i(e,t,r,d),d(),globalThis.requestAnimationFrame(()=>{d(),globalThis.requestAnimationFrame(d)}),d}function Gi(n){if(typeof n!="object"||n===null)return!1;let e=n;if(typeof e.sourcePath!="string"||typeof e.commentrayPath!="string"||e.staticBrowseUrl!==void 0&&typeof e.staticBrowseUrl!="string")return!1;let t=e.sourceOnGithub,r=e.commentrayOnGithub,o=typeof t=="string";return!(o!==(typeof r=="string")||!(typeof e.staticBrowseUrl=="string"&&e.staticBrowseUrl.trim().length>0)&&!o)}function Tn(n){let e=[];if(!Array.isArray(n))return e;for(let t of n)Gi(t)&&e.push(t);return e}function Wi(n){if(n.kind!=="commentrayLine"||typeof n.line!="number"||typeof n.text!="string")return null;let e=typeof n.sourcePath=="string"?n.sourcePath:"",t=typeof n.commentrayPath=="string"?n.commentrayPath:"";return{kind:"md",line:n.line,text:n.text,spPath:e,crPath:t}}function Vi(n,e){if(n.kind!=="sourcePath"&&n.kind!=="commentrayPath")return null;let t=typeof n.sourcePath=="string"?n.sourcePath:"",r=typeof n.commentrayPath=="string"?n.commentrayPath:"",o=n.kind==="sourcePath"?t:r;return o?{kind:"path",line:e,text:o,spPath:t,crPath:r}:null}function Ui(n){if(!n||typeof n!="object")return[];let e=n.rows;if(!Array.isArray(e))return[];let t=[],r=0;for(let o of e){if(!o||typeof o!="object")continue;let i=o,s=Wi(i);if(s){t.push(s);continue}let a=Vi(i,r);a&&(t.push(a),r+=1)}return t}function oo(n){let e=n.trim();if(e==="")return[];try{let t=JSON.parse(R(e));return Tn(t)}catch{return[]}}function Yi(n,e){let t=e.sourcePath.split("/").filter(Boolean);if(t.length===0)return;let r=n;for(let o=0;o<t.length;o++){let i=t[o];if(i===void 0)continue;r.children.has(i)||r.children.set(i,{children:new Map,pairs:[]});let s=r.children.get(i);if(s===void 0)return;o===t.length-1&&s.pairs.push(e),r=s}}function Qi(n){let e=n.replace(/\\/g,"/").replace(/\/+$/,""),t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function ji(n){return(n.replace(/\\/g,"/").replace(/\/+$/,"").split("/").filter(Boolean).at(-1)??"").replace(/\.md$/i,"")}function Ki(n,e){let t=Qi(n.sourcePath);if(!e)return t;let r=ji(n.commentrayPath);return r!==""&&r!==t?`${t} \xB7 ${r}`:t}function Xi(n){let e=(n.staticBrowseUrl??"").trim();if(e.length>0)return Q(e,globalThis.location.pathname,globalThis.location.origin);let t=(n.commentrayOnGithub??"").trim();return t.length>0?t:"#"}function Ji(n){return(n.staticBrowseUrl??"").trim().length>0?`${n.sourcePath} \u2014 open this pair in the site viewer`:(n.commentrayOnGithub??"").trim().length>0?`${n.sourcePath} \u2014 open companion commentray on the repository host`:n.sourcePath}function Zi(n){for(let e of n.querySelectorAll("a.tree-file-link"))e instanceof HTMLAnchorElement&&(e.classList.remove("tree-file-link--current"),e.removeAttribute("aria-current"))}function es(n,e,t){for(let r of n.querySelectorAll("a.tree-file-link")){if(!(r instanceof HTMLAnchorElement))continue;let o=r.getAttribute("data-pair-source-path")?.trim()??"",i=r.getAttribute("data-pair-commentray-path")?.trim()??"";if(Kt({sourcePath:o,commentrayPath:i},e,t)){r.classList.add("tree-file-link--current"),r.setAttribute("aria-current","page");break}}}function wn(){let n=document.getElementById("shell"),e=document.getElementById("documented-files-tree");if(!(n instanceof HTMLElement)||!(e instanceof HTMLElement))return;Zi(e);let t=n.getAttribute("data-commentray-pair-source-path")?.trim()??"",r=n.getAttribute("data-commentray-pair-commentray-path")?.trim()??"";t.length===0||r.length===0||es(e,t,r)}function io(n){let e=[...n.children.keys()].sort((r,o)=>r.localeCompare(o));if(e.length===0)return"";let t=[];for(let r of e){let o=n.children.get(r);if(o!==void 0){if(o.children.size>0){let i=io(o);t.push(`<li><div class="tree-dir">${B(r)}</div>${i}</li>`)}if(o.pairs.length>0){let i=o.pairs.length>1;for(let s of o.pairs){let a=B(Ki(s,i)),c=B(Ji(s)),l=B(Xi(s)),u=B(k(s.sourcePath)),d=B(k(s.commentrayPath)),h=(s.staticBrowseUrl?.trim()??"").length>0?"":' target="_blank" rel="noopener noreferrer"';t.push(`<li><div class="tree-file"><a class="tree-file-link" href="${l}" data-pair-source-path="${u}" data-pair-commentray-path="${d}"${h} title="${c}">${a}</a></div></li>`)}}}}return`<ul>${t.join("")}</ul>`}function ts(n,e,t){if(e.length===0){n.innerHTML=t?'<p class="nav-rail__doc-hub-hint" role="status">No paths match this filter.</p>':'<p class="nav-rail__doc-hub-hint" role="status">No documented pairs in this export.</p>';return}let r={children:new Map,pairs:[]};for(let o of e)Yi(r,o);n.innerHTML=io(r),wn()}function ns(n,e){let t=null,r=null;return async()=>t!==null?t:(r===null&&(r=(async()=>{if(e.length>0&&(t=oo(e),t.length>0))return;if(n.length===0){t=[];return}let o=await fetch(n,{credentials:"same-origin"});if(!o.ok)throw new Error(`nav json ${String(o.status)}`);let i=await o.json();t=Tn(i.documentedPairs)})()),await r,t??[])}function rs(n){let e=n.querySelector(".nav-rail__doc-hub-inner");if(!(e instanceof HTMLElement))return()=>{};let t=e,r=globalThis.matchMedia("(max-width: 767px)");function o(){let s=n.querySelector("summary");return s instanceof HTMLElement?s:null}function i(){if(!n.open||!r.matches){t.style.removeProperty("position"),t.style.removeProperty("top"),t.style.removeProperty("left"),t.style.removeProperty("right"),t.style.removeProperty("width"),t.style.removeProperty("max-width"),t.style.removeProperty("max-height"),t.style.removeProperty("z-index");return}let s=o();if(!s)return;let a=s.getBoundingClientRect(),c=8;t.style.position="fixed",t.style.top=`${String(Math.round(a.bottom+4))}px`,t.style.left=`${String(Math.round(c))}px`,t.style.right=`${String(Math.round(c))}px`,t.style.width="auto",t.style.maxWidth="none",t.style.maxHeight="min(52vh, 400px)",t.style.zIndex="200"}return r.addEventListener("change",i),globalThis.addEventListener("resize",i),globalThis.addEventListener("scroll",i,!0),i}function os(){let n=document.getElementById("documented-files-filter");n instanceof HTMLInputElement&&z(n)}function vr(n){let e=n.querySelector("summary");e instanceof HTMLElement&&e.focus({preventScroll:!0})}function is(n){function e(t){!n.open||t.key!=="Escape"||(t.preventDefault(),n.open=!1,vr(n))}document.addEventListener("keydown",e,!0),document.addEventListener("pointerdown",t=>{if(!n.open)return;let r=t.target;r instanceof Node&&(n.contains(r)||(n.open=!1,vr(n)))},!0)}function ss(){let n=document.getElementById("documented-files-hub"),e=document.getElementById("documented-files-tree"),t=document.getElementById("documented-files-filter"),r=document.getElementById("shell");if(!(n instanceof HTMLDetailsElement)||!(e instanceof HTMLElement))return;let o=n,i=e,s=o.getAttribute("data-nav-json-url")?.trim()??"",a=r?.getAttribute("data-documented-pairs-b64")?.trim()??"";if(s.length===0&&a.length===0)return;let c=rs(o),l=ns(s,a),u=null;function d(){if(u===null)return;let h=t instanceof HTMLInputElement?t.value:"",f=zn(u,h),p=h.trim().length>0;ts(i,f,p&&u.length>0&&f.length===0)}async function m(){try{u=await l(),d()}catch{u=null,i.innerHTML='<p class="nav-rail__doc-hub-hint" role="alert">Could not load the file list.</p>'}}o.addEventListener("toggle",()=>{c(),o.open&&globalThis.requestAnimationFrame(()=>{c(),os()}),o.open&&m()}),is(o),i.addEventListener("keydown",h=>{if(!o.open||h.isComposing)return;let f=h.target;if(!(f instanceof HTMLAnchorElement)||!f.classList.contains("tree-file-link"))return;let p=pr(i);if(p.length===0)return;let g=p.indexOf(f);if(!(g<0)){if(h.key==="ArrowDown"){g<p.length-1&&(z(p[g+1]),h.preventDefault());return}if(h.key==="ArrowUp"){if(g>0){z(p[g-1]),h.preventDefault();return}t instanceof HTMLInputElement&&(z(t),h.preventDefault())}}}),t instanceof HTMLInputElement&&(t.addEventListener("input",()=>{!o.open||u===null||d()}),t.addEventListener("keydown",h=>{if(!o.open||h.isComposing||h.key!=="ArrowDown")return;let f=pr(i);f.length!==0&&(z(f[0]),h.preventDefault())}))}function as(n,e,t,r,o){let i=!1,s=o;function a(l){if(!i)return;let u=e.getBoundingClientRect(),d=l.clientX-u.left,m=M(d/u.width*100,15,85);s=m,t.style.flex=`0 0 ${m}%`,e.style.setProperty("--split-pct",`${String(m)}%`)}function c(){i=!1,window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",c),document.body.style.cursor="",document.body.style.userSelect="",A(localStorage,n,String(s))}r.addEventListener("mousedown",l=>{l.preventDefault(),i=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",a),window.addEventListener("mouseup",c)})}var rt="commentray.codeCommentrayStatic.splitPct",so="commentray.codeCommentrayStatic.wrap",Me="commentray.codeCommentrayStatic.dualMobilePane",cs="commentray.codeCommentrayStatic.sourceMarkdownPaneMode",ls="commentray.codeCommentrayStatic.pageBreaksEnabled",xe="(max-width: 767px)";function J(n){return n==="code"?"code":"doc"}function Le(){return globalThis.matchMedia(xe).matches}function ot(n,e){if(e){n.setAttribute("data-mobile-single-pane","true");return}n.removeAttribute("data-mobile-single-pane")}function us(n){let e=document.getElementById("commentray-help-tour");e instanceof HTMLButtonElement&&e.addEventListener("click",()=>{rn(n,Le,{force:!0})})}function $(n){return n.getAttribute("data-source-pane-mode")==="rendered-markdown"?"rendered-markdown":"source"}function ds(n){let e=(n??"").trim().toLowerCase();return!(e==="0"||e==="false"||e==="off")}function ms(n){let e=ds(D(localStorage,ls));n.setAttribute("data-page-breaks-enabled",e?"true":"false")}function hs(n){let e=()=>{let t=Math.max(globalThis.innerHeight,document.documentElement?.clientHeight??0);if(!Number.isFinite(t)||t<=0)return;let r=Math.round(M(t*.72,260,820));n.style.setProperty("--commentray-page-break-min-height",`${String(r)}px`)};globalThis.addEventListener("resize",e,{passive:!0}),globalThis.addEventListener("orientationchange",e,{passive:!0}),globalThis.visualViewport?.addEventListener("resize",e,{passive:!0}),e()}function Mr(n){let e=document.querySelector("label.toolbar-wrap-lines");e instanceof HTMLLabelElement&&(e.hidden=$(n)==="rendered-markdown")}function Ee(n){return $(n)==="rendered-markdown"?"code-md-line-":"code-line-"}function fs(n,e){let t=()=>{if(n.getAttribute("data-layout")!=="dual"||!e.matches||J(n.getAttribute("data-dual-mobile-pane"))!=="doc")return;let r=document.getElementById("doc-pane-body");r instanceof HTMLElement&&ce(r)};queueMicrotask(()=>{t(),requestAnimationFrame(()=>{t(),requestAnimationFrame(t)})})}function ao(n,e,t){let r=()=>{e.hidden=!0,e.classList.remove("is-visible")},o=()=>{e.hidden=!1,e.classList.add("is-visible")},i=()=>{if(!t.matches){r();return}let s=n.getBoundingClientRect(),a=globalThis.innerHeight,c=10;s.bottom<c||s.top>a-c?o():r()};globalThis.addEventListener("scroll",i,{passive:!0}),globalThis.addEventListener("resize",i,{passive:!0}),t.addEventListener("change",i),globalThis.requestAnimationFrame(i)}function ps(n,e,t){let r=()=>{e.hidden=!0,e.classList.remove("is-visible")},o=()=>{e.hidden=!1,e.classList.add("is-visible")},i=()=>{if(n.hidden||n.getClientRects().length===0){r();return}let s=n.getBoundingClientRect(),a=globalThis.innerHeight,c=10;s.bottom<c||s.top>a-c?o():r()};globalThis.addEventListener("scroll",i,{passive:!0,signal:t}),globalThis.addEventListener("resize",i,{passive:!0,signal:t}),globalThis.requestAnimationFrame(i)}function Lr(n,e,t){let r=Le()&&J(n.getAttribute("data-dual-mobile-pane"))!=="code";e.hidden=r,r?(e.setAttribute("aria-hidden","true"),e.style.setProperty("display","none","important")):(e.removeAttribute("aria-hidden"),e.style.removeProperty("display")),t instanceof HTMLButtonElement&&(t.hidden=!0,t.classList.remove("is-visible"))}function gs(n,e){let t=n.querySelectorAll(`[id^="${e}"]`);if(t.length===0)return null;let r=L(n)?n.getBoundingClientRect().top+n.clientTop+2:Math.max(0,n.getBoundingClientRect().top)+2;for(let s of t)if(s.getBoundingClientRect().bottom>r-.001){let c=/^(?:code-line-|code-md-line-)(\d+)$/.exec(s.id);return c?.[1]?Number.parseInt(c[1],10):null}let o=t[t.length-1];if(!o)return null;let i=/^(?:code-line-|code-md-line-)(\d+)$/.exec(o.id);return i?.[1]?Number.parseInt(i[1],10):null}function ys(n,e,t,r,o,i){function s(){return Array.from(e.querySelectorAll('[data-source-markdown-body="true"]'))}function a(){let h=$(n)==="rendered-markdown",f=h?"markdown source":"rendered markdown",p=h?"rendered markdown":"markdown source",g=`Switch source pane to ${f}`,w=`Switch source pane to ${f} (currently ${p})`,b=y=>{y instanceof HTMLButtonElement&&(y.setAttribute("aria-pressed",h?"true":"false"),y.setAttribute("aria-label",g),y.title=w)};b(t),b(r)}a(),Mr(n),Lr(n,t,r);let c=()=>{Lr(n,t,r)};globalThis.addEventListener("resize",c,{passive:!0,signal:o}),globalThis.matchMedia(xe).addEventListener("change",c,{signal:o});let u=new MutationObserver(c);u.observe(n,{attributes:!0,attributeFilter:["data-dual-mobile-pane","data-source-pane-mode"]}),o.addEventListener("abort",()=>u.disconnect(),{once:!0});let d=()=>{let m=$(n),f=gs(e,m==="rendered-markdown"?"code-md-line-":"code-line-"),p=m==="rendered-markdown"?"source":"rendered-markdown",g=p==="rendered-markdown"?"code-md-line-":"code-line-";n.setAttribute("data-source-pane-mode",p),A(localStorage,cs,p),Le()&&J(n.getAttribute("data-dual-mobile-pane"))==="doc"&&(n.setAttribute("data-dual-mobile-pane","code"),A(localStorage,Me,"code")),a(),Mr(n);let w=!Le()||L(e);if(f!==null&&w){let b=e.querySelector(`#${g}${String(f)}`);b instanceof HTMLElement&&yn(e,b,0)}if(p==="rendered-markdown")for(let b of s())ce(b),ke(b);i?.()};t.addEventListener("click",d,{signal:o}),r&&(r.addEventListener("click",d,{signal:o}),ps(t,r,o))}function bs(n,e,t,r){let o=globalThis.matchMedia(xe);function i(){return J(D(localStorage,Me))}function s(){o.matches?(ot(n,!0),n.setAttribute("data-dual-mobile-pane",i())):(ot(n,!1),n.removeAttribute("data-dual-mobile-pane"))}let a=()=>{if(!o.matches)return;let l=J(n.getAttribute("data-dual-mobile-pane"))==="code"?"doc":"code",u=q().scrollTop;l==="code"?t.prepareMobileFlipToCode():t.prepareMobileFlipToDoc(),n.setAttribute("data-dual-mobile-pane",l),A(localStorage,Me,l),globalThis.requestAnimationFrame(()=>{globalThis.requestAnimationFrame(()=>{if(l==="code"){t.finishMobileFlipToCode();let d=q();if(u>5&&d.scrollTop<=1){let m=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=M(u,0,m)}}else t.finishMobileFlipToDoc()})}),l==="doc"&&fs(n,o)};e.addEventListener("click",a),r&&(r.addEventListener("click",a),ao(e,r,o)),o.addEventListener("change",s),s()}function co(n,e,t,r,o){let i=globalThis.matchMedia(xe);function s(){return J(D(localStorage,Me))}function a(){i.matches?(ot(n,!0),n.setAttribute("data-dual-mobile-pane",s())):(ot(n,!1),n.removeAttribute("data-dual-mobile-pane"))}let c=()=>{if(!i.matches)return;let u=J(n.getAttribute("data-dual-mobile-pane"))==="code"?"doc":"code";n.setAttribute("data-dual-mobile-pane",u),A(localStorage,Me,u),u==="doc"&&queueMicrotask(()=>{requestAnimationFrame(()=>{ce(n)})})};t.addEventListener("click",c),r&&(r.addEventListener("click",c),ao(t,r,i)),i.addEventListener("change",a),a()}var Xe=null,gn=null;function Ss(n){return n.getAttribute("data-stretch-buffer-sync")==="flow-synchronizer"}function Ts(n){return Array.from(n.querySelectorAll("tbody tr.stretch-row--block[data-commentray-stretch-sync-id]")).filter(e=>(e.dataset.commentrayStretchSyncId?.trim()??"").length>0)}function ws(n){let e=n.dataset.commentrayStretchSyncId?.trim()??"";if(e.length===0)return null;let t=n.querySelector(":scope > td.stretch-code"),r=n.querySelector(":scope > td.stretch-doc");return!(t instanceof HTMLTableCellElement)||!(r instanceof HTMLTableCellElement)?null:{id:e,codeRect:t.getBoundingClientRect(),docRect:r.getBoundingClientRect()}}function it(n){if(!(n instanceof HTMLElement))return null;let e=n.getBoundingClientRect();if(e.width<=0||e.height<=0)return null;let t=globalThis.getComputedStyle(n);return t.display==="none"||t.visibility==="hidden"?null:e}function Es(n,e){let t=$(e)==="rendered-markdown"?".source-pane--rendered-md":".source-pane--code",r=n.querySelector(t);if(it(r)!==null)return r;let o=n.querySelectorAll(".source-pane--code, .source-pane--rendered-md");for(let i of o)if(it(i)!==null)return i;return null}function vs(n,e){let t=Es(n,e),r=it(t);return r!==null?r.bottom:n.getBoundingClientRect().bottom}function Ms(n){let e=n.querySelector(":scope .stretch-doc-inner"),t=it(e);return t!==null?t.bottom:n.getBoundingClientRect().bottom}function Ls(n,e){let t=n.getBoundingClientRect(),r=t.top+Math.min(Math.max(t.height*.18,24),120);for(let o of e){let i=o.getBoundingClientRect();if(i.top<=r&&i.bottom>=r)return o.dataset.commentrayStretchSyncId?.trim()??null}return e[0]?.dataset.commentrayStretchSyncId?.trim()??null}function ks(n,e,t,r){let o=Ts(t),i=r.getBoundingClientRect(),s=i.width,a=i.height;if(s<=0||a<=0||o.length===0){n.replaceChildren();return}n.setAttribute("viewBox",`0 0 ${String(s)} ${String(a)}`),n.setAttribute("preserveAspectRatio","none");let c=Ls(e,o),l=[];for(let u of o){let d=ws(u);if(d===null)continue;let m=u.querySelector(":scope > td.stretch-code"),h=u.querySelector(":scope > td.stretch-doc");if(!(m instanceof HTMLTableCellElement)||!(h instanceof HTMLTableCellElement))continue;let f=vs(m,e),p=Ms(h),g=N(d.codeRect.top+1,i.top,a),w=N(d.docRect.top+1,i.top,a),b=N(f-1,i.top,a),y=N(p-1,i.top,a),x=d.id===c?"gutter__rays-path gutter__rays-path--active":"gutter__rays-path",C=`${x} gutter__rays-path--trail`,v=be(0,g.y,s,w.y,{tension:.38,clipStart:g.clipped,clipEnd:w.clipped}),H=be(0,b.y,s,y.y,{tension:.38,clipStart:b.clipped,clipEnd:y.clipped}),I=v.dotted?`<path class="${C}" d="${v.dotted}" />`:"",Z=H.dotted?`<path class="${C}" d="${H.dotted}" />`:"";l.push(`<g class="gutter__rays-block" data-commentray-block="${B(d.id)}"><path class="${x}" d="${v.solid}" />`+I+`<path class="${x}" d="${H.solid}" />`+Z+"</g>")}n.innerHTML=l.join("")}function Hs(n,e,t){t.querySelector(":scope > .gutter__rays")?.remove();let r="http://www.w3.org/2000/svg",o=document.createElement("div");o.className="gutter__rays",o.setAttribute("aria-hidden","true");let i=document.createElementNS(r,"svg");o.appendChild(i),t.appendChild(o);let s=0,a=()=>{s===0&&(s=globalThis.requestAnimationFrame(()=>{s=0,ks(i,n,e,t)}))},c=()=>a();n.addEventListener("scroll",c,{passive:!0}),globalThis.addEventListener("resize",c);let l=new ResizeObserver(c);return l.observe(n),l.observe(e),l.observe(t),a(),globalThis.requestAnimationFrame(()=>{a(),globalThis.requestAnimationFrame(a)}),{disconnect:()=>{s!==0&&globalThis.cancelAnimationFrame(s),n.removeEventListener("scroll",c),globalThis.removeEventListener("resize",c),l.disconnect(),o.remove()},request:a}}function xs(n,e){let t=document.getElementById("stretch-gutter");if(!(t instanceof HTMLElement))return;let r=Number.parseFloat(D(localStorage,rt)??""),o=M(Number.isFinite(r)?r:50,15,85);n.style.setProperty("--stretch-code-pct",`${String(o)}%`);let i=!1,s=c=>{if(!i)return;let l=e.getBoundingClientRect();if(l.width<=0)return;let u=c.clientX-l.left,d=M(u/l.width*100,15,85);n.style.setProperty("--stretch-code-pct",`${String(d)}%`),A(localStorage,rt,String(d)),gn?.request()},a=()=>{i&&(i=!1,document.body.style.cursor="",document.body.style.userSelect="",globalThis.removeEventListener("mousemove",s),globalThis.removeEventListener("mouseup",a))};t.addEventListener("mousedown",c=>{c.preventDefault(),i=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none",globalThis.addEventListener("mousemove",s),globalThis.addEventListener("mouseup",a)})}function lo(n,e){e instanceof HTMLTableElement&&Ss(n)?(Xe?.disconnect(),Xe=cr(e)):(Xe?.disconnect(),Xe=null);let t=document.getElementById("wrap-lines");t&&Ur(so,e,t,()=>{globalThis.dispatchEvent(new Event("resize"))});let r=document.getElementById("stretch-gutter");gn?.disconnect(),gn=e instanceof HTMLElement&&r instanceof HTMLElement?Hs(n,e,r):null,xs(n,e)}function Cs(n,e){if(n===null||typeof n!="object")return!1;let t=n;return typeof t.id!="string"||typeof t.docInnerHtmlB64!="string"?!1:e!=="stretch"?!0:typeof t.stretchSwapInnerB64=="string"&&t.stretchSwapInnerB64.trim().length>0}function uo(n){let e=n?.textContent?.trim()??"";if(!e)return null;try{let t=JSON.parse(R(e));if(!t||!Array.isArray(t.angles)||t.angles.length<2)return null;let r=t.layoutMode==="stretch"?"stretch":"dual";return t.angles.every(o=>Cs(o,r))?{...t,layoutMode:r}:null}catch{return null}}function As(n,e){let t=e.stretchSwapInnerB64;if(t===void 0||t.trim().length===0)return;n.innerHTML=R(t);let r=document.getElementById("code-pane");if(r instanceof HTMLElement){lo(n,r),En(n,r,()=>{globalThis.dispatchEvent(new Event("resize"))});let a=document.getElementById("mobile-pane-flip"),c=document.getElementById("mobile-pane-flip-scroll");a instanceof HTMLButtonElement&&co(n,r,a,c instanceof HTMLButtonElement?c:null,()=>{globalThis.dispatchEvent(new Event("resize"))})}n.setAttribute("data-scroll-block-links-b64",e.scrollBlockLinksB64),n.setAttribute("data-raw-md-b64",e.rawMdB64),n.setAttribute("data-search-commentray-path",e.commentrayPathForSearch);let o=k(e.commentrayPathForSearch);o.length>0?n.setAttribute("data-commentray-pair-commentray-path",o):n.removeAttribute("data-commentray-pair-commentray-path");let i=document.getElementById("nav-rail-doc-path");if(i){let a=e.commentrayPathForSearch.trim();i.textContent=a.length>0?a:"\u2014",a.length>0?i.setAttribute("title",a):i.removeAttribute("title")}let s=e.staticBrowseUrl?.trim()??"";if(s.length>0){let a=Qt(s,globalThis.location.pathname,globalThis.location.origin);n.setAttribute("data-commentray-pair-browse-href",a)}else{let a=e.commentrayOnGithubUrl?.trim();a?n.setAttribute("data-commentray-pair-browse-href",a):n.removeAttribute("data-commentray-pair-browse-href")}wn(),go(n),ce(n),ke(n),q().scrollTop=0}function Bs(n,e,t){if(e.layoutMode!=="stretch")return;let r=document.getElementById("angle-select");r&&r.addEventListener("change",()=>{let o=e.angles.find(i=>i.id===r.value);o&&(As(n,o),t?.(o))})}function Is(n,e){let t=mo();if(!t)return;let r=fo(n,e),{searchInput:o,searchClear:i,searchResults:s}=t;Vr({scope:r.scope,filePathLabel:r.filePathLabel,mutable:r.mutable,rawCode:r.rawCode,searchInput:o,searchClear:i,searchResults:s,docScrollEl:n}),ho(n,r.pathInit.documentedPairs,r.indexState,r.mutable,r.rebuildSearcher,o);let a=document.getElementById("commentray-multi-angle-b64"),c=uo(a);c?.layoutMode==="stretch"&&Bs(n,c,l=>{r.mutable.rawMd=R(l.rawMdB64),r.mutable.mdLines=r.mutable.rawMd.split(`
20
- `),r.mutable.commentrayPathLabel=l.commentrayPathForSearch,r.rebuildSearcher(),o.value="",s.innerHTML="",s.hidden=!0})}function Ps(){let n=document.getElementById("doc-pane"),e=document.getElementById("gutter"),t=document.getElementById("wrap-lines");if(!n||!e||!t)return null;let r=document.getElementById("doc-pane-body"),o=r instanceof HTMLElement?r:n;return{docBody:r,docScrollEl:o,gutter:e,wrapCb:t}}function mo(){let n=document.getElementById("search-q"),e=document.getElementById("search-clear"),t=document.getElementById("search-results");return!n||!e||!t?null:{searchInput:n,searchClear:e,searchResults:t}}function Rs(n){let{scope:e,rawCode:t,filePathLabel:r,hubNavRows:o,pathRowsForOrdering:i,rawMd:s,commentrayPathLabel:a}=n;if(e!=="commentray-and-paths")return hr(e,t,s,r,a);if(o.length>0)return o;let c=i.length>0?i:hr(e,t,s,r,a).filter(u=>u.kind==="path"),l=s.split(`
21
- `).map((u,d)=>({kind:"md",line:d,text:u,spPath:r,crPath:a}));return[...c,...l]}function Ds(n,e,t,r){if(e!=="commentray-and-paths")return{documentedPairs:[],pathRowsForOrdering:[],pathBlobWide:""};let o=oo(n.getAttribute("data-documented-pairs-b64")?.trim()??""),i=$n(o),s=i.length>0?i.map(a=>a.text).join(`
19
+ `),a=[];return n==="commentray-and-paths"&&(r.trim()&&a.push({kind:"path",line:a.length,text:r}),o.trim()&&a.push({kind:"path",line:a.length,text:o})),[...n==="full"?s.map((c,l)=>({kind:"code",line:l,text:c})):[],...a,...i.map((c,l)=>({kind:"md",line:l,text:c}))]}function fr(n){let e=Fe.createDefaultSearcher();return e.indexEntities(n,t=>t.kind==="md"&&t.crPath?`md:${t.crPath}:${t.line}`:t.kind==="path"?`path:${t.spPath??""}|${t.crPath??""}|${t.line}|${t.text.slice(0,120)}`:`${t.kind}:${t.line}`,t=>[t.text]),e}function Hi(n,e){let t=n;for(;t;){if(t.classList?.contains("hit"))return t;if(t===e)return null;t=t.parentElement}return null}function pn(n){return[...n.querySelectorAll("button.hit")].filter(e=>e instanceof HTMLButtonElement)}function pr(n){return[...n.querySelectorAll("a.tree-file-link")].filter(e=>e instanceof HTMLAnchorElement)}function Ci(n){let e=document.getElementById(`code-line-${String(n)}`);e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}function xi(n,e){let t=(n.getAttribute("data-cr-path")??"").trim(),r=(n.getAttribute("data-sp-path")??"").trim(),o=Ge(e.mutable.documentedPairs,t,r);if(o&&jt(o,e.filePathLabel,e.mutable.commentrayPathLabel)){(M(e.docScrollEl)?e.docScrollEl:A()).scrollTo({top:0,behavior:"smooth"});return}o&&Gr(o,null)}function Ai(n,e,t){let r=t.mutable.commentrayPathLabel.trim(),o=e.trim();if(o.length>0&&L(o)!==L(r)){let i=Ge(t.mutable.documentedPairs,o,"");if(i){Gr(i,n);return}return}qr(t.docScrollEl,n,t.mutable.mdLines.length)}function Wr(n,e){let t=n.getAttribute("data-kind"),r=parseInt(n.getAttribute("data-line")||"0",10),o=n.getAttribute("data-cr-path")?.trim()??"";if(t==="code"){Ci(r);return}if(t==="path"){xi(n,e);return}Ai(r,o,e)}function Bi(n,e,t){let r={currentCommentrayPath:t.commentrayPathLabel,currentSourcePath:e};if(n==="full"){let l=e.trim();if(l.length===0)return null;let u=[{sourcePath:l,commentrayPath:t.commentrayPathLabel.trim()}],d=cn("full",u.length,u.length,!1);return ln(d,u,r)}let{rows:o,totalUnique:i}=qn(t.documentedPairs);if(o.length>0){let l=cn("commentray-and-paths",o.length,i,!1);return ln(l,o,r)}let s=e.trim();if(s.length===0)return null;let a=[{sourcePath:s,commentrayPath:t.commentrayPathLabel.trim()}],c=cn("commentray-and-paths",a.length,a.length,!0);return ln(c,a,r)}function $(n){n.focus({preventScroll:!0}),n.scrollIntoView({block:"nearest",inline:"nearest"})}function Ii(n,e){n.addEventListener("keydown",t=>{if(t.isComposing||n.hidden)return;let r=pn(n);if(r.length===0)return;let o=document.activeElement;if(!(o instanceof HTMLButtonElement)||!o.classList.contains("hit"))return;let i=r.indexOf(o);if(!(i<0)){if(t.key==="ArrowDown"&&i<r.length-1){$(r[i+1]),t.preventDefault();return}if(t.key==="ArrowUp"){if(i>0){$(r[i-1]),t.preventDefault();return}$(e),t.preventDefault()}}})}function Ri(n,e,t){let{renderEmptyBrowsePreview:r,runSearch:o,cancelDebounceTimer:i,hitClickDeps:s}=t;n.addEventListener("keydown",a=>{if(a.isComposing)return;if(a.key==="ArrowDown"){if(!e.hidden){let l=pn(e);if(l.length>0&&document.activeElement===n){$(l[0]),a.preventDefault();return}}if(Se(n.value).length>0)return;r(),a.preventDefault();return}if(a.key!=="Enter")return;i(),Se(n.value).length>0&&o();let c=pn(e);!e.hidden&&c.length>0&&document.activeElement===n&&(a.preventDefault(),Wr(c[0],s))})}function Vr(n){let{scope:e,filePathLabel:t,mutable:r,rawCode:o,searchInput:i,searchClear:s,searchResults:a,docScrollEl:c}=n,l;function u(){clearTimeout(l),l=void 0}function d(){u(),i.value="",a.innerHTML="",a.hidden=!0}function m(){let p=Bi(e,t,r);p!==null&&(a.hidden=!1,a.innerHTML=p)}function h(){let p=Se(i.value);if(p.length===0){a.hidden=!0,a.innerHTML="";return}let g=Ei({scope:e,filePathLabel:t,commentrayPathLabel:r.commentrayPathLabel,rawCode:o,rawMd:r.rawMd,searcher:r.searcher,queryRaw:i.value,tokens:p,pathBlobWide:r.pathBlobWide,pathRowsForOrdering:r.pathRowsForOrdering.length>0?r.pathRowsForOrdering:void 0});a.hidden=!1,a.innerHTML=Li(e,g,p,{currentCommentrayPath:r.commentrayPathLabel,currentSourcePath:t})}let f={mutable:r,docScrollEl:c,filePathLabel:t};a.addEventListener("click",p=>{let g=Hi(p.target,a);g&&Wr(g,f)}),Ii(a,i),i.addEventListener("input",()=>{clearTimeout(l),l=setTimeout(h,200)}),Ri(i,a,{renderEmptyBrowsePreview:m,runSearch:h,cancelDebounceTimer:u,hitClickDeps:f}),s.addEventListener("click",d),document.addEventListener("keydown",p=>{if(p.key!=="Escape")return;let g=i.value.trim().length>0,E=document.activeElement===i,b=!a.hidden;!g&&!E&&!b||(d(),E&&i.blur(),p.preventDefault())})}function Ur(n,e,t,r,...o){let i=o.filter(a=>a instanceof HTMLElement),s=O(localStorage,n)==="1";if(t.checked=s,s){e.classList.add("wrap");for(let a of i)a.classList.add("wrap")}else{e.classList.remove("wrap");for(let a of i)a.classList.remove("wrap")}t.addEventListener("change",()=>{if(t.checked){e.classList.add("wrap");for(let a of i)a.classList.add("wrap");I(localStorage,n,"1")}else{e.classList.remove("wrap");for(let a of i)a.classList.remove("wrap");I(localStorage,n,"0")}r&&queueMicrotask(()=>{requestAnimationFrame(()=>{r(),requestAnimationFrame(()=>{r()})})})})}function Yr(n){let e=n.trim();if(!e)return[];try{let t=JSON.parse(D(e));if(!Array.isArray(t))return[];let r=[];for(let o of t){if(typeof o!="object"||o===null)continue;let i=o;if(typeof i.id=="string"&&typeof i.commentrayLine=="number"&&typeof i.sourceStart=="number"&&typeof i.sourceEnd=="number"){let s=i.markerViewportHalfOpen1Based,a=typeof s=="object"&&s!==null&&typeof s.lo=="number"&&typeof s.hiExclusive=="number"?{lo:s.lo,hiExclusive:s.hiExclusive}:{lo:i.sourceStart,hiExclusive:i.sourceEnd+1};r.push({id:i.id,commentrayLine:i.commentrayLine,sourceStart:i.sourceStart,sourceEnd:i.sourceEnd,markerViewportHalfOpen1Based:a})}}return r}catch{return[]}}function Qr(n=64){let e=A(),t=Math.max(0,e.scrollHeight-e.clientHeight);return t>0&&e.scrollTop>=t-n}function jr(n,e=64){let t=Math.max(0,n.scrollHeight-n.clientHeight);return t>0&&n.scrollTop>=t-e}function Kr(n){let e=n.getAttribute("data-commentray-line");return e===null||e===""?null:Number(e)}function gr(n,e){let t=[];for(let r of n){let o=Kr(r);o!==null&&t.push({line0:o,top:r.getBoundingClientRect().top})}return Dn(t,e)}function yr(n){for(let e=n.length-1;e>=0;e--){let t=n.item(e);if(!t)continue;let r=Kr(t);if(r!==null)return r}return null}function Xr(n,e="code-line-"){let t=n.querySelectorAll(`[id^="${e}"]`);if(t.length===0)return 1;if(!M(n)){if(Qr()){let u=t[t.length-1],d=/^(?:code-line-|code-md-line-)(\d+)$/.exec(u.id);return d?Number(d[1])+1:t.length}let i=n.getBoundingClientRect(),s=globalThis.innerHeight,a=Math.max(0,i.top),c=Math.min(s,i.bottom),l=a+j(c-a);for(let u of t)if(u.getBoundingClientRect().bottom>l-.001){let m=/^(?:code-line-|code-md-line-)(\d+)$/.exec(u.id);return m?Number(m[1])+1:1}return t.length}if(jr(n)){let i=t[t.length-1],s=/^(?:code-line-|code-md-line-)(\d+)$/.exec(i.id);return s?Number(s[1])+1:t.length}let o=n.getBoundingClientRect().top+n.clientTop+j(n.clientHeight);for(let i of t)if(i.getBoundingClientRect().bottom>o-.001){let a=/^(?:code-line-|code-md-line-)(\d+)$/.exec(i.id);return a?Number(a[1])+1:1}return t.length}function Sn(n){let e=n.querySelectorAll(".commentray-block-anchor");if(e.length===0)return null;if(!M(n)){if(Qr()){let l=yr(e);if(l!==null)return l}let o=n.getBoundingClientRect(),i=globalThis.innerHeight,s=Math.max(0,o.top),a=Math.min(i,o.bottom),c=s+j(a-s);return gr(e,c)}if(jr(n)){let o=yr(e);if(o!==null)return o}let r=n.getBoundingClientRect().top+n.clientTop+j(n.clientHeight);return gr(e,r)}function Jr(){let n=document.getElementById("shell");return n instanceof HTMLElement?n.getAttribute("data-page-breaks-enabled")==="true":!1}function Pi(n){if(!M(n)){let t=n.getBoundingClientRect(),r=globalThis.innerHeight,o=Math.max(0,t.top),i=Math.min(r,t.bottom);return o+j(i-o)}return n.getBoundingClientRect().top+n.clientTop+j(n.clientHeight)}function Di(n){if(!Jr())return null;let e=Pi(n),t=Array.from(n.querySelectorAll(".commentray-page-break[data-next-source-viewport-line]"));for(let r of t){let o=r.getAttribute("data-next-source-viewport-line");if(!o)continue;let i=Number.parseInt(o,10);if(!Number.isFinite(i)||i<=0)continue;let s=r.getBoundingClientRect().top,a=r.getAttribute("data-next-commentray-line"),c=a?Number.parseInt(a,10):Number.NaN,l=Number.isFinite(c)&&c>=0?n.querySelector(`[data-commentray-line="${String(c)}"]`):null,u=l?l.getBoundingClientRect().top:s+r.clientHeight;if(!(s<=e&&e<u))continue;let d=Math.max(1,u-s),m=w((e-s)/d,0,1),f=globalThis.matchMedia("(max-width: 767px)").matches?.2:.35;return m<f?null:i-1}return null}var Fi=Math.max(320,1050);function Ni(n){let e=performance.now()+Fi;n.until=Math.max(n.until,e)}function Zr(n){return performance.now()<n.until}var Oi=200;function _i(n,e,t,r){let o=performance.now();!bn()||o-e.lastEchoSkipTraceAt<Oi||(e.lastEchoSkipTraceAt=o,S(`wire.${n}.flush-skipped`,{reason:"partner-echo",echoUntilMs:Math.round(t.until),[`${n}ScrollTop`]:r.scrollTop}))}function br(n){let{axis:e,driverPane:t,state:r,syncingRef:o,ownEchoGate:i,partnerEchoGate:s,syncFromDriver:a}=n;return()=>{if(r.pendingRaf=0,Zr(i)){_i(e,r,i,t),r.lastSeenTop=t.scrollTop;return}if(o.current!=="none"){S(`wire.${e}.flush-skipped`,{reason:"sync-in-progress",syncing:o.current});return}let c=t.scrollTop,l=c-r.lastSeenTop;r.lastSeenTop=c,o.current=e,Ni(s),S(`wire.${e}.driver`,{delta:l,[`${e}ScrollTop`]:c}),a(l),o.current="none"}}function Sr(n){let{driverPane:e,state:t,syncingRef:r,ownEchoGate:o,flush:i}=n;e.addEventListener("scroll",()=>{if(Zr(o)){t.lastSeenTop=e.scrollTop,t.pendingRaf!==0&&(cancelAnimationFrame(t.pendingRaf),t.pendingRaf=0);return}if(r.current!=="none"){t.lastSeenTop=e.scrollTop;return}t.pendingRaf!==0&&cancelAnimationFrame(t.pendingRaf),t.pendingRaf=requestAnimationFrame(i)},{passive:!0})}function eo(n,e,t,r){let o={current:"none"},i={until:0},s={until:0},a={lastSeenTop:n.scrollTop,pendingRaf:0,lastEchoSkipTraceAt:-1/0},c={lastSeenTop:e.scrollTop,pendingRaf:0,lastEchoSkipTraceAt:-1/0},l=br({axis:"code",driverPane:n,state:a,syncingRef:o,ownEchoGate:i,partnerEchoGate:s,syncFromDriver:t}),u=br({axis:"doc",driverPane:e,state:c,syncingRef:o,ownEchoGate:s,partnerEchoGate:i,syncFromDriver:r});Sr({driverPane:n,state:a,syncingRef:o,ownEchoGate:i,flush:l}),Sr({driverPane:e,state:c,syncingRef:o,ownEchoGate:s,flush:u})}function Tr(n,e){let{codePane:t,docPane:r,getLinks:o,lineIdPrefix:i,sticky:s}=n,a=z(r),c=i(),l=zr(t,r,o,c,s,n.allowProportionalMirror);tt(t,r,l);let u=z(r);S("code\u2192doc.apply",{driverDelta:e,lineIdPrefix:c,plan:se(l),docScrollTopBefore:a,docScrollTopAfter:u,docDelta:u-a,codeScrollTop:t.scrollTop}),Je({driverDelta:e,partnerBefore:a,partnerPane:r,axis:"code\u2192doc"})}function wr(n,e){let{codePane:t,docPane:r,getLinks:o,lineIdPrefix:i,sticky:s}=n,a=z(t),c=i(),l=_r(r,t,o,s,c,n.allowProportionalMirror);et(t,r,l,c);let u=z(t);S("doc\u2192code.apply",{driverDelta:e,lineIdPrefix:c,plan:ie(l),codeScrollTopBefore:a,codeScrollTopAfter:u,codeDelta:u-a,docScrollTop:r.scrollTop}),Je({driverDelta:e,partnerBefore:a,partnerPane:t,axis:"doc\u2192code"})}function un(n,e,t,r,o,i){let s=i?.allowProportionalMirror!==!1,a=null,c=null,l={sourceSticky:{lockedId:null},commentraySticky:{lockedId:null},linksKey:{current:""}},u={codePane:n,docPane:e,getLinks:t,lineIdPrefix:r,sticky:l,allowProportionalMirror:s},d=y=>Tr(u,y),m=y=>wr(u,y),h=()=>{Tr(u,0)},f=()=>{wr(u,0)},p=()=>{if(s&&o?.()===!0){a={k:"mirrorW",ratio:ke()};return}a=_r(e,n,t,l,r(),s)},g=()=>{if(!a)return;let y=a;a=null,y.k==="noop"&&y.skipProportionalFallbackOnFlip!==!0&&s&&(y=hn(e)),et(n,e,y,r())},E=()=>{c=zr(n,e,t,r(),l,s)},b=()=>{if(!c)return;let y=c;c=null,y.k==="noop"&&s&&(y=fn(n)),tt(n,e,y)};return eo(n,e,d,m),{syncFromCodeToDoc:h,syncFromDocToCode:f,prepareMobileFlipToCode:p,finishMobileFlipToCode:g,prepareMobileFlipToDoc:E,finishMobileFlipToDoc:b}}function zi(n,e){let t=null,r=null,o=m=>{let h=z(e),f=fn(n);tt(n,e,f),S("code\u2192doc.apply",{mode:"proportional-shell",driverDelta:m,plan:se(f),docScrollTopBefore:h,docScrollTopAfter:z(e),codeScrollTop:n.scrollTop}),Je({driverDelta:m,partnerBefore:h,partnerPane:e,axis:"code\u2192doc"})},i=m=>{let h=z(n),f=hn(e);et(n,e,f),S("doc\u2192code.apply",{mode:"proportional-shell",driverDelta:m,plan:ie(f),codeScrollTopBefore:h,codeScrollTopAfter:z(n),docScrollTop:e.scrollTop}),Je({driverDelta:m,partnerBefore:h,partnerPane:n,axis:"doc\u2192code"})},s=()=>{o(0)},a=()=>{i(0)},c=()=>{t=hn(e)},l=()=>{if(!t)return;let m=t;t=null,et(n,e,m)},u=()=>{r=fn(n)},d=()=>{if(!r)return;let m=r;r=null,tt(n,e,m)};return eo(n,e,o,i),{syncFromCodeToDoc:s,syncFromDocToCode:a,prepareMobileFlipToCode:c,finishMobileFlipToCode:l,prepareMobileFlipToDoc:u,finishMobileFlipToDoc:d}}function to(n){let e=n.getBoundingClientRect();return(e.top+e.bottom)/2}function Er(n){return to(n)}function $i(n,e,t,r){if(e){let a=document.getElementById(`commentray-block-${e.id}`);if(!a)return to(t);let c=a.getBoundingClientRect().top-3;return r?Pn(n,t,a):c}let i=n.getBoundingClientRect().bottom-4,s=n.children[n.children.length-1];if(s&&(i=Math.min(i,s.getBoundingClientRect().bottom-4)),r){let a=t.getBoundingClientRect().top+4,c=_e(n,t,null);i=Math.min(i,Math.max(a,c))}return i}function no(n,e){if(!n.startsWith(e))return null;let t=Number.parseInt(n.slice(e.length),10);return Number.isFinite(t)?t:null}function ro(n,e){let t=0,r=n.length-1,o=-1;for(;t<=r;){let i=t+r>>1;(n[i]?.line0??-1)>=e?(o=i,r=i-1):t=i+1}return o>=0?n[o]?.el??null:null}function qi(n,e){let t=0,r=n.length-1,o=-1;for(;t<=r;){let i=t+r>>1;(n[i]?.line0??-1)<=e?(o=i,t=i+1):r=i-1}return o>=0?n[o]?.el??null:null}function Gi(n){return Array.from(document.querySelectorAll(`[id^="${n}"]`)).map(e=>({line0:no(e.id,n),el:e})).filter(e=>e.line0!==null).sort((e,t)=>e.line0-t.line0)}function Wi(n,e,t,r){let o=()=>r();e.addEventListener("scroll",o,{passive:!0}),t.addEventListener("scroll",o,{passive:!0}),globalThis.addEventListener("resize",o);let i=new ResizeObserver(o);i.observe(n),i.observe(e),i.observe(t);let s=n.parentElement;s&&i.observe(s)}function Vi(n,e,t){let r=Sn(e);return e.querySelector(".commentray-block-anchor")!==null&&r!==null?In(n,r):Bn(n,t())}function Ui(n,e,t,r,o,i){let s=Cn(r()),a=Ne(s),c=e.getBoundingClientRect(),l=c.width,u=c.height;if(l<=0||u<=0||a.length===0){n.replaceChildren();return}let d=Vi(s,t,o),m=Jr();n.setAttribute("viewBox",`0 0 ${String(l)} ${String(u)}`),n.setAttribute("preserveAspectRatio","none");let h=[],f=Array.from(document.querySelectorAll(`[id^="${i}"]`)).map(p=>({line0:no(p.id,i),el:p})).filter(p=>p.line0!==null).sort((p,g)=>p.line0-g.line0);for(let p=0;p<a.length;p++){let g=a[p];if(!g)continue;let E=An(s,g),b=Wt(g.sourceStart),y=Wt(g.sourceEnd),C=document.getElementById(`${i}${String(b)}`)??ro(f,b),x=document.getElementById(`${i}${String(y)}`)??qi(f,y),k=document.getElementById(`commentray-block-${g.id}`);if(!C||!x||!k)continue;let H=$i(t,E,k,m),R=Er(C),J=Er(x),Z=k.getBoundingClientRect().top+2,F=Math.max(H,Z+4),le=N(R,c.top,u),vn=N(Z,c.top,u),Mn=N(J,c.top,u),Ln=N(F,c.top,u),st=g.id===d?"gutter__rays-path gutter__rays-path--active":"gutter__rays-path",kn=`${st} gutter__rays-path--trail`,at=be(0,le.y,l,vn.y,{tension:.38,clipStart:le.clipped,clipEnd:vn.clipped}),ct=be(0,Mn.y,l,Ln.y,{tension:.38,clipStart:Mn.clipped,clipEnd:Ln.clipped}),wo=at.dotted?`<path class="${kn}" d="${at.dotted}" />`:"",Eo=ct.dotted?`<path class="${kn}" d="${ct.dotted}" />`:"";h.push(`<g class="gutter__rays-block" data-commentray-block="${B(g.id)}"><path class="${st}" d="${at.solid}" />`+wo+`<path class="${st}" d="${ct.solid}" />`+Eo+"</g>")}n.innerHTML=h.join("")}function Yi(n){let{gutter:e,codePane:t,docScrollEl:r,getLinks:o,probeTopSourceLine1Based:i}=n,s=n.sourceLineIdPrefix??(()=>"code-line-"),a="http://www.w3.org/2000/svg",c=document.createElement("div");c.className="gutter__rays",c.setAttribute("aria-hidden","true");let l=document.createElementNS(a,"svg");c.appendChild(l),e.appendChild(c);let u=0;function d(){u===0&&(u=globalThis.requestAnimationFrame(()=>{u=0,Ui(l,e,r,o,i,s())}))}return Wi(e,t,r,d),d(),globalThis.requestAnimationFrame(()=>{d(),globalThis.requestAnimationFrame(d)}),d}function Qi(n){if(typeof n!="object"||n===null)return!1;let e=n;if(typeof e.sourcePath!="string"||typeof e.commentrayPath!="string"||e.staticBrowseUrl!==void 0&&typeof e.staticBrowseUrl!="string")return!1;let t=e.sourceOnGithub,r=e.commentrayOnGithub,o=typeof t=="string";return!(o!==(typeof r=="string")||!(typeof e.staticBrowseUrl=="string"&&e.staticBrowseUrl.trim().length>0)&&!o)}function Tn(n){let e=[];if(!Array.isArray(n))return e;for(let t of n)Qi(t)&&e.push(t);return e}function ji(n){if(n.kind!=="commentrayLine"||typeof n.line!="number"||typeof n.text!="string")return null;let e=typeof n.sourcePath=="string"?n.sourcePath:"",t=typeof n.commentrayPath=="string"?n.commentrayPath:"";return{kind:"md",line:n.line,text:n.text,spPath:e,crPath:t}}function Ki(n,e){if(n.kind!=="sourcePath"&&n.kind!=="commentrayPath")return null;let t=typeof n.sourcePath=="string"?n.sourcePath:"",r=typeof n.commentrayPath=="string"?n.commentrayPath:"",o=n.kind==="sourcePath"?t:r;return o?{kind:"path",line:e,text:o,spPath:t,crPath:r}:null}function Xi(n){if(!n||typeof n!="object")return[];let e=n.rows;if(!Array.isArray(e))return[];let t=[],r=0;for(let o of e){if(!o||typeof o!="object")continue;let i=o,s=ji(i);if(s){t.push(s);continue}let a=Ki(i,r);a&&(t.push(a),r+=1)}return t}function oo(n){let e=n.trim();if(e==="")return[];try{let t=JSON.parse(D(e));return Tn(t)}catch{return[]}}function Ji(n,e){let t=e.sourcePath.split("/").filter(Boolean);if(t.length===0)return;let r=n;for(let o=0;o<t.length;o++){let i=t[o];if(i===void 0)continue;r.children.has(i)||r.children.set(i,{children:new Map,pairs:[]});let s=r.children.get(i);if(s===void 0)return;o===t.length-1&&s.pairs.push(e),r=s}}function Zi(n){let e=n.replace(/\\/g,"/").replace(/\/+$/,""),t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function es(n){return(n.replace(/\\/g,"/").replace(/\/+$/,"").split("/").filter(Boolean).at(-1)??"").replace(/\.md$/i,"")}function ts(n,e){let t=Zi(n.sourcePath);if(!e)return t;let r=es(n.commentrayPath);return r!==""&&r!==t?`${t} \xB7 ${r}`:t}function ns(n){let e=(n.staticBrowseUrl??"").trim();if(e.length>0)return Q(e,globalThis.location.pathname,globalThis.location.origin);let t=(n.commentrayOnGithub??"").trim();return t.length>0?t:"#"}function rs(n){return(n.staticBrowseUrl??"").trim().length>0?`${n.sourcePath} \u2014 open this pair in the site viewer`:(n.commentrayOnGithub??"").trim().length>0?`${n.sourcePath} \u2014 open companion commentray on the repository host`:n.sourcePath}function os(n){for(let e of n.querySelectorAll("a.tree-file-link"))e instanceof HTMLAnchorElement&&(e.classList.remove("tree-file-link--current"),e.removeAttribute("aria-current"))}function is(n,e,t){for(let r of n.querySelectorAll("a.tree-file-link")){if(!(r instanceof HTMLAnchorElement))continue;let o=r.getAttribute("data-pair-source-path")?.trim()??"",i=r.getAttribute("data-pair-commentray-path")?.trim()??"";if(jt({sourcePath:o,commentrayPath:i},e,t)){r.classList.add("tree-file-link--current"),r.setAttribute("aria-current","page");break}}}function wn(){let n=document.getElementById("shell"),e=document.getElementById("documented-files-tree");if(!(n instanceof HTMLElement)||!(e instanceof HTMLElement))return;os(e);let t=n.getAttribute("data-commentray-pair-source-path")?.trim()??"",r=n.getAttribute("data-commentray-pair-commentray-path")?.trim()??"";t.length===0||r.length===0||is(e,t,r)}function io(n){let e=[...n.children.keys()].sort((r,o)=>r.localeCompare(o));if(e.length===0)return"";let t=[];for(let r of e){let o=n.children.get(r);if(o!==void 0){if(o.children.size>0){let i=io(o);t.push(`<li><div class="tree-dir">${B(r)}</div>${i}</li>`)}if(o.pairs.length>0){let i=o.pairs.length>1;for(let s of o.pairs){let a=B(ts(s,i)),c=B(rs(s)),l=B(ns(s)),u=B(L(s.sourcePath)),d=B(L(s.commentrayPath)),h=(s.staticBrowseUrl?.trim()??"").length>0?"":' target="_blank" rel="noopener noreferrer"';t.push(`<li><div class="tree-file"><a class="tree-file-link" href="${l}" data-pair-source-path="${u}" data-pair-commentray-path="${d}"${h} title="${c}">${a}</a></div></li>`)}}}}return`<ul>${t.join("")}</ul>`}function ss(n,e,t){if(e.length===0){n.innerHTML=t?'<p class="nav-rail__doc-hub-hint" role="status">No paths match this filter.</p>':'<p class="nav-rail__doc-hub-hint" role="status">No documented pairs in this export.</p>';return}let r={children:new Map,pairs:[]};for(let o of e)Ji(r,o);n.innerHTML=io(r),wn()}function as(n,e){let t=null,r=null;return async()=>t!==null?t:(r===null&&(r=(async()=>{if(e.length>0&&(t=oo(e),t.length>0))return;if(n.length===0){t=[];return}let o=await fetch(n,{credentials:"same-origin"});if(!o.ok)throw new Error(`nav json ${String(o.status)}`);let i=await o.json();t=Tn(i.documentedPairs)})()),await r,t??[])}function cs(n){let e=n.querySelector(".nav-rail__doc-hub-inner");if(!(e instanceof HTMLElement))return()=>{};let t=e,r=globalThis.matchMedia("(max-width: 767px)");function o(){let s=n.querySelector("summary");return s instanceof HTMLElement?s:null}function i(){if(!n.open||!r.matches){t.style.removeProperty("position"),t.style.removeProperty("top"),t.style.removeProperty("left"),t.style.removeProperty("right"),t.style.removeProperty("width"),t.style.removeProperty("max-width"),t.style.removeProperty("max-height"),t.style.removeProperty("z-index");return}let s=o();if(!s)return;let a=s.getBoundingClientRect(),c=8;t.style.position="fixed",t.style.top=`${String(Math.round(a.bottom+4))}px`,t.style.left=`${String(Math.round(c))}px`,t.style.right=`${String(Math.round(c))}px`,t.style.width="auto",t.style.maxWidth="none",t.style.maxHeight="min(52vh, 400px)",t.style.zIndex="200"}return r.addEventListener("change",i),globalThis.addEventListener("resize",i),globalThis.addEventListener("scroll",i,!0),i}function ls(){let n=document.getElementById("documented-files-filter");n instanceof HTMLInputElement&&$(n)}function vr(n){let e=n.querySelector("summary");e instanceof HTMLElement&&e.focus({preventScroll:!0})}function us(n){function e(t){!n.open||t.key!=="Escape"||(t.preventDefault(),n.open=!1,vr(n))}document.addEventListener("keydown",e,!0),document.addEventListener("pointerdown",t=>{if(!n.open)return;let r=t.target;r instanceof Node&&(n.contains(r)||(n.open=!1,vr(n)))},!0)}function ds(){let n=document.getElementById("documented-files-hub"),e=document.getElementById("documented-files-tree"),t=document.getElementById("documented-files-filter"),r=document.getElementById("shell");if(!(n instanceof HTMLDetailsElement)||!(e instanceof HTMLElement))return;let o=n,i=e,s=o.getAttribute("data-nav-json-url")?.trim()??"",a=r?.getAttribute("data-documented-pairs-b64")?.trim()??"";if(s.length===0&&a.length===0)return;let c=cs(o),l=as(s,a),u=null;function d(){if(u===null)return;let h=t instanceof HTMLInputElement?t.value:"",f=zn(u,h),p=h.trim().length>0;ss(i,f,p&&u.length>0&&f.length===0)}async function m(){try{u=await l(),d()}catch{u=null,i.innerHTML='<p class="nav-rail__doc-hub-hint" role="alert">Could not load the file list.</p>'}}o.addEventListener("toggle",()=>{c(),o.open&&globalThis.requestAnimationFrame(()=>{c(),ls()}),o.open&&m()}),us(o),i.addEventListener("keydown",h=>{if(!o.open||h.isComposing)return;let f=h.target;if(!(f instanceof HTMLAnchorElement)||!f.classList.contains("tree-file-link"))return;let p=pr(i);if(p.length===0)return;let g=p.indexOf(f);if(!(g<0)){if(h.key==="ArrowDown"){g<p.length-1&&($(p[g+1]),h.preventDefault());return}if(h.key==="ArrowUp"){if(g>0){$(p[g-1]),h.preventDefault();return}t instanceof HTMLInputElement&&($(t),h.preventDefault())}}}),t instanceof HTMLInputElement&&(t.addEventListener("input",()=>{!o.open||u===null||d()}),t.addEventListener("keydown",h=>{if(!o.open||h.isComposing||h.key!=="ArrowDown")return;let f=pr(i);f.length!==0&&($(f[0]),h.preventDefault())}))}function ms(n,e,t,r,o){let i=!1,s=o;function a(l){if(!i)return;let u=e.getBoundingClientRect(),d=l.clientX-u.left,m=w(d/u.width*100,15,85);s=m,t.style.flex=`0 0 ${m}%`,e.style.setProperty("--split-pct",`${String(m)}%`)}function c(){i=!1,window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",c),document.body.style.cursor="",document.body.style.userSelect="",I(localStorage,n,String(s))}r.addEventListener("mousedown",l=>{l.preventDefault(),i=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",a),window.addEventListener("mouseup",c)})}var nt="commentray.codeCommentrayStatic.splitPct",so="commentray.codeCommentrayStatic.wrap",gn="commentray.codeCommentrayStatic.dualMobilePane",hs="commentray.codeCommentrayStatic.sourceMarkdownPaneMode",fs="commentray.codeCommentrayStatic.pageBreaksEnabled",it="(max-width: 767px)";function ae(n){return n==="code"?"code":"doc"}function ao(n){let e=n.replace(/^#/,"").trim();return e.length===0?[]:e.split(/--|&/).map(t=>t.trim()).filter(t=>t.length>0)}function co(n){return`mobile-pane-${n}`}function ps(n){let e=ao(n);for(let t of e){if(t==="mobile-pane-code")return"code";if(t==="mobile-pane-doc")return"doc"}return null}function gs(n,e){let t=ao(globalThis.location.hash).filter(o=>!e(o));t.push(n);let r=new URL(globalThis.location.href);r.hash=t.length>0?t.join("&"):"",globalThis.history.replaceState(globalThis.history.state,"",r.toString())}function lo(n){gs(co(n),e=>/^mobile-pane-(?:code|doc)$/.test(e))}function Me(){return globalThis.matchMedia(it).matches}function Mr(n,e){if(e){n.setAttribute("data-mobile-single-pane","true");return}n.removeAttribute("data-mobile-single-pane")}function ys(n){let e=document.getElementById("commentray-help-tour");e instanceof HTMLButtonElement&&e.addEventListener("click",()=>{nn(n,Me,{force:!0})})}function q(n){return n.getAttribute("data-source-pane-mode")==="rendered-markdown"?"rendered-markdown":"source"}function bs(n){let e=(n??"").trim().toLowerCase();return!(e==="0"||e==="false"||e==="off")}function Ss(n){let e=bs(O(localStorage,fs));n.setAttribute("data-page-breaks-enabled",e?"true":"false")}function Ts(n){let e=()=>{let t=Math.max(globalThis.innerHeight,document.documentElement?.clientHeight??0);if(!Number.isFinite(t)||t<=0)return;let r=Math.round(w(t*.72,260,820));n.style.setProperty("--commentray-page-break-min-height",`${String(r)}px`)};globalThis.addEventListener("resize",e,{passive:!0}),globalThis.addEventListener("orientationchange",e,{passive:!0}),globalThis.visualViewport?.addEventListener("resize",e,{passive:!0}),e()}function Lr(n){let e=document.querySelector("label.toolbar-wrap-lines");e instanceof HTMLLabelElement&&(e.hidden=q(n)==="rendered-markdown")}function Ee(n){return q(n)==="rendered-markdown"?"code-md-line-":"code-line-"}function ws(n,e){let t=()=>{if(n.getAttribute("data-layout")!=="dual"||!e.matches||ae(n.getAttribute("data-dual-mobile-pane"))!=="doc")return;let r=document.getElementById("doc-pane-body");r instanceof HTMLElement&&ce(r)};queueMicrotask(()=>{t(),requestAnimationFrame(()=>{t(),requestAnimationFrame(t)})})}function Es(n,e,t){let r=()=>{e.hidden=!0,e.classList.remove("is-visible")},o=()=>{e.hidden=!1,e.classList.add("is-visible")},i=()=>{if(!t.matches){r();return}let s=n.getBoundingClientRect(),a=globalThis.innerHeight,c=10;s.bottom<c||s.top>a-c?o():r()};globalThis.addEventListener("scroll",i,{passive:!0}),globalThis.addEventListener("resize",i,{passive:!0}),t.addEventListener("change",i),globalThis.requestAnimationFrame(i)}function vs(n,e,t){let r=()=>{e.hidden=!0,e.classList.remove("is-visible")},o=()=>{e.hidden=!1,e.classList.add("is-visible")},i=()=>{if(n.hidden||n.getClientRects().length===0){r();return}let s=n.getBoundingClientRect(),a=globalThis.innerHeight,c=10;s.bottom<c||s.top>a-c?o():r()};globalThis.addEventListener("scroll",i,{passive:!0,signal:t}),globalThis.addEventListener("resize",i,{passive:!0,signal:t}),globalThis.requestAnimationFrame(i)}function kr(n,e,t){let r=Me()&&ae(n.getAttribute("data-dual-mobile-pane"))!=="code";e.hidden=r,r?(e.setAttribute("aria-hidden","true"),e.style.setProperty("display","none","important")):(e.removeAttribute("aria-hidden"),e.style.removeProperty("display")),t instanceof HTMLButtonElement&&(t.hidden=!0,t.classList.remove("is-visible"))}function Ms(n,e){let t=n.querySelectorAll(`[id^="${e}"]`);if(t.length===0)return null;let r=M(n)?n.getBoundingClientRect().top+n.clientTop+2:Math.max(0,n.getBoundingClientRect().top)+2;for(let s of t)if(s.getBoundingClientRect().bottom>r-.001){let c=/^(?:code-line-|code-md-line-)(\d+)$/.exec(s.id);return c?.[1]?Number.parseInt(c[1],10):null}let o=t[t.length-1];if(!o)return null;let i=/^(?:code-line-|code-md-line-)(\d+)$/.exec(o.id);return i?.[1]?Number.parseInt(i[1],10):null}function Ls(n,e,t,r,o,i){function s(){return Array.from(e.querySelectorAll('[data-source-markdown-body="true"]'))}function a(){let h=q(n)==="rendered-markdown",f=h?"markdown source":"rendered markdown",p=h?"rendered markdown":"markdown source",g=`Switch source pane to ${f}`,E=`Switch source pane to ${f} (currently ${p})`,b=y=>{y instanceof HTMLButtonElement&&(y.setAttribute("aria-pressed",h?"true":"false"),y.setAttribute("aria-label",g),y.title=E)};b(t),b(r)}a(),Lr(n),kr(n,t,r);let c=()=>{kr(n,t,r)};globalThis.addEventListener("resize",c,{passive:!0,signal:o}),globalThis.matchMedia(it).addEventListener("change",c,{signal:o});let u=new MutationObserver(c);u.observe(n,{attributes:!0,attributeFilter:["data-dual-mobile-pane","data-source-pane-mode"]}),o.addEventListener("abort",()=>u.disconnect(),{once:!0});let d=()=>{let m=q(n),f=Ms(e,m==="rendered-markdown"?"code-md-line-":"code-line-"),p=m==="rendered-markdown"?"source":"rendered-markdown",g=p==="rendered-markdown"?"code-md-line-":"code-line-";n.setAttribute("data-source-pane-mode",p),I(localStorage,hs,p),Me()&&ae(n.getAttribute("data-dual-mobile-pane"))==="doc"&&(n.setAttribute("data-dual-mobile-pane","code"),I(localStorage,gn,"code"),lo("code")),a(),Lr(n);let E=!Me()||M(e);if(f!==null&&E){let b=e.querySelector(`#${g}${String(f)}`);b instanceof HTMLElement&&ot(e,b,0)}if(p==="rendered-markdown")for(let b of s())ce(b),Le(b);i?.()};t.addEventListener("click",d,{signal:o}),r&&(r.addEventListener("click",d,{signal:o}),vs(t,r,o))}function uo(n,e,t,r){let o=globalThis.matchMedia(it);function i(){let c=ps(globalThis.location.hash);return c!==null?c:ae(O(localStorage,gn))}function s(){o.matches?(Mr(n,!0),n.setAttribute("data-dual-mobile-pane",i())):(Mr(n,!1),n.removeAttribute("data-dual-mobile-pane"))}let a=()=>{if(!o.matches)return;let l=ae(n.getAttribute("data-dual-mobile-pane"))==="code"?"doc":"code",u=A().scrollTop;l==="code"?t.prepareMobileFlipToCode():t.prepareMobileFlipToDoc(),n.setAttribute("data-dual-mobile-pane",l),I(localStorage,gn,l),lo(l),globalThis.requestAnimationFrame(()=>{globalThis.requestAnimationFrame(()=>{if(l==="code"){t.finishMobileFlipToCode();let d=A();if(u>5&&d.scrollTop<=1){let m=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=w(u,0,m)}}else t.finishMobileFlipToDoc()})}),l==="doc"&&ws(n,o)};e.addEventListener("click",a),r&&(r.addEventListener("click",a),Es(e,r,o)),o.addEventListener("change",s),globalThis.addEventListener("hashchange",s),s()}function mo(n,e,t,r,o){let i=e instanceof HTMLTableElement?e:null,s=null,a=0,c=0,l=()=>{if(c=A().scrollTop,i===null){s=null,a=0;return}s=ho(i).find(p=>p.getBoundingClientRect().bottom>0)??null,a=s?.getBoundingClientRect().top??0},u=()=>{let h=A();if(s!==null){let p=s.getBoundingClientRect().top-a;if(Math.abs(p)>.5){let g=Math.max(0,h.scrollHeight-h.clientHeight);h.scrollTop=w(h.scrollTop+p,0,g);return}}let f=Math.max(0,h.scrollHeight-h.clientHeight);h.scrollTop=w(c,0,f)},d=()=>{i!==null&&on(i),u()};uo(n,t,{syncFromCodeToDoc:()=>{},syncFromDocToCode:()=>{},prepareMobileFlipToCode:l,prepareMobileFlipToDoc:l,finishMobileFlipToCode:()=>{d(),o?.()},finishMobileFlipToDoc:()=>{d(),o?.(),ce(n).then(()=>{requestAnimationFrame(()=>{d()})})}},r)}var Ke=null,yn=null;function ks(n){return n.getAttribute("data-stretch-buffer-sync")==="flow-synchronizer"}function ho(n){return Array.from(n.querySelectorAll("tbody tr.stretch-row--block[data-commentray-stretch-sync-id]")).filter(e=>(e.dataset.commentrayStretchSyncId?.trim()??"").length>0)}function Hs(n){let e=n.dataset.commentrayStretchSyncId?.trim()??"";if(e.length===0)return null;let t=n.querySelector(":scope > td.stretch-code"),r=n.querySelector(":scope > td.stretch-doc");return!(t instanceof HTMLTableCellElement)||!(r instanceof HTMLTableCellElement)?null:{id:e,codeRect:t.getBoundingClientRect(),docRect:r.getBoundingClientRect()}}function rt(n){if(!(n instanceof HTMLElement))return null;let e=n.getBoundingClientRect();if(e.width<=0||e.height<=0)return null;let t=globalThis.getComputedStyle(n);return t.display==="none"||t.visibility==="hidden"?null:e}function Cs(n,e){let t=q(e)==="rendered-markdown"?".source-pane--rendered-md":".source-pane--code",r=n.querySelector(t);if(rt(r)!==null)return r;let o=n.querySelectorAll(".source-pane--code, .source-pane--rendered-md");for(let i of o)if(rt(i)!==null)return i;return null}function xs(n,e){let t=Cs(n,e),r=rt(t);return r!==null?r.bottom:n.getBoundingClientRect().bottom}function As(n){let e=n.querySelector(":scope .stretch-doc-inner"),t=rt(e);return t!==null?t.bottom:n.getBoundingClientRect().bottom}function Bs(n,e){let t=n.getBoundingClientRect(),r=t.top+Math.min(Math.max(t.height*.18,24),120);for(let o of e){let i=o.getBoundingClientRect();if(i.top<=r&&i.bottom>=r)return o.dataset.commentrayStretchSyncId?.trim()??null}return e[0]?.dataset.commentrayStretchSyncId?.trim()??null}function Is(n,e,t,r){let o=ho(t),i=r.getBoundingClientRect(),s=i.width,a=i.height;if(s<=0||a<=0||o.length===0){n.replaceChildren();return}n.setAttribute("viewBox",`0 0 ${String(s)} ${String(a)}`),n.setAttribute("preserveAspectRatio","none");let c=Bs(e,o),l=[];for(let u of o){let d=Hs(u);if(d===null)continue;let m=u.querySelector(":scope > td.stretch-code"),h=u.querySelector(":scope > td.stretch-doc");if(!(m instanceof HTMLTableCellElement)||!(h instanceof HTMLTableCellElement))continue;let f=xs(m,e),p=As(h),g=N(d.codeRect.top+1,i.top,a),E=N(d.docRect.top+1,i.top,a),b=N(f-1,i.top,a),y=N(p-1,i.top,a),C=d.id===c?"gutter__rays-path gutter__rays-path--active":"gutter__rays-path",x=`${C} gutter__rays-path--trail`,k=be(0,g.y,s,E.y,{tension:.38,clipStart:g.clipped,clipEnd:E.clipped}),H=be(0,b.y,s,y.y,{tension:.38,clipStart:b.clipped,clipEnd:y.clipped}),R=k.dotted?`<path class="${x}" d="${k.dotted}" />`:"",J=H.dotted?`<path class="${x}" d="${H.dotted}" />`:"";l.push(`<g class="gutter__rays-block" data-commentray-block="${B(d.id)}"><path class="${C}" d="${k.solid}" />`+R+`<path class="${C}" d="${H.solid}" />`+J+"</g>")}n.innerHTML=l.join("")}function Rs(n,e,t){t.querySelector(":scope > .gutter__rays")?.remove();let r="http://www.w3.org/2000/svg",o=document.createElement("div");o.className="gutter__rays",o.setAttribute("aria-hidden","true");let i=document.createElementNS(r,"svg");o.appendChild(i),t.appendChild(o);let s=0,a=()=>{s===0&&(s=globalThis.requestAnimationFrame(()=>{s=0,Is(i,n,e,t)}))},c=()=>a();n.addEventListener("scroll",c,{passive:!0}),globalThis.addEventListener("resize",c);let l=new ResizeObserver(c);return l.observe(n),l.observe(e),l.observe(t),a(),globalThis.requestAnimationFrame(()=>{a(),globalThis.requestAnimationFrame(a)}),{disconnect:()=>{s!==0&&globalThis.cancelAnimationFrame(s),n.removeEventListener("scroll",c),globalThis.removeEventListener("resize",c),l.disconnect(),o.remove()},request:a}}function Ps(n,e){let t=document.getElementById("stretch-gutter");if(!(t instanceof HTMLElement))return;let r=Number.parseFloat(O(localStorage,nt)??""),o=w(Number.isFinite(r)?r:50,15,85);n.style.setProperty("--stretch-code-pct",`${String(o)}%`);let i=!1,s=c=>{if(!i)return;let l=e.getBoundingClientRect();if(l.width<=0)return;let u=c.clientX-l.left,d=w(u/l.width*100,15,85);n.style.setProperty("--stretch-code-pct",`${String(d)}%`),I(localStorage,nt,String(d)),yn?.request()},a=()=>{i&&(i=!1,document.body.style.cursor="",document.body.style.userSelect="",globalThis.removeEventListener("mousemove",s),globalThis.removeEventListener("mouseup",a))};t.addEventListener("mousedown",c=>{c.preventDefault(),i=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none",globalThis.addEventListener("mousemove",s),globalThis.addEventListener("mouseup",a)})}function fo(n,e){e instanceof HTMLTableElement&&ks(n)?(Ke?.disconnect(),Ke=cr(e)):(Ke?.disconnect(),Ke=null);let t=document.getElementById("wrap-lines");t&&Ur(so,e,t,()=>{globalThis.dispatchEvent(new Event("resize"))});let r=document.getElementById("stretch-gutter");yn?.disconnect(),yn=e instanceof HTMLElement&&r instanceof HTMLElement?Rs(n,e,r):null,Ps(n,e)}function Ds(n,e){if(n===null||typeof n!="object")return!1;let t=n;return typeof t.id!="string"||typeof t.docInnerHtmlB64!="string"?!1:e!=="stretch"?!0:typeof t.stretchSwapInnerB64=="string"&&t.stretchSwapInnerB64.trim().length>0}function po(n){let e=n?.textContent?.trim()??"";if(!e)return null;try{let t=JSON.parse(D(e));if(!t||!Array.isArray(t.angles)||t.angles.length<2)return null;let r=t.layoutMode==="stretch"?"stretch":"dual";return t.angles.every(o=>Ds(o,r))?{...t,layoutMode:r}:null}catch{return null}}function Fs(n,e){let t=e.stretchSwapInnerB64;if(t===void 0||t.trim().length===0)return;n.innerHTML=D(t);let r=document.getElementById("code-pane");if(r instanceof HTMLElement){fo(n,r),En(n,r,()=>{globalThis.dispatchEvent(new Event("resize"))});let a=document.getElementById("mobile-pane-flip"),c=document.getElementById("mobile-pane-flip-scroll");a instanceof HTMLButtonElement&&mo(n,r,a,c instanceof HTMLButtonElement?c:null,()=>{globalThis.dispatchEvent(new Event("resize"))})}n.setAttribute("data-scroll-block-links-b64",e.scrollBlockLinksB64),n.setAttribute("data-raw-md-b64",e.rawMdB64),n.setAttribute("data-search-commentray-path",e.commentrayPathForSearch);let o=L(e.commentrayPathForSearch);o.length>0?n.setAttribute("data-commentray-pair-commentray-path",o):n.removeAttribute("data-commentray-pair-commentray-path");let i=document.getElementById("nav-rail-doc-path");if(i){let a=e.commentrayPathForSearch.trim();i.textContent=a.length>0?a:"\u2014",a.length>0?i.setAttribute("title",a):i.removeAttribute("title")}let s=e.staticBrowseUrl?.trim()??"";if(s.length>0){let a=Qt(s,globalThis.location.pathname,globalThis.location.origin);n.setAttribute("data-commentray-pair-browse-href",a)}else{let a=e.commentrayOnGithubUrl?.trim();a?n.setAttribute("data-commentray-pair-browse-href",a):n.removeAttribute("data-commentray-pair-browse-href")}wn(),To(n),ce(n),Le(n),A().scrollTop=0}function Ns(n,e,t){if(e.layoutMode!=="stretch")return;let r=document.getElementById("angle-select");r&&r.addEventListener("change",()=>{let o=e.angles.find(i=>i.id===r.value);o&&(Fs(n,o),t?.(o))})}function Os(n,e){let t=go();if(!t)return;let r=bo(n,e),{searchInput:o,searchClear:i,searchResults:s}=t;Vr({scope:r.scope,filePathLabel:r.filePathLabel,mutable:r.mutable,rawCode:r.rawCode,searchInput:o,searchClear:i,searchResults:s,docScrollEl:n}),yo(n,r.pathInit.documentedPairs,r.indexState,r.mutable,r.rebuildSearcher,o);let a=document.getElementById("commentray-multi-angle-b64"),c=po(a);c?.layoutMode==="stretch"&&Ns(n,c,l=>{r.mutable.rawMd=D(l.rawMdB64),r.mutable.mdLines=r.mutable.rawMd.split(`
20
+ `),r.mutable.commentrayPathLabel=l.commentrayPathForSearch,r.rebuildSearcher(),o.value="",s.innerHTML="",s.hidden=!0})}function _s(){let n=document.getElementById("doc-pane"),e=document.getElementById("gutter"),t=document.getElementById("wrap-lines");if(!n||!e||!t)return null;let r=document.getElementById("doc-pane-body"),o=r instanceof HTMLElement?r:n;return{docBody:r,docScrollEl:o,gutter:e,wrapCb:t}}function go(){let n=document.getElementById("search-q"),e=document.getElementById("search-clear"),t=document.getElementById("search-results");return!n||!e||!t?null:{searchInput:n,searchClear:e,searchResults:t}}function zs(n){let{scope:e,rawCode:t,filePathLabel:r,hubNavRows:o,pathRowsForOrdering:i,rawMd:s,commentrayPathLabel:a}=n;if(e!=="commentray-and-paths")return hr(e,t,s,r,a);if(o.length>0)return o;let c=i.length>0?i:hr(e,t,s,r,a).filter(u=>u.kind==="path"),l=s.split(`
21
+ `).map((u,d)=>({kind:"md",line:d,text:u,spPath:r,crPath:a}));return[...c,...l]}function $s(n,e,t,r){if(e!=="commentray-and-paths")return{documentedPairs:[],pathRowsForOrdering:[],pathBlobWide:""};let o=oo(n.getAttribute("data-documented-pairs-b64")?.trim()??""),i=$n(o),s=i.length>0?i.map(a=>a.text).join(`
22
22
  `):[t,r].filter(a=>a.trim().length>0).join(`
23
- `);return{documentedPairs:o,pathRowsForOrdering:i,pathBlobWide:s}}function Fs(n,e){if(e.length===0)return n;if(n.length===0)return e;let t=new Map;for(let r of n){let o=(r.staticBrowseUrl??"").trim();o.length!==0&&t.set(k(r.commentrayPath),o)}return e.map(r=>{if((r.staticBrowseUrl??"").trim().length>0)return r;let i=t.get(k(r.commentrayPath));return i!==void 0&&i.length>0?{...r,staticBrowseUrl:i}:r})}function Ns(n){let e=n.getAttribute("data-nav-search-json-url")?.trim()??"";if(e.length===0)return"";try{return new URL(e,globalThis.location.href).href}catch{return e}}function ho(n,e,t,r,o,i){let s=Ns(n);s.length!==0&&(async()=>{try{let a=await fetch(s,{credentials:"same-origin"});if(!a.ok)return;let c=await a.json(),l=Tn(c.documentedPairs),u=Fs(e,l);u.length>0&&(t.documentedPairs=u,r.documentedPairs=u);let d=Ui(c);if(d.length===0)return;t.hubNavRows=d,t.pathRowsForOrdering=d.filter(m=>m.kind==="path"),r.pathRowsForOrdering=t.pathRowsForOrdering,r.pathBlobWide=t.pathRowsForOrdering.map(m=>m.text).join(`
24
- `),o(),i.value.trim().length>0&&i.dispatchEvent(new Event("input",{bubbles:!0}))}catch{}})()}function Os(n){let{angle:e,docBody:t,mutable:r,rebuildSearcher:o,scrollLinksRef:i,shell:s,searchInput:a,searchResults:c,requestBlockRayRedraw:l}=n;t.innerHTML=R(e.docInnerHtmlB64),ce(t),ke(t),r.rawMd=R(e.rawMdB64),r.mdLines=r.rawMd.split(`
25
- `),r.commentrayPathLabel=e.commentrayPathForSearch,o(),i.current=Yr(e.scrollBlockLinksB64),s.setAttribute("data-scroll-block-links-b64",e.scrollBlockLinksB64),s.setAttribute("data-search-commentray-path",e.commentrayPathForSearch);let u=k(e.commentrayPathForSearch);u.length>0?s.setAttribute("data-commentray-pair-commentray-path",u):s.removeAttribute("data-commentray-pair-commentray-path"),wn();let d=document.getElementById("nav-rail-doc-path");if(d){let h=e.commentrayPathForSearch.trim();d.textContent=h.length>0?h:"\u2014",h.length>0?d.setAttribute("title",h):d.removeAttribute("title")}let m=e.staticBrowseUrl?.trim()??"";if(m.length>0){let h=Qt(m,globalThis.location.pathname,globalThis.location.origin);s.setAttribute("data-commentray-pair-browse-href",h)}else{let h=e.commentrayOnGithubUrl?.trim();h?s.setAttribute("data-commentray-pair-browse-href",h):s.removeAttribute("data-commentray-pair-browse-href")}a&&c&&(a.value="",c.innerHTML="",c.hidden=!0),go(s),l?.(),globalThis.requestAnimationFrame(()=>{l?.(),globalThis.requestAnimationFrame(()=>{l?.()})})}function _s(n,e){let{codePane:t,docScrollEl:r,docBody:o,shell:i,scrollLinksRef:s,multiPayload:a,mutable:c,rebuildSearcher:l,searchInput:u,searchResults:d,requestBlockRayRedraw:m}=n;if(a){let h=un(t,r,()=>s.current,()=>Ee(i),()=>$(i)==="rendered-markdown",e),f=document.getElementById("angle-select");return f&&o&&f.addEventListener("change",()=>{let p=a.angles.find(g=>g.id===f.value);p&&Os({angle:p,docBody:o,mutable:c,rebuildSearcher:l,scrollLinksRef:s,shell:i,searchInput:u,searchResults:d,requestBlockRayRedraw:m})}),h}return s.current.length>0?un(t,r,()=>s.current,()=>Ee(i),()=>$(i)==="rendered-markdown",e):e.allowProportionalMirror?Di(t,r):un(t,r,()=>[],()=>Ee(i),()=>$(i)==="rendered-markdown",e)}function zs(n){let t=Vn(n.shell.getAttribute("data-scroll-sync-strategy"))==="block-snap-only"?{allowProportionalMirror:!1}:{allowProportionalMirror:!0};return _s(n,t)}function $s(n,e){function t(o){let i=o.replace(/^#/,"").trim();if(i.length===0)return null;let s=i.split(/--|&/).map(a=>a.trim()).filter(a=>a.length>0);for(let a of s){let c=/^commentray-md-line-(\d+)$/.exec(a);if(!c?.[1])continue;let l=Number.parseInt(c[1],10);if(Number.isFinite(l))return l}return null}function r(){let o=t(globalThis.location.hash);o!==null&&qr(n,o,e())}globalThis.addEventListener("hashchange",r),globalThis.requestAnimationFrame(()=>{globalThis.requestAnimationFrame(r)})}function qs(n){if($(n)!=="rendered-markdown")return;let e=document.getElementById("code-pane");if(e instanceof HTMLElement)for(let t of e.querySelectorAll('[data-source-markdown-body="true"]'))ce(t),ke(t)}var dn=null;function En(n,e,t){let r=document.getElementById("source-markdown-pane-flip"),o=document.getElementById("source-markdown-pane-flip-scroll");r instanceof HTMLButtonElement&&(dn?.abort(),dn=new AbortController,ys(n,e,r,o instanceof HTMLButtonElement?o:null,dn.signal,t),qs(n))}function fo(n,e){let{rawCodeB64:t,rawMdB64:r}=Fn(n,e),o=R(t),i=R(r),a={current:Yr(n.getAttribute("data-scroll-block-links-b64")||"")},{scope:c,filePathLabel:l,commentrayPathLabel:u}=wi(n),d=Ds(n,c,l,u),m={hubNavRows:[],documentedPairs:d.documentedPairs,pathRowsForOrdering:d.pathRowsForOrdering},h={rawMd:i,mdLines:i.split(`
26
- `),commentrayPathLabel:u,searcher:fr([]),pathBlobWide:d.pathBlobWide,pathRowsForOrdering:m.pathRowsForOrdering,documentedPairs:m.documentedPairs};function f(){h.searcher=fr(Rs({scope:c,rawCode:o,filePathLabel:l,hubNavRows:m.hubNavRows,pathRowsForOrdering:m.pathRowsForOrdering,rawMd:h.rawMd,commentrayPathLabel:h.commentrayPathLabel}))}return f(),{rawCode:o,rawMd:i,scrollLinksRef:a,scope:c,filePathLabel:l,commentrayPathLabel:u,pathInit:d,indexState:m,mutable:h,rebuildSearcher:f}}function Gs(n,e){let t=Ps();if(!t)return;let{docBody:r,docScrollEl:o,gutter:i,wrapCb:s}=t,a=mo(),c=fo(n,e);if(ke(document),a){let{searchInput:v,searchClear:H,searchResults:I}=a;Vr({scope:c.scope,filePathLabel:c.filePathLabel,mutable:c.mutable,rawCode:c.rawCode,searchInput:v,searchClear:H,searchResults:I,docScrollEl:o}),ho(n,c.pathInit.documentedPairs,c.indexState,c.mutable,c.rebuildSearcher,v)}let l=parseFloat(D(localStorage,rt)||"46"),u=M(Number.isFinite(l)?l:46,15,85);e.style.flex=`0 0 ${u}%`,n.style.setProperty("--split-pct",`${String(u)}%`);let d=document.getElementById("doc-pane"),m=d instanceof HTMLElement?d:null,h=document.getElementById("code-pane-markdown-body"),f={};Ur(so,e,s,()=>{f.request?.()},m,r,h instanceof HTMLElement?h:null),as(rt,n,e,i,u);let p=document.getElementById("commentray-multi-angle-b64"),g=uo(p),b=g!==null||c.scrollLinksRef.current.length>0?qi({gutter:i,codePane:e,docScrollEl:o,getLinks:()=>c.scrollLinksRef.current,probeTopSourceLine1Based:()=>Xr(e,Ee(n)),sourceLineIdPrefix:()=>Ee(n)}):void 0;f.request=b;let y=zs({codePane:e,docScrollEl:o,docBody:r,shell:n,scrollLinksRef:c.scrollLinksRef,multiPayload:g,mutable:c.mutable,rebuildSearcher:c.rebuildSearcher,searchInput:a?.searchInput,searchResults:a?.searchResults,requestBlockRayRedraw:b}),x=document.getElementById("mobile-pane-flip"),C=document.getElementById("mobile-pane-flip-scroll");x instanceof HTMLButtonElement&&bs(n,x,y,C instanceof HTMLButtonElement?C:null),En(n,e,()=>{b?.()}),rn(n,Le),$s(o,()=>c.mutable.mdLines.length)}function Ws(n){return n==="light"?"Light":n==="dark"?"Dark":"System"}function Vs(n,e){let t=Ws(e);n.setAttribute("aria-label",`Color theme: ${t}. Left-click opens the menu. Right-click cycles System, Light, and Dark.`),n.title=`Appearance: ${t} \u2014 left-click menu, right-click cycle`}function Us(){let n=document.querySelector(".toolbar-theme"),e=document.getElementById("commentray-theme-trigger"),t=document.getElementById("commentray-theme-menu");if(!n||!(e instanceof HTMLButtonElement)||!(t instanceof HTMLElement))return;let r=n,o=e,i=t,s=Ve(D(localStorage,Jt));Zt(s);let a=!1;function c(){o.dataset.commentrayTriggerMode=s,o.setAttribute("aria-expanded",a?"true":"false"),Vs(o,s);for(let f of i.querySelectorAll("[data-commentray-theme-value]")){let p=Ve(f.dataset.commentrayThemeValue??"");f.setAttribute("aria-checked",p===s?"true":"false")}}function l(){a=!0,i.removeAttribute("hidden"),c(),(i.querySelector('[role="menuitemradio"][aria-checked="true"]')??i.querySelector('[role="menuitemradio"]'))?.focus()}function u(){a=!1,i.setAttribute("hidden",""),c()}function d(f){s=f,A(localStorage,Jt,f),Zt(f),c()}o.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),a?u():l()}),o.addEventListener("contextmenu",f=>{f.preventDefault(),a&&u(),d(Gn(s))});for(let f of i.querySelectorAll("[data-commentray-theme-value]"))f.addEventListener("click",p=>{p.stopPropagation();let g=Ve(f.dataset.commentrayThemeValue??"");d(g),u(),o.focus()});function m(f){if(!a)return;let p=f.target;p instanceof Node&&(r.contains(p)||u())}function h(f){!a||f.key!=="Escape"||(f.preventDefault(),f.stopPropagation(),u(),o.focus())}document.addEventListener("mousedown",m,!0),document.addEventListener("touchstart",m,!0),document.addEventListener("keydown",h,!0),c()}function Ys(n){let e=n.trim();if(e.length===0||/^(javascript|data):/i.test(e))return null;try{return new URL(e,globalThis.location.href).toString()}catch{return null}}function kr(n,e){return new URL(n,e).toString()}function Qs(n,e){let t=n.getAttribute("data-nav-search-json-url")?.trim()??"";t.length>0&&n.setAttribute("data-nav-search-json-url",kr(t,e));let r=document.getElementById("documented-files-hub");if(r instanceof HTMLElement){let o=r.getAttribute("data-nav-json-url")?.trim()??"";o.length>0&&r.setAttribute("data-nav-json-url",kr(o,e))}}function js(n,e){let t=n.getAttribute("data-commentray-pair-browse-href")?.trim()??"";t.length>0&&We(t)&&n.setAttribute("data-commentray-pair-browse-href",Q(t,e,globalThis.location.origin))}function Ks(){let n=document.getElementById("doc-pane");if(!(n instanceof HTMLElement))return null;let e=document.getElementById("doc-pane-body"),t=e instanceof HTMLElement?e:n;if(t.querySelectorAll(".commentray-block-anchor").length===0)return null;let o=Sn(t);return o===null||!Number.isFinite(o)||o<0?null:`commentray-md-line-${String(o)}`}function Xs(n){if((n.getAttribute("data-layout")??"dual")!=="dual")return;let e=globalThis.location.pathname,t=globalThis.location.href;Qs(n,t),js(n,e)}function po(n){let t=(n.getAttribute("data-commentray-pair-browse-href")??"").trim();return(We(t)&&t.length>0?Q(t,globalThis.location.pathname,globalThis.location.origin):Ys(t))??globalThis.location.href}function Js(){let n=[],e=o=>{let i=o.trim();i.length!==0&&(n.includes(i)||n.push(i))},t=document.getElementById("angle-select");if(t instanceof HTMLSelectElement){let o=t.value.trim();o.length>0&&e(`angle-${encodeURIComponent(o)}`)}let r=Ks();return r&&e(r),n.length>0?`#${n.join("&")}`:""}function Zs(n){let e=new URL(po(n),globalThis.location.href),t=Js();return e.hash=t.length>0?t.slice(1):"",e.toString()}function go(n){let e;try{e=new URL(po(n),globalThis.location.href)}catch{return}if(e.origin!==globalThis.location.origin)return;e.hash="";let t=new URL(globalThis.location.href);t.pathname===e.pathname&&t.search===e.search||globalThis.location.assign(e.toString())}async function ea(n){try{return await navigator.clipboard.writeText(n),!0}catch{let e=document.createElement("textarea");e.value=n,e.setAttribute("readonly","true"),e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px",document.body.appendChild(e),e.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(e)}}}function ta(){let n=document.getElementById("shell"),e=document.getElementById("commentray-share-link");if(!(n instanceof HTMLElement)||!(e instanceof HTMLButtonElement))return;let t="Copy shareable permalink",r;e.addEventListener("click",()=>{(async()=>{let o=Zs(n);await ea(o)&&(e.dataset.copied="true",e.setAttribute("aria-label","Permalink copied"),e.title="Permalink copied",r!==void 0&&globalThis.clearTimeout(r),r=globalThis.setTimeout(()=>{delete e.dataset.copied,e.setAttribute("aria-label",t),e.title=t},1200))})()})}function Hr(){ai(),ta(),Us(),ss();let n=document.getElementById("shell"),e=document.getElementById("code-pane");if(!n||!e)return;if(ms(n),hs(n),us(n),(n.getAttribute("data-layout")||"dual")==="stretch"){lo(n,e),Is(n,e),En(n,e,()=>{globalThis.dispatchEvent(new Event("resize"))});let r=document.getElementById("mobile-pane-flip"),o=document.getElementById("mobile-pane-flip-scroll");r instanceof HTMLButtonElement&&co(n,e,r,o instanceof HTMLButtonElement?o:null,()=>{globalThis.dispatchEvent(new Event("resize"))});return}Gs(n,e),Xs(n)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Hr):Hr();})();
23
+ `);return{documentedPairs:o,pathRowsForOrdering:i,pathBlobWide:s}}function qs(n,e,t,r){if(n!=="commentray-and-paths")return t;let o=e.trim();if(o.length===0)return t;let i=Ge(r,"",o);if(!i)return t;let s=t.trim(),a=i.commentrayPath.trim();return a.length===0?t:s.length===0||L(s)==="commentray.md"&&L(a)!=="commentray.md"?a:t}function Gs(n,e){if(e.length===0)return n;if(n.length===0)return e;let t=new Map;for(let r of n){let o=(r.staticBrowseUrl??"").trim();o.length!==0&&t.set(L(r.commentrayPath),o)}return e.map(r=>{if((r.staticBrowseUrl??"").trim().length>0)return r;let i=t.get(L(r.commentrayPath));return i!==void 0&&i.length>0?{...r,staticBrowseUrl:i}:r})}function Ws(n){let e=n.getAttribute("data-nav-search-json-url")?.trim()??"";if(e.length===0)return"";try{return new URL(e,globalThis.location.href).href}catch{return e}}function yo(n,e,t,r,o,i){let s=Ws(n);s.length!==0&&(async()=>{try{let a=await fetch(s,{credentials:"same-origin"});if(!a.ok)return;let c=await a.json(),l=Tn(c.documentedPairs),u=Gs(e,l);u.length>0&&(t.documentedPairs=u,r.documentedPairs=u);let d=Xi(c);if(d.length===0)return;t.hubNavRows=d,t.pathRowsForOrdering=d.filter(m=>m.kind==="path"),r.pathRowsForOrdering=t.pathRowsForOrdering,r.pathBlobWide=t.pathRowsForOrdering.map(m=>m.text).join(`
24
+ `),o(),i.value.trim().length>0&&i.dispatchEvent(new Event("input",{bubbles:!0}))}catch{}})()}function Vs(n){let{angle:e,docBody:t,mutable:r,rebuildSearcher:o,scrollLinksRef:i,shell:s,searchInput:a,searchResults:c,requestBlockRayRedraw:l}=n;t.innerHTML=D(e.docInnerHtmlB64),ce(t),Le(t),r.rawMd=D(e.rawMdB64),r.mdLines=r.rawMd.split(`
25
+ `),r.commentrayPathLabel=e.commentrayPathForSearch,o(),i.current=Yr(e.scrollBlockLinksB64),s.setAttribute("data-scroll-block-links-b64",e.scrollBlockLinksB64),s.setAttribute("data-search-commentray-path",e.commentrayPathForSearch);let u=L(e.commentrayPathForSearch);u.length>0?s.setAttribute("data-commentray-pair-commentray-path",u):s.removeAttribute("data-commentray-pair-commentray-path"),wn();let d=document.getElementById("nav-rail-doc-path");if(d){let h=e.commentrayPathForSearch.trim();d.textContent=h.length>0?h:"\u2014",h.length>0?d.setAttribute("title",h):d.removeAttribute("title")}let m=e.staticBrowseUrl?.trim()??"";if(m.length>0){let h=Qt(m,globalThis.location.pathname,globalThis.location.origin);s.setAttribute("data-commentray-pair-browse-href",h)}else{let h=e.commentrayOnGithubUrl?.trim();h?s.setAttribute("data-commentray-pair-browse-href",h):s.removeAttribute("data-commentray-pair-browse-href")}a&&c&&(a.value="",c.innerHTML="",c.hidden=!0),To(s),l?.(),globalThis.requestAnimationFrame(()=>{l?.(),globalThis.requestAnimationFrame(()=>{l?.()})})}function Us(n,e){let{codePane:t,docScrollEl:r,docBody:o,shell:i,scrollLinksRef:s,multiPayload:a,mutable:c,rebuildSearcher:l,searchInput:u,searchResults:d,requestBlockRayRedraw:m}=n;if(a){let h=un(t,r,()=>s.current,()=>Ee(i),()=>q(i)==="rendered-markdown",e),f=document.getElementById("angle-select");return f&&o&&f.addEventListener("change",()=>{let p=a.angles.find(g=>g.id===f.value);p&&Vs({angle:p,docBody:o,mutable:c,rebuildSearcher:l,scrollLinksRef:s,shell:i,searchInput:u,searchResults:d,requestBlockRayRedraw:m})}),h}return s.current.length>0?un(t,r,()=>s.current,()=>Ee(i),()=>q(i)==="rendered-markdown",e):e.allowProportionalMirror?zi(t,r):un(t,r,()=>[],()=>Ee(i),()=>q(i)==="rendered-markdown",e)}function Ys(n){let t=Vn(n.shell.getAttribute("data-scroll-sync-strategy"))==="block-snap-only"?{allowProportionalMirror:!1}:{allowProportionalMirror:!0};return Us(n,t)}function Qs(n,e){function t(o){let i=o.replace(/^#/,"").trim();if(i.length===0)return null;let s=i.split(/--|&/).map(a=>a.trim()).filter(a=>a.length>0);for(let a of s){let c=/^commentray-md-line-(\d+)$/.exec(a);if(!c?.[1])continue;let l=Number.parseInt(c[1],10);if(Number.isFinite(l))return l}return null}function r(){let o=t(globalThis.location.hash);o!==null&&qr(n,o,e())}globalThis.addEventListener("hashchange",r),globalThis.requestAnimationFrame(()=>{globalThis.requestAnimationFrame(r)})}function js(n){if(q(n)!=="rendered-markdown")return;let e=document.getElementById("code-pane");if(e instanceof HTMLElement)for(let t of e.querySelectorAll('[data-source-markdown-body="true"]'))ce(t),Le(t)}var dn=null;function En(n,e,t){let r=document.getElementById("source-markdown-pane-flip"),o=document.getElementById("source-markdown-pane-flip-scroll");r instanceof HTMLButtonElement&&(dn?.abort(),dn=new AbortController,Ls(n,e,r,o instanceof HTMLButtonElement?o:null,dn.signal,t),js(n))}function bo(n,e){let{rawCodeB64:t,rawMdB64:r}=Fn(n,e),o=D(t),i=D(r),a={current:Yr(n.getAttribute("data-scroll-block-links-b64")||"")},{scope:c,filePathLabel:l,commentrayPathLabel:u}=ki(n),d=$s(n,c,l,u),m=qs(c,l,u,d.documentedPairs);if(m.trim().length>0){n.setAttribute("data-search-commentray-path",m);let g=document.getElementById("nav-rail-doc-path");g&&(g.textContent=m,g.setAttribute("title",m))}let h={hubNavRows:[],documentedPairs:d.documentedPairs,pathRowsForOrdering:d.pathRowsForOrdering},f={rawMd:i,mdLines:i.split(`
26
+ `),commentrayPathLabel:m,searcher:fr([]),pathBlobWide:d.pathBlobWide,pathRowsForOrdering:h.pathRowsForOrdering,documentedPairs:h.documentedPairs};function p(){f.searcher=fr(zs({scope:c,rawCode:o,filePathLabel:l,hubNavRows:h.hubNavRows,pathRowsForOrdering:h.pathRowsForOrdering,rawMd:f.rawMd,commentrayPathLabel:f.commentrayPathLabel}))}return p(),{rawCode:o,rawMd:i,scrollLinksRef:a,scope:c,filePathLabel:l,commentrayPathLabel:m,pathInit:d,indexState:h,mutable:f,rebuildSearcher:p}}function Ks(n,e){let t=_s();if(!t)return;let{docBody:r,docScrollEl:o,gutter:i,wrapCb:s}=t,a=go(),c=bo(n,e);if(Le(document),a){let{searchInput:k,searchClear:H,searchResults:R}=a;Vr({scope:c.scope,filePathLabel:c.filePathLabel,mutable:c.mutable,rawCode:c.rawCode,searchInput:k,searchClear:H,searchResults:R,docScrollEl:o}),yo(n,c.pathInit.documentedPairs,c.indexState,c.mutable,c.rebuildSearcher,k)}let l=parseFloat(O(localStorage,nt)||"46"),u=w(Number.isFinite(l)?l:46,15,85);e.style.flex=`0 0 ${u}%`,n.style.setProperty("--split-pct",`${String(u)}%`);let d=document.getElementById("doc-pane"),m=d instanceof HTMLElement?d:null,h=document.getElementById("code-pane-markdown-body"),f={};Ur(so,e,s,()=>{f.request?.()},m,r,h instanceof HTMLElement?h:null),ms(nt,n,e,i,u);let p=document.getElementById("commentray-multi-angle-b64"),g=po(p),b=g!==null||c.scrollLinksRef.current.length>0?Yi({gutter:i,codePane:e,docScrollEl:o,getLinks:()=>c.scrollLinksRef.current,probeTopSourceLine1Based:()=>Xr(e,Ee(n)),sourceLineIdPrefix:()=>Ee(n)}):void 0;f.request=b;let y=Ys({codePane:e,docScrollEl:o,docBody:r,shell:n,scrollLinksRef:c.scrollLinksRef,multiPayload:g,mutable:c.mutable,rebuildSearcher:c.rebuildSearcher,searchInput:a?.searchInput,searchResults:a?.searchResults,requestBlockRayRedraw:b}),C=document.getElementById("mobile-pane-flip"),x=document.getElementById("mobile-pane-flip-scroll");C instanceof HTMLButtonElement&&uo(n,C,y,x instanceof HTMLButtonElement?x:null),En(n,e,()=>{b?.()}),nn(n,Me),Qs(o,()=>c.mutable.mdLines.length)}function Xs(n){return n==="light"?"Light":n==="dark"?"Dark":"System"}function Js(n,e){let t=Xs(e);n.setAttribute("aria-label",`Color theme: ${t}. Left-click opens the menu. Right-click cycles System, Light, and Dark.`),n.title=`Appearance: ${t} \u2014 left-click menu, right-click cycle`}function Zs(){let n=document.querySelector(".toolbar-theme"),e=document.getElementById("commentray-theme-trigger"),t=document.getElementById("commentray-theme-menu");if(!n||!(e instanceof HTMLButtonElement)||!(t instanceof HTMLElement))return;let r=n,o=e,i=t,s=We(O(localStorage,Xt));Jt(s);let a=!1;function c(){o.dataset.commentrayTriggerMode=s,o.setAttribute("aria-expanded",a?"true":"false"),Js(o,s);for(let f of i.querySelectorAll("[data-commentray-theme-value]")){let p=We(f.dataset.commentrayThemeValue??"");f.setAttribute("aria-checked",p===s?"true":"false")}}function l(){a=!0,i.removeAttribute("hidden"),c(),(i.querySelector('[role="menuitemradio"][aria-checked="true"]')??i.querySelector('[role="menuitemradio"]'))?.focus()}function u(){a=!1,i.setAttribute("hidden",""),c()}function d(f){s=f,I(localStorage,Xt,f),Jt(f),c()}o.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),a?u():l()}),o.addEventListener("contextmenu",f=>{f.preventDefault(),a&&u(),d(Gn(s))});for(let f of i.querySelectorAll("[data-commentray-theme-value]"))f.addEventListener("click",p=>{p.stopPropagation();let g=We(f.dataset.commentrayThemeValue??"");d(g),u(),o.focus()});function m(f){if(!a)return;let p=f.target;p instanceof Node&&(r.contains(p)||u())}function h(f){!a||f.key!=="Escape"||(f.preventDefault(),f.stopPropagation(),u(),o.focus())}document.addEventListener("mousedown",m,!0),document.addEventListener("touchstart",m,!0),document.addEventListener("keydown",h,!0),c()}function ea(n){let e=n.trim();if(e.length===0||/^(javascript|data):/i.test(e))return null;try{return new URL(e,globalThis.location.href).toString()}catch{return null}}function Hr(n,e){return new URL(n,e).toString()}function ta(n,e){let t=n.getAttribute("data-nav-search-json-url")?.trim()??"";t.length>0&&n.setAttribute("data-nav-search-json-url",Hr(t,e));let r=document.getElementById("documented-files-hub");if(r instanceof HTMLElement){let o=r.getAttribute("data-nav-json-url")?.trim()??"";o.length>0&&r.setAttribute("data-nav-json-url",Hr(o,e))}}function na(n,e){let t=n.getAttribute("data-commentray-pair-browse-href")?.trim()??"";t.length>0&&qe(t)&&n.setAttribute("data-commentray-pair-browse-href",Q(t,e,globalThis.location.origin))}function ra(){let n=document.getElementById("doc-pane");if(!(n instanceof HTMLElement))return null;let e=document.getElementById("doc-pane-body"),t=e instanceof HTMLElement?e:n;if(t.querySelectorAll(".commentray-block-anchor").length===0)return null;let o=Sn(t);return o===null||!Number.isFinite(o)||o<0?null:`commentray-md-line-${String(o)}`}function oa(n){if((n.getAttribute("data-layout")??"dual")!=="dual")return;let e=globalThis.location.pathname,t=globalThis.location.href;ta(n,t),na(n,e)}function So(n){let t=(n.getAttribute("data-commentray-pair-browse-href")??"").trim();return(qe(t)&&t.length>0?Q(t,globalThis.location.pathname,globalThis.location.origin):ea(t))??globalThis.location.href}function ia(){let n=[],e=i=>{let s=i.trim();s.length!==0&&(n.includes(s)||n.push(s))},t=document.getElementById("angle-select");if(t instanceof HTMLSelectElement){let i=t.value.trim();i.length>0&&e(`angle-${encodeURIComponent(i)}`)}let r=document.getElementById("shell");if(r instanceof HTMLElement&&r.getAttribute("data-mobile-single-pane")==="true"){let i=ae(r.getAttribute("data-dual-mobile-pane"));e(co(i))}let o=ra();return o&&e(o),n.length>0?`#${n.join("&")}`:""}function sa(n){let e=new URL(So(n),globalThis.location.href),t=ia();return e.hash=t.length>0?t.slice(1):"",e.toString()}function To(n){let e;try{e=new URL(So(n),globalThis.location.href)}catch{return}if(e.origin!==globalThis.location.origin)return;e.hash="";let t=new URL(globalThis.location.href);t.pathname===e.pathname&&t.search===e.search||globalThis.location.assign(e.toString())}async function aa(n){try{return await navigator.clipboard.writeText(n),!0}catch{let e=document.createElement("textarea");e.value=n,e.setAttribute("readonly","true"),e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px",document.body.appendChild(e),e.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(e)}}}function ca(){let n=document.getElementById("shell"),e=document.getElementById("commentray-share-link");if(!(n instanceof HTMLElement)||!(e instanceof HTMLButtonElement))return;let t="Copy shareable permalink",r;e.addEventListener("click",()=>{(async()=>{let o=sa(n);await aa(o)&&(e.dataset.copied="true",e.setAttribute("aria-label","Permalink copied"),e.title="Permalink copied",r!==void 0&&globalThis.clearTimeout(r),r=globalThis.setTimeout(()=>{delete e.dataset.copied,e.setAttribute("aria-label",t),e.title=t},1200))})()})}function Cr(){mi(),ca(),Zs(),ds();let n=document.getElementById("shell"),e=document.getElementById("code-pane");if(!n||!e)return;if(Ss(n),Ts(n),ys(n),(n.getAttribute("data-layout")||"dual")==="stretch"){fo(n,e),Os(n,e),En(n,e,()=>{globalThis.dispatchEvent(new Event("resize"))});let r=document.getElementById("mobile-pane-flip"),o=document.getElementById("mobile-pane-flip-scroll");r instanceof HTMLButtonElement&&mo(n,e,r,o instanceof HTMLButtonElement?o:null,()=>{globalThis.dispatchEvent(new Event("resize"))});return}Ks(n,e),oa(n)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Cr):Cr();})();