@hyperpuncher/pi-ui 0.54.0 → 0.54.1
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.
- package/README.md +2 -1
- package/dist/npm/server-main.js +2 -2
- package/package.json +1 -1
- package/static/app.css +1 -1
- package/static/build/chunks/angular-html-9t1z861h.js +1 -0
- package/static/build/chunks/{angular-ts-wpa0ntyd.js → angular-ts-yces35hm.js} +1 -1
- package/static/build/chunks/bat-sykj1aa7.js +1 -0
- package/static/build/chunks/bibtex-f2ty1dx3.js +1 -0
- package/static/build/chunks/{bsl-ekqr89hb.js → bsl-dhrmm1jj.js} +1 -1
- package/static/build/chunks/cmake-5z22d5ee.js +1 -0
- package/static/build/chunks/{code-theme-a5ywgc5d.js → code-theme-ame4fn6s.js} +1 -1
- package/static/build/chunks/csv-j1nr2egp.js +1 -0
- package/static/build/chunks/{erb-ssgyt8yk.js → erb-5ke38pz0.js} +1 -1
- package/static/build/chunks/{fortran-fixed-form-yqrdwjab.js → fortran-fixed-form-eawvv1am.js} +1 -1
- package/static/build/chunks/fortran-free-form-wpe8st7g.js +1 -0
- package/static/build/chunks/fsharp-9e2dnvk9.js +1 -0
- package/static/build/chunks/{gdresource-4fj86xjd.js → gdresource-gfrqcbcg.js} +1 -1
- package/static/build/chunks/gdscript-5nb9fzmy.js +1 -0
- package/static/build/chunks/gdshader-ba7x07gg.js +1 -0
- package/static/build/chunks/{graphql-ddq2qt0v.js → graphql-6dembcfz.js} +1 -1
- package/static/build/chunks/haml-fs8t607p.js +1 -0
- package/static/build/chunks/handlebars-qxp1hmm5.js +1 -0
- package/static/build/chunks/haxe-63hhvesn.js +1 -0
- package/static/build/chunks/hlsl-99cqj6by.js +1 -0
- package/static/build/chunks/{http-q7kc4tj6.js → http-r101fvka.js} +1 -1
- package/static/build/chunks/{hurl-megk96q7.js → hurl-hzcngdvj.js} +1 -1
- package/static/build/chunks/{hxml-6ch21be5.js → hxml-psqp1nsp.js} +1 -1
- package/static/build/chunks/{index-wg53q3y0.js → index-hynb8kca.js} +13 -13
- package/static/build/chunks/jsonc-15dhk5z3.js +1 -0
- package/static/build/chunks/jsx-h2hggewx.js +1 -0
- package/static/build/chunks/{julia-mgfk32ya.js → julia-427d8qjf.js} +1 -1
- package/static/build/chunks/{just-rjtrh43a.js → just-ezfq4t7j.js} +1 -1
- package/static/build/chunks/latex-41146jxq.js +1 -0
- package/static/build/chunks/log-jvqtv319.js +1 -0
- package/static/build/chunks/{main-hw5rht8r.js → main-098d512h.js} +2 -2
- package/static/build/chunks/{main-dedmwdfs.js → main-0g6qtbm7.js} +2 -2
- package/static/build/chunks/{main-17y72e2k.js → main-25shm7ha.js} +2 -2
- package/static/build/chunks/{main-q53pa7e1.js → main-29fmzgdz.js} +1 -1
- package/static/build/chunks/{main-c4y2m713.js → main-5dymmn8v.js} +2 -2
- package/static/build/chunks/{main-b4j28cva.js → main-6yfb802z.js} +2 -2
- package/static/build/chunks/{main-s13hhth9.js → main-8nztd0r5.js} +2 -2
- package/static/build/chunks/{main-epsspf8t.js → main-93jq8y6w.js} +2 -2
- package/static/build/chunks/{main-vqg1a9c8.js → main-9brcqyac.js} +2 -2
- package/static/build/chunks/{main-sh14kcap.js → main-9kwttvkk.js} +2 -2
- package/static/build/chunks/{main-v6yya2rp.js → main-aabsw5zs.js} +2 -2
- package/static/build/chunks/{main-q0zg1fh4.js → main-brz9x4r1.js} +2 -2
- package/static/build/chunks/{main-z8x5tyev.js → main-ch19n8dg.js} +2 -2
- package/static/build/chunks/{main-q6xq4ymt.js → main-d2jmsjyj.js} +2 -2
- package/static/build/chunks/{main-60jmcz5q.js → main-d5kpdgb3.js} +2 -2
- package/static/build/chunks/{main-drhnr196.js → main-dckqpwtw.js} +1 -1
- package/static/build/chunks/{main-0tfr6zpw.js → main-e3dchyzh.js} +2 -2
- package/static/build/chunks/{main-aj799kta.js → main-gza5czsg.js} +2 -2
- package/static/build/chunks/{main-0m5jmwcm.js → main-jx88bb4k.js} +2 -2
- package/static/build/chunks/{main-z9ya2zyf.js → main-kqvqxvs9.js} +15 -15
- package/static/build/chunks/{main-m23prjtn.js → main-m3gqgzj2.js} +2 -2
- package/static/build/chunks/{main-75b7czew.js → main-mvvsw424.js} +2 -2
- package/static/build/chunks/{main-0eq28dnr.js → main-mwqd3xej.js} +2 -2
- package/static/build/chunks/{main-wg1rgmq8.js → main-mx73v44m.js} +2 -2
- package/static/build/chunks/{main-320cz9m0.js → main-n1amqv0y.js} +2 -2
- package/static/build/chunks/{main-1h81h5tc.js → main-n2gksx7q.js} +2 -2
- package/static/build/chunks/{main-fxxjfq5x.js → main-na165zc6.js} +2 -2
- package/static/build/chunks/{main-w4ktfx46.js → main-qjaabb97.js} +2 -2
- package/static/build/chunks/{main-fnryfy0w.js → main-trx88rdg.js} +2 -2
- package/static/build/chunks/{main-12hs60r7.js → main-v9hveeqk.js} +2 -2
- package/static/build/chunks/{main-svq37c5n.js → main-vyjr38wk.js} +2 -2
- package/static/build/chunks/{main-g5cvv1jb.js → main-wjv4knsy.js} +2 -2
- package/static/build/chunks/{main-n354gvtx.js → main-xxtt0kat.js} +2 -2
- package/static/build/chunks/{main-ncmhhxpc.js → main-ze318jkq.js} +2 -2
- package/static/build/chunks/{main-pf4sasgx.js → main-zne4xghc.js} +1 -1
- package/static/build/chunks/{nextflow-vsm9mewk.js → nextflow-ecafj8kf.js} +1 -1
- package/static/build/chunks/nextflow-groovy-xvrmcddz.js +1 -0
- package/static/build/chunks/{nim-rjrps4r1.js → nim-jcfn78ep.js} +1 -1
- package/static/build/chunks/ocaml-3t7q77vf.js +1 -0
- package/static/build/chunks/{org-41f97gct.js → org-83gwmman.js} +1 -1
- package/static/build/chunks/powershell-bft3fprh.js +1 -0
- package/static/build/chunks/pug-67fg5zkc.js +1 -0
- package/static/build/chunks/{rst-qgaks9ys.js → rst-0j7thaq8.js} +1 -1
- package/static/build/chunks/{ruby-10gnpa9m.js → ruby-h41d1jye.js} +1 -1
- package/static/build/chunks/sdbl-pe5gn8zr.js +1 -0
- package/static/build/chunks/{shaderlab-qdakc6m7.js → shaderlab-b58smhfe.js} +1 -1
- package/static/build/chunks/{sparql-hrn3zm8y.js → sparql-wz87e1pd.js} +1 -1
- package/static/build/chunks/stylus-x9mf4enc.js +1 -0
- package/static/build/chunks/swift-zn3gdbrz.js +1 -0
- package/static/build/chunks/system-verilog-gcgja1bf.js +1 -0
- package/static/build/chunks/tex-pxg823cm.js +1 -0
- package/static/build/chunks/turtle-rygwqp46.js +1 -0
- package/static/build/chunks/{twig-1rd58h0d.js → twig-zr6z9qb5.js} +1 -1
- package/static/build/chunks/{typst-pg1czsjz.js → typst-5t62efc4.js} +1 -1
- package/static/build/chunks/verilog-jp5dkmgg.js +1 -0
- package/static/build/chunks/{vue-vine-d46tfy6m.js → vue-vine-x1pd5ydv.js} +1 -1
- package/static/build/chunks/{workspace-review-73s0n7hc.js → workspace-review-5r77y1ft.js} +11 -11
- package/static/build/chunks/zig-98xskbfp.js +1 -0
- package/static/build/main.js +4 -4
- package/static/build/chunks/angular-html-z4fqs47k.js +0 -1
- package/static/build/chunks/bat-4986hex0.js +0 -1
- package/static/build/chunks/bibtex-n2nhe0wx.js +0 -1
- package/static/build/chunks/cmake-86bharq9.js +0 -1
- package/static/build/chunks/csv-kzar1n4v.js +0 -1
- package/static/build/chunks/fortran-free-form-4tb589s6.js +0 -1
- package/static/build/chunks/fsharp-5v62w2jq.js +0 -1
- package/static/build/chunks/gdscript-4h1shwqj.js +0 -1
- package/static/build/chunks/gdshader-5za4a2j9.js +0 -1
- package/static/build/chunks/haml-vsp7hh3f.js +0 -1
- package/static/build/chunks/handlebars-59gn5dj7.js +0 -1
- package/static/build/chunks/haxe-zvpwvpvn.js +0 -1
- package/static/build/chunks/hlsl-svktsk04.js +0 -1
- package/static/build/chunks/jsonc-ssb35fmp.js +0 -1
- package/static/build/chunks/jsx-9ct7s1py.js +0 -1
- package/static/build/chunks/latex-xha4wvvc.js +0 -1
- package/static/build/chunks/log-jnggnqka.js +0 -1
- package/static/build/chunks/nextflow-groovy-b4w15vkr.js +0 -1
- package/static/build/chunks/ocaml-yt0kq4b3.js +0 -1
- package/static/build/chunks/powershell-8cv2gpfc.js +0 -1
- package/static/build/chunks/pug-s4e1p0x9.js +0 -1
- package/static/build/chunks/sdbl-rw2b1wff.js +0 -1
- package/static/build/chunks/stylus-051daetz.js +0 -1
- package/static/build/chunks/swift-c3wmm92e.js +0 -1
- package/static/build/chunks/system-verilog-cysaabmv.js +0 -1
- package/static/build/chunks/tex-yj0j713p.js +0 -1
- package/static/build/chunks/turtle-am0wf2w4.js +0 -1
- package/static/build/chunks/verilog-1bxyw8xv.js +0 -1
- package/static/build/chunks/zig-rdjds834.js +0 -1
- /package/static/build/chunks/{main-0spvwn6n.js → main-m9dfhq6m.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{De,e}from"../main.js";function qu(t){return t!==null&&typeof t==="object"&&"default"in t?t.default:t}var cy=class extends Error{constructor(t){super(`Theme "${t}" is already registered`);this.name="DuplicateThemeError"}},dy=class extends Error{constructor(t){super(`No loader registered for theme "${t}"`);this.name="UnregisteredThemeError"}},my=class extends Error{constructor(t){super(`Theme "${t}" has not been resolved`);this.name="UnresolvedThemeError"}};function pf(){let t=new Map,n=new Map,s=new Map,a=0;function l(_,O){if(t.has(_))throw new cy(_);t.set(_,O)}function d(_,O){if(t.has(_))return!1;return t.set(_,O),!0}function f(_){return t.has(_)}function h(_){let O=n.get(_);if(O!==void 0)return Promise.resolve(O);let B=s.get(_);if(B!==void 0)return B;let X=t.get(_);if(X===void 0)return Promise.reject(new dy(_));let z=a,K=X().then((W)=>{let J=qu(W);if(z===a)n.set(_,J);if(s.get(_)===K)s.delete(_);return J}).catch((W)=>{if(s.get(_)===K)s.delete(_);throw W});return s.set(_,K),K}function g(_){return Promise.all(_.map((O)=>h(O)))}function I(_,O){n.set(_,O)}function b(_){for(let[O,B]of _)I(O,B)}function v(_){return n.get(_)}function k(_){let O=[];for(let B of _){let X=n.get(B);if(X===void 0)throw new my(B);O.push(X)}return O}function w(_){return n.has(_)}function P(_){for(let O of _)if(!n.has(O))return!1;return!0}function M(_){let O=n.get(_);if(O!==void 0)return O;return h(_)}function N(){a++,n.clear(),s.clear()}return{clearResolvedThemes:N,getResolvedOrResolveTheme:M,getResolvedTheme:v,getResolvedThemes:k,hasRegisteredTheme:f,hasResolvedTheme:w,hasResolvedThemes:P,registerTheme:l,registerThemeIfAbsent:d,resolveTheme:h,resolveThemes:g,seedResolvedTheme:I,seedResolvedThemes:b}}var vn=pf();function Ku(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function go(t){let n=[],s=new Set;for(let v of C1(t.themes)){let k=fy(v)?v.getThemes():[v];for(let w of k){if(s.has(w.name))throw Error(`Theme collection already contains theme "${w.name}"`);s.add(w.name),n.push(w)}}let a=Object.freeze([...n]),l=Object.freeze(a.filter((v)=>v.colorScheme==="light")),d=Object.freeze(a.filter((v)=>v.colorScheme==="dark")),f=new Map(a.map((v)=>[v.name,v])),h=Object.freeze(a.map((v)=>v.name)),g=Object.freeze(l.map((v)=>v.name)),I=Object.freeze(d.map((v)=>v.name));function b(v){if(v==null)return a;let{colorScheme:k,collection:w}=v;if(w==null){if(k==="light")return l;if(k==="dark")return d;return a}return a.filter((P)=>{if(P.collection!==w)return!1;return k==null||P.colorScheme===k})}return{getTheme(v){return f.get(v)},getThemes(v){return b(v)},getThemeNames(v){if(v?.collection==null){if(v?.colorScheme==="light")return g;if(v?.colorScheme==="dark")return I;return h}return b(v).map((k)=>k.name)},hasTheme(v){return f.has(v)},orderBy(v){return go({themes:a.map((k,w)=>({descriptor:k,index:w})).sort((k,w)=>{let P=v(k.descriptor,w.descriptor);if(P!==0)return P;return k.index-w.index}).map((k)=>k.descriptor)})},pick(v){let k=[],w=new Set;for(let P of v){if(w.has(P))throw Error(`Theme collection pick already includes theme "${P}"`);w.add(P);let M=f.get(P);if(M==null)throw Error(`Theme collection does not contain theme "${P}"`);k.push(M)}return go({themes:k})},registerInto(v){for(let k of a)v.registerThemeIfAbsent(k.name,k.load)}}}function C1(t){if(E1(t))return[t];return t}function E1(t){return fy(t)||v1(t)}function v1(t){return typeof t.name==="string"&&typeof t.load==="function"}function fy(t){return typeof t.getThemes==="function"}var{defineProperty:hf,getOwnPropertyDescriptor:k1,getOwnPropertyNames:T1}=Object,w1=Object.prototype.hasOwnProperty,hy=(t,n)=>{let s={};for(var a in t)hf(s,a,{get:t[a],enumerable:!0});if(!n)hf(s,Symbol.toStringTag,{value:"Module"});return s},py=(t,n,s,a)=>{if(n&&typeof n==="object"||typeof n==="function"){for(var l=T1(n),d=0,f=l.length,h;d<f;d++)if(h=l[d],!w1.call(t,h)&&h!==s)hf(t,h,{get:((g)=>n[g]).bind(null,h),enumerable:!(a=k1(n,h))||a.enumerable})}return t},gy=(t,n,s)=>(py(t,n,"default"),s&&py(s,n,"default"));var Lt=class extends Error{constructor(t){super(t);this.name="ShikiError"}};function R1(t){return Ef(t)}function Ef(t){if(Array.isArray(t))return L1(t);if(t instanceof RegExp)return t;if(typeof t==="object")return A1(t);return t}function L1(t){let n=[];for(let s=0,a=t.length;s<a;s++)n[s]=Ef(t[s]);return n}function A1(t){let n={};for(let s in t)n[s]=Ef(t[s]);return n}function ky(t,...n){return n.forEach((s)=>{for(let a in s)t[a]=s[a]}),t}function Ty(t){let n=~t.lastIndexOf("/")||~t.lastIndexOf("\\");if(n===0)return t;else if(~n===t.length-1)return Ty(t.substring(0,t.length-1));else return t.substr(~n+1)}var gf=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Vu=class{static hasCaptures(t){if(t===null)return!1;return gf.lastIndex=0,gf.test(t)}static replaceCaptures(t,n,s){return t.replace(gf,(a,l,d,f)=>{let h=s[parseInt(l||d,10)];if(h){let g=n.substring(h.start,h.end);while(g[0]===".")g=g.substring(1);switch(f){case"downcase":return g.toLowerCase();case"upcase":return g.toUpperCase();default:return g}}else return a})}};function wy(t,n){if(t<n)return-1;if(t>n)return 1;return 0}function Ry(t,n){if(t===null&&n===null)return 0;if(!t)return-1;if(!n)return 1;let s=t.length,a=n.length;if(s===a){for(let l=0;l<s;l++){let d=wy(t[l],n[l]);if(d!==0)return d}return 0}return s-a}function yy(t){if(/^#[0-9a-f]{6}$/i.test(t))return!0;if(/^#[0-9a-f]{8}$/i.test(t))return!0;if(/^#[0-9a-f]{3}$/i.test(t))return!0;if(/^#[0-9a-f]{4}$/i.test(t))return!0;return!1}function Ly(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ay=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);let n=this.fn(t);return this.cache.set(t,n),n}},Wa=class{constructor(t,n,s){this._colorMap=t,this._defaults=n,this._root=s}static createFromRawTheme(t,n){return this.createFromParsedTheme(_1(t),n)}static createFromParsedTheme(t,n){return $1(t,n)}_cachedMatchRoot=new Ay((t)=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;let n=t.scopeName,a=this._cachedMatchRoot.get(n).find((l)=>P1(t.parent,l.parentScopes));if(!a)return null;return new Py(a.fontStyle,a.foreground,a.background)}},yf=class t{constructor(n,s){this.parent=n,this.scopeName=s}static push(n,s){for(let a of s)n=new t(n,a);return n}static from(...n){let s=null;for(let a=0;a<n.length;a++)s=new t(s,n[a]);return s}push(n){return new t(this,n)}getSegments(){let n=this,s=[];while(n)s.push(n.scopeName),n=n.parent;return s.reverse(),s}toString(){return this.getSegments().join(" ")}extends(n){if(this===n)return!0;if(this.parent===null)return!1;return this.parent.extends(n)}getExtensionIfDefined(n){let s=[],a=this;while(a&&a!==n)s.push(a.scopeName),a=a.parent;return a===n?s.reverse():void 0}};function P1(t,n){if(n.length===0)return!0;for(let s=0;s<n.length;s++){let a=n[s],l=!1;if(a===">"){if(s===n.length-1)return!1;a=n[++s],l=!0}while(t){if(M1(t.scopeName,a))break;if(l)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function M1(t,n){return n===t||t.startsWith(n)&&t[n.length]==="."}var Py=class{constructor(t,n,s){this.fontStyle=t,this.foregroundId=n,this.backgroundId=s}};function _1(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let n=t.settings,s=[],a=0;for(let l=0,d=n.length;l<d;l++){let f=n[l];if(!f.settings)continue;let h;if(typeof f.scope==="string"){let v=f.scope;v=v.replace(/^[,]+/,""),v=v.replace(/[,]+$/,""),h=v.split(",")}else if(Array.isArray(f.scope))h=f.scope;else h=[""];let g=-1;if(typeof f.settings.fontStyle==="string"){g=0;let v=f.settings.fontStyle.split(" ");for(let k=0,w=v.length;k<w;k++)switch(v[k]){case"italic":g=g|1;break;case"bold":g=g|2;break;case"underline":g=g|4;break;case"strikethrough":g=g|8;break}}let I=null;if(typeof f.settings.foreground==="string"&&yy(f.settings.foreground))I=f.settings.foreground;let b=null;if(typeof f.settings.background==="string"&&yy(f.settings.background))b=f.settings.background;for(let v=0,k=h.length;v<k;v++){let P=h[v].trim().split(" "),M=P[P.length-1],N=null;if(P.length>1)N=P.slice(0,P.length-1),N.reverse();s[a++]=new O1(M,N,l,g,I,b)}}return s}var O1=class{constructor(t,n,s,a,l,d){this.scope=t,this.parentScopes=n,this.index=s,this.fontStyle=a,this.foreground=l,this.background=d}},qn=((t)=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(qn||{});function $1(t,n){t.sort((g,I)=>{let b=wy(g.scope,I.scope);if(b!==0)return b;if(b=Ry(g.parentScopes,I.parentScopes),b!==0)return b;return g.index-I.index});let s=0,a="#000000",l="#ffffff";while(t.length>=1&&t[0].scope===""){let g=t.shift();if(g.fontStyle!==-1)s=g.fontStyle;if(g.foreground!==null)a=g.foreground;if(g.background!==null)l=g.background}let d=new F1(n),f=new Py(s,d.getId(a),d.getId(l)),h=new D1(new If(0,null,-1,0,0),[]);for(let g=0,I=t.length;g<I;g++){let b=t[g];h.insert(0,b.scope,b.parentScopes,b.fontStyle,d.getId(b.foreground),d.getId(b.background))}return new Wa(d,f,h)}var F1=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let n=0,s=t.length;n<s;n++)this._color2id[t[n]]=n,this._id2color[n]=t[n]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let n=this._color2id[t];if(n)return n;if(this._isFrozen)throw Error(`Missing color in color map - ${t}`);return n=++this._lastColorId,this._color2id[t]=n,this._id2color[n]=t,n}getColorMap(){return this._id2color.slice(0)}},N1=Object.freeze([]),If=class t{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(n,s,a,l,d){this.scopeDepth=n,this.parentScopes=s||N1,this.fontStyle=a,this.foreground=l,this.background=d}clone(){return new t(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(n){let s=[];for(let a=0,l=n.length;a<l;a++)s[a]=n[a].clone();return s}acceptOverwrite(n,s,a,l){if(this.scopeDepth>n)console.log("how did this happen?");else this.scopeDepth=n;if(s!==-1)this.fontStyle=s;if(a!==0)this.foreground=a;if(l!==0)this.background=l}},D1=class t{constructor(n,s=[],a={}){this._mainRule=n,this._children=a,this._rulesWithParentScopes=s}_rulesWithParentScopes;static _cmpBySpecificity(n,s){if(n.scopeDepth!==s.scopeDepth)return s.scopeDepth-n.scopeDepth;let a=0,l=0;while(!0){if(n.parentScopes[a]===">")a++;if(s.parentScopes[l]===">")l++;if(a>=n.parentScopes.length||l>=s.parentScopes.length)break;let d=s.parentScopes[l].length-n.parentScopes[a].length;if(d!==0)return d;a++,l++}return s.parentScopes.length-n.parentScopes.length}match(n){if(n!==""){let a=n.indexOf("."),l,d;if(a===-1)l=n,d="";else l=n.substring(0,a),d=n.substring(a+1);if(this._children.hasOwnProperty(l))return this._children[l].match(d)}let s=this._rulesWithParentScopes.concat(this._mainRule);return s.sort(t._cmpBySpecificity),s}insert(n,s,a,l,d,f){if(s===""){this._doInsertHere(n,a,l,d,f);return}let h=s.indexOf("."),g,I;if(h===-1)g=s,I="";else g=s.substring(0,h),I=s.substring(h+1);let b;if(this._children.hasOwnProperty(g))b=this._children[g];else b=new t(this._mainRule.clone(),If.cloneArr(this._rulesWithParentScopes)),this._children[g]=b;b.insert(n+1,I,a,l,d,f)}_doInsertHere(n,s,a,l,d){if(s===null){this._mainRule.acceptOverwrite(n,a,l,d);return}for(let f=0,h=this._rulesWithParentScopes.length;f<h;f++){let g=this._rulesWithParentScopes[f];if(Ry(g.parentScopes,s)===0){g.acceptOverwrite(n,a,l,d);return}}if(a===-1)a=this._mainRule.fontStyle;if(l===0)l=this._mainRule.foreground;if(d===0)d=this._mainRule.background;this._rulesWithParentScopes.push(new If(n,s,a,l,d))}},G=class t{static toBinaryStr(n){return n.toString(2).padStart(32,"0")}static print(n){let s=t.getLanguageId(n),a=t.getTokenType(n),l=t.getFontStyle(n),d=t.getForeground(n),f=t.getBackground(n);console.log({languageId:s,tokenType:a,fontStyle:l,foreground:d,background:f})}static getLanguageId(n){return(n&255)>>>0}static getTokenType(n){return(n&768)>>>8}static containsBalancedBrackets(n){return(n&1024)!==0}static getFontStyle(n){return(n&30720)>>>11}static getForeground(n){return(n&16744448)>>>15}static getBackground(n){return(n&4278190080)>>>24}static set(n,s,a,l,d,f,h){let g=t.getLanguageId(n),I=t.getTokenType(n),b=t.containsBalancedBrackets(n)?1:0,v=t.getFontStyle(n),k=t.getForeground(n),w=t.getBackground(n);if(s!==0)g=s;if(a!==8)I=U1(a);if(l!==null)b=l?1:0;if(d!==-1)v=d;if(f!==0)k=f;if(h!==0)w=h;return(g<<0|I<<8|b<<10|v<<11|k<<15|w<<24)>>>0}};function H1(t){return t}function U1(t){return t}function Xu(t,n){let s=[],a=B1(t),l=a.next();while(l!==null){let g=0;if(l.length===2&&l.charAt(1)===":"){switch(l.charAt(0)){case"R":g=1;break;case"L":g=-1;break;default:console.log(`Unknown priority ${l} in scope selector`)}l=a.next()}let I=f();if(s.push({matcher:I,priority:g}),l!==",")break;l=a.next()}return s;function d(){if(l==="-"){l=a.next();let g=d();return(I)=>!!g&&!g(I)}if(l==="("){l=a.next();let g=h();if(l===")")l=a.next();return g}if(xy(l)){let g=[];do g.push(l),l=a.next();while(xy(l));return(I)=>n(g,I)}return null}function f(){let g=[],I=d();while(I)g.push(I),I=d();return(b)=>g.every((v)=>v(b))}function h(){let g=[],I=f();while(I){if(g.push(I),l==="|"||l===",")do l=a.next();while(l==="|"||l===",");else break;I=f()}return(b)=>g.some((v)=>v(b))}}function xy(t){return!!t&&!!t.match(/[\w\.:]+/)}function B1(t){let n=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,s=n.exec(t);return{next:()=>{if(!s)return null;let a=s[0];return s=n.exec(t),a}}}var G1=((t)=>(t[t.None=0]="None",t[t.NotBeginString=1]="NotBeginString",t[t.NotEndString=2]="NotEndString",t[t.NotBeginPosition=4]="NotBeginPosition",t[t.DebugCall=8]="DebugCall",t))(G1||{});function My(t){if(typeof t.dispose==="function")t.dispose()}var Xa=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},z1=class{constructor(t,n){this.scopeName=t,this.ruleName=n}toKey(){return`${this.scopeName}#${this.ruleName}`}},j1=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){let n=t.toKey();if(this._seenReferenceKeys.has(n))return;this._seenReferenceKeys.add(n),this._references.push(t)}},q1=class{constructor(t,n){this.repo=t,this.initialScopeName=n,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Xa(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let t=this.Q;this.Q=[];let n=new j1;for(let s of t)K1(s,this.initialScopeName,this.repo,n);for(let s of n.references)if(s instanceof Xa){if(this.seenFullScopeRequests.has(s.scopeName))continue;this.seenFullScopeRequests.add(s.scopeName),this.Q.push(s)}else{if(this.seenFullScopeRequests.has(s.scopeName))continue;if(this.seenPartialScopeRequests.has(s.toKey()))continue;this.seenPartialScopeRequests.add(s.toKey()),this.Q.push(s)}}};function K1(t,n,s,a){let l=s.lookup(t.scopeName);if(!l){if(t.scopeName===n)throw Error(`No grammar provided for <${n}>`);return}let d=s.lookup(n);if(t instanceof Xa)Wu({baseGrammar:d,selfGrammar:l},a);else Sf(t.ruleName,{baseGrammar:d,selfGrammar:l,repository:l.repository},a);let f=s.injections(t.scopeName);if(f)for(let h of f)a.add(new Xa(h))}function Sf(t,n,s){if(n.repository&&n.repository[t]){let a=n.repository[t];Yu([a],n,s)}}function Wu(t,n){if(t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns))Yu(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},n);if(t.selfGrammar.injections)Yu(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},n)}function Yu(t,n,s){for(let a of t){if(s.visitedRule.has(a))continue;s.visitedRule.add(a);let l=a.repository?ky({},n.repository,a.repository):n.repository;if(Array.isArray(a.patterns))Yu(a.patterns,{...n,repository:l},s);let d=a.include;if(!d)continue;let f=_y(d);switch(f.kind){case 0:Wu({...n,selfGrammar:n.baseGrammar},s);break;case 1:Wu(n,s);break;case 2:Sf(f.ruleName,{...n,repository:l},s);break;case 3:case 4:let h=f.scopeName===n.selfGrammar.scopeName?n.selfGrammar:f.scopeName===n.baseGrammar.scopeName?n.baseGrammar:void 0;if(h){let g={baseGrammar:n.baseGrammar,selfGrammar:h,repository:l};if(f.kind===4)Sf(f.ruleName,g,s);else Wu(g,s)}else if(f.kind===4)s.add(new z1(f.scopeName,f.ruleName));else s.add(new Xa(f.scopeName));break}}}var V1=class{kind=0},W1=class{kind=1},X1=class{constructor(t){this.ruleName=t}kind=2},Y1=class{constructor(t){this.scopeName=t}kind=3},J1=class{constructor(t,n){this.scopeName=t,this.ruleName=n}kind=4};function _y(t){if(t==="$base")return new V1;else if(t==="$self")return new W1;let n=t.indexOf("#");if(n===-1)return new Y1(t);else if(n===0)return new X1(t.substring(1));else{let s=t.substring(0,n),a=t.substring(n+1);return new J1(s,a)}}var Q1=/\\(\d+)/,Iy=/\\(\d+)/g,v5=Symbol("RuleId"),Z1=-1,Oy=-2;function $y(t){return t}function Fy(t){return t}var Qa=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,n,s,a){this.$location=t,this.id=n,this._name=s||null,this._nameIsCapturing=Vu.hasCaptures(this._name),this._contentName=a||null,this._contentNameIsCapturing=Vu.hasCaptures(this._contentName)}get debugName(){let t=this.$location?`${Ty(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,n){if(!this._nameIsCapturing||this._name===null||t===null||n===null)return this._name;return Vu.replaceCaptures(this._name,t,n)}getContentName(t,n){if(!this._contentNameIsCapturing||this._contentName===null)return this._contentName;return Vu.replaceCaptures(this._contentName,t,n)}},eA=class extends Qa{retokenizeCapturedWithRuleId;constructor(t,n,s,a,l){super(t,n,s,a);this.retokenizeCapturedWithRuleId=l}dispose(){}collectPatterns(t,n){throw Error("Not supported!")}compile(t,n){throw Error("Not supported!")}compileAG(t,n,s,a){throw Error("Not supported!")}},tA=class extends Qa{_match;captures;_cachedCompiledPatterns;constructor(t,n,s,a,l){super(t,n,s,null);this._match=new Ya(a,this.id),this.captures=l,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t).compileAG(t,s,a)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new Ja,this.collectPatterns(t,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},Sy=class extends Qa{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,n,s,a,l){super(t,n,s,a);this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}collectPatterns(t,n){for(let s of this.patterns)t.getRule(s).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t).compileAG(t,s,a)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new Ja,this.collectPatterns(t,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},bf=class extends Qa{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,n,s,a,l,d,f,h,g,I){super(t,n,s,a);this._begin=new Ya(l,this.id),this.beginCaptures=d,this._end=new Ya(f?f:"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=h,this.applyEndPatternLast=g||!1,this.patterns=I.patterns,this.hasMissingPatterns=I.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t,n).compileAG(t,s,a)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ja;for(let s of this.patterns)t.getRule(s).collectPatterns(t,this._cachedCompiledPatterns);if(this.applyEndPatternLast)this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end);else this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}if(this._end.hasBackReferences)if(this.applyEndPatternLast)this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n);else this._cachedCompiledPatterns.setSource(0,n);return this._cachedCompiledPatterns}},Ju=class extends Qa{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,n,s,a,l,d,f,h,g){super(t,n,s,a);this._begin=new Ya(l,this.id),this.beginCaptures=d,this.whileCaptures=h,this._while=new Ya(f,Oy),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=g.patterns,this.hasMissingPatterns=g.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null;if(this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t).compileAG(t,s,a)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ja;for(let n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,s,a){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,s,a)}_getCachedCompiledWhilePatterns(t,n){if(!this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns=new Ja,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while);if(this._while.hasBackReferences)this._cachedCompiledWhilePatterns.setSource(0,n?n:"");return this._cachedCompiledWhilePatterns}},Ny=class t{static createCaptureRule(n,s,a,l,d){return n.registerRule((f)=>new eA(s,f,a,l,d))}static getCompiledRuleId(n,s,a){if(!n.id)s.registerRule((l)=>{if(n.id=l,n.match)return new tA(n.$vscodeTextmateLocation,n.id,n.name,n.match,t._compileCaptures(n.captures,s,a));if(typeof n.begin>"u"){if(n.repository)a=ky({},a,n.repository);let d=n.patterns;if(typeof d>"u"&&n.include)d=[{include:n.include}];return new Sy(n.$vscodeTextmateLocation,n.id,n.name,n.contentName,t._compilePatterns(d,s,a))}if(n.while)return new Ju(n.$vscodeTextmateLocation,n.id,n.name,n.contentName,n.begin,t._compileCaptures(n.beginCaptures||n.captures,s,a),n.while,t._compileCaptures(n.whileCaptures||n.captures,s,a),t._compilePatterns(n.patterns,s,a));return new bf(n.$vscodeTextmateLocation,n.id,n.name,n.contentName,n.begin,t._compileCaptures(n.beginCaptures||n.captures,s,a),n.end,t._compileCaptures(n.endCaptures||n.captures,s,a),n.applyEndPatternLast,t._compilePatterns(n.patterns,s,a))});return n.id}static _compileCaptures(n,s,a){let l=[];if(n){let d=0;for(let f in n){if(f==="$vscodeTextmateLocation")continue;let h=parseInt(f,10);if(h>d)d=h}for(let f=0;f<=d;f++)l[f]=null;for(let f in n){if(f==="$vscodeTextmateLocation")continue;let h=parseInt(f,10),g=0;if(n[f].patterns)g=t.getCompiledRuleId(n[f],s,a);l[h]=t.createCaptureRule(s,n[f].$vscodeTextmateLocation,n[f].name,n[f].contentName,g)}}return l}static _compilePatterns(n,s,a){let l=[];if(n)for(let d=0,f=n.length;d<f;d++){let h=n[d],g=-1;if(h.include){let I=_y(h.include);switch(I.kind){case 0:case 1:g=t.getCompiledRuleId(a[h.include],s,a);break;case 2:let b=a[I.ruleName];if(b)g=t.getCompiledRuleId(b,s,a);break;case 3:case 4:let v=I.scopeName,k=I.kind===4?I.ruleName:null,w=s.getExternalGrammar(v,a);if(w)if(k){let P=w.repository[k];if(P)g=t.getCompiledRuleId(P,s,w.repository)}else g=t.getCompiledRuleId(w.repository.$self,s,w.repository);break}}else g=t.getCompiledRuleId(h,s,a);if(g!==-1){let I=s.getRule(g),b=!1;if(I instanceof Sy||I instanceof bf||I instanceof Ju){if(I.hasMissingPatterns&&I.patterns.length===0)b=!0}if(b)continue;l.push(g)}}return{patterns:l,hasMissingPatterns:(n?n.length:0)!==l.length}}},Ya=class t{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(n,s){if(n&&typeof n==="string"){let a=n.length,l=0,d=[],f=!1;for(let h=0;h<a;h++)if(n.charAt(h)==="\\"){if(h+1<a){let I=n.charAt(h+1);if(I==="z")d.push(n.substring(l,h)),d.push("$(?!\\n)(?<!\\n)"),l=h+2;else if(I==="A"||I==="G")f=!0;h++}}if(this.hasAnchor=f,l===0)this.source=n;else d.push(n.substring(l,a)),this.source=d.join("")}else this.hasAnchor=!1,this.source=n;if(this.hasAnchor)this._anchorCache=this._buildAnchorCache();else this._anchorCache=null;if(this.ruleId=s,typeof this.source==="string")this.hasBackReferences=Q1.test(this.source);else this.hasBackReferences=!1}clone(){return new t(this.source,this.ruleId)}setSource(n){if(this.source===n)return;if(this.source=n,this.hasAnchor)this._anchorCache=this._buildAnchorCache()}resolveBackReferences(n,s){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let a=s.map((l)=>n.substring(l.start,l.end));return Iy.lastIndex=0,this.source.replace(Iy,(l,d)=>Ly(a[parseInt(d,10)]||""))}_buildAnchorCache(){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let n=[],s=[],a=[],l=[],d,f,h,g;for(d=0,f=this.source.length;d<f;d++)if(h=this.source.charAt(d),n[d]=h,s[d]=h,a[d]=h,l[d]=h,h==="\\"){if(d+1<f){if(g=this.source.charAt(d+1),g==="A")n[d+1]="",s[d+1]="",a[d+1]="A",l[d+1]="A";else if(g==="G")n[d+1]="",s[d+1]="G",a[d+1]="",l[d+1]="G";else n[d+1]=g,s[d+1]=g,a[d+1]=g,l[d+1]=g;d++}}return{A0_G0:n.join(""),A0_G1:s.join(""),A1_G0:a.join(""),A1_G1:l.join("")}}resolveAnchors(n,s){if(!this.hasAnchor||!this._anchorCache||typeof this.source!=="string")return this.source;if(n)if(s)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;else if(s)return this._anchorCache.A0_G1;else return this._anchorCache.A0_G0}},Ja=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){if(this._cached)this._cached.dispose(),this._cached=null;if(this._anchorCache.A0_G0)this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null;if(this._anchorCache.A0_G1)this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null;if(this._anchorCache.A1_G0)this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null;if(this._anchorCache.A1_G1)this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,n){if(this._items[t].source!==n)this._disposeCaches(),this._items[t].setSource(n)}compile(t){if(!this._cached){let n=this._items.map((s)=>s.source);this._cached=new by(t,n,this._items.map((s)=>s.ruleId))}return this._cached}compileAG(t,n,s){if(!this._hasAnchors)return this.compile(t);else if(n)if(s){if(!this._anchorCache.A1_G1)this._anchorCache.A1_G1=this._resolveAnchors(t,n,s);return this._anchorCache.A1_G1}else{if(!this._anchorCache.A1_G0)this._anchorCache.A1_G0=this._resolveAnchors(t,n,s);return this._anchorCache.A1_G0}else if(s){if(!this._anchorCache.A0_G1)this._anchorCache.A0_G1=this._resolveAnchors(t,n,s);return this._anchorCache.A0_G1}else{if(!this._anchorCache.A0_G0)this._anchorCache.A0_G0=this._resolveAnchors(t,n,s);return this._anchorCache.A0_G0}}_resolveAnchors(t,n,s){let a=this._items.map((l)=>l.resolveAnchors(n,s));return new by(t,a,this._items.map((l)=>l.ruleId))}},by=class{constructor(t,n,s){this.regExps=n,this.rules=s,this.scanner=t.createOnigScanner(n)}scanner;dispose(){if(typeof this.scanner.dispose==="function")this.scanner.dispose()}toString(){let t=[];for(let n=0,s=this.rules.length;n<s;n++)t.push(" - "+this.rules[n]+": "+this.regExps[n]);return t.join(`
|
|
2
2
|
`)}findNextMatchSync(t,n,s){let a=this.scanner.findNextMatchSync(t,n,s);if(!a)return null;return{ruleId:this.rules[a.index],captureIndices:a.captureIndices}}},xf=class{constructor(t,n){this.languageId=t,this.tokenType=n}},nA=class t{_defaultAttributes;_embeddedLanguagesMatcher;constructor(n,s){this._defaultAttributes=new xf(n,8),this._embeddedLanguagesMatcher=new rA(Object.entries(s||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(n){if(n===null)return t._NULL_SCOPE_METADATA;return this._getBasicScopeAttributes.get(n)}static _NULL_SCOPE_METADATA=new xf(0,0);_getBasicScopeAttributes=new Ay((n)=>{let s=this._scopeToLanguage(n),a=this._toStandardTokenType(n);return new xf(s,a)});_scopeToLanguage(n){return this._embeddedLanguagesMatcher.match(n)||0}_toStandardTokenType(n){let s=n.match(t.STANDARD_TOKEN_TYPE_REGEXP);if(!s)return 8;switch(s[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},rA=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);let n=t.map(([s,a])=>Ly(s));n.sort(),n.reverse(),this.scopesRegExp=new RegExp(`^((${n.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;let n=t.match(this.scopesRegExp);if(!n)return;return this.values.get(n[1])}},k5={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},Dy=!1,Cy=class{constructor(t,n){this.stack=t,this.stoppedEarly=n}};function Hy(t,n,s,a,l,d,f,h){let g=n.content.length,I=!1,b=-1;if(f){let w=iA(t,n,s,a,l,d);l=w.stack,a=w.linePos,s=w.isFirstLine,b=w.anchorPosition}let v=Date.now();while(!I){if(h!==0){if(Date.now()-v>h)return new Cy(l,!0)}k()}return new Cy(l,!1);function k(){let w=oA(t,n,s,a,l,b);if(!w){d.produce(l,g),I=!0;return}let{captureIndices:P,matchedRuleId:M}=w,N=P&&P.length>0?P[0].end>a:!1;if(M===Z1){let _=l.getRule(t);d.produce(l,P[0].start),l=l.withContentNameScopesList(l.nameScopesList),Ka(t,n,s,l,d,_.endCaptures,P),d.produce(l,P[0].end);let O=l;if(l=l.parent,b=O.getAnchorPos(),!N&&O.getEnterPos()===a){l=O,d.produce(l,g),I=!0;return}}else{let _=t.getRule(M);d.produce(l,P[0].start);let O=l,B=_.getName(n.content,P),X=l.contentNameScopesList.pushAttributed(B,t);if(l=l.push(M,a,b,P[0].end===g,null,X,X),_ instanceof bf){let z=_;Ka(t,n,s,l,d,z.beginCaptures,P),d.produce(l,P[0].end),b=P[0].end;let K=z.getContentName(n.content,P),W=X.pushAttributed(K,t);if(l=l.withContentNameScopesList(W),z.endHasBackReferences)l=l.withEndRule(z.getEndWithResolvedBackReferences(n.content,P));if(!N&&O.hasSameRuleAs(l)){l=l.pop(),d.produce(l,g),I=!0;return}}else if(_ instanceof Ju){let z=_;Ka(t,n,s,l,d,z.beginCaptures,P),d.produce(l,P[0].end),b=P[0].end;let K=z.getContentName(n.content,P),W=X.pushAttributed(K,t);if(l=l.withContentNameScopesList(W),z.whileHasBackReferences)l=l.withEndRule(z.getWhileWithResolvedBackReferences(n.content,P));if(!N&&O.hasSameRuleAs(l)){l=l.pop(),d.produce(l,g),I=!0;return}}else if(Ka(t,n,s,l,d,_.captures,P),d.produce(l,P[0].end),l=l.pop(),!N){l=l.safePop(),d.produce(l,g),I=!0;return}}if(P[0].end>a)a=P[0].end,s=!1}}function iA(t,n,s,a,l,d){let f=l.beginRuleCapturedEOL?0:-1,h=[];for(let g=l;g;g=g.pop()){let I=g.getRule(t);if(I instanceof Ju)h.push({rule:I,stack:g})}for(let g=h.pop();g;g=h.pop()){let{ruleScanner:I,findOptions:b}=lA(g.rule,t,g.stack.endRule,s,a===f),v=I.findNextMatchSync(n,a,b);if(v){if(v.ruleId!==Oy){l=g.stack.pop();break}if(v.captureIndices&&v.captureIndices.length){if(d.produce(g.stack,v.captureIndices[0].start),Ka(t,n,s,g.stack,d,g.rule.whileCaptures,v.captureIndices),d.produce(g.stack,v.captureIndices[0].end),f=v.captureIndices[0].end,v.captureIndices[0].end>a)a=v.captureIndices[0].end,s=!1}}else{l=g.stack.pop();break}}return{stack:l,linePos:a,anchorPosition:f,isFirstLine:s}}function oA(t,n,s,a,l,d){let f=sA(t,n,s,a,l,d),h=t.getInjections();if(h.length===0)return f;let g=aA(h,t,n,s,a,l,d);if(!g)return f;if(!f)return g;let I=f.captureIndices[0].start,b=g.captureIndices[0].start;if(b<I||g.priorityMatch&&b===I)return g;return f}function sA(t,n,s,a,l,d){let f=l.getRule(t),{ruleScanner:h,findOptions:g}=Uy(f,t,l.endRule,s,a===d),I=h.findNextMatchSync(n,a,g);if(I)return{captureIndices:I.captureIndices,matchedRuleId:I.ruleId};return null}function aA(t,n,s,a,l,d,f){let h=Number.MAX_VALUE,g=null,I,b=0,v=d.contentNameScopesList.getScopeNames();for(let k=0,w=t.length;k<w;k++){let P=t[k];if(!P.matcher(v))continue;let M=n.getRule(P.ruleId),{ruleScanner:N,findOptions:_}=Uy(M,n,null,a,l===f),O=N.findNextMatchSync(s,l,_);if(!O)continue;let B=O.captureIndices[0].start;if(B>=h)continue;if(h=B,g=O.captureIndices,I=O.ruleId,b=P.priority,h===l)break}if(g)return{priorityMatch:b===-1,captureIndices:g,matchedRuleId:I};return null}function Uy(t,n,s,a,l){if(Dy){let f=t.compile(n,s),h=By(a,l);return{ruleScanner:f,findOptions:h}}return{ruleScanner:t.compileAG(n,s,a,l),findOptions:0}}function lA(t,n,s,a,l){if(Dy){let f=t.compileWhile(n,s),h=By(a,l);return{ruleScanner:f,findOptions:h}}return{ruleScanner:t.compileWhileAG(n,s,a,l),findOptions:0}}function By(t,n){let s=0;if(!t)s|=1;if(!n)s|=4;return s}function Ka(t,n,s,a,l,d,f){if(d.length===0)return;let h=n.content,g=Math.min(d.length,f.length),I=[],b=f[0].end;for(let v=0;v<g;v++){let k=d[v];if(k===null)continue;let w=f[v];if(w.length===0)continue;if(w.start>b)break;while(I.length>0&&I[I.length-1].endPos<=w.start)l.produceFromScopes(I[I.length-1].scopes,I[I.length-1].endPos),I.pop();if(I.length>0)l.produceFromScopes(I[I.length-1].scopes,w.start);else l.produce(a,w.start);if(k.retokenizeCapturedWithRuleId){let M=k.getName(h,f),N=a.contentNameScopesList.pushAttributed(M,t),_=k.getContentName(h,f),O=N.pushAttributed(_,t),B=a.push(k.retokenizeCapturedWithRuleId,w.start,-1,!1,null,N,O),X=t.createOnigString(h.substring(0,w.end));Hy(t,X,s&&w.start===0,w.start,B,l,!1,0),My(X);continue}let P=k.getName(h,f);if(P!==null){let N=(I.length>0?I[I.length-1].scopes:a.contentNameScopesList).pushAttributed(P,t);I.push(new uA(N,w.end))}}while(I.length>0)l.produceFromScopes(I[I.length-1].scopes,I[I.length-1].endPos),I.pop()}var uA=class{scopes;endPos;constructor(t,n){this.scopes=t,this.endPos=n}};function cA(t,n,s,a,l,d,f,h){return new mA(t,n,s,a,l,d,f,h)}function Ey(t,n,s,a,l){let d=Xu(n,Qu),f=Ny.getCompiledRuleId(s,a,l.repository);for(let h of d)t.push({debugSelector:n,matcher:h.matcher,ruleId:f,grammar:l,priority:h.priority})}function Qu(t,n){if(n.length<t.length)return!1;let s=0;return t.every((a)=>{for(let l=s;l<n.length;l++)if(dA(n[l],a))return s=l+1,!0;return!1})}function dA(t,n){if(!t)return!1;if(t===n)return!0;let s=n.length;return t.length>s&&t.substr(0,s)===n&&t[s]==="."}var mA=class{constructor(t,n,s,a,l,d,f,h){if(this._rootScopeName=t,this.balancedBracketSelectors=d,this._onigLib=h,this._basicScopeAttributesProvider=new nA(s,a),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=f,this._grammar=vy(n,null),this._injections=null,this._tokenTypeMatchers=[],l)for(let g of Object.keys(l)){let I=Xu(g,Qu);for(let b of I)this._tokenTypeMatchers.push({matcher:b.matcher,type:l[g]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let t of this._ruleId2desc)if(t)t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){let t={lookup:(l)=>{if(l===this._rootScopeName)return this._grammar;return this.getExternalGrammar(l)},injections:(l)=>this._grammarRepository.injections(l)},n=[],s=this._rootScopeName,a=t.lookup(s);if(a){let l=a.injections;if(l)for(let f in l)Ey(n,f,l[f],this,a);let d=this._grammarRepository.injections(s);if(d)d.forEach((f)=>{let h=this.getExternalGrammar(f);if(h){let g=h.injectionSelector;if(g)Ey(n,g,h,this,h)}})}return n.sort((l,d)=>l.priority-d.priority),n}getInjections(){if(this._injections===null)this._injections=this._collectInjections();return this._injections}registerRule(t){let n=++this._lastRuleId,s=t($y(n));return this._ruleId2desc[n]=s,s}getRule(t){return this._ruleId2desc[Fy(t)]}getExternalGrammar(t,n){if(this._includedGrammars[t])return this._includedGrammars[t];else if(this._grammarRepository){let s=this._grammarRepository.lookup(t);if(s)return this._includedGrammars[t]=vy(s,n&&n.$base),this._includedGrammars[t]}return}tokenizeLine(t,n,s=0){let a=this._tokenize(t,n,!1,s);return{tokens:a.lineTokens.getResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}tokenizeLine2(t,n,s=0){let a=this._tokenize(t,n,!0,s);return{tokens:a.lineTokens.getBinaryResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}_tokenize(t,n,s,a){if(this._rootId===-1)this._rootId=Ny.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections();let l;if(!n||n===Cf.NULL){l=!0;let I=this._basicScopeAttributesProvider.getDefaultAttributes(),b=this.themeProvider.getDefaults(),v=G.set(0,I.languageId,I.tokenType,null,b.fontStyle,b.foregroundId,b.backgroundId),k=this.getRule(this._rootId).getName(null,null),w;if(k)w=Va.createRootAndLookUpScopeName(k,v,this);else w=Va.createRoot("unknown",v);n=new Cf(null,this._rootId,-1,-1,!1,null,w,w)}else l=!1,n.reset();t=t+`
|
|
3
|
-
`;let d=this.createOnigString(t),f=d.content.length,h=new pA(s,t,this._tokenTypeMatchers,this.balancedBracketSelectors),g=Hy(this,d,l,0,n,h,!0,a);return My(d),{lineLength:f,lineTokens:h,ruleStack:g.stack,stoppedEarly:g.stoppedEarly}}};function vy(t,n){return t=R1(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=n||t.repository.$self,t}var Va=class t{constructor(n,s,a){this.parent=n,this.scopePath=s,this.tokenAttributes=a}static fromExtension(n,s){let a=n,l=n?.scopePath??null;for(let d of s)l=yf.push(l,d.scopeNames),a=new t(a,l,d.encodedTokenAttributes);return a}static createRoot(n,s){return new t(null,new yf(null,n),s)}static createRootAndLookUpScopeName(n,s,a){let l=a.getMetadataForScope(n),d=new yf(null,n),f=a.themeProvider.themeMatch(d),h=t.mergeAttributes(s,l,f);return new t(null,d,h)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(n){return t.equals(this,n)}static equals(n,s){do{if(n===s)return!0;if(!n&&!s)return!0;if(!n||!s)return!1;if(n.scopeName!==s.scopeName||n.tokenAttributes!==s.tokenAttributes)return!1;n=n.parent,s=s.parent}while(!0)}static mergeAttributes(n,s,a){let l=-1,d=0,f=0;if(a!==null)l=a.fontStyle,d=a.foregroundId,f=a.backgroundId;return G.set(n,s.languageId,s.tokenType,null,l,d,f)}pushAttributed(n,s){if(n===null)return this;if(n.indexOf(" ")===-1)return t._pushAttributed(this,n,s);let a=n.split(/ /g),l=this;for(let d of a)l=t._pushAttributed(l,d,s);return l}static _pushAttributed(n,s,a){let l=a.getMetadataForScope(s),d=n.scopePath.push(s),f=a.themeProvider.themeMatch(d),h=t.mergeAttributes(n.tokenAttributes,l,f);return new t(n,d,h)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(n){let s=[],a=this;while(a&&a!==n)s.push({encodedTokenAttributes:a.tokenAttributes,scopeNames:a.scopePath.getExtensionIfDefined(a.parent?.scopePath??null)}),a=a.parent;return a===n?s.reverse():void 0}},Cf=class t{constructor(n,s,a,l,d,f,h,g){this.parent=n,this.ruleId=s,this.beginRuleCapturedEOL=d,this.endRule=f,this.nameScopesList=h,this.contentNameScopesList=g,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=a,this._anchorPos=l}_stackElementBrand=void 0;static NULL=new t(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(n){if(n===null)return!1;return t._equals(this,n)}static _equals(n,s){if(n===s)return!0;if(!this._structuralEquals(n,s))return!1;return Va.equals(n.contentNameScopesList,s.contentNameScopesList)}static _structuralEquals(n,s){do{if(n===s)return!0;if(!n&&!s)return!0;if(!n||!s)return!1;if(n.depth!==s.depth||n.ruleId!==s.ruleId||n.endRule!==s.endRule)return!1;n=n.parent,s=s.parent}while(!0)}clone(){return this}static _reset(n){while(n)n._enterPos=-1,n._anchorPos=-1,n=n.parent}reset(){t._reset(this)}pop(){return this.parent}safePop(){if(this.parent)return this.parent;return this}push(n,s,a,l,d,f,h){return new t(this,n,s,a,l,d,f,h)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(n){return n.getRule(this.ruleId)}toString(){let n=[];return this._writeString(n,0),"["+n.join(",")+"]"}_writeString(n,s){if(this.parent)s=this.parent._writeString(n,s);return n[s++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,s}withContentNameScopesList(n){if(this.contentNameScopesList===n)return this;return this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,n)}withEndRule(n){if(this.endRule===n)return this;return new t(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,n,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(n){let s=this;while(s&&s._enterPos===n._enterPos){if(s.ruleId===n.ruleId)return!0;s=s.parent}return!1}toStateStackFrame(){return{ruleId:Fy(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(n,s){let a=Va.fromExtension(n?.nameScopesList??null,s.nameScopesList);return new t(n,$y(s.ruleId),s.enterPos??-1,s.anchorPos??-1,s.beginRuleCapturedEOL,s.endRule,a,Va.fromExtension(a,s.contentNameScopesList))}},fA=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,n){this.balancedBracketScopes=t.flatMap((s)=>{if(s==="*")return this.allowAny=!0,[];return Xu(s,Qu).map((a)=>a.matcher)}),this.unbalancedBracketScopes=n.flatMap((s)=>Xu(s,Qu).map((a)=>a.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(let n of this.unbalancedBracketScopes)if(n(t))return!1;for(let n of this.balancedBracketScopes)if(n(t))return!0;return this.allowAny}},pA=class{constructor(t,n,s,a){this.balancedBracketSelectors=a,this._emitBinaryTokens=t,this._tokenTypeOverrides=s,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,n){this.produceFromScopes(t.contentNameScopesList,n)}produceFromScopes(t,n){if(this._lastTokenEndIndex>=n)return;if(this._emitBinaryTokens){let a=t?.tokenAttributes??0,l=!1;if(this.balancedBracketSelectors?.matchesAlways)l=!0;if(this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let d=t?.getScopeNames()??[];for(let f of this._tokenTypeOverrides)if(f.matcher(d))a=G.set(a,0,H1(f.type),null,-1,0,0);if(this.balancedBracketSelectors)l=this.balancedBracketSelectors.match(d)}if(l)a=G.set(a,0,8,l,-1,0,0);if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=n;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=n;return}let s=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:n,scopes:s}),this._lastTokenEndIndex=n}getResult(t,n){if(this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===n-1)this._tokens.pop();if(this._tokens.length===0)this._lastTokenEndIndex=-1,this.produce(t,n),this._tokens[this._tokens.length-1].startIndex=0;return this._tokens}getBinaryResult(t,n){if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===n-1)this._binaryTokens.pop(),this._binaryTokens.pop();if(this._binaryTokens.length===0)this._lastTokenEndIndex=-1,this.produce(t,n),this._binaryTokens[this._binaryTokens.length-2]=0;let s=new Uint32Array(this._binaryTokens.length);for(let a=0,l=this._binaryTokens.length;a<l;a++)s[a]=this._binaryTokens[a];return s}},hA=class{constructor(t,n){this._onigLib=n,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,n){if(this._rawGrammars.set(t.scopeName,t),n)this._injectionGrammars.set(t.scopeName,n)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,n,s,a,l){if(!this._grammars.has(t)){let d=this._rawGrammars.get(t);if(!d)return null;this._grammars.set(t,cA(t,d,n,s,a,l,this,this._onigLib))}return this._grammars.get(t)}},Gy=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new hA(Wa.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Wa.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,s){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(t,n,s){return this._loadGrammar(t,n,s.embeddedLanguages,s.tokenTypes,new fA(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,a,l){let d=new q1(this._syncRegistry,t);while(d.Q.length>0)d.Q.map((f)=>this._loadSingleGrammar(f.scopeName)),d.processQueue();return this._grammarForScopeName(t,n,s,a,l)}_loadSingleGrammar(t){if(!this._ensureGrammarCache.has(t))this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0)}_doLoadSingleGrammar(t){let n=this._options.loadGrammar(t);if(n){let s=typeof this._options.getInjections==="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(t,n=[],s=0,a=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,a)}_grammarForScopeName(t,n=0,s=null,a=null,l=null){return this._syncRegistry.grammarForScopeName(t,n,s,a,l)}},R=Cf.NULL;function el(t,n){let s=typeof t==="string"?{}:{...t.colorReplacements},a=typeof t==="string"?t:t.name;for(let[l,d]of Object.entries(n?.colorReplacements||{}))if(typeof d==="string")s[l]=d;else if(l===a)Object.assign(s,d);return s}function Gi(t,n){if(!t)return t;return n?.[t?.toLowerCase()]||t}function Vy(t){return Array.isArray(t)?t:[t]}async function vf(t){return Promise.resolve(typeof t==="function"?t():t).then((n)=>n.default||n)}function tl(t){return!t||["plaintext","txt","text","plain"].includes(t)}function kf(t){return t==="ansi"||tl(t)}function nl(t){return t==="none"}function Tf(t){return nl(t)}var gA=/(\r?\n)/g;function Ns(t,n=!1){if(t.length===0)return[["",0]];let s=t.split(gA),a=0,l=[];for(let d=0;d<s.length;d+=2){let f=n?s[d]+(s[d+1]||""):s[d];l.push([f,a]),a+=s[d].length,a+=s[d+1]?.length||0}return l}var zy={light:"#333333",dark:"#bbbbbb"},jy={light:"#fffffe",dark:"#1e1e1e"},qy="__shiki_resolved";function Ds(t){if(t?.[qy])return t;let n={...t};if(n.tokenColors&&!n.settings)n.settings=n.tokenColors,delete n.tokenColors;n.type||="dark",n.colorReplacements={...n.colorReplacements},n.settings||=[];let{bg:s,fg:a}=n;if(!s||!a){let h=n.settings?n.settings.find((g)=>!g.name&&!g.scope):void 0;if(h?.settings?.foreground)a=h.settings.foreground;if(h?.settings?.background)s=h.settings.background;if(!a&&n?.colors?.["editor.foreground"])a=n.colors["editor.foreground"];if(!s&&n?.colors?.["editor.background"])s=n.colors["editor.background"];if(!a)a=n.type==="light"?zy.light:zy.dark;if(!s)s=n.type==="light"?jy.light:jy.dark;n.fg=a,n.bg=s}if(!(n.settings[0]&&n.settings[0].settings&&!n.settings[0].scope))n.settings.unshift({settings:{foreground:n.fg,background:n.bg}});let l=0,d=new Map;function f(h){if(d.has(h))return d.get(h);l+=1;let g=`#${l.toString(16).padStart(8,"0").toLowerCase()}`;if(n.colorReplacements?.[`#${g}`])return f(h);return d.set(h,g),g}n.settings=n.settings.map((h)=>{let g=h.settings?.foreground&&!h.settings.foreground.startsWith("#"),I=h.settings?.background&&!h.settings.background.startsWith("#");if(!g&&!I)return h;let b={...h,settings:{...h.settings}};if(g){let v=f(h.settings.foreground);n.colorReplacements[v]=h.settings.foreground,b.settings.foreground=v}if(I){let v=f(h.settings.background);n.colorReplacements[v]=h.settings.background,b.settings.background=v}return b});for(let h of Object.keys(n.colors||{}))if(h==="editor.foreground"||h==="editor.background"||h.startsWith("terminal.ansi")){if(!n.colors[h]?.startsWith("#")){let g=f(n.colors[h]);n.colorReplacements[g]=n.colors[h],n.colors[h]=g}}return Object.defineProperty(n,qy,{enumerable:!1,writable:!1,value:!0}),n}async function Wy(t){return[...new Set((await Promise.all(t.filter((n)=>!kf(n)).map(async(n)=>await vf(n).then((s)=>Array.isArray(s)?s:[s])))).flat())]}async function Xy(t){return(await Promise.all(t.map(async(n)=>Tf(n)?null:Ds(await vf(n))))).filter((n)=>!!n)}function Yy(t,n){if(!n)return t;if(n[t]){let s=new Set([t]);while(n[t]){if(t=n[t],s.has(t))throw new Lt(`Circular alias \`${[...s].join(" -> ")} -> ${t}\``);s.add(t)}}return t}var yA=class extends Gy{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(t,n,s,a={}){super(t);this._resolver=t,this._themes=n,this._langs=s,this._alias=a,this._themes.map((l)=>this.loadTheme(l)),this.loadLanguages(this._langs)}getTheme(t){if(typeof t==="string")return this._resolvedThemes.get(t);else return this.loadTheme(t)}loadTheme(t){let n=Ds(t);if(n.name)this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null;return n}getLoadedThemes(){if(!this._loadedThemesCache)this._loadedThemesCache=[...this._resolvedThemes.keys()];return this._loadedThemesCache}setTheme(t){let n=this._textmateThemeCache.get(t);if(!n)n=Wa.createFromRawTheme(t),this._textmateThemeCache.set(t,n);this._syncRegistry.setTheme(n)}getGrammar(t){return t=Yy(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;let n=new Set([...this._langMap.values()].filter((l)=>l.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);let s={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);let a=this.loadGrammarWithConfiguration(t.scopeName,1,s);if(a.name=t.name,this._resolvedGrammars.set(t.name,a),t.aliases)t.aliases.forEach((l)=>{this._alias[l]=t.name});if(this._loadedLanguagesCache=null,n.size)for(let l of n)this._resolvedGrammars.delete(l.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(l.scopeName),this._syncRegistry?._grammars?.delete(l.scopeName),this.loadLanguage(this._langMap.get(l.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(let a of t)this.resolveEmbeddedLanguages(a);let n=[...this._langGraph.entries()],s=n.filter(([a,l])=>!l);if(s.length){let a=n.filter(([l,d])=>{if(!d)return!1;return(d.embeddedLanguages||d.embeddedLangs)?.some((f)=>s.map(([h])=>h).includes(f))}).filter((l)=>!s.includes(l));throw new Lt(`Missing languages ${s.map(([l])=>`\`${l}\``).join(", ")}, required by ${a.map(([l])=>`\`${l}\``).join(", ")}`)}for(let[a,l]of n)this._resolver.addLanguage(l);for(let[a,l]of n)this.loadLanguage(l)}getLoadedLanguages(){if(!this._loadedLanguagesCache)this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])];return this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);let n=t.embeddedLanguages??t.embeddedLangs;if(n)for(let s of n)this._langGraph.set(s,this._langMap.get(s))}},xA=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,n){this._onigLib={createOnigScanner:(s)=>t.createScanner(s),createOnigString:(s)=>t.createString(s)},n.forEach((s)=>this.addLanguage(s))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){if(this._langs.set(t.name,t),t.aliases)t.aliases.forEach((n)=>{this._langs.set(n,t)});if(this._scopeToLang.set(t.scopeName,t),t.injectTo)t.injectTo.forEach((n)=>{if(!this._injections.get(n))this._injections.set(n,[]);this._injections.get(n).push(t.scopeName)})}getInjections(t){let n=t.split("."),s=[];for(let a=1;a<=n.length;a++){let l=n.slice(0,a).join(".");s=[...s,...this._injections.get(l)||[]]}return s}},Za=0;function wf(t){if(Za+=1,t.warnings!==!1&&Za>=10&&Za%10===0)console.warn(`[Shiki] ${Za} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let n=!1;if(!t.engine)throw new Lt("`engine` option is required for synchronous mode");let s=(t.langs||[]).flat(1),a=(t.themes||[]).flat(1).map(Ds),l=new yA(new xA(t.engine,s),a,s,t.langAlias),d;function f(O){return Yy(O,t.langAlias)}function h(O){N();let B=l.getGrammar(typeof O==="string"?O:O.name);if(!B)throw new Lt(`Language \`${O}\` not found, you may need to load it first`);return B}function g(O){if(O==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};N();let B=l.getTheme(O);if(!B)throw new Lt(`Theme \`${O}\` not found, you may need to load it first`);return B}function I(O){N();let B=g(O);if(d!==O)l.setTheme(B),d=O;return{theme:B,colorMap:l.getColorMap()}}function b(){return N(),l.getLoadedThemes()}function v(){return N(),l.getLoadedLanguages()}function k(...O){N(),l.loadLanguages(O.flat(1))}async function w(...O){return k(await Wy(O))}function P(...O){N();for(let B of O.flat(1))l.loadTheme(B)}async function M(...O){return N(),P(await Xy(O))}function N(){if(n)throw new Lt("Shiki instance has been disposed")}function _(){if(n)return;n=!0,l.dispose(),Za-=1}return{setTheme:I,getTheme:g,getLanguage:h,getLoadedThemes:b,getLoadedLanguages:v,resolveLangAlias:f,loadLanguage:w,loadLanguageSync:k,loadTheme:M,loadThemeSync:P,dispose:_,[Symbol.dispose]:_}}async function Rf(t){if(!t.engine)console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[n,s,a]=await Promise.all([Xy(t.themes||[]),Wy(t.langs||[]),t.engine]);return wf({...t,themes:n,langs:s,engine:a})}var Jy=new WeakMap;function rl(t,n){Jy.set(t,n)}function Hs(t){return Jy.get(t)}var Zu=class t{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(n,s){return new t(Object.fromEntries(Vy(s).map((a)=>[a,R])),n)}constructor(...n){if(n.length===2){let[s,a]=n;this.lang=a,this._stacks=s}else{let[s,a,l]=n;this.lang=a,this._stacks={[l]:s}}}getInternalStack(n=this.theme){return this._stacks[n]}getScopes(n=this.theme){return IA(this._stacks[n])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function IA(t){let n=[],s=new Set;function a(l){if(s.has(l))return;s.add(l);let d=l?.nameScopesList?.scopeName;if(d)n.push(d);if(l.parent)a(l.parent)}return a(t),n}function SA(t,n){if(!(t instanceof Zu))throw new Lt("Invalid grammar state");return t.getInternalStack(n)}var bA=/,/,CA=/ /;function Lf(t,n,s={}){let{theme:a=t.getLoadedThemes()[0]}=s;if(tl(t.resolveLangAlias(s.lang||"text"))||nl(a))return Ns(n).map((h)=>[{content:h[0],offset:h[1]}]);let{theme:l,colorMap:d}=t.setTheme(a),f=t.getLanguage(s.lang||"text");if(s.grammarState){if(s.grammarState.lang!==f.name)throw new Lt(`Grammar state language "${s.grammarState.lang}" does not match highlight language "${f.name}"`);if(!s.grammarState.themes.includes(l.name))throw new Lt(`Grammar state themes "${s.grammarState.themes}" do not contain highlight theme "${l.name}"`)}return Zy(n,f,l,d,s)}function Qy(...t){if(t.length===2)return Hs(t[1]);let[n,s,a={}]=t,{lang:l="text",theme:d=n.getLoadedThemes()[0]}=a;if(tl(l)||nl(d))throw new Lt("Plain language does not have grammar state");if(l==="ansi")throw new Lt("ANSI language does not have grammar state");let{theme:f,colorMap:h}=n.setTheme(d),g=n.getLanguage(l);return new Zu(Af(s,g,f,h,a).stateStack,g.name,f.name)}function Zy(t,n,s,a,l){let d=Af(t,n,s,a,l),f=new Zu(d.stateStack,n.name,s.name);return rl(d.tokens,f),d.tokens}function Af(t,n,s,a,l){let d=el(s,l),{tokenizeMaxLineLength:f=0,tokenizeTimeLimit:h=500,includeExplanation:g=!1}=l,I=Ns(t),b=l.grammarState?SA(l.grammarState,s.name)??R:l.grammarContextCode!=null?Af(l.grammarContextCode,n,s,a,{...l,grammarState:void 0,grammarContextCode:void 0}).stateStack:R,v=[],k=[];for(let w=0,P=I.length;w<P;w++){let[M,N]=I[w];if(M===""){v=[],k.push([]);continue}if(f>0&&M.length>=f){v=[],k.push([{content:M,offset:N,color:"",fontStyle:0}]);continue}let _,O,B;if(g&&g!=="tokenType")_=n.tokenizeLine(M,b,h),O=_.tokens,B=0;let X=n.tokenizeLine2(M,b,h),z=X.tokens.length/2;for(let K=0;K<z;K++){let W=X.tokens[2*K],J=K+1<z?X.tokens[2*K+2]:M.length;if(W===J)continue;let ee=X.tokens[2*K+1],ce=Gi(a[G.getForeground(ee)],d),Ae=G.getFontStyle(ee),ue={content:M.substring(W,J),offset:N+W,color:ce,fontStyle:Ae};if(g==="tokenType")ue.type=G.getTokenType(ee);else if(g){let Se=[];if(g!=="scopeName")for(let It of s.settings){let Ce;switch(typeof It.scope){case"string":Ce=It.scope.split(bA).map((qe)=>qe.trim());break;case"object":Ce=It.scope;break;default:continue}Se.push({settings:It,selectors:Ce.map((qe)=>qe.split(CA))})}ue.explanation=[];let ut=0;while(W+ut<J){let It=O[B],Ce=M.substring(It.startIndex,It.endIndex);ut+=Ce.length,ue.explanation.push({content:Ce,scopes:g==="scopeName"?EA(It.scopes):vA(Se,It.scopes)}),B+=1}}v.push(ue)}k.push(v),v=[],b=X.ruleStack}return{tokens:k,stateStack:b}}function EA(t){return t.map((n)=>({scopeName:n}))}function vA(t,n){let s=[];for(let a=0,l=n.length;a<l;a++){let d=n[a];s[a]={scopeName:d,themeMatches:TA(t,d,n.slice(0,a))}}return s}function Ky(t,n){return t===n||n.substring(0,t.length)===t&&n[t.length]==="."}function kA(t,n,s){if(!Ky(t.at(-1),n))return!1;let a=t.length-2,l=s.length-1;while(a>=0&&l>=0){if(Ky(t[a],s[l]))a-=1;l-=1}if(a===-1)return!0;return!1}function TA(t,n,s){let a=[];for(let{selectors:l,settings:d}of t)for(let f of l)if(kA(f,n,s)){a.push(d);break}return a}function ec(t,n,s,a=Lf){let l=Object.entries(s.themes).filter((I)=>I[1]).map((I)=>({color:I[0],theme:I[1]})),d=l.map((I,b)=>{let v=a(t,n,{...s,includeExplanation:b===0||s.includeExplanation==="tokenType"?s.includeExplanation:!1,theme:I.theme});return{tokens:v,state:Hs(v),theme:typeof I.theme==="string"?I.theme:I.theme.name}}),f=wA(...d.map((I)=>I.tokens)),h=f[0].map((I,b)=>I.map((v,k)=>{let w={content:v.content,variants:{},offset:v.offset};if("includeExplanation"in s&&s.includeExplanation)w.explanation=v.explanation;return f.forEach((P,M)=>{let{content:N,explanation:_,offset:O,...B}=P[b][k];w.variants[l[M].color]=B}),w})),g=d[0].state?new Zu(Object.fromEntries(d.map((I)=>[I.theme,I.state?.getInternalStack(I.theme)])),d[0].state.lang):void 0;if(g)rl(h,g);return h}function wA(...t){let n=t.map(()=>[]),s=t.length;for(let a=0;a<t[0].length;a++){let l=t.map((g)=>g[a]),d=n.map(()=>[]);n.forEach((g,I)=>g.push(d[I]));let f=l.map(()=>0),h=l.map((g)=>g[0]);while(h.every((g)=>g)){let g=Math.min(...h.map((I)=>I.content.length));for(let I=0;I<s;I++){let b=h[I];if(b.content.length===g)d[I].push(b),f[I]+=1,h[I]=l[I][f[I]];else d[I].push({...b,content:b.content.slice(0,g)}),h[I]={...b,content:b.content.slice(g),offset:b.offset+g}}}}return n}var ex=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class yo{constructor(t,n,s){if(this.normal=n,this.property=t,s)this.space=s}}yo.prototype.normal={};yo.prototype.property={};yo.prototype.space=void 0;function Pf(t,n){let s={},a={};for(let l of t)Object.assign(s,l.property),Object.assign(a,l.normal);return new yo(s,a,n)}function Us(t){return t.toLowerCase()}class Kn{constructor(t,n){this.attribute=n,this.property=t}}Kn.prototype.attribute="";Kn.prototype.booleanish=!1;Kn.prototype.boolean=!1;Kn.prototype.commaOrSpaceSeparated=!1;Kn.prototype.commaSeparated=!1;Kn.prototype.defined=!1;Kn.prototype.mustUseProperty=!1;Kn.prototype.number=!1;Kn.prototype.overloadedBoolean=!1;Kn.prototype.property="";Kn.prototype.spaceSeparated=!1;Kn.prototype.space=void 0;var il={};De(il,{boolean:()=>_e,booleanish:()=>fn,commaOrSpaceSeparated:()=>gr,commaSeparated:()=>zi,number:()=>Q,overloadedBoolean:()=>tc,spaceSeparated:()=>Rt});var RA=0,_e=Qo(),fn=Qo(),tc=Qo(),Q=Qo(),Rt=Qo(),zi=Qo(),gr=Qo();function Qo(){return 2**++RA}var Mf=Object.keys(il);class Bs extends Kn{constructor(t,n,s,a){let l=-1;super(t,n);if(tx(this,"space",a),typeof s==="number")while(++l<Mf.length){let d=Mf[l];tx(this,Mf[l],(s&il[d])===il[d])}}}Bs.prototype.defined=!0;function tx(t,n,s){if(s)t[n]=s}function Xr(t){let n={},s={};for(let[a,l]of Object.entries(t.properties)){let d=new Bs(a,t.transform(t.attributes||{},a),l,t.space);if(t.mustUseProperty&&t.mustUseProperty.includes(a))d.mustUseProperty=!0;n[a]=d,s[Us(a)]=a,s[Us(d.attribute)]=a}return new yo(n,s,t.space)}var _f=Xr({properties:{ariaActiveDescendant:null,ariaAtomic:fn,ariaAutoComplete:null,ariaBusy:fn,ariaChecked:fn,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:fn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:fn,ariaFlowTo:Rt,ariaGrabbed:fn,ariaHasPopup:null,ariaHidden:fn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:Q,ariaLive:null,ariaModal:fn,ariaMultiLine:fn,ariaMultiSelectable:fn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:fn,ariaReadOnly:fn,ariaRelevant:null,ariaRequired:fn,ariaRoleDescription:Rt,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:fn,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(t,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function nc(t,n){return n in t?t[n]:n}function rc(t,n){return nc(t,n.toLowerCase())}var nx=Xr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:zi,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:_e,allowPaymentRequest:_e,allowUserMedia:_e,alpha:_e,alt:null,as:null,async:_e,autoCapitalize:null,autoComplete:Rt,autoFocus:_e,autoPlay:_e,blocking:Rt,capture:null,charSet:null,checked:_e,cite:null,className:Rt,closedBy:null,colorSpace:null,cols:Q,colSpan:Q,command:null,commandFor:null,content:null,contentEditable:fn,controls:_e,controlsList:Rt,coords:Q|zi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_e,defer:_e,dir:null,dirName:null,disabled:_e,download:tc,draggable:fn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_e,formTarget:null,headers:Rt,height:Q,hidden:tc,high:Q,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:_e,inputMode:null,integrity:null,is:null,isMap:_e,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:_e,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_e,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:_e,muted:_e,name:null,nonce:null,noModule:_e,noValidate:_e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_e,optimum:Q,pattern:null,ping:Rt,placeholder:null,playsInline:_e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_e,referrerPolicy:null,rel:Rt,required:_e,reversed:_e,rows:Q,rowSpan:Q,sandbox:Rt,scope:null,scoped:_e,seamless:_e,selected:_e,shadowRootClonable:_e,shadowRootCustomElementRegistry:_e,shadowRootDelegatesFocus:_e,shadowRootMode:null,shadowRootSerializable:_e,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:fn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:_e,useMap:null,value:fn,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_e,declare:_e,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:_e,noHref:_e,noShade:_e,noWrap:_e,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:fn,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:_e,disablePictureInPicture:_e,disableRemotePlayback:_e,exportParts:zi,part:Rt,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:rc});var rx=Xr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gr,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:Rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:_e,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:zi,g2:zi,glyphName:zi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gr,rev:gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gr,requiredFeatures:gr,requiredFonts:gr,requiredFormats:gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gr,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:nc});var Of=Xr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,n){return"xlink:"+n.slice(5).toLowerCase()}});var $f=Xr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:rc});var Ff=Xr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,n){return"xml:"+n.slice(3).toLowerCase()}});var LA=/[A-Z]/g,ix=/-[a-z]/g,AA=/^data[-\w.:]+$/i;function Nf(t,n){let s=Us(n),a=n,l=Kn;if(s in t.normal)return t.property[t.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&AA.test(n)){if(n.charAt(4)==="-"){let d=n.slice(5).replace(ix,MA);a="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{let d=n.slice(4);if(!ix.test(d)){let f=d.replace(LA,PA);if(f.charAt(0)!=="-")f="-"+f;n="data"+f}}l=Bs}return new l(a,n)}function PA(t){return"-"+t.toLowerCase()}function MA(t){return t.charAt(1).toUpperCase()}var ox=Pf([_f,nx,Of,$f,Ff],"html"),ic=Pf([_f,rx,Of,$f,Ff],"svg");var sx={}.hasOwnProperty;function ax(t,n){let s=n||{};function a(l,...d){let{invalid:f,handlers:h}=a;if(l&&sx.call(l,t)){let g=String(l[t]);f=sx.call(h,g)?h[g]:a.unknown}if(f)return f.call(this,l,...d)}return a.handlers=s.handlers||{},a.invalid=s.invalid,a.unknown=s.unknown,a}var _A=/["&'<>`]/g,OA=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,$A=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,FA=/[|\\{}()[\]^$+*?.]/g,lx=new WeakMap;function ux(t,n){if(t=t.replace(n.subset?NA(n.subset):_A,a),n.subset||n.escapeOnly)return t;return t.replace(OA,s).replace($A,a);function s(l,d,f){return n.format((l.charCodeAt(0)-55296)*1024+l.charCodeAt(1)-56320+65536,f.charCodeAt(d+2),n)}function a(l,d,f){return n.format(l.charCodeAt(0),f.charCodeAt(d+1),n)}}function NA(t){let n=lx.get(t);if(!n)n=DA(t),lx.set(t,n);return n}function DA(t){let n=[],s=-1;while(++s<t.length)n.push(t[s].replace(FA,"\\$&"));return new RegExp("(?:"+n.join("|")+")","g")}var HA=/[\dA-Fa-f]/;function cx(t,n,s){let a="&#x"+t.toString(16).toUpperCase();return s&&n&&!HA.test(String.fromCharCode(n))?a:a+";"}var UA=/\d/;function dx(t,n,s){let a="&#"+String(t);return s&&n&&!UA.test(String.fromCharCode(n))?a:a+";"}var mx=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var oc={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"};var fx=["cent","copy","divide","gt","lt","not","para","times"];var px={}.hasOwnProperty,Df={},sc;for(sc in oc)if(px.call(oc,sc))Df[oc[sc]]=sc;var BA=/[^\dA-Za-z]/;function hx(t,n,s,a){let l=String.fromCharCode(t);if(px.call(Df,l)){let d=Df[l],f="&"+d;if(s&&mx.includes(d)&&!fx.includes(d)&&(!a||n&&n!==61&&BA.test(String.fromCharCode(n))))return f;return f+";"}return""}function gx(t,n,s){let a=cx(t,n,s.omitOptionalSemicolons),l;if(s.useNamedReferences||s.useShortestReferences)l=hx(t,n,s.omitOptionalSemicolons,s.attribute);if((s.useShortestReferences||!l)&&s.useShortestReferences){let d=dx(t,n,s.omitOptionalSemicolons);if(d.length<a.length)a=d}return l&&(!s.useShortestReferences||l.length<a.length)?l:a}function ji(t,n){return ux(t,Object.assign({format:gx},n))}var GA=/^>|^->|<!--|-->|--!>|<!-$/g,zA=[">"],jA=["<",">"];function yx(t,n,s,a){return a.settings.bogusComments?"<?"+ji(t.value,Object.assign({},a.settings.characterReferences,{subset:zA}))+">":"<!--"+t.value.replace(GA,l)+"-->";function l(d){return ji(d,Object.assign({},a.settings.characterReferences,{subset:jA}))}}function xx(t,n,s,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}function Hf(t,n){let s=String(t);if(typeof n!=="string")throw TypeError("Expected character");let a=0,l=s.indexOf(n);while(l!==-1)a++,l=s.indexOf(n,l+n.length);return a}function Ix(t,n){let s=n||{};return(t[t.length-1]===""?[...t,""]:t).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}function Sx(t){return t.join(" ").trim()}var qA=/[ \t\n\f\r]/g;function Zo(t){return typeof t==="object"?t.type==="text"?bx(t.value):!1:bx(t)}function bx(t){return t.replace(qA,"")===""}var bn=Cx(1),Uf=Cx(-1),KA=[];function Cx(t){return n;function n(s,a,l){let d=s?s.children:KA,f=(a||0)+t,h=d[f];if(!l)while(h&&Zo(h))f+=t,h=d[f];return h}}var VA={}.hasOwnProperty;function ac(t){return n;function n(s,a,l){return VA.call(t,s.tagName)&&t[s.tagName](s,a,l)}}var ol=ac({body:XA,caption:Bf,colgroup:Bf,dd:ZA,dt:QA,head:Bf,html:WA,li:JA,optgroup:eP,option:tP,p:YA,rp:Ex,rt:Ex,tbody:rP,td:vx,tfoot:iP,th:vx,thead:nP,tr:oP});function Bf(t,n,s){let a=bn(s,n,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&Zo(a.value.charAt(0)))}function WA(t,n,s){let a=bn(s,n);return!a||a.type!=="comment"}function XA(t,n,s){let a=bn(s,n);return!a||a.type!=="comment"}function YA(t,n,s){let a=bn(s,n);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!s||!(s.type==="element"&&(s.tagName==="a"||s.tagName==="audio"||s.tagName==="del"||s.tagName==="ins"||s.tagName==="map"||s.tagName==="noscript"||s.tagName==="video"))}function JA(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&a.tagName==="li"}function QA(t,n,s){let a=bn(s,n);return Boolean(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function ZA(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function Ex(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function eP(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&a.tagName==="optgroup"}function tP(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function nP(t,n,s){let a=bn(s,n);return Boolean(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function rP(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function iP(t,n,s){return!bn(s,n)}function oP(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&a.tagName==="tr"}function vx(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}var kx=ac({body:lP,colgroup:uP,head:aP,html:sP,tbody:cP});function sP(t){let n=bn(t,-1);return!n||n.type!=="comment"}function aP(t){let n=new Set;for(let a of t.children)if(a.type==="element"&&(a.tagName==="base"||a.tagName==="title")){if(n.has(a.tagName))return!1;n.add(a.tagName)}let s=t.children[0];return!s||s.type==="element"}function lP(t){let n=bn(t,-1,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&Zo(n.value.charAt(0)))&&!(n.type==="element"&&(n.tagName==="meta"||n.tagName==="link"||n.tagName==="script"||n.tagName==="style"||n.tagName==="template"))}function uP(t,n,s){let a=Uf(s,n),l=bn(t,-1,!0);if(s&&a&&a.type==="element"&&a.tagName==="colgroup"&&ol(a,s.children.indexOf(a),s))return!1;return Boolean(l&&l.type==="element"&&l.tagName==="col")}function cP(t,n,s){let a=Uf(s,n),l=bn(t,-1);if(s&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&ol(a,s.children.indexOf(a),s))return!1;return Boolean(l&&l.type==="element"&&l.tagName==="tr")}var lc={name:[[`
|
|
3
|
+
`;let d=this.createOnigString(t),f=d.content.length,h=new pA(s,t,this._tokenTypeMatchers,this.balancedBracketSelectors),g=Hy(this,d,l,0,n,h,!0,a);return My(d),{lineLength:f,lineTokens:h,ruleStack:g.stack,stoppedEarly:g.stoppedEarly}}};function vy(t,n){return t=R1(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=n||t.repository.$self,t}var Va=class t{constructor(n,s,a){this.parent=n,this.scopePath=s,this.tokenAttributes=a}static fromExtension(n,s){let a=n,l=n?.scopePath??null;for(let d of s)l=yf.push(l,d.scopeNames),a=new t(a,l,d.encodedTokenAttributes);return a}static createRoot(n,s){return new t(null,new yf(null,n),s)}static createRootAndLookUpScopeName(n,s,a){let l=a.getMetadataForScope(n),d=new yf(null,n),f=a.themeProvider.themeMatch(d),h=t.mergeAttributes(s,l,f);return new t(null,d,h)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(n){return t.equals(this,n)}static equals(n,s){do{if(n===s)return!0;if(!n&&!s)return!0;if(!n||!s)return!1;if(n.scopeName!==s.scopeName||n.tokenAttributes!==s.tokenAttributes)return!1;n=n.parent,s=s.parent}while(!0)}static mergeAttributes(n,s,a){let l=-1,d=0,f=0;if(a!==null)l=a.fontStyle,d=a.foregroundId,f=a.backgroundId;return G.set(n,s.languageId,s.tokenType,null,l,d,f)}pushAttributed(n,s){if(n===null)return this;if(n.indexOf(" ")===-1)return t._pushAttributed(this,n,s);let a=n.split(/ /g),l=this;for(let d of a)l=t._pushAttributed(l,d,s);return l}static _pushAttributed(n,s,a){let l=a.getMetadataForScope(s),d=n.scopePath.push(s),f=a.themeProvider.themeMatch(d),h=t.mergeAttributes(n.tokenAttributes,l,f);return new t(n,d,h)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(n){let s=[],a=this;while(a&&a!==n)s.push({encodedTokenAttributes:a.tokenAttributes,scopeNames:a.scopePath.getExtensionIfDefined(a.parent?.scopePath??null)}),a=a.parent;return a===n?s.reverse():void 0}},Cf=class t{constructor(n,s,a,l,d,f,h,g){this.parent=n,this.ruleId=s,this.beginRuleCapturedEOL=d,this.endRule=f,this.nameScopesList=h,this.contentNameScopesList=g,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=a,this._anchorPos=l}_stackElementBrand=void 0;static NULL=new t(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(n){if(n===null)return!1;return t._equals(this,n)}static _equals(n,s){if(n===s)return!0;if(!this._structuralEquals(n,s))return!1;return Va.equals(n.contentNameScopesList,s.contentNameScopesList)}static _structuralEquals(n,s){do{if(n===s)return!0;if(!n&&!s)return!0;if(!n||!s)return!1;if(n.depth!==s.depth||n.ruleId!==s.ruleId||n.endRule!==s.endRule)return!1;n=n.parent,s=s.parent}while(!0)}clone(){return this}static _reset(n){while(n)n._enterPos=-1,n._anchorPos=-1,n=n.parent}reset(){t._reset(this)}pop(){return this.parent}safePop(){if(this.parent)return this.parent;return this}push(n,s,a,l,d,f,h){return new t(this,n,s,a,l,d,f,h)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(n){return n.getRule(this.ruleId)}toString(){let n=[];return this._writeString(n,0),"["+n.join(",")+"]"}_writeString(n,s){if(this.parent)s=this.parent._writeString(n,s);return n[s++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,s}withContentNameScopesList(n){if(this.contentNameScopesList===n)return this;return this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,n)}withEndRule(n){if(this.endRule===n)return this;return new t(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,n,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(n){let s=this;while(s&&s._enterPos===n._enterPos){if(s.ruleId===n.ruleId)return!0;s=s.parent}return!1}toStateStackFrame(){return{ruleId:Fy(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(n,s){let a=Va.fromExtension(n?.nameScopesList??null,s.nameScopesList);return new t(n,$y(s.ruleId),s.enterPos??-1,s.anchorPos??-1,s.beginRuleCapturedEOL,s.endRule,a,Va.fromExtension(a,s.contentNameScopesList))}},fA=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,n){this.balancedBracketScopes=t.flatMap((s)=>{if(s==="*")return this.allowAny=!0,[];return Xu(s,Qu).map((a)=>a.matcher)}),this.unbalancedBracketScopes=n.flatMap((s)=>Xu(s,Qu).map((a)=>a.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(let n of this.unbalancedBracketScopes)if(n(t))return!1;for(let n of this.balancedBracketScopes)if(n(t))return!0;return this.allowAny}},pA=class{constructor(t,n,s,a){this.balancedBracketSelectors=a,this._emitBinaryTokens=t,this._tokenTypeOverrides=s,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,n){this.produceFromScopes(t.contentNameScopesList,n)}produceFromScopes(t,n){if(this._lastTokenEndIndex>=n)return;if(this._emitBinaryTokens){let a=t?.tokenAttributes??0,l=!1;if(this.balancedBracketSelectors?.matchesAlways)l=!0;if(this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let d=t?.getScopeNames()??[];for(let f of this._tokenTypeOverrides)if(f.matcher(d))a=G.set(a,0,H1(f.type),null,-1,0,0);if(this.balancedBracketSelectors)l=this.balancedBracketSelectors.match(d)}if(l)a=G.set(a,0,8,l,-1,0,0);if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=n;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=n;return}let s=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:n,scopes:s}),this._lastTokenEndIndex=n}getResult(t,n){if(this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===n-1)this._tokens.pop();if(this._tokens.length===0)this._lastTokenEndIndex=-1,this.produce(t,n),this._tokens[this._tokens.length-1].startIndex=0;return this._tokens}getBinaryResult(t,n){if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===n-1)this._binaryTokens.pop(),this._binaryTokens.pop();if(this._binaryTokens.length===0)this._lastTokenEndIndex=-1,this.produce(t,n),this._binaryTokens[this._binaryTokens.length-2]=0;let s=new Uint32Array(this._binaryTokens.length);for(let a=0,l=this._binaryTokens.length;a<l;a++)s[a]=this._binaryTokens[a];return s}},hA=class{constructor(t,n){this._onigLib=n,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,n){if(this._rawGrammars.set(t.scopeName,t),n)this._injectionGrammars.set(t.scopeName,n)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,n,s,a,l){if(!this._grammars.has(t)){let d=this._rawGrammars.get(t);if(!d)return null;this._grammars.set(t,cA(t,d,n,s,a,l,this,this._onigLib))}return this._grammars.get(t)}},Gy=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new hA(Wa.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Wa.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,s){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(t,n,s){return this._loadGrammar(t,n,s.embeddedLanguages,s.tokenTypes,new fA(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,a,l){let d=new q1(this._syncRegistry,t);while(d.Q.length>0)d.Q.map((f)=>this._loadSingleGrammar(f.scopeName)),d.processQueue();return this._grammarForScopeName(t,n,s,a,l)}_loadSingleGrammar(t){if(!this._ensureGrammarCache.has(t))this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0)}_doLoadSingleGrammar(t){let n=this._options.loadGrammar(t);if(n){let s=typeof this._options.getInjections==="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(t,n=[],s=0,a=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,a)}_grammarForScopeName(t,n=0,s=null,a=null,l=null){return this._syncRegistry.grammarForScopeName(t,n,s,a,l)}},R=Cf.NULL;function el(t,n){let s=typeof t==="string"?{}:{...t.colorReplacements},a=typeof t==="string"?t:t.name;for(let[l,d]of Object.entries(n?.colorReplacements||{}))if(typeof d==="string")s[l]=d;else if(l===a)Object.assign(s,d);return s}function Gi(t,n){if(!t)return t;return n?.[t?.toLowerCase()]||t}function Vy(t){return Array.isArray(t)?t:[t]}async function vf(t){return Promise.resolve(typeof t==="function"?t():t).then((n)=>n.default||n)}function tl(t){return!t||["plaintext","txt","text","plain"].includes(t)}function kf(t){return t==="ansi"||tl(t)}function nl(t){return t==="none"}function Tf(t){return nl(t)}var gA=/(\r?\n)/g;function Ns(t,n=!1){if(t.length===0)return[["",0]];let s=t.split(gA),a=0,l=[];for(let d=0;d<s.length;d+=2){let f=n?s[d]+(s[d+1]||""):s[d];l.push([f,a]),a+=s[d].length,a+=s[d+1]?.length||0}return l}var zy={light:"#333333",dark:"#bbbbbb"},jy={light:"#fffffe",dark:"#1e1e1e"},qy="__shiki_resolved";function Ds(t){if(t?.[qy])return t;let n={...t};if(n.tokenColors&&!n.settings)n.settings=n.tokenColors,delete n.tokenColors;n.type||="dark",n.colorReplacements={...n.colorReplacements},n.settings||=[];let{bg:s,fg:a}=n;if(!s||!a){let h=n.settings?n.settings.find((g)=>!g.name&&!g.scope):void 0;if(h?.settings?.foreground)a=h.settings.foreground;if(h?.settings?.background)s=h.settings.background;if(!a&&n?.colors?.["editor.foreground"])a=n.colors["editor.foreground"];if(!s&&n?.colors?.["editor.background"])s=n.colors["editor.background"];if(!a)a=n.type==="light"?zy.light:zy.dark;if(!s)s=n.type==="light"?jy.light:jy.dark;n.fg=a,n.bg=s}if(!(n.settings[0]&&n.settings[0].settings&&!n.settings[0].scope))n.settings.unshift({settings:{foreground:n.fg,background:n.bg}});let l=0,d=new Map;function f(h){if(d.has(h))return d.get(h);l+=1;let g=`#${l.toString(16).padStart(8,"0").toLowerCase()}`;if(n.colorReplacements?.[`#${g}`])return f(h);return d.set(h,g),g}n.settings=n.settings.map((h)=>{let g=h.settings?.foreground&&!h.settings.foreground.startsWith("#"),I=h.settings?.background&&!h.settings.background.startsWith("#");if(!g&&!I)return h;let b={...h,settings:{...h.settings}};if(g){let v=f(h.settings.foreground);n.colorReplacements[v]=h.settings.foreground,b.settings.foreground=v}if(I){let v=f(h.settings.background);n.colorReplacements[v]=h.settings.background,b.settings.background=v}return b});for(let h of Object.keys(n.colors||{}))if(h==="editor.foreground"||h==="editor.background"||h.startsWith("terminal.ansi")){if(!n.colors[h]?.startsWith("#")){let g=f(n.colors[h]);n.colorReplacements[g]=n.colors[h],n.colors[h]=g}}return Object.defineProperty(n,qy,{enumerable:!1,writable:!1,value:!0}),n}async function Wy(t){return[...new Set((await Promise.all(t.filter((n)=>!kf(n)).map(async(n)=>await vf(n).then((s)=>Array.isArray(s)?s:[s])))).flat())]}async function Xy(t){return(await Promise.all(t.map(async(n)=>Tf(n)?null:Ds(await vf(n))))).filter((n)=>!!n)}function Yy(t,n){if(!n)return t;if(n[t]){let s=new Set([t]);while(n[t]){if(t=n[t],s.has(t))throw new Lt(`Circular alias \`${[...s].join(" -> ")} -> ${t}\``);s.add(t)}}return t}var yA=class extends Gy{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(t,n,s,a={}){super(t);this._resolver=t,this._themes=n,this._langs=s,this._alias=a,this._themes.map((l)=>this.loadTheme(l)),this.loadLanguages(this._langs)}getTheme(t){if(typeof t==="string")return this._resolvedThemes.get(t);else return this.loadTheme(t)}loadTheme(t){let n=Ds(t);if(n.name)this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null;return n}getLoadedThemes(){if(!this._loadedThemesCache)this._loadedThemesCache=[...this._resolvedThemes.keys()];return this._loadedThemesCache}setTheme(t){let n=this._textmateThemeCache.get(t);if(!n)n=Wa.createFromRawTheme(t),this._textmateThemeCache.set(t,n);this._syncRegistry.setTheme(n)}getGrammar(t){return t=Yy(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;let n=new Set([...this._langMap.values()].filter((l)=>l.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);let s={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);let a=this.loadGrammarWithConfiguration(t.scopeName,1,s);if(a.name=t.name,this._resolvedGrammars.set(t.name,a),t.aliases)t.aliases.forEach((l)=>{this._alias[l]=t.name});if(this._loadedLanguagesCache=null,n.size)for(let l of n)this._resolvedGrammars.delete(l.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(l.scopeName),this._syncRegistry?._grammars?.delete(l.scopeName),this.loadLanguage(this._langMap.get(l.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(let a of t)this.resolveEmbeddedLanguages(a);let n=[...this._langGraph.entries()],s=n.filter(([a,l])=>!l);if(s.length){let a=n.filter(([l,d])=>{if(!d)return!1;return(d.embeddedLanguages||d.embeddedLangs)?.some((f)=>s.map(([h])=>h).includes(f))}).filter((l)=>!s.includes(l));throw new Lt(`Missing languages ${s.map(([l])=>`\`${l}\``).join(", ")}, required by ${a.map(([l])=>`\`${l}\``).join(", ")}`)}for(let[a,l]of n)this._resolver.addLanguage(l);for(let[a,l]of n)this.loadLanguage(l)}getLoadedLanguages(){if(!this._loadedLanguagesCache)this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])];return this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);let n=t.embeddedLanguages??t.embeddedLangs;if(n)for(let s of n)this._langGraph.set(s,this._langMap.get(s))}},xA=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,n){this._onigLib={createOnigScanner:(s)=>t.createScanner(s),createOnigString:(s)=>t.createString(s)},n.forEach((s)=>this.addLanguage(s))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){if(this._langs.set(t.name,t),t.aliases)t.aliases.forEach((n)=>{this._langs.set(n,t)});if(this._scopeToLang.set(t.scopeName,t),t.injectTo)t.injectTo.forEach((n)=>{if(!this._injections.get(n))this._injections.set(n,[]);this._injections.get(n).push(t.scopeName)})}getInjections(t){let n=t.split("."),s=[];for(let a=1;a<=n.length;a++){let l=n.slice(0,a).join(".");s=[...s,...this._injections.get(l)||[]]}return s}},Za=0;function wf(t){if(Za+=1,t.warnings!==!1&&Za>=10&&Za%10===0)console.warn(`[Shiki] ${Za} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let n=!1;if(!t.engine)throw new Lt("`engine` option is required for synchronous mode");let s=(t.langs||[]).flat(1),a=(t.themes||[]).flat(1).map(Ds),l=new yA(new xA(t.engine,s),a,s,t.langAlias),d;function f(O){return Yy(O,t.langAlias)}function h(O){N();let B=l.getGrammar(typeof O==="string"?O:O.name);if(!B)throw new Lt(`Language \`${O}\` not found, you may need to load it first`);return B}function g(O){if(O==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};N();let B=l.getTheme(O);if(!B)throw new Lt(`Theme \`${O}\` not found, you may need to load it first`);return B}function I(O){N();let B=g(O);if(d!==O)l.setTheme(B),d=O;return{theme:B,colorMap:l.getColorMap()}}function b(){return N(),l.getLoadedThemes()}function v(){return N(),l.getLoadedLanguages()}function k(...O){N(),l.loadLanguages(O.flat(1))}async function w(...O){return k(await Wy(O))}function P(...O){N();for(let B of O.flat(1))l.loadTheme(B)}async function M(...O){return N(),P(await Xy(O))}function N(){if(n)throw new Lt("Shiki instance has been disposed")}function _(){if(n)return;n=!0,l.dispose(),Za-=1}return{setTheme:I,getTheme:g,getLanguage:h,getLoadedThemes:b,getLoadedLanguages:v,resolveLangAlias:f,loadLanguage:w,loadLanguageSync:k,loadTheme:M,loadThemeSync:P,dispose:_,[Symbol.dispose]:_}}async function Rf(t){if(!t.engine)console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[n,s,a]=await Promise.all([Xy(t.themes||[]),Wy(t.langs||[]),t.engine]);return wf({...t,themes:n,langs:s,engine:a})}var Jy=new WeakMap;function rl(t,n){Jy.set(t,n)}function Hs(t){return Jy.get(t)}var Zu=class t{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(n,s){return new t(Object.fromEntries(Vy(s).map((a)=>[a,R])),n)}constructor(...n){if(n.length===2){let[s,a]=n;this.lang=a,this._stacks=s}else{let[s,a,l]=n;this.lang=a,this._stacks={[l]:s}}}getInternalStack(n=this.theme){return this._stacks[n]}getScopes(n=this.theme){return IA(this._stacks[n])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function IA(t){let n=[],s=new Set;function a(l){if(s.has(l))return;s.add(l);let d=l?.nameScopesList?.scopeName;if(d)n.push(d);if(l.parent)a(l.parent)}return a(t),n}function SA(t,n){if(!(t instanceof Zu))throw new Lt("Invalid grammar state");return t.getInternalStack(n)}var bA=/,/,CA=/ /;function Lf(t,n,s={}){let{theme:a=t.getLoadedThemes()[0]}=s;if(tl(t.resolveLangAlias(s.lang||"text"))||nl(a))return Ns(n).map((h)=>[{content:h[0],offset:h[1]}]);let{theme:l,colorMap:d}=t.setTheme(a),f=t.getLanguage(s.lang||"text");if(s.grammarState){if(s.grammarState.lang!==f.name)throw new Lt(`Grammar state language "${s.grammarState.lang}" does not match highlight language "${f.name}"`);if(!s.grammarState.themes.includes(l.name))throw new Lt(`Grammar state themes "${s.grammarState.themes}" do not contain highlight theme "${l.name}"`)}return Zy(n,f,l,d,s)}function Qy(...t){if(t.length===2)return Hs(t[1]);let[n,s,a={}]=t,{lang:l="text",theme:d=n.getLoadedThemes()[0]}=a;if(tl(l)||nl(d))throw new Lt("Plain language does not have grammar state");if(l==="ansi")throw new Lt("ANSI language does not have grammar state");let{theme:f,colorMap:h}=n.setTheme(d),g=n.getLanguage(l);return new Zu(Af(s,g,f,h,a).stateStack,g.name,f.name)}function Zy(t,n,s,a,l){let d=Af(t,n,s,a,l),f=new Zu(d.stateStack,n.name,s.name);return rl(d.tokens,f),d.tokens}function Af(t,n,s,a,l){let d=el(s,l),{tokenizeMaxLineLength:f=0,tokenizeTimeLimit:h=500,includeExplanation:g=!1}=l,I=Ns(t),b=l.grammarState?SA(l.grammarState,s.name)??R:l.grammarContextCode!=null?Af(l.grammarContextCode,n,s,a,{...l,grammarState:void 0,grammarContextCode:void 0}).stateStack:R,v=[],k=[];for(let w=0,P=I.length;w<P;w++){let[M,N]=I[w];if(M===""){v=[],k.push([]);continue}if(f>0&&M.length>=f){v=[],k.push([{content:M,offset:N,color:"",fontStyle:0}]);continue}let _,O,B;if(g&&g!=="tokenType")_=n.tokenizeLine(M,b,h),O=_.tokens,B=0;let X=n.tokenizeLine2(M,b,h),z=X.tokens.length/2;for(let K=0;K<z;K++){let W=X.tokens[2*K],J=K+1<z?X.tokens[2*K+2]:M.length;if(W===J)continue;let ee=X.tokens[2*K+1],ue=Gi(a[G.getForeground(ee)],d),Ae=G.getFontStyle(ee),le={content:M.substring(W,J),offset:N+W,color:ue,fontStyle:Ae};if(g==="tokenType")le.type=G.getTokenType(ee);else if(g){let Se=[];if(g!=="scopeName")for(let It of s.settings){let Ce;switch(typeof It.scope){case"string":Ce=It.scope.split(bA).map((qe)=>qe.trim());break;case"object":Ce=It.scope;break;default:continue}Se.push({settings:It,selectors:Ce.map((qe)=>qe.split(CA))})}le.explanation=[];let lt=0;while(W+lt<J){let It=O[B],Ce=M.substring(It.startIndex,It.endIndex);lt+=Ce.length,le.explanation.push({content:Ce,scopes:g==="scopeName"?EA(It.scopes):vA(Se,It.scopes)}),B+=1}}v.push(le)}k.push(v),v=[],b=X.ruleStack}return{tokens:k,stateStack:b}}function EA(t){return t.map((n)=>({scopeName:n}))}function vA(t,n){let s=[];for(let a=0,l=n.length;a<l;a++){let d=n[a];s[a]={scopeName:d,themeMatches:TA(t,d,n.slice(0,a))}}return s}function Ky(t,n){return t===n||n.substring(0,t.length)===t&&n[t.length]==="."}function kA(t,n,s){if(!Ky(t.at(-1),n))return!1;let a=t.length-2,l=s.length-1;while(a>=0&&l>=0){if(Ky(t[a],s[l]))a-=1;l-=1}if(a===-1)return!0;return!1}function TA(t,n,s){let a=[];for(let{selectors:l,settings:d}of t)for(let f of l)if(kA(f,n,s)){a.push(d);break}return a}function ec(t,n,s,a=Lf){let l=Object.entries(s.themes).filter((I)=>I[1]).map((I)=>({color:I[0],theme:I[1]})),d=l.map((I,b)=>{let v=a(t,n,{...s,includeExplanation:b===0||s.includeExplanation==="tokenType"?s.includeExplanation:!1,theme:I.theme});return{tokens:v,state:Hs(v),theme:typeof I.theme==="string"?I.theme:I.theme.name}}),f=wA(...d.map((I)=>I.tokens)),h=f[0].map((I,b)=>I.map((v,k)=>{let w={content:v.content,variants:{},offset:v.offset};if("includeExplanation"in s&&s.includeExplanation)w.explanation=v.explanation;return f.forEach((P,M)=>{let{content:N,explanation:_,offset:O,...B}=P[b][k];w.variants[l[M].color]=B}),w})),g=d[0].state?new Zu(Object.fromEntries(d.map((I)=>[I.theme,I.state?.getInternalStack(I.theme)])),d[0].state.lang):void 0;if(g)rl(h,g);return h}function wA(...t){let n=t.map(()=>[]),s=t.length;for(let a=0;a<t[0].length;a++){let l=t.map((g)=>g[a]),d=n.map(()=>[]);n.forEach((g,I)=>g.push(d[I]));let f=l.map(()=>0),h=l.map((g)=>g[0]);while(h.every((g)=>g)){let g=Math.min(...h.map((I)=>I.content.length));for(let I=0;I<s;I++){let b=h[I];if(b.content.length===g)d[I].push(b),f[I]+=1,h[I]=l[I][f[I]];else d[I].push({...b,content:b.content.slice(0,g)}),h[I]={...b,content:b.content.slice(g),offset:b.offset+g}}}}return n}var ex=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class yo{constructor(t,n,s){if(this.normal=n,this.property=t,s)this.space=s}}yo.prototype.normal={};yo.prototype.property={};yo.prototype.space=void 0;function Pf(t,n){let s={},a={};for(let l of t)Object.assign(s,l.property),Object.assign(a,l.normal);return new yo(s,a,n)}function Us(t){return t.toLowerCase()}class Kn{constructor(t,n){this.attribute=n,this.property=t}}Kn.prototype.attribute="";Kn.prototype.booleanish=!1;Kn.prototype.boolean=!1;Kn.prototype.commaOrSpaceSeparated=!1;Kn.prototype.commaSeparated=!1;Kn.prototype.defined=!1;Kn.prototype.mustUseProperty=!1;Kn.prototype.number=!1;Kn.prototype.overloadedBoolean=!1;Kn.prototype.property="";Kn.prototype.spaceSeparated=!1;Kn.prototype.space=void 0;var il={};De(il,{boolean:()=>_e,booleanish:()=>fn,commaOrSpaceSeparated:()=>gr,commaSeparated:()=>zi,number:()=>Q,overloadedBoolean:()=>tc,spaceSeparated:()=>Rt});var RA=0,_e=Qo(),fn=Qo(),tc=Qo(),Q=Qo(),Rt=Qo(),zi=Qo(),gr=Qo();function Qo(){return 2**++RA}var Mf=Object.keys(il);class Bs extends Kn{constructor(t,n,s,a){let l=-1;super(t,n);if(tx(this,"space",a),typeof s==="number")while(++l<Mf.length){let d=Mf[l];tx(this,Mf[l],(s&il[d])===il[d])}}}Bs.prototype.defined=!0;function tx(t,n,s){if(s)t[n]=s}function Xr(t){let n={},s={};for(let[a,l]of Object.entries(t.properties)){let d=new Bs(a,t.transform(t.attributes||{},a),l,t.space);if(t.mustUseProperty&&t.mustUseProperty.includes(a))d.mustUseProperty=!0;n[a]=d,s[Us(a)]=a,s[Us(d.attribute)]=a}return new yo(n,s,t.space)}var _f=Xr({properties:{ariaActiveDescendant:null,ariaAtomic:fn,ariaAutoComplete:null,ariaBusy:fn,ariaChecked:fn,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:fn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:fn,ariaFlowTo:Rt,ariaGrabbed:fn,ariaHasPopup:null,ariaHidden:fn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:Q,ariaLive:null,ariaModal:fn,ariaMultiLine:fn,ariaMultiSelectable:fn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:fn,ariaReadOnly:fn,ariaRelevant:null,ariaRequired:fn,ariaRoleDescription:Rt,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:fn,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(t,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function nc(t,n){return n in t?t[n]:n}function rc(t,n){return nc(t,n.toLowerCase())}var nx=Xr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:zi,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:_e,allowPaymentRequest:_e,allowUserMedia:_e,alpha:_e,alt:null,as:null,async:_e,autoCapitalize:null,autoComplete:Rt,autoFocus:_e,autoPlay:_e,blocking:Rt,capture:null,charSet:null,checked:_e,cite:null,className:Rt,closedBy:null,colorSpace:null,cols:Q,colSpan:Q,command:null,commandFor:null,content:null,contentEditable:fn,controls:_e,controlsList:Rt,coords:Q|zi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_e,defer:_e,dir:null,dirName:null,disabled:_e,download:tc,draggable:fn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_e,formTarget:null,headers:Rt,height:Q,hidden:tc,high:Q,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:_e,inputMode:null,integrity:null,is:null,isMap:_e,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:_e,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_e,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:_e,muted:_e,name:null,nonce:null,noModule:_e,noValidate:_e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_e,optimum:Q,pattern:null,ping:Rt,placeholder:null,playsInline:_e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_e,referrerPolicy:null,rel:Rt,required:_e,reversed:_e,rows:Q,rowSpan:Q,sandbox:Rt,scope:null,scoped:_e,seamless:_e,selected:_e,shadowRootClonable:_e,shadowRootCustomElementRegistry:_e,shadowRootDelegatesFocus:_e,shadowRootMode:null,shadowRootSerializable:_e,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:fn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:_e,useMap:null,value:fn,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_e,declare:_e,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:_e,noHref:_e,noShade:_e,noWrap:_e,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:fn,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:_e,disablePictureInPicture:_e,disableRemotePlayback:_e,exportParts:zi,part:Rt,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:rc});var rx=Xr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gr,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:Rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:_e,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:zi,g2:zi,glyphName:zi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gr,rev:gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gr,requiredFeatures:gr,requiredFonts:gr,requiredFormats:gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gr,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:nc});var Of=Xr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,n){return"xlink:"+n.slice(5).toLowerCase()}});var $f=Xr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:rc});var Ff=Xr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,n){return"xml:"+n.slice(3).toLowerCase()}});var LA=/[A-Z]/g,ix=/-[a-z]/g,AA=/^data[-\w.:]+$/i;function Nf(t,n){let s=Us(n),a=n,l=Kn;if(s in t.normal)return t.property[t.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&AA.test(n)){if(n.charAt(4)==="-"){let d=n.slice(5).replace(ix,MA);a="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{let d=n.slice(4);if(!ix.test(d)){let f=d.replace(LA,PA);if(f.charAt(0)!=="-")f="-"+f;n="data"+f}}l=Bs}return new l(a,n)}function PA(t){return"-"+t.toLowerCase()}function MA(t){return t.charAt(1).toUpperCase()}var ox=Pf([_f,nx,Of,$f,Ff],"html"),ic=Pf([_f,rx,Of,$f,Ff],"svg");var sx={}.hasOwnProperty;function ax(t,n){let s=n||{};function a(l,...d){let{invalid:f,handlers:h}=a;if(l&&sx.call(l,t)){let g=String(l[t]);f=sx.call(h,g)?h[g]:a.unknown}if(f)return f.call(this,l,...d)}return a.handlers=s.handlers||{},a.invalid=s.invalid,a.unknown=s.unknown,a}var _A=/["&'<>`]/g,OA=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,$A=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,FA=/[|\\{}()[\]^$+*?.]/g,lx=new WeakMap;function ux(t,n){if(t=t.replace(n.subset?NA(n.subset):_A,a),n.subset||n.escapeOnly)return t;return t.replace(OA,s).replace($A,a);function s(l,d,f){return n.format((l.charCodeAt(0)-55296)*1024+l.charCodeAt(1)-56320+65536,f.charCodeAt(d+2),n)}function a(l,d,f){return n.format(l.charCodeAt(0),f.charCodeAt(d+1),n)}}function NA(t){let n=lx.get(t);if(!n)n=DA(t),lx.set(t,n);return n}function DA(t){let n=[],s=-1;while(++s<t.length)n.push(t[s].replace(FA,"\\$&"));return new RegExp("(?:"+n.join("|")+")","g")}var HA=/[\dA-Fa-f]/;function cx(t,n,s){let a="&#x"+t.toString(16).toUpperCase();return s&&n&&!HA.test(String.fromCharCode(n))?a:a+";"}var UA=/\d/;function dx(t,n,s){let a="&#"+String(t);return s&&n&&!UA.test(String.fromCharCode(n))?a:a+";"}var mx=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var oc={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"};var fx=["cent","copy","divide","gt","lt","not","para","times"];var px={}.hasOwnProperty,Df={},sc;for(sc in oc)if(px.call(oc,sc))Df[oc[sc]]=sc;var BA=/[^\dA-Za-z]/;function hx(t,n,s,a){let l=String.fromCharCode(t);if(px.call(Df,l)){let d=Df[l],f="&"+d;if(s&&mx.includes(d)&&!fx.includes(d)&&(!a||n&&n!==61&&BA.test(String.fromCharCode(n))))return f;return f+";"}return""}function gx(t,n,s){let a=cx(t,n,s.omitOptionalSemicolons),l;if(s.useNamedReferences||s.useShortestReferences)l=hx(t,n,s.omitOptionalSemicolons,s.attribute);if((s.useShortestReferences||!l)&&s.useShortestReferences){let d=dx(t,n,s.omitOptionalSemicolons);if(d.length<a.length)a=d}return l&&(!s.useShortestReferences||l.length<a.length)?l:a}function ji(t,n){return ux(t,Object.assign({format:gx},n))}var GA=/^>|^->|<!--|-->|--!>|<!-$/g,zA=[">"],jA=["<",">"];function yx(t,n,s,a){return a.settings.bogusComments?"<?"+ji(t.value,Object.assign({},a.settings.characterReferences,{subset:zA}))+">":"<!--"+t.value.replace(GA,l)+"-->";function l(d){return ji(d,Object.assign({},a.settings.characterReferences,{subset:jA}))}}function xx(t,n,s,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}function Hf(t,n){let s=String(t);if(typeof n!=="string")throw TypeError("Expected character");let a=0,l=s.indexOf(n);while(l!==-1)a++,l=s.indexOf(n,l+n.length);return a}function Ix(t,n){let s=n||{};return(t[t.length-1]===""?[...t,""]:t).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}function Sx(t){return t.join(" ").trim()}var qA=/[ \t\n\f\r]/g;function Zo(t){return typeof t==="object"?t.type==="text"?bx(t.value):!1:bx(t)}function bx(t){return t.replace(qA,"")===""}var bn=Cx(1),Uf=Cx(-1),KA=[];function Cx(t){return n;function n(s,a,l){let d=s?s.children:KA,f=(a||0)+t,h=d[f];if(!l)while(h&&Zo(h))f+=t,h=d[f];return h}}var VA={}.hasOwnProperty;function ac(t){return n;function n(s,a,l){return VA.call(t,s.tagName)&&t[s.tagName](s,a,l)}}var ol=ac({body:XA,caption:Bf,colgroup:Bf,dd:ZA,dt:QA,head:Bf,html:WA,li:JA,optgroup:eP,option:tP,p:YA,rp:Ex,rt:Ex,tbody:rP,td:vx,tfoot:iP,th:vx,thead:nP,tr:oP});function Bf(t,n,s){let a=bn(s,n,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&Zo(a.value.charAt(0)))}function WA(t,n,s){let a=bn(s,n);return!a||a.type!=="comment"}function XA(t,n,s){let a=bn(s,n);return!a||a.type!=="comment"}function YA(t,n,s){let a=bn(s,n);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!s||!(s.type==="element"&&(s.tagName==="a"||s.tagName==="audio"||s.tagName==="del"||s.tagName==="ins"||s.tagName==="map"||s.tagName==="noscript"||s.tagName==="video"))}function JA(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&a.tagName==="li"}function QA(t,n,s){let a=bn(s,n);return Boolean(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function ZA(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function Ex(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function eP(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&a.tagName==="optgroup"}function tP(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function nP(t,n,s){let a=bn(s,n);return Boolean(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function rP(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function iP(t,n,s){return!bn(s,n)}function oP(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&a.tagName==="tr"}function vx(t,n,s){let a=bn(s,n);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}var kx=ac({body:lP,colgroup:uP,head:aP,html:sP,tbody:cP});function sP(t){let n=bn(t,-1);return!n||n.type!=="comment"}function aP(t){let n=new Set;for(let a of t.children)if(a.type==="element"&&(a.tagName==="base"||a.tagName==="title")){if(n.has(a.tagName))return!1;n.add(a.tagName)}let s=t.children[0];return!s||s.type==="element"}function lP(t){let n=bn(t,-1,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&Zo(n.value.charAt(0)))&&!(n.type==="element"&&(n.tagName==="meta"||n.tagName==="link"||n.tagName==="script"||n.tagName==="style"||n.tagName==="template"))}function uP(t,n,s){let a=Uf(s,n),l=bn(t,-1,!0);if(s&&a&&a.type==="element"&&a.tagName==="colgroup"&&ol(a,s.children.indexOf(a),s))return!1;return Boolean(l&&l.type==="element"&&l.tagName==="col")}function cP(t,n,s){let a=Uf(s,n),l=bn(t,-1);if(s&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&ol(a,s.children.indexOf(a),s))return!1;return Boolean(l&&l.type==="element"&&l.tagName==="tr")}var lc={name:[[`
|
|
4
4
|
\f\r &/=>`.split(""),`
|
|
5
5
|
\f\r "&'/=>\``.split("")],[`\x00
|
|
6
6
|
\f\r "&'/<=>`.split(""),`\x00
|
|
@@ -9,7 +9,7 @@ import{De,e}from"../main.js";function qu(t){return t!==null&&typeof t==="object"
|
|
|
9
9
|
\f\r "&'<=>\``.split("")],[`\x00
|
|
10
10
|
\f\r "&'<=>\``.split(""),`\x00
|
|
11
11
|
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\x00&'".split(""),"\x00\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\x00"&'.split(""),"\x00\"&'`".split("")]]};function Tx(t,n,s,a){let l=a.schema,d=l.space==="svg"?!1:a.settings.omitOptionalTags,f=l.space==="svg"?a.settings.closeEmptyElements:a.settings.voids.includes(t.tagName.toLowerCase()),h=[],g;if(l.space==="html"&&t.tagName==="svg")a.schema=ic;let I=dP(a,t.properties),b=a.all(l.space==="html"&&t.tagName==="template"?t.content:t);if(a.schema=l,b)f=!1;if(I||!d||!kx(t,n,s)){if(h.push("<",t.tagName,I?" "+I:""),f&&(l.space==="svg"||a.settings.closeSelfClosing)){if(g=I.charAt(I.length-1),!a.settings.tightSelfClosing||g==="/"||g&&g!=='"'&&g!=="'")h.push(" ");h.push("/")}h.push(">")}if(h.push(b),!f&&(!d||!ol(t,n,s)))h.push("</"+t.tagName+">");return h.join("")}function dP(t,n){let s=[],a=-1,l;if(n){for(l in n)if(n[l]!==null&&n[l]!==void 0){let d=mP(t,l,n[l]);if(d)s.push(d)}}while(++a<s.length){let d=t.settings.tightAttributes?s[a].charAt(s[a].length-1):void 0;if(a!==s.length-1&&d!=='"'&&d!=="'")s[a]+=" "}return s.join("")}function mP(t,n,s){let a=Nf(t.schema,n),l=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,d=t.settings.allowDangerousCharacters?0:1,f=t.quote,h;if(a.overloadedBoolean&&(s===a.attribute||s===""))s=!0;else if((a.boolean||a.overloadedBoolean)&&(typeof s!=="string"||s===a.attribute||s===""))s=Boolean(s);if(s===null||s===void 0||s===!1||typeof s==="number"&&Number.isNaN(s))return"";let g=ji(a.attribute,Object.assign({},t.settings.characterReferences,{subset:lc.name[l][d]}));if(s===!0)return g;if(s=Array.isArray(s)?(a.commaSeparated?Ix:Sx)(s,{padLeft:!t.settings.tightCommaSeparatedLists}):String(s),t.settings.collapseEmptyAttributes&&!s)return g;if(t.settings.preferUnquoted)h=ji(s,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:lc.unquoted[l][d]}));if(h!==s){if(t.settings.quoteSmart&&Hf(s,f)>Hf(s,t.alternative))f=t.alternative;h=f+ji(s,Object.assign({},t.settings.characterReferences,{subset:(f==="'"?lc.single:lc.double)[l][d],attribute:!0}))+f}return g+(h?"="+h:h)}var fP=["<","&"];function uc(t,n,s,a){return s&&s.type==="element"&&(s.tagName==="script"||s.tagName==="style")?t.value:ji(t.value,Object.assign({},a.settings.characterReferences,{subset:fP}))}function wx(t,n,s,a){return a.settings.allowDangerousHtml?t.value:uc(t,n,s,a)}function Rx(t,n,s,a){return a.all(t)}var Lx=ax("type",{invalid:pP,unknown:hP,handlers:{comment:yx,doctype:xx,element:Tx,raw:wx,root:Rx,text:uc}});function pP(t){throw Error("Expected node, not `"+t+"`")}function hP(t){throw Error("Cannot compile unknown node `"+t.type+"`")}var gP={},yP={},xP=[];function pn(t,n){let s=n||gP,a=s.quote||'"',l=a==='"'?"'":'"';if(a!=='"'&&a!=="'")throw Error("Invalid quote `"+a+"`, expected `'` or `\"`");return{one:IP,all:SP,settings:{omitOptionalTags:s.omitOptionalTags||!1,allowParseErrors:s.allowParseErrors||!1,allowDangerousCharacters:s.allowDangerousCharacters||!1,quoteSmart:s.quoteSmart||!1,preferUnquoted:s.preferUnquoted||!1,tightAttributes:s.tightAttributes||!1,upperDoctype:s.upperDoctype||!1,tightDoctype:s.tightDoctype||!1,bogusComments:s.bogusComments||!1,tightCommaSeparatedLists:s.tightCommaSeparatedLists||!1,tightSelfClosing:s.tightSelfClosing||!1,collapseEmptyAttributes:s.collapseEmptyAttributes||!1,allowDangerousHtml:s.allowDangerousHtml||!1,voids:s.voids||ex,characterReferences:s.characterReferences||yP,closeSelfClosing:s.closeSelfClosing||!1,closeEmptyElements:s.closeEmptyElements||!1},schema:s.space==="svg"?ic:ox,quote:a,alternative:l}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function IP(t,n,s){return Lx(t,n,s,this)}function SP(t){let n=[],s=t&&t.children||xP,a=-1;while(++a<s.length)n[a]=this.one(s[a],a,t);return n.join("")}var Ax=/\s+/g;function _x(t,n){if(!n)return t;if(t.properties||={},t.properties.class||=[],typeof t.properties.class==="string")t.properties.class=t.properties.class.split(Ax);if(!Array.isArray(t.properties.class))t.properties.class=[];let s=Array.isArray(n)?n:n.split(Ax);for(let a of s)if(a&&!t.properties.class.includes(a))t.properties.class.push(a);return t}var bP=/:?lang=["']([^"']+)["']/g,CP=/(?:```|~~~)([\w-]+)/g,EP=/\\begin\{([\w-]+)\}/g,vP=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,kP=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function TP(t){let n=Ns(t,!0).map(([l])=>l);function s(l){if(l===t.length)return{line:n.length-1,character:n.at(-1).length};let d=l,f=0;for(let h of n){if(d<h.length)break;d-=h.length,f++}return{line:f,character:d}}function a(l,d){let f=0;for(let h=0;h<l;h++)f+=n[h].length;return f+=d,f}return{lines:n,indexToPos:s,posToIndex:a}}function Ox(t,n,s){let a=new Set;for(let d of t.matchAll(bP)){let f=d[1].toLowerCase().trim();if(f)a.add(f)}for(let d of t.matchAll(CP)){let f=d[1].toLowerCase().trim();if(f)a.add(f)}for(let d of t.matchAll(EP)){let f=d[1].toLowerCase().trim();if(f)a.add(f)}for(let d of t.matchAll(vP)){let f=d[1].toLowerCase().trim(),h=f.includes("/")?f.split("/").pop():f;if(h)a.add(h)}if(kP.test(t))a.add("yaml");if(!s)return[...a];let l=s.getBundledLanguages();return[...a].filter((d)=>d&&l[d])}var wP=["color","background-color"];function RP(t,n){let s=0,a=[];for(let l of n){if(l>s)a.push({...t,content:t.content.slice(s,l),offset:t.offset+s});s=l}if(s<t.content.length)a.push({...t,content:t.content.slice(s),offset:t.offset+s});return a}function LP(t,n){let s=0,a=t.length;while(s<a){let l=s+(a-s>>1);if(t[l]<=n)s=l+1;else a=l}return s}function AP(t,n){let s=[...n instanceof Set?n:new Set(n)].sort((a,l)=>a-l);if(!s.length)return t;return t.map((a)=>a.flatMap((l)=>{let d=l.offset+l.content.length,f=LP(s,l.offset),h=f;while(h<s.length&&s[h]<d)h++;if(f===h)return l;let g=s.slice(f,h);for(let I=0;I<g.length;I++)g[I]-=l.offset;return RP(l,g)}))}function PP(t,n,s,a,l="css-vars"){let d={content:t.content,explanation:t.explanation,offset:t.offset},f=n.map((b)=>cc(t.variants[b])),h=new Set(f.flatMap((b)=>Object.keys(b))),g={},I=(b,v)=>{let k=v==="color"?"":v==="background-color"?"-bg":`-${v}`;return s+n[b]+(v==="color"?"":k)};return f.forEach((b,v)=>{for(let k of h){let w=b[k]||"inherit";if(v===0&&a&&wP.includes(k))if(a==="light-dark()"&&f.length>1){let P=n.findIndex((O)=>O==="light"),M=n.findIndex((O)=>O==="dark");if(P===-1||M===-1)throw new Lt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let N=f[P][k]||"inherit",_=f[M][k]||"inherit";if(g[k]=`light-dark(${N}, ${_})`,l==="css-vars")g[I(v,k)]=w}else g[k]=w;else if(l==="css-vars")g[I(v,k)]=w}}),d.htmlStyle=g,d}function cc(t){let n={};if(t.color)n.color=t.color;if(t.bgColor)n["background-color"]=t.bgColor;if(t.fontStyle){if(t.fontStyle&qn.Italic)n["font-style"]="italic";if(t.fontStyle&qn.Bold)n["font-weight"]="bold";let s=[];if(t.fontStyle&qn.Underline)s.push("underline");if(t.fontStyle&qn.Strikethrough)s.push("line-through");if(s.length)n["text-decoration"]=s.join(" ")}return n}function zf(t){if(typeof t==="string")return t;return Object.entries(t).map(([n,s])=>`${n}:${s}`).join(";")}function MP(){let t=new WeakMap;function n(s){if(!t.has(s.meta)){let l=function(f){if(typeof f==="number"){if(f<0||f>s.source.length)throw new Lt(`Invalid decoration offset: ${f}. Code length: ${s.source.length}`);return{...a.indexToPos(f),offset:f}}else{let h=a.lines[f.line];if(h===void 0)throw new Lt(`Invalid decoration position ${JSON.stringify(f)}. Lines length: ${a.lines.length}`);let g=f.character;if(g<0)g=h.length+g;if(g<0||g>h.length)throw new Lt(`Invalid decoration position ${JSON.stringify(f)}. Line ${f.line} length: ${h.length}`);return{...f,character:g,offset:a.posToIndex(f.line,g)}}},a=TP(s.source),d=(s.options.decorations||[]).map((f)=>({...f,start:l(f.start),end:l(f.end)}));_P(d),t.set(s.meta,{decorations:d,converter:a,source:s.source})}return t.get(s.meta)}return{name:"shiki:decorations",tokens(s){if(!this.options.decorations?.length)return;return AP(s,n(this).decorations.flatMap((a)=>[a.start.offset,a.end.offset]))},code(s){if(!this.options.decorations?.length)return;let a=n(this),l=[...s.children].filter((b)=>b.type==="element"&&b.tagName==="span");if(l.length!==a.converter.lines.length)throw new Lt(`Number of lines in code element (${l.length}) does not match the number of lines in the source (${a.converter.lines.length}). Failed to apply decorations.`);function d(b,v,k,w){let P=l[b],M="",N=-1,_=-1;if(v===0)N=0;if(k===0)_=0;if(k===Number.POSITIVE_INFINITY)_=P.children.length;if(N===-1||_===-1)for(let B=0;B<P.children.length;B++){if(M+=$x(P.children[B]),N===-1&&M.length===v)N=B+1;if(_===-1&&M.length===k)_=B+1}if(N===-1)throw new Lt(`Failed to find start index for decoration ${JSON.stringify(w.start)}`);if(_===-1)throw new Lt(`Failed to find end index for decoration ${JSON.stringify(w.end)}`);let O=P.children.slice(N,_);if(!w.alwaysWrap&&O.length===P.children.length)h(P,w,"line");else if(!w.alwaysWrap&&O.length===1&&O[0].type==="element")h(O[0],w,"token");else{let B={type:"element",tagName:"span",properties:{},children:O};h(B,w,"wrapper"),P.children.splice(N,O.length,B)}}function f(b,v){l[b]=h(l[b],v,"line")}function h(b,v,k){let w=v.properties||{},P=v.transform||((M)=>M);if(b.tagName=v.tagName||"span",b.properties={...b.properties,...w,class:b.properties.class},v.properties?.class)_x(b,v.properties.class);return b=P(b,k)||b,b}let g=[],I=a.decorations.sort((b,v)=>v.start.offset-b.start.offset||b.end.offset-v.end.offset);for(let b of I){let{start:v,end:k}=b;if(v.line===k.line)d(v.line,v.character,k.character,b);else if(v.line<k.line){d(v.line,v.character,Number.POSITIVE_INFINITY,b);for(let w=v.line+1;w<k.line;w++)g.unshift(()=>f(w,b));d(k.line,0,k.character,b)}}g.forEach((b)=>b())}}}function _P(t){for(let n=0;n<t.length;n++){let s=t[n];if(s.start.offset>s.end.offset)throw new Lt(`Invalid decoration range: ${JSON.stringify(s.start)} - ${JSON.stringify(s.end)}`);for(let a=n+1;a<t.length;a++){let l=t[a],d=s.start.offset<=l.start.offset&&l.start.offset<s.end.offset,f=s.start.offset<l.end.offset&&l.end.offset<=s.end.offset,h=l.start.offset<=s.start.offset&&s.start.offset<l.end.offset,g=l.start.offset<s.end.offset&&s.end.offset<=l.end.offset;if(d||f||h||g){if(d&&f)continue;if(h&&g)continue;if(h&&s.start.offset===s.end.offset)continue;if(f&&l.start.offset===l.end.offset)continue;throw new Lt(`Decorations ${JSON.stringify(s.start)} and ${JSON.stringify(l.start)} intersect.`)}}}}function $x(t){if(t.type==="text")return t.value;if(t.type==="element")return t.children.map($x).join("");return""}var OP=[MP()];function dc(t){let n=$P(t.transformers||[]);return[...n.pre,...n.normal,...n.post,...OP]}function $P(t){let n=[],s=[],a=[];for(let l of t)switch(l.enforce){case"pre":n.push(l);break;case"post":s.push(l);break;default:a.push(l)}return{pre:n,post:s,normal:a}}var es=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Gf={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function FP(t,n){let s=t.indexOf("\x1B",n);if(s!==-1){if(t[s+1]==="["){let a=t.indexOf("m",s);if(a!==-1)return{sequence:t.substring(s+2,a).split(";"),startPosition:s,position:a+1}}}return{position:t.length}}function Px(t){let n=t.shift();if(n==="2"){let s=t.splice(0,3).map((a)=>Number.parseInt(a));if(s.length!==3||s.some((a)=>Number.isNaN(a)))return;return{type:"rgb",rgb:s}}else if(n==="5"){let s=t.shift();if(s)return{type:"table",index:Number(s)}}}function NP(t){let n=[];while(t.length>0){let s=t.shift();if(!s)continue;let a=Number.parseInt(s);if(Number.isNaN(a))continue;if(a===0)n.push({type:"resetAll"});else if(a<=9){if(Gf[a])n.push({type:"setDecoration",value:Gf[a]})}else if(a<=29){let l=Gf[a-20];if(l){if(n.push({type:"resetDecoration",value:l}),l==="dim")n.push({type:"resetDecoration",value:"bold"})}}else if(a<=37)n.push({type:"setForegroundColor",value:{type:"named",name:es[a-30]}});else if(a===38){let l=Px(t);if(l)n.push({type:"setForegroundColor",value:l})}else if(a===39)n.push({type:"resetForegroundColor"});else if(a<=47)n.push({type:"setBackgroundColor",value:{type:"named",name:es[a-40]}});else if(a===48){let l=Px(t);if(l)n.push({type:"setBackgroundColor",value:l})}else if(a===49)n.push({type:"resetBackgroundColor"});else if(a===53)n.push({type:"setDecoration",value:"overline"});else if(a===55)n.push({type:"resetDecoration",value:"overline"});else if(a>=90&&a<=97)n.push({type:"setForegroundColor",value:{type:"named",name:es[a-90+8]}});else if(a>=100&&a<=107)n.push({type:"setBackgroundColor",value:{type:"named",name:es[a-100+8]}})}return n}function DP(){let t=null,n=null,s=new Set;return{parse(a){let l=[],d=0;do{let f=FP(a,d),h=f.sequence?a.substring(d,f.startPosition):a.substring(d);if(h.length>0)l.push({value:h,foreground:t,background:n,decorations:new Set(s)});if(f.sequence){let g=NP(f.sequence);for(let I of g)if(I.type==="resetAll")t=null,n=null,s.clear();else if(I.type==="resetForegroundColor")t=null;else if(I.type==="resetBackgroundColor")n=null;else if(I.type==="resetDecoration")s.delete(I.value);for(let I of g)if(I.type==="setForegroundColor")t=I.value;else if(I.type==="setBackgroundColor")n=I.value;else if(I.type==="setDecoration")s.add(I.value)}d=f.position}while(d<a.length);return l}}}var HP={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function UP(t=HP){function n(h){return t[h]}function s(h){return`#${h.map((g)=>Math.max(0,Math.min(g,255)).toString(16).padStart(2,"0")).join("")}`}let a;function l(){if(a)return a;a=[];for(let I=0;I<es.length;I++)a.push(n(es[I]));let h=[0,95,135,175,215,255];for(let I=0;I<6;I++)for(let b=0;b<6;b++)for(let v=0;v<6;v++)a.push(s([h[I],h[b],h[v]]));let g=8;for(let I=0;I<24;I++,g+=10)a.push(s([g,g,g]));return a}function d(h){return l()[h]}function f(h){switch(h.type){case"named":return n(h.name);case"rgb":return s(h.rgb);case"table":return d(h.index)}}return{value:f}}var BP=/#([0-9a-f]{3,8})/i,GP=/var\((--[\w-]+-ansi-[\w-]+)\)/,zP={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function jP(t,n,s){let a=el(t,s),l=Ns(n),d=UP(Object.fromEntries(es.map((h)=>{let g=`terminal.ansi${h[0].toUpperCase()}${h.substring(1)}`;return[h,t.colors?.[g]||zP[h]]}))),f=DP();return l.map((h)=>f.parse(h[0]).map((g)=>{let I,b;if(g.decorations.has("reverse"))I=g.background?d.value(g.background):t.bg,b=g.foreground?d.value(g.foreground):t.fg;else I=g.foreground?d.value(g.foreground):t.fg,b=g.background?d.value(g.background):void 0;if(I=Gi(I,a),b=Gi(b,a),g.decorations.has("dim"))I=qP(I);let v=qn.None;if(g.decorations.has("bold"))v|=qn.Bold;if(g.decorations.has("italic"))v|=qn.Italic;if(g.decorations.has("underline"))v|=qn.Underline;if(g.decorations.has("strikethrough"))v|=qn.Strikethrough;return{content:g.value,offset:h[1],color:I,bgColor:b,fontStyle:v}}))}function qP(t){let n=t.match(BP);if(n){let a=n[1];if(a.length===8){let l=Math.round(Number.parseInt(a.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${a.slice(0,6)}${l}`}else if(a.length===6)return`#${a}80`;else if(a.length===4){let l=a[0],d=a[1],f=a[2],h=a[3];return`#${l}${l}${d}${d}${f}${f}${Math.round(Number.parseInt(`${h}${h}`,16)/2).toString(16).padStart(2,"0")}`}else if(a.length===3){let l=a[0],d=a[1],f=a[2];return`#${l}${l}${d}${d}${f}${f}80`}}let s=t.match(GP);if(s)return`var(${s[1]}-dim)`;return t}function jf(t,n,s={}){let a=t.resolveLangAlias(s.lang||"text"),{theme:l=t.getLoadedThemes()[0]}=s;if(!tl(a)&&!nl(l)&&a==="ansi"){let{theme:d}=t.setTheme(l);return jP(d,n,s)}return Lf(t,n,s)}function mc(t,n,s){let a,l,d,f,h,g;if("themes"in s){let{defaultColor:I="light",cssVariablePrefix:b="--shiki-",colorsRendering:v="css-vars"}=s,k=Object.entries(s.themes).filter((_)=>_[1]).map((_)=>({color:_[0],theme:_[1]})).sort((_,O)=>_.color===I?-1:O.color===I?1:0);if(k.length===0)throw new Lt("`themes` option must not be empty");let w=ec(t,n,s,jf);if(g=Hs(w),I&&I!=="light-dark()"&&!k.some((_)=>_.color===I))throw new Lt(`\`themes\` option must contain the defaultColor key \`${I}\``);let P=k.map((_)=>t.getTheme(_.theme)),M=k.map((_)=>_.color);if(d=w.map((_)=>_.map((O)=>PP(O,M,b,I,v))),g)rl(d,g);let N=k.map((_)=>el(_.theme,s));l=Mx(k,P,N,b,I,"fg",v),a=Mx(k,P,N,b,I,"bg",v),f=`shiki-themes ${P.map((_)=>_.name).join(" ")}`,h=I?void 0:[l,a].join(";")}else if("theme"in s){let I=el(s.theme,s);d=jf(t,n,s);let b=t.getTheme(s.theme);a=Gi(b.bg,I),l=Gi(b.fg,I),f=b.name,g=Hs(d)}else throw new Lt("Invalid options, either `theme` or `themes` must be provided");return{tokens:d,fg:l,bg:a,themeName:f,rootStyle:h,grammarState:g}}function Mx(t,n,s,a,l,d,f){return t.map((h,g)=>{let I=Gi(n[g][d],s[g])||"inherit",b=`${a+h.color}${d==="bg"?"-bg":""}:${I}`;if(g===0&&l){if(l==="light-dark()"&&t.length>1){let v=t.findIndex((w)=>w.color==="light"),k=t.findIndex((w)=>w.color==="dark");if(v===-1||k===-1)throw new Lt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Gi(n[v][d],s[v])||"inherit"}, ${Gi(n[k][d],s[k])||"inherit"});${b}`}return I}if(f==="css-vars")return b;return null}).filter((h)=>!!h).join(";")}var Fx=/^\s+$/,KP=/^(\s*)(.*?)(\s*)$/;function fc(t,n,s,a={meta:{},options:s,codeToHast:(l,d)=>fc(t,l,d),codeToTokens:(l,d)=>mc(t,l,d)}){let l=n;for(let P of dc(s))l=P.preprocess?.call(a,l,s)||l;let{tokens:d,fg:f,bg:h,themeName:g,rootStyle:I,grammarState:b}=mc(t,l,s),{mergeWhitespaces:v=!0,mergeSameStyleTokens:k=!1}=s;if(v===!0)d=WP(d);else if(v==="never")d=XP(d);if(k)d=YP(d);let w={...a,get source(){return l}};for(let P of dc(s))d=P.tokens?.call(w,d)||d;return VP(d,{...s,fg:f,bg:h,themeName:g,rootStyle:s.rootStyle===!1?!1:s.rootStyle??I},w,b)}function VP(t,n,s,a=Hs(t)){let l=dc(n),d=[],f={type:"root",children:[]},{structure:h="classic",tabindex:g="0"}=n,I={class:`shiki ${n.themeName||""}`};if(n.rootStyle!==!1)if(n.rootStyle!=null)I.style=n.rootStyle;else I.style=`background-color:${n.bg};color:${n.fg}`;if(g!==!1&&g!=null)I.tabindex=g.toString();for(let[M,N]of Object.entries(n.meta||{}))if(!M.startsWith("_"))I[M]=N;let b={type:"element",tagName:"pre",properties:I,children:[],data:n.data},v={type:"element",tagName:"code",properties:{},children:d},k=[],w={...s,structure:h,addClassToHast:_x,get source(){return s.source},get tokens(){return t},get options(){return n},get root(){return f},get pre(){return b},get code(){return v},get lines(){return k}};if(t.forEach((M,N)=>{if(N){if(h==="inline")f.children.push({type:"element",tagName:"br",properties:{},children:[]});else if(h==="classic")d.push({type:"text",value:`
|
|
12
|
-
`})}let _={type:"element",tagName:"span",properties:{class:"line"},children:[]},O=0;for(let B of M){let X={type:"element",tagName:"span",properties:{...B.htmlAttrs},children:[{type:"text",value:B.content}]},z=zf(B.htmlStyle||cc(B));if(z)X.properties.style=z;for(let K of l)X=K?.span?.call(w,X,N+1,O,_,B)||X;if(h==="inline")f.children.push(X);else if(h==="classic")_.children.push(X);O+=B.content.length}if(h==="classic"){for(let B of l)_=B?.line?.call(w,_,N+1)||_;k.push(_),d.push(_)}else if(h==="inline")k.push(_)}),h==="classic"){for(let M of l)v=M?.code?.call(w,v)||v;b.children.push(v);for(let M of l)b=M?.pre?.call(w,b)||b;f.children.push(b)}else if(h==="inline"){let M=[],N={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let O of f.children)if(O.type==="element"&&O.tagName==="br")M.push(N),N={type:"element",tagName:"span",properties:{class:"line"},children:[]};else if(O.type==="element"||O.type==="text")N.children.push(O);M.push(N);let _={type:"element",tagName:"code",properties:{},children:M};for(let O of l)_=O?.code?.call(w,_)||_;f.children=[];for(let O=0;O<_.children.length;O++){if(O>0)f.children.push({type:"element",tagName:"br",properties:{},children:[]});let B=_.children[O];if(B.type==="element")f.children.push(...B.children)}}let P=f;for(let M of l)P=M?.root?.call(w,P)||P;if(a)rl(P,a);return P}function WP(t){return t.map((n)=>{let s=[],a="",l;return n.forEach((d,f)=>{let h=!(d.fontStyle&&(d.fontStyle&qn.Underline||d.fontStyle&qn.Strikethrough));if(h&&Fx.test(d.content)&&n[f+1]){if(l===void 0)l=d.offset;a+=d.content}else if(a){if(h)s.push({...d,offset:l,content:a+d.content});else s.push({content:a,offset:l},d);l=void 0,a=""}else s.push(d)}),s})}function XP(t){return t.map((n)=>n.flatMap((s)=>{if(Fx.test(s.content))return s;let a=s.content.match(KP);if(!a)return s;let[,l,d,f]=a;if(!l&&!f)return s;let h=[{...s,offset:s.offset+l.length,content:d}];if(l)h.unshift({content:l,offset:s.offset});if(f)h.push({content:f,offset:s.offset+l.length+d.length});return h}))}function YP(t){return t.map((n)=>{let s=[];for(let a of n){if(s.length===0){s.push({...a});continue}let l=s.at(-1),d=zf(l.htmlStyle||cc(l)),f=zf(a.htmlStyle||cc(a)),h=l.fontStyle&&(l.fontStyle&qn.Underline||l.fontStyle&qn.Strikethrough),g=a.fontStyle&&(a.fontStyle&qn.Underline||a.fontStyle&qn.Strikethrough);if(!h&&!g&&d===f)l.content+=a.content;else s.push({...a})}return s})}var JP=pn;function QP(t,n,s){let a={meta:{},options:s,codeToHast:(d,f)=>fc(t,d,f),codeToTokens:(d,f)=>mc(t,d,f)},l=JP(fc(t,n,s,a));for(let d of dc(s))l=d.postprocess?.call(a,l,s)||l;return l}async function Nx(t){let n=await Rf(t);return{getLastGrammarState:(...s)=>Qy(n,...s),codeToTokensBase:(s,a)=>jf(n,s,a),codeToTokensWithThemes:(s,a)=>ec(n,s,a),codeToTokens:(s,a)=>mc(n,s,a),codeToHast:(s,a)=>fc(n,s,a),codeToHtml:(s,a)=>QP(n,s,a),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...n,getInternalContext:()=>n}}function ZP(t){let n;async function s(a){if(!n)return n=t({...a,themes:a.themes||[],langs:a.langs||[]}),n;else{let l=await n;return await Promise.all([l.loadTheme(...a.themes||[]),l.loadLanguage(...a.langs||[])]),l}}return s}var Aq=ZP(Nx);function Dx(t){let{langs:n,themes:s,engine:a}=t;async function l(d){function f(v){if(typeof v==="string"){if(v=d.langAlias?.[v]||v,kf(v))return[];let k=n[v];if(!k)throw new Lt(`Language \`${v}\` is not included in this bundle. You may want to load it from external source.`);return k}return v}function h(v){if(Tf(v))return"none";if(typeof v==="string"){let k=s[v];if(!k)throw new Lt(`Theme \`${v}\` is not included in this bundle. You may want to load it from external source.`);return k}return v}let g=(d.themes??[]).map((v)=>h(v)),I=(d.langs??[]).map((v)=>f(v)),b=await Nx({engine:d.engine??a(),...d,themes:g,langs:I});return{...b,loadLanguage(...v){return b.loadLanguage(...v.map(f))},loadTheme(...v){return b.loadTheme(...v.map(h))},getBundledLanguages(){return n},getBundledThemes(){return s}}}return l}function eM(t){let n;async function s(a={}){if(!n){n=t({...a,themes:[],langs:[]});let l=await n;return await Promise.all([l.loadTheme(...a.themes||[]),l.loadLanguage(...a.langs||[])]),l}else{let l=await n;return await Promise.all([l.loadTheme(...a.themes||[]),l.loadLanguage(...a.langs||[])]),l}}return s}function Hx(t,n){let s=eM(t);async function a(l,d){let f=await s({langs:[d.lang],themes:"theme"in d?[d.theme]:Object.values(d.themes)}),h=await n?.guessEmbeddedLanguages?.(l,d.lang,f);if(h)await f.loadLanguage(...h);return f}return{getSingletonHighlighter(l){return s(l)},async codeToHtml(l,d){return(await a(l,d)).codeToHtml(l,d)},async codeToHast(l,d){return(await a(l,d)).codeToHast(l,d)},async codeToTokens(l,d){return(await a(l,d)).codeToTokens(l,d)},async codeToTokensBase(l,d){return(await a(l,d)).codeToTokensBase(l,d)},async codeToTokensWithThemes(l,d){return(await a(l,d)).codeToTokensWithThemes(l,d)},async getLastGrammarState(l,d){return(await s({langs:[d.lang],themes:[d.theme]})).getLastGrammarState(l,d)}}}function sl({name:t,load:n,colorScheme:s,collection:a,displayName:l}){return{name:t,colorScheme:s,collection:a,displayName:l,load:tM(n)}}function tM(t){return async()=>Ds(qu(await t()))}var nM="pierre",rM=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],Ux=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],iM=[...Ux,...rM],oM=new Set(Ux);function sM(t){if(oM.has(t))return"light";return"dark"}var aM={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},lM={"pierre-dark":()=>(e("4mgfqqv0"),import("./pierre-dark-4mgfqqv0.js")),"pierre-dark-soft":()=>(e("w7sqrdqg"),import("./pierre-dark-soft-w7sqrdqg.js")),"pierre-dark-vibrant":()=>(e("xbst0r6r"),import("./pierre-dark-vibrant-xbst0r6r.js")),"pierre-dark-protanopia-deuteranopia":()=>(e("dvs8g9s9"),import("./pierre-dark-protanopia-deuteranopia-dvs8g9s9.js")),"pierre-dark-tritanopia":()=>(e("hg031v40"),import("./pierre-dark-tritanopia-hg031v40.js")),"pierre-light":()=>(e("hcqns3mt"),import("./pierre-light-hcqns3mt.js")),"pierre-light-soft":()=>(e("kfyv50pr"),import("./pierre-light-soft-kfyv50pr.js")),"pierre-light-vibrant":()=>(e("4f2kgqvy"),import("./pierre-light-vibrant-4f2kgqvy.js")),"pierre-light-protanopia-deuteranopia":()=>(e("s9tqbsvc"),import("./pierre-light-protanopia-deuteranopia-s9tqbsvc.js")),"pierre-light-tritanopia":()=>(e("x4vh9x60"),import("./pierre-light-tritanopia-x4vh9x60.js"))};function uM(t){return sl({name:t,collection:nM,colorScheme:sM(t),displayName:aM[t],load:lM[t]})}var pc=go({themes:iM.map((t)=>uM(t))});var cM="shiki",Gx=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],dM=["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"],mM=new Set(Gx);function fM(t){if(mM.has(t))return"light";return"dark"}var pM={andromeeda:()=>(e("wg0jqvm9"),import("./andromeeda-wg0jqvm9.js")),"aurora-x":()=>(e("mv0k79bd"),import("./aurora-x-mv0k79bd.js")),"ayu-dark":()=>(e("ghd075yb"),import("./ayu-dark-ghd075yb.js")),"ayu-light":()=>(e("v3ystkk5"),import("./ayu-light-v3ystkk5.js")),"ayu-mirage":()=>(e("vzvzpezs"),import("./ayu-mirage-vzvzpezs.js")),"catppuccin-frappe":()=>(e("znmj0d2m"),import("./catppuccin-frappe-znmj0d2m.js")),"catppuccin-latte":()=>(e("p8aygbzx"),import("./catppuccin-latte-p8aygbzx.js")),"catppuccin-macchiato":()=>(e("f8vwt6tn"),import("./catppuccin-macchiato-f8vwt6tn.js")),"catppuccin-mocha":()=>(e("f5skm0s6"),import("./catppuccin-mocha-f5skm0s6.js")),"dark-plus":()=>(e("m8at7yx7"),import("./dark-plus-m8at7yx7.js")),dracula:()=>(e("4fc9ntns"),import("./dracula-4fc9ntns.js")),"dracula-soft":()=>(e("5q94k618"),import("./dracula-soft-5q94k618.js")),"everforest-dark":()=>(e("d1yfc7p8"),import("./everforest-dark-d1yfc7p8.js")),"everforest-light":()=>(e("8cd74ewt"),import("./everforest-light-8cd74ewt.js")),"github-dark":()=>(e("mm6673p6"),import("./github-dark-mm6673p6.js")),"github-dark-default":()=>(e("mq5awb4z"),import("./github-dark-default-mq5awb4z.js")),"github-dark-dimmed":()=>(e("kt7rv59v"),import("./github-dark-dimmed-kt7rv59v.js")),"github-dark-high-contrast":()=>(e("18jh4rmk"),import("./github-dark-high-contrast-18jh4rmk.js")),"github-light":()=>(e("t2j0qk96"),import("./github-light-t2j0qk96.js")),"github-light-default":()=>(e("knt9ds0k"),import("./github-light-default-knt9ds0k.js")),"github-light-high-contrast":()=>(e("vgqbqnpv"),import("./github-light-high-contrast-vgqbqnpv.js")),"gruvbox-dark-hard":()=>(e("914016cj"),import("./gruvbox-dark-hard-914016cj.js")),"gruvbox-dark-medium":()=>(e("9t6b705s"),import("./gruvbox-dark-medium-9t6b705s.js")),"gruvbox-dark-soft":()=>(e("sdv10jrj"),import("./gruvbox-dark-soft-sdv10jrj.js")),"gruvbox-light-hard":()=>(e("cy4jx512"),import("./gruvbox-light-hard-cy4jx512.js")),"gruvbox-light-medium":()=>(e("5mtfg3dp"),import("./gruvbox-light-medium-5mtfg3dp.js")),"gruvbox-light-soft":()=>(e("015c376k"),import("./gruvbox-light-soft-015c376k.js")),horizon:()=>(e("5588d3zy"),import("./horizon-5588d3zy.js")),"horizon-bright":()=>(e("enf70ntg"),import("./horizon-bright-enf70ntg.js")),houston:()=>(e("ppgd3znr"),import("./houston-ppgd3znr.js")),"kanagawa-dragon":()=>(e("nxvznjva"),import("./kanagawa-dragon-nxvznjva.js")),"kanagawa-lotus":()=>(e("mbgxwth0"),import("./kanagawa-lotus-mbgxwth0.js")),"kanagawa-wave":()=>(e("tqt2pskq"),import("./kanagawa-wave-tqt2pskq.js")),laserwave:()=>(e("fjafvtft"),import("./laserwave-fjafvtft.js")),"light-plus":()=>(e("ay9qb384"),import("./light-plus-ay9qb384.js")),"material-theme":()=>(e("wrbv1ehn"),import("./material-theme-wrbv1ehn.js")),"material-theme-darker":()=>(e("ys1cr5m1"),import("./material-theme-darker-ys1cr5m1.js")),"material-theme-lighter":()=>(e("e1vq84p1"),import("./material-theme-lighter-e1vq84p1.js")),"material-theme-ocean":()=>(e("p0xtkjcq"),import("./material-theme-ocean-p0xtkjcq.js")),"material-theme-palenight":()=>(e("1s5w6vg5"),import("./material-theme-palenight-1s5w6vg5.js")),"min-dark":()=>(e("9kdrynsa"),import("./min-dark-9kdrynsa.js")),"min-light":()=>(e("z3j5w6rx"),import("./min-light-z3j5w6rx.js")),monokai:()=>(e("5jadr7kg"),import("./monokai-5jadr7kg.js")),"night-owl":()=>(e("9r0ckba5"),import("./night-owl-9r0ckba5.js")),"night-owl-light":()=>(e("7ce95fs8"),import("./night-owl-light-7ce95fs8.js")),nord:()=>(e("5xx43938"),import("./nord-5xx43938.js")),"one-dark-pro":()=>(e("rcrka58h"),import("./one-dark-pro-rcrka58h.js")),"one-light":()=>(e("ywjxksww"),import("./one-light-ywjxksww.js")),plastic:()=>(e("jt18dkfd"),import("./plastic-jt18dkfd.js")),poimandres:()=>(e("5barcpw8"),import("./poimandres-5barcpw8.js")),red:()=>(e("8x83g358"),import("./red-8x83g358.js")),"rose-pine":()=>(e("6gb86a0d"),import("./rose-pine-6gb86a0d.js")),"rose-pine-dawn":()=>(e("7fwrfh74"),import("./rose-pine-dawn-7fwrfh74.js")),"rose-pine-moon":()=>(e("3em138qf"),import("./rose-pine-moon-3em138qf.js")),"slack-dark":()=>(e("wp500gq1"),import("./slack-dark-wp500gq1.js")),"slack-ochin":()=>(e("nknyxfxy"),import("./slack-ochin-nknyxfxy.js")),"snazzy-light":()=>(e("eb2am5x1"),import("./snazzy-light-eb2am5x1.js")),"solarized-dark":()=>(e("qk7a6yqw"),import("./solarized-dark-qk7a6yqw.js")),"solarized-light":()=>(e("zdncvbbq"),import("./solarized-light-zdncvbbq.js")),"synthwave-84":()=>(e("ksscxt51"),import("./synthwave-84-ksscxt51.js")),"tokyo-night":()=>(e("8fcm1mvt"),import("./tokyo-night-8fcm1mvt.js")),vesper:()=>(e("9nxespbm"),import("./vesper-9nxespbm.js")),"vitesse-black":()=>(e("93n0yege"),import("./vitesse-black-93n0yege.js")),"vitesse-dark":()=>(e("06e2nv03"),import("./vitesse-dark-06e2nv03.js")),"vitesse-light":()=>(e("gxb5srgm"),import("./vitesse-light-gxb5srgm.js"))};function Bx(t){return sl({name:t,collection:cM,colorScheme:fM(t),load:pM[t]})}var hc=go({themes:Object.freeze([...Gx.map((t)=>Bx(t)),...dM.map((t)=>Bx(t))])});var Xq=go({themes:[pc,hc]});function gc(t){if(Ku())throw Error(`Theme "${t}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(vn.hasRegisteredTheme(t))return;let n=hc.getTheme(t);if(n!=null){vn.registerThemeIfAbsent(n.name,n.load);return}throw Error(`No valid theme loader registered for "${t}"`)}function yc(t,n){if(n.name!==t)throw Error(`resolvedTheme: themeName: ${t} does not match theme.name: ${n.name}`)}async function Ge(t){gc(t);let n=await vn.resolveTheme(t);return yc(t,n),n}var Lr=new Map,xc=new Map,zx=new Map,Gs=new Set;function U(t){for(let n of Array.isArray(t)?t:[t]){if(n==="text"||n==="ansi")continue;if(!Gs.has(n))return!1}return!0}function qf(t,n){t=Array.isArray(t)?t:[t];for(let s of t){if(Gs.has(s.name))continue;let a=Lr.get(s.name);if(a==null)a=s,Lr.set(s.name,a);let l=a.data.find((d)=>d.name===a.name||d.aliases?.includes(a.name)===!0);if(l==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${a.name}" as its name or an alias.`);n.loadLanguageSync(a.data);try{n.getLanguage(a.name)}catch{throw Error(`attachResolvedLanguages: "${l.name}" is already loaded without alias "${a.name}". Load the alias first or give the grammar a unique name.`)}Gs.add(a.name)}}var Ic=[{id:"abap",name:"ABAP",import:()=>(e("v9zztnv2"),import("./abap-v9zztnv2.js"))},{id:"actionscript-3",name:"ActionScript",aliases:["actionscript","as3"],import:()=>(e("rend4f70"),import("./actionscript-3-rend4f70.js"))},{id:"ada",name:"Ada",import:()=>(e("spbz69wz"),import("./ada-spbz69wz.js"))},{id:"ahk",name:"AutoHotkey",aliases:["ahk1"],import:()=>(e("xfr8qz8q"),import("./ahk-xfr8qz8q.js"))},{id:"ahk2",name:"AutoHotkey2",import:()=>(e("1pfwf6n4"),import("./ahk2-1pfwf6n4.js"))},{id:"angular-html",name:"Angular HTML",import:()=>(e("z4fqs47k"),import("./angular-html-z4fqs47k.js"))},{id:"angular-ts",name:"Angular TypeScript",import:()=>(e("wpa0ntyd"),import("./angular-ts-wpa0ntyd.js"))},{id:"apache",name:"Apache Conf",import:()=>(e("yj702sg1"),import("./apache-yj702sg1.js"))},{id:"apex",name:"Apex",import:()=>(e("rxfwy5w1"),import("./apex-rxfwy5w1.js"))},{id:"apl",name:"APL",import:()=>(e("4tz7nbhb"),import("./apl-4tz7nbhb.js"))},{id:"applescript",name:"AppleScript",import:()=>(e("vyd7bkgm"),import("./applescript-vyd7bkgm.js"))},{id:"ara",name:"Ara",import:()=>(e("adbqgrjb"),import("./ara-adbqgrjb.js"))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>(e("t5y04cmt"),import("./asciidoc-t5y04cmt.js"))},{id:"asm",name:"Assembly",import:()=>(e("rwycywwf"),import("./asm-rwycywwf.js"))},{id:"astro",name:"Astro",import:()=>(e("95kf8zcf"),import("./astro-95kf8zcf.js"))},{id:"awk",name:"AWK",import:()=>(e("q2zme0ge"),import("./awk-q2zme0ge.js"))},{id:"ballerina",name:"Ballerina",import:()=>(e("6t0f78k9"),import("./ballerina-6t0f78k9.js"))},{id:"bat",name:"Batch File",aliases:["batch","cmd"],import:()=>(e("4986hex0"),import("./bat-4986hex0.js"))},{id:"beancount",name:"Beancount",import:()=>(e("gj14bxxv"),import("./beancount-gj14bxxv.js"))},{id:"berry",name:"Berry",aliases:["be"],import:()=>(e("nv4mppwp"),import("./berry-nv4mppwp.js"))},{id:"bibtex",name:"BibTeX",import:()=>(e("n2nhe0wx"),import("./bibtex-n2nhe0wx.js"))},{id:"bicep",name:"Bicep",import:()=>(e("nn9md6rb"),import("./bicep-nn9md6rb.js"))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:()=>(e("s821k3bw"),import("./bird2-s821k3bw.js"))},{id:"blade",name:"Blade",import:()=>(e("f74rx037"),import("./blade-f74rx037.js"))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>(e("ekqr89hb"),import("./bsl-ekqr89hb.js"))},{id:"c",name:"C",import:()=>(e("crm6zbmg"),import("./c-crm6zbmg.js"))},{id:"c3",name:"C3",import:()=>(e("19a99jet"),import("./c3-19a99jet.js"))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>(e("je337d9r"),import("./cadence-je337d9r.js"))},{id:"cairo",name:"Cairo",import:()=>(e("19n4vg8f"),import("./cairo-19n4vg8f.js"))},{id:"chapel",name:"Chapel",aliases:["chpl"],import:()=>(e("pgf3hgyg"),import("./chapel-pgf3hgyg.js"))},{id:"clarity",name:"Clarity",import:()=>(e("f6q9m3km"),import("./clarity-f6q9m3km.js"))},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>(e("q3w3rnbx"),import("./clojure-q3w3rnbx.js"))},{id:"cmake",name:"CMake",import:()=>(e("86bharq9"),import("./cmake-86bharq9.js"))},{id:"cobol",name:"COBOL",import:()=>(e("8zy7bwxd"),import("./cobol-8zy7bwxd.js"))},{id:"codeowners",name:"CODEOWNERS",import:()=>(e("n2ta4c94"),import("./codeowners-n2ta4c94.js"))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>(e("kdz1nqdn"),import("./codeql-kdz1nqdn.js"))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>(e("21p5hc0f"),import("./coffee-21p5hc0f.js"))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>(e("2yynsm2j"),import("./common-lisp-2yynsm2j.js"))},{id:"coq",name:"Rocq",import:()=>(e("m2ph7shf"),import("./coq-m2ph7shf.js"))},{id:"cpp",name:"C++",aliases:["c++"],import:()=>(e("pwzcj5qg"),import("./cpp-pwzcj5qg.js"))},{id:"crystal",name:"Crystal",import:()=>(e("mp6v15at"),import("./crystal-mp6v15at.js"))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>(e("7r279f07"),import("./csharp-7r279f07.js"))},{id:"css",name:"CSS",import:()=>(e("t2rfx939"),import("./css-t2rfx939.js"))},{id:"csv",name:"CSV",import:()=>(e("kzar1n4v"),import("./csv-kzar1n4v.js"))},{id:"cue",name:"CUE",import:()=>(e("3tvhth3f"),import("./cue-3tvhth3f.js"))},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>(e("0w0hkger"),import("./cypher-0w0hkger.js"))},{id:"d",name:"D",import:()=>(e("ddd3mfwv"),import("./d-ddd3mfwv.js"))},{id:"dart",name:"Dart",import:()=>(e("9bqb7q92"),import("./dart-9bqb7q92.js"))},{id:"dax",name:"DAX",import:()=>(e("n84494pa"),import("./dax-n84494pa.js"))},{id:"desktop",name:"Desktop",import:()=>(e("mgp42r9a"),import("./desktop-mgp42r9a.js"))},{id:"diff",name:"Diff",import:()=>(e("13j86cjk"),import("./diff-13j86cjk.js"))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>(e("v24nexj8"),import("./docker-v24nexj8.js"))},{id:"dotenv",name:"dotEnv",import:()=>(e("kz2m1he0"),import("./dotenv-kz2m1he0.js"))},{id:"dream-maker",name:"Dream Maker",import:()=>(e("ddcw1pkg"),import("./dream-maker-ddcw1pkg.js"))},{id:"edge",name:"Edge",import:()=>(e("fecan6xm"),import("./edge-fecan6xm.js"))},{id:"elixir",name:"Elixir",import:()=>(e("5kgxba97"),import("./elixir-5kgxba97.js"))},{id:"elm",name:"Elm",import:()=>(e("hy42zyg1"),import("./elm-hy42zyg1.js"))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>(e("fevh7w6r"),import("./emacs-lisp-fevh7w6r.js"))},{id:"erb",name:"ERB",import:()=>(e("ssgyt8yk"),import("./erb-ssgyt8yk.js"))},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>(e("8yqvhztk"),import("./erlang-8yqvhztk.js"))},{id:"fennel",name:"Fennel",import:()=>(e("r83cvyb2"),import("./fennel-r83cvyb2.js"))},{id:"fish",name:"Fish",import:()=>(e("3p5cq65q"),import("./fish-3p5cq65q.js"))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>(e("dgf1xd34"),import("./fluent-dgf1xd34.js"))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>(e("yqrdwjab"),import("./fortran-fixed-form-yqrdwjab.js"))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>(e("4tb589s6"),import("./fortran-free-form-4tb589s6.js"))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>(e("5v62w2jq"),import("./fsharp-5v62w2jq.js"))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:()=>(e("4fj86xjd"),import("./gdresource-4fj86xjd.js"))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:()=>(e("4h1shwqj"),import("./gdscript-4h1shwqj.js"))},{id:"gdshader",name:"GDShader",import:()=>(e("5za4a2j9"),import("./gdshader-5za4a2j9.js"))},{id:"genie",name:"Genie",import:()=>(e("0g0rveqm"),import("./genie-0g0rveqm.js"))},{id:"gherkin",name:"Gherkin",import:()=>(e("x9mbetch"),import("./gherkin-x9mbetch.js"))},{id:"git-commit",name:"Git Commit Message",import:()=>(e("tgh7eq9c"),import("./git-commit-tgh7eq9c.js"))},{id:"git-rebase",name:"Git Rebase Message",import:()=>(e("q3rpjbyz"),import("./git-rebase-q3rpjbyz.js"))},{id:"gleam",name:"Gleam",import:()=>(e("9kv9z5ay"),import("./gleam-9kv9z5ay.js"))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>(e("9h9h16am"),import("./glimmer-js-9h9h16am.js"))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>(e("0k5s1v2h"),import("./glimmer-ts-0k5s1v2h.js"))},{id:"glsl",name:"GLSL",import:()=>(e("mmrej8st"),import("./glsl-mmrej8st.js"))},{id:"gn",name:"GN",import:()=>(e("kd98cxzg"),import("./gn-kd98cxzg.js"))},{id:"gnuplot",name:"Gnuplot",import:()=>(e("8t392p99"),import("./gnuplot-8t392p99.js"))},{id:"go",name:"Go",import:()=>(e("3m0kqn3p"),import("./go-3m0kqn3p.js"))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>(e("ddq2qt0v"),import("./graphql-ddq2qt0v.js"))},{id:"groovy",name:"Groovy",import:()=>(e("hcqzjh1n"),import("./groovy-hcqzjh1n.js"))},{id:"hack",name:"Hack",import:()=>(e("r0517j09"),import("./hack-r0517j09.js"))},{id:"haml",name:"Ruby Haml",import:()=>(e("vsp7hh3f"),import("./haml-vsp7hh3f.js"))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>(e("59gn5dj7"),import("./handlebars-59gn5dj7.js"))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>(e("bydw5m21"),import("./haskell-bydw5m21.js"))},{id:"haxe",name:"Haxe",import:()=>(e("zvpwvpvn"),import("./haxe-zvpwvpvn.js"))},{id:"hcl",name:"HashiCorp HCL",import:()=>(e("e92k9k77"),import("./hcl-e92k9k77.js"))},{id:"hjson",name:"Hjson",import:()=>(e("k4xzehbj"),import("./hjson-k4xzehbj.js"))},{id:"hlsl",name:"HLSL",import:()=>(e("svktsk04"),import("./hlsl-svktsk04.js"))},{id:"html",name:"HTML",import:()=>(e("fbn2078w"),import("./html-fbn2078w.js"))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>(e("vpadkpjz"),import("./html-derivative-vpadkpjz.js"))},{id:"http",name:"HTTP",import:()=>(e("q7kc4tj6"),import("./http-q7kc4tj6.js"))},{id:"hurl",name:"Hurl",import:()=>(e("megk96q7"),import("./hurl-megk96q7.js"))},{id:"hxml",name:"HXML",import:()=>(e("6ch21be5"),import("./hxml-6ch21be5.js"))},{id:"hy",name:"Hy",import:()=>(e("ar1v5vng"),import("./hy-ar1v5vng.js"))},{id:"imba",name:"Imba",import:()=>(e("8w1tr2yq"),import("./imba-8w1tr2yq.js"))},{id:"ini",name:"INI",aliases:["properties"],import:()=>(e("v269qqbk"),import("./ini-v269qqbk.js"))},{id:"java",name:"Java",import:()=>(e("08891286"),import("./java-08891286.js"))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>(e("c9kyad61"),import("./javascript-c9kyad61.js"))},{id:"jinja",name:"Jinja",import:()=>(e("54ggdj1m"),import("./jinja-54ggdj1m.js"))},{id:"jison",name:"Jison",import:()=>(e("j783t39n"),import("./jison-j783t39n.js"))},{id:"json",name:"JSON",import:()=>(e("g47q5a3x"),import("./json-g47q5a3x.js"))},{id:"json5",name:"JSON5",import:()=>(e("htnawg0s"),import("./json5-htnawg0s.js"))},{id:"jsonc",name:"JSON with Comments",import:()=>(e("ssb35fmp"),import("./jsonc-ssb35fmp.js"))},{id:"jsonl",name:"JSON Lines",import:()=>(e("cta2wnj7"),import("./jsonl-cta2wnj7.js"))},{id:"jsonnet",name:"Jsonnet",import:()=>(e("y8sfefcj"),import("./jsonnet-y8sfefcj.js"))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>(e("ar9p95ya"),import("./jssm-ar9p95ya.js"))},{id:"jsx",name:"JSX",import:()=>(e("9ct7s1py"),import("./jsx-9ct7s1py.js"))},{id:"julia",name:"Julia",aliases:["jl"],import:()=>(e("mgfk32ya"),import("./julia-mgfk32ya.js"))},{id:"just",name:"Just",aliases:["justfile"],import:()=>(e("rjtrh43a"),import("./just-rjtrh43a.js"))},{id:"kdl",name:"KDL",import:()=>(e("fex1syf1"),import("./kdl-fex1syf1.js"))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>(e("t27dc445"),import("./kotlin-t27dc445.js"))},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>(e("rdyq38zq"),import("./kusto-rdyq38zq.js"))},{id:"latex",name:"LaTeX",import:()=>(e("xha4wvvc"),import("./latex-xha4wvvc.js"))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>(e("0c7zvz88"),import("./lean-0c7zvz88.js"))},{id:"less",name:"Less",import:()=>(e("ekqk42nj"),import("./less-ekqk42nj.js"))},{id:"liquid",name:"Liquid",import:()=>(e("w18z4eby"),import("./liquid-w18z4eby.js"))},{id:"llvm",name:"LLVM IR",import:()=>(e("r5dkm1jm"),import("./llvm-r5dkm1jm.js"))},{id:"log",name:"Log file",import:()=>(e("jnggnqka"),import("./log-jnggnqka.js"))},{id:"logo",name:"Logo",import:()=>(e("t7pt3vzb"),import("./logo-t7pt3vzb.js"))},{id:"lua",name:"Lua",import:()=>(e("m7dk4azp"),import("./lua-m7dk4azp.js"))},{id:"luau",name:"Luau",import:()=>(e("t1tnzmg4"),import("./luau-t1tnzmg4.js"))},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>(e("ccgc3g99"),import("./make-ccgc3g99.js"))},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>(e("m9wpbj55"),import("./markdown-m9wpbj55.js"))},{id:"marko",name:"Marko",import:()=>(e("mz0wgv09"),import("./marko-mz0wgv09.js"))},{id:"matlab",name:"MATLAB",import:()=>(e("ajtwd8mv"),import("./matlab-ajtwd8mv.js"))},{id:"mdc",name:"MDC",import:()=>(e("8fzqn2ra"),import("./mdc-8fzqn2ra.js"))},{id:"mdx",name:"MDX",import:()=>(e("z02tv5ym"),import("./mdx-z02tv5ym.js"))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>(e("wczz61sj"),import("./mermaid-wczz61sj.js"))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>(e("914dckvv"),import("./mipsasm-914dckvv.js"))},{id:"mojo",name:"Mojo",import:()=>(e("w6n7h2t6"),import("./mojo-w6n7h2t6.js"))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>(e("3ebyydj8"),import("./moonbit-3ebyydj8.js"))},{id:"move",name:"Move",import:()=>(e("5208ftg3"),import("./move-5208ftg3.js"))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>(e("1692t78j"),import("./narrat-1692t78j.js"))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>(e("vsm9mewk"),import("./nextflow-vsm9mewk.js"))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:()=>(e("b4w15vkr"),import("./nextflow-groovy-b4w15vkr.js"))},{id:"nginx",name:"Nginx",import:()=>(e("0zpcaqmv"),import("./nginx-0zpcaqmv.js"))},{id:"nim",name:"Nim",import:()=>(e("rjrps4r1"),import("./nim-rjrps4r1.js"))},{id:"nix",name:"Nix",import:()=>(e("xmvyr3v2"),import("./nix-xmvyr3v2.js"))},{id:"nsis",name:"NSIS",import:()=>(e("y9q5tf9c"),import("./nsis-y9q5tf9c.js"))},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>(e("m3q56d2j"),import("./nushell-m3q56d2j.js"))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>(e("f77fv246"),import("./objective-c-f77fv246.js"))},{id:"objective-cpp",name:"Objective-C++",import:()=>(e("sgxrjcg1"),import("./objective-cpp-sgxrjcg1.js"))},{id:"ocaml",name:"OCaml",import:()=>(e("yt0kq4b3"),import("./ocaml-yt0kq4b3.js"))},{id:"odin",name:"Odin",import:()=>(e("jnrmxydw"),import("./odin-jnrmxydw.js"))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>(e("03s49fa7"),import("./openscad-03s49fa7.js"))},{id:"org",name:"Org Markup",import:()=>(e("41f97gct"),import("./org-41f97gct.js"))},{id:"pascal",name:"Pascal",import:()=>(e("q9kebwbt"),import("./pascal-q9kebwbt.js"))},{id:"perl",name:"Perl",import:()=>(e("y7kpcnmy"),import("./perl-y7kpcnmy.js"))},{id:"php",name:"PHP",import:()=>(e("qhnmwt67"),import("./php-qhnmwt67.js"))},{id:"pkl",name:"Pkl",import:()=>(e("af4va0yb"),import("./pkl-af4va0yb.js"))},{id:"plsql",name:"PL/SQL",import:()=>(e("zqt98gm4"),import("./plsql-zqt98gm4.js"))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>(e("acj27vh2"),import("./po-acj27vh2.js"))},{id:"polar",name:"Polar",import:()=>(e("12pt2ejq"),import("./polar-12pt2ejq.js"))},{id:"postcss",name:"PostCSS",import:()=>(e("xtvzpbp0"),import("./postcss-xtvzpbp0.js"))},{id:"powerquery",name:"PowerQuery",import:()=>(e("fcfjpawf"),import("./powerquery-fcfjpawf.js"))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1","pwsh"],import:()=>(e("8cv2gpfc"),import("./powershell-8cv2gpfc.js"))},{id:"prisma",name:"Prisma",import:()=>(e("1ww1ftj6"),import("./prisma-1ww1ftj6.js"))},{id:"prolog",name:"Prolog",import:()=>(e("pyt3g0dv"),import("./prolog-pyt3g0dv.js"))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>(e("5jn838mr"),import("./proto-5jn838mr.js"))},{id:"pug",name:"Pug",aliases:["jade"],import:()=>(e("s4e1p0x9"),import("./pug-s4e1p0x9.js"))},{id:"puppet",name:"Puppet",import:()=>(e("kffv3erv"),import("./puppet-kffv3erv.js"))},{id:"purescript",name:"PureScript",import:()=>(e("58gvwc47"),import("./purescript-58gvwc47.js"))},{id:"python",name:"Python",aliases:["py"],import:()=>(e("5jqjsqct"),import("./python-5jqjsqct.js"))},{id:"qml",name:"QML",import:()=>(e("zs7srp3c"),import("./qml-zs7srp3c.js"))},{id:"qmldir",name:"QML Directory",import:()=>(e("a9c26xfg"),import("./qmldir-a9c26xfg.js"))},{id:"qss",name:"Qt Style Sheets",import:()=>(e("5ggszvyp"),import("./qss-5ggszvyp.js"))},{id:"r",name:"R",import:()=>(e("hj5v5z9g"),import("./r-hj5v5z9g.js"))},{id:"racket",name:"Racket",import:()=>(e("k7w53tcs"),import("./racket-k7w53tcs.js"))},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>(e("r7t0wsvd"),import("./raku-r7t0wsvd.js"))},{id:"razor",name:"ASP.NET Razor",import:()=>(e("ja2vmp26"),import("./razor-ja2vmp26.js"))},{id:"rbs",name:"RBS",aliases:["ruby-signature"],import:()=>(e("dxm66dww"),import("./rbs-dxm66dww.js"))},{id:"reg",name:"Windows Registry Script",import:()=>(e("pf0vhy79"),import("./reg-pf0vhy79.js"))},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>(e("nrbm9kkc"),import("./regexp-nrbm9kkc.js"))},{id:"rel",name:"Rel",import:()=>(e("4daxvj43"),import("./rel-4daxvj43.js"))},{id:"riscv",name:"RISC-V",import:()=>(e("jhp8r03y"),import("./riscv-jhp8r03y.js"))},{id:"ron",name:"RON",import:()=>(e("d5wnwe3b"),import("./ron-d5wnwe3b.js"))},{id:"rosmsg",name:"ROS Interface",import:()=>(e("xj3jz1r9"),import("./rosmsg-xj3jz1r9.js"))},{id:"rst",name:"reStructuredText",import:()=>(e("qgaks9ys"),import("./rst-qgaks9ys.js"))},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>(e("10gnpa9m"),import("./ruby-10gnpa9m.js"))},{id:"rust",name:"Rust",aliases:["rs"],import:()=>(e("azbn31pd"),import("./rust-azbn31pd.js"))},{id:"sas",name:"SAS",import:()=>(e("74xzp6gp"),import("./sas-74xzp6gp.js"))},{id:"sass",name:"Sass",import:()=>(e("r1mzskwd"),import("./sass-r1mzskwd.js"))},{id:"scala",name:"Scala",import:()=>(e("e28dqbjh"),import("./scala-e28dqbjh.js"))},{id:"scheme",name:"Scheme",import:()=>(e("ersa4nxy"),import("./scheme-ersa4nxy.js"))},{id:"scss",name:"SCSS",import:()=>(e("h44zmxs9"),import("./scss-h44zmxs9.js"))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>(e("rw2b1wff"),import("./sdbl-rw2b1wff.js"))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>(e("qdakc6m7"),import("./shaderlab-qdakc6m7.js"))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>(e("pa08q251"),import("./shellscript-pa08q251.js"))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>(e("4kzj1fbj"),import("./shellsession-4kzj1fbj.js"))},{id:"smalltalk",name:"GNU Smalltalk",import:()=>(e("53b6hvg0"),import("./smalltalk-53b6hvg0.js"))},{id:"smithy",name:"Smithy",import:()=>(e("fgjwefsv"),import("./smithy-fgjwefsv.js"))},{id:"solidity",name:"Solidity",import:()=>(e("4xgc8v0p"),import("./solidity-4xgc8v0p.js"))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>(e("y2ne3k1g"),import("./soy-y2ne3k1g.js"))},{id:"sparql",name:"SPARQL",import:()=>(e("hrn3zm8y"),import("./sparql-hrn3zm8y.js"))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>(e("zcht3ttv"),import("./splunk-zcht3ttv.js"))},{id:"sql",name:"SQL",import:()=>(e("etbwe74e"),import("./sql-etbwe74e.js"))},{id:"ssh-config",name:"SSH Config",import:()=>(e("d0ty6y19"),import("./ssh-config-d0ty6y19.js"))},{id:"stata",name:"Stata",import:()=>(e("r52wae6s"),import("./stata-r52wae6s.js"))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>(e("051daetz"),import("./stylus-051daetz.js"))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:()=>(e("vw9k2yst"),import("./surrealql-vw9k2yst.js"))},{id:"svelte",name:"Svelte",import:()=>(e("xke2awzd"),import("./svelte-xke2awzd.js"))},{id:"swift",name:"Swift",import:()=>(e("c3wmm92e"),import("./swift-c3wmm92e.js"))},{id:"system-verilog",name:"SystemVerilog",import:()=>(e("cysaabmv"),import("./system-verilog-cysaabmv.js"))},{id:"systemd",name:"Systemd Units",import:()=>(e("debgc0xf"),import("./systemd-debgc0xf.js"))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>(e("xtcfkwwv"),import("./talonscript-xtcfkwwv.js"))},{id:"tasl",name:"Tasl",import:()=>(e("0805m303"),import("./tasl-0805m303.js"))},{id:"tcl",name:"Tcl",import:()=>(e("681ts9sc"),import("./tcl-681ts9sc.js"))},{id:"templ",name:"Templ",import:()=>(e("ygv4mpks"),import("./templ-ygv4mpks.js"))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>(e("em9vczt8"),import("./terraform-em9vczt8.js"))},{id:"tex",name:"TeX",import:()=>(e("yj0j713p"),import("./tex-yj0j713p.js"))},{id:"toml",name:"TOML",import:()=>(e("z4gdpbjt"),import("./toml-z4gdpbjt.js"))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>(e("5c023h24"),import("./ts-tags-5c023h24.js"))},{id:"tsv",name:"TSV",import:()=>(e("dr4chrhc"),import("./tsv-dr4chrhc.js"))},{id:"tsx",name:"TSX",import:()=>(e("e4j5thds"),import("./tsx-e4j5thds.js"))},{id:"turtle",name:"Turtle",import:()=>(e("am0wf2w4"),import("./turtle-am0wf2w4.js"))},{id:"twig",name:"Twig",import:()=>(e("1rd58h0d"),import("./twig-1rd58h0d.js"))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>(e("mqwe73n5"),import("./typescript-mqwe73n5.js"))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>(e("g3mhq5bb"),import("./typespec-g3mhq5bb.js"))},{id:"typst",name:"Typst",aliases:["typ"],import:()=>(e("pg1czsjz"),import("./typst-pg1czsjz.js"))},{id:"v",name:"V",import:()=>(e("f74jgk7j"),import("./v-f74jgk7j.js"))},{id:"vala",name:"Vala",import:()=>(e("smcm9afx"),import("./vala-smcm9afx.js"))},{id:"vb",name:"Visual Basic",import:()=>(e("pxn2t506"),import("./vb-pxn2t506.js"))},{id:"verilog",name:"Verilog",import:()=>(e("1bxyw8xv"),import("./verilog-1bxyw8xv.js"))},{id:"vhdl",name:"VHDL",import:()=>(e("kwccd285"),import("./vhdl-kwccd285.js"))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>(e("tq8eww09"),import("./viml-tq8eww09.js"))},{id:"vue",name:"Vue",import:()=>(e("ezkjk5e2"),import("./vue-ezkjk5e2.js"))},{id:"vue-html",name:"Vue HTML",import:()=>(e("ct5jzs45"),import("./vue-html-ct5jzs45.js"))},{id:"vue-vine",name:"Vue Vine",import:()=>(e("d46tfy6m"),import("./vue-vine-d46tfy6m.js"))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>(e("af81wz1j"),import("./vyper-af81wz1j.js"))},{id:"wasm",name:"WebAssembly",import:()=>(e("7m7s4wz7"),import("./wasm-7m7s4wz7.js"))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>(e("24cpw9ac"),import("./wenyan-24cpw9ac.js"))},{id:"wgsl",name:"WGSL",import:()=>(e("4bnwg8k2"),import("./wgsl-4bnwg8k2.js"))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>(e("eptnvn3e"),import("./wikitext-eptnvn3e.js"))},{id:"wit",name:"WebAssembly Interface Types",import:()=>(e("qhkwv0tf"),import("./wit-qhkwv0tf.js"))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>(e("v5pfp432"),import("./wolfram-v5pfp432.js"))},{id:"xml",name:"XML",import:()=>(e("4stg7cdn"),import("./xml-4stg7cdn.js"))},{id:"xsl",name:"XSL",import:()=>(e("e2ernnxm"),import("./xsl-e2ernnxm.js"))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>(e("pv4shv7v"),import("./yaml-pv4shv7v.js"))},{id:"zenscript",name:"ZenScript",import:()=>(e("knxz1bhv"),import("./zenscript-knxz1bhv.js"))},{id:"zig",name:"Zig",import:()=>(e("rdjds834"),import("./zig-rdjds834.js"))}],Kf=Object.fromEntries(Ic.map((t)=>[t.id,t.import])),Vf=Object.fromEntries(Ic.flatMap((t)=>t.aliases?.map((n)=>[n,t.import])||[])),zs={...Kf,...Vf};var Jf={};De(Jf,{createOnigurumaEngine:()=>Ec,getDefaultWasmLoader:()=>AM,loadWasm:()=>Yf,setDefaultWasmLoader:()=>LM});var Xf=class extends Error{constructor(t){super(t);this.name="ShikiError"}};function hM(){return 2147483648}function gM(){return typeof performance<"u"?performance.now():Date.now()}var yM=(t,n)=>t+(n-t%n)%n;async function xM(t){let n,s,a={};function l(w){s=w,a.HEAPU8=new Uint8Array(w),a.HEAPU32=new Uint32Array(w)}function d(w,P,M){a.HEAPU8.copyWithin(w,P,P+M)}function f(w){try{return n.grow(w-s.byteLength+65535>>>16),l(n.buffer),1}catch{}}function h(w){let P=a.HEAPU8.length;w=w>>>0;let M=hM();if(w>M)return!1;for(let N=1;N<=4;N*=2){let _=P*(1+0.2/N);_=Math.min(_,w+100663296);let O=Math.min(M,yM(Math.max(w,_),65536));if(f(O))return!0}return!1}let g=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function I(w,P,M=1024){let N=P+M,_=P;while(w[_]&&!(_>=N))++_;if(_-P>16&&w.buffer&&g)return g.decode(w.subarray(P,_));let O="";while(P<_){let B=w[P++];if(!(B&128)){O+=String.fromCharCode(B);continue}let X=w[P++]&63;if((B&224)===192){O+=String.fromCharCode((B&31)<<6|X);continue}let z=w[P++]&63;if((B&240)===224)B=(B&15)<<12|X<<6|z;else B=(B&7)<<18|X<<12|z<<6|w[P++]&63;if(B<65536)O+=String.fromCharCode(B);else{let K=B-65536;O+=String.fromCharCode(55296|K>>10,56320|K&1023)}}return O}function b(w,P){return w?I(a.HEAPU8,w,P):""}let v={emscripten_get_now:gM,emscripten_memcpy_big:d,emscripten_resize_heap:h,fd_write:()=>0};async function k(){let P=await t({env:v,wasi_snapshot_preview1:v});n=P.memory,l(n.buffer),Object.assign(a,P),a.UTF8ToString=b}return await k(),a}var IM=Object.defineProperty,SM=(t,n,s)=>(n in t)?IM(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s,$n=(t,n,s)=>SM(t,typeof n!=="symbol"?n+"":n,s),Bn=null;function bM(t){throw new Xf(t.UTF8ToString(t.getLastOnigError()))}class bc{constructor(t){$n(this,"utf16Length"),$n(this,"utf8Length"),$n(this,"utf16Value"),$n(this,"utf8Value"),$n(this,"utf16OffsetToUtf8"),$n(this,"utf8OffsetToUtf16");let n=t.length,s=bc._utf8ByteLength(t),a=s!==n,l=a?new Uint32Array(n+1):null;if(a)l[n]=s;let d=a?new Uint32Array(s+1):null;if(a)d[s]=n;let f=new Uint8Array(s),h=0;for(let g=0;g<n;g++){let I=t.charCodeAt(g),b=I,v=!1;if(I>=55296&&I<=56319){if(g+1<n){let k=t.charCodeAt(g+1);if(k>=56320&&k<=57343)b=(I-55296<<10)+65536|k-56320,v=!0}}if(a){if(l[g]=h,v)l[g+1]=h;if(b<=127)d[h+0]=g;else if(b<=2047)d[h+0]=g,d[h+1]=g;else if(b<=65535)d[h+0]=g,d[h+1]=g,d[h+2]=g;else d[h+0]=g,d[h+1]=g,d[h+2]=g,d[h+3]=g}if(b<=127)f[h++]=b;else if(b<=2047)f[h++]=192|(b&1984)>>>6,f[h++]=128|(b&63)>>>0;else if(b<=65535)f[h++]=224|(b&61440)>>>12,f[h++]=128|(b&4032)>>>6,f[h++]=128|(b&63)>>>0;else f[h++]=240|(b&1835008)>>>18,f[h++]=128|(b&258048)>>>12,f[h++]=128|(b&4032)>>>6,f[h++]=128|(b&63)>>>0;if(v)g++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=f,this.utf16OffsetToUtf8=l,this.utf8OffsetToUtf16=d}static _utf8ByteLength(t){let n=0;for(let s=0,a=t.length;s<a;s++){let l=t.charCodeAt(s),d=l,f=!1;if(l>=55296&&l<=56319){if(s+1<a){let h=t.charCodeAt(s+1);if(h>=56320&&h<=57343)d=(l-55296<<10)+65536|h-56320,f=!0}}if(d<=127)n+=1;else if(d<=2047)n+=2;else if(d<=65535)n+=3;else n+=4;if(f)s++}return n}createString(t){let n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}var Cc=class t{constructor(n){if($n(this,"id",++t.LAST_ID),$n(this,"_onigBinding"),$n(this,"content"),$n(this,"utf16Length"),$n(this,"utf8Length"),$n(this,"utf16OffsetToUtf8"),$n(this,"utf8OffsetToUtf16"),$n(this,"ptr"),!Bn)throw new Xf("Must invoke loadWasm first.");this._onigBinding=Bn,this.content=n;let s=new bc(n);if(this.utf16Length=s.utf16Length,this.utf8Length=s.utf8Length,this.utf16OffsetToUtf8=s.utf16OffsetToUtf8,this.utf8OffsetToUtf16=s.utf8OffsetToUtf16,this.utf8Length<1e4&&!t._sharedPtrInUse){if(!t._sharedPtr)t._sharedPtr=Bn.omalloc(1e4);t._sharedPtrInUse=!0,Bn.HEAPU8.set(s.utf8Value,t._sharedPtr),this.ptr=t._sharedPtr}else this.ptr=s.createString(Bn)}convertUtf8OffsetToUtf16(n){if(this.utf8OffsetToUtf16){if(n<0)return 0;if(n>this.utf8Length)return this.utf16Length;return this.utf8OffsetToUtf16[n]}return n}convertUtf16OffsetToUtf8(n){if(this.utf16OffsetToUtf8){if(n<0)return 0;if(n>this.utf16Length)return this.utf8Length;return this.utf16OffsetToUtf8[n]}return n}dispose(){if(this.ptr===t._sharedPtr)t._sharedPtrInUse=!1;else this._onigBinding.ofree(this.ptr)}};$n(Cc,"LAST_ID",0);$n(Cc,"_sharedPtr",0);$n(Cc,"_sharedPtrInUse",!1);var jx=Cc;class qx{constructor(t){if($n(this,"_onigBinding"),$n(this,"_ptr"),!Bn)throw new Xf("Must invoke loadWasm first.");let n=[],s=[];for(let f=0,h=t.length;f<h;f++){let g=new bc(t[f]);n[f]=g.createString(Bn),s[f]=g.utf8Length}let a=Bn.omalloc(4*t.length);Bn.HEAPU32.set(n,a/4);let l=Bn.omalloc(4*t.length);Bn.HEAPU32.set(s,l/4);let d=Bn.createOnigScanner(a,l,t.length);for(let f=0,h=t.length;f<h;f++)Bn.ofree(n[f]);if(Bn.ofree(l),Bn.ofree(a),d===0)bM(Bn);this._onigBinding=Bn,this._ptr=d}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,s){let a=0;if(typeof s==="number")a=s;if(typeof t==="string"){t=new jx(t);let l=this._findNextMatchSync(t,n,!1,a);return t.dispose(),l}return this._findNextMatchSync(t,n,!1,a)}_findNextMatchSync(t,n,s,a){let l=this._onigBinding,d=l.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),a);if(d===0)return null;let f=l.HEAPU32,h=d/4,g=f[h++],I=f[h++],b=[];for(let v=0;v<I;v++){let k=t.convertUtf8OffsetToUtf16(f[h++]),w=t.convertUtf8OffsetToUtf16(f[h++]);b[v]={start:k,end:w,length:w-k}}return{index:g,captureIndices:b}}}function CM(t){return typeof t.instantiator==="function"}function EM(t){return typeof t.default==="function"}function vM(t){return typeof t.data<"u"}function kM(t){return typeof Response<"u"&&t instanceof Response}function TM(t){return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&Buffer.isBuffer?.(t)||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}var Sc;function Yf(t){if(Sc)return Sc;async function n(){Bn=await xM(async(s)=>{let a=t;if(a=await a,typeof a==="function")a=await a(s);if(typeof a==="function")a=await a(s);if(CM(a))a=await a.instantiator(s);else if(EM(a))a=await a.default(s);else{if(vM(a))a=a.data;if(kM(a))if(typeof WebAssembly.instantiateStreaming==="function")a=await wM(a)(s);else a=await RM(a)(s);else if(TM(a))a=await Wf(a)(s);else if(a instanceof WebAssembly.Module)a=await Wf(a)(s);else if("default"in a&&a.default instanceof WebAssembly.Module)a=await Wf(a.default)(s)}if("instance"in a)a=a.instance;if("exports"in a)a=a.exports;return a})}return Sc=n(),Sc}function Wf(t){return(n)=>WebAssembly.instantiate(t,n)}function wM(t){return(n)=>WebAssembly.instantiateStreaming(t,n)}function RM(t){return async(n)=>{let s=await t.arrayBuffer();return WebAssembly.instantiate(s,n)}}var Kx;function LM(t){Kx=t}function AM(){return Kx}async function Ec(t){if(t)await Yf(t);return{createScanner(n){return new qx(n.map((s)=>typeof s==="string"?s:s.source))},createString(n){return new jx(n)}}}var Qf=hy({});gy(Qf,Jf);var Vx=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>(e("wg0jqvm9"),import("./andromeeda-wg0jqvm9.js"))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>(e("mv0k79bd"),import("./aurora-x-mv0k79bd.js"))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>(e("ghd075yb"),import("./ayu-dark-ghd075yb.js"))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:()=>(e("v3ystkk5"),import("./ayu-light-v3ystkk5.js"))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:()=>(e("vzvzpezs"),import("./ayu-mirage-vzvzpezs.js"))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>(e("znmj0d2m"),import("./catppuccin-frappe-znmj0d2m.js"))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>(e("p8aygbzx"),import("./catppuccin-latte-p8aygbzx.js"))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>(e("f8vwt6tn"),import("./catppuccin-macchiato-f8vwt6tn.js"))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>(e("f5skm0s6"),import("./catppuccin-mocha-f5skm0s6.js"))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>(e("m8at7yx7"),import("./dark-plus-m8at7yx7.js"))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>(e("4fc9ntns"),import("./dracula-4fc9ntns.js"))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>(e("5q94k618"),import("./dracula-soft-5q94k618.js"))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>(e("d1yfc7p8"),import("./everforest-dark-d1yfc7p8.js"))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>(e("8cd74ewt"),import("./everforest-light-8cd74ewt.js"))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>(e("mm6673p6"),import("./github-dark-mm6673p6.js"))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>(e("mq5awb4z"),import("./github-dark-default-mq5awb4z.js"))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>(e("kt7rv59v"),import("./github-dark-dimmed-kt7rv59v.js"))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>(e("18jh4rmk"),import("./github-dark-high-contrast-18jh4rmk.js"))},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>(e("t2j0qk96"),import("./github-light-t2j0qk96.js"))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>(e("knt9ds0k"),import("./github-light-default-knt9ds0k.js"))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>(e("vgqbqnpv"),import("./github-light-high-contrast-vgqbqnpv.js"))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>(e("914016cj"),import("./gruvbox-dark-hard-914016cj.js"))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>(e("9t6b705s"),import("./gruvbox-dark-medium-9t6b705s.js"))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>(e("sdv10jrj"),import("./gruvbox-dark-soft-sdv10jrj.js"))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>(e("cy4jx512"),import("./gruvbox-light-hard-cy4jx512.js"))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>(e("5mtfg3dp"),import("./gruvbox-light-medium-5mtfg3dp.js"))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>(e("015c376k"),import("./gruvbox-light-soft-015c376k.js"))},{id:"horizon",displayName:"Horizon",type:"dark",import:()=>(e("5588d3zy"),import("./horizon-5588d3zy.js"))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:()=>(e("enf70ntg"),import("./horizon-bright-enf70ntg.js"))},{id:"houston",displayName:"Houston",type:"dark",import:()=>(e("ppgd3znr"),import("./houston-ppgd3znr.js"))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>(e("nxvznjva"),import("./kanagawa-dragon-nxvznjva.js"))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>(e("mbgxwth0"),import("./kanagawa-lotus-mbgxwth0.js"))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>(e("tqt2pskq"),import("./kanagawa-wave-tqt2pskq.js"))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>(e("fjafvtft"),import("./laserwave-fjafvtft.js"))},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>(e("ay9qb384"),import("./light-plus-ay9qb384.js"))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>(e("wrbv1ehn"),import("./material-theme-wrbv1ehn.js"))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>(e("ys1cr5m1"),import("./material-theme-darker-ys1cr5m1.js"))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>(e("e1vq84p1"),import("./material-theme-lighter-e1vq84p1.js"))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>(e("p0xtkjcq"),import("./material-theme-ocean-p0xtkjcq.js"))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>(e("1s5w6vg5"),import("./material-theme-palenight-1s5w6vg5.js"))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>(e("9kdrynsa"),import("./min-dark-9kdrynsa.js"))},{id:"min-light",displayName:"Min Light",type:"light",import:()=>(e("z3j5w6rx"),import("./min-light-z3j5w6rx.js"))},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>(e("5jadr7kg"),import("./monokai-5jadr7kg.js"))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>(e("9r0ckba5"),import("./night-owl-9r0ckba5.js"))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:()=>(e("7ce95fs8"),import("./night-owl-light-7ce95fs8.js"))},{id:"nord",displayName:"Nord",type:"dark",import:()=>(e("5xx43938"),import("./nord-5xx43938.js"))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>(e("rcrka58h"),import("./one-dark-pro-rcrka58h.js"))},{id:"one-light",displayName:"One Light",type:"light",import:()=>(e("ywjxksww"),import("./one-light-ywjxksww.js"))},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>(e("jt18dkfd"),import("./plastic-jt18dkfd.js"))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>(e("5barcpw8"),import("./poimandres-5barcpw8.js"))},{id:"red",displayName:"Red",type:"dark",import:()=>(e("8x83g358"),import("./red-8x83g358.js"))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>(e("6gb86a0d"),import("./rose-pine-6gb86a0d.js"))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>(e("7fwrfh74"),import("./rose-pine-dawn-7fwrfh74.js"))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>(e("3em138qf"),import("./rose-pine-moon-3em138qf.js"))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>(e("wp500gq1"),import("./slack-dark-wp500gq1.js"))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>(e("nknyxfxy"),import("./slack-ochin-nknyxfxy.js"))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>(e("eb2am5x1"),import("./snazzy-light-eb2am5x1.js"))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>(e("qk7a6yqw"),import("./solarized-dark-qk7a6yqw.js"))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>(e("zdncvbbq"),import("./solarized-light-zdncvbbq.js"))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>(e("ksscxt51"),import("./synthwave-84-ksscxt51.js"))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>(e("8fcm1mvt"),import("./tokyo-night-8fcm1mvt.js"))},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>(e("9nxespbm"),import("./vesper-9nxespbm.js"))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>(e("93n0yege"),import("./vitesse-black-93n0yege.js"))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>(e("06e2nv03"),import("./vitesse-dark-06e2nv03.js"))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>(e("gxb5srgm"),import("./vitesse-light-gxb5srgm.js"))}],Wx=Object.fromEntries(Vx.map((t)=>[t.id,t.import]));var vc=Dx({langs:zs,themes:Wx,engine:()=>(0,Qf.createOnigurumaEngine)(import("shiki/wasm"))}),{codeToHtml:PM,codeToHast:MM,codeToTokens:_M,codeToTokensBase:OM,codeToTokensWithThemes:$M,getSingletonHighlighter:FM,getLastGrammarState:NM}=Hx(vc,{guessEmbeddedLanguages:Ox});var Xx=class{patterns;options;regexps;constructor(t,n={}){this.patterns=t,this.options=n;let{forgiving:s=!1,cache:a,regexConstructor:l}=n;if(!l)throw Error("Option `regexConstructor` is not provided");this.regexps=t.map((d)=>{if(typeof d!=="string")return d;let f=a?.get(d);if(f){if(f instanceof RegExp)return f;if(s)return null;throw f}try{let h=l(d);return a?.set(d,h),h}catch(h){if(a?.set(d,h),s)return null;throw h}})}findNextMatchSync(t,n,s){let a=typeof t==="string"?t:t.content,l=[];function d(f,h,g=0){return{index:f,captureIndices:h.indices.map((I)=>{if(I==null)return{start:4294967295,end:4294967295,length:0};return{start:I[0]+g,end:I[1]+g,length:I[1]-I[0]}})}}for(let f=0;f<this.regexps.length;f++){let h=this.regexps[f];if(!h)continue;try{h.lastIndex=n;let g=h.exec(a);if(!g)continue;if(g.index===n)return d(f,g,0);l.push([f,g,0])}catch(g){if(this.options.forgiving)continue;throw g}}if(l.length){let f=Math.min(...l.map((h)=>h[1].index));for(let[h,g,I]of l)if(g.index===f)return d(h,g,I)}return null}};function xo(t){if([...t].length!==1)throw Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function Yx(t,n,s){return t.has(n)||t.set(n,s),t.get(n)}var al=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),kn=String.raw;function qi(t,n){if(t==null)throw Error(n??"Value expected");return t}var nI=kn`\[\^?`,rI=`c.? | C(?:-.?)?|${kn`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${kn`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${kn`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${kn`o\{[^\}]*\}?`}|${kn`\d{1,3}`}`,ep=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,kc=new RegExp(kn`
|
|
12
|
+
`})}let _={type:"element",tagName:"span",properties:{class:"line"},children:[]},O=0;for(let B of M){let X={type:"element",tagName:"span",properties:{...B.htmlAttrs},children:[{type:"text",value:B.content}]},z=zf(B.htmlStyle||cc(B));if(z)X.properties.style=z;for(let K of l)X=K?.span?.call(w,X,N+1,O,_,B)||X;if(h==="inline")f.children.push(X);else if(h==="classic")_.children.push(X);O+=B.content.length}if(h==="classic"){for(let B of l)_=B?.line?.call(w,_,N+1)||_;k.push(_),d.push(_)}else if(h==="inline")k.push(_)}),h==="classic"){for(let M of l)v=M?.code?.call(w,v)||v;b.children.push(v);for(let M of l)b=M?.pre?.call(w,b)||b;f.children.push(b)}else if(h==="inline"){let M=[],N={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let O of f.children)if(O.type==="element"&&O.tagName==="br")M.push(N),N={type:"element",tagName:"span",properties:{class:"line"},children:[]};else if(O.type==="element"||O.type==="text")N.children.push(O);M.push(N);let _={type:"element",tagName:"code",properties:{},children:M};for(let O of l)_=O?.code?.call(w,_)||_;f.children=[];for(let O=0;O<_.children.length;O++){if(O>0)f.children.push({type:"element",tagName:"br",properties:{},children:[]});let B=_.children[O];if(B.type==="element")f.children.push(...B.children)}}let P=f;for(let M of l)P=M?.root?.call(w,P)||P;if(a)rl(P,a);return P}function WP(t){return t.map((n)=>{let s=[],a="",l;return n.forEach((d,f)=>{let h=!(d.fontStyle&&(d.fontStyle&qn.Underline||d.fontStyle&qn.Strikethrough));if(h&&Fx.test(d.content)&&n[f+1]){if(l===void 0)l=d.offset;a+=d.content}else if(a){if(h)s.push({...d,offset:l,content:a+d.content});else s.push({content:a,offset:l},d);l=void 0,a=""}else s.push(d)}),s})}function XP(t){return t.map((n)=>n.flatMap((s)=>{if(Fx.test(s.content))return s;let a=s.content.match(KP);if(!a)return s;let[,l,d,f]=a;if(!l&&!f)return s;let h=[{...s,offset:s.offset+l.length,content:d}];if(l)h.unshift({content:l,offset:s.offset});if(f)h.push({content:f,offset:s.offset+l.length+d.length});return h}))}function YP(t){return t.map((n)=>{let s=[];for(let a of n){if(s.length===0){s.push({...a});continue}let l=s.at(-1),d=zf(l.htmlStyle||cc(l)),f=zf(a.htmlStyle||cc(a)),h=l.fontStyle&&(l.fontStyle&qn.Underline||l.fontStyle&qn.Strikethrough),g=a.fontStyle&&(a.fontStyle&qn.Underline||a.fontStyle&qn.Strikethrough);if(!h&&!g&&d===f)l.content+=a.content;else s.push({...a})}return s})}var JP=pn;function QP(t,n,s){let a={meta:{},options:s,codeToHast:(d,f)=>fc(t,d,f),codeToTokens:(d,f)=>mc(t,d,f)},l=JP(fc(t,n,s,a));for(let d of dc(s))l=d.postprocess?.call(a,l,s)||l;return l}async function Nx(t){let n=await Rf(t);return{getLastGrammarState:(...s)=>Qy(n,...s),codeToTokensBase:(s,a)=>jf(n,s,a),codeToTokensWithThemes:(s,a)=>ec(n,s,a),codeToTokens:(s,a)=>mc(n,s,a),codeToHast:(s,a)=>fc(n,s,a),codeToHtml:(s,a)=>QP(n,s,a),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...n,getInternalContext:()=>n}}function ZP(t){let n;async function s(a){if(!n)return n=t({...a,themes:a.themes||[],langs:a.langs||[]}),n;else{let l=await n;return await Promise.all([l.loadTheme(...a.themes||[]),l.loadLanguage(...a.langs||[])]),l}}return s}var Aq=ZP(Nx);function Dx(t){let{langs:n,themes:s,engine:a}=t;async function l(d){function f(v){if(typeof v==="string"){if(v=d.langAlias?.[v]||v,kf(v))return[];let k=n[v];if(!k)throw new Lt(`Language \`${v}\` is not included in this bundle. You may want to load it from external source.`);return k}return v}function h(v){if(Tf(v))return"none";if(typeof v==="string"){let k=s[v];if(!k)throw new Lt(`Theme \`${v}\` is not included in this bundle. You may want to load it from external source.`);return k}return v}let g=(d.themes??[]).map((v)=>h(v)),I=(d.langs??[]).map((v)=>f(v)),b=await Nx({engine:d.engine??a(),...d,themes:g,langs:I});return{...b,loadLanguage(...v){return b.loadLanguage(...v.map(f))},loadTheme(...v){return b.loadTheme(...v.map(h))},getBundledLanguages(){return n},getBundledThemes(){return s}}}return l}function eM(t){let n;async function s(a={}){if(!n){n=t({...a,themes:[],langs:[]});let l=await n;return await Promise.all([l.loadTheme(...a.themes||[]),l.loadLanguage(...a.langs||[])]),l}else{let l=await n;return await Promise.all([l.loadTheme(...a.themes||[]),l.loadLanguage(...a.langs||[])]),l}}return s}function Hx(t,n){let s=eM(t);async function a(l,d){let f=await s({langs:[d.lang],themes:"theme"in d?[d.theme]:Object.values(d.themes)}),h=await n?.guessEmbeddedLanguages?.(l,d.lang,f);if(h)await f.loadLanguage(...h);return f}return{getSingletonHighlighter(l){return s(l)},async codeToHtml(l,d){return(await a(l,d)).codeToHtml(l,d)},async codeToHast(l,d){return(await a(l,d)).codeToHast(l,d)},async codeToTokens(l,d){return(await a(l,d)).codeToTokens(l,d)},async codeToTokensBase(l,d){return(await a(l,d)).codeToTokensBase(l,d)},async codeToTokensWithThemes(l,d){return(await a(l,d)).codeToTokensWithThemes(l,d)},async getLastGrammarState(l,d){return(await s({langs:[d.lang],themes:[d.theme]})).getLastGrammarState(l,d)}}}function sl({name:t,load:n,colorScheme:s,collection:a,displayName:l}){return{name:t,colorScheme:s,collection:a,displayName:l,load:tM(n)}}function tM(t){return async()=>Ds(qu(await t()))}var nM="pierre",rM=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],Ux=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],iM=[...Ux,...rM],oM=new Set(Ux);function sM(t){if(oM.has(t))return"light";return"dark"}var aM={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},lM={"pierre-dark":()=>(e("4mgfqqv0"),import("./pierre-dark-4mgfqqv0.js")),"pierre-dark-soft":()=>(e("w7sqrdqg"),import("./pierre-dark-soft-w7sqrdqg.js")),"pierre-dark-vibrant":()=>(e("xbst0r6r"),import("./pierre-dark-vibrant-xbst0r6r.js")),"pierre-dark-protanopia-deuteranopia":()=>(e("dvs8g9s9"),import("./pierre-dark-protanopia-deuteranopia-dvs8g9s9.js")),"pierre-dark-tritanopia":()=>(e("hg031v40"),import("./pierre-dark-tritanopia-hg031v40.js")),"pierre-light":()=>(e("hcqns3mt"),import("./pierre-light-hcqns3mt.js")),"pierre-light-soft":()=>(e("kfyv50pr"),import("./pierre-light-soft-kfyv50pr.js")),"pierre-light-vibrant":()=>(e("4f2kgqvy"),import("./pierre-light-vibrant-4f2kgqvy.js")),"pierre-light-protanopia-deuteranopia":()=>(e("s9tqbsvc"),import("./pierre-light-protanopia-deuteranopia-s9tqbsvc.js")),"pierre-light-tritanopia":()=>(e("x4vh9x60"),import("./pierre-light-tritanopia-x4vh9x60.js"))};function uM(t){return sl({name:t,collection:nM,colorScheme:sM(t),displayName:aM[t],load:lM[t]})}var pc=go({themes:iM.map((t)=>uM(t))});var cM="shiki",Gx=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],dM=["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"],mM=new Set(Gx);function fM(t){if(mM.has(t))return"light";return"dark"}var pM={andromeeda:()=>(e("wg0jqvm9"),import("./andromeeda-wg0jqvm9.js")),"aurora-x":()=>(e("mv0k79bd"),import("./aurora-x-mv0k79bd.js")),"ayu-dark":()=>(e("ghd075yb"),import("./ayu-dark-ghd075yb.js")),"ayu-light":()=>(e("v3ystkk5"),import("./ayu-light-v3ystkk5.js")),"ayu-mirage":()=>(e("vzvzpezs"),import("./ayu-mirage-vzvzpezs.js")),"catppuccin-frappe":()=>(e("znmj0d2m"),import("./catppuccin-frappe-znmj0d2m.js")),"catppuccin-latte":()=>(e("p8aygbzx"),import("./catppuccin-latte-p8aygbzx.js")),"catppuccin-macchiato":()=>(e("f8vwt6tn"),import("./catppuccin-macchiato-f8vwt6tn.js")),"catppuccin-mocha":()=>(e("f5skm0s6"),import("./catppuccin-mocha-f5skm0s6.js")),"dark-plus":()=>(e("m8at7yx7"),import("./dark-plus-m8at7yx7.js")),dracula:()=>(e("4fc9ntns"),import("./dracula-4fc9ntns.js")),"dracula-soft":()=>(e("5q94k618"),import("./dracula-soft-5q94k618.js")),"everforest-dark":()=>(e("d1yfc7p8"),import("./everforest-dark-d1yfc7p8.js")),"everforest-light":()=>(e("8cd74ewt"),import("./everforest-light-8cd74ewt.js")),"github-dark":()=>(e("mm6673p6"),import("./github-dark-mm6673p6.js")),"github-dark-default":()=>(e("mq5awb4z"),import("./github-dark-default-mq5awb4z.js")),"github-dark-dimmed":()=>(e("kt7rv59v"),import("./github-dark-dimmed-kt7rv59v.js")),"github-dark-high-contrast":()=>(e("18jh4rmk"),import("./github-dark-high-contrast-18jh4rmk.js")),"github-light":()=>(e("t2j0qk96"),import("./github-light-t2j0qk96.js")),"github-light-default":()=>(e("knt9ds0k"),import("./github-light-default-knt9ds0k.js")),"github-light-high-contrast":()=>(e("vgqbqnpv"),import("./github-light-high-contrast-vgqbqnpv.js")),"gruvbox-dark-hard":()=>(e("914016cj"),import("./gruvbox-dark-hard-914016cj.js")),"gruvbox-dark-medium":()=>(e("9t6b705s"),import("./gruvbox-dark-medium-9t6b705s.js")),"gruvbox-dark-soft":()=>(e("sdv10jrj"),import("./gruvbox-dark-soft-sdv10jrj.js")),"gruvbox-light-hard":()=>(e("cy4jx512"),import("./gruvbox-light-hard-cy4jx512.js")),"gruvbox-light-medium":()=>(e("5mtfg3dp"),import("./gruvbox-light-medium-5mtfg3dp.js")),"gruvbox-light-soft":()=>(e("015c376k"),import("./gruvbox-light-soft-015c376k.js")),horizon:()=>(e("5588d3zy"),import("./horizon-5588d3zy.js")),"horizon-bright":()=>(e("enf70ntg"),import("./horizon-bright-enf70ntg.js")),houston:()=>(e("ppgd3znr"),import("./houston-ppgd3znr.js")),"kanagawa-dragon":()=>(e("nxvznjva"),import("./kanagawa-dragon-nxvznjva.js")),"kanagawa-lotus":()=>(e("mbgxwth0"),import("./kanagawa-lotus-mbgxwth0.js")),"kanagawa-wave":()=>(e("tqt2pskq"),import("./kanagawa-wave-tqt2pskq.js")),laserwave:()=>(e("fjafvtft"),import("./laserwave-fjafvtft.js")),"light-plus":()=>(e("ay9qb384"),import("./light-plus-ay9qb384.js")),"material-theme":()=>(e("wrbv1ehn"),import("./material-theme-wrbv1ehn.js")),"material-theme-darker":()=>(e("ys1cr5m1"),import("./material-theme-darker-ys1cr5m1.js")),"material-theme-lighter":()=>(e("e1vq84p1"),import("./material-theme-lighter-e1vq84p1.js")),"material-theme-ocean":()=>(e("p0xtkjcq"),import("./material-theme-ocean-p0xtkjcq.js")),"material-theme-palenight":()=>(e("1s5w6vg5"),import("./material-theme-palenight-1s5w6vg5.js")),"min-dark":()=>(e("9kdrynsa"),import("./min-dark-9kdrynsa.js")),"min-light":()=>(e("z3j5w6rx"),import("./min-light-z3j5w6rx.js")),monokai:()=>(e("5jadr7kg"),import("./monokai-5jadr7kg.js")),"night-owl":()=>(e("9r0ckba5"),import("./night-owl-9r0ckba5.js")),"night-owl-light":()=>(e("7ce95fs8"),import("./night-owl-light-7ce95fs8.js")),nord:()=>(e("5xx43938"),import("./nord-5xx43938.js")),"one-dark-pro":()=>(e("rcrka58h"),import("./one-dark-pro-rcrka58h.js")),"one-light":()=>(e("ywjxksww"),import("./one-light-ywjxksww.js")),plastic:()=>(e("jt18dkfd"),import("./plastic-jt18dkfd.js")),poimandres:()=>(e("5barcpw8"),import("./poimandres-5barcpw8.js")),red:()=>(e("8x83g358"),import("./red-8x83g358.js")),"rose-pine":()=>(e("6gb86a0d"),import("./rose-pine-6gb86a0d.js")),"rose-pine-dawn":()=>(e("7fwrfh74"),import("./rose-pine-dawn-7fwrfh74.js")),"rose-pine-moon":()=>(e("3em138qf"),import("./rose-pine-moon-3em138qf.js")),"slack-dark":()=>(e("wp500gq1"),import("./slack-dark-wp500gq1.js")),"slack-ochin":()=>(e("nknyxfxy"),import("./slack-ochin-nknyxfxy.js")),"snazzy-light":()=>(e("eb2am5x1"),import("./snazzy-light-eb2am5x1.js")),"solarized-dark":()=>(e("qk7a6yqw"),import("./solarized-dark-qk7a6yqw.js")),"solarized-light":()=>(e("zdncvbbq"),import("./solarized-light-zdncvbbq.js")),"synthwave-84":()=>(e("ksscxt51"),import("./synthwave-84-ksscxt51.js")),"tokyo-night":()=>(e("8fcm1mvt"),import("./tokyo-night-8fcm1mvt.js")),vesper:()=>(e("9nxespbm"),import("./vesper-9nxespbm.js")),"vitesse-black":()=>(e("93n0yege"),import("./vitesse-black-93n0yege.js")),"vitesse-dark":()=>(e("06e2nv03"),import("./vitesse-dark-06e2nv03.js")),"vitesse-light":()=>(e("gxb5srgm"),import("./vitesse-light-gxb5srgm.js"))};function Bx(t){return sl({name:t,collection:cM,colorScheme:fM(t),load:pM[t]})}var hc=go({themes:Object.freeze([...Gx.map((t)=>Bx(t)),...dM.map((t)=>Bx(t))])});var Xq=go({themes:[pc,hc]});function gc(t){if(Ku())throw Error(`Theme "${t}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(vn.hasRegisteredTheme(t))return;let n=hc.getTheme(t);if(n!=null){vn.registerThemeIfAbsent(n.name,n.load);return}throw Error(`No valid theme loader registered for "${t}"`)}function yc(t,n){if(n.name!==t)throw Error(`resolvedTheme: themeName: ${t} does not match theme.name: ${n.name}`)}async function Ge(t){gc(t);let n=await vn.resolveTheme(t);return yc(t,n),n}var Lr=new Map,xc=new Map,zx=new Map,Gs=new Set;function U(t){for(let n of Array.isArray(t)?t:[t]){if(n==="text"||n==="ansi")continue;if(!Gs.has(n))return!1}return!0}function qf(t,n){t=Array.isArray(t)?t:[t];for(let s of t){if(Gs.has(s.name))continue;let a=Lr.get(s.name);if(a==null)a=s,Lr.set(s.name,a);let l=a.data.find((d)=>d.name===a.name||d.aliases?.includes(a.name)===!0);if(l==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${a.name}" as its name or an alias.`);n.loadLanguageSync(a.data);try{n.getLanguage(a.name)}catch{throw Error(`attachResolvedLanguages: "${l.name}" is already loaded without alias "${a.name}". Load the alias first or give the grammar a unique name.`)}Gs.add(a.name)}}var Ic=[{id:"abap",name:"ABAP",import:()=>(e("v9zztnv2"),import("./abap-v9zztnv2.js"))},{id:"actionscript-3",name:"ActionScript",aliases:["actionscript","as3"],import:()=>(e("rend4f70"),import("./actionscript-3-rend4f70.js"))},{id:"ada",name:"Ada",import:()=>(e("spbz69wz"),import("./ada-spbz69wz.js"))},{id:"ahk",name:"AutoHotkey",aliases:["ahk1"],import:()=>(e("xfr8qz8q"),import("./ahk-xfr8qz8q.js"))},{id:"ahk2",name:"AutoHotkey2",import:()=>(e("1pfwf6n4"),import("./ahk2-1pfwf6n4.js"))},{id:"angular-html",name:"Angular HTML",import:()=>(e("9t1z861h"),import("./angular-html-9t1z861h.js"))},{id:"angular-ts",name:"Angular TypeScript",import:()=>(e("yces35hm"),import("./angular-ts-yces35hm.js"))},{id:"apache",name:"Apache Conf",import:()=>(e("yj702sg1"),import("./apache-yj702sg1.js"))},{id:"apex",name:"Apex",import:()=>(e("rxfwy5w1"),import("./apex-rxfwy5w1.js"))},{id:"apl",name:"APL",import:()=>(e("4tz7nbhb"),import("./apl-4tz7nbhb.js"))},{id:"applescript",name:"AppleScript",import:()=>(e("vyd7bkgm"),import("./applescript-vyd7bkgm.js"))},{id:"ara",name:"Ara",import:()=>(e("adbqgrjb"),import("./ara-adbqgrjb.js"))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>(e("t5y04cmt"),import("./asciidoc-t5y04cmt.js"))},{id:"asm",name:"Assembly",import:()=>(e("rwycywwf"),import("./asm-rwycywwf.js"))},{id:"astro",name:"Astro",import:()=>(e("95kf8zcf"),import("./astro-95kf8zcf.js"))},{id:"awk",name:"AWK",import:()=>(e("q2zme0ge"),import("./awk-q2zme0ge.js"))},{id:"ballerina",name:"Ballerina",import:()=>(e("6t0f78k9"),import("./ballerina-6t0f78k9.js"))},{id:"bat",name:"Batch File",aliases:["batch","cmd"],import:()=>(e("sykj1aa7"),import("./bat-sykj1aa7.js"))},{id:"beancount",name:"Beancount",import:()=>(e("gj14bxxv"),import("./beancount-gj14bxxv.js"))},{id:"berry",name:"Berry",aliases:["be"],import:()=>(e("nv4mppwp"),import("./berry-nv4mppwp.js"))},{id:"bibtex",name:"BibTeX",import:()=>(e("f2ty1dx3"),import("./bibtex-f2ty1dx3.js"))},{id:"bicep",name:"Bicep",import:()=>(e("nn9md6rb"),import("./bicep-nn9md6rb.js"))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:()=>(e("s821k3bw"),import("./bird2-s821k3bw.js"))},{id:"blade",name:"Blade",import:()=>(e("f74rx037"),import("./blade-f74rx037.js"))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>(e("dhrmm1jj"),import("./bsl-dhrmm1jj.js"))},{id:"c",name:"C",import:()=>(e("crm6zbmg"),import("./c-crm6zbmg.js"))},{id:"c3",name:"C3",import:()=>(e("19a99jet"),import("./c3-19a99jet.js"))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>(e("je337d9r"),import("./cadence-je337d9r.js"))},{id:"cairo",name:"Cairo",import:()=>(e("19n4vg8f"),import("./cairo-19n4vg8f.js"))},{id:"chapel",name:"Chapel",aliases:["chpl"],import:()=>(e("pgf3hgyg"),import("./chapel-pgf3hgyg.js"))},{id:"clarity",name:"Clarity",import:()=>(e("f6q9m3km"),import("./clarity-f6q9m3km.js"))},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>(e("q3w3rnbx"),import("./clojure-q3w3rnbx.js"))},{id:"cmake",name:"CMake",import:()=>(e("5z22d5ee"),import("./cmake-5z22d5ee.js"))},{id:"cobol",name:"COBOL",import:()=>(e("8zy7bwxd"),import("./cobol-8zy7bwxd.js"))},{id:"codeowners",name:"CODEOWNERS",import:()=>(e("n2ta4c94"),import("./codeowners-n2ta4c94.js"))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>(e("kdz1nqdn"),import("./codeql-kdz1nqdn.js"))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>(e("21p5hc0f"),import("./coffee-21p5hc0f.js"))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>(e("2yynsm2j"),import("./common-lisp-2yynsm2j.js"))},{id:"coq",name:"Rocq",import:()=>(e("m2ph7shf"),import("./coq-m2ph7shf.js"))},{id:"cpp",name:"C++",aliases:["c++"],import:()=>(e("pwzcj5qg"),import("./cpp-pwzcj5qg.js"))},{id:"crystal",name:"Crystal",import:()=>(e("mp6v15at"),import("./crystal-mp6v15at.js"))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>(e("7r279f07"),import("./csharp-7r279f07.js"))},{id:"css",name:"CSS",import:()=>(e("t2rfx939"),import("./css-t2rfx939.js"))},{id:"csv",name:"CSV",import:()=>(e("j1nr2egp"),import("./csv-j1nr2egp.js"))},{id:"cue",name:"CUE",import:()=>(e("3tvhth3f"),import("./cue-3tvhth3f.js"))},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>(e("0w0hkger"),import("./cypher-0w0hkger.js"))},{id:"d",name:"D",import:()=>(e("ddd3mfwv"),import("./d-ddd3mfwv.js"))},{id:"dart",name:"Dart",import:()=>(e("9bqb7q92"),import("./dart-9bqb7q92.js"))},{id:"dax",name:"DAX",import:()=>(e("n84494pa"),import("./dax-n84494pa.js"))},{id:"desktop",name:"Desktop",import:()=>(e("mgp42r9a"),import("./desktop-mgp42r9a.js"))},{id:"diff",name:"Diff",import:()=>(e("13j86cjk"),import("./diff-13j86cjk.js"))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>(e("v24nexj8"),import("./docker-v24nexj8.js"))},{id:"dotenv",name:"dotEnv",import:()=>(e("kz2m1he0"),import("./dotenv-kz2m1he0.js"))},{id:"dream-maker",name:"Dream Maker",import:()=>(e("ddcw1pkg"),import("./dream-maker-ddcw1pkg.js"))},{id:"edge",name:"Edge",import:()=>(e("fecan6xm"),import("./edge-fecan6xm.js"))},{id:"elixir",name:"Elixir",import:()=>(e("5kgxba97"),import("./elixir-5kgxba97.js"))},{id:"elm",name:"Elm",import:()=>(e("hy42zyg1"),import("./elm-hy42zyg1.js"))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>(e("fevh7w6r"),import("./emacs-lisp-fevh7w6r.js"))},{id:"erb",name:"ERB",import:()=>(e("5ke38pz0"),import("./erb-5ke38pz0.js"))},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>(e("8yqvhztk"),import("./erlang-8yqvhztk.js"))},{id:"fennel",name:"Fennel",import:()=>(e("r83cvyb2"),import("./fennel-r83cvyb2.js"))},{id:"fish",name:"Fish",import:()=>(e("3p5cq65q"),import("./fish-3p5cq65q.js"))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>(e("dgf1xd34"),import("./fluent-dgf1xd34.js"))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>(e("eawvv1am"),import("./fortran-fixed-form-eawvv1am.js"))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>(e("wpe8st7g"),import("./fortran-free-form-wpe8st7g.js"))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>(e("9e2dnvk9"),import("./fsharp-9e2dnvk9.js"))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:()=>(e("gfrqcbcg"),import("./gdresource-gfrqcbcg.js"))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:()=>(e("5nb9fzmy"),import("./gdscript-5nb9fzmy.js"))},{id:"gdshader",name:"GDShader",import:()=>(e("ba7x07gg"),import("./gdshader-ba7x07gg.js"))},{id:"genie",name:"Genie",import:()=>(e("0g0rveqm"),import("./genie-0g0rveqm.js"))},{id:"gherkin",name:"Gherkin",import:()=>(e("x9mbetch"),import("./gherkin-x9mbetch.js"))},{id:"git-commit",name:"Git Commit Message",import:()=>(e("tgh7eq9c"),import("./git-commit-tgh7eq9c.js"))},{id:"git-rebase",name:"Git Rebase Message",import:()=>(e("q3rpjbyz"),import("./git-rebase-q3rpjbyz.js"))},{id:"gleam",name:"Gleam",import:()=>(e("9kv9z5ay"),import("./gleam-9kv9z5ay.js"))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>(e("9h9h16am"),import("./glimmer-js-9h9h16am.js"))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>(e("0k5s1v2h"),import("./glimmer-ts-0k5s1v2h.js"))},{id:"glsl",name:"GLSL",import:()=>(e("mmrej8st"),import("./glsl-mmrej8st.js"))},{id:"gn",name:"GN",import:()=>(e("kd98cxzg"),import("./gn-kd98cxzg.js"))},{id:"gnuplot",name:"Gnuplot",import:()=>(e("8t392p99"),import("./gnuplot-8t392p99.js"))},{id:"go",name:"Go",import:()=>(e("3m0kqn3p"),import("./go-3m0kqn3p.js"))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>(e("6dembcfz"),import("./graphql-6dembcfz.js"))},{id:"groovy",name:"Groovy",import:()=>(e("hcqzjh1n"),import("./groovy-hcqzjh1n.js"))},{id:"hack",name:"Hack",import:()=>(e("r0517j09"),import("./hack-r0517j09.js"))},{id:"haml",name:"Ruby Haml",import:()=>(e("fs8t607p"),import("./haml-fs8t607p.js"))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>(e("qxp1hmm5"),import("./handlebars-qxp1hmm5.js"))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>(e("bydw5m21"),import("./haskell-bydw5m21.js"))},{id:"haxe",name:"Haxe",import:()=>(e("63hhvesn"),import("./haxe-63hhvesn.js"))},{id:"hcl",name:"HashiCorp HCL",import:()=>(e("e92k9k77"),import("./hcl-e92k9k77.js"))},{id:"hjson",name:"Hjson",import:()=>(e("k4xzehbj"),import("./hjson-k4xzehbj.js"))},{id:"hlsl",name:"HLSL",import:()=>(e("99cqj6by"),import("./hlsl-99cqj6by.js"))},{id:"html",name:"HTML",import:()=>(e("fbn2078w"),import("./html-fbn2078w.js"))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>(e("vpadkpjz"),import("./html-derivative-vpadkpjz.js"))},{id:"http",name:"HTTP",import:()=>(e("r101fvka"),import("./http-r101fvka.js"))},{id:"hurl",name:"Hurl",import:()=>(e("hzcngdvj"),import("./hurl-hzcngdvj.js"))},{id:"hxml",name:"HXML",import:()=>(e("psqp1nsp"),import("./hxml-psqp1nsp.js"))},{id:"hy",name:"Hy",import:()=>(e("ar1v5vng"),import("./hy-ar1v5vng.js"))},{id:"imba",name:"Imba",import:()=>(e("8w1tr2yq"),import("./imba-8w1tr2yq.js"))},{id:"ini",name:"INI",aliases:["properties"],import:()=>(e("v269qqbk"),import("./ini-v269qqbk.js"))},{id:"java",name:"Java",import:()=>(e("08891286"),import("./java-08891286.js"))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>(e("c9kyad61"),import("./javascript-c9kyad61.js"))},{id:"jinja",name:"Jinja",import:()=>(e("54ggdj1m"),import("./jinja-54ggdj1m.js"))},{id:"jison",name:"Jison",import:()=>(e("j783t39n"),import("./jison-j783t39n.js"))},{id:"json",name:"JSON",import:()=>(e("g47q5a3x"),import("./json-g47q5a3x.js"))},{id:"json5",name:"JSON5",import:()=>(e("htnawg0s"),import("./json5-htnawg0s.js"))},{id:"jsonc",name:"JSON with Comments",import:()=>(e("15dhk5z3"),import("./jsonc-15dhk5z3.js"))},{id:"jsonl",name:"JSON Lines",import:()=>(e("cta2wnj7"),import("./jsonl-cta2wnj7.js"))},{id:"jsonnet",name:"Jsonnet",import:()=>(e("y8sfefcj"),import("./jsonnet-y8sfefcj.js"))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>(e("ar9p95ya"),import("./jssm-ar9p95ya.js"))},{id:"jsx",name:"JSX",import:()=>(e("h2hggewx"),import("./jsx-h2hggewx.js"))},{id:"julia",name:"Julia",aliases:["jl"],import:()=>(e("427d8qjf"),import("./julia-427d8qjf.js"))},{id:"just",name:"Just",aliases:["justfile"],import:()=>(e("ezfq4t7j"),import("./just-ezfq4t7j.js"))},{id:"kdl",name:"KDL",import:()=>(e("fex1syf1"),import("./kdl-fex1syf1.js"))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>(e("t27dc445"),import("./kotlin-t27dc445.js"))},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>(e("rdyq38zq"),import("./kusto-rdyq38zq.js"))},{id:"latex",name:"LaTeX",import:()=>(e("41146jxq"),import("./latex-41146jxq.js"))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>(e("0c7zvz88"),import("./lean-0c7zvz88.js"))},{id:"less",name:"Less",import:()=>(e("ekqk42nj"),import("./less-ekqk42nj.js"))},{id:"liquid",name:"Liquid",import:()=>(e("w18z4eby"),import("./liquid-w18z4eby.js"))},{id:"llvm",name:"LLVM IR",import:()=>(e("r5dkm1jm"),import("./llvm-r5dkm1jm.js"))},{id:"log",name:"Log file",import:()=>(e("jvqtv319"),import("./log-jvqtv319.js"))},{id:"logo",name:"Logo",import:()=>(e("t7pt3vzb"),import("./logo-t7pt3vzb.js"))},{id:"lua",name:"Lua",import:()=>(e("m7dk4azp"),import("./lua-m7dk4azp.js"))},{id:"luau",name:"Luau",import:()=>(e("t1tnzmg4"),import("./luau-t1tnzmg4.js"))},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>(e("ccgc3g99"),import("./make-ccgc3g99.js"))},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>(e("m9wpbj55"),import("./markdown-m9wpbj55.js"))},{id:"marko",name:"Marko",import:()=>(e("mz0wgv09"),import("./marko-mz0wgv09.js"))},{id:"matlab",name:"MATLAB",import:()=>(e("ajtwd8mv"),import("./matlab-ajtwd8mv.js"))},{id:"mdc",name:"MDC",import:()=>(e("8fzqn2ra"),import("./mdc-8fzqn2ra.js"))},{id:"mdx",name:"MDX",import:()=>(e("z02tv5ym"),import("./mdx-z02tv5ym.js"))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>(e("wczz61sj"),import("./mermaid-wczz61sj.js"))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>(e("914dckvv"),import("./mipsasm-914dckvv.js"))},{id:"mojo",name:"Mojo",import:()=>(e("w6n7h2t6"),import("./mojo-w6n7h2t6.js"))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>(e("3ebyydj8"),import("./moonbit-3ebyydj8.js"))},{id:"move",name:"Move",import:()=>(e("5208ftg3"),import("./move-5208ftg3.js"))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>(e("1692t78j"),import("./narrat-1692t78j.js"))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>(e("ecafj8kf"),import("./nextflow-ecafj8kf.js"))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:()=>(e("xvrmcddz"),import("./nextflow-groovy-xvrmcddz.js"))},{id:"nginx",name:"Nginx",import:()=>(e("0zpcaqmv"),import("./nginx-0zpcaqmv.js"))},{id:"nim",name:"Nim",import:()=>(e("jcfn78ep"),import("./nim-jcfn78ep.js"))},{id:"nix",name:"Nix",import:()=>(e("xmvyr3v2"),import("./nix-xmvyr3v2.js"))},{id:"nsis",name:"NSIS",import:()=>(e("y9q5tf9c"),import("./nsis-y9q5tf9c.js"))},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>(e("m3q56d2j"),import("./nushell-m3q56d2j.js"))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>(e("f77fv246"),import("./objective-c-f77fv246.js"))},{id:"objective-cpp",name:"Objective-C++",import:()=>(e("sgxrjcg1"),import("./objective-cpp-sgxrjcg1.js"))},{id:"ocaml",name:"OCaml",import:()=>(e("3t7q77vf"),import("./ocaml-3t7q77vf.js"))},{id:"odin",name:"Odin",import:()=>(e("jnrmxydw"),import("./odin-jnrmxydw.js"))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>(e("03s49fa7"),import("./openscad-03s49fa7.js"))},{id:"org",name:"Org Markup",import:()=>(e("83gwmman"),import("./org-83gwmman.js"))},{id:"pascal",name:"Pascal",import:()=>(e("q9kebwbt"),import("./pascal-q9kebwbt.js"))},{id:"perl",name:"Perl",import:()=>(e("y7kpcnmy"),import("./perl-y7kpcnmy.js"))},{id:"php",name:"PHP",import:()=>(e("qhnmwt67"),import("./php-qhnmwt67.js"))},{id:"pkl",name:"Pkl",import:()=>(e("af4va0yb"),import("./pkl-af4va0yb.js"))},{id:"plsql",name:"PL/SQL",import:()=>(e("zqt98gm4"),import("./plsql-zqt98gm4.js"))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>(e("acj27vh2"),import("./po-acj27vh2.js"))},{id:"polar",name:"Polar",import:()=>(e("12pt2ejq"),import("./polar-12pt2ejq.js"))},{id:"postcss",name:"PostCSS",import:()=>(e("xtvzpbp0"),import("./postcss-xtvzpbp0.js"))},{id:"powerquery",name:"PowerQuery",import:()=>(e("fcfjpawf"),import("./powerquery-fcfjpawf.js"))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1","pwsh"],import:()=>(e("bft3fprh"),import("./powershell-bft3fprh.js"))},{id:"prisma",name:"Prisma",import:()=>(e("1ww1ftj6"),import("./prisma-1ww1ftj6.js"))},{id:"prolog",name:"Prolog",import:()=>(e("pyt3g0dv"),import("./prolog-pyt3g0dv.js"))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>(e("5jn838mr"),import("./proto-5jn838mr.js"))},{id:"pug",name:"Pug",aliases:["jade"],import:()=>(e("67fg5zkc"),import("./pug-67fg5zkc.js"))},{id:"puppet",name:"Puppet",import:()=>(e("kffv3erv"),import("./puppet-kffv3erv.js"))},{id:"purescript",name:"PureScript",import:()=>(e("58gvwc47"),import("./purescript-58gvwc47.js"))},{id:"python",name:"Python",aliases:["py"],import:()=>(e("5jqjsqct"),import("./python-5jqjsqct.js"))},{id:"qml",name:"QML",import:()=>(e("zs7srp3c"),import("./qml-zs7srp3c.js"))},{id:"qmldir",name:"QML Directory",import:()=>(e("a9c26xfg"),import("./qmldir-a9c26xfg.js"))},{id:"qss",name:"Qt Style Sheets",import:()=>(e("5ggszvyp"),import("./qss-5ggszvyp.js"))},{id:"r",name:"R",import:()=>(e("hj5v5z9g"),import("./r-hj5v5z9g.js"))},{id:"racket",name:"Racket",import:()=>(e("k7w53tcs"),import("./racket-k7w53tcs.js"))},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>(e("r7t0wsvd"),import("./raku-r7t0wsvd.js"))},{id:"razor",name:"ASP.NET Razor",import:()=>(e("ja2vmp26"),import("./razor-ja2vmp26.js"))},{id:"rbs",name:"RBS",aliases:["ruby-signature"],import:()=>(e("dxm66dww"),import("./rbs-dxm66dww.js"))},{id:"reg",name:"Windows Registry Script",import:()=>(e("pf0vhy79"),import("./reg-pf0vhy79.js"))},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>(e("nrbm9kkc"),import("./regexp-nrbm9kkc.js"))},{id:"rel",name:"Rel",import:()=>(e("4daxvj43"),import("./rel-4daxvj43.js"))},{id:"riscv",name:"RISC-V",import:()=>(e("jhp8r03y"),import("./riscv-jhp8r03y.js"))},{id:"ron",name:"RON",import:()=>(e("d5wnwe3b"),import("./ron-d5wnwe3b.js"))},{id:"rosmsg",name:"ROS Interface",import:()=>(e("xj3jz1r9"),import("./rosmsg-xj3jz1r9.js"))},{id:"rst",name:"reStructuredText",import:()=>(e("0j7thaq8"),import("./rst-0j7thaq8.js"))},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>(e("h41d1jye"),import("./ruby-h41d1jye.js"))},{id:"rust",name:"Rust",aliases:["rs"],import:()=>(e("azbn31pd"),import("./rust-azbn31pd.js"))},{id:"sas",name:"SAS",import:()=>(e("74xzp6gp"),import("./sas-74xzp6gp.js"))},{id:"sass",name:"Sass",import:()=>(e("r1mzskwd"),import("./sass-r1mzskwd.js"))},{id:"scala",name:"Scala",import:()=>(e("e28dqbjh"),import("./scala-e28dqbjh.js"))},{id:"scheme",name:"Scheme",import:()=>(e("ersa4nxy"),import("./scheme-ersa4nxy.js"))},{id:"scss",name:"SCSS",import:()=>(e("h44zmxs9"),import("./scss-h44zmxs9.js"))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>(e("pe5gn8zr"),import("./sdbl-pe5gn8zr.js"))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>(e("b58smhfe"),import("./shaderlab-b58smhfe.js"))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>(e("pa08q251"),import("./shellscript-pa08q251.js"))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>(e("4kzj1fbj"),import("./shellsession-4kzj1fbj.js"))},{id:"smalltalk",name:"GNU Smalltalk",import:()=>(e("53b6hvg0"),import("./smalltalk-53b6hvg0.js"))},{id:"smithy",name:"Smithy",import:()=>(e("fgjwefsv"),import("./smithy-fgjwefsv.js"))},{id:"solidity",name:"Solidity",import:()=>(e("4xgc8v0p"),import("./solidity-4xgc8v0p.js"))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>(e("y2ne3k1g"),import("./soy-y2ne3k1g.js"))},{id:"sparql",name:"SPARQL",import:()=>(e("wz87e1pd"),import("./sparql-wz87e1pd.js"))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>(e("zcht3ttv"),import("./splunk-zcht3ttv.js"))},{id:"sql",name:"SQL",import:()=>(e("etbwe74e"),import("./sql-etbwe74e.js"))},{id:"ssh-config",name:"SSH Config",import:()=>(e("d0ty6y19"),import("./ssh-config-d0ty6y19.js"))},{id:"stata",name:"Stata",import:()=>(e("r52wae6s"),import("./stata-r52wae6s.js"))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>(e("x9mf4enc"),import("./stylus-x9mf4enc.js"))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:()=>(e("vw9k2yst"),import("./surrealql-vw9k2yst.js"))},{id:"svelte",name:"Svelte",import:()=>(e("xke2awzd"),import("./svelte-xke2awzd.js"))},{id:"swift",name:"Swift",import:()=>(e("zn3gdbrz"),import("./swift-zn3gdbrz.js"))},{id:"system-verilog",name:"SystemVerilog",import:()=>(e("gcgja1bf"),import("./system-verilog-gcgja1bf.js"))},{id:"systemd",name:"Systemd Units",import:()=>(e("debgc0xf"),import("./systemd-debgc0xf.js"))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>(e("xtcfkwwv"),import("./talonscript-xtcfkwwv.js"))},{id:"tasl",name:"Tasl",import:()=>(e("0805m303"),import("./tasl-0805m303.js"))},{id:"tcl",name:"Tcl",import:()=>(e("681ts9sc"),import("./tcl-681ts9sc.js"))},{id:"templ",name:"Templ",import:()=>(e("ygv4mpks"),import("./templ-ygv4mpks.js"))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>(e("em9vczt8"),import("./terraform-em9vczt8.js"))},{id:"tex",name:"TeX",import:()=>(e("pxg823cm"),import("./tex-pxg823cm.js"))},{id:"toml",name:"TOML",import:()=>(e("z4gdpbjt"),import("./toml-z4gdpbjt.js"))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>(e("5c023h24"),import("./ts-tags-5c023h24.js"))},{id:"tsv",name:"TSV",import:()=>(e("dr4chrhc"),import("./tsv-dr4chrhc.js"))},{id:"tsx",name:"TSX",import:()=>(e("e4j5thds"),import("./tsx-e4j5thds.js"))},{id:"turtle",name:"Turtle",import:()=>(e("rygwqp46"),import("./turtle-rygwqp46.js"))},{id:"twig",name:"Twig",import:()=>(e("zr6z9qb5"),import("./twig-zr6z9qb5.js"))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>(e("mqwe73n5"),import("./typescript-mqwe73n5.js"))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>(e("g3mhq5bb"),import("./typespec-g3mhq5bb.js"))},{id:"typst",name:"Typst",aliases:["typ"],import:()=>(e("5t62efc4"),import("./typst-5t62efc4.js"))},{id:"v",name:"V",import:()=>(e("f74jgk7j"),import("./v-f74jgk7j.js"))},{id:"vala",name:"Vala",import:()=>(e("smcm9afx"),import("./vala-smcm9afx.js"))},{id:"vb",name:"Visual Basic",import:()=>(e("pxn2t506"),import("./vb-pxn2t506.js"))},{id:"verilog",name:"Verilog",import:()=>(e("jp5dkmgg"),import("./verilog-jp5dkmgg.js"))},{id:"vhdl",name:"VHDL",import:()=>(e("kwccd285"),import("./vhdl-kwccd285.js"))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>(e("tq8eww09"),import("./viml-tq8eww09.js"))},{id:"vue",name:"Vue",import:()=>(e("ezkjk5e2"),import("./vue-ezkjk5e2.js"))},{id:"vue-html",name:"Vue HTML",import:()=>(e("ct5jzs45"),import("./vue-html-ct5jzs45.js"))},{id:"vue-vine",name:"Vue Vine",import:()=>(e("x1pd5ydv"),import("./vue-vine-x1pd5ydv.js"))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>(e("af81wz1j"),import("./vyper-af81wz1j.js"))},{id:"wasm",name:"WebAssembly",import:()=>(e("7m7s4wz7"),import("./wasm-7m7s4wz7.js"))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>(e("24cpw9ac"),import("./wenyan-24cpw9ac.js"))},{id:"wgsl",name:"WGSL",import:()=>(e("4bnwg8k2"),import("./wgsl-4bnwg8k2.js"))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>(e("eptnvn3e"),import("./wikitext-eptnvn3e.js"))},{id:"wit",name:"WebAssembly Interface Types",import:()=>(e("qhkwv0tf"),import("./wit-qhkwv0tf.js"))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>(e("v5pfp432"),import("./wolfram-v5pfp432.js"))},{id:"xml",name:"XML",import:()=>(e("4stg7cdn"),import("./xml-4stg7cdn.js"))},{id:"xsl",name:"XSL",import:()=>(e("e2ernnxm"),import("./xsl-e2ernnxm.js"))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>(e("pv4shv7v"),import("./yaml-pv4shv7v.js"))},{id:"zenscript",name:"ZenScript",import:()=>(e("knxz1bhv"),import("./zenscript-knxz1bhv.js"))},{id:"zig",name:"Zig",import:()=>(e("98xskbfp"),import("./zig-98xskbfp.js"))}],Kf=Object.fromEntries(Ic.map((t)=>[t.id,t.import])),Vf=Object.fromEntries(Ic.flatMap((t)=>t.aliases?.map((n)=>[n,t.import])||[])),zs={...Kf,...Vf};var Jf={};De(Jf,{createOnigurumaEngine:()=>Ec,getDefaultWasmLoader:()=>AM,loadWasm:()=>Yf,setDefaultWasmLoader:()=>LM});var Xf=class extends Error{constructor(t){super(t);this.name="ShikiError"}};function hM(){return 2147483648}function gM(){return typeof performance<"u"?performance.now():Date.now()}var yM=(t,n)=>t+(n-t%n)%n;async function xM(t){let n,s,a={};function l(w){s=w,a.HEAPU8=new Uint8Array(w),a.HEAPU32=new Uint32Array(w)}function d(w,P,M){a.HEAPU8.copyWithin(w,P,P+M)}function f(w){try{return n.grow(w-s.byteLength+65535>>>16),l(n.buffer),1}catch{}}function h(w){let P=a.HEAPU8.length;w=w>>>0;let M=hM();if(w>M)return!1;for(let N=1;N<=4;N*=2){let _=P*(1+0.2/N);_=Math.min(_,w+100663296);let O=Math.min(M,yM(Math.max(w,_),65536));if(f(O))return!0}return!1}let g=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function I(w,P,M=1024){let N=P+M,_=P;while(w[_]&&!(_>=N))++_;if(_-P>16&&w.buffer&&g)return g.decode(w.subarray(P,_));let O="";while(P<_){let B=w[P++];if(!(B&128)){O+=String.fromCharCode(B);continue}let X=w[P++]&63;if((B&224)===192){O+=String.fromCharCode((B&31)<<6|X);continue}let z=w[P++]&63;if((B&240)===224)B=(B&15)<<12|X<<6|z;else B=(B&7)<<18|X<<12|z<<6|w[P++]&63;if(B<65536)O+=String.fromCharCode(B);else{let K=B-65536;O+=String.fromCharCode(55296|K>>10,56320|K&1023)}}return O}function b(w,P){return w?I(a.HEAPU8,w,P):""}let v={emscripten_get_now:gM,emscripten_memcpy_big:d,emscripten_resize_heap:h,fd_write:()=>0};async function k(){let P=await t({env:v,wasi_snapshot_preview1:v});n=P.memory,l(n.buffer),Object.assign(a,P),a.UTF8ToString=b}return await k(),a}var IM=Object.defineProperty,SM=(t,n,s)=>(n in t)?IM(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s,$n=(t,n,s)=>SM(t,typeof n!=="symbol"?n+"":n,s),Bn=null;function bM(t){throw new Xf(t.UTF8ToString(t.getLastOnigError()))}class bc{constructor(t){$n(this,"utf16Length"),$n(this,"utf8Length"),$n(this,"utf16Value"),$n(this,"utf8Value"),$n(this,"utf16OffsetToUtf8"),$n(this,"utf8OffsetToUtf16");let n=t.length,s=bc._utf8ByteLength(t),a=s!==n,l=a?new Uint32Array(n+1):null;if(a)l[n]=s;let d=a?new Uint32Array(s+1):null;if(a)d[s]=n;let f=new Uint8Array(s),h=0;for(let g=0;g<n;g++){let I=t.charCodeAt(g),b=I,v=!1;if(I>=55296&&I<=56319){if(g+1<n){let k=t.charCodeAt(g+1);if(k>=56320&&k<=57343)b=(I-55296<<10)+65536|k-56320,v=!0}}if(a){if(l[g]=h,v)l[g+1]=h;if(b<=127)d[h+0]=g;else if(b<=2047)d[h+0]=g,d[h+1]=g;else if(b<=65535)d[h+0]=g,d[h+1]=g,d[h+2]=g;else d[h+0]=g,d[h+1]=g,d[h+2]=g,d[h+3]=g}if(b<=127)f[h++]=b;else if(b<=2047)f[h++]=192|(b&1984)>>>6,f[h++]=128|(b&63)>>>0;else if(b<=65535)f[h++]=224|(b&61440)>>>12,f[h++]=128|(b&4032)>>>6,f[h++]=128|(b&63)>>>0;else f[h++]=240|(b&1835008)>>>18,f[h++]=128|(b&258048)>>>12,f[h++]=128|(b&4032)>>>6,f[h++]=128|(b&63)>>>0;if(v)g++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=f,this.utf16OffsetToUtf8=l,this.utf8OffsetToUtf16=d}static _utf8ByteLength(t){let n=0;for(let s=0,a=t.length;s<a;s++){let l=t.charCodeAt(s),d=l,f=!1;if(l>=55296&&l<=56319){if(s+1<a){let h=t.charCodeAt(s+1);if(h>=56320&&h<=57343)d=(l-55296<<10)+65536|h-56320,f=!0}}if(d<=127)n+=1;else if(d<=2047)n+=2;else if(d<=65535)n+=3;else n+=4;if(f)s++}return n}createString(t){let n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}var Cc=class t{constructor(n){if($n(this,"id",++t.LAST_ID),$n(this,"_onigBinding"),$n(this,"content"),$n(this,"utf16Length"),$n(this,"utf8Length"),$n(this,"utf16OffsetToUtf8"),$n(this,"utf8OffsetToUtf16"),$n(this,"ptr"),!Bn)throw new Xf("Must invoke loadWasm first.");this._onigBinding=Bn,this.content=n;let s=new bc(n);if(this.utf16Length=s.utf16Length,this.utf8Length=s.utf8Length,this.utf16OffsetToUtf8=s.utf16OffsetToUtf8,this.utf8OffsetToUtf16=s.utf8OffsetToUtf16,this.utf8Length<1e4&&!t._sharedPtrInUse){if(!t._sharedPtr)t._sharedPtr=Bn.omalloc(1e4);t._sharedPtrInUse=!0,Bn.HEAPU8.set(s.utf8Value,t._sharedPtr),this.ptr=t._sharedPtr}else this.ptr=s.createString(Bn)}convertUtf8OffsetToUtf16(n){if(this.utf8OffsetToUtf16){if(n<0)return 0;if(n>this.utf8Length)return this.utf16Length;return this.utf8OffsetToUtf16[n]}return n}convertUtf16OffsetToUtf8(n){if(this.utf16OffsetToUtf8){if(n<0)return 0;if(n>this.utf16Length)return this.utf8Length;return this.utf16OffsetToUtf8[n]}return n}dispose(){if(this.ptr===t._sharedPtr)t._sharedPtrInUse=!1;else this._onigBinding.ofree(this.ptr)}};$n(Cc,"LAST_ID",0);$n(Cc,"_sharedPtr",0);$n(Cc,"_sharedPtrInUse",!1);var jx=Cc;class qx{constructor(t){if($n(this,"_onigBinding"),$n(this,"_ptr"),!Bn)throw new Xf("Must invoke loadWasm first.");let n=[],s=[];for(let f=0,h=t.length;f<h;f++){let g=new bc(t[f]);n[f]=g.createString(Bn),s[f]=g.utf8Length}let a=Bn.omalloc(4*t.length);Bn.HEAPU32.set(n,a/4);let l=Bn.omalloc(4*t.length);Bn.HEAPU32.set(s,l/4);let d=Bn.createOnigScanner(a,l,t.length);for(let f=0,h=t.length;f<h;f++)Bn.ofree(n[f]);if(Bn.ofree(l),Bn.ofree(a),d===0)bM(Bn);this._onigBinding=Bn,this._ptr=d}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,s){let a=0;if(typeof s==="number")a=s;if(typeof t==="string"){t=new jx(t);let l=this._findNextMatchSync(t,n,!1,a);return t.dispose(),l}return this._findNextMatchSync(t,n,!1,a)}_findNextMatchSync(t,n,s,a){let l=this._onigBinding,d=l.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),a);if(d===0)return null;let f=l.HEAPU32,h=d/4,g=f[h++],I=f[h++],b=[];for(let v=0;v<I;v++){let k=t.convertUtf8OffsetToUtf16(f[h++]),w=t.convertUtf8OffsetToUtf16(f[h++]);b[v]={start:k,end:w,length:w-k}}return{index:g,captureIndices:b}}}function CM(t){return typeof t.instantiator==="function"}function EM(t){return typeof t.default==="function"}function vM(t){return typeof t.data<"u"}function kM(t){return typeof Response<"u"&&t instanceof Response}function TM(t){return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&Buffer.isBuffer?.(t)||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}var Sc;function Yf(t){if(Sc)return Sc;async function n(){Bn=await xM(async(s)=>{let a=t;if(a=await a,typeof a==="function")a=await a(s);if(typeof a==="function")a=await a(s);if(CM(a))a=await a.instantiator(s);else if(EM(a))a=await a.default(s);else{if(vM(a))a=a.data;if(kM(a))if(typeof WebAssembly.instantiateStreaming==="function")a=await wM(a)(s);else a=await RM(a)(s);else if(TM(a))a=await Wf(a)(s);else if(a instanceof WebAssembly.Module)a=await Wf(a)(s);else if("default"in a&&a.default instanceof WebAssembly.Module)a=await Wf(a.default)(s)}if("instance"in a)a=a.instance;if("exports"in a)a=a.exports;return a})}return Sc=n(),Sc}function Wf(t){return(n)=>WebAssembly.instantiate(t,n)}function wM(t){return(n)=>WebAssembly.instantiateStreaming(t,n)}function RM(t){return async(n)=>{let s=await t.arrayBuffer();return WebAssembly.instantiate(s,n)}}var Kx;function LM(t){Kx=t}function AM(){return Kx}async function Ec(t){if(t)await Yf(t);return{createScanner(n){return new qx(n.map((s)=>typeof s==="string"?s:s.source))},createString(n){return new jx(n)}}}var Qf=hy({});gy(Qf,Jf);var Vx=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>(e("wg0jqvm9"),import("./andromeeda-wg0jqvm9.js"))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>(e("mv0k79bd"),import("./aurora-x-mv0k79bd.js"))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>(e("ghd075yb"),import("./ayu-dark-ghd075yb.js"))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:()=>(e("v3ystkk5"),import("./ayu-light-v3ystkk5.js"))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:()=>(e("vzvzpezs"),import("./ayu-mirage-vzvzpezs.js"))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>(e("znmj0d2m"),import("./catppuccin-frappe-znmj0d2m.js"))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>(e("p8aygbzx"),import("./catppuccin-latte-p8aygbzx.js"))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>(e("f8vwt6tn"),import("./catppuccin-macchiato-f8vwt6tn.js"))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>(e("f5skm0s6"),import("./catppuccin-mocha-f5skm0s6.js"))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>(e("m8at7yx7"),import("./dark-plus-m8at7yx7.js"))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>(e("4fc9ntns"),import("./dracula-4fc9ntns.js"))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>(e("5q94k618"),import("./dracula-soft-5q94k618.js"))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>(e("d1yfc7p8"),import("./everforest-dark-d1yfc7p8.js"))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>(e("8cd74ewt"),import("./everforest-light-8cd74ewt.js"))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>(e("mm6673p6"),import("./github-dark-mm6673p6.js"))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>(e("mq5awb4z"),import("./github-dark-default-mq5awb4z.js"))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>(e("kt7rv59v"),import("./github-dark-dimmed-kt7rv59v.js"))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>(e("18jh4rmk"),import("./github-dark-high-contrast-18jh4rmk.js"))},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>(e("t2j0qk96"),import("./github-light-t2j0qk96.js"))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>(e("knt9ds0k"),import("./github-light-default-knt9ds0k.js"))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>(e("vgqbqnpv"),import("./github-light-high-contrast-vgqbqnpv.js"))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>(e("914016cj"),import("./gruvbox-dark-hard-914016cj.js"))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>(e("9t6b705s"),import("./gruvbox-dark-medium-9t6b705s.js"))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>(e("sdv10jrj"),import("./gruvbox-dark-soft-sdv10jrj.js"))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>(e("cy4jx512"),import("./gruvbox-light-hard-cy4jx512.js"))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>(e("5mtfg3dp"),import("./gruvbox-light-medium-5mtfg3dp.js"))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>(e("015c376k"),import("./gruvbox-light-soft-015c376k.js"))},{id:"horizon",displayName:"Horizon",type:"dark",import:()=>(e("5588d3zy"),import("./horizon-5588d3zy.js"))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:()=>(e("enf70ntg"),import("./horizon-bright-enf70ntg.js"))},{id:"houston",displayName:"Houston",type:"dark",import:()=>(e("ppgd3znr"),import("./houston-ppgd3znr.js"))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>(e("nxvznjva"),import("./kanagawa-dragon-nxvznjva.js"))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>(e("mbgxwth0"),import("./kanagawa-lotus-mbgxwth0.js"))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>(e("tqt2pskq"),import("./kanagawa-wave-tqt2pskq.js"))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>(e("fjafvtft"),import("./laserwave-fjafvtft.js"))},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>(e("ay9qb384"),import("./light-plus-ay9qb384.js"))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>(e("wrbv1ehn"),import("./material-theme-wrbv1ehn.js"))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>(e("ys1cr5m1"),import("./material-theme-darker-ys1cr5m1.js"))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>(e("e1vq84p1"),import("./material-theme-lighter-e1vq84p1.js"))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>(e("p0xtkjcq"),import("./material-theme-ocean-p0xtkjcq.js"))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>(e("1s5w6vg5"),import("./material-theme-palenight-1s5w6vg5.js"))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>(e("9kdrynsa"),import("./min-dark-9kdrynsa.js"))},{id:"min-light",displayName:"Min Light",type:"light",import:()=>(e("z3j5w6rx"),import("./min-light-z3j5w6rx.js"))},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>(e("5jadr7kg"),import("./monokai-5jadr7kg.js"))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>(e("9r0ckba5"),import("./night-owl-9r0ckba5.js"))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:()=>(e("7ce95fs8"),import("./night-owl-light-7ce95fs8.js"))},{id:"nord",displayName:"Nord",type:"dark",import:()=>(e("5xx43938"),import("./nord-5xx43938.js"))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>(e("rcrka58h"),import("./one-dark-pro-rcrka58h.js"))},{id:"one-light",displayName:"One Light",type:"light",import:()=>(e("ywjxksww"),import("./one-light-ywjxksww.js"))},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>(e("jt18dkfd"),import("./plastic-jt18dkfd.js"))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>(e("5barcpw8"),import("./poimandres-5barcpw8.js"))},{id:"red",displayName:"Red",type:"dark",import:()=>(e("8x83g358"),import("./red-8x83g358.js"))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>(e("6gb86a0d"),import("./rose-pine-6gb86a0d.js"))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>(e("7fwrfh74"),import("./rose-pine-dawn-7fwrfh74.js"))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>(e("3em138qf"),import("./rose-pine-moon-3em138qf.js"))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>(e("wp500gq1"),import("./slack-dark-wp500gq1.js"))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>(e("nknyxfxy"),import("./slack-ochin-nknyxfxy.js"))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>(e("eb2am5x1"),import("./snazzy-light-eb2am5x1.js"))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>(e("qk7a6yqw"),import("./solarized-dark-qk7a6yqw.js"))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>(e("zdncvbbq"),import("./solarized-light-zdncvbbq.js"))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>(e("ksscxt51"),import("./synthwave-84-ksscxt51.js"))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>(e("8fcm1mvt"),import("./tokyo-night-8fcm1mvt.js"))},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>(e("9nxespbm"),import("./vesper-9nxespbm.js"))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>(e("93n0yege"),import("./vitesse-black-93n0yege.js"))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>(e("06e2nv03"),import("./vitesse-dark-06e2nv03.js"))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>(e("gxb5srgm"),import("./vitesse-light-gxb5srgm.js"))}],Wx=Object.fromEntries(Vx.map((t)=>[t.id,t.import]));var vc=Dx({langs:zs,themes:Wx,engine:()=>(0,Qf.createOnigurumaEngine)(import("shiki/wasm"))}),{codeToHtml:PM,codeToHast:MM,codeToTokens:_M,codeToTokensBase:OM,codeToTokensWithThemes:$M,getSingletonHighlighter:FM,getLastGrammarState:NM}=Hx(vc,{guessEmbeddedLanguages:Ox});var Xx=class{patterns;options;regexps;constructor(t,n={}){this.patterns=t,this.options=n;let{forgiving:s=!1,cache:a,regexConstructor:l}=n;if(!l)throw Error("Option `regexConstructor` is not provided");this.regexps=t.map((d)=>{if(typeof d!=="string")return d;let f=a?.get(d);if(f){if(f instanceof RegExp)return f;if(s)return null;throw f}try{let h=l(d);return a?.set(d,h),h}catch(h){if(a?.set(d,h),s)return null;throw h}})}findNextMatchSync(t,n,s){let a=typeof t==="string"?t:t.content,l=[];function d(f,h,g=0){return{index:f,captureIndices:h.indices.map((I)=>{if(I==null)return{start:4294967295,end:4294967295,length:0};return{start:I[0]+g,end:I[1]+g,length:I[1]-I[0]}})}}for(let f=0;f<this.regexps.length;f++){let h=this.regexps[f];if(!h)continue;try{h.lastIndex=n;let g=h.exec(a);if(!g)continue;if(g.index===n)return d(f,g,0);l.push([f,g,0])}catch(g){if(this.options.forgiving)continue;throw g}}if(l.length){let f=Math.min(...l.map((h)=>h[1].index));for(let[h,g,I]of l)if(g.index===f)return d(h,g,I)}return null}};function xo(t){if([...t].length!==1)throw Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function Yx(t,n,s){return t.has(n)||t.set(n,s),t.get(n)}var al=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),kn=String.raw;function qi(t,n){if(t==null)throw Error(n??"Value expected");return t}var nI=kn`\[\^?`,rI=`c.? | C(?:-.?)?|${kn`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${kn`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${kn`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${kn`o\{[^\}]*\}?`}|${kn`\d{1,3}`}`,ep=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,kc=new RegExp(kn`
|
|
13
13
|
\\ (?:
|
|
14
14
|
${rI}
|
|
15
15
|
| [gk]<[^>]*>?
|
|
@@ -56,7 +56,7 @@ import{De,e}from"../main.js";function qu(t){return t!==null&&typeof t==="object"
|
|
|
56
56
|
))?
|
|
57
57
|
| (?<qBase>${II})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
58
58
|
| \\?.
|
|
59
|
-
`.replace(/\s+/g,""),"gsu");function ap(t){if(!new RegExp(`${II}\\+`).test(t))return{pattern:t};let n=[],s=null,a=null,l="",d=0,f;op.lastIndex=0;while(f=op.exec(t)){let{0:h,index:g,groups:{qBase:I,qMod:b,invalidQ:v}}=f;if(h==="["){if(!d)a=g;d++}else if(h==="]")if(d)d--;else a=null;else if(!d){if(b==="+"&&l&&!l.startsWith("(")){if(v)throw Error(`Invalid quantifier "${h}"`);let k=-1;if(/^\{\d+\}$/.test(I))t=gI(t,g+I.length,b,"");else{if(l===")"||l==="]"){let w=l===")"?s:a;if(w===null)throw Error(`Invalid unmatched "${l}"`);t=`${t.slice(0,w)}(?>${t.slice(w,g)}${I})${t.slice(g+h.length)}`}else t=`${t.slice(0,g-l.length)}(?>${l}${I})${t.slice(g+h.length)}`;k+=4}op.lastIndex+=k}else if(h[0]==="(")n.push(g);else if(h===")")s=n.length?n.pop():null}l=h}return{pattern:t}}var Yr=String.raw,T_=Yr`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,up=Yr`\(\?R=(?<rDepth>[^\)]+)\)|${T_}`,Mc=Yr`\(\?<(?![=!])(?<captureName>[^>]+)>`,vI=Yr`${Mc}|(?<unnamed>\()(?!\?)`,is=new RegExp(Yr`${Mc}|${up}|\(\?|\\?.`,"gsu"),lp="Cannot use multiple overlapping recursions";function kI(t,n){let{hiddenCaptures:s,mode:a}={hiddenCaptures:[],mode:"plugin",...n},l=n?.captureTransfers??new Map;if(!new RegExp(up,"su").test(t))return{pattern:t,captureTransfers:l,hiddenCaptures:s};if(a==="plugin"&&dl(t,Yr`\(\?\(DEFINE\)`,yr.DEFAULT))throw Error("DEFINE groups cannot be used with recursion");let d=[],f=dl(t,Yr`\\[1-9]`,yr.DEFAULT),h=new Map,g=[],I=!1,b=0,v=0,k;is.lastIndex=0;while(k=is.exec(t)){let{0:w,groups:{captureName:P,rDepth:M,gRNameOrNum:N,gRDepth:_}}=k;if(w==="[")b++;else if(!b){if(M){if(SI(M),I)throw Error(lp);if(f)throw Error(`${a==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);let O=t.slice(0,k.index),B=t.slice(is.lastIndex);if(dl(B,up,yr.DEFAULT))throw Error(lp);let X=+M-1;t=bI(O,B,X,!1,s,d,v),l=EI(l,O,X,d.length,0,v);break}else if(N){SI(_);let O=!1;for(let
|
|
59
|
+
`.replace(/\s+/g,""),"gsu");function ap(t){if(!new RegExp(`${II}\\+`).test(t))return{pattern:t};let n=[],s=null,a=null,l="",d=0,f;op.lastIndex=0;while(f=op.exec(t)){let{0:h,index:g,groups:{qBase:I,qMod:b,invalidQ:v}}=f;if(h==="["){if(!d)a=g;d++}else if(h==="]")if(d)d--;else a=null;else if(!d){if(b==="+"&&l&&!l.startsWith("(")){if(v)throw Error(`Invalid quantifier "${h}"`);let k=-1;if(/^\{\d+\}$/.test(I))t=gI(t,g+I.length,b,"");else{if(l===")"||l==="]"){let w=l===")"?s:a;if(w===null)throw Error(`Invalid unmatched "${l}"`);t=`${t.slice(0,w)}(?>${t.slice(w,g)}${I})${t.slice(g+h.length)}`}else t=`${t.slice(0,g-l.length)}(?>${l}${I})${t.slice(g+h.length)}`;k+=4}op.lastIndex+=k}else if(h[0]==="(")n.push(g);else if(h===")")s=n.length?n.pop():null}l=h}return{pattern:t}}var Yr=String.raw,T_=Yr`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,up=Yr`\(\?R=(?<rDepth>[^\)]+)\)|${T_}`,Mc=Yr`\(\?<(?![=!])(?<captureName>[^>]+)>`,vI=Yr`${Mc}|(?<unnamed>\()(?!\?)`,is=new RegExp(Yr`${Mc}|${up}|\(\?|\\?.`,"gsu"),lp="Cannot use multiple overlapping recursions";function kI(t,n){let{hiddenCaptures:s,mode:a}={hiddenCaptures:[],mode:"plugin",...n},l=n?.captureTransfers??new Map;if(!new RegExp(up,"su").test(t))return{pattern:t,captureTransfers:l,hiddenCaptures:s};if(a==="plugin"&&dl(t,Yr`\(\?\(DEFINE\)`,yr.DEFAULT))throw Error("DEFINE groups cannot be used with recursion");let d=[],f=dl(t,Yr`\\[1-9]`,yr.DEFAULT),h=new Map,g=[],I=!1,b=0,v=0,k;is.lastIndex=0;while(k=is.exec(t)){let{0:w,groups:{captureName:P,rDepth:M,gRNameOrNum:N,gRDepth:_}}=k;if(w==="[")b++;else if(!b){if(M){if(SI(M),I)throw Error(lp);if(f)throw Error(`${a==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);let O=t.slice(0,k.index),B=t.slice(is.lastIndex);if(dl(B,up,yr.DEFAULT))throw Error(lp);let X=+M-1;t=bI(O,B,X,!1,s,d,v),l=EI(l,O,X,d.length,0,v);break}else if(N){SI(_);let O=!1;for(let le of g)if(le.name===N||le.num===+N){if(O=!0,le.hasRecursedWithin)throw Error(lp);break}if(!O)throw Error(Yr`Recursive \g cannot be used outside the referenced group "${a==="external"?N:Yr`\g<${N}&R=${_}>`}"`);let B=h.get(N),X=yI(t,B);if(f&&dl(X,Yr`${Mc}|\((?!\?)`,yr.DEFAULT))throw Error(`${a==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);let z=t.slice(B,k.index),K=X.slice(z.length+w.length),W=d.length,J=+_-1,ee=bI(z,K,J,!0,s,d,v);l=EI(l,z,J,d.length-W,W,v);let ue=t.slice(0,B),Ae=t.slice(B+X.length);t=`${ue}${ee}${Ae}`,is.lastIndex+=ee.length-w.length-z.length-K.length,g.forEach((le)=>le.hasRecursedWithin=!0),I=!0}else if(P)v++,h.set(String(v),is.lastIndex),h.set(P,is.lastIndex),g.push({num:v,name:P});else if(w[0]==="("){let O=w==="(";if(O)v++,h.set(String(v),is.lastIndex);g.push(O?{num:v}:{})}else if(w===")")g.pop()}else if(w==="]")b--}return s.push(...d),{pattern:t,captureTransfers:l,hiddenCaptures:s}}function SI(t){let n=`Max depth must be integer between 2 and 100; used ${t}`;if(!/^[1-9]\d*$/.test(t))throw Error(n);if(t=+t,t<2||t>100)throw Error(n)}function bI(t,n,s,a,l,d,f){let h=new Set;if(a)ip(t+n,Mc,({groups:{captureName:I}})=>{h.add(I)},yr.DEFAULT);let g=[s,a?h:null,l,d,f];return`${t}${CI(`(?:${t}`,"forward",...g)}(?:)${CI(`${n})`,"backward",...g)}${n}`}function CI(t,n,s,a,l,d,f){let g=(b)=>n==="forward"?b+2:s-b+2-1,I="";for(let b=0;b<s;b++){let v=g(b);I+=cl(t,Yr`${vI}|\\k<(?<backref>[^>]+)>`,({0:k,groups:{captureName:w,unnamed:P,backref:M}})=>{if(M&&a&&!a.has(M))return k;let N=`_$${v}`;if(P||w){let _=f+d.length+1;return d.push(_),w_(l,_),P?k:`(?<${w}${N}>`}return Yr`\k<${M}${N}>`},yr.DEFAULT)}return I}function w_(t,n){for(let s=0;s<t.length;s++)if(t[s]>=n)t[s]++}function EI(t,n,s,a,l,d){if(t.size&&a){let f=0;ip(n,vI,()=>f++,yr.DEFAULT);let h=d-f+l,g=new Map;return t.forEach((I,b)=>{let v=(a-f*s)/s,k=f*s,w=b>h+f?b+a:b,P=[];for(let M of I)if(M<=h)P.push(M);else if(M>h+f+v)P.push(M+a);else if(M<=h+f)for(let N=0;N<=s;N++)P.push(M+f*N);else for(let N=0;N<=s;N++)P.push(M+k+v*N);g.set(w,P)}),g}return t}var{fromCodePoint:Fn,raw:Ke}=String,ri={},Oc=globalThis.RegExp;ri.flagGroups=(()=>{try{new Oc("(?i:)")}catch{return!1}return!0})();ri.unicodeSets=(()=>{try{new Oc("[[]]","v")}catch{return!1}return!0})();ri.bugFlagVLiteralHyphenIsRange=ri.unicodeSets?(()=>{try{new Oc(Ke`[\d\-a]`,"v")}catch{return!0}return!1})():!1;ri.bugNestedClassIgnoresNegation=ri.unicodeSets&&new Oc("[[^a]]","v").test("a");function _c(t,{enable:n,disable:s}){return{dotAll:!s?.dotAll&&!!(n?.dotAll||t.dotAll),ignoreCase:!s?.ignoreCase&&!!(n?.ignoreCase||t.ignoreCase)}}function ml(t,n,s){if(!t.has(n))t.set(n,s);return t.get(n)}function pp(t,n){return TI[t]>=TI[n]}function R_(t,n){if(t==null)throw Error(n??"Value expected");return t}var TI={ES2025:2025,ES2024:2024,ES2018:2018},L_={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function PI(t={}){if({}.toString.call(t)!=="[object Object]")throw Error("Unexpected options");if(t.target!==void 0&&!L_[t.target])throw Error(`Unexpected target "${t.target}"`);let n={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...t,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...t.rules}};if(n.target==="auto")n.target=ri.flagGroups?"ES2025":ri.unicodeSets?"ES2024":"ES2018";return n}var A_="[\t-\r ]",P_=new Set([Fn(304),Fn(305)]),Wi=Ke`[\p{L}\p{M}\p{N}\p{Pc}]`;function MI(t){if(P_.has(t))return[t];let n=new Set,s=t.toLowerCase(),a=s.toUpperCase(),l=O_.get(s),d=M_.get(s),f=__.get(s);if([...a].length===1)n.add(a);return f&&n.add(f),l&&n.add(l),n.add(s),d&&n.add(d),[...n]}var hp=new Map(`C Other
|
|
60
60
|
Cc Control cntrl
|
|
61
61
|
Cf Format
|
|
62
62
|
Cn Unassigned
|
|
@@ -149,10 +149,10 @@ XID_Continue XIDC
|
|
|
149
149
|
XID_Start XIDS`.split(/\s/).map((t)=>[Ks(t),t])),M_=new Map([["s",Fn(383)],[Fn(383),"s"]]),__=new Map([[Fn(223),Fn(7838)],[Fn(107),Fn(8490)],[Fn(229),Fn(8491)],[Fn(969),Fn(8486)]]),O_=new Map([So(453),So(456),So(459),So(498),...cp(8072,8079),...cp(8088,8095),...cp(8104,8111),So(8124),So(8140),So(8188)]),$_=new Map([["alnum",Ke`[\p{Alpha}\p{Nd}]`],["alpha",Ke`\p{Alpha}`],["ascii",Ke`\p{ASCII}`],["blank",Ke`[\p{Zs}\t]`],["cntrl",Ke`\p{Cc}`],["digit",Ke`\p{Nd}`],["graph",Ke`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",Ke`\p{Lower}`],["print",Ke`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",Ke`[\p{P}\p{S}]`],["space",Ke`\p{space}`],["upper",Ke`\p{Upper}`],["word",Ke`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",Ke`\p{AHex}`]]);function F_(t,n){let s=[];for(let a=t;a<=n;a++)s.push(a);return s}function So(t){let n=Fn(t);return[n.toLowerCase(),n]}function cp(t,n){return F_(t,n).map((s)=>So(s))}var _I=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function N_(t,n){let s={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...n};OI(t);let a={accuracy:s.accuracy,asciiWordBoundaries:s.asciiWordBoundaries,avoidSubclass:s.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:pp(s.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};rs(t,D_,a);let l={dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},d={currentFlags:l,prevFlags:null,globalFlags:l,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:a.subroutineRefMap};rs(t,H_,d);let f={groupsByName:d.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:d.reffedNodesByReferencer};return rs(t,U_,f),t._originMap=d.groupOriginByCopy,t._strategy=a.strategy,t}var D_={AbsenceFunction({node:t,parent:n,replaceWith:s}){let{body:a,kind:l}=t;if(l==="repeater"){let d=Ar();d.body[0].body.push(Io({negate:!0,body:a}),ns("Any"));let f=Ar();f.body[0].body.push(np("greedy",0,1/0,d)),s(Cn(f,n),{traverse:!0})}else throw Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:t,parent:n,key:s},{flagDirectivesByAlt:a}){let l=t.body.filter((d)=>d.kind==="flags");for(let d=s+1;d<n.body.length;d++){let f=n.body[d];ml(a,f,[]).push(...l)}},exit({node:t},{flagDirectivesByAlt:n}){if(n.get(t)?.length){let s=FI(n.get(t));if(s){let a=Ar({flags:s});a.body[0].body=t.body,t.body=[Cn(a,t)]}}}},Assertion({node:t,parent:n,key:s,container:a,root:l,remove:d,replaceWith:f},h){let{kind:g,negate:I}=t,{asciiWordBoundaries:b,avoidSubclass:v,supportedGNodes:k,wordIsAscii:w}=h;if(g==="text_segment_boundary")throw Error(`Unsupported text segment boundary "\\${I?"Y":"y"}"`);else if(g==="line_end")f(Cn(Io({body:[Vi({body:[Lc("string_end")]}),Vi({body:[qs(10)]})]}),n));else if(g==="line_start")f(Cn(Xi(Ke`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),n));else if(g==="search_start")if(k.has(t))l.flags.sticky=!0,d();else{let P=a[s-1];if(P&&K_(P))f(Cn(Io({negate:!0}),n));else if(v)throw Error(Ke`Uses "\G" in a way that requires a subclass`);else f(bo(Lc("string_start"),n)),h.strategy="clip_search"}else if(g==="string_end"||g==="string_start");else if(g==="string_end_newline")f(Cn(Xi(Ke`(?=\n?\z)`),n));else if(g==="word_boundary"){if(!w&&!b){let P=`(?:(?<=${Wi})(?!${Wi})|(?<!${Wi})(?=${Wi}))`,M=`(?:(?<=${Wi})(?=${Wi})|(?<!${Wi})(?!${Wi}))`;f(Cn(Xi(I?M:P),n))}}else throw Error(`Unexpected assertion kind "${g}"`)},Backreference({node:t},{jsGroupNameMap:n}){let{ref:s}=t;if(typeof s==="string"&&!mp(s))s=dp(s,n),t.ref=s},CapturingGroup({node:t},{jsGroupNameMap:n,subroutineRefMap:s}){let{name:a}=t;if(a&&!mp(a))a=dp(a,n),t.name=a;if(s.set(t.number,t),a)s.set(a,t)},CharacterClassRange({node:t,parent:n,replaceWith:s}){if(n.kind==="intersection"){let a=ll({body:[t]});s(Cn(a,n),{traverse:!0})}},CharacterSet({node:t,parent:n,replaceWith:s},{accuracy:a,minTargetEs2024:l,digitIsAscii:d,spaceIsAscii:f,wordIsAscii:h}){let{kind:g,negate:I,value:b}=t;if(d&&(g==="digit"||b==="digit")){s(bo(Ac("digit",{negate:I}),n));return}if(f&&(g==="space"||b==="space")){s(Cn(fp(Xi(A_),I),n));return}if(h&&(g==="word"||b==="word")){s(bo(Ac("word",{negate:I}),n));return}if(g==="any")s(bo(ns("Any"),n));else if(g==="digit")s(bo(ns("Nd",{negate:I}),n));else if(g==="dot");else if(g==="text_segment"){if(a==="strict")throw Error(Ke`Use of "\X" requires non-strict accuracy`);let v="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",k=Ke`\p{RI}{2}|${v}(?:\u200D${v})*`;s(Cn(Xi(Ke`(?>\r\n|${l?Ke`\p{RGI_Emoji}`:k}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),n))}else if(g==="hex")s(bo(ns("AHex",{negate:I}),n));else if(g==="newline")s(Cn(Xi(I?`[^
|
|
150
150
|
]`:`(?>\r
|
|
151
151
|
?|[
|
|
152
|
-
\v\f
\u2028\u2029])`),n));else if(g==="posix")if(!l&&(b==="graph"||b==="print")){if(a==="strict")throw Error(`POSIX class "${b}" requires min target ES2024 or non-strict accuracy`);let v={graph:"!-~",print:" -~"}[b];if(I)v=`\x00-${Fn(v.codePointAt(0)-1)}${Fn(v.codePointAt(2)+1)}-\uDBFF\uDFFF`;s(Cn(Xi(`[${v}]`),n))}else s(Cn(fp(Xi($_.get(b)),I),n));else if(g==="property"){if(!hp.has(Ks(b)))t.key="sc"}else if(g==="space")s(bo(ns("space",{negate:I}),n));else if(g==="word")s(Cn(fp(Xi(Wi),I),n));else throw Error(`Unexpected character set kind "${g}"`)},Directive({node:t,parent:n,root:s,remove:a,replaceWith:l,removeAllPrevSiblings:d,removeAllNextSiblings:f}){let{kind:h,flags:g}=t;if(h==="flags")if(!g.enable&&!g.disable)a();else{let I=Ar({flags:g});I.body[0].body=f(),l(Cn(I,n),{traverse:!0})}else if(h==="keep"){let I=s.body[0],v=s.body.length===1&&Tc(I,{type:"Group"})&&I.body[0].body.length===1?I.body[0]:s;if(n.parent!==v||v.body.length>1)throw Error(Ke`Uses "\K" in a way that's unsupported`);let k=Io({behind:!0});k.body[0].body=d(),l(Cn(k,n))}else throw Error(`Unexpected directive kind "${h}"`)},Flags({node:t,parent:n}){if(t.posixIsAscii)throw Error('Unsupported flag "P"');if(t.textSegmentMode==="word")throw Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach((s)=>delete t[s]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),n.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;let{enable:n,disable:s}=t.flags;n?.extended&&delete n.extended,s?.extended&&delete s.extended,n?.dotAll&&s?.dotAll&&delete n.dotAll,n?.ignoreCase&&s?.ignoreCase&&delete n.ignoreCase,n&&!Object.keys(n).length&&delete t.flags.enable,s&&!Object.keys(s).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},n){let{kind:s}=t;if(s==="lookbehind")n.passedLookbehind=!0},NamedCallout({node:t,parent:n,replaceWith:s}){let{kind:a}=t;if(a==="fail")s(Cn(Io({negate:!0}),n));else throw Error(`Unsupported named callout "(*${a.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){let n=Ar();n.body[0].body.push(t.body),t.body=Cn(n,t)}},Regex:{enter({node:t},{supportedGNodes:n}){let s=[],a=!1,l=!1;for(let d of t.body)if(d.body.length===1&&d.body[0].kind==="search_start")d.body.pop();else{let f=DI(d.body);if(f)a=!0,Array.isArray(f)?s.push(...f):s.push(f);else l=!0}if(a&&!l)s.forEach((d)=>n.add(d))},exit(t,{accuracy:n,passedLookbehind:s,strategy:a}){if(n==="strict"&&s&&a)throw Error(Ke`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:n}){let{ref:s}=t;if(typeof s==="string"&&!mp(s))s=dp(s,n),t.ref=s}},H_={Backreference({node:t},{multiplexCapturesToLeftByRef:n,reffedNodesByReferencer:s}){let{orphan:a,ref:l}=t;if(!a)s.set(t,[...n.get(l).map(({node:d})=>d)])},CapturingGroup:{enter({node:t,parent:n,replaceWith:s,skip:a},{groupOriginByCopy:l,groupsByName:d,multiplexCapturesToLeftByRef:f,openRefs:h,reffedNodesByReferencer:g}){let I=l.get(t);if(I&&h.has(t.number)){let v=bo(wI(t.number),n);g.set(v,h.get(t.number)),s(v);return}if(h.set(t.number,t),f.set(t.number,[]),t.name)ml(f,t.name,[]);let b=f.get(t.name??t.number);for(let v=0;v<b.length;v++){let k=b[v];if(I===k.node||I&&I===k.origin||t===k.origin){b.splice(v,1);break}}if(f.get(t.number).push({node:t,origin:I}),t.name)f.get(t.name).push({node:t,origin:I});if(t.name){let v=ml(d,t.name,new Map),k=!1;if(I)k=!0;else for(let w of v.values())if(!w.hasDuplicateNameToRemove){k=!0;break}d.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:k})}},exit({node:t},{openRefs:n}){if(n.get(t.number)===t)n.delete(t.number)}},Group:{enter({node:t},n){if(n.prevFlags=n.currentFlags,t.flags)n.currentFlags=_c(n.currentFlags,t.flags)},exit(t,n){n.currentFlags=n.prevFlags}},Subroutine({node:t,parent:n,replaceWith:s},a){let{isRecursive:l,ref:d}=t;if(l){let b=n;while(b=b.parent)if(b.type==="CapturingGroup"&&(b.name===d||b.number===d))break;a.reffedNodesByReferencer.set(t,b);return}let f=a.subroutineRefMap.get(d),h=d===0,g=h?wI(0):$I(f,a.groupOriginByCopy,null),I=g;if(!h){let b=FI(z_(f,(k)=>k.type==="Group"&&!!k.flags)),v=b?_c(a.globalFlags,b):a.globalFlags;if(!B_(v,a.currentFlags))I=Ar({flags:j_(v)}),I.body[0].body.push(g)}s(Cn(I,n),{traverse:!h})}},U_={Backreference({node:t,parent:n,replaceWith:s},a){if(t.orphan){a.highestOrphanBackref=Math.max(a.highestOrphanBackref,t.ref);return}let d=a.reffedNodesByReferencer.get(t).filter((f)=>G_(f,t));if(!d.length)s(Cn(Io({negate:!0}),n));else if(d.length>1){let f=Ar({atomic:!0,body:d.reverse().map((h)=>Vi({body:[wc(h.number)]}))});s(Cn(f,n))}else t.ref=d[0].number},CapturingGroup({node:t},n){if(t.number=++n.numCapturesToLeft,t.name){if(n.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove)delete t.name}},Regex:{exit({node:t},n){let s=Math.max(n.highestOrphanBackref-n.numCapturesToLeft,0);for(let a=0;a<s;a++){let l=tp();t.body.at(-1).body.push(l)}}},Subroutine({node:t},n){if(!t.isRecursive||t.ref===0)return;t.ref=n.reffedNodesByReferencer.get(t).number}};function OI(t){rs(t,{"*"({node:n,parent:s}){n.parent=s}})}function B_(t,n){return t.dotAll===n.dotAll&&t.ignoreCase===n.ignoreCase}function G_(t,n){let s=n;do{if(s.type==="Regex")return!1;if(s.type==="Alternative")continue;if(s===t)return!1;let a=NI(s.parent);for(let l of a){if(l===s)break;if(l===t||HI(l,t))return!0}}while(s=s.parent);throw Error("Unexpected path")}function $I(t,n,s,a){let l=Array.isArray(t)?[]:{};for(let[d,f]of Object.entries(t))if(d==="parent")l.parent=Array.isArray(s)?a:s;else if(f&&typeof f==="object")l[d]=$I(f,n,l,s);else{if(d==="type"&&f==="CapturingGroup")n.set(l,n.get(t)??t);l[d]=f}return l}function wI(t){let n=rp(t);return n.isRecursive=!0,n}function z_(t,n){let s=[];while(t=t.parent)if(!n||n(t))s.push(t);return s}function dp(t,n){if(n.has(t))return n.get(t);let s=`$${n.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return n.set(t,s),s}function FI(t){let n=["dotAll","ignoreCase"],s={enable:{},disable:{}};if(t.forEach(({flags:a})=>{n.forEach((l)=>{if(a.enable?.[l])delete s.disable[l],s.enable[l]=!0;if(a.disable?.[l])s.disable[l]=!0})}),!Object.keys(s.enable).length)delete s.enable;if(!Object.keys(s.disable).length)delete s.disable;if(s.enable||s.disable)return s;return null}function j_({dotAll:t,ignoreCase:n}){let s={};if(t||n)s.enable={},t&&(s.enable.dotAll=!0),n&&(s.enable.ignoreCase=!0);if(!t||!n)s.disable={},!t&&(s.disable.dotAll=!0),!n&&(s.disable.ignoreCase=!0);return s}function NI(t){if(!t)throw Error("Node expected");let{body:n}=t;return Array.isArray(n)?n:n?[n]:null}function DI(t){let n=t.find((s)=>s.kind==="search_start"||V_(s,{negate:!1})||!q_(s));if(!n)return null;if(n.kind==="search_start")return n;if(n.type==="LookaroundAssertion")return n.body[0].body[0];if(n.type==="CapturingGroup"||n.type==="Group"){let s=[];for(let a of n.body){let l=DI(a.body);if(!l)return null;Array.isArray(l)?s.push(...l):s.push(l)}return s}return null}function HI(t,n){let s=NI(t)??[];for(let a of s)if(a===n||HI(a,n))return!0;return!1}function q_({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function K_(t){let n=["Character","CharacterClass","CharacterSet"];return n.includes(t.type)||t.type==="Quantifier"&&t.min&&n.includes(t.body.type)}function V_(t,n){let s={negate:null,...n};return t.type==="LookaroundAssertion"&&(s.negate===null||t.negate===s.negate)&&t.body.length===1&&Tc(t.body[0],{type:"Assertion",kind:"search_start"})}function mp(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function Xi(t,n){let a=Rc(t,{...n,unicodePropertyMap:hp}).body;if(a.length>1||a[0].body.length>1)return Ar({body:a});return a[0].body[0]}function fp(t,n){return t.negate=n,t}function bo(t,n){return t.parent=n,t}function Cn(t,n){return OI(t),t.parent=n,t}function W_(t,n){let s=PI(n),a=pp(s.target,"ES2024"),l=pp(s.target,"ES2025"),d=s.rules.recursionLimit;if(!Number.isInteger(d)||d<2||d>20)throw Error("Invalid recursionLimit; use 2-20");let f=null,h=null;if(!l){let w=[t.flags.ignoreCase];rs(t,X_,{getCurrentModI:()=>w.at(-1),popModI(){w.pop()},pushModI(P){w.push(P)},setHasCasedChar(){if(w.at(-1))f=!0;else h=!0}})}let g={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||f)&&!h)},I=t,b={accuracy:s.accuracy,appliedGlobalFlags:g,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:I,originMap:t._originMap,recursionLimit:d,useAppliedIgnoreCase:!!(!l&&f&&h),useFlagMods:l,useFlagV:a,verbose:s.verbose};function v(w){return b.lastNode=I,I=w,R_(Y_[w.type],`Unexpected node type "${w.type}"`)(w,b,v)}let k={pattern:t.body.map(v).join("|"),flags:v(t.flags),options:{...t.options}};if(!a)delete k.options.force.v,k.options.disable.v=!0,k.options.unicodeSetsPlugin=null;return k._captureTransfers=new Map,k._hiddenCaptures=[],b.captureMap.forEach((w,P)=>{if(w.hidden)k._hiddenCaptures.push(P);if(w.transferTo)ml(k._captureTransfers,w.transferTo,[]).push(P)}),k}var X_={"*":{enter({node:t},n){if(LI(t)){let s=n.getCurrentModI();n.pushModI(t.flags?_c({ignoreCase:s},t.flags).ignoreCase:s)}},exit({node:t},n){if(LI(t))n.popModI()}},Backreference(t,n){n.setHasCasedChar()},Character({node:t},n){if(gp(Fn(t.value)))n.setHasCasedChar()},CharacterClassRange({node:t,skip:n},s){if(n(),UI(t,{firstOnly:!0}).length)s.setHasCasedChar()},CharacterSet({node:t},n){if(t.kind==="property"&&_I.has(t.value))n.setHasCasedChar()}},Y_={Alternative({body:t},n,s){return t.map(s).join("")},Assertion({kind:t,negate:n}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return n?Ke`\B`:Ke`\b`;throw Error(`Unexpected assertion kind "${t}"`)},Backreference({ref:t},n){if(typeof t!=="number")throw Error("Unexpected named backref in transformed AST");if(!n.useFlagMods&&n.accuracy==="strict"&&n.currentFlags.ignoreCase&&!n.captureMap.get(t).ignoreCase)throw Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t},CapturingGroup(t,n,s){let{body:a,name:l,number:d}=t,f={ignoreCase:n.currentFlags.ignoreCase},h=n.originMap.get(t);if(h){if(f.hidden=!0,d>h.number)f.transferTo=h.number}return n.captureMap.set(d,f),`(${l?`?<${l}>`:""}${a.map(s).join("|")})`},Character({value:t},n){let s=Fn(t),a=Ws(t,{escDigit:n.lastNode.type==="Backreference",inCharClass:n.inCharClass,useFlagV:n.useFlagV});if(a!==s)return a;if(n.useAppliedIgnoreCase&&n.currentFlags.ignoreCase&&gp(s)){let l=MI(s);return n.inCharClass?l.join(""):l.length>1?`[${l.join("")}]`:l[0]}return s},CharacterClass(t,n,s){let{kind:a,negate:l,parent:d}=t,{body:f}=t;if(a==="intersection"&&!n.useFlagV)throw Error("Use of character class intersection requires min target ES2024");if(ri.bugFlagVLiteralHyphenIsRange&&n.useFlagV&&f.some(AI))f=[qs(45),...f.filter((I)=>!AI(I))];let h=()=>`[${l?"^":""}${f.map(s).join(a==="intersection"?"&&":"")}]`;if(!n.inCharClass){if((!n.useFlagV||ri.bugNestedClassIgnoresNegation)&&!l){let b=f.filter((v)=>v.type==="CharacterClass"&&v.kind==="union"&&v.negate);if(b.length){let v=Ar(),k=v.body[0];if(v.parent=d,k.parent=v,f=f.filter((w)=>!b.includes(w)),t.body=f,f.length)t.parent=k,k.body.push(t);else v.body.pop();return b.forEach((w)=>{let P=Vi({body:[w]});w.parent=P,P.parent=v,v.body.push(P)}),s(v)}}n.inCharClass=!0;let I=h();return n.inCharClass=!1,I}let g=f[0];if(a==="union"&&!l&&g&&((!n.useFlagV||!n.verbose)&&d.kind==="union"&&!(ri.bugFlagVLiteralHyphenIsRange&&n.useFlagV)||!n.verbose&&d.kind==="intersection"&&f.length===1&&g.type!=="CharacterClassRange"))return f.map(s).join("");if(!n.useFlagV&&d.type==="CharacterClass")throw Error("Uses nested character class in a way that requires min target ES2024");return h()},CharacterClassRange(t,n){let s=t.min.value,a=t.max.value,l={escDigit:!1,inCharClass:!0,useFlagV:n.useFlagV},d=Ws(s,l),f=Ws(a,l),h=new Set;if(n.useAppliedIgnoreCase&&n.currentFlags.ignoreCase){let g=UI(t);tO(g).forEach((b)=>{h.add(Array.isArray(b)?`${Ws(b[0],l)}-${Ws(b[1],l)}`:Ws(b,l))})}return`${d}-${f}${[...h].join("")}`},CharacterSet({kind:t,negate:n,value:s,key:a},l){if(t==="dot")return l.currentFlags.dotAll?l.appliedGlobalFlags.dotAll||l.useFlagMods?".":"[^]":Ke`[^\n]`;if(t==="digit")return n?Ke`\D`:Ke`\d`;if(t==="property"){if(l.useAppliedIgnoreCase&&l.currentFlags.ignoreCase&&_I.has(s))throw Error(`Unicode property "${s}" can't be case-insensitive when other chars have specific case`);return`${n?Ke`\P`:Ke`\p`}{${a?`${a}=`:""}${s}}`}if(t==="word")return n?Ke`\W`:Ke`\w`;throw Error(`Unexpected character set kind "${t}"`)},Flags(t,n){return(n.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:n,flags:s,parent:a},l,d){let f=l.currentFlags;if(s)l.currentFlags=_c(f,s);let h=n.map(d).join("|"),g=!l.verbose&&n.length===1&&a.type!=="Quantifier"&&!t&&(!l.useFlagMods||!s)?h:`(?${nO(t,s,l.useFlagMods)}${h})`;return l.currentFlags=f,g},LookaroundAssertion({body:t,kind:n,negate:s},a,l){return`(?${`${n==="lookahead"?"":"<"}${s?"!":"="}`}${t.map(l).join("|")})`},Quantifier(t,n,s){return s(t.body)+rO(t)},Subroutine({isRecursive:t,ref:n},s){if(!t)throw Error("Unexpected non-recursive subroutine in transformed AST");let a=s.recursionLimit;return n===0?`(?R=${a})`:Ke`\g<${n}&R=${a}>`}},J_=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Q_=new Set(["-","\\","]","^","["]),Z_=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),RI=new Map([[9,Ke`\t`],[10,Ke`\n`],[11,Ke`\v`],[12,Ke`\f`],[13,Ke`\r`],[8232,Ke`\u2028`],[8233,Ke`\u2029`],[65279,Ke`\uFEFF`]]),eO=/^\p{Cased}$/u;function gp(t){return eO.test(t)}function UI(t,n){let s=!!n?.firstOnly,a=t.min.value,l=t.max.value,d=[];if(a<65&&(l===65535||l>=131071)||a===65536&&l>=131071)return d;for(let f=a;f<=l;f++){let h=Fn(f);if(!gp(h))continue;let g=MI(h).filter((I)=>{let b=I.codePointAt(0);return b<a||b>l});if(g.length){if(d.push(...g),s)break}}return d}function Ws(t,{escDigit:n,inCharClass:s,useFlagV:a}){if(RI.has(t))return RI.get(t);if(t<32||t>126&&t<160||t>262143||n&&iO(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;let l=s?a?Z_:Q_:J_,d=Fn(t);return(l.has(d)?"\\":"")+d}function tO(t){let n=t.map((l)=>l.codePointAt(0)).sort((l,d)=>l-d),s=[],a=null;for(let l=0;l<n.length;l++)if(n[l+1]===n[l]+1)a??=n[l];else if(a===null)s.push(n[l]);else s.push([a,n[l]]),a=null;return s}function nO(t,n,s){if(t)return">";let a="";if(n&&s){let{enable:l,disable:d}=n;a=(l?.ignoreCase?"i":"")+(l?.dotAll?"s":"")+(d?"-":"")+(d?.ignoreCase?"i":"")+(d?.dotAll?"s":"")}return`${a}:`}function rO({kind:t,max:n,min:s}){let a;if(!s&&n===1)a="?";else if(!s&&n===1/0)a="*";else if(s===1&&n===1/0)a="+";else if(s===n)a=`{${s}}`;else a=`{${s},${n===1/0?"":n}}`;return a+{greedy:"",lazy:"?",possessive:"+"}[t]}function LI({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function iO(t){return t>47&&t<58}function AI({type:t,value:n}){return t==="Character"&&n===45}var oO=class t extends RegExp{#t=new Map;#e=null;#r;#n=null;#i=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(n,s,a){let l=!!a?.lazyCompile;if(n instanceof RegExp){if(a)throw Error("Cannot provide options when copying a regexp");let d=n;super(d,s);if(this.#r=d.source,d instanceof t)this.#t=d.#t,this.#n=d.#n,this.#i=d.#i,this.rawOptions=d.rawOptions}else{let d={hiddenCaptures:[],strategy:null,transfers:[],...a};super(l?"":n,s);this.#r=n,this.#t=aO(d.hiddenCaptures,d.transfers),this.#i=d.strategy,this.rawOptions=a??{}}if(!l)this.#e=this}exec(n){if(!this.#e){let{lazyCompile:l,...d}=this.rawOptions;this.#e=new t(this.#r,this.flags,d)}let s=this.global||this.sticky,a=this.lastIndex;if(this.#i==="clip_search"&&s&&a){this.lastIndex=0;let l=this.#o(n.slice(a));if(l)sO(l,a,n,this.hasIndices),this.lastIndex+=a;return l}return this.#o(n)}#o(n){this.#e.lastIndex=this.lastIndex;let s=super.exec.call(this.#e,n);if(this.lastIndex=this.#e.lastIndex,!s||!this.#t.size)return s;let a=[...s];s.length=1;let l;if(this.hasIndices)l=[...s.indices],s.indices.length=1;let d=[0];for(let f=1;f<a.length;f++){let{hidden:h,transferTo:g}=this.#t.get(f)??{};if(h)d.push(null);else if(d.push(s.length),s.push(a[f]),this.hasIndices)s.indices.push(l[f]);if(g&&a[f]!==void 0){let I=d[g];if(!I)throw Error(`Invalid capture transfer to "${I}"`);if(s[I]=a[f],this.hasIndices)s.indices[I]=l[f];if(s.groups){if(!this.#n)this.#n=lO(this.source);let b=this.#n.get(g);if(b){if(s.groups[b]=a[f],this.hasIndices)s.indices.groups[b]=l[f]}}}}return s}};function sO(t,n,s,a){if(t.index+=n,t.input=s,a){let l=t.indices;for(let f=0;f<l.length;f++){let h=l[f];if(h)l[f]=[h[0]+n,h[1]+n]}let d=l.groups;if(d)Object.keys(d).forEach((f)=>{let h=d[f];if(h)d[f]=[h[0]+n,h[1]+n]})}}function aO(t,n){let s=new Map;for(let a of t)s.set(a,{hidden:!0});for(let[a,l]of n)for(let d of l)ml(s,d,{}).transferTo=a;return s}function lO(t){let n=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,s=new Map,a=0,l=0,d;while(d=n.exec(t)){let{0:f,groups:{capture:h,name:g}}=d;if(f==="[")a++;else if(!a){if(h){if(l++,g)s.set(l,g)}}else if(f==="]")a--}return s}function BI(t,n){let s=uO(t,n);if(s.options)return new oO(s.pattern,s.flags,s.options);return new RegExp(s.pattern,s.flags)}function uO(t,n){let s=PI(n),a=Rc(t,{flags:s.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:s.rules.captureGroup,singleline:s.rules.singleline},skipBackrefValidation:s.rules.allowOrphanBackrefs,unicodePropertyMap:hp}),l=N_(a,{accuracy:s.accuracy,asciiWordBoundaries:s.rules.asciiWordBoundaries,avoidSubclass:s.avoidSubclass,bestEffortTarget:s.target}),d=W_(l,s),f=kI(d.pattern,{captureTransfers:d._captureTransfers,hiddenCaptures:d._hiddenCaptures,mode:"external"}),h=ap(f.pattern),g=sp(h.pattern,{captureTransfers:f.captureTransfers,hiddenCaptures:f.hiddenCaptures}),I={pattern:g.pattern,flags:`${s.hasIndices?"d":""}${s.global?"g":""}${d.flags}${d.options.disable.v?"u":"v"}`};if(s.avoidSubclass){if(s.lazyCompileLength!==1/0)throw Error("Lazy compilation requires subclass")}else{let b=g.hiddenCaptures.sort((P,M)=>P-M),v=Array.from(g.captureTransfers),k=l._strategy,w=I.pattern.length>=s.lazyCompileLength;if(b.length||v.length||k||w)I.options={...b.length&&{hiddenCaptures:b},...v.length&&{transfers:v},...k&&{strategy:k},...w&&{lazyCompile:w}}}return I}function yp(t,n){return BI(t,{global:!0,hasIndices:!0,lazyCompileLength:3000,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...n})}function $c(t={}){let n={target:"auto",cache:new Map,...t};return n.regexConstructor||=(s)=>yp(s,{target:n.target}),{createScanner(s){return new Xx(s,n)},createString(s){return{content:s}}}}async function Fc(t){if(Ku())throw Error(`resolveLanguage("${t}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let n=xc.get(t);if(n!=null)return n;try{let s=zx.get(t);if(s==null&&Object.prototype.hasOwnProperty.call(zs,t))s=zs[t];if(s==null)throw Error(`resolveLanguage: "${t}" not found in bundled or custom languages`);let a=s().then(({default:l})=>{let d={name:t,data:l};if(!Lr.has(t))Lr.set(t,d);return d});return xc.set(t,a),await a}finally{xc.delete(t)}}function Nc(t){return Lr.get(t)??Fc(t)}var Dc="diffs-container",GI=(()=>{try{return!1}catch{return!1}})(),zI=/(?=^From [a-f0-9]+ .+$)/m,xp=/(?=^diff --git)/gm;var jI=/(?<=\n)/,qI=/^(---|\+\+\+)\s+([^\t\r\n]+)/,KI=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var Xs="header-prefix",Ys="header-filename-suffix",Js="header-metadata",Qs="header-custom",u={dark:"pierre-dark",light:"pierre-light"},VI="data-theme-css",WI="data-unsafe-css";var XI="data-diffs-scrollbar-measure",YI="data-diffs-code-view-header",JI="data-diffs-code-view-footer",Hc="--diffs-scrollbar-gutter-measured";var QI=1e5,fl={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Zs={...fl,hunkLineCount:1},ZI={paddingTop:8,paddingBottom:8,gap:8},eS={omega:0.015,positionEpsilon:0.5,velocityEpsilon:0.05},tS=Object.freeze({fromStart:0,fromEnd:0}),ea={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Uc={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function C(t=u){let n=[];if(typeof t==="string")n.push(t);else n.push(t.dark),n.push(t.light);return n}var ta=new Set;function ur(t){for(let n of C(t))if(!ta.has(n))return!1;return!0}function Ne(t,n){t=Array.isArray(t)?t:[t];for(let s of t){let a;if(typeof s==="string"){if(a=vn.getResolvedTheme(s),a==null)throw Error(`loadResolvedThemes: ${s} is not resolved, you must resolve it before calling loadResolvedThemes`)}else if(a=s,s=s.name,vn.getResolvedTheme(s)==null)vn.seedResolvedTheme(s,a);if(ta.has(s))continue;ta.add(s),n.loadThemeSync(a)}}function nS(t){return vn.getResolvedTheme(t)??Ge(t)}var ii;async function j({themes:t,langs:n,preferredHighlighter:s="shiki-js"}){ii??=vc({themes:[],langs:["text"],engine:s==="shiki-wasm"?Ec(import("shiki/wasm")):$c()});let a=cO(ii)?await ii:ii;ii=a;let l=[];for(let f of Array.from(new Set(n))){if(f==="text"||f==="ansi")continue;let h=Nc(f);if("then"in h)l.push(h);else qf(h,a)}let d=[];for(let f of t){let h=nS(f);if("then"in h)d.push(h);else Ne(h,ii)}if(l.length>0||d.length>0)await Promise.all([Promise.all(l).then((f)=>{qf(f,a)}),Promise.all(d).then((f)=>{Ne(f,a)})]);return a}function rS(t=ii){return t!=null&&!("then"in t)}function T(t){if(ii==null||"then"in ii)return;if(t!=null&&(!ur(t.theme)||!U(t.lang)))return;return ii}function cO(t=ii){return t!=null&&"then"in t}async function ae(t){await j(t)}for(let t of pc.getThemes())vn.registerThemeIfAbsent(t.name,t.load);function Nn(t,n){return t-(n===0?0:1)}function Dn(t,n){return Nn(t,n)+n}function os(t,...n){return`ck1:${JSON.stringify([t,...n])}`}function Pr(t){let n=t.length;if(t.charCodeAt(n-1)===10){if(n--,t.charCodeAt(n-1)===13)n--}return t.slice(0,n)}var dO=new TextEncoder,mO=new TextDecoder("utf-8",{ignoreBOM:!0}),fO=/[\uD800-\uDFFF]/;var na=new Uint8Array(1024);function Ip(){if(na.length!==1024)na=new Uint8Array(1024)}function Tn(t){if(t.length===0)return t;if(fO.test(t))return JSON.parse(JSON.stringify(t));let n=t.length*3;if(na.length<n)na=new Uint8Array(n);let{written:s}=dO.encodeInto(t,na);return mO.decode(na.subarray(0,s))}var pO=new TextDecoder("utf-8",{ignoreBOM:!0}),hO={'"':'"',"\\":"\\",a:"\x07",b:"\b",t:"\t",n:`
|
|
153
|
-
`,v:"\v",f:"\f",r:"\r"};function iS(t){if(t[0]!=='"')return;let n="",s=1;while(s<t.length){let a=t[s];if(a==='"')return{fileName:n,rawLength:s+1};if(a!=="\\"){n+=a,s++;continue}let l=hO[t[s+1]];if(l!=null){n+=l,s+=2;continue}let d=[];do{let f=gO(t,s+1);if(f==null)return;d.push(f),s+=4}while(t[s]==="\\"&&t[s+1]>="0"&&t[s+1]<="7");n+=pO.decode(new Uint8Array(d))}}function gO(t,n){let s=t.charCodeAt(n)-48,a=t.charCodeAt(n+1)-48,l=t.charCodeAt(n+2)-48;if(s>=0&&s<=3&&a>=0&&a<=7&&l>=0&&l<=7)return s*64+a*8+l}function sS(t){for(let n of t.hunks)for(let s=0;s<n.hunkContent.length;s++){let a=n.hunkContent[s];if(a.type!=="change")continue;let l=yO(t,a);if(l!=null)n.hunkContent.splice(s,1,...l),s+=l.length-1}}function aS(t,n,s){let{hunkContent:a}=t;for(let l=1;l<a.length;l++){let d=a[l],f=a[l-1];if(d.type!=="change"||d.additions>0&&d.deletions>0||f.type!=="context")continue;let h=d.additions>0,g=h?n.additionLines:n.deletionLines,I=h?d.additionLineIndex:d.deletionLineIndex,b=h?d.additions:d.deletions,v=g[I]??"";if(v.trim()!=="")continue;let k=!0;for(let _=1;_<b;_++)if(g[I+_]!==v){k=!1;break}if(!k)continue;let w=0;while(w<f.lines&&n.additionLines[f.additionLineIndex+f.lines-1-w]===v)w++;if(w===0)continue;if(l===1&&w===f.lines)continue;if(s!=null){if(w=s(d,w),w===0)continue}d.additionLineIndex-=w,d.deletionLineIndex-=w;let P=d.additionLineIndex+d.additions,M=d.deletionLineIndex+d.deletions,N=a[l+1];if(N?.type==="context")N.lines+=w,N.additionLineIndex=P,N.deletionLineIndex=M;else a.splice(l+1,0,{type:"context",lines:w,additionLineIndex:P,deletionLineIndex:M});if(f.lines-=w,f.lines===0)a.splice(l-1,1),l--}}function yO(t,n){let{deletions:s,additions:a,deletionLineIndex:l,additionLineIndex:d}=n,f=Math.min(s,a),h=Math.abs(a-s);if(f===0||h===0||f*(h+1)>4096)return null;let g=[];for(let M=0;M<s;M++)g.push(oS(t.deletionLines[l+M]??""));let I=[];for(let M=0;M<a;M++)I.push(oS(t.additionLines[d+M]??""));let b=a>s,v=0,k=-1;for(let M=0;M<=h;M++){let N=0;for(let _=0;_<f;_++)N+=IO(g[_+(b?0:M)],I[_+(b?M:0)]);if(M===0)k=N+f*0.5;else if(N>k)k=N,v=M}if(v===0)return null;let w=[],P=(M,N,_,O)=>{if(M>0||N>0)w.push({type:"change",deletions:M,additions:N,deletionLineIndex:_,additionLineIndex:O})};if(b)P(0,v,l,d),P(f,f,l,d+v),P(0,a-f-v,l+f,d+v+f);else P(v,0,l,d),P(f,f,l+v,d),P(s-f-v,0,l+v+f,d+f);return w}var xO=/\s+/g;function oS(t){return t.replace(xO,"")}function IO(t,n){if(t===n)return 1;let s=Math.max(t.length,n.length),a=Math.min(t.length,n.length);if(a===0)return 0;let l=0;while(l<a&&t[l]===n[l])l++;let d=0;while(d<a-l&&t[t.length-1-d]===n[n.length-1-d])d++;return(l+d)/s}var SO=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function bO(t,n,s=!1,a){let l=LO(t),d=l?EO(t):vO(t),f,h=[];for(let g of d){if(l&&!xp.test(g)){if(f==null)f=Tn(g);else if(s)throw Error("parsePatchContent: unknown file blob");else console.error("parsePatchContent: unknown file blob:",g);continue}else if(!l&&!kO(g)){if(f==null)f=Tn(g);else if(s)throw Error("parsePatchContent: unknown file blob");else console.error("parsePatchContent: unknown file blob:",g);continue}let I=fS(g,{cacheKey:n!=null?a==null?os("patch-file",n,String(h.length)):os("patch-file",n,String(a),String(h.length)):void 0,isGitDiff:l,throwOnError:s});if(I!=null)h.push(I)}return{patchMetadata:f,files:h}}function mS(t,n){try{return fS(t,n)}finally{Ip()}}function fS(t,{cacheKey:n,isGitDiff:s=xp.test(t),oldFile:a,newFile:l,throwOnError:d=!1}={}){let f=0,h=yS(t,"@@ "),g,I=a==null||l==null,b=0,v=0;for(let k of h){let w=pS(k),P=w[0];if(P==null){if(d)throw Error("parsePatchContent: invalid hunk");else console.error("parsePatchContent: invalid hunk",k);continue}let M=gS(P),N=0,_=0;if(M==null||g==null){if(g!=null){if(d)throw Error("parsePatchContent: Invalid hunk");else console.error("parsePatchContent: Invalid hunk",k);continue}if(g={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:I,additionLines:!I&&a!=null&&l!=null?lS(l.contents):[],deletionLines:!I&&a!=null&&l!=null?lS(a.contents):[],cacheKey:dS(n)},g.additionLines.length===1&&l?.contents==="")g.additionLines.length=0;if(g.deletionLines.length===1&&a?.contents==="")g.deletionLines.length=0;for(let ee of w){if(ee.startsWith("diff --git")){let Ae=ee.trim().match(SO);if(Ae==null){if(d)throw Error("parsePatchContent: invalid git diff header");else console.error("parsePatchContent: invalid git diff header",ee);continue}let
|
|
152
|
+
\v\f
\u2028\u2029])`),n));else if(g==="posix")if(!l&&(b==="graph"||b==="print")){if(a==="strict")throw Error(`POSIX class "${b}" requires min target ES2024 or non-strict accuracy`);let v={graph:"!-~",print:" -~"}[b];if(I)v=`\x00-${Fn(v.codePointAt(0)-1)}${Fn(v.codePointAt(2)+1)}-\uDBFF\uDFFF`;s(Cn(Xi(`[${v}]`),n))}else s(Cn(fp(Xi($_.get(b)),I),n));else if(g==="property"){if(!hp.has(Ks(b)))t.key="sc"}else if(g==="space")s(bo(ns("space",{negate:I}),n));else if(g==="word")s(Cn(fp(Xi(Wi),I),n));else throw Error(`Unexpected character set kind "${g}"`)},Directive({node:t,parent:n,root:s,remove:a,replaceWith:l,removeAllPrevSiblings:d,removeAllNextSiblings:f}){let{kind:h,flags:g}=t;if(h==="flags")if(!g.enable&&!g.disable)a();else{let I=Ar({flags:g});I.body[0].body=f(),l(Cn(I,n),{traverse:!0})}else if(h==="keep"){let I=s.body[0],v=s.body.length===1&&Tc(I,{type:"Group"})&&I.body[0].body.length===1?I.body[0]:s;if(n.parent!==v||v.body.length>1)throw Error(Ke`Uses "\K" in a way that's unsupported`);let k=Io({behind:!0});k.body[0].body=d(),l(Cn(k,n))}else throw Error(`Unexpected directive kind "${h}"`)},Flags({node:t,parent:n}){if(t.posixIsAscii)throw Error('Unsupported flag "P"');if(t.textSegmentMode==="word")throw Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach((s)=>delete t[s]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),n.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;let{enable:n,disable:s}=t.flags;n?.extended&&delete n.extended,s?.extended&&delete s.extended,n?.dotAll&&s?.dotAll&&delete n.dotAll,n?.ignoreCase&&s?.ignoreCase&&delete n.ignoreCase,n&&!Object.keys(n).length&&delete t.flags.enable,s&&!Object.keys(s).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},n){let{kind:s}=t;if(s==="lookbehind")n.passedLookbehind=!0},NamedCallout({node:t,parent:n,replaceWith:s}){let{kind:a}=t;if(a==="fail")s(Cn(Io({negate:!0}),n));else throw Error(`Unsupported named callout "(*${a.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){let n=Ar();n.body[0].body.push(t.body),t.body=Cn(n,t)}},Regex:{enter({node:t},{supportedGNodes:n}){let s=[],a=!1,l=!1;for(let d of t.body)if(d.body.length===1&&d.body[0].kind==="search_start")d.body.pop();else{let f=DI(d.body);if(f)a=!0,Array.isArray(f)?s.push(...f):s.push(f);else l=!0}if(a&&!l)s.forEach((d)=>n.add(d))},exit(t,{accuracy:n,passedLookbehind:s,strategy:a}){if(n==="strict"&&s&&a)throw Error(Ke`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:n}){let{ref:s}=t;if(typeof s==="string"&&!mp(s))s=dp(s,n),t.ref=s}},H_={Backreference({node:t},{multiplexCapturesToLeftByRef:n,reffedNodesByReferencer:s}){let{orphan:a,ref:l}=t;if(!a)s.set(t,[...n.get(l).map(({node:d})=>d)])},CapturingGroup:{enter({node:t,parent:n,replaceWith:s,skip:a},{groupOriginByCopy:l,groupsByName:d,multiplexCapturesToLeftByRef:f,openRefs:h,reffedNodesByReferencer:g}){let I=l.get(t);if(I&&h.has(t.number)){let v=bo(wI(t.number),n);g.set(v,h.get(t.number)),s(v);return}if(h.set(t.number,t),f.set(t.number,[]),t.name)ml(f,t.name,[]);let b=f.get(t.name??t.number);for(let v=0;v<b.length;v++){let k=b[v];if(I===k.node||I&&I===k.origin||t===k.origin){b.splice(v,1);break}}if(f.get(t.number).push({node:t,origin:I}),t.name)f.get(t.name).push({node:t,origin:I});if(t.name){let v=ml(d,t.name,new Map),k=!1;if(I)k=!0;else for(let w of v.values())if(!w.hasDuplicateNameToRemove){k=!0;break}d.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:k})}},exit({node:t},{openRefs:n}){if(n.get(t.number)===t)n.delete(t.number)}},Group:{enter({node:t},n){if(n.prevFlags=n.currentFlags,t.flags)n.currentFlags=_c(n.currentFlags,t.flags)},exit(t,n){n.currentFlags=n.prevFlags}},Subroutine({node:t,parent:n,replaceWith:s},a){let{isRecursive:l,ref:d}=t;if(l){let b=n;while(b=b.parent)if(b.type==="CapturingGroup"&&(b.name===d||b.number===d))break;a.reffedNodesByReferencer.set(t,b);return}let f=a.subroutineRefMap.get(d),h=d===0,g=h?wI(0):$I(f,a.groupOriginByCopy,null),I=g;if(!h){let b=FI(z_(f,(k)=>k.type==="Group"&&!!k.flags)),v=b?_c(a.globalFlags,b):a.globalFlags;if(!B_(v,a.currentFlags))I=Ar({flags:j_(v)}),I.body[0].body.push(g)}s(Cn(I,n),{traverse:!h})}},U_={Backreference({node:t,parent:n,replaceWith:s},a){if(t.orphan){a.highestOrphanBackref=Math.max(a.highestOrphanBackref,t.ref);return}let d=a.reffedNodesByReferencer.get(t).filter((f)=>G_(f,t));if(!d.length)s(Cn(Io({negate:!0}),n));else if(d.length>1){let f=Ar({atomic:!0,body:d.reverse().map((h)=>Vi({body:[wc(h.number)]}))});s(Cn(f,n))}else t.ref=d[0].number},CapturingGroup({node:t},n){if(t.number=++n.numCapturesToLeft,t.name){if(n.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove)delete t.name}},Regex:{exit({node:t},n){let s=Math.max(n.highestOrphanBackref-n.numCapturesToLeft,0);for(let a=0;a<s;a++){let l=tp();t.body.at(-1).body.push(l)}}},Subroutine({node:t},n){if(!t.isRecursive||t.ref===0)return;t.ref=n.reffedNodesByReferencer.get(t).number}};function OI(t){rs(t,{"*"({node:n,parent:s}){n.parent=s}})}function B_(t,n){return t.dotAll===n.dotAll&&t.ignoreCase===n.ignoreCase}function G_(t,n){let s=n;do{if(s.type==="Regex")return!1;if(s.type==="Alternative")continue;if(s===t)return!1;let a=NI(s.parent);for(let l of a){if(l===s)break;if(l===t||HI(l,t))return!0}}while(s=s.parent);throw Error("Unexpected path")}function $I(t,n,s,a){let l=Array.isArray(t)?[]:{};for(let[d,f]of Object.entries(t))if(d==="parent")l.parent=Array.isArray(s)?a:s;else if(f&&typeof f==="object")l[d]=$I(f,n,l,s);else{if(d==="type"&&f==="CapturingGroup")n.set(l,n.get(t)??t);l[d]=f}return l}function wI(t){let n=rp(t);return n.isRecursive=!0,n}function z_(t,n){let s=[];while(t=t.parent)if(!n||n(t))s.push(t);return s}function dp(t,n){if(n.has(t))return n.get(t);let s=`$${n.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return n.set(t,s),s}function FI(t){let n=["dotAll","ignoreCase"],s={enable:{},disable:{}};if(t.forEach(({flags:a})=>{n.forEach((l)=>{if(a.enable?.[l])delete s.disable[l],s.enable[l]=!0;if(a.disable?.[l])s.disable[l]=!0})}),!Object.keys(s.enable).length)delete s.enable;if(!Object.keys(s.disable).length)delete s.disable;if(s.enable||s.disable)return s;return null}function j_({dotAll:t,ignoreCase:n}){let s={};if(t||n)s.enable={},t&&(s.enable.dotAll=!0),n&&(s.enable.ignoreCase=!0);if(!t||!n)s.disable={},!t&&(s.disable.dotAll=!0),!n&&(s.disable.ignoreCase=!0);return s}function NI(t){if(!t)throw Error("Node expected");let{body:n}=t;return Array.isArray(n)?n:n?[n]:null}function DI(t){let n=t.find((s)=>s.kind==="search_start"||V_(s,{negate:!1})||!q_(s));if(!n)return null;if(n.kind==="search_start")return n;if(n.type==="LookaroundAssertion")return n.body[0].body[0];if(n.type==="CapturingGroup"||n.type==="Group"){let s=[];for(let a of n.body){let l=DI(a.body);if(!l)return null;Array.isArray(l)?s.push(...l):s.push(l)}return s}return null}function HI(t,n){let s=NI(t)??[];for(let a of s)if(a===n||HI(a,n))return!0;return!1}function q_({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function K_(t){let n=["Character","CharacterClass","CharacterSet"];return n.includes(t.type)||t.type==="Quantifier"&&t.min&&n.includes(t.body.type)}function V_(t,n){let s={negate:null,...n};return t.type==="LookaroundAssertion"&&(s.negate===null||t.negate===s.negate)&&t.body.length===1&&Tc(t.body[0],{type:"Assertion",kind:"search_start"})}function mp(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function Xi(t,n){let a=Rc(t,{...n,unicodePropertyMap:hp}).body;if(a.length>1||a[0].body.length>1)return Ar({body:a});return a[0].body[0]}function fp(t,n){return t.negate=n,t}function bo(t,n){return t.parent=n,t}function Cn(t,n){return OI(t),t.parent=n,t}function W_(t,n){let s=PI(n),a=pp(s.target,"ES2024"),l=pp(s.target,"ES2025"),d=s.rules.recursionLimit;if(!Number.isInteger(d)||d<2||d>20)throw Error("Invalid recursionLimit; use 2-20");let f=null,h=null;if(!l){let w=[t.flags.ignoreCase];rs(t,X_,{getCurrentModI:()=>w.at(-1),popModI(){w.pop()},pushModI(P){w.push(P)},setHasCasedChar(){if(w.at(-1))f=!0;else h=!0}})}let g={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||f)&&!h)},I=t,b={accuracy:s.accuracy,appliedGlobalFlags:g,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:I,originMap:t._originMap,recursionLimit:d,useAppliedIgnoreCase:!!(!l&&f&&h),useFlagMods:l,useFlagV:a,verbose:s.verbose};function v(w){return b.lastNode=I,I=w,R_(Y_[w.type],`Unexpected node type "${w.type}"`)(w,b,v)}let k={pattern:t.body.map(v).join("|"),flags:v(t.flags),options:{...t.options}};if(!a)delete k.options.force.v,k.options.disable.v=!0,k.options.unicodeSetsPlugin=null;return k._captureTransfers=new Map,k._hiddenCaptures=[],b.captureMap.forEach((w,P)=>{if(w.hidden)k._hiddenCaptures.push(P);if(w.transferTo)ml(k._captureTransfers,w.transferTo,[]).push(P)}),k}var X_={"*":{enter({node:t},n){if(LI(t)){let s=n.getCurrentModI();n.pushModI(t.flags?_c({ignoreCase:s},t.flags).ignoreCase:s)}},exit({node:t},n){if(LI(t))n.popModI()}},Backreference(t,n){n.setHasCasedChar()},Character({node:t},n){if(gp(Fn(t.value)))n.setHasCasedChar()},CharacterClassRange({node:t,skip:n},s){if(n(),UI(t,{firstOnly:!0}).length)s.setHasCasedChar()},CharacterSet({node:t},n){if(t.kind==="property"&&_I.has(t.value))n.setHasCasedChar()}},Y_={Alternative({body:t},n,s){return t.map(s).join("")},Assertion({kind:t,negate:n}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return n?Ke`\B`:Ke`\b`;throw Error(`Unexpected assertion kind "${t}"`)},Backreference({ref:t},n){if(typeof t!=="number")throw Error("Unexpected named backref in transformed AST");if(!n.useFlagMods&&n.accuracy==="strict"&&n.currentFlags.ignoreCase&&!n.captureMap.get(t).ignoreCase)throw Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t},CapturingGroup(t,n,s){let{body:a,name:l,number:d}=t,f={ignoreCase:n.currentFlags.ignoreCase},h=n.originMap.get(t);if(h){if(f.hidden=!0,d>h.number)f.transferTo=h.number}return n.captureMap.set(d,f),`(${l?`?<${l}>`:""}${a.map(s).join("|")})`},Character({value:t},n){let s=Fn(t),a=Ws(t,{escDigit:n.lastNode.type==="Backreference",inCharClass:n.inCharClass,useFlagV:n.useFlagV});if(a!==s)return a;if(n.useAppliedIgnoreCase&&n.currentFlags.ignoreCase&&gp(s)){let l=MI(s);return n.inCharClass?l.join(""):l.length>1?`[${l.join("")}]`:l[0]}return s},CharacterClass(t,n,s){let{kind:a,negate:l,parent:d}=t,{body:f}=t;if(a==="intersection"&&!n.useFlagV)throw Error("Use of character class intersection requires min target ES2024");if(ri.bugFlagVLiteralHyphenIsRange&&n.useFlagV&&f.some(AI))f=[qs(45),...f.filter((I)=>!AI(I))];let h=()=>`[${l?"^":""}${f.map(s).join(a==="intersection"?"&&":"")}]`;if(!n.inCharClass){if((!n.useFlagV||ri.bugNestedClassIgnoresNegation)&&!l){let b=f.filter((v)=>v.type==="CharacterClass"&&v.kind==="union"&&v.negate);if(b.length){let v=Ar(),k=v.body[0];if(v.parent=d,k.parent=v,f=f.filter((w)=>!b.includes(w)),t.body=f,f.length)t.parent=k,k.body.push(t);else v.body.pop();return b.forEach((w)=>{let P=Vi({body:[w]});w.parent=P,P.parent=v,v.body.push(P)}),s(v)}}n.inCharClass=!0;let I=h();return n.inCharClass=!1,I}let g=f[0];if(a==="union"&&!l&&g&&((!n.useFlagV||!n.verbose)&&d.kind==="union"&&!(ri.bugFlagVLiteralHyphenIsRange&&n.useFlagV)||!n.verbose&&d.kind==="intersection"&&f.length===1&&g.type!=="CharacterClassRange"))return f.map(s).join("");if(!n.useFlagV&&d.type==="CharacterClass")throw Error("Uses nested character class in a way that requires min target ES2024");return h()},CharacterClassRange(t,n){let s=t.min.value,a=t.max.value,l={escDigit:!1,inCharClass:!0,useFlagV:n.useFlagV},d=Ws(s,l),f=Ws(a,l),h=new Set;if(n.useAppliedIgnoreCase&&n.currentFlags.ignoreCase){let g=UI(t);tO(g).forEach((b)=>{h.add(Array.isArray(b)?`${Ws(b[0],l)}-${Ws(b[1],l)}`:Ws(b,l))})}return`${d}-${f}${[...h].join("")}`},CharacterSet({kind:t,negate:n,value:s,key:a},l){if(t==="dot")return l.currentFlags.dotAll?l.appliedGlobalFlags.dotAll||l.useFlagMods?".":"[^]":Ke`[^\n]`;if(t==="digit")return n?Ke`\D`:Ke`\d`;if(t==="property"){if(l.useAppliedIgnoreCase&&l.currentFlags.ignoreCase&&_I.has(s))throw Error(`Unicode property "${s}" can't be case-insensitive when other chars have specific case`);return`${n?Ke`\P`:Ke`\p`}{${a?`${a}=`:""}${s}}`}if(t==="word")return n?Ke`\W`:Ke`\w`;throw Error(`Unexpected character set kind "${t}"`)},Flags(t,n){return(n.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:n,flags:s,parent:a},l,d){let f=l.currentFlags;if(s)l.currentFlags=_c(f,s);let h=n.map(d).join("|"),g=!l.verbose&&n.length===1&&a.type!=="Quantifier"&&!t&&(!l.useFlagMods||!s)?h:`(?${nO(t,s,l.useFlagMods)}${h})`;return l.currentFlags=f,g},LookaroundAssertion({body:t,kind:n,negate:s},a,l){return`(?${`${n==="lookahead"?"":"<"}${s?"!":"="}`}${t.map(l).join("|")})`},Quantifier(t,n,s){return s(t.body)+rO(t)},Subroutine({isRecursive:t,ref:n},s){if(!t)throw Error("Unexpected non-recursive subroutine in transformed AST");let a=s.recursionLimit;return n===0?`(?R=${a})`:Ke`\g<${n}&R=${a}>`}},J_=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Q_=new Set(["-","\\","]","^","["]),Z_=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),RI=new Map([[9,Ke`\t`],[10,Ke`\n`],[11,Ke`\v`],[12,Ke`\f`],[13,Ke`\r`],[8232,Ke`\u2028`],[8233,Ke`\u2029`],[65279,Ke`\uFEFF`]]),eO=/^\p{Cased}$/u;function gp(t){return eO.test(t)}function UI(t,n){let s=!!n?.firstOnly,a=t.min.value,l=t.max.value,d=[];if(a<65&&(l===65535||l>=131071)||a===65536&&l>=131071)return d;for(let f=a;f<=l;f++){let h=Fn(f);if(!gp(h))continue;let g=MI(h).filter((I)=>{let b=I.codePointAt(0);return b<a||b>l});if(g.length){if(d.push(...g),s)break}}return d}function Ws(t,{escDigit:n,inCharClass:s,useFlagV:a}){if(RI.has(t))return RI.get(t);if(t<32||t>126&&t<160||t>262143||n&&iO(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;let l=s?a?Z_:Q_:J_,d=Fn(t);return(l.has(d)?"\\":"")+d}function tO(t){let n=t.map((l)=>l.codePointAt(0)).sort((l,d)=>l-d),s=[],a=null;for(let l=0;l<n.length;l++)if(n[l+1]===n[l]+1)a??=n[l];else if(a===null)s.push(n[l]);else s.push([a,n[l]]),a=null;return s}function nO(t,n,s){if(t)return">";let a="";if(n&&s){let{enable:l,disable:d}=n;a=(l?.ignoreCase?"i":"")+(l?.dotAll?"s":"")+(d?"-":"")+(d?.ignoreCase?"i":"")+(d?.dotAll?"s":"")}return`${a}:`}function rO({kind:t,max:n,min:s}){let a;if(!s&&n===1)a="?";else if(!s&&n===1/0)a="*";else if(s===1&&n===1/0)a="+";else if(s===n)a=`{${s}}`;else a=`{${s},${n===1/0?"":n}}`;return a+{greedy:"",lazy:"?",possessive:"+"}[t]}function LI({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function iO(t){return t>47&&t<58}function AI({type:t,value:n}){return t==="Character"&&n===45}var oO=class t extends RegExp{#t=new Map;#e=null;#r;#n=null;#i=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(n,s,a){let l=!!a?.lazyCompile;if(n instanceof RegExp){if(a)throw Error("Cannot provide options when copying a regexp");let d=n;super(d,s);if(this.#r=d.source,d instanceof t)this.#t=d.#t,this.#n=d.#n,this.#i=d.#i,this.rawOptions=d.rawOptions}else{let d={hiddenCaptures:[],strategy:null,transfers:[],...a};super(l?"":n,s);this.#r=n,this.#t=aO(d.hiddenCaptures,d.transfers),this.#i=d.strategy,this.rawOptions=a??{}}if(!l)this.#e=this}exec(n){if(!this.#e){let{lazyCompile:l,...d}=this.rawOptions;this.#e=new t(this.#r,this.flags,d)}let s=this.global||this.sticky,a=this.lastIndex;if(this.#i==="clip_search"&&s&&a){this.lastIndex=0;let l=this.#o(n.slice(a));if(l)sO(l,a,n,this.hasIndices),this.lastIndex+=a;return l}return this.#o(n)}#o(n){this.#e.lastIndex=this.lastIndex;let s=super.exec.call(this.#e,n);if(this.lastIndex=this.#e.lastIndex,!s||!this.#t.size)return s;let a=[...s];s.length=1;let l;if(this.hasIndices)l=[...s.indices],s.indices.length=1;let d=[0];for(let f=1;f<a.length;f++){let{hidden:h,transferTo:g}=this.#t.get(f)??{};if(h)d.push(null);else if(d.push(s.length),s.push(a[f]),this.hasIndices)s.indices.push(l[f]);if(g&&a[f]!==void 0){let I=d[g];if(!I)throw Error(`Invalid capture transfer to "${I}"`);if(s[I]=a[f],this.hasIndices)s.indices[I]=l[f];if(s.groups){if(!this.#n)this.#n=lO(this.source);let b=this.#n.get(g);if(b){if(s.groups[b]=a[f],this.hasIndices)s.indices.groups[b]=l[f]}}}}return s}};function sO(t,n,s,a){if(t.index+=n,t.input=s,a){let l=t.indices;for(let f=0;f<l.length;f++){let h=l[f];if(h)l[f]=[h[0]+n,h[1]+n]}let d=l.groups;if(d)Object.keys(d).forEach((f)=>{let h=d[f];if(h)d[f]=[h[0]+n,h[1]+n]})}}function aO(t,n){let s=new Map;for(let a of t)s.set(a,{hidden:!0});for(let[a,l]of n)for(let d of l)ml(s,d,{}).transferTo=a;return s}function lO(t){let n=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,s=new Map,a=0,l=0,d;while(d=n.exec(t)){let{0:f,groups:{capture:h,name:g}}=d;if(f==="[")a++;else if(!a){if(h){if(l++,g)s.set(l,g)}}else if(f==="]")a--}return s}function BI(t,n){let s=uO(t,n);if(s.options)return new oO(s.pattern,s.flags,s.options);return new RegExp(s.pattern,s.flags)}function uO(t,n){let s=PI(n),a=Rc(t,{flags:s.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:s.rules.captureGroup,singleline:s.rules.singleline},skipBackrefValidation:s.rules.allowOrphanBackrefs,unicodePropertyMap:hp}),l=N_(a,{accuracy:s.accuracy,asciiWordBoundaries:s.rules.asciiWordBoundaries,avoidSubclass:s.avoidSubclass,bestEffortTarget:s.target}),d=W_(l,s),f=kI(d.pattern,{captureTransfers:d._captureTransfers,hiddenCaptures:d._hiddenCaptures,mode:"external"}),h=ap(f.pattern),g=sp(h.pattern,{captureTransfers:f.captureTransfers,hiddenCaptures:f.hiddenCaptures}),I={pattern:g.pattern,flags:`${s.hasIndices?"d":""}${s.global?"g":""}${d.flags}${d.options.disable.v?"u":"v"}`};if(s.avoidSubclass){if(s.lazyCompileLength!==1/0)throw Error("Lazy compilation requires subclass")}else{let b=g.hiddenCaptures.sort((P,M)=>P-M),v=Array.from(g.captureTransfers),k=l._strategy,w=I.pattern.length>=s.lazyCompileLength;if(b.length||v.length||k||w)I.options={...b.length&&{hiddenCaptures:b},...v.length&&{transfers:v},...k&&{strategy:k},...w&&{lazyCompile:w}}}return I}function yp(t,n){return BI(t,{global:!0,hasIndices:!0,lazyCompileLength:3000,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...n})}function $c(t={}){let n={target:"auto",cache:new Map,...t};return n.regexConstructor||=(s)=>yp(s,{target:n.target}),{createScanner(s){return new Xx(s,n)},createString(s){return{content:s}}}}async function Fc(t){if(Ku())throw Error(`resolveLanguage("${t}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let n=xc.get(t);if(n!=null)return n;try{let s=zx.get(t);if(s==null&&Object.prototype.hasOwnProperty.call(zs,t))s=zs[t];if(s==null)throw Error(`resolveLanguage: "${t}" not found in bundled or custom languages`);let a=s().then(({default:l})=>{let d={name:t,data:l};if(!Lr.has(t))Lr.set(t,d);return d});return xc.set(t,a),await a}finally{xc.delete(t)}}function Nc(t){return Lr.get(t)??Fc(t)}var Dc="diffs-container",GI=(()=>{try{return!1}catch{return!1}})(),zI=/(?=^From [a-f0-9]+ .+$)/m,xp=/(?=^diff --git)/gm;var jI=/(?<=\n)/,qI=/^(---|\+\+\+)\s+([^\t\r\n]+)/,KI=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var Xs="header-prefix",Ys="header-filename-suffix",Js="header-metadata",Qs="header-custom",u={dark:"pierre-dark",light:"pierre-light"},VI="data-theme-css",WI="data-unsafe-css";var XI="data-diffs-scrollbar-measure",YI="data-diffs-code-view-header",JI="data-diffs-code-view-footer",Hc="--diffs-scrollbar-gutter-measured";var QI=1e5,fl={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Zs={...fl,hunkLineCount:1},ZI={paddingTop:8,paddingBottom:8,gap:8},eS={omega:0.015,positionEpsilon:0.5,velocityEpsilon:0.05},tS=Object.freeze({fromStart:0,fromEnd:0}),ea={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Uc={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function C(t=u){let n=[];if(typeof t==="string")n.push(t);else n.push(t.dark),n.push(t.light);return n}var ta=new Set;function ur(t){for(let n of C(t))if(!ta.has(n))return!1;return!0}function Ne(t,n){t=Array.isArray(t)?t:[t];for(let s of t){let a;if(typeof s==="string"){if(a=vn.getResolvedTheme(s),a==null)throw Error(`loadResolvedThemes: ${s} is not resolved, you must resolve it before calling loadResolvedThemes`)}else if(a=s,s=s.name,vn.getResolvedTheme(s)==null)vn.seedResolvedTheme(s,a);if(ta.has(s))continue;ta.add(s),n.loadThemeSync(a)}}function nS(t){return vn.getResolvedTheme(t)??Ge(t)}var ii;async function j({themes:t,langs:n,preferredHighlighter:s="shiki-js"}){ii??=vc({themes:[],langs:["text"],engine:s==="shiki-wasm"?Ec(import("shiki/wasm")):$c()});let a=cO(ii)?await ii:ii;ii=a;let l=[];for(let f of Array.from(new Set(n))){if(f==="text"||f==="ansi")continue;let h=Nc(f);if("then"in h)l.push(h);else qf(h,a)}let d=[];for(let f of t){let h=nS(f);if("then"in h)d.push(h);else Ne(h,ii)}if(l.length>0||d.length>0)await Promise.all([Promise.all(l).then((f)=>{qf(f,a)}),Promise.all(d).then((f)=>{Ne(f,a)})]);return a}function rS(t=ii){return t!=null&&!("then"in t)}function T(t){if(ii==null||"then"in ii)return;if(t!=null&&(!ur(t.theme)||!U(t.lang)))return;return ii}function cO(t=ii){return t!=null&&"then"in t}async function re(t){await j(t)}for(let t of pc.getThemes())vn.registerThemeIfAbsent(t.name,t.load);function Nn(t,n){return t-(n===0?0:1)}function Dn(t,n){return Nn(t,n)+n}function os(t,...n){return`ck1:${JSON.stringify([t,...n])}`}function Pr(t){let n=t.length;if(t.charCodeAt(n-1)===10){if(n--,t.charCodeAt(n-1)===13)n--}return t.slice(0,n)}var dO=new TextEncoder,mO=new TextDecoder("utf-8",{ignoreBOM:!0}),fO=/[\uD800-\uDFFF]/;var na=new Uint8Array(1024);function Ip(){if(na.length!==1024)na=new Uint8Array(1024)}function Tn(t){if(t.length===0)return t;if(fO.test(t))return JSON.parse(JSON.stringify(t));let n=t.length*3;if(na.length<n)na=new Uint8Array(n);let{written:s}=dO.encodeInto(t,na);return mO.decode(na.subarray(0,s))}var pO=new TextDecoder("utf-8",{ignoreBOM:!0}),hO={'"':'"',"\\":"\\",a:"\x07",b:"\b",t:"\t",n:`
|
|
153
|
+
`,v:"\v",f:"\f",r:"\r"};function iS(t){if(t[0]!=='"')return;let n="",s=1;while(s<t.length){let a=t[s];if(a==='"')return{fileName:n,rawLength:s+1};if(a!=="\\"){n+=a,s++;continue}let l=hO[t[s+1]];if(l!=null){n+=l,s+=2;continue}let d=[];do{let f=gO(t,s+1);if(f==null)return;d.push(f),s+=4}while(t[s]==="\\"&&t[s+1]>="0"&&t[s+1]<="7");n+=pO.decode(new Uint8Array(d))}}function gO(t,n){let s=t.charCodeAt(n)-48,a=t.charCodeAt(n+1)-48,l=t.charCodeAt(n+2)-48;if(s>=0&&s<=3&&a>=0&&a<=7&&l>=0&&l<=7)return s*64+a*8+l}function sS(t){for(let n of t.hunks)for(let s=0;s<n.hunkContent.length;s++){let a=n.hunkContent[s];if(a.type!=="change")continue;let l=yO(t,a);if(l!=null)n.hunkContent.splice(s,1,...l),s+=l.length-1}}function aS(t,n,s){let{hunkContent:a}=t;for(let l=1;l<a.length;l++){let d=a[l],f=a[l-1];if(d.type!=="change"||d.additions>0&&d.deletions>0||f.type!=="context")continue;let h=d.additions>0,g=h?n.additionLines:n.deletionLines,I=h?d.additionLineIndex:d.deletionLineIndex,b=h?d.additions:d.deletions,v=g[I]??"";if(v.trim()!=="")continue;let k=!0;for(let _=1;_<b;_++)if(g[I+_]!==v){k=!1;break}if(!k)continue;let w=0;while(w<f.lines&&n.additionLines[f.additionLineIndex+f.lines-1-w]===v)w++;if(w===0)continue;if(l===1&&w===f.lines)continue;if(s!=null){if(w=s(d,w),w===0)continue}d.additionLineIndex-=w,d.deletionLineIndex-=w;let P=d.additionLineIndex+d.additions,M=d.deletionLineIndex+d.deletions,N=a[l+1];if(N?.type==="context")N.lines+=w,N.additionLineIndex=P,N.deletionLineIndex=M;else a.splice(l+1,0,{type:"context",lines:w,additionLineIndex:P,deletionLineIndex:M});if(f.lines-=w,f.lines===0)a.splice(l-1,1),l--}}function yO(t,n){let{deletions:s,additions:a,deletionLineIndex:l,additionLineIndex:d}=n,f=Math.min(s,a),h=Math.abs(a-s);if(f===0||h===0||f*(h+1)>4096)return null;let g=[];for(let M=0;M<s;M++)g.push(oS(t.deletionLines[l+M]??""));let I=[];for(let M=0;M<a;M++)I.push(oS(t.additionLines[d+M]??""));let b=a>s,v=0,k=-1;for(let M=0;M<=h;M++){let N=0;for(let _=0;_<f;_++)N+=IO(g[_+(b?0:M)],I[_+(b?M:0)]);if(M===0)k=N+f*0.5;else if(N>k)k=N,v=M}if(v===0)return null;let w=[],P=(M,N,_,O)=>{if(M>0||N>0)w.push({type:"change",deletions:M,additions:N,deletionLineIndex:_,additionLineIndex:O})};if(b)P(0,v,l,d),P(f,f,l,d+v),P(0,a-f-v,l+f,d+v+f);else P(v,0,l,d),P(f,f,l+v,d),P(s-f-v,0,l+v+f,d+f);return w}var xO=/\s+/g;function oS(t){return t.replace(xO,"")}function IO(t,n){if(t===n)return 1;let s=Math.max(t.length,n.length),a=Math.min(t.length,n.length);if(a===0)return 0;let l=0;while(l<a&&t[l]===n[l])l++;let d=0;while(d<a-l&&t[t.length-1-d]===n[n.length-1-d])d++;return(l+d)/s}var SO=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function bO(t,n,s=!1,a){let l=LO(t),d=l?EO(t):vO(t),f,h=[];for(let g of d){if(l&&!xp.test(g)){if(f==null)f=Tn(g);else if(s)throw Error("parsePatchContent: unknown file blob");else console.error("parsePatchContent: unknown file blob:",g);continue}else if(!l&&!kO(g)){if(f==null)f=Tn(g);else if(s)throw Error("parsePatchContent: unknown file blob");else console.error("parsePatchContent: unknown file blob:",g);continue}let I=fS(g,{cacheKey:n!=null?a==null?os("patch-file",n,String(h.length)):os("patch-file",n,String(a),String(h.length)):void 0,isGitDiff:l,throwOnError:s});if(I!=null)h.push(I)}return{patchMetadata:f,files:h}}function mS(t,n){try{return fS(t,n)}finally{Ip()}}function fS(t,{cacheKey:n,isGitDiff:s=xp.test(t),oldFile:a,newFile:l,throwOnError:d=!1}={}){let f=0,h=yS(t,"@@ "),g,I=a==null||l==null,b=0,v=0;for(let k of h){let w=pS(k),P=w[0];if(P==null){if(d)throw Error("parsePatchContent: invalid hunk");else console.error("parsePatchContent: invalid hunk",k);continue}let M=gS(P),N=0,_=0;if(M==null||g==null){if(g!=null){if(d)throw Error("parsePatchContent: Invalid hunk");else console.error("parsePatchContent: Invalid hunk",k);continue}if(g={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:I,additionLines:!I&&a!=null&&l!=null?lS(l.contents):[],deletionLines:!I&&a!=null&&l!=null?lS(a.contents):[],cacheKey:dS(n)},g.additionLines.length===1&&l?.contents==="")g.additionLines.length=0;if(g.deletionLines.length===1&&a?.contents==="")g.deletionLines.length=0;for(let ee of w){if(ee.startsWith("diff --git")){let Ae=ee.trim().match(SO);if(Ae==null){if(d)throw Error("parsePatchContent: invalid git diff header");else console.error("parsePatchContent: invalid git diff header",ee);continue}let le=pl(Ae[1],!0),Se=pl(Ae[2],!0);if(g.name=Tn(Se),le!==Se)g.prevName=Tn(le);continue}let ue=ee.startsWith("---")||ee.startsWith("+++")?ee.match(qI):null;if(ue!=null){let[,Ae,le]=ue,Se=pl(le,s);if(Ae==="---"&&Se!=="/dev/null"){let lt=Tn(Se);g.prevName=lt,g.name=lt}else if(Ae==="+++"&&Se!=="/dev/null")g.name=Tn(Se)}else if(s){if(ee.startsWith("new mode "))g.mode=Tn(ee.slice(8).trim());if(ee.startsWith("old mode "))g.prevMode=Tn(ee.slice(8).trim());if(ee.startsWith("new file mode"))g.type="new",g.mode=Tn(ee.slice(13).trim());if(ee.startsWith("deleted file mode"))g.type="deleted",g.mode=Tn(ee.slice(17).trim());if(ee.startsWith("similarity index"))if(ee.startsWith("similarity index 100%"))g.type="rename-pure";else g.type="rename-changed";if(ee.startsWith("index ")){let[,Ae,le,Se]=ee.trim().match(KI)??[];if(Ae!=null)g.prevObjectId=Tn(Ae);if(le!=null)g.newObjectId=Tn(le);if(Se!=null)g.mode=Tn(Se)}if(ee.startsWith("rename from ")||ee.startsWith("copy from "))g.prevName=Tn(pl(ee.slice(ee.startsWith("rename")?12:10)));if(ee.startsWith("rename to ")||ee.startsWith("copy to "))g.name=Tn(pl(ee.slice(ee.startsWith("rename")?10:8)))}}continue}let O,B;while(w.length>0&&(w[w.length-1]===`
|
|
154
154
|
`||w[w.length-1]==="\r"||w[w.length-1]===`\r
|
|
155
|
-
`||w[w.length-1]===""))w.pop();let{additionStart:X,deletionStart:z}=M;b=I?b:z-1,v=I?v:X-1;let K={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:M.additionCount,additionStart:X,additionLines:N,deletionCount:M.deletionCount,deletionStart:z,deletionLines:_,deletionLineIndex:b,additionLineIndex:v,hunkContent:[],hunkContext:dS(M.hunkContext),hunkSpecs:Tn(P),noEOFCRAdditions:!1,noEOFCRDeletions:!1},W=0,J=0;for(let ee=1;ee<w.length;ee++){let
|
|
155
|
+
`||w[w.length-1]===""))w.pop();let{additionStart:X,deletionStart:z}=M;b=I?b:z-1,v=I?v:X-1;let K={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:M.additionCount,additionStart:X,additionLines:N,deletionCount:M.deletionCount,deletionStart:z,deletionLines:_,deletionLineIndex:b,additionLineIndex:v,hunkContent:[],hunkContext:dS(M.hunkContext),hunkSpecs:Tn(P),noEOFCRAdditions:!1,noEOFCRDeletions:!1},W=0,J=0;for(let ee=1;ee<w.length;ee++){let ue=w[ee];if(W>=K.additionCount&&J>=K.deletionCount&&!ue.startsWith("\\")){if(!(TO(ue)&&!wO(ue)))break;if(d)throw Error("parsePatchContent: hunk has more lines than expected")}let Ae=ue[0];if(Ae!=="+"&&Ae!=="-"&&Ae!==" "&&Ae!=="\\"){if(d)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${Ae}", full line: "${ue}"`),console.error("processFile: invalid rawLine:",ue);continue}let le=AO(Ae);if(le==="addition"){if(d&&W>=K.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let Se=Sp(ue);if(O==null||O.type!=="change")O=bp("change",b,v),K.hunkContent.push(O);if(v++,W++,I)g.additionLines.push(Se);O.additions++,N++,B="addition"}else if(le==="deletion"){if(d&&J>=K.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let Se=Sp(ue);if(O==null||O.type!=="change")O=bp("change",b,v),K.hunkContent.push(O);if(b++,J++,I)g.deletionLines.push(Se);O.deletions++,_++,B="deletion"}else if(le==="context"){if(d&&(J>=K.deletionCount||W>=K.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let Se=Sp(ue);if(O==null||O.type!=="context")O=bp("context",b,v),K.hunkContent.push(O);if(v++,b++,W++,J++,I)g.deletionLines.push(Se),g.additionLines.push(Se);O.lines++,B="context"}else if(le==="metadata"&&O!=null){if(O.type==="context")K.noEOFCRAdditions=!0,K.noEOFCRDeletions=!0;else if(B==="deletion")K.noEOFCRDeletions=!0;else if(B==="addition")K.noEOFCRAdditions=!0;if(I&&(B==="addition"||B==="context")){let Se=g.additionLines.length-1;if(Se>=0)g.additionLines[Se]=Pr(g.additionLines[Se])}if(I&&(B==="deletion"||B==="context")){let Se=g.deletionLines.length-1;if(Se>=0)g.deletionLines[Se]=Pr(g.deletionLines[Se])}}}if(W!==K.additionCount||J!==K.deletionCount){if(d)throw Error("parsePatchContent: hunk line count mismatch");console.error(`parsePatchContent: hunk line count mismatch: "${P.trimEnd()}", declared old/new ${K.deletionCount}/${K.additionCount}, parsed old/new ${J}/${W}`);let ee=Nn(K.additionStart,K.additionCount)+(W===0?0:1),ue=Nn(K.deletionStart,K.deletionCount)+(J===0?0:1);if(!I){let Ae=ee-K.additionStart,le=ue-K.deletionStart;K.additionLineIndex+=Ae,K.deletionLineIndex+=le;for(let Se of K.hunkContent)Se.additionLineIndex+=Ae,Se.deletionLineIndex+=le}K.additionStart=ee,K.deletionStart=ue,K.additionCount=W,K.deletionCount=J}K.additionLines=N,K.deletionLines=_,K.collapsedBefore=Math.max(Nn(K.additionStart,K.additionCount)-f,0),g.hunks.push(K),f=Dn(K.additionStart,K.additionCount);for(let ee of K.hunkContent)if(ee.type==="context")K.splitLineCount+=ee.lines,K.unifiedLineCount+=ee.lines;else K.splitLineCount+=Math.max(ee.additions,ee.deletions),K.unifiedLineCount+=ee.deletions+ee.additions;K.splitLineStart=g.splitLineCount+K.collapsedBefore,K.unifiedLineStart=g.unifiedLineCount+K.collapsedBefore,g.splitLineCount+=K.collapsedBefore+K.splitLineCount,g.unifiedLineCount+=K.collapsedBefore+K.unifiedLineCount}if(g==null)return;if(d&&I&&!s&&g.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(g.hunks.length>0&&!I&&g.additionLines.length>0&&g.deletionLines.length>0){let k=g.hunks[g.hunks.length-1],w=Dn(k.additionStart,k.additionCount),P=g.additionLines.length,M=Math.max(P-w,0);g.splitLineCount+=M,g.unifiedLineCount+=M}if(!s){if(g.prevName!=null&&g.name!==g.prevName)if(g.hunks.length>0)g.type="rename-changed";else g.type="rename-pure";else if((a==null||a.contents==="")&&l!=null&&l.contents!=="")g.type="new";else if(a!=null&&a.contents!==""&&(l==null||l.contents===""))g.type="deleted"}if(g.type!=="rename-pure"&&g.type!=="rename-changed")g.prevName=void 0;return sS(g),g}function Ht(t,n,s=!1){let a=[],l=CO(t)?t.split(zI):[t];for(let d of l)try{a.push(bO(d,n,s,n!=null?a.length:void 0))}catch(f){if(s)throw f;else console.error(f)}finally{Ip()}return a}function pl(t,n=!1){let s=t.trim(),a=s.startsWith('"')?iS(s)?.fileName??s:s;return n&&(a.startsWith("a/")||a.startsWith("b/"))?a.slice(2):a}function CO(t){return t.startsWith("From ")||t.includes(`
|
|
156
156
|
From `)}function lS(t){let n=pS(t);for(let s=0;s<n.length;s++)n[s]=Tn(n[s]);return n}function pS(t){if(t.length===0)return[""];let n=[],s=0;for(;;){let a=t.indexOf(`
|
|
157
157
|
`,s);if(a===-1)break;n.push(t.slice(s,a+1)),s=a+1}if(s<t.length)n.push(t.slice(s));return n}function EO(t){return yS(t,"diff --git")}function vO(t){if(t.length===0)return[""];let n=[],s=0,a=0,l=0,d=0,f=!1;while(a<t.length){let h=Cp(t,a);if(l<=0&&d<=0){if(hS(t,a)){if(a>s)n.push(t.slice(s,a));s=a,f=!0,a=Cp(t,h);continue}if(f&&t.startsWith("@@ -",a)){let I=gS(t.slice(a,h));if(I!=null)l=I.deletionCount,d=I.additionCount}a=h;continue}let g=t[a];if(g==="\\"){a=h;continue}if(g===" ")l=Math.max(l-1,0),d=Math.max(d-1,0);else if(g==="-")l=Math.max(l-1,0);else if(g==="+")d=Math.max(d-1,0);a=h}return n.push(t.slice(s)),n}function kO(t){return hS(t,0)}function hS(t,n){let s=Cp(t,n);return uS(t,n,"---")&&uS(t,s,"+++")}function uS(t,n,s){if(!t.startsWith(s,n))return!1;let a=t[n+s.length];if(a!==" "&&a!=="\t")return!1;for(let l=n+s.length+1;l<t.length;l++){let d=t[l];if(d===`
|
|
158
158
|
`||d==="\r")break;if(d!==" "&&d!=="\t")return!0}return!1}function Cp(t,n){let s=t.indexOf(`
|
|
@@ -162,15 +162,15 @@ From `)}function lS(t){let n=pS(t);for(let s=0;s<n.length;s++)n[s]=Tn(n[s]);retu
|
|
|
162
162
|
`))return t.slice(0,-1);return t}function LO(t){return t.startsWith("diff --git")||t.includes(`
|
|
163
163
|
diff --git`)}function yS(t,n){if(t.length===0)return[""];let s=`
|
|
164
164
|
${n}`,a=t.startsWith(n)?0:cS(t,s,0);if(a===-1)return[t];let l=[];if(a>0)l.push(t.slice(0,a));let d=a;for(;;){let f=cS(t,s,d+1);if(f===-1)break;l.push(t.slice(d,f)),d=f}return l.push(t.slice(d)),l}function cS(t,n,s){let a=t.indexOf(n,s);return a===-1?-1:a+1}function dS(t){return t==null?t:Tn(t)}function AO(t){return t===" "?"context":t==="\\"?"metadata":t==="+"?"addition":"deletion"}function Sp(t){let n=t.slice(1);return Tn(n===""?`
|
|
165
|
-
`:n)}function bp(t,n,s){if(t==="change")return{type:"change",additions:0,deletions:0,additionLineIndex:s,deletionLineIndex:n};return{type:"context",lines:0,additionLineIndex:s,deletionLineIndex:n}}var ra=new Set,ia=null;function q(t){ra.add(t),ia??=requestAnimationFrame(xS)}function D(t){if(ra.delete(t)&&ra.size===0&&ia!=null)cancelAnimationFrame(ia),ia=null}function xS(t){let n=new Set(ra);ra.clear();for(let s of n)try{s(t)}catch(a){console.error(a)}if(ra.size>0)ia=requestAnimationFrame(xS);else ia=null}function IS(t,n){if(t==null||n==null)return t===n;if(t.header!==n.header||t.footer!==n.footer)return!1;return PO(t.items,n.items)}function PO(t,n){if(t==null||n==null)return t===n;if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++){let a=t[s],l=n[s];if(a==null||l==null||a.id!==l.id||a.type!==l.type||a.element!==l.element||a.instance!==l.instance||a.version!==l.version)return!1}return!0}function vi(t,n,s){if(t===n||t==null||n==null)return t===n;let a=new Set(s),l=Object.keys(t),d=new Set(Object.keys(n));for(let f of l){if(d.delete(f),a.has(f))continue;if(!(f in n)||t[f]!==n[f])return!1}for(let f of Array.from(d))if(!a.has(f))return!1;return!0}function E(t,n){if(t==null||n==null||typeof t==="string"||typeof n==="string")return t===n;return t.dark===n.dark&&t.light===n.light}function oa(t,n){let s=t?.theme??u,a=n?.theme??u,l=SS(t),d=SS(n);return E(s,a)&&vi(t,n,["theme","parseDiffOptions"])&&vi(l,d)}function SS(t){if(t!=null&&"parseDiffOptions"in t)return t.parseDiffOptions}function sa(t,n){return t?.start===n?.start&&t?.end===n?.end&&t?.side===n?.side&&t?.endSide===n?.endSide}function bS(t,n,s){let a=document.createElement("div");if(a.style.display="flow-root",t==="header")a.setAttribute(YI,""),n.before(a);else a.setAttribute(JI,""),n.after(a);return s?.observe(a),a}function Ep({scrollTop:t,scrollHeight:n,height:s,fitPerfectly:a=!1,fitPerfectlyOverscroll:l=0,overscrollSize:d}){let f=s+d*2,h=a?s+l*2:f;if(n=Math.max(n,h),f>=n||a){let b=Math.max(t-l,0),v=Math.min(t+h,n);return{top:b,bottom:Math.max(v,b)}}let g=t+s/2-f/2,I=g+f;if(g<0)g=0;if(I>n)I=n;return g=Math.floor(Math.max(g,0)),{top:g,bottom:Math.ceil(Math.max(Math.min(I,n),g))}}function Co(t){if(typeof HTMLStyleElement<"u"&&t instanceof HTMLStyleElement)return!0;let n=t.tagName??t.nodeName;return typeof n==="string"&&n.toLowerCase()==="style"}function CS(){if(typeof window>"u"||typeof window.matchMedia!=="function")return!1;return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function oi(t){let n=window.devicePixelRatio??1;return Math.round(t*n)/n}function an(t,n){return t?.cacheKey!=null||n?.cacheKey!=null?t?.cacheKey===n?.cacheKey:t?.contents===n?.contents&&t?.name===n?.name&&t?.lang===n?.lang}function aa(t){return{...fl,...t}}function Mr(t,n){let s=MO(t,n);return n?s:t.diffHeaderHeight+s}function MO(t,n){return t.paddingTop??(n?t.spacing:0)}function ss(t){return t.paddingBottom??t.spacing}function ES(t){switch(t){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}var Gc="-1,-1";function zc(t){return t?.some((n)=>n.lineNumber===0)??!1}function hl(t){let n=t[0];return n!=null&&n.length>0?n:void 0}function Eo(t){return t.startingLine===0&&t.totalLines>0}function vS(t,n){return t.lineNumber===n.lineNumber&&t.side===n.side}function xr(t){return{type:"text",value:t}}function ke({tagName:t,children:n=[],properties:s={}}){return{type:"element",tagName:t,properties:s,children:n}}function as({name:t,width:n=16,height:s=16,properties:a}){return ke({tagName:"svg",properties:{width:n,height:s,viewBox:"0 0 16 16",...a},children:[ke({tagName:"use",properties:{href:`#${t.replace(/^#/,"")}`}})]})}function kS(t){let n=t.children[0];while(n!=null){if(n.type==="element"&&n.tagName==="code")return n;if("children"in n)n=n.children[0];else n=null}}function vo(t){return ke({tagName:"div",properties:{"data-gutter":""},children:t})}function jc(t,n,s,a={}){return ke({tagName:"div",properties:{"data-line-type":t,"data-column-number":n,"data-line-index":s,...a},children:n!=null?[ke({tagName:"span",properties:{"data-line-number-content":""},children:[xr(`${n}`)]})]:void 0})}function cr(t,n,s){return ke({tagName:"div",properties:{"data-gutter-buffer":n,"data-buffer-size":s,"data-line-type":n==="annotation"?void 0:t,style:n==="annotation"?`grid-row: span ${s};`:`grid-row: span ${s};min-height:calc(${s} * 1lh);`}})}function TS(){return ke({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[as({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function re(t){for(let n of t){if(!(n instanceof HTMLElement))continue;if(n.hasAttribute("data-utility-button")||n.hasAttribute("data-gutter-utility-slot")||n.getAttribute("slot")==="gutter-utility-slot"||n.getAttribute("name")==="gutter-utility-slot")return!0}return!1}var Kc=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:"idle"};constructor(t,n){this.mode=t,this.options=n}setOptions(t){this.options=t}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),D(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(t){this.setSelectionDirty();let{usesCustomGutterUtility:n=!1,enableGutterUtility:s=!1}=this.options;if(this.pre!==t)this.cleanUp(),this.pre=t;if(s)this.ensureGutterUtilityNode(n);else if(this.gutterUtilityContainer!=null){if(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting")this.clearPointerSession(),this.detachDocumentPointerListeners()}this.syncPointerListeners(t),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(t,n){let s=!(t===this.selectedRange||sa(t??void 0,this.selectedRange??void 0)),a=n?.lineNumberOnly??!1,l=n?.activeLineSide!==this.selectedRangeHighlightSide||a!==this.selectedRangeLineNumberOnly;if(!this.isSelectionDirty()&&!s&&!l)return;if(this.proposedSelectedRange=void 0,this.selectedRange=t,this.selectedRangeHighlightSide=n?.activeLineSide,this.selectedRangeLineNumberOnly=a,this.renderSelection(),this.placeUtility(),s&&n?.notify!==!1)this.notifySelectionCommitted(t)}setEditorActiveLine(t,{lineNumberOnly:n=!1,side:s}={}){let a=t!==this.editorActiveLine,l=s!==this.editorActiveLineSide||n!==this.editorLineNumberOnly;if(!this.isSelectionDirty()&&!a&&!l)return;this.editorActiveLine=t,this.editorActiveLineSide=s,this.editorLineNumberOnly=n,this.renderSelection()}getSelection(){return this.selectedRange}getHoveredLine=()=>{let t=this.gutterUtilityLine??this.hoveredLine;if(t!=null){if(this.mode==="diff"&&t.type==="diff-line")return{lineNumber:t.lineNumber,side:t.annotationSide};if(this.mode==="file"&&t.type==="line")return{lineNumber:t.lineNumber}}};handlePointerClick=(t)=>{let{onHunkExpand:n,onLineClick:s,onLineNumberClick:a,onTokenClick:l,onMergeConflictActionClick:d}=this.options;if(n==null&&s==null&&a==null&&d==null&&l==null)return;if(this.options.onGutterUtilityClick!=null&&re(t.composedPath()))return;Yi(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",t),this.handlePointerEvent({eventType:"click",event:t})};handlePointerMove=(t)=>{if(t.pointerType!=="mouse")return;let{lineHoverHighlight:n="disabled",onLineEnter:s,onLineLeave:a,onTokenEnter:l,onTokenLeave:d,enableGutterUtility:f=!1}=this.options;if(n==="disabled"&&!f&&s==null&&a==null&&l==null&&d==null)return;Yi(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",t),this.handlePointerEvent({eventType:"move",event:t})};handlePointerLeave=(t)=>{let{__debugPointerEvents:n}=this.options;if(Yi(n,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){Yi(n,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}if(this.hoveredToken!=null)this.options.onTokenLeave?.(this.hoveredToken,t),this.clearHoveredToken();if(this.hoveredLine!=null)this.options.onLineLeave?.({...this.hoveredLine,event:t}),this.clearHoveredLine();this.placeUtility()};handlePointerEvent({eventType:t,event:n}){let{__debugPointerEvents:s}=this.options,a=n.composedPath();Yi(s,t,"FileDiff.DEBUG.handlePointerEvent:",{eventType:t,composedPath:a});let l=this.resolvePointerTarget(a);Yi(s,t,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",l);let{onLineClick:d,onLineNumberClick:f,onLineEnter:h,onLineLeave:g,onTokenClick:I,onTokenEnter:b,onTokenLeave:v,onHunkExpand:k,onMergeConflictActionClick:w}=this.options;switch(t){case"move":{let P=vp(l)&&this.hoveredLine?.lineElement===l.lineElement;if(!(qc(l)&&this.hoveredToken?.tokenElement===l.tokenElement)){if(this.hoveredToken!=null)v?.(this.hoveredToken,n),this.clearHoveredToken();if(qc(l))this.setHoveredToken(this.toTokenEventBaseProps(l)),b?.(this.hoveredToken,n)}if(!P){if(this.hoveredLine!=null)g?.({...this.hoveredLine,event:n}),this.clearHoveredLine();if(vp(l))this.setHoveredLine(this.toEventBaseProps(l)),this.placeUtility(),h?.({...this.hoveredLine,event:n});else this.placeUtility()}break}case"click":{if(l==null)break;if($O(l)&&w!=null){w(l);break}if(OO(l)&&k!=null){k(l.hunkIndex,l.all||n.shiftKey?"both":l.direction,l.all||n.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!vp(l))break;if(qc(l)&&I!=null)I(this.toTokenEventBaseProps(l),n);let P=this.toEventBaseProps(l);if(f!=null&&l.numberColumn)f({...P,event:n});else if(d!=null)d({...P,event:n});break}}}syncPointerListeners(t){let{__debugPointerEvents:n,lineHoverHighlight:s="disabled",onLineClick:a,onLineNumberClick:l,onLineEnter:d,onLineLeave:f,onTokenClick:h,onTokenEnter:g,onTokenLeave:I,onHunkExpand:b,onMergeConflictActionClick:v,enableGutterUtility:k=!1,enableLineSelection:w=!1,onGutterUtilityClick:P}=this.options,M=P!=null,N=s!=="disabled"||a!=null||l!=null||d!=null||f!=null||h!=null||g!=null||I!=null||b!=null||v!=null||k||w||M;if(N&&!this.hasPointerListeners)t.addEventListener("click",this.handlePointerClick),t.addEventListener("pointerdown",this.handlePointerDown),t.addEventListener("pointermove",this.handlePointerMove),t.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,Yi(n,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{let B=[];if(n==="both"||n==="click"){if(a!=null)B.push("onLineClick");if(l!=null)B.push("onLineNumberClick");if(b!=null)B.push("expandable hunk separators");if(v!=null)B.push("merge conflict actions")}return B})()),Yi(n,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),Yi(n,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event");else if(!N&&this.hasPointerListeners)t.removeEventListener("click",this.handlePointerClick),t.removeEventListener("pointerdown",this.handlePointerDown),t.removeEventListener("pointermove",this.handlePointerMove),t.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1;let _=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",O=this.pointerSession.mode==="gutterSelecting";if(!w&&_||!M&&O)this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState()}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:t,onLineNumberClick:n,enableLineSelection:s=!1}=this.options,a=t!=null,l=n!=null||s;if(a&&!this.interactiveLinesAttr)this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0;else if(!a&&this.interactiveLinesAttr)this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1;if(l&&!this.interactiveLineNumbersAttr)this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0;else if(!l&&this.interactiveLineNumbersAttr)this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1}handlePointerDown=(t)=>{if(t.pointerType==="mouse"&&t.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;let n=t.composedPath();if(re(n)&&this.options.onGutterUtilityClick!=null)this.startGutterSelectionFromPointerDown(t);else{if(t.pointerType!=="mouse")this.revealUtilityFromGutterPath(n);this.startLineSelectionFromPointerDown(t)}};startLineSelectionFromPointerDown(t){let{enableLineSelection:n=!1}=this.options;if(!n)return;let s=this.resolveSelectionInfo(t,{source:"event-path",requireNumberColumn:!0});if(s==null)return;let{pre:a}=this;if(a==null)return;let{lineNumber:l,eventSide:d,lineIndex:f}=s;if(t.shiftKey&&this.selectedRange!=null){let h=this.getIndexesFromSelection(this.selectedRange,a.getAttribute("data-diff-type")==="split");if(h==null)return;let g=h.start<=h.end?f>=h.start:f<=h.end;this.selectionAnchor={lineNumber:g?this.selectedRange.start:this.selectedRange.end,side:g?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(l,d,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:t.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===l&&this.selectedRange?.end===l){let h={lineNumber:l,side:d};this.selectionAnchor=h,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:t.pointerId,anchor:h,pending:h},this.attachDocumentPointerListeners();return}if(this.options.controlledSelection===!0)this.proposedSelectedRange=null;else this.selectedRange=null;this.placeUtility(),this.selectionAnchor={lineNumber:l,side:d},this.updateSelection(l,d,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:t.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(t){let{onGutterUtilityClick:n}=this.options;if(n==null)return;let s=this.currentSelectionEnds(),a=s?.bottom??this.resolveSelectionPoint(t,{source:"event-path",excludeUtility:!1}),l=s?.top??a;if(a==null||l==null)return;t.preventDefault(),t.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:t.pointerId,anchor:l,current:a},this.selectionAnchor={lineNumber:l.lineNumber,side:l.side},this.updateSelection(a.lineNumber,a.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners()}handleDocumentPointerMove=(t)=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault();let n=this.resolveSelectionPoint(t,{source:"coordinates-first"});if(n==null)return;this.pointerSession.current=n,this.updateSelection(n.lineNumber,n.side);return}case"selecting":{if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault();let n=this.resolveSelectionInfo(t,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;this.updateSelection(n.lineNumber,n.eventSide);return}case"pendingSingleLineUnselect":{if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault();let n=this.resolveSelectionInfo(t,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;let s={lineNumber:n.lineNumber,side:n.eventSide};if(vS(this.pointerSession.pending,s))return;this.updateSelection(n.lineNumber,n.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:t.pointerId};return}}};handleDocumentPointerUp=(t)=>{let{onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{let{pointerSession:s}=this;if(t.pointerId!==s.pointerId)return;t.preventDefault();let a=this.resolveSelectionPoint(t,{source:"coordinates-first"});if(a!=null)s.current=a,this.updateSelection(a.lineNumber,a.side);let l=this.buildSelectedLineRange(s.anchor,s.current);n?.({...l}),this.selectionAnchor=void 0,this.notifySelectionEnd(l),this.notifySelectionCommitted(l),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case"selecting":if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=(t)=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession){if(t.pointerId!==this.pointerSession.pointerId)return}this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){if(this.hoveredLine==null)return;this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0}setHoveredLine(t){let{lineHoverHighlight:n="disabled"}=this.options;if(this.hoveredLine!=null)this.clearHoveredLine();if(this.hoveredLine=t,n!=="disabled"){if(n==="both"||n==="line")this.hoveredLine.lineElement.setAttribute("data-hovered","");if(n==="both"||n==="number")this.hoveredLine.numberElement.setAttribute("data-hovered","")}}clearHoveredToken(){if(this.hoveredToken==null)return;this.hoveredToken=void 0}setHoveredToken(t){if(this.hoveredToken!=null)this.clearHoveredToken();this.hoveredToken=t}ensureGutterUtilityNode(t){if(this.gutterUtilityContainer==null)this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","");if(t){if(this.gutterUtilityButton!=null)this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0;if(this.gutterUtilitySlot==null)this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot";if(this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer)this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot)}else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let n=document.createElement("div");n.innerHTML=pn(TS());let s=n.firstElementChild;if(!(s instanceof HTMLButtonElement))throw Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");s.remove(),this.gutterUtilityButton=s}if(this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer)this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(t){if(this.placeUtilityFromSelection())return;let n=this.resolvePointerTarget(t);if(yl(n)&&n.numberColumn)this.showUtilityOnLine(this.toEventBaseProps(n))}placeUtility(){if(this.placeUtilityFromSelection())return;if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}placeUtilityFromSelection(){let t=this.currentSelectionEnds();if(t==null)return!1;let n=this.targetForSelectionPoint(t.bottom);if(n==null)this.hideUtility();else this.showUtilityOnLine(this.toEventBaseProps(n));return!0}showUtilityOnLine(t){if(this.gutterUtilityContainer==null)return;this.gutterUtilityLine=t,t.numberElement.appendChild(this.gutterUtilityContainer)}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let t=this.getCurrentSelectionRange();return t==null?void 0:this.selectionEnds(t)}selectionEnds(t){let n={lineNumber:t.start,side:t.side},s={lineNumber:t.end,side:t.endSide??t.side},a=this.selectionPointRowIndex(n),l=this.selectionPointRowIndex(s);if(a==null||l==null)return;return a>l?{top:s,bottom:n}:{top:n,bottom:s}}selectionPointRowIndex(t){let n=this.getLineIndex(t.lineNumber,t.side);if(n==null)return;return this.isSplitDiff()?n[1]:n[0]}targetForSelectionPoint(t){if(this.pre==null)return;let n=this.getLineIndex(t.lineNumber,t.side);if(n==null)return;let s=this.mode==="diff"?`${n[0]},${n[1]}`:`${n[0]}`,a=this.pre.querySelectorAll(`[data-column-number="${t.lineNumber}"][data-line-index="${s}"]`);for(let l of a){if(!(l instanceof HTMLElement))continue;let d=this.resolvePointerTarget(gl(l));if(!yl(d))continue;if(this.mode==="diff"&&t.side!=null&&d.side!==t.side)continue;return d}}attachDocumentPointerListeners(){if(this.hasDocumentPointerListeners)return;document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0}detachDocumentPointerListeners(){if(!this.hasDocumentPointerListeners)return;document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){if(this.pointerSession.mode==="pendingSingleLineUnselect")this.pointerSession={mode:"idle"}}selectionInfoFromPath(t,n){let s=this.resolvePointerTarget(t);if(!yl(s))return;if(n&&!s.numberColumn)return;if(s.splitLineIndex==null)return;return{lineIndex:s.splitLineIndex,lineNumber:s.lineNumber,eventSide:this.mode==="diff"?s.side:void 0}}resolveSelectionInfo(t,n){let s=this.resolveSelectionPath(t,n);return s!=null?this.selectionInfoFromPath(s,n.requireNumberColumn):void 0}selectionPointFromPath(t){let n=this.resolvePointerTarget(t);if(!yl(n))return;return{lineNumber:n.lineNumber,side:this.mode==="diff"?n.side:void 0}}resolveSelectionPoint(t,n){let s=this.resolveSelectionPath(t,n);return s!=null?this.selectionPointFromPath(s):void 0}resolveSelectionPath(t,n){let s=n.excludeUtility!==!1;switch(n.source){case"event-path":return this.pathFromEventPath(t.composedPath(),s);case"coordinates-first":{let a=this.pathFromCoordinates(t,s);if(a!==void 0)return a??void 0;return this.pathFromEventPath(t.composedPath(),s)}}}pathFromCoordinates(t,n){let s=this.hitTest(t);if(s===void 0)return;if(s===null)return null;return this.pathFromElement(s,n)??null}pathFromEventPath(t,n){if(n&&re(t))return;for(let s of t)if(s instanceof Element)return this.pathFromElement(s,n)}pathFromElement(t,n){let s=gl(t);if(n&&re(s))return;let a=NO(t);if(a!=null)return gl(a);return this.pathFromAnnotationSlot(t)}pathFromAnnotationSlot(t){let n=DO(t)?.previousElementSibling;if(n instanceof HTMLElement&&(n.hasAttribute("data-line")||n.hasAttribute("data-column-number")))return gl(n);let s=UO(HO(t));if(s==null)return;let a=this.targetForSelectionPoint(s);return a!=null?gl(a.lineElement):void 0}hitTest(t){if(!Number.isFinite(t.clientX)||!Number.isFinite(t.clientY))return;let n=this.pre?.getRootNode(),s=RS(n)?n:RS(document)?document:void 0;if(s==null)return;return s.elementFromPoint(t.clientX,t.clientY)}getLineIndex(t,n){let{getLineIndex:s}=this.options;return s!=null?s(t,n):[t-1,t-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(t,n,s=!0){let a=this.getCurrentSelectionRange(),l;if(t==null)l=null;else{let d=this.selectionAnchor?.side??n,f=this.selectionAnchor?.lineNumber??t;l=this.buildSelectionRange(f,t,d,n)}if(sa(a??void 0,l??void 0))return;if(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0)this.proposedSelectedRange=l;else this.selectedRange=l,q(this.renderSelection);if(this.placeUtility(),s)this.notifySelectionChangeDelta()}getIndexesFromSelection(t,n){if(this.pre==null)return;let s=this.getLineIndex(t.start,t.side),a=this.getLineIndex(t.end,t.endSide??t.side);return s!=null&&a!=null?{start:n?s[1]:s[0],end:n?a[1]:a[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(t,n,s){if(t.range==null)return;let a=this.getIndexesFromSelection(t.range,n);if(a==null)throw console.error({rowRange:a,range:t.range}),Error(`InteractionManager.renderSelection: No valid ${s} rowRange`);return a}getLineRenderColumns(t,n,s,a){if(this.pre==null||n==null&&a==null)return[];let{children:l}=this.pre;if(l.length>2)throw console.error(l),Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");let d=[];for(let f of l){let h=f.hasAttribute("data-deletions")?"deletions":f.hasAttribute("data-additions")?"additions":void 0,g=t!=null&&n!=null&&(t.highlightSide==null||h==null||t.highlightSide===h),I=s!=null&&a!=null&&(s.highlightSide==null||h==null||s.highlightSide===h);if(!g&&!I)continue;let[b,v]=f.children;if(!(b instanceof HTMLElement)||!(v instanceof HTMLElement))throw Error("InteractionManager.renderSelection: missing gutter or content element");if(v.children.length!==b.children.length)throw Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");d.push({content:v,gutter:b,renderEditorActiveLine:I,renderSelectedLines:g})}return d}renderSelection=()=>{D(this.renderSelection);let t=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:n,selectedLines:s}=t,a=!LS(this.renderedSelectedLinesState,s),l=!LS(this.renderedEditorActiveLineState,n);if(!a&&!l)return;if(a)this.renderedSelectedLinesState=void 0;if(l)this.renderedEditorActiveLineState=void 0;let d=this.pre.getAttribute("data-diff-type")==="split",f=!a?void 0:this.resolveLineRenderRange(s,d,"selected-lines"),h=!l?void 0:this.resolveLineRenderRange(n,d,"editor-active-line"),g=this.getLineRenderColumns(a?s:void 0,f,l?n:void 0,h),I=s.range==null||g.some((M)=>M.renderSelectedLines),b=n.range==null||g.some((M)=>M.renderEditorActiveLine);if(a)for(let M of this.pre.querySelectorAll("[data-selected-line]"))M.removeAttribute("data-selected-line");if(l)for(let M of this.pre.querySelectorAll("[data-editor-active-line]"))M.removeAttribute("data-editor-active-line");let v=f==null?void 0:Math.min(f.start,f.end),k=f==null?void 0:Math.max(f.start,f.end),w=v===k,P=h?.start;for(let M of g){let{content:N,gutter:_,renderEditorActiveLine:O,renderSelectedLines:B}=M,X=Math.max(B?k??-1/0:-1/0,O?P??-1/0:-1/0),z=N.children.length;for(let K=0;K<z;K++){let W=N.children[K],J=_.children[K];if(!(W instanceof HTMLElement)||!(J instanceof HTMLElement))continue;let ee=this.parseLineIndex(W,d);if((ee??0)>X)break;if(ee==null)continue;if(B&&v!=null&&k!=null&&ee>=v&&ee<=k){let ce=w?"single":ee===v?"first":ee===k?"last":"";if(J.setAttribute("data-selected-line",ce),!s.lineNumberOnly){if(W.setAttribute("data-selected-line",ce),J.nextSibling instanceof HTMLElement&&W.nextSibling instanceof HTMLElement&&(W.nextSibling.hasAttribute("data-line-annotation")||W.nextSibling.hasAttribute("data-merge-conflict-actions"))){if(w)ce="last",W.setAttribute("data-selected-line","first");else if(ee===v)ce="";else if(ee===k)W.setAttribute("data-selected-line","");W.nextSibling.setAttribute("data-selected-line",ce),J.nextSibling.setAttribute("data-selected-line",ce)}}}if(O&&ee===P){if(J.setAttribute("data-editor-active-line",""),!n.lineNumberOnly)W.setAttribute("data-editor-active-line","")}}}if(a&&I)this.renderedSelectedLinesState=s;if(l&&b)this.renderedEditorActiveLineState=n};notifySelectionCommitted(t){this.options.onLineSelected?.(t)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(t){this.options.onLineSelectionStart?.(t)}notifySelectionEnd(t){this.options.onLineSelectionEnd?.(t)}toEventBaseProps(t){if(this.mode==="file")return{type:"line",lineElement:t.lineElement,lineNumber:t.lineNumber,numberColumn:t.numberColumn,numberElement:t.numberElement};return{type:"diff-line",annotationSide:t.side,lineType:t.lineType,lineElement:t.lineElement,numberElement:t.numberElement,lineNumber:t.lineNumber,numberColumn:t.numberColumn}}toTokenEventBaseProps({lineCharEnd:t,lineCharStart:n,lineNumber:s,side:a,tokenElement:l,tokenText:d}){if(this.mode==="file")return{type:"token",lineCharEnd:t,lineCharStart:n,lineNumber:s,tokenElement:l,tokenText:d};return{type:"token",lineCharEnd:t,lineCharStart:n,lineNumber:s,side:a,tokenElement:l,tokenText:d}}buildSelectedLineRange(t,n){return this.buildSelectionRange(t.lineNumber,n.lineNumber,t.side,n.side)}buildSelectionRange(t,n,s,a){return{start:t,end:n,...s!=null?{side:s}:{},...s!==a&&a!=null?{endSide:a}:{}}}resolvePointerTarget(t){let n=!1,s,a,l,d,f,h,g,I,b,v;for(let w of t){if(!(w instanceof HTMLElement))continue;if(v==null&&w.hasAttribute("data-merge-conflict-action")){let _=w.getAttribute("data-merge-conflict-action")??void 0,O=w.getAttribute("data-merge-conflict-conflict-index")??void 0,B=O!=null?Number.parseInt(O,10):NaN;if(FO(_)&&Number.isFinite(B))v={kind:"merge-conflict-action",resolution:_,conflictIndex:B}}if(h==null&&w.hasAttribute("data-char")){h=w;let _=w.getAttribute("data-char");if(_!=null){let O=Number.parseInt(_,10);if(!Number.isNaN(O)){let B=w.textContent??"",X=O+B.length;if(B.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)g={tokenElement:h,lineCharStart:O,lineCharEnd:X,tokenText:B};continue}}}let P=f==null?w.getAttribute("data-column-number")??void 0:void 0;if(P!=null){f=w,b=Number.parseInt(P,10),n=!0,s=PS(w),d=w.getAttribute("data-line-index")??void 0;continue}let M=l==null?w.getAttribute("data-line")??void 0:void 0;if(M!=null){l=w,b=Number.parseInt(M,10),s=PS(w),d=w.getAttribute("data-line-index")??void 0;continue}if(I==null&&(w.hasAttribute("data-expand-button")||w.hasAttribute("data-unmodified-lines"))){I={hunkIndex:void 0,direction:(()=>{if(w.hasAttribute("data-expand-up"))return"up";if(w.hasAttribute("data-expand-down"))return"down";return"both"})(),all:w.hasAttribute("data-expand-all-button")};continue}let N=I!=null?w.getAttribute("data-expand-index")??void 0:void 0;if(I!=null&&N!=null){let _=Number.parseInt(N,10);if(!Number.isNaN(_))I.hunkIndex=_;continue}if(a==null&&w.hasAttribute("data-code")){a=w;break}}if(v!=null)return v;if(I?.hunkIndex!=null)return{type:"line-info",hunkIndex:I.hunkIndex,direction:I.direction,all:I.all};if(l??=d!=null?wS(a,`[data-line][data-line-index="${d}"]`):void 0,f??=d!=null?wS(a,`[data-column-number][data-line-index="${d}"]`):void 0,a==null||l==null||f==null||s==null||b==null||Number.isNaN(b))return;let k=this.parseLineIndex(l,this.isSplitDiff());if(g!=null){if(this.mode==="file")return{kind:"token",lineType:s,lineElement:l,lineNumber:b,numberColumn:n,numberElement:f,side:void 0,splitLineIndex:k,...g};return{kind:"token",lineType:s,lineElement:l,lineNumber:b,numberColumn:n,numberElement:f,side:AS(s,a),splitLineIndex:k,...g}}if(this.mode==="file")return{kind:"line",lineType:s,lineElement:l,lineNumber:b,numberColumn:n,numberElement:f,side:void 0,splitLineIndex:k};return{kind:"line",lineType:s,lineElement:l,lineNumber:b,numberColumn:n,numberElement:f,side:AS(s,a),splitLineIndex:k}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(t,n){let s=(t.getAttribute("data-line-index")??"").split(",").map((a)=>Number.parseInt(a,10)).filter((a)=>!Number.isNaN(a));if(n&&s.length===2)return s[1];if(!n)return s[0]}};function la({enableTokenInteractionsOnWhitespace:t,enableGutterUtility:n,lineHoverHighlight:s,onGutterUtilityClick:a,onLineClick:l,onLineEnter:d,onLineLeave:f,onLineNumberClick:h,onTokenClick:g,onTokenEnter:I,onTokenLeave:b,renderGutterUtility:v,__debugPointerEvents:k,enableLineSelection:w,controlledSelection:P,onLineSelected:M,onLineSelectionStart:N,onLineSelectionChange:_,onLineSelectionEnd:O},B,X,z){return{enableTokenInteractionsOnWhitespace:t,enableGutterUtility:_O({enableGutterUtility:n,renderGutterUtility:v,onGutterUtilityClick:a}),usesCustomGutterUtility:v!=null,lineHoverHighlight:s,onGutterUtilityClick:a,onHunkExpand:B,onMergeConflictActionClick:z,onLineClick:l,onLineEnter:d,onLineLeave:f,onLineNumberClick:h,onTokenClick:g,onTokenEnter:I,onTokenLeave:b,__debugPointerEvents:k,enableLineSelection:w,controlledSelection:P,onLineSelected:M,onLineSelectionStart:N,onLineSelectionChange:_,onLineSelectionEnd:O,getLineIndex:X}}function _O({enableGutterUtility:t,renderGutterUtility:n,onGutterUtilityClick:s}){if(s!=null&&n!=null)throw Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return t??!1}function yl(t){return t!=null&&"kind"in t&&t.kind==="line"}function qc(t){return t!=null&&"kind"in t&&t.kind==="token"}function vp(t){return yl(t)||qc(t)}function OO(t){return"type"in t&&t.type==="line-info"}function $O(t){return"kind"in t&&t.kind==="merge-conflict-action"}function FO(t){return t==="current"||t==="incoming"||t==="both"}function wS(t,n){let s=t?.querySelector(n);return s instanceof HTMLElement?s:void 0}function gl(t){let n=[],s=t;while(s!=null)n.push(s),s=s.parentNode;return n}function NO(t){let n=t.closest("[data-line], [data-column-number]");if(n instanceof HTMLElement)return n;let s=t.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(s instanceof HTMLElement))return;let a=s.previousElementSibling;return a instanceof HTMLElement&&(a.hasAttribute("data-line")||a.hasAttribute("data-column-number"))?a:void 0}function DO(t){let n=t.closest('[slot^="annotation-"]'),s=(n instanceof HTMLElement&&n.assignedSlot!=null?n.assignedSlot:t.tagName==="SLOT"?t:void 0)?.closest("[data-line-annotation]");return s instanceof HTMLElement?s:void 0}function HO(t){let n=t.closest('[slot^="annotation-"]');if(n instanceof HTMLElement)return n.getAttribute("slot")??void 0;if(t instanceof HTMLElement){let s=t.getAttribute("name")??void 0;return s!=null&&s.startsWith("annotation-")?s:void 0}}function UO(t){if(t==null)return;let n=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(t);if(n==null)return;let s=Number.parseInt(n[2],10);if(!Number.isFinite(s)||s<=0)return;return{lineNumber:s,side:n[1]}}function RS(t){return t!=null&&typeof t.elementFromPoint==="function"}function BO(t,n){return t===n||sa(t??void 0,n??void 0)}function LS(t,n){return t?.highlightSide===n.highlightSide&&t?.lineNumberOnly===n.lineNumberOnly&&BO(t?.range??null,n.range)}function AS(t,n){switch(t){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return n.hasAttribute("data-deletions")?"deletions":"additions"}}function PS(t){let n=t.getAttribute("data-line-type");if(n==null)return;switch(n){case"change-deletion":case"change-addition":case"context":case"context-expanded":return n;default:return}}function Yi(t="none",n,...s){switch(t){case"none":return;case"both":break;case"click":if(n!=="click")return;break;case"move":if(n!=="move")return}console.log(...s)}var Vc=class t{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let n=t.resizeObserver??new ResizeObserver(t.handleSharedResizeEntries);return t.resizeObserver=n,n}static handleSharedResizeEntries(n){let s=new Map;for(let a of n){let l=t.managersByElement.get(a.target);if(l==null)continue;let d=s.get(l);if(d==null)s.set(l,[a]);else d.push(a)}for(let[a,l]of s)a.handleResizeEntries(l)}observedNodes=new Map;setup(n,{disableAnnotations:s,columnVariables:a="apply"}){let l=new Set,d=a==="apply",f=0,h=new Map(this.observedNodes);this.observedNodes.clear();for(let g of n.children){if(f===2)break;let I=(()=>{if(g instanceof HTMLElement&&g.tagName==="CODE")return g})();if(I==null)continue;f++;let b=h.get(I);if(b!=null&&b.type!=="code")throw Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let v=I.firstElementChild;if(!(v instanceof HTMLElement))v=null;if(b!=null){if(this.observedNodes.set(I,b),h.delete(I),b.numberElement!==v){if(b.numberElement!=null)this.unobserve(b.numberElement),h.delete(b.numberElement);if(v!=null)this.observe(v),h.delete(v),this.observedNodes.set(v,b);b.numberElement=v,b.numberWidth=0}else if(b.numberElement!=null)h.delete(b.numberElement),this.observedNodes.set(b.numberElement,b);else b.numberWidth=0;jO(b,d)}else if(b={type:"code",codeElement:I,numberElement:v,codeWidth:"auto",numberWidth:0,applyColumnVariables:d},this.observedNodes.set(I,b),this.observe(I),v!=null)this.observedNodes.set(v,b),this.observe(v)}if(f>1&&!s){let g=n.querySelectorAll('[data-line-annotation*=","]'),I=new Map;for(let b of g){if(!(b instanceof HTMLElement))continue;let v=b.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(v)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:v,element:b});continue}let k=I.get(v);if(k==null)k=[],I.set(v,k);k.push(b)}for(let[b,v]of I){if(v.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",b,v);continue}let[k,w]=v,P=k.firstElementChild,M=w.firstElementChild;if(!(k instanceof HTMLElement)||!(w instanceof HTMLElement)||!(P instanceof HTMLElement)||!(M instanceof HTMLElement))continue;let N=h.get(P);if(N!=null){this.observedNodes.set(P,N),this.observedNodes.set(M,N),h.delete(P),h.delete(M);continue}let _=P.getBoundingClientRect().height,O=M.getBoundingClientRect().height;N={type:"annotations",column1:{container:k,child:P,childHeight:_},column2:{container:w,child:M,childHeight:O},currentHeight:"auto"},l.add({child1:P,child2:M,item:N,newHeight:Math.max(_,O)})}for(let b of l)this.applyNewHeight(b.item,b.newHeight),this.observedNodes.set(b.child1,b.item),this.observedNodes.set(b.child2,b.item),this.observe(b.child1),this.observe(b.child2);l.clear()}for(let[g,I]of h)if(this.unobserve(g),I.type==="code")qO(I);else KO(I);h.clear()}cleanUp(){for(let n of this.observedNodes.keys())this.unobserve(n);this.observedNodes.clear()}observe(n){let{managersByElement:s}=t,a=s.get(n);if(a===this)return;else if(a!=null&&a!==this)throw Error("ResizeManager.observe: element is already owned by another ResizeManager");s.set(n,this),t.getResizeObserver().observe(n)}unobserve(n){let{managersByElement:s,resizeObserver:a}=t,l=s.get(n);if(l==null)return;else if(l!==this)throw Error("ResizeManager.unobserve: element is owned by another ResizeManager");if(s.delete(n),a?.unobserve(n),a!=null&&s.size===0)a.disconnect(),t.resizeObserver=void 0}handleResizeEntries(n){let s=new Map,a=new Set;for(let l of n){let{target:d,borderBoxSize:f,contentBoxSize:h}=l;if(!(d instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",l);continue}let g=this.observedNodes.get(d);if(g==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",l);continue}if(g.type==="annotations"){let I=(()=>{if(d===g.column1.child)return g.column1;if(d===g.column2.child)return g.column2})();if(I==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:g,target:d});continue}I.childHeight=f[0].blockSize,a.add(g)}else if(g.type==="code"){let I=s.get(g)??{},b=h[0].inlineSize;if(d===g.codeElement)I.codeInlineSize=b;else if(d===g.numberElement)I.numberInlineSize=b;s.set(g,I)}}this.applyAnnotationUpdates(a),a.clear(),this.applyColumnUpdates(s),s.clear()}applyAnnotationUpdates(n){for(let s of n)this.applyNewHeight(s,Math.max(s.column1.childHeight,s.column2.childHeight))}applyColumnUpdates=(n)=>{for(let[s,a]of n){let l=a.codeInlineSize!=null?GO(a.codeInlineSize):s.codeWidth,d=a.numberInlineSize!=null?zO(a.numberInlineSize):s.numberWidth,f=l!==s.codeWidth,h=d!==s.numberWidth;if(!f&&!h)continue;if(s.codeWidth=l,s.numberWidth=d,s.applyColumnVariables)MS(s,{codeWidthChanged:f,numberWidthChanged:h})}};applyNewHeight(n,s){if(s!==n.currentHeight)n.currentHeight=Math.max(s,0),n.column1.container.style.setProperty("--diffs-annotation-min-height",`${n.currentHeight}px`),n.column2.container.style.setProperty("--diffs-annotation-min-height",`${n.currentHeight}px`)}};function GO(t){let n=Math.max(Math.floor(t),0);return n===0?"auto":n}function zO(t){return Math.max(Math.ceil(t),0)}function jO(t,n){if(t.applyColumnVariables===n)return;if(t.applyColumnVariables=n,n)MS(t,{codeWidthChanged:!0,numberWidthChanged:!0});else _S(t)}function MS(t,{codeWidthChanged:n,numberWidthChanged:s}){let{codeElement:a,codeWidth:l,numberWidth:d}=t;if(n)a.style.setProperty("--diffs-column-width",`${typeof l==="number"?`${l}px`:"auto"}`);if(s)a.style.setProperty("--diffs-column-number-width",`${d===0?"auto":`${d}px`}`);if(n||s&&l!=="auto"){let f=typeof l==="number"?Math.max(l-d,0):0;a.style.setProperty("--diffs-column-content-width",`${f>0?`${f}px`:"auto"}`)}}function _S(t){t.codeElement.style.removeProperty("--diffs-column-content-width"),t.codeElement.style.removeProperty("--diffs-column-number-width"),t.codeElement.style.removeProperty("--diffs-column-width")}function qO(t){if(t.codeElement.isConnected)_S(t)}function KO(t){if(t.column1.container.isConnected)t.column1.container.style.removeProperty("--diffs-annotation-min-height");if(t.column2.container.isConnected)t.column2.container.style.removeProperty("--diffs-annotation-min-height")}function ko(t,n){if(t==null||n==null)return t===n;return t.startingLine===n.startingLine&&t.totalLines===n.totalLines&&t.bufferBefore===n.bufferBefore&&t.bufferAfter===n.bufferAfter}var ls=new Map,VO=0,xl={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","\uD83D\uDD25":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",mts:"typescript",cts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function p(t){if(ls.has(t))return ls.get(t)??"text";if(xl[t]!=null)return xl[t];let n=t.match(/\.([^/\\]+\.[^/\\]+)$/);if(n!=null){if(ls.has(n[1]))return ls.get(n[1])??"text";if(xl[n[1]]!=null)return xl[n[1]]??"text"}let s=t.match(/\.([^.]+)$/)?.[1]??"";if(ls.has(s))return ls.get(s)??"text";return xl[s]??"text"}function Je(){return VO}function et(){return Object.fromEntries(ls)}function S(t){return`annotation-${"side"in t?`${t.side}-`:""}${t.lineNumber}`}function V(t){return(t.lang??p(t.name))==="text"}function ze(t){return vn.hasResolvedThemes(t)}function Wc(t,n){if(t.endsWith(`\r
|
|
165
|
+
`:n)}function bp(t,n,s){if(t==="change")return{type:"change",additions:0,deletions:0,additionLineIndex:s,deletionLineIndex:n};return{type:"context",lines:0,additionLineIndex:s,deletionLineIndex:n}}var ra=new Set,ia=null;function q(t){ra.add(t),ia??=requestAnimationFrame(xS)}function D(t){if(ra.delete(t)&&ra.size===0&&ia!=null)cancelAnimationFrame(ia),ia=null}function xS(t){let n=new Set(ra);ra.clear();for(let s of n)try{s(t)}catch(a){console.error(a)}if(ra.size>0)ia=requestAnimationFrame(xS);else ia=null}function IS(t,n){if(t==null||n==null)return t===n;if(t.header!==n.header||t.footer!==n.footer)return!1;return PO(t.items,n.items)}function PO(t,n){if(t==null||n==null)return t===n;if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++){let a=t[s],l=n[s];if(a==null||l==null||a.id!==l.id||a.type!==l.type||a.element!==l.element||a.instance!==l.instance||a.version!==l.version)return!1}return!0}function vi(t,n,s){if(t===n||t==null||n==null)return t===n;let a=new Set(s),l=Object.keys(t),d=new Set(Object.keys(n));for(let f of l){if(d.delete(f),a.has(f))continue;if(!(f in n)||t[f]!==n[f])return!1}for(let f of Array.from(d))if(!a.has(f))return!1;return!0}function E(t,n){if(t==null||n==null||typeof t==="string"||typeof n==="string")return t===n;return t.dark===n.dark&&t.light===n.light}function oa(t,n){let s=t?.theme??u,a=n?.theme??u,l=SS(t),d=SS(n);return E(s,a)&&vi(t,n,["theme","parseDiffOptions"])&&vi(l,d)}function SS(t){if(t!=null&&"parseDiffOptions"in t)return t.parseDiffOptions}function sa(t,n){return t?.start===n?.start&&t?.end===n?.end&&t?.side===n?.side&&t?.endSide===n?.endSide}function bS(t,n,s){let a=document.createElement("div");if(a.style.display="flow-root",t==="header")a.setAttribute(YI,""),n.before(a);else a.setAttribute(JI,""),n.after(a);return s?.observe(a),a}function Ep({scrollTop:t,scrollHeight:n,height:s,fitPerfectly:a=!1,fitPerfectlyOverscroll:l=0,overscrollSize:d}){let f=s+d*2,h=a?s+l*2:f;if(n=Math.max(n,h),f>=n||a){let b=Math.max(t-l,0),v=Math.min(t+h,n);return{top:b,bottom:Math.max(v,b)}}let g=t+s/2-f/2,I=g+f;if(g<0)g=0;if(I>n)I=n;return g=Math.floor(Math.max(g,0)),{top:g,bottom:Math.ceil(Math.max(Math.min(I,n),g))}}function Co(t){if(typeof HTMLStyleElement<"u"&&t instanceof HTMLStyleElement)return!0;let n=t.tagName??t.nodeName;return typeof n==="string"&&n.toLowerCase()==="style"}function CS(){if(typeof window>"u"||typeof window.matchMedia!=="function")return!1;return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function oi(t){let n=window.devicePixelRatio??1;return Math.round(t*n)/n}function an(t,n){return t?.cacheKey!=null||n?.cacheKey!=null?t?.cacheKey===n?.cacheKey:t?.contents===n?.contents&&t?.name===n?.name&&t?.lang===n?.lang}function aa(t){return{...fl,...t}}function Mr(t,n){let s=MO(t,n);return n?s:t.diffHeaderHeight+s}function MO(t,n){return t.paddingTop??(n?t.spacing:0)}function ss(t){return t.paddingBottom??t.spacing}function ES(t){switch(t){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}var Gc="-1,-1";function zc(t){return t?.some((n)=>n.lineNumber===0)??!1}function hl(t){let n=t[0];return n!=null&&n.length>0?n:void 0}function Eo(t){return t.startingLine===0&&t.totalLines>0}function vS(t,n){return t.lineNumber===n.lineNumber&&t.side===n.side}function xr(t){return{type:"text",value:t}}function ke({tagName:t,children:n=[],properties:s={}}){return{type:"element",tagName:t,properties:s,children:n}}function as({name:t,width:n=16,height:s=16,properties:a}){return ke({tagName:"svg",properties:{width:n,height:s,viewBox:"0 0 16 16",...a},children:[ke({tagName:"use",properties:{href:`#${t.replace(/^#/,"")}`}})]})}function kS(t){let n=t.children[0];while(n!=null){if(n.type==="element"&&n.tagName==="code")return n;if("children"in n)n=n.children[0];else n=null}}function vo(t){return ke({tagName:"div",properties:{"data-gutter":""},children:t})}function jc(t,n,s,a={}){return ke({tagName:"div",properties:{"data-line-type":t,"data-column-number":n,"data-line-index":s,...a},children:n!=null?[ke({tagName:"span",properties:{"data-line-number-content":""},children:[xr(`${n}`)]})]:void 0})}function cr(t,n,s){return ke({tagName:"div",properties:{"data-gutter-buffer":n,"data-buffer-size":s,"data-line-type":n==="annotation"?void 0:t,style:n==="annotation"?`grid-row: span ${s};`:`grid-row: span ${s};min-height:calc(${s} * 1lh);`}})}function TS(){return ke({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[as({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function ie(t){for(let n of t){if(!(n instanceof HTMLElement))continue;if(n.hasAttribute("data-utility-button")||n.hasAttribute("data-gutter-utility-slot")||n.getAttribute("slot")==="gutter-utility-slot"||n.getAttribute("name")==="gutter-utility-slot")return!0}return!1}var Kc=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:"idle"};constructor(t,n){this.mode=t,this.options=n}setOptions(t){this.options=t}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),D(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(t){this.setSelectionDirty();let{usesCustomGutterUtility:n=!1,enableGutterUtility:s=!1}=this.options;if(this.pre!==t)this.cleanUp(),this.pre=t;if(s)this.ensureGutterUtilityNode(n);else if(this.gutterUtilityContainer!=null){if(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting")this.clearPointerSession(),this.detachDocumentPointerListeners()}this.syncPointerListeners(t),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(t,n){let s=!(t===this.selectedRange||sa(t??void 0,this.selectedRange??void 0)),a=n?.lineNumberOnly??!1,l=n?.activeLineSide!==this.selectedRangeHighlightSide||a!==this.selectedRangeLineNumberOnly;if(!this.isSelectionDirty()&&!s&&!l)return;if(this.proposedSelectedRange=void 0,this.selectedRange=t,this.selectedRangeHighlightSide=n?.activeLineSide,this.selectedRangeLineNumberOnly=a,this.renderSelection(),this.placeUtility(),s&&n?.notify!==!1)this.notifySelectionCommitted(t)}setEditorActiveLine(t,{lineNumberOnly:n=!1,side:s}={}){let a=t!==this.editorActiveLine,l=s!==this.editorActiveLineSide||n!==this.editorLineNumberOnly;if(!this.isSelectionDirty()&&!a&&!l)return;this.editorActiveLine=t,this.editorActiveLineSide=s,this.editorLineNumberOnly=n,this.renderSelection()}getSelection(){return this.selectedRange}getHoveredLine=()=>{let t=this.gutterUtilityLine??this.hoveredLine;if(t!=null){if(this.mode==="diff"&&t.type==="diff-line")return{lineNumber:t.lineNumber,side:t.annotationSide};if(this.mode==="file"&&t.type==="line")return{lineNumber:t.lineNumber}}};handlePointerClick=(t)=>{let{onHunkExpand:n,onLineClick:s,onLineNumberClick:a,onTokenClick:l,onMergeConflictActionClick:d}=this.options;if(n==null&&s==null&&a==null&&d==null&&l==null)return;if(this.options.onGutterUtilityClick!=null&&ie(t.composedPath()))return;Yi(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",t),this.handlePointerEvent({eventType:"click",event:t})};handlePointerMove=(t)=>{if(t.pointerType!=="mouse")return;let{lineHoverHighlight:n="disabled",onLineEnter:s,onLineLeave:a,onTokenEnter:l,onTokenLeave:d,enableGutterUtility:f=!1}=this.options;if(n==="disabled"&&!f&&s==null&&a==null&&l==null&&d==null)return;Yi(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",t),this.handlePointerEvent({eventType:"move",event:t})};handlePointerLeave=(t)=>{let{__debugPointerEvents:n}=this.options;if(Yi(n,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){Yi(n,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}if(this.hoveredToken!=null)this.options.onTokenLeave?.(this.hoveredToken,t),this.clearHoveredToken();if(this.hoveredLine!=null)this.options.onLineLeave?.({...this.hoveredLine,event:t}),this.clearHoveredLine();this.placeUtility()};handlePointerEvent({eventType:t,event:n}){let{__debugPointerEvents:s}=this.options,a=n.composedPath();Yi(s,t,"FileDiff.DEBUG.handlePointerEvent:",{eventType:t,composedPath:a});let l=this.resolvePointerTarget(a);Yi(s,t,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",l);let{onLineClick:d,onLineNumberClick:f,onLineEnter:h,onLineLeave:g,onTokenClick:I,onTokenEnter:b,onTokenLeave:v,onHunkExpand:k,onMergeConflictActionClick:w}=this.options;switch(t){case"move":{let P=vp(l)&&this.hoveredLine?.lineElement===l.lineElement;if(!(qc(l)&&this.hoveredToken?.tokenElement===l.tokenElement)){if(this.hoveredToken!=null)v?.(this.hoveredToken,n),this.clearHoveredToken();if(qc(l))this.setHoveredToken(this.toTokenEventBaseProps(l)),b?.(this.hoveredToken,n)}if(!P){if(this.hoveredLine!=null)g?.({...this.hoveredLine,event:n}),this.clearHoveredLine();if(vp(l))this.setHoveredLine(this.toEventBaseProps(l)),this.placeUtility(),h?.({...this.hoveredLine,event:n});else this.placeUtility()}break}case"click":{if(l==null)break;if($O(l)&&w!=null){w(l);break}if(OO(l)&&k!=null){k(l.hunkIndex,l.all||n.shiftKey?"both":l.direction,l.all||n.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!vp(l))break;if(qc(l)&&I!=null)I(this.toTokenEventBaseProps(l),n);let P=this.toEventBaseProps(l);if(f!=null&&l.numberColumn)f({...P,event:n});else if(d!=null)d({...P,event:n});break}}}syncPointerListeners(t){let{__debugPointerEvents:n,lineHoverHighlight:s="disabled",onLineClick:a,onLineNumberClick:l,onLineEnter:d,onLineLeave:f,onTokenClick:h,onTokenEnter:g,onTokenLeave:I,onHunkExpand:b,onMergeConflictActionClick:v,enableGutterUtility:k=!1,enableLineSelection:w=!1,onGutterUtilityClick:P}=this.options,M=P!=null,N=s!=="disabled"||a!=null||l!=null||d!=null||f!=null||h!=null||g!=null||I!=null||b!=null||v!=null||k||w||M;if(N&&!this.hasPointerListeners)t.addEventListener("click",this.handlePointerClick),t.addEventListener("pointerdown",this.handlePointerDown),t.addEventListener("pointermove",this.handlePointerMove),t.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,Yi(n,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{let B=[];if(n==="both"||n==="click"){if(a!=null)B.push("onLineClick");if(l!=null)B.push("onLineNumberClick");if(b!=null)B.push("expandable hunk separators");if(v!=null)B.push("merge conflict actions")}return B})()),Yi(n,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),Yi(n,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event");else if(!N&&this.hasPointerListeners)t.removeEventListener("click",this.handlePointerClick),t.removeEventListener("pointerdown",this.handlePointerDown),t.removeEventListener("pointermove",this.handlePointerMove),t.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1;let _=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",O=this.pointerSession.mode==="gutterSelecting";if(!w&&_||!M&&O)this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState()}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:t,onLineNumberClick:n,enableLineSelection:s=!1}=this.options,a=t!=null,l=n!=null||s;if(a&&!this.interactiveLinesAttr)this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0;else if(!a&&this.interactiveLinesAttr)this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1;if(l&&!this.interactiveLineNumbersAttr)this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0;else if(!l&&this.interactiveLineNumbersAttr)this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1}handlePointerDown=(t)=>{if(t.pointerType==="mouse"&&t.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;let n=t.composedPath();if(ie(n)&&this.options.onGutterUtilityClick!=null)this.startGutterSelectionFromPointerDown(t);else{if(t.pointerType!=="mouse")this.revealUtilityFromGutterPath(n);this.startLineSelectionFromPointerDown(t)}};startLineSelectionFromPointerDown(t){let{enableLineSelection:n=!1}=this.options;if(!n)return;let s=this.resolveSelectionInfo(t,{source:"event-path",requireNumberColumn:!0});if(s==null)return;let{pre:a}=this;if(a==null)return;let{lineNumber:l,eventSide:d,lineIndex:f}=s;if(t.shiftKey&&this.selectedRange!=null){let h=this.getIndexesFromSelection(this.selectedRange,a.getAttribute("data-diff-type")==="split");if(h==null)return;let g=h.start<=h.end?f>=h.start:f<=h.end;this.selectionAnchor={lineNumber:g?this.selectedRange.start:this.selectedRange.end,side:g?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(l,d,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:t.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===l&&this.selectedRange?.end===l){let h={lineNumber:l,side:d};this.selectionAnchor=h,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:t.pointerId,anchor:h,pending:h},this.attachDocumentPointerListeners();return}if(this.options.controlledSelection===!0)this.proposedSelectedRange=null;else this.selectedRange=null;this.placeUtility(),this.selectionAnchor={lineNumber:l,side:d},this.updateSelection(l,d,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:t.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(t){let{onGutterUtilityClick:n}=this.options;if(n==null)return;let s=this.currentSelectionEnds(),a=s?.bottom??this.resolveSelectionPoint(t,{source:"event-path",excludeUtility:!1}),l=s?.top??a;if(a==null||l==null)return;t.preventDefault(),t.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:t.pointerId,anchor:l,current:a},this.selectionAnchor={lineNumber:l.lineNumber,side:l.side},this.updateSelection(a.lineNumber,a.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners()}handleDocumentPointerMove=(t)=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault();let n=this.resolveSelectionPoint(t,{source:"coordinates-first"});if(n==null)return;this.pointerSession.current=n,this.updateSelection(n.lineNumber,n.side);return}case"selecting":{if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault();let n=this.resolveSelectionInfo(t,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;this.updateSelection(n.lineNumber,n.eventSide);return}case"pendingSingleLineUnselect":{if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault();let n=this.resolveSelectionInfo(t,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;let s={lineNumber:n.lineNumber,side:n.eventSide};if(vS(this.pointerSession.pending,s))return;this.updateSelection(n.lineNumber,n.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:t.pointerId};return}}};handleDocumentPointerUp=(t)=>{let{onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{let{pointerSession:s}=this;if(t.pointerId!==s.pointerId)return;t.preventDefault();let a=this.resolveSelectionPoint(t,{source:"coordinates-first"});if(a!=null)s.current=a,this.updateSelection(a.lineNumber,a.side);let l=this.buildSelectedLineRange(s.anchor,s.current);n?.({...l}),this.selectionAnchor=void 0,this.notifySelectionEnd(l),this.notifySelectionCommitted(l),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case"selecting":if(t.pointerId!==this.pointerSession.pointerId)return;t.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=(t)=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession){if(t.pointerId!==this.pointerSession.pointerId)return}this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){if(this.hoveredLine==null)return;this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0}setHoveredLine(t){let{lineHoverHighlight:n="disabled"}=this.options;if(this.hoveredLine!=null)this.clearHoveredLine();if(this.hoveredLine=t,n!=="disabled"){if(n==="both"||n==="line")this.hoveredLine.lineElement.setAttribute("data-hovered","");if(n==="both"||n==="number")this.hoveredLine.numberElement.setAttribute("data-hovered","")}}clearHoveredToken(){if(this.hoveredToken==null)return;this.hoveredToken=void 0}setHoveredToken(t){if(this.hoveredToken!=null)this.clearHoveredToken();this.hoveredToken=t}ensureGutterUtilityNode(t){if(this.gutterUtilityContainer==null)this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","");if(t){if(this.gutterUtilityButton!=null)this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0;if(this.gutterUtilitySlot==null)this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot";if(this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer)this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot)}else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let n=document.createElement("div");n.innerHTML=pn(TS());let s=n.firstElementChild;if(!(s instanceof HTMLButtonElement))throw Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");s.remove(),this.gutterUtilityButton=s}if(this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer)this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(t){if(this.placeUtilityFromSelection())return;let n=this.resolvePointerTarget(t);if(yl(n)&&n.numberColumn)this.showUtilityOnLine(this.toEventBaseProps(n))}placeUtility(){if(this.placeUtilityFromSelection())return;if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}placeUtilityFromSelection(){let t=this.currentSelectionEnds();if(t==null)return!1;let n=this.targetForSelectionPoint(t.bottom);if(n==null)this.hideUtility();else this.showUtilityOnLine(this.toEventBaseProps(n));return!0}showUtilityOnLine(t){if(this.gutterUtilityContainer==null)return;this.gutterUtilityLine=t,t.numberElement.appendChild(this.gutterUtilityContainer)}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let t=this.getCurrentSelectionRange();return t==null?void 0:this.selectionEnds(t)}selectionEnds(t){let n={lineNumber:t.start,side:t.side},s={lineNumber:t.end,side:t.endSide??t.side},a=this.selectionPointRowIndex(n),l=this.selectionPointRowIndex(s);if(a==null||l==null)return;return a>l?{top:s,bottom:n}:{top:n,bottom:s}}selectionPointRowIndex(t){let n=this.getLineIndex(t.lineNumber,t.side);if(n==null)return;return this.isSplitDiff()?n[1]:n[0]}targetForSelectionPoint(t){if(this.pre==null)return;let n=this.getLineIndex(t.lineNumber,t.side);if(n==null)return;let s=this.mode==="diff"?`${n[0]},${n[1]}`:`${n[0]}`,a=this.pre.querySelectorAll(`[data-column-number="${t.lineNumber}"][data-line-index="${s}"]`);for(let l of a){if(!(l instanceof HTMLElement))continue;let d=this.resolvePointerTarget(gl(l));if(!yl(d))continue;if(this.mode==="diff"&&t.side!=null&&d.side!==t.side)continue;return d}}attachDocumentPointerListeners(){if(this.hasDocumentPointerListeners)return;document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0}detachDocumentPointerListeners(){if(!this.hasDocumentPointerListeners)return;document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){if(this.pointerSession.mode==="pendingSingleLineUnselect")this.pointerSession={mode:"idle"}}selectionInfoFromPath(t,n){let s=this.resolvePointerTarget(t);if(!yl(s))return;if(n&&!s.numberColumn)return;if(s.splitLineIndex==null)return;return{lineIndex:s.splitLineIndex,lineNumber:s.lineNumber,eventSide:this.mode==="diff"?s.side:void 0}}resolveSelectionInfo(t,n){let s=this.resolveSelectionPath(t,n);return s!=null?this.selectionInfoFromPath(s,n.requireNumberColumn):void 0}selectionPointFromPath(t){let n=this.resolvePointerTarget(t);if(!yl(n))return;return{lineNumber:n.lineNumber,side:this.mode==="diff"?n.side:void 0}}resolveSelectionPoint(t,n){let s=this.resolveSelectionPath(t,n);return s!=null?this.selectionPointFromPath(s):void 0}resolveSelectionPath(t,n){let s=n.excludeUtility!==!1;switch(n.source){case"event-path":return this.pathFromEventPath(t.composedPath(),s);case"coordinates-first":{let a=this.pathFromCoordinates(t,s);if(a!==void 0)return a??void 0;return this.pathFromEventPath(t.composedPath(),s)}}}pathFromCoordinates(t,n){let s=this.hitTest(t);if(s===void 0)return;if(s===null)return null;return this.pathFromElement(s,n)??null}pathFromEventPath(t,n){if(n&&ie(t))return;for(let s of t)if(s instanceof Element)return this.pathFromElement(s,n)}pathFromElement(t,n){let s=gl(t);if(n&&ie(s))return;let a=NO(t);if(a!=null)return gl(a);return this.pathFromAnnotationSlot(t)}pathFromAnnotationSlot(t){let n=DO(t)?.previousElementSibling;if(n instanceof HTMLElement&&(n.hasAttribute("data-line")||n.hasAttribute("data-column-number")))return gl(n);let s=UO(HO(t));if(s==null)return;let a=this.targetForSelectionPoint(s);return a!=null?gl(a.lineElement):void 0}hitTest(t){if(!Number.isFinite(t.clientX)||!Number.isFinite(t.clientY))return;let n=this.pre?.getRootNode(),s=RS(n)?n:RS(document)?document:void 0;if(s==null)return;return s.elementFromPoint(t.clientX,t.clientY)}getLineIndex(t,n){let{getLineIndex:s}=this.options;return s!=null?s(t,n):[t-1,t-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(t,n,s=!0){let a=this.getCurrentSelectionRange(),l;if(t==null)l=null;else{let d=this.selectionAnchor?.side??n,f=this.selectionAnchor?.lineNumber??t;l=this.buildSelectionRange(f,t,d,n)}if(sa(a??void 0,l??void 0))return;if(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0)this.proposedSelectedRange=l;else this.selectedRange=l,q(this.renderSelection);if(this.placeUtility(),s)this.notifySelectionChangeDelta()}getIndexesFromSelection(t,n){if(this.pre==null)return;let s=this.getLineIndex(t.start,t.side),a=this.getLineIndex(t.end,t.endSide??t.side);return s!=null&&a!=null?{start:n?s[1]:s[0],end:n?a[1]:a[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(t,n,s){if(t.range==null)return;let a=this.getIndexesFromSelection(t.range,n);if(a==null)throw console.error({rowRange:a,range:t.range}),Error(`InteractionManager.renderSelection: No valid ${s} rowRange`);return a}getLineRenderColumns(t,n,s,a){if(this.pre==null||n==null&&a==null)return[];let{children:l}=this.pre;if(l.length>2)throw console.error(l),Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");let d=[];for(let f of l){let h=f.hasAttribute("data-deletions")?"deletions":f.hasAttribute("data-additions")?"additions":void 0,g=t!=null&&n!=null&&(t.highlightSide==null||h==null||t.highlightSide===h),I=s!=null&&a!=null&&(s.highlightSide==null||h==null||s.highlightSide===h);if(!g&&!I)continue;let[b,v]=f.children;if(!(b instanceof HTMLElement)||!(v instanceof HTMLElement))throw Error("InteractionManager.renderSelection: missing gutter or content element");if(v.children.length!==b.children.length)throw Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");d.push({content:v,gutter:b,renderEditorActiveLine:I,renderSelectedLines:g})}return d}renderSelection=()=>{D(this.renderSelection);let t=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:n,selectedLines:s}=t,a=!LS(this.renderedSelectedLinesState,s),l=!LS(this.renderedEditorActiveLineState,n);if(!a&&!l)return;if(a)this.renderedSelectedLinesState=void 0;if(l)this.renderedEditorActiveLineState=void 0;let d=this.pre.getAttribute("data-diff-type")==="split",f=!a?void 0:this.resolveLineRenderRange(s,d,"selected-lines"),h=!l?void 0:this.resolveLineRenderRange(n,d,"editor-active-line"),g=this.getLineRenderColumns(a?s:void 0,f,l?n:void 0,h),I=s.range==null||g.some((M)=>M.renderSelectedLines),b=n.range==null||g.some((M)=>M.renderEditorActiveLine);if(a)for(let M of this.pre.querySelectorAll("[data-selected-line]"))M.removeAttribute("data-selected-line");if(l)for(let M of this.pre.querySelectorAll("[data-editor-active-line]"))M.removeAttribute("data-editor-active-line");let v=f==null?void 0:Math.min(f.start,f.end),k=f==null?void 0:Math.max(f.start,f.end),w=v===k,P=h?.start;for(let M of g){let{content:N,gutter:_,renderEditorActiveLine:O,renderSelectedLines:B}=M,X=Math.max(B?k??-1/0:-1/0,O?P??-1/0:-1/0),z=N.children.length;for(let K=0;K<z;K++){let W=N.children[K],J=_.children[K];if(!(W instanceof HTMLElement)||!(J instanceof HTMLElement))continue;let ee=this.parseLineIndex(W,d);if((ee??0)>X)break;if(ee==null)continue;if(B&&v!=null&&k!=null&&ee>=v&&ee<=k){let ue=w?"single":ee===v?"first":ee===k?"last":"";if(J.setAttribute("data-selected-line",ue),!s.lineNumberOnly){if(W.setAttribute("data-selected-line",ue),J.nextSibling instanceof HTMLElement&&W.nextSibling instanceof HTMLElement&&(W.nextSibling.hasAttribute("data-line-annotation")||W.nextSibling.hasAttribute("data-merge-conflict-actions"))){if(w)ue="last",W.setAttribute("data-selected-line","first");else if(ee===v)ue="";else if(ee===k)W.setAttribute("data-selected-line","");W.nextSibling.setAttribute("data-selected-line",ue),J.nextSibling.setAttribute("data-selected-line",ue)}}}if(O&&ee===P){if(J.setAttribute("data-editor-active-line",""),!n.lineNumberOnly)W.setAttribute("data-editor-active-line","")}}}if(a&&I)this.renderedSelectedLinesState=s;if(l&&b)this.renderedEditorActiveLineState=n};notifySelectionCommitted(t){this.options.onLineSelected?.(t)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(t){this.options.onLineSelectionStart?.(t)}notifySelectionEnd(t){this.options.onLineSelectionEnd?.(t)}toEventBaseProps(t){if(this.mode==="file")return{type:"line",lineElement:t.lineElement,lineNumber:t.lineNumber,numberColumn:t.numberColumn,numberElement:t.numberElement};return{type:"diff-line",annotationSide:t.side,lineType:t.lineType,lineElement:t.lineElement,numberElement:t.numberElement,lineNumber:t.lineNumber,numberColumn:t.numberColumn}}toTokenEventBaseProps({lineCharEnd:t,lineCharStart:n,lineNumber:s,side:a,tokenElement:l,tokenText:d}){if(this.mode==="file")return{type:"token",lineCharEnd:t,lineCharStart:n,lineNumber:s,tokenElement:l,tokenText:d};return{type:"token",lineCharEnd:t,lineCharStart:n,lineNumber:s,side:a,tokenElement:l,tokenText:d}}buildSelectedLineRange(t,n){return this.buildSelectionRange(t.lineNumber,n.lineNumber,t.side,n.side)}buildSelectionRange(t,n,s,a){return{start:t,end:n,...s!=null?{side:s}:{},...s!==a&&a!=null?{endSide:a}:{}}}resolvePointerTarget(t){let n=!1,s,a,l,d,f,h,g,I,b,v;for(let w of t){if(!(w instanceof HTMLElement))continue;if(v==null&&w.hasAttribute("data-merge-conflict-action")){let _=w.getAttribute("data-merge-conflict-action")??void 0,O=w.getAttribute("data-merge-conflict-conflict-index")??void 0,B=O!=null?Number.parseInt(O,10):NaN;if(FO(_)&&Number.isFinite(B))v={kind:"merge-conflict-action",resolution:_,conflictIndex:B}}if(h==null&&w.hasAttribute("data-char")){h=w;let _=w.getAttribute("data-char");if(_!=null){let O=Number.parseInt(_,10);if(!Number.isNaN(O)){let B=w.textContent??"",X=O+B.length;if(B.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)g={tokenElement:h,lineCharStart:O,lineCharEnd:X,tokenText:B};continue}}}let P=f==null?w.getAttribute("data-column-number")??void 0:void 0;if(P!=null){f=w,b=Number.parseInt(P,10),n=!0,s=PS(w),d=w.getAttribute("data-line-index")??void 0;continue}let M=l==null?w.getAttribute("data-line")??void 0:void 0;if(M!=null){l=w,b=Number.parseInt(M,10),s=PS(w),d=w.getAttribute("data-line-index")??void 0;continue}if(I==null&&(w.hasAttribute("data-expand-button")||w.hasAttribute("data-unmodified-lines"))){I={hunkIndex:void 0,direction:(()=>{if(w.hasAttribute("data-expand-up"))return"up";if(w.hasAttribute("data-expand-down"))return"down";return"both"})(),all:w.hasAttribute("data-expand-all-button")};continue}let N=I!=null?w.getAttribute("data-expand-index")??void 0:void 0;if(I!=null&&N!=null){let _=Number.parseInt(N,10);if(!Number.isNaN(_))I.hunkIndex=_;continue}if(a==null&&w.hasAttribute("data-code")){a=w;break}}if(v!=null)return v;if(I?.hunkIndex!=null)return{type:"line-info",hunkIndex:I.hunkIndex,direction:I.direction,all:I.all};if(l??=d!=null?wS(a,`[data-line][data-line-index="${d}"]`):void 0,f??=d!=null?wS(a,`[data-column-number][data-line-index="${d}"]`):void 0,a==null||l==null||f==null||s==null||b==null||Number.isNaN(b))return;let k=this.parseLineIndex(l,this.isSplitDiff());if(g!=null){if(this.mode==="file")return{kind:"token",lineType:s,lineElement:l,lineNumber:b,numberColumn:n,numberElement:f,side:void 0,splitLineIndex:k,...g};return{kind:"token",lineType:s,lineElement:l,lineNumber:b,numberColumn:n,numberElement:f,side:AS(s,a),splitLineIndex:k,...g}}if(this.mode==="file")return{kind:"line",lineType:s,lineElement:l,lineNumber:b,numberColumn:n,numberElement:f,side:void 0,splitLineIndex:k};return{kind:"line",lineType:s,lineElement:l,lineNumber:b,numberColumn:n,numberElement:f,side:AS(s,a),splitLineIndex:k}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(t,n){let s=(t.getAttribute("data-line-index")??"").split(",").map((a)=>Number.parseInt(a,10)).filter((a)=>!Number.isNaN(a));if(n&&s.length===2)return s[1];if(!n)return s[0]}};function la({enableTokenInteractionsOnWhitespace:t,enableGutterUtility:n,lineHoverHighlight:s,onGutterUtilityClick:a,onLineClick:l,onLineEnter:d,onLineLeave:f,onLineNumberClick:h,onTokenClick:g,onTokenEnter:I,onTokenLeave:b,renderGutterUtility:v,__debugPointerEvents:k,enableLineSelection:w,controlledSelection:P,onLineSelected:M,onLineSelectionStart:N,onLineSelectionChange:_,onLineSelectionEnd:O},B,X,z){return{enableTokenInteractionsOnWhitespace:t,enableGutterUtility:_O({enableGutterUtility:n,renderGutterUtility:v,onGutterUtilityClick:a}),usesCustomGutterUtility:v!=null,lineHoverHighlight:s,onGutterUtilityClick:a,onHunkExpand:B,onMergeConflictActionClick:z,onLineClick:l,onLineEnter:d,onLineLeave:f,onLineNumberClick:h,onTokenClick:g,onTokenEnter:I,onTokenLeave:b,__debugPointerEvents:k,enableLineSelection:w,controlledSelection:P,onLineSelected:M,onLineSelectionStart:N,onLineSelectionChange:_,onLineSelectionEnd:O,getLineIndex:X}}function _O({enableGutterUtility:t,renderGutterUtility:n,onGutterUtilityClick:s}){if(s!=null&&n!=null)throw Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return t??!1}function yl(t){return t!=null&&"kind"in t&&t.kind==="line"}function qc(t){return t!=null&&"kind"in t&&t.kind==="token"}function vp(t){return yl(t)||qc(t)}function OO(t){return"type"in t&&t.type==="line-info"}function $O(t){return"kind"in t&&t.kind==="merge-conflict-action"}function FO(t){return t==="current"||t==="incoming"||t==="both"}function wS(t,n){let s=t?.querySelector(n);return s instanceof HTMLElement?s:void 0}function gl(t){let n=[],s=t;while(s!=null)n.push(s),s=s.parentNode;return n}function NO(t){let n=t.closest("[data-line], [data-column-number]");if(n instanceof HTMLElement)return n;let s=t.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(s instanceof HTMLElement))return;let a=s.previousElementSibling;return a instanceof HTMLElement&&(a.hasAttribute("data-line")||a.hasAttribute("data-column-number"))?a:void 0}function DO(t){let n=t.closest('[slot^="annotation-"]'),s=(n instanceof HTMLElement&&n.assignedSlot!=null?n.assignedSlot:t.tagName==="SLOT"?t:void 0)?.closest("[data-line-annotation]");return s instanceof HTMLElement?s:void 0}function HO(t){let n=t.closest('[slot^="annotation-"]');if(n instanceof HTMLElement)return n.getAttribute("slot")??void 0;if(t instanceof HTMLElement){let s=t.getAttribute("name")??void 0;return s!=null&&s.startsWith("annotation-")?s:void 0}}function UO(t){if(t==null)return;let n=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(t);if(n==null)return;let s=Number.parseInt(n[2],10);if(!Number.isFinite(s)||s<=0)return;return{lineNumber:s,side:n[1]}}function RS(t){return t!=null&&typeof t.elementFromPoint==="function"}function BO(t,n){return t===n||sa(t??void 0,n??void 0)}function LS(t,n){return t?.highlightSide===n.highlightSide&&t?.lineNumberOnly===n.lineNumberOnly&&BO(t?.range??null,n.range)}function AS(t,n){switch(t){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return n.hasAttribute("data-deletions")?"deletions":"additions"}}function PS(t){let n=t.getAttribute("data-line-type");if(n==null)return;switch(n){case"change-deletion":case"change-addition":case"context":case"context-expanded":return n;default:return}}function Yi(t="none",n,...s){switch(t){case"none":return;case"both":break;case"click":if(n!=="click")return;break;case"move":if(n!=="move")return}console.log(...s)}var Vc=class t{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let n=t.resizeObserver??new ResizeObserver(t.handleSharedResizeEntries);return t.resizeObserver=n,n}static handleSharedResizeEntries(n){let s=new Map;for(let a of n){let l=t.managersByElement.get(a.target);if(l==null)continue;let d=s.get(l);if(d==null)s.set(l,[a]);else d.push(a)}for(let[a,l]of s)a.handleResizeEntries(l)}observedNodes=new Map;setup(n,{disableAnnotations:s,columnVariables:a="apply"}){let l=new Set,d=a==="apply",f=0,h=new Map(this.observedNodes);this.observedNodes.clear();for(let g of n.children){if(f===2)break;let I=(()=>{if(g instanceof HTMLElement&&g.tagName==="CODE")return g})();if(I==null)continue;f++;let b=h.get(I);if(b!=null&&b.type!=="code")throw Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let v=I.firstElementChild;if(!(v instanceof HTMLElement))v=null;if(b!=null){if(this.observedNodes.set(I,b),h.delete(I),b.numberElement!==v){if(b.numberElement!=null)this.unobserve(b.numberElement),h.delete(b.numberElement);if(v!=null)this.observe(v),h.delete(v),this.observedNodes.set(v,b);b.numberElement=v,b.numberWidth=0}else if(b.numberElement!=null)h.delete(b.numberElement),this.observedNodes.set(b.numberElement,b);else b.numberWidth=0;jO(b,d)}else if(b={type:"code",codeElement:I,numberElement:v,codeWidth:"auto",numberWidth:0,applyColumnVariables:d},this.observedNodes.set(I,b),this.observe(I),v!=null)this.observedNodes.set(v,b),this.observe(v)}if(f>1&&!s){let g=n.querySelectorAll('[data-line-annotation*=","]'),I=new Map;for(let b of g){if(!(b instanceof HTMLElement))continue;let v=b.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(v)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:v,element:b});continue}let k=I.get(v);if(k==null)k=[],I.set(v,k);k.push(b)}for(let[b,v]of I){if(v.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",b,v);continue}let[k,w]=v,P=k.firstElementChild,M=w.firstElementChild;if(!(k instanceof HTMLElement)||!(w instanceof HTMLElement)||!(P instanceof HTMLElement)||!(M instanceof HTMLElement))continue;let N=h.get(P);if(N!=null){this.observedNodes.set(P,N),this.observedNodes.set(M,N),h.delete(P),h.delete(M);continue}let _=P.getBoundingClientRect().height,O=M.getBoundingClientRect().height;N={type:"annotations",column1:{container:k,child:P,childHeight:_},column2:{container:w,child:M,childHeight:O},currentHeight:"auto"},l.add({child1:P,child2:M,item:N,newHeight:Math.max(_,O)})}for(let b of l)this.applyNewHeight(b.item,b.newHeight),this.observedNodes.set(b.child1,b.item),this.observedNodes.set(b.child2,b.item),this.observe(b.child1),this.observe(b.child2);l.clear()}for(let[g,I]of h)if(this.unobserve(g),I.type==="code")qO(I);else KO(I);h.clear()}cleanUp(){for(let n of this.observedNodes.keys())this.unobserve(n);this.observedNodes.clear()}observe(n){let{managersByElement:s}=t,a=s.get(n);if(a===this)return;else if(a!=null&&a!==this)throw Error("ResizeManager.observe: element is already owned by another ResizeManager");s.set(n,this),t.getResizeObserver().observe(n)}unobserve(n){let{managersByElement:s,resizeObserver:a}=t,l=s.get(n);if(l==null)return;else if(l!==this)throw Error("ResizeManager.unobserve: element is owned by another ResizeManager");if(s.delete(n),a?.unobserve(n),a!=null&&s.size===0)a.disconnect(),t.resizeObserver=void 0}handleResizeEntries(n){let s=new Map,a=new Set;for(let l of n){let{target:d,borderBoxSize:f,contentBoxSize:h}=l;if(!(d instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",l);continue}let g=this.observedNodes.get(d);if(g==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",l);continue}if(g.type==="annotations"){let I=(()=>{if(d===g.column1.child)return g.column1;if(d===g.column2.child)return g.column2})();if(I==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:g,target:d});continue}I.childHeight=f[0].blockSize,a.add(g)}else if(g.type==="code"){let I=s.get(g)??{},b=h[0].inlineSize;if(d===g.codeElement)I.codeInlineSize=b;else if(d===g.numberElement)I.numberInlineSize=b;s.set(g,I)}}this.applyAnnotationUpdates(a),a.clear(),this.applyColumnUpdates(s),s.clear()}applyAnnotationUpdates(n){for(let s of n)this.applyNewHeight(s,Math.max(s.column1.childHeight,s.column2.childHeight))}applyColumnUpdates=(n)=>{for(let[s,a]of n){let l=a.codeInlineSize!=null?GO(a.codeInlineSize):s.codeWidth,d=a.numberInlineSize!=null?zO(a.numberInlineSize):s.numberWidth,f=l!==s.codeWidth,h=d!==s.numberWidth;if(!f&&!h)continue;if(s.codeWidth=l,s.numberWidth=d,s.applyColumnVariables)MS(s,{codeWidthChanged:f,numberWidthChanged:h})}};applyNewHeight(n,s){if(s!==n.currentHeight)n.currentHeight=Math.max(s,0),n.column1.container.style.setProperty("--diffs-annotation-min-height",`${n.currentHeight}px`),n.column2.container.style.setProperty("--diffs-annotation-min-height",`${n.currentHeight}px`)}};function GO(t){let n=Math.max(Math.floor(t),0);return n===0?"auto":n}function zO(t){return Math.max(Math.ceil(t),0)}function jO(t,n){if(t.applyColumnVariables===n)return;if(t.applyColumnVariables=n,n)MS(t,{codeWidthChanged:!0,numberWidthChanged:!0});else _S(t)}function MS(t,{codeWidthChanged:n,numberWidthChanged:s}){let{codeElement:a,codeWidth:l,numberWidth:d}=t;if(n)a.style.setProperty("--diffs-column-width",`${typeof l==="number"?`${l}px`:"auto"}`);if(s)a.style.setProperty("--diffs-column-number-width",`${d===0?"auto":`${d}px`}`);if(n||s&&l!=="auto"){let f=typeof l==="number"?Math.max(l-d,0):0;a.style.setProperty("--diffs-column-content-width",`${f>0?`${f}px`:"auto"}`)}}function _S(t){t.codeElement.style.removeProperty("--diffs-column-content-width"),t.codeElement.style.removeProperty("--diffs-column-number-width"),t.codeElement.style.removeProperty("--diffs-column-width")}function qO(t){if(t.codeElement.isConnected)_S(t)}function KO(t){if(t.column1.container.isConnected)t.column1.container.style.removeProperty("--diffs-annotation-min-height");if(t.column2.container.isConnected)t.column2.container.style.removeProperty("--diffs-annotation-min-height")}function ko(t,n){if(t==null||n==null)return t===n;return t.startingLine===n.startingLine&&t.totalLines===n.totalLines&&t.bufferBefore===n.bufferBefore&&t.bufferAfter===n.bufferAfter}var ls=new Map,VO=0,xl={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","\uD83D\uDD25":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",mts:"typescript",cts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function p(t){if(ls.has(t))return ls.get(t)??"text";if(xl[t]!=null)return xl[t];let n=t.match(/\.([^/\\]+\.[^/\\]+)$/);if(n!=null){if(ls.has(n[1]))return ls.get(n[1])??"text";if(xl[n[1]]!=null)return xl[n[1]]??"text"}let s=t.match(/\.([^.]+)$/)?.[1]??"";if(ls.has(s))return ls.get(s)??"text";return xl[s]??"text"}function et(){return VO}function tt(){return Object.fromEntries(ls)}function S(t){return`annotation-${"side"in t?`${t.side}-`:""}${t.lineNumber}`}function V(t){return(t.lang??p(t.name))==="text"}function ze(t){return vn.hasResolvedThemes(t)}function Wc(t,n){if(t.endsWith(`\r
|
|
166
166
|
`))return n+`\r
|
|
167
167
|
`;if(t.endsWith("\r"))return n+"\r";if(t.endsWith(`
|
|
168
168
|
`))return n+`
|
|
169
169
|
`;return n}function L(t,n){return E(t.theme,n.theme)&&t.useTokenTransformer===n.useTokenTransformer&&t.tokenizeMaxLineLength===n.tokenizeMaxLineLength}function me(t){let n=[0],s=t.indexOf("\r"),a=t.indexOf(`
|
|
170
170
|
`),l=0,d=0;while(s!==-1||a!==-1){let f;if(s!==-1&&(a===-1||s<a))if(a===s+1)f=a+1,s=t.indexOf("\r",f),a=t.indexOf(`
|
|
171
171
|
`,f);else f=s+1,s=t.indexOf("\r",f);else f=a+1,a=t.indexOf(`
|
|
172
|
-
`,f);if(n.push(f),++d===4){if(f-l<=40){for(let h=f;h<t.length;h++){let g=t.charCodeAt(h);if(g===10||g===13){if(g===13&&h+1<t.length&&t.charCodeAt(h+1)===10)h++;n.push(h+1)}}return n}l=f,d=0}}return n}function
|
|
173
|
-
`));return t}var Zc=Symbol("no-token"),kp=Symbol("multiple-tokens");function Tp(t){let n=JO(t);if(n!=null)return n;let s=Zc,a=[],l=[],d,f=()=>{if(l.length===0||d==null){l=[],d=void 0;return}if(l.length===1){let g=l[0];if(g?.type==="element"){QO(g,d);for(let I of g.children)ed(I)}else ed(g);a.push(g),l=[],d=void 0;return}for(let g of l)ed(g);a.push(ke({tagName:"span",properties:{"data-char":d},children:l})),l=[],d=void 0},h=(g)=>{if(g===Zc)return;if(g===kp){s=kp;return}if(s===Zc){s=g;return}if(s!==g)s=kp};for(let g of t.children){let I=g.type==="element"?Tp(g):Zc;if(h(I),typeof I!=="number"){f(),a.push(g);continue}if(d!=null&&d!==I)f();d??=I,l.push(g)}return f(),t.children=a,s}function JO(t){let n=t.properties["data-char"];if(typeof n==="number")return n}function ed(t){if(t.type!=="element")return;t.properties["data-char"]=void 0;for(let n of t.children)ed(n)}function QO(t,n){t.properties["data-char"]=n}var L3=Symbol("highlighted-lines");function FS(t={}){let{classPrefix:n="__shiki_",classSuffix:s="",classReplacer:a=(h)=>h}=t,l=new Map;function d(h){return Object.entries(h).map(([g,I])=>`${g}:${I}`).join(";")}function f(h){let g=typeof h==="string"?h:d(h),I=n+ZO(g)+s;if(I=a(I),!l.has(I))l.set(I,typeof h==="string"?h:{...h});return I}return{name:"@shikijs/transformers:style-to-class",pre(h){if(!h.properties.style)return;let g=f(h.properties.style);delete h.properties.style,this.addClassToHast(h,g)},tokens(h){for(let g of h)for(let I of g){if(!I.htmlStyle)continue;let b=f(I.htmlStyle);if(I.htmlStyle={},I.htmlAttrs||={},!I.htmlAttrs.class)I.htmlAttrs.class=b;else I.htmlAttrs.class+=` ${b}`}},getClassRegistry(){return l},getCSS(){let h="";for(let[g,I]of l.entries())h+=`.${g}{${typeof I==="string"?I:d(I)}}`;return h},clearRegistry(){l.clear()}}}function ZO(t,n=0){let s=3735928559^n,a=1103547991^n;for(let l=0,d;l<t.length;l++)d=t.charCodeAt(l),s=Math.imul(s^d,2654435761),a=Math.imul(a^d,1597334677);return s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(a^a>>>13,3266489909),a=Math.imul(a^a>>>16,2246822507),a^=Math.imul(s^s>>>13,3266489909),(4294967296*(2097151&a)+(s>>>0)).toString(36).slice(0,6)}function td(t=!1,n=!1){let s={lineInfo:[]},a=[{line(l){return delete l.properties.class,l},pre(l){let d=kS(l),f=[];if(d!=null){let h=1;for(let g of d.children){if(g.type!=="element")continue;if(t)Tp(g);f.push($S(g,h,s)),h++}d.children=f}return l},...t?{tokens(l){for(let d of l){let f=0;for(let h of d){let g=h;g.__lineChar??=f,f+=h.content.length}}},preprocess(l,d){d.mergeWhitespaces="never"},span(l,d,f,h,g){if(g?.offset!=null&&g.content!=null){let I=g.__lineChar;if(I!=null)l.properties["data-char"]=I;return l}return l}}:null}];if(n)a.push(e$,NS);if(t)a.push({line:(l)=>{if(l.type==="element"&&l.children.length===0)l.children.push({type:"element",tagName:"br",properties:{},children:[]});return l}});return{state:s,transformers:a,toClass:NS}}var NS=FS({classPrefix:"hl-"}),e$={name:"token-style-normalizer",tokens(t){for(let n of t)for(let s of n){if(s.htmlStyle!=null)continue;let a={};if(s.color!=null)a.color=s.color;if(s.bgColor!=null)a["background-color"]=s.bgColor;if(s.fontStyle!=null&&s.fontStyle!==0){if((s.fontStyle&1)!==0)a["font-style"]="italic";if((s.fontStyle&2)!==0)a["font-weight"]="bold";if((s.fontStyle&4)!==0)a["text-decoration"]="underline"}if(Object.keys(a).length>0)s.htmlStyle=a}}};function nr(t){return`--${t==="token"?"diffs-token":"diffs"}-`}var t$=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,n$=/^0(?:\.0+)?%?$/;function r$(t){let n=t.indexOf("(");if(n<=0||!t.endsWith(")"))return;let s=t.slice(0,n).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(s))return;let a=t.slice(n+1,-1).trim();if(a.length===0)return;let l=a.lastIndexOf("/");if(l!==-1)return a.slice(l+1).trim();if(/^(?:rgba|hsla)$/i.test(s)){let d=a.split(",");if(d.length===4)return d[3]?.trim()}}function Sl(t){let n=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(t.trim());if(n==null)return null;let s=n[1],a,l=1;if(s.length===3)a=s.split("").map((d)=>d+d).join("");else if(s.length===6)a=s;else a=s.slice(0,6),l=parseInt(s.slice(6,8),16)/255;return[parseInt(a.slice(0,2),16),parseInt(a.slice(2,4),16),parseInt(a.slice(4,6),16),l]}function _r(t){if(t==null)return null;let n=Sl(t);if(n==null)return null;let s=n[0]/255,a=n[1]/255,l=n[2]/255,d=(f)=>f<=0.03928?f/12.92:((f+0.055)/1.055)**2.4;return 0.2126*d(s)+0.7152*d(a)+0.0722*d(l)}function nd(t,n){let[s,a]=t>n?[t,n]:[n,t];return(s+0.05)/(a+0.05)}function DS(t,n){if(n==null)return;let s=Sl(t),a=Sl(n);if(s==null||a==null)return;let[l,d,f,h]=s,[g,I,b]=a;return"#"+[Math.round(l*h+g*(1-h)),Math.round(d*h+I*(1-h)),Math.round(f*h+b*(1-h))].map((v)=>v.toString(16).padStart(2,"0")).join("")}function bl(t){if(t==null)return!1;let n=t.trim().toLowerCase();if(n==="transparent")return!0;if(t$.test(n))return!0;let s=r$(n);return s!=null&&n$.test(s)}function HS(t,n){let s=_r(t);if(s!=null)return s<0.4;let a=_r(n);return a!=null?a>0.6:!1}function US(t,n){if(t==null||n==null)return!1;if(t.trim().toLowerCase()===n.trim().toLowerCase())return!0;let s=_r(t),a=_r(n);if(s==null||a==null)return!1;return Math.abs(s-a)<0.06}function rd(t,n,s){if(n==null||s==null)return!1;let a=_r(t),l=_r(n),d=_r(s);if(a==null||l==null||d==null)return!1;return Math.abs(a-d)<Math.abs(a-l)}function BS(t,n){let s=_r(t),a=n.find((f)=>f!=null&&f!=="");if(s==null)return a;let l,d=-1;for(let f of n){if(f==null||f==="")continue;let h=_r(f);if(h==null)continue;let g=nd(s,h);if(g>=3)return f;if(g>d)l=f,d=g}return l??a}function GS(t,n){if(n==null)return t;let s=Sl(t),a=Sl(n),l=_r(n);if(s==null||a==null||l==null)return`color-mix(in srgb, ${t} 70%, ${n})`;let[d,f,h]=s,[g,I,b]=a;for(let v of[0.6,0.7,0.8,0.9]){let k="#"+[Math.round(d*v+g*(1-v)),Math.round(f*v+I*(1-v)),Math.round(h*v+b*(1-v))].map((P)=>P.toString(16).padStart(2,"0")).join(""),w=_r(k);if(w!=null&&nd(l,w)>=4.5)return k}return t}var zS=new WeakMap;function Cl(t){let n=zS.get(t);if(n!=null)return n;let s=t.colors??{},a={...s},l=s["editor.background"]??t.bg,d=s["editor.foreground"]??t.fg,f=s["sideBar.background"]??l,h=s["sideBar.foreground"]??d;ki(a,"editor.background",l),ki(a,"editor.foreground",d),ki(a,"sideBar.background",f),ki(a,"sideBar.foreground",h),ki(a,"input.background",s["input.background"]??f),ki(a,"sideBarSectionHeader.foreground",s["sideBarSectionHeader.foreground"]??h),ki(a,"list.activeSelectionForeground",s["list.activeSelectionForeground"]??h),ki(a,"gitDecoration.addedResourceForeground",wp(s["gitDecoration.addedResourceForeground"],s["terminal.ansiGreen"],s["editorGutter.addedBackground"])),ki(a,"gitDecoration.modifiedResourceForeground",wp(s["gitDecoration.modifiedResourceForeground"],s["terminal.ansiBlue"],s["editorGutter.modifiedBackground"])),ki(a,"gitDecoration.deletedResourceForeground",wp(s["gitDecoration.deletedResourceForeground"],s["terminal.ansiRed"],s["editorGutter.deletedBackground"]));let g=(bl(s["list.focusOutline"])?void 0:s["list.focusOutline"])??(bl(s.focusBorder)?void 0:s.focusBorder);if(g!=null)a["list.focusOutline"]=g;else delete a["list.focusOutline"];let I=s["list.hoverBackground"];if(I!=null&&(i$(I,f)||rd(I,f,h)))delete a["list.hoverBackground"];let b=Object.freeze({...t,colors:Object.freeze(a)});return zS.set(t,b),b}function ki(t,n,s){if(s!=null&&s!=="")t[n]=s}function wp(...t){for(let n of t)if(n!=null&&n!=="")return n}function i$(t,n){return n!=null&&t.toLowerCase()===n.toLowerCase()}var
|
|
172
|
+
`,f);if(n.push(f),++d===4){if(f-l<=40){for(let h=f;h<t.length;h++){let g=t.charCodeAt(h);if(g===10||g===13){if(g===13&&h+1<t.length&&t.charCodeAt(h+1)===10)h++;n.push(h+1)}}return n}l=f,d=0}}return n}function Ot(t){let n=0;for(let s=0;s<t.length;s++){let a=t.charCodeAt(s);if(a===10||a===13){if(a===13&&s+1<t.length&&t.charCodeAt(s+1)===10)s++;n++}}return n}function us(t){let n=me(t);return Array.from({length:n.length},(s,a)=>{let l=n[a],d=n[a+1]??t.length;return t.slice(l,d)})}function Il(t){return ke({tagName:"div",children:[ke({tagName:"div",children:t.annotations?.map((n)=>ke({tagName:"slot",properties:{name:n}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${t.hunkIndex},${t.lineIndex}`}})}function Xc(t,n){return ke({tagName:"div",children:t,properties:{"data-content":"",style:`grid-row: span ${n}`}})}function OS(t){switch(t){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function Yc({fileOrDiff:t,mode:n,stickyHeader:s}){let a="type"in t?t:void 0,l={"data-diffs-header":n,"data-change-type":a?.type,"data-sticky":s?"":void 0};return ke({tagName:"div",children:[n==="custom"?ke({tagName:"slot",properties:{name:Qs}}):WO({name:t.name,prevName:"prevName"in t?t.prevName:void 0,iconType:a?.type??"file"}),...n==="custom"?[]:[XO(a)]],properties:l})}function WO({name:t,prevName:n,iconType:s}){let a=[ke({tagName:"slot",properties:{name:Xs}}),as({name:OS(s),properties:{"data-change-icon":s}})];if(n!=null)a.push(ke({tagName:"div",children:[ke({tagName:"bdi",children:[xr(n)]})],properties:{"data-prev-name":""}})),a.push(as({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}));return a.push(ke({tagName:"div",children:[ke({tagName:"bdi",children:[xr(t)]})],properties:{"data-title":""}})),a.push(ke({tagName:"slot",properties:{name:Ys}})),ke({tagName:"div",children:a,properties:{"data-header-content":""}})}function XO(t){let n=[];if(t!=null){let s=0,a=0;for(let l of t.hunks)s+=l.additionLines,a+=l.deletionLines;if(a>0||s===0)n.push(ke({tagName:"span",children:[xr(`-${a}`)],properties:{"data-deletions-count":""}}));if(s>0||a===0)n.push(ke({tagName:"span",children:[xr(`+${s}`)],properties:{"data-additions-count":""}}))}return n.push(ke({tagName:"slot",properties:{name:Js}})),ke({tagName:"div",children:n,properties:{"data-metadata":""}})}function Jc(t){return ke({tagName:"pre",properties:YO(t)})}function YO({diffIndicators:t,disableBackground:n,disableLineNumbers:s,overflow:a,split:l,totalLines:d,type:f,customProperties:h}){return{...h,"data-diff":f==="diff"?"":void 0,"data-file":f==="file"?"":void 0,"data-diff-type":f==="diff"?l?"split":"single":void 0,"data-overflow":a,"data-disable-line-numbers":s?"":void 0,"data-background":!n?"":void 0,"data-indicators":t==="bars"||t==="classic"?t:void 0,style:`--diffs-min-number-column-width-default:${`${d}`.length}ch;`}}function Qc(t,{theme:n,preferredHighlighter:s="shiki-js"}){return{langs:Array.isArray(t)?t:[t??"text"],themes:C(n),preferredHighlighter:s}}function cs(t){return t.startingLine===0&&t.totalLines===1/0&&t.bufferBefore===0&&t.bufferAfter===0}function ds(t,n){for(let s of n)t.push(s)}function $S(t,n,s){let a=typeof s.lineInfo==="function"?s.lineInfo(n):s.lineInfo[n-1];if(a==null){let l=`processLine: line ${n}, contains no state.lineInfo`;throw console.error(l,{node:t,line:n,state:s}),Error(l)}if(t.tagName="div",t.properties["data-line"]=a.lineNumber,t.properties["data-alt-line"]=a.altLineNumber,t.properties["data-line-type"]=a.type,t.properties["data-line-index"]=a.lineIndex,t.children.length===0)t.children.push(xr(`
|
|
173
|
+
`));return t}var Zc=Symbol("no-token"),kp=Symbol("multiple-tokens");function Tp(t){let n=JO(t);if(n!=null)return n;let s=Zc,a=[],l=[],d,f=()=>{if(l.length===0||d==null){l=[],d=void 0;return}if(l.length===1){let g=l[0];if(g?.type==="element"){QO(g,d);for(let I of g.children)ed(I)}else ed(g);a.push(g),l=[],d=void 0;return}for(let g of l)ed(g);a.push(ke({tagName:"span",properties:{"data-char":d},children:l})),l=[],d=void 0},h=(g)=>{if(g===Zc)return;if(g===kp){s=kp;return}if(s===Zc){s=g;return}if(s!==g)s=kp};for(let g of t.children){let I=g.type==="element"?Tp(g):Zc;if(h(I),typeof I!=="number"){f(),a.push(g);continue}if(d!=null&&d!==I)f();d??=I,l.push(g)}return f(),t.children=a,s}function JO(t){let n=t.properties["data-char"];if(typeof n==="number")return n}function ed(t){if(t.type!=="element")return;t.properties["data-char"]=void 0;for(let n of t.children)ed(n)}function QO(t,n){t.properties["data-char"]=n}var L3=Symbol("highlighted-lines");function FS(t={}){let{classPrefix:n="__shiki_",classSuffix:s="",classReplacer:a=(h)=>h}=t,l=new Map;function d(h){return Object.entries(h).map(([g,I])=>`${g}:${I}`).join(";")}function f(h){let g=typeof h==="string"?h:d(h),I=n+ZO(g)+s;if(I=a(I),!l.has(I))l.set(I,typeof h==="string"?h:{...h});return I}return{name:"@shikijs/transformers:style-to-class",pre(h){if(!h.properties.style)return;let g=f(h.properties.style);delete h.properties.style,this.addClassToHast(h,g)},tokens(h){for(let g of h)for(let I of g){if(!I.htmlStyle)continue;let b=f(I.htmlStyle);if(I.htmlStyle={},I.htmlAttrs||={},!I.htmlAttrs.class)I.htmlAttrs.class=b;else I.htmlAttrs.class+=` ${b}`}},getClassRegistry(){return l},getCSS(){let h="";for(let[g,I]of l.entries())h+=`.${g}{${typeof I==="string"?I:d(I)}}`;return h},clearRegistry(){l.clear()}}}function ZO(t,n=0){let s=3735928559^n,a=1103547991^n;for(let l=0,d;l<t.length;l++)d=t.charCodeAt(l),s=Math.imul(s^d,2654435761),a=Math.imul(a^d,1597334677);return s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(a^a>>>13,3266489909),a=Math.imul(a^a>>>16,2246822507),a^=Math.imul(s^s>>>13,3266489909),(4294967296*(2097151&a)+(s>>>0)).toString(36).slice(0,6)}function td(t=!1,n=!1){let s={lineInfo:[]},a=[{line(l){return delete l.properties.class,l},pre(l){let d=kS(l),f=[];if(d!=null){let h=1;for(let g of d.children){if(g.type!=="element")continue;if(t)Tp(g);f.push($S(g,h,s)),h++}d.children=f}return l},...t?{tokens(l){for(let d of l){let f=0;for(let h of d){let g=h;g.__lineChar??=f,f+=h.content.length}}},preprocess(l,d){d.mergeWhitespaces="never"},span(l,d,f,h,g){if(g?.offset!=null&&g.content!=null){let I=g.__lineChar;if(I!=null)l.properties["data-char"]=I;return l}return l}}:null}];if(n)a.push(e$,NS);if(t)a.push({line:(l)=>{if(l.type==="element"&&l.children.length===0)l.children.push({type:"element",tagName:"br",properties:{},children:[]});return l}});return{state:s,transformers:a,toClass:NS}}var NS=FS({classPrefix:"hl-"}),e$={name:"token-style-normalizer",tokens(t){for(let n of t)for(let s of n){if(s.htmlStyle!=null)continue;let a={};if(s.color!=null)a.color=s.color;if(s.bgColor!=null)a["background-color"]=s.bgColor;if(s.fontStyle!=null&&s.fontStyle!==0){if((s.fontStyle&1)!==0)a["font-style"]="italic";if((s.fontStyle&2)!==0)a["font-weight"]="bold";if((s.fontStyle&4)!==0)a["text-decoration"]="underline"}if(Object.keys(a).length>0)s.htmlStyle=a}}};function nr(t){return`--${t==="token"?"diffs-token":"diffs"}-`}var t$=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,n$=/^0(?:\.0+)?%?$/;function r$(t){let n=t.indexOf("(");if(n<=0||!t.endsWith(")"))return;let s=t.slice(0,n).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(s))return;let a=t.slice(n+1,-1).trim();if(a.length===0)return;let l=a.lastIndexOf("/");if(l!==-1)return a.slice(l+1).trim();if(/^(?:rgba|hsla)$/i.test(s)){let d=a.split(",");if(d.length===4)return d[3]?.trim()}}function Sl(t){let n=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(t.trim());if(n==null)return null;let s=n[1],a,l=1;if(s.length===3)a=s.split("").map((d)=>d+d).join("");else if(s.length===6)a=s;else a=s.slice(0,6),l=parseInt(s.slice(6,8),16)/255;return[parseInt(a.slice(0,2),16),parseInt(a.slice(2,4),16),parseInt(a.slice(4,6),16),l]}function _r(t){if(t==null)return null;let n=Sl(t);if(n==null)return null;let s=n[0]/255,a=n[1]/255,l=n[2]/255,d=(f)=>f<=0.03928?f/12.92:((f+0.055)/1.055)**2.4;return 0.2126*d(s)+0.7152*d(a)+0.0722*d(l)}function nd(t,n){let[s,a]=t>n?[t,n]:[n,t];return(s+0.05)/(a+0.05)}function DS(t,n){if(n==null)return;let s=Sl(t),a=Sl(n);if(s==null||a==null)return;let[l,d,f,h]=s,[g,I,b]=a;return"#"+[Math.round(l*h+g*(1-h)),Math.round(d*h+I*(1-h)),Math.round(f*h+b*(1-h))].map((v)=>v.toString(16).padStart(2,"0")).join("")}function bl(t){if(t==null)return!1;let n=t.trim().toLowerCase();if(n==="transparent")return!0;if(t$.test(n))return!0;let s=r$(n);return s!=null&&n$.test(s)}function HS(t,n){let s=_r(t);if(s!=null)return s<0.4;let a=_r(n);return a!=null?a>0.6:!1}function US(t,n){if(t==null||n==null)return!1;if(t.trim().toLowerCase()===n.trim().toLowerCase())return!0;let s=_r(t),a=_r(n);if(s==null||a==null)return!1;return Math.abs(s-a)<0.06}function rd(t,n,s){if(n==null||s==null)return!1;let a=_r(t),l=_r(n),d=_r(s);if(a==null||l==null||d==null)return!1;return Math.abs(a-d)<Math.abs(a-l)}function BS(t,n){let s=_r(t),a=n.find((f)=>f!=null&&f!=="");if(s==null)return a;let l,d=-1;for(let f of n){if(f==null||f==="")continue;let h=_r(f);if(h==null)continue;let g=nd(s,h);if(g>=3)return f;if(g>d)l=f,d=g}return l??a}function GS(t,n){if(n==null)return t;let s=Sl(t),a=Sl(n),l=_r(n);if(s==null||a==null||l==null)return`color-mix(in srgb, ${t} 70%, ${n})`;let[d,f,h]=s,[g,I,b]=a;for(let v of[0.6,0.7,0.8,0.9]){let k="#"+[Math.round(d*v+g*(1-v)),Math.round(f*v+I*(1-v)),Math.round(h*v+b*(1-v))].map((P)=>P.toString(16).padStart(2,"0")).join(""),w=_r(k);if(w!=null&&nd(l,w)>=4.5)return k}return t}var zS=new WeakMap;function Cl(t){let n=zS.get(t);if(n!=null)return n;let s=t.colors??{},a={...s},l=s["editor.background"]??t.bg,d=s["editor.foreground"]??t.fg,f=s["sideBar.background"]??l,h=s["sideBar.foreground"]??d;ki(a,"editor.background",l),ki(a,"editor.foreground",d),ki(a,"sideBar.background",f),ki(a,"sideBar.foreground",h),ki(a,"input.background",s["input.background"]??f),ki(a,"sideBarSectionHeader.foreground",s["sideBarSectionHeader.foreground"]??h),ki(a,"list.activeSelectionForeground",s["list.activeSelectionForeground"]??h),ki(a,"gitDecoration.addedResourceForeground",wp(s["gitDecoration.addedResourceForeground"],s["terminal.ansiGreen"],s["editorGutter.addedBackground"])),ki(a,"gitDecoration.modifiedResourceForeground",wp(s["gitDecoration.modifiedResourceForeground"],s["terminal.ansiBlue"],s["editorGutter.modifiedBackground"])),ki(a,"gitDecoration.deletedResourceForeground",wp(s["gitDecoration.deletedResourceForeground"],s["terminal.ansiRed"],s["editorGutter.deletedBackground"]));let g=(bl(s["list.focusOutline"])?void 0:s["list.focusOutline"])??(bl(s.focusBorder)?void 0:s.focusBorder);if(g!=null)a["list.focusOutline"]=g;else delete a["list.focusOutline"];let I=s["list.hoverBackground"];if(I!=null&&(i$(I,f)||rd(I,f,h)))delete a["list.hoverBackground"];let b=Object.freeze({...t,colors:Object.freeze(a)});return zS.set(t,b),b}function ki(t,n,s){if(s!=null&&s!=="")t[n]=s}function wp(...t){for(let n of t)if(n!=null&&n!=="")return n}function i$(t,n){return n!=null&&t.toLowerCase()===n.toLowerCase()}var Mt={compositeOverBg:DS,contrastRatio:nd,deriveMutedFg:GS,hoverWouldEraseText:rd,isDarkSurface:HS,isFullyTransparent:bl,pickReadableForeground:BS,relativeLuminance:_r,surfacesMatch:US};function id({theme:t=u,highlighter:n,prefix:s}){let a="";if(typeof t==="string"){let l=n.getTheme(t),d=Cl(l);a+=`color:${d.fg};`,a+=`background-color:${d.bg};`,a+=`${nr("global")}fg:${d.fg};`,a+=`${nr("global")}bg:${d.bg};`,a+=Rp(l,s)}else{let l=n.getTheme(t.dark),d=Cl(l);a+=`${nr("global")}dark:${d.fg};`,a+=`${nr("global")}dark-bg:${d.bg};`,a+=Rp(l,"dark"),l=n.getTheme(t.light),d=Cl(l),a+=`${nr("global")}light:${d.fg};`,a+=`${nr("global")}light-bg:${d.bg};`,a+=Rp(l,"light")}return a}function Rp(t,n){n=n!=null?`${n}-`:"";let s="",a=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];if(a!=null)s+=`${nr("global")}${n}addition-color:${a};`;let l=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];if(l!=null)s+=`${nr("global")}${n}deletion-color:${l};`;let d=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];if(d!=null)s+=`${nr("global")}${n}modified-color:${d};`;return s}function El(t){let n=t.children[0];while(n!=null){if(n.type==="element"&&n.tagName==="code")return n.children;if("children"in n)n=n.children[0];else n=null}throw console.error(t),Error("getLineNodes: Unable to find children")}var o$={forcePlainText:!1};function He(t,n,{theme:s,tokenizeMaxLineLength:a,useTokenTransformer:l},{forcePlainText:d,startingLine:f,totalLines:h,lines:g}=o$){if(d)f??=0,h??=1/0;else f=0,h=1/0;let I=f>0||h<1/0,{state:b,transformers:v}=td(l),k=d?"text":t.lang??p(t.name),w=typeof s==="string"?n.getTheme(s).type:void 0,P=id({theme:s,highlighter:n});b.lineInfo=(O)=>({type:"context",lineIndex:O-1+f,lineNumber:O+f});let M=(()=>{if(typeof s==="string")return{lang:k,theme:s,transformers:v,defaultColor:!1,cssVariablePrefix:nr("token"),tokenizeMaxLineLength:a,tokenizeTimeLimit:0};return{lang:k,themes:s,transformers:v,defaultColor:!1,cssVariablePrefix:nr("token"),tokenizeMaxLineLength:a,tokenizeTimeLimit:0}})(),N=El(n.codeToHast(s$(I?a$(g??us(t.contents),f,h):t.contents),M)),_=I?Array(f):N;if(I)ds(_,N);return{code:_,themeStyles:P,baseThemeType:w}}function s$(t){return t.replace(/\r(?!\n)/g,`
|
|
174
174
|
`)}function a$(t,n,s){if(t.length===0)return"";let a=Math.min(n+s,t.length);return t.slice(n,a).join("")}function od(t,n){return n.cacheKey==null?t.file===n&&t.sourceContents===n.contents:t.cacheKey===n.cacheKey}var l$=-1,jS=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++l$}`;highlighter;file;renderCache;pendingHighlightResult;computedLang="text";lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;get fileCache(){return this.renderCache?.file}constructor(t={theme:u},n=S,s,a){if(this.options=t,this.annotationSlotName=n,this.onRenderUpdate=s,this.workerManager=a,a?.isWorkingPool()!==!0)this.highlighter=ur(t.theme??u)?T():void 0}setOptions(t){this.options=t}mergeOptions(t){this.options={...this.options,...t}}setLineAnnotations(t){this.lineAnnotations={};for(let n of t){let s=this.lineAnnotations[n.lineNumber]??[];this.lineAnnotations[n.lineNumber]=s,s.push(n)}}cleanUp(){this.endEditSession(),this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(t,n){let{editSessionActive:s,renderCache:a}=this;if(this.editSessionActive=!0,!s)this.pendingHighlightResult=void 0;if(this.file=t,a==null)return;if(s&&a.file===t)return;if(s){this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;return}let{options:l}=this.getRenderOptions(t),d=a.file===t,f=n!=null&&an(a.file,n),{result:h}=a;if(!a.highlighted||h==null||!L(a.options,l)||!d&&!f){this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;return}if(d)return;this.renderCache={...a,file:t,result:{...h,code:[...h.code]}};let{lineCache:g}=this;if(g!=null&&n!=null&&od(g,n))this.lineCache={cacheKey:void 0,file:t,sourceContents:t.contents,lines:g.lines};else this.lineCache=void 0}endEditSession(t){if(this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.file==null){this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;return}let{renderCache:n}=this;if(t==null||n==null||n.file===t||!an(n.file,t))return;n.file=t}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){if(this.editSessionActive){if(this.renderCache!=null)this.renderCache.renderRange=void 0;this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}else this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.file=void 0}clearRenderCache(){this.pendingStructuralRows=void 0,this.renderCache=void 0,this.pendingHighlightResult=void 0}hydrate(t){this.file=t;let{options:n}=this.getRenderOptions(t),s=sd(this.getOrCreateLineCache(t).length,this.getTokenizeMaxLength()),a=this.workerManager?.getFileResultCache(t);if(a!=null&&!L(n,a.options))a=void 0;if(this.renderCache??={file:t,hydrated:!0,options:n,highlighted:!s&&!V(t),result:s?void 0:a?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){if(this.renderCache.result==null&&!s)this.workerManager.highlightFileAST(this,t)}else if(this.highlighter==null)this.computedLang=t.lang??p(t.name),this.initializeHighlighter()}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??u}getEffectiveCodeOptions(){let t=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:t?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(t){let n=(()=>{if(this.workerManager?.isWorkingPool()===!0){let l=this.workerManager.getFileRenderOptions();if(this.editSessionActive&&l.useTokenTransformer!==!0)return{...l,useTokenTransformer:!0};return l}let{tokenizeMaxLineLength:a=1000}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:a}})(),{renderCache:s}=this;if(s?.result==null)return{options:n,forceHighlight:!0};if(!an(t,s.file)||!L(n,s.options))return{options:n,forceHighlight:!0};return{options:n,forceHighlight:!1}}getFileForNextRender(t){let{options:n}=this.getRenderOptions(t);if(this.getReadyRenderResult(t,n)!=null)return t;let{renderCache:s}=this;if(s==null)return t;if(an(s.file,t))return s.file;let a=us(t.contents),l=t.contents.length===0||V(t)||sd(a.length,this.getTokenizeMaxLength());return this.canRenderFile(t,n,l)?t:s.file}canRenderFile(t,n,s){let{renderCache:a}=this;if(a==null||an(a.file,t))return!0;if(s)return a.result==null&&a.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&ur(n.theme);if(a.result==null&&a.hydrated!==!0)return!0;if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)return!a.highlighted;return this.highlighter!=null&&ur(n.theme)}getOrCreateLineCache(t){let{lineCache:n}=this;if(n==null||!od(n,t))n={cacheKey:t.cacheKey,file:t,sourceContents:t.contents,lines:us(t.contents)};return this.lineCache=n,n.lines}getLineCount(t){let n=this.getOrCreateLineCache(t);return this.textDocumentCache.get(t)?.lineCount??n.length}updateRenderCache(t,n,s=!1){this.pendingStructuralRows=void 0;let{renderCache:a}=this;if(a==null)return;let{file:l,result:d}=a;if(d==null)return;let f=s?new Map:void 0;this.pendingStructuralRows=f;let h=this.lineCache!=null&&od(this.lineCache,l)?this.lineCache:void 0;for(let[g,I]of t){if(f==null&&h!=null&&g<h.lines.length){let v=I.map((k)=>k[2]).join("");h.lines[g]=Wc(h.lines[g]??"",v)}let b={type:"element",tagName:"div",properties:{"data-line":g+1,"data-line-type":"context","data-line-index":g},children:I.map(([v,k,w])=>{if(v===0&&k===""){if(w==="")return{type:"element",tagName:"br",properties:{},children:[]};return{type:"text",value:w}}return{type:"element",tagName:"span",properties:{"data-char":v,style:`color:${k};`},children:[{type:"text",value:w}]}})};if(f!=null)f.set(g,b);else d.code[g]=b}if(d.baseThemeType=n,a.isDirty=!0,f==null&&h!=null)l.contents=h.lines.join(""),h.sourceContents=l.contents}applyDocumentChange(t){let{pendingStructuralRows:n,renderCache:s}=this;this.pendingStructuralRows=void 0;let a=this.file??s?.file;if(a==null)return;let l=s?.result,d=this.lineCache!=null&&od(this.lineCache,a)?this.lineCache.lines:us(a.contents),f=us(t.getText());if(l!=null&&d.length!==f.length){let g=Math.min(d.length,f.length),I=0;while(I<g&&d[I]===f[I])I++;let b=0;while(b<g-I&&d[d.length-1-b]===f[f.length-1-b])b++;let v=l.code;l.code=Array(f.length);for(let k=0;k<I;k++)l.code[k]=v[k];for(let k=0;k<b;k++)l.code[f.length-1-k]=v[d.length-1-k];if(n!==void 0){for(let[k,w]of n)if(k<f.length)l.code[k]=w}for(let k=I;k<f.length-b;k++)l.code[k]??={type:"element",tagName:"div",properties:{"data-line":k+1,"data-line-type":"context","data-line-index":k},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:t.getLineText(k)}]}]};for(let k=0;k<l.code.length;k++){let w=l.code[k];if(w?.type==="element")w.properties["data-line"]=k+1,w.properties["data-line-index"]=k}if(s!=null)s.isDirty=!0}let h=t.getText();this.lineCache={cacheKey:a.cacheKey,file:a,sourceContents:h,lines:f},this.textDocumentCache.set(a,t),a.contents=h}renderFile(t=this.file,n=ea){if(this.file=t,t==null){this.pendingHighlightResult=void 0;return}let{options:s,forceHighlight:a}=this.getRenderOptions(t),l=this.getReadyRenderResult(t,s);if(this.pendingHighlightResult=void 0,l!=null)this.renderCache={...l,file:t,renderRange:void 0},a=!1;this.renderCache??={file:t,highlighted:!1,options:s,result:void 0,renderRange:void 0};let d=this.getOrCreateLineCache(t),f=t.contents.length>0,h=!f||V(t)||sd(d.length,this.getTokenizeMaxLength()),g=this.canRenderFile(t,s,h),I=!an(t,this.renderCache.file),b=!ko(this.renderCache.renderRange,n);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let v=this.renderCache.result==null&&this.renderCache.highlighted&&!h&&!I&&cs(n);if(g&&!v&&(h||this.renderCache.result==null||!this.renderCache.highlighted&&(I||b))){if(this.renderCache.file=t,this.renderCache.options=s,this.renderCache.highlighted=!1,this.renderCache.result==null||I||b||a)this.renderCache.result=this.workerManager.getPlainFileAST(t,n.startingLine,n.totalLines,d);this.renderCache.renderRange=n}if(!h&&f&&(!this.renderCache.highlighted||a))this.workerManager.highlightFileAST(this,t)}else{this.computedLang=t.lang??p(t.name),this.highlighter??=T();let v=this.highlighter!=null&&ur(s.theme),k=this.highlighter!=null&&U(this.computedLang),w=!h&&k;if(g&&this.highlighter!=null&&v&&(a||h||!this.renderCache.highlighted&&w||this.renderCache.result==null)){let{result:P,options:M}=this.renderFileWithHighlighter(t,this.highlighter,h||!k);this.renderCache={file:t,options:M,highlighted:w,result:P,renderRange:void 0}}if(!v||!h&&!k)this.asyncHighlight(t).then(({result:P,options:M})=>{this.applyHighlightResult(t,P,M,!h)})}return this.renderCache.result!=null?this.processFileResult(this.renderCache.file,n,this.renderCache.result):void 0}async asyncRender(t,n=ea){this.file=t;let{result:s}=await this.asyncHighlight(t);return this.processFileResult(t,n,s)}async asyncHighlight(t){let n=sd(this.getOrCreateLineCache(t).length,this.getTokenizeMaxLength());this.computedLang=n?"text":t.lang??p(t.name);let s=this.highlighter!=null&&ze(C(this.getLocalHighlightTheme())),a=n||this.highlighter!=null&&U(this.computedLang);if(this.highlighter==null||!s||!a)this.highlighter=await this.initializeHighlighter();return this.renderFileWithHighlighter(t,this.highlighter,n)}renderFileWithHighlighter(t,n,s=!1){let{options:a}=this.getRenderOptions(t);return{result:He(t,n,a,{forcePlainText:s}),options:a}}processFileResult(t,n,{code:s,themeStyles:a,baseThemeType:l}){let d=this.getLineCount(t),{disableFileHeader:f=!1}=this.options,h=[],g=vo(),I=Math.min(n.startingLine+n.totalLines,d),b=0,v=Eo(n)?hl(this.lineAnnotations):void 0;if(v!=null)g.children.push(cr("context","annotation",1)),h.push(Il({type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:v.map((k)=>this.annotationSlotName(k))})),b++;for(let k=n.startingLine;k<I;k++){let w=k+1,P=s[k];if(P==null)throw console.error("FileRenderer.processFileResult: Line doesnt exist",{name:t.name,lineIndex:k,lineNumber:w}),Error("FileRenderer.processFileResult: Line doesnt exist");g.children.push(jc("context",w,`${k}`)),h.push(P),b++;let M=this.lineAnnotations[w];if(M!=null)g.children.push(cr("context","annotation",1)),h.push(Il({type:"annotation",hunkIndex:0,lineIndex:w,annotations:M.map((N)=>this.annotationSlotName(N))})),b++}return g.properties.style=`grid-row: span ${b}`,{file:t,gutterAST:g.children??[],contentAST:h,preAST:this.createPreElement(d),headerAST:!f?this.renderHeader(t):void 0,totalLines:d,rowCount:b,themeStyles:a,baseThemeType:l,bufferBefore:n.bufferBefore,bufferAfter:n.bufferAfter,css:""}}renderHeader(t){let{headerRenderMode:n="default",stickyHeader:s=!1}=this.options;return Yc({fileOrDiff:t,mode:n,stickyHeader:s})}renderFullHTML(t){return pn(this.renderFullAST(t))}renderFullAST(t,n=[]){return n.push(ke({tagName:"code",children:this.renderCodeAST(t),properties:{"data-code":""}})),{...t.preAST,children:n}}renderCodeAST(t){let n=vo();return n.children=t.gutterAST,n.properties.style=`grid-row: span ${t.rowCount}`,[n,Xc(t.contentAST,t.rowCount)]}renderPartialHTML(t,n=!1){if(!n)return pn(t);return pn(ke({tagName:"code",children:t,properties:{"data-code":""}}))}async initializeHighlighter(){return this.highlighter=await j(Qc(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(t,n,s,a=!0){if(this.editSessionActive)return;this.applyHighlightResult(t,n,s,a)}applyHighlightResult(t,n,s,a=!0){let{file:l,renderCache:d}=this;if(l==null||d==null||!an(t,l)||!L(s,this.getRenderOptions(l).options))return;if(!(d.result==null||!d.highlighted||!L(d.options,s)||!an(d.file,l)))return;this.pendingHighlightResult={file:l,options:s,highlighted:a,result:n},this.onRenderUpdate?.()}getMatchingWorkerResultCache(t,n){if(this.editSessionActive)return;let s=this.workerManager?.getFileResultCache(t);if(s==null||!L(n,s.options))return;return s}getReadyRenderResult(t,n){let{pendingHighlightResult:s}=this;if(s!=null&&an(s.file,t)&&L(s.options,n))return s;let a=this.getMatchingWorkerResultCache(t,n);if(a==null||this.hasHighlightedRenderCache(t,n))return;return{file:t,highlighted:!0,...a}}hasHighlightedRenderCache(t,n){let{renderCache:s}=this;return s?.result!=null&&s.highlighted&&an(t,s.file)&&L(n,s.options)}onHighlightError(t){console.error(t)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(t){let{disableLineNumbers:n=!1,overflow:s="scroll"}=this.options;return Jc({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:n,overflow:s,split:!1,totalLines:t})}};function sd(t,n){return t>n}var ad=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
175
175
|
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
176
176
|
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
@@ -290,7 +290,7 @@ ${n}`,a=t.startsWith(n)?0:cS(t,s,0);if(a===-1)return[t];let l=[];if(a>0)l.push(t
|
|
|
290
290
|
${l}
|
|
291
291
|
${t}
|
|
292
292
|
}
|
|
293
|
-
}`}function hd(t,n){let s=Lp(n);return t.replace(c$,s)}function d$(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var WS=new WeakMap;function ge(t){let n=WS.get(t);return n==null?t:n}function Ot(t,n){WS.set(t,n)}function ua(t,n,s){let a=new Map;for(let l of t){let d=ge(l);a.set(d,s?.slotNames.get(d)??n(l))}return{provided:t,current:t,slotNames:a}}function gd(t,n,s){for(let a of n){let l=ge(a);if(!t.slotNames.has(l))t.slotNames.set(l,s(a))}t.provided=n,t.current=n}function yd(t,n,s){if(t==null)return s(n);let a=ge(n),l=t.slotNames.get(a);if(l==null)l=s(n),t.slotNames.set(a,l);return l}function xd(t){return t?.useTokenTransformer===!0||t?.onTokenClick!=null||t?.onTokenEnter!=null||t?.onTokenLeave!=null}function Pp(t){return{theme:t?.theme,disableLineNumbers:t?.disableLineNumbers,overflow:t?.overflow,themeType:t?.themeType,collapsed:t?.collapsed,disableFileHeader:t?.disableFileHeader,disableVirtualizationBuffers:t?.disableVirtualizationBuffers,stickyHeader:t?.stickyHeader,preferredHighlighter:t?.preferredHighlighter,useCSSClasses:t?.useCSSClasses,useTokenTransformer:xd(t),tokenizeMaxLineLength:t?.tokenizeMaxLineLength,tokenizeMaxLength:t?.tokenizeMaxLength,unsafeCSS:t?.unsafeCSS,headerRenderMode:t?.renderCustomHeader!=null?"custom":"default"}}function ca({code:t,pre:n,columnType:s,rowSpan:a,containerSize:l=!1}={}){if(t==null){if(t=document.createElement("code"),t.setAttribute("data-code",""),s!=null)t.setAttribute(`data-${s}`,"");n?.appendChild(t)}if(a!=null)t.style.setProperty("grid-row",`span ${a}`);else t.style.removeProperty("grid-row");if(l)t.setAttribute("data-container-size","");else t.removeAttribute("data-container-size");return t}function vl(t,n){let s=t?.offsetHeight??0;if(t==null||s===0){n();return}t.style.minHeight=`${s}px`;try{n(),t.offsetHeight}finally{t.style.minHeight=""}}function Id({shadowRoot:t,currentNode:n,themeCSS:s}){if(s.trim()===""){n?.remove();return}if(n??=m$(),n.textContent=s,n.parentNode!==t)t.appendChild(n);return n}function m$(){let t=document.createElement("style");return t.setAttribute(VI,""),t}var f$=void 0;var p$=void 0;function fe(){return f$??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(h$())}function ie(){return p$??="safari"in window&&"pushNotification"in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function h$(){let t=globalThis.navigator;return t?.platform??t?.userAgentData?.platform??"unknown"}function Sd(t,n){if(n==null)return;let s=t.shadowRoot??t.attachShadow({mode:"open"});if(s.innerHTML==="")s.innerHTML=n}function bd(t,{type:n,diffIndicators:s,disableBackground:a,disableLineNumbers:l,overflow:d,split:f,totalLines:h,customProperties:g}){if(g!=null)for(let I in g){let b=g[I];if(b!=null)t.setAttribute(I,`${b}`)}if(n==="diff")t.setAttribute("data-diff",""),t.removeAttribute("data-file");else t.setAttribute("data-file",""),t.removeAttribute("data-diff");switch(s){case"bars":case"classic":t.setAttribute("data-indicators",s);break;case"none":t.removeAttribute("data-indicators")}if(l)t.setAttribute("data-disable-line-numbers","");else t.removeAttribute("data-disable-line-numbers");if(a)t.removeAttribute("data-background");else t.setAttribute("data-background","");if(n==="diff")t.setAttribute("data-diff-type",f?"split":"single");else t.removeAttribute("data-diff-type");return t.setAttribute("data-overflow",d),t.style.setProperty("--diffs-min-number-column-width-default",`${`${h}`.length}ch`),t}if(typeof HTMLElement<"u"&&customElements.get("diffs-container")==null){let t;class n extends HTMLElement{constructor(){super();if(this.shadowRoot!=null)return;let s=this.attachShadow({mode:"open"});if(t==null)t=new CSSStyleSheet,t.replaceSync(Ap);s.adoptedStyleSheets=[t]}connectedCallback(){let s=this.shadowRoot??this.attachShadow({mode:"open"});To(s)}}customElements.define(Dc,n)}var g$=[""];function y$(t){let n={...t};return delete n.cacheKey,n}var x$=-1,Ue=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++x$}`;type="file";fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(t={theme:u},n,s=!1){this.options=t,this.workerManager=n,this.isContainerManaged=s,this.fileRenderer=new jS(t,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new Vc,this.interactionManager=new Kc("file",la(t)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=(t)=>yd(this.editSession?.annotations,t,S);handleHighlightRender=()=>{this.rerender()};rerender(){if(!this.enabled||this.file==null)return;this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??u}getLatestFile(t=this.file){return this.editSession?.file??t}getRenderedFile(){return this.renderedFile}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(t){let n=this.editSession?.annotations;if(t===this.lineAnnotations)return!1;return n==null||t!==n.provided&&t!==n.current}updateExternalFile(t,n){if(an(this.file,t))return!1;let s=this.editSession!=null;if(this.file=t,s||this.editor!=null)this.installEditSession(t,s?void 0:this.editor?.__getDocumentContents(t),!0);else this.editSession=void 0;if(this.editSession?.annotations!=null&&n!=null)this.lineAnnotations=n,this.editSession.annotations=ua(n,S,this.editSession.annotations);return!0}installEditSession(t,n,s=!1){let a=n==null||n.name===t.name&&n.lang===t.lang&&n.contents===t.contents,l=y$(n??t);this.editSession={file:l,externalReplacement:s&&a,annotations:this.editSession?.annotations??ua(this.lineAnnotations,S)},this.fileRenderer.beginEditSession(l,a?t:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(t){if(t==null)return;this.options=t,this.cachedHeaderHTML=void 0,this.syncInteractionOptions()}syncInteractionOptions(){this.interactionManager.setOptions(la(this.options))}mergeOptions(t){this.options={...this.options,...t}}setThemeType(t){if((this.options.themeType??"system")===t)return;this.mergeOptions({themeType:t}),this.applyCachedThemeState(t)}applyCachedThemeState(t){if(typeof this.options.theme==="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let n=this.appliedThemeCSS.baseThemeType??t;if(this.appliedThemeCSS.themeType===n)return!1;return this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,t,this.appliedThemeCSS.baseThemeType),!0}hasThemeChanged(){return this.appliedThemeCSS!=null&&!E(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(t){let n=this.editSession?.annotations;if(n==null){this.lineAnnotations=t;return}if(!this.isNewAnnotations(t))return;this.lineAnnotations=t,gd(n,t,S)}syncEditSessionAnnotationsFromEditor(t){let n=this.editSession?.annotations;if(n==null||t===n.current)return!1;return n.current=t,this.fileRenderer.setLineAnnotations(t),this.renderAnnotations(),!0}setSelectedLines(t,n){this.interactionManager.setSelection(t,n)}setEditorActiveLine(t,n){this.interactionManager.setEditorActiveLine(t,{lineNumberOnly:n?.lineNumberOnly,side:n?.side??"additions"})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(t){if(this.code!=null)this.code.scrollLeft=t}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t==="wrap",columnVariables:this.shouldApplyColumnVariables(t)?"apply":"measure"}),this.managersDirty=!1}shouldApplyColumnVariables(t){return t==="scroll"&&this.getLatestAnnotations().length>0}cleanUp(t=!1){let n=this.editor;if(this.emitPostRender(!0),n?.cleanUp(t?"recycle":"discard"),!t)this.editor=void 0;if(this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,!this.isContainerManaged)this.fileContainer?.remove();if(this.fileContainer=void 0,this.mounted=!1,!t)this.lineAnnotations=[];if(this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,!t)this.cachedHeaderHTML=void 0;if(this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,t)this.fileRenderer.recycle();else this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0;this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(t){let{fileContainer:n,prerenderedHTML:s,preventEmit:a=!1,file:l,lineAnnotations:d}=t;if(!this.enabled)throw Error("File.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw Error("File.hydrate: hydrate can only be called before the instance has rendered or hydrated");this.hydrateElements(n,s);let f=this.editor!=null;if(f||I$(this.pre,l,this.options.collapsed)||S$(this.headerElement,l,this.options.disableFileHeader))this.render({...t,forceRender:f||t.forceRender,preventEmit:!0});else this.hydrationSetup({file:l,lineAnnotations:d});if(!a)this.emitPostRender()}hydrateElements(t,n){if(this.fileContainer!==t)this.emitPostRender(!0);Sd(t,n);for(let s of Array.from(t.shadowRoot?.children??[])){if(s instanceof SVGElement){this.spriteSVG=s;continue}if(!(s instanceof HTMLElement))continue;if(s instanceof HTMLPreElement){this.pre=s,this.appliedPreAttributes=void 0;continue}if(s instanceof HTMLStyleElement&&s.hasAttribute("data-theme-css")){this.themeCSSStyle=s;continue}if(s instanceof HTMLStyleElement&&s.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=s,this.appliedUnsafeCSS=s.textContent;continue}if("diffsHeader"in s.dataset){this.headerElement=s,this.lastRenderedHeaderHTML=void 0;continue}}if(this.pre!=null)this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute("data-dehydrated");this.fileContainer=t,this.hydrateMeasuredScrollbar()}hydrationSetup({file:t,lineAnnotations:n}){if(this.lineAnnotations=n??this.lineAnnotations,this.file=t,this.fileRenderer.setOptions(Pp(this.options)),this.syncInteractionOptions(),this.pre==null)return;this.fileRenderer.hydrate(t),this.renderedFile=t,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers()}getOrCreateLineCache(t=this.getLatestFile()){return t!=null?this.fileRenderer.getOrCreateLineCache(t):g$}updateBuffers(t){if(this.pre!=null)this.applyBuffers(this.pre,t)}syncRenderViewToEditor(){let{editor:t,fileContainer:n,renderRange:s}=this,a=this.getLatestAnnotations(),l=this.getLatestFile();if(t==null||n==null||l==null)return;let d=(I)=>{if(!this.enabled||this.editor!==t||this.fileContainer!==n||this.getLatestFile()!==l)return;t.__syncRenderView({highlighter:I,fileContainer:n,file:l,lineAnnotations:a,renderRange:s,externalDocument:this.editSession?.externalReplacement===!0})},f=this.getTheme(),h=l.lang??p(l.name),g=T({theme:f,lang:h});if(g!=null)d(g);else j({themes:C(f),langs:Array.from(new Set(["text",h])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(d)}__acknowledgeDocumentUpdate(){if(this.editSession!=null)this.editSession.externalReplacement=!1}__acceptEditorChange(t){let{lineAnnotations:n}=t;if(n!=null)this.syncEditSessionAnnotationsFromEditor(n)}emitEditChange(t){let{onEditChange:n}=this.options;n?.(t)}__captureDocumentSessionState(){}__attachEditor(t){if(this.editor!=null)throw Error("File.__attachEditor: an editor is already attached");this.editor=t;let n=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(t),n}catch(s){throw n(),s}}__resumeEditor(t){if(this.editor!==t)throw Error("File.__resumeEditor: editor association changed");this.resumeEditorRendering(t)}resumeEditorRendering(t){if(this.editSession!=null)this.fileRenderer.beginEditSession(this.editSession.file);else if(this.file!=null)this.installEditSession(this.file,t.__getDocumentContents(this.file));let n=this.editSession?.file;if(this.fileRenderer.editorRenderReady()){if(this.fileRenderer.fileCache===n)this.renderedFile=n;this.syncRenderViewToEditor()}else this.rerender()}__completeEditSession(t,n){this.settleEditSession(n==="install",t)}settleEditSession(t,n){let{editSession:s,file:a,lineAnnotations:l}=this;if(s==null||a==null)return;let{file:d,annotations:f}=s;if(this.editor!=null)throw Error("File.__completeEditSession: detach the editor before completing the session");let h=f?.current,g,I=!1,b;if(n==null)throw Error("File.__completeEditSession: editor is required for completion");let v={...d},k={file:v,editor:n,originalFile:a,lineAnnotations:h,originalLineAnnotations:l};Object.freeze(k);try{if(n.__emitEditComplete(k),this.options.onEditComplete?.(k)==="accept"){if(v.cacheKey!=null&&v.cacheKey===a.cacheKey)throw Error("File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey");g=v}}catch(M){I=!0,b=M}if(t&&g!=null){if(this.file=g,h!=null)this.lineAnnotations=h}this.editSession=void 0;let{renderedFile:w,file:P}=this;if(this.fileRenderer.endEditSession(P),w!=null&&P!=null&&w!==P&&an(w,P))this.renderedFile=P;if(t&&this.fileContainer!=null)this.rerender();if(I)throw b}applyDocumentChange(t,n){let s=this.editSession?.file;if(s==null)throw Error("File.applyDocumentChange: requires an active edit session");if(this.fileRenderer.beginEditSession(s),this.fileRenderer.applyDocumentChange(t),n!=null)this.syncEditSessionAnnotationsFromEditor(n)}applySuspendedDocumentChange(t,n){if(this.editSession==null)return;this.applyDocumentChange(t,n),this.fileRenderer.clearRenderCache()}updateRenderCache(t,n,s){let a=this.editSession?.file;if(a==null)throw Error("File.updateRenderCache: requires an active edit session");this.fileRenderer.beginEditSession(a),this.fileRenderer.updateRenderCache(t,n,s?.lineCountChangeInFlight)}render({file:t,fileContainer:n,forceRender:s=!1,preventEmit:a=!1,containerWrapper:l,deferManagers:d=!1,lineAnnotations:f,renderRange:h}){if(!this.enabled)throw Error("File.render: attempting to call render after cleaned up");this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:g=!1,themeType:I="system"}=this.options,b=g?void 0:h,v=this.renderRange,k=this.hasThemeChanged(),w=f!=null&&(f.length>0||this.getLatestAnnotations().length>0)?this.isNewAnnotations(f):!1,P=!an(this.file,t);if(P)this.updateExternalFile(t,f);let M=this.getLatestFile(t)??t;if(!g&&!s&&ko(b,this.renderRange)&&!P&&!w&&!k){let O=this.applyCachedThemeState(I);if(O)this.finalizeRender();return O}if(this.renderRange=b,P)this.cachedHeaderHTML=void 0;if(this.fileRenderer.setOptions(Pp(this.options)),this.syncInteractionOptions(),f!=null)this.setLineAnnotations(f);this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:N=!1,disableFileHeader:_=!1}=this.options;if(_){if(this.headerElement!=null)this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0;this.clearHeaderSlots()}if(n=this.getOrCreateFileContainerNode(n,l),this.applyCachedThemeState(I),g){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let O=this.fileRenderer.renderFile(M,Uc);if(O!=null)this.applyThemeState(n,O.themeStyles,I,O.baseThemeType);if(O?.headerAST!=null)this.applyHeaderToDOM(O.headerAST,n,O.file);this.renderedFile=O?.file??M,this.injectUnsafeCSS()}catch(O){if(N)throw O;if(console.error(O),O instanceof Error)this.applyErrorToDOM(O,n)}if(this.finalizeRender(),!a)this.emitPostRender();return!0}try{let O=this.getOrCreatePreNode(n);if(!this.canPartiallyRender(s,w,P||k||!an(this.renderedFile,M))||!this.applyPartialRender(M,v,b)){let B=this.fileRenderer.renderFile(M,b);if(B==null){if(this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool())this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender());return!1}if(this.applyThemeState(n,B.themeStyles,I,B.baseThemeType),B.headerAST!=null)this.applyHeaderToDOM(B.headerAST,n,B.file);this.applyFullRender(B,O),this.renderedFile=B.file}if(this.applyBuffers(O,b),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,!d)this.flushManagers();if(this.finalizeRender(),this.editor!=null)this.syncRenderViewToEditor()}catch(O){if(N)throw O;if(console.error(O),O instanceof Error)this.applyErrorToDOM(O,n)}if(!a)this.emitPostRender();return!0}finalizeRender(){}emitPostRender(t=!1){let{fileContainer:n,options:{onPostRender:s}}=this;if(t){if(!this.mounted)return;if(this.mounted=!1,n==null)return;s?.(n,this,"unmount");return}if(n==null)return;let a=this.mounted?"update":"mount";this.mounted=!0,s?.(n,this,a)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:t}of this.annotationCache.values())t.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(t,n,s){if(t||n||s)return!1;return!0}renderPlaceholder(t){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let n=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",n.appendChild(this.placeHolder)}return this.setPlaceholderHeight(t)}setPlaceholderHeight(t){if(this.placeHolder==null)return!1;return this.placeHolder.style.setProperty("height",`${t}px`),!0}async primeHighlightCache(t=this.file){let{workerManager:n}=this;if(t==null||n==null||!n.isWorkingPool()||t.cacheKey==null||V(t))return;let s=this.options.tokenizeMaxLength??1e5;if(this.fileRenderer.getOrCreateLineCache(t).length>s)return;await n.primeFileHighlightCache(t).catch((a)=>{console.error(a)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:a}of this.annotationCache.values())a.remove();this.annotationCache.clear();return}let t=new Map(this.annotationCache),{renderAnnotation:n}=this.options,s=this.getLatestAnnotations();if(n!=null&&s.length>0)for(let[a,l]of s.entries()){let d=this.getAnnotationSlotName(l),f=`${a}-${d}`,h=this.annotationCache.get(f);if(h==null||!qS(l,h.annotation)){h?.element.remove();let g=n(l);if(g==null)continue;h={element:ud(d),annotation:l},h.element.appendChild(g),this.fileContainer.appendChild(h.element),this.annotationCache.set(f,h)}t.delete(f)}for(let[a,{element:l}]of t.entries())this.annotationCache.delete(a),l.remove()}renderGutterUtility(){let{renderGutterUtility:t}=this.options;if(this.fileContainer==null||t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=t(this.interactionManager.getHoveredLine);if(n!=null&&this.gutterUtilityContent!=null)return;else if(n==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let s=cd();s.appendChild(n),this.fileContainer.appendChild(s),this.gutterUtilityContent=s}injectUnsafeCSS(){let{unsafeCSS:t}=this.options,n=this.fileContainer?.shadowRoot;if(n==null)return;if(t==null||t===""){if(this.unsafeCSSStyle!=null)this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0;this.appliedUnsafeCSS=void 0;return}if(this.unsafeCSSStyle?.parentNode===n&&this.appliedUnsafeCSS===t)return;if(this.unsafeCSSStyle??=dd(),this.unsafeCSSStyle.parentNode!==n)n.appendChild(this.unsafeCSSStyle);this.unsafeCSSStyle.textContent=fd(t),this.appliedUnsafeCSS=t}applyThemeState(t,n,s,a){let l=t.shadowRoot??t.attachShadow({mode:"open"}),d=a??s,f=this.getTheme(),h=typeof f==="string"?f:{...f},g=To(l);if(this.themeCSSStyle?.parentNode===l&&this.appliedThemeCSS?.themeStyles===n&&this.appliedThemeCSS.themeType===d&&this.appliedThemeCSS.scrollbarGutter===g){this.appliedThemeCSS.theme=h;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===l){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:h,themeStyles:n,themeType:d,baseThemeType:a,scrollbarGutter:g};return}this.themeCSSStyle=Id({shadowRoot:l,currentNode:this.themeCSSStyle,themeCSS:pd(n,d,g)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:h,themeStyles:n,themeType:d,baseThemeType:a,scrollbarGutter:g}:void 0}hydrateMeasuredScrollbar(){let t=this.fileContainer?.shadowRoot;if(t==null||this.themeCSSStyle==null)return;this.themeCSSStyle.textContent=hd(this.themeCSSStyle.textContent??"",To(t))}shouldGuardRebuildScroll(){return this.editor!=null&&ie()}applyFullRender(t,n){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(n,t);let s=this.code=ca({code:this.code}),a=this.fileRenderer.renderCodeAST(t);this.editor?.__captureFocusForDOMReplacement();let l=()=>{if(s.childElementCount>=2)for(let d=0;d<2;d++){let f=s.children[d],h=a[d];f.innerHTML=pn(h.children),f.style.cssText=h.properties.style}else s.innerHTML=pn(a);if(!n.contains(s))n.replaceChildren(s)};if(this.shouldGuardRebuildScroll())vl(n,l);else l();this.lastRowCount=t.rowCount}applyPartialRender(t,n,s){if(n==null||s==null)return!1;let{code:a}=this,l=a!=null?this.getColumns(a):void 0;if(a==null||l==null)return!1;let d=n.startingLine,f=s.startingLine,h=n.totalLines===1/0?Number.POSITIVE_INFINITY:d+n.totalLines,g=s.totalLines===1/0?Number.POSITIVE_INFINITY:f+s.totalLines,I=Math.max(d,f),b=Math.min(h,g);if(b<=I)return!1;if(!this.trimDOMToOverlap(l.gutter,I,b)||!this.trimDOMToOverlap(l.content,I,b))throw Error("File.applyPartialRender: failed to trim to overlap");let{length:v}=l.content.children,k=(N,_)=>{if(_<=0)return;return this.fileRenderer.renderFile(t,{startingLine:N,totalLines:_,bufferBefore:0,bufferAfter:0})},w=f<I?k(f,I-f):void 0;if(w===void 0&&f<I)return!1;let P=g===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Math.max(0,g-b),M=g>b?k(b,P):void 0;if(M===void 0&&g>b)return!1;if(this.cleanupErrorWrapper(),w!=null)l.gutter.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(w.gutterAST)),l.content.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(w.contentAST)),v+=w.rowCount;if(M!=null)l.gutter.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(M.gutterAST)),l.content.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(M.contentAST)),v+=M.rowCount;if(this.lastRowCount!==v)l.gutter.style.setProperty("grid-row",`span ${v}`),l.content.style.setProperty("grid-row",`span ${v}`),this.lastRowCount=v;return!0}getColumns(t){let n=t.children[0],s=t.children[1];if(!(n instanceof HTMLElement)||!(s instanceof HTMLElement)||n.dataset.gutter==null||s.dataset.content==null)return;return{gutter:n,content:s}}trimDOMToOverlap(t,n,s){let a=this.getDOMBoundaryIndices(t,[n,s]),l=a.get(n)??t.children.length,d=a.get(s)??t.children.length;if(l>d)return!1;for(let f=t.children.length-1;f>=d;f-=1)t.children[f]?.remove();for(let f=l-1;f>=0;f-=1)t.children[f]?.remove();return!0}getDOMBoundaryIndices(t,n){let s=[...new Set(n)].sort((h,g)=>h-g),a=new Map;if(s.length===0)return a;let l=0,d=s[l],{children:f}=t;if(d===0)a.set(0,0),l+=1,d=s[l];for(let h=0;h<f.length;h+=1){let g=f[h];if(!(g instanceof HTMLElement))continue;let I=this.getLineIndexFromDOMNode(g);if(I==null)continue;while(d!=null&&I>=d)a.set(d,h),l+=1,d=s[l];if(l>=s.length)break}for(let h of s)if(!a.has(h))a.set(h,f.length);return a}getLineIndexFromDOMNode(t){let n=t.dataset.lineIndex;if(n==null)return;let s=Number(n);return Number.isNaN(s)?void 0:s}applyBuffers(t,n){if(n==null||this.shouldDisableVirtualizationBuffers()){if(this.bufferBefore!=null)this.bufferBefore.remove(),this.bufferBefore=void 0;if(this.bufferAfter!=null)this.bufferAfter.remove(),this.bufferAfter=void 0;return}if(n.bufferBefore>0){if(this.bufferBefore==null)this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",t.before(this.bufferBefore);this.bufferBefore.style.setProperty("height",`${n.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")}else if(this.bufferBefore!=null)this.bufferBefore.remove(),this.bufferBefore=void 0;if(n.bufferAfter>0){if(this.bufferAfter==null)this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",t.after(this.bufferAfter);this.bufferAfter.style.setProperty("height",`${n.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")}else if(this.bufferAfter!=null)this.bufferAfter.remove(),this.bufferAfter=void 0}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(t,n,s){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let a=this.cachedHeaderHTML??pn(t);if(this.cachedHeaderHTML=a,a!==this.lastRenderedHeaderHTML){let g=document.createElement("div");g.innerHTML=a;let I=g.firstElementChild;if(!(I instanceof HTMLElement))return;if(this.headerElement!=null)n.shadowRoot?.replaceChild(I,this.headerElement);else n.shadowRoot?.prepend(I);this.headerElement=I,this.lastRenderedHeaderHTML=a}if(this.isContainerManaged)return;let{renderHeaderPrefix:l,renderHeaderFilenameSuffix:d,renderCustomHeader:f,renderHeaderMetadata:h}=this.options;if(f!=null){let g=f(s)??void 0;this.headerCustom=this.upsertHeaderSlotElement(n,this.headerCustom,Qs,g),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let g=l?.(s)??void 0,I=d?.(s)??void 0,b=h?.(s)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(n,this.headerPrefix,Xs,g),this.headerFilenameSuffix=this.upsertHeaderSlotElement(n,this.headerFilenameSuffix,Ys,I),this.headerMetadata=this.upsertHeaderSlotElement(n,this.headerMetadata,Js,b),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(t,n,s,a){if(a==null){n?.remove();return}let l=n??this.createHeaderSlotElement(s);if(n==null)t.appendChild(l);return this.replaceHeaderSlotContent(l,a),l}replaceHeaderSlotContent(t,n){if(t.replaceChildren(),n instanceof Element)t.appendChild(n);else t.innerText=`${n}`}createHeaderSlotElement(t){let n=document.createElement("div");return n.slot=t,n}getOrCreateFileContainerNode(t,n){let{fileContainer:s}=this,a=t??s??document.createElement("diffs-container"),l=s!==a;if(s!=null&&l)this.editor?.__captureFocusForDOMReplacement();if(l)this.emitPostRender(!0);if(this.fileContainer=a,s!=null&&l)this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0;if(n!=null&&this.fileContainer.parentNode!==n)n.appendChild(this.fileContainer);if(l)this.adoptReusableShellElements(this.fileContainer);return this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(t){let{shadowRoot:n}=t;if(n==null)return;for(let s of n.children)if(s instanceof SVGElement)this.spriteSVG??=s;else if(Co(s)&&s.hasAttribute("data-theme-css"))this.themeCSSStyle??=s,this.hasAdoptedThemeCSS=!0;else if(Co(s)&&s.hasAttribute("data-unsafe-css"))this.unsafeCSSStyle??=s,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0}ensureSpriteSVG(t){let n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.spriteSVG==null){let s=document.createElement("div");s.innerHTML=ad;let a=s.firstChild;if(a instanceof SVGElement)this.spriteSVG=a}if(this.spriteSVG!=null&&this.spriteSVG.parentNode!==n)n.appendChild(this.spriteSVG)}getOrCreatePreNode(t){let n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.pre==null)this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.code=void 0,n.appendChild(this.pre);else if(this.pre.parentNode!==n)this.editor?.__captureFocusForDOMReplacement(),t.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0;return this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(t){this.code=void 0;for(let n of Array.from(t.children)){if(!(n instanceof HTMLElement))continue;if(n.hasAttribute("data-code")){this.code=n;return}}}applyPreNodeAttributes(t,{totalLines:n}){let{overflow:s="scroll",disableLineNumbers:a=!1}=this.options,l={type:"file",split:!1,overflow:s,disableLineNumbers:a,diffIndicators:"none",disableBackground:!0,totalLines:n};if(ld(l,this.appliedPreAttributes))return;bd(t,l),this.appliedPreAttributes=l}applyErrorToDOM(t,n){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let s=n.shadowRoot??n.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",s.appendChild(this.errorWrapper);let a=document.createElement("div");a.dataset.errorMessage="",a.innerText=t.message,this.errorWrapper.appendChild(a);let l=document.createElement("pre");l.dataset.errorStack="",l.innerText=t.stack??"No Error Stack",this.errorWrapper.appendChild(l)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function I$(t,n,s=!1){return!s&&t==null&&n!=null}function S$(t,n,s=!1){return t==null&&n!=null&&!s}var b$=5000,Cd=new Map,C$=-1;function E$(t,n){return(t.overflow??"scroll")!==(n.overflow??"scroll")||(t.collapsed??!1)!==(n.collapsed??!1)||(t.disableLineNumbers??!1)!==(n.disableLineNumbers??!1)||(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||t.unsafeCSS!==n.unsafeCSS}var XS=class extends Ue{virtualizer;metrics;__id=`virtualized-file:${++C$}`;renderType="virtualized";top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:Cd};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(t,n,s=fl,a,l=!1){super(t,a,l);this.virtualizer=n,this.metrics=s}setMetrics(t,n=!1){let s=aa(t);if(!n&&vi(this.metrics,s))return;this.metrics=s,this.resetLayoutCache()}setLineAnnotations(t){if(this.syncLineAnnotations(t))this.forceRenderOverride=!0}syncLineAnnotations(t){if(t==null||!this.isNewAnnotations(t))return!1;if(t.length===0&&this.getLatestAnnotations().length===0)return!1;return super.setLineAnnotations(t),!0}syncEditSessionAnnotationsFromEditor(t){if(super.syncEditSessionAnnotationsFromEditor(t))return this.forceRenderOverride=!0,!0;return!1}hasLineAnnotations(){return this.getLatestAnnotations().some((t)=>t.lineNumber>0)}hasUniformLineHeights(){let{overflow:t="scroll"}=this.options;return t==="scroll"&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(t,n=!1){let s=this.cache.heights.get(t);if(s!=null)return s;let a=n?2:1;return this.metrics.lineHeight*a}setOptions(t){if(this.isAdvancedMode())throw Error("VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(t==null)return;let{options:n}=this,s=!oa(n,t),a=E$(n,t);if(super.setOptions(t),a)this.resetLayoutCache(!0);if(s)this.forceRenderOverride=!0;if(s)this.virtualizer.instanceChanged(this,a)}setThemeType(t){if(this.isAdvancedMode())throw Error("VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(t)}resetLayoutCache(t=!1,n=!0){if(this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0)this.cache.heights.clear();if(this.cache.checkpoints.length>0)this.cache.checkpoints.length=0;if(this.cache.ghostTextRows=Cd,this.renderRange!=null&&n)this.renderRange=void 0;if(t&&this.isSimpleMode())this.computeApproximateSize()}applyGhostTextRows(t){let{heights:n,ghostTextRows:s}=this.cache;if(s===t)return!1;let{lineHeight:a}=this.metrics,l=!1;for(let d of new Set([...s.keys(),...t.keys()])){let f=s.get(d)??0,h=t.get(d)??0;if(h===f)continue;let g=(n.get(d)??a)-f*a+h*a;if(g===a)n.delete(d);else n.set(d,g);l=!0}return this.cache.ghostTextRows=t,l}reconcileHeights(){let t=!1;if(this.fileContainer==null||this.getLayoutFile()==null){if(this.height!==0)t=!0;return this.height=0,t}let{overflow:n="scroll"}=this.options;this.top=this.getVirtualizedTop();let s=this.editor?.__getGhostTextRows()??Cd;t=this.applyGhostTextRows(s);let a=n!=="scroll"||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!a&&this.cache.heights.size===0&&this.cache.fileAnnotationHeight===0){if(t)this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height);return t}let{lineHeight:l}=this.metrics;if(this.code==null)return t;let d=this.code.children[1];if(!(d instanceof HTMLElement))return t;if(this.renderRange!=null&&Eo(this.renderRange)){let f=v$(d)??0;if(f!==this.cache.fileAnnotationHeight)this.cache.fileAnnotationHeight=f,t=!0}for(let f of d.children){if(!(f instanceof HTMLElement))continue;let h=f.dataset.lineIndex;if(h==null)continue;let g=Number(h),I=(s.get(g)??0)*l,b=this.cache.heights.get(g);if(!a&&(b==null||b===l+I))continue;let v=f.getBoundingClientRect().height+I,k=!1;if(f.nextElementSibling instanceof HTMLElement&&(("lineAnnotation"in f.nextElementSibling.dataset)||("noNewline"in f.nextElementSibling.dataset))){if("noNewline"in f.nextElementSibling.dataset)k=!0;v+=f.nextElementSibling.getBoundingClientRect().height}let w=this.getLineHeight(g,k);if(v===w)continue;if(t=!0,v===this.metrics.lineHeight*(k?2:1))this.cache.heights.delete(g);else this.cache.heights.set(g,v)}if(t||this.isResizeDebuggingEnabled())this.computeApproximateSize(!0);return t}onRender=(t)=>{if(this.fileContainer==null||this.file==null)return!1;if(t)this.top=this.getVirtualizedTop();return this.render({file:this.file})};updateCodeViewLayout(t,n,s,a){let l=!an(this.file,t);if(l)this.updateExternalFile(t,a);let{pendingRenderFile:d,layoutFileChanged:f,renderedFileChanged:h,annotationsChanged:g}=this.updatePendingRender(t,a),I=s?.resetFileLayoutCache===!0||f;if(s?.metrics!=null)this.metrics=s.metrics,I=!0;let{collapsed:b=!1}=this.options;if(this.currentCollapsed!==b)this.currentCollapsed=b,I=!0;if(I)this.resetLayoutCache();if(l)this.layoutDirty=!0;if(!this.forceRenderOverride&&(l||h||g))this.forceRenderOverride=!0;return this.top=n,this.computeApproximateSize(!1,d),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(t){let n=this.getLayoutFile();if(n==null||t<1)return;let{disableFileHeader:s=!1,collapsed:a=!1}=this.options,l=this.fileRenderer.getLineCount(n)-1,d=Mr(this.metrics,s);if(a||l<0)return{top:d,height:0};let f=Math.min(Math.max(t-1,0),l),{lineHeight:h}=this.metrics;if(d+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:d+f*h,height:h};let g=this.getLayoutCheckpointBeforeLineIndex(f);d=g?.top??d;for(let I=g?.lineIndex??0;I<f;I++)d+=this.getLineHeight(I,!1);return{top:d,height:this.getLineHeight(f,!1)}}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(t){let n=this.getLayoutFile();if(n==null||this.renderRange==null)return;let{disableFileHeader:s=!1,collapsed:a=!1}=this.options;if(a||this.renderRange.totalLines<=0)return;let l=this.fileRenderer.getLineCount(n)-1;if(l<0)return;let d=Mr(this.metrics,s),f=Math.min(this.renderRange.startingLine,l),h=Math.min(f+this.renderRange.totalLines-1,l);if(h<f)return;let{fileAnnotationHeight:g}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:b}=this.metrics,v=d+(f===0?g:this.renderRange.bufferBefore),k=f+Math.max(Math.ceil((t-v)/b),0);if(k>h)return;return{lineNumber:k+1,top:d+g+k*b}}let I=d+(f===0?g:this.renderRange.bufferBefore);for(let b=f;b<=h;b++){if(I>=t)return{lineNumber:b+1,top:I};I+=this.getLineHeight(b)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(t){let n=this.getLayoutFile();if(this.top==null||n==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let s=t!=null?this.computeRenderRangeFromWindow(n,this.top,t):this.renderRange;if(s==null)return;let{bufferBefore:a,bufferAfter:l,totalLines:d}=s,f=0;if(d===0){let h=t??this.virtualizer.getWindowSpecs();if(this.top<h.top)f=l}return{topOffset:this.top+a+f,height:this.height-(a+l)}}cleanUp(t=!1){let n=this.cache.ghostTextRows.size>0;if(n)this.layoutDirty=!0;let s=t&&this.isAdvancedMode()&&this.fileContainer!=null&&(n||!an(this.getRenderedFile(),this.getLatestFile()));if(this.fileContainer!=null&&this.isSimpleMode())this.getSimpleVirtualizer()?.disconnect(this.fileContainer);if(!t)this.resetLayoutCache();if(this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(t),s)this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(t=!1,n=this.getLayoutFile()){let s=this.isResizeDebuggingEnabled();if(!t&&!this.layoutDirty&&!s)return;let a=this.height===0;if(this.height=0,this.cache.checkpoints=[],n==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??Cd);let{disableFileHeader:l=!1,collapsed:d=!1}=this.options,{lineHeight:f}=this.metrics,h=this.fileRenderer.getLineCount(n),g=Mr(this.metrics,l),I=ss(this.metrics);if(this.height+=g,d){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=h*f;else for(let b=0;b<h;b++)this.addLayoutCheckpoint(b,this.height),this.height+=this.getLineHeight(b,!1);if(h>0)this.height+=I;if(this.fileContainer!=null&&s&&!a){let b=this.fileContainer.getBoundingClientRect();if(b.height!==this.height)console.log("VirtualizedFile.computeApproximateSize: computed height doesnt match",{name:n.name,elementHeight:b.height,computedHeight:this.height});else console.log("VirtualizedFile.computeApproximateSize: computed height IS CORRECT")}this.layoutDirty=!1}setVisibility(t){if(this.isAdvancedMode()||this.fileContainer==null)return;if(this.renderRange=void 0,t&&!this.isVisible)this.top=this.getVirtualizedTop(),this.isVisible=!0;else if(!t&&this.isVisible)this.isVisible=!1,this.rerender()}rerender(){if(!this.enabled||this.file==null)return;let t=this.getLatestFile(),n=t==null?void 0:this.fileRenderer.getFileForNextRender(t);if(this.isSimpleMode())this.pendingRender=void 0;this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!an(this.getRenderedFile(),n))}syncGhostTextRows(){let t=this.getAdvancedVirtualizer();if(t!=null)t.capturePendingLayoutAnchor(),this.layoutDirty=!0,t.instanceChanged(this,!0);else this.getSimpleVirtualizer()?.requestHeightReconcile(this)}applyDocumentChange(t,n,s=!1){let{renderRange:a}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(t,n),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1);let l=this.getRenderedFile();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(s&&a!=null&&l!=null){let d=this.virtualizer.getWindowSpecs(),f=this.computeRenderRangeFromWindow(l,this.top??0,d);if(f.bufferAfter!==a.bufferAfter)this.updateBuffers(f)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}render({fileContainer:t,file:n,forceRender:s=!1,lineAnnotations:a,...l}){let d=!an(this.file,n);if(d)this.updateExternalFile(n,a),this.cachedHeaderHTML=void 0;let{pendingRenderFile:f,layoutFileChanged:h,renderedFileChanged:g,annotationsChanged:I}=(()=>{if(this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(n)??n))return{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:this.syncLineAnnotations(a)};return this.updatePendingRender(n,a)})(),{forceRenderOverride:b,isSetup:v}=this;if(this.forceRenderOverride=void 0,h)this.resetLayoutCache();if(t=this.getOrCreateFileContainerNode(t),!v){this.computeApproximateSize(!1,f);let M=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(M==null)throw Error("VirtualizedFile.render: simple virtualizer is not available");M.connect(t,this),this.isVisible=M.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}else if(this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode())this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,f);if(!this.isVisible&&this.isSimpleMode()&&(!d||!v))return this.renderPlaceholder(this.height);let k=this.virtualizer.getWindowSpecs(),w=this.top??0,P=this.computeRenderRangeFromWindow(f,w,k);return super.render({file:n,fileContainer:t,renderRange:P,lineAnnotations:a,forceRender:(b??s)||I||g||d,...l})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error("VirtualizedFile.render: rendered a different file than its prepared layout");if(this.pendingRender=void 0,this.isSimpleMode())this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(t,n){let s=this.getLatestFile(t)??t,a=this.getRenderedFile(),l=this.pendingRender?.file??a,d=this.fileRenderer.getFileForNextRender(s);return this.pendingRender={latestFile:s,file:d},{pendingRenderFile:d,annotationsChanged:this.syncLineAnnotations(n),layoutFileChanged:!an(l,d),renderedFileChanged:!an(a,d)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}addLayoutCheckpoint(t,n){if(t%b$!==0)return;this.cache.checkpoints.push({lineIndex:t,top:n})}getLayoutCheckpointBeforeLineIndex(t){if(t<=0||this.cache.checkpoints.length===0)return;let n=0,s=this.cache.checkpoints.length-1,a;while(n<=s){let l=n+s>>1,d=this.cache.checkpoints[l];if(d==null)throw Error("VirtualizedFile: invalid checkpoint index");if(d.lineIndex<=t)a=d,n=l+1;else s=l-1}return a}getLayoutCheckpointBeforeTop(t,n){let s=0,a=this.cache.checkpoints.length-1,l=-1;while(s<=a){let d=s+a>>1,f=this.cache.checkpoints[d];if(f==null)throw Error("VirtualizedFile: invalid checkpoint index");if(f.top<=t)l=d,s=d+1;else a=d-1}if(n==null)return l>=0?this.cache.checkpoints[l]:void 0;for(let d=l;d>=0;d--){let f=this.cache.checkpoints[d];if(f==null)throw Error("VirtualizedFile: invalid checkpoint index");if(f.lineIndex%n===0)return f}}getVirtualizedTop(){if(this.virtualizer.type==="advanced")return this.virtualizer.getLocalTopForInstance(this);return this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(t,n,{top:s,bottom:a}){let{disableFileHeader:l=!1}=this.options,{hunkLineCount:d,lineHeight:f}=this.metrics,h=this.fileRenderer.getLineCount(t),g=this.height,I=Mr(this.metrics,l),b=h>0?ss(this.metrics):0,{fileAnnotationHeight:v}=this.cache,k=I+v,w=Math.max(0,g-I-v-b),P=zc(this.getLatestAnnotations()),M=n+I,N=v>0&&P&&M<a&&M+v>s;if(n<s-g||n>a)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-I-b};if(h<=d)return{startingLine:0,totalLines:d,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(a-s,0)/f),O=Math.ceil(_/d)*d+d,B=O/d,X=(s+a)/2;if(this.hasUniformLineHeights()){let En=n+k,wr=En+w;if(!N&&!(En<a&&wr>s))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-I-b};let Kr=Math.floor(N&&X<n+k?0:(X-(n+k))/f),Vr=Math.floor(Kr/d)-Math.floor(B/2),Yo=Math.ceil(h/d),lr=Math.max(0,Math.min(Vr,Yo))*d,Fs=Vr<0?O+Vr*d:O,qa=lr===0?0:v+lr*f,Hi=Math.min(Fs,h-lr);return{startingLine:lr,totalLines:Fs,bufferBefore:qa,bufferAfter:Math.max(0,(h-lr-Hi)*f)}}let z=B,K=[],W=this.getLayoutCheckpointBeforeTop(Math.max(0,s-n-O*f*2),d),J=n+(W?.top??k),ee=W?.lineIndex??0,ce,Ae,ue,Se=W?.lineIndex??0;for(let En=Se;En<h;En++){let wr=ee%d===0,Kr=Math.floor(ee/d);if(wr){if(K[Kr]=J-(n+k),ue!=null){if(ue<=0)break;ue--}}let Vr=this.getLineHeight(En,!1);if(J>s-Vr&&J<a)ce??=Kr;if(J+Vr>X)Ae??=Kr;if(ue==null&&J>=a&&wr)ue=z;ee++,J+=Vr}if(ce==null)if(N)ce=0,Ae=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-I-b};Ae??=ce;let ut=Math.round(Ae-B/2),It=Math.max(0,Math.ceil(h/d)-B),Ce=Math.max(0,Math.min(ut,It)),qe=Ce*d,Tt=ut<0?O+ut*d:O,jn=K[Ce]??0,St=qe===0?0:v+jn,Nt=Ce+Tt/d,sn=Nt<K.length?w-K[Nt]:w-(J-n-k);return{startingLine:qe,totalLines:Tt,bufferBefore:St,bufferAfter:Math.max(0,sn)}}};function v$(t){let n;for(let s of t.children){if(!(s instanceof HTMLElement))continue;if(s.dataset.lineAnnotation!==Gc)continue;n=Math.max(n??0,s.getBoundingClientRect().height)}return n}function m(t,n){return t?.cacheKey!=null||n?.cacheKey!=null?t?.cacheKey===n?.cacheKey:t===n}function be(t,n){return t?.cacheKey===n?.cacheKey&&t?.contents===n?.contents&&t?.name===n?.name&&t?.lang===n?.lang}async function kl(t,n=300){let s;try{await Promise.race([t(),new Promise((a)=>{s=setTimeout(a,n)})])}finally{if(s!=null)clearTimeout(s)}}function da(t){return[Nn(t.additionStart,t.additionCount)+1,Dn(t.additionStart,t.additionCount)+1]}function Ir({isPartial:t,rangeSize:n,expandedHunks:s,hunkIndex:a,collapsedContextThreshold:l}){let d=Math.max(n,0);if(d===0||t)return{fromStart:0,fromEnd:0,rangeSize:d,collapsedLines:d,renderAll:!1};if(s===!0||d<=l)return{fromStart:d,fromEnd:0,rangeSize:d,collapsedLines:0,renderAll:!0};let f=s?.get(a),h=Math.min(Math.max(f?.fromStart??0,0),d),g=Math.min(Math.max(f?.fromEnd??0,0),d),I=h+g,b=I>=d;return{fromStart:b?d:h,fromEnd:b?0:g,rangeSize:d,collapsedLines:Math.max(d-I,0),renderAll:b}}function YS(t){let n=t.hunks[t.hunks.length-1];if(n==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0)return!1;let s=t.additionLines.length-Dn(n.additionStart,n.additionCount),a=t.deletionLines.length-Dn(n.deletionStart,n.deletionCount);if(s<=0&&a<=0)return!1;return s!==a}function Mp({fileDiff:t,errorPrefix:n}){let s=t.hunks[t.hunks.length-1];if(s==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0)return 0;let a=t.additionLines.length-Dn(s.additionStart,s.additionCount),l=t.deletionLines.length-Dn(s.deletionStart,s.deletionCount);if(a<=0&&l<=0)return 0;if(a!==l)throw Error(`${n}: trailing context mismatch (additions=${a}, deletions=${l}) for ${t.name}`);return Math.min(a,l)}function Sr({fileDiff:t,hunkIndex:n,expandedHunks:s,collapsedContextThreshold:a,errorPrefix:l}){if(n!==t.hunks.length-1)return;let d=Mp({fileDiff:t,errorPrefix:l});if(d<=0)return;if(s===!0||d<=a)return{fromStart:d,fromEnd:0,rangeSize:d,collapsedLines:0,renderAll:!0};let f=s?.get(t.hunks.length),h=Math.min(Math.max(f?.fromStart??0,0),d);return{fromStart:h,fromEnd:0,rangeSize:d,collapsedLines:d-h,renderAll:h>=d}}function Ed({fileDiff:t,lineNumber:n,expandedHunks:s,collapsedContextThreshold:a}){if(s===!0||t.isPartial)return!0;for(let[h,g]of t.hunks.entries()){let[I,b]=da(g);if(n<I){let v=Ir({isPartial:t.isPartial,rangeSize:g.collapsedBefore,expandedHunks:s,hunkIndex:h,collapsedContextThreshold:a}),k=I-v.rangeSize;return v.renderAll||n<k+v.fromStart||n>=I-v.fromEnd}if(n<b)return!0}let l=Sr({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:s,collapsedContextThreshold:a,errorPrefix:"isAdditionLineRenderable"});if(l==null||l.renderAll)return!0;let d=t.hunks[t.hunks.length-1],[,f]=da(d);return n<f+l.fromStart||n>=f+l.rangeSize}function JS({fileDiff:t,lineNumber:n,direction:s,expandedHunks:a,collapsedContextThreshold:l}){if(a===!0||t.isPartial)return n;let d=[],f=1;for(let[g,I]of t.hunks.entries()){let[b,v]=da(I),k=Ir({isPartial:t.isPartial,rangeSize:I.collapsedBefore,expandedHunks:a,hunkIndex:g,collapsedContextThreshold:l}),w=b-k.rangeSize;if(k.renderAll)d.push([w,b]);else{if(k.fromStart>0)d.push([w,w+k.fromStart]);if(k.fromEnd>0)d.push([b-k.fromEnd,b])}d.push([b,v]),f=v}let h=Sr({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:l,errorPrefix:"getNearestRenderableAdditionLine"});if(h!=null){let g=f;if(f=g+h.rangeSize,h.renderAll)d.push([g,f]);else if(h.fromStart>0)d.push([g,g+h.fromStart])}if(n>=f)return n;if(s==="down"){for(let[g,I]of d)if(I>n)return Math.max(g,n);return}for(let g=d.length-1;g>=0;g--){let[I,b]=d[g];if(I<=n)return Math.min(b-1,n)}}function QS({type:t,metrics:n}){return n.hunkSeparatorHeight??ES(t)}function ZS({type:t,metrics:n}){return t==="simple"||t==="metadata"||t==="line-info-basic"?0:n.spacing}function k$({type:t,hunkIndex:n,hunkSpecs:s}){switch(t){case"simple":return n>0;case"metadata":return s!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function T$(t){return t!=="simple"&&t!=="metadata"}function ms({type:t,metrics:n,hunkIndex:s,hunkSpecs:a}){if(!k$({type:t,hunkIndex:s,hunkSpecs:a}))return;let l=QS({type:t,metrics:n}),d=ZS({type:t,metrics:n}),f=s>0?d:0,h=d;return{height:l,gapBefore:f,gapAfter:h,totalHeight:f+l+h}}function Ji({type:t,metrics:n}){if(!T$(t))return;let s=QS({type:t,metrics:n}),a=ZS({type:t,metrics:n});return{height:s,gapBefore:a,gapAfter:0,totalHeight:a+s}}function e0({fileDiff:t,metrics:n,disableFileHeader:s,hunkSeparators:a,expandUnchanged:l,expandedHunks:d,collapsedContextThreshold:f,canHydratePartialDiff:h}){let g=Mr(n,s),I=g,b=l?!0:d,v=t.hunks.length-1;for(let k=0;k<t.hunks.length;k++){let w=t.hunks[k];if(w==null)throw Error("computeEstimatedDiffHeights: invalid hunk index");let P=Ir({isPartial:t.isPartial,rangeSize:w.collapsedBefore,expandedHunks:b,hunkIndex:k,collapsedContextThreshold:f}),M=(P.fromStart+P.fromEnd)*n.lineHeight;if(g+=M,I+=M,P.collapsedLines>0){let O=ms({type:a,metrics:n,hunkIndex:k,hunkSpecs:w.hunkSpecs})?.totalHeight??0;g+=O,I+=O}g+=w.splitLineCount*n.lineHeight,I+=w.unifiedLineCount*n.lineHeight;let N=w$(w);g+=N.split*n.lineHeight,I+=N.unified*n.lineHeight;let _=k===v?Sr({fileDiff:t,hunkIndex:k,expandedHunks:b,collapsedContextThreshold:f,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(_!=null){let O=(_.fromStart+_.fromEnd)*n.lineHeight;if(g+=O,I+=O,_.collapsedLines>0){let B=Ji({type:a,metrics:n})?.totalHeight??0;g+=B,I+=B}}else if(k===v&&t.isPartial&&h){let O=Ji({type:a,metrics:n})?.totalHeight??0;g+=O,I+=O}}if(t.hunks.length>0){let k=ss(n);g+=k,I+=k}return{splitHeight:g,unifiedHeight:I}}function w$(t){if(!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return{split:0,unified:0};let n=t.hunkContent.at(-1);if(n==null)return{split:0,unified:0};if(n.type==="context"){let s=n.lines>0?1:0;return{split:s,unified:s}}return R$(t,n)}function R$(t,n){let s=(n.deletions>0&&t.noEOFCRDeletions?1:0)+(n.additions>0&&t.noEOFCRAdditions?1:0),a=n.deletions>0&&t.noEOFCRDeletions,l=n.additions>0&&t.noEOFCRAdditions;return{split:a||l?1:0,unified:s}}function Tl({oldFile:t,newFile:n},s){if(t===void 0&&n===void 0)return;if(t===void 0||n===void 0)throw Error(`${s}: Pass null for an intentionally missing oldFile or newFile side`);if(t===null){if(n===null)throw Error(`${s}: You must pass oldFile, newFile, or both`);return{oldFile:t,newFile:n}}if(n===null)return{oldFile:t,newFile:n};return{oldFile:t,newFile:n}}function Pe(t){return t.map((n)=>({...n,hunkContent:n.hunkContent.map((s)=>({...s}))}))}function vd(t){return{...t,hunks:Pe(t.hunks),deletionLines:[...t.deletionLines],additionLines:[...t.additionLines]}}function ma(t){return t!==""?t.split(jI):[]}function wl(t,n,s){let a=t==="clone"?vd(n):n;if(!a.isPartial)throw Error("hydratePartialDiff: fileDiff must be partial");switch(a.type){case"change":case"rename-changed":return L$(a,P$(a,s),t0(a,s));case"rename-pure":{let l=t0(a,s);M$(a,s);let d=ma(l.contents);return a.isPartial=!1,a.deletionLines=d,a.additionLines=d,n0(a,null,l),a}}throw Error(`hydratePartialDiff: ${a.type} diffs cannot be hydrated from loaded files`)}function L$(t,n,s){let a=ma(n.contents),l=ma(s.contents),{hunks:d,splitLineCount:f,unifiedLineCount:h}=A$(t.hunks,l.length);return t.hunks=d,t.splitLineCount=f,t.unifiedLineCount=h,t.isPartial=!1,t.deletionLines=a,t.additionLines=l,n0(t,n,s),t}function A$(t,n){let s=0,a=0,l=0,d=[];for(let f of t){let h=Math.max(f.additionStart-1,0),g=Math.max(f.deletionStart-1,0),I=h,b=g,v=0,k=0,w=0,P=0,M=[];for(let _ of f.hunkContent){if(_.type==="context"){M.push({..._,additionLineIndex:I,deletionLineIndex:b}),I+=_.lines,b+=_.lines,w+=_.lines,P+=_.lines;continue}M.push({..._,additionLineIndex:I,deletionLineIndex:b}),I+=_.additions,b+=_.deletions,v+=_.additions,k+=_.deletions,w+=Math.max(_.additions,_.deletions),P+=_.additions+_.deletions}let N=Math.max(Nn(f.additionStart,f.additionCount)-l,0);d.push({...f,collapsedBefore:N,additionLineIndex:h,deletionLineIndex:g,additionLines:v,deletionLines:k,hunkContent:M,splitLineStart:s+N,unifiedLineStart:a+N,splitLineCount:w,unifiedLineCount:P}),s+=N+w,a+=N+P,l=Dn(f.additionStart,f.additionCount)}if(d.length>0){let f=d[d.length-1],h=Dn(f.additionStart,f.additionCount),g=Math.max(n-h,0);s+=g,a+=g}return{hunks:d,splitLineCount:s,unifiedLineCount:a}}function P$(t,n){if(n.oldFile==null)throw Error(`hydratePartialDiff: ${t.type} diff for ${t.name} requires oldFile`);return n.oldFile}function t0(t,n){if(n.newFile==null)throw Error(`hydratePartialDiff: ${t.type} diff for ${t.name} requires newFile`);return n.newFile}function M$(t,n){if(n.oldFile!==null)throw Error(`hydratePartialDiff: ${t.type} diff for ${t.name} requires oldFile to be null`)}function _$(t,n,s){if(t.cacheKey!=null)return`${t.cacheKey}:hydrated`;return O$(n,s)}function n0(t,n,s){let a=_$(t,n,s);if(a==null){delete t.cacheKey;return}t.cacheKey=a}function O$(t,n){if(t!=null&&n!=null)return t.cacheKey!=null&&n.cacheKey!=null?os("hydrated-files",t.cacheKey,n.cacheKey):void 0;return t?.cacheKey??n?.cacheKey}function si({diff:t,diffStyle:n,startingLine:s=0,totalLines:a=1/0,expandedHunks:l,collapsedContextThreshold:d=1,callback:f}){let h=$$({diff:t,diffStyle:n,startingLine:s,expandedHunks:l,collapsedContextThreshold:d}),g={viewportStart:s,viewportEnd:s+a,isWindowedHighlight:s>0||a<1/0,splitCount:h.splitCount,unifiedCount:h.unifiedCount,finalHunkIndex:t.hunks.length-1,shouldBreak(){if(!g.isWindowedHighlight)return!1;let I=g.unifiedCount>=s+a,b=g.splitCount>=s+a;if(n==="unified")return I;else if(n==="split")return b;else return I&&b},shouldSkip(I,b){if(!g.isWindowedHighlight)return!1;let v=I>0&&g.unifiedCount+I<=s,k=b>0&&g.splitCount+b<=s;if(n==="unified")return v;else if(n==="split")return k;else return v&&k},incrementCounts(I,b){if(n==="unified"||n==="both")g.unifiedCount+=I;if(n==="split"||n==="both")g.splitCount+=b},isInWindow(I,b){if(!g.isWindowedHighlight)return!0;let v=g.isInUnifiedWindow(I),k=g.isInSplitWindow(b);if(n==="unified")return v;else if(n==="split")return k;else return v||k},isInUnifiedWindow(I){return!g.isWindowedHighlight||g.unifiedCount>=s-I&&g.unifiedCount<s+a},isInSplitWindow(I){return!g.isWindowedHighlight||g.splitCount>=s-I&&g.splitCount<s+a},emit(I,b=!1){if(!b)if(n==="unified")g.incrementCounts(1,0);else if(n==="split")g.incrementCounts(0,1);else g.incrementCounts(1,1);return f(I)??!1}};e:for(let I=h.hunkIndex;I<t.hunks.length;I++){let O=function(ue,Se){if(N==null||N.collapsedLines<=0||N.fromStart+N.fromEnd>0)return 0;if(n==="unified")return ue===b.unifiedLineStart+b.unifiedLineCount-1?N.collapsedLines:0;return Se===b.splitLineStart+b.splitLineCount-1?N.collapsedLines:0},X=function(){if(B)return 0;return B=!0,M.collapsedLines},b=t.hunks[I];if(b==null)throw Error("iterateOverDiff: invalid hunk index");if(g.shouldBreak())break;let v=Nn(b.deletionStart,b.deletionCount),k=Nn(b.additionStart,b.additionCount),w=!t.isPartial&&b.deletionCount===0?v:b.deletionLineIndex,P=!t.isPartial&&b.additionCount===0?k:b.additionLineIndex,M=Ir({isPartial:t.isPartial,rangeSize:b.collapsedBefore,expandedHunks:l,hunkIndex:I,collapsedContextThreshold:d}),N=I===g.finalHunkIndex?Sr({fileDiff:t,hunkIndex:I,expandedHunks:l,collapsedContextThreshold:d,errorPrefix:"iterateOverDiff"}):void 0,_=M.fromStart+M.fromEnd,B=M.collapsedLines===0;if(!g.shouldSkip(_,_)){let ue=b.unifiedLineStart-M.rangeSize,Se=b.splitLineStart-M.rangeSize,ut=w-M.rangeSize,It=P-M.rangeSize,Ce=v+1-M.rangeSize,qe=k+1-M.rangeSize;if(kd(g,M.fromStart,n,(Tt)=>g.emit({hunkIndex:I,hunk:b,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:Ce+Tt,lineIndex:ut+Tt,noEOFCR:!1,unifiedLineIndex:ue+Tt,splitLineIndex:Se+Tt},additionLine:{unifiedLineIndex:ue+Tt,splitLineIndex:Se+Tt,lineIndex:It+Tt,lineNumber:qe+Tt,noEOFCR:!1}})))break e;if(ue=b.unifiedLineStart-M.fromEnd,Se=b.splitLineStart-M.fromEnd,ut=w-M.fromEnd,It=P-M.fromEnd,Ce=v+1-M.fromEnd,qe=k+1-M.fromEnd,kd(g,M.fromEnd,n,(Tt)=>g.emit({hunkIndex:I,hunk:b,collapsedBefore:X(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:Ce+Tt,lineIndex:ut+Tt,noEOFCR:!1,unifiedLineIndex:ue+Tt,splitLineIndex:Se+Tt},additionLine:{unifiedLineIndex:ue+Tt,splitLineIndex:Se+Tt,lineIndex:It+Tt,lineNumber:qe+Tt,noEOFCR:!1}}),()=>{X()}))break e}else g.incrementCounts(_,_),X();let{unifiedLineStart:z,splitLineStart:K}=b,W=w,J=P,ee=v+1,ce=k+1,Ae=b.hunkContent.at(-1);for(let ue of b.hunkContent){if(g.shouldBreak())break e;let Se=ue===Ae;if(ue.type==="context"){if(!g.shouldSkip(ue.lines,ue.lines)){if(kd(g,ue.lines,n,(ut)=>{let It=Se&&ut===ue.lines-1,Ce=z+ut,qe=K+ut;return g.emit({hunkIndex:I,hunk:b,collapsedBefore:X(),collapsedAfter:O(Ce,qe),type:"context",deletionLine:{lineNumber:ee+ut,lineIndex:W+ut,noEOFCR:It&&b.noEOFCRDeletions,unifiedLineIndex:Ce,splitLineIndex:qe},additionLine:{unifiedLineIndex:Ce,splitLineIndex:qe,lineIndex:J+ut,lineNumber:ce+ut,noEOFCR:It&&b.noEOFCRAdditions}})},()=>{X()}))break e}else g.incrementCounts(ue.lines,ue.lines),X();z+=ue.lines,K+=ue.lines,W+=ue.lines,J+=ue.lines,ee+=ue.lines,ce+=ue.lines}else{let ut=Math.max(ue.deletions,ue.additions),It=ue.deletions+ue.additions;if(!g.shouldSkip(It,ut)){let Ce=D$(g,ue,n);if((Ce[0]?.[0]??0)>0)X();for(let[qe,Tt]of Ce)for(let jn=qe;jn<Tt;jn++){let St=O(z+jn,n==="unified"?K+(jn<ue.deletions?jn:jn-ue.deletions):K+jn);if(g.emit(H$({hunkIndex:I,hunk:b,collapsedBefore:X(),collapsedAfter:St,diffStyle:n,index:jn,unifiedLineIndex:z,splitLineIndex:K,additionLineIndex:J,deletionLineIndex:W,additionLineNumber:ce,deletionLineNumber:ee,content:ue,isLastContent:Se,unifiedCount:It,splitCount:ut}),!0))break e}}X(),g.incrementCounts(It,ut),z+=It,K+=ut,W+=ue.deletions,J+=ue.additions,ee+=ue.deletions,ce+=ue.additions}}if(N!=null){let{collapsedLines:ue,fromStart:Se,fromEnd:ut}=N,It=Se+ut;if(kd(g,It,n,(Ce)=>{let qe=Ce===It-1;return g.emit({hunkIndex:t.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:qe?ue:0,type:"context-expanded",deletionLine:{lineNumber:ee+Ce,lineIndex:W+Ce,noEOFCR:!1,unifiedLineIndex:z+Ce,splitLineIndex:K+Ce},additionLine:{unifiedLineIndex:z+Ce,splitLineIndex:K+Ce,lineIndex:J+Ce,lineNumber:ce+Ce,noEOFCR:!1}})},void 0,()=>g.shouldBreak()))break e}}}function $$({diff:t,diffStyle:n,startingLine:s,expandedHunks:a,collapsedContextThreshold:l}){if(s<=0||n==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};let d=F$({diff:t,expandedHunks:a,collapsedContextThreshold:l}),f=0,h=t.hunks.length-1,g=t.hunks.length;while(f<=h){let b=f+h>>1,v=d[b+1];if(v==null)throw Error("iterateOverDiff: invalid hunk prefix index");if((n==="unified"?v.unifiedCount:v.splitCount)>s)g=b,h=b-1;else f=b+1}if(g>=t.hunks.length){let b=d[t.hunks.length];if(b==null)throw Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:t.hunks.length,splitCount:b.splitCount,unifiedCount:b.unifiedCount}}let I=d[g];if(I==null)throw Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:g,splitCount:I.splitCount,unifiedCount:I.unifiedCount}}function F$({diff:t,expandedHunks:n,collapsedContextThreshold:s}){let a=0,l=0,d=t.hunks.length-1,f=[{splitCount:0,unifiedCount:0}];for(let h=0;h<t.hunks.length;h++){let g=t.hunks[h];if(g==null)throw Error("iterateOverDiff: invalid hunk summary index");let I=Ir({isPartial:t.isPartial,rangeSize:g.collapsedBefore,expandedHunks:n,hunkIndex:h,collapsedContextThreshold:s}),b=I.fromStart+I.fromEnd;a+=b+g.splitLineCount,l+=b+g.unifiedLineCount;let v=h===d?Sr({fileDiff:t,hunkIndex:h,expandedHunks:n,collapsedContextThreshold:s,errorPrefix:"iterateOverDiff"}):void 0;if(v!=null){let k=v.fromStart+v.fromEnd;a+=k,l+=k}f.push({splitCount:a,unifiedCount:l})}return f}function N$(t,n,s){if(!t.isWindowedHighlight||n<=0)return[0,n];let a=[];function l(h){let g=Math.max(0,t.viewportStart-h),I=Math.min(n,t.viewportEnd-h);if(I>g)a.push([g,I])}if(s!=="split")l(t.unifiedCount);if(s!=="unified")l(t.splitCount);if(a.length===0)return[0,0];let d=a[0][0],f=a[0][1];for(let h=1;h<a.length;h++){let g=a[h];d=Math.min(d,g[0]),f=Math.max(f,g[1])}return[d,f]}function kd(t,n,s,a,l,d){let[f,h]=N$(t,n,s);if(f>0)t.incrementCounts(f,f),l?.();let g=f;while(g<n){if(d?.()===!0)return!0;if(g>=h){t.incrementCounts(n-g,n-g);break}if(t.isInWindow(0,0)){if(a(g)===!0)return!0}else t.incrementCounts(1,1);g++}return!1}function D$(t,n,s){if(!t.isWindowedHighlight)return[[0,s==="unified"?n.deletions+n.additions:Math.max(n.deletions,n.additions)]];let a=s!=="split",l=s!=="unified",d=s==="unified"?"unified":"split",f=[];function h(v,k){if(v+k<=t.viewportStart||v>=t.viewportEnd)return;let w=Math.max(0,t.viewportStart-v),P=Math.min(k,t.viewportEnd-v);return P>w?[w,P]:void 0}function g(v,k){if(d==="split")return v;return k==="additions"?[v[0]+n.deletions,v[1]+n.deletions]:v}function I(v,k){if(v==null)return;let[w,P]=g(v,k);if(P>w)f.push([w,P])}if(a)I(h(t.unifiedCount,n.deletions),"deletions"),I(h(t.unifiedCount+n.deletions,n.additions),"additions");if(l)I(h(t.splitCount,n.deletions),"deletions"),I(h(t.splitCount,n.additions),"additions");if(f.length===0)return f;f.sort((v,k)=>v[0]-k[0]);let b=[f[0]];for(let[v,k]of f.slice(1)){let w=b[b.length-1];if(v<=w[1])w[1]=Math.max(w[1],k);else b.push([v,k])}return b}function H$({hunkIndex:t,hunk:n,collapsedAfter:s,collapsedBefore:a,diffStyle:l,index:d,unifiedLineIndex:f,splitLineIndex:h,additionLineIndex:g,deletionLineIndex:I,additionLineNumber:b,deletionLineNumber:v,content:k,isLastContent:w,unifiedCount:P,splitCount:M}){let N=d<k.deletions?f+d:void 0,_=l==="unified"?d>=k.deletions?f+d:void 0:d<k.additions?f+k.deletions+d:void 0,O=l==="unified"?h+(d<k.deletions?d:d-k.deletions):h+d,B=d<k.deletions?I+d:void 0,X=d<k.deletions?v+d:void 0,z=l==="unified"?d>=k.deletions?g+(d-k.deletions):void 0:d<k.additions?g+d:void 0,K=l==="unified"?d>=k.deletions?b+(d-k.deletions):void 0:d<k.additions?b+d:void 0,W=l==="unified"?w&&d===k.deletions-1&&n.noEOFCRDeletions:w&&d===M-1&&n.noEOFCRDeletions,J=l==="unified"?w&&d===P-1&&n.noEOFCRAdditions:w&&d===M-1&&n.noEOFCRAdditions,ee=B!=null&&X!=null&&N!=null?{lineNumber:X,lineIndex:B,noEOFCR:W,unifiedLineIndex:N,splitLineIndex:O}:void 0,ce=z!=null&&K!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:O,lineIndex:z,lineNumber:K,noEOFCR:J}:void 0;if(ee==null&&ce!=null)return{type:"change",hunkIndex:t,hunk:n,collapsedAfter:s,collapsedBefore:a,deletionLine:void 0,additionLine:ce};else if(ee!=null&&ce==null)return{type:"change",hunkIndex:t,hunk:n,collapsedAfter:s,collapsedBefore:a,deletionLine:ee,additionLine:void 0};if(ee==null||ce==null)throw Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:t,hunk:n,collapsedAfter:s,collapsedBefore:a,deletionLine:ee,additionLine:ce}}class Qi{diff(t,n,s={}){let a;if(typeof s==="function")a=s,s={};else if("callback"in s)a=s.callback;let l=this.castInput(t,s),d=this.castInput(n,s),f=this.removeEmpty(this.tokenize(l,s)),h=this.removeEmpty(this.tokenize(d,s));return this.diffWithOptionsObj(f,h,s,a)}diffWithOptionsObj(t,n,s,a){var l;let d=(_)=>{if(_=this.postProcess(_,s),a){setTimeout(function(){a(_)},0);return}else return _},f=n.length,h=t.length,g=1,I=f+h;if(s.maxEditLength!=null)I=Math.min(I,s.maxEditLength);let b=(l=s.timeout)!==null&&l!==void 0?l:1/0,v=Date.now()+b,k=[{oldPos:-1,lastComponent:void 0}],w=this.extractCommon(k[0],n,t,0,s);if(k[0].oldPos+1>=h&&w+1>=f)return d(this.buildValues(k[0].lastComponent,n,t));let P=-1/0,M=1/0,N=()=>{for(let _=Math.max(P,-g);_<=Math.min(M,g);_+=2){let O,B=k[_-1],X=k[_+1];if(B)k[_-1]=void 0;let z=!1;if(X){let W=X.oldPos-_;z=X&&0<=W&&W<f}let K=B&&B.oldPos+1<h;if(!z&&!K){k[_]=void 0;continue}if(!K||z&&B.oldPos<X.oldPos)O=this.addToPath(X,!0,!1,0,s);else O=this.addToPath(B,!1,!0,1,s);if(w=this.extractCommon(O,n,t,_,s),O.oldPos+1>=h&&w+1>=f)return d(this.buildValues(O.lastComponent,n,t))||!0;else{if(k[_]=O,O.oldPos+1>=h)M=Math.min(M,_-1);if(w+1>=f)P=Math.max(P,_+1)}}g++};if(a)(function _(){setTimeout(function(){if(g>I||Date.now()>v)return a(void 0);if(!N())_()},0)})();else while(g<=I&&Date.now()<=v){let _=N();if(_)return _}}addToPath(t,n,s,a,l){let d=t.lastComponent;if(d&&!l.oneChangePerToken&&d.added===n&&d.removed===s)return{oldPos:t.oldPos+a,lastComponent:{count:d.count+1,added:n,removed:s,previousComponent:d.previousComponent}};else return{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:s,previousComponent:d}}}extractCommon(t,n,s,a,l){let d=n.length,f=s.length,h=t.oldPos,g=h-a,I=0;while(g+1<d&&h+1<f&&this.equals(s[h+1],n[g+1],l))if(g++,h++,I++,l.oneChangePerToken)t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1};if(I&&!l.oneChangePerToken)t.lastComponent={count:I,previousComponent:t.lastComponent,added:!1,removed:!1};return t.oldPos=h,g}equals(t,n,s){if(s.comparator)return s.comparator(t,n);else return t===n||!!s.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let s=0;s<t.length;s++)if(t[s])n.push(t[s]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,s){let a=[],l;while(t)a.push(t),l=t.previousComponent,delete t.previousComponent,t=l;a.reverse();let d=a.length,f=0,h=0,g=0;for(;f<d;f++){let I=a[f];if(!I.removed){if(!I.added&&this.useLongestToken){let b=n.slice(h,h+I.count);b=b.map(function(v,k){let w=s[g+k];return w.length>v.length?w:v}),I.value=this.join(b)}else I.value=this.join(n.slice(h,h+I.count));if(h+=I.count,!I.added)g+=I.count}else I.value=this.join(s.slice(g,g+I.count)),g+=I.count}return a}}class r0 extends Qi{}var i0=new r0;function _p(t,n,s){return i0.diff(t,n,s)}function Op(t,n){let s;for(s=0;s<t.length&&s<n.length;s++)if(t[s]!=n[s])return t.slice(0,s);return t.slice(0,s)}function $p(t,n){let s;if(!t||!n||t[t.length-1]!=n[n.length-1])return"";for(s=0;s<t.length&&s<n.length;s++)if(t[t.length-(s+1)]!=n[n.length-(s+1)])return t.slice(-s);return t.slice(-s)}function Td(t,n,s){if(t.slice(0,n.length)!=n)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(n)}; this is a bug`);return s+t.slice(n.length)}function wd(t,n,s){if(!n)return t+s;if(t.slice(-n.length)!=n)throw Error(`string ${JSON.stringify(t)} doesn't end with suffix ${JSON.stringify(n)}; this is a bug`);return t.slice(0,-n.length)+s}function fa(t,n){return Td(t,n,"")}function Rl(t,n){return wd(t,n,"")}function Fp(t,n){return n.slice(0,U$(t,n))}function U$(t,n){let s=0;if(t.length>n.length)s=t.length-n.length;let a=n.length;if(t.length<n.length)a=t.length;let l=Array(a),d=0;l[0]=0;for(let f=1;f<a;f++){if(n[f]==n[d])l[f]=l[d];else l[f]=d;while(d>0&&n[f]!=n[d])d=l[d];if(n[f]==n[d])d++}d=0;for(let f=s;f<t.length;f++){while(d>0&&t[f]!=n[d])d=l[d];if(t[f]==n[d])d++}return d}function Np(t,n){let s=[];for(let a of Array.from(n.segment(t))){let l=a.segment;if(s.length&&/\s/.test(s[s.length-1])&&/\s/.test(l))s[s.length-1]+=l;else s.push(l)}return s}function Rd(t,n){if(n)return pa(t,n)[1];let s;for(s=t.length-1;s>=0;s--)if(!t[s].match(/\s/))break;return t.substring(s+1)}function fs(t,n){if(n)return pa(t,n)[0];let s=t.match(/^\s*/);return s?s[0]:""}function pa(t,n){if(!n)return[fs(t),Rd(t)];if(n.resolvedOptions().granularity!="word")throw Error('The segmenter passed must have a granularity of "word"');let s=Np(t,n),a=s[0],l=s[s.length-1],d=/\s/.test(a)?a:"",f=/\s/.test(l)?l:"";return[d,f]}var Ld="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",B$=new RegExp(`[${Ld}]+|\\s+|[^${Ld}]`,"ug");class s0 extends Qi{equals(t,n,s){if(s.ignoreCase)t=t.toLowerCase(),n=n.toLowerCase();return t.trim()===n.trim()}tokenize(t,n={}){let s;if(n.intlSegmenter){let d=n.intlSegmenter;if(d.resolvedOptions().granularity!="word")throw Error('The segmenter passed must have a granularity of "word"');s=Np(t,d)}else s=t.match(B$)||[];let a=[],l=null;return s.forEach((d)=>{if(/\s/.test(d))if(l==null)a.push(d);else a.push(a.pop()+d);else if(l!=null&&/\s/.test(l))if(a[a.length-1]==l)a.push(a.pop()+d);else a.push(l+d);else a.push(d);l=d}),a}join(t){return t.map((n,s)=>{if(s==0)return n;else return n.replace(/^\s+/,"")}).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let s=null,a=null,l=null;if(t.forEach((d)=>{if(d.added)a=d;else if(d.removed)l=d;else{if(a||l)o0(s,l,a,d,n.intlSegmenter);s=d,a=null,l=null}}),a||l)o0(s,l,a,null,n.intlSegmenter);return t}}var G$=new s0;function o0(t,n,s,a,l){if(n&&s){let[d,f]=pa(n.value,l),[h,g]=pa(s.value,l);if(t){let I=Op(d,h);t.value=wd(t.value,h,I),n.value=fa(n.value,I),s.value=fa(s.value,I)}if(a){let I=$p(f,g);a.value=Td(a.value,g,I),n.value=Rl(n.value,I),s.value=Rl(s.value,I)}}else if(s){if(t){let d=fs(s.value,l);s.value=s.value.substring(d.length)}if(a){let d=fs(a.value,l);a.value=a.value.substring(d.length)}}else if(t&&a){let d=fs(a.value,l),[f,h]=pa(n.value,l),g=Op(d,f);n.value=fa(n.value,g);let I=$p(fa(d,g),h);n.value=Rl(n.value,I),a.value=Td(a.value,d,I),t.value=wd(t.value,d,d.slice(0,d.length-I.length))}else if(a){let d=fs(a.value,l),f=Rd(n.value,l),h=Fp(f,d);n.value=Rl(n.value,h)}else if(t){let d=Rd(t.value,l),f=fs(n.value,l),h=Fp(d,f);n.value=fa(n.value,h)}}class a0 extends Qi{tokenize(t){let n=new RegExp(`(\\r?\\n)|[${Ld}]+|[^\\S\\n\\r]+|[^${Ld}]`,"ug");return t.match(n)||[]}}var l0=new a0;function Dp(t,n,s){return l0.diff(t,n,s)}class u0 extends Qi{constructor(){super(...arguments);this.tokenize=j$}equals(t,n,s){if(s.ignoreWhitespace){if(!s.newlineIsToken||!t.includes(`
|
|
293
|
+
}`}function hd(t,n){let s=Lp(n);return t.replace(c$,s)}function d$(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var WS=new WeakMap;function ge(t){let n=WS.get(t);return n==null?t:n}function Gt(t,n){WS.set(t,n)}function ua(t,n,s){let a=new Map;for(let l of t){let d=ge(l);a.set(d,s?.slotNames.get(d)??n(l))}return{provided:t,current:t,slotNames:a}}function gd(t,n,s){for(let a of n){let l=ge(a);if(!t.slotNames.has(l))t.slotNames.set(l,s(a))}t.provided=n,t.current=n}function yd(t,n,s){if(t==null)return s(n);let a=ge(n),l=t.slotNames.get(a);if(l==null)l=s(n),t.slotNames.set(a,l);return l}function xd(t){return t?.useTokenTransformer===!0||t?.onTokenClick!=null||t?.onTokenEnter!=null||t?.onTokenLeave!=null}function Pp(t){return{theme:t?.theme,disableLineNumbers:t?.disableLineNumbers,overflow:t?.overflow,themeType:t?.themeType,collapsed:t?.collapsed,disableFileHeader:t?.disableFileHeader,disableVirtualizationBuffers:t?.disableVirtualizationBuffers,stickyHeader:t?.stickyHeader,preferredHighlighter:t?.preferredHighlighter,useCSSClasses:t?.useCSSClasses,useTokenTransformer:xd(t),tokenizeMaxLineLength:t?.tokenizeMaxLineLength,tokenizeMaxLength:t?.tokenizeMaxLength,unsafeCSS:t?.unsafeCSS,headerRenderMode:t?.renderCustomHeader!=null?"custom":"default"}}function ca({code:t,pre:n,columnType:s,rowSpan:a,containerSize:l=!1}={}){if(t==null){if(t=document.createElement("code"),t.setAttribute("data-code",""),s!=null)t.setAttribute(`data-${s}`,"");n?.appendChild(t)}if(a!=null)t.style.setProperty("grid-row",`span ${a}`);else t.style.removeProperty("grid-row");if(l)t.setAttribute("data-container-size","");else t.removeAttribute("data-container-size");return t}function vl(t,n){let s=t?.offsetHeight??0;if(t==null||s===0){n();return}t.style.minHeight=`${s}px`;try{n(),t.offsetHeight}finally{t.style.minHeight=""}}function Id({shadowRoot:t,currentNode:n,themeCSS:s}){if(s.trim()===""){n?.remove();return}if(n??=m$(),n.textContent=s,n.parentNode!==t)t.appendChild(n);return n}function m$(){let t=document.createElement("style");return t.setAttribute(VI,""),t}var f$=void 0;var p$=void 0;function fe(){return f$??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(h$())}function oe(){return p$??="safari"in window&&"pushNotification"in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function h$(){let t=globalThis.navigator;return t?.platform??t?.userAgentData?.platform??"unknown"}function Sd(t,n){if(n==null)return;let s=t.shadowRoot??t.attachShadow({mode:"open"});if(s.innerHTML==="")s.innerHTML=n}function bd(t,{type:n,diffIndicators:s,disableBackground:a,disableLineNumbers:l,overflow:d,split:f,totalLines:h,customProperties:g}){if(g!=null)for(let I in g){let b=g[I];if(b!=null)t.setAttribute(I,`${b}`)}if(n==="diff")t.setAttribute("data-diff",""),t.removeAttribute("data-file");else t.setAttribute("data-file",""),t.removeAttribute("data-diff");switch(s){case"bars":case"classic":t.setAttribute("data-indicators",s);break;case"none":t.removeAttribute("data-indicators")}if(l)t.setAttribute("data-disable-line-numbers","");else t.removeAttribute("data-disable-line-numbers");if(a)t.removeAttribute("data-background");else t.setAttribute("data-background","");if(n==="diff")t.setAttribute("data-diff-type",f?"split":"single");else t.removeAttribute("data-diff-type");return t.setAttribute("data-overflow",d),t.style.setProperty("--diffs-min-number-column-width-default",`${`${h}`.length}ch`),t}if(typeof HTMLElement<"u"&&customElements.get("diffs-container")==null){let t;class n extends HTMLElement{constructor(){super();if(this.shadowRoot!=null)return;let s=this.attachShadow({mode:"open"});if(t==null)t=new CSSStyleSheet,t.replaceSync(Ap);s.adoptedStyleSheets=[t]}connectedCallback(){let s=this.shadowRoot??this.attachShadow({mode:"open"});To(s)}}customElements.define(Dc,n)}var g$=[""];function y$(t){let n={...t};return delete n.cacheKey,n}var x$=-1,Ue=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++x$}`;type="file";fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(t={theme:u},n,s=!1){this.options=t,this.workerManager=n,this.isContainerManaged=s,this.fileRenderer=new jS(t,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new Vc,this.interactionManager=new Kc("file",la(t)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=(t)=>yd(this.editSession?.annotations,t,S);handleHighlightRender=()=>{this.rerender()};rerender(){if(!this.enabled||this.file==null)return;this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??u}getLatestFile(t=this.file){return this.editSession?.file??t}getRenderedFile(){return this.renderedFile}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(t){let n=this.editSession?.annotations;if(t===this.lineAnnotations)return!1;return n==null||t!==n.provided&&t!==n.current}updateExternalFile(t,n){if(an(this.file,t))return!1;let s=this.editSession!=null;if(this.file=t,s||this.editor!=null)this.installEditSession(t,s?void 0:this.editor?.__getDocumentContents(t),!0);else this.editSession=void 0;if(this.editSession?.annotations!=null&&n!=null)this.lineAnnotations=n,this.editSession.annotations=ua(n,S,this.editSession.annotations);return!0}installEditSession(t,n,s=!1){let a=n==null||n.name===t.name&&n.lang===t.lang&&n.contents===t.contents,l=y$(n??t);this.editSession={file:l,externalReplacement:s&&a,annotations:this.editSession?.annotations??ua(this.lineAnnotations,S)},this.fileRenderer.beginEditSession(l,a?t:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(t){if(t==null)return;this.options=t,this.cachedHeaderHTML=void 0,this.syncInteractionOptions()}syncInteractionOptions(){this.interactionManager.setOptions(la(this.options))}mergeOptions(t){this.options={...this.options,...t}}setThemeType(t){if((this.options.themeType??"system")===t)return;this.mergeOptions({themeType:t}),this.applyCachedThemeState(t)}applyCachedThemeState(t){if(typeof this.options.theme==="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let n=this.appliedThemeCSS.baseThemeType??t;if(this.appliedThemeCSS.themeType===n)return!1;return this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,t,this.appliedThemeCSS.baseThemeType),!0}hasThemeChanged(){return this.appliedThemeCSS!=null&&!E(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(t){let n=this.editSession?.annotations;if(n==null){this.lineAnnotations=t;return}if(!this.isNewAnnotations(t))return;this.lineAnnotations=t,gd(n,t,S)}syncEditSessionAnnotationsFromEditor(t){let n=this.editSession?.annotations;if(n==null||t===n.current)return!1;return n.current=t,this.fileRenderer.setLineAnnotations(t),this.renderAnnotations(),!0}setSelectedLines(t,n){this.interactionManager.setSelection(t,n)}setEditorActiveLine(t,n){this.interactionManager.setEditorActiveLine(t,{lineNumberOnly:n?.lineNumberOnly,side:n?.side??"additions"})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(t){if(this.code!=null)this.code.scrollLeft=t}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t==="wrap",columnVariables:this.shouldApplyColumnVariables(t)?"apply":"measure"}),this.managersDirty=!1}shouldApplyColumnVariables(t){return t==="scroll"&&this.getLatestAnnotations().length>0}cleanUp(t=!1){let n=this.editor;if(this.emitPostRender(!0),n?.cleanUp(t?"recycle":"discard"),!t)this.editor=void 0;if(this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,!this.isContainerManaged)this.fileContainer?.remove();if(this.fileContainer=void 0,this.mounted=!1,!t)this.lineAnnotations=[];if(this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,!t)this.cachedHeaderHTML=void 0;if(this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,t)this.fileRenderer.recycle();else this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0;this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(t){let{fileContainer:n,prerenderedHTML:s,preventEmit:a=!1,file:l,lineAnnotations:d}=t;if(!this.enabled)throw Error("File.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw Error("File.hydrate: hydrate can only be called before the instance has rendered or hydrated");this.hydrateElements(n,s);let f=this.editor!=null;if(f||I$(this.pre,l,this.options.collapsed)||S$(this.headerElement,l,this.options.disableFileHeader))this.render({...t,forceRender:f||t.forceRender,preventEmit:!0});else this.hydrationSetup({file:l,lineAnnotations:d});if(!a)this.emitPostRender()}hydrateElements(t,n){if(this.fileContainer!==t)this.emitPostRender(!0);Sd(t,n);for(let s of Array.from(t.shadowRoot?.children??[])){if(s instanceof SVGElement){this.spriteSVG=s;continue}if(!(s instanceof HTMLElement))continue;if(s instanceof HTMLPreElement){this.pre=s,this.appliedPreAttributes=void 0;continue}if(s instanceof HTMLStyleElement&&s.hasAttribute("data-theme-css")){this.themeCSSStyle=s;continue}if(s instanceof HTMLStyleElement&&s.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=s,this.appliedUnsafeCSS=s.textContent;continue}if("diffsHeader"in s.dataset){this.headerElement=s,this.lastRenderedHeaderHTML=void 0;continue}}if(this.pre!=null)this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute("data-dehydrated");this.fileContainer=t,this.hydrateMeasuredScrollbar()}hydrationSetup({file:t,lineAnnotations:n}){if(this.lineAnnotations=n??this.lineAnnotations,this.file=t,this.fileRenderer.setOptions(Pp(this.options)),this.syncInteractionOptions(),this.pre==null)return;this.fileRenderer.hydrate(t),this.renderedFile=t,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers()}getOrCreateLineCache(t=this.getLatestFile()){return t!=null?this.fileRenderer.getOrCreateLineCache(t):g$}updateBuffers(t){if(this.pre!=null)this.applyBuffers(this.pre,t)}syncRenderViewToEditor(){let{editor:t,fileContainer:n,renderRange:s}=this,a=this.getLatestAnnotations(),l=this.getLatestFile();if(t==null||n==null||l==null)return;let d=(I)=>{if(!this.enabled||this.editor!==t||this.fileContainer!==n||this.getLatestFile()!==l)return;t.__syncRenderView({highlighter:I,fileContainer:n,file:l,lineAnnotations:a,renderRange:s,externalDocument:this.editSession?.externalReplacement===!0})},f=this.getTheme(),h=l.lang??p(l.name),g=T({theme:f,lang:h});if(g!=null)d(g);else j({themes:C(f),langs:Array.from(new Set(["text",h])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(d)}__acknowledgeDocumentUpdate(){if(this.editSession!=null)this.editSession.externalReplacement=!1}__acceptEditorChange(t){let{lineAnnotations:n}=t;if(n!=null)this.syncEditSessionAnnotationsFromEditor(n)}emitEditChange(t){let{onEditChange:n}=this.options;n?.(t)}__captureDocumentSessionState(){}__attachEditor(t){if(this.editor!=null)throw Error("File.__attachEditor: an editor is already attached");this.editor=t;let n=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(t),n}catch(s){throw n(),s}}__resumeEditor(t){if(this.editor!==t)throw Error("File.__resumeEditor: editor association changed");this.resumeEditorRendering(t)}resumeEditorRendering(t){if(this.editSession!=null)this.fileRenderer.beginEditSession(this.editSession.file);else if(this.file!=null)this.installEditSession(this.file,t.__getDocumentContents(this.file));let n=this.editSession?.file;if(this.fileRenderer.editorRenderReady()){if(this.fileRenderer.fileCache===n)this.renderedFile=n;this.syncRenderViewToEditor()}else this.rerender()}__completeEditSession(t,n){this.settleEditSession(n==="install",t)}settleEditSession(t,n){let{editSession:s,file:a,lineAnnotations:l}=this;if(s==null||a==null)return;let{file:d,annotations:f}=s;if(this.editor!=null)throw Error("File.__completeEditSession: detach the editor before completing the session");let h=f?.current,g,I=!1,b;if(n==null)throw Error("File.__completeEditSession: editor is required for completion");let v={...d},k={file:v,editor:n,originalFile:a,lineAnnotations:h,originalLineAnnotations:l};Object.freeze(k);try{if(n.__emitEditComplete(k),this.options.onEditComplete?.(k)==="accept"){if(v.cacheKey!=null&&v.cacheKey===a.cacheKey)throw Error("File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey");g=v}}catch(M){I=!0,b=M}if(t&&g!=null){if(this.file=g,h!=null)this.lineAnnotations=h}this.editSession=void 0;let{renderedFile:w,file:P}=this;if(this.fileRenderer.endEditSession(P),w!=null&&P!=null&&w!==P&&an(w,P))this.renderedFile=P;if(t&&this.fileContainer!=null)this.rerender();if(I)throw b}applyDocumentChange(t,n){let s=this.editSession?.file;if(s==null)throw Error("File.applyDocumentChange: requires an active edit session");if(this.fileRenderer.beginEditSession(s),this.fileRenderer.applyDocumentChange(t),n!=null)this.syncEditSessionAnnotationsFromEditor(n)}applySuspendedDocumentChange(t,n){if(this.editSession==null)return;this.applyDocumentChange(t,n),this.fileRenderer.clearRenderCache()}updateRenderCache(t,n,s){let a=this.editSession?.file;if(a==null)throw Error("File.updateRenderCache: requires an active edit session");this.fileRenderer.beginEditSession(a),this.fileRenderer.updateRenderCache(t,n,s?.lineCountChangeInFlight)}render({file:t,fileContainer:n,forceRender:s=!1,preventEmit:a=!1,containerWrapper:l,deferManagers:d=!1,lineAnnotations:f,renderRange:h}){if(!this.enabled)throw Error("File.render: attempting to call render after cleaned up");this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:g=!1,themeType:I="system"}=this.options,b=g?void 0:h,v=this.renderRange,k=this.hasThemeChanged(),w=f!=null&&(f.length>0||this.getLatestAnnotations().length>0)?this.isNewAnnotations(f):!1,P=!an(this.file,t);if(P)this.updateExternalFile(t,f);let M=this.getLatestFile(t)??t;if(!g&&!s&&ko(b,this.renderRange)&&!P&&!w&&!k){let O=this.applyCachedThemeState(I);if(O)this.finalizeRender();return O}if(this.renderRange=b,P)this.cachedHeaderHTML=void 0;if(this.fileRenderer.setOptions(Pp(this.options)),this.syncInteractionOptions(),f!=null)this.setLineAnnotations(f);this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:N=!1,disableFileHeader:_=!1}=this.options;if(_){if(this.headerElement!=null)this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0;this.clearHeaderSlots()}if(n=this.getOrCreateFileContainerNode(n,l),this.applyCachedThemeState(I),g){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let O=this.fileRenderer.renderFile(M,Uc);if(O!=null)this.applyThemeState(n,O.themeStyles,I,O.baseThemeType);if(O?.headerAST!=null)this.applyHeaderToDOM(O.headerAST,n,O.file);this.renderedFile=O?.file??M,this.injectUnsafeCSS()}catch(O){if(N)throw O;if(console.error(O),O instanceof Error)this.applyErrorToDOM(O,n)}if(this.finalizeRender(),!a)this.emitPostRender();return!0}try{let O=this.getOrCreatePreNode(n);if(!this.canPartiallyRender(s,w,P||k||!an(this.renderedFile,M))||!this.applyPartialRender(M,v,b)){let B=this.fileRenderer.renderFile(M,b);if(B==null){if(this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool())this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender());return!1}if(this.applyThemeState(n,B.themeStyles,I,B.baseThemeType),B.headerAST!=null)this.applyHeaderToDOM(B.headerAST,n,B.file);this.applyFullRender(B,O),this.renderedFile=B.file}if(this.applyBuffers(O,b),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,!d)this.flushManagers();if(this.finalizeRender(),this.editor!=null)this.syncRenderViewToEditor()}catch(O){if(N)throw O;if(console.error(O),O instanceof Error)this.applyErrorToDOM(O,n)}if(!a)this.emitPostRender();return!0}finalizeRender(){}emitPostRender(t=!1){let{fileContainer:n,options:{onPostRender:s}}=this;if(t){if(!this.mounted)return;if(this.mounted=!1,n==null)return;s?.(n,this,"unmount");return}if(n==null)return;let a=this.mounted?"update":"mount";this.mounted=!0,s?.(n,this,a)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:t}of this.annotationCache.values())t.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(t,n,s){if(t||n||s)return!1;return!0}renderPlaceholder(t){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let n=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",n.appendChild(this.placeHolder)}return this.setPlaceholderHeight(t)}setPlaceholderHeight(t){if(this.placeHolder==null)return!1;return this.placeHolder.style.setProperty("height",`${t}px`),!0}async primeHighlightCache(t=this.file){let{workerManager:n}=this;if(t==null||n==null||!n.isWorkingPool()||t.cacheKey==null||V(t))return;let s=this.options.tokenizeMaxLength??1e5;if(this.fileRenderer.getOrCreateLineCache(t).length>s)return;await n.primeFileHighlightCache(t).catch((a)=>{console.error(a)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:a}of this.annotationCache.values())a.remove();this.annotationCache.clear();return}let t=new Map(this.annotationCache),{renderAnnotation:n}=this.options,s=this.getLatestAnnotations();if(n!=null&&s.length>0)for(let[a,l]of s.entries()){let d=this.getAnnotationSlotName(l),f=`${a}-${d}`,h=this.annotationCache.get(f);if(h==null||!qS(l,h.annotation)){h?.element.remove();let g=n(l);if(g==null)continue;h={element:ud(d),annotation:l},h.element.appendChild(g),this.fileContainer.appendChild(h.element),this.annotationCache.set(f,h)}t.delete(f)}for(let[a,{element:l}]of t.entries())this.annotationCache.delete(a),l.remove()}renderGutterUtility(){let{renderGutterUtility:t}=this.options;if(this.fileContainer==null||t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=t(this.interactionManager.getHoveredLine);if(n!=null&&this.gutterUtilityContent!=null)return;else if(n==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let s=cd();s.appendChild(n),this.fileContainer.appendChild(s),this.gutterUtilityContent=s}injectUnsafeCSS(){let{unsafeCSS:t}=this.options,n=this.fileContainer?.shadowRoot;if(n==null)return;if(t==null||t===""){if(this.unsafeCSSStyle!=null)this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0;this.appliedUnsafeCSS=void 0;return}if(this.unsafeCSSStyle?.parentNode===n&&this.appliedUnsafeCSS===t)return;if(this.unsafeCSSStyle??=dd(),this.unsafeCSSStyle.parentNode!==n)n.appendChild(this.unsafeCSSStyle);this.unsafeCSSStyle.textContent=fd(t),this.appliedUnsafeCSS=t}applyThemeState(t,n,s,a){let l=t.shadowRoot??t.attachShadow({mode:"open"}),d=a??s,f=this.getTheme(),h=typeof f==="string"?f:{...f},g=To(l);if(this.themeCSSStyle?.parentNode===l&&this.appliedThemeCSS?.themeStyles===n&&this.appliedThemeCSS.themeType===d&&this.appliedThemeCSS.scrollbarGutter===g){this.appliedThemeCSS.theme=h;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===l){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:h,themeStyles:n,themeType:d,baseThemeType:a,scrollbarGutter:g};return}this.themeCSSStyle=Id({shadowRoot:l,currentNode:this.themeCSSStyle,themeCSS:pd(n,d,g)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:h,themeStyles:n,themeType:d,baseThemeType:a,scrollbarGutter:g}:void 0}hydrateMeasuredScrollbar(){let t=this.fileContainer?.shadowRoot;if(t==null||this.themeCSSStyle==null)return;this.themeCSSStyle.textContent=hd(this.themeCSSStyle.textContent??"",To(t))}shouldGuardRebuildScroll(){return this.editor!=null&&oe()}applyFullRender(t,n){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(n,t);let s=this.code=ca({code:this.code}),a=this.fileRenderer.renderCodeAST(t);this.editor?.__captureFocusForDOMReplacement();let l=()=>{if(s.childElementCount>=2)for(let d=0;d<2;d++){let f=s.children[d],h=a[d];f.innerHTML=pn(h.children),f.style.cssText=h.properties.style}else s.innerHTML=pn(a);if(!n.contains(s))n.replaceChildren(s)};if(this.shouldGuardRebuildScroll())vl(n,l);else l();this.lastRowCount=t.rowCount}applyPartialRender(t,n,s){if(n==null||s==null)return!1;let{code:a}=this,l=a!=null?this.getColumns(a):void 0;if(a==null||l==null)return!1;let d=n.startingLine,f=s.startingLine,h=n.totalLines===1/0?Number.POSITIVE_INFINITY:d+n.totalLines,g=s.totalLines===1/0?Number.POSITIVE_INFINITY:f+s.totalLines,I=Math.max(d,f),b=Math.min(h,g);if(b<=I)return!1;if(!this.trimDOMToOverlap(l.gutter,I,b)||!this.trimDOMToOverlap(l.content,I,b))throw Error("File.applyPartialRender: failed to trim to overlap");let{length:v}=l.content.children,k=(N,_)=>{if(_<=0)return;return this.fileRenderer.renderFile(t,{startingLine:N,totalLines:_,bufferBefore:0,bufferAfter:0})},w=f<I?k(f,I-f):void 0;if(w===void 0&&f<I)return!1;let P=g===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Math.max(0,g-b),M=g>b?k(b,P):void 0;if(M===void 0&&g>b)return!1;if(this.cleanupErrorWrapper(),w!=null)l.gutter.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(w.gutterAST)),l.content.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(w.contentAST)),v+=w.rowCount;if(M!=null)l.gutter.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(M.gutterAST)),l.content.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(M.contentAST)),v+=M.rowCount;if(this.lastRowCount!==v)l.gutter.style.setProperty("grid-row",`span ${v}`),l.content.style.setProperty("grid-row",`span ${v}`),this.lastRowCount=v;return!0}getColumns(t){let n=t.children[0],s=t.children[1];if(!(n instanceof HTMLElement)||!(s instanceof HTMLElement)||n.dataset.gutter==null||s.dataset.content==null)return;return{gutter:n,content:s}}trimDOMToOverlap(t,n,s){let a=this.getDOMBoundaryIndices(t,[n,s]),l=a.get(n)??t.children.length,d=a.get(s)??t.children.length;if(l>d)return!1;for(let f=t.children.length-1;f>=d;f-=1)t.children[f]?.remove();for(let f=l-1;f>=0;f-=1)t.children[f]?.remove();return!0}getDOMBoundaryIndices(t,n){let s=[...new Set(n)].sort((h,g)=>h-g),a=new Map;if(s.length===0)return a;let l=0,d=s[l],{children:f}=t;if(d===0)a.set(0,0),l+=1,d=s[l];for(let h=0;h<f.length;h+=1){let g=f[h];if(!(g instanceof HTMLElement))continue;let I=this.getLineIndexFromDOMNode(g);if(I==null)continue;while(d!=null&&I>=d)a.set(d,h),l+=1,d=s[l];if(l>=s.length)break}for(let h of s)if(!a.has(h))a.set(h,f.length);return a}getLineIndexFromDOMNode(t){let n=t.dataset.lineIndex;if(n==null)return;let s=Number(n);return Number.isNaN(s)?void 0:s}applyBuffers(t,n){if(n==null||this.shouldDisableVirtualizationBuffers()){if(this.bufferBefore!=null)this.bufferBefore.remove(),this.bufferBefore=void 0;if(this.bufferAfter!=null)this.bufferAfter.remove(),this.bufferAfter=void 0;return}if(n.bufferBefore>0){if(this.bufferBefore==null)this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",t.before(this.bufferBefore);this.bufferBefore.style.setProperty("height",`${n.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")}else if(this.bufferBefore!=null)this.bufferBefore.remove(),this.bufferBefore=void 0;if(n.bufferAfter>0){if(this.bufferAfter==null)this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",t.after(this.bufferAfter);this.bufferAfter.style.setProperty("height",`${n.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")}else if(this.bufferAfter!=null)this.bufferAfter.remove(),this.bufferAfter=void 0}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(t,n,s){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let a=this.cachedHeaderHTML??pn(t);if(this.cachedHeaderHTML=a,a!==this.lastRenderedHeaderHTML){let g=document.createElement("div");g.innerHTML=a;let I=g.firstElementChild;if(!(I instanceof HTMLElement))return;if(this.headerElement!=null)n.shadowRoot?.replaceChild(I,this.headerElement);else n.shadowRoot?.prepend(I);this.headerElement=I,this.lastRenderedHeaderHTML=a}if(this.isContainerManaged)return;let{renderHeaderPrefix:l,renderHeaderFilenameSuffix:d,renderCustomHeader:f,renderHeaderMetadata:h}=this.options;if(f!=null){let g=f(s)??void 0;this.headerCustom=this.upsertHeaderSlotElement(n,this.headerCustom,Qs,g),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let g=l?.(s)??void 0,I=d?.(s)??void 0,b=h?.(s)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(n,this.headerPrefix,Xs,g),this.headerFilenameSuffix=this.upsertHeaderSlotElement(n,this.headerFilenameSuffix,Ys,I),this.headerMetadata=this.upsertHeaderSlotElement(n,this.headerMetadata,Js,b),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(t,n,s,a){if(a==null){n?.remove();return}let l=n??this.createHeaderSlotElement(s);if(n==null)t.appendChild(l);return this.replaceHeaderSlotContent(l,a),l}replaceHeaderSlotContent(t,n){if(t.replaceChildren(),n instanceof Element)t.appendChild(n);else t.innerText=`${n}`}createHeaderSlotElement(t){let n=document.createElement("div");return n.slot=t,n}getOrCreateFileContainerNode(t,n){let{fileContainer:s}=this,a=t??s??document.createElement("diffs-container"),l=s!==a;if(s!=null&&l)this.editor?.__captureFocusForDOMReplacement();if(l)this.emitPostRender(!0);if(this.fileContainer=a,s!=null&&l)this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0;if(n!=null&&this.fileContainer.parentNode!==n)n.appendChild(this.fileContainer);if(l)this.adoptReusableShellElements(this.fileContainer);return this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(t){let{shadowRoot:n}=t;if(n==null)return;for(let s of n.children)if(s instanceof SVGElement)this.spriteSVG??=s;else if(Co(s)&&s.hasAttribute("data-theme-css"))this.themeCSSStyle??=s,this.hasAdoptedThemeCSS=!0;else if(Co(s)&&s.hasAttribute("data-unsafe-css"))this.unsafeCSSStyle??=s,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0}ensureSpriteSVG(t){let n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.spriteSVG==null){let s=document.createElement("div");s.innerHTML=ad;let a=s.firstChild;if(a instanceof SVGElement)this.spriteSVG=a}if(this.spriteSVG!=null&&this.spriteSVG.parentNode!==n)n.appendChild(this.spriteSVG)}getOrCreatePreNode(t){let n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.pre==null)this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.code=void 0,n.appendChild(this.pre);else if(this.pre.parentNode!==n)this.editor?.__captureFocusForDOMReplacement(),t.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0;return this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(t){this.code=void 0;for(let n of Array.from(t.children)){if(!(n instanceof HTMLElement))continue;if(n.hasAttribute("data-code")){this.code=n;return}}}applyPreNodeAttributes(t,{totalLines:n}){let{overflow:s="scroll",disableLineNumbers:a=!1}=this.options,l={type:"file",split:!1,overflow:s,disableLineNumbers:a,diffIndicators:"none",disableBackground:!0,totalLines:n};if(ld(l,this.appliedPreAttributes))return;bd(t,l),this.appliedPreAttributes=l}applyErrorToDOM(t,n){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let s=n.shadowRoot??n.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",s.appendChild(this.errorWrapper);let a=document.createElement("div");a.dataset.errorMessage="",a.innerText=t.message,this.errorWrapper.appendChild(a);let l=document.createElement("pre");l.dataset.errorStack="",l.innerText=t.stack??"No Error Stack",this.errorWrapper.appendChild(l)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function I$(t,n,s=!1){return!s&&t==null&&n!=null}function S$(t,n,s=!1){return t==null&&n!=null&&!s}var b$=5000,Cd=new Map,C$=-1;function E$(t,n){return(t.overflow??"scroll")!==(n.overflow??"scroll")||(t.collapsed??!1)!==(n.collapsed??!1)||(t.disableLineNumbers??!1)!==(n.disableLineNumbers??!1)||(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||t.unsafeCSS!==n.unsafeCSS}var XS=class extends Ue{virtualizer;metrics;__id=`virtualized-file:${++C$}`;renderType="virtualized";top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:Cd};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(t,n,s=fl,a,l=!1){super(t,a,l);this.virtualizer=n,this.metrics=s}setMetrics(t,n=!1){let s=aa(t);if(!n&&vi(this.metrics,s))return;this.metrics=s,this.resetLayoutCache()}setLineAnnotations(t){if(this.syncLineAnnotations(t))this.forceRenderOverride=!0}syncLineAnnotations(t){if(t==null||!this.isNewAnnotations(t))return!1;if(t.length===0&&this.getLatestAnnotations().length===0)return!1;return super.setLineAnnotations(t),!0}syncEditSessionAnnotationsFromEditor(t){if(super.syncEditSessionAnnotationsFromEditor(t))return this.forceRenderOverride=!0,!0;return!1}hasLineAnnotations(){return this.getLatestAnnotations().some((t)=>t.lineNumber>0)}hasUniformLineHeights(){let{overflow:t="scroll"}=this.options;return t==="scroll"&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(t,n=!1){let s=this.cache.heights.get(t);if(s!=null)return s;let a=n?2:1;return this.metrics.lineHeight*a}setOptions(t){if(this.isAdvancedMode())throw Error("VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(t==null)return;let{options:n}=this,s=!oa(n,t),a=E$(n,t);if(super.setOptions(t),a)this.resetLayoutCache(!0);if(s)this.forceRenderOverride=!0;if(s)this.virtualizer.instanceChanged(this,a)}setThemeType(t){if(this.isAdvancedMode())throw Error("VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(t)}resetLayoutCache(t=!1,n=!0){if(this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0)this.cache.heights.clear();if(this.cache.checkpoints.length>0)this.cache.checkpoints.length=0;if(this.cache.ghostTextRows=Cd,this.renderRange!=null&&n)this.renderRange=void 0;if(t&&this.isSimpleMode())this.computeApproximateSize()}applyGhostTextRows(t){let{heights:n,ghostTextRows:s}=this.cache;if(s===t)return!1;let{lineHeight:a}=this.metrics,l=!1;for(let d of new Set([...s.keys(),...t.keys()])){let f=s.get(d)??0,h=t.get(d)??0;if(h===f)continue;let g=(n.get(d)??a)-f*a+h*a;if(g===a)n.delete(d);else n.set(d,g);l=!0}return this.cache.ghostTextRows=t,l}reconcileHeights(){let t=!1;if(this.fileContainer==null||this.getLayoutFile()==null){if(this.height!==0)t=!0;return this.height=0,t}let{overflow:n="scroll"}=this.options;this.top=this.getVirtualizedTop();let s=this.editor?.__getGhostTextRows()??Cd;t=this.applyGhostTextRows(s);let a=n!=="scroll"||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!a&&this.cache.heights.size===0&&this.cache.fileAnnotationHeight===0){if(t)this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height);return t}let{lineHeight:l}=this.metrics;if(this.code==null)return t;let d=this.code.children[1];if(!(d instanceof HTMLElement))return t;if(this.renderRange!=null&&Eo(this.renderRange)){let f=v$(d)??0;if(f!==this.cache.fileAnnotationHeight)this.cache.fileAnnotationHeight=f,t=!0}for(let f of d.children){if(!(f instanceof HTMLElement))continue;let h=f.dataset.lineIndex;if(h==null)continue;let g=Number(h),I=(s.get(g)??0)*l,b=this.cache.heights.get(g);if(!a&&(b==null||b===l+I))continue;let v=f.getBoundingClientRect().height+I,k=!1;if(f.nextElementSibling instanceof HTMLElement&&(("lineAnnotation"in f.nextElementSibling.dataset)||("noNewline"in f.nextElementSibling.dataset))){if("noNewline"in f.nextElementSibling.dataset)k=!0;v+=f.nextElementSibling.getBoundingClientRect().height}let w=this.getLineHeight(g,k);if(v===w)continue;if(t=!0,v===this.metrics.lineHeight*(k?2:1))this.cache.heights.delete(g);else this.cache.heights.set(g,v)}if(t||this.isResizeDebuggingEnabled())this.computeApproximateSize(!0);return t}onRender=(t)=>{if(this.fileContainer==null||this.file==null)return!1;if(t)this.top=this.getVirtualizedTop();return this.render({file:this.file})};updateCodeViewLayout(t,n,s,a){let l=!an(this.file,t);if(l)this.updateExternalFile(t,a);let{pendingRenderFile:d,layoutFileChanged:f,renderedFileChanged:h,annotationsChanged:g}=this.updatePendingRender(t,a),I=s?.resetFileLayoutCache===!0||f;if(s?.metrics!=null)this.metrics=s.metrics,I=!0;let{collapsed:b=!1}=this.options;if(this.currentCollapsed!==b)this.currentCollapsed=b,I=!0;if(I)this.resetLayoutCache();if(l)this.layoutDirty=!0;if(!this.forceRenderOverride&&(l||h||g))this.forceRenderOverride=!0;return this.top=n,this.computeApproximateSize(!1,d),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(t){let n=this.getLayoutFile();if(n==null||t<1)return;let{disableFileHeader:s=!1,collapsed:a=!1}=this.options,l=this.fileRenderer.getLineCount(n)-1,d=Mr(this.metrics,s);if(a||l<0)return{top:d,height:0};let f=Math.min(Math.max(t-1,0),l),{lineHeight:h}=this.metrics;if(d+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:d+f*h,height:h};let g=this.getLayoutCheckpointBeforeLineIndex(f);d=g?.top??d;for(let I=g?.lineIndex??0;I<f;I++)d+=this.getLineHeight(I,!1);return{top:d,height:this.getLineHeight(f,!1)}}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(t){let n=this.getLayoutFile();if(n==null||this.renderRange==null)return;let{disableFileHeader:s=!1,collapsed:a=!1}=this.options;if(a||this.renderRange.totalLines<=0)return;let l=this.fileRenderer.getLineCount(n)-1;if(l<0)return;let d=Mr(this.metrics,s),f=Math.min(this.renderRange.startingLine,l),h=Math.min(f+this.renderRange.totalLines-1,l);if(h<f)return;let{fileAnnotationHeight:g}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:b}=this.metrics,v=d+(f===0?g:this.renderRange.bufferBefore),k=f+Math.max(Math.ceil((t-v)/b),0);if(k>h)return;return{lineNumber:k+1,top:d+g+k*b}}let I=d+(f===0?g:this.renderRange.bufferBefore);for(let b=f;b<=h;b++){if(I>=t)return{lineNumber:b+1,top:I};I+=this.getLineHeight(b)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(t){let n=this.getLayoutFile();if(this.top==null||n==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let s=t!=null?this.computeRenderRangeFromWindow(n,this.top,t):this.renderRange;if(s==null)return;let{bufferBefore:a,bufferAfter:l,totalLines:d}=s,f=0;if(d===0){let h=t??this.virtualizer.getWindowSpecs();if(this.top<h.top)f=l}return{topOffset:this.top+a+f,height:this.height-(a+l)}}cleanUp(t=!1){let n=this.cache.ghostTextRows.size>0;if(n)this.layoutDirty=!0;let s=t&&this.isAdvancedMode()&&this.fileContainer!=null&&(n||!an(this.getRenderedFile(),this.getLatestFile()));if(this.fileContainer!=null&&this.isSimpleMode())this.getSimpleVirtualizer()?.disconnect(this.fileContainer);if(!t)this.resetLayoutCache();if(this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(t),s)this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(t=!1,n=this.getLayoutFile()){let s=this.isResizeDebuggingEnabled();if(!t&&!this.layoutDirty&&!s)return;let a=this.height===0;if(this.height=0,this.cache.checkpoints=[],n==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??Cd);let{disableFileHeader:l=!1,collapsed:d=!1}=this.options,{lineHeight:f}=this.metrics,h=this.fileRenderer.getLineCount(n),g=Mr(this.metrics,l),I=ss(this.metrics);if(this.height+=g,d){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=h*f;else for(let b=0;b<h;b++)this.addLayoutCheckpoint(b,this.height),this.height+=this.getLineHeight(b,!1);if(h>0)this.height+=I;if(this.fileContainer!=null&&s&&!a){let b=this.fileContainer.getBoundingClientRect();if(b.height!==this.height)console.log("VirtualizedFile.computeApproximateSize: computed height doesnt match",{name:n.name,elementHeight:b.height,computedHeight:this.height});else console.log("VirtualizedFile.computeApproximateSize: computed height IS CORRECT")}this.layoutDirty=!1}setVisibility(t){if(this.isAdvancedMode()||this.fileContainer==null)return;if(this.renderRange=void 0,t&&!this.isVisible)this.top=this.getVirtualizedTop(),this.isVisible=!0;else if(!t&&this.isVisible)this.isVisible=!1,this.rerender()}rerender(){if(!this.enabled||this.file==null)return;let t=this.getLatestFile(),n=t==null?void 0:this.fileRenderer.getFileForNextRender(t);if(this.isSimpleMode())this.pendingRender=void 0;this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!an(this.getRenderedFile(),n))}syncGhostTextRows(){let t=this.getAdvancedVirtualizer();if(t!=null)t.capturePendingLayoutAnchor(),this.layoutDirty=!0,t.instanceChanged(this,!0);else this.getSimpleVirtualizer()?.requestHeightReconcile(this)}applyDocumentChange(t,n,s=!1){let{renderRange:a}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(t,n),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1);let l=this.getRenderedFile();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(s&&a!=null&&l!=null){let d=this.virtualizer.getWindowSpecs(),f=this.computeRenderRangeFromWindow(l,this.top??0,d);if(f.bufferAfter!==a.bufferAfter)this.updateBuffers(f)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}render({fileContainer:t,file:n,forceRender:s=!1,lineAnnotations:a,...l}){let d=!an(this.file,n);if(d)this.updateExternalFile(n,a),this.cachedHeaderHTML=void 0;let{pendingRenderFile:f,layoutFileChanged:h,renderedFileChanged:g,annotationsChanged:I}=(()=>{if(this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(n)??n))return{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:this.syncLineAnnotations(a)};return this.updatePendingRender(n,a)})(),{forceRenderOverride:b,isSetup:v}=this;if(this.forceRenderOverride=void 0,h)this.resetLayoutCache();if(t=this.getOrCreateFileContainerNode(t),!v){this.computeApproximateSize(!1,f);let M=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(M==null)throw Error("VirtualizedFile.render: simple virtualizer is not available");M.connect(t,this),this.isVisible=M.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}else if(this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode())this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,f);if(!this.isVisible&&this.isSimpleMode()&&(!d||!v))return this.renderPlaceholder(this.height);let k=this.virtualizer.getWindowSpecs(),w=this.top??0,P=this.computeRenderRangeFromWindow(f,w,k);return super.render({file:n,fileContainer:t,renderRange:P,lineAnnotations:a,forceRender:(b??s)||I||g||d,...l})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error("VirtualizedFile.render: rendered a different file than its prepared layout");if(this.pendingRender=void 0,this.isSimpleMode())this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(t,n){let s=this.getLatestFile(t)??t,a=this.getRenderedFile(),l=this.pendingRender?.file??a,d=this.fileRenderer.getFileForNextRender(s);return this.pendingRender={latestFile:s,file:d},{pendingRenderFile:d,annotationsChanged:this.syncLineAnnotations(n),layoutFileChanged:!an(l,d),renderedFileChanged:!an(a,d)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}addLayoutCheckpoint(t,n){if(t%b$!==0)return;this.cache.checkpoints.push({lineIndex:t,top:n})}getLayoutCheckpointBeforeLineIndex(t){if(t<=0||this.cache.checkpoints.length===0)return;let n=0,s=this.cache.checkpoints.length-1,a;while(n<=s){let l=n+s>>1,d=this.cache.checkpoints[l];if(d==null)throw Error("VirtualizedFile: invalid checkpoint index");if(d.lineIndex<=t)a=d,n=l+1;else s=l-1}return a}getLayoutCheckpointBeforeTop(t,n){let s=0,a=this.cache.checkpoints.length-1,l=-1;while(s<=a){let d=s+a>>1,f=this.cache.checkpoints[d];if(f==null)throw Error("VirtualizedFile: invalid checkpoint index");if(f.top<=t)l=d,s=d+1;else a=d-1}if(n==null)return l>=0?this.cache.checkpoints[l]:void 0;for(let d=l;d>=0;d--){let f=this.cache.checkpoints[d];if(f==null)throw Error("VirtualizedFile: invalid checkpoint index");if(f.lineIndex%n===0)return f}}getVirtualizedTop(){if(this.virtualizer.type==="advanced")return this.virtualizer.getLocalTopForInstance(this);return this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(t,n,{top:s,bottom:a}){let{disableFileHeader:l=!1}=this.options,{hunkLineCount:d,lineHeight:f}=this.metrics,h=this.fileRenderer.getLineCount(t),g=this.height,I=Mr(this.metrics,l),b=h>0?ss(this.metrics):0,{fileAnnotationHeight:v}=this.cache,k=I+v,w=Math.max(0,g-I-v-b),P=zc(this.getLatestAnnotations()),M=n+I,N=v>0&&P&&M<a&&M+v>s;if(n<s-g||n>a)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-I-b};if(h<=d)return{startingLine:0,totalLines:d,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(a-s,0)/f),O=Math.ceil(_/d)*d+d,B=O/d,X=(s+a)/2;if(this.hasUniformLineHeights()){let En=n+k,wr=En+w;if(!N&&!(En<a&&wr>s))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-I-b};let Kr=Math.floor(N&&X<n+k?0:(X-(n+k))/f),Vr=Math.floor(Kr/d)-Math.floor(B/2),Yo=Math.ceil(h/d),lr=Math.max(0,Math.min(Vr,Yo))*d,Fs=Vr<0?O+Vr*d:O,qa=lr===0?0:v+lr*f,Hi=Math.min(Fs,h-lr);return{startingLine:lr,totalLines:Fs,bufferBefore:qa,bufferAfter:Math.max(0,(h-lr-Hi)*f)}}let z=B,K=[],W=this.getLayoutCheckpointBeforeTop(Math.max(0,s-n-O*f*2),d),J=n+(W?.top??k),ee=W?.lineIndex??0,ue,Ae,le,Se=W?.lineIndex??0;for(let En=Se;En<h;En++){let wr=ee%d===0,Kr=Math.floor(ee/d);if(wr){if(K[Kr]=J-(n+k),le!=null){if(le<=0)break;le--}}let Vr=this.getLineHeight(En,!1);if(J>s-Vr&&J<a)ue??=Kr;if(J+Vr>X)Ae??=Kr;if(le==null&&J>=a&&wr)le=z;ee++,J+=Vr}if(ue==null)if(N)ue=0,Ae=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-I-b};Ae??=ue;let lt=Math.round(Ae-B/2),It=Math.max(0,Math.ceil(h/d)-B),Ce=Math.max(0,Math.min(lt,It)),qe=Ce*d,Tt=lt<0?O+lt*d:O,jn=K[Ce]??0,St=qe===0?0:v+jn,Ft=Ce+Tt/d,sn=Ft<K.length?w-K[Ft]:w-(J-n-k);return{startingLine:qe,totalLines:Tt,bufferBefore:St,bufferAfter:Math.max(0,sn)}}};function v$(t){let n;for(let s of t.children){if(!(s instanceof HTMLElement))continue;if(s.dataset.lineAnnotation!==Gc)continue;n=Math.max(n??0,s.getBoundingClientRect().height)}return n}function m(t,n){return t?.cacheKey!=null||n?.cacheKey!=null?t?.cacheKey===n?.cacheKey:t===n}function be(t,n){return t?.cacheKey===n?.cacheKey&&t?.contents===n?.contents&&t?.name===n?.name&&t?.lang===n?.lang}async function kl(t,n=300){let s;try{await Promise.race([t(),new Promise((a)=>{s=setTimeout(a,n)})])}finally{if(s!=null)clearTimeout(s)}}function da(t){return[Nn(t.additionStart,t.additionCount)+1,Dn(t.additionStart,t.additionCount)+1]}function Ir({isPartial:t,rangeSize:n,expandedHunks:s,hunkIndex:a,collapsedContextThreshold:l}){let d=Math.max(n,0);if(d===0||t)return{fromStart:0,fromEnd:0,rangeSize:d,collapsedLines:d,renderAll:!1};if(s===!0||d<=l)return{fromStart:d,fromEnd:0,rangeSize:d,collapsedLines:0,renderAll:!0};let f=s?.get(a),h=Math.min(Math.max(f?.fromStart??0,0),d),g=Math.min(Math.max(f?.fromEnd??0,0),d),I=h+g,b=I>=d;return{fromStart:b?d:h,fromEnd:b?0:g,rangeSize:d,collapsedLines:Math.max(d-I,0),renderAll:b}}function YS(t){let n=t.hunks[t.hunks.length-1];if(n==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0)return!1;let s=t.additionLines.length-Dn(n.additionStart,n.additionCount),a=t.deletionLines.length-Dn(n.deletionStart,n.deletionCount);if(s<=0&&a<=0)return!1;return s!==a}function Mp({fileDiff:t,errorPrefix:n}){let s=t.hunks[t.hunks.length-1];if(s==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0)return 0;let a=t.additionLines.length-Dn(s.additionStart,s.additionCount),l=t.deletionLines.length-Dn(s.deletionStart,s.deletionCount);if(a<=0&&l<=0)return 0;if(a!==l)throw Error(`${n}: trailing context mismatch (additions=${a}, deletions=${l}) for ${t.name}`);return Math.min(a,l)}function Sr({fileDiff:t,hunkIndex:n,expandedHunks:s,collapsedContextThreshold:a,errorPrefix:l}){if(n!==t.hunks.length-1)return;let d=Mp({fileDiff:t,errorPrefix:l});if(d<=0)return;if(s===!0||d<=a)return{fromStart:d,fromEnd:0,rangeSize:d,collapsedLines:0,renderAll:!0};let f=s?.get(t.hunks.length),h=Math.min(Math.max(f?.fromStart??0,0),d);return{fromStart:h,fromEnd:0,rangeSize:d,collapsedLines:d-h,renderAll:h>=d}}function Ed({fileDiff:t,lineNumber:n,expandedHunks:s,collapsedContextThreshold:a}){if(s===!0||t.isPartial)return!0;for(let[h,g]of t.hunks.entries()){let[I,b]=da(g);if(n<I){let v=Ir({isPartial:t.isPartial,rangeSize:g.collapsedBefore,expandedHunks:s,hunkIndex:h,collapsedContextThreshold:a}),k=I-v.rangeSize;return v.renderAll||n<k+v.fromStart||n>=I-v.fromEnd}if(n<b)return!0}let l=Sr({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:s,collapsedContextThreshold:a,errorPrefix:"isAdditionLineRenderable"});if(l==null||l.renderAll)return!0;let d=t.hunks[t.hunks.length-1],[,f]=da(d);return n<f+l.fromStart||n>=f+l.rangeSize}function JS({fileDiff:t,lineNumber:n,direction:s,expandedHunks:a,collapsedContextThreshold:l}){if(a===!0||t.isPartial)return n;let d=[],f=1;for(let[g,I]of t.hunks.entries()){let[b,v]=da(I),k=Ir({isPartial:t.isPartial,rangeSize:I.collapsedBefore,expandedHunks:a,hunkIndex:g,collapsedContextThreshold:l}),w=b-k.rangeSize;if(k.renderAll)d.push([w,b]);else{if(k.fromStart>0)d.push([w,w+k.fromStart]);if(k.fromEnd>0)d.push([b-k.fromEnd,b])}d.push([b,v]),f=v}let h=Sr({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:l,errorPrefix:"getNearestRenderableAdditionLine"});if(h!=null){let g=f;if(f=g+h.rangeSize,h.renderAll)d.push([g,f]);else if(h.fromStart>0)d.push([g,g+h.fromStart])}if(n>=f)return n;if(s==="down"){for(let[g,I]of d)if(I>n)return Math.max(g,n);return}for(let g=d.length-1;g>=0;g--){let[I,b]=d[g];if(I<=n)return Math.min(b-1,n)}}function QS({type:t,metrics:n}){return n.hunkSeparatorHeight??ES(t)}function ZS({type:t,metrics:n}){return t==="simple"||t==="metadata"||t==="line-info-basic"?0:n.spacing}function k$({type:t,hunkIndex:n,hunkSpecs:s}){switch(t){case"simple":return n>0;case"metadata":return s!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function T$(t){return t!=="simple"&&t!=="metadata"}function ms({type:t,metrics:n,hunkIndex:s,hunkSpecs:a}){if(!k$({type:t,hunkIndex:s,hunkSpecs:a}))return;let l=QS({type:t,metrics:n}),d=ZS({type:t,metrics:n}),f=s>0?d:0,h=d;return{height:l,gapBefore:f,gapAfter:h,totalHeight:f+l+h}}function Ji({type:t,metrics:n}){if(!T$(t))return;let s=QS({type:t,metrics:n}),a=ZS({type:t,metrics:n});return{height:s,gapBefore:a,gapAfter:0,totalHeight:a+s}}function e0({fileDiff:t,metrics:n,disableFileHeader:s,hunkSeparators:a,expandUnchanged:l,expandedHunks:d,collapsedContextThreshold:f,canHydratePartialDiff:h}){let g=Mr(n,s),I=g,b=l?!0:d,v=t.hunks.length-1;for(let k=0;k<t.hunks.length;k++){let w=t.hunks[k];if(w==null)throw Error("computeEstimatedDiffHeights: invalid hunk index");let P=Ir({isPartial:t.isPartial,rangeSize:w.collapsedBefore,expandedHunks:b,hunkIndex:k,collapsedContextThreshold:f}),M=(P.fromStart+P.fromEnd)*n.lineHeight;if(g+=M,I+=M,P.collapsedLines>0){let O=ms({type:a,metrics:n,hunkIndex:k,hunkSpecs:w.hunkSpecs})?.totalHeight??0;g+=O,I+=O}g+=w.splitLineCount*n.lineHeight,I+=w.unifiedLineCount*n.lineHeight;let N=w$(w);g+=N.split*n.lineHeight,I+=N.unified*n.lineHeight;let _=k===v?Sr({fileDiff:t,hunkIndex:k,expandedHunks:b,collapsedContextThreshold:f,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(_!=null){let O=(_.fromStart+_.fromEnd)*n.lineHeight;if(g+=O,I+=O,_.collapsedLines>0){let B=Ji({type:a,metrics:n})?.totalHeight??0;g+=B,I+=B}}else if(k===v&&t.isPartial&&h){let O=Ji({type:a,metrics:n})?.totalHeight??0;g+=O,I+=O}}if(t.hunks.length>0){let k=ss(n);g+=k,I+=k}return{splitHeight:g,unifiedHeight:I}}function w$(t){if(!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return{split:0,unified:0};let n=t.hunkContent.at(-1);if(n==null)return{split:0,unified:0};if(n.type==="context"){let s=n.lines>0?1:0;return{split:s,unified:s}}return R$(t,n)}function R$(t,n){let s=(n.deletions>0&&t.noEOFCRDeletions?1:0)+(n.additions>0&&t.noEOFCRAdditions?1:0),a=n.deletions>0&&t.noEOFCRDeletions,l=n.additions>0&&t.noEOFCRAdditions;return{split:a||l?1:0,unified:s}}function Tl({oldFile:t,newFile:n},s){if(t===void 0&&n===void 0)return;if(t===void 0||n===void 0)throw Error(`${s}: Pass null for an intentionally missing oldFile or newFile side`);if(t===null){if(n===null)throw Error(`${s}: You must pass oldFile, newFile, or both`);return{oldFile:t,newFile:n}}if(n===null)return{oldFile:t,newFile:n};return{oldFile:t,newFile:n}}function Pe(t){return t.map((n)=>({...n,hunkContent:n.hunkContent.map((s)=>({...s}))}))}function vd(t){return{...t,hunks:Pe(t.hunks),deletionLines:[...t.deletionLines],additionLines:[...t.additionLines]}}function ma(t){return t!==""?t.split(jI):[]}function wl(t,n,s){let a=t==="clone"?vd(n):n;if(!a.isPartial)throw Error("hydratePartialDiff: fileDiff must be partial");switch(a.type){case"change":case"rename-changed":return L$(a,P$(a,s),t0(a,s));case"rename-pure":{let l=t0(a,s);M$(a,s);let d=ma(l.contents);return a.isPartial=!1,a.deletionLines=d,a.additionLines=d,n0(a,null,l),a}}throw Error(`hydratePartialDiff: ${a.type} diffs cannot be hydrated from loaded files`)}function L$(t,n,s){let a=ma(n.contents),l=ma(s.contents),{hunks:d,splitLineCount:f,unifiedLineCount:h}=A$(t.hunks,l.length);return t.hunks=d,t.splitLineCount=f,t.unifiedLineCount=h,t.isPartial=!1,t.deletionLines=a,t.additionLines=l,n0(t,n,s),t}function A$(t,n){let s=0,a=0,l=0,d=[];for(let f of t){let h=Math.max(f.additionStart-1,0),g=Math.max(f.deletionStart-1,0),I=h,b=g,v=0,k=0,w=0,P=0,M=[];for(let _ of f.hunkContent){if(_.type==="context"){M.push({..._,additionLineIndex:I,deletionLineIndex:b}),I+=_.lines,b+=_.lines,w+=_.lines,P+=_.lines;continue}M.push({..._,additionLineIndex:I,deletionLineIndex:b}),I+=_.additions,b+=_.deletions,v+=_.additions,k+=_.deletions,w+=Math.max(_.additions,_.deletions),P+=_.additions+_.deletions}let N=Math.max(Nn(f.additionStart,f.additionCount)-l,0);d.push({...f,collapsedBefore:N,additionLineIndex:h,deletionLineIndex:g,additionLines:v,deletionLines:k,hunkContent:M,splitLineStart:s+N,unifiedLineStart:a+N,splitLineCount:w,unifiedLineCount:P}),s+=N+w,a+=N+P,l=Dn(f.additionStart,f.additionCount)}if(d.length>0){let f=d[d.length-1],h=Dn(f.additionStart,f.additionCount),g=Math.max(n-h,0);s+=g,a+=g}return{hunks:d,splitLineCount:s,unifiedLineCount:a}}function P$(t,n){if(n.oldFile==null)throw Error(`hydratePartialDiff: ${t.type} diff for ${t.name} requires oldFile`);return n.oldFile}function t0(t,n){if(n.newFile==null)throw Error(`hydratePartialDiff: ${t.type} diff for ${t.name} requires newFile`);return n.newFile}function M$(t,n){if(n.oldFile!==null)throw Error(`hydratePartialDiff: ${t.type} diff for ${t.name} requires oldFile to be null`)}function _$(t,n,s){if(t.cacheKey!=null)return`${t.cacheKey}:hydrated`;return O$(n,s)}function n0(t,n,s){let a=_$(t,n,s);if(a==null){delete t.cacheKey;return}t.cacheKey=a}function O$(t,n){if(t!=null&&n!=null)return t.cacheKey!=null&&n.cacheKey!=null?os("hydrated-files",t.cacheKey,n.cacheKey):void 0;return t?.cacheKey??n?.cacheKey}function si({diff:t,diffStyle:n,startingLine:s=0,totalLines:a=1/0,expandedHunks:l,collapsedContextThreshold:d=1,callback:f}){let h=$$({diff:t,diffStyle:n,startingLine:s,expandedHunks:l,collapsedContextThreshold:d}),g={viewportStart:s,viewportEnd:s+a,isWindowedHighlight:s>0||a<1/0,splitCount:h.splitCount,unifiedCount:h.unifiedCount,finalHunkIndex:t.hunks.length-1,shouldBreak(){if(!g.isWindowedHighlight)return!1;let I=g.unifiedCount>=s+a,b=g.splitCount>=s+a;if(n==="unified")return I;else if(n==="split")return b;else return I&&b},shouldSkip(I,b){if(!g.isWindowedHighlight)return!1;let v=I>0&&g.unifiedCount+I<=s,k=b>0&&g.splitCount+b<=s;if(n==="unified")return v;else if(n==="split")return k;else return v&&k},incrementCounts(I,b){if(n==="unified"||n==="both")g.unifiedCount+=I;if(n==="split"||n==="both")g.splitCount+=b},isInWindow(I,b){if(!g.isWindowedHighlight)return!0;let v=g.isInUnifiedWindow(I),k=g.isInSplitWindow(b);if(n==="unified")return v;else if(n==="split")return k;else return v||k},isInUnifiedWindow(I){return!g.isWindowedHighlight||g.unifiedCount>=s-I&&g.unifiedCount<s+a},isInSplitWindow(I){return!g.isWindowedHighlight||g.splitCount>=s-I&&g.splitCount<s+a},emit(I,b=!1){if(!b)if(n==="unified")g.incrementCounts(1,0);else if(n==="split")g.incrementCounts(0,1);else g.incrementCounts(1,1);return f(I)??!1}};e:for(let I=h.hunkIndex;I<t.hunks.length;I++){let O=function(le,Se){if(N==null||N.collapsedLines<=0||N.fromStart+N.fromEnd>0)return 0;if(n==="unified")return le===b.unifiedLineStart+b.unifiedLineCount-1?N.collapsedLines:0;return Se===b.splitLineStart+b.splitLineCount-1?N.collapsedLines:0},X=function(){if(B)return 0;return B=!0,M.collapsedLines},b=t.hunks[I];if(b==null)throw Error("iterateOverDiff: invalid hunk index");if(g.shouldBreak())break;let v=Nn(b.deletionStart,b.deletionCount),k=Nn(b.additionStart,b.additionCount),w=!t.isPartial&&b.deletionCount===0?v:b.deletionLineIndex,P=!t.isPartial&&b.additionCount===0?k:b.additionLineIndex,M=Ir({isPartial:t.isPartial,rangeSize:b.collapsedBefore,expandedHunks:l,hunkIndex:I,collapsedContextThreshold:d}),N=I===g.finalHunkIndex?Sr({fileDiff:t,hunkIndex:I,expandedHunks:l,collapsedContextThreshold:d,errorPrefix:"iterateOverDiff"}):void 0,_=M.fromStart+M.fromEnd,B=M.collapsedLines===0;if(!g.shouldSkip(_,_)){let le=b.unifiedLineStart-M.rangeSize,Se=b.splitLineStart-M.rangeSize,lt=w-M.rangeSize,It=P-M.rangeSize,Ce=v+1-M.rangeSize,qe=k+1-M.rangeSize;if(kd(g,M.fromStart,n,(Tt)=>g.emit({hunkIndex:I,hunk:b,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:Ce+Tt,lineIndex:lt+Tt,noEOFCR:!1,unifiedLineIndex:le+Tt,splitLineIndex:Se+Tt},additionLine:{unifiedLineIndex:le+Tt,splitLineIndex:Se+Tt,lineIndex:It+Tt,lineNumber:qe+Tt,noEOFCR:!1}})))break e;if(le=b.unifiedLineStart-M.fromEnd,Se=b.splitLineStart-M.fromEnd,lt=w-M.fromEnd,It=P-M.fromEnd,Ce=v+1-M.fromEnd,qe=k+1-M.fromEnd,kd(g,M.fromEnd,n,(Tt)=>g.emit({hunkIndex:I,hunk:b,collapsedBefore:X(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:Ce+Tt,lineIndex:lt+Tt,noEOFCR:!1,unifiedLineIndex:le+Tt,splitLineIndex:Se+Tt},additionLine:{unifiedLineIndex:le+Tt,splitLineIndex:Se+Tt,lineIndex:It+Tt,lineNumber:qe+Tt,noEOFCR:!1}}),()=>{X()}))break e}else g.incrementCounts(_,_),X();let{unifiedLineStart:z,splitLineStart:K}=b,W=w,J=P,ee=v+1,ue=k+1,Ae=b.hunkContent.at(-1);for(let le of b.hunkContent){if(g.shouldBreak())break e;let Se=le===Ae;if(le.type==="context"){if(!g.shouldSkip(le.lines,le.lines)){if(kd(g,le.lines,n,(lt)=>{let It=Se&<===le.lines-1,Ce=z+lt,qe=K+lt;return g.emit({hunkIndex:I,hunk:b,collapsedBefore:X(),collapsedAfter:O(Ce,qe),type:"context",deletionLine:{lineNumber:ee+lt,lineIndex:W+lt,noEOFCR:It&&b.noEOFCRDeletions,unifiedLineIndex:Ce,splitLineIndex:qe},additionLine:{unifiedLineIndex:Ce,splitLineIndex:qe,lineIndex:J+lt,lineNumber:ue+lt,noEOFCR:It&&b.noEOFCRAdditions}})},()=>{X()}))break e}else g.incrementCounts(le.lines,le.lines),X();z+=le.lines,K+=le.lines,W+=le.lines,J+=le.lines,ee+=le.lines,ue+=le.lines}else{let lt=Math.max(le.deletions,le.additions),It=le.deletions+le.additions;if(!g.shouldSkip(It,lt)){let Ce=D$(g,le,n);if((Ce[0]?.[0]??0)>0)X();for(let[qe,Tt]of Ce)for(let jn=qe;jn<Tt;jn++){let St=O(z+jn,n==="unified"?K+(jn<le.deletions?jn:jn-le.deletions):K+jn);if(g.emit(H$({hunkIndex:I,hunk:b,collapsedBefore:X(),collapsedAfter:St,diffStyle:n,index:jn,unifiedLineIndex:z,splitLineIndex:K,additionLineIndex:J,deletionLineIndex:W,additionLineNumber:ue,deletionLineNumber:ee,content:le,isLastContent:Se,unifiedCount:It,splitCount:lt}),!0))break e}}X(),g.incrementCounts(It,lt),z+=It,K+=lt,W+=le.deletions,J+=le.additions,ee+=le.deletions,ue+=le.additions}}if(N!=null){let{collapsedLines:le,fromStart:Se,fromEnd:lt}=N,It=Se+lt;if(kd(g,It,n,(Ce)=>{let qe=Ce===It-1;return g.emit({hunkIndex:t.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:qe?le:0,type:"context-expanded",deletionLine:{lineNumber:ee+Ce,lineIndex:W+Ce,noEOFCR:!1,unifiedLineIndex:z+Ce,splitLineIndex:K+Ce},additionLine:{unifiedLineIndex:z+Ce,splitLineIndex:K+Ce,lineIndex:J+Ce,lineNumber:ue+Ce,noEOFCR:!1}})},void 0,()=>g.shouldBreak()))break e}}}function $$({diff:t,diffStyle:n,startingLine:s,expandedHunks:a,collapsedContextThreshold:l}){if(s<=0||n==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};let d=F$({diff:t,expandedHunks:a,collapsedContextThreshold:l}),f=0,h=t.hunks.length-1,g=t.hunks.length;while(f<=h){let b=f+h>>1,v=d[b+1];if(v==null)throw Error("iterateOverDiff: invalid hunk prefix index");if((n==="unified"?v.unifiedCount:v.splitCount)>s)g=b,h=b-1;else f=b+1}if(g>=t.hunks.length){let b=d[t.hunks.length];if(b==null)throw Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:t.hunks.length,splitCount:b.splitCount,unifiedCount:b.unifiedCount}}let I=d[g];if(I==null)throw Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:g,splitCount:I.splitCount,unifiedCount:I.unifiedCount}}function F$({diff:t,expandedHunks:n,collapsedContextThreshold:s}){let a=0,l=0,d=t.hunks.length-1,f=[{splitCount:0,unifiedCount:0}];for(let h=0;h<t.hunks.length;h++){let g=t.hunks[h];if(g==null)throw Error("iterateOverDiff: invalid hunk summary index");let I=Ir({isPartial:t.isPartial,rangeSize:g.collapsedBefore,expandedHunks:n,hunkIndex:h,collapsedContextThreshold:s}),b=I.fromStart+I.fromEnd;a+=b+g.splitLineCount,l+=b+g.unifiedLineCount;let v=h===d?Sr({fileDiff:t,hunkIndex:h,expandedHunks:n,collapsedContextThreshold:s,errorPrefix:"iterateOverDiff"}):void 0;if(v!=null){let k=v.fromStart+v.fromEnd;a+=k,l+=k}f.push({splitCount:a,unifiedCount:l})}return f}function N$(t,n,s){if(!t.isWindowedHighlight||n<=0)return[0,n];let a=[];function l(h){let g=Math.max(0,t.viewportStart-h),I=Math.min(n,t.viewportEnd-h);if(I>g)a.push([g,I])}if(s!=="split")l(t.unifiedCount);if(s!=="unified")l(t.splitCount);if(a.length===0)return[0,0];let d=a[0][0],f=a[0][1];for(let h=1;h<a.length;h++){let g=a[h];d=Math.min(d,g[0]),f=Math.max(f,g[1])}return[d,f]}function kd(t,n,s,a,l,d){let[f,h]=N$(t,n,s);if(f>0)t.incrementCounts(f,f),l?.();let g=f;while(g<n){if(d?.()===!0)return!0;if(g>=h){t.incrementCounts(n-g,n-g);break}if(t.isInWindow(0,0)){if(a(g)===!0)return!0}else t.incrementCounts(1,1);g++}return!1}function D$(t,n,s){if(!t.isWindowedHighlight)return[[0,s==="unified"?n.deletions+n.additions:Math.max(n.deletions,n.additions)]];let a=s!=="split",l=s!=="unified",d=s==="unified"?"unified":"split",f=[];function h(v,k){if(v+k<=t.viewportStart||v>=t.viewportEnd)return;let w=Math.max(0,t.viewportStart-v),P=Math.min(k,t.viewportEnd-v);return P>w?[w,P]:void 0}function g(v,k){if(d==="split")return v;return k==="additions"?[v[0]+n.deletions,v[1]+n.deletions]:v}function I(v,k){if(v==null)return;let[w,P]=g(v,k);if(P>w)f.push([w,P])}if(a)I(h(t.unifiedCount,n.deletions),"deletions"),I(h(t.unifiedCount+n.deletions,n.additions),"additions");if(l)I(h(t.splitCount,n.deletions),"deletions"),I(h(t.splitCount,n.additions),"additions");if(f.length===0)return f;f.sort((v,k)=>v[0]-k[0]);let b=[f[0]];for(let[v,k]of f.slice(1)){let w=b[b.length-1];if(v<=w[1])w[1]=Math.max(w[1],k);else b.push([v,k])}return b}function H$({hunkIndex:t,hunk:n,collapsedAfter:s,collapsedBefore:a,diffStyle:l,index:d,unifiedLineIndex:f,splitLineIndex:h,additionLineIndex:g,deletionLineIndex:I,additionLineNumber:b,deletionLineNumber:v,content:k,isLastContent:w,unifiedCount:P,splitCount:M}){let N=d<k.deletions?f+d:void 0,_=l==="unified"?d>=k.deletions?f+d:void 0:d<k.additions?f+k.deletions+d:void 0,O=l==="unified"?h+(d<k.deletions?d:d-k.deletions):h+d,B=d<k.deletions?I+d:void 0,X=d<k.deletions?v+d:void 0,z=l==="unified"?d>=k.deletions?g+(d-k.deletions):void 0:d<k.additions?g+d:void 0,K=l==="unified"?d>=k.deletions?b+(d-k.deletions):void 0:d<k.additions?b+d:void 0,W=l==="unified"?w&&d===k.deletions-1&&n.noEOFCRDeletions:w&&d===M-1&&n.noEOFCRDeletions,J=l==="unified"?w&&d===P-1&&n.noEOFCRAdditions:w&&d===M-1&&n.noEOFCRAdditions,ee=B!=null&&X!=null&&N!=null?{lineNumber:X,lineIndex:B,noEOFCR:W,unifiedLineIndex:N,splitLineIndex:O}:void 0,ue=z!=null&&K!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:O,lineIndex:z,lineNumber:K,noEOFCR:J}:void 0;if(ee==null&&ue!=null)return{type:"change",hunkIndex:t,hunk:n,collapsedAfter:s,collapsedBefore:a,deletionLine:void 0,additionLine:ue};else if(ee!=null&&ue==null)return{type:"change",hunkIndex:t,hunk:n,collapsedAfter:s,collapsedBefore:a,deletionLine:ee,additionLine:void 0};if(ee==null||ue==null)throw Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:t,hunk:n,collapsedAfter:s,collapsedBefore:a,deletionLine:ee,additionLine:ue}}class Qi{diff(t,n,s={}){let a;if(typeof s==="function")a=s,s={};else if("callback"in s)a=s.callback;let l=this.castInput(t,s),d=this.castInput(n,s),f=this.removeEmpty(this.tokenize(l,s)),h=this.removeEmpty(this.tokenize(d,s));return this.diffWithOptionsObj(f,h,s,a)}diffWithOptionsObj(t,n,s,a){var l;let d=(_)=>{if(_=this.postProcess(_,s),a){setTimeout(function(){a(_)},0);return}else return _},f=n.length,h=t.length,g=1,I=f+h;if(s.maxEditLength!=null)I=Math.min(I,s.maxEditLength);let b=(l=s.timeout)!==null&&l!==void 0?l:1/0,v=Date.now()+b,k=[{oldPos:-1,lastComponent:void 0}],w=this.extractCommon(k[0],n,t,0,s);if(k[0].oldPos+1>=h&&w+1>=f)return d(this.buildValues(k[0].lastComponent,n,t));let P=-1/0,M=1/0,N=()=>{for(let _=Math.max(P,-g);_<=Math.min(M,g);_+=2){let O,B=k[_-1],X=k[_+1];if(B)k[_-1]=void 0;let z=!1;if(X){let W=X.oldPos-_;z=X&&0<=W&&W<f}let K=B&&B.oldPos+1<h;if(!z&&!K){k[_]=void 0;continue}if(!K||z&&B.oldPos<X.oldPos)O=this.addToPath(X,!0,!1,0,s);else O=this.addToPath(B,!1,!0,1,s);if(w=this.extractCommon(O,n,t,_,s),O.oldPos+1>=h&&w+1>=f)return d(this.buildValues(O.lastComponent,n,t))||!0;else{if(k[_]=O,O.oldPos+1>=h)M=Math.min(M,_-1);if(w+1>=f)P=Math.max(P,_+1)}}g++};if(a)(function _(){setTimeout(function(){if(g>I||Date.now()>v)return a(void 0);if(!N())_()},0)})();else while(g<=I&&Date.now()<=v){let _=N();if(_)return _}}addToPath(t,n,s,a,l){let d=t.lastComponent;if(d&&!l.oneChangePerToken&&d.added===n&&d.removed===s)return{oldPos:t.oldPos+a,lastComponent:{count:d.count+1,added:n,removed:s,previousComponent:d.previousComponent}};else return{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:s,previousComponent:d}}}extractCommon(t,n,s,a,l){let d=n.length,f=s.length,h=t.oldPos,g=h-a,I=0;while(g+1<d&&h+1<f&&this.equals(s[h+1],n[g+1],l))if(g++,h++,I++,l.oneChangePerToken)t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1};if(I&&!l.oneChangePerToken)t.lastComponent={count:I,previousComponent:t.lastComponent,added:!1,removed:!1};return t.oldPos=h,g}equals(t,n,s){if(s.comparator)return s.comparator(t,n);else return t===n||!!s.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let s=0;s<t.length;s++)if(t[s])n.push(t[s]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,s){let a=[],l;while(t)a.push(t),l=t.previousComponent,delete t.previousComponent,t=l;a.reverse();let d=a.length,f=0,h=0,g=0;for(;f<d;f++){let I=a[f];if(!I.removed){if(!I.added&&this.useLongestToken){let b=n.slice(h,h+I.count);b=b.map(function(v,k){let w=s[g+k];return w.length>v.length?w:v}),I.value=this.join(b)}else I.value=this.join(n.slice(h,h+I.count));if(h+=I.count,!I.added)g+=I.count}else I.value=this.join(s.slice(g,g+I.count)),g+=I.count}return a}}class r0 extends Qi{}var i0=new r0;function _p(t,n,s){return i0.diff(t,n,s)}function Op(t,n){let s;for(s=0;s<t.length&&s<n.length;s++)if(t[s]!=n[s])return t.slice(0,s);return t.slice(0,s)}function $p(t,n){let s;if(!t||!n||t[t.length-1]!=n[n.length-1])return"";for(s=0;s<t.length&&s<n.length;s++)if(t[t.length-(s+1)]!=n[n.length-(s+1)])return t.slice(-s);return t.slice(-s)}function Td(t,n,s){if(t.slice(0,n.length)!=n)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(n)}; this is a bug`);return s+t.slice(n.length)}function wd(t,n,s){if(!n)return t+s;if(t.slice(-n.length)!=n)throw Error(`string ${JSON.stringify(t)} doesn't end with suffix ${JSON.stringify(n)}; this is a bug`);return t.slice(0,-n.length)+s}function fa(t,n){return Td(t,n,"")}function Rl(t,n){return wd(t,n,"")}function Fp(t,n){return n.slice(0,U$(t,n))}function U$(t,n){let s=0;if(t.length>n.length)s=t.length-n.length;let a=n.length;if(t.length<n.length)a=t.length;let l=Array(a),d=0;l[0]=0;for(let f=1;f<a;f++){if(n[f]==n[d])l[f]=l[d];else l[f]=d;while(d>0&&n[f]!=n[d])d=l[d];if(n[f]==n[d])d++}d=0;for(let f=s;f<t.length;f++){while(d>0&&t[f]!=n[d])d=l[d];if(t[f]==n[d])d++}return d}function Np(t,n){let s=[];for(let a of Array.from(n.segment(t))){let l=a.segment;if(s.length&&/\s/.test(s[s.length-1])&&/\s/.test(l))s[s.length-1]+=l;else s.push(l)}return s}function Rd(t,n){if(n)return pa(t,n)[1];let s;for(s=t.length-1;s>=0;s--)if(!t[s].match(/\s/))break;return t.substring(s+1)}function fs(t,n){if(n)return pa(t,n)[0];let s=t.match(/^\s*/);return s?s[0]:""}function pa(t,n){if(!n)return[fs(t),Rd(t)];if(n.resolvedOptions().granularity!="word")throw Error('The segmenter passed must have a granularity of "word"');let s=Np(t,n),a=s[0],l=s[s.length-1],d=/\s/.test(a)?a:"",f=/\s/.test(l)?l:"";return[d,f]}var Ld="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",B$=new RegExp(`[${Ld}]+|\\s+|[^${Ld}]`,"ug");class s0 extends Qi{equals(t,n,s){if(s.ignoreCase)t=t.toLowerCase(),n=n.toLowerCase();return t.trim()===n.trim()}tokenize(t,n={}){let s;if(n.intlSegmenter){let d=n.intlSegmenter;if(d.resolvedOptions().granularity!="word")throw Error('The segmenter passed must have a granularity of "word"');s=Np(t,d)}else s=t.match(B$)||[];let a=[],l=null;return s.forEach((d)=>{if(/\s/.test(d))if(l==null)a.push(d);else a.push(a.pop()+d);else if(l!=null&&/\s/.test(l))if(a[a.length-1]==l)a.push(a.pop()+d);else a.push(l+d);else a.push(d);l=d}),a}join(t){return t.map((n,s)=>{if(s==0)return n;else return n.replace(/^\s+/,"")}).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let s=null,a=null,l=null;if(t.forEach((d)=>{if(d.added)a=d;else if(d.removed)l=d;else{if(a||l)o0(s,l,a,d,n.intlSegmenter);s=d,a=null,l=null}}),a||l)o0(s,l,a,null,n.intlSegmenter);return t}}var G$=new s0;function o0(t,n,s,a,l){if(n&&s){let[d,f]=pa(n.value,l),[h,g]=pa(s.value,l);if(t){let I=Op(d,h);t.value=wd(t.value,h,I),n.value=fa(n.value,I),s.value=fa(s.value,I)}if(a){let I=$p(f,g);a.value=Td(a.value,g,I),n.value=Rl(n.value,I),s.value=Rl(s.value,I)}}else if(s){if(t){let d=fs(s.value,l);s.value=s.value.substring(d.length)}if(a){let d=fs(a.value,l);a.value=a.value.substring(d.length)}}else if(t&&a){let d=fs(a.value,l),[f,h]=pa(n.value,l),g=Op(d,f);n.value=fa(n.value,g);let I=$p(fa(d,g),h);n.value=Rl(n.value,I),a.value=Td(a.value,d,I),t.value=wd(t.value,d,d.slice(0,d.length-I.length))}else if(a){let d=fs(a.value,l),f=Rd(n.value,l),h=Fp(f,d);n.value=Rl(n.value,h)}else if(t){let d=Rd(t.value,l),f=fs(n.value,l),h=Fp(d,f);n.value=fa(n.value,h)}}class a0 extends Qi{tokenize(t){let n=new RegExp(`(\\r?\\n)|[${Ld}]+|[^\\S\\n\\r]+|[^${Ld}]`,"ug");return t.match(n)||[]}}var l0=new a0;function Dp(t,n,s){return l0.diff(t,n,s)}class u0 extends Qi{constructor(){super(...arguments);this.tokenize=j$}equals(t,n,s){if(s.ignoreWhitespace){if(!s.newlineIsToken||!t.includes(`
|
|
294
294
|
`))t=t.trim();if(!s.newlineIsToken||!n.includes(`
|
|
295
295
|
`))n=n.trim()}else if(s.ignoreNewlineAtEof&&!s.newlineIsToken){if(t.endsWith(`
|
|
296
296
|
`))t=t.slice(0,-1);if(n.endsWith(`
|
|
@@ -306,9 +306,9 @@ ${n}`,a=t.startsWith(n)?0:cS(t,s,0);if(a===-1)return[t];let l=[];if(a>0)l.push(t
|
|
|
306
306
|
`).join("");if(a===n)a=Array.from({length:s},(l,d)=>`\x00${" ".repeat(d)}
|
|
307
307
|
`).join("");return a}function X$(t){for(let n of t)if(n.trim().length>0)return!1;return!0}function Pd(t,n){return n.length>0&&n.length<t.deletionLines.length&&X$(n)}function Ll(t,n,s){let a=t.deletionLines.join(""),l=W$(n.length,a),d=ai({name:t.prevName??t.name,contents:a},{name:t.name,contents:l,lang:t.lang},s);return{hunks:d.hunks,splitLineCount:d.splitLineCount,unifiedLineCount:d.unifiedLineCount,additionLines:n,deletionLines:d.deletionLines,type:d.type}}function Al(t,n){return Ll(t,[""],n)}function Md(t,n){if(t.additionLines.length===0)return Al(t,n);if(Pd(t,t.additionLines))return Ll(t,t.additionLines,n);let s=t.additionLines,a=Ti(t,n);return zp(a,s),a}function Y$(t){return t.length>1&&t.at(-1)===""}function zp(t,n){if(!Y$(n))return;let s=n.length-t.additionLines.length;if(s<=0)return;let a=t.additionLines.length,l=t.hunks.at(-1);if(l==null)return;if(Dn(l.additionStart,l.additionCount)!==a)return;for(let d of l.hunkContent)if(d.type==="change"&&d.additions<d.deletions&&d.additionLineIndex+d.additions===a){t.additionLines=n,d.additions+=s,l.additionCount+=s,l.additionLines+=s,ha(t);return}}function m0(t,n,s){if(t.isPartial)return Zi(t,Ti(t,s));if(t.deletionLines.length!==t.additionLines.length)return Zi(t,Ti(t,s));let a=Array.from(n);if(a.length===0)return Zi(t,{hunks:t.hunks,splitLineCount:t.splitLineCount,unifiedLineCount:t.unifiedLineCount,type:t.type});for(let d of a){let f=t.additionLines[d],h=t.deletionLines[d];if(f==null||h==null)return Zi(t,Ti(t,s));if(Pr(f)===Pr(h))return Zi(t,Ti(t,s))}let l=J$(t,a);if(l.size===0)return Zi(t,Ti(t,s));for(let d of l)if(!Z$(t,d,s))return Zi(t,Ti(t,s));if(ha(t),YS(t))return Zi(t,Ti(t,s));return Zi(t,{hunks:t.hunks,splitLineCount:t.splitLineCount,unifiedLineCount:t.unifiedLineCount,type:t.type})}function Zi(t,n){return Object.assign(t,n),n}function J$(t,n){let s=new Set;for(let a of n){let l=Q$(t,a);if(l==null)return new Set;s.add(l)}return s}function Q$(t,n){for(let[s,a]of t.hunks.entries()){let l=a.additionLineIndex+a.additionCount;if(n>=a.additionLineIndex&&n<l)return s}}function Z$(t,n,s){let a=t.hunks[n];if(a==null)return!1;let l=t.deletionLines.slice(a.deletionLineIndex,a.deletionLineIndex+a.deletionCount),d=t.additionLines.slice(a.additionLineIndex,a.additionLineIndex+a.additionCount),f=ai({name:t.prevName??t.name,contents:l.join("")},{name:t.name,contents:d.join(""),lang:t.lang},{...s,context:0}),h=f.hunks[0];if(h==null||f.hunks.length!==1)return!1;return eF(a,h),jp(t,n),!0}function jp(t,n){let s=t.hunks[n];if(s==null)return;if(n!==t.hunks.length-1){s.noEOFCRAdditions=!1,s.noEOFCRDeletions=!1;return}let a=t.additionLines.at(-1),l=t.deletionLines.at(-1);s.noEOFCRAdditions=a!=null&&a!==""&&!a.endsWith(`
|
|
308
308
|
`),s.noEOFCRDeletions=l!=null&&l!==""&&!l.endsWith(`
|
|
309
|
-
`)}function eF(t,n){let{additionLineIndex:s,deletionLineIndex:a}=t;if(t.hunkContent=n.hunkContent.map((l)=>qp(l,s,a)),t.additionLineIndex=s+n.additionLineIndex,t.additionStart=t.additionStart+n.additionLineIndex,t.additionCount=n.additionCount,t.additionLines=n.additionLines,n.deletionLineIndex>=0)t.deletionLineIndex=a+n.deletionLineIndex,t.deletionStart=t.deletionStart+n.deletionLineIndex;t.deletionCount=n.deletionCount,t.deletionLines=n.deletionLines,t.noEOFCRAdditions=n.noEOFCRAdditions,t.noEOFCRDeletions=n.noEOFCRDeletions,_d(t)}function qp(t,n,s){return{...t,additionLineIndex:t.additionLineIndex+n,deletionLineIndex:t.deletionLineIndex+s}}function _d(t){let n=0,s=0;for(let a of t.hunkContent)if(a.type==="context")n+=a.lines,s+=a.lines;else n+=Math.max(a.additions,a.deletions),s+=a.additions+a.deletions;t.splitLineCount=n,t.unifiedLineCount=s}function ha(t){let n=0,s=0,a=0;for(let l of t.hunks)l.collapsedBefore=Math.max(Nn(l.additionStart,l.additionCount)-a,0),l.splitLineStart=n+l.collapsedBefore,l.unifiedLineStart=s+l.collapsedBefore,_d(l),n+=l.collapsedBefore+l.splitLineCount,s+=l.collapsedBefore+l.unifiedLineCount,a=Dn(l.additionStart,l.additionCount);if(t.hunks.length>0){let l=t.hunks[t.hunks.length-1],d=Math.max(t.additionLines.length-Dn(l.additionStart,l.additionCount),0);n+=d,s+=d}t.splitLineCount=n,t.unifiedLineCount=s}var f0=new WeakMap;function tF(t){if(t.length>1&&t[t.length-1]==="")return t.slice(0,-1);return t}function nF(t,n){let s=Math.min(t.length,n.length),a=0;while(a<s&&t[a]===n[a])a++;let l=t.length,d=n.length;while(l>a&&d>a&&t[l-1]===n[d-1])l--,d--;if(a===l&&a===d)return;return{start:a,deletionEnd:l,additionEnd:d}}function $d(t,n,s){let{hunks:a,additionLines:l}=t,d=tF(l),f=d===l?t:{...t,additionLines:d},h=lF(a,sF(f,n,s),t.deletionLines.length),g=dF(f,h);if(t.additionLines=d,t.hunks=g,t.editSessionDirty=!0,hF(t),zp(t,l),!fF(a,t.hunks))return;return{regions:h.map((I)=>I.previousSpan)}}function y0(t,n,s,a){let l=new Set(n),d=Array.from(l).filter((b)=>b>=0&&b<t.additionLines.length).sort((b,v)=>b-v);if(d.length===0)return;let f=(b)=>l.has(b)?a?.get(b):t.additionLines[b],{hunks:h}=t,g,I=0;for(let b of d){while(I<h.length){let w=h[I];if(b<Fd(w)+w.additionCount)break;I++}let v=h[I],k=v==null?void 0:Fd(v);if(k==null||b<k||g!=null&&g!==I)return $d(t,s,f);g=I}if(g==null)return;if(rF(t,d,g,a,s)){t.editSessionDirty=!0;return}return $d(t,s,f)}function rF(t,n,s,a,l){if(a==null||l?.ignoreWhitespace===!0||l?.stripTrailingCr===!0)return!1;let d=iF(t),f=t.hunks[s];if(f.hunkContent.some(oF))return!1;for(let h of n){let g=a.get(h),I=t.additionLines[h];if(g==null||I==null||d.has(g)||d.has(I))return!1;let b=!1;for(let v of f.hunkContent)if(v.type==="change"&&v.additions===v.deletions&&h>=v.additionLineIndex&&h<v.additionLineIndex+v.additions){b=!0;break}if(!b)return!1}return!0}function iF(t){let n=f0.get(t);if(n?.lines===t.deletionLines)return n.set;let s=new Set(t.deletionLines);return f0.set(t,{lines:t.deletionLines,set:s}),s}function oF(t){return t?.type==="change"&&(t.additions===0||t.deletions===0)}function x0(t,n){let s=new Map,{regions:a}=n;for(let l=0;l<=a.length;l++){let d=a[l-1],f=a[l],h=l===0?t.get(0):d==null?void 0:t.get(d.lastIndex+1),g=f==null?void 0:t.get(f.firstIndex),I=h?.fromStart??0,b=g?.fromEnd??0;if(I>0||b>0)s.set(l,{fromStart:I,fromEnd:b})}return s}function I0(t,n,s){let a=[];if(t.isPartial)return a;for(let[d,f]of t.hunks.entries()){let h=Ir({isPartial:t.isPartial,rangeSize:f.collapsedBefore,expandedHunks:n,hunkIndex:d,collapsedContextThreshold:s});if(h.rangeSize<=s)continue;let g=ps(f),I=g-h.rangeSize;if(h.fromStart>0)a.push([I,I+h.fromStart]);if(h.fromEnd>0)a.push([g-h.fromEnd,g])}let l=Sr({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:n,collapsedContextThreshold:s,errorPrefix:"captureExpansionAnchors"});if(l!=null&&l.fromStart>0&&l.rangeSize>s){let d=t.hunks[t.hunks.length-1],f=ps(d)+d.deletionCount;a.push([f,f+l.fromStart])}return a}function S0(t,n){let s=new Map;if(n.length===0)return s;let a=(d,f,h)=>{if(h<=f)return;let g=0,I=0;for(let[b,v]of n){if(v<=f||b>=h)continue;if(b<=f)g=Math.max(g,Math.min(v,h)-f);if(v>=h)I=Math.max(I,h-Math.max(b,f))}if(g>0||I>0)s.set(d,{fromStart:g,fromEnd:I})};for(let[d,f]of t.hunks.entries()){let h=ps(f);a(d,h-Math.max(f.collapsedBefore,0),h)}let l=t.hunks[t.hunks.length-1];if(l!=null&&!t.isPartial&&t.deletionLines.length>0)a(t.hunks.length,ps(l)+l.deletionCount,t.deletionLines.length);return s}function Kp(t,n){if(t.editSessionDirty!==!0)return!1;return delete t.editSessionDirty,Object.assign(t,t.additionLines.length<=1&&t.additionLines.join("")===""?Ti(t,n):Md(t,n)),!0}function sF(t,n,s){if(nF(t.deletionLines,t.additionLines)==null)return[];let a=ai({name:t.prevName??t.name,contents:t.deletionLines.join("")},{name:t.name,contents:t.additionLines.join(""),lang:t.lang},n),l,d=(I,b)=>{l??=aF(t.hunks);for(let v=0;v<=b;v++){let k=l.get(I.deletionLineIndex-v);if(k==null||k.additions!==I.additions||k.deletions!==I.deletions)continue;if(I.additions>0&&s!=null){for(let w=0;w<I.additions;w++)if(s(k.additionLineIndex+w)!==a.additionLines[I.additionLineIndex+w])return b}return v}return b},f=[],h=0,g=0;for(let I of a.hunks){aS(I,a,d);let b=I.additionCount>0?I.additionLineIndex-h:I.deletionLineIndex-g;h+=b,g+=b;for(let v of I.hunkContent){if(v.type==="context"){h+=v.lines,g+=v.lines;continue}let k=qp(v,0,0);if(k.additions===0)k.additionLineIndex=h;if(k.deletions===0)k.deletionLineIndex=g;f.push(k),h+=k.additions,g+=k.deletions}}return f}function aF(t){let n=new Map;for(let s of t)for(let a of s.hunkContent)if(a.type==="change"&&(a.additions===0||a.deletions===0))n.set(a.deletionLineIndex,a);return n}function lF(t,n,s){let a=t.map((f,h)=>{let g=ps(f);return{deletionStart:g,deletionEnd:g+f.deletionCount,blocks:[],previousSpan:{firstIndex:h,lastIndex:h}}}),l=[],d=0;for(let f of n){let h=f.deletionLineIndex,g=h+f.deletions;while(d<a.length&&a[d].deletionEnd<h)l.push(a[d]),d++;let I=l.length>0&&uF(h,g,l[l.length-1])?l.pop():void 0;while(d<a.length&&a[d].deletionStart<=g)I=cF(I,a[d]),d++;if(I==null){let b=h,v=g;if((f.deletions===0||f.additions===0)&&s>f.deletions){let k=l[l.length-1]?.deletionEnd??0,w=a[d]?.deletionStart??s;if(h>k)b--;else if(g<w)v++}I={deletionStart:b,deletionEnd:v,blocks:[],previousSpan:void 0}}I.deletionStart=Math.min(I.deletionStart,h),I.deletionEnd=Math.max(I.deletionEnd,g),I.blocks.push(f),l.push(I)}while(d<a.length)l.push(a[d]),d++;return l}function uF(t,n,s){return t<=s.deletionEnd&&n>=s.deletionStart}function cF(t,n){if(t==null)return n;if(t.deletionStart=Math.min(t.deletionStart,n.deletionStart),t.deletionEnd=Math.max(t.deletionEnd,n.deletionEnd),t.blocks.push(...n.blocks),n.previousSpan!=null)t.previousSpan??={...n.previousSpan},t.previousSpan.firstIndex=Math.min(t.previousSpan.firstIndex,n.previousSpan.firstIndex),t.previousSpan.lastIndex=Math.max(t.previousSpan.lastIndex,n.previousSpan.lastIndex);return t}function dF(t,n){let s=[],a=0,l=0;for(let d of n){let f=d.deletionStart-a;if(f<0)throw Error("buildRegionHunks: overlapping old-side regions");a+=f,l+=f;let h=l,g=[];for(let b of d.blocks){let v=b.deletionLineIndex-a,k=b.additionLineIndex-l;if(v<0||v!==k)throw Error("buildRegionHunks: canonical block context mismatch");p0(g,v,l,a),a+=v,l+=k,g.push({...b}),a+=b.deletions,l+=b.additions}let I=d.deletionEnd-a;if(I<0)throw Error("buildRegionHunks: block exceeds its old-side region");p0(g,I,l,a),a+=I,l+=I,s.push(mF(t,{additionStart:h,additionEnd:l,deletionStart:d.deletionStart,deletionEnd:d.deletionEnd},g))}if(t.deletionLines.length-a!==t.additionLines.length-l)throw Error("buildRegionHunks: trailing context mismatch");return s}function mF(t,n,s){let a=n.additionEnd-n.additionStart,l=n.deletionEnd-n.deletionStart,d=0,f=0;for(let g of s)if(g.type==="change")d+=g.additions,f+=g.deletions;let h={collapsedBefore:0,additionStart:Od(n.additionStart,a),additionCount:a,additionLines:d,additionLineIndex:g0(n.additionStart,a),deletionStart:Od(n.deletionStart,l),deletionCount:l,deletionLines:f,deletionLineIndex:g0(n.deletionStart,l),hunkContent:s,hunkSpecs:`@@ -${Od(n.deletionStart,l)},${l} +${Od(n.additionStart,a)},${a} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return _d(h),h}function p0(t,n,s,a){if(n>0)t.push({type:"context",lines:n,additionLineIndex:s,deletionLineIndex:a})}function fF(t,n){if(t.length!==n.length)return!0;for(let s=0;s<t.length;s++){let a=t[s],l=n[s];if(ps(a)!==ps(l)||a.deletionCount!==l.deletionCount||Fd(a)!==Fd(l)||a.additionCount!==l.additionCount||a.splitLineCount!==l.splitLineCount||!pF(a,l))return!0}return!1}function pF(t,n){let s=h0(t),a=h0(n);while(!0){let l=s.next(),d=a.next();if(l.done===!0||d.done===!0)return l.done===d.done;if(l.value[0]!==d.value[0]||l.value[1]!==d.value[1])return!1}}function*h0(t){for(let n of t.hunkContent){if(n.type==="context"){for(let a=0;a<n.lines;a++)yield[n.deletionLineIndex+a,n.additionLineIndex+a];continue}let s=Math.max(n.deletions,n.additions);for(let a=0;a<s;a++)yield[a<n.deletions?n.deletionLineIndex+a:void 0,a<n.additions?n.additionLineIndex+a:void 0]}}function Fd(t){return Nn(t.additionStart,t.additionCount)}function ps(t){return Nn(t.deletionStart,t.deletionCount)}function Od(t,n){return n===0?t:t+1}function g0(t,n){return n===0?t-1:t}function hF(t){ha(t);for(let n=0;n<t.hunks.length;n++)jp(t,n)}function Z(t){let n=t.lang??p(t.name),s=t.lang??(t.prevName!=null?p(t.prevName):"text");return n==="text"&&s==="text"}function A(t,n){return E(t.theme,n.theme)&&t.useTokenTransformer===n.useTokenTransformer&&t.tokenizeMaxLineLength===n.tokenizeMaxLineLength&&t.lineDiffType===n.lineDiffType&&t.maxLineDiffLength===n.maxLineDiffLength}function Pl(t){return ke({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":t,style:`grid-row: span ${t};min-height:calc(${t} * 1lh)`}})}function Ml(t){return ke({tagName:"div",children:[ke({tagName:"span",children:[xr("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":t,"data-column-content":""}})}function Vp(t){return ke({tagName:"div",children:[as({name:t==="both"?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":t==="both"?"":void 0,"data-expand-up":t==="up"?"":void 0,"data-expand-down":t==="down"?"":void 0}})}function hs({type:t,content:n,expandIndex:s,chunked:a=!1,slotName:l,isFirstHunk:d,isLastHunk:f}){let h=0,g=[];if(t==="metadata"&&n!=null)g.push(ke({tagName:"div",children:[xr(n)],properties:{"data-separator-wrapper":""}}));if((t==="line-info"||t==="line-info-basic")&&n!=null){let I=[];if(s!=null)if(!a)I.push(Vp(!d&&!f?"both":d?"down":"up")),h++;else{if(!d)I.push(Vp("up")),h++;if(!f)I.push(Vp("down")),h++}if(I.push(ke({tagName:"div",children:[ke({tagName:"span",children:[xr(n)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),a&&s!=null)I.push(ke({tagName:"div",children:[xr("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}}));g.push(ke({tagName:"div",children:I,properties:{"data-separator-wrapper":"","data-separator-multi-button":h>1?"":void 0}}))}if(t==="custom"&&l!=null)g.push(ke({tagName:"slot",properties:{name:l}}));return ke({tagName:"div",children:g,properties:{"data-separator":g.length===0?"simple":t,"data-expand-index":s,"data-separator-first":d?"":void 0,"data-separator-last":f?"":void 0}})}function b0(t,n){return`hunk-separator-${t}-${n}`}function C0(t){let n=t.at(-1);if(n==null)return 0;return Math.max(Dn(n.additionStart,n.additionCount),Dn(n.deletionStart,n.deletionCount))}function _l({line:t,spanStart:n,spanLength:s}){return{start:{line:t,character:n},end:{line:t,character:n+s},properties:{"data-diff-span":""},alwaysWrap:!0}}function Ol({item:t,arr:n,enableJoin:s,isNeutral:a=!1,isLastItem:l=!1}){let d=n[n.length-1];if(d==null||l||!s){n.push([a?0:1,t.value]);return}let f=d[0]===0;if(a===f||a&&t.value.length===1&&!f){d[1]+=t.value;return}n.push([a?0:1,t.value])}var gF={forcePlainText:!1};function Ze(t,n,s,{forcePlainText:a,startingLine:l,totalLines:d,expandedHunks:f,collapsedContextThreshold:h=1}=gF){if(a)l??=0,d??=1/0;else l=0,d=1/0;let g=l>0||d<1/0,I=typeof s.theme==="string"?n.getTheme(s.theme).type:void 0,b=id({theme:s.theme,highlighter:n}),v=a&&!g&&(t.unifiedLineCount>1000||t.splitLineCount>1000)?"none":s.lineDiffType,k={deletionLines:[],additionLines:[]},{maxLineDiffLength:w}=s,P=!a&&!t.isPartial,M=a?f:void 0,N=new Map;function _(B){let X=P?0:B,z=N.get(X)??IF();return N.set(X,z),z}function O(B,X,z,K){if(g){let W=z.at(-1);if(W==null||W.targetIndex+W.count!==X)W={targetIndex:X,originalOffset:K.length,count:0},z.push(W);W.count++}K.push(B)}si({diff:t,diffStyle:"both",startingLine:l,totalLines:d,expandedHunks:g?M:!0,collapsedContextThreshold:h,callback:({hunkIndex:B,additionLine:X,deletionLine:z,type:K})=>{let W=_(B),J=X!=null?X.splitLineIndex:z.splitLineIndex;if(K==="change"&&X!=null&&z!=null)xF({additionLine:t.additionLines[X.lineIndex],deletionLine:t.deletionLines[z.lineIndex],deletionLineIndex:W.deletionContent.length,additionLineIndex:W.additionContent.length,deletionDecorations:W.deletionDecorations,additionDecorations:W.additionDecorations,lineDiffType:v,maxLineDiffLength:w});if(z!=null)O(t.deletionLines[z.lineIndex],z.lineIndex,W.deletionSegments,W.deletionContent),W.deletionInfo.push({type:K==="change"?"change-deletion":K,lineNumber:z.lineNumber,altLineNumber:K==="change"?void 0:X.lineNumber??void 0,lineIndex:`${z.unifiedLineIndex},${J}`});if(X!=null)O(t.additionLines[X.lineIndex],X.lineIndex,W.additionSegments,W.additionContent),W.additionInfo.push({type:K==="change"?"change-addition":K,lineNumber:X.lineNumber,altLineNumber:K==="change"?void 0:z.lineNumber??void 0,lineIndex:`${X.unifiedLineIndex},${J}`})}});for(let B of N.values()){if(B.deletionContent.length===0&&B.additionContent.length===0)continue;let X={name:t.prevName??t.name,contents:B.deletionContent.value},z={name:t.name,contents:B.additionContent.value},{deletionLines:K,additionLines:W}=SF({deletionFile:X,deletionInfo:B.deletionInfo,deletionDecorations:B.deletionDecorations,additionFile:z,additionInfo:B.additionInfo,additionDecorations:B.additionDecorations,highlighter:n,options:s,languageOverride:a?"text":t.lang});if(P){k.deletionLines=K,k.additionLines=W;continue}if(B.deletionSegments.length>0)for(let J of B.deletionSegments)for(let ee=0;ee<J.count;ee++)k.deletionLines[J.targetIndex+ee]=K[J.originalOffset+ee];else ds(k.deletionLines,K);if(B.additionSegments.length>0)for(let J of B.additionSegments)for(let ee=0;ee<J.count;ee++)k.additionLines[J.targetIndex+ee]=W[J.originalOffset+ee];else ds(k.additionLines,W)}return{code:k,themeStyles:b,baseThemeType:I}}function yF(t,{deletionLineIndex:n,additionLineIndex:s,deletionDecorations:a,additionDecorations:l}){let d=0,f=0,h=-1,g=0,I=-1,b=0;for(let{value:v,added:k,removed:w}of t)if(w){if(h===-1)h=d;d+=v.length,g=d}else if(k){if(I===-1)I=f;f+=v.length,b=f}else d+=v.length,f+=v.length;if(h!==-1)a.push(_l({line:n,spanStart:h,spanLength:g-h}));if(I!==-1)l.push(_l({line:s,spanStart:I,spanLength:b-I}))}function xF({deletionLine:t,additionLine:n,deletionLineIndex:s,additionLineIndex:a,deletionDecorations:l,additionDecorations:d,lineDiffType:f,maxLineDiffLength:h}){if(t==null||n==null||f==="none")return;if(t=Pr(t),n=Pr(n),t.length>h||n.length>h)return;let g=f==="char"?_p(t,n):Dp(t,n);if(f==="word-line"){yF(g,{deletionLineIndex:s,additionLineIndex:a,deletionDecorations:l,additionDecorations:d});return}let I=[],b=[],v=f==="word-alt",k=g.at(-1);for(let P of g){let M=P===k;if(!P.added&&!P.removed)Ol({item:P,arr:I,enableJoin:v,isNeutral:!0,isLastItem:M}),Ol({item:P,arr:b,enableJoin:v,isNeutral:!0,isLastItem:M});else if(P.removed)Ol({item:P,arr:I,enableJoin:v,isLastItem:M});else Ol({item:P,arr:b,enableJoin:v,isLastItem:M})}let w=0;for(let P of I){if(P[0]===1)l.push(_l({line:s,spanStart:w,spanLength:P[1].length}));w+=P[1].length}w=0;for(let P of b){if(P[0]===1)d.push(_l({line:a,spanStart:w,spanLength:P[1].length}));w+=P[1].length}}function IF(){return{deletionContent:{push(t){this.value+=t,this.length++},value:"",length:0},additionContent:{push(t){this.value+=t,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function SF({deletionFile:t,additionFile:n,deletionInfo:s,additionInfo:a,highlighter:l,deletionDecorations:d,additionDecorations:f,languageOverride:h,options:{theme:g,...I}}){let b=h??p(t.name),v=h??p(n.name),{state:k,transformers:w}=td(I.useTokenTransformer),P=(()=>typeof g==="string"?{...I,lang:"text",theme:g,transformers:w,decorations:void 0,defaultColor:!1,cssVariablePrefix:nr("token"),tokenizeTimeLimit:0}:{...I,lang:"text",themes:g,transformers:w,decorations:void 0,defaultColor:!1,cssVariablePrefix:nr("token"),tokenizeTimeLimit:0})();return{deletionLines:(()=>{if(t.contents==="")return[];return P.lang=b,k.lineInfo=s,P.decorations=d,El(l.codeToHast(Pr(t.contents),P))})(),additionLines:(()=>{if(n.contents==="")return[];return P.lang=v,P.decorations=f,k.lineInfo=a,El(l.codeToHast(Pr(n.contents),P))})()}}var bF=-1,T0=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++bF}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=["text"];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(t={theme:u},n=S,s,a){if(this.options=t,this.annotationSlotName=n,this.onRenderUpdate=s,this.workerManager=a,a?.isWorkingPool()!==!0)this.highlighter=ur(t.theme??u)?T():void 0}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){if(this.highlighter=void 0,this.diff=void 0,this.editSessionActive){if(this.renderCache!=null)this.renderCache.renderRange=void 0;this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}else this.clearRenderCache();this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(t,n){let{editSessionActive:s}=this;if(this.editSessionActive=!0,!s)this.pendingHighlightResult=void 0;if(this.diff=t,s&&this.renderCache!=null&&this.renderCache.diff!==t)this.clearRenderCache();let{renderCache:a}=this;if(!t.isPartial&&t.additionLines.length===0){Object.assign(t,Al(t,this.options.parseDiffOptions)),this.markEditSessionPass(t),this.clearRenderCache();return}if(a==null)return;if(s&&a.diff===t)return;let{options:l}=this.getRenderOptions(t),d=a.diff===t,f=n!=null&&m(a.diff,n),{result:h}=a;if(!a.highlighted||h==null||!A(a.options,l)||!d&&!f){this.clearRenderCache();return}if(d)return;this.renderCache={diff:t,options:l,highlighted:!0,result:{...h,code:{...h.code,additionLines:[...h.code.additionLines]}},renderRange:a.renderRange}}endEditSession(){if(this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff==null)this.clearRenderCache()}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:t,renderCache:n,workerManager:s}=this;if(t==null||n==null||!m(n.diff,t)||Z(t)||$l(t,this.getTokenizeMaxLength()))return Promise.resolve();if(!this.editSessionActive&&s?.isWorkingPool()===!0&&t.cacheKey!=null)return s.evictDiffFromCache(t.cacheKey),s.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,s.getDiffResultCache(t))}).catch((a)=>this.onHighlightError(a));return this.asyncHighlight(t).then((a)=>this.applyRefreshedResult(t,a)).catch((a)=>this.onHighlightError(a))}applyRefreshedResult(t,n){let{diff:s,renderCache:a}=this;if(n==null||s==null||a==null||!m(s,t)||!m(a.diff,t)||this.editSessionActive)return;let{options:l}=this.getRenderOptions(s);if(!A(l,n.options))return;this.pendingHighlightResult={diff:s,options:n.options,highlighted:!0,result:n.result},this.onRenderUpdate?.()}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(t){this.options=t}mergeOptions(t){this.options={...this.options,...t}}expandHunk(t,n,s=this.getOptionsWithDefaults().expansionLineCount){let a={...this.expandedHunks.get(t)??{fromStart:0,fromEnd:0}};if(n==="up"||n==="both")a.fromStart+=s;if(n==="down"||n==="both")a.fromEnd+=s;if(this.renderCache?.highlighted!==!0)this.clearRenderCache();this.expandedHunks.set(t,a)}getExpandedHunk(t){return this.expandedHunks.get(t)??tS}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(t){this.expandedHunks=t}setLineAnnotations(t){this.additionAnnotations={},this.deletionAnnotations={};for(let n of t){let s=(()=>{switch(n.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),a=s[n.lineNumber]??[];s[n.lineNumber]=a,a.push(n)}}updateRenderCache(t,n,s=!1){this.pendingStructuralRows=void 0;let{renderCache:a}=this;if(a==null)return!1;let{result:l,diff:d}=a;if(l==null)return!1;if(d.isPartial)throw Error("Could not update render cache for partial diff");let f=l.code.additionLines,h=this.pendingStructuralRows=s?new Map:void 0,g=[],I=new Map;for(let[v,k]of t){let w=f[v]?.properties??{},P=k.map((B)=>B[2]).join(""),M=v<d.additionLines.length,N=M?d.additionLines[v]??"":"",_=Pr(N);if(h==null&&M){if(d.additionLines[v]=Wc(N,P),_!==P)g.push(v),I.set(v,N)}let O={type:"element",tagName:"div",properties:{"data-line":w["data-line"]??v+1,"data-line-index":w["data-line-index"]??v,"data-line-type":w["data-line-type"]??"context"},children:k.map(([B,X,z])=>{if(B===0&&X===""){if(z==="")return{type:"element",tagName:"br",properties:{},children:[]};return{type:"text",value:z}}return{type:"element",tagName:"span",properties:{"data-char":B,style:`color:${X};`},children:[{type:"text",value:z}]}})};if(h!=null)h.set(v,O);else f[v]=O}let b=!1;if(g.length>0)if(this.editSessionActive)if(d.additionLines.length<=1&&d.additionLines.join("")==="")this.applyRecomputePreservingSessionType(d,Al(d,this.options.parseDiffOptions)),b=!0;else if(Pd(d,d.additionLines))this.applyRecomputePreservingSessionType(d,Ll(d,d.additionLines,this.options.parseDiffOptions)),b=!0;else{let v=y0(d,g,this.options.parseDiffOptions,I);this.applyExpansionRemap(v),b=v!=null}else Object.assign(d,m0(d,g,this.options.parseDiffOptions));return l.baseThemeType=n,a.isDirty=!0,b}applyExpansionRemap(t){if(t!=null)this.expandedHunks=x0(this.expandedHunks,t)}applyDocumentChange(t){let{pendingStructuralRows:n,renderCache:s}=this;this.pendingStructuralRows=void 0;let a=this.diff??s?.diff;if(a==null)return;let l=s?.result;if(a.isPartial)throw Error("Could not apply document change for partial diff");let{additionLines:d}=a;if(a.additionLines=kF(t),l!=null)l.code.additionLines=vF(d,a.additionLines,l.code.additionLines,t);if(a.additionLines.length<=1&&a.additionLines.join("")===""){if(this.applyRecomputePreservingSessionType(a,Al(a,this.options.parseDiffOptions)),l!=null)l.code.additionLines[0]=Yp(0,t.getLineText(0))}else if(this.editSessionActive)this.applySessionDocumentChange(a,d);else Object.assign(a,Md(a,this.options.parseDiffOptions));if(n!=null&&l!=null){for(let[f,h]of n)if(f<l.code.additionLines.length)l.code.additionLines[f]=h}if(s!=null)s.isDirty=!0}applySessionDocumentChange(t,n){let{parseDiffOptions:s}=this.options,a=t.additionLines;if(Pd(t,a)){this.applyRecomputePreservingSessionType(t,Ll(t,a,s));return}this.applyExpansionRemap($d(t,s,(l)=>n[l]))}applyRecomputePreservingSessionType(t,n){let s=this.editSessionActive?t.type:void 0;if(Object.assign(t,n),s!=null)t.type=s;this.markEditSessionPass(t)}markEditSessionPass(t){if(!this.editSessionActive)return;t.editSessionDirty=!0}getUnifiedLineDecoration({lineType:t}){return{gutterLineType:t,contentProperties:{"data-line-type":t}}}getSplitLineDecoration({side:t,type:n}){let s=n==="change"?t==="deletions"?"change-deletion":"change-addition":n;return{gutterLineType:s,contentProperties:{"data-line-type":s}}}createAnnotationElement=(t)=>Il(t);getOptionsWithDefaults(){let{diffIndicators:t="bars",diffStyle:n="split",disableBackground:s=!1,disableFileHeader:a=!1,disableLineNumbers:l=!1,disableVirtualizationBuffers:d=!1,collapsed:f=!1,expandUnchanged:h=!1,collapsedContextThreshold:g=1,expansionLineCount:I=100,hunkSeparators:b="line-info",lineDiffType:v="word-alt",maxLineDiffLength:k=1000,overflow:w="scroll",stickyHeader:P=!1,theme:M=u,headerRenderMode:N="default",tokenizeMaxLineLength:_=1000,tokenizeMaxLength:O=QI,useTokenTransformer:B=!1,useCSSClasses:X=!1}=this.options;return{diffIndicators:t,diffStyle:n,disableBackground:s,disableFileHeader:a,disableLineNumbers:l,disableVirtualizationBuffers:d,collapsed:f,expandUnchanged:h,collapsedContextThreshold:g,expansionLineCount:I,hunkSeparators:b,lineDiffType:v,maxLineDiffLength:k,overflow:w,stickyHeader:P,theme:this.workerManager?.getDiffRenderOptions().theme??M,headerRenderMode:N,tokenizeMaxLineLength:_,tokenizeMaxLength:O,useTokenTransformer:B,useCSSClasses:X}}async initializeHighlighter(){return this.highlighter=await j(Qc(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(t){if(t==null)return;this.diff=t;let{options:n}=this.getRenderOptions(t),s=$l(t,this.getTokenizeMaxLength()),a=this.workerManager?.getDiffResultCache(t);if(a!=null&&!A(n,a.options))a=void 0;if(this.renderCache??={diff:t,hydrated:!0,highlighted:!s&&!Z(t),options:n,result:s?void 0:a?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){if(this.renderCache.result==null&&!s)this.workerManager.highlightDiffAST(this,this.diff)}else if(this.highlighter==null)this.computedLangs=Xp(t),this.initializeHighlighter()}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??u}getEffectiveCodeOptions(){let t=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:t?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(t){let n=(()=>{if(this.workerManager?.isWorkingPool()===!0){let h=this.workerManager.getDiffRenderOptions();if(this.editSessionActive&&h.useTokenTransformer!==!0)return{...h,useTokenTransformer:!0};return h}let{theme:a,tokenizeMaxLineLength:l,lineDiffType:d,maxLineDiffLength:f}=this.getOptionsWithDefaults();return{theme:a,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:l,lineDiffType:d,maxLineDiffLength:f}})();this.getOptionsWithDefaults();let{renderCache:s}=this;if(s?.result==null)return{options:n,forceHighlight:!0};if(!m(t,s.diff)||!A(n,s.options))return{options:n,forceHighlight:!0};return{options:n,forceHighlight:!1}}getDiffForNextRender(t){let{options:n}=this.getRenderOptions(t);if(this.getReadyRenderResult(t,n)!=null)return t;if(this.renderCache==null)return t;if(m(this.renderCache.diff,t))return this.renderCache.diff;let s=!(t.additionLines.length>0||t.deletionLines.length>0)||Z(t)||$l(t,this.getTokenizeMaxLength());return this.canRenderDiff(t,n,s)?t:this.renderCache.diff}canRenderDiff(t,n,s){let{renderCache:a}=this;if(a==null||m(a.diff,t))return!0;if(s)return a.result==null&&a.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&ur(n.theme);if(a.result==null&&a.hydrated!==!0)return!0;if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)return!a.highlighted;return this.highlighter!=null&&ur(n.theme)}renderDiff(t=this.diff,n=ea){if(this.diff=t,t==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:s,collapsedContextThreshold:a}=this.getOptionsWithDefaults(),{options:l,forceHighlight:d}=this.getRenderOptions(t),f=this.getReadyRenderResult(t,l);if(this.pendingHighlightResult=void 0,f!=null)this.renderCache={...f,diff:t,renderRange:void 0},d=!1;this.renderCache??={diff:t,highlighted:!1,options:l,result:void 0,renderRange:void 0};let h=t.additionLines.length>0||t.deletionLines.length>0,g=!h||Z(t)||$l(t,this.getTokenizeMaxLength()),I=this.canRenderDiff(t,l,g),b=!m(t,this.renderCache.diff),v=!ko(this.renderCache.renderRange,n);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let k=this.renderCache.result==null&&this.renderCache.highlighted&&!g&&!b&&cs(n);if(I&&!k&&(g||this.renderCache.result==null||!this.renderCache.highlighted&&(b||v))){if(this.renderCache.diff=t,this.renderCache.options=l,this.renderCache.highlighted=!1,this.renderCache.result==null||b||v||d)this.renderCache.result=this.workerManager.getPlainDiffAST(t,n.startingLine,n.totalLines,cs(n)?!0:s?!0:this.expandedHunks,a);this.renderCache.renderRange=n}if(!g&&h&&(!this.renderCache.highlighted||d))this.workerManager.highlightDiffAST(this,t)}else{this.computedLangs=Xp(t),this.highlighter??=T();let k=this.highlighter!=null&&ur(l.theme),w=this.highlighter!=null&&U(this.computedLangs),P=!g&&w;if(I&&this.highlighter!=null&&k&&(d||g||!this.renderCache.highlighted&&P||this.renderCache.result==null)){let{result:M,options:N}=this.renderDiffWithHighlighter(t,this.highlighter,g||!w);this.renderCache={diff:t,options:N,highlighted:P,result:M,renderRange:void 0}}if(!k||!g&&!w)this.asyncHighlight(t).then(({result:M,options:N})=>{this.applyHighlightResult(t,M,N,!g)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,n,this.renderCache.result):void 0}async asyncRender(t,n=ea){this.diff=t;let{result:s}=await this.asyncHighlight(t);return this.processDiffResult(t,n,s)}createPreElement(t,n,s){let{diffIndicators:a,disableBackground:l,disableLineNumbers:d,overflow:f}=this.getOptionsWithDefaults();return Jc({type:"diff",diffIndicators:a,disableBackground:l,disableLineNumbers:d,overflow:f,split:t,totalLines:n,customProperties:s})}async asyncHighlight(t){let n=$l(t,this.getTokenizeMaxLength());this.computedLangs=n?["text"]:Xp(t);let s=this.highlighter!=null&&ur(this.getLocalHighlightTheme()),a=n||this.highlighter!=null&&U(this.computedLangs);if(this.highlighter==null||!s||!a)this.highlighter=await this.initializeHighlighter();return this.renderDiffWithHighlighter(t,this.highlighter,n)}renderDiffWithHighlighter(t,n,s=!1){let{options:a}=this.getRenderOptions(t),{collapsedContextThreshold:l}=this.getOptionsWithDefaults(),d=Ze(t,n,a,{forcePlainText:s,expandedHunks:s?!0:void 0,collapsedContextThreshold:l});if(this.editSessionActive&&t.additionLines.length===1&&t.additionLines[0]===""&&d.code.additionLines[0]==null){let f;if(si({diff:t,diffStyle:"both",expandedHunks:s?!0:void 0,collapsedContextThreshold:l,callback:({additionLine:h})=>{if(h?.lineIndex!==0)return;return f=h,!0}}),f==null)throw Error("DiffHunksRenderer: missing empty addition line");d.code.additionLines[0]=Yp(0,"",f.unifiedLineIndex,f.splitLineIndex)}return{result:d,options:a}}onHighlightSuccess(t,n,s,a=!0){if(this.editSessionActive)return;this.applyHighlightResult(t,n,s,a)}applyHighlightResult(t,n,s,a=!0){let{diff:l,renderCache:d}=this;if(l==null||d==null||!m(l,t)||!A(s,this.getRenderOptions(l).options))return;if(!(d.result==null||!d.highlighted||!A(d.options,s)||!m(d.diff,l)))return;this.pendingHighlightResult={diff:l,options:s,highlighted:a,result:n},this.onRenderUpdate?.()}getMatchingWorkerResultCache(t,n){if(this.editSessionActive)return;let s=this.workerManager?.getDiffResultCache(t);if(s==null||!A(n,s.options))return;return s}getReadyRenderResult(t,n){let{pendingHighlightResult:s}=this;if(s!=null&&m(s.diff,t)&&A(s.options,n))return s;let a=this.getMatchingWorkerResultCache(t,n);if(a==null||this.hasHighlightedRenderCache(t,n))return;return{diff:t,highlighted:!0,...a}}hasHighlightedRenderCache(t,n){let{renderCache:s}=this;return s?.result!=null&&s.highlighted&&m(t,s.diff)&&A(n,s.options)}onHighlightError(t){console.error(t)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(t,n,{code:s,themeStyles:a,baseThemeType:l}){let{diffStyle:d,disableFileHeader:f,expandUnchanged:h,expansionLineCount:g,collapsedContextThreshold:I,hunkSeparators:b}=this.getOptionsWithDefaults(),v=this.renderCache?.isDirty??!1,k=d==="unified",w=TF(t,this.options.loadDiffFiles!=null),P=!t.isPartial||w,M=[],N=[],_=[],O=[],{additionLines:B,deletionLines:X}=s,z={rowCount:0,hunkSeparators:b,additionsContentAST:M,deletionsContentAST:N,unifiedContentAST:_,unifiedGutterAST:vo(),deletionsGutterAST:vo(),additionsGutterAST:vo(),expansionLineCount:g,hunkData:O,incrementRowCount(Ce=1){z.rowCount+=Ce},pushToGutter(Ce,qe){switch(Ce){case"unified":z.unifiedGutterAST.children.push(qe);break;case"deletions":z.deletionsGutterAST.children.push(qe);break;case"additions":z.additionsGutterAST.children.push(qe)}}},K=Mp({fileDiff:t,errorPrefix:"DiffHunksRenderer.processDiffResult"}),W={size:0,side:void 0,increment(){this.size+=1},flush(){if(d==="unified")return;if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}if(this.side==="additions")z.pushToGutter("additions",cr(void 0,"buffer",this.size)),M?.push(Pl(this.size));else z.pushToGutter("deletions",cr(void 0,"buffer",this.size)),N?.push(Pl(this.size));this.size=0,this.side=void 0}},J=(Ce,qe,Tt,jn,St)=>{z.pushToGutter(Ce,jc(qe,Tt,jn,St))};function ee(Ce){if(W.flush(),d==="unified")Wp("unified",Ce,z);else Wp("deletions",Ce,z),Wp("additions",Ce,z)}if(this.pushFileLevelAnnotations(t,d,n,z),si({diff:t,diffStyle:d,startingLine:n.startingLine,totalLines:n.totalLines,expandedHunks:h?!0:this.expandedHunks,collapsedContextThreshold:I,callback:({hunkIndex:Ce,hunk:qe,collapsedBefore:Tt,collapsedAfter:jn,additionLine:St,deletionLine:Nt,type:sn})=>{let En=Nt!=null?Nt.splitLineIndex:St.splitLineIndex,wr=St!=null?St.unifiedLineIndex:Nt.unifiedLineIndex;if(d==="split"&&sn!=="change")W.flush();if(Tt>0)ee({hunkIndex:Ce,collapsedLines:Tt,rangeSize:Math.max(qe?.collapsedBefore??0,0),hunkSpecs:qe?.hunkSpecs,isFirstHunk:Ce===0,isLastHunk:!1,isExpandable:P});let Kr=d==="unified"?wr:En,Vr={type:sn,hunkIndex:Ce,lineIndex:Kr,unifiedLineIndex:wr,splitLineIndex:En,deletionLine:Nt,additionLine:St};if(d==="unified"){let mn=this.getUnifiedInjectedRowsForLine?.(Vr);if(mn?.before!=null)E0(mn.before,z);let hr=Nt!=null?X[Nt.lineIndex]:void 0,Rr=St!=null?B[St.lineIndex]:void 0;if(hr==null&&Rr==null)throw console.error("DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong",{file:t.name}),Error("DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong");let Jo=sn==="change"?St!=null?"change-addition":"change-deletion":sn,ni=this.getUnifiedLineDecoration({type:sn,lineType:Jo,additionLineIndex:St?.lineIndex,deletionLineIndex:Nt?.lineIndex});if(J("unified",ni.gutterLineType,St!=null?St.lineNumber:Nt.lineNumber,`${wr},${En}`,ni.gutterProperties),Rr!=null)Rr=Dd(Rr,ni.contentProperties,v&&St!=null?{"data-line":St.lineNumber,"data-line-index":`${wr},${En}`}:void 0);else if(hr!=null)hr=Dd(hr,ni.contentProperties,v&&Nt!=null?{"data-line":Nt.lineNumber,"data-line-index":`${wr},${En}`}:void 0);if(Nd({diffStyle:"unified",type:sn,deletionLine:hr,additionLine:Rr,unifiedSpan:this.getAnnotations("unified",Nt?.lineNumber,St?.lineNumber,Ce,Kr),createAnnotationElement:(Bi)=>this.createAnnotationElement(Bi),context:z}),mn?.after!=null)E0(mn.after,z)}else{let mn=this.getSplitInjectedRowsForLine?.(Vr);if(mn?.before!=null)v0(mn.before,z,W);let hr=Nt!=null?X[Nt.lineIndex]:void 0,Rr=St!=null?B[St.lineIndex]:void 0,Jo=this.getSplitLineDecoration({side:"deletions",type:sn,lineIndex:Nt?.lineIndex}),ni=this.getSplitLineDecoration({side:"additions",type:sn,lineIndex:St?.lineIndex});if(hr==null&&Rr==null)throw console.error("DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong",{file:t.name}),Error("DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong");let Bi=(()=>{if(sn==="change"){if(Rr==null)return"additions";else if(hr==null)return"deletions"}})();if(Bi!=null){if(W.side!=null&&W.side!==Bi)W.flush();W.side=Bi,W.increment()}else if(sn==="change")W.flush();let ho=this.getAnnotations("split",Nt?.lineNumber,St?.lineNumber,Ce,Kr);if(ho!=null&&W.size>0)W.flush();if(Nt!=null){let Wr=Dd(hr,Jo.contentProperties,v?{"data-line":Nt.lineNumber,"data-line-index":`${Nt.unifiedLineIndex},${En}`}:void 0);if(J("deletions",Jo.gutterLineType,Nt.lineNumber,`${Nt.unifiedLineIndex},${En}`,Jo.gutterProperties),Wr!=null)hr=Wr}if(St!=null){let Wr=Dd(Rr,ni.contentProperties,v?{"data-line":St.lineNumber,"data-line-index":`${St.unifiedLineIndex},${En}`}:void 0);if(J("additions",ni.gutterLineType,St.lineNumber,`${St.unifiedLineIndex},${En}`,ni.gutterProperties),Wr!=null)Rr=Wr}if(Nd({diffStyle:"split",type:sn,additionLine:Rr,deletionLine:hr,...ho,createAnnotationElement:(Wr)=>this.createAnnotationElement(Wr),context:z}),mn?.after!=null)v0(mn.after,z,W)}let Yo=d==="split"&&qe!=null&&En===qe.splitLineStart+qe.splitLineCount-1,lr=Ce===t.hunks.length-1&&qe!=null&&(d==="split"?En===qe.splitLineStart+qe.splitLineCount-1:wr===qe.unifiedLineStart+qe.unifiedLineCount-1),Fs=Yo?qe.noEOFCRDeletions:!1,qa=Yo?qe.noEOFCRAdditions:!1,Hi=(Nt?.noEOFCR??!1)||Fs,Ui=(St?.noEOFCR??!1)||qa;if(Ui||Hi){if(d==="split")W.flush();if(Hi){let mn=sn==="context"||sn==="context-expanded"?sn:"change-deletion";if(d==="unified")z.unifiedContentAST.push(Ml(mn)),z.pushToGutter("unified",cr(mn,"metadata",1));else if(z.deletionsContentAST.push(Ml(mn)),z.pushToGutter("deletions",cr(mn,"metadata",1)),!Ui)z.pushToGutter("additions",cr(void 0,"buffer",1)),z.additionsContentAST.push(Pl(1))}if(Ui){let mn=sn==="context"||sn==="context-expanded"?sn:"change-addition";if(d==="unified")z.unifiedContentAST.push(Ml(mn)),z.pushToGutter("unified",cr(mn,"metadata",1));else if(z.additionsContentAST.push(Ml(mn)),z.pushToGutter("additions",cr(mn,"metadata",1)),!Hi)z.pushToGutter("deletions",cr(void 0,"buffer",1)),z.deletionsContentAST.push(Pl(1))}z.incrementRowCount(1)}if(b!=="simple"&&b!=="metadata"&&(jn>0||lr&&w))ee({hunkIndex:sn==="context-expanded"?Ce:Ce+1,collapsedLines:lr&&w?"unknown":jn,rangeSize:K,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:P});z.incrementRowCount(1)}}),d==="split")W.flush();let ce=Math.max(C0(t.hunks),t.additionLines.length??0,t.deletionLines.length??0),Ae=n.bufferBefore>0||n.bufferAfter>0,ue=!k&&t.type!=="deleted",Se=!k&&t.type!=="new",ut=z.rowCount>0||Ae;M=ue&&ut?M:void 0,N=Se&&ut?N:void 0,_=k&&ut?_:void 0;let It=this.createPreElement(N!=null&&M!=null,ce);return{fileDiff:t,unifiedGutterAST:k&&ut?z.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:Se&&ut?z.deletionsGutterAST.children:void 0,deletionsContentAST:N,additionsGutterAST:ue&&ut?z.additionsGutterAST.children:void 0,additionsContentAST:M,hunkData:O,preNode:It,themeStyles:a,baseThemeType:l,headerElement:!f?this.renderHeader(t):void 0,totalLines:ce,rowCount:z.rowCount,bufferBefore:n.bufferBefore,bufferAfter:n.bufferAfter,css:""}}renderCodeAST(t,n){let s=t==="unified"?n.unifiedGutterAST:t==="deletions"?n.deletionsGutterAST:n.additionsGutterAST,a=t==="unified"?n.unifiedContentAST:t==="deletions"?n.deletionsContentAST:n.additionsContentAST;if(s==null||a==null)return;let l=vo(s);return l.properties.style=`grid-row: span ${n.rowCount}`,[l,Xc(a,n.rowCount)]}renderFullAST(t,n=[]){let s=this.getOptionsWithDefaults().hunkSeparators==="line-info",a=this.renderCodeAST("unified",t);if(a!=null)return n.push(ke({tagName:"code",children:a,properties:{"data-code":"","data-container-size":s?"":void 0,"data-unified":""}})),{...t.preNode,children:n};let l=this.renderCodeAST("deletions",t);if(l!=null)n.push(ke({tagName:"code",children:l,properties:{"data-code":"","data-container-size":s?"":void 0,"data-deletions":""}}));let d=this.renderCodeAST("additions",t);if(d!=null)n.push(ke({tagName:"code",children:d,properties:{"data-code":"","data-container-size":s?"":void 0,"data-additions":""}}));return{...t.preNode,children:n}}renderFullHTML(t,n=[]){return pn(this.renderFullAST(t,n))}renderPartialHTML(t,n){if(n==null)return pn(t);return pn(ke({tagName:"code",children:t,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${n}`]:""}}))}pushFileLevelAnnotations(t,n,s,a){if(!Eo(s))return;let l=t.type!=="new"?this.getAnnotationNames(hl(this.deletionAnnotations)):[],d=t.type!=="deleted"?this.getAnnotationNames(hl(this.additionAnnotations)):[];if(l.length===0&&d.length===0)return;let f=-1,h=-1,{createAnnotationElement:g}=this;if(n==="unified"){Nd({diffStyle:n,type:"context",unifiedSpan:{type:"annotation",hunkIndex:f,lineIndex:h,annotations:l.concat(d)},createAnnotationElement:g,context:a});return}Nd({diffStyle:n,type:"context",deletionSpan:{type:"annotation",hunkIndex:f,lineIndex:h,annotations:l},additionSpan:{type:"annotation",hunkIndex:f,lineIndex:h,annotations:d},createAnnotationElement:g,context:a})}getAnnotations(t,n,s,a,l){let d={type:"annotation",hunkIndex:a,lineIndex:l,annotations:[]};if(n!=null)for(let h of this.deletionAnnotations[n]??[])d.annotations.push(this.annotationSlotName(h));let f={type:"annotation",hunkIndex:a,lineIndex:l,annotations:[]};if(s!=null)for(let h of this.additionAnnotations[s]??[])(t==="unified"?d:f).annotations.push(this.annotationSlotName(h));if(t==="unified"){if(d.annotations.length>0)return d;return}if(f.annotations.length===0&&d.annotations.length===0)return;return{deletionSpan:d,additionSpan:f}}getAnnotationNames(t){return t?.map((n)=>this.annotationSlotName(n))??[]}renderHeader(t){let{headerRenderMode:n,stickyHeader:s}=this.getOptionsWithDefaults();return Yc({fileOrDiff:t,mode:n,stickyHeader:s})}},CF=new Intl.PluralRules("en-US");function EF(t){return`${t} unmodified line${CF.select(t)==="one"?"":"s"}`}function E0(t,n){for(let s of t)n.unifiedContentAST.push(s.content),n.pushToGutter("unified",s.gutter),n.incrementRowCount(1)}function v0(t,n,s){for(let{deletion:a,addition:l}of t){if(a==null&&l==null)continue;let d=a!=null&&l!=null?void 0:a==null?"deletions":"additions";if(d==null||s.side!==d)s.flush();if(a!=null)n.deletionsContentAST.push(a.content),n.pushToGutter("deletions",a.gutter);if(l!=null)n.additionsContentAST.push(l.content),n.pushToGutter("additions",l.gutter);if(d!=null)s.side=d,s.increment();n.incrementRowCount(1)}}function Nd({diffStyle:t,type:n,deletionLine:s,additionLine:a,unifiedSpan:l,deletionSpan:d,additionSpan:f,createAnnotationElement:h,context:g}){let I=!1;if(t==="unified"){if(a!=null)g.unifiedContentAST.push(a);else if(s!=null)g.unifiedContentAST.push(s);if(l!=null){let b=n==="change"?s!=null?"change-deletion":"change-addition":n;g.unifiedContentAST.push(h(l)),g.pushToGutter("unified",cr(b,"annotation",1)),I=!0}}else if(t==="split"){if(s!=null)g.deletionsContentAST.push(s);if(a!=null)g.additionsContentAST.push(a);if(d!=null){let b=n==="change"?s!=null?"change-deletion":"context":n;g.deletionsContentAST.push(h(d)),g.pushToGutter("deletions",cr(b,"annotation",1)),I=!0}if(f!=null){let b=n==="change"?a!=null?"change-addition":"context":n;g.additionsContentAST.push(h(f)),g.pushToGutter("additions",cr(b,"annotation",1)),I=!0}}if(I)g.incrementRowCount(1)}function Wp(t,{hunkIndex:n,collapsedLines:s,rangeSize:a,hunkSpecs:l,isFirstHunk:d,isLastHunk:f,isExpandable:h},g){if(typeof s==="number"&&s<=0)return;let I=t==="unified"?g.unifiedContentAST:t==="deletions"?g.deletionsContentAST:g.additionsContentAST;if(g.hunkSeparators==="metadata"){if(l!=null){if(g.pushToGutter(t,hs({type:"metadata",content:l,isFirstHunk:d,isLastHunk:f})),I.push(hs({type:"metadata",content:l,isFirstHunk:d,isLastHunk:f})),t!=="additions")g.incrementRowCount(1)}return}if(g.hunkSeparators==="simple"){if(n>0){if(g.pushToGutter(t,hs({type:"simple",isFirstHunk:d,isLastHunk:!1})),I.push(hs({type:"simple",isFirstHunk:d,isLastHunk:!1})),t!=="additions")g.incrementRowCount(1)}return}let b=b0(t,n),v=a>g.expansionLineCount,k=h?n:void 0,w=typeof s==="number"?EF(s):"More unchanged context may be available";if(g.pushToGutter(t,hs({type:g.hunkSeparators,content:w,expandIndex:k,chunked:v,slotName:b,isFirstHunk:d,isLastHunk:f})),I.push(hs({type:g.hunkSeparators,content:w,expandIndex:k,chunked:v,slotName:b,isFirstHunk:d,isLastHunk:f})),t!=="additions")g.incrementRowCount(1);g.hunkData.push({slotName:b,hunkIndex:n,lines:typeof s==="number"?s:0,lineCountKnown:typeof s==="number",type:t,expandable:h?{up:!d,down:!f,chunked:v}:void 0})}function Dd(t,n,s){if(t==null||t.type!=="element"||n==null&&s==null)return t;return{...t,properties:{...t.properties,...n,...s}}}function k0(t){return t.length>0&&t[t.length-1]===""?t.length-1:t.length}function vF(t,n,s,a){let l=k0(t),d=k0(n),f=Math.min(l,d),h=0;while(h<f&&t[h]===n[h])h++;let g=0;while(g<f-h&&t[l-1-g]===n[d-1-g])g++;let I=Array(n.length);for(let b=0;b<h;b++)I[b]=s[b];for(let b=0;b<g;b++)I[d-1-b]=s[l-1-b];if(l<t.length&&d<n.length)I[n.length-1]=s[t.length-1];for(let b=h;b<n.length;b++)I[b]??=Yp(b,a.getLineText(b));return I}function Yp(t,n,s=t,a=t){return{type:"element",tagName:"div",properties:{"data-line":t+1,"data-line-index":`${s},${a}`,"data-line-type":"context"},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:n}]}]}}function kF(t){let n=[];for(let s=0;s<t.lineCount;s++)n.push(t.getLineText(s,!0));return n}function Xp(t){if(t.lang!=null)return[t.lang];let n=p(t.prevName??t.name),s=p(t.name);return n===s?[s]:[n,s]}function $l(t,n){return Math.max(t.additionLines.length,t.deletionLines.length)>n}function TF(t,n){return t.isPartial&&n&&(t.type==="change"||t.type==="rename-changed")}function w0(t,n){return t.lineNumber===n.lineNumber&&t.side===n.side&&t.metadata===n.metadata}function R0(t,n){return t.slotName===n.slotName&&t.hunkIndex===n.hunkIndex&&t.lines===n.lines&&t.lineCountKnown===n.lineCountKnown&&t.type===n.type&&t.expandable?.chunked===n.expandable?.chunked&&t.expandable?.up===n.expandable?.up&&t.expandable?.down===n.expandable?.down}function L0(t){return{theme:t?.theme,disableLineNumbers:t?.disableLineNumbers,overflow:t?.overflow,collapsed:t?.collapsed,disableFileHeader:t?.disableFileHeader,disableVirtualizationBuffers:t?.disableVirtualizationBuffers,stickyHeader:t?.stickyHeader,preferredHighlighter:t?.preferredHighlighter,useCSSClasses:t?.useCSSClasses,useTokenTransformer:xd(t),tokenizeMaxLineLength:t?.tokenizeMaxLineLength,tokenizeMaxLength:t?.tokenizeMaxLength,diffStyle:t?.diffStyle,diffIndicators:t?.diffIndicators,disableBackground:t?.disableBackground,hunkSeparators:typeof t?.hunkSeparators==="function"?"custom":t?.hunkSeparators,expandUnchanged:t?.expandUnchanged,loadDiffFiles:t?.loadDiffFiles,collapsedContextThreshold:t?.collapsedContextThreshold,lineDiffType:t?.lineDiffType,maxLineDiffLength:t?.maxLineDiffLength,expansionLineCount:t?.expansionLineCount,headerRenderMode:t?.renderCustomHeader!=null?"custom":"default"}}function Jp(t){return t.isPartial&&(t.type==="change"||t.type==="rename-changed"||t.type==="rename-pure")}function wF(t){let n={...t};return delete n.cacheKey,n}function A0(t,n){if(t.isPartial||n.isPartial)throw Error("FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated");let s=t.lang??p(t.name),a=n.lang??p(n.name),l=t.type!=="new",d=n.type!=="new";if(t.name!==n.name||s!==a||l!==d||t.deletionLines.length!==n.deletionLines.length)return!0;return t.deletionLines.some((f,h)=>f!==n.deletionLines[h])}function RF(t,n){return t.length===n.length&&t.every((s,a)=>s===n[a])}function LF(t,n){let{oldFile:s}=t;if(s==null)return n.type==="new";return n.type!=="new"&&s.name===(n.prevName??n.name)&&RF(s.lines,n.deletionLines)}var AF=-1,M0=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++AF}`;type="file-diff";fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(t={theme:u},n,s=!1){this.options=t,this.workerManager=n,this.isContainerManaged=s,this.hunksRenderer=this.createHunksRenderer(t),this.resizeManager=new Vc,this.scrollSyncManager=new d0,this.interactionManager=new Kc("diff",la(t,typeof t.hunkSeparators==="function"||(t.hunkSeparators??"line-info")==="line-info"||t.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??u}getHunksRendererOptions(t){return L0(t)}createHunksRenderer(t){return new T0(this.getHunksRendererOptions(t),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(t,n="additions")=>this.getLineIndexForDiff(this.getDiffForLineIndex(),t,n);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(t,n,s){if(t==null)return;let a=t.hunks.at(-1),l,d;e:for(let f of t.hunks){let h=s==="deletions"?f.deletionStart:f.additionStart,g=s==="deletions"?f.deletionCount:f.additionCount,I=Nn(h,g)+1,{splitLineStart:b,unifiedLineStart:v}=f;if(n<I){let k=I-n;l=Math.max(v-k,0),d=Math.max(b-k,0);break e}if(n>=I+g){if(f===a){let k=n-(I+g);l=v+f.unifiedLineCount+k,d=b+f.splitLineCount+k;break e}continue}for(let k of f.hunkContent)if(k.type==="context")if(n<I+k.lines){let w=n-I;d=b+w,l=v+w;break e}else I+=k.lines,b+=k.lines,v+=k.lines;else{let w=s==="deletions"?k.deletions:k.additions;if(n<I+w){let P=n-I;l=v+(s==="additions"?k.deletions:0)+P,d=b+P;break e}else I+=w,b+=Math.max(k.deletions,k.additions),v+=k.deletions+k.additions}break e}if(l==null||d==null)return;return[l,d]}setOptions(t){if(t==null)return;this.options=t,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(t)),this.syncInteractionOptions()}syncInteractionOptions(){this.interactionManager.setOptions(la(this.options,typeof this.options.hunkSeparators==="function"||(this.options.hunkSeparators??"line-info")==="line-info"||this.options.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(t){this.options={...this.options,...t}}setThemeType(t){if((this.options.themeType??"system")===t)return;this.mergeOptions({themeType:t}),this.applyCachedThemeState(t)}applyCachedThemeState(t){if(typeof this.options.theme==="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let n=this.appliedThemeCSS.baseThemeType??t;if(this.appliedThemeCSS.themeType===n)return!1;return this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,t,this.appliedThemeCSS.baseThemeType),!0}hasThemeChanged(){return this.appliedThemeCSS!=null&&!E(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=(t)=>yd(this.editSession?.annotations,t,S);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(t){let n=this.editSession?.annotations;if(t===this.lineAnnotations)return!1;return n==null||t!==n.provided&&t!==n.current}setLineAnnotations(t){let n=this.editSession?.annotations;if(n==null){this.lineAnnotations=t;return}if(!this.isNewAnnotations(t))return;this.lineAnnotations=t,gd(n,t,S)}syncEditSessionAnnotationsFromEditor(t){let n=this.editSession?.annotations;if(n==null||t===n.current)return!1;return n.current=t,this.hunksRenderer.setLineAnnotations(t),this.renderAnnotations(),!0}canPartiallyRender(t,n,s){if(t||n||s||typeof this.options.hunkSeparators==="function")return!1;return!0}setSelectedLines(t,n){if(this.lineStateRefreshPending)this.deferredSelectedLines=[t,n];else this.interactionManager.setSelection(t,n)}setEditorActiveLine(t,n){if(this.lineStateRefreshPending)this.deferredEditorActiveLine=[t,n];else this.interactionManager.setEditorActiveLine(t,{lineNumberOnly:n?.lineNumberOnly,side:n?.side??"additions"})}flushDeferredLineState(){let{deferredEditorActiveLine:t,deferredSelectedLines:n}=this;if(this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,t!=null)this.setEditorActiveLine(...t);if(n!=null)this.interactionManager.setSelection(...n)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:t="split",overflow:n="scroll"}=this.options;if(this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:n==="wrap",columnVariables:this.shouldApplyColumnVariables(n)?"apply":"measure"}),n==="scroll"&&t==="split")this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions);else this.scrollSyncManager.cleanUp();this.managersDirty=!1}shouldApplyColumnVariables(t){if(typeof this.options.hunkSeparators==="function")return!0;return t==="scroll"&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute("data-has-merge-conflict")===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(t){if(this.codeUnified!=null)this.codeUnified.scrollLeft=t;if(this.codeAdditions!=null)this.codeAdditions.scrollLeft=t;if(this.codeDeletions!=null)this.codeDeletions.scrollLeft=t}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(t=!1){let{editor:n}=this;if(D(this.handleEditSessionRender),this.emitPostRender(!0),n?.cleanUp(t?"recycle":"discard"),!t)this.editor=void 0;if(this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,!t)this.pendingFiles=void 0;if(!this.isContainerManaged)this.fileContainer?.remove();if(this.fileContainer=void 0,this.mounted=!1,!t)this.lineAnnotations=[];if(this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,!t)this.clearReusableHeader();if(this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,t)this.hunksRenderer.recycle();else this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0;if(this.refreshViewTimeout!=null)clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:t,prerenderedHTML:n,preventEmit:s=!1,lineAnnotations:a,fileDiff:l,...d}){if(!this.enabled)throw Error("FileDiff.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw Error("FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated");let f=Tl(d,"FileDiff.hydrate"),h=f?.oldFile,g=f?.newFile;this.hydrateElements(t,n);let I=this.editor!=null;if(I||OF(this.pre,MF({fileDiff:l,oldFile:h,newFile:g}),this.options.collapsed)||$F(this.headerElement,_F({fileDiff:l,oldFile:h,newFile:g}),this.options.disableFileHeader))this.render({...d,fileContainer:t,lineAnnotations:a,fileDiff:l,forceRender:I||d.forceRender,preventEmit:!0});else this.hydrationSetup({fileDiff:l,lineAnnotations:a,...f});if(!s)this.emitPostRender()}hydrateElements(t,n){if(this.fileContainer!==t)this.emitPostRender(!0);Sd(t,n);for(let s of t.shadowRoot?.children??[]){if(s instanceof SVGElement){this.spriteSVG=s;continue}if(!(s instanceof HTMLElement))continue;if(s instanceof HTMLPreElement){this.pre=s;for(let a of s.children){if(!(a instanceof HTMLElement)||a.tagName.toLowerCase()!=="code")continue;if("deletions"in a.dataset)this.codeDeletions=a;if("additions"in a.dataset)this.codeAdditions=a;if("unified"in a.dataset)this.codeUnified=a}continue}if("diffsHeader"in s.dataset){this.headerElement=s;continue}if(s instanceof HTMLStyleElement&&s.hasAttribute("data-theme-css")){this.themeCSSStyle=s;continue}if(s instanceof HTMLStyleElement&&s.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=s,this.appliedUnsafeCSS=s.textContent;continue}}if(this.pre!=null)this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated");this.fileContainer=t,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:t,oldFile:n,newFile:s,lineAnnotations:a}){if(this.lineAnnotations=a??this.lineAnnotations,this.additionFile=s,this.deletionFile=n,this.fileDiff=t??(n!==void 0&&s!==void 0?ai(n,s,this.options.parseDiffOptions):void 0),this.pre==null)return;this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers()}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(t,n,s)=>{this.expandHunk(t,n,s)};expandHunk=(t,n,s)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(t,n,s),this.rerender()};loadFilesIfNecessary(){let{fileDiff:t,options:{loadDiffFiles:n}}=this;if(t==null||!Jp(t)||this.pendingFiles?.fileDiff===t)return;if(n==null)throw Error("FileDiff: loadDiffFiles is required to load full files for a partial diff");let s=this.loadFilesForDiff(t,n),a=this.pendingFiles={fileDiff:t,promise:s},l=()=>{if(this.pendingFiles===a)this.pendingFiles=void 0};a.promise=s.finally(l)}__canAttachEditor(){return this.fileDiff!=null&&!this.fileDiff.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;let t=this.__prepareForEditing();if(t==null){if(this.fileDiff?.isPartial===!0&&!Jp(this.fileDiff))throw Error("FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff");throw Error("FileDiff.prepareForEditing: a partial diff requires loadDiffFiles")}if(await t,!this.__canAttachEditor())throw Error("FileDiff.prepareForEditing: the diff did not finish loading")}__prepareForEditing(){if(this.__canAttachEditor())return;if(this.fileDiff?.isPartial===!0&&!Jp(this.fileDiff))throw Error("FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit");return this.loadFilesIfNecessary(),this.pendingFiles?.promise}async loadFilesForDiff(t,n){try{let s=await n(t);if(this.fileDiff!==t)return;await this.handleFilesLoaded(t,s)}catch(s){if(this.options.disableErrorHandling===!0)throw s;console.error(s)}}async handleFilesLoaded(t,n){if(this.fileDiff!==t||!t.isPartial)return;if(wl("merge",t,n),this.setHydratedState(n),this.installHydratedSessionDiff(t)){this.rerender();return}if(await kl(()=>this.primeHighlightCache(t)),!this.enabled||this.fileDiff!==t)return;this.rerender()}installHydratedSessionDiff(t){if(t.isPartial)throw Error("FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing");if(this.fileDiff!==t)return!1;if(this.editSession?.outgoingDiff!=null)return this.installEditSession(t),!0;return!1}updateExternalDiff(t,n){if(m(this.fileDiff,t))return!1;let s=this.editSession?.outgoingDiff??this.editSession?.diff;if(this.fileDiff=t,s!=null){if(t.isPartial)this.loadFilesIfNecessary();else this.installEditSession(t);if(this.editSession!=null)this.editSession.outgoingDiff=s}if(this.editSession?.annotations!=null&&n!=null)this.lineAnnotations=n,this.editSession.annotations=ua(n,S,this.editSession.annotations);return!0}installEditSession(t,n,s){let a=t.additionLines.join(""),l=n!=null?ma(n.contents):void 0,d=s!=null&&LF(s,t);if(s!=null&&!d)throw Error("FileDiff: retained session cannot resume against a different old file");if(n!=null&&n.contents!==a&&!d)throw Error("FileDiff: retained edits are missing their diff session state");let f=n==null||n.name===t.name&&n.lang===t.lang&&n.contents===a,h=wF(t);if(n!=null&&l!=null&&!f)h.name=n.name,h.lang=n.lang;if(d&&s!=null&&l!=null)h.additionLines=l,h.type=s.type,h.hunks=s.hunks,h.editSessionDirty=!0,ha(h);this.editSession={diff:h,annotations:this.editSession?.annotations??ua(this.lineAnnotations,S),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(h,f&&!d?t:void 0)}setHydratedState(t){this.deletionFile=t.oldFile,this.additionFile=t.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:t,deferManagers:n=!1,forceRender:s=!1,preventEmit:a=!1,lineAnnotations:l,fileContainer:d,containerWrapper:f,renderRange:h,...g}){if(!this.enabled)throw Error("FileDiff.render: attempting to call render after cleaned up");let I=Tl(g,"FileDiff.render"),b=I?.oldFile,v=I?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:k=!1,themeType:w="system",expandUnchanged:P=!1}=this.options,M=k?void 0:h,N=this.hasThemeChanged(),_=I!=null,O=_&&(!P0(b,this.deletionFile)||!P0(v,this.additionFile)),B=t!=null&&!m(t,this.fileDiff),X=l!=null&&(l.length>0||this.getLatestAnnotations().length>0)?this.isNewAnnotations(l):!1;if(!k&&ko(M,this.renderRange)&&!s&&!X&&!N&&(t!=null&&!B||t==null&&!O)){let ce=this.applyCachedThemeState(w);if(ce)this.finalizeRender();return ce}let z;if(t==null&&_&&(O||this.fileDiff==null))z=ai(I.oldFile,I.newFile,this.options.parseDiffOptions);let{renderRange:K}=this;if(this.renderRange=M,_)this.deletionFile=b,this.additionFile=v;else if(t!=null)this.deletionFile=void 0,this.additionFile=void 0;if(t!=null&&B)this.updateExternalDiff(t,l);else if(z!=null)B=!0,this.updateExternalDiff(z,l);if(B)this.clearReusableHeader();if(l!=null)this.setLineAnnotations(l);let W=this.getLatestDiff();if(W==null)return!1;if(W.editSessionDirty===!0&&this.shouldSelfHealEditSession())Kp(W,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult();if(P)this.loadFilesIfNecessary();this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:J=!1,disableFileHeader:ee=!1}=this.options;if(ee){if(this.headerElement!=null)this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0;this.clearHeaderSlots()}if(d=this.getOrCreateFileContainer(d,f),this.applyCachedThemeState(w),k){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let ce=this.hunksRenderer.renderDiff(W,Uc);if(ce!=null)this.applyThemeState(d,ce.themeStyles,w,ce.baseThemeType);if(ce?.headerElement!=null)this.applyHeaderToDOM(ce.headerElement,d,ce.fileDiff);this.renderSeparators([]),this.renderedDiff=ce?.fileDiff??W,this.injectUnsafeCSS()}catch(ce){if(J)throw ce;if(console.error(ce),ce instanceof Error)this.applyErrorToDOM(ce,d)}if(this.finalizeRender(),!a)this.emitPostRender();return!0}try{let ce=this.getOrCreatePreNode(d);if(!(this.canPartiallyRender(s,X,O||B||N||!m(this.renderedDiff,W))&&this.applyPartialRender({fileDiff:W,previousRenderRange:K,renderRange:M}))){let Ae=this.hunksRenderer.renderDiff(W,M);if(Ae==null){if(this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool())this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender());return!1}if(this.applyThemeState(d,Ae.themeStyles,w,Ae.baseThemeType),Ae.headerElement!=null)this.applyHeaderToDOM(Ae.headerElement,d,Ae.fileDiff);if(Ae.additionsContentAST!=null||Ae.deletionsContentAST!=null||Ae.unifiedContentAST!=null)this.applyHunksToDOM(ce,Ae);else if(this.pre!=null)this.pre.remove(),this.pre=void 0;this.renderSeparators(Ae.hunkData),this.renderedDiff=Ae.fileDiff}if(this.applyBuffers(ce,M),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,!n)this.flushManagers();if(this.finalizeRender(),this.editor!=null)this.syncRenderViewToEditor()}catch(ce){if(J)throw ce;if(console.error(ce),ce instanceof Error)this.applyErrorToDOM(ce,d)}if(!a)this.emitPostRender();return!0}finalizeRender(){}emitPostRender(t=!1){let{fileContainer:n,options:{onPostRender:s}}=this;if(t){if(!this.mounted)return;if(this.mounted=!1,n==null)return;this.options.onPostRender?.(n,this,"unmount");return}if(n==null)return;let a=this.mounted?"update":"mount";this.mounted=!0,s?.(n,this,a)}getLatestDiff(t=this.fileDiff){return this.editSession?.diff??t}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:t,fileContainer:n}=this,s=this.getLatestAnnotations(),a=this.computeEditorRenderRange(this.renderRange),l=this.getLatestDiff();if(t==null||n==null||l==null||l.isPartial)return;let d=(I)=>{if(!this.enabled||this.editor!==t||this.fileContainer!==n||this.getLatestDiff()!==l)return;let b=this.editSession?.outgoingDiff,{fileDiff:v}=this,k=b!=null&&v!=null&&b!==l,w=k&&b!=null&&v!=null?A0(b,v):!1;t.__syncRenderView({highlighter:I,fileContainer:n,fileDiff:l,lineAnnotations:s,renderRange:a,externalDocument:k,resetHistory:w})},f=this.getTheme(),h=l.lang??p(l.name),g=T({theme:f,lang:h});if(g!=null)d(g);else j({themes:C(f),langs:["text",h],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(d)}computeEditorRenderRange(t){let n=this.getLatestDiff();if(t==null||n==null||cs(t))return t;let{diffStyle:s="split",expandUnchanged:a=!1,collapsedContextThreshold:l=1}=this.options,d,f;if(si({diff:n,diffStyle:s,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l,callback:({additionLine:h})=>{if(h!=null)d??=h.lineNumber,f=h.lineNumber}}),d==null||f==null)return{...t,startingLine:0,totalLines:0};return{...t,startingLine:d-1,totalLines:f-d+1}}__acknowledgeDocumentUpdate(){if(this.editSession!=null)this.editSession.outgoingDiff=void 0}__acceptEditorChange(t){let{lineAnnotations:n}=t;if(n!=null)this.syncEditSessionAnnotationsFromEditor(n)}emitEditChange(t){let{onEditChange:n}=this.options;n?.(t)}__captureDocumentSessionState(t=!0){let{fileDiff:n,editSession:{diff:s,outgoingDiff:a}={}}=this;if(a!=null&&n!=null){if(!n.isPartial&&A0(a,n))return;s=a}if(s==null||s.isPartial)return;return{diffSession:{oldFile:s.type!=="new"?{name:s.prevName??s.name,lines:t?[...s.deletionLines]:s.deletionLines}:null,type:s.type,hunks:t?Pe(s.hunks):s.hunks},hasChanges:s.editSessionDirty===!0}}__attachEditor(t){if(this.type!=="file-diff")throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error("FileDiff.__attachEditor: an editor is already attached");if(!this.__canAttachEditor())throw Error("FileDiff.__attachEditor: a complete diff is required before editing");let n=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(t),n}catch(s){throw n(),s}}__resumeEditor(t){if(this.editor!==t)throw Error("FileDiff.__resumeEditor: editor association changed");this.resumeEditorRendering(t)}resumeEditorRendering(t){let{fileDiff:n}=this,s=this.editSession?.outgoingDiff;if(s!=null&&n!=null&&!n.isPartial&&this.editSession?.diff===s)this.installEditSession(n);let a=this.editSession==null&&n!=null&&!n.isPartial?n:void 0;if(a!=null)this.installEditSession(a,t.__getDocumentContents(PF(a)),t.__getDocumentSessionState());else if(this.editSession!=null)this.hunksRenderer.beginEditSession(this.editSession.diff);if(this.editor=t,this.fileDiff?.isPartial===!0)this.loadFilesIfNecessary();let l=this.editSession?.diff;if(this.hunksRenderer.editorRenderReady()){if(l!=null&&this.hunksRenderer.diffCache===l)this.renderedDiff=l;this.syncRenderViewToEditor()}else this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(t,n){this.settleEditSession(n==="install",t)}settleEditSession(t,n){let{editSession:s,fileDiff:a,lineAnnotations:l}=this;if(s==null||a==null)return;let{diff:d,annotations:f}=s;if(this.editor!=null)throw Error("FileDiff.__completeEditSession: detach the editor before completing the session");this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let h=f?.current,g,I=null,b=null,v=!1,k;if(n==null)throw Error("FileDiff.__completeEditSession: editor is required for completion");let w=vd(d),P={name:w.name,contents:w.additionLines.join("")};if(w.lang!=null)P.lang=w.lang;let M={fileDiff:w,editor:n,originalFileDiff:a,oldFile:w.type==="new"?null:{name:w.prevName??w.name,contents:w.deletionLines.join("")},newFile:P,lineAnnotations:h,originalLineAnnotations:l};Object.freeze(M);try{if(n.__emitEditComplete(M),this.options.onEditComplete?.(M)==="accept"){if(w.cacheKey!=null&&w.cacheKey===a.cacheKey)throw Error("FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey");g=w,I=M.oldFile,b=M.newFile}}catch(N){v=!0,k=N}if(t&&g!=null){if(this.fileDiff=g,this.additionFile!=null)this.deletionFile=I,this.additionFile=b;if(h!=null)this.lineAnnotations=h}if(this.editSession=void 0,t&&this.fileContainer!=null)this.rerender();if(v)throw k}finalizeEditSessionHunks(){let t=this.getLatestDiff();if(t==null||t.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:n=1}=this.options,s=I0(t,this.hunksRenderer.getExpandedHunksMap(),n);return Kp(t,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(S0(t,s)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(t,n){let s=this.editSession?.diff;if(s==null)throw Error("FileDiff.applyDocumentChange: requires an active edit session");if(this.detachAdditionLines(),this.hunksRenderer.beginEditSession(s),this.hunksRenderer.applyDocumentChange(t),n!=null)this.syncEditSessionAnnotationsFromEditor(n);this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(t,n){this.applyDocumentChange(t,n),this.hunksRenderer.clearRenderCache()}updateRenderCache(t,n,s={}){let a=this.editSession?.diff;if(a==null)throw Error("FileDiff.updateRenderCache: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(a);let{shouldRefreshDiffsView:l,lineCountChangeInFlight:d}=s;if(this.hunksRenderer.updateRenderCache(t,n,d)){if(this.refreshViewTimeout!=null)clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0;this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}if(l===!0){if(this.refreshViewTimeout!=null)clearTimeout(this.refreshViewTimeout);this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{if(this.refreshViewTimeout=void 0,this.options.diffStyle==="split")this.refreshSplitDiffView();else this.refreshUnifiedDiffView();this.flushDeferredLineState()},150)}}detachAdditionLines(){let t=this.editSession?.diff,{fileDiff:n}=this;if(t!=null&&(t.additionLines===n?.additionLines||t.additionLines===t.deletionLines))t.additionLines=[...t.additionLines]}isLineRenderable(t){let n=this.getRenderedDiff();if(n==null)return!0;let{expandUnchanged:s=!1,collapsedContextThreshold:a=1}=this.options;return Ed({fileDiff:n,lineNumber:t,expandedHunks:s?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a})}getNearestRenderableLine(t,n){let s=this.getRenderedDiff();if(s==null)return t;let{expandUnchanged:a=!1,collapsedContextThreshold:l=1}=this.options;return JS({fileDiff:s,lineNumber:t,direction:n,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l})}revealLine(t){let n=this.getRenderedDiff(),{expandUnchanged:s=!1,collapsedContextThreshold:a=1,expansionLineCount:l=100}=this.options;if(n==null||n.isPartial||s)return!1;let d=this.hunksRenderer.getExpandedHunksMap();for(let[I,b]of n.hunks.entries()){let[v,k]=da(b);if(t<v){let w=Ir({isPartial:n.isPartial,rangeSize:b.collapsedBefore,expandedHunks:d,hunkIndex:I,collapsedContextThreshold:a}),P=v-w.rangeSize;if(w.renderAll||t<P+w.fromStart||t>=v-w.fromEnd)return!1;let M=t-(P+w.fromStart)+1,N=v-w.fromEnd-t;if(M<=N)this.expandHunk(I,"up",M+l);else this.expandHunk(I,"down",N+l);return!0}if(t<k)return!1}let f=Sr({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:d,collapsedContextThreshold:a,errorPrefix:"FileDiff.revealLine"});if(f==null||f.renderAll)return!1;let h=n.hunks[n.hunks.length-1],[,g]=da(h);if(t<g+f.fromStart||t>=g+f.rangeSize)return!1;return this.expandHunk(n.hunks.length,"up",t-(g+f.fromStart)+1+l),!0}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){q(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:t}of this.separatorCache.values())t.remove();this.separatorCache.clear();for(let{element:t}of this.annotationCache.values())t.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(t){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let n=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",n.appendChild(this.placeHolder)}return this.setPlaceholderHeight(t)}setPlaceholderHeight(t){if(this.placeHolder==null)return!1;return this.placeHolder.style.setProperty("height",`${t}px`),!0}async primeHighlightCache(t=this.fileDiff){let{workerManager:n}=this;if(t==null||n==null||!n.isWorkingPool()||t.cacheKey==null||Z(t))return;let s=this.options.tokenizeMaxLength??1e5;if(Math.max(t.additionLines.length,t.deletionLines.length)>s)return;await n.primeDiffHighlightCache(t).catch((a)=>{console.error(a)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(t){let{hunkSeparators:n}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof n!=="function"){for(let{element:a}of this.separatorCache.values())a.remove();this.separatorCache.clear();return}let s=new Map(this.separatorCache);for(let a of t){let l=a.slotName,d=this.separatorCache.get(l);if(d==null||!R0(a,d.hunkData)){d?.element.remove();let f=document.createElement("div");f.style.display="contents",f.slot=a.slotName;let h=n(a,this);if(h!=null)f.appendChild(h);this.fileContainer.appendChild(f),d={element:f,hunkData:a},this.separatorCache.set(l,d)}s.delete(l)}for(let[a,{element:l}]of s.entries())this.separatorCache.delete(a),l.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:a}of this.annotationCache.values())a.remove();this.annotationCache.clear();return}let t=new Map(this.annotationCache),{renderAnnotation:n}=this.options,s=this.getLatestAnnotations();if(n!=null&&s.length>0)for(let[a,l]of s.entries()){let d=this.getAnnotationSlotName(l),f=`${a}-${d}`,h=this.annotationCache.get(f);if(h==null||!w0(l,h.annotation)){h?.element.remove();let g=n(l);if(g==null)continue;h={element:ud(d),annotation:l},h.element.appendChild(g),this.fileContainer.appendChild(h.element),this.annotationCache.set(f,h)}t.delete(f)}for(let[a,{element:l}]of t.entries())this.annotationCache.delete(a),l.remove()}renderGutterUtility(){let{renderGutterUtility:t}=this.options;if(this.fileContainer==null||t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=t(this.interactionManager.getHoveredLine);if(n!=null&&this.gutterUtilityContent!=null)return;else if(n==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let s=cd();s.appendChild(n),this.fileContainer.appendChild(s),this.gutterUtilityContent=s}getOrCreateFileContainer(t,n){let{fileContainer:s}=this,a=t??s??document.createElement("diffs-container"),l=s!==a;if(s!=null&&l)this.editor?.__captureFocusForDOMReplacement();if(l)this.emitPostRender(!0);if(this.fileContainer=a,s!=null&&l)this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0;if(n!=null&&this.fileContainer.parentNode!==n)n.appendChild(this.fileContainer);if(l)this.adoptReusableShellElements(this.fileContainer);return this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(t){let{shadowRoot:n}=t;if(n==null)return;for(let s of n.children)if(s instanceof SVGElement)this.spriteSVG??=s;else if(Co(s)&&s.hasAttribute("data-theme-css"))this.themeCSSStyle??=s,this.hasAdoptedThemeCSS=!0;else if(Co(s)&&s.hasAttribute("data-unsafe-css"))this.unsafeCSSStyle??=s,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0}ensureSpriteSVG(t){let n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.spriteSVG==null){let s=document.createElement("div");s.innerHTML=ad;let a=s.firstChild;if(a instanceof SVGElement)this.spriteSVG=a}if(this.spriteSVG!=null&&this.spriteSVG.parentNode!==n)n.appendChild(this.spriteSVG)}getOrCreatePreNode(t){let n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.pre==null)this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,n.appendChild(this.pre);else if(this.pre.parentNode!==n)this.editor?.__captureFocusForDOMReplacement(),n.appendChild(this.pre),this.appliedPreAttributes=void 0;return this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(t){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let n of Array.from(t.children)){if(!(n instanceof HTMLElement))continue;if(n.hasAttribute("data-unified"))this.codeUnified=n;else if(n.hasAttribute("data-deletions"))this.codeDeletions=n;else if(n.hasAttribute("data-additions"))this.codeAdditions=n}}applyHeaderToDOM(t,n,s){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:a,html:l,lastRenderedHTML:d}}=this,f=(s!==this.editSession?.diff&&m(a,s)?l:void 0)??pn(t);if(this.headerCache.html=f,this.headerCache.fileDiff=s,f!==d){let P=document.createElement("div");P.innerHTML=f;let M=P.firstElementChild;if(!(M instanceof HTMLElement))return;if(this.headerElement!=null)n.shadowRoot?.replaceChild(M,this.headerElement);else n.shadowRoot?.prepend(M);this.headerElement=M,this.headerCache.lastRenderedHTML=f}if(this.isContainerManaged)return;let{renderCustomHeader:h,renderHeaderPrefix:g,renderHeaderFilenameSuffix:I,renderHeaderMetadata:b}=this.options;if(h!=null){let P=h(s)??void 0;this.headerCustom=this.upsertHeaderSlotElement(n,this.headerCustom,Qs,P),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let v=g?.(s)??void 0,k=I?.(s)??void 0,w=b?.(s)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(n,this.headerPrefix,Xs,v),this.headerFilenameSuffix=this.upsertHeaderSlotElement(n,this.headerFilenameSuffix,Ys,k),this.headerMetadata=this.upsertHeaderSlotElement(n,this.headerMetadata,Js,w),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(t,n,s,a){if(a==null){n?.remove();return}let l=n??this.createHeaderSlotElement(s);if(n==null)t.appendChild(l);return this.replaceHeaderSlotContent(l,a),l}replaceHeaderSlotContent(t,n){if(t.replaceChildren(),n instanceof Element)t.appendChild(n);else t.innerText=`${n}`}createHeaderSlotElement(t){let n=document.createElement("div");return n.slot=t,n}injectUnsafeCSS(){let{unsafeCSS:t}=this.options,n=this.fileContainer?.shadowRoot;if(n==null)return;if(t==null||t===""){if(this.unsafeCSSStyle!=null)this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0;this.appliedUnsafeCSS=void 0;return}if(this.unsafeCSSStyle?.parentNode===n&&this.appliedUnsafeCSS===t)return;if(this.unsafeCSSStyle??=dd(),this.unsafeCSSStyle.parentNode!==n)n.appendChild(this.unsafeCSSStyle);this.unsafeCSSStyle.textContent=fd(t),this.appliedUnsafeCSS=t}applyThemeState(t,n,s,a){let l=t.shadowRoot??t.attachShadow({mode:"open"}),d=a??s,f=this.getTheme(),h=typeof f==="string"?f:{...f},g=To(l);if(this.themeCSSStyle?.parentNode===l&&this.appliedThemeCSS?.themeStyles===n&&this.appliedThemeCSS.themeType===d&&this.appliedThemeCSS.scrollbarGutter===g){this.appliedThemeCSS.theme=h;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===l){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:h,themeStyles:n,themeType:d,baseThemeType:a,scrollbarGutter:g};return}this.themeCSSStyle=Id({shadowRoot:l,currentNode:this.themeCSSStyle,themeCSS:pd(n,d,g)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:h,themeStyles:n,themeType:d,baseThemeType:a,scrollbarGutter:g}:void 0}hydrateMeasuredScrollbar(){let t=this.fileContainer?.shadowRoot;if(t==null||this.themeCSSStyle==null)return;this.themeCSSStyle.textContent=hd(this.themeCSSStyle.textContent??"",To(t))}shouldGuardRebuildScroll(){return this.editor!=null&&ie()}applyHunksToDOM(t,n){if(this.shouldGuardRebuildScroll())vl(t,()=>this.replaceCodeColumns(t,n));else this.replaceCodeColumns(t,n)}applyCodeColumnsInPlace(t,n,s){let a=this.getColumnPair(t);if(a==null)return!1;let l=Ro(n[0]),d=Ro(n[1]);if(l==null||d==null)return!1;if(a.gutter.innerHTML=pn(l),a.content.innerHTML=pn(d),s!==this.lastRowCount)a.gutter.style.setProperty("grid-row",`span ${s}`),a.content.style.setProperty("grid-row",`span ${s}`);return!0}replaceCodeColumns(t,n){let{overflow:s="scroll"}=this.options,a=(this.options.hunkSeparators??"line-info")==="line-info",l=s==="wrap"?n.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,n);let d=!1,f=[],h=this.hunksRenderer.renderCodeAST("unified",n),g=this.hunksRenderer.renderCodeAST("deletions",n),I=this.hunksRenderer.renderCodeAST("additions",n);if(this.editor?.__captureFocusForDOMReplacement(),h!=null){if(d=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=ca({code:this.codeUnified,columnType:"unified",rowSpan:l,containerSize:a}),!this.applyCodeColumnsInPlace(this.codeUnified,h,n.rowCount))this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(h);f.push(this.codeUnified)}else if(g!=null||I!=null){if(g!=null){if(d=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=ca({code:this.codeDeletions,columnType:"deletions",rowSpan:l,containerSize:a}),!this.applyCodeColumnsInPlace(this.codeDeletions,g,n.rowCount))this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(g);f.push(this.codeDeletions)}else this.codeDeletions?.remove(),this.codeDeletions=void 0;if(I!=null){if(d=d||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=ca({code:this.codeAdditions,columnType:"additions",rowSpan:l,containerSize:a}),!this.applyCodeColumnsInPlace(this.codeAdditions,I,n.rowCount))this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(I);f.push(this.codeAdditions)}else this.codeAdditions?.remove(),this.codeAdditions=void 0}else this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0;if(f.length===0)t.textContent="";else if(d)t.replaceChildren(...f);this.lastRowCount=n.rowCount}applyPartialRender({fileDiff:t,previousRenderRange:n,renderRange:s}){let{pre:a,codeUnified:l,codeAdditions:d,codeDeletions:f,options:{diffStyle:h="split"}}=this;if(a==null||n==null||s==null||!Number.isFinite(n.totalLines)||!Number.isFinite(s.totalLines)||this.lastRowCount==null)return!1;let g=this.getCodeColumns(h,l,f,d);if(g==null)return!1;let I=n.startingLine,b=s.startingLine,v=I+n.totalLines,k=b+s.totalLines,w=Math.max(I,b),P=Math.min(v,k);if(P<=w)return!1;let M=Math.max(0,w-I),N=Math.max(0,v-P),_=this.trimColumns({columns:g,trimStart:M,trimEnd:N,previousStart:I,overlapStart:w,overlapEnd:P,diffStyle:h});if(_<0)throw Error("FileDiff.applyPartialRender: failed to trim to overlap");if(this.lastRowCount<_)throw Error("FileDiff.applyPartialRender: trimmed beyond DOM row count");let O=this.lastRowCount-_,B=(W,J)=>{if(J<=0)return;return this.hunksRenderer.renderDiff(t,{startingLine:W,totalLines:J,bufferBefore:0,bufferAfter:0})},X=B(b,Math.max(w-b,0));if(X==null&&b<w)return!1;let z=B(P,Math.max(k-P,0));if(z==null&&k>P)return!1;let K=(W,J)=>{if(W==null)return;if(h==="unified"&&!Array.isArray(g))this.insertPartialHTML(h,g,W,J);else if(h==="split"&&Array.isArray(g))this.insertPartialHTML(h,g,W,J);else throw Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");O+=W.rowCount,this.renderedDiff=W.fileDiff};if(this.cleanupErrorWrapper(),K(X,"afterbegin"),K(z,"beforeend"),this.lastRowCount!==O)this.applyRowSpan(h,g,O),this.lastRowCount=O;return!0}insertPartialHTML(t,n,s,a){if(t==="unified"&&!Array.isArray(n)){let l=this.hunksRenderer.renderCodeAST("unified",s);this.renderPartialColumn(n,l,a)}else if(t==="split"&&Array.isArray(n)){let l=this.hunksRenderer.renderCodeAST("deletions",s),d=this.hunksRenderer.renderCodeAST("additions",s);this.renderPartialColumn(n[0],l,a),this.renderPartialColumn(n[1],d,a)}else throw Error("FileDiff.insertPartialHTML: Invalid argument composition")}refreshSplitDiffView(){let t=this.getLatestDiff();if(this.options.diffStyle!=="split"||t==null)return;let n=this.hunksRenderer.renderDiff(t,this.renderRange);if(n==null)return;let s=this.getCodeColumns("split",this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(s))return;let a=(l,d)=>{if(d==null)return;let f=this.hunksRenderer.renderCodeAST(l,n),h=Ro(f?.[0]),g=Ro(f?.[1]);for(let[I,b]of[[d.gutter,h],[d.content,g]])if(b!=null&&I.childElementCount===b.length)for(let v=0;v<b.length;v++){let k=I.children[v],w=b[v].properties["data-line-type"];if(w!=null&&k.dataset.lineType!==w)k.dataset.lineType=w}};a("deletions",s[0]),a("additions",s[1]),this.renderedDiff=n.fileDiff}refreshUnifiedDiffView(){let t=this.getLatestDiff();if(this.options.diffStyle!=="unified"||t==null)return;let n=this.hunksRenderer.renderDiff(t,this.renderRange);if(n==null)return;let s=this.getCodeColumns("unified",this.codeUnified,this.codeDeletions,this.codeAdditions);if(s==null||Array.isArray(s))return;let a=this.hunksRenderer.renderCodeAST("unified",n),l=Ro(a?.[0]),d=Ro(a?.[1]),f=()=>{for(let[h,g]of[[s.gutter,l],[s.content,d]])if(g!=null)h.innerHTML=pn(g);if(n.rowCount!==this.lastRowCount)this.applyRowSpan("unified",s,n.rowCount),this.lastRowCount=n.rowCount;this.renderedDiff=n.fileDiff};if(this.shouldGuardRebuildScroll())vl(this.pre,f);else f();this.renderSeparators(n.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(t,n,s){if(t==null||n==null)return;let a=Ro(n[0]),l=Ro(n[1]);if(a==null||l==null)throw Error("FileDiff.insertPartialHTML: Unexpected AST structure");let d=l.at(0);if(s==="beforeend"&&d?.type==="element"&&typeof d.properties["data-buffer-size"]==="number")this.mergeBuffersIfNecessary(d.properties["data-buffer-size"],t.content.children[t.content.children.length-1],t.gutter.children[t.gutter.children.length-1],a,l,!0);let f=l.at(-1);if(s==="afterbegin"&&f?.type==="element"&&typeof f.properties["data-buffer-size"]==="number")this.mergeBuffersIfNecessary(f.properties["data-buffer-size"],t.content.children[0],t.gutter.children[0],a,l,!1);t.gutter.insertAdjacentHTML(s,this.hunksRenderer.renderPartialHTML(a)),t.content.insertAdjacentHTML(s,this.hunksRenderer.renderPartialHTML(l))}mergeBuffersIfNecessary(t,n,s,a,l,d){if(!(n instanceof HTMLElement)||!(s instanceof HTMLElement))return;let f=this.getBufferSize(n.dataset);if(f==null)return;if(d)a.shift(),l.shift();else a.pop(),l.pop();this.updateBufferSize(n,f+t),this.updateBufferSize(s,f+t)}applyRowSpan(t,n,s){let a=(l)=>{if(l==null)return;l.gutter.style.setProperty("grid-row",`span ${s}`),l.content.style.setProperty("grid-row",`span ${s}`)};if(t==="unified"&&!Array.isArray(n))a(n);else if(t==="split"&&Array.isArray(n))a(n[0]),a(n[1]);else throw Error("dun fuuuuked up")}trimColumnRows(t,n,s){let a=0,l=0,d=0,f=!1,h=s>=0;if(t==null)return 0;let g=Array.from(t.content.children),I=Array.from(t.gutter.children);if(g.length!==I.length)throw Error("FileDiff.trimColumnRows: columns do not match");while(d<g.length){if(n<=0&&!h&&!f)break;let b=I[d],v=g[d];if(d++,!(b instanceof HTMLElement)||!(v instanceof HTMLElement))throw console.error({gutterElement:b,contentElement:v}),Error("FileDiff.trimColumnRows: invalid row elements");if(f){if(f=!1,b.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in v.dataset||b.dataset.gutterBuffer==="metadata"&&"noNewline"in v.dataset){b.remove(),v.remove(),l++;continue}}if("lineIndex"in b.dataset&&"lineIndex"in v.dataset){if(n>0||h&&a>=s){if(b.remove(),v.remove(),n>0){if(n--,n===0)f=!0}l++}a++;continue}if("separator"in b.dataset&&"separator"in v.dataset){if(n>0||h&&a>=s)b.remove(),v.remove(),l++;continue}if(b.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in v.dataset){if(n>0||h&&a>=s)b.remove(),v.remove(),l++;continue}if(b.dataset.gutterBuffer==="metadata"&&"noNewline"in v.dataset){if(n>0||h&&a>=s)b.remove(),v.remove(),l++;continue}if(b.dataset.gutterBuffer==="buffer"&&"contentBuffer"in v.dataset){let k=this.getBufferSize(v.dataset);if(k==null)throw Error("FileDiff.trimColumnRows: invalid element");if(n>0){let w=Math.min(n,k),P=k-w;if(P>0)this.updateBufferSize(b,P),this.updateBufferSize(v,P),l+=w;else b.remove(),v.remove(),l+=k;if(n-=w,n===0&&P===0)f=!0}else if(h){let w=a,P=a+k-1;if(s<=w)b.remove(),v.remove(),l+=k;else if(s<=P){let M=P-s+1,N=k-M;this.updateBufferSize(b,N),this.updateBufferSize(v,N),l+=M}}a+=k;continue}throw console.error({gutterElement:b,contentElement:v}),Error("FileDiff.trimColumnRows: unknown row elements")}return l}trimColumns({columns:t,diffStyle:n,overlapEnd:s,overlapStart:a,previousStart:l,trimEnd:d,trimStart:f}){let h=Math.max(0,a-l),g=s-l;if(g<0)throw Error("FileDiff.trimColumns: overlap ends before previous");let I=f>0,b=d>0;if(!I&&!b)return 0;let v=I?h:0,k=b?g:-1;if(n==="unified"&&!Array.isArray(t))return this.trimColumnRows(t,v,k);else if(n==="split"&&Array.isArray(t)){let w=this.trimColumnRows(t[0],v,k),P=this.trimColumnRows(t[1],v,k);if(t[0]!=null&&t[1]!=null&&w!==P)throw Error("FileDiff.trimColumns: split columns out of sync");return t[0]!=null?w:P}else throw console.error({diffStyle:n,columns:t}),Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(t){let n=Number.parseInt(t?.bufferSize??"",10);return Number.isNaN(n)?void 0:n}updateBufferSize(t,n){t.dataset.bufferSize=`${n}`,t.style.setProperty("grid-row",`span ${n}`),t.style.setProperty("min-height",`calc(${n} * 1lh)`)}getColumnPair(t){if(t==null)return;let n=t.children[0],s=t.children[1];if(!(n instanceof HTMLElement)||!(s instanceof HTMLElement)||n.dataset.gutter==null||s.dataset.content==null)return;return{gutter:n,content:s}}getCodeColumns(t,n,s,a){if(t==="unified")return this.getColumnPair(n);else{let l=this.getColumnPair(s),d=this.getColumnPair(a);return l!=null||d!=null?[l,d]:void 0}}updateBuffers(t){if(this.pre!=null)this.applyBuffers(this.pre,t)}applyBuffers(t,n){if(n==null||this.shouldDisableVirtualizationBuffers()){if(this.bufferBefore!=null)this.bufferBefore.remove(),this.bufferBefore=void 0;if(this.bufferAfter!=null)this.bufferAfter.remove(),this.bufferAfter=void 0;return}if(n.bufferBefore>0){if(this.bufferBefore==null)this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",t.before(this.bufferBefore);this.bufferBefore.style.setProperty("height",`${n.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")}else if(this.bufferBefore!=null)this.bufferBefore.remove(),this.bufferBefore=void 0;if(n.bufferAfter>0){if(this.bufferAfter==null)this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",t.after(this.bufferAfter);this.bufferAfter.style.setProperty("height",`${n.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")}else if(this.bufferAfter!=null)this.bufferAfter.remove(),this.bufferAfter=void 0}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(t,{additionsContentAST:n,deletionsContentAST:s,totalLines:a},l){let{diffIndicators:d="bars",disableBackground:f=!1,disableLineNumbers:h=!1,overflow:g="scroll",diffStyle:I="split"}=this.options,b={type:"diff",diffIndicators:d,disableBackground:f,disableLineNumbers:h,overflow:g,split:I==="unified"?!1:n!=null&&s!=null,totalLines:a,customProperties:l};if(ld(b,this.appliedPreAttributes))return;bd(t,b),this.appliedPreAttributes=b}applyErrorToDOM(t,n){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let s=n.shadowRoot??n.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",s.appendChild(this.errorWrapper);let a=document.createElement("div");a.dataset.errorMessage="",a.innerText=t.message,this.errorWrapper.appendChild(a);let l=document.createElement("pre");l.dataset.errorStack="",l.innerText=t.stack??"No Error Stack",this.errorWrapper.appendChild(l)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function PF(t){return{name:t.name,lang:t.lang,contents:t.additionLines.join("")}}function P0(t,n){if(t==null||n==null)return t==null&&n==null;return be(t,n)}function MF({fileDiff:t,oldFile:n,newFile:s}){return t!=null&&t.hunks.length>0||n!=null||s!=null}function _F({fileDiff:t,oldFile:n,newFile:s}){return t!=null||n!=null||s!=null}function OF(t,n,s=!1){return!s&&t==null&&n}function $F(t,n,s=!1){return t==null&&n&&!s}function Ro(t){if(t==null||t.type!=="element")return;return t.children??[]}var Zp=3000,Hd=new Map,FF=-1,F0=class extends M0{__id=`little-virtualized-file-diff:${++FF}`;renderType="virtualized";top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Hd,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(t,n,s,a,l=!1){super(t,a,l);this.virtualizer=n,this.metrics=aa(s)}setMetrics(t,n=!1){let s=aa(t);if(!n&&vi(this.metrics,s))return;this.metrics=s,this.resetLayoutCache({includeEstimatedHeights:!0})}setLineAnnotations(t){if(this.syncLineAnnotations(t))this.forceRenderOverride=!0}syncLineAnnotations(t){if(t==null||!this.isNewAnnotations(t)||t.length===0&&this.getLatestAnnotations().length===0)return!1;return super.setLineAnnotations(t),!0}syncEditSessionAnnotationsFromEditor(t){if(super.syncEditSessionAnnotationsFromEditor(t))return this.forceRenderOverride=!0,!0;return!1}setFileAnnotationHeight(t){let n=this.cache.fileAnnotationHeight;if(t===n)return!1;return this.cache.fileAnnotationHeight=t,this.cache.measuredHeightDeltaTotal+=t-n,!0}hasFileAnnotations(t){let n=this.getLatestAnnotations();if(!zc(n))return!1;return n.some((s)=>{if(s.lineNumber!==0)return!1;if(t.type==="new")return s.side==="additions";if(t.type==="deleted")return s.side==="deletions";return!0})}getLineHeight(t,n=!1){return this.getEstimatedLineHeight(n)+(this.cache.heightDeltas.get(t)??0)}getEstimatedLineHeight(t=!1){let n=t?2:1;return this.metrics.lineHeight*n}setOptions(t){if(this.isAdvancedMode())throw Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(t==null)return;let{options:n}=this,s=!oa(n,t),a=s&&GF(n,t);if(super.setOptions(t),a)this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:zF(n,t)});if(s)this.forceRenderOverride=!0;if(s&&this.isSimpleMode())this.virtualizer.instanceChanged(this,a)}setThemeType(t){if(this.isAdvancedMode())throw Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(t)}resetLayoutCache({forceSimpleRecompute:t=!1,includeEstimatedHeights:n=!1,resetRenderRange:s=!0}={}){if(this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=Hd,this.cache.ghostTextRowsByIndex.size>0)this.cache.ghostTextRowsByIndex.clear();if(this.invalidateDerivedLayoutCache(n,s),t&&this.isSimpleMode())this.computeApproximateSize()}invalidateDerivedLayoutCache(t,n=!0){if(this.layoutDirty=!0,this.cache.checkpoints.length>0)this.cache.checkpoints.length=0;if(this.cache.totalLines!==0)this.cache.totalLines=0;if(t)this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;if(this.renderRange!=null&&n)this.renderRange=void 0}applyGhostTextRows(t,n){let{cache:{heightDeltas:s,ghostTextRows:a,ghostTextRowsByIndex:l},metrics:{lineHeight:d}}=this;if(a===n)return!1;let f=this.getDiffStyle(),h=new Map;for(let[I,b]of n){let v=this.getLineIndexForDiff(t,I+1,"additions");if(v==null)continue;h.set(f==="split"?v[1]:v[0],b)}let g=!1;for(let I of new Set([...l.keys(),...h.keys()])){let b=((h.get(I)??0)-(l.get(I)??0))*d;if(b===0)continue;let v=(s.get(I)??0)+b;if(v===0)s.delete(I);else s.set(I,v);this.cache.measuredHeightDeltaTotal+=b,g=!0}return this.cache.ghostTextRows=n,this.cache.ghostTextRowsByIndex=h,g}reconcileHeights(){let t=!1,{options:{overflow:n="scroll"},metrics:{lineHeight:s}}=this,a=this.placeHolder!=null?this.getLayoutDiff():this.getRenderedDiff();if(this.fileContainer==null||a==null){if(this.height!==0)t=!0;return this.height=0,t}this.top=this.getVirtualizedTop(),t=this.applyGhostTextRows(a,this.editor?.__getGhostTextRows()??Hd);let{ghostTextRowsByIndex:l}=this.cache,d=n!=="scroll"||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!d&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0){if(t)this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height);return t}let f=this.getDiffStyle(),h=f==="split"?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&Eo(this.renderRange)){let g=NF(h)??0;if(this.setFileAnnotationHeight(g))t=!0}for(let g of h){if(g==null)continue;let I=g.children[1];if(!(I instanceof HTMLElement))continue;let b=f==="split"&&g===this.codeDeletions;for(let v of I.children){if(!(v instanceof HTMLElement))continue;let k=v.dataset.lineIndex;if(k==null)continue;let w=qF(k,f),P=l.get(w)??0;if(b&&P>0)continue;let M=this.cache.heightDeltas.get(w)??0;if(!d&&M===P*s)continue;let N=v.getBoundingClientRect().height+P*s,_=!1;if(v.nextElementSibling instanceof HTMLElement&&(("lineAnnotation"in v.nextElementSibling.dataset)||("noNewline"in v.nextElementSibling.dataset))){if("noNewline"in v.nextElementSibling.dataset)_=!0;N+=v.nextElementSibling.getBoundingClientRect().height}let O=this.getEstimatedLineHeight(_),B=N-O;if(B===M)continue;if(t=!0,this.cache.measuredHeightDeltaTotal+=B-M,B===0)this.cache.heightDeltas.delete(w);else this.cache.heightDeltas.set(w,B)}}if(t||this.isResizeDebuggingEnabled())this.computeApproximateSize(!0);return t}onRender=(t)=>{if(this.fileContainer==null)return!1;if(t)this.top=this.getVirtualizedTop();return this.render()};flushManagers(){if(super.flushManagers(),this.lineStateRefreshPending)this.flushDeferredLineState()}updateCodeViewLayout(t,n,s,a){let l=!1,d=!1,{pendingExpansions:f,pendingHydratedDiff:h,options:{collapsed:g=!1}}=this;if(h!=null){if(this.pendingHydratedDiff=void 0,h.expectedDiff===t)Object.assign(t,h.nextDiff),this.setHydratedState(h.files),this.installHydratedSessionDiff(t),this.forceRenderOverride=!0,l=!0,d=!0}if(f!=null){this.pendingExpansions=void 0;for(let{hunkIndex:P,direction:M,expansionLineCountOverride:N}of f)this.hunksRenderer.expandHunk(P,M,N),this.forceRenderOverride=!0,d=!0}let I=this.updateExternalDiff(t,a),{pendingRenderDiff:b,layoutDiffChanged:v,renderedDiffChanged:k,annotationsChanged:w}=this.updatePendingRender(t,a);if(!this.forceRenderOverride&&(I||k||w))this.forceRenderOverride=!0;if(s?.resetDiffLayoutCache===!0||v)l=!0;if(v||s?.resetDiffLayoutCache===!0&&s.includeEstimatedDiffHeights)d=!0;if(s?.metrics!=null)this.metrics=aa(s.metrics),l=!0,d=!0;if(this.currentCollapsed!==g)this.currentCollapsed=g,l=!0;if(l)this.resetLayoutCache({includeEstimatedHeights:d});else if(d)this.invalidateDerivedLayoutCache(!0);return this.top=n,this.computeApproximateSize(!1,b),this.height}getLinePosition(t,n="additions"){let s=this.getLayoutDiff();if(s==null||t<1)return;let a=this.getLineIndexForDiff(s,t,n);if(a==null)return;let{disableFileHeader:l=!1,expandUnchanged:d=!1,collapsed:f=!1,collapsedContextThreshold:h=1}=this.options,g=this.getDiffStyle(),I=this.getHunkSeparatorType(),b=g==="split"?a[1]:a[0];this.approximateLayoutCheckpoints(s);let v=Mr(this.metrics,l),k=this.getLayoutCheckpointBeforeLineIndex(b),w=k?.top??v+this.cache.fileAnnotationHeight;if(f)return{top:v,height:0};let P;return si({diff:s,diffStyle:g,startingLine:k?.renderedLineIndex??0,expandedHunks:d?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:h,callback:({hunkIndex:M,hunk:N,collapsedBefore:_,collapsedAfter:O,deletionLine:B,additionLine:X})=>{let z=g==="split"?X?.splitLineIndex??B?.splitLineIndex:X?.unifiedLineIndex??B?.unifiedLineIndex;if(z==null)throw Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(_>0){let W=ms({type:I,metrics:this.metrics,hunkIndex:M,hunkSpecs:N?.hunkSpecs});if(W!=null){if(w+=W.gapBefore,b>=z-_&&b<z)return P={top:w,height:W.height},!0;w+=W.height+W.gapAfter}}let K=this.getLineHeight(z,(X?.noEOFCR??!1)||(B?.noEOFCR??!1));if(z===b)return P={top:w,height:K},!0;if(w+=K,O>0){let W=Ji({type:I,metrics:this.metrics});if(W!=null){if(b>z&&b<=z+O)return P={top:w+W.gapBefore,height:W.height},!0;w+=W.totalHeight}}return!1}}),P}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(t){let n=this.getLayoutDiff();if(n==null)return;let{disableFileHeader:s=!1,expandUnchanged:a=!1,collapsed:l=!1,collapsedContextThreshold:d=1}=this.options;if(l)return;let f=this.getDiffStyle(),h=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(n);let g=this.getLayoutCheckpointBeforeTop(t),I=g?.top??Mr(this.metrics,s)+this.cache.fileAnnotationHeight,b;return si({diff:n,diffStyle:f,startingLine:g?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:d,callback:({hunkIndex:v,hunk:k,collapsedBefore:w,collapsedAfter:P,deletionLine:M,additionLine:N})=>{let _=f==="split"?N?.splitLineIndex??M?.splitLineIndex:N?.unifiedLineIndex??M?.unifiedLineIndex;if(_==null)throw Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(w>0){let B=ms({type:h,metrics:this.metrics,hunkIndex:v,hunkSpecs:k?.hunkSpecs});if(B!=null)I+=B.totalHeight}if(I>=t){if(M!=null)b={lineNumber:M.lineNumber,side:"deletions",top:I};else if(N!=null)b={lineNumber:N.lineNumber,side:"additions",top:I};if(b!=null)return!0}let O=this.getLineHeight(_,(N?.noEOFCR??!1)||(M?.noEOFCR??!1));if(I+=O,P>0){let B=Ji({type:h,metrics:this.metrics});if(B!=null)I+=B.totalHeight}return!1}}),b}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(t){let n=this.getLayoutDiff();if(this.top==null||n==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let s=t!=null?this.computeRenderRangeFromWindow(n,this.top,t):this.renderRange;if(s==null)return;let{bufferBefore:a,bufferAfter:l,totalLines:d}=s,f=0;if(d===0){let h=t??this.virtualizer.getWindowSpecs();if(this.top<h.top)f=l}return{topOffset:this.top+a+f,height:this.height-(a+l)}}cleanUp(t=!1){let n=this.cache.ghostTextRows.size>0;if(n)this.layoutDirty=!0;let s=t&&this.isAdvancedMode()&&this.fileContainer!=null&&(n||!m(this.getRenderedDiff(),this.getLatestDiff()));if(this.fileContainer!=null&&this.isSimpleMode())this.getSimpleVirtualizer()?.disconnect(this.fileContainer);if(!t)this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0;if(this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(t),s)this.virtualizer.instanceChanged(this,!0)}expandHunk=(t,n,s)=>{if(this.fileDiff==null)return;if(this.loadFilesIfNecessary(),this.isAdvancedMode())this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:t,direction:n,expansionLineCountOverride:s});else this.hunksRenderer.expandHunk(t,n,s),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize();this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)};async handleFilesLoaded(t,n){if(this.fileDiff!==t||!t.isPartial)return;if(this.isAdvancedMode()){let s=wl("clone",t,n);if(await kl(()=>this.primeHighlightCache(s)),this.fileDiff!==t)return;this.pendingHydratedDiff={expectedDiff:t,nextDiff:s,files:n}}else{if(wl("merge",t,n),this.setHydratedState(n),!this.installHydratedSessionDiff(t)){if(await kl(()=>this.primeHighlightCache(t)),this.fileDiff!==t)return}this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(t){if(super.isLineRenderable(t))return!0;let{pendingExpansions:n}=this,s=this.getRenderedDiff();if(n==null||n.length===0||s==null)return!1;let{expansionLineCount:a=100,collapsedContextThreshold:l=1}=this.options,d=new Map(this.hunksRenderer.getExpandedHunksMap());for(let f of n){let h={...d.get(f.hunkIndex)??{fromStart:0,fromEnd:0}},g=f.expansionLineCountOverride??a;if(f.direction==="up"||f.direction==="both")h.fromStart+=g;if(f.direction==="down"||f.direction==="both")h.fromEnd+=g;d.set(f.hunkIndex,h)}return Ed({fileDiff:s,lineNumber:t,expandedHunks:d,collapsedContextThreshold:l})}invalidateEditSessionLayout(){if(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),!this.isSimpleMode())this.computeApproximateSize(!0);this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){if(this.invalidateEditSessionLayout(),!this.enabled||this.fileDiff==null)return;this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(t){if(this.isAdvancedMode()||this.fileContainer==null)return;if(this.renderRange=void 0,t&&!this.isVisible)this.top=this.getVirtualizedTop(),this.isVisible=!0;else if(!t&&this.isVisible)this.isVisible=!1,this.rerender()}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let t=this.getLatestDiff(),n=t==null?void 0:this.hunksRenderer.getDiffForNextRender(t);if(this.isSimpleMode())this.pendingRender=void 0;this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!m(this.getRenderedDiff(),n))}syncGhostTextRows(){let t=this.getAdvancedVirtualizer();if(t!=null)t.capturePendingLayoutAnchor(),this.layoutDirty=!0,t.instanceChanged(this,!0);else this.getSimpleVirtualizer()?.requestHeightReconcile(this)}applyDocumentChange(t,n,s=!1){let{renderRange:a}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(t,n),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let l=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(s&&a!=null&&l!=null){let d=this.virtualizer.getWindowSpecs(),f=this.computeRenderRangeFromWindow(l,this.top??0,d);if(f.bufferAfter!==a.bufferAfter)this.updateBuffers(f)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(t=!1,n=this.getLayoutDiff()){let s=this.isResizeDebuggingEnabled();if(!t&&!this.layoutDirty&&!s)return;let a=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,n==null){this.layoutDirty=!1;return}this.applyGhostTextRows(n,this.editor?.__getGhostTextRows()??Hd);let{disableFileHeader:l=!1,collapsed:d=!1}=this.options,f=Mr(this.metrics,l);if(this.height+=f,d){this.layoutDirty=!1;return}if(this.height=this.getActiveEstimatedHeight(n)+this.cache.measuredHeightDeltaTotal,s&&!a)this.validateComputedHeight(n);this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(t=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(t);let n=this.getDiffStyle()==="split"?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(n==null)throw Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return n}ensureEstimatedDiffHeights(t=this.getLayoutDiff()){if(t==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:n=!1,expandUnchanged:s=!1,collapsedContextThreshold:a=1}=this.options,{splitHeight:l,unifiedHeight:d}=e0({fileDiff:t,metrics:this.metrics,disableFileHeader:n,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:s,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,canHydratePartialDiff:Qp(t,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=l,this.cache.estimatedUnifiedHeight=d}validateComputedHeight(t=this.getLayoutDiff()){if(this.fileContainer==null||t==null)return;let n=this.fileContainer.getBoundingClientRect();if(n.height!==this.height)console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:t.name,elementHeight:n.height,computedHeight:this.height});else console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:t,fileDiff:n,forceRender:s=!1,lineAnnotations:a,...l}={}){let d=Tl(l,"VirtualizedFileDiff.render"),f=d!=null,h=d?.oldFile,g=d?.newFile,I=f&&(!$0(h,this.deletionFile)||!$0(g,this.additionFile)),b=n??this.fileDiff;if(n==null&&f&&(I||this.fileDiff==null))b=ai(d.oldFile,d.newFile,this.options.parseDiffOptions);let{forceRenderOverride:v,isSetup:k}=this;this.forceRenderOverride=void 0;let w=b!=null&&!m(this.fileDiff,b),P=w||I;if(t=this.getOrCreateFileContainer(t),b==null)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(w)this.updateExternalDiff(b,a);let{pendingRenderDiff:M,layoutDiffChanged:N,renderedDiffChanged:_,annotationsChanged:O}=(()=>{if(this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(b)??b))return{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(a)};return this.updatePendingRender(b,a)})();if(N)this.resetLayoutCache({includeEstimatedHeights:!0});if(!k){this.computeApproximateSize(!1,M);let K=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(K==null)throw Error("VirtualizedFileDiff.render: simple virtualizer is not available");K.connect(t,this),this.isVisible=K.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}else if(this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode())this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,M);if(!this.isVisible&&this.isSimpleMode()&&(!P||!k)){if(d!=null)this.deletionFile=h,this.additionFile=g;if(w)this.clearReusableHeader();return this.renderPlaceholder(this.height)}let B=this.virtualizer.getWindowSpecs(),X=this.top??0,z=this.computeRenderRangeFromWindow(M,X,B);return super.render({fileDiff:b,fileContainer:t,renderRange:z,lineAnnotations:a,forceRender:(v??s)||O||_||w,...d,...l})}finalizeRender(){if(!m(this.getRenderedDiff(),this.pendingRender?.diff))throw Error("VirtualizedFileDiff.render: rendered a different diff than its prepared layout");if(this.pendingRender=void 0,this.isSimpleMode())this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(t,n){let s=this.getLatestDiff(t)??t,a=this.getRenderedDiff(),{pendingRender:l}=this,d=l?.diff??a,f=this.hunksRenderer.getDiffForNextRender(s);return this.pendingRender={latestDiff:s,diff:f},{pendingRenderDiff:f,annotationsChanged:this.syncLineAnnotations(n),layoutDiffChanged:!m(d,f),renderedDiffChanged:!m(a,f)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}getVirtualizedTop(){if(this.virtualizer.type==="advanced")return this.virtualizer.getLocalTopForInstance(this);return this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??"split"}getHunkSeparatorType(){return jF(this.options.hunkSeparators)}approximateLayoutCheckpoints(t){if(!this.layoutDirty&&this.cache.checkpoints.length>0||t.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:n=!1,expandUnchanged:s=!1,collapsedContextThreshold:a=1}=this.options,l=t.hunks.length-1,d=Qp(t,this.options.loadDiffFiles!=null),f=this.getDiffStyle(),h=this.getHunkSeparatorType(),g=s?!0:this.hunksRenderer.getExpandedHunksMap(),I=DF(this.cache.heightDeltas),b=Mr(this.metrics,n)+this.cache.fileAnnotationHeight,v=0,k=({rowCount:w,startLineIndex:P,preSeparatorHeight:M=0,postSeparatorHeight:N=0,metadataOffsets:_=[]})=>{if(w<=0)return;let O=v,B=v+w,X=HF(O);while(X<B){let z=X-O,K=b+(z>0?M:0)+z*this.metrics.lineHeight+UF(_,z)*this.metrics.lineHeight+_0(I,P,P+z);this.cache.checkpoints.push({renderedLineIndex:X,lineIndex:P+z,top:K}),X+=Zp}b+=M+w*this.metrics.lineHeight+_.length*this.metrics.lineHeight+_0(I,P,P+w)+N,v=B};for(let w=0;w<t.hunks.length;w++){let P=t.hunks[w];if(P==null)throw Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");let M=Ir({isPartial:t.isPartial,rangeSize:P.collapsedBefore,expandedHunks:g,hunkIndex:w,collapsedContextThreshold:a}),N=M.collapsedLines>0?ms({type:h,metrics:this.metrics,hunkIndex:w,hunkSpecs:P.hunkSpecs})?.totalHeight??0:0;k({rowCount:M.fromStart,startLineIndex:(f==="split"?P.splitLineStart:P.unifiedLineStart)-M.rangeSize});let _=N;if(k({rowCount:M.fromEnd,startLineIndex:(f==="split"?P.splitLineStart:P.unifiedLineStart)-M.fromEnd,preSeparatorHeight:_}),M.fromEnd>0)_=0;let O=w===l?Sr({fileDiff:t,hunkIndex:w,expandedHunks:g,collapsedContextThreshold:a,errorPrefix:"VirtualizedFileDiff"}):void 0,B=O!=null&&O.collapsedLines>0?Ji({type:h,metrics:this.metrics})?.totalHeight??0:w===l&&d?Ji({type:h,metrics:this.metrics})?.totalHeight??0:0,X=O!=null?O.fromStart+O.fromEnd:0,z=f==="split"?P.splitLineCount:P.unifiedLineCount,K=f==="split"?P.splitLineStart:P.unifiedLineStart;if(k({rowCount:z,startLineIndex:K,preSeparatorHeight:_,postSeparatorHeight:X===0?B:0,metadataOffsets:BF({diffStyle:f,hunk:P,rowCount:z})}),O!=null&&X>0)k({rowCount:X,startLineIndex:K+z,postSeparatorHeight:B})}this.cache.totalLines=v}getLayoutCheckpointBeforeLineIndex(t){if(t<=0||this.cache.checkpoints.length===0)return;let n=0,s=this.cache.checkpoints.length-1,a;while(n<=s){let l=n+s>>1,d=this.cache.checkpoints[l];if(d==null)throw Error("VirtualizedFileDiff: invalid checkpoint index");if(d.lineIndex<=t)a=d,n=l+1;else s=l-1}return a}getLayoutCheckpointBeforeTop(t,n){let s=0,a=this.cache.checkpoints.length-1,l=-1;while(s<=a){let d=s+a>>1,f=this.cache.checkpoints[d];if(f==null)throw Error("VirtualizedFileDiff: invalid checkpoint index");if(f.top<=t)l=d,s=d+1;else a=d-1}if(n==null)return l>=0?this.cache.checkpoints[l]:void 0;for(let d=l;d>=0;d--){let f=this.cache.checkpoints[d];if(f==null)throw Error("VirtualizedFileDiff: invalid checkpoint index");if(f.renderedLineIndex%n===0)return f}}getExpandedLineCount(t,n){let s=0;if(t.isPartial){for(let h of t.hunks)s+=n==="split"?h.splitLineCount:h.unifiedLineCount;return s}let{expandUnchanged:a=!1,collapsedContextThreshold:l=1}=this.options,d=a?!0:this.hunksRenderer.getExpandedHunksMap();for(let[h,g]of t.hunks.entries()){let I=n==="split"?g.splitLineCount:g.unifiedLineCount;s+=I;let b=Math.max(g.collapsedBefore,0),{fromStart:v,fromEnd:k,renderAll:w}=Ir({isPartial:t.isPartial,rangeSize:b,expandedHunks:d,hunkIndex:h,collapsedContextThreshold:l});if(b>0)s+=w?b:v+k}let f=Sr({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:d,collapsedContextThreshold:l,errorPrefix:"VirtualizedFileDiff"});if(f!=null)s+=f.fromStart+f.fromEnd;return s}getLayoutLineCount(t,n){let s=this.getExpandedLineCount(t,n),a=n==="split"?t.splitLineCount:t.unifiedLineCount;return Math.max(s,a,t.additionLines.length,t.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(t,n,{top:s,bottom:a}){let{disableFileHeader:l=!1,expandUnchanged:d=!1,collapsedContextThreshold:f=1}=this.options,{hunkLineCount:h,lineHeight:g}=this.metrics,I=this.getDiffStyle(),b=this.getHunkSeparatorType(),v=Qp(t,this.options.loadDiffFiles!=null),k=this.height,w=this.getLayoutLineCount(t,I),P=Mr(this.metrics,l),M=t.hunks.length>0?ss(this.metrics):0,{fileAnnotationHeight:N}=this.cache,_=P+N,O=Math.max(0,k-P-N-M),B=this.hasFileAnnotations(t),X=n+P,z=N>0&&B&&X<a&&X+N>s;if(n<s-k||n>a)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:k-P-M};if(w<=h||t.hunks.length===0)return{startingLine:0,totalLines:h,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(t),w=this.getLayoutLineCount(t,I);let K=Math.ceil(Math.max(a-s,0)/g),W=Math.ceil(K/h)*h+h,J=W/h,ee=J,ce=[],Ae=(s+a)/2,ue=this.getLayoutCheckpointBeforeTop(Math.max(0,s-n-W*g*2),h),Se=n+(ue?.top??_),ut=ue?.renderedLineIndex??0,It,Ce,qe;if(si({diff:t,diffStyle:I,startingLine:ue?.renderedLineIndex??0,expandedHunks:d?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:f,callback:({hunkIndex:Yo,hunk:lr,collapsedBefore:Fs,collapsedAfter:qa,deletionLine:Hi,additionLine:Ui})=>{let mn=Ui!=null?Ui.splitLineIndex:Hi.splitLineIndex,hr=Ui!=null?Ui.unifiedLineIndex:Hi.unifiedLineIndex,Rr=(Ui?.noEOFCR??!1)||(Hi?.noEOFCR??!1),Jo=Yo===t.hunks.length-1&&lr!=null&&(I==="split"?mn===lr.splitLineStart+lr.splitLineCount-1:hr===lr.unifiedLineStart+lr.unifiedLineCount-1),ni=(Fs>0?ms({type:b,metrics:this.metrics,hunkIndex:Yo,hunkSpecs:lr?.hunkSpecs}):void 0)?.totalHeight??0;Se+=ni;let Bi=ut%h===0,ho=Math.floor(ut/h);if(Bi){if(ce[ho]=Se-(n+_+ni),qe!=null){if(qe<=0)return!0;qe--}}let Wr=this.getLineHeight(I==="split"?mn:hr,Rr);if(Se>s-Wr&&Se<a)It??=ho;if(Ce==null&&Se+Wr>Ae)Ce=ho;if(qe==null&&Se>=a&&Bi)qe=ee;if(ut++,Se+=Wr,qa>0||Jo&&v){let ju=Ji({type:b,metrics:this.metrics});if(ju!=null){if(Se<a&&Se+ju.totalHeight>s)It??=ho;if(Ce==null&&Se+ju.totalHeight>Ae)Ce=ho;Se+=ju.totalHeight}}return!1}}),It==null)if(z)It=0,Ce=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:k-P-M};Ce??=It;let Tt=Math.round(Ce-J/2),jn=Math.max(0,Math.ceil(w/h)-J),St=Math.max(0,Math.min(Tt,jn)),Nt=St*h,sn=Tt<0?W+Tt*h:W,En=ce[St]??0,wr=Nt===0?0:N+En,Kr=St+sn/h,Vr=Kr<ce.length?O-ce[Kr]:O-(Se-n-_);return{startingLine:Nt,totalLines:sn,bufferBefore:wr,bufferAfter:Math.max(0,Vr)}}};function NF(t){let n;for(let s of t){if(s==null)continue;let a=s.children[1];if(!(a instanceof HTMLElement))continue;for(let l of a.children){if(!(l instanceof HTMLElement))continue;if(l.dataset.lineAnnotation!==Gc)continue;n=Math.max(n??0,l.getBoundingClientRect().height)}}return n}function DF(t){let n=Array.from(t).sort((d,f)=>d[0]-f[0]),s=[],a=[0],l=0;for(let[d,f]of n)s.push(d),l+=f,a.push(l);return{lineIndexes:s,prefixTotals:a}}function _0({lineIndexes:t,prefixTotals:n},s,a){if(s>=a||t.length===0)return 0;let l=O0(t,s);return(n[O0(t,a)]??0)-(n[l]??0)}function O0(t,n){let s=0,a=t.length;while(s<a){let l=s+a>>1,d=t[l];if(d==null)throw Error("VirtualizedFileDiff: invalid prefix index");if(d<n)s=l+1;else a=l}return s}function HF(t){return Math.ceil(t/Zp)*Zp}function UF(t,n){let s=0;for(let a of t)if(a<n)s++;return s}function BF({diffStyle:t,hunk:n,rowCount:s}){if(s<=0||!n.noEOFCRAdditions&&!n.noEOFCRDeletions)return[];let a=n.hunkContent.at(-1);if(a==null)return[];if(a.type==="context")return[s-1];let l=Math.max(a.deletions,a.additions),d=a.deletions+a.additions;if(t==="split")return l>0&&(n.noEOFCRAdditions||n.noEOFCRDeletions)?[s-1]:[];let f=[],h=s-d;if(a.deletions>0&&n.noEOFCRDeletions)f.push(h+a.deletions-1);if(a.additions>0&&n.noEOFCRAdditions)f.push(s-1);return f}function GF(t,n){return(t.diffStyle??"split")!==(n.diffStyle??"split")||(t.overflow??"scroll")!==(n.overflow??"scroll")||(t.collapsed??!1)!==(n.collapsed??!1)||(t.disableLineNumbers??!1)!==(n.disableLineNumbers??!1)||(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||(t.diffIndicators??"bars")!==(n.diffIndicators??"bars")||(t.hunkSeparators??"line-info")!==(n.hunkSeparators??"line-info")||Boolean(t.loadDiffFiles)!==Boolean(n.loadDiffFiles)||(t.expandUnchanged??!1)!==(n.expandUnchanged??!1)||(t.collapsedContextThreshold??1)!==(n.collapsedContextThreshold??1)||t.unsafeCSS!==n.unsafeCSS}function zF(t,n){return(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||(t.hunkSeparators??"line-info")!==(n.hunkSeparators??"line-info")||Boolean(t.loadDiffFiles)!==Boolean(n.loadDiffFiles)||(t.expandUnchanged??!1)!==(n.expandUnchanged??!1)||(t.collapsedContextThreshold??1)!==(n.collapsedContextThreshold??1)}function Qp(t,n){return t.isPartial&&n&&(t.type==="change"||t.type==="rename-changed")}function jF(t){return typeof t==="function"?"custom":t??"line-info"}function $0(t,n){if(t==null||n==null)return t==null&&n==null;return be(t,n)}function qF(t,n){let[s,a]=t.split(",").map(Number);return n==="split"?a:s}var KF=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","diffStyle","diffIndicators","disableBackground","expandUnchanged","loadDiffFiles","collapsedContextThreshold","lineDiffType","maxLineDiffLength","expansionLineCount","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],VF=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],N0=["renderCustomHeader","renderHeaderPrefix","renderHeaderFilenameSuffix","renderHeaderMetadata","renderAnnotation","renderGutterUtility","onPostRender","onGutterUtilityClick","onLineClick","onLineNumberClick","onLineEnter","onLineLeave","onTokenClick","onTokenEnter","onTokenLeave"],D0=["onLineSelected","onLineSelectionStart","onLineSelectionChange","onLineSelectionEnd"],V0=Symbol("CodeView.itemOptionsState");function H0(t,n){Object.defineProperty(t,V0,{configurable:!1,enumerable:!1,value:n})}function Lo(t){return t[V0]}function li(t,n,s){Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get(){return s(this)}})}var WF=120,U0=1,B0="--diffs-overflow-override",XF=12000000,YF=1e6,JF=2000000,QF=1e7,G0=11000000;function ZF(t){if(t==null)throw Error("CodeView: createEditor is required for items with edit: true")}var eN=(()=>{let{navigator:t}=globalThis,n=t.userAgent,s=/iP(?:hone|ad|od)/.test(n),a=t.platform==="MacIntel"&&t.maxTouchPoints>1;return(s||a)&&/AppleWebKit/.test(n)&&/Safari/.test(n)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(n)})(),Ht=class t{static __STOP=!1;static __lastScrollPosition=0;type="advanced";config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=Zs;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement("div");stickyContainer=document.createElement("div");stickyOffset=document.createElement("div");header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;constructor(n={theme:u},s,a=!1){this.options=n,this.computeMetricsCache(n.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=s,this.isContainerManaged=a,this.stickyOffset.style.contain="layout size",this.stickyContainer.style.position="sticky",this.stickyContainer.style.width="100%",this.stickyContainer.style.contain="layout style inline-size",this.stickyContainer.style.isolation="isolate",this.stickyContainer.style.display="flex",this.stickyContainer.style.flexDirection="column"}getLayout(){return this.options.layout??ZI}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(n){return this.itemMetricsCache={hunkLineCount:n?.hunkLineCount??Zs.hunkLineCount,lineHeight:n?.lineHeight??Zs.lineHeight,diffHeaderHeight:n?.diffHeaderHeight??Zs.diffHeaderHeight,hunkSeparatorHeight:n?.hunkSeparatorHeight,spacing:n?.spacing??Zs.spacing,paddingTop:n?.paddingTop,paddingBottom:n?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??eS}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return GI&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(n){if(!this.shouldValidateItemHeights()||n.element==null)return;let s=n.instance.getAdvancedStickySpecs();if(s==null)return;let a=s.height,l=n.element.getBoundingClientRect().height;if(a===l)return;console.error("CodeView: reconciled item height does not match DOM height",{id:n.item.id,type:n.type,index:n.index,version:n.version,expectedHeight:a,actualHeight:l,delta:l-a,stickyTopOffset:s.topOffset,virtualizedHeight:n.instance.getVirtualizedHeight(),top:n.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:n.element,instance:n.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:n,lastIndex:s,stickyHeight:a,stickyTop:l,stickyBottom:d}=this.renderState;if(n===-1||s===-1)return;let f=this.stickyContainer.getBoundingClientRect().height;if(Math.abs(f-a)<U0)return;console.error("CodeView: sticky container height does not match computed layout",{computedStickyHeight:a,actualStickyHeight:f,delta:f-a,stickyTop:l,stickyBottom:d,firstIndex:n,lastIndex:s,firstStickySpecs:this.items[n]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[s]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){if(this.scrollInteractionFixTimer!=null)clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0}suspendScrollInteractions(){if(this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled)this.stickyContainer.style.pointerEvents="none",this.pointerEventsDisabled=!0;if(eN&&!this.codeOverflowFix)this.stickyContainer.style.setProperty(B0,"hidden"),this.codeOverflowFix=!0;this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,WF)}restoreScrollInteractions=()=>{if(this.clearScrollInteractionTimer(),this.pointerEventsDisabled)this.stickyContainer.style.removeProperty("pointer-events"),this.pointerEventsDisabled=!1;if(this.codeOverflowFix)this.stickyContainer.style.setProperty(B0,"auto"),this.codeOverflowFix=!1};syncLayout(){let{gap:n,paddingBottom:s,paddingTop:a}=this.getLayout();this.stickyContainer.style.gap=`${n}px`,this.container?.style.setProperty("margin-top",`${a}px`),this.container?.style.setProperty("margin-bottom",`${s}px`)}reconcileHeaderFooterHosts(){let n=this.reconcileHost("header"),s=this.reconcileHost("footer");return n||s}reconcileHost(n){let{root:s,container:a}=this;if(s==null||a==null)return!1;let l=n==="header"?this.header:this.footer,d=n==="header"?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(d==null){if(l.element==null)return!1;return this.resizeObserver?.unobserve(l.element),l.element.remove(),l.element=void 0,l.render=void 0,this.setHostHeight(l,0),!1}if(l.element!=null&&d===l.render)return!1;let f=l.element??bS(n,a,this.resizeObserver);l.element=f;let h=d();if(h!=null)f.replaceChildren(h);else if(!this.isContainerManaged&&f.children.length>0)f.textContent="";return l.render=d,!0}setHostHeight(n,s){if(n.height===s)return;n.height=s,this.scrollDirty=!0}measureMountedHosts(){if(this.header.element!=null)this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height);if(this.footer.element!=null)this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(n){if(this.root!=null)throw Error("CodeView.setup: already setup");if(this.workerManager?.subscribeToThemeChanges(this),this.root=n,this.root.style.overflowAnchor="none",!this.root.hasAttribute("tabindex"))this.root.tabIndex=-1;this.container??=document.createElement("div"),this.container.style.contain="layout style",this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener("scroll",this.handleScroll,{passive:!0}),this.root.addEventListener("wheel",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("touchstart",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("pointerdown",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("keydown",this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{if(t.__STOP)t.__STOP=!1,this.scrollTo({type:"position",position:t.__lastScrollPosition,behavior:"instant"});else t.__lastScrollPosition=this.getScrollTop(),t.__STOP=!0}}reset(){D(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let{items:n}=this,s=[...this.itemEditors.values()].map((d)=>{let f=this.idToItem.get(d.state.id);if(f!=null)d.state.removedItem=f.item;return d});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items=[],this.idToItem.clear(),this.instanceToItem.clear();let a=!1,l;for(let d of s)try{d.editor.cleanUp("discard")}catch(f){if(!a)a=!0,l=f}for(let d of n)try{d.instance.cleanUp()}catch(f){if(!a)a=!0,l=f}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent="",this.stickyOffset.style.height="",this.container?.style.removeProperty("height"),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),!this.isContainerManaged)this.flushSlotCoordinator();if(a)throw l}cleanUp(){let n=!1,s;try{this.reset()}catch(a){n=!0,s=a}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener("scroll",this.handleScroll),this.root?.removeEventListener("wheel",this.clearPendingScroll),this.root?.removeEventListener("touchstart",this.clearPendingScroll),this.root?.removeEventListener("pointerdown",this.clearPendingScroll),this.root?.removeEventListener("keydown",this.clearPendingScroll),this.root?.style.removeProperty("overflow-anchor"),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent="",this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,n)throw s}cleanAllRenderedItems(){if(this.renderState.firstIndex===-1)return;for(let n=this.renderState.firstIndex;n<=this.renderState.lastIndex;n++){let s=this.items[n];if(s==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${n}`);this.releaseRenderedItem(s)}}primeScrollTarget(n){if(n.type==="position")return;let s=this.idToItem.get(n.id);if(s==null)return;s.instance.primeHighlightCache()}getElementPoolLimit(){let n=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:s}=this.itemMetricsCache;return Math.max(8,Math.ceil(n/Math.max(s,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let n=this.elementPool.pop();while(n!=null&&!this.isElementPoolGenerationCurrent(n))n=this.elementPool.pop();return n??=document.createElement(Dc),this.markElementPoolGenerationCurrent(n),n}releaseRenderedItem(n){let{element:s}=n;if(s!=null&&this.renderedItemOwnsFocus(s))this.shouldFixContainerFocus=!0;if(n.instance.cleanUp(!0),this.attachedEditors.delete(n.item.id),n.element=void 0,s==null)return;s.remove(),this.cleanElement(s),this.queueElementForPool(s)}renderedItemOwnsFocus(n){let{activeElement:s}=document;return s===n||n.contains(s)||n.shadowRoot?.activeElement!=null}fixContainerFocus(){if(this.shouldFixContainerFocus)this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0})}cleanElement(n){let{shadowRoot:s}=n;if(s!=null){for(let a of Array.from(s.children))if(!oN(a))a.remove()}if(!this.isContainerManaged)n.replaceChildren()}queueElementForPool(n){let s=this.getElementPoolLimit();if(!this.isElementPoolGenerationCurrent(n)||this.getElementPoolSize()>=s)return;if(this.isElementClean(n))this.elementPool.push(n);else this.pendingElementPool.push(n)}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:n}=this;this.pendingElementPool=[];let s=this.getElementPoolLimit();for(let a of n)if(this.isElementPoolGenerationCurrent(a)&&this.isElementClean(a)&&this.elementPool.length<s)this.elementPool.push(a);else if(this.isElementPoolGenerationCurrent(a)&&this.getElementPoolSize()<s)this.pendingElementPool.push(a)}isElementClean(n){return n.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(n){this.elementPoolTracker.set(n,this.elementPoolVersion)}isElementPoolGenerationCurrent(n){return this.elementPoolTracker.get(n)===this.elementPoolVersion}resolveEffectiveScrollBehavior(n,s){if(CS())return"instant";if(n.behavior!=="smooth-auto")return n.behavior??"instant";return Math.abs(s-this.getScrollTop())<=this.getHeight()*10?"smooth":"instant"}scrollTo(n){if(this.root==null)return;let s=this.normalizeScrollTarget(n);if(s==null)return;let a=this.resolveScrollTargetTop(s);if(a==null)return;if(this.primeScrollTarget(s),this.resolveEffectiveScrollBehavior(s,a)==="smooth")this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()};else this.scrollAnimation=void 0;this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=s,this.render()}setSelectedLines(n,s){this.applySelectedLines(n,s)}getSelectedLines(){return this.selectedLines}clearSelectedLines(n){this.applySelectedLines(null,n)}getItem(n){return this.idToItem.get(n)?.item}getEditor(n){return this.itemEditors.get(n)?.editor}updateItem(n){let s=this.idToItem.get(n.id);if(s==null)return console.error(`CodeView.updateItem: unknown item id "${n.id}"`),!1;if(!this.syncItemRecord(s,n))return!1;return this.markItemLayoutDirty(s),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0}updateItemId(n,s){if(n===s)return!0;let a=this.idToItem.get(n);if(a==null)return console.error(`CodeView.updateItemId: unknown item id "${n}"`),!1;if(this.idToItem.has(s))return console.error(`CodeView.updateItemId: duplicate item id "${s}"`),!1;if(this.idToItem.delete(n),a.item.id=s,this.idToItem.set(s,a),this.updateItemOptionsId(a.instance.options,s),this.selectedLines?.id===n)this.selectedLines={...this.selectedLines,id:s},this.options.onSelectedLinesChange?.(this.selectedLines);let l=this.itemEditors.get(n);if(l!=null){if(this.itemEditors.delete(n),this.itemEditors.set(s,l),this.attachedEditors.delete(n))this.attachedEditors.add(s)}return this.renamePendingScrollTarget(n,s),this.renamePendingLayoutAnchor(n,s),this.render(),!0}addItem(n){this.addItems([n])}addItems(n){this.appendItemsInternal(n),this.syncItemEditors(),this.syncSelection()}removeItem(n){let s=this.idToItem.get(n);if(s==null)return console.error(`CodeView.removeItem: unknown item id "${n}"`),!1;let a=[];for(let l of this.items)if(l!==s)a.push(l.item);return this.setItems(a),!0}setItems(n){let s;if(this.items.length===0)this.appendItemsInternal(n);else if(!this.tryAppendItems(n))s=this.reconcileItems(n);try{this.syncItemEditors(s)}finally{for(let a of s?.values()??[])a.instance.cleanUp()}this.syncSelection()}appendItemsInternal(n,s=!0){if(n.length===0)return;let a=this.getLayout(),l=this.items.length===0?0:this.scrollHeight+a.gap,d=l;for(let f=0;f<n.length;f++){let h=n[f];if(h==null)throw Error("CodeView.appendItemsInternal: missing input item");if(this.idToItem.has(h.id))throw Error(`CodeView.addItem: duplicate id "${h.id}"`);let g=this.createItem(h,this.items.length,l);this.items.push(g),this.idToItem.set(g.item.id,g),this.instanceToItem.set(g.instance,g),g.height=tN(g),l+=g.height+a.gap}if(this.scrollHeight=l-a.gap,this.scrollDirty=!0,s)if(this.canSkipRenderForAppend(d))this.syncContainerHeight();else this.render()}canSkipRenderForAppend(n){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&n>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(n){if(n==null)return;this.capturePendingLayoutAnchor();let{options:s}=this,a=this.getLayout(),{itemMetricsCache:l}=this;if(nN(s,n))this.invalidateElementPool();this.options=n;let d=this.computeMetricsCache(n.itemMetrics),f=!vi(l,d),h=!vi(a,this.getLayout());if(h)this.syncLayout();let g=f||rN(s,n);if(g){let b=this.pendingLayoutReset;this.pendingLayoutReset={metrics:f?d:b?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:b?.includeEstimatedDiffHeights===!0||f||iN(s,n)}}if(h||g)this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0;if(!oa(s,n))this.renderOptionsRevision++;this.syncItemEditors();let I=s.renderCodeViewHeader!==n.renderCodeViewHeader||s.renderCodeViewFooter!==n.renderCodeViewFooter;if(!this.isContainerManaged&&(this.items.length>0||I))this.render()}capturePendingLayoutAnchor(n=this.idToItem){if(this.root==null||this.items.length===0||this.pendingScrollTarget!=null)return;this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),n)}render(n=!1){if(t.__STOP)return;if(n)D(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit();else q(this.computeRenderRangeAndEmit)}isReady(){let{workerManager:n}=this;if(n==null||n.getStats().workersFailed)return this.isSharedHighlighterReady();if(n.isInitialized())return this.clearReadySubscription(),!0;if(this.isReadySubscription??=n.subscribeToStatChanges((s)=>{if(s.managerState!=="initialized"&&!s.workersFailed)return;this.clearReadySubscription(),this.render(!0)}),n.getStats().managerState==="waiting")n.initialize().catch(()=>{});return!1}clearReadySubscription(){if(this.isReadySubscription==null)return;this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0}isSharedHighlighterReady(){let n=this.workerManager?.getFileRenderOptions().theme??this.options.theme??u;if(rS()&&ur(n))return this.clearReadySubscription(),!0;if(!E(this.pendingHighlighterTheme,n))this.clearReadySubscription();return this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=n;let s=!1;return ae({themes:C(n),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{if(s)return;this.clearReadySubscription(),this.render(!0)},(a)=>{if(s)return;this.clearReadySubscription(),console.error(a)}),()=>{s=!0}})(),!1}instanceChanged(n,s){let a=this.instanceToItem.get(n);if(a==null)throw Error("CodeView.instanceChanged: An instance has changed that is not registered");if(s)this.markItemLayoutDirty(a);this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:n,lastIndex:s}=this.renderState;if(n===-1||s===-1||s<n)return[];let a=[];for(let l=n;l<=s;l++){let d=this.items[l];if(d?.element==null)continue;if(d.type==="diff")a.push({id:d.item.id,type:"diff",item:d.item,version:d.version,element:d.element,instance:d.instance});else a.push({id:d.item.id,type:"file",item:d.item,version:d.version,element:d.element,instance:d.instance})}return a}setSlotCoordinator(n){if(n===this.slotCoordinator)return!1;return this.slotCoordinator=n,this.slotSnapshot=void 0,!0}getSlotSnapshot(n){return this.buildSlotSnapshot(n)}buildSlotSnapshot(n){let s=aN(this.getRenderedItems(),n),{element:a}=this.header,{element:l}=this.footer;if(s==null&&a==null&&l==null)return;return{items:s,header:a,footer:l}}subscribeToScroll(n){return this.scrollListeners.add(n),()=>{this.scrollListeners.delete(n)}}getLocalTopForInstance(n){let s=this.instanceToItem.get(n);if(s==null)throw Error("CodeView.getLocalTopForInstance: unknown virtualized instance");return s.top}getTopForItem(n){let s=this.idToItem.get(n);if(s==null)return;return s.top+this.getItemTopOffset()}createItem(n,s,a){let{itemMetricsCache:l}=this;if(n.type==="diff"){let f=new F0(this.createDiffOptions(n.id),this,l,this.workerManager,this.isContainerManaged);return{type:"diff",item:n,version:n.version,index:s,top:a,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:f}}let d=new XS(this.createFileOptions(n.id),this,l,this.workerManager,this.isContainerManaged);return{type:"file",item:n,version:n.version,index:s,top:a,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:d}}applySelectedLines(n,s){let{selectedLines:a}=this;if(n==null&&a==null||n!=null&&a?.id===n.id&&sa(a.range,n.range))return;if(a!=null&&a.id!==n?.id)this.idToItem.get(a.id)?.instance.setSelectedLines(null,{notify:!1});this.selectedLines=n,this.idToItem.get(n?.id??"")?.instance.setSelectedLines(n?.range??null,s)}syncSelection(){if(this.selectedLines==null)return;let n=this.idToItem.get(this.selectedLines.id);if(n==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}n.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(n){return n.item.edit===!0&&n.item.collapsed!==!0}attachItemEditor(n){let{id:s}=n.item,{createEditor:a}=this.options;if(n.element==null||this.attachedEditors.has(s)||!this.isItemInEditMode(n))return;let l=this.itemEditors.get(s),d;try{if(l==null&&n.type==="diff"&&!n.instance.__canAttachEditor()){n.instance.__prepareForEditing();return}if(l==null){ZF(a);let f=Lo(n.instance.options);if(f==null)throw Error("CodeView.attachItemEditor: instance options are missing their state");let h=(I)=>{let b=this.idToItem.get(f.id);if(b==null)return;this.options.onItemEditChange?.(I,b.item)},g=this.options.getEditStateKey?.(n.item);if(n.type==="diff"){let I=a("file-diff",{onChange:h},g);d=I,this.itemEditors.set(s,{editor:I,state:f,dispose:I.edit(n.instance)})}else{let I=a("file",{onChange:h},g);d=I,this.itemEditors.set(s,{editor:I,state:f,dispose:I.edit(n.instance)})}}else if(n.type==="diff")l.dispose=l.editor.edit(n.instance);else l.dispose=l.editor.edit(n.instance);this.attachedEditors.add(s)}catch(f){throw d?.cleanUp(),this.releaseRenderedItem(n),f}}syncItemEditors(n){if(this.itemEditors.size===0)return;let s=[];for(let[d,f]of this.itemEditors){let h=this.idToItem.get(d),g=n?.get(d);if(g==null&&h!=null){let{edit:I=!1,collapsed:b=!1}=h.item;if(I){if(b&&this.attachedEditors.delete(d))f.editor.cleanUp("recycle");continue}}else if(g!=null)f.state.removedItem=g.item;this.itemEditors.delete(d),this.attachedEditors.delete(d),s.push(f)}if(s.length===0)return;let a=!1,l;for(let d of s){try{d.dispose()}catch(h){if(!a)a=!0,l=h}let f=this.idToItem.get(d.state.id);if(f!=null)this.markItemLayoutDirty(f)}if(this.render(),a)throw l}requireItemFromState(n){let s=this.idToItem.get(n.id)?.item??n.removedItem;if(s==null)throw Error(`CodeView.onItemEditComplete: unknown item "${n.id}"`);return s}completeFileItemEdit(n,s){let a=this.requireItemFromState(n);if(a.type!=="file")throw Error(`CodeView.onItemEditComplete: item "${n.id}" is not a file item`);let l={...a,file:s.file,annotations:s.lineAnnotations,edit:!1,version:(a.version??0)+1};if((this.options.onItemEditComplete?.(s,a,l)??"reject")==="reject")return"reject";if(this.idToItem.has(a.id))this.updateItem(l);return"accept"}completeDiffItemEdit(n,s){let a=this.requireItemFromState(n);if(a.type!=="diff")throw Error(`CodeView.onItemEditComplete: item "${n.id}" is not a diff item`);let l={...a,fileDiff:s.fileDiff,annotations:s.lineAnnotations,edit:!1,version:(a.version??0)+1};if((this.options.onItemEditComplete?.(s,a,l)??"reject")==="reject")return"reject";if(this.idToItem.has(a.id))this.updateItem(l);return"accept"}renamePendingScrollTarget(n,s){let{pendingScrollTarget:a}=this;if(a==null||a.type==="position"||a.id!==n)return;this.pendingScrollTarget={...a,id:s}}renamePendingLayoutAnchor(n,s){if(this.pendingLayoutAnchor?.id===n)this.pendingLayoutAnchor.id=s}createFileOptionsPrototype(){let n={};for(let s of VF)li(n,s,()=>this.options[s]);li(n,"stickyHeader",()=>this.options.stickyHeaders),li(n,"collapsed",(s)=>{let a=Lo(s);if(a==null)return;return this.getItemOptions(a,"file")?.item.collapsed}),li(n,"onEditComplete",(s)=>{if(this.options.onItemEditComplete==null)return;let a=Lo(s);if(a==null)return;return(l)=>this.completeFileItemEdit(a,l)});for(let s of N0)this.defineItemSharedCallback(n,"file",s);for(let s of D0)this.defineItemSelectionCallback(n,"file",s);return n}createDiffOptionsPrototype(){let n={};for(let s of KF)li(n,s,()=>this.options[s]);li(n,"stickyHeader",()=>this.options.stickyHeaders),li(n,"hunkSeparators",()=>this.options.hunkSeparators),li(n,"collapsed",(s)=>{let a=Lo(s);if(a==null)return;return this.getItemOptions(a,"diff")?.item.collapsed}),li(n,"onEditComplete",(s)=>{if(this.options.onItemEditComplete==null)return;let a=Lo(s);if(a==null)return;return(l)=>this.completeDiffItemEdit(a,l)});for(let s of N0)this.defineItemSharedCallback(n,"diff",s);for(let s of D0)this.defineItemSelectionCallback(n,"diff",s);return n}createFileOptions(n){let s=Object.create(this.fileOptionsPrototype);return H0(s,{id:n}),s}createDiffOptions(n){let s=Object.create(this.diffOptionsPrototype);return H0(s,{id:n}),s}updateItemOptionsId(n,s){let a=Lo(n);if(a==null)throw Error("CodeView.updateItemOptionsId: No valid state");a.id=s}getItemOptions(n,s){let a=this.idToItem.get(n.id);if(a==null||a.type!==s)return;return a}defineItemSharedCallback(n,s,a){li(n,a,(l)=>{if(this.options[a]==null)return;let d=Lo(l);if(d==null)return;let f=d.callbackCache??={},h=f[a];if(h==null)h=(...g)=>{let I=this.getItemOptions(d,s);if(I==null)return;let b=this.options[a];return b?.(...g,I)},f[a]=h;return h})}defineItemSelectionCallback(n,s,a){li(n,a,(l)=>{let d=Lo(l);if(d==null)return;let f=d.callbackCache??={},h=f[a];if(h==null)h=(g)=>{let I=this.getItemOptions(d,s);if(I==null)return;let b=g==null?null:{id:I.item.id,range:g};if(this.options.controlledSelection!==!0){if(g!=null||this.selectedLines?.id===I.item.id)this.applySelectedLines(b,{notify:!1})}this.options.onSelectedLinesChange?.(b);let v=this.options[a];return v?.(g,I)},f[a]=h;return h})}markLayoutDirtyFromIndex(n){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??n,n)}markItemLayoutDirty(n){if(this.items[n.index]!==n)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${n.item.id}"`);this.markLayoutDirtyFromIndex(n.index)}tryAppendItems(n){if(n.length<=this.items.length)return!1;for(let s=0;s<this.items.length;s++){let a=this.items[s];if(a==null)throw Error("CodeView.tryAppendItems: missing existing item");let l=n[s];if(l==null||a.item.id!==l.id||a.type!==l.type)return!1}for(let s=0;s<this.items.length;s++){let a=this.items[s];if(a==null)throw Error("CodeView.tryAppendItems: missing existing item");let l=n[s];if(l==null)throw Error("CodeView.tryAppendItems: append candidate missing prefix item");if(this.syncItemRecord(a,l))this.markLayoutDirtyFromIndex(s)}return this.appendItemsInternal(n.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(n){let{items:s,idToItem:a}=this,l=new Set(s),d=[],f=new Map,h=new Map,g=new Map,I;for(let b=0;b<n.length;b++){let v=n[b];if(v==null)throw Error("CodeView.reconcileItems: missing input item");if(f.has(v.id))throw Error(`CodeView.setItems: duplicate id "${v.id}"`);let k=a.get(v.id),w=k!=null&&k.type===v.type?k:this.createItem(v,b,0);if(w.index=b,k!=null&&k.type===v.type){if(l.delete(k),this.syncItemRecord(w,v))I=Math.min(I??b,b)}else I=Math.min(I??b,b);if(s[b]!==w)I=Math.min(I??b,b);d.push(w),f.set(v.id,w),h.set(w.instance,w)}if(I==null){if(l.size===0)return;I=Math.max(d.length-1,0)}this.capturePendingLayoutAnchor(f);for(let b=0;b<s.length;b++){let v=s[b];if(v==null||!l.has(v))continue;g.set(v.item.id,v),this.releaseRenderedItem(v);let k=Math.max(d.length-1,0);I=Math.min(I??k,k)}if(this.items=d,this.idToItem=f,this.instanceToItem=h,this.renderState.firstIndex>=d.length)this.resetRenderState();else if(this.renderState.lastIndex>=d.length)this.renderState.lastIndex=d.length-1;return this.markLayoutDirtyFromIndex(I),this.scrollDirty=!0,this.render(),g.size>0?g:void 0}syncItemRecord(n,s){if(n.type!==s.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${s.id}"`);if(n.version===s.version)return!1;return n.item=s,n.version=s.version,n.renderedOptionsRevision=-1,!0}getMaxScrollTopForHeight(n){let{paddingBottom:s,paddingTop:a}=this.getLayout();return Math.max(a+this.header.height+n+this.footer.height+s-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>G0}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),XF):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(n){let s=this.getMaxPagedScrollTop();return Math.max(0,Math.min(n,s))}clampScrollTop(n){let s=this.getMaxScrollTop();return Math.max(0,Math.min(n,s))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(n){let s=this.getMaxScrollPageOffset();return Math.max(0,Math.min(n,s))}resolveScrollPageWindow(n,s){let a=oi(this.clampPagedScrollTop(s)),l=this.clampScrollPageOffset(n-a);return a=oi(this.clampPagedScrollTop(n-l)),l=this.clampScrollPageOffset(n-a),{pagedScrollTop:a,scrollPageOffset:l}}resolvePagedScrollPosition(n){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(n),scrollPageOffset:0};let s=this.clampScrollPageOffset(this.scrollPageOffset),a=n-s,l=this.getMaxPagedScrollTop(),d=this.getMaxScrollPageOffset(),f=a>G0&&s<d,h=a<YF&&s>0;if(a<0||a>l||f||h)return this.resolveScrollPageWindow(n,h?Math.min(QF,l):JF);return{pagedScrollTop:oi(this.clampPagedScrollTop(a)),scrollPageOffset:s}}needsScrollPageUpdate(n){let s=oi(this.clampScrollTop(n)),{scrollPageOffset:a}=this.resolvePagedScrollPosition(s);return a!==this.scrollPageOffset}getPagedLayoutTop(n){if(!this.shouldRebaseScroll())return n;return Math.max(n-this.scrollPageOffset,0)}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(n){let s=this.idToItem.get(n.id);if(s==null){console.warn(`CodeView.scrollTo: unknown item id "${n.id}"`);return}if(n.type==="item")return{top:s.top,height:s.height};if(n.type==="range"){let l=this.getRangeScrollPosition(s,n);if(l==null){console.warn(`CodeView.scrollTo: unable to resolve range ${z0(n.range)} for item "${n.id}"`);return}return{top:s.top+l.top,height:l.height}}let a=this.getLineScrollPosition(s,n);if(a==null){console.warn(`CodeView.scrollTo: unable to resolve line ${n.lineNumber} for item "${n.id}"`);return}return{top:s.top+a.top,height:a.height}}normalizeScrollTarget(n){if(n.type==="position"||n.align!=="nearest")return n;let s=this.getScrollTargetRect(n);if(s==null)return;let a=n.offset??0,l=this.getItemTopOffset()+s.top,d=l+s.height,f=this.getScrollTop(),h=f+(n.type==="line"||n.type==="range"?this.getStickyHeaderOffset():0),g=f+this.getHeight();if(l-a<=h&&d+a>=g)return;if(l-a<h)return{...n,align:"start"};if(d+a>g)return{...n,align:"end"}}resolveScrollTargetTop(n){if(n.type==="position"){let l=this.clampScrollTop(n.position);return l!==n.position?l:this.clampScrollTop(n.position-this.getStickyHeaderOffset())}let s=this.idToItem.get(n.id);if(s==null){console.warn(`CodeView.scrollTo: unknown item id "${n.id}"`);return}if(n.type==="item")return this.clampScrollTop(this.resolveAlignedScrollPosition(s.top,s.height,n.align,n.offset));if(n.type==="range"){let l=this.getRangeScrollPosition(s,n);if(l==null){console.warn(`CodeView.scrollTo: unable to resolve range ${z0(n.range)} for item "${n.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(s.top+l.top,l.height,n.align,n.offset,this.getStickyHeaderOffset()))}let a=this.getLineScrollPosition(s,n);if(a==null){console.warn(`CodeView.scrollTo: unable to resolve line ${n.lineNumber} for item "${n.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(s.top+a.top,a.height,n.align,n.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(n,s,a,l=0,d=0){n+=this.getItemTopOffset();let f=this.getHeight();if(a==="center"&&s+l<f)return n-(f-s)/2+l;if(a==="end")return n-(f-s)+l;return n-d-l}getLineScrollPosition(n,s){if(n.type==="diff")return n.instance.getLinePosition(s.lineNumber,s.side);return n.instance.getLinePosition(s.lineNumber)}getRangeScrollPosition(n,s){let{range:a}=s,l=this.getLineScrollPosition(n,{type:"line",id:s.id,lineNumber:a.start,side:a.side}),d=this.getLineScrollPosition(n,{type:"line",id:s.id,lineNumber:a.end,side:a.endSide??a.side});if(l==null||d==null)return;let f=l.top,h=f+l.height,g=d.top,I=g+d.height,b=Math.min(f,g);return{top:b,height:Math.max(h,I)-b}}computeTargetScrollTopForFrame(n,s){if(this.pendingScrollTarget==null)return n;let a=this.resolveScrollTargetTop(this.pendingScrollTarget);if(a==null)return n;let{scrollAnimation:l}=this;if(l==null)return a;return this.computeSpringStep(l,a,s).position}computeSpringStep(n,s,a){let l=Math.max(0,a-n.lastTimestamp),{omega:d}=this.getSmoothScrollSettings(),f=Math.exp(-d*l),h=n.position-s,g=n.velocity+d*h;return{position:s+(h+g*l)*f,velocity:(g*(1-d*l)-d*h)*f}}advanceScrollAnimation(n,s){if(this.pendingScrollTarget==null)return;let a=this.resolveScrollTargetTop(this.pendingScrollTarget);if(a==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let l=this.scrollAnimation;if(l==null)return a;l.position+=s;let{position:d,velocity:f}=this.computeSpringStep(l,a,n);l.lastTimestamp=n,l.position=d,l.velocity=f;let{positionEpsilon:h,velocityEpsilon:g}=this.getSmoothScrollSettings();if(Math.abs(a-d)<=h&&Math.abs(f)<=g)return l.position=a,l.velocity=0,this.scrollAnimation=void 0,a;return l.position}computeRenderRangeAndEmit=(n=performance.now())=>{if(t.__STOP||this.container==null)return;if(!this.isReady())return;let s=this.getHeight(),a=this.getScrollTop(),l=a,d=this.pendingLayoutAnchor!=null,f=this.getScrollAnchor(l);if(this.layoutDirtyIndex!=null)this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,d=!0;if(d&&f!=null){let W=this.resolveAnchoredScrollTop(f);if(W!=null){let J=W-l;if(l=W,this.scrollAnimation!=null)this.scrollAnimation.position+=J}}if(d)l=this.clampScrollTop(l),this.syncContainerHeight();let h=this.computeTargetScrollTopForFrame(l,n),g=!d&&(this.renderState.scrollTop===-1||Math.abs(h-this.renderState.scrollTop)>s+this.config.overscrollSize*2);if(g)f=void 0;this.windowSpecs=Ep({scrollTop:h-this.header.height,height:s,scrollHeight:this.getScrollHeight(),fitPerfectly:g,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let I=a;if(this.pendingScrollTarget!=null&&h!==I||this.needsScrollPageUpdate(h))this.applyScrollFix(h,I,this.windowSpecs),I=h;let{top:b,bottom:v}=this.windowSpecs,{firstIndex:k,lastIndex:w}=this.renderState;if(k>=0)for(let W=k;W<=w;W++){let J=this.items[W];if(J==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${W}`);if(!(J.top>b-J.height&&J.top<=v))this.releaseRenderedItem(J)}let P=this.reconcileHeaderFooterHosts(),M,N=new Set,_=this.findFirstVisibleIndex(b),O=this.findLastVisibleIndex(v);for(let W=_;W<=O;W++){let J=this.items[W];if(J==null)throw Error("CodeView.computeRenderRangeAndEmit: missing item");let{instance:ee}=J;if(J.element==null){if(J.element=this.acquireElement(),K0(this.stickyContainer,J.element,M),ee.virtualizedSetup(),q0(J,J.element))J.renderedOptionsRevision=this.renderOptionsRevision,N.add(J);M=J.element}else{if(K0(this.stickyContainer,J.element,M),q0(J,void 0,J.renderedOptionsRevision!==this.renderOptionsRevision))J.renderedOptionsRevision=this.renderOptionsRevision,N.add(J);M=J.element}if(J.item.edit===!0)this.attachItemEditor(J)}if(this.renderState.firstIndex=_<=O?_:-1,this.renderState.lastIndex=O,this.flushSlotCoordinator(),this.flushManagers(N),P)this.measureMountedHosts();this.reconcileRenderedItems(N),this.syncContainerHeight(),this.updateStickyPositioning();let B=f!=null?this.resolveAnchoredScrollTop(f):void 0;if(f===this.pendingLayoutAnchor)this.pendingLayoutAnchor=void 0;let X=B!=null?B-l:0,z=h,K=!1;if(this.pendingScrollTarget!=null){let W=this.advanceScrollAnimation(n,X);if(W!=null)z=W,K=!0;else z=l}else z=B??h;if(z!==I)this.applyScrollFix(z,I,this.windowSpecs),I=z;if(K&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget))this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;if(this.renderState.scrollTop=oi(I),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),g||this.scrollAnimation!=null)this.render()};flushManagers(n){for(let s of n)s.instance.flushManagers()}syncContainerHeight(){let n=this.getPagedScrollHeight();if(this.container==null||this.containerHeight===n)return;this.container.style.height=`${n}px`,this.containerHeight=n}getStickyBounds(n){let{firstIndex:s,lastIndex:a}=n!=null?{firstIndex:this.findFirstVisibleIndex(n.top),lastIndex:this.findLastVisibleIndex(n.bottom)}:this.renderState;if(s===-1||a===-1||s>a)return;let l=this.items[s]?.instance.getAdvancedStickySpecs(n),d=this.items[a]?.instance.getAdvancedStickySpecs(n);if(l==null||d==null)return;return{stickyTop:this.getPagedLayoutTop(Math.max(l.topOffset,0)),stickyBottom:this.getPagedLayoutTop(d.topOffset+d.height)}}applyStickyPositioning({stickyTop:n,stickyBottom:s}){let a=this.getHeight(),{itemMetricsCache:l}=this,d=s-n;this.renderState.stickyHeight=d,this.renderState.stickyTop=n,this.renderState.stickyBottom=s,this.stickyOffset.style.height=`${n}px`;let f=(Math.random()*l.lineHeight>>0)*-1,h=-Math.max(d+f,0)+a;this.stickyContainer.style.top=`${h}px`,this.stickyContainer.style.bottom=`${h+l.diffHeaderHeight}px`}syncPagedScrollScaffolding(n){this.syncContainerHeight();let s=this.getStickyBounds(n);if(s==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(n.top)}px`;return}this.applyStickyPositioning(s)}reconcileRenderedItems(n){let{firstIndex:s,lastIndex:a}=this.renderState;if(s===-1)return;let l=-1,d=!1;for(let f=s;f<this.items.length;f++){if(!d&&f>a)break;let h=this.items[f];if(h==null)throw Error("CodeView.reconcileRenderedItems: Invalid item");if(l===-1)l=h.top;else if(h.top!==l)h.top=l,h.instance.syncVirtualizedTop(),d=!0;if(n==null?f<=a:n.has(h)){if(h.instance.reconcileHeights())d=!0,h.height=h.instance.getVirtualizedHeight();this.validateRenderedItemHeight(h)}if(l+=h.instance.getVirtualizedHeight(),f<this.items.length-1)l+=this.getLayout().gap}if(d&&l!=null)this.scrollDirty=!0,this.scrollHeight=l}updateStickyPositioning(){let n=this.getStickyBounds();if(n==null){if(this.renderState.firstIndex===-1)this.stickyOffset.style.height="";return}let{stickyTop:s,stickyBottom:a}=n;if(a-s===this.renderState.stickyHeight&&s===this.renderState.stickyTop&&a===this.renderState.stickyBottom)return;this.applyStickyPositioning(n)}handleScroll=()=>{if(t.__STOP)return;this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render()};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=(n)=>{let s=!1;for(let a of n)if(a.target===this.stickyContainer){let l=a.borderBoxSize[0].blockSize;if(Math.abs(l-this.renderState.stickyHeight)>=U0){let d=this.getScrollTop(),f=this.getScrollAnchor(d);this.reconcileRenderedItems(),this.updateStickyPositioning();let h=f!=null?this.resolveAnchoredScrollTop(f):void 0;if(h!=null){let g=h-d;if(this.applyScrollFix(h,d,this.windowSpecs),this.scrollAnimation!=null)this.scrollAnimation.position+=g}if(this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget))this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;s=!0}}else if(a.target===this.header.element||a.target===this.footer.element){let l=a.target===this.header.element?this.header:this.footer,d=a.borderBoxSize[0].blockSize;if(d!==l.height){let f=this.getScrollTop(),h=this.getScrollAnchor(f);this.setHostHeight(l,d);let g=h!=null?this.resolveAnchoredScrollTop(h):void 0;if(g!=null){let I=g-f;if(this.applyScrollFix(g,f,this.windowSpecs),this.scrollAnimation!=null)this.scrollAnimation.position+=I}if(this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget))this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;s=!0}}else this.scrollDirty=!0,this.heightDirty=!0,s=!0;if(s)this.render(!0)};getScrollAnchorViewportTop(n,s){return n<s?s+this.getStickyHeaderOffset():s}getScrollAnchor(n,s=this.idToItem){let a,{pendingLayoutAnchor:l}=this;if(l!=null){let b=this.idToItem.get(l.id);if(b!=null&&s.get(l.id)===b)return l;if(b!=null)a=b}if(n<=0)return;let{firstIndex:d,lastIndex:f,stickyTop:h,stickyBottom:g}=this.renderState;if(d===-1||f===-1)return;let I=this.getHeight();if(h===-1||g===-1)return;for(let b=d;b<=f;b++){let v=this.items[b];if(v==null)continue;let k=this.getItemTopOffset()+v.top;if(k+v.height<=n)continue;if(k>=n+I)break;if(s.get(v.item.id)!==v){a??=v;continue}if(k>=n)return{type:"item",id:v.item.id,viewportOffset:k-n};let w=this.getScrollAnchorViewportTop(k,n)-k,P=v.instance.getNumericScrollAnchor(w);if(P!=null){let M=k+P.top;return{type:"line",id:v.item.id,lineNumber:P.lineNumber,side:P.side,viewportOffset:M-n}}}if(a!=null)for(let b=a.index+1;b<this.items.length;b++){let v=this.items[b];if(v!=null&&s.get(v.item.id)===v)return{type:"item",id:v.item.id,viewportOffset:0}}}resolveAnchoredScrollTop(n){let s=this.idToItem.get(n.id);if(s==null)return;let a=this.getItemTopOffset();if(n.type==="item"){let f=a+s.top;return this.clampScrollTop(f-n.viewportOffset)}let l=s.type==="diff"?s.instance.getLinePosition(n.lineNumber,n.side):s.instance.getLinePosition(n.lineNumber);if(l==null)return;let d=a+s.top+l.top;return this.clampScrollTop(d-n.viewportOffset)}applyScrollFix(n,s,a){if(this.root==null)return;let l=oi(this.clampScrollTop(n)),d=oi(s),{scrollPageOffset:f}=this,h=oi(this.clampPagedScrollTop(d-f)),{pagedScrollTop:g,scrollPageOffset:I}=this.resolvePagedScrollPosition(l),b=g,v=f!==I;if(l===this.renderState.scrollTop&&l===d&&b===h&&!v)return;if(this.suspendScrollInteractions(),b!==h||v)this.scrollPageOffset=I,this.syncPagedScrollScaffolding(a);if(b!==h)this.root.scrollTo({top:b,behavior:"instant"});this.renderState.scrollTop=l,this.scrollTop=l,this.scrollDirty=!1}isPendingTargetSettled(n){let s=this.resolveScrollTargetTop(n);if(s==null)return!0;return oi(this.getScrollTop())===oi(s)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let n=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(n+this.scrollPageOffset),this.scrollTop}getHeight(){if(!this.heightDirty)return this.height;return this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let n=this.buildSlotSnapshot(this.slotCoordinator);if(IS(this.slotSnapshot,n))return;this.slotSnapshot=n,this.slotCoordinator.onSnapshotChange(n)}notifyScroll(){if(this.scrollListeners.size===0)return;let n=this.getScrollTop();for(let s of this.scrollListeners)s(n,this)}findFirstVisibleIndex(n){let s=0,a=this.items.length-1,l=this.items.length;while(s<=a){let d=s+a>>1,f=this.items[d];if(f==null)throw Error("CodeView.findFirstVisibleIndex: invalid item index");if(f.top+f.height>n)l=d,a=d-1;else s=d+1}return l}findLastVisibleIndex(n){let s=0,a=this.items.length-1,l=-1;while(s<=a){let d=s+a>>1,f=this.items[d];if(f==null)throw Error("CodeView.findLastVisibleIndex: invalid item index");if(f.top<=n)l=d,s=d+1;else a=d-1}return l}recomputeLayout(n=0,s){if(this.items.length===0){this.scrollHeight=0;return}let a=this.getLayout(),l=0;if(n>0){let d=this.items[n-1];if(d==null)throw Error("CodeView.recomputeLayout: invalid dirty index");l=d.top+d.height+a.gap}for(let d=n;d<this.items.length;d++){let f=this.items[d];if(f==null)throw Error("CodeView.recomputeLayout: invalid item index");if(f.top=l,f.type==="diff")f.height=f.instance.updateCodeViewLayout(f.item.fileDiff,l,s,f.item.annotations??[]);else f.height=f.instance.updateCodeViewLayout(f.item.file,l,s,f.item.annotations??[]);if(l+=f.height,d<this.items.length-1)l+=a.gap}if(l!==this.scrollHeight)this.scrollDirty=!0;this.scrollHeight=l}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function tN(t){if(t.instance.cleanUp(!0),t.type==="diff")return t.instance.updateCodeViewLayout(t.item.fileDiff,t.top,void 0,t.item.annotations??[]);else return t.instance.updateCodeViewLayout(t.item.file,t.top,void 0,t.item.annotations??[])}function nN(t,n){return!E(t.theme??u,n.theme??u)||(t.themeType??"system")!==(n.themeType??"system")||t.unsafeCSS!==n.unsafeCSS}function rN(t,n){return(t.overflow??"scroll")!==(n.overflow??"scroll")||(t.disableLineNumbers??!1)!==(n.disableLineNumbers??!1)||(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||t.unsafeCSS!==n.unsafeCSS||(t.diffStyle??"split")!==(n.diffStyle??"split")||(t.diffIndicators??"bars")!==(n.diffIndicators??"bars")||(t.hunkSeparators??"line-info")!==(n.hunkSeparators??"line-info")||(t.expandUnchanged??!1)!==(n.expandUnchanged??!1)||(t.collapsedContextThreshold??1)!==(n.collapsedContextThreshold??1)}function iN(t,n){return(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||(t.hunkSeparators??"line-info")!==(n.hunkSeparators??"line-info")||(t.expandUnchanged??!1)!==(n.expandUnchanged??!1)||(t.collapsedContextThreshold??1)!==(n.collapsedContextThreshold??1)}function oN(t){if(t instanceof SVGElement)return!0;return Co(t)&&(t.hasAttribute("data-core-css")||t.hasAttribute("data-theme-css")||t.hasAttribute("data-unsafe-css"))}function z0(t){let n=j0(t.start,t.side),s=j0(t.end,t.endSide??t.side);return n===s?n:`${n}-${s}`}function j0(t,n){if(n==null)return`${t}`;return`${n==="deletions"?"D":"A"}${t}`}function q0(t,n,s=!1){if(t.type==="diff")return t.instance.render({deferManagers:!0,fileContainer:n,fileDiff:t.item.fileDiff,forceRender:s,lineAnnotations:t.item.annotations??[]});else return t.instance.render({deferManagers:!0,fileContainer:n,file:t.item.file,forceRender:s,lineAnnotations:t.item.annotations??[]})}function K0(t,n,s){if(s==null){if(t.firstChild!==n)t.prepend(n);return}if(s.nextSibling!==n)s.after(n)}function sN(t){return(t.annotations?.length??0)>0}function aN(t,{hasHeaderRenderers:n,hasAnnotationRenderer:s,hasGutterRenderer:a}){if(t.length===0)return;if(n||a)return t;if(!s)return;let l=[];for(let d of t)if(sN(d.item))l.push(d);return l.length>0?l:void 0}var wi={assign:0,create:0,clone:0,discard:0,update:0};var H={};De(H,{Counted:()=>rh,Entries:()=>Ln,EntriesRegExp:()=>ih,Every:()=>Rn,EveryAll:()=>Vn,GraphemeCount:()=>mN,HasPropertyKey:()=>Y,IsArray:()=>Te,IsBigInt:()=>Zt,IsBoolean:()=>wn,IsClassInstance:()=>ib,IsConstructor:()=>th,IsDeepEqual:()=>xa,IsEqual:()=>F,IsFunction:()=>Ao,IsGreaterEqualThan:()=>ga,IsGreaterThan:()=>ys,IsInteger:()=>Bd,IsLessEqualThan:()=>Ri,IsLessThan:()=>Fl,IsMaxLength:()=>ob,IsMinLength:()=>sb,IsMultipleOf:()=>rb,IsNull:()=>Or,IsNumber:()=>ft,IsObject:()=>Be,IsObjectNotArray:()=>eo,IsString:()=>ct,IsSymbol:()=>nh,IsUndefined:()=>bt,IsUnsafePropertyKey:()=>Nl,IsValueLike:()=>xs,Keys:()=>pe,ShiftLeft:()=>Qe,Some:()=>ya,SomeAll:()=>ab,Symbols:()=>lb,Values:()=>oh});function gs(t,n,s){return t>=n&&t<=s}function Y0(t){return t===8205}function lN(t){return gs(t,55296,56319)}function W0(t){return gs(t,127462,127487)}function J0(t){return gs(t,65024,65039)}function Q0(t){return gs(t,768,879)||gs(t,6832,6911)||gs(t,7616,7679)||gs(t,65056,65071)}function Ud(t){return t>65535?2:1}function X0(t,n){while(n<t.length){let s=t.codePointAt(n);if(Q0(s)||J0(s))n+=Ud(s);else break}return n}function eh(t,n){let s=t.codePointAt(n),a=n+Ud(s);a=X0(t,a);while(a<t.length-1&&Y0(t.codePointAt(a))){let l=t.codePointAt(a+1);a+=1+Ud(l),a=X0(t,a)}if(W0(s)&&a<t.length&&W0(t.codePointAt(a)))a+=Ud(t.codePointAt(a));return a}function Z0(t){return t>=768&&(lN(t)||Q0(t)||J0(t)||Y0(t))}function eb(t){let n=0,s=0;while(s<t.length)s=eh(t,s),n++;return n}function uN(t,n){let s=0,a=0;while(a<t.length)if(a=eh(t,a),++s>=n)return!0;return!1}function cN(t,n){let s=0,a=0;while(a<t.length)if(a=eh(t,a),++s>n)return!1;return!0}function tb(t,n){if(n===0)return!0;if(t.length<n)return!1;let s=0;while(!0){if(Z0(t.charCodeAt(s)))return uN(t,n);if(++s>=n)return!0}}function nb(t,n){if(t.length<=n)return!0;let s=0;while(!0){if(Z0(t.charCodeAt(s)))return cN(t,n);if(++s>n)return!1}}function Te(t){return Array.isArray(t)}function Zt(t){return F(typeof t,"bigint")}function wn(t){return F(typeof t,"boolean")}function th(t){if(bt(t)||!Ao(t))return!1;let n=Function.prototype.toString.call(t);if(/^class\s/.test(n))return!0;if(/\[native code\]/.test(n))return!0;return!1}function Ao(t){return F(typeof t,"function")}function Bd(t){return Number.isInteger(t)}function Or(t){return F(t,null)}function ft(t){return Number.isFinite(t)}function eo(t){return Be(t)&&!Te(t)}function Be(t){return F(typeof t,"object")&&!Or(t)}function ct(t){return F(typeof t,"string")}function nh(t){return F(typeof t,"symbol")}function bt(t){return F(t,void 0)}function F(t,n){return t===n}function ys(t,n){return t>n}function Fl(t,n){return t<n}function Ri(t,n){return t<=n}function ga(t,n){return t>=n}function rb(t,n){if(Zt(t)||Zt(n))return BigInt(t)%BigInt(n)===0n;let s=0.0000000001;if(!ft(t))return!0;if(Bd(t)&&1/n%1===0)return!0;let a=t%n;return Math.min(Math.abs(a),Math.abs(a-n),Math.abs(a+n))<s}function ib(t){if(!Be(t))return!1;let n=globalThis.Object.getPrototypeOf(t);if(Or(n))return!1;return F(typeof n.constructor,"function")&&!(F(n.constructor,globalThis.Object)||F(n.constructor.name,"Object"))}function xs(t){return Zt(t)||wn(t)||Or(t)||ft(t)||ct(t)||bt(t)}function mN(t){return eb(t)}function ob(t,n){return nb(t,n)}function sb(t,n){return tb(t,n)}function Rn(t,n,s){return t.every((a,l)=>l<n||s(a,l))}function Vn(t,n,s){let a=!0;return t.forEach((l,d)=>{if(d>=n&&!s(l,d))a=!1}),a}function ya(t,n){return t.some((s,a)=>n(s,a))}function ab(t,n){let s=!1;return t.forEach((a,l)=>{if(n(a,l))s=!0}),s}function rh(t,n){return t.reduce((s,a,l)=>n(a,l)?++s:s,0)}function Qe(t,n,s){return F(t.length,0)?s():n(t[0],t.slice(1))}function Nl(t){return F(t,"__proto__")||F(t,"constructor")||F(t,"prototype")}function Y(t,n){return Nl(n)?Object.prototype.hasOwnProperty.call(t,n):(n in t)}function ih(t){return pe(t).map((n)=>[new RegExp(`^${n}$`),t[n]])}function Ln(t){return Object.entries(t)}function pe(t){return Object.getOwnPropertyNames(t)}function lb(t){return Object.getOwnPropertySymbols(t)}function oh(t){return Object.values(t)}function fN(t,n){if(!Be(n))return!1;let s=pe(t);return F(s.length,pe(n).length)&&s.every((a)=>xa(t[a],n[a]))}function pN(t,n){return Te(n)&&F(t.length,n.length)&&t.every((s,a)=>xa(t[a],n[a]))}function xa(t,n){return Te(t)?pN(t,n):Be(t)?fN(t,n):F(t,n)}var hN=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function gN(t){return hN.test(t)}function Gn(t,n){return`(${t} && ${n})`}function Dt(t,n){return`(${t} || ${n})`}function rr(t){return`!(${t})`}function Gd(t){return`Array.isArray(${t})`}function ub(t){return`typeof ${t} === "bigint"`}function yN(t){return`typeof ${t} === "boolean"`}function xN(t){return`Number.isInteger(${t})`}function IN(t){return`${t} === null`}function cb(t){return`Number.isFinite(${t})`}function db(t){return Gn(mb(t),rr(Gd(t)))}function mb(t){return`typeof ${t} === "object" && ${t} !== null`}function fb(t){return`typeof ${t} === "string"`}function SN(t){return`typeof ${t} === "symbol"`}function sh(t){return`${t} === undefined`}function bN(t){return`typeof ${t} === "function"`}function CN(t){return`Guard.IsConstructor(${t})`}function br(t,n){return`${t} === ${n}`}function pb(t,n){return`${t} > ${n}`}function ah(t,n){return`${t} < ${n}`}function Is(t,n){return`${t} <= ${n}`}function Dl(t,n){return`${t} >= ${n}`}function EN(t,n){return`Guard.IsMinLength(${t}, ${n})`}function vN(t,n){return`Guard.IsMaxLength(${t}, ${n})`}function Li(t,n,s,a){return F(n,"0")?`${t}.every((${s[0]}, ${s[1]}) => (${a}))`:`${t}.every((${s[0]}, ${s[1]}) => (${s[1]} < ${n}) || (${a}))`}function kN(t,n,s){return`${t}.some((${n[0]}, ${n[1]}) => ${s})`}function TN(t,n,s){return`((value) => { let result = false; value.forEach((${n[0]}, ${n[1]}) => { if (${s}) result = true }); return result })(${t})`}function zd(t,n,s){return`${t}.reduce((result, ${n[0]}, ${n[1]}) => (${s}) ? ++result : result, 0)`}function hb(t){return`Object.entries(${t})`}function Ss(t){return`Object.getOwnPropertyNames(${t})`}function bs(t,n){return F(n,'"__proto__"')||F(n,'"constructor"')?`Object.prototype.hasOwnProperty.call(${t}, ${n})`:`${n} in ${t}`}function gb(t,n){return`Guard.IsDeepEqual(${t}, ${n})`}function wN(t){return`[${t.join(", ")}]`}function Po(t,n){return`((${t.join(", ")}) => ${n})`}function Bt(t,n){return`${t}(${n.join(", ")})`}function lh(t,n){return`new ${t}(${n.join(", ")})`}function Xe(t,n){return`${t}${gN(n)?`.${n}`:`[${Ie(n)}]`}`}function Ie(t){if(!xs(t))throw Error("Unsupported Constant");return ct(t)?JSON.stringify(t):`${t}`}function RN(t,n,s){return`(${t} ? ${n} : ${s})`}function jd(t){return`{ ${t.join("; ")}; }`}function to(t,n){return`const ${t} = ${n}`}function yb(t,n){return`if(${t}) { ${n} }`}function qd(t){return`return ${t}`}function Wn(t){return F(t.length,0)?"true":t.reduce((n,s)=>Gn(n,s))}function uh(t){return F(t.length,0)?"false":t.reduce((n,s)=>Dt(n,s))}function LN(t,n){return`Guard.IsMultipleOf(${t}, ${n})`}function AN(t){return t instanceof Boolean}function PN(t){return t instanceof Number}function MN(t){return t instanceof String}function xb(t){return globalThis.ArrayBuffer.isView(t)}function Ib(t){return t instanceof globalThis.RegExp}function _N(t){return t instanceof globalThis.Date}function ON(t){return t instanceof globalThis.Set}function $N(t){return t instanceof globalThis.Map}var NN={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Jr(){return NN}function Mo(t){return Jr().immutableTypes?Object.freeze(t):t}function ir(t,n){return wi.assign+=1,Mo({...t,...n})}function DN(t){return t}function HN(t){return Y(t,"~kind")||Y(t,"~unsafe")}function UN(t){let n={};for(let s of pe(t)){if(Nl(s))continue;let a=Object.getOwnPropertyDescriptor(t,s);if(a.value=Cs(a.value),F(a.enumerable,!0))n[s]=a.value;else Object.defineProperty(n,s,a)}return n}function BN(t){let n={};for(let s of pe(t)){if(Nl(s))continue;n[s]=Cs(t[s])}for(let s of lb(t))n[s]=Cs(t[s]);return n}function GN(t){return ib(t)?DN(t):HN(t)?UN(t):BN(t)}function zN(t){return t.map((n)=>Cs(n))}function jN(t){return t.slice()}function qN(t){return new RegExp(t.source,t.flags)}function KN(t){return new Map(Cs([...t.entries()]))}function VN(t){return new Set(Cs([...t.values()]))}function Cs(t){return xb(t)?jN(t):Ib(t)?qN(t):$N(t)?KN(t):ON(t)?VN(t):Te(t)?zN(t):Be(t)?GN(t):t}function Ia(t){return wi.clone+=1,Cs(t)}function WN(t,n){for(let s of Object.keys(n))Object.defineProperty(t,s,{configurable:!0,writable:!0,enumerable:!1,value:n[s]});return t}function Sb(t,n){return{...t,...n}}function Et(t,n,s={}){wi.create+=1;let a=Sb(n,s),l=Jr().enumerableKind?Sb(a,t):WN(a,t);return Mo(l)}function ui(t,n){wi.discard+=1;let s={};for(let a of pe(t)){if(n.includes(a))continue;let l=Object.getOwnPropertyDescriptor(t,a);l.value=Ia(l.value),Object.defineProperty(s,a,l)}return Mo(s)}function pt(t,n,s){wi.update+=1;let a=Jr(),l=Ia(t);for(let d of Object.keys(n))Object.defineProperty(l,d,{configurable:!0,writable:!0,enumerable:a.enumerableKind,value:n[d]});for(let d of Object.keys(s))Object.defineProperty(l,d,{configurable:!0,enumerable:!0,writable:!0,value:s[d]});return Mo(l)}function xe(t,n){return Be(t)&&Y(t,"~kind")&&F(t["~kind"],n)}function ln(t){return Be(t)}function Ee(t,n,s){return Et({"~kind":"Deferred"},{type:"deferred",action:t,parameters:n,options:s},{})}function _o(t){return xe(t,"Deferred")}function XN(t){return pt(t,{"~readonly":!0},{})}function Ul(t,n){return pt(XN(t),{},n)}function bb(t,n,s,a){let l=te(t,n,s);return Ul(l,a)}function YN(t){return pt(t,{"~optional":!0},{})}function Bl(t,n){return pt(YN(t),{},n)}function Cb(t,n,s,a){let l=te(t,n,s);return Bl(l,a)}function x(t,n){return Et({"~kind":"Array"},{type:"array",items:t},n)}function lt(t){return xe(t,"Array")}function Sa(t){return ui(t,["~kind","type","items"])}function Oo(t,n,s={}){return Et({"~kind":"Constructor"},{type:"constructor",parameters:t,instanceType:n},s)}function hn(t){return xe(t,"Constructor")}function Eb(t){return ui(t,["~kind","type","parameters","instanceType"])}function $o(t,n,s={}){return Et({["~kind"]:"Function"},{type:"function",parameters:t,returnType:n},s)}function gn(t){return xe(t,"Function")}function vb(t){return ui(t,["~kind","type","parameters","returnType"])}function Xn(t,n){return Et({["~kind"]:"Ref"},{$ref:t},n)}function Ct(t){return xe(t,"Ref")}function Kd(t,n){return Et({"~kind":"Generic"},{type:"generic",parameters:t,expression:n})}function Gl(t){return xe(t,"Generic")}function Vd(t){return Et({["~kind"]:"Any"},{},t)}function en(t){return xe(t,"Any")}var kb="(?!)";function At(t){return Et({"~kind":"Never"},{not:{}},t)}function Fr(t){return xe(t,"Never")}function Es(t,n={}){return Bl(t,n)}function Ut(t){return Es(t)}function An(t){return ln(t)&&Y(t,"~optional")}function Tb(t){return pe(t).filter((n)=>!An(t[n]))}function Wd(t){return pe(t)}function Xd(t){return oh(t)}function r(t,n={}){let s=Tb(t),a=s.length>0?{required:s}:{};return Et({"~kind":"Object"},{type:"object",...a,properties:t},n)}function Re(t){return xe(t,"Object")}function wb(t){return ui(t,["~kind","type","properties","required"])}function ci(t){return Et({["~kind"]:"Unknown"},{},t)}function yn(t){return xe(t,"Unknown")}function no(t,n,s){let a=pe(t).reduce((l,d)=>({...l,[d]:pt(t[d],{},{$id:d})}),{});return Et({["~kind"]:"Cyclic"},{$defs:a,$ref:n},s)}function _t(t){return xe(t,"Cyclic")}function ch(t){return eo(t)&&Y(t,"~unsafe")&&Or(t["~unsafe"])}function dr(t,n){return n[t.length]?.(...t)??(()=>{throw Error("Invalid Arguments")})()}function xn(t){return xe(t,"Infer")}function Yd(t,n,s,a={}){return Et({"~kind":"Dependent"},{if:t,then:n,else:s},a)}function un(t){return xe(t,"Dependent")}function Rb(t){return ui(t,["~kind","if","then","else"])}function In(t){return xe(t,"Enum")}function Cr(t,n={}){return Et({"~kind":"Intersect"},{allOf:t},n)}function we(t){return xe(t,"Intersect")}function Lb(t){return ui(t,["~kind","allOf"])}var dh=void 0;function JN(){try{return Pb("null")(),!0}catch{return!1}}function Ab(){if(bt(dh))dh=JN();return dh&&Jr().useAcceleration}function Pb(...t){return new globalThis.Function(...t)}var vs={};De(vs,{Hash:()=>fh,HashCode:()=>Db});function cn(){throw Error("Unreachable")}function QN(t){let n=new Set,s=t;while(s&&s!==Object.prototype){for(let a of Reflect.ownKeys(s))if(a!=="constructor"&&typeof a!=="symbol")n.add(a);s=Object.getPrototypeOf(s)}return[...n]}function ZN(t){return typeof t==="number"}var or;(function(t){t[t.Array=0]="Array",t[t.BigInt=1]="BigInt",t[t.Boolean=2]="Boolean",t[t.Date=3]="Date",t[t.Constructor=4]="Constructor",t[t.Function=5]="Function",t[t.Null=6]="Null",t[t.Number=7]="Number",t[t.Object=8]="Object",t[t.RegExp=9]="RegExp",t[t.String=10]="String",t[t.Symbol=11]="Symbol",t[t.TypeArray=12]="TypeArray",t[t.Undefined=13]="Undefined"})(or||(or={}));var ba=BigInt("14695981039346656037"),[eD,tD]=[BigInt("1099511628211"),BigInt("18446744073709551616")],nD=Array.from({length:256}).map((t,n)=>BigInt(n)),$b=new Float64Array(1),Fb=new DataView($b.buffer),Nb=new Uint8Array($b.buffer);function Hn(t){ba=ba^nD[t],ba=ba*eD%tD}function rD(t){Hn(or.Array);for(let n of t)Fo(n)}function iD(t){Hn(or.BigInt),Fb.setBigInt64(0,t);for(let n of Nb)Hn(n)}function _b(t){Hn(or.Boolean),Hn(t?1:0)}function oD(t){Hn(or.Constructor),Fo(t.toString())}function sD(t){Hn(or.Date),Fo(t.getTime())}function aD(t){Hn(or.Function),Fo(t.toString())}function lD(t){Hn(or.Null)}function Ob(t){Hn(or.Number),Fb.setFloat64(0,t,!0);for(let n of Nb)Hn(n)}function uD(t){Hn(or.Object);for(let n of QN(t).sort())Fo(n),Fo(t[n])}function cD(t){Hn(or.RegExp),mh(t.toString())}var dD=new TextEncoder;function mh(t){Hn(or.String);for(let n of dD.encode(t))Hn(n)}function mD(t){Hn(or.Symbol),Fo(t.toString())}function fD(t){Hn(or.TypeArray);let n=new Uint8Array(t.buffer);for(let s=0;s<n.length;s++)Hn(n[s])}function pD(t){return Hn(or.Undefined)}function Fo(t){return xb(t)?fD(t):_N(t)?sD(t):Ib(t)?cD(t):AN(t)?_b(t.valueOf()):MN(t)?mh(t.valueOf()):PN(t)?Ob(t.valueOf()):ZN(t)?Ob(t):Te(t)?rD(t):wn(t)?_b(t):Zt(t)?iD(t):th(t)?oD(t):Or(t)?lD(t):Be(t)?uD(t):ct(t)?mh(t):nh(t)?mD(t):bt(t)?pD(t):Ao(t)?aD(t):cn()}function Db(t){return ba=BigInt("14695981039346656037"),Fo(t),ba}function fh(t){return Db(t).toString(16).padStart(16,"0")}function Hb(t){switch(t.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${t.params.dependencies.join(", ")} when property ${t.params.property} is present`;case"dependentRequired":return`must have properties ${t.params.dependencies.join(", ")} when property ${t.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${t.params.comparison} ${t.params.limit}`;case"exclusiveMinimum":return`must be ${t.params.comparison} ${t.params.limit}`;case"format":return`must match format "${t.params.format}"`;case"if":return`must match "${t.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${t.params.limit} items`;case"maxLength":return`must not have more than ${t.params.limit} characters`;case"maxProperties":return`must not have more than ${t.params.limit} properties`;case"maximum":return`must be ${t.params.comparison} ${t.params.limit}`;case"minItems":return`must not have fewer than ${t.params.limit} items`;case"minLength":return`must not have fewer than ${t.params.limit} characters`;case"minProperties":return`must not have fewer than ${t.params.limit} properties`;case"minimum":return`must be ${t.params.comparison} ${t.params.limit}`;case"multipleOf":return`must be multiple of ${t.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${t.params.pattern}"`;case"propertyNames":return`property names ${t.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${t.params.requiredProperties.join(", ")}`;case"type":return typeof t.params.type==="string"?`must be ${t.params.type}`:`must be either ${t.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return t.params.message;default:return"an unknown validation error occurred"}}var hD=Hb;function Ub(){return hD}function Nr(t){return ln(t)&&Y(t,"~codec")&&Be(t["~codec"])&&Y(t["~codec"],"encode")&&Y(t["~codec"],"decode")}function Ca(t){return ln(t)&&Y(t,"~immutable")}function Ea(t,n={}){return Ul(t,n)}function va(t){return ln(t)&&Y(t,"~readonly")}var Gb="-?(?:0|[1-9][0-9]*)n";function ph(t){return Et({"~kind":"BigInt"},{type:"bigint"},t)}function Dr(t){return xe(t,"BigInt")}function We(t){return Et({"~kind":"Boolean"},{type:"boolean"},t)}function mr(t){return xe(t,"Boolean")}var Jd="-?(?:0|[1-9][0-9]*)";function jl(t){return Et({"~kind":"Integer"},{type:"integer"},t)}function zn(t){return xe(t,"Integer")}class zb extends Error{constructor(t){super("Invalid Literal value");Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}}function yD(t){return Zt(t)?"bigint":wn(t)?"boolean":ft(t)?"number":ct(t)?"string":(()=>{throw new zb(t)})()}function o(t,n){return Et({"~kind":"Literal"},{type:yD(t),const:t},n)}function hh(t){return Zt(t)||wn(t)||ft(t)||ct(t)}function jb(t){return Ye(t)&&Zt(t.const)}function qb(t){return Ye(t)&&wn(t.const)}function Qd(t){return Ye(t)&&ft(t.const)}function Zd(t){return Ye(t)&&ct(t.const)}function Ye(t){return xe(t,"Literal")}function he(t){return Et({"~kind":"Null"},{type:"null"},t)}function ro(t){return xe(t,"Null")}var em="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function y(t){return Et({"~kind":"Number"},{type:"number"},t)}function tn(t){return xe(t,"Number")}function tm(t){return Et({"~kind":"Symbol"},{type:"symbol"},t)}function No(t){return xe(t,"Symbol")}var nm=".*";function c(t){return Et({"~kind":"String"},{type:"string"},t)}function Pn(t){return xe(t,"String")}function i(t,n={}){return Et({"~kind":"Union"},{anyOf:t},n)}function se(t){return xe(t,"Union")}function Kb(t){return ui(t,["~kind","anyOf"])}function ql(t){let n=Vb(t);return F(n.length,2)?n[0]:[]}function xD(t){return!0}function Wb(t){return Qe(t,(n,s)=>ID(n)?Wb(s):!1,()=>!0)}function Xb(t){return F(t.length,0)?!1:Wb(t)}function ID(t){return se(t)?Xb(t.anyOf):Ye(t)?xD(t.const):!1}function rm(t){return Xb(t)}function im(t){return Et({["~kind"]:"TemplateLiteral"},{type:"string",pattern:t},{})}function Yb(t,n,s=[]){return Qe(t,(a,l)=>Yb(l,n,[...s,`${a}${n}`]),()=>s)}function SD(t,n){return F(t.length,0)?[`${n}`]:Yb(t,n)}function Jb(t,n,s=[]){return Qe(n,(a,l)=>Jb(t,l,[...s,...Qb(t,a)]),()=>s)}function Qb(t,n){return se(n)?Jb(t,n.anyOf):Ye(n)?SD(t,n.const):cn()}function Zb(t,n){return Qe(n,(s,a)=>Zb(Qb(t,s),a),()=>t)}function bD(t){return t.map((n)=>o(n))}function CD(t){let n=Zb([],t),s=bD(n);return i(s)}function ED(t){return F(t.length,0)?cn():F(t.length,1)&&Ye(t[0])?t[0]:CD(t)}function gh(t){let n=ql(t);return F(n.length,0)?c():rm(n)?ED(n):im(t)}function Kl(t){let n=gh(t);return Ft(n)?c():n}function fr(t,n){let a={[t]:n};return Et({["~kind"]:"Record"},{type:"object",patternProperties:a})}function eC(t){return fr(Do,t)}function tC(t){return r({true:t,false:t})}function Sn(t,n={}){let[s,a,l]=[t,t.length,!1];return Et({["~kind"]:"Tuple"},{type:"array",additionalItems:l,items:s,minItems:a},n)}function Ve(t){return xe(t,"Tuple")}function nC(t){return ui(t,["~kind","type","items","minItems","additionalItems"])}function vD(t){return ui(t,["~readonly"])}function yh(t,n){return pt(vD(t),{},n)}function rC(t,n,s,a){let l=te(t,n,s);return yh(l,a)}function iC(t,n={}){return yh(t,n)}function kD(t){return ui(t,["~optional"])}function xh(t,n){return pt(kD(t),{},n)}function oC(t,n,s,a){let l=te(t,n,s);return xh(l,a)}function om(t,n={}){return xh(t,n)}function Ih(t){return t.reduceRight((s,a,l)=>({[l]:a,...s}),{})}function sC(t){let n=Ih(t.items);return r(n)}function Sh(t){return Re(t)||Ve(t)}function TD(t,n){return va(t)?va(n)?!0:!1:!1}function wD(t,n){return An(t)?An(n)?!0:!1:!1}function RD(t,n){let s=TD(t,n),a=wD(t,n),l=Wt([t,n]),d=iC(om(l));return s&&a?Ea(Es(d)):s&&!a?Ea(d):!s&&a?Es(d):d}function LD(t,n,s){return s in t?s in n?RD(t[s],n[s]):t[s]:(s in n)?n[s]:At()}function AD(t,n){return[...new Set([...pe(t),...pe(n)])].reduce((l,d)=>({...l,[d]:LD(t,n,d)}),{})}function aC(t){return Re(t)?t.properties:Ve(t)?Ih(t.items):{}}function lC(t,n){let s=aC(t),a=aC(n),l=AD(s,a);return r(l)}function PD(t,n){let s=ka(t,n);return F(s,Wl)?t:F(s,Xl)?n:F(s,Vl)?n:At()}function MD(t,n){let s=Sh(t),a=Sh(n);return s&&a?lC(t,n):s&&!a?t:!s&&a?n:PD(t,n)}function uC(t,n){return Fr(t)?t:en(t)?t:yn(t)?n:Fr(n)?n:en(n)?n:yn(n)?t:MD(t,n)}function _D(t,n){return se(t)||se(n)}function OD(t,n){let s=Qr(t),a=Qr(n);return _D(s,a)?Wt([s,a]):uC(s,a)}function cC(t,n,s=[]){return Qe(n,(a,l)=>cC(t,l,[...s,OD(a,t)]),()=>F(s.length,0)?[t]:s)}function dC(t,n,s=[]){return Qe(t,(a,l)=>dC(l,n,[...s,...Yl([a],n)]),()=>s)}function Yl(t,n=[]){return Qe(t,(s,a)=>se(s)?Yl(a,dC(s.anyOf,n)):Yl(a,cC(s,n)),()=>n)}function $D(t,n){let s=Yn({},t,n);return Er(s)?[]:[t]}function mC(t,n,s=[]){return Qe(t,(a,l)=>mC(l,n,[...s,...$D(a,n)]),()=>s)}function sm(t,n){let s=Qr(t),a=se(s)?s.anyOf:[s],l=mC(a,n);return pr(l)}function di(t,n,s){let a=Wt([t,n]),l=sm(s,t);return pr([a,l])}function sr(t,n=[]){return Qe(t,(s,a)=>sr(a,[...n,o(s)]),()=>pr(n))}function Wt(t){let n=Yl(t),s=bh(n);return pr(s)}function Jn(t){let n=Kl(t);return Qr(n)}function pr(t){let n=bh(t);return Ho(n)}function Qr(t){return un(t)?di(t.if,t.then,t.else):In(t)?sr(t.enum):we(t)?Wt(t.allOf):Ft(t)?Jn(t.pattern):se(t)?pr(t.anyOf):t}function Ho(t){return F(t.length,1)?t[0]:F(t.length,0)?At():i(t)}function fC(t,n){let s=sr(t);return Uo(s,n)}function pC(t,n){return fr(Ta,n)}function hC(t,n){let s=Wt(t);return Uo(s,n)}function gC(t,n){return ct(t)||ft(t)?r({[t]:n}):F(t,!1)?r({false:n}):F(t,!0)?r({true:n}):r({})}function yC(t,n){return fr(am,n)}function xC(t,n){return Y(t,"pattern")&&(ct(t.pattern)||t.pattern instanceof RegExp)?fr(t.pattern.toString(),n):fr(Do,n)}function IC(t,n){let s=ql(t);return rm(s)?Uo(Jn(t),n):fr(t,n)}function FD(t){return se(t)?ks(t.anyOf):[t]}function ks(t,n=[]){return Qe(t,(s,a)=>ks(a,[...n,...FD(s)]),()=>n)}function ND(t){return t.some((n)=>Pn(n)||tn(n)||zn(n))}function DD(t,n){return F(ND(t),!0)?fr(Do,n):void 0}function HD(t,n){return t.reduce((s,a)=>Ye(a)&&(ct(a.const)||ft(a.const))?{...s,[a.const]:n}:s,{})}function UD(t,n){let s=HD(t,n);return r(s)}function SC(t,n){let s=ks(t),a=DD(s,n);return ln(a)?a:UD(s,n)}function Uo(t,n){return en(t)?eC(n):mr(t)?tC(n):In(t)?fC(t.enum,n):zn(t)?pC(t,n):we(t)?hC(t.allOf,n):Ye(t)?gC(t.const,n):tn(t)?yC(t,n):se(t)?SC(t.anyOf,n):Pn(t)?xC(t,n):Ft(t)?IC(t.pattern,n):r({})}function Ch(t,n,s){return je([t])?pt(Uo(t,n),{},s):Eh(t,n,s)}function bC(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return Ch(d,f,l)}var Ta=`^${Jd}$`,am=`^${em}$`,Do=`^${nm}$`;function Eh(t,n,s={}){return Ee("Record",[t,n],s)}function Jl(t,n,s={}){return Ch(t,n,s)}function CC(t,n){return fr(t,n)}function lm(t){return F(t,Do)?c():F(t,Ta)?jl():F(t,am)?y():gh(t)}function Un(t){return pe(t.patternProperties)[0]}function Ts(t){let n=Un(t);return lm(n)}function zt(t){return t.patternProperties[Un(t)]}function vt(t){return xe(t,"Record")}function um(t){return Et({"~kind":"Rest"},{type:"rest",items:t},{})}function ws(t){return xe(t,"Rest")}function vh(t){return xe(t,"This")}function cm(t){return Et({"~kind":"Undefined"},{type:"undefined"},t)}function Ai(t){return xe(t,"Undefined")}function Hr(t){return xe(t,"Void")}function EC(t){return ph()}function vC(t){return c()}function kC(t){return y()}function TC(t){return jl()}function wC(t){return At()}function RC(t){return o(t)}function LC(t){return t}function AC(t){return i(t[1])}function PC(t){return t.length===3?[...t[0],...t[2]]:t.length===1?[...t[0]]:[]}function MC(t){return[t[0],...t[1]]}function _C(t){return t}function OC(t){return t[1]}function mm(t){return F(t.length,2)}function vr(t,n,s){return mm(t)?n(t[0],t[1]):s()}function XD(t,n){return F(n.indexOf(t),0)?[t,n.slice(t.length)]:[]}function Pi(t,n){for(let s=0;s<t.length;s++){let a=XD(t[s],n);if(mm(a))return a}return[]}function Wh(t,n){return Array.from({length:n-t+1},(s,a)=>String.fromCharCode(t+a))}var $C=[...Wh(97,122),...Wh(65,90)],FC="0",NC=Wh(49,57),wa=[FC,...NC],DC=" ",Ql=`
|
|
310
|
-
`;var Ra="_";var HC="$";var UC="//",BC="/*",JD="*/";function GC(t){let n=t.indexOf(JD);return F(n,-1)?"":t.slice(n+2)}function zC(t){let n=t.indexOf(Ql);return F(n,-1)?"":t.slice(n)}function QD(t){return t.replace(/^[ \t\r\f\v]+/,"")}function fm(t){let n=QD(t);return n.startsWith(BC)?fm(GC(n.slice(2))):n.startsWith(UC)?fm(zC(n.slice(2))):n}function mi(t){let n=t.trimStart();return n.startsWith(BC)?mi(GC(n.slice(2))):n.startsWith(UC)?mi(zC(n.slice(2))):n}var Jse=[...wa,Ra];function Xh(t,n){return Pi([t],n)}function fi(t,n){return F(t,"")?["",n]:t.startsWith(Ql)?Xh(t,fm(n)):t.startsWith(DC)?Xh(t,n):Xh(t,mi(n))}var rH=[...$C,Ra,HC];var vae=[...rH,...wa];var $ae=[...wa,Ra];function iH(t){return F(t,"")?[]:[t.slice(0,1),t.slice(1)]}function jC(t,n){return Qe(t,(s,a)=>n.startsWith(s)?!0:jC(a,n),()=>!1)}function Zl(t,n,s=""){return vr(iH(n),(a,l)=>jC(t,n)?[s,n]:Zl(t,l,`${s}${a}`),()=>[])}function qC(t,n){return vr(Zl(t,n),(s,a)=>F(s,"")?[]:[s,a],()=>[])}var ht=(t,n,s=()=>[])=>t.length===2?n(t):s();var sH=(t)=>ht(fi("-?(?:0|[1-9][0-9]*)n",t),([n,s])=>[EC(n),s]),aH=(t)=>ht(fi(".*",t),([n,s])=>[vC(n),s]),lH=(t)=>ht(fi("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",t),([n,s])=>[kC(n),s]),uH=(t)=>ht(fi("-?(?:0|[1-9][0-9]*)",t),([n,s])=>[TC(n),s]),cH=(t)=>ht(fi("(?!)",t),([n,s])=>[wC(n),s]),dH=(t)=>ht(qC(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],t),([n,s])=>[RC(n),s]),mH=(t)=>ht(ht(sH(t),([n,s])=>[n,s],()=>ht(aH(t),([n,s])=>[n,s],()=>ht(lH(t),([n,s])=>[n,s],()=>ht(uH(t),([n,s])=>[n,s],()=>ht(cH(t),([n,s])=>[n,s],()=>ht(fH(t),([n,s])=>[n,s],()=>ht(dH(t),([n,s])=>[n,s],()=>[]))))))),([n,s])=>[LC(n),s]),fH=(t)=>ht(ht(fi("(",t),([n,s])=>ht(Jh(s),([a,l])=>ht(fi(")",l),([d,f])=>[[n,a,d],f]))),([n,s])=>[AC(n),s]),KC=(t)=>ht(ht(ht(Yh(t),([n,s])=>ht(fi("|",s),([a,l])=>ht(KC(l),([d,f])=>[[n,a,d],f]))),([n,s])=>[n,s],()=>ht(ht(Yh(t),([n,s])=>[[n],s]),([n,s])=>[n,s],()=>ht([[],t],([n,s])=>[n,s],()=>[]))),([n,s])=>[PC(n),s]),Yh=(t)=>ht(ht(mH(t),([n,s])=>ht(Jh(s),([a,l])=>[[n,a],l])),([n,s])=>[MC(n),s]),Jh=(t)=>ht(ht(KC(t),([n,s])=>[n,s],()=>ht(Yh(t),([n,s])=>[n,s],()=>[])),([n,s])=>[_C(n),s]),Vb=(t)=>ht(ht(fi("^",t),([n,s])=>ht(Jh(s),([a,l])=>ht(fi("$",l),([d,f])=>[[n,a,d],f]))),([n,s])=>[OC(n),s]);function hH(t){return t.join("|")}function gH(t){return t.slice(1,t.length-1)}function yH(t,n,s){return Bo(n,`${s}${t}`)}function xH(t,n){return Bo(t,`${n}${Gb}`)}function IH(t,n){return Bo(t,`${n}${Jd}`)}function SH(t,n){return Bo(t,`${n}${em}`)}function bH(t,n){return eu(i([o("false"),o("true")]),t,n)}function CH(t,n){return Bo(t,`${n}${nm}`)}function EH(t,n,s){return Bo(n,`${s}${gH(t)}`)}function vH(t,n,s){let a=pm(t,{});return eu(a,n,s)}function kH(t,n,s){let a=sr(t);return eu(a,n,s)}function VC(t,n,s,a=[]){return Qe(t,(l,d)=>VC(d,n,s,[...a,eu(l,[],"")]),()=>Bo(n,`${s}(${hH(a)})`))}function eu(t,n,s){return In(t)?kH(t.enum,n,s):zn(t)?IH(n,s):Ye(t)?yH(t.const,n,s):Dr(t)?xH(n,s):mr(t)?bH(n,s):tn(t)?SH(n,s):Pn(t)?CH(n,s):Ft(t)?EH(t.pattern,n,s):XC(t)?vH(t.parameters[0],n,s):se(t)?VC(t.anyOf,n,s):kb}function Bo(t,n){return Qe(t,(s,a)=>eu(s,a,n),()=>n)}function TH(t){return`^${Bo(t,"")}$`}function WC(t){let n=TH(t);return im(n)}function pm(t,n){return je(t)?pt(WC(t),{},n):kh(t,n)}function YC(t,n,s,a){let l=Ur(t,n,s);return pm(l,a)}function kh(t,n={}){return Ee("TemplateLiteral",[t],n)}function XC(t){return ln(t)&&Y(t,"action")&&F(t.action,"TemplateLiteral")}function Ft(t){return xe(t,"TemplateLiteral")}function JC(t){return Et({["~kind"]:"ExtendsUnion"},{inferred:t})}function QC(t){return Be(t)&&Y(t,"~kind")&&Y(t,"inferred")&&F(t["~kind"],"ExtendsUnion")&&Be(t.inferred)}function de(t){return Et({["~kind"]:"ExtendsTrue"},{inferred:t})}function ZC(t){return Be(t)&&Y(t,"~kind")&&Y(t,"inferred")&&F(t["~kind"],"ExtendsTrue")&&Be(t.inferred)}function Fe(){return Et({["~kind"]:"ExtendsFalse"},{})}function eE(t){return Be(t)&&Y(t,"~kind")&&F(t["~kind"],"ExtendsFalse")}function Er(t){return QC(t)||ZC(t)}function Xt(t,n,s){return Er(t)?n(t.inferred):s()}function wH(t,n,s,a){return Xt(dt(t,s,a),(l)=>de(ir(ir(t,l),{[n]:s})),()=>Fe())}function RH(t,n){return de(t)}function LH(t,n,s,a,l){return Xt(dt(t,n,s),(d)=>Xt(dt(d,n,a),(f)=>de(f),()=>Fe()),()=>Xt(dt(t,n,l),(d)=>de(d),()=>Fe()))}function AH(t,n,s){let a=sr(s);return dt(t,n,a)}function tE(t,n,s){return Qe(s,(a,l)=>Xt(dt(t,n,a),(d)=>tE(d,n,l),()=>Fe()),()=>de(t))}function PH(t,n,s){let a=Jn(s);return dt(t,n,a)}function nE(t,n,s){return Qe(s,(a,l)=>Xt(dt(t,n,a),(d)=>de(d),()=>nE(t,n,l)),()=>Fe())}function xt(t,n,s){return en(s)?RH(t,n):un(s)?LH(t,n,s.if,s.then,s.else):In(s)?AH(t,n,s.enum):xn(s)?wH(t,s.name,n,s.extends):we(s)?tE(t,n,s.allOf):Ft(s)?PH(t,n,s.pattern):se(s)?nE(t,n,s.anyOf):yn(s)?de(t):Fe()}function rE(t,n,s){return xn(s)?xt(t,n,s):en(s)?de(t):yn(s)?de(t):JC(t)}function MH(t,n){let s=Ca(t),a=Ca(n);return s&&a?!0:!s&&a?!0:s&&!a?!1:!0}function iE(t,n,s,a){return lt(a)?MH(n,a)?dt(t,s,a.items):Fe():xt(t,n,a)}function oE(t,n,s){return Dr(s)?de(t):xt(t,n,s)}function sE(t,n,s){return mr(s)?de(t):xt(t,n,s)}function _H(t,n,s,a,l){let d=xn(a)?n:a,f=xn(a)?a:n,h=An(n),g=An(a);return!h&&g?Fe():Xt(dt(t,d,f),(I)=>tu(I,s,l),()=>Fe())}function OH(t,n,s,a){return Qe(a,(l,d)=>_H(t,n,s,l,d),()=>An(n)?de(t):Fe())}function $H(t,n,s){return Qe(n,(a,l)=>OH(t,a,l,s),()=>de(t))}function tu(t,n,s){return $H(t,n,s)}function hm(t,n,s){return Hr(s)?de(t):dt(t,n,s)}function aE(t,n,s,a){return en(a)?de(t):yn(a)?de(t):hn(a)?Xt(tu(t,n,a.parameters),(l)=>hm(l,s,a.instanceType),()=>Fe()):Fe()}function lE(t,n,s,a,l){return Xt(dt(t,n,l),()=>dt(t,s,l),()=>dt(t,a,l))}function uE(t,n,s){let a=sr(n);return dt(t,a,s)}function cE(t,n,s,a){return en(a)?de(t):yn(a)?de(t):gn(a)?Xt(tu(t,n,a.parameters),(l)=>hm(l,s,a.returnType),()=>Fe()):Fe()}function dE(t,n,s){return zn(s)?de(t):tn(s)?de(t):xt(t,n,s)}function mE(t,n,s){let a=Wt(n);return dt(t,a,s)}function gm(t,n,s){return n===s?de(t):Fe()}function FH(t,n,s){return Ye(s)?gm(t,n,s.const):Dr(s)?de(t):xt(t,o(n),s)}function NH(t,n,s){return Ye(s)?gm(t,n,s.const):mr(s)?de(t):xt(t,o(n),s)}function DH(t,n,s){return Ye(s)?gm(t,n,s.const):tn(s)?de(t):xt(t,o(n),s)}function HH(t,n,s){return Ye(s)?gm(t,n,s.const):Pn(s)?de(t):xt(t,o(n),s)}function fE(t,n,s){return Zt(n.const)?FH(t,n.const,s):wn(n.const)?NH(t,n.const,s):ft(n.const)?DH(t,n.const,s):ct(n.const)?HH(t,n.const,s):cn()}function pE(t,n,s){return xn(s)?xt(t,n,s):de(t)}function hE(t,n,s){return ro(s)?de(t):xt(t,n,s)}function gE(t,n,s){return tn(s)?de(t):xt(t,n,s)}function UH(t,n,s){return An(n)?An(s)?de(t):Fe():de(t)}function BH(t,n,s){return xn(s)&&Fr(s.extends)?Fe():Xt(dt(t,n,s),(a)=>UH(a,n,s),()=>Fe())}function GH(t,n){return t.reduce((s,a)=>(a in n)?Er(n[a])?{...s,...n[a].inferred}:cn():cn(),{})}function zH(t,n,s){let a={};for(let f of pe(s))a[f]=f in n?BH({},n[f],s[f]):An(s[f])?xn(s[f])?de(ir(t,{[s[f].name]:s[f].extends})):de(t):Fe();let l=oh(a).every((f)=>Er(f)),d=l?GH(pe(a),a):{};return l?de(d):Fe()}function jH(t,n,s){let a=zH(t,n,s);return Er(a)?de(ir(t,a.inferred)):Fe()}function qH(t,n,s){return jH(t,n,s)}function KH(t,n){return pe(n).reduce((s,a)=>({...s,[a]:Y(t,a)?se(s[a])?i([...s[a].anyOf,n[a]]):i([t[a],n[a]]):n[a]}),t)}function yE(t,n,s,a){return Qe(n,(l,d)=>Xt(dt({},t[l],s),(f)=>yE(t,d,s,KH(a,f)),()=>Fe()),()=>de(a))}function VH(t,n,s,a){let l=pe(n);return yE(n,l,a,t)}function xE(t,n,s){return vt(s)?VH(t,n,Un(s),zt(s)):Re(s)?qH(t,n,s.properties):xt(t,r(n),s)}function WH(t,n){return F(pe(n).length,0)?de(t):Fe()}function XH(t,n,s,a,l){return dt(t,s,l)}function IE(t,n,s,a){return vt(a)?XH(t,lm(n),s,lm(Un(a)),zt(a)):Re(a)?WH(t,a.properties):en(a)?de(t):yn(a)?de(t):Fe()}function SE(t,n,s){return Pn(s)?de(t):xt(t,n,s)}function bE(t,n,s){return No(s)?de(t):xt(t,n,s)}function CE(t,n,s){let a=Jn(n);return dt(t,a,s)}function Qh(t,n){return Et({"~kind":"Inferrable"},{name:t,type:n},{})}function nu(t){return Be(t)&&Y(t,"~kind")&&Y(t,"name")&&Y(t,"type")&&F(t["~kind"],"Inferrable")&&ct(t.name)&&Be(t.type)}function Zh(t){return ws(t)?xn(t.items)?lt(t.items.extends)?Qh(t.items.name,t.items.extends.items):yn(t.items.extends)?Qh(t.items.name,t.items.extends):void 0:cn():void 0}function ym(t){return xn(t)?Qh(t.name,t.extends):void 0}function eg(t,n,s=[]){return Qe(t,(a,l)=>Xt(dt({},a,n),()=>eg(l,n,[...s,a]),()=>{return}),()=>s)}function EE(t,n,s,a){let l=eg(s,a);return Te(l)?de(ir(t,{[n]:Sn(l)})):Fe()}function xm(t,n,s,a){let l=eg(s,a);return Te(l)?de(ir(t,{[n]:i(l)})):Fe()}function YH(t){return[...t].reverse()}function tg(t,n){return n?YH(t):t}function JH(t){let n=t.length>0?t[0]:void 0,s=ln(n)?Zh(n):void 0;return ln(s)}function QH(t,n,s,a,l,d){return Xt(dt(t,s,l),(f)=>vE(f,n,a,d),()=>Fe())}function ZH(t,n,s,a,l){let d=Zh(a);return nu(d)?EE(t,d.name,tg(s,n),d.type):Qe(s,(f,h)=>QH(t,n,f,h,a,l),()=>Fe())}function e2(t,n,s,a){return Qe(a,(l,d)=>ZH(t,n,s,l,d),()=>F(s.length,0)?de(t):Fe())}function vE(t,n,s,a){return e2(t,n,s,a)}function t2(t,n,s){let a=Go(t,dn([],[]),s),l=JH(a);return vE(t,l,tg(n,l),tg(a,l))}function kE(t,n,s){let a=ym(s);return nu(a)?xm(t,a.name,n,a.type):Qe(n,(l,d)=>Xt(dt(t,l,s),(f)=>kE(f,d,s),()=>Fe()),()=>de(t))}function TE(t,n,s){let a=Go(t,dn([],[]),n);return Ve(s)?t2(t,a,s.items):lt(s)?kE(t,a,s.items):xt(t,Sn(a),s)}function wE(t,n,s){return Hr(s)?de(t):Ai(s)?de(t):xt(t,n,s)}function RE(t,n,s){return Qe(s,(a,l)=>Xt(dt(t,n,a),(d)=>de(d),()=>RE(t,n,l)),()=>Fe())}function ng(t,n,s){return Qe(n,(a,l)=>Xt(RE(t,a,s),(d)=>ng(d,l,s),()=>Fe()),()=>de(t))}function LE(t,n,s){let a=ym(s);return nu(a)?xm(t,a.name,n,a.type):se(s)?ng(t,n,s.anyOf):ng(t,n,[s])}function AE(t,n,s){return xn(s)?xt(t,n,s):en(s)?de(t):yn(s)?de(t):Fe()}function PE(t,n,s){return Hr(s)?de(t):xt(t,n,s)}function dt(t,n,s){return en(n)?rE(t,n,s):lt(n)?iE(t,n,n.items,s):Dr(n)?oE(t,n,s):mr(n)?sE(t,n,s):hn(n)?aE(t,n.parameters,n.instanceType,s):un(n)?lE(t,n.if,n.then,n.else,s):In(n)?uE(t,n.enum,s):gn(n)?cE(t,n.parameters,n.returnType,s):zn(n)?dE(t,n,s):we(n)?mE(t,n.allOf,s):Ye(n)?fE(t,n,s):Fr(n)?pE(t,n,s):ro(n)?hE(t,n,s):tn(n)?gE(t,n,s):Re(n)?xE(t,n.properties,s):vt(n)?IE(t,Un(n),zt(n),s):Pn(n)?SE(t,n,s):No(n)?bE(t,n,s):Ft(n)?CE(t,n.pattern,s):Ve(n)?TE(t,n.items,s):Ai(n)?wE(t,n,s):se(n)?LE(t,n.anyOf,s):yn(n)?AE(t,n,s):Hr(n)?PE(t,n,s):Fe()}function n2(t,n){return Wt([...t,r(n)])}function ME(t,n,s){return je(t)?pt(n2(t,n),{},s):Th(t,n,s)}function _E(t,n,s,a,l){let d=Ur(t,n,s),f=ru(t,n,a);return ME(d,f,l)}function Th(t,n,s={}){return Ee("Interface",[t,n],s)}function La(t){return ln(t)&&Y(t,"action")&&F(t.action,"Interface")}function r2(t,n,s){return t.includes(s)?!0:iu([...t,s],n,n[s])}function OE(t,n,s){let a=Xd(s);return Rs(t,n,a)}function Rs(t,n,s){return Qe(s,(a,l)=>iu(t,n,a)?!0:Rs(t,n,l),()=>!1)}function iu(t,n,s){return Ct(s)?r2(t,n,s.$ref):lt(s)?iu(t,n,s.items):hn(s)?Rs(t,n,[...s.parameters,s.instanceType]):gn(s)?Rs(t,n,[...s.parameters,s.returnType]):La(s)?OE(t,n,s.parameters[1]):we(s)?Rs(t,n,s.allOf):Re(s)?OE(t,n,s.properties):se(s)?Rs(t,n,s.anyOf):Ve(s)?Rs(t,n,s.items):vt(s)?iu(t,n,zt(s)):!1}function $E(t,n,s){return iu(t,n,s)}function i2(t,n){return n.reduce((s,a)=>$E([a],t,t[a])?[...s,a]:s,[])}function FE(t){let n=Wd(t);return i2(t,n)}function o2(t,n,s){return s.includes(n)?s:(n in t)?ou(t,t[n],[...s,n]):cn()}function NE(t,n,s){let a=Xd(n);return Aa(t,a,s)}function Aa(t,n,s){return n.reduce((a,l)=>ou(t,l,a),s)}function ou(t,n,s){return Ct(n)?o2(t,n.$ref,s):lt(n)?ou(t,n.items,s):hn(n)?Aa(t,[...n.parameters,n.instanceType],s):gn(n)?Aa(t,[...n.parameters,n.returnType],s):La(n)?NE(t,n.parameters[1],s):we(n)?Aa(t,n.allOf,s):Re(n)?NE(t,n.properties,s):se(n)?Aa(t,n.anyOf,s):Ve(n)?Aa(t,n.items,s):vt(n)?ou(t,zt(n),s):s}function DE(t,n,s){return ou(t,s,[n])}function s2(t){return Vd()}function a2(t){return pe(t).reduce((n,s)=>({...n,[s]:Ls(t[s])}),{})}function su(t){return t.reduce((n,s)=>[...n,Ls(s)],[])}function Ls(t){return Ct(t)?s2(t.$ref):lt(t)?x(Ls(t.items),Sa(t)):hn(t)?Oo(su(t.parameters),Ls(t.instanceType)):gn(t)?$o(su(t.parameters),Ls(t.returnType)):we(t)?Cr(su(t.allOf)):Re(t)?r(a2(t.properties)):vt(t)?Jl(Ts(t),Ls(zt(t))):se(t)?i(su(t.anyOf)):Ve(t)?Sn(su(t.items)):t}function l2(t,n){return n in t?Ls(t[n]):ci()}function HE(t){return l2(t.$defs,t.$ref)}function u2(t,n,s){let a=Ur(t,dn([],[]),n),l=ru({},dn([],[]),s);return Wt([...a,r(l)])}function c2(t,n){return pe(t).filter((a)=>n.includes(a)).reduce((a,l)=>{let d=t[l],f=La(d)?u2(t,d.parameters[0],d.parameters[1]):d;return{...a,[l]:f}},{})}function UE(t,n,s){let a=DE(t,n,s),l=c2(t,a);return no(l,n)}function BE(t,n){return n in t?Ct(t[n])?BE(t,t[n].$ref):t[n]:At()}function Mi(t,n){return BE(t,n)}function GE(t){return _t(t)?HE(t):ch(t)?ci():t}function Yn(t,n,s){let a=GE(n),l=GE(s);return dt(t,a,l)}var Vl=0,au=1,Wl=2,Xl=3;function ka(t,n){let s=[Yn({},t,n),Yn({},n,t)];return Er(s[0])&&Er(s[1])?Vl:Er(s[0])&&eE(s[1])?Wl:eE(s[0])&&Er(s[1])?Xl:au}function rg(t,n,s=[],a=n){return Qe(n,(l,d)=>{let f=ka(t,l);return F(f,Wl)||F(f,Vl)?a:F(f,au)?rg(t,d,[...s,l],a):rg(t,d,s,a)},()=>[...s,t])}function d2(t,n,s){let a=Qr(t);return en(a)?[a]:yn(a)?[a]:Fr(a)?Im(n,s):Re(a)?Im(n,[...s,a]):Im(n,rg(a,s))}function Im(t,n=[]){return Qe(t,(s,a)=>d2(s,a,n),()=>n)}function bh(t){let n=Im(t);return ks(n)}function ig(t,n){return pt(Qr(t),{},n)}function zE(t,n,s,a){let l=te(t,n,s);return ig(l,a)}function lu(t,n=[]){return _o(t)&&F(t.action,"Conditional")?Ct(t.parameters[0])?lu(t.parameters[2],lu(t.parameters[3],[...n,t.parameters[0].$ref])):lu(t.parameters[2],lu(t.parameters[3],n)):_o(t)&&F(t.action,"Mapped")?_o(t.parameters[1])&&F(t.parameters[1].action,"KeyOf")&&Ct(t.parameters[1].parameters[0])?[...n,t.parameters[1].parameters[0].$ref]:n:n}function m2(t,n){return t.reduce((s,a)=>[...s,n.includes(a.name)],[])}function KE(t,n,s=[]){return Qe(t,(a,l)=>Qe(n,(d,f)=>KE(l,f,[...s,[d,a]]),()=>s),()=>s)}function f2(t){return Ft(t)?Jn(t.pattern):In(t)?sr(t.enum):t}function p2(t){let n=f2(t);return se(n)?[...n.anyOf]:[n]}function h2(t,n){return t.reduce((s,a)=>[...s,[...a,n]],[])}function jE(t,n){return n.reduce((s,a)=>[...s,...h2(t,a)],[])}function qE(t){return t.reduce((n,s)=>F(s[0],!0)?jE(n,p2(s[1])):jE(n,[s[1]]),[[]])}function VE(t,n,s){let a=lu(s),l=m2(t,a),d=KE(n,l);return _o(s)&&F(s.action,"Conditional")?qE(d):_o(s)&&F(s.action,"Mapped")?qE(d):[n]}function g2(){return["(not-resolvable)",At()]}function y2(){return["(not-generic)",At()]}function x2(t,n,s){return[t,Kd(n,s)]}function I2(t,n,s){return n in t?WE(t,n,t[n],s):g2()}function WE(t,n,s,a){return Gl(s)?x2(n,s.parameters,s.expression):Ct(s)?I2(t,s.$ref,a):y2()}function XE(t,n,s){return WE(t,"(anonymous)",n,s)}function S2(t,n,s){if(xn(n)||uu(n)||Er(Yn({},n,s)))return;let a={parameter:t,expect:s,actual:n};throw Error(`Argument for parameter ${t} does not satisfy constraint`,{cause:a})}function YE(t,n,s,a,l){let d=te(t,n,l);return S2(s,d,a),ir(t,{[s]:d})}function b2(t,n,s,a,l){let d=te(t,n,s.extends),f=te(t,n,s.equals);return Qe(l,(h,g)=>og(YE(t,n,s.name,d,h),n,a,g),()=>og(YE(t,n,s.name,d,f),n,a,[]))}function og(t,n,s,a){return Qe(s,(l,d)=>b2(t,n,l,d,a),()=>t)}function JE(t,n,s,a){return og(t,n,s,a)}var sg=0,ag=0;function C2(){if(Fl(ag,Jr().maxInstantiationCount))return;throw Error("Type instantiation is excessively deep and possibly infinite")}function E2(){C2(),ag++,sg++}function v2(){if(sg--,F(sg,0))ag=0}function k2(t){return ys(t.callstack.length,0)?t.callstack[t.callstack.length-1]:""}function T2(t,n){return F(k2(t),n)}function w2(t,n,s,a,l,d){E2();try{let f=JE(t,n,a,d),h=te(f,dn([...n.callstack,s.$ref],n.visited),l);return te(f,dn([],[]),h)}finally{v2()}}function R2(t,n,s,a,l,d){return d.reduce((f,h)=>{let g=w2(t,n,s,a,l,h);return[...f,g]},[])}function L2(t,n,s,a,l,d){let f=VE(a,d,l),h=R2(t,n,s,a,l,f);return F(h.length,1)?h[0]:pr(h)}function lg(t,n,s,a){let l=Ur(t,n,a),d=XE(t,s,a),f=d[0],h=d[1];return Gl(h)?T2(n,f)?dm(Xn(f),l):L2(t,n,Xn(f),h.parameters,h.expression,l):dm(s,l)}function dm(t,n){return Et({["~kind"]:"Call"},{type:"call",target:t,arguments:n},{})}function uu(t){return xe(t,"Call")}function A2(t){return ui(t,["~immutable"])}function QE(t,n){return pt(A2(t),{},n)}function ZE(t,n,s,a){let l=te(t,n,s);return QE(l,a)}function ev(t,n){return t(n)}function tv(t,n){return ct(n)?o(ev(t,n)):o(n)}function nv(t,n){let s=Jn(n);return io(t,s)}function rv(t,n){let s=n.map((a)=>io(t,a));return i(s)}function io(t,n){return Ye(n)?tv(t,n.const):Ft(n)?nv(t,n.pattern):se(n)?rv(t,n.anyOf):n}function wh(t,n={}){return Ee("Capitalize",[t],n)}function Rh(t,n={}){return Ee("Lowercase",[t],n)}function Lh(t,n={}){return Ee("Uncapitalize",[t],n)}function Ah(t,n={}){return Ee("Uppercase",[t],n)}var P2=(t)=>t[0].toUpperCase()+t.slice(1),M2=(t)=>t.toLowerCase(),_2=(t)=>t[0].toLowerCase()+t.slice(1),O2=(t)=>t.toUpperCase();function iv(t,n){return je([t])?pt(io(P2,t),{},n):wh(t,n)}function ov(t,n){return je([t])?pt(io(M2,t),{},n):Rh(t,n)}function sv(t,n){return je([t])?pt(io(_2,t),{},n):Lh(t,n)}function av(t,n){return je([t])?pt(io(O2,t),{},n):Ah(t,n)}function lv(t,n,s,a){let l=te(t,n,s);return iv(l,a)}function uv(t,n,s,a){let l=te(t,n,s);return ov(l,a)}function cv(t,n,s,a){let l=te(t,n,s);return sv(l,a)}function dv(t,n,s,a){let l=te(t,n,s);return av(l,a)}function Ph(t,n,s,a,l={}){return Ee("Conditional",[t,n,s,a],l)}function $2(t,n,s,a,l,d){let f=Yn(t,s,a);return QC(f)?i([te(f.inferred,n,l),te(t,n,d)]):ZC(f)?te(f.inferred,n,l):te(t,n,d)}function mv(t,n,s,a,l,d,f){return je([s,a])?pt($2(t,n,s,a,l,d),{},f):Ph(s,a,l,d,f)}function fv(t,n,s,a,l,d,f){let h=te(t,n,s),g=te(t,n,a);return mv(t,n,h,g,l,d,f)}function Mh(t,n={}){return Ee("ConstructorParameters",[t],n)}function F2(t){let n=hn(t)?t.parameters:[],s=Go({},dn([],[]),n);return Sn(s)}function pv(t,n){return je([t])?pt(F2(t),{},n):Mh(t,n)}function hv(t,n,s,a){let l=te(t,n,s);return pv(l,a)}function _h(t,n,s={}){return Ee("Exclude",[t,n],s)}function Sm(t,n,s){return je([t,n])?pt(sm(t,n),{},s):_h(t,n,s)}function gv(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return Sm(d,f,l)}function Oh(t,n,s={}){return Ee("Extract",[t,n],s)}function N2(t,n){let s=Yn({},t,n);return Er(s)?[t]:[]}function xv(t,n,s=[]){return Qe(t,(a,l)=>xv(l,n,[...s,...N2(a,n)]),()=>s)}function Iv(t,n){let s=Qr(t),a=se(s)?s.anyOf:[s],l=xv(a,n);return pr(l)}function yv(t,n,s){return je([t,n])?pt(Iv(t,n),{},s):Oh(t,n,s)}function Sv(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return yv(d,f,l)}function $h(t,n,s={}){return Ee("Index",[t,n],s)}function Ev(t,n){let s=Mi(t,n);return Br(s)}function vv(t,n,s){let a=di(t,n,s);return Br(a)}function D2(t,n){let s=pe(t).filter((b)=>!Y(n,b)),a=pe(n).filter((b)=>!Y(t,b)),l=pe(t).filter((b)=>Y(n,b)),d=s.reduce((b,v)=>({...b,[v]:t[v]}),{}),f=a.reduce((b,v)=>({...b,[v]:n[v]}),{}),h=l.reduce((b,v)=>({...b,[v]:Wt([t[v],n[v]])}),{}),g=ir(d,f);return ir(g,h)}function kv(t){return t.reduce((n,s)=>D2(n,Br(s)),{})}function Tv(t){return t}function wv(t){let n=sC(Sn(t));return Br(n)}function H2(t,n){return pe(t).filter((l)=>(l in n)).reduce((l,d)=>({...l,[d]:pr([t[d],n[d]])}),{})}function Rv(t,n){return Qe(t,(s,a)=>Rv(a,H2(n,Br(s))),()=>n)}function Lv(t){return Qe(t,(n,s)=>Rv(s,Br(n)),()=>cn())}function Br(t){return _t(t)?Ev(t.$defs,t.$ref):un(t)?vv(t.if,t.then,t.else):we(t)?kv(t.allOf):se(t)?Lv(t.anyOf):Ve(t)?wv(t.items):Re(t)?Tv(t.properties):{}}function Pa(t){let n=Br(t);return r(n)}var U2=new RegExp("^(?:0|[1-9][0-9]*)$");function Ma(t){let n=`${t}`;return U2.test(n)?parseInt(n):t}function B2(t){return o(Ma(t))}function Av(t){return t.map((n)=>Pv(n))}function Pv(t){return we(t)?Cr(Av(t.allOf)):se(t)?i(Av(t.anyOf)):Ye(t)?B2(t.const):t}function Mv(t,n){let s=Pv(n),a=Yn({},s,y());return Er(a)?t:Ye(n)&&F(n.const,"length")?y():At()}function _v(t,n){let s=Mi(t,n);return kr(s)}function Ov(t,n,s){let a=di(t,n,s);return kr(a)}function $v(t){let n=sr(t);return kr(n)}function Fv(t){let n=Wt(t);return kr(n)}function Nv(t){return[`${t}`]}function Dv(t){let n=Jn(t);return kr(n)}function Hv(t){return t.reduce((n,s)=>[...n,...kr(s)],[])}function kr(t){return _t(t)?_v(t.$defs,t.$ref):un(t)?Ov(t.if,t.then,t.else):In(t)?$v(t.enum):we(t)?Fv(t.allOf):Ye(t)?Nv(t.const):Ft(t)?Dv(t.pattern):se(t)?Hv(t.anyOf):[]}function _a(t){return kr(t)}function cu(t,n){return n.map((s)=>du(t,s))}function du(t,n){return lt(n)?x(du(t,n.items)):hn(n)?Oo(cu(t,n.parameters),du(t,n.instanceType)):gn(n)?$o(cu(t,n.parameters),du(t,n.returnType)):Ve(n)?Sn(cu(t,n.items)):se(n)?i(cu(t,n.anyOf)):we(n)?Cr(cu(t,n.allOf)):vh(n)?r(t):n}function Uv(t,n){return du(t,n)}function G2(t,n){let s=n in t?t[n]:At();return Uv(t,s)}function Bv(t,n){return n.reduce((s,a)=>[...s,G2(t,a)],[])}function z2(t,n){let s=_a(n),a=Bv(t,s);return pr(a)}var j2=new RegExp(Ta);function q2(t){return t.filter((s)=>j2.test(s))}function K2(t){let n=Wd(t),s=q2(n),a=Bv(t,s);return pr(a)}function Gv(t,n){return tn(n)?K2(t):z2(t,n)}function V2(t){return o(Ma(t))}function zv(t){return t.map((n)=>ug(n))}function ug(t){return we(t)?Cr(zv(t.allOf)):se(t)?i(zv(t.anyOf)):Ye(t)?V2(t.const):t}function W2(t,n){return t.reduceRight((s,a,l)=>{let d=Yn({},o(l),n);return Er(d)?[a,...s]:s},[])}function X2(t,n){let s=ug(n),a=W2(t,s);return Ho(a)}function Y2(t){return Ho(t)}function jv(t,n){return Ye(n)&&F(n.const,"length")?o(t.length):tn(n)||zn(n)?Y2(t):X2(t,n)}function qv(t,n){return lt(t)?Mv(t.items,n):Re(t)?Gv(t.properties,n):Ve(t)?jv(t.items,n):At()}function J2(t){return _t(t)||un(t)||we(t)||se(t)?Pa(t):t}function Cv(t,n,s){return je([t,n])?pt(qv(J2(t),n),{},s):$h(t,n,s)}function Kv(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return Cv(d,f,l)}function Fh(t,n={}){return Ee("InstanceType",[t],n)}function Q2(t){return hn(t)?t.instanceType:At()}function Vv(t,n){return je([t])?pt(Q2(t),{},n):Fh(t,n)}function Wv(t,n,s,a={}){let l=te(t,n,s);return Vv(l,a)}function Nh(t,n={}){return Ee("KeyOf",[t],n)}function Yv(){return i([y(),c(),tm()])}function Jv(t){return y()}function Z2(t){return t.reduce((s,a)=>hh(a)?[...s,o(Ma(a))]:cn(),[])}function Qv(t){let n=pe(t),s=Z2(n);return Ho(s)}function Zv(t){return Ts(t)}function ek(t){let n=t.map((s,a)=>o(a));return Ho(n)}function tk(t){return en(t)?Yv():lt(t)?Jv(t.items):Re(t)?Qv(t.properties):vt(t)?Zv(t):Ve(t)?ek(t.items):At()}function eU(t){return _t(t)||un(t)||we(t)||se(t)?Pa(t):t}function Xv(t,n){return je([t])?pt(tk(eU(t)),{},n):Nh(t,n)}function nk(t,n,s,a){let l=te(t,n,s);return Xv(l,a)}function Dh(t,n,s,a,l={}){return Ee("Mapped",[t,n,s,a],l)}function tU(t){let n=Jn(t);return bm(n)}function nU(t){return t.reduce((n,s)=>[...n,...bm(s)],[])}function rU(t){let n=sr(t);return bm(n)}function iU(t){return ft(t)?[o(`${t}`)]:[o(t)]}function bm(t){return In(t)?rU(t.enum):Ye(t)?iU(t.const):Ft(t)?tU(t.pattern):se(t)?nU(t.anyOf):[t]}function ik(t){return bm(t)}function oU(t){return Ft(t)?Jn(t.pattern):t}function sU(t,n,s,a,l,d){let f=ir(t,{[s.name]:a}),h=te(f,n,l),g=oU(h),I=te(f,n,d);return Qd(g)||Zd(g)?{[g.const]:I}:{}}function aU(t,n,s,a,l,d){return a.reduce((f,h)=>[...f,sU(t,n,s,h,l,d)],[])}function lU(t){return t.reduce((n,s)=>[...n,r(s)],[])}function ok(t,n,s,a,l,d){let f=ik(a),h=aU(t,n,s,f,l,d),g=lU(h);return Wt(g)}function rk(t,n,s,a,l,d,f){return je([a])?pt(ok(t,n,s,a,l,d),{},f):Dh(s,a,l,d,f)}function sk(t,n,s,a,l,d,f){let h=te(t,n,a);return rk(t,n,s,h,l,d,f)}function uU(t,n,s){let a=ir(t,n);return pe(n).filter((d)=>s.includes(d)).reduce((d,f)=>({...d,[f]:UE(a,f,n[f])}),{})}function cU(t,n,s){let a=ir(t,n);return pe(n).filter((d)=>!s.includes(d)).reduce((d,f)=>({...d,[f]:te(a,dn([],[]),n[f])}),{})}function dU(t,n,s){let a=FE(n),l=uU(t,n,a),d=cU(t,n,a),f={...l,...d};return pt(f,{},s)}function cg(t,n,s,a){return dU(t,s,a)}function Hh(t,n={}){return Ee("NonNullable",[t],n)}function mU(t){let n=i([he(),cm()]);return Sm(t,n,{})}function ak(t,n){return je([t])?pt(mU(t),{},n):Hh(t,n)}function lk(t,n,s,a){let l=te(t,n,s);return ak(l,a)}function Uh(t,n,s={}){return Ee("Omit",[t,n],s)}function Cm(t){let n=Pa(t);return Re(n)?n.properties:cn()}function fU(t,n){return pe(t).reduce((a,l)=>n.includes(l)?a:{...a,[l]:t[l]},{})}function ck(t,n){let s=Cm(t),a=_a(n),l=fU(s,a);return r(l)}function uk(t,n,s){return je([t,n])?pt(ck(t,n),{},s):Uh(t,n,s)}function dk(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return uk(d,f,l)}function Bh(t,n={}){return Ee("Parameters",[t],n)}function pU(t){let n=gn(t)?t.parameters:[],s=Go({},dn([],[]),n);return Sn(s)}function mk(t,n){return je([t])?pt(pU(t),{},n):Bh(t,n)}function fk(t,n,s,a){let l=te(t,n,s);return mk(l,a)}function Gh(t,n={}){return Ee("Partial",[t],n)}function hk(t,n){let s=Mi(t,n),a=_i(s);return no(ir(t,{[n]:a}),n)}function gk(t,n,s){let a=di(t,n,s);return _i(a)}function yk(t){let n=Wt(t);return _i(n)}function xk(t){let n=t.map((s)=>_i(s));return i(n)}function Ik(t){let n=pe(t).reduce((a,l)=>({...a,[l]:Es(t[l])}),{});return r(n)}function _i(t){return _t(t)?hk(t.$defs,t.$ref):un(t)?gk(t.if,t.then,t.else):we(t)?yk(t.allOf):se(t)?xk(t.anyOf):Re(t)?Ik(t.properties):r({})}function pk(t,n){return je([t])?pt(_i(t),{},n):Gh(t,n)}function Sk(t,n,s,a){let l=te(t,n,s);return pk(l,a)}function zh(t,n,s={}){return Ee("Pick",[t,n],s)}function hU(t,n){return pe(t).reduce((a,l)=>n.includes(l)?ir(a,{[l]:t[l]}):a,{})}function Ck(t,n){let s=Cm(t),a=_a(n),l=hU(s,a);return r(l)}function bk(t,n,s){return je([t,n])?pt(Ck(t,n),{},s):zh(t,n,s)}function Ek(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return bk(d,f,l)}function jh(t,n={}){return Ee("ReadonlyObject",[t],n)}function oe(t,n={}){return dg(t,n)}function vk(t){return zl(x(t))}function kk(t,n){let s=Mi(t,n),a=Oi(s);return no(ir(t,{[n]:a}),n)}function Tk(t,n,s){let a=di(t,n,s);return Oi(a)}function wk(t){let n=Wt(t);return Oi(n)}function Rk(t){let n=pe(t).reduce((a,l)=>({...a,[l]:Ea(t[l])}),{});return r(n)}function Lk(t){return zl(Sn(t))}function Ak(t){let n=t.map((s)=>Oi(s));return i(n)}function Oi(t){return lt(t)?vk(t.items):_t(t)?kk(t.$defs,t.$ref):un(t)?Tk(t.if,t.then,t.else):we(t)?wk(t.allOf):Re(t)?Rk(t.properties):Ve(t)?Lk(t.items):se(t)?Ak(t.anyOf):t}function dg(t,n){return je([t])?pt(Oi(t),{},n):jh(t)}function Pk(t,n,s,a){let l=te(t,n,s);return dg(l,a)}function Mk(t,n,s,a){return n.visited.includes(a)?s:(a in t)?te(t,dn(n.callstack,[...n.visited,a]),t[a]):s}function _k(t,n){let s=Mi(t,n),a=$i(s);return no(ir(t,{[n]:a}),n)}function Ok(t,n,s){let a=di(t,n,s);return $i(a)}function $k(t){let n=Wt(t);return $i(n)}function Fk(t){let n=t.map((s)=>$i(s));return i(n)}function Nk(t){let n=pe(t).reduce((a,l)=>({...a,[l]:om(t[l])}),{});return r(n)}function $i(t){return _t(t)?_k(t.$defs,t.$ref):un(t)?Ok(t.if,t.then,t.else):we(t)?$k(t.allOf):se(t)?Fk(t.anyOf):Re(t)?Nk(t.properties):r({})}function qh(t,n={}){return Ee("Required",[t],n)}function Dk(t,n){return je([t])?pt($i(t),{},n):qh(t,n)}function Hk(t,n,s,a){let l=te(t,n,s);return Dk(l,a)}function Kh(t,n={}){return Ee("ReturnType",[t],n)}function gU(t){return gn(t)?t.returnType:At()}function Uk(t,n){return je([t])?pt(gU(t),{},n):Kh(t,n)}function Bk(t,n,s,a={}){let l=te(t,n,s);return Uk(l,a)}function Vh(t,n){return Ee("With",[t,n],{})}function mg(t,n){return fg(t,n)}function fg(t,n){return je([t])?pt(t,{},n):Vh(t,n)}function Gk(t,n,s,a){let l=te(t,n,s);return fg(l,a)}function yU(t){return ws(t)?Ve(t.items)?pg(t.items.items):xn(t.items)?[t]:Ct(t.items)?[t]:[At()]:[t]}function pg(t){return t.reduce((s,a)=>[...s,...yU(a)],[])}function dn(t,n){return{callstack:t,visited:n}}function je(t){return Qe(t,(n,s)=>Ct(n)?!1:je(s),()=>!0)}function ru(t,n,s){return pe(s).reduce((a,l)=>({...a,[l]:te(t,n,s[l])}),{})}function Go(t,n,s){let a=Ur(t,n,s);return pg(a)}function Ur(t,n,s){return s.map((a)=>te(t,n,a))}function xU(t,n){let s=An(t)?Bl(n,{}):n,a=va(t)?Ul(s,{}):s;return Ca(t)?mu(a,{}):a}function IU(t,n,s,a,l){return F(s,"AddImmutable")?zk(t,n,a[0],l):F(s,"RemoveImmutable")?ZE(t,n,a[0],l):F(s,"AddReadonly")?bb(t,n,a[0],l):F(s,"RemoveReadonly")?rC(t,n,a[0],l):F(s,"AddOptional")?Cb(t,n,a[0],l):F(s,"RemoveOptional")?oC(t,n,a[0],l):F(s,"Capitalize")?lv(t,n,a[0],l):F(s,"Conditional")?fv(t,n,a[0],a[1],a[2],a[3],l):F(s,"ConstructorParameters")?hv(t,n,a[0],l):F(s,"Evaluate")?zE(t,n,a[0],l):F(s,"Exclude")?gv(t,n,a[0],a[1],l):F(s,"Extract")?Sv(t,n,a[0],a[1],l):F(s,"Index")?Kv(t,n,a[0],a[1],l):F(s,"InstanceType")?Wv(t,n,a[0],l):F(s,"Interface")?_E(t,n,a[0],a[1],l):F(s,"KeyOf")?nk(t,n,a[0],l):F(s,"Lowercase")?uv(t,n,a[0],l):F(s,"Mapped")?sk(t,n,a[0],a[1],a[2],a[3],l):F(s,"Module")?cg(t,n,a[0],l):F(s,"NonNullable")?lk(t,n,a[0],l):F(s,"Pick")?Ek(t,n,a[0],a[1],l):F(s,"Parameters")?fk(t,n,a[0],l):F(s,"Partial")?Sk(t,n,a[0],l):F(s,"Omit")?dk(t,n,a[0],a[1],l):F(s,"ReadonlyObject")?Pk(t,n,a[0],l):F(s,"Record")?bC(t,n,a[0],a[1],l):F(s,"Required")?Hk(t,n,a[0],l):F(s,"ReturnType")?Bk(t,n,a[0],l):F(s,"TemplateLiteral")?YC(t,n,a[0],l):F(s,"Uncapitalize")?cv(t,n,a[0],l):F(s,"Uppercase")?dv(t,n,a[0],l):F(s,"With")?Gk(t,n,a[0],a[1]):Ee(s,a,l)}function SU(t,n,s){let a=Ct(s)?Mk(t,n,s,s.$ref):lt(s)?x(te(t,n,s.items),Sa(s)):uu(s)?lg(t,n,s.target,s.arguments):hn(s)?Oo(Ur(t,n,s.parameters),te(t,n,s.instanceType),Eb(s)):gn(s)?$o(Ur(t,n,s.parameters),te(t,n,s.returnType),vb(s)):un(s)?Yd(te(t,n,s.if),te(t,n,s.then),te(t,n,s.else),Rb(s)):we(s)?Cr(Ur(t,n,s.allOf),Lb(s)):Re(s)?r(ru(t,n,s.properties),wb(s)):vt(s)?CC(Un(s),te(t,n,zt(s))):ws(s)?um(te(t,n,s.items)):Ve(s)?Sn(Go(t,n,s.items),nC(s)):se(s)?i(Ur(t,n,s.anyOf),Kb(s)):s;return xU(s,a)}function te(t,n,s){return _o(s)?IU(t,n,s.action,s.parameters,s.options):SU(t,n,s)}function pi(t,n){return te(t,dn([],[]),n)}function bU(t){return pt(t,{"~immutable":!0},{})}function mu(t,n){return pt(bU(t),{},n)}function zk(t,n,s,a){let l=te(t,n,s);return mu(l,a)}function zl(t,n={}){return mu(t,n)}function Qn(t,n={}){return ig(t,n)}function CU(t,n){let s=ka(t,n);return F(s,Xl)?1:F(s,au)?1:0}function jk(t,n,s=[]){return Qe(n,(a,l)=>F(CU(t,a),1)?jk(t,l,[...s,a]):[...s,t,...n],()=>[...s,t])}function qk(t,n=[]){return Qe(t,(s,a)=>qk(a,jk(s,n)),()=>n)}function Kk(t){return qk(t)}function fu(t){return Y(t,"~refine")&&Te(t["~refine"])&&Rn(t["~refine"],0,(n)=>Be(n)&&Y(n,"check")&&Y(n,"error")&&Ao(n.check)&&Ao(n.error))}function Mn(t){return Be(t)&&!Te(t)}function oo(t){return wn(t)}function Le(t){return Mn(t)||oo(t)}function Oa(t){return Y(t,"additionalItems")&&Le(t.additionalItems)}function Zr(t){return Y(t,"additionalProperties")&&Le(t.additionalProperties)}function pu(t){return Y(t,"allOf")&&Te(t.allOf)&&t.allOf.every((n)=>Le(n))}function hu(t){return Y(t,"$anchor")&&ct(t.$anchor)}function gu(t){return Y(t,"anyOf")&&Te(t.anyOf)&&t.anyOf.every((n)=>Le(n))}function Em(t){return Y(t,"const")}function Fi(t){return Y(t,"contains")&&Le(t.contains)}function Gr(t){return Y(t,"default")}function yu(t){return Y(t,"dependencies")&&Be(t.dependencies)&&Object.values(t.dependencies).every((n)=>Le(n)||Te(n)&&n.every((s)=>ct(s)))}function xu(t){return Y(t,"dependentRequired")&&Be(t.dependentRequired)&&Object.values(t.dependentRequired).every((n)=>Te(n)&&n.every((s)=>ct(s)))}function $a(t){return Y(t,"dependentSchemas")&&Be(t.dependentSchemas)&&Object.values(t.dependentSchemas).every((n)=>Le(n))}function so(t){return Y(t,"$dynamicAnchor")&&ct(t.$dynamicAnchor)}function Iu(t){return Y(t,"$dynamicRef")&&ct(t.$dynamicRef)}function Su(t){return Y(t,"else")&&Le(t.else)}function vm(t){return Y(t,"enum")&&Te(t.enum)}function bu(t){return Y(t,"exclusiveMaximum")&&(ft(t.exclusiveMaximum)||Zt(t.exclusiveMaximum))}function hi(t){return Y(t,"exclusiveMinimum")&&(ft(t.exclusiveMinimum)||Zt(t.exclusiveMinimum))}function As(t){return Y(t,"format")&&ct(t.format)}function zr(t){return Y(t,"$id")&&ct(t.$id)}function Cu(t){return Y(t,"if")&&Le(t.if)}function ao(t){return Y(t,"items")&&(Le(t.items)||Te(t.items)&&t.items.every((n)=>Le(n)))}function Eu(t){return ao(t)&&Te(t.items)}function vu(t){return Y(t,"maximum")&&(ft(t.maximum)||Zt(t.maximum))}function ku(t){return Y(t,"maxContains")&&ft(t.maxContains)}function Fa(t){return Y(t,"maxItems")&&ft(t.maxItems)}function Tu(t){return Y(t,"maxLength")&&ft(t.maxLength)}function wu(t){return Y(t,"maxProperties")&&ft(t.maxProperties)}function gi(t){return Y(t,"minimum")&&(ft(t.minimum)||Zt(t.minimum))}function lo(t){return Y(t,"minContains")&&ft(t.minContains)}function zo(t){return Y(t,"minItems")&&ft(t.minItems)}function Ps(t){return Y(t,"minLength")&&ft(t.minLength)}function Ms(t){return Y(t,"minProperties")&&ft(t.minProperties)}function Ru(t){return Y(t,"multipleOf")&&(ft(t.multipleOf)||Zt(t.multipleOf))}function Lu(t){return Y(t,"not")&&Le(t.not)}function Au(t){return Y(t,"oneOf")&&Te(t.oneOf)&&t.oneOf.every((n)=>Le(n))}function _s(t){return Y(t,"pattern")&&(ct(t.pattern)||t.pattern instanceof RegExp)}function uo(t){return Y(t,"patternProperties")&&Be(t.patternProperties)&&Object.values(t.patternProperties).every((n)=>Le(n))}function yi(t){return Y(t,"prefixItems")&&Te(t.prefixItems)&&t.prefixItems.every((n)=>Le(n))}function co(t){return Y(t,"properties")&&Be(t.properties)&&Object.values(t.properties).every((n)=>Le(n))}function Na(t){return Y(t,"propertyNames")&&(Be(t.propertyNames)||Le(t.propertyNames))}function vU(t){return Y(t,"$recursiveAnchor")&&wn(t.$recursiveAnchor)}function Pu(t){return vU(t)&&F(t.$recursiveAnchor,!0)}function Mu(t){return Y(t,"$recursiveRef")&&ct(t.$recursiveRef)}function _u(t){return Y(t,"$ref")&&ct(t.$ref)}function xi(t){return Y(t,"required")&&Te(t.required)&&t.required.every((n)=>ct(n))}function Ou(t){return Y(t,"then")&&Le(t.then)}function $u(t){return Y(t,"type")&&(ct(t.type)||Te(t.type)&&t.type.every((n)=>ct(n)))}function jo(t){return Y(t,"uniqueItems")&&wn(t.uniqueItems)}function qo(t){return Y(t,"unevaluatedItems")&&Le(t.unevaluatedItems)}function Ko(t){return Y(t,"unevaluatedProperties")&&Le(t.unevaluatedProperties)}function kU(t){return qo(t)||Ko(t)||ya(pe(t),(n)=>km(t[n]))}function TU(t){return ya(t,(n)=>km(n))}function km(t){return Te(t)?TU(t):Be(t)?kU(t):!1}function Vk(t,n){return km(n)||ya(pe(t),(s)=>km(t[s]))}class gg{constructor(t){this.hasUnevaluated=t}UseUnevaluated(){return this.hasUnevaluated}Push(){return Bt(Xe("context","Push"),[])}Pop(){return Bt(Xe("context","Pop"),[])}AddIndex(t){return Bt(Xe("context","AddIndex"),[t])}AddKey(t){return Bt(Xe("context","AddKey"),[t])}Merge(t){return Bt(Xe("context","Merge"),[t])}}class er{constructor(){let t=new Set,n=new Set;this.stack=[{indices:t,keys:n}]}Push(){let t=new Set,n=new Set;return this.stack.push({indices:t,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(let n of t)n.GetIndices().forEach((s)=>this.GetIndices().add(s)),n.GetKeys().forEach((s)=>this.GetKeys().add(s));return!0}}class tr extends er{constructor(){super();this.errors=[]}AtCapacity(){return this.errors.length>=Jr().maxErrors}AddError(t){if(!this.AtCapacity())this.errors.push(t);return!1}GetErrors(){return this.errors}}var Tm={identifier:"External",variables:[]};function ei(t){let n=`External[${Tm.variables.length}]`;return Tm.variables.push(t),n}function Wk(){Tm.variables=[]}function Xk(){return{...Tm}}function Yk(t,n,s,a){let l=ei(s["~refine"].map((d)=>d));return Li(l,Ie(0),["refinement","_"],Bt(Xe("refinement","check"),[a]))}function Jk(t,n,s,a){return Rn(s["~refine"],0,(l,d)=>l.check(a))}function Qk(t,n,s,a,l,d){return Vn(l["~refine"],0,(f,h)=>f.check(d)||n.AddError({keyword:"~refine",schemaPath:s,instancePath:a,params:{index:h,message:f.error(d)}}))}var wU=0;function kt(){return`var_${wU++}`}function yg(t){return ao(t)&&Te(t.items)}function RU(t,n,s,a){let[l,d]=[kt(),kt()],f=ar(t,n,s.additionalItems,l),h=ah(d,Ie(s.items.length)),g=n.AddIndex(d);return Li(a,Ie(0),[l,d],Dt(h,Gn(f,g)))}function LU(t,n,s,a){let[l,d]=[kt(),kt()],f=ar(t,n,s.additionalItems,l),h=ah(d,Ie(s.items.length));return Li(a,Ie(0),[l,d],Dt(h,f))}function Zk(t,n,s,a){if(!yg(s))return Ie(!0);return n.UseUnevaluated()?RU(t,n,s,a):LU(t,n,s,a)}function eT(t,n,s,a){if(!yg(s))return!0;return Rn(a,0,(d,f)=>Fl(f,s.items.length)||jr(t,n,s.additionalItems,d)&&n.AddIndex(f))}function tT(t,n,s,a,l,d){if(!yg(l))return!0;return Rn(d,0,(h,g)=>{let I=`${s}/additionalItems`,b=`${a}/${g}`;return Fl(g,l.items.length)||qr(t,n,I,b,l.additionalItems,h)&&n.AddIndex(g)})}function Ii(t){return new RegExp(t,"u")}function AU(t,n){return!t.UseUnevaluated()&&(F(n,!0)||Be(n)&&F(pe(n).length,0))}function PU(t){return`^${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function xg(t){let n=[];if(uo(t))n.push(...pe(t.patternProperties));if(co(t))n.push(...pe(t.properties).map(PU));return F(n.length,0)?"(?!)":`(${n.join("|")})`}function MU(t,n,s){return xi(n)&&co(n)&&!uo(n)&&F(n.additionalProperties,!1)&&F(pe(n.properties).length,n.required.length)}function _U(t,n,s){return br(Xe(Bt(Xe("Object","getOwnPropertyNames"),[s]),"length"),Ie(n.required.length))}function OU(t,n,s,a){let[l,d]=[kt(),kt()],f=ei(Ii(xg(s))),h=ar(t,n,s.additionalProperties,`${a}[${l}]`),g=Bt(Xe(f,"test"),[l]),I=n.AddKey(l),b=n.UseUnevaluated()?Dt(g,Gn(h,I)):Dt(g,h);return Li(Ss(a),Ie(0),[l,d],b)}function nT(t,n,s,a){if(AU(n,s.additionalProperties))return Ie(!0);return MU(n,s,a)?_U(n,s,a):OU(t,n,s,a)}function rT(t,n,s,a){let l=Ii(xg(s));return Rn(pe(a),0,(f,h)=>l.test(f)||jr(t,n,s.additionalProperties,a[f])&&n.AddKey(f))}function iT(t,n,s,a,l,d){let f=Ii(xg(l)),h=[];return Vn(pe(d),0,(I,b)=>{let v=`${s}/additionalProperties`,k=`${a}/${I}`,w=f.test(I)||qr(t,n,v,k,l.additionalProperties,d[I])&&n.AddKey(I);if(!w)h.push(I);return w})||n.AddError({keyword:"additionalProperties",schemaPath:s,instancePath:a,params:{additionalProperties:h}})}function Vo(t,n,s,a,l){let d=to("results","[]"),f=s.map((b,v)=>to(`context_${v}`,lh("CheckContext",[]))),h=s.map((b,v)=>to(`condition_${v}`,Bt(Po(["context"],gt(t,n,b,a)),[`context_${v}`]))),g=s.map((b,v)=>yb(`condition_${v}`,Bt(Xe("results","push"),[`context_${v}`]))),I=qd(Gn(l,n.Merge("results")));return Bt(Po([],jd([d,...f,...h,...g,I])),[])}function $U(t,n,s,a){return Vo(t,n,s.allOf,a,br(Xe("results","length"),Ie(s.allOf.length)))}function FU(t,n,s,a){return Wn(s.allOf.map((l)=>gt(t,n,l,a)))}function oT(t,n,s,a){return n.UseUnevaluated()?$U(t,n,s,a):FU(t,n,s,a)}function sT(t,n,s,a){let l=s.allOf.reduce((d,f)=>{let h=new er;return mt(t,h,f,a)?[...d,h]:d},[]);return F(l.length,s.allOf.length)&&n.Merge(l)}function aT(t,n,s,a,l,d){let f=[],h=l.allOf.reduce((I,b,v)=>{let k=`${s}/allOf/${v}`,w=new tr,P=$t(t,w,k,a,b,d);if(!P)f.push(w);return P?[...I,w]:I},[]),g=F(h.length,l.allOf.length)&&n.Merge(h);if(!g)f.forEach((I)=>I.GetErrors().forEach((b)=>n.AddError(b)));return g}function NU(t,n,s,a){return Vo(t,n,s.anyOf,a,pb(Xe("results","length"),Ie(0)))}function DU(t,n,s,a){return uh(s.anyOf.map((l)=>gt(t,n,l,a)))}function lT(t,n,s,a){return n.UseUnevaluated()?NU(t,n,s,a):DU(t,n,s,a)}function uT(t,n,s,a){let l=s.anyOf.reduce((d,f)=>{let h=new er;return mt(t,h,f,a)?[...d,h]:d},[]);return ys(l.length,0)&&n.Merge(l)}function cT(t,n,s,a,l,d){let f=[],h=l.anyOf.reduce((I,b,v)=>{let k=new tr,w=`${s}/anyOf/${v}`,P=$t(t,k,w,a,b,d);if(!P)f.push(k);return P?[...I,k]:I},[]),g=ys(h.length,0)&&n.Merge(h);if(!g)f.forEach((I)=>I.GetErrors().forEach((b)=>n.AddError(b)));return g||n.AddError({keyword:"anyOf",schemaPath:s,instancePath:a,params:{}})}function dT(t,n,s,a){return s?Ie(!0):Ie(!1)}function Ig(t,n,s,a){return s}function mT(t,n,s,a,l,d){return Ig(t,n,l,d)||n.AddError({keyword:"boolean",schemaPath:s,instancePath:a,params:{}})}function fT(t,n,s,a){return xs(s.const)?br(a,Ie(s.const)):gb(a,ei(s.const))}function Sg(t,n,s,a){return xs(s.const)?F(a,s.const):xa(a,s.const)}function pT(t,n,s,a,l,d){return Sg(t,n,l,d)||n.AddError({keyword:"const",schemaPath:s,instancePath:a,params:{allowedValue:l.const}})}function hT(t){return!(lo(t)&&F(t.minContains,0))}function HU(t,n,s,a){let[l,d]=[kt(),kt()],f=rr(br(Xe(a,"length"),Ie(0))),h=TN(a,[l,d],Gn(gt(t,n,s.contains,l),n.AddIndex(d)));return Gn(f,h)}function UU(t,n,s,a){let[l]=[kt()],d=rr(br(Xe(a,"length"),Ie(0))),f=kN(a,[l,"_"],gt(t,n,s.contains,l));return Gn(d,f)}function gT(t,n,s,a){if(!hT(s))return Ie(!0);return n.UseUnevaluated()?HU(t,n,s,a):UU(t,n,s,a)}function bg(t,n,s,a){if(!hT(s))return!0;return!F(a.length,0)&&ab(a,(l,d)=>mt(t,n,s.contains,l)&&n.AddIndex(d))}function yT(t,n,s,a,l,d){return bg(t,n,l,d)||n.AddError({keyword:"contains",schemaPath:s,instancePath:a,params:{minContains:1}})}function xT(t,n,s,a){let l=br(Xe(Ss(a),"length"),Ie(0)),d=Wn(Ln(s.dependencies).map(([f,h])=>{let g=rr(bs(a,Ie(f))),I=gt(t,n,h,a),b=(v)=>Wn(v.map((k)=>bs(a,Ie(k))));return Dt(g,Te(h)?b(h):I)}));return Dt(l,d)}function IT(t,n,s,a){let l=F(pe(a).length,0),d=Rn(Ln(s.dependencies),0,([f,h])=>!Y(a,f)||(Te(h)?h.every((g)=>Y(a,g)):mt(t,n,h,a)));return l||d}function ST(t,n,s,a,l,d){let f=F(pe(d).length,0),h=Vn(Ln(l.dependencies),0,([g,I])=>{let b=`${s}/dependencies/${g}`;return!Y(d,g)||(Te(I)?I.every((v)=>Y(d,v)||n.AddError({keyword:"dependencies",schemaPath:s,instancePath:a,params:{property:g,dependencies:I}})):$t(t,n,b,a,I,d))});return f||h}function bT(t,n,s,a){let l=br(Xe(Ss(a),"length"),Ie(0)),d=Wn(Ln(s.dependentRequired).map(([f,h])=>{let g=rr(bs(a,Ie(f))),I=Wn(h.map((b)=>bs(a,Ie(b))));return Dt(g,I)}));return Dt(l,d)}function CT(t,n,s,a){let l=F(pe(a).length,0),d=Rn(Ln(s.dependentRequired),0,([f,h])=>!Y(a,f)||h.every((g)=>Y(a,g)));return l||d}function ET(t,n,s,a,l,d){let f=F(pe(d).length,0),h=Vn(Ln(l.dependentRequired),0,([g,I])=>!Y(d,g)||Vn(I,0,(b)=>Y(d,b)||n.AddError({keyword:"dependentRequired",schemaPath:s,instancePath:a,params:{property:g,dependencies:I}})));return f||h}function vT(t,n,s,a){let l=br(Xe(Ss(a),"length"),Ie(0)),d=Wn(Ln(s.dependentSchemas).map(([f,h])=>{let g=rr(bs(a,Ie(f))),I=gt(t,n,h,a);return Dt(g,I)}));return Dt(l,d)}function kT(t,n,s,a){let l=F(pe(a).length,0),d=Rn(Ln(s.dependentSchemas),0,([f,h])=>!Y(a,f)||mt(t,n,h,a));return l||d}function TT(t,n,s,a,l,d){let f=F(pe(d).length,0),h=Vn(Ln(l.dependentSchemas),0,([g,I])=>{let b=`${s}/dependentSchemas/${g}`;return!Y(d,g)||$t(t,n,b,a,I,d)});return f||h}function wT(t,n,s,a){let l=t.DynamicRef(s)??!1;return mo(t,n,l,a)}function RT(t,n,s,a){let l=t.DynamicRef(s)??!1;return Le(l)&&mt(t,n,l,a)}function LT(t,n,s,a,l,d){let f=t.DynamicRef(l)??!1;return Le(f)&&$t(t,n,"#",a,f,d)}function AT(t,n,s,a){return uh(s.enum.map((l)=>{if(xs(l))return br(a,Ie(l));let d=ei(l);return gb(a,d)}))}function Eg(t,n,s,a){return ya(s.enum,(l)=>xs(l)?F(a,l):xa(a,l))}function PT(t,n,s,a,l,d){return Eg(t,n,l,d)||n.AddError({keyword:"enum",schemaPath:s,instancePath:a,params:{allowedValues:l.enum}})}function MT(t,n,s,a){return ah(a,Ie(s.exclusiveMaximum))}function vg(t,n,s,a){return Fl(a,s.exclusiveMaximum)}function _T(t,n,s,a,l,d){return vg(t,n,l,d)||n.AddError({keyword:"exclusiveMaximum",schemaPath:s,instancePath:a,params:{comparison:"<",limit:l.exclusiveMaximum}})}function OT(t,n,s,a){return pb(a,Ie(s.exclusiveMinimum))}function kg(t,n,s,a){return ys(a,s.exclusiveMinimum)}function $T(t,n,s,a,l,d){return kg(t,n,l,d)||n.AddError({keyword:"exclusiveMinimum",schemaPath:s,instancePath:a,params:{comparison:">",limit:l.exclusiveMinimum}})}var Ga={};De(Ga,{Clear:()=>lw,Entries:()=>A8,Get:()=>_8,Has:()=>M8,IsDate:()=>Ha,IsDateTime:()=>wm,IsDuration:()=>Rm,IsEmail:()=>Lm,IsHostname:()=>Nm,IsIPv4:()=>Um,IsIPv6:()=>Bm,IsIdnEmail:()=>Dm,IsIdnHostname:()=>Hm,IsIri:()=>zm,IsIriReference:()=>Gm,IsJsonPointer:()=>qm,IsJsonPointerUriFragment:()=>jm,IsRegex:()=>Km,IsRelativeJsonPointer:()=>Vm,IsTime:()=>Ua,IsUri:()=>Ym,IsUriReference:()=>Wm,IsUriTemplate:()=>Xm,IsUrl:()=>Jm,IsUuid:()=>Qm,Reset:()=>cw,Set:()=>P8,Test:()=>uw});var BU=[0,31,28,31,30,31,30,31,31,30,31,30,31],GU=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function zU(t){return t%4===0&&(t%100!==0||t%400===0)}function Ha(t){let n=GU.exec(t);if(!n)return!1;let s=+n[1],a=+n[2],l=+n[3];return a>=1&&a<=12&&l>=1&&l<=(a===2&&zU(s)?29:BU[a])}var jU=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;function Ua(t,n=!0){let s=jU.exec(t);if(!s)return!1;if(n&&!s[4]&&!s[5])return!1;let a=+s[1],l=+s[2],d=+s[3];if(a>23||l>59||d>60)return!1;if(s[5]){let b=+s[6],v=+s[7];if(b>23||v>59)return!1}if(d<60)return!0;let f=s[5]==="-"?-1:1,h=+(s[6]||0),g=+(s[7]||0);return((a*60+l-f*(h*60+g))%1440+1440)%1440===1439}function wm(t){let n=t.split(/T/i);return n.length===2&&Ha(n[0])&&Ua(n[1])}var qU=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function Rm(t){return qU.test(t)}var KU=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;function Lm(t){return KU.test(t)}var FT=/^(?!-).*(?<!-)$/,NT=/^(?!..--)/,DT=/^[a-zA-Z0-9-]*$/;var Ba=/[^\p{ASCII}]/u;var VU=/[0-9]/,HT=/[\u{0660}-\u{0669}]/u,WU=/[\u{06f0}-\u{06f9}]/u,XU=/[\u{002e}\u{002c}\u{003a}\u{002f}]/u,YU=/[\u{002d}\u{002b}]/u,Tg=/\p{Mn}/u,JU=/\p{Mc}/u;var UT=/[\p{Mn}\p{Mc}\p{Me}]/u,wg=/\p{L}/u,QU=/\p{Nd}/u,BT=/\p{Script=Greek}/u,Am=/\p{Script=Hebrew}/u,GT=/[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u,zT=/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u,Rg=/[\u{094d}\u{09cd}\u{0a4d}\u{0acd}\u{0b4d}\u{0bcd}\u{0c4d}\u{0ccd}\u{0d3b}\u{0d3c}\u{0d4d}\u{0dca}\u{1b44}\u{1baa}\u{1bab}\u{a9c0}\u{11046}\u{1107f}\u{110b9}\u{11133}\u{11134}\u{111c0}\u{11235}\u{1134d}\u{11442}\u{114c2}\u{115bf}\u{1163f}\u{116b6}\u{11c3f}\u{11d44}\u{11d45}]/u,jT=/[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u,ZU=/[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u,e8=/[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u,qT=new RegExp([VU,WU].map((t)=>t.source).join("|"),"u"),KT=new RegExp([wg,YU,XU,QU,Tg,JU,ZU,e8].map((t)=>t.source).join("|"),"u");function VT(t){return FT.test(t)&&NT.test(t)&&DT.test(t)}var Si=36,Nu=1,Du=26,n8=38,r8=700,XT=72,YT=128;function Lg(){throw null}function Pm(t){return t.toLowerCase().startsWith("xn--")}function JT(t,n,s){t=s?Math.floor(t/r8):t>>1,t+=Math.floor(t/n);let a=0;while(t>(Si-Nu)*Du>>1)t=Math.floor(t/(Si-Nu)),a+=Si;return a+Math.floor((Si-Nu+1)*t/(t+n8))}function Mm(t){let n=[],s=YT,a=0,l=XT,d=t.lastIndexOf("-");if(d>0)for(let h=0;h<d;h++){let g=t.charCodeAt(h);if(g>=128)Lg();n.push(g)}let f=d<0?0:d+1;while(f<t.length){let h=a,g=1,I=Si;while(!0){if(f>=t.length)Lg();let v=t.charCodeAt(f++),k;if(v>=97&&v<=122)k=v-97;else if(v>=48&&v<=57)k=v-48+26;else Lg();a+=k*g;let w=I<=l?Nu:I>=l+Du?Du:I-l;if(k<w)break;g*=Si-w,I+=Si}let b=n.length+1;l=JT(a-h,b,h===0),s+=Math.floor(a/b),a%=b,n.splice(a,0,s),a++}return String.fromCodePoint(...n)}function WT(t){return t<26?String.fromCharCode(t+97):String.fromCharCode(t-26+48)}var i8=new RegExp(Ba.source,"gu");function QT(t){let n=t.replace(i8,""),s=n.length,a=s>0?[n,"-"]:[],l=Array.from(t,(I)=>I.codePointAt(0)),d=YT,f=0,h=XT,g=s;while(g<l.length){let I=1/0;for(let b of l)if(b>=d&&b<I)I=b;f+=(I-d)*(g+1),d=I;for(let b of l){if(b<d)f++;if(b===d){let v=f;for(let k=Si;;k+=Si){let w=k<=h?Nu:k>=h+Du?Du:k-h;if(v<w)break;let P=w+(v-w)%(Si-w);a.push(WT(P)),v=Math.floor((v-w)/(Si-w))}a.push(WT(v)),h=JT(f,g+1,g===s),f=0,g++}}f++,d++}return a.join("")}var o8=/^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/,ZT=/^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/,s8=/^(?:R|AL|AN)$/;function ew(t){if(Pm(t))try{return _m(Mm(t.slice(4).toLowerCase()))}catch{return!1}return _m(t)}function tw(t){let n=String.fromCodePoint(t);return qT.test(n)?"EN":HT.test(n)?"AN":Tg.test(n)?"NSM":Am.test(n)?"R":zT.test(n)?"AL":wg.test(n)?"L":"ON"}function _m(t){for(let n of t)if(s8.test(tw(n.codePointAt(0))))return!0;return!1}function Om(t){let n=!1,s=ZT,a=!1,l=!1,d=!0;for(let f of t){let h=tw(f.codePointAt(0));if(d){if(h!=="L"&&h!=="R"&&h!=="AL")return!1;n=h==="R"||h==="AL",s=n?o8:ZT,d=!1}if(!s.test(h))return!1;if(h==="EN")a=!0;else if(h==="AN")l=!0}if(n&&a&&l)return!1;return!0}function a8(t){return Ba.test(t)&&QT(t).length+4>63}function l8(t){if(t[0]==="-"||t[t.length-1]==="-")return!0;return t.slice(2).join("").startsWith("--")}function $m(t){if(a8(t))return!1;if(_m(t)&&!Om(t))return!1;let n=[...t],s=n.map((d)=>d.codePointAt(0)),a=s.length;if(l8(n))return!1;if(UT.test(n[0]))return!1;let l=!1;for(let d=0;d<a;d++){let f=s[d],h=n[d];if(jT.test(h))return!1;if(!KT.test(h))return!1;if(GT.test(h))l=!0;let g=s[d-1],I=s[d+1];switch(f){case 183:if(g!==108||I!==108)return!1;break;case 885:if(!I||!BT.test(n[d+1]))return!1;break;case 1523:case 1524:if(!g||!Am.test(n[d-1]))return!1;break;case 8204:if(!g||g<128&&!Rg.test(n[d-1]))return!1;break;case 8205:if(!g||!Rg.test(n[d-1]))return!1;break;case 12539:break}}if(t.includes("・")&&!l)return!1;return!0}function Fm(t){if(!Pm(t))return!1;try{let n=t.slice(4).toLowerCase();if(n.lastIndexOf("-")===0)return!1;let s=Mm(n);if(!Ba.test(s))return!1;return $m(s)}catch{return!1}}function u8(t){return t.length>0&&t.length<=63}function c8(t){return u8(t)&&(Fm(t)||VT(t))}function ow(t){if(t.length===0||t.length>253)return!1;if(t.charCodeAt(t.length-1)===46)return!1;return t.split(".").every((n)=>c8(n))}function d8(t){return t.length>0&&t.length<=63}function m8(t){return d8(t)&&(Fm(t)||$m(t))}function f8(t){return t.replace(/[\uff01-\uff5e]/g,(n)=>String.fromCharCode(n.charCodeAt(0)-65248)).normalize("NFC").replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu,"").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".")}function sw(t){if(t.length===0||t.includes(" "))return!1;let n=f8(t);if(n.length>253)return!1;let s=n.split("."),a=s.some((l)=>ew(l));return s.every((l)=>m8(l)&&(!a||Om(l)))}function Nm(t){return ow(t)}var p8=/^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;function Dm(t){return p8.test(t.normalize("NFC"))}function Hm(t){return sw(t)}var h8=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function Um(t){return h8.test(t)}var g8=/^(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:)?[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)$/i;function Bm(t){return g8.test(t)}var y8=/[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/,x8=/^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;function Gm(t){return!y8.test(t)&&!x8.test(t)&&URL.canParse(t,"http://example.com")}var I8=/\[[vV][0-9a-fA-F]+\.[^\]]+\]/,S8=/[\x00-\x20<>\^`{|}\\]/,b8=/%(?![0-9a-fA-F]{2})/;function C8(t){return t.length<2048?t.replace(I8,"[::1]"):t}function zm(t){if(S8.test(t))return!1;if(b8.test(t))return!1;return URL.canParse(C8(t))}var E8=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function jm(t){return E8.test(t)}var v8=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function qm(t){return v8.test(t)}function Km(t){try{return new RegExp(t,"u"),!0}catch{return!1}}var k8=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Vm(t){return k8.test(t)}var T8=/^(?:[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Wm(t){return T8.test(t)}var w8=/^(?:(?:[^\x00-\x20"<>%\\^`{|}\x7f]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?)*\})*$/i;function Xm(t){return w8.test(t)}var R8=/^[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Ym(t){return R8.test(t)}function Jm(t){return URL.canParse(t)}var L8=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Qm(t){return L8.test(t)}var jt=new Map;function lw(){jt.clear()}function A8(){return[...jt.entries()]}function P8(t,n){jt.set(t,n)}function M8(t){return jt.has(t)}function _8(t){return jt.get(t)}function uw(t,n){return jt.get(t)?.(n)??!0}function cw(){lw(),jt.set("date-time",wm),jt.set("date",Ha),jt.set("duration",Rm),jt.set("email",Lm),jt.set("hostname",Nm),jt.set("idn-email",Dm),jt.set("idn-hostname",Hm),jt.set("ipv4",Um),jt.set("ipv6",Bm),jt.set("iri-reference",Gm),jt.set("iri",zm),jt.set("json-pointer-uri-fragment",jm),jt.set("json-pointer",qm),jt.set("regex",Km),jt.set("relative-json-pointer",Vm),jt.set("time",Ua),jt.set("uri-reference",Wm),jt.set("uri-template",Xm),jt.set("uri",Ym),jt.set("url",Jm),jt.set("uuid",Qm)}cw();function dw(t,n,s,a){return Bt(Xe("Format","Test"),[Ie(s.format),a])}function Pg(t,n,s,a){return uw(s.format,a)}function mw(t,n,s,a,l,d){return Pg(t,n,l,d)||n.AddError({keyword:"format",schemaPath:s,instancePath:a,params:{format:l.format}})}function fw(t,n,s,a){let l=Ou(s)?s.then:!0,d=Su(s)?s.else:!0;return RN(gt(t,n,s.if,a),gt(t,n,l,a),gt(t,n,d,a))}function pw(t,n,s,a){let l=Ou(s)?s.then:!0,d=Su(s)?s.else:!0;return mt(t,n,s.if,a)?mt(t,n,l,a):mt(t,n,d,a)}function hw(t,n,s,a,l,d){let f=Ou(l)?l.then:!0,h=Su(l)?l.else:!0,g=new tr,I=$t(t,g,`${s}/if`,a,l.if,d)?$t(t,g,`${s}/then`,a,f,d)||n.AddError({keyword:"if",schemaPath:s,instancePath:a,params:{failingKeyword:"then"}}):$t(t,n,`${s}/else`,a,h,d)||n.AddError({keyword:"if",schemaPath:s,instancePath:a,params:{failingKeyword:"else"}});if(I)n.Merge([g]);return I}function O8(t,n,s,a){return Wn(s.items.map((l,d)=>{let f=Is(Xe(a,"length"),Ie(d)),h=ar(t,n,l,`${a}[${d}]`),g=n.AddIndex(Ie(d));return Dt(f,Gn(h,g))}))}function $8(t,n,s,a){return Wn(s.items.map((l,d)=>{let f=Is(Xe(a,"length"),Ie(d)),h=ar(t,n,l,`${a}[${d}]`);return Dt(f,h)}))}function F8(t,n,s,a){return n.UseUnevaluated()?O8(t,n,s,a):$8(t,n,s,a)}function N8(t,n,s,a){return Rn(s.items,0,(l,d)=>Ri(a.length,d)||jr(t,n,l,a[d])&&n.AddIndex(d))}function D8(t,n,s,a,l,d){return Vn(l.items,0,(f,h)=>{let g=`${s}/items/${h}`,I=`${a}/${h}`;return Ri(d.length,h)||qr(t,n,g,I,f,d[h])&&n.AddIndex(h)})}function H8(t,n,s,a){let l=yi(s)?s.prefixItems.length:0,d=ar(t,n,s.items,"element"),f=n.AddIndex("index");return Li(a,Ie(l),["element","index"],Gn(d,f))}function U8(t,n,s,a){let l=yi(s)?s.prefixItems.length:0,d=ar(t,n,s.items,"element");return Li(a,Ie(l),["element","index"],d)}function B8(t,n,s,a){return n.UseUnevaluated()?H8(t,n,s,a):U8(t,n,s,a)}function G8(t,n,s,a){let l=yi(s)?s.prefixItems.length:0;return Rn(a,l,(d,f)=>jr(t,n,s.items,d)&&n.AddIndex(f))}function z8(t,n,s,a,l,d){let f=yi(l)?l.prefixItems.length:0;return Vn(d,f,(h,g)=>{let I=`${s}/items`,b=`${a}/${g}`;return qr(t,n,I,b,l.items,h)&&n.AddIndex(g)})}function gw(t,n,s,a){return Eu(s)?F8(t,n,s,a):B8(t,n,s,a)}function yw(t,n,s,a){return Eu(s)?N8(t,n,s,a):G8(t,n,s,a)}function xw(t,n,s,a,l,d){return Eu(l)?D8(t,n,s,a,l,d):z8(t,n,s,a,l,d)}function Iw(t){return Fi(t)}function Sw(t,n,s,a){if(!Iw(s))return Ie(!0);let[l]=[kt()],d=zd(a,[l,"_"],gt(t,n,s.contains,l));return Is(d,Ie(s.maxContains))}function Mg(t,n,s,a){if(!Iw(s))return!0;let l=rh(a,(d)=>mt(t,n,s.contains,d));return Ri(l,s.maxContains)}function bw(t,n,s,a,l,d){let f=lo(l)?l.minContains:1;return Mg(t,n,l,d)||n.AddError({keyword:"contains",schemaPath:s,instancePath:a,params:{minContains:f,maxContains:l.maxContains}})}function Cw(t,n,s,a){return Is(a,Ie(s.maximum))}function _g(t,n,s,a){return Ri(a,s.maximum)}function Ew(t,n,s,a,l,d){return _g(t,n,l,d)||n.AddError({keyword:"maximum",schemaPath:s,instancePath:a,params:{comparison:"<=",limit:l.maximum}})}function vw(t,n,s,a){return Is(Xe(a,"length"),Ie(s.maxItems))}function Og(t,n,s,a){return Ri(a.length,s.maxItems)}function kw(t,n,s,a,l,d){return Og(t,n,l,d)||n.AddError({keyword:"maxItems",schemaPath:s,instancePath:a,params:{limit:l.maxItems}})}function Tw(t,n,s,a){return vN(a,Ie(s.maxLength))}function $g(t,n,s,a){return ob(a,s.maxLength)}function ww(t,n,s,a,l,d){return $g(t,n,l,d)||n.AddError({keyword:"maxLength",schemaPath:s,instancePath:a,params:{limit:l.maxLength}})}function Rw(t,n,s,a){return Is(Xe(Ss(a),"length"),Ie(s.maxProperties))}function Fg(t,n,s,a){return Ri(pe(a).length,s.maxProperties)}function Lw(t,n,s,a,l,d){return Fg(t,n,l,d)||n.AddError({keyword:"maxProperties",schemaPath:s,instancePath:a,params:{limit:l.maxProperties}})}function Aw(t){return Fi(t)}function j8(t,n,s,a){let[l,d]=[kt(),kt()],f=zd(a,[l,d],Gn(gt(t,n,s.contains,l),n.AddIndex(d)));return Dl(f,Ie(s.minContains))}function q8(t,n,s,a){let[l]=[kt()],d=zd(a,[l,"_"],gt(t,n,s.contains,l));return Dl(d,Ie(s.minContains))}function Pw(t,n,s,a){if(!Aw(s))return Ie(!0);return n.UseUnevaluated()?j8(t,n,s,a):q8(t,n,s,a)}function Ng(t,n,s,a){if(!Aw(s))return!0;let l=rh(a,(d,f)=>mt(t,n,s.contains,d)&&n.AddIndex(f));return ga(l,s.minContains)}function Mw(t,n,s,a,l,d){return Ng(t,n,l,d)||n.AddError({keyword:"contains",schemaPath:s,instancePath:a,params:{minContains:l.minContains}})}function _w(t,n,s,a){return Dl(a,Ie(s.minimum))}function Dg(t,n,s,a){return ga(a,s.minimum)}function Ow(t,n,s,a,l,d){return Dg(t,n,l,d)||n.AddError({keyword:"minimum",schemaPath:s,instancePath:a,params:{comparison:">=",limit:l.minimum}})}function $w(t,n,s,a){return Dl(Xe(a,"length"),Ie(s.minItems))}function Hg(t,n,s,a){return ga(a.length,s.minItems)}function Fw(t,n,s,a,l,d){return Hg(t,n,l,d)||n.AddError({keyword:"minItems",schemaPath:s,instancePath:a,params:{limit:l.minItems}})}function Nw(t,n,s,a){return EN(a,Ie(s.minLength))}function Ug(t,n,s,a){return sb(a,s.minLength)}function Dw(t,n,s,a,l,d){return Ug(t,n,l,d)||n.AddError({keyword:"minLength",schemaPath:s,instancePath:a,params:{limit:l.minLength}})}function Hw(t,n,s,a){return Dl(Xe(Ss(a),"length"),Ie(s.minProperties))}function Bg(t,n,s,a){return ga(pe(a).length,s.minProperties)}function Uw(t,n,s,a,l,d){return Bg(t,n,l,d)||n.AddError({keyword:"minProperties",schemaPath:s,instancePath:a,params:{limit:l.minProperties}})}function Bw(t,n,s,a){return LN(a,Ie(s.multipleOf))}function Gg(t,n,s,a){return rb(a,s.multipleOf)}function Gw(t,n,s,a,l,d){return Gg(t,n,l,d)||n.AddError({keyword:"multipleOf",schemaPath:s,instancePath:a,params:{multipleOf:l.multipleOf}})}function K8(t,n,s,a){return Vo(t,n,[s.not],a,rr(br(Xe("results","length"),Ie(1))))}function V8(t,n,s,a){return rr(gt(t,n,s.not,a))}function zw(t,n,s,a){return n.UseUnevaluated()?K8(t,n,s,a):V8(t,n,s,a)}function zg(t,n,s,a){let l=new er;return!mt(t,l,s.not,a)&&n.Merge([l])}function jw(t,n,s,a,l,d){return zg(t,n,l,d)||n.AddError({keyword:"not",schemaPath:s,instancePath:a,params:{}})}function W8(t,n,s,a){return Vo(t,n,s.oneOf,a,br(Xe("results","length"),Ie(1)))}function X8(t,n,s,a){let[l]=[kt()],d=wN(s.oneOf.map((h)=>gt(t,n,h,a))),f=zd(d,[l,"_"],br(l,Ie(!0)));return br(f,Ie(1))}function qw(t,n,s,a){return n.UseUnevaluated()?W8(t,n,s,a):X8(t,n,s,a)}function Kw(t,n,s,a){let l=s.oneOf.reduce((d,f)=>{let h=new er;return mt(t,h,f,a)?[...d,h]:d},[]);return F(l.length,1)&&n.Merge(l)}function Vw(t,n,s,a,l,d){let f=[],h=[],g=l.oneOf.reduce((b,v,k)=>{let w=new tr,P=`${s}/oneOf/${k}`,M=$t(t,w,P,a,v,d);if(M)h.push(k);if(!M)f.push(w);return M?[...b,w]:b},[]),I=F(g.length,1)&&n.Merge(g);if(!I&&F(h.length,0))f.forEach((b)=>b.GetErrors().forEach((v)=>n.AddError(v)));return I||n.AddError({keyword:"oneOf",schemaPath:s,instancePath:a,params:{passingSchemas:h}})}function Ww(t,n,s,a){let l=ei(ct(s.pattern)?Ii(s.pattern):s.pattern);return Bt(Xe(l,"test"),[a])}function jg(t,n,s,a){return(ct(s.pattern)?Ii(s.pattern):s.pattern).test(a)}function Xw(t,n,s,a,l,d){return jg(t,n,l,d)||n.AddError({keyword:"pattern",schemaPath:s,instancePath:a,params:{pattern:l.pattern}})}function Yw(t,n,s,a){return Wn(Ln(s.patternProperties).map(([l,d])=>{let[f,h]=[kt(),kt()],g=ei(Ii(l)),I=rr(Bt(Xe(g,"test"),[f])),b=ar(t,n,d,h),v=n.AddKey(f),k=n.UseUnevaluated()?Dt(I,Gn(b,v)):Dt(I,b);return Li(hb(a),Ie(0),[`[${f}, ${h}]`,"_"],k)}))}function Jw(t,n,s,a){return Rn(Ln(s.patternProperties),0,([l,d])=>{let f=Ii(l);return Rn(Ln(a),0,([h,g])=>!f.test(h)||jr(t,n,d,g)&&n.AddKey(h))})}function Qw(t,n,s,a,l,d){return Vn(Ln(l.patternProperties),0,([f,h])=>{let g=`${s}/patternProperties/${f}`,I=Ii(f);return Vn(Ln(d),0,([b,v])=>{let k=`${a}/${b}`;return!I.test(b)||qr(t,n,g,k,h,v)&&n.AddKey(b)})})}function Zw(t,n,s,a){return Wn(s.prefixItems.map((l,d)=>{let f=Is(Xe(a,"length"),Ie(d)),h=ar(t,n,l,`${a}[${d}]`),g=n.AddIndex(Ie(d)),I=n.UseUnevaluated()?Gn(h,g):h;return Dt(f,I)}))}function eR(t,n,s,a){return F(a.length,0)||Rn(s.prefixItems,0,(l,d)=>Ri(a.length,d)||jr(t,n,l,a[d])&&n.AddIndex(d))}function tR(t,n,s,a,l,d){return F(d.length,0)||Vn(l.prefixItems,0,(f,h)=>{let g=`${s}/prefixItems/${h}`,I=`${a}/${h}`;return Ri(d.length,h)||qr(t,n,g,I,f,d[h])&&n.AddIndex(h)})}function Zm(t,n){return t.includes(n)||Jr().exactOptionalPropertyTypes}function nR(t,n){return sh(Xe(t,n))}function qg(t,n){return bt(t[n])}function rR(t,n,s,a){let l=xi(s)?s.required:[],d=Ln(s.properties).map(([f,h])=>{let g=rr(bs(a,Ie(f))),I=ar(t,n,h,Xe(a,f)),b=n.AddKey(Ie(f)),v=n.UseUnevaluated()?Gn(I,b):I,k=l.includes(f)?v:Dt(g,v);return Zm(l,f)?k:Dt(nR(a,f),k)});return Wn(d)}function iR(t,n,s,a){let l=xi(s)?s.required:[];return Rn(Ln(s.properties),0,([f,h])=>{let g=!Y(a,f)||jr(t,n,h,a[f])&&n.AddKey(f);return Zm(l,f)?g:qg(a,f)||g})}function oR(t,n,s,a,l,d){let f=xi(l)?l.required:[];return Vn(Ln(l.properties),0,([g,I])=>{let b=`${s}/properties/${g}`,v=`${a}/${g}`,k=()=>!Y(d,g)||qr(t,n,b,v,I,d[g])&&n.AddKey(g);return Zm(f,g)?k():qg(d,g)||k()})}function sR(t,n,s,a){let[l,d]=[kt(),kt()];return Li(Ss(a),Ie(0),[l,d],gt(t,n,s.propertyNames,l))}function aR(t,n,s,a){return Rn(pe(a),0,(l,d)=>mt(t,n,s.propertyNames,l))}function lR(t,n,s,a,l,d){let f=[];return Vn(pe(d),0,(g,I)=>{let b=`${a}/${g}`,v=`${s}/propertyNames`,k=$t(t,n,v,b,l.propertyNames,g);if(!k)f.push(g);return k})||n.AddError({keyword:"propertyNames",schemaPath:s,instancePath:a,params:{propertyNames:f}})}function uR(t,n,s,a){let l=t.RecursiveRef(s)??!1;return mo(t,n,l,a)}function cR(t,n,s,a){let l=t.RecursiveRef(s)??!1;return Le(l)&&mt(t,n,l,a)}function dR(t,n,s,a,l,d){let f=t.RecursiveRef(l)??!1;return Le(f)&&$t(t,n,"#",a,f,d)}function Y8(t,n,s,a){let l=Po(["context","value"],mo(t,n,s,"value")),d=Po(["context","value"],jd([to("nextContext",lh("CheckContext",[])),to("result",Bt(l,["nextContext","value"])),yb("result",n.Merge("[nextContext]")),qd("result")]));return Bt(d,["context",a])}function J8(t,n,s,a){return mo(t,n,s,a)}function mR(t,n,s,a){let l=t.Ref(s)??!1;return n.UseUnevaluated()?Y8(t,n,l,a):J8(t,n,l,a)}function fR(t,n,s,a){let l=t.Ref(s)??!1,d=new er,f=Le(l)&&mt(t,d,l,a);if(f)n.Merge([d]);return f}function pR(t,n,s,a,l,d){let f=t.Ref(l)??!1,h=new tr,g=Le(f)&&$t(t,h,"#",a,f,d);if(g)n.Merge([h]);if(!g)h.GetErrors().forEach((I)=>n.AddError(I));return g}function hR(t,n,s,a){return Wn(s.required.map((l)=>bs(a,Ie(l))))}function gR(t,n,s,a){return Rn(s.required,0,(l)=>Y(a,l))}function yR(t,n,s,a,l,d){let f=[];return Vn(l.required,0,(g)=>{let I=Y(d,g);if(!I)f.push(g);return I})||n.AddError({keyword:"required",schemaPath:s,instancePath:a,params:{requiredProperties:f}})}function xR(t,n,s,a){return F(s,"object")?db(a):F(s,"array")?Gd(a):F(s,"boolean")?yN(a):F(s,"integer")?xN(a):F(s,"number")?cb(a):F(s,"null")?IN(a):F(s,"string")?fb(a):F(s,"bigint")?ub(a):F(s,"constructor")?CN(a):F(s,"function")?bN(a):F(s,"symbol")?SN(a):F(s,"undefined")?sh(a):F(s,"void")?sh(a):Ie(!0)}function Kg(t,n,s,a,l){return F(s,"object")?eo(l):F(s,"array")?Te(l):F(s,"boolean")?wn(l):F(s,"integer")?Bd(l):F(s,"number")?ft(l):F(s,"null")?Or(l):F(s,"string")?ct(l):F(s,"bigint")?Zt(l):F(s,"constructor")?th(l):F(s,"function")?Ao(l):F(s,"symbol")?nh(l):F(s,"undefined")?bt(l):F(s,"void")?bt(l):!0}function Q8(t,n,s,a){return uh(s.map((l)=>xR(t,n,l,a)))}function IR(t,n,s,a,l){return ya(s,(d)=>Kg(t,n,d,a,l))}function SR(t,n,s,a){return Te(s.type)?Q8(t,n,s.type,a):xR(t,n,s.type,a)}function bR(t,n,s,a){return Te(s.type)?IR(t,n,s.type,s,a):Kg(t,n,s.type,s,a)}function CR(t,n,s,a,l,d){return(Te(l.type)?IR(t,n,l.type,l,d):Kg(t,n,l.type,l,d))||n.AddError({keyword:"type",schemaPath:s,instancePath:a,params:{type:l.type}})}function ER(t,n,s,a){let[l,d]=[kt(),kt()],f=Bt(Xe("context","GetIndices"),[]),h=Bt(Xe("indices","has"),[l]),g=gt(t,n,s.unevaluatedItems,d),I=Bt(Xe("context","AddIndex"),[l]),b=Li(a,Ie(0),[d,l],Gn(Dt(h,g),I));return Bt(Po(["context"],jd([to("indices",f),qd(b)])),["context"])}function vR(t,n,s,a){let l=n.GetIndices();return Rn(a,0,(d,f)=>(l.has(f)||mt(t,n,s.unevaluatedItems,d))&&n.AddIndex(f))}function kR(t,n,s,a,l,d){let f=n.GetIndices(),h=[];return Vn(d,0,(I,b)=>{let v=new tr,k=(f.has(b)||$t(t,v,s,a,l.unevaluatedItems,I))&&n.AddIndex(b);if(!k)h.push(b);return k})||n.AddError({keyword:"unevaluatedItems",schemaPath:s,instancePath:a,params:{unevaluatedItems:h}})}function TR(t,n,s,a){let[l,d]=[kt(),kt()],f=Bt(Xe("context","GetKeys"),[]),h=Bt(Xe("keys","has"),[l]),g=Bt(Xe("context","AddKey"),[l]),I=gt(t,n,s.unevaluatedProperties,d),b=Li(hb(a),Ie(0),[`[${l}, ${d}]`,"_"],Dt(h,Gn(I,g)));return Bt(Po(["context"],jd([to("keys",f),qd(b)])),["context"])}function wR(t,n,s,a){let l=n.GetKeys();return Rn(Ln(a),0,([d,f])=>l.has(d)||mt(t,n,s.unevaluatedProperties,f)&&n.AddKey(d))}function RR(t,n,s,a,l,d){let f=n.GetKeys(),h=[];return Vn(Ln(d),0,([I,b])=>{let v=new tr,k=f.has(I)||$t(t,v,s,a,l.unevaluatedProperties,b)&&n.AddKey(I);if(!k)h.push(I);return k})||n.AddError({keyword:"unevaluatedProperties",schemaPath:s,instancePath:a,params:{unevaluatedProperties:h}})}function Vg(t){return!F(t.uniqueItems,!1)}function LR(t,n,s,a){if(!Vg(s))return Ie(!0);let l=Xe(lh("Set",[Bt(Xe(a,"map"),[Xe("Hashing","Hash")])]),"size"),d=Xe(a,"length");return br(l,d)}function AR(t,n,s,a){if(!Vg(s))return!0;let l=new Set(a.map(fh)).size,d=a.length;return F(l,d)}function PR(t,n,s,a,l,d){if(!Vg(l))return!0;let f=new Set,h=d.reduce((I,b,v)=>{let k=fh(b);if(f.has(k))return[...I,v];return f.add(k),I},[]);return F(h.length,0)||n.AddError({keyword:"uniqueItems",schemaPath:s,instancePath:a,params:{duplicateItems:h}})}function Hu(t,n){return $u(t)&&(Te(t.type)&&ys(t.type.length,0)&&Rn(t.type,0,(s)=>F(s,n))||F(t.type,n))}function Z8(t){return Hu(t,"object")}function eB(t){return Mn(t)&&(Zr(t)||yu(t)||xu(t)||$a(t)||co(t)||uo(t)||Na(t)||Ms(t)||wu(t)||xi(t)||Ko(t))}function tB(t){return Hu(t,"array")}function nB(t){return Mn(t)&&(Oa(t)||ao(t)||Fi(t)||ku(t)||Fa(t)||lo(t)||zo(t)||yi(t)||qo(t)||jo(t))}function rB(t){return Hu(t,"string")}function iB(t){return Mn(t)&&(Ps(t)||Tu(t)||As(t)||_s(t))}function oB(t){return Hu(t,"number")||Hu(t,"bigint")}function sB(t){return Mn(t)&&(gi(t)||vu(t)||bu(t)||hi(t)||Ru(t))}function ar(t,n,s,a){return n.UseUnevaluated()?Gn(Gn(n.Push(),gt(t,n,s,a)),n.Pop()):gt(t,n,s,a)}function gt(t,n,s,a){t.Push(s);let l=[];if(oo(s))return dT(t,n,s,a);if($u(s))l.push(SR(t,n,s,a));if(eB(s)){let f=[];if(xi(s))f.push(hR(t,n,s,a));if(Zr(s))f.push(nT(t,n,s,a));if(yu(s))f.push(xT(t,n,s,a));if(xu(s))f.push(bT(t,n,s,a));if($a(s))f.push(vT(t,n,s,a));if(uo(s))f.push(Yw(t,n,s,a));if(co(s))f.push(rR(t,n,s,a));if(Na(s))f.push(sR(t,n,s,a));if(Ms(s))f.push(Hw(t,n,s,a));if(wu(s))f.push(Rw(t,n,s,a));let h=Wn(f),g=Dt(rr(db(a)),h);l.push(Z8(s)?h:g)}if(nB(s)){let f=[];if(Oa(s))f.push(Zk(t,n,s,a));if(Fi(s))f.push(gT(t,n,s,a));if(ao(s))f.push(gw(t,n,s,a));if(ku(s))f.push(Sw(t,n,s,a));if(Fa(s))f.push(vw(t,n,s,a));if(lo(s))f.push(Pw(t,n,s,a));if(zo(s))f.push($w(t,n,s,a));if(yi(s))f.push(Zw(t,n,s,a));if(jo(s))f.push(LR(t,n,s,a));let h=Wn(f),g=Dt(rr(Gd(a)),h);l.push(tB(s)?h:g)}if(iB(s)){let f=[];if(Tu(s))f.push(Tw(t,n,s,a));if(Ps(s))f.push(Nw(t,n,s,a));if(As(s))f.push(dw(t,n,s,a));if(_s(s))f.push(Ww(t,n,s,a));let h=Wn(f),g=Dt(rr(fb(a)),h);l.push(rB(s)?h:g)}if(sB(s)){let f=[];if(bu(s))f.push(MT(t,n,s,a));if(hi(s))f.push(OT(t,n,s,a));if(vu(s))f.push(Cw(t,n,s,a));if(gi(s))f.push(_w(t,n,s,a));if(Ru(s))f.push(Bw(t,n,s,a));let h=Wn(f),g=Dt(rr(Dt(cb(a),ub(a))),h);l.push(oB(s)?h:g)}if(_u(s))l.push(mR(t,n,s,a));if(Mu(s))l.push(uR(t,n,s,a));if(Iu(s))l.push(wT(t,n,s,a));if(Em(s))l.push(fT(t,n,s,a));if(vm(s))l.push(AT(t,n,s,a));if(Cu(s))l.push(fw(t,n,s,a));if(Lu(s))l.push(zw(t,n,s,a));if(pu(s))l.push(oT(t,n,s,a));if(gu(s))l.push(lT(t,n,s,a));if(Au(s))l.push(qw(t,n,s,a));if(qo(s))l.push(Dt(rr(Gd(a)),ER(t,n,s,a)));if(Ko(s))l.push(Dt(rr(mb(a)),TR(t,n,s,a)));if(fu(s))l.push(Yk(t,n,s,a));let d=Wn(l);return t.Pop(s),d}function jr(t,n,s,a){return n.Push()&&mt(t,n,s,a)&&n.Pop()}function mt(t,n,s,a){t.Push(s);let l=oo(s)?Ig(t,n,s,a):(!$u(s)||bR(t,n,s,a))&&(!(Be(a)&&!Te(a))||(!xi(s)||gR(t,n,s,a))&&(!Zr(s)||rT(t,n,s,a))&&(!yu(s)||IT(t,n,s,a))&&(!xu(s)||CT(t,n,s,a))&&(!$a(s)||kT(t,n,s,a))&&(!uo(s)||Jw(t,n,s,a))&&(!co(s)||iR(t,n,s,a))&&(!Na(s)||aR(t,n,s,a))&&(!Ms(s)||Bg(t,n,s,a))&&(!wu(s)||Fg(t,n,s,a)))&&(!Te(a)||(!Oa(s)||eT(t,n,s,a))&&(!Fi(s)||bg(t,n,s,a))&&(!ao(s)||yw(t,n,s,a))&&(!ku(s)||Mg(t,n,s,a))&&(!Fa(s)||Og(t,n,s,a))&&(!lo(s)||Ng(t,n,s,a))&&(!zo(s)||Hg(t,n,s,a))&&(!yi(s)||eR(t,n,s,a))&&(!jo(s)||AR(t,n,s,a)))&&(!ct(a)||(!Tu(s)||$g(t,n,s,a))&&(!Ps(s)||Ug(t,n,s,a))&&(!As(s)||Pg(t,n,s,a))&&(!_s(s)||jg(t,n,s,a)))&&(!(ft(a)||Zt(a))||(!bu(s)||vg(t,n,s,a))&&(!hi(s)||kg(t,n,s,a))&&(!vu(s)||_g(t,n,s,a))&&(!gi(s)||Dg(t,n,s,a))&&(!Ru(s)||Gg(t,n,s,a)))&&(!_u(s)||fR(t,n,s,a))&&(!Mu(s)||cR(t,n,s,a))&&(!Iu(s)||RT(t,n,s,a))&&(!Em(s)||Sg(t,n,s,a))&&(!vm(s)||Eg(t,n,s,a))&&(!Cu(s)||pw(t,n,s,a))&&(!Lu(s)||zg(t,n,s,a))&&(!pu(s)||sT(t,n,s,a))&&(!gu(s)||uT(t,n,s,a))&&(!Au(s)||Kw(t,n,s,a))&&(!qo(s)||(!Te(a)||vR(t,n,s,a)))&&(!Ko(s)||(!Be(a)||wR(t,n,s,a)))&&(!fu(s)||Jk(t,n,s,a));return t.Pop(s),l}function qr(t,n,s,a,l,d){return n.Push()&&$t(t,n,s,a,l,d)&&n.Pop()}function $t(t,n,s,a,l,d){if(n.AtCapacity())return!1;t.Push(l);let f=oo(l)?mT(t,n,s,a,l,d):!!(+(!$u(l)||CR(t,n,s,a,l,d))&+(!(Be(d)&&!Te(d))||!!(+(!xi(l)||yR(t,n,s,a,l,d))&+(!Zr(l)||iT(t,n,s,a,l,d))&+(!yu(l)||ST(t,n,s,a,l,d))&+(!xu(l)||ET(t,n,s,a,l,d))&+(!$a(l)||TT(t,n,s,a,l,d))&+(!uo(l)||Qw(t,n,s,a,l,d))&+(!co(l)||oR(t,n,s,a,l,d))&+(!Na(l)||lR(t,n,s,a,l,d))&+(!Ms(l)||Uw(t,n,s,a,l,d))&+(!wu(l)||Lw(t,n,s,a,l,d))))&+(!Te(d)||!!(+(!Oa(l)||tT(t,n,s,a,l,d))&+(!Fi(l)||yT(t,n,s,a,l,d))&+(!ao(l)||xw(t,n,s,a,l,d))&+(!ku(l)||bw(t,n,s,a,l,d))&+(!Fa(l)||kw(t,n,s,a,l,d))&+(!lo(l)||Mw(t,n,s,a,l,d))&+(!zo(l)||Fw(t,n,s,a,l,d))&+(!yi(l)||tR(t,n,s,a,l,d))&+(!jo(l)||PR(t,n,s,a,l,d))))&+(!ct(d)||!!(+(!Tu(l)||ww(t,n,s,a,l,d))&+(!Ps(l)||Dw(t,n,s,a,l,d))&+(!As(l)||mw(t,n,s,a,l,d))&+(!_s(l)||Xw(t,n,s,a,l,d))))&+(!(ft(d)||Zt(d))||!!(+(!bu(l)||_T(t,n,s,a,l,d))&+(!hi(l)||$T(t,n,s,a,l,d))&+(!vu(l)||Ew(t,n,s,a,l,d))&+(!gi(l)||Ow(t,n,s,a,l,d))&+(!Ru(l)||Gw(t,n,s,a,l,d))))&+(!_u(l)||pR(t,n,s,a,l,d))&+(!Mu(l)||dR(t,n,s,a,l,d))&+(!Iu(l)||LT(t,n,s,a,l,d))&+(!Em(l)||pT(t,n,s,a,l,d))&+(!vm(l)||PT(t,n,s,a,l,d))&+(!Cu(l)||hw(t,n,s,a,l,d))&+(!Lu(l)||jw(t,n,s,a,l,d))&+(!pu(l)||aT(t,n,s,a,l,d))&+(!gu(l)||cT(t,n,s,a,l,d))&+(!Au(l)||Vw(t,n,s,a,l,d))&+(!qo(l)||(!Te(d)||kR(t,n,s,a,l,d)))&+(!Ko(l)||(!Be(d)||RR(t,n,s,a,l,d))))&&(!fu(l)||Qk(t,n,s,a,l,d));return t.Pop(l),f}var MR=[0],ef=new Map,Uu=new Map;function aB(){return`${MR[0]++}`}function lB(t,n){if(!ef.has(t))ef.set(t,new Map);let s=ef.get(t);if(s.has(n))return s.get(n);let a=aB();return s.set(n,a),a}function uB(t,n,s,a){return t.UseUnevaluated()?Bt(`check_${s}`,["context",a]):Bt(`check_${s}`,[a])}function cB(t,n,s,a){let l=gt(t,n,s,"value");return n.UseUnevaluated()?to(`check_${a}`,Po(["context","value"],l)):to(`check_${a}`,Po(["value"],l))}function _R(){MR[0]=0,ef.clear(),Uu.clear()}function OR(){return[...Uu.values()]}function mo(t,n,s,a){let l=lB(s,t.LexicalBaseURL()),d=uB(n,s,l,a);if(Uu.has(l))return d;return Uu.set(l,""),Uu.set(l,cB(t,n,s,l)),d}function dB(t,n){return Be(n)&&!Nl(t)?n[t]:void 0}function mB(t,n){return t.reduce((s,a)=>dB(a,s),n)}function fB(t){if(F(t.length,0))return[];let n=t.split("/").map((s)=>s.replace(/~1/g,"/").replace(/~0/g,"~"));return n.length>0&&n[0]===""?n.slice(1):n}function pB(t,n){let s=fB(n);return mB(s,t)}var nf="https://json-schema.org";function FR(t,n){if(Be(t)&&so(t)&&F(t.$dynamicAnchor,n))return t;if(Be(t))for(let s of pe(t)){let a=FR(t[s],n);if(a)return a}return}function Wg(t,n,s){if(F(t,s))return n.href;let a=Mn(t)&&zr(t)?new URL(t.$id,n.href):n;if(Te(t))for(let l of t){let d=Wg(l,a,s);if(!bt(d))return d}else if(Be(t))for(let l of pe(t)){let d=Wg(t[l],a,s);if(!bt(d))return d}return}function hB(t,n,s){if(F(t.$id,s.hash))return t;let a=new URL(s.href,n.href);if(F(n.pathname,a.pathname))return s.hash.startsWith("#")?NR(t,s):t;return}function gB(t,n,s){let a=new URL(`#${t.$anchor}`,n.href),l=new URL(s.href,n.href);return F(a.href,l.href)?t:void 0}function yB(t,n,s){let a=new URL(`#${t.$dynamicAnchor}`,n.href),l=new URL(s.href,n.href);return F(a.href,l.href)?t:void 0}function NR(t,n){if(n.href.endsWith("#"))return t;if(!n.hash.startsWith("#"))return;let s=decodeURIComponent(n.hash.slice(1));if(!s.startsWith("/"))return;return pB(t,s)}function xB(t,n,s){if(zr(t)){let a=hB(t,n,s);if(!bt(a))return a}if(hu(t)){let a=gB(t,n,s);if(!bt(a))return a}if(so(t)){let a=yB(t,n,s);if(!bt(a))return a}return NR(t,s)}function IB(t,n,s){return t.reduce((a,l)=>{let d=rf(l,n,s);return!bt(d)?d:a},void 0)}function SB(t){return F(t,"const")||F(t,"enum")}function bB(t,n,s){return pe(t).reduce((a,l)=>{if(SB(l))return a;let d=rf(t[l],n,s);return!bt(d)?d:a},void 0)}function rf(t,n,s){let a=Mn(t)&&zr(t)?new URL(t.$id,n.href):n;if(Mn(t)){let l=xB(t,a,s);if(!bt(l))return l}if(Te(t))return IB(t,a,s);if(Be(t))return bB(t,a,s);return}function CB(t,n,s){return Wg(t,new URL(n||".",nf),s)}function EB(t,n,s,a){let l=of(t,n,s,a,!1);return Mn(l)&&zr(l)?l:void 0}function $R(t){return t.href.split("#")[0]}function vB(t,n){return Y(t,n)?t[n]:void 0}function kB(t,n,s){return rf(t,n,s)}function TB(t,n,s){let a=$R(s);if(F(a,$R(n)))return;if(!Y(t,a))return;let l=t[a],d=Mn(l)&&zr(l)?new URL(l.$id,a):new URL(a);return F(s.hash,"")?l:rf(l,d,s)}function wB(t,n,s,a,l){if(!a.$ref.startsWith("#"))return;if(Y(t,"$schema"))return;let d=CB(n,s,l);if(bt(d)||F(d,s))return;return{target:l,base:d,root:n}}function RB(t,n,s){let a=t[n];if(!Mn(a))return;return{target:s,base:n,root:a}}function LB(t,n,s,a,l){let d=l?RB(t.context,a,s):void 0;if(!bt(d))return d;return wB(t.root,t.lexicalSchema,t.referenceBase,n,s)}function AB(t,n,s,a,l,d){if(zr(l))return;let f=EB(t,n,s,a);if(!f||d.includes(f))return;return{target:l,resource:f}}function of(t,n,s,a,l=!0){let d=new URL(s||".",nf),f=l&&zr(n)?new URL(n.$id,d):d,h=new URL(a,f.href);return vB(t,a)??kB(n,f,h)??TB(t,f,h)}function PB(t,n,s,a,l,d){let f=new URL(s||".",nf),h=l.$dynamicRef.startsWith("#")?a:n,g=of(t,h,s,l.$dynamicRef,!1);if(bt(g)){let v=new URL(l.$dynamicRef,f).hash;if(!v.startsWith("#/")&&v.startsWith("#")){let k=decodeURIComponent(v.slice(1));return d.find((P)=>F(P.$dynamicAnchor,k))??FR(n,k)}return}if(!Mn(g)||!so(g))return g;if(new URL(l.$dynamicRef,f).hash.startsWith("#/"))return g;return d.find((v)=>F(v.$dynamicAnchor,g.$dynamicAnchor))??g}function MB(t,n){let s=t.inRetrievedFrame?t.lexicalSchema:t.root,a=n.$ref.startsWith("#")?t.lexicalSchema:s,l=of(t.context,a,t.referenceBase,n.$ref,!1);if(!l||!Mn(l))return{schema:l};let d=new URL(n.$ref,t.referenceBase).href.split("#")[0],f=!F(d,t.resourceBase),h=LB(t,n,l,d,f),g=f?AB(t.context,t.root,t.referenceBase,d,l,t.ids):void 0;return{schema:l,retrievedResource:h,resolvedResource:g}}function _B(t,n){let s=Pu(t.lexicalSchema)?t.recursiveAnchors[0]:t.lexicalSchema;return of(t.context,s,t.lexicalBase,n.$recursiveRef,!1)}function OB(t,n){return PB(t.context,t.root,t.lexicalBase,t.lexicalSchema,n,t.dynamicAnchors)}var Qt=function(t,n,s,a){if(s==="a"&&!a)throw TypeError("Private accessor was defined without a getter");if(typeof n==="function"?t!==n||!a:!n.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?a:s==="a"?a.call(t):a?a.value:n.get(t)},qt,af,zR,Qg,sf,DR,HR,UR,BR,Yg,Jg,Zg,ey,GR,jR;class Wo{constructor(t,n){qt.add(this),this.context=t,this.schema=n,this.ids=[],this.resourceIds=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[],this.retrievedResources=new Map,this.retrievedFrames=[],this.resolvedResources=new Map,this.pendingResource=!0}LexicalBaseURL(){return Qt(this,qt,"m",Qg).call(this,this.ids)}Push(t){if(!Mn(t))return;if(zr(t))Qt(this,qt,"m",Zg).call(this,t);if(hu(t))this.anchors.push(t);if(Pu(t))this.recursiveAnchors.push(t);if(so(t))this.dynamicAnchors.push(t);let n=this.retrievedResources.get(t);if(n)this.retrievedFrames.push({schema:n.root,base:n.base,idDepth:this.ids.length,resourceDepth:this.resourceIds.length})}Pop(t){if(!Mn(t))return;if(zr(t))Qt(this,qt,"m",ey).call(this,t);if(hu(t))this.anchors.pop();if(Pu(t))this.recursiveAnchors.pop();if(so(t))this.dynamicAnchors.pop();if(this.retrievedResources.has(t))this.retrievedFrames.pop();Qt(this,qt,"m",jR).call(this,t)}Ref(t){let n=MB(Qt(this,qt,"m",af).call(this),t);return Qt(this,qt,"m",zR).call(this,n),n.schema}RecursiveRef(t){let n=_B(Qt(this,qt,"m",af).call(this),t);if(n)this.pendingResource=!0;return n}DynamicRef(t){let n=OB(Qt(this,qt,"m",af).call(this),t);if(n)this.pendingResource=!0;return n}}qt=new WeakSet,af=function(){return{context:this.context,root:this.schema,ids:this.ids,lexicalSchema:Qt(this,qt,"m",HR).call(this),lexicalBase:this.LexicalBaseURL(),referenceBase:Qt(this,qt,"m",DR).call(this),resourceBase:Qt(this,qt,"m",sf).call(this),recursiveAnchors:this.recursiveAnchors,dynamicAnchors:this.dynamicAnchors,inRetrievedFrame:this.retrievedFrames.length>0}},zR=function(n){if(!bt(n.schema))this.pendingResource=!0;if(!bt(n.resolvedResource))Qt(this,qt,"m",GR).call(this,n.resolvedResource.target,n.resolvedResource.resource);if(!bt(n.retrievedResource))this.retrievedResources.set(n.retrievedResource.target,{base:n.retrievedResource.base,root:n.retrievedResource.root})},Qg=function(n){let s=this.retrievedFrames[this.retrievedFrames.length-1],a=s?new URL(s.base):new URL(nf);return(s?n.slice(s.idDepth):n).reduce((d,f)=>new URL(f.$id,d),a).href},sf=function(){let n=this.retrievedFrames[this.retrievedFrames.length-1];if(!n)return Qt(this,qt,"m",Qg).call(this,this.resourceIds);return this.resourceIds.slice(n.resourceDepth).reduce((s,a)=>new URL(a.$id,s),new URL(n.base)).href},DR=function(){if(this.retrievedFrames.length>0)return Qt(this,qt,"m",sf).call(this);let n=this.ids[this.ids.length-1];if(n&&!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(n.$id))return this.LexicalBaseURL();return Qt(this,qt,"m",sf).call(this)},HR=function(){let n=this.retrievedFrames[this.retrievedFrames.length-1];if(n)return this.ids.length>n.idDepth?this.ids[this.ids.length-1]:n.schema;return this.ids.length>0?this.ids[this.ids.length-1]:this.schema},UR=function(n){n.forEach((s)=>Qt(this,qt,"m",Yg).call(this,s,!1))},BR=function(n){n.forEach((s)=>Qt(this,qt,"m",Jg).call(this,s,!1))},Yg=function t(n,s=!0){if(oo(n))return;if(Te(n))return Qt(this,qt,"m",UR).call(this,n);if(!Mn(n))return;let a=n;if(!s&&zr(a))return;if(!s&&so(a))this.dynamicAnchors.push(a);for(let l of pe(a))Qt(this,qt,"m",t).call(this,a[l],!1)},Jg=function t(n,s=!0){if(oo(n))return;if(Te(n))return Qt(this,qt,"m",BR).call(this,n);if(!Mn(n))return;let a=n;if(!s&&zr(a))return;if(!s&&so(a))this.dynamicAnchors.pop();for(let l of pe(a))Qt(this,qt,"m",t).call(this,a[l],!1)},Zg=function(n){this.ids.push(n);let s=this.pendingResource;if(this.pendingResource=!1,s)this.resourceIds.push(n);Qt(this,qt,"m",Yg).call(this,n,!0)},ey=function(n){if(this.ids.pop(),this.resourceIds.length>0&&F(this.resourceIds[this.resourceIds.length-1],n))this.resourceIds.pop();Qt(this,qt,"m",Jg).call(this,n,!0)},GR=function(n,s){Qt(this,qt,"m",Zg).call(this,s),this.resolvedResources.set(n,s)},jR=function(n){if(!this.resolvedResources.has(n))return;let s=this.resolvedResources.get(n);Qt(this,qt,"m",ey).call(this,s),this.resolvedResources.delete(n)};function $B(t){let n=t.Functions().join(`;
|
|
311
|
-
`),s=t.UseUnevaluated()?["const context = new CheckContext({}, {})",`return ${t.Entry()}`]:[`return ${t.Entry()}`];return`${n}; return (value) => { ${s.join("; ")} }`}function FB(t,n){return Pb("CheckContext","Guard","Format","Hashing",t.External().identifier,n)(er,H,Ga,vs,t.External().variables)}function NB(t){let n=new Wo(t.Context(),t.Schema()),s=new er;return(a)=>mt(n,s,t.Schema(),a)}function DB(t,n){return Ab()?FB(t,n):NB(t)}class qR{constructor(t,n,s){this.isAccelerated=t,this.code=n,this.check=s}IsAccelerated(){return this.isAccelerated}Code(){return this.code}Check(t){return this.check(t)}}class KR{constructor(t,n,s,a,l,d){this.context=t,this.schema=n,this.external=s,this.functions=a,this.entry=l,this.useUnevaluated=d}Context(){return this.context}Schema(){return this.schema}UseUnevaluated(){return this.useUnevaluated}External(){return this.external}Functions(){return this.functions}Entry(){return this.entry}Evaluate(){let t=$B(this),n=DB(this,t);return new qR(Ab(),t,n)}}function lf(...t){let[n,s]=dr(t,{2:(g,I)=>[g,I],1:(g)=>[{},g]});Wk(),_R();let a=new Wo(n,s),l=new gg(Vk(n,s)),d=mo(a,l,s,"value"),f=OR(),h=Xk();return new KR(n,s,h,f,d,l.UseUnevaluated())}function uf(...t){let[n,s,a]=dr(t,{3:(b,v,k)=>[b,v,k],2:(b,v)=>[{},b,v]}),l=new Wo(n,s),d=new tr,f=$t(l,d,"#","",s,a),h=d.GetErrors(),g=Ub(),I=h.map((b)=>({...b,message:g(b)}));return[f,I]}function ny(...t){let[n,s,a]=dr(t,{3:(f,h,g)=>[f,h,g],2:(f,h)=>[{},f,h]}),l=new Wo(n,s),d=new er;return mt(l,d,s,a)}function wt(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return ny(n,s,a)}function bi(...t){let[n,s,a]=dr(t,{3:(f,h,g)=>[f,h,g],2:(f,h)=>[{},f,h]}),[l,d]=uf(n,s,a);return d}class Os extends Error{constructor(t,n,s){super(t);Object.defineProperty(this,"cause",{value:{source:t,errors:s,value:n},writable:!1,configurable:!1,enumerable:!1})}}function VR(t,n,s){if(!Te(s))return s;return s.map((a)=>_n(t,n.items,a))}function WR(t,n,s){return _n({...t,...n.$defs},Xn(n.$ref),s)}function BB(t,n){let s=Y(n,"unevaluatedProperties")?{additionalProperties:n.unevaluatedProperties}:{},a=pi(t,n),l=Qn(a);return Re(l)?mg(l,s):l}function XR(t,n,s){let a=BB(t,n);return _n(t,a,s)}function cf(t){return Y(t,"additionalProperties")?t.additionalProperties:void 0}function YR(t,n,s){if(!Be(s)||Te(s))return s;let a=cf(n);for(let l of pe(s)){if(Y(n.properties,l)){s[l]=_n(t,n.properties[l],s[l]);continue}if(wn(a)&&F(a,!0)||ln(a)&&wt(t,a,s[l])){s[l]=_n(t,a,s[l]);continue}delete s[l]}return s}function JR(t,n,s){if(!Be(s))return s;let a=cf(n),[l,d]=[new RegExp(Un(n)),zt(n)];for(let f of pe(s)){if(l.test(f)){s[f]=_n(t,d,s[f]);continue}if(wn(a)&&F(a,!0)||ln(a)&&wt(t,a,s[f])){s[f]=_n(t,a,s[f]);continue}delete s[f]}return s}function QR(t,n,s){return Y(t,n.$ref)?_n(t,t[n.$ref],s):s}function ZR(t,n,s){if(!Te(s))return s;let a=Math.min(s.length,n.items.length);for(let l=0;l<a;l++)s[l]=_n(t,n.items[l],s[l]);return ys(s.length,a)?s.slice(0,a):s}function nn(t){return Ia(t)}function eL(t,n,s){for(let a of n.anyOf){let l=_n(t,a,nn(s));if(wt(t,a,l))return l}return s}function _n(t,n,s){return lt(n)?VR(t,n,s):_t(n)?WR(t,n,s):we(n)?XR(t,n,s):Re(n)?YR(t,n,s):vt(n)?JR(t,n,s):Ct(n)?QR(t,n,s):Ve(n)?ZR(t,n,s):se(n)?eL(t,n,s):s}function GB(t,n){for(let s of pe(t)){if(Y(n,s))continue;n[s]=t[s]}return n}function zB(t){let n={};for(let s of pe(t))n[s]=Bu(t[s]);return n}function jB(t){return ry(Kk(t))}function ry(t){return t.map((n)=>Bu(n))}function Bu(t){let n=lt(t)?x(Bu(t.items),Sa(t)):we(t)?Cr(ry(t.allOf)):se(t)?i(jB(t.anyOf)):Re(t)?r(zB(t.properties)):vt(t)?Jl(Ts(t),Bu(zt(t))):Ve(t)?Sn(ry(t.items)):t;return GB(t,n)}function za(t){return Bu(t)}function ti(...t){let[n,s,a]=dr(t,{3:(d,f,h)=>[d,f,h],2:(d,f)=>[{},d,f]}),l=Jr().unionPrioritySort?za(s):s;return _n(n,l,a)}function Tr(t){return Be(t)&&Y(t,"value")}function ve(t){return{value:t}}function Kt(){return}function qB(t){return Te(t)?ve(t):ve([t])}function KB(t){return F(t,!0)?ve(BigInt(1)):ve(BigInt(0))}var VB=/^-?(0|[1-9]\d*)n$/,WB=/^-?(0|[1-9]\d*)\.\d+$/,XB=/^-?(0|[1-9]\d*)$/;function YB(t){return VB.test(t)}function JB(t){return WB.test(t)}function QB(t){return XB.test(t)}function ZB(t){let n=t.toLowerCase();return YB(t)?ve(BigInt(t.slice(0,t.length-1))):JB(t)?ve(BigInt(t.split(".")[0])):QB(t)?ve(BigInt(t)):F(n,"false")?ve(BigInt(0)):F(n,"true")?ve(BigInt(1)):Kt()}function df(t){return Zt(t)?ve(t):wn(t)?KB(t):ft(t)?ve(BigInt(Math.trunc(t))):Or(t)?ve(BigInt(0)):ct(t)?ZB(t):bt(t)?ve(BigInt(0)):Kt()}function eG(t){return F(t,BigInt(0))?ve(!1):F(t,BigInt(1))?ve(!0):Kt()}function tG(t){return F(t,0)?ve(!1):F(t,1)?ve(!0):Kt()}function nG(t){return F(t.toLowerCase(),"false")?ve(!1):F(t.toLowerCase(),"true")?ve(!0):F(t,"0")?ve(!1):F(t,"1")?ve(!0):Kt()}function tL(t){return Zt(t)?eG(t):wn(t)?ve(t):ft(t)?tG(t):Or(t)?ve(!1):ct(t)?nG(t):bt(t)?ve(!1):Kt()}function rG(t){return F(t,BigInt(0))?ve(null):Kt()}function iG(t){return F(t,!1)?ve(null):Kt()}function oG(t){return F(t,0)?ve(null):Kt()}function sG(t){let n=t.toLowerCase();return F(n,"undefined")||F(n,"null")||F(t,"")||F(t,"0")?ve(null):Kt()}function aG(t){return Zt(t)?rG(t):wn(t)?iG(t):ft(t)?oG(t):Or(t)?ve(null):ct(t)?sG(t):bt(t)?ve(null):Kt()}var nL=BigInt(Number.MAX_SAFE_INTEGER),rL=BigInt(Number.MIN_SAFE_INTEGER);function lG(t){return t<=nL&&t>=rL?ve(Number(t)):Kt()}function uG(t){return ve(t?1:0)}function cG(t){let n=+t;if(ft(n))return ve(n);let s=t.toLowerCase();if(F(s,"false"))return ve(0);if(F(s,"true"))return ve(1);let a=df(t);if(Tr(a))return a.value<=nL&&a.value>=rL?ve(Number(a.value)):Kt();return Kt()}function iy(t){return Zt(t)?lG(t):wn(t)?uG(t):ft(t)?ve(t):Or(t)?ve(0):ct(t)?cG(t):bt(t)?ve(0):Kt()}function iL(t){return Zt(t)?ve(t.toString()):wn(t)?ve(t.toString()):ft(t)?ve(t.toString()):Or(t)?ve("null"):ct(t)?ve(t):bt(t)?ve(""):Kt()}function dG(t){return F(t,BigInt(0))?ve(void 0):Kt()}function mG(t){return F(t,!1)?ve(void 0):Kt()}function fG(t){return F(t,0)?ve(void 0):Kt()}function pG(t){let n=t.toLowerCase();return F(n,"undefined")||F(n,"null")||F(t,"")||F(t,"0")?ve(void 0):Kt()}function oL(t){return Zt(t)?dG(t):wn(t)?mG(t):ft(t)?fG(t):Or(t)?ve(void 0):ct(t)?pG(t):bt(t)?ve(t):Kt()}function sL(t,n,s){return qB(s).value.map((l)=>rn(t,n.items,l))}function aL(t,n,s){let a=df(s);return Tr(a)?a.value:s}function lL(t,n,s){let a=tL(s);return Tr(a)?a.value:s}function uL(t,n,s){return rn({...t,...n.$defs},Xn(n.$ref),s)}function cL(t,n,s){return rn(t,Qn(n),s)}function dL(t,n,s){let a=iy(s);return Tr(a)?Math.trunc(a.value):s}function mL(t,n,s){let a=pi(t,n),l=Qn(a);return rn(t,l,s)}function hG(t,n,s){let a=df(s);return Tr(a)&&F(n.const,a.value)?a.value:s}function gG(t,n,s){let a=tL(s);return Tr(a)&&F(n.const,a.value)?a.value:s}function yG(t,n,s){let a=iy(s);return Tr(a)&&F(n.const,a.value)?a.value:s}function xG(t,n,s){let a=iL(s);return Tr(a)&&F(n.const,a.value)?a.value:s}function fL(t,n,s){if(F(n.const,s))return s;return jb(n)?hG(t,n,s):qb(n)?gG(t,n,s):Qd(n)?yG(t,n,s):Zd(n)?xG(t,n,s):cn()}function pL(t,n,s){let a=aG(s);return Tr(a)?a.value:s}function hL(t,n,s){let a=iy(s);return Tr(a)?a.value:s}function mf(t,n,s,a){let l=pe(a);for(let[d,f]of n)for(let h of l)if(!d.test(h))a[h]=rn(t,s,a[h]);return a}function Gu(t,n,s){return An(t)&&bt(s[n])}function IG(t,n,s){let a=ih(n.properties),l=pe(s);for(let[d,f]of a)for(let h of l){if(!d.test(h)||Gu(f,h,s))continue;s[h]=rn(t,f,s[h])}return Y(n,"additionalProperties")&&Be(n.additionalProperties)?mf(t,a,n.additionalProperties,s):s}function gL(t,n,s){return eo(s)?IG(t,n,s):s}function SG(t,n,s){let a=ih(n.patternProperties),l=pe(s);for(let[d,f]of a)for(let h of l)if(d.test(h))s[h]=rn(t,f,s[h]);return Y(n,"additionalProperties")&&Be(n.additionalProperties)?mf(t,a,n.additionalProperties,s):s}function yL(t,n,s){return eo(s)?SG(t,n,s):s}function xL(t,n,s){return Y(t,n.$ref)?rn(t,t[n.$ref],s):s}function IL(t,n,s){let a=iL(s);return Tr(a)?a.value:s}function SL(t,n,s){return rn(t,Qn(n),s)}function bL(t,n,s){if(!Te(s))return s;for(let a=0;a<Math.min(n.items.length,s.length);a++)s[a]=rn(t,n.items[a],s[a]);return s}function CL(t,n,s){let a=oL(s);return Tr(a)?a.value:s}function EL(t,n,s){if(n.anyOf.some((f)=>wt(t,f,s)))return s;let d=n.anyOf.map((f)=>rn(t,f,nn(s))).find((f)=>wt(t,n,f));return bt(d)?s:d}function vL(t,n,s){let a=oL(s);return Tr(a)?void 0:s}function rn(t,n,s){return lt(n)?sL(t,n,s):Dr(n)?aL(t,n,s):mr(n)?lL(t,n,s):_t(n)?uL(t,n,s):In(n)?cL(t,n,s):zn(n)?dL(t,n,s):we(n)?mL(t,n,s):Ye(n)?fL(t,n,s):ro(n)?pL(t,n,s):tn(n)?hL(t,n,s):Re(n)?gL(t,n,s):vt(n)?yL(t,n,s):Ct(n)?xL(t,n,s):Pn(n)?IL(t,n,s):Ft(n)?SL(t,n,s):Ve(n)?bL(t,n,s):Ai(n)?CL(t,n,s):se(n)?EL(t,n,s):Hr(n)?vL(t,n,s):s}function Ni(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return rn(n,s,a)}function kL(t,n,s){if(!Te(s))return s;for(let a=0;a<s.length;a++)s[a]=On(t,n.items,s[a]);return s}function TL(t,n,s){return On({...t,...n.$defs},Xn(n.$ref),s)}function wL(t,n){if(!bt(n))return n;return Ao(t.default)?t.default():nn(t.default)}function RL(t,n,s){let a=pi(t,n),l=Qn(a);return On(t,l,s)}function LL(t,n,s){if(!Be(s))return s;let a=pe(n.properties);for(let l of a){let d=On(t,n.properties[l],s[l]);if(bt(d)&&(An(n.properties[l])||!Y(n.properties[l],"default")))continue;s[l]=d}if(!Zr(n)||wn(n.additionalProperties))return s;for(let l of pe(s)){if(a.includes(l))continue;s[l]=On(t,n.additionalProperties,s[l])}return s}function AL(t,n,s){if(!Be(s))return s;let[a,l]=[new RegExp(Un(n)),zt(n)];for(let d of pe(s)){if(!(a.test(d)&&Gr(l)))continue;s[d]=On(t,l,s[d])}if(!Zr(n))return s;for(let d of pe(s)){if(a.test(d))continue;s[d]=On(t,n.additionalProperties,s[d])}return s}function PL(t,n,s){return Y(t,n.$ref)?On(t,t[n.$ref],s):s}function ML(t,n,s){if(!Te(s))return s;let[a,l]=[n.items,Math.max(n.items.length,s.length)];for(let d=0;d<l;d++)if(d<a.length)s[d]=On(t,a[d],s[d]);return s}function _L(t,n,s){for(let a of n.anyOf){let l=On(t,a,nn(s));if(wt(t,a,l))return l}return s}function On(t,n,s){let a=Gr(n)?wL(n,s):s;return lt(n)?kL(t,n,a):_t(n)?TL(t,n,a):we(n)?RL(t,n,a):Re(n)?LL(t,n,a):vt(n)?AL(t,n,a):Ct(n)?PL(t,n,a):Ve(n)?ML(t,n,a):se(n)?_L(t,n,a):a}function fo(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return On(n,s,a)}function ja(t){return(...n)=>{let[s,a,l]=dr(n,{3:(d,f,h)=>[d,f,h],2:(d,f)=>[{},d,f]});return t.reduce((d,f)=>f(s,a,d),l)}}function bG(t,n,s){return n["~codec"].decode(s)}function CG(t,n,s){return n["~codec"].encode(s)}function Vt(t,n,s,a){if(!Nr(s))return a;return F(t,"Decode")?bG(n,s,a):CG(n,s,a)}function EG(t,n,s,a){if(!Te(a))return a;for(let l=0;l<a.length;l++)a[l]=Yt(t,n,s.items,a[l]);return Vt(t,n,s,a)}function vG(t,n,s,a){let l=Vt(t,n,s,a);if(!Te(l))return l;for(let d=0;d<l.length;d++)l[d]=Yt(t,n,s.items,l[d]);return l}function OL(t,n,s,a){return F(t,"Decode")?EG(t,n,s,a):vG(t,n,s,a)}function $L(t,n,s,a){return a=Yt(t,{...n,...s.$defs},Xn(s.$ref),a),Vt(t,n,s,a)}function FL(t){return t.reduce((n,s)=>({...n,...s}),{})}function NL(t,n){for(let s of n)if(!xa(t,s))return s;return t}function kG(t,n,s,a){if(F(s.allOf.length,0))return Vt(t,n,s,a);let l=s.allOf.map((h)=>Yt(t,n,h,ti(h,nn(a)))),f=l.every((h)=>Be(h))?FL(l):NL(a,l);return Vt(t,n,s,f)}function TG(t,n,s,a){if(F(s.allOf.length,0))return Vt(t,n,s,a);let l=Vt(t,n,s,a),d=s.allOf.map((h)=>Yt(t,n,h,ti(h,nn(l))));if(d.every((h)=>Be(h)))return FL(d);return NL(l,d)}function DL(t,n,s,a){return F(t,"Decode")?kG(t,n,s,a):TG(t,n,s,a)}function wG(t,n,s,a){if(!eo(a))return a;for(let l of pe(s.properties)){if(!Y(a,l)||Gu(s.properties[l],l,a))continue;a[l]=Yt(t,n,s.properties[l],a[l])}return Vt(t,n,s,a)}function RG(t,n,s,a){let l=Vt(t,n,s,a);if(!eo(l))return l;for(let d of pe(s.properties)){if(!Y(l,d)||Gu(s.properties[d],d,l))continue;l[d]=Yt(t,n,s.properties[d],l[d])}return l}function HL(t,n,s,a){return F(t,"Decode")?wG(t,n,s,a):RG(t,n,s,a)}function LG(t,n,s,a){if(!eo(a))return a;let l=new RegExp(Un(s));for(let d of pe(a)){if(!l.test(d))continue;a[d]=Yt(t,n,zt(s),a[d])}return Vt(t,n,s,a)}function AG(t,n,s,a){let l=Vt(t,n,s,a);if(!eo(l))return l;let d=new RegExp(Un(s));for(let f of pe(l)){if(!d.test(f))continue;l[f]=Yt(t,n,zt(s),l[f])}return l}function UL(t,n,s,a){return F(t,"Decode")?LG(t,n,s,a):AG(t,n,s,a)}function BL(t,n,s,a){return Y(n,s.$ref)?Yt(t,n,n[s.$ref],a):a}function GL(t,n,s,a){return F(t,"Decode")?Vt(t,n,s,BL(t,n,s,a)):BL(t,n,s,Vt(t,n,s,a))}function PG(t,n,s,a){if(!Te(a))return a;for(let l=0;l<Math.min(s.items.length,a.length);l++)a[l]=Yt(t,n,s.items[l],a[l]);return Vt(t,n,s,a)}function MG(t,n,s,a){let l=Vt(t,n,s,a);if(!Te(l))return a;for(let d=0;d<Math.min(s.items.length,l.length);d++)l[d]=Yt(t,n,s.items[d],l[d]);return l}function zL(t,n,s,a){return F(t,"Decode")?PG(t,n,s,a):MG(t,n,s,a)}function _G(t,n,s,a){for(let l of s.anyOf){if(!wt(n,l,a))continue;let d=Yt(t,n,l,a);return Vt(t,n,s,d)}return a}function OG(t,n,s,a){let l=Vt(t,n,s,a);for(let d of s.anyOf){let f=Yt(t,n,d,nn(l));if(!wt(n,d,f))continue;return f}return l}function jL(t,n,s,a){return F(t,"Decode")?_G(t,n,s,a):OG(t,n,s,a)}function Yt(t,n,s,a){return lt(s)?OL(t,n,s,a):_t(s)?$L(t,n,s,a):we(s)?DL(t,n,s,a):Re(s)?HL(t,n,s,a):vt(s)?UL(t,n,s,a):Ct(s)?GL(t,n,s,a):Ve(s)?zL(t,n,s,a):se(s)?jL(t,n,s,a):Vt(t,n,s,a)}class qL extends Os{constructor(t,n){super("Decode",t,n)}}function $G(t,n,s){if(!wt(t,n,s))throw new qL(s,bi(t,n,s));return s}function FG(t,n,s){let a=Jr().unionPrioritySort?za(n):n;return Yt("Decode",t,a,s)}var NG=ja([(t,n,s)=>nn(s),(t,n,s)=>fo(t,n,s),(t,n,s)=>Ni(t,n,s),(t,n,s)=>ti(t,n,s),(t,n,s)=>$G(t,n,s),(t,n,s)=>FG(t,n,s)]);function oy(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return NG(n,s,a)}class KL extends Os{constructor(t,n){super("Encode",t,n)}}function DG(t,n,s){if(!wt(t,n,s))throw new KL(s,bi(t,n,s));return s}function HG(t,n,s){let a=Jr().unionPrioritySort?za(n):n;return Yt("Encode",t,a,s)}var UG=ja([(t,n,s)=>nn(s),(t,n,s)=>HG(t,n,s),(t,n,s)=>fo(t,n,s),(t,n,s)=>Ni(t,n,s),(t,n,s)=>ti(t,n,s),(t,n,s)=>DG(t,n,s)]);function sy(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return UG(n,s,a)}function BG(t,n){return Nr(n)||Xo(t,n.items)}function GG(t,n){return Nr(n)||VL({...t,...n.$defs},Xn(n.$ref))}function zG(t,n){return Nr(n)||n.allOf.some((s)=>Xo(t,s))}function jG(t,n){return Nr(n)||pe(n.properties).some((s)=>Xo(t,n.properties[s]))}function qG(t,n){return Nr(n)||Xo(t,zt(n))}function VL(t,n){if(ay.has(n.$ref))return!1;return ay.add(n.$ref),Nr(n)||Y(t,n.$ref)&&Xo(t,t[n.$ref])}function KG(t,n){return Nr(n)||n.items.some((s)=>Xo(t,s))}function VG(t,n){return Nr(n)||n.anyOf.some((s)=>Xo(t,s))}function Xo(t,n){return lt(n)?BG(t,n):_t(n)?GG(t,n):we(n)?zG(t,n):Re(n)?jG(t,n):vt(n)?qG(t,n):Ct(n)?VL(t,n):Ve(n)?KG(t,n):se(n)?VG(t,n):Nr(n)}var ay=new Set;function ly(...t){let[n,s]=dr(t,{2:(a,l)=>[a,l],1:(a)=>[{},a]});return ay.clear(),Xo(n,s)}class Ei extends Error{constructor(t,n){super(n);this.type=t}}function WL(t,n){return Ao(n.default)?n.default(n):Be(n.default)?nn(n.default):n.default}function XL(t,n){if(jo(n)&&!Gr(n))throw new Ei(n,"Arrays with uniqueItems constraints must specify a default annotation");let s=zo(n)?n.minItems:0;return Array.from({length:s},()=>on(t,n.items))}function YL(t,n){return hi(n)?BigInt(n.exclusiveMinimum)+BigInt(1):gi(n)?BigInt(n.minimum):BigInt(0)}function JL(t,n){return!1}function QL(t,n){let s=on(t,n.instanceType);return class{constructor(){Object.assign(this,s)}}}function ZL(t,n){return on({...t,...n.$defs},Xn(n.$ref))}function e1(t,n){return on(t,Qn(n))}function t1(t,n){let s=on(t,n.returnType);return()=>s}function n1(t,n){return hi(n)&&ft(n.exclusiveMinimum)?n.exclusiveMinimum+1:gi(n)?n.minimum:0}function r1(t,n){let s=pi(t,n),a=Qn(s);return on(t,a)}function i1(t,n){return n.const}function o1(t,n){throw new Ei(n,"Cannot create TNever types")}function s1(t,n){return null}function a1(t,n){return hi(n)&&ft(n.exclusiveMinimum)?n.exclusiveMinimum+1:gi(n)?n.minimum:0}function l1(t,n){return(bt(n.required)?[]:n.required).reduce((a,l)=>({...a,[l]:on(t,n.properties[l])}),{})}function u1(t,n){if(Ms(n)&&!Gr(n))throw new Ei(n,"Record with the minProperties constraint must have a default annotation");return{}}function c1(t,n){return Y(t,n.$ref)?on(t,t[n.$ref]):(()=>{throw new Ei(n,"Unable to deref Ref")})()}function d1(t,n){if((_s(n)||As(n))&&!Gr(n))throw Error("Strings with format or pattern constraints must specify default");let a=Ps(n)?n.minLength:0;return"".padEnd(a)}function m1(t,n){return Symbol()}function f1(t,n){let s=Kl(n.pattern);if(Pn(s))throw new Ei(n,"Unable to create TemplateLiteral due to infinite type expansion");return on(t,s)}function p1(t,n){return Array.from({length:n.minItems},(s,a)=>on(t,n.items[a]))}function h1(t,n){return}function g1(t,n){if(F(n.anyOf.length,0))throw Error("Unable to create Union with no variants");return on(t,n.anyOf[0])}function y1(t,n){return}function on(t,n){return Gr(n)?WL(t,n):lt(n)?XL(t,n):Dr(n)?YL(t,n):mr(n)?JL(t,n):hn(n)?QL(t,n):_t(n)?ZL(t,n):In(n)?e1(t,n):gn(n)?t1(t,n):zn(n)?n1(t,n):we(n)?r1(t,n):Ye(n)?i1(t,n):Fr(n)?o1(t,n):ro(n)?s1(t,n):tn(n)?a1(t,n):Re(n)?l1(t,n):vt(n)?u1(t,n):Ct(n)?c1(t,n):Pn(n)?d1(t,n):No(n)?m1(t,n):Ft(n)?f1(t,n):Ve(n)?p1(t,n):Ai(n)?h1(t,n):se(n)?g1(t,n):Hr(n)?y1(t,n):void 0}function Di(...t){let[n,s]=dr(t,{2:(a,l)=>[a,l],1:(a)=>[{},a]});return on(n,s)}class zu extends Os{constructor(t,n){super("Parse",t,n)}}function WG(t,n,s){if(!wt(t,n,s))throw new zu(s,bi(t,n,s));return s}var uy=ja([(t,n,s)=>nn(s),(t,n,s)=>fo(t,n,s),(t,n,s)=>Ni(t,n,s),(t,n,s)=>ti(t,n,s),(t,n,s)=>WG(t,n,s)]);function ot(...t){let[n,s,a]=dr(t,{3:(d,f,h)=>[d,f,h],2:(d,f)=>[{},d,f]});if(wt(n,s,a))return a;if(Jr().correctiveParse)return uy(n,s,a);throw new zu(a,bi(n,s,a))}var YG=r({type:o("insert"),path:c(),value:ci()}),JG=Object({type:o("update"),path:c(),value:ci()}),QG=r({type:o("delete"),path:c()}),S6e=i([YG,JG,QG]);class ff{constructor(t,n){this.hasCodec=ly(t,n),this.buildResult=lf(t,n),this.evaluateResult=this.buildResult.Evaluate()}IsAccelerated(){return this.evaluateResult.IsAccelerated()}Context(){return this.buildResult.Context()}Type(){return this.buildResult.Schema()}Code(){return this.evaluateResult.Code()}Check(t){return this.evaluateResult.Check(t)}Parse(t){if(this.Check(t))return t;if(Jr().correctiveParse)return uy(this.Context(),this.Type(),t);throw new zu(t,this.Errors(t))}Errors(t){if(this.IsAccelerated()&&this.Check(t))return[];return bi(this.Context(),this.Type(),t)}Clean(t){return ti(this.Context(),this.Type(),t)}Convert(t){return Ni(this.Context(),this.Type(),t)}Create(){return Di(this.Context(),this.Type())}Default(t){return fo(this.Context(),this.Type(),t)}Decode(t){return this.hasCodec?oy(this.Context(),this.Type(),t):this.Parse(t)}Encode(t){return this.hasCodec?sy(this.Context(),this.Type(),t):this.Parse(t)}}function le(...t){let[n,s]=dr(t,{2:(a,l)=>[a,l],1:(a)=>[{},a]});return new ff(n,s)}var t5=le(r({dark:c(),light:c()}));function Me(t){return t5.Check(t)}var Oe={dark:"pierre-dark-soft",light:"pierre-light"},S1=Oe;function ye(){return S1}function st(t){S1={dark:t.dark,light:t.light}}var b1=class t{options;tokensStable=[];tokensUnstable=[];lastUnstableCodeChunk="";lastStableGrammarState;constructor(n){this.options=n}async enqueue(n){let s=(this.lastUnstableCodeChunk+n).split(`
|
|
309
|
+
`)}function eF(t,n){let{additionLineIndex:s,deletionLineIndex:a}=t;if(t.hunkContent=n.hunkContent.map((l)=>qp(l,s,a)),t.additionLineIndex=s+n.additionLineIndex,t.additionStart=t.additionStart+n.additionLineIndex,t.additionCount=n.additionCount,t.additionLines=n.additionLines,n.deletionLineIndex>=0)t.deletionLineIndex=a+n.deletionLineIndex,t.deletionStart=t.deletionStart+n.deletionLineIndex;t.deletionCount=n.deletionCount,t.deletionLines=n.deletionLines,t.noEOFCRAdditions=n.noEOFCRAdditions,t.noEOFCRDeletions=n.noEOFCRDeletions,_d(t)}function qp(t,n,s){return{...t,additionLineIndex:t.additionLineIndex+n,deletionLineIndex:t.deletionLineIndex+s}}function _d(t){let n=0,s=0;for(let a of t.hunkContent)if(a.type==="context")n+=a.lines,s+=a.lines;else n+=Math.max(a.additions,a.deletions),s+=a.additions+a.deletions;t.splitLineCount=n,t.unifiedLineCount=s}function ha(t){let n=0,s=0,a=0;for(let l of t.hunks)l.collapsedBefore=Math.max(Nn(l.additionStart,l.additionCount)-a,0),l.splitLineStart=n+l.collapsedBefore,l.unifiedLineStart=s+l.collapsedBefore,_d(l),n+=l.collapsedBefore+l.splitLineCount,s+=l.collapsedBefore+l.unifiedLineCount,a=Dn(l.additionStart,l.additionCount);if(t.hunks.length>0){let l=t.hunks[t.hunks.length-1],d=Math.max(t.additionLines.length-Dn(l.additionStart,l.additionCount),0);n+=d,s+=d}t.splitLineCount=n,t.unifiedLineCount=s}var f0=new WeakMap;function tF(t){if(t.length>1&&t[t.length-1]==="")return t.slice(0,-1);return t}function nF(t,n){let s=Math.min(t.length,n.length),a=0;while(a<s&&t[a]===n[a])a++;let l=t.length,d=n.length;while(l>a&&d>a&&t[l-1]===n[d-1])l--,d--;if(a===l&&a===d)return;return{start:a,deletionEnd:l,additionEnd:d}}function $d(t,n,s){let{hunks:a,additionLines:l}=t,d=tF(l),f=d===l?t:{...t,additionLines:d},h=lF(a,sF(f,n,s),t.deletionLines.length),g=dF(f,h);if(t.additionLines=d,t.hunks=g,t.editSessionDirty=!0,hF(t),zp(t,l),!fF(a,t.hunks))return;return{regions:h.map((I)=>I.previousSpan)}}function y0(t,n,s,a){let l=new Set(n),d=Array.from(l).filter((b)=>b>=0&&b<t.additionLines.length).sort((b,v)=>b-v);if(d.length===0)return;let f=(b)=>l.has(b)?a?.get(b):t.additionLines[b],{hunks:h}=t,g,I=0;for(let b of d){while(I<h.length){let w=h[I];if(b<Fd(w)+w.additionCount)break;I++}let v=h[I],k=v==null?void 0:Fd(v);if(k==null||b<k||g!=null&&g!==I)return $d(t,s,f);g=I}if(g==null)return;if(rF(t,d,g,a,s)){t.editSessionDirty=!0;return}return $d(t,s,f)}function rF(t,n,s,a,l){if(a==null||l?.ignoreWhitespace===!0||l?.stripTrailingCr===!0)return!1;let d=iF(t),f=t.hunks[s];if(f.hunkContent.some(oF))return!1;for(let h of n){let g=a.get(h),I=t.additionLines[h];if(g==null||I==null||d.has(g)||d.has(I))return!1;let b=!1;for(let v of f.hunkContent)if(v.type==="change"&&v.additions===v.deletions&&h>=v.additionLineIndex&&h<v.additionLineIndex+v.additions){b=!0;break}if(!b)return!1}return!0}function iF(t){let n=f0.get(t);if(n?.lines===t.deletionLines)return n.set;let s=new Set(t.deletionLines);return f0.set(t,{lines:t.deletionLines,set:s}),s}function oF(t){return t?.type==="change"&&(t.additions===0||t.deletions===0)}function x0(t,n){let s=new Map,{regions:a}=n;for(let l=0;l<=a.length;l++){let d=a[l-1],f=a[l],h=l===0?t.get(0):d==null?void 0:t.get(d.lastIndex+1),g=f==null?void 0:t.get(f.firstIndex),I=h?.fromStart??0,b=g?.fromEnd??0;if(I>0||b>0)s.set(l,{fromStart:I,fromEnd:b})}return s}function I0(t,n,s){let a=[];if(t.isPartial)return a;for(let[d,f]of t.hunks.entries()){let h=Ir({isPartial:t.isPartial,rangeSize:f.collapsedBefore,expandedHunks:n,hunkIndex:d,collapsedContextThreshold:s});if(h.rangeSize<=s)continue;let g=ps(f),I=g-h.rangeSize;if(h.fromStart>0)a.push([I,I+h.fromStart]);if(h.fromEnd>0)a.push([g-h.fromEnd,g])}let l=Sr({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:n,collapsedContextThreshold:s,errorPrefix:"captureExpansionAnchors"});if(l!=null&&l.fromStart>0&&l.rangeSize>s){let d=t.hunks[t.hunks.length-1],f=ps(d)+d.deletionCount;a.push([f,f+l.fromStart])}return a}function S0(t,n){let s=new Map;if(n.length===0)return s;let a=(d,f,h)=>{if(h<=f)return;let g=0,I=0;for(let[b,v]of n){if(v<=f||b>=h)continue;if(b<=f)g=Math.max(g,Math.min(v,h)-f);if(v>=h)I=Math.max(I,h-Math.max(b,f))}if(g>0||I>0)s.set(d,{fromStart:g,fromEnd:I})};for(let[d,f]of t.hunks.entries()){let h=ps(f);a(d,h-Math.max(f.collapsedBefore,0),h)}let l=t.hunks[t.hunks.length-1];if(l!=null&&!t.isPartial&&t.deletionLines.length>0)a(t.hunks.length,ps(l)+l.deletionCount,t.deletionLines.length);return s}function Kp(t,n){if(t.editSessionDirty!==!0)return!1;return delete t.editSessionDirty,Object.assign(t,t.additionLines.length<=1&&t.additionLines.join("")===""?Ti(t,n):Md(t,n)),!0}function sF(t,n,s){if(nF(t.deletionLines,t.additionLines)==null)return[];let a=ai({name:t.prevName??t.name,contents:t.deletionLines.join("")},{name:t.name,contents:t.additionLines.join(""),lang:t.lang},n),l,d=(I,b)=>{l??=aF(t.hunks);for(let v=0;v<=b;v++){let k=l.get(I.deletionLineIndex-v);if(k==null||k.additions!==I.additions||k.deletions!==I.deletions)continue;if(I.additions>0&&s!=null){for(let w=0;w<I.additions;w++)if(s(k.additionLineIndex+w)!==a.additionLines[I.additionLineIndex+w])return b}return v}return b},f=[],h=0,g=0;for(let I of a.hunks){aS(I,a,d);let b=I.additionCount>0?I.additionLineIndex-h:I.deletionLineIndex-g;h+=b,g+=b;for(let v of I.hunkContent){if(v.type==="context"){h+=v.lines,g+=v.lines;continue}let k=qp(v,0,0);if(k.additions===0)k.additionLineIndex=h;if(k.deletions===0)k.deletionLineIndex=g;f.push(k),h+=k.additions,g+=k.deletions}}return f}function aF(t){let n=new Map;for(let s of t)for(let a of s.hunkContent)if(a.type==="change"&&(a.additions===0||a.deletions===0))n.set(a.deletionLineIndex,a);return n}function lF(t,n,s){let a=t.map((f,h)=>{let g=ps(f);return{deletionStart:g,deletionEnd:g+f.deletionCount,blocks:[],previousSpan:{firstIndex:h,lastIndex:h}}}),l=[],d=0;for(let f of n){let h=f.deletionLineIndex,g=h+f.deletions;while(d<a.length&&a[d].deletionEnd<h)l.push(a[d]),d++;let I=l.length>0&&uF(h,g,l[l.length-1])?l.pop():void 0;while(d<a.length&&a[d].deletionStart<=g)I=cF(I,a[d]),d++;if(I==null){let b=h,v=g;if((f.deletions===0||f.additions===0)&&s>f.deletions){let k=l[l.length-1]?.deletionEnd??0,w=a[d]?.deletionStart??s;if(h>k)b--;else if(g<w)v++}I={deletionStart:b,deletionEnd:v,blocks:[],previousSpan:void 0}}I.deletionStart=Math.min(I.deletionStart,h),I.deletionEnd=Math.max(I.deletionEnd,g),I.blocks.push(f),l.push(I)}while(d<a.length)l.push(a[d]),d++;return l}function uF(t,n,s){return t<=s.deletionEnd&&n>=s.deletionStart}function cF(t,n){if(t==null)return n;if(t.deletionStart=Math.min(t.deletionStart,n.deletionStart),t.deletionEnd=Math.max(t.deletionEnd,n.deletionEnd),t.blocks.push(...n.blocks),n.previousSpan!=null)t.previousSpan??={...n.previousSpan},t.previousSpan.firstIndex=Math.min(t.previousSpan.firstIndex,n.previousSpan.firstIndex),t.previousSpan.lastIndex=Math.max(t.previousSpan.lastIndex,n.previousSpan.lastIndex);return t}function dF(t,n){let s=[],a=0,l=0;for(let d of n){let f=d.deletionStart-a;if(f<0)throw Error("buildRegionHunks: overlapping old-side regions");a+=f,l+=f;let h=l,g=[];for(let b of d.blocks){let v=b.deletionLineIndex-a,k=b.additionLineIndex-l;if(v<0||v!==k)throw Error("buildRegionHunks: canonical block context mismatch");p0(g,v,l,a),a+=v,l+=k,g.push({...b}),a+=b.deletions,l+=b.additions}let I=d.deletionEnd-a;if(I<0)throw Error("buildRegionHunks: block exceeds its old-side region");p0(g,I,l,a),a+=I,l+=I,s.push(mF(t,{additionStart:h,additionEnd:l,deletionStart:d.deletionStart,deletionEnd:d.deletionEnd},g))}if(t.deletionLines.length-a!==t.additionLines.length-l)throw Error("buildRegionHunks: trailing context mismatch");return s}function mF(t,n,s){let a=n.additionEnd-n.additionStart,l=n.deletionEnd-n.deletionStart,d=0,f=0;for(let g of s)if(g.type==="change")d+=g.additions,f+=g.deletions;let h={collapsedBefore:0,additionStart:Od(n.additionStart,a),additionCount:a,additionLines:d,additionLineIndex:g0(n.additionStart,a),deletionStart:Od(n.deletionStart,l),deletionCount:l,deletionLines:f,deletionLineIndex:g0(n.deletionStart,l),hunkContent:s,hunkSpecs:`@@ -${Od(n.deletionStart,l)},${l} +${Od(n.additionStart,a)},${a} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return _d(h),h}function p0(t,n,s,a){if(n>0)t.push({type:"context",lines:n,additionLineIndex:s,deletionLineIndex:a})}function fF(t,n){if(t.length!==n.length)return!0;for(let s=0;s<t.length;s++){let a=t[s],l=n[s];if(ps(a)!==ps(l)||a.deletionCount!==l.deletionCount||Fd(a)!==Fd(l)||a.additionCount!==l.additionCount||a.splitLineCount!==l.splitLineCount||!pF(a,l))return!0}return!1}function pF(t,n){let s=h0(t),a=h0(n);while(!0){let l=s.next(),d=a.next();if(l.done===!0||d.done===!0)return l.done===d.done;if(l.value[0]!==d.value[0]||l.value[1]!==d.value[1])return!1}}function*h0(t){for(let n of t.hunkContent){if(n.type==="context"){for(let a=0;a<n.lines;a++)yield[n.deletionLineIndex+a,n.additionLineIndex+a];continue}let s=Math.max(n.deletions,n.additions);for(let a=0;a<s;a++)yield[a<n.deletions?n.deletionLineIndex+a:void 0,a<n.additions?n.additionLineIndex+a:void 0]}}function Fd(t){return Nn(t.additionStart,t.additionCount)}function ps(t){return Nn(t.deletionStart,t.deletionCount)}function Od(t,n){return n===0?t:t+1}function g0(t,n){return n===0?t-1:t}function hF(t){ha(t);for(let n=0;n<t.hunks.length;n++)jp(t,n)}function Z(t){let n=t.lang??p(t.name),s=t.lang??(t.prevName!=null?p(t.prevName):"text");return n==="text"&&s==="text"}function A(t,n){return E(t.theme,n.theme)&&t.useTokenTransformer===n.useTokenTransformer&&t.tokenizeMaxLineLength===n.tokenizeMaxLineLength&&t.lineDiffType===n.lineDiffType&&t.maxLineDiffLength===n.maxLineDiffLength}function Pl(t){return ke({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":t,style:`grid-row: span ${t};min-height:calc(${t} * 1lh)`}})}function Ml(t){return ke({tagName:"div",children:[ke({tagName:"span",children:[xr("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":t,"data-column-content":""}})}function Vp(t){return ke({tagName:"div",children:[as({name:t==="both"?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":t==="both"?"":void 0,"data-expand-up":t==="up"?"":void 0,"data-expand-down":t==="down"?"":void 0}})}function hs({type:t,content:n,expandIndex:s,chunked:a=!1,slotName:l,isFirstHunk:d,isLastHunk:f}){let h=0,g=[];if(t==="metadata"&&n!=null)g.push(ke({tagName:"div",children:[xr(n)],properties:{"data-separator-wrapper":""}}));if((t==="line-info"||t==="line-info-basic")&&n!=null){let I=[];if(s!=null)if(!a)I.push(Vp(!d&&!f?"both":d?"down":"up")),h++;else{if(!d)I.push(Vp("up")),h++;if(!f)I.push(Vp("down")),h++}if(I.push(ke({tagName:"div",children:[ke({tagName:"span",children:[xr(n)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),a&&s!=null)I.push(ke({tagName:"div",children:[xr("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}}));g.push(ke({tagName:"div",children:I,properties:{"data-separator-wrapper":"","data-separator-multi-button":h>1?"":void 0}}))}if(t==="custom"&&l!=null)g.push(ke({tagName:"slot",properties:{name:l}}));return ke({tagName:"div",children:g,properties:{"data-separator":g.length===0?"simple":t,"data-expand-index":s,"data-separator-first":d?"":void 0,"data-separator-last":f?"":void 0}})}function b0(t,n){return`hunk-separator-${t}-${n}`}function C0(t){let n=t.at(-1);if(n==null)return 0;return Math.max(Dn(n.additionStart,n.additionCount),Dn(n.deletionStart,n.deletionCount))}function _l({line:t,spanStart:n,spanLength:s}){return{start:{line:t,character:n},end:{line:t,character:n+s},properties:{"data-diff-span":""},alwaysWrap:!0}}function Ol({item:t,arr:n,enableJoin:s,isNeutral:a=!1,isLastItem:l=!1}){let d=n[n.length-1];if(d==null||l||!s){n.push([a?0:1,t.value]);return}let f=d[0]===0;if(a===f||a&&t.value.length===1&&!f){d[1]+=t.value;return}n.push([a?0:1,t.value])}var gF={forcePlainText:!1};function Ze(t,n,s,{forcePlainText:a,startingLine:l,totalLines:d,expandedHunks:f,collapsedContextThreshold:h=1}=gF){if(a)l??=0,d??=1/0;else l=0,d=1/0;let g=l>0||d<1/0,I=typeof s.theme==="string"?n.getTheme(s.theme).type:void 0,b=id({theme:s.theme,highlighter:n}),v=a&&!g&&(t.unifiedLineCount>1000||t.splitLineCount>1000)?"none":s.lineDiffType,k={deletionLines:[],additionLines:[]},{maxLineDiffLength:w}=s,P=!a&&!t.isPartial,M=a?f:void 0,N=new Map;function _(B){let X=P?0:B,z=N.get(X)??IF();return N.set(X,z),z}function O(B,X,z,K){if(g){let W=z.at(-1);if(W==null||W.targetIndex+W.count!==X)W={targetIndex:X,originalOffset:K.length,count:0},z.push(W);W.count++}K.push(B)}si({diff:t,diffStyle:"both",startingLine:l,totalLines:d,expandedHunks:g?M:!0,collapsedContextThreshold:h,callback:({hunkIndex:B,additionLine:X,deletionLine:z,type:K})=>{let W=_(B),J=X!=null?X.splitLineIndex:z.splitLineIndex;if(K==="change"&&X!=null&&z!=null)xF({additionLine:t.additionLines[X.lineIndex],deletionLine:t.deletionLines[z.lineIndex],deletionLineIndex:W.deletionContent.length,additionLineIndex:W.additionContent.length,deletionDecorations:W.deletionDecorations,additionDecorations:W.additionDecorations,lineDiffType:v,maxLineDiffLength:w});if(z!=null)O(t.deletionLines[z.lineIndex],z.lineIndex,W.deletionSegments,W.deletionContent),W.deletionInfo.push({type:K==="change"?"change-deletion":K,lineNumber:z.lineNumber,altLineNumber:K==="change"?void 0:X.lineNumber??void 0,lineIndex:`${z.unifiedLineIndex},${J}`});if(X!=null)O(t.additionLines[X.lineIndex],X.lineIndex,W.additionSegments,W.additionContent),W.additionInfo.push({type:K==="change"?"change-addition":K,lineNumber:X.lineNumber,altLineNumber:K==="change"?void 0:z.lineNumber??void 0,lineIndex:`${X.unifiedLineIndex},${J}`})}});for(let B of N.values()){if(B.deletionContent.length===0&&B.additionContent.length===0)continue;let X={name:t.prevName??t.name,contents:B.deletionContent.value},z={name:t.name,contents:B.additionContent.value},{deletionLines:K,additionLines:W}=SF({deletionFile:X,deletionInfo:B.deletionInfo,deletionDecorations:B.deletionDecorations,additionFile:z,additionInfo:B.additionInfo,additionDecorations:B.additionDecorations,highlighter:n,options:s,languageOverride:a?"text":t.lang});if(P){k.deletionLines=K,k.additionLines=W;continue}if(B.deletionSegments.length>0)for(let J of B.deletionSegments)for(let ee=0;ee<J.count;ee++)k.deletionLines[J.targetIndex+ee]=K[J.originalOffset+ee];else ds(k.deletionLines,K);if(B.additionSegments.length>0)for(let J of B.additionSegments)for(let ee=0;ee<J.count;ee++)k.additionLines[J.targetIndex+ee]=W[J.originalOffset+ee];else ds(k.additionLines,W)}return{code:k,themeStyles:b,baseThemeType:I}}function yF(t,{deletionLineIndex:n,additionLineIndex:s,deletionDecorations:a,additionDecorations:l}){let d=0,f=0,h=-1,g=0,I=-1,b=0;for(let{value:v,added:k,removed:w}of t)if(w){if(h===-1)h=d;d+=v.length,g=d}else if(k){if(I===-1)I=f;f+=v.length,b=f}else d+=v.length,f+=v.length;if(h!==-1)a.push(_l({line:n,spanStart:h,spanLength:g-h}));if(I!==-1)l.push(_l({line:s,spanStart:I,spanLength:b-I}))}function xF({deletionLine:t,additionLine:n,deletionLineIndex:s,additionLineIndex:a,deletionDecorations:l,additionDecorations:d,lineDiffType:f,maxLineDiffLength:h}){if(t==null||n==null||f==="none")return;if(t=Pr(t),n=Pr(n),t.length>h||n.length>h)return;let g=f==="char"?_p(t,n):Dp(t,n);if(f==="word-line"){yF(g,{deletionLineIndex:s,additionLineIndex:a,deletionDecorations:l,additionDecorations:d});return}let I=[],b=[],v=f==="word-alt",k=g.at(-1);for(let P of g){let M=P===k;if(!P.added&&!P.removed)Ol({item:P,arr:I,enableJoin:v,isNeutral:!0,isLastItem:M}),Ol({item:P,arr:b,enableJoin:v,isNeutral:!0,isLastItem:M});else if(P.removed)Ol({item:P,arr:I,enableJoin:v,isLastItem:M});else Ol({item:P,arr:b,enableJoin:v,isLastItem:M})}let w=0;for(let P of I){if(P[0]===1)l.push(_l({line:s,spanStart:w,spanLength:P[1].length}));w+=P[1].length}w=0;for(let P of b){if(P[0]===1)d.push(_l({line:a,spanStart:w,spanLength:P[1].length}));w+=P[1].length}}function IF(){return{deletionContent:{push(t){this.value+=t,this.length++},value:"",length:0},additionContent:{push(t){this.value+=t,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function SF({deletionFile:t,additionFile:n,deletionInfo:s,additionInfo:a,highlighter:l,deletionDecorations:d,additionDecorations:f,languageOverride:h,options:{theme:g,...I}}){let b=h??p(t.name),v=h??p(n.name),{state:k,transformers:w}=td(I.useTokenTransformer),P=(()=>typeof g==="string"?{...I,lang:"text",theme:g,transformers:w,decorations:void 0,defaultColor:!1,cssVariablePrefix:nr("token"),tokenizeTimeLimit:0}:{...I,lang:"text",themes:g,transformers:w,decorations:void 0,defaultColor:!1,cssVariablePrefix:nr("token"),tokenizeTimeLimit:0})();return{deletionLines:(()=>{if(t.contents==="")return[];return P.lang=b,k.lineInfo=s,P.decorations=d,El(l.codeToHast(Pr(t.contents),P))})(),additionLines:(()=>{if(n.contents==="")return[];return P.lang=v,P.decorations=f,k.lineInfo=a,El(l.codeToHast(Pr(n.contents),P))})()}}var bF=-1,T0=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++bF}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=["text"];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(t={theme:u},n=S,s,a){if(this.options=t,this.annotationSlotName=n,this.onRenderUpdate=s,this.workerManager=a,a?.isWorkingPool()!==!0)this.highlighter=ur(t.theme??u)?T():void 0}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){if(this.highlighter=void 0,this.diff=void 0,this.editSessionActive){if(this.renderCache!=null)this.renderCache.renderRange=void 0;this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}else this.clearRenderCache();this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(t,n){let{editSessionActive:s}=this;if(this.editSessionActive=!0,!s)this.pendingHighlightResult=void 0;if(this.diff=t,s&&this.renderCache!=null&&this.renderCache.diff!==t)this.clearRenderCache();let{renderCache:a}=this;if(!t.isPartial&&t.additionLines.length===0){Object.assign(t,Al(t,this.options.parseDiffOptions)),this.markEditSessionPass(t),this.clearRenderCache();return}if(a==null)return;if(s&&a.diff===t)return;let{options:l}=this.getRenderOptions(t),d=a.diff===t,f=n!=null&&m(a.diff,n),{result:h}=a;if(!a.highlighted||h==null||!A(a.options,l)||!d&&!f){this.clearRenderCache();return}if(d)return;this.renderCache={diff:t,options:l,highlighted:!0,result:{...h,code:{...h.code,additionLines:[...h.code.additionLines]}},renderRange:a.renderRange}}endEditSession(){if(this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff==null)this.clearRenderCache()}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:t,renderCache:n,workerManager:s}=this;if(t==null||n==null||!m(n.diff,t)||Z(t)||$l(t,this.getTokenizeMaxLength()))return Promise.resolve();if(!this.editSessionActive&&s?.isWorkingPool()===!0&&t.cacheKey!=null)return s.evictDiffFromCache(t.cacheKey),s.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,s.getDiffResultCache(t))}).catch((a)=>this.onHighlightError(a));return this.asyncHighlight(t).then((a)=>this.applyRefreshedResult(t,a)).catch((a)=>this.onHighlightError(a))}applyRefreshedResult(t,n){let{diff:s,renderCache:a}=this;if(n==null||s==null||a==null||!m(s,t)||!m(a.diff,t)||this.editSessionActive)return;let{options:l}=this.getRenderOptions(s);if(!A(l,n.options))return;this.pendingHighlightResult={diff:s,options:n.options,highlighted:!0,result:n.result},this.onRenderUpdate?.()}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(t){this.options=t}mergeOptions(t){this.options={...this.options,...t}}expandHunk(t,n,s=this.getOptionsWithDefaults().expansionLineCount){let a={...this.expandedHunks.get(t)??{fromStart:0,fromEnd:0}};if(n==="up"||n==="both")a.fromStart+=s;if(n==="down"||n==="both")a.fromEnd+=s;if(this.renderCache?.highlighted!==!0)this.clearRenderCache();this.expandedHunks.set(t,a)}getExpandedHunk(t){return this.expandedHunks.get(t)??tS}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(t){this.expandedHunks=t}setLineAnnotations(t){this.additionAnnotations={},this.deletionAnnotations={};for(let n of t){let s=(()=>{switch(n.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),a=s[n.lineNumber]??[];s[n.lineNumber]=a,a.push(n)}}updateRenderCache(t,n,s=!1){this.pendingStructuralRows=void 0;let{renderCache:a}=this;if(a==null)return!1;let{result:l,diff:d}=a;if(l==null)return!1;if(d.isPartial)throw Error("Could not update render cache for partial diff");let f=l.code.additionLines,h=this.pendingStructuralRows=s?new Map:void 0,g=[],I=new Map;for(let[v,k]of t){let w=f[v]?.properties??{},P=k.map((B)=>B[2]).join(""),M=v<d.additionLines.length,N=M?d.additionLines[v]??"":"",_=Pr(N);if(h==null&&M){if(d.additionLines[v]=Wc(N,P),_!==P)g.push(v),I.set(v,N)}let O={type:"element",tagName:"div",properties:{"data-line":w["data-line"]??v+1,"data-line-index":w["data-line-index"]??v,"data-line-type":w["data-line-type"]??"context"},children:k.map(([B,X,z])=>{if(B===0&&X===""){if(z==="")return{type:"element",tagName:"br",properties:{},children:[]};return{type:"text",value:z}}return{type:"element",tagName:"span",properties:{"data-char":B,style:`color:${X};`},children:[{type:"text",value:z}]}})};if(h!=null)h.set(v,O);else f[v]=O}let b=!1;if(g.length>0)if(this.editSessionActive)if(d.additionLines.length<=1&&d.additionLines.join("")==="")this.applyRecomputePreservingSessionType(d,Al(d,this.options.parseDiffOptions)),b=!0;else if(Pd(d,d.additionLines))this.applyRecomputePreservingSessionType(d,Ll(d,d.additionLines,this.options.parseDiffOptions)),b=!0;else{let v=y0(d,g,this.options.parseDiffOptions,I);this.applyExpansionRemap(v),b=v!=null}else Object.assign(d,m0(d,g,this.options.parseDiffOptions));return l.baseThemeType=n,a.isDirty=!0,b}applyExpansionRemap(t){if(t!=null)this.expandedHunks=x0(this.expandedHunks,t)}applyDocumentChange(t){let{pendingStructuralRows:n,renderCache:s}=this;this.pendingStructuralRows=void 0;let a=this.diff??s?.diff;if(a==null)return;let l=s?.result;if(a.isPartial)throw Error("Could not apply document change for partial diff");let{additionLines:d}=a;if(a.additionLines=kF(t),l!=null)l.code.additionLines=vF(d,a.additionLines,l.code.additionLines,t);if(a.additionLines.length<=1&&a.additionLines.join("")===""){if(this.applyRecomputePreservingSessionType(a,Al(a,this.options.parseDiffOptions)),l!=null)l.code.additionLines[0]=Yp(0,t.getLineText(0))}else if(this.editSessionActive)this.applySessionDocumentChange(a,d);else Object.assign(a,Md(a,this.options.parseDiffOptions));if(n!=null&&l!=null){for(let[f,h]of n)if(f<l.code.additionLines.length)l.code.additionLines[f]=h}if(s!=null)s.isDirty=!0}applySessionDocumentChange(t,n){let{parseDiffOptions:s}=this.options,a=t.additionLines;if(Pd(t,a)){this.applyRecomputePreservingSessionType(t,Ll(t,a,s));return}this.applyExpansionRemap($d(t,s,(l)=>n[l]))}applyRecomputePreservingSessionType(t,n){let s=this.editSessionActive?t.type:void 0;if(Object.assign(t,n),s!=null)t.type=s;this.markEditSessionPass(t)}markEditSessionPass(t){if(!this.editSessionActive)return;t.editSessionDirty=!0}getUnifiedLineDecoration({lineType:t}){return{gutterLineType:t,contentProperties:{"data-line-type":t}}}getSplitLineDecoration({side:t,type:n}){let s=n==="change"?t==="deletions"?"change-deletion":"change-addition":n;return{gutterLineType:s,contentProperties:{"data-line-type":s}}}createAnnotationElement=(t)=>Il(t);getOptionsWithDefaults(){let{diffIndicators:t="bars",diffStyle:n="split",disableBackground:s=!1,disableFileHeader:a=!1,disableLineNumbers:l=!1,disableVirtualizationBuffers:d=!1,collapsed:f=!1,expandUnchanged:h=!1,collapsedContextThreshold:g=1,expansionLineCount:I=100,hunkSeparators:b="line-info",lineDiffType:v="word-alt",maxLineDiffLength:k=1000,overflow:w="scroll",stickyHeader:P=!1,theme:M=u,headerRenderMode:N="default",tokenizeMaxLineLength:_=1000,tokenizeMaxLength:O=QI,useTokenTransformer:B=!1,useCSSClasses:X=!1}=this.options;return{diffIndicators:t,diffStyle:n,disableBackground:s,disableFileHeader:a,disableLineNumbers:l,disableVirtualizationBuffers:d,collapsed:f,expandUnchanged:h,collapsedContextThreshold:g,expansionLineCount:I,hunkSeparators:b,lineDiffType:v,maxLineDiffLength:k,overflow:w,stickyHeader:P,theme:this.workerManager?.getDiffRenderOptions().theme??M,headerRenderMode:N,tokenizeMaxLineLength:_,tokenizeMaxLength:O,useTokenTransformer:B,useCSSClasses:X}}async initializeHighlighter(){return this.highlighter=await j(Qc(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(t){if(t==null)return;this.diff=t;let{options:n}=this.getRenderOptions(t),s=$l(t,this.getTokenizeMaxLength()),a=this.workerManager?.getDiffResultCache(t);if(a!=null&&!A(n,a.options))a=void 0;if(this.renderCache??={diff:t,hydrated:!0,highlighted:!s&&!Z(t),options:n,result:s?void 0:a?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){if(this.renderCache.result==null&&!s)this.workerManager.highlightDiffAST(this,this.diff)}else if(this.highlighter==null)this.computedLangs=Xp(t),this.initializeHighlighter()}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??u}getEffectiveCodeOptions(){let t=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:t?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(t){let n=(()=>{if(this.workerManager?.isWorkingPool()===!0){let h=this.workerManager.getDiffRenderOptions();if(this.editSessionActive&&h.useTokenTransformer!==!0)return{...h,useTokenTransformer:!0};return h}let{theme:a,tokenizeMaxLineLength:l,lineDiffType:d,maxLineDiffLength:f}=this.getOptionsWithDefaults();return{theme:a,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:l,lineDiffType:d,maxLineDiffLength:f}})();this.getOptionsWithDefaults();let{renderCache:s}=this;if(s?.result==null)return{options:n,forceHighlight:!0};if(!m(t,s.diff)||!A(n,s.options))return{options:n,forceHighlight:!0};return{options:n,forceHighlight:!1}}getDiffForNextRender(t){let{options:n}=this.getRenderOptions(t);if(this.getReadyRenderResult(t,n)!=null)return t;if(this.renderCache==null)return t;if(m(this.renderCache.diff,t))return this.renderCache.diff;let s=!(t.additionLines.length>0||t.deletionLines.length>0)||Z(t)||$l(t,this.getTokenizeMaxLength());return this.canRenderDiff(t,n,s)?t:this.renderCache.diff}canRenderDiff(t,n,s){let{renderCache:a}=this;if(a==null||m(a.diff,t))return!0;if(s)return a.result==null&&a.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&ur(n.theme);if(a.result==null&&a.hydrated!==!0)return!0;if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)return!a.highlighted;return this.highlighter!=null&&ur(n.theme)}renderDiff(t=this.diff,n=ea){if(this.diff=t,t==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:s,collapsedContextThreshold:a}=this.getOptionsWithDefaults(),{options:l,forceHighlight:d}=this.getRenderOptions(t),f=this.getReadyRenderResult(t,l);if(this.pendingHighlightResult=void 0,f!=null)this.renderCache={...f,diff:t,renderRange:void 0},d=!1;this.renderCache??={diff:t,highlighted:!1,options:l,result:void 0,renderRange:void 0};let h=t.additionLines.length>0||t.deletionLines.length>0,g=!h||Z(t)||$l(t,this.getTokenizeMaxLength()),I=this.canRenderDiff(t,l,g),b=!m(t,this.renderCache.diff),v=!ko(this.renderCache.renderRange,n);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let k=this.renderCache.result==null&&this.renderCache.highlighted&&!g&&!b&&cs(n);if(I&&!k&&(g||this.renderCache.result==null||!this.renderCache.highlighted&&(b||v))){if(this.renderCache.diff=t,this.renderCache.options=l,this.renderCache.highlighted=!1,this.renderCache.result==null||b||v||d)this.renderCache.result=this.workerManager.getPlainDiffAST(t,n.startingLine,n.totalLines,cs(n)?!0:s?!0:this.expandedHunks,a);this.renderCache.renderRange=n}if(!g&&h&&(!this.renderCache.highlighted||d))this.workerManager.highlightDiffAST(this,t)}else{this.computedLangs=Xp(t),this.highlighter??=T();let k=this.highlighter!=null&&ur(l.theme),w=this.highlighter!=null&&U(this.computedLangs),P=!g&&w;if(I&&this.highlighter!=null&&k&&(d||g||!this.renderCache.highlighted&&P||this.renderCache.result==null)){let{result:M,options:N}=this.renderDiffWithHighlighter(t,this.highlighter,g||!w);this.renderCache={diff:t,options:N,highlighted:P,result:M,renderRange:void 0}}if(!k||!g&&!w)this.asyncHighlight(t).then(({result:M,options:N})=>{this.applyHighlightResult(t,M,N,!g)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,n,this.renderCache.result):void 0}async asyncRender(t,n=ea){this.diff=t;let{result:s}=await this.asyncHighlight(t);return this.processDiffResult(t,n,s)}createPreElement(t,n,s){let{diffIndicators:a,disableBackground:l,disableLineNumbers:d,overflow:f}=this.getOptionsWithDefaults();return Jc({type:"diff",diffIndicators:a,disableBackground:l,disableLineNumbers:d,overflow:f,split:t,totalLines:n,customProperties:s})}async asyncHighlight(t){let n=$l(t,this.getTokenizeMaxLength());this.computedLangs=n?["text"]:Xp(t);let s=this.highlighter!=null&&ur(this.getLocalHighlightTheme()),a=n||this.highlighter!=null&&U(this.computedLangs);if(this.highlighter==null||!s||!a)this.highlighter=await this.initializeHighlighter();return this.renderDiffWithHighlighter(t,this.highlighter,n)}renderDiffWithHighlighter(t,n,s=!1){let{options:a}=this.getRenderOptions(t),{collapsedContextThreshold:l}=this.getOptionsWithDefaults(),d=Ze(t,n,a,{forcePlainText:s,expandedHunks:s?!0:void 0,collapsedContextThreshold:l});if(this.editSessionActive&&t.additionLines.length===1&&t.additionLines[0]===""&&d.code.additionLines[0]==null){let f;if(si({diff:t,diffStyle:"both",expandedHunks:s?!0:void 0,collapsedContextThreshold:l,callback:({additionLine:h})=>{if(h?.lineIndex!==0)return;return f=h,!0}}),f==null)throw Error("DiffHunksRenderer: missing empty addition line");d.code.additionLines[0]=Yp(0,"",f.unifiedLineIndex,f.splitLineIndex)}return{result:d,options:a}}onHighlightSuccess(t,n,s,a=!0){if(this.editSessionActive)return;this.applyHighlightResult(t,n,s,a)}applyHighlightResult(t,n,s,a=!0){let{diff:l,renderCache:d}=this;if(l==null||d==null||!m(l,t)||!A(s,this.getRenderOptions(l).options))return;if(!(d.result==null||!d.highlighted||!A(d.options,s)||!m(d.diff,l)))return;this.pendingHighlightResult={diff:l,options:s,highlighted:a,result:n},this.onRenderUpdate?.()}getMatchingWorkerResultCache(t,n){if(this.editSessionActive)return;let s=this.workerManager?.getDiffResultCache(t);if(s==null||!A(n,s.options))return;return s}getReadyRenderResult(t,n){let{pendingHighlightResult:s}=this;if(s!=null&&m(s.diff,t)&&A(s.options,n))return s;let a=this.getMatchingWorkerResultCache(t,n);if(a==null||this.hasHighlightedRenderCache(t,n))return;return{diff:t,highlighted:!0,...a}}hasHighlightedRenderCache(t,n){let{renderCache:s}=this;return s?.result!=null&&s.highlighted&&m(t,s.diff)&&A(n,s.options)}onHighlightError(t){console.error(t)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(t,n,{code:s,themeStyles:a,baseThemeType:l}){let{diffStyle:d,disableFileHeader:f,expandUnchanged:h,expansionLineCount:g,collapsedContextThreshold:I,hunkSeparators:b}=this.getOptionsWithDefaults(),v=this.renderCache?.isDirty??!1,k=d==="unified",w=TF(t,this.options.loadDiffFiles!=null),P=!t.isPartial||w,M=[],N=[],_=[],O=[],{additionLines:B,deletionLines:X}=s,z={rowCount:0,hunkSeparators:b,additionsContentAST:M,deletionsContentAST:N,unifiedContentAST:_,unifiedGutterAST:vo(),deletionsGutterAST:vo(),additionsGutterAST:vo(),expansionLineCount:g,hunkData:O,incrementRowCount(Ce=1){z.rowCount+=Ce},pushToGutter(Ce,qe){switch(Ce){case"unified":z.unifiedGutterAST.children.push(qe);break;case"deletions":z.deletionsGutterAST.children.push(qe);break;case"additions":z.additionsGutterAST.children.push(qe)}}},K=Mp({fileDiff:t,errorPrefix:"DiffHunksRenderer.processDiffResult"}),W={size:0,side:void 0,increment(){this.size+=1},flush(){if(d==="unified")return;if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}if(this.side==="additions")z.pushToGutter("additions",cr(void 0,"buffer",this.size)),M?.push(Pl(this.size));else z.pushToGutter("deletions",cr(void 0,"buffer",this.size)),N?.push(Pl(this.size));this.size=0,this.side=void 0}},J=(Ce,qe,Tt,jn,St)=>{z.pushToGutter(Ce,jc(qe,Tt,jn,St))};function ee(Ce){if(W.flush(),d==="unified")Wp("unified",Ce,z);else Wp("deletions",Ce,z),Wp("additions",Ce,z)}if(this.pushFileLevelAnnotations(t,d,n,z),si({diff:t,diffStyle:d,startingLine:n.startingLine,totalLines:n.totalLines,expandedHunks:h?!0:this.expandedHunks,collapsedContextThreshold:I,callback:({hunkIndex:Ce,hunk:qe,collapsedBefore:Tt,collapsedAfter:jn,additionLine:St,deletionLine:Ft,type:sn})=>{let En=Ft!=null?Ft.splitLineIndex:St.splitLineIndex,wr=St!=null?St.unifiedLineIndex:Ft.unifiedLineIndex;if(d==="split"&&sn!=="change")W.flush();if(Tt>0)ee({hunkIndex:Ce,collapsedLines:Tt,rangeSize:Math.max(qe?.collapsedBefore??0,0),hunkSpecs:qe?.hunkSpecs,isFirstHunk:Ce===0,isLastHunk:!1,isExpandable:P});let Kr=d==="unified"?wr:En,Vr={type:sn,hunkIndex:Ce,lineIndex:Kr,unifiedLineIndex:wr,splitLineIndex:En,deletionLine:Ft,additionLine:St};if(d==="unified"){let mn=this.getUnifiedInjectedRowsForLine?.(Vr);if(mn?.before!=null)E0(mn.before,z);let hr=Ft!=null?X[Ft.lineIndex]:void 0,Rr=St!=null?B[St.lineIndex]:void 0;if(hr==null&&Rr==null)throw console.error("DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong",{file:t.name}),Error("DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong");let Jo=sn==="change"?St!=null?"change-addition":"change-deletion":sn,ni=this.getUnifiedLineDecoration({type:sn,lineType:Jo,additionLineIndex:St?.lineIndex,deletionLineIndex:Ft?.lineIndex});if(J("unified",ni.gutterLineType,St!=null?St.lineNumber:Ft.lineNumber,`${wr},${En}`,ni.gutterProperties),Rr!=null)Rr=Dd(Rr,ni.contentProperties,v&&St!=null?{"data-line":St.lineNumber,"data-line-index":`${wr},${En}`}:void 0);else if(hr!=null)hr=Dd(hr,ni.contentProperties,v&&Ft!=null?{"data-line":Ft.lineNumber,"data-line-index":`${wr},${En}`}:void 0);if(Nd({diffStyle:"unified",type:sn,deletionLine:hr,additionLine:Rr,unifiedSpan:this.getAnnotations("unified",Ft?.lineNumber,St?.lineNumber,Ce,Kr),createAnnotationElement:(Bi)=>this.createAnnotationElement(Bi),context:z}),mn?.after!=null)E0(mn.after,z)}else{let mn=this.getSplitInjectedRowsForLine?.(Vr);if(mn?.before!=null)v0(mn.before,z,W);let hr=Ft!=null?X[Ft.lineIndex]:void 0,Rr=St!=null?B[St.lineIndex]:void 0,Jo=this.getSplitLineDecoration({side:"deletions",type:sn,lineIndex:Ft?.lineIndex}),ni=this.getSplitLineDecoration({side:"additions",type:sn,lineIndex:St?.lineIndex});if(hr==null&&Rr==null)throw console.error("DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong",{file:t.name}),Error("DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong");let Bi=(()=>{if(sn==="change"){if(Rr==null)return"additions";else if(hr==null)return"deletions"}})();if(Bi!=null){if(W.side!=null&&W.side!==Bi)W.flush();W.side=Bi,W.increment()}else if(sn==="change")W.flush();let ho=this.getAnnotations("split",Ft?.lineNumber,St?.lineNumber,Ce,Kr);if(ho!=null&&W.size>0)W.flush();if(Ft!=null){let Wr=Dd(hr,Jo.contentProperties,v?{"data-line":Ft.lineNumber,"data-line-index":`${Ft.unifiedLineIndex},${En}`}:void 0);if(J("deletions",Jo.gutterLineType,Ft.lineNumber,`${Ft.unifiedLineIndex},${En}`,Jo.gutterProperties),Wr!=null)hr=Wr}if(St!=null){let Wr=Dd(Rr,ni.contentProperties,v?{"data-line":St.lineNumber,"data-line-index":`${St.unifiedLineIndex},${En}`}:void 0);if(J("additions",ni.gutterLineType,St.lineNumber,`${St.unifiedLineIndex},${En}`,ni.gutterProperties),Wr!=null)Rr=Wr}if(Nd({diffStyle:"split",type:sn,additionLine:Rr,deletionLine:hr,...ho,createAnnotationElement:(Wr)=>this.createAnnotationElement(Wr),context:z}),mn?.after!=null)v0(mn.after,z,W)}let Yo=d==="split"&&qe!=null&&En===qe.splitLineStart+qe.splitLineCount-1,lr=Ce===t.hunks.length-1&&qe!=null&&(d==="split"?En===qe.splitLineStart+qe.splitLineCount-1:wr===qe.unifiedLineStart+qe.unifiedLineCount-1),Fs=Yo?qe.noEOFCRDeletions:!1,qa=Yo?qe.noEOFCRAdditions:!1,Hi=(Ft?.noEOFCR??!1)||Fs,Ui=(St?.noEOFCR??!1)||qa;if(Ui||Hi){if(d==="split")W.flush();if(Hi){let mn=sn==="context"||sn==="context-expanded"?sn:"change-deletion";if(d==="unified")z.unifiedContentAST.push(Ml(mn)),z.pushToGutter("unified",cr(mn,"metadata",1));else if(z.deletionsContentAST.push(Ml(mn)),z.pushToGutter("deletions",cr(mn,"metadata",1)),!Ui)z.pushToGutter("additions",cr(void 0,"buffer",1)),z.additionsContentAST.push(Pl(1))}if(Ui){let mn=sn==="context"||sn==="context-expanded"?sn:"change-addition";if(d==="unified")z.unifiedContentAST.push(Ml(mn)),z.pushToGutter("unified",cr(mn,"metadata",1));else if(z.additionsContentAST.push(Ml(mn)),z.pushToGutter("additions",cr(mn,"metadata",1)),!Hi)z.pushToGutter("deletions",cr(void 0,"buffer",1)),z.deletionsContentAST.push(Pl(1))}z.incrementRowCount(1)}if(b!=="simple"&&b!=="metadata"&&(jn>0||lr&&w))ee({hunkIndex:sn==="context-expanded"?Ce:Ce+1,collapsedLines:lr&&w?"unknown":jn,rangeSize:K,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:P});z.incrementRowCount(1)}}),d==="split")W.flush();let ue=Math.max(C0(t.hunks),t.additionLines.length??0,t.deletionLines.length??0),Ae=n.bufferBefore>0||n.bufferAfter>0,le=!k&&t.type!=="deleted",Se=!k&&t.type!=="new",lt=z.rowCount>0||Ae;M=le&<?M:void 0,N=Se&<?N:void 0,_=k&<?_:void 0;let It=this.createPreElement(N!=null&&M!=null,ue);return{fileDiff:t,unifiedGutterAST:k&<?z.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:Se&<?z.deletionsGutterAST.children:void 0,deletionsContentAST:N,additionsGutterAST:le&<?z.additionsGutterAST.children:void 0,additionsContentAST:M,hunkData:O,preNode:It,themeStyles:a,baseThemeType:l,headerElement:!f?this.renderHeader(t):void 0,totalLines:ue,rowCount:z.rowCount,bufferBefore:n.bufferBefore,bufferAfter:n.bufferAfter,css:""}}renderCodeAST(t,n){let s=t==="unified"?n.unifiedGutterAST:t==="deletions"?n.deletionsGutterAST:n.additionsGutterAST,a=t==="unified"?n.unifiedContentAST:t==="deletions"?n.deletionsContentAST:n.additionsContentAST;if(s==null||a==null)return;let l=vo(s);return l.properties.style=`grid-row: span ${n.rowCount}`,[l,Xc(a,n.rowCount)]}renderFullAST(t,n=[]){let s=this.getOptionsWithDefaults().hunkSeparators==="line-info",a=this.renderCodeAST("unified",t);if(a!=null)return n.push(ke({tagName:"code",children:a,properties:{"data-code":"","data-container-size":s?"":void 0,"data-unified":""}})),{...t.preNode,children:n};let l=this.renderCodeAST("deletions",t);if(l!=null)n.push(ke({tagName:"code",children:l,properties:{"data-code":"","data-container-size":s?"":void 0,"data-deletions":""}}));let d=this.renderCodeAST("additions",t);if(d!=null)n.push(ke({tagName:"code",children:d,properties:{"data-code":"","data-container-size":s?"":void 0,"data-additions":""}}));return{...t.preNode,children:n}}renderFullHTML(t,n=[]){return pn(this.renderFullAST(t,n))}renderPartialHTML(t,n){if(n==null)return pn(t);return pn(ke({tagName:"code",children:t,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${n}`]:""}}))}pushFileLevelAnnotations(t,n,s,a){if(!Eo(s))return;let l=t.type!=="new"?this.getAnnotationNames(hl(this.deletionAnnotations)):[],d=t.type!=="deleted"?this.getAnnotationNames(hl(this.additionAnnotations)):[];if(l.length===0&&d.length===0)return;let f=-1,h=-1,{createAnnotationElement:g}=this;if(n==="unified"){Nd({diffStyle:n,type:"context",unifiedSpan:{type:"annotation",hunkIndex:f,lineIndex:h,annotations:l.concat(d)},createAnnotationElement:g,context:a});return}Nd({diffStyle:n,type:"context",deletionSpan:{type:"annotation",hunkIndex:f,lineIndex:h,annotations:l},additionSpan:{type:"annotation",hunkIndex:f,lineIndex:h,annotations:d},createAnnotationElement:g,context:a})}getAnnotations(t,n,s,a,l){let d={type:"annotation",hunkIndex:a,lineIndex:l,annotations:[]};if(n!=null)for(let h of this.deletionAnnotations[n]??[])d.annotations.push(this.annotationSlotName(h));let f={type:"annotation",hunkIndex:a,lineIndex:l,annotations:[]};if(s!=null)for(let h of this.additionAnnotations[s]??[])(t==="unified"?d:f).annotations.push(this.annotationSlotName(h));if(t==="unified"){if(d.annotations.length>0)return d;return}if(f.annotations.length===0&&d.annotations.length===0)return;return{deletionSpan:d,additionSpan:f}}getAnnotationNames(t){return t?.map((n)=>this.annotationSlotName(n))??[]}renderHeader(t){let{headerRenderMode:n,stickyHeader:s}=this.getOptionsWithDefaults();return Yc({fileOrDiff:t,mode:n,stickyHeader:s})}},CF=new Intl.PluralRules("en-US");function EF(t){return`${t} unmodified line${CF.select(t)==="one"?"":"s"}`}function E0(t,n){for(let s of t)n.unifiedContentAST.push(s.content),n.pushToGutter("unified",s.gutter),n.incrementRowCount(1)}function v0(t,n,s){for(let{deletion:a,addition:l}of t){if(a==null&&l==null)continue;let d=a!=null&&l!=null?void 0:a==null?"deletions":"additions";if(d==null||s.side!==d)s.flush();if(a!=null)n.deletionsContentAST.push(a.content),n.pushToGutter("deletions",a.gutter);if(l!=null)n.additionsContentAST.push(l.content),n.pushToGutter("additions",l.gutter);if(d!=null)s.side=d,s.increment();n.incrementRowCount(1)}}function Nd({diffStyle:t,type:n,deletionLine:s,additionLine:a,unifiedSpan:l,deletionSpan:d,additionSpan:f,createAnnotationElement:h,context:g}){let I=!1;if(t==="unified"){if(a!=null)g.unifiedContentAST.push(a);else if(s!=null)g.unifiedContentAST.push(s);if(l!=null){let b=n==="change"?s!=null?"change-deletion":"change-addition":n;g.unifiedContentAST.push(h(l)),g.pushToGutter("unified",cr(b,"annotation",1)),I=!0}}else if(t==="split"){if(s!=null)g.deletionsContentAST.push(s);if(a!=null)g.additionsContentAST.push(a);if(d!=null){let b=n==="change"?s!=null?"change-deletion":"context":n;g.deletionsContentAST.push(h(d)),g.pushToGutter("deletions",cr(b,"annotation",1)),I=!0}if(f!=null){let b=n==="change"?a!=null?"change-addition":"context":n;g.additionsContentAST.push(h(f)),g.pushToGutter("additions",cr(b,"annotation",1)),I=!0}}if(I)g.incrementRowCount(1)}function Wp(t,{hunkIndex:n,collapsedLines:s,rangeSize:a,hunkSpecs:l,isFirstHunk:d,isLastHunk:f,isExpandable:h},g){if(typeof s==="number"&&s<=0)return;let I=t==="unified"?g.unifiedContentAST:t==="deletions"?g.deletionsContentAST:g.additionsContentAST;if(g.hunkSeparators==="metadata"){if(l!=null){if(g.pushToGutter(t,hs({type:"metadata",content:l,isFirstHunk:d,isLastHunk:f})),I.push(hs({type:"metadata",content:l,isFirstHunk:d,isLastHunk:f})),t!=="additions")g.incrementRowCount(1)}return}if(g.hunkSeparators==="simple"){if(n>0){if(g.pushToGutter(t,hs({type:"simple",isFirstHunk:d,isLastHunk:!1})),I.push(hs({type:"simple",isFirstHunk:d,isLastHunk:!1})),t!=="additions")g.incrementRowCount(1)}return}let b=b0(t,n),v=a>g.expansionLineCount,k=h?n:void 0,w=typeof s==="number"?EF(s):"More unchanged context may be available";if(g.pushToGutter(t,hs({type:g.hunkSeparators,content:w,expandIndex:k,chunked:v,slotName:b,isFirstHunk:d,isLastHunk:f})),I.push(hs({type:g.hunkSeparators,content:w,expandIndex:k,chunked:v,slotName:b,isFirstHunk:d,isLastHunk:f})),t!=="additions")g.incrementRowCount(1);g.hunkData.push({slotName:b,hunkIndex:n,lines:typeof s==="number"?s:0,lineCountKnown:typeof s==="number",type:t,expandable:h?{up:!d,down:!f,chunked:v}:void 0})}function Dd(t,n,s){if(t==null||t.type!=="element"||n==null&&s==null)return t;return{...t,properties:{...t.properties,...n,...s}}}function k0(t){return t.length>0&&t[t.length-1]===""?t.length-1:t.length}function vF(t,n,s,a){let l=k0(t),d=k0(n),f=Math.min(l,d),h=0;while(h<f&&t[h]===n[h])h++;let g=0;while(g<f-h&&t[l-1-g]===n[d-1-g])g++;let I=Array(n.length);for(let b=0;b<h;b++)I[b]=s[b];for(let b=0;b<g;b++)I[d-1-b]=s[l-1-b];if(l<t.length&&d<n.length)I[n.length-1]=s[t.length-1];for(let b=h;b<n.length;b++)I[b]??=Yp(b,a.getLineText(b));return I}function Yp(t,n,s=t,a=t){return{type:"element",tagName:"div",properties:{"data-line":t+1,"data-line-index":`${s},${a}`,"data-line-type":"context"},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:n}]}]}}function kF(t){let n=[];for(let s=0;s<t.lineCount;s++)n.push(t.getLineText(s,!0));return n}function Xp(t){if(t.lang!=null)return[t.lang];let n=p(t.prevName??t.name),s=p(t.name);return n===s?[s]:[n,s]}function $l(t,n){return Math.max(t.additionLines.length,t.deletionLines.length)>n}function TF(t,n){return t.isPartial&&n&&(t.type==="change"||t.type==="rename-changed")}function w0(t,n){return t.lineNumber===n.lineNumber&&t.side===n.side&&t.metadata===n.metadata}function R0(t,n){return t.slotName===n.slotName&&t.hunkIndex===n.hunkIndex&&t.lines===n.lines&&t.lineCountKnown===n.lineCountKnown&&t.type===n.type&&t.expandable?.chunked===n.expandable?.chunked&&t.expandable?.up===n.expandable?.up&&t.expandable?.down===n.expandable?.down}function L0(t){return{theme:t?.theme,disableLineNumbers:t?.disableLineNumbers,overflow:t?.overflow,collapsed:t?.collapsed,disableFileHeader:t?.disableFileHeader,disableVirtualizationBuffers:t?.disableVirtualizationBuffers,stickyHeader:t?.stickyHeader,preferredHighlighter:t?.preferredHighlighter,useCSSClasses:t?.useCSSClasses,useTokenTransformer:xd(t),tokenizeMaxLineLength:t?.tokenizeMaxLineLength,tokenizeMaxLength:t?.tokenizeMaxLength,diffStyle:t?.diffStyle,diffIndicators:t?.diffIndicators,disableBackground:t?.disableBackground,hunkSeparators:typeof t?.hunkSeparators==="function"?"custom":t?.hunkSeparators,expandUnchanged:t?.expandUnchanged,loadDiffFiles:t?.loadDiffFiles,collapsedContextThreshold:t?.collapsedContextThreshold,lineDiffType:t?.lineDiffType,maxLineDiffLength:t?.maxLineDiffLength,expansionLineCount:t?.expansionLineCount,headerRenderMode:t?.renderCustomHeader!=null?"custom":"default"}}function Jp(t){return t.isPartial&&(t.type==="change"||t.type==="rename-changed"||t.type==="rename-pure")}function wF(t){let n={...t};return delete n.cacheKey,n}function A0(t,n){if(t.isPartial||n.isPartial)throw Error("FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated");let s=t.lang??p(t.name),a=n.lang??p(n.name),l=t.type!=="new",d=n.type!=="new";if(t.name!==n.name||s!==a||l!==d||t.deletionLines.length!==n.deletionLines.length)return!0;return t.deletionLines.some((f,h)=>f!==n.deletionLines[h])}function RF(t,n){return t.length===n.length&&t.every((s,a)=>s===n[a])}function LF(t,n){let{oldFile:s}=t;if(s==null)return n.type==="new";return n.type!=="new"&&s.name===(n.prevName??n.name)&&RF(s.lines,n.deletionLines)}var AF=-1,M0=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++AF}`;type="file-diff";fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(t={theme:u},n,s=!1){this.options=t,this.workerManager=n,this.isContainerManaged=s,this.hunksRenderer=this.createHunksRenderer(t),this.resizeManager=new Vc,this.scrollSyncManager=new d0,this.interactionManager=new Kc("diff",la(t,typeof t.hunkSeparators==="function"||(t.hunkSeparators??"line-info")==="line-info"||t.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??u}getHunksRendererOptions(t){return L0(t)}createHunksRenderer(t){return new T0(this.getHunksRendererOptions(t),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(t,n="additions")=>this.getLineIndexForDiff(this.getDiffForLineIndex(),t,n);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(t,n,s){if(t==null)return;let a=t.hunks.at(-1),l,d;e:for(let f of t.hunks){let h=s==="deletions"?f.deletionStart:f.additionStart,g=s==="deletions"?f.deletionCount:f.additionCount,I=Nn(h,g)+1,{splitLineStart:b,unifiedLineStart:v}=f;if(n<I){let k=I-n;l=Math.max(v-k,0),d=Math.max(b-k,0);break e}if(n>=I+g){if(f===a){let k=n-(I+g);l=v+f.unifiedLineCount+k,d=b+f.splitLineCount+k;break e}continue}for(let k of f.hunkContent)if(k.type==="context")if(n<I+k.lines){let w=n-I;d=b+w,l=v+w;break e}else I+=k.lines,b+=k.lines,v+=k.lines;else{let w=s==="deletions"?k.deletions:k.additions;if(n<I+w){let P=n-I;l=v+(s==="additions"?k.deletions:0)+P,d=b+P;break e}else I+=w,b+=Math.max(k.deletions,k.additions),v+=k.deletions+k.additions}break e}if(l==null||d==null)return;return[l,d]}setOptions(t){if(t==null)return;this.options=t,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(t)),this.syncInteractionOptions()}syncInteractionOptions(){this.interactionManager.setOptions(la(this.options,typeof this.options.hunkSeparators==="function"||(this.options.hunkSeparators??"line-info")==="line-info"||this.options.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(t){this.options={...this.options,...t}}setThemeType(t){if((this.options.themeType??"system")===t)return;this.mergeOptions({themeType:t}),this.applyCachedThemeState(t)}applyCachedThemeState(t){if(typeof this.options.theme==="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let n=this.appliedThemeCSS.baseThemeType??t;if(this.appliedThemeCSS.themeType===n)return!1;return this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,t,this.appliedThemeCSS.baseThemeType),!0}hasThemeChanged(){return this.appliedThemeCSS!=null&&!E(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=(t)=>yd(this.editSession?.annotations,t,S);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(t){let n=this.editSession?.annotations;if(t===this.lineAnnotations)return!1;return n==null||t!==n.provided&&t!==n.current}setLineAnnotations(t){let n=this.editSession?.annotations;if(n==null){this.lineAnnotations=t;return}if(!this.isNewAnnotations(t))return;this.lineAnnotations=t,gd(n,t,S)}syncEditSessionAnnotationsFromEditor(t){let n=this.editSession?.annotations;if(n==null||t===n.current)return!1;return n.current=t,this.hunksRenderer.setLineAnnotations(t),this.renderAnnotations(),!0}canPartiallyRender(t,n,s){if(t||n||s||typeof this.options.hunkSeparators==="function")return!1;return!0}setSelectedLines(t,n){if(this.lineStateRefreshPending)this.deferredSelectedLines=[t,n];else this.interactionManager.setSelection(t,n)}setEditorActiveLine(t,n){if(this.lineStateRefreshPending)this.deferredEditorActiveLine=[t,n];else this.interactionManager.setEditorActiveLine(t,{lineNumberOnly:n?.lineNumberOnly,side:n?.side??"additions"})}flushDeferredLineState(){let{deferredEditorActiveLine:t,deferredSelectedLines:n}=this;if(this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,t!=null)this.setEditorActiveLine(...t);if(n!=null)this.interactionManager.setSelection(...n)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:t="split",overflow:n="scroll"}=this.options;if(this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:n==="wrap",columnVariables:this.shouldApplyColumnVariables(n)?"apply":"measure"}),n==="scroll"&&t==="split")this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions);else this.scrollSyncManager.cleanUp();this.managersDirty=!1}shouldApplyColumnVariables(t){if(typeof this.options.hunkSeparators==="function")return!0;return t==="scroll"&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute("data-has-merge-conflict")===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(t){if(this.codeUnified!=null)this.codeUnified.scrollLeft=t;if(this.codeAdditions!=null)this.codeAdditions.scrollLeft=t;if(this.codeDeletions!=null)this.codeDeletions.scrollLeft=t}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(t=!1){let{editor:n}=this;if(D(this.handleEditSessionRender),this.emitPostRender(!0),n?.cleanUp(t?"recycle":"discard"),!t)this.editor=void 0;if(this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,!t)this.pendingFiles=void 0;if(!this.isContainerManaged)this.fileContainer?.remove();if(this.fileContainer=void 0,this.mounted=!1,!t)this.lineAnnotations=[];if(this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,!t)this.clearReusableHeader();if(this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,t)this.hunksRenderer.recycle();else this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0;if(this.refreshViewTimeout!=null)clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:t,prerenderedHTML:n,preventEmit:s=!1,lineAnnotations:a,fileDiff:l,...d}){if(!this.enabled)throw Error("FileDiff.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw Error("FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated");let f=Tl(d,"FileDiff.hydrate"),h=f?.oldFile,g=f?.newFile;this.hydrateElements(t,n);let I=this.editor!=null;if(I||OF(this.pre,MF({fileDiff:l,oldFile:h,newFile:g}),this.options.collapsed)||$F(this.headerElement,_F({fileDiff:l,oldFile:h,newFile:g}),this.options.disableFileHeader))this.render({...d,fileContainer:t,lineAnnotations:a,fileDiff:l,forceRender:I||d.forceRender,preventEmit:!0});else this.hydrationSetup({fileDiff:l,lineAnnotations:a,...f});if(!s)this.emitPostRender()}hydrateElements(t,n){if(this.fileContainer!==t)this.emitPostRender(!0);Sd(t,n);for(let s of t.shadowRoot?.children??[]){if(s instanceof SVGElement){this.spriteSVG=s;continue}if(!(s instanceof HTMLElement))continue;if(s instanceof HTMLPreElement){this.pre=s;for(let a of s.children){if(!(a instanceof HTMLElement)||a.tagName.toLowerCase()!=="code")continue;if("deletions"in a.dataset)this.codeDeletions=a;if("additions"in a.dataset)this.codeAdditions=a;if("unified"in a.dataset)this.codeUnified=a}continue}if("diffsHeader"in s.dataset){this.headerElement=s;continue}if(s instanceof HTMLStyleElement&&s.hasAttribute("data-theme-css")){this.themeCSSStyle=s;continue}if(s instanceof HTMLStyleElement&&s.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=s,this.appliedUnsafeCSS=s.textContent;continue}}if(this.pre!=null)this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated");this.fileContainer=t,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:t,oldFile:n,newFile:s,lineAnnotations:a}){if(this.lineAnnotations=a??this.lineAnnotations,this.additionFile=s,this.deletionFile=n,this.fileDiff=t??(n!==void 0&&s!==void 0?ai(n,s,this.options.parseDiffOptions):void 0),this.pre==null)return;this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers()}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(t,n,s)=>{this.expandHunk(t,n,s)};expandHunk=(t,n,s)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(t,n,s),this.rerender()};loadFilesIfNecessary(){let{fileDiff:t,options:{loadDiffFiles:n}}=this;if(t==null||!Jp(t)||this.pendingFiles?.fileDiff===t)return;if(n==null)throw Error("FileDiff: loadDiffFiles is required to load full files for a partial diff");let s=this.loadFilesForDiff(t,n),a=this.pendingFiles={fileDiff:t,promise:s},l=()=>{if(this.pendingFiles===a)this.pendingFiles=void 0};a.promise=s.finally(l)}__canAttachEditor(){return this.fileDiff!=null&&!this.fileDiff.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;let t=this.__prepareForEditing();if(t==null){if(this.fileDiff?.isPartial===!0&&!Jp(this.fileDiff))throw Error("FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff");throw Error("FileDiff.prepareForEditing: a partial diff requires loadDiffFiles")}if(await t,!this.__canAttachEditor())throw Error("FileDiff.prepareForEditing: the diff did not finish loading")}__prepareForEditing(){if(this.__canAttachEditor())return;if(this.fileDiff?.isPartial===!0&&!Jp(this.fileDiff))throw Error("FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit");return this.loadFilesIfNecessary(),this.pendingFiles?.promise}async loadFilesForDiff(t,n){try{let s=await n(t);if(this.fileDiff!==t)return;await this.handleFilesLoaded(t,s)}catch(s){if(this.options.disableErrorHandling===!0)throw s;console.error(s)}}async handleFilesLoaded(t,n){if(this.fileDiff!==t||!t.isPartial)return;if(wl("merge",t,n),this.setHydratedState(n),this.installHydratedSessionDiff(t)){this.rerender();return}if(await kl(()=>this.primeHighlightCache(t)),!this.enabled||this.fileDiff!==t)return;this.rerender()}installHydratedSessionDiff(t){if(t.isPartial)throw Error("FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing");if(this.fileDiff!==t)return!1;if(this.editSession?.outgoingDiff!=null)return this.installEditSession(t),!0;return!1}updateExternalDiff(t,n){if(m(this.fileDiff,t))return!1;let s=this.editSession?.outgoingDiff??this.editSession?.diff;if(this.fileDiff=t,s!=null){if(t.isPartial)this.loadFilesIfNecessary();else this.installEditSession(t);if(this.editSession!=null)this.editSession.outgoingDiff=s}if(this.editSession?.annotations!=null&&n!=null)this.lineAnnotations=n,this.editSession.annotations=ua(n,S,this.editSession.annotations);return!0}installEditSession(t,n,s){let a=t.additionLines.join(""),l=n!=null?ma(n.contents):void 0,d=s!=null&&LF(s,t);if(s!=null&&!d)throw Error("FileDiff: retained session cannot resume against a different old file");if(n!=null&&n.contents!==a&&!d)throw Error("FileDiff: retained edits are missing their diff session state");let f=n==null||n.name===t.name&&n.lang===t.lang&&n.contents===a,h=wF(t);if(n!=null&&l!=null&&!f)h.name=n.name,h.lang=n.lang;if(d&&s!=null&&l!=null)h.additionLines=l,h.type=s.type,h.hunks=s.hunks,h.editSessionDirty=!0,ha(h);this.editSession={diff:h,annotations:this.editSession?.annotations??ua(this.lineAnnotations,S),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(h,f&&!d?t:void 0)}setHydratedState(t){this.deletionFile=t.oldFile,this.additionFile=t.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:t,deferManagers:n=!1,forceRender:s=!1,preventEmit:a=!1,lineAnnotations:l,fileContainer:d,containerWrapper:f,renderRange:h,...g}){if(!this.enabled)throw Error("FileDiff.render: attempting to call render after cleaned up");let I=Tl(g,"FileDiff.render"),b=I?.oldFile,v=I?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:k=!1,themeType:w="system",expandUnchanged:P=!1}=this.options,M=k?void 0:h,N=this.hasThemeChanged(),_=I!=null,O=_&&(!P0(b,this.deletionFile)||!P0(v,this.additionFile)),B=t!=null&&!m(t,this.fileDiff),X=l!=null&&(l.length>0||this.getLatestAnnotations().length>0)?this.isNewAnnotations(l):!1;if(!k&&ko(M,this.renderRange)&&!s&&!X&&!N&&(t!=null&&!B||t==null&&!O)){let ue=this.applyCachedThemeState(w);if(ue)this.finalizeRender();return ue}let z;if(t==null&&_&&(O||this.fileDiff==null))z=ai(I.oldFile,I.newFile,this.options.parseDiffOptions);let{renderRange:K}=this;if(this.renderRange=M,_)this.deletionFile=b,this.additionFile=v;else if(t!=null)this.deletionFile=void 0,this.additionFile=void 0;if(t!=null&&B)this.updateExternalDiff(t,l);else if(z!=null)B=!0,this.updateExternalDiff(z,l);if(B)this.clearReusableHeader();if(l!=null)this.setLineAnnotations(l);let W=this.getLatestDiff();if(W==null)return!1;if(W.editSessionDirty===!0&&this.shouldSelfHealEditSession())Kp(W,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult();if(P)this.loadFilesIfNecessary();this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:J=!1,disableFileHeader:ee=!1}=this.options;if(ee){if(this.headerElement!=null)this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0;this.clearHeaderSlots()}if(d=this.getOrCreateFileContainer(d,f),this.applyCachedThemeState(w),k){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let ue=this.hunksRenderer.renderDiff(W,Uc);if(ue!=null)this.applyThemeState(d,ue.themeStyles,w,ue.baseThemeType);if(ue?.headerElement!=null)this.applyHeaderToDOM(ue.headerElement,d,ue.fileDiff);this.renderSeparators([]),this.renderedDiff=ue?.fileDiff??W,this.injectUnsafeCSS()}catch(ue){if(J)throw ue;if(console.error(ue),ue instanceof Error)this.applyErrorToDOM(ue,d)}if(this.finalizeRender(),!a)this.emitPostRender();return!0}try{let ue=this.getOrCreatePreNode(d);if(!(this.canPartiallyRender(s,X,O||B||N||!m(this.renderedDiff,W))&&this.applyPartialRender({fileDiff:W,previousRenderRange:K,renderRange:M}))){let Ae=this.hunksRenderer.renderDiff(W,M);if(Ae==null){if(this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool())this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender());return!1}if(this.applyThemeState(d,Ae.themeStyles,w,Ae.baseThemeType),Ae.headerElement!=null)this.applyHeaderToDOM(Ae.headerElement,d,Ae.fileDiff);if(Ae.additionsContentAST!=null||Ae.deletionsContentAST!=null||Ae.unifiedContentAST!=null)this.applyHunksToDOM(ue,Ae);else if(this.pre!=null)this.pre.remove(),this.pre=void 0;this.renderSeparators(Ae.hunkData),this.renderedDiff=Ae.fileDiff}if(this.applyBuffers(ue,M),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,!n)this.flushManagers();if(this.finalizeRender(),this.editor!=null)this.syncRenderViewToEditor()}catch(ue){if(J)throw ue;if(console.error(ue),ue instanceof Error)this.applyErrorToDOM(ue,d)}if(!a)this.emitPostRender();return!0}finalizeRender(){}emitPostRender(t=!1){let{fileContainer:n,options:{onPostRender:s}}=this;if(t){if(!this.mounted)return;if(this.mounted=!1,n==null)return;this.options.onPostRender?.(n,this,"unmount");return}if(n==null)return;let a=this.mounted?"update":"mount";this.mounted=!0,s?.(n,this,a)}getLatestDiff(t=this.fileDiff){return this.editSession?.diff??t}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:t,fileContainer:n}=this,s=this.getLatestAnnotations(),a=this.computeEditorRenderRange(this.renderRange),l=this.getLatestDiff();if(t==null||n==null||l==null||l.isPartial)return;let d=(I)=>{if(!this.enabled||this.editor!==t||this.fileContainer!==n||this.getLatestDiff()!==l)return;let b=this.editSession?.outgoingDiff,{fileDiff:v}=this,k=b!=null&&v!=null&&b!==l,w=k&&b!=null&&v!=null?A0(b,v):!1;t.__syncRenderView({highlighter:I,fileContainer:n,fileDiff:l,lineAnnotations:s,renderRange:a,externalDocument:k,resetHistory:w})},f=this.getTheme(),h=l.lang??p(l.name),g=T({theme:f,lang:h});if(g!=null)d(g);else j({themes:C(f),langs:["text",h],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(d)}computeEditorRenderRange(t){let n=this.getLatestDiff();if(t==null||n==null||cs(t))return t;let{diffStyle:s="split",expandUnchanged:a=!1,collapsedContextThreshold:l=1}=this.options,d,f;if(si({diff:n,diffStyle:s,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l,callback:({additionLine:h})=>{if(h!=null)d??=h.lineNumber,f=h.lineNumber}}),d==null||f==null)return{...t,startingLine:0,totalLines:0};return{...t,startingLine:d-1,totalLines:f-d+1}}__acknowledgeDocumentUpdate(){if(this.editSession!=null)this.editSession.outgoingDiff=void 0}__acceptEditorChange(t){let{lineAnnotations:n}=t;if(n!=null)this.syncEditSessionAnnotationsFromEditor(n)}emitEditChange(t){let{onEditChange:n}=this.options;n?.(t)}__captureDocumentSessionState(t=!0){let{fileDiff:n,editSession:{diff:s,outgoingDiff:a}={}}=this;if(a!=null&&n!=null){if(!n.isPartial&&A0(a,n))return;s=a}if(s==null||s.isPartial)return;return{diffSession:{oldFile:s.type!=="new"?{name:s.prevName??s.name,lines:t?[...s.deletionLines]:s.deletionLines}:null,type:s.type,hunks:t?Pe(s.hunks):s.hunks},hasChanges:s.editSessionDirty===!0}}__attachEditor(t){if(this.type!=="file-diff")throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error("FileDiff.__attachEditor: an editor is already attached");if(!this.__canAttachEditor())throw Error("FileDiff.__attachEditor: a complete diff is required before editing");let n=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(t),n}catch(s){throw n(),s}}__resumeEditor(t){if(this.editor!==t)throw Error("FileDiff.__resumeEditor: editor association changed");this.resumeEditorRendering(t)}resumeEditorRendering(t){let{fileDiff:n}=this,s=this.editSession?.outgoingDiff;if(s!=null&&n!=null&&!n.isPartial&&this.editSession?.diff===s)this.installEditSession(n);let a=this.editSession==null&&n!=null&&!n.isPartial?n:void 0;if(a!=null)this.installEditSession(a,t.__getDocumentContents(PF(a)),t.__getDocumentSessionState());else if(this.editSession!=null)this.hunksRenderer.beginEditSession(this.editSession.diff);if(this.editor=t,this.fileDiff?.isPartial===!0)this.loadFilesIfNecessary();let l=this.editSession?.diff;if(this.hunksRenderer.editorRenderReady()){if(l!=null&&this.hunksRenderer.diffCache===l)this.renderedDiff=l;this.syncRenderViewToEditor()}else this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(t,n){this.settleEditSession(n==="install",t)}settleEditSession(t,n){let{editSession:s,fileDiff:a,lineAnnotations:l}=this;if(s==null||a==null)return;let{diff:d,annotations:f}=s;if(this.editor!=null)throw Error("FileDiff.__completeEditSession: detach the editor before completing the session");this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let h=f?.current,g,I=null,b=null,v=!1,k;if(n==null)throw Error("FileDiff.__completeEditSession: editor is required for completion");let w=vd(d),P={name:w.name,contents:w.additionLines.join("")};if(w.lang!=null)P.lang=w.lang;let M={fileDiff:w,editor:n,originalFileDiff:a,oldFile:w.type==="new"?null:{name:w.prevName??w.name,contents:w.deletionLines.join("")},newFile:P,lineAnnotations:h,originalLineAnnotations:l};Object.freeze(M);try{if(n.__emitEditComplete(M),this.options.onEditComplete?.(M)==="accept"){if(w.cacheKey!=null&&w.cacheKey===a.cacheKey)throw Error("FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey");g=w,I=M.oldFile,b=M.newFile}}catch(N){v=!0,k=N}if(t&&g!=null){if(this.fileDiff=g,this.additionFile!=null)this.deletionFile=I,this.additionFile=b;if(h!=null)this.lineAnnotations=h}if(this.editSession=void 0,t&&this.fileContainer!=null)this.rerender();if(v)throw k}finalizeEditSessionHunks(){let t=this.getLatestDiff();if(t==null||t.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:n=1}=this.options,s=I0(t,this.hunksRenderer.getExpandedHunksMap(),n);return Kp(t,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(S0(t,s)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(t,n){let s=this.editSession?.diff;if(s==null)throw Error("FileDiff.applyDocumentChange: requires an active edit session");if(this.detachAdditionLines(),this.hunksRenderer.beginEditSession(s),this.hunksRenderer.applyDocumentChange(t),n!=null)this.syncEditSessionAnnotationsFromEditor(n);this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(t,n){this.applyDocumentChange(t,n),this.hunksRenderer.clearRenderCache()}updateRenderCache(t,n,s={}){let a=this.editSession?.diff;if(a==null)throw Error("FileDiff.updateRenderCache: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(a);let{shouldRefreshDiffsView:l,lineCountChangeInFlight:d}=s;if(this.hunksRenderer.updateRenderCache(t,n,d)){if(this.refreshViewTimeout!=null)clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0;this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}if(l===!0){if(this.refreshViewTimeout!=null)clearTimeout(this.refreshViewTimeout);this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{if(this.refreshViewTimeout=void 0,this.options.diffStyle==="split")this.refreshSplitDiffView();else this.refreshUnifiedDiffView();this.flushDeferredLineState()},150)}}detachAdditionLines(){let t=this.editSession?.diff,{fileDiff:n}=this;if(t!=null&&(t.additionLines===n?.additionLines||t.additionLines===t.deletionLines))t.additionLines=[...t.additionLines]}isLineRenderable(t){let n=this.getRenderedDiff();if(n==null)return!0;let{expandUnchanged:s=!1,collapsedContextThreshold:a=1}=this.options;return Ed({fileDiff:n,lineNumber:t,expandedHunks:s?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a})}getNearestRenderableLine(t,n){let s=this.getRenderedDiff();if(s==null)return t;let{expandUnchanged:a=!1,collapsedContextThreshold:l=1}=this.options;return JS({fileDiff:s,lineNumber:t,direction:n,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l})}revealLine(t){let n=this.getRenderedDiff(),{expandUnchanged:s=!1,collapsedContextThreshold:a=1,expansionLineCount:l=100}=this.options;if(n==null||n.isPartial||s)return!1;let d=this.hunksRenderer.getExpandedHunksMap();for(let[I,b]of n.hunks.entries()){let[v,k]=da(b);if(t<v){let w=Ir({isPartial:n.isPartial,rangeSize:b.collapsedBefore,expandedHunks:d,hunkIndex:I,collapsedContextThreshold:a}),P=v-w.rangeSize;if(w.renderAll||t<P+w.fromStart||t>=v-w.fromEnd)return!1;let M=t-(P+w.fromStart)+1,N=v-w.fromEnd-t;if(M<=N)this.expandHunk(I,"up",M+l);else this.expandHunk(I,"down",N+l);return!0}if(t<k)return!1}let f=Sr({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:d,collapsedContextThreshold:a,errorPrefix:"FileDiff.revealLine"});if(f==null||f.renderAll)return!1;let h=n.hunks[n.hunks.length-1],[,g]=da(h);if(t<g+f.fromStart||t>=g+f.rangeSize)return!1;return this.expandHunk(n.hunks.length,"up",t-(g+f.fromStart)+1+l),!0}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){q(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:t}of this.separatorCache.values())t.remove();this.separatorCache.clear();for(let{element:t}of this.annotationCache.values())t.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(t){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let n=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",n.appendChild(this.placeHolder)}return this.setPlaceholderHeight(t)}setPlaceholderHeight(t){if(this.placeHolder==null)return!1;return this.placeHolder.style.setProperty("height",`${t}px`),!0}async primeHighlightCache(t=this.fileDiff){let{workerManager:n}=this;if(t==null||n==null||!n.isWorkingPool()||t.cacheKey==null||Z(t))return;let s=this.options.tokenizeMaxLength??1e5;if(Math.max(t.additionLines.length,t.deletionLines.length)>s)return;await n.primeDiffHighlightCache(t).catch((a)=>{console.error(a)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(t){let{hunkSeparators:n}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof n!=="function"){for(let{element:a}of this.separatorCache.values())a.remove();this.separatorCache.clear();return}let s=new Map(this.separatorCache);for(let a of t){let l=a.slotName,d=this.separatorCache.get(l);if(d==null||!R0(a,d.hunkData)){d?.element.remove();let f=document.createElement("div");f.style.display="contents",f.slot=a.slotName;let h=n(a,this);if(h!=null)f.appendChild(h);this.fileContainer.appendChild(f),d={element:f,hunkData:a},this.separatorCache.set(l,d)}s.delete(l)}for(let[a,{element:l}]of s.entries())this.separatorCache.delete(a),l.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:a}of this.annotationCache.values())a.remove();this.annotationCache.clear();return}let t=new Map(this.annotationCache),{renderAnnotation:n}=this.options,s=this.getLatestAnnotations();if(n!=null&&s.length>0)for(let[a,l]of s.entries()){let d=this.getAnnotationSlotName(l),f=`${a}-${d}`,h=this.annotationCache.get(f);if(h==null||!w0(l,h.annotation)){h?.element.remove();let g=n(l);if(g==null)continue;h={element:ud(d),annotation:l},h.element.appendChild(g),this.fileContainer.appendChild(h.element),this.annotationCache.set(f,h)}t.delete(f)}for(let[a,{element:l}]of t.entries())this.annotationCache.delete(a),l.remove()}renderGutterUtility(){let{renderGutterUtility:t}=this.options;if(this.fileContainer==null||t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=t(this.interactionManager.getHoveredLine);if(n!=null&&this.gutterUtilityContent!=null)return;else if(n==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let s=cd();s.appendChild(n),this.fileContainer.appendChild(s),this.gutterUtilityContent=s}getOrCreateFileContainer(t,n){let{fileContainer:s}=this,a=t??s??document.createElement("diffs-container"),l=s!==a;if(s!=null&&l)this.editor?.__captureFocusForDOMReplacement();if(l)this.emitPostRender(!0);if(this.fileContainer=a,s!=null&&l)this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0;if(n!=null&&this.fileContainer.parentNode!==n)n.appendChild(this.fileContainer);if(l)this.adoptReusableShellElements(this.fileContainer);return this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(t){let{shadowRoot:n}=t;if(n==null)return;for(let s of n.children)if(s instanceof SVGElement)this.spriteSVG??=s;else if(Co(s)&&s.hasAttribute("data-theme-css"))this.themeCSSStyle??=s,this.hasAdoptedThemeCSS=!0;else if(Co(s)&&s.hasAttribute("data-unsafe-css"))this.unsafeCSSStyle??=s,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0}ensureSpriteSVG(t){let n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.spriteSVG==null){let s=document.createElement("div");s.innerHTML=ad;let a=s.firstChild;if(a instanceof SVGElement)this.spriteSVG=a}if(this.spriteSVG!=null&&this.spriteSVG.parentNode!==n)n.appendChild(this.spriteSVG)}getOrCreatePreNode(t){let n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.pre==null)this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,n.appendChild(this.pre);else if(this.pre.parentNode!==n)this.editor?.__captureFocusForDOMReplacement(),n.appendChild(this.pre),this.appliedPreAttributes=void 0;return this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(t){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let n of Array.from(t.children)){if(!(n instanceof HTMLElement))continue;if(n.hasAttribute("data-unified"))this.codeUnified=n;else if(n.hasAttribute("data-deletions"))this.codeDeletions=n;else if(n.hasAttribute("data-additions"))this.codeAdditions=n}}applyHeaderToDOM(t,n,s){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:a,html:l,lastRenderedHTML:d}}=this,f=(s!==this.editSession?.diff&&m(a,s)?l:void 0)??pn(t);if(this.headerCache.html=f,this.headerCache.fileDiff=s,f!==d){let P=document.createElement("div");P.innerHTML=f;let M=P.firstElementChild;if(!(M instanceof HTMLElement))return;if(this.headerElement!=null)n.shadowRoot?.replaceChild(M,this.headerElement);else n.shadowRoot?.prepend(M);this.headerElement=M,this.headerCache.lastRenderedHTML=f}if(this.isContainerManaged)return;let{renderCustomHeader:h,renderHeaderPrefix:g,renderHeaderFilenameSuffix:I,renderHeaderMetadata:b}=this.options;if(h!=null){let P=h(s)??void 0;this.headerCustom=this.upsertHeaderSlotElement(n,this.headerCustom,Qs,P),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let v=g?.(s)??void 0,k=I?.(s)??void 0,w=b?.(s)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(n,this.headerPrefix,Xs,v),this.headerFilenameSuffix=this.upsertHeaderSlotElement(n,this.headerFilenameSuffix,Ys,k),this.headerMetadata=this.upsertHeaderSlotElement(n,this.headerMetadata,Js,w),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(t,n,s,a){if(a==null){n?.remove();return}let l=n??this.createHeaderSlotElement(s);if(n==null)t.appendChild(l);return this.replaceHeaderSlotContent(l,a),l}replaceHeaderSlotContent(t,n){if(t.replaceChildren(),n instanceof Element)t.appendChild(n);else t.innerText=`${n}`}createHeaderSlotElement(t){let n=document.createElement("div");return n.slot=t,n}injectUnsafeCSS(){let{unsafeCSS:t}=this.options,n=this.fileContainer?.shadowRoot;if(n==null)return;if(t==null||t===""){if(this.unsafeCSSStyle!=null)this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0;this.appliedUnsafeCSS=void 0;return}if(this.unsafeCSSStyle?.parentNode===n&&this.appliedUnsafeCSS===t)return;if(this.unsafeCSSStyle??=dd(),this.unsafeCSSStyle.parentNode!==n)n.appendChild(this.unsafeCSSStyle);this.unsafeCSSStyle.textContent=fd(t),this.appliedUnsafeCSS=t}applyThemeState(t,n,s,a){let l=t.shadowRoot??t.attachShadow({mode:"open"}),d=a??s,f=this.getTheme(),h=typeof f==="string"?f:{...f},g=To(l);if(this.themeCSSStyle?.parentNode===l&&this.appliedThemeCSS?.themeStyles===n&&this.appliedThemeCSS.themeType===d&&this.appliedThemeCSS.scrollbarGutter===g){this.appliedThemeCSS.theme=h;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===l){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:h,themeStyles:n,themeType:d,baseThemeType:a,scrollbarGutter:g};return}this.themeCSSStyle=Id({shadowRoot:l,currentNode:this.themeCSSStyle,themeCSS:pd(n,d,g)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:h,themeStyles:n,themeType:d,baseThemeType:a,scrollbarGutter:g}:void 0}hydrateMeasuredScrollbar(){let t=this.fileContainer?.shadowRoot;if(t==null||this.themeCSSStyle==null)return;this.themeCSSStyle.textContent=hd(this.themeCSSStyle.textContent??"",To(t))}shouldGuardRebuildScroll(){return this.editor!=null&&oe()}applyHunksToDOM(t,n){if(this.shouldGuardRebuildScroll())vl(t,()=>this.replaceCodeColumns(t,n));else this.replaceCodeColumns(t,n)}applyCodeColumnsInPlace(t,n,s){let a=this.getColumnPair(t);if(a==null)return!1;let l=Ro(n[0]),d=Ro(n[1]);if(l==null||d==null)return!1;if(a.gutter.innerHTML=pn(l),a.content.innerHTML=pn(d),s!==this.lastRowCount)a.gutter.style.setProperty("grid-row",`span ${s}`),a.content.style.setProperty("grid-row",`span ${s}`);return!0}replaceCodeColumns(t,n){let{overflow:s="scroll"}=this.options,a=(this.options.hunkSeparators??"line-info")==="line-info",l=s==="wrap"?n.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,n);let d=!1,f=[],h=this.hunksRenderer.renderCodeAST("unified",n),g=this.hunksRenderer.renderCodeAST("deletions",n),I=this.hunksRenderer.renderCodeAST("additions",n);if(this.editor?.__captureFocusForDOMReplacement(),h!=null){if(d=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=ca({code:this.codeUnified,columnType:"unified",rowSpan:l,containerSize:a}),!this.applyCodeColumnsInPlace(this.codeUnified,h,n.rowCount))this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(h);f.push(this.codeUnified)}else if(g!=null||I!=null){if(g!=null){if(d=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=ca({code:this.codeDeletions,columnType:"deletions",rowSpan:l,containerSize:a}),!this.applyCodeColumnsInPlace(this.codeDeletions,g,n.rowCount))this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(g);f.push(this.codeDeletions)}else this.codeDeletions?.remove(),this.codeDeletions=void 0;if(I!=null){if(d=d||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=ca({code:this.codeAdditions,columnType:"additions",rowSpan:l,containerSize:a}),!this.applyCodeColumnsInPlace(this.codeAdditions,I,n.rowCount))this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(I);f.push(this.codeAdditions)}else this.codeAdditions?.remove(),this.codeAdditions=void 0}else this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0;if(f.length===0)t.textContent="";else if(d)t.replaceChildren(...f);this.lastRowCount=n.rowCount}applyPartialRender({fileDiff:t,previousRenderRange:n,renderRange:s}){let{pre:a,codeUnified:l,codeAdditions:d,codeDeletions:f,options:{diffStyle:h="split"}}=this;if(a==null||n==null||s==null||!Number.isFinite(n.totalLines)||!Number.isFinite(s.totalLines)||this.lastRowCount==null)return!1;let g=this.getCodeColumns(h,l,f,d);if(g==null)return!1;let I=n.startingLine,b=s.startingLine,v=I+n.totalLines,k=b+s.totalLines,w=Math.max(I,b),P=Math.min(v,k);if(P<=w)return!1;let M=Math.max(0,w-I),N=Math.max(0,v-P),_=this.trimColumns({columns:g,trimStart:M,trimEnd:N,previousStart:I,overlapStart:w,overlapEnd:P,diffStyle:h});if(_<0)throw Error("FileDiff.applyPartialRender: failed to trim to overlap");if(this.lastRowCount<_)throw Error("FileDiff.applyPartialRender: trimmed beyond DOM row count");let O=this.lastRowCount-_,B=(W,J)=>{if(J<=0)return;return this.hunksRenderer.renderDiff(t,{startingLine:W,totalLines:J,bufferBefore:0,bufferAfter:0})},X=B(b,Math.max(w-b,0));if(X==null&&b<w)return!1;let z=B(P,Math.max(k-P,0));if(z==null&&k>P)return!1;let K=(W,J)=>{if(W==null)return;if(h==="unified"&&!Array.isArray(g))this.insertPartialHTML(h,g,W,J);else if(h==="split"&&Array.isArray(g))this.insertPartialHTML(h,g,W,J);else throw Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");O+=W.rowCount,this.renderedDiff=W.fileDiff};if(this.cleanupErrorWrapper(),K(X,"afterbegin"),K(z,"beforeend"),this.lastRowCount!==O)this.applyRowSpan(h,g,O),this.lastRowCount=O;return!0}insertPartialHTML(t,n,s,a){if(t==="unified"&&!Array.isArray(n)){let l=this.hunksRenderer.renderCodeAST("unified",s);this.renderPartialColumn(n,l,a)}else if(t==="split"&&Array.isArray(n)){let l=this.hunksRenderer.renderCodeAST("deletions",s),d=this.hunksRenderer.renderCodeAST("additions",s);this.renderPartialColumn(n[0],l,a),this.renderPartialColumn(n[1],d,a)}else throw Error("FileDiff.insertPartialHTML: Invalid argument composition")}refreshSplitDiffView(){let t=this.getLatestDiff();if(this.options.diffStyle!=="split"||t==null)return;let n=this.hunksRenderer.renderDiff(t,this.renderRange);if(n==null)return;let s=this.getCodeColumns("split",this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(s))return;let a=(l,d)=>{if(d==null)return;let f=this.hunksRenderer.renderCodeAST(l,n),h=Ro(f?.[0]),g=Ro(f?.[1]);for(let[I,b]of[[d.gutter,h],[d.content,g]])if(b!=null&&I.childElementCount===b.length)for(let v=0;v<b.length;v++){let k=I.children[v],w=b[v].properties["data-line-type"];if(w!=null&&k.dataset.lineType!==w)k.dataset.lineType=w}};a("deletions",s[0]),a("additions",s[1]),this.renderedDiff=n.fileDiff}refreshUnifiedDiffView(){let t=this.getLatestDiff();if(this.options.diffStyle!=="unified"||t==null)return;let n=this.hunksRenderer.renderDiff(t,this.renderRange);if(n==null)return;let s=this.getCodeColumns("unified",this.codeUnified,this.codeDeletions,this.codeAdditions);if(s==null||Array.isArray(s))return;let a=this.hunksRenderer.renderCodeAST("unified",n),l=Ro(a?.[0]),d=Ro(a?.[1]),f=()=>{for(let[h,g]of[[s.gutter,l],[s.content,d]])if(g!=null)h.innerHTML=pn(g);if(n.rowCount!==this.lastRowCount)this.applyRowSpan("unified",s,n.rowCount),this.lastRowCount=n.rowCount;this.renderedDiff=n.fileDiff};if(this.shouldGuardRebuildScroll())vl(this.pre,f);else f();this.renderSeparators(n.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(t,n,s){if(t==null||n==null)return;let a=Ro(n[0]),l=Ro(n[1]);if(a==null||l==null)throw Error("FileDiff.insertPartialHTML: Unexpected AST structure");let d=l.at(0);if(s==="beforeend"&&d?.type==="element"&&typeof d.properties["data-buffer-size"]==="number")this.mergeBuffersIfNecessary(d.properties["data-buffer-size"],t.content.children[t.content.children.length-1],t.gutter.children[t.gutter.children.length-1],a,l,!0);let f=l.at(-1);if(s==="afterbegin"&&f?.type==="element"&&typeof f.properties["data-buffer-size"]==="number")this.mergeBuffersIfNecessary(f.properties["data-buffer-size"],t.content.children[0],t.gutter.children[0],a,l,!1);t.gutter.insertAdjacentHTML(s,this.hunksRenderer.renderPartialHTML(a)),t.content.insertAdjacentHTML(s,this.hunksRenderer.renderPartialHTML(l))}mergeBuffersIfNecessary(t,n,s,a,l,d){if(!(n instanceof HTMLElement)||!(s instanceof HTMLElement))return;let f=this.getBufferSize(n.dataset);if(f==null)return;if(d)a.shift(),l.shift();else a.pop(),l.pop();this.updateBufferSize(n,f+t),this.updateBufferSize(s,f+t)}applyRowSpan(t,n,s){let a=(l)=>{if(l==null)return;l.gutter.style.setProperty("grid-row",`span ${s}`),l.content.style.setProperty("grid-row",`span ${s}`)};if(t==="unified"&&!Array.isArray(n))a(n);else if(t==="split"&&Array.isArray(n))a(n[0]),a(n[1]);else throw Error("dun fuuuuked up")}trimColumnRows(t,n,s){let a=0,l=0,d=0,f=!1,h=s>=0;if(t==null)return 0;let g=Array.from(t.content.children),I=Array.from(t.gutter.children);if(g.length!==I.length)throw Error("FileDiff.trimColumnRows: columns do not match");while(d<g.length){if(n<=0&&!h&&!f)break;let b=I[d],v=g[d];if(d++,!(b instanceof HTMLElement)||!(v instanceof HTMLElement))throw console.error({gutterElement:b,contentElement:v}),Error("FileDiff.trimColumnRows: invalid row elements");if(f){if(f=!1,b.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in v.dataset||b.dataset.gutterBuffer==="metadata"&&"noNewline"in v.dataset){b.remove(),v.remove(),l++;continue}}if("lineIndex"in b.dataset&&"lineIndex"in v.dataset){if(n>0||h&&a>=s){if(b.remove(),v.remove(),n>0){if(n--,n===0)f=!0}l++}a++;continue}if("separator"in b.dataset&&"separator"in v.dataset){if(n>0||h&&a>=s)b.remove(),v.remove(),l++;continue}if(b.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in v.dataset){if(n>0||h&&a>=s)b.remove(),v.remove(),l++;continue}if(b.dataset.gutterBuffer==="metadata"&&"noNewline"in v.dataset){if(n>0||h&&a>=s)b.remove(),v.remove(),l++;continue}if(b.dataset.gutterBuffer==="buffer"&&"contentBuffer"in v.dataset){let k=this.getBufferSize(v.dataset);if(k==null)throw Error("FileDiff.trimColumnRows: invalid element");if(n>0){let w=Math.min(n,k),P=k-w;if(P>0)this.updateBufferSize(b,P),this.updateBufferSize(v,P),l+=w;else b.remove(),v.remove(),l+=k;if(n-=w,n===0&&P===0)f=!0}else if(h){let w=a,P=a+k-1;if(s<=w)b.remove(),v.remove(),l+=k;else if(s<=P){let M=P-s+1,N=k-M;this.updateBufferSize(b,N),this.updateBufferSize(v,N),l+=M}}a+=k;continue}throw console.error({gutterElement:b,contentElement:v}),Error("FileDiff.trimColumnRows: unknown row elements")}return l}trimColumns({columns:t,diffStyle:n,overlapEnd:s,overlapStart:a,previousStart:l,trimEnd:d,trimStart:f}){let h=Math.max(0,a-l),g=s-l;if(g<0)throw Error("FileDiff.trimColumns: overlap ends before previous");let I=f>0,b=d>0;if(!I&&!b)return 0;let v=I?h:0,k=b?g:-1;if(n==="unified"&&!Array.isArray(t))return this.trimColumnRows(t,v,k);else if(n==="split"&&Array.isArray(t)){let w=this.trimColumnRows(t[0],v,k),P=this.trimColumnRows(t[1],v,k);if(t[0]!=null&&t[1]!=null&&w!==P)throw Error("FileDiff.trimColumns: split columns out of sync");return t[0]!=null?w:P}else throw console.error({diffStyle:n,columns:t}),Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(t){let n=Number.parseInt(t?.bufferSize??"",10);return Number.isNaN(n)?void 0:n}updateBufferSize(t,n){t.dataset.bufferSize=`${n}`,t.style.setProperty("grid-row",`span ${n}`),t.style.setProperty("min-height",`calc(${n} * 1lh)`)}getColumnPair(t){if(t==null)return;let n=t.children[0],s=t.children[1];if(!(n instanceof HTMLElement)||!(s instanceof HTMLElement)||n.dataset.gutter==null||s.dataset.content==null)return;return{gutter:n,content:s}}getCodeColumns(t,n,s,a){if(t==="unified")return this.getColumnPair(n);else{let l=this.getColumnPair(s),d=this.getColumnPair(a);return l!=null||d!=null?[l,d]:void 0}}updateBuffers(t){if(this.pre!=null)this.applyBuffers(this.pre,t)}applyBuffers(t,n){if(n==null||this.shouldDisableVirtualizationBuffers()){if(this.bufferBefore!=null)this.bufferBefore.remove(),this.bufferBefore=void 0;if(this.bufferAfter!=null)this.bufferAfter.remove(),this.bufferAfter=void 0;return}if(n.bufferBefore>0){if(this.bufferBefore==null)this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",t.before(this.bufferBefore);this.bufferBefore.style.setProperty("height",`${n.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")}else if(this.bufferBefore!=null)this.bufferBefore.remove(),this.bufferBefore=void 0;if(n.bufferAfter>0){if(this.bufferAfter==null)this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",t.after(this.bufferAfter);this.bufferAfter.style.setProperty("height",`${n.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")}else if(this.bufferAfter!=null)this.bufferAfter.remove(),this.bufferAfter=void 0}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(t,{additionsContentAST:n,deletionsContentAST:s,totalLines:a},l){let{diffIndicators:d="bars",disableBackground:f=!1,disableLineNumbers:h=!1,overflow:g="scroll",diffStyle:I="split"}=this.options,b={type:"diff",diffIndicators:d,disableBackground:f,disableLineNumbers:h,overflow:g,split:I==="unified"?!1:n!=null&&s!=null,totalLines:a,customProperties:l};if(ld(b,this.appliedPreAttributes))return;bd(t,b),this.appliedPreAttributes=b}applyErrorToDOM(t,n){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let s=n.shadowRoot??n.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",s.appendChild(this.errorWrapper);let a=document.createElement("div");a.dataset.errorMessage="",a.innerText=t.message,this.errorWrapper.appendChild(a);let l=document.createElement("pre");l.dataset.errorStack="",l.innerText=t.stack??"No Error Stack",this.errorWrapper.appendChild(l)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function PF(t){return{name:t.name,lang:t.lang,contents:t.additionLines.join("")}}function P0(t,n){if(t==null||n==null)return t==null&&n==null;return be(t,n)}function MF({fileDiff:t,oldFile:n,newFile:s}){return t!=null&&t.hunks.length>0||n!=null||s!=null}function _F({fileDiff:t,oldFile:n,newFile:s}){return t!=null||n!=null||s!=null}function OF(t,n,s=!1){return!s&&t==null&&n}function $F(t,n,s=!1){return t==null&&n&&!s}function Ro(t){if(t==null||t.type!=="element")return;return t.children??[]}var Zp=3000,Hd=new Map,FF=-1,F0=class extends M0{__id=`little-virtualized-file-diff:${++FF}`;renderType="virtualized";top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Hd,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(t,n,s,a,l=!1){super(t,a,l);this.virtualizer=n,this.metrics=aa(s)}setMetrics(t,n=!1){let s=aa(t);if(!n&&vi(this.metrics,s))return;this.metrics=s,this.resetLayoutCache({includeEstimatedHeights:!0})}setLineAnnotations(t){if(this.syncLineAnnotations(t))this.forceRenderOverride=!0}syncLineAnnotations(t){if(t==null||!this.isNewAnnotations(t)||t.length===0&&this.getLatestAnnotations().length===0)return!1;return super.setLineAnnotations(t),!0}syncEditSessionAnnotationsFromEditor(t){if(super.syncEditSessionAnnotationsFromEditor(t))return this.forceRenderOverride=!0,!0;return!1}setFileAnnotationHeight(t){let n=this.cache.fileAnnotationHeight;if(t===n)return!1;return this.cache.fileAnnotationHeight=t,this.cache.measuredHeightDeltaTotal+=t-n,!0}hasFileAnnotations(t){let n=this.getLatestAnnotations();if(!zc(n))return!1;return n.some((s)=>{if(s.lineNumber!==0)return!1;if(t.type==="new")return s.side==="additions";if(t.type==="deleted")return s.side==="deletions";return!0})}getLineHeight(t,n=!1){return this.getEstimatedLineHeight(n)+(this.cache.heightDeltas.get(t)??0)}getEstimatedLineHeight(t=!1){let n=t?2:1;return this.metrics.lineHeight*n}setOptions(t){if(this.isAdvancedMode())throw Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(t==null)return;let{options:n}=this,s=!oa(n,t),a=s&&GF(n,t);if(super.setOptions(t),a)this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:zF(n,t)});if(s)this.forceRenderOverride=!0;if(s&&this.isSimpleMode())this.virtualizer.instanceChanged(this,a)}setThemeType(t){if(this.isAdvancedMode())throw Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(t)}resetLayoutCache({forceSimpleRecompute:t=!1,includeEstimatedHeights:n=!1,resetRenderRange:s=!0}={}){if(this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=Hd,this.cache.ghostTextRowsByIndex.size>0)this.cache.ghostTextRowsByIndex.clear();if(this.invalidateDerivedLayoutCache(n,s),t&&this.isSimpleMode())this.computeApproximateSize()}invalidateDerivedLayoutCache(t,n=!0){if(this.layoutDirty=!0,this.cache.checkpoints.length>0)this.cache.checkpoints.length=0;if(this.cache.totalLines!==0)this.cache.totalLines=0;if(t)this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;if(this.renderRange!=null&&n)this.renderRange=void 0}applyGhostTextRows(t,n){let{cache:{heightDeltas:s,ghostTextRows:a,ghostTextRowsByIndex:l},metrics:{lineHeight:d}}=this;if(a===n)return!1;let f=this.getDiffStyle(),h=new Map;for(let[I,b]of n){let v=this.getLineIndexForDiff(t,I+1,"additions");if(v==null)continue;h.set(f==="split"?v[1]:v[0],b)}let g=!1;for(let I of new Set([...l.keys(),...h.keys()])){let b=((h.get(I)??0)-(l.get(I)??0))*d;if(b===0)continue;let v=(s.get(I)??0)+b;if(v===0)s.delete(I);else s.set(I,v);this.cache.measuredHeightDeltaTotal+=b,g=!0}return this.cache.ghostTextRows=n,this.cache.ghostTextRowsByIndex=h,g}reconcileHeights(){let t=!1,{options:{overflow:n="scroll"},metrics:{lineHeight:s}}=this,a=this.placeHolder!=null?this.getLayoutDiff():this.getRenderedDiff();if(this.fileContainer==null||a==null){if(this.height!==0)t=!0;return this.height=0,t}this.top=this.getVirtualizedTop(),t=this.applyGhostTextRows(a,this.editor?.__getGhostTextRows()??Hd);let{ghostTextRowsByIndex:l}=this.cache,d=n!=="scroll"||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!d&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0){if(t)this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height);return t}let f=this.getDiffStyle(),h=f==="split"?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&Eo(this.renderRange)){let g=NF(h)??0;if(this.setFileAnnotationHeight(g))t=!0}for(let g of h){if(g==null)continue;let I=g.children[1];if(!(I instanceof HTMLElement))continue;let b=f==="split"&&g===this.codeDeletions;for(let v of I.children){if(!(v instanceof HTMLElement))continue;let k=v.dataset.lineIndex;if(k==null)continue;let w=qF(k,f),P=l.get(w)??0;if(b&&P>0)continue;let M=this.cache.heightDeltas.get(w)??0;if(!d&&M===P*s)continue;let N=v.getBoundingClientRect().height+P*s,_=!1;if(v.nextElementSibling instanceof HTMLElement&&(("lineAnnotation"in v.nextElementSibling.dataset)||("noNewline"in v.nextElementSibling.dataset))){if("noNewline"in v.nextElementSibling.dataset)_=!0;N+=v.nextElementSibling.getBoundingClientRect().height}let O=this.getEstimatedLineHeight(_),B=N-O;if(B===M)continue;if(t=!0,this.cache.measuredHeightDeltaTotal+=B-M,B===0)this.cache.heightDeltas.delete(w);else this.cache.heightDeltas.set(w,B)}}if(t||this.isResizeDebuggingEnabled())this.computeApproximateSize(!0);return t}onRender=(t)=>{if(this.fileContainer==null)return!1;if(t)this.top=this.getVirtualizedTop();return this.render()};flushManagers(){if(super.flushManagers(),this.lineStateRefreshPending)this.flushDeferredLineState()}updateCodeViewLayout(t,n,s,a){let l=!1,d=!1,{pendingExpansions:f,pendingHydratedDiff:h,options:{collapsed:g=!1}}=this;if(h!=null){if(this.pendingHydratedDiff=void 0,h.expectedDiff===t)Object.assign(t,h.nextDiff),this.setHydratedState(h.files),this.installHydratedSessionDiff(t),this.forceRenderOverride=!0,l=!0,d=!0}if(f!=null){this.pendingExpansions=void 0;for(let{hunkIndex:P,direction:M,expansionLineCountOverride:N}of f)this.hunksRenderer.expandHunk(P,M,N),this.forceRenderOverride=!0,d=!0}let I=this.updateExternalDiff(t,a),{pendingRenderDiff:b,layoutDiffChanged:v,renderedDiffChanged:k,annotationsChanged:w}=this.updatePendingRender(t,a);if(!this.forceRenderOverride&&(I||k||w))this.forceRenderOverride=!0;if(s?.resetDiffLayoutCache===!0||v)l=!0;if(v||s?.resetDiffLayoutCache===!0&&s.includeEstimatedDiffHeights)d=!0;if(s?.metrics!=null)this.metrics=aa(s.metrics),l=!0,d=!0;if(this.currentCollapsed!==g)this.currentCollapsed=g,l=!0;if(l)this.resetLayoutCache({includeEstimatedHeights:d});else if(d)this.invalidateDerivedLayoutCache(!0);return this.top=n,this.computeApproximateSize(!1,b),this.height}getLinePosition(t,n="additions"){let s=this.getLayoutDiff();if(s==null||t<1)return;let a=this.getLineIndexForDiff(s,t,n);if(a==null)return;let{disableFileHeader:l=!1,expandUnchanged:d=!1,collapsed:f=!1,collapsedContextThreshold:h=1}=this.options,g=this.getDiffStyle(),I=this.getHunkSeparatorType(),b=g==="split"?a[1]:a[0];this.approximateLayoutCheckpoints(s);let v=Mr(this.metrics,l),k=this.getLayoutCheckpointBeforeLineIndex(b),w=k?.top??v+this.cache.fileAnnotationHeight;if(f)return{top:v,height:0};let P;return si({diff:s,diffStyle:g,startingLine:k?.renderedLineIndex??0,expandedHunks:d?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:h,callback:({hunkIndex:M,hunk:N,collapsedBefore:_,collapsedAfter:O,deletionLine:B,additionLine:X})=>{let z=g==="split"?X?.splitLineIndex??B?.splitLineIndex:X?.unifiedLineIndex??B?.unifiedLineIndex;if(z==null)throw Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(_>0){let W=ms({type:I,metrics:this.metrics,hunkIndex:M,hunkSpecs:N?.hunkSpecs});if(W!=null){if(w+=W.gapBefore,b>=z-_&&b<z)return P={top:w,height:W.height},!0;w+=W.height+W.gapAfter}}let K=this.getLineHeight(z,(X?.noEOFCR??!1)||(B?.noEOFCR??!1));if(z===b)return P={top:w,height:K},!0;if(w+=K,O>0){let W=Ji({type:I,metrics:this.metrics});if(W!=null){if(b>z&&b<=z+O)return P={top:w+W.gapBefore,height:W.height},!0;w+=W.totalHeight}}return!1}}),P}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(t){let n=this.getLayoutDiff();if(n==null)return;let{disableFileHeader:s=!1,expandUnchanged:a=!1,collapsed:l=!1,collapsedContextThreshold:d=1}=this.options;if(l)return;let f=this.getDiffStyle(),h=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(n);let g=this.getLayoutCheckpointBeforeTop(t),I=g?.top??Mr(this.metrics,s)+this.cache.fileAnnotationHeight,b;return si({diff:n,diffStyle:f,startingLine:g?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:d,callback:({hunkIndex:v,hunk:k,collapsedBefore:w,collapsedAfter:P,deletionLine:M,additionLine:N})=>{let _=f==="split"?N?.splitLineIndex??M?.splitLineIndex:N?.unifiedLineIndex??M?.unifiedLineIndex;if(_==null)throw Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(w>0){let B=ms({type:h,metrics:this.metrics,hunkIndex:v,hunkSpecs:k?.hunkSpecs});if(B!=null)I+=B.totalHeight}if(I>=t){if(M!=null)b={lineNumber:M.lineNumber,side:"deletions",top:I};else if(N!=null)b={lineNumber:N.lineNumber,side:"additions",top:I};if(b!=null)return!0}let O=this.getLineHeight(_,(N?.noEOFCR??!1)||(M?.noEOFCR??!1));if(I+=O,P>0){let B=Ji({type:h,metrics:this.metrics});if(B!=null)I+=B.totalHeight}return!1}}),b}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(t){let n=this.getLayoutDiff();if(this.top==null||n==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let s=t!=null?this.computeRenderRangeFromWindow(n,this.top,t):this.renderRange;if(s==null)return;let{bufferBefore:a,bufferAfter:l,totalLines:d}=s,f=0;if(d===0){let h=t??this.virtualizer.getWindowSpecs();if(this.top<h.top)f=l}return{topOffset:this.top+a+f,height:this.height-(a+l)}}cleanUp(t=!1){let n=this.cache.ghostTextRows.size>0;if(n)this.layoutDirty=!0;let s=t&&this.isAdvancedMode()&&this.fileContainer!=null&&(n||!m(this.getRenderedDiff(),this.getLatestDiff()));if(this.fileContainer!=null&&this.isSimpleMode())this.getSimpleVirtualizer()?.disconnect(this.fileContainer);if(!t)this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0;if(this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(t),s)this.virtualizer.instanceChanged(this,!0)}expandHunk=(t,n,s)=>{if(this.fileDiff==null)return;if(this.loadFilesIfNecessary(),this.isAdvancedMode())this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:t,direction:n,expansionLineCountOverride:s});else this.hunksRenderer.expandHunk(t,n,s),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize();this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)};async handleFilesLoaded(t,n){if(this.fileDiff!==t||!t.isPartial)return;if(this.isAdvancedMode()){let s=wl("clone",t,n);if(await kl(()=>this.primeHighlightCache(s)),this.fileDiff!==t)return;this.pendingHydratedDiff={expectedDiff:t,nextDiff:s,files:n}}else{if(wl("merge",t,n),this.setHydratedState(n),!this.installHydratedSessionDiff(t)){if(await kl(()=>this.primeHighlightCache(t)),this.fileDiff!==t)return}this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(t){if(super.isLineRenderable(t))return!0;let{pendingExpansions:n}=this,s=this.getRenderedDiff();if(n==null||n.length===0||s==null)return!1;let{expansionLineCount:a=100,collapsedContextThreshold:l=1}=this.options,d=new Map(this.hunksRenderer.getExpandedHunksMap());for(let f of n){let h={...d.get(f.hunkIndex)??{fromStart:0,fromEnd:0}},g=f.expansionLineCountOverride??a;if(f.direction==="up"||f.direction==="both")h.fromStart+=g;if(f.direction==="down"||f.direction==="both")h.fromEnd+=g;d.set(f.hunkIndex,h)}return Ed({fileDiff:s,lineNumber:t,expandedHunks:d,collapsedContextThreshold:l})}invalidateEditSessionLayout(){if(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),!this.isSimpleMode())this.computeApproximateSize(!0);this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){if(this.invalidateEditSessionLayout(),!this.enabled||this.fileDiff==null)return;this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(t){if(this.isAdvancedMode()||this.fileContainer==null)return;if(this.renderRange=void 0,t&&!this.isVisible)this.top=this.getVirtualizedTop(),this.isVisible=!0;else if(!t&&this.isVisible)this.isVisible=!1,this.rerender()}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let t=this.getLatestDiff(),n=t==null?void 0:this.hunksRenderer.getDiffForNextRender(t);if(this.isSimpleMode())this.pendingRender=void 0;this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!m(this.getRenderedDiff(),n))}syncGhostTextRows(){let t=this.getAdvancedVirtualizer();if(t!=null)t.capturePendingLayoutAnchor(),this.layoutDirty=!0,t.instanceChanged(this,!0);else this.getSimpleVirtualizer()?.requestHeightReconcile(this)}applyDocumentChange(t,n,s=!1){let{renderRange:a}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(t,n),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let l=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(s&&a!=null&&l!=null){let d=this.virtualizer.getWindowSpecs(),f=this.computeRenderRangeFromWindow(l,this.top??0,d);if(f.bufferAfter!==a.bufferAfter)this.updateBuffers(f)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(t=!1,n=this.getLayoutDiff()){let s=this.isResizeDebuggingEnabled();if(!t&&!this.layoutDirty&&!s)return;let a=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,n==null){this.layoutDirty=!1;return}this.applyGhostTextRows(n,this.editor?.__getGhostTextRows()??Hd);let{disableFileHeader:l=!1,collapsed:d=!1}=this.options,f=Mr(this.metrics,l);if(this.height+=f,d){this.layoutDirty=!1;return}if(this.height=this.getActiveEstimatedHeight(n)+this.cache.measuredHeightDeltaTotal,s&&!a)this.validateComputedHeight(n);this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(t=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(t);let n=this.getDiffStyle()==="split"?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(n==null)throw Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return n}ensureEstimatedDiffHeights(t=this.getLayoutDiff()){if(t==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:n=!1,expandUnchanged:s=!1,collapsedContextThreshold:a=1}=this.options,{splitHeight:l,unifiedHeight:d}=e0({fileDiff:t,metrics:this.metrics,disableFileHeader:n,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:s,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,canHydratePartialDiff:Qp(t,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=l,this.cache.estimatedUnifiedHeight=d}validateComputedHeight(t=this.getLayoutDiff()){if(this.fileContainer==null||t==null)return;let n=this.fileContainer.getBoundingClientRect();if(n.height!==this.height)console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:t.name,elementHeight:n.height,computedHeight:this.height});else console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:t,fileDiff:n,forceRender:s=!1,lineAnnotations:a,...l}={}){let d=Tl(l,"VirtualizedFileDiff.render"),f=d!=null,h=d?.oldFile,g=d?.newFile,I=f&&(!$0(h,this.deletionFile)||!$0(g,this.additionFile)),b=n??this.fileDiff;if(n==null&&f&&(I||this.fileDiff==null))b=ai(d.oldFile,d.newFile,this.options.parseDiffOptions);let{forceRenderOverride:v,isSetup:k}=this;this.forceRenderOverride=void 0;let w=b!=null&&!m(this.fileDiff,b),P=w||I;if(t=this.getOrCreateFileContainer(t),b==null)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(w)this.updateExternalDiff(b,a);let{pendingRenderDiff:M,layoutDiffChanged:N,renderedDiffChanged:_,annotationsChanged:O}=(()=>{if(this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(b)??b))return{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(a)};return this.updatePendingRender(b,a)})();if(N)this.resetLayoutCache({includeEstimatedHeights:!0});if(!k){this.computeApproximateSize(!1,M);let K=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(K==null)throw Error("VirtualizedFileDiff.render: simple virtualizer is not available");K.connect(t,this),this.isVisible=K.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}else if(this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode())this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,M);if(!this.isVisible&&this.isSimpleMode()&&(!P||!k)){if(d!=null)this.deletionFile=h,this.additionFile=g;if(w)this.clearReusableHeader();return this.renderPlaceholder(this.height)}let B=this.virtualizer.getWindowSpecs(),X=this.top??0,z=this.computeRenderRangeFromWindow(M,X,B);return super.render({fileDiff:b,fileContainer:t,renderRange:z,lineAnnotations:a,forceRender:(v??s)||O||_||w,...d,...l})}finalizeRender(){if(!m(this.getRenderedDiff(),this.pendingRender?.diff))throw Error("VirtualizedFileDiff.render: rendered a different diff than its prepared layout");if(this.pendingRender=void 0,this.isSimpleMode())this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(t,n){let s=this.getLatestDiff(t)??t,a=this.getRenderedDiff(),{pendingRender:l}=this,d=l?.diff??a,f=this.hunksRenderer.getDiffForNextRender(s);return this.pendingRender={latestDiff:s,diff:f},{pendingRenderDiff:f,annotationsChanged:this.syncLineAnnotations(n),layoutDiffChanged:!m(d,f),renderedDiffChanged:!m(a,f)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}getVirtualizedTop(){if(this.virtualizer.type==="advanced")return this.virtualizer.getLocalTopForInstance(this);return this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??"split"}getHunkSeparatorType(){return jF(this.options.hunkSeparators)}approximateLayoutCheckpoints(t){if(!this.layoutDirty&&this.cache.checkpoints.length>0||t.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:n=!1,expandUnchanged:s=!1,collapsedContextThreshold:a=1}=this.options,l=t.hunks.length-1,d=Qp(t,this.options.loadDiffFiles!=null),f=this.getDiffStyle(),h=this.getHunkSeparatorType(),g=s?!0:this.hunksRenderer.getExpandedHunksMap(),I=DF(this.cache.heightDeltas),b=Mr(this.metrics,n)+this.cache.fileAnnotationHeight,v=0,k=({rowCount:w,startLineIndex:P,preSeparatorHeight:M=0,postSeparatorHeight:N=0,metadataOffsets:_=[]})=>{if(w<=0)return;let O=v,B=v+w,X=HF(O);while(X<B){let z=X-O,K=b+(z>0?M:0)+z*this.metrics.lineHeight+UF(_,z)*this.metrics.lineHeight+_0(I,P,P+z);this.cache.checkpoints.push({renderedLineIndex:X,lineIndex:P+z,top:K}),X+=Zp}b+=M+w*this.metrics.lineHeight+_.length*this.metrics.lineHeight+_0(I,P,P+w)+N,v=B};for(let w=0;w<t.hunks.length;w++){let P=t.hunks[w];if(P==null)throw Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");let M=Ir({isPartial:t.isPartial,rangeSize:P.collapsedBefore,expandedHunks:g,hunkIndex:w,collapsedContextThreshold:a}),N=M.collapsedLines>0?ms({type:h,metrics:this.metrics,hunkIndex:w,hunkSpecs:P.hunkSpecs})?.totalHeight??0:0;k({rowCount:M.fromStart,startLineIndex:(f==="split"?P.splitLineStart:P.unifiedLineStart)-M.rangeSize});let _=N;if(k({rowCount:M.fromEnd,startLineIndex:(f==="split"?P.splitLineStart:P.unifiedLineStart)-M.fromEnd,preSeparatorHeight:_}),M.fromEnd>0)_=0;let O=w===l?Sr({fileDiff:t,hunkIndex:w,expandedHunks:g,collapsedContextThreshold:a,errorPrefix:"VirtualizedFileDiff"}):void 0,B=O!=null&&O.collapsedLines>0?Ji({type:h,metrics:this.metrics})?.totalHeight??0:w===l&&d?Ji({type:h,metrics:this.metrics})?.totalHeight??0:0,X=O!=null?O.fromStart+O.fromEnd:0,z=f==="split"?P.splitLineCount:P.unifiedLineCount,K=f==="split"?P.splitLineStart:P.unifiedLineStart;if(k({rowCount:z,startLineIndex:K,preSeparatorHeight:_,postSeparatorHeight:X===0?B:0,metadataOffsets:BF({diffStyle:f,hunk:P,rowCount:z})}),O!=null&&X>0)k({rowCount:X,startLineIndex:K+z,postSeparatorHeight:B})}this.cache.totalLines=v}getLayoutCheckpointBeforeLineIndex(t){if(t<=0||this.cache.checkpoints.length===0)return;let n=0,s=this.cache.checkpoints.length-1,a;while(n<=s){let l=n+s>>1,d=this.cache.checkpoints[l];if(d==null)throw Error("VirtualizedFileDiff: invalid checkpoint index");if(d.lineIndex<=t)a=d,n=l+1;else s=l-1}return a}getLayoutCheckpointBeforeTop(t,n){let s=0,a=this.cache.checkpoints.length-1,l=-1;while(s<=a){let d=s+a>>1,f=this.cache.checkpoints[d];if(f==null)throw Error("VirtualizedFileDiff: invalid checkpoint index");if(f.top<=t)l=d,s=d+1;else a=d-1}if(n==null)return l>=0?this.cache.checkpoints[l]:void 0;for(let d=l;d>=0;d--){let f=this.cache.checkpoints[d];if(f==null)throw Error("VirtualizedFileDiff: invalid checkpoint index");if(f.renderedLineIndex%n===0)return f}}getExpandedLineCount(t,n){let s=0;if(t.isPartial){for(let h of t.hunks)s+=n==="split"?h.splitLineCount:h.unifiedLineCount;return s}let{expandUnchanged:a=!1,collapsedContextThreshold:l=1}=this.options,d=a?!0:this.hunksRenderer.getExpandedHunksMap();for(let[h,g]of t.hunks.entries()){let I=n==="split"?g.splitLineCount:g.unifiedLineCount;s+=I;let b=Math.max(g.collapsedBefore,0),{fromStart:v,fromEnd:k,renderAll:w}=Ir({isPartial:t.isPartial,rangeSize:b,expandedHunks:d,hunkIndex:h,collapsedContextThreshold:l});if(b>0)s+=w?b:v+k}let f=Sr({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:d,collapsedContextThreshold:l,errorPrefix:"VirtualizedFileDiff"});if(f!=null)s+=f.fromStart+f.fromEnd;return s}getLayoutLineCount(t,n){let s=this.getExpandedLineCount(t,n),a=n==="split"?t.splitLineCount:t.unifiedLineCount;return Math.max(s,a,t.additionLines.length,t.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(t,n,{top:s,bottom:a}){let{disableFileHeader:l=!1,expandUnchanged:d=!1,collapsedContextThreshold:f=1}=this.options,{hunkLineCount:h,lineHeight:g}=this.metrics,I=this.getDiffStyle(),b=this.getHunkSeparatorType(),v=Qp(t,this.options.loadDiffFiles!=null),k=this.height,w=this.getLayoutLineCount(t,I),P=Mr(this.metrics,l),M=t.hunks.length>0?ss(this.metrics):0,{fileAnnotationHeight:N}=this.cache,_=P+N,O=Math.max(0,k-P-N-M),B=this.hasFileAnnotations(t),X=n+P,z=N>0&&B&&X<a&&X+N>s;if(n<s-k||n>a)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:k-P-M};if(w<=h||t.hunks.length===0)return{startingLine:0,totalLines:h,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(t),w=this.getLayoutLineCount(t,I);let K=Math.ceil(Math.max(a-s,0)/g),W=Math.ceil(K/h)*h+h,J=W/h,ee=J,ue=[],Ae=(s+a)/2,le=this.getLayoutCheckpointBeforeTop(Math.max(0,s-n-W*g*2),h),Se=n+(le?.top??_),lt=le?.renderedLineIndex??0,It,Ce,qe;if(si({diff:t,diffStyle:I,startingLine:le?.renderedLineIndex??0,expandedHunks:d?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:f,callback:({hunkIndex:Yo,hunk:lr,collapsedBefore:Fs,collapsedAfter:qa,deletionLine:Hi,additionLine:Ui})=>{let mn=Ui!=null?Ui.splitLineIndex:Hi.splitLineIndex,hr=Ui!=null?Ui.unifiedLineIndex:Hi.unifiedLineIndex,Rr=(Ui?.noEOFCR??!1)||(Hi?.noEOFCR??!1),Jo=Yo===t.hunks.length-1&&lr!=null&&(I==="split"?mn===lr.splitLineStart+lr.splitLineCount-1:hr===lr.unifiedLineStart+lr.unifiedLineCount-1),ni=(Fs>0?ms({type:b,metrics:this.metrics,hunkIndex:Yo,hunkSpecs:lr?.hunkSpecs}):void 0)?.totalHeight??0;Se+=ni;let Bi=lt%h===0,ho=Math.floor(lt/h);if(Bi){if(ue[ho]=Se-(n+_+ni),qe!=null){if(qe<=0)return!0;qe--}}let Wr=this.getLineHeight(I==="split"?mn:hr,Rr);if(Se>s-Wr&&Se<a)It??=ho;if(Ce==null&&Se+Wr>Ae)Ce=ho;if(qe==null&&Se>=a&&Bi)qe=ee;if(lt++,Se+=Wr,qa>0||Jo&&v){let ju=Ji({type:b,metrics:this.metrics});if(ju!=null){if(Se<a&&Se+ju.totalHeight>s)It??=ho;if(Ce==null&&Se+ju.totalHeight>Ae)Ce=ho;Se+=ju.totalHeight}}return!1}}),It==null)if(z)It=0,Ce=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:k-P-M};Ce??=It;let Tt=Math.round(Ce-J/2),jn=Math.max(0,Math.ceil(w/h)-J),St=Math.max(0,Math.min(Tt,jn)),Ft=St*h,sn=Tt<0?W+Tt*h:W,En=ue[St]??0,wr=Ft===0?0:N+En,Kr=St+sn/h,Vr=Kr<ue.length?O-ue[Kr]:O-(Se-n-_);return{startingLine:Ft,totalLines:sn,bufferBefore:wr,bufferAfter:Math.max(0,Vr)}}};function NF(t){let n;for(let s of t){if(s==null)continue;let a=s.children[1];if(!(a instanceof HTMLElement))continue;for(let l of a.children){if(!(l instanceof HTMLElement))continue;if(l.dataset.lineAnnotation!==Gc)continue;n=Math.max(n??0,l.getBoundingClientRect().height)}}return n}function DF(t){let n=Array.from(t).sort((d,f)=>d[0]-f[0]),s=[],a=[0],l=0;for(let[d,f]of n)s.push(d),l+=f,a.push(l);return{lineIndexes:s,prefixTotals:a}}function _0({lineIndexes:t,prefixTotals:n},s,a){if(s>=a||t.length===0)return 0;let l=O0(t,s);return(n[O0(t,a)]??0)-(n[l]??0)}function O0(t,n){let s=0,a=t.length;while(s<a){let l=s+a>>1,d=t[l];if(d==null)throw Error("VirtualizedFileDiff: invalid prefix index");if(d<n)s=l+1;else a=l}return s}function HF(t){return Math.ceil(t/Zp)*Zp}function UF(t,n){let s=0;for(let a of t)if(a<n)s++;return s}function BF({diffStyle:t,hunk:n,rowCount:s}){if(s<=0||!n.noEOFCRAdditions&&!n.noEOFCRDeletions)return[];let a=n.hunkContent.at(-1);if(a==null)return[];if(a.type==="context")return[s-1];let l=Math.max(a.deletions,a.additions),d=a.deletions+a.additions;if(t==="split")return l>0&&(n.noEOFCRAdditions||n.noEOFCRDeletions)?[s-1]:[];let f=[],h=s-d;if(a.deletions>0&&n.noEOFCRDeletions)f.push(h+a.deletions-1);if(a.additions>0&&n.noEOFCRAdditions)f.push(s-1);return f}function GF(t,n){return(t.diffStyle??"split")!==(n.diffStyle??"split")||(t.overflow??"scroll")!==(n.overflow??"scroll")||(t.collapsed??!1)!==(n.collapsed??!1)||(t.disableLineNumbers??!1)!==(n.disableLineNumbers??!1)||(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||(t.diffIndicators??"bars")!==(n.diffIndicators??"bars")||(t.hunkSeparators??"line-info")!==(n.hunkSeparators??"line-info")||Boolean(t.loadDiffFiles)!==Boolean(n.loadDiffFiles)||(t.expandUnchanged??!1)!==(n.expandUnchanged??!1)||(t.collapsedContextThreshold??1)!==(n.collapsedContextThreshold??1)||t.unsafeCSS!==n.unsafeCSS}function zF(t,n){return(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||(t.hunkSeparators??"line-info")!==(n.hunkSeparators??"line-info")||Boolean(t.loadDiffFiles)!==Boolean(n.loadDiffFiles)||(t.expandUnchanged??!1)!==(n.expandUnchanged??!1)||(t.collapsedContextThreshold??1)!==(n.collapsedContextThreshold??1)}function Qp(t,n){return t.isPartial&&n&&(t.type==="change"||t.type==="rename-changed")}function jF(t){return typeof t==="function"?"custom":t??"line-info"}function $0(t,n){if(t==null||n==null)return t==null&&n==null;return be(t,n)}function qF(t,n){let[s,a]=t.split(",").map(Number);return n==="split"?a:s}var KF=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","diffStyle","diffIndicators","disableBackground","expandUnchanged","loadDiffFiles","collapsedContextThreshold","lineDiffType","maxLineDiffLength","expansionLineCount","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],VF=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],N0=["renderCustomHeader","renderHeaderPrefix","renderHeaderFilenameSuffix","renderHeaderMetadata","renderAnnotation","renderGutterUtility","onPostRender","onGutterUtilityClick","onLineClick","onLineNumberClick","onLineEnter","onLineLeave","onTokenClick","onTokenEnter","onTokenLeave"],D0=["onLineSelected","onLineSelectionStart","onLineSelectionChange","onLineSelectionEnd"],V0=Symbol("CodeView.itemOptionsState");function H0(t,n){Object.defineProperty(t,V0,{configurable:!1,enumerable:!1,value:n})}function Lo(t){return t[V0]}function li(t,n,s){Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get(){return s(this)}})}var WF=120,U0=1,B0="--diffs-overflow-override",XF=12000000,YF=1e6,JF=2000000,QF=1e7,G0=11000000;function ZF(t){if(t==null)throw Error("CodeView: createEditor is required for items with edit: true")}var eN=(()=>{let{navigator:t}=globalThis,n=t.userAgent,s=/iP(?:hone|ad|od)/.test(n),a=t.platform==="MacIntel"&&t.maxTouchPoints>1;return(s||a)&&/AppleWebKit/.test(n)&&/Safari/.test(n)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(n)})(),Ut=class t{static __STOP=!1;static __lastScrollPosition=0;type="advanced";config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=Zs;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement("div");stickyContainer=document.createElement("div");stickyOffset=document.createElement("div");header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;constructor(n={theme:u},s,a=!1){this.options=n,this.computeMetricsCache(n.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=s,this.isContainerManaged=a,this.stickyOffset.style.contain="layout size",this.stickyContainer.style.position="sticky",this.stickyContainer.style.width="100%",this.stickyContainer.style.contain="layout style inline-size",this.stickyContainer.style.isolation="isolate",this.stickyContainer.style.display="flex",this.stickyContainer.style.flexDirection="column"}getLayout(){return this.options.layout??ZI}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(n){return this.itemMetricsCache={hunkLineCount:n?.hunkLineCount??Zs.hunkLineCount,lineHeight:n?.lineHeight??Zs.lineHeight,diffHeaderHeight:n?.diffHeaderHeight??Zs.diffHeaderHeight,hunkSeparatorHeight:n?.hunkSeparatorHeight,spacing:n?.spacing??Zs.spacing,paddingTop:n?.paddingTop,paddingBottom:n?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??eS}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return GI&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(n){if(!this.shouldValidateItemHeights()||n.element==null)return;let s=n.instance.getAdvancedStickySpecs();if(s==null)return;let a=s.height,l=n.element.getBoundingClientRect().height;if(a===l)return;console.error("CodeView: reconciled item height does not match DOM height",{id:n.item.id,type:n.type,index:n.index,version:n.version,expectedHeight:a,actualHeight:l,delta:l-a,stickyTopOffset:s.topOffset,virtualizedHeight:n.instance.getVirtualizedHeight(),top:n.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:n.element,instance:n.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:n,lastIndex:s,stickyHeight:a,stickyTop:l,stickyBottom:d}=this.renderState;if(n===-1||s===-1)return;let f=this.stickyContainer.getBoundingClientRect().height;if(Math.abs(f-a)<U0)return;console.error("CodeView: sticky container height does not match computed layout",{computedStickyHeight:a,actualStickyHeight:f,delta:f-a,stickyTop:l,stickyBottom:d,firstIndex:n,lastIndex:s,firstStickySpecs:this.items[n]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[s]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){if(this.scrollInteractionFixTimer!=null)clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0}suspendScrollInteractions(){if(this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled)this.stickyContainer.style.pointerEvents="none",this.pointerEventsDisabled=!0;if(eN&&!this.codeOverflowFix)this.stickyContainer.style.setProperty(B0,"hidden"),this.codeOverflowFix=!0;this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,WF)}restoreScrollInteractions=()=>{if(this.clearScrollInteractionTimer(),this.pointerEventsDisabled)this.stickyContainer.style.removeProperty("pointer-events"),this.pointerEventsDisabled=!1;if(this.codeOverflowFix)this.stickyContainer.style.setProperty(B0,"auto"),this.codeOverflowFix=!1};syncLayout(){let{gap:n,paddingBottom:s,paddingTop:a}=this.getLayout();this.stickyContainer.style.gap=`${n}px`,this.container?.style.setProperty("margin-top",`${a}px`),this.container?.style.setProperty("margin-bottom",`${s}px`)}reconcileHeaderFooterHosts(){let n=this.reconcileHost("header"),s=this.reconcileHost("footer");return n||s}reconcileHost(n){let{root:s,container:a}=this;if(s==null||a==null)return!1;let l=n==="header"?this.header:this.footer,d=n==="header"?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(d==null){if(l.element==null)return!1;return this.resizeObserver?.unobserve(l.element),l.element.remove(),l.element=void 0,l.render=void 0,this.setHostHeight(l,0),!1}if(l.element!=null&&d===l.render)return!1;let f=l.element??bS(n,a,this.resizeObserver);l.element=f;let h=d();if(h!=null)f.replaceChildren(h);else if(!this.isContainerManaged&&f.children.length>0)f.textContent="";return l.render=d,!0}setHostHeight(n,s){if(n.height===s)return;n.height=s,this.scrollDirty=!0}measureMountedHosts(){if(this.header.element!=null)this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height);if(this.footer.element!=null)this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(n){if(this.root!=null)throw Error("CodeView.setup: already setup");if(this.workerManager?.subscribeToThemeChanges(this),this.root=n,this.root.style.overflowAnchor="none",!this.root.hasAttribute("tabindex"))this.root.tabIndex=-1;this.container??=document.createElement("div"),this.container.style.contain="layout style",this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener("scroll",this.handleScroll,{passive:!0}),this.root.addEventListener("wheel",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("touchstart",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("pointerdown",this.clearPendingScroll,{passive:!0}),this.root.addEventListener("keydown",this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{if(t.__STOP)t.__STOP=!1,this.scrollTo({type:"position",position:t.__lastScrollPosition,behavior:"instant"});else t.__lastScrollPosition=this.getScrollTop(),t.__STOP=!0}}reset(){D(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let{items:n}=this,s=[...this.itemEditors.values()].map((d)=>{let f=this.idToItem.get(d.state.id);if(f!=null)d.state.removedItem=f.item;return d});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items=[],this.idToItem.clear(),this.instanceToItem.clear();let a=!1,l;for(let d of s)try{d.editor.cleanUp("discard")}catch(f){if(!a)a=!0,l=f}for(let d of n)try{d.instance.cleanUp()}catch(f){if(!a)a=!0,l=f}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent="",this.stickyOffset.style.height="",this.container?.style.removeProperty("height"),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),!this.isContainerManaged)this.flushSlotCoordinator();if(a)throw l}cleanUp(){let n=!1,s;try{this.reset()}catch(a){n=!0,s=a}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener("scroll",this.handleScroll),this.root?.removeEventListener("wheel",this.clearPendingScroll),this.root?.removeEventListener("touchstart",this.clearPendingScroll),this.root?.removeEventListener("pointerdown",this.clearPendingScroll),this.root?.removeEventListener("keydown",this.clearPendingScroll),this.root?.style.removeProperty("overflow-anchor"),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent="",this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,n)throw s}cleanAllRenderedItems(){if(this.renderState.firstIndex===-1)return;for(let n=this.renderState.firstIndex;n<=this.renderState.lastIndex;n++){let s=this.items[n];if(s==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${n}`);this.releaseRenderedItem(s)}}primeScrollTarget(n){if(n.type==="position")return;let s=this.idToItem.get(n.id);if(s==null)return;s.instance.primeHighlightCache()}getElementPoolLimit(){let n=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:s}=this.itemMetricsCache;return Math.max(8,Math.ceil(n/Math.max(s,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let n=this.elementPool.pop();while(n!=null&&!this.isElementPoolGenerationCurrent(n))n=this.elementPool.pop();return n??=document.createElement(Dc),this.markElementPoolGenerationCurrent(n),n}releaseRenderedItem(n){let{element:s}=n;if(s!=null&&this.renderedItemOwnsFocus(s))this.shouldFixContainerFocus=!0;if(n.instance.cleanUp(!0),this.attachedEditors.delete(n.item.id),n.element=void 0,s==null)return;s.remove(),this.cleanElement(s),this.queueElementForPool(s)}renderedItemOwnsFocus(n){let{activeElement:s}=document;return s===n||n.contains(s)||n.shadowRoot?.activeElement!=null}fixContainerFocus(){if(this.shouldFixContainerFocus)this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0})}cleanElement(n){let{shadowRoot:s}=n;if(s!=null){for(let a of Array.from(s.children))if(!oN(a))a.remove()}if(!this.isContainerManaged)n.replaceChildren()}queueElementForPool(n){let s=this.getElementPoolLimit();if(!this.isElementPoolGenerationCurrent(n)||this.getElementPoolSize()>=s)return;if(this.isElementClean(n))this.elementPool.push(n);else this.pendingElementPool.push(n)}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:n}=this;this.pendingElementPool=[];let s=this.getElementPoolLimit();for(let a of n)if(this.isElementPoolGenerationCurrent(a)&&this.isElementClean(a)&&this.elementPool.length<s)this.elementPool.push(a);else if(this.isElementPoolGenerationCurrent(a)&&this.getElementPoolSize()<s)this.pendingElementPool.push(a)}isElementClean(n){return n.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(n){this.elementPoolTracker.set(n,this.elementPoolVersion)}isElementPoolGenerationCurrent(n){return this.elementPoolTracker.get(n)===this.elementPoolVersion}resolveEffectiveScrollBehavior(n,s){if(CS())return"instant";if(n.behavior!=="smooth-auto")return n.behavior??"instant";return Math.abs(s-this.getScrollTop())<=this.getHeight()*10?"smooth":"instant"}scrollTo(n){if(this.root==null)return;let s=this.normalizeScrollTarget(n);if(s==null)return;let a=this.resolveScrollTargetTop(s);if(a==null)return;if(this.primeScrollTarget(s),this.resolveEffectiveScrollBehavior(s,a)==="smooth")this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()};else this.scrollAnimation=void 0;this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=s,this.render()}setSelectedLines(n,s){this.applySelectedLines(n,s)}getSelectedLines(){return this.selectedLines}clearSelectedLines(n){this.applySelectedLines(null,n)}getItem(n){return this.idToItem.get(n)?.item}getEditor(n){return this.itemEditors.get(n)?.editor}updateItem(n){let s=this.idToItem.get(n.id);if(s==null)return console.error(`CodeView.updateItem: unknown item id "${n.id}"`),!1;if(!this.syncItemRecord(s,n))return!1;return this.markItemLayoutDirty(s),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0}updateItemId(n,s){if(n===s)return!0;let a=this.idToItem.get(n);if(a==null)return console.error(`CodeView.updateItemId: unknown item id "${n}"`),!1;if(this.idToItem.has(s))return console.error(`CodeView.updateItemId: duplicate item id "${s}"`),!1;if(this.idToItem.delete(n),a.item.id=s,this.idToItem.set(s,a),this.updateItemOptionsId(a.instance.options,s),this.selectedLines?.id===n)this.selectedLines={...this.selectedLines,id:s},this.options.onSelectedLinesChange?.(this.selectedLines);let l=this.itemEditors.get(n);if(l!=null){if(this.itemEditors.delete(n),this.itemEditors.set(s,l),this.attachedEditors.delete(n))this.attachedEditors.add(s)}return this.renamePendingScrollTarget(n,s),this.renamePendingLayoutAnchor(n,s),this.render(),!0}addItem(n){this.addItems([n])}addItems(n){this.appendItemsInternal(n),this.syncItemEditors(),this.syncSelection()}removeItem(n){let s=this.idToItem.get(n);if(s==null)return console.error(`CodeView.removeItem: unknown item id "${n}"`),!1;let a=[];for(let l of this.items)if(l!==s)a.push(l.item);return this.setItems(a),!0}setItems(n){let s;if(this.items.length===0)this.appendItemsInternal(n);else if(!this.tryAppendItems(n))s=this.reconcileItems(n);try{this.syncItemEditors(s)}finally{for(let a of s?.values()??[])a.instance.cleanUp()}this.syncSelection()}appendItemsInternal(n,s=!0){if(n.length===0)return;let a=this.getLayout(),l=this.items.length===0?0:this.scrollHeight+a.gap,d=l;for(let f=0;f<n.length;f++){let h=n[f];if(h==null)throw Error("CodeView.appendItemsInternal: missing input item");if(this.idToItem.has(h.id))throw Error(`CodeView.addItem: duplicate id "${h.id}"`);let g=this.createItem(h,this.items.length,l);this.items.push(g),this.idToItem.set(g.item.id,g),this.instanceToItem.set(g.instance,g),g.height=tN(g),l+=g.height+a.gap}if(this.scrollHeight=l-a.gap,this.scrollDirty=!0,s)if(this.canSkipRenderForAppend(d))this.syncContainerHeight();else this.render()}canSkipRenderForAppend(n){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&n>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(n){if(n==null)return;this.capturePendingLayoutAnchor();let{options:s}=this,a=this.getLayout(),{itemMetricsCache:l}=this;if(nN(s,n))this.invalidateElementPool();this.options=n;let d=this.computeMetricsCache(n.itemMetrics),f=!vi(l,d),h=!vi(a,this.getLayout());if(h)this.syncLayout();let g=f||rN(s,n);if(g){let b=this.pendingLayoutReset;this.pendingLayoutReset={metrics:f?d:b?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:b?.includeEstimatedDiffHeights===!0||f||iN(s,n)}}if(h||g)this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0;if(!oa(s,n))this.renderOptionsRevision++;this.syncItemEditors();let I=s.renderCodeViewHeader!==n.renderCodeViewHeader||s.renderCodeViewFooter!==n.renderCodeViewFooter;if(!this.isContainerManaged&&(this.items.length>0||I))this.render()}capturePendingLayoutAnchor(n=this.idToItem){if(this.root==null||this.items.length===0||this.pendingScrollTarget!=null)return;this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),n)}render(n=!1){if(t.__STOP)return;if(n)D(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit();else q(this.computeRenderRangeAndEmit)}isReady(){let{workerManager:n}=this;if(n==null||n.getStats().workersFailed)return this.isSharedHighlighterReady();if(n.isInitialized())return this.clearReadySubscription(),!0;if(this.isReadySubscription??=n.subscribeToStatChanges((s)=>{if(s.managerState!=="initialized"&&!s.workersFailed)return;this.clearReadySubscription(),this.render(!0)}),n.getStats().managerState==="waiting")n.initialize().catch(()=>{});return!1}clearReadySubscription(){if(this.isReadySubscription==null)return;this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0}isSharedHighlighterReady(){let n=this.workerManager?.getFileRenderOptions().theme??this.options.theme??u;if(rS()&&ur(n))return this.clearReadySubscription(),!0;if(!E(this.pendingHighlighterTheme,n))this.clearReadySubscription();return this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=n;let s=!1;return re({themes:C(n),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{if(s)return;this.clearReadySubscription(),this.render(!0)},(a)=>{if(s)return;this.clearReadySubscription(),console.error(a)}),()=>{s=!0}})(),!1}instanceChanged(n,s){let a=this.instanceToItem.get(n);if(a==null)throw Error("CodeView.instanceChanged: An instance has changed that is not registered");if(s)this.markItemLayoutDirty(a);this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:n,lastIndex:s}=this.renderState;if(n===-1||s===-1||s<n)return[];let a=[];for(let l=n;l<=s;l++){let d=this.items[l];if(d?.element==null)continue;if(d.type==="diff")a.push({id:d.item.id,type:"diff",item:d.item,version:d.version,element:d.element,instance:d.instance});else a.push({id:d.item.id,type:"file",item:d.item,version:d.version,element:d.element,instance:d.instance})}return a}setSlotCoordinator(n){if(n===this.slotCoordinator)return!1;return this.slotCoordinator=n,this.slotSnapshot=void 0,!0}getSlotSnapshot(n){return this.buildSlotSnapshot(n)}buildSlotSnapshot(n){let s=aN(this.getRenderedItems(),n),{element:a}=this.header,{element:l}=this.footer;if(s==null&&a==null&&l==null)return;return{items:s,header:a,footer:l}}subscribeToScroll(n){return this.scrollListeners.add(n),()=>{this.scrollListeners.delete(n)}}getLocalTopForInstance(n){let s=this.instanceToItem.get(n);if(s==null)throw Error("CodeView.getLocalTopForInstance: unknown virtualized instance");return s.top}getTopForItem(n){let s=this.idToItem.get(n);if(s==null)return;return s.top+this.getItemTopOffset()}createItem(n,s,a){let{itemMetricsCache:l}=this;if(n.type==="diff"){let f=new F0(this.createDiffOptions(n.id),this,l,this.workerManager,this.isContainerManaged);return{type:"diff",item:n,version:n.version,index:s,top:a,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:f}}let d=new XS(this.createFileOptions(n.id),this,l,this.workerManager,this.isContainerManaged);return{type:"file",item:n,version:n.version,index:s,top:a,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:d}}applySelectedLines(n,s){let{selectedLines:a}=this;if(n==null&&a==null||n!=null&&a?.id===n.id&&sa(a.range,n.range))return;if(a!=null&&a.id!==n?.id)this.idToItem.get(a.id)?.instance.setSelectedLines(null,{notify:!1});this.selectedLines=n,this.idToItem.get(n?.id??"")?.instance.setSelectedLines(n?.range??null,s)}syncSelection(){if(this.selectedLines==null)return;let n=this.idToItem.get(this.selectedLines.id);if(n==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}n.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(n){return n.item.edit===!0&&n.item.collapsed!==!0}attachItemEditor(n){let{id:s}=n.item,{createEditor:a}=this.options;if(n.element==null||this.attachedEditors.has(s)||!this.isItemInEditMode(n))return;let l=this.itemEditors.get(s),d;try{if(l==null&&n.type==="diff"&&!n.instance.__canAttachEditor()){n.instance.__prepareForEditing();return}if(l==null){ZF(a);let f=Lo(n.instance.options);if(f==null)throw Error("CodeView.attachItemEditor: instance options are missing their state");let h=(I)=>{let b=this.idToItem.get(f.id);if(b==null)return;this.options.onItemEditChange?.(I,b.item)},g=this.options.getEditStateKey?.(n.item);if(n.type==="diff"){let I=a("file-diff",{onChange:h},g);d=I,this.itemEditors.set(s,{editor:I,state:f,dispose:I.edit(n.instance)})}else{let I=a("file",{onChange:h},g);d=I,this.itemEditors.set(s,{editor:I,state:f,dispose:I.edit(n.instance)})}}else if(n.type==="diff")l.dispose=l.editor.edit(n.instance);else l.dispose=l.editor.edit(n.instance);this.attachedEditors.add(s)}catch(f){throw d?.cleanUp(),this.releaseRenderedItem(n),f}}syncItemEditors(n){if(this.itemEditors.size===0)return;let s=[];for(let[d,f]of this.itemEditors){let h=this.idToItem.get(d),g=n?.get(d);if(g==null&&h!=null){let{edit:I=!1,collapsed:b=!1}=h.item;if(I){if(b&&this.attachedEditors.delete(d))f.editor.cleanUp("recycle");continue}}else if(g!=null)f.state.removedItem=g.item;this.itemEditors.delete(d),this.attachedEditors.delete(d),s.push(f)}if(s.length===0)return;let a=!1,l;for(let d of s){try{d.dispose()}catch(h){if(!a)a=!0,l=h}let f=this.idToItem.get(d.state.id);if(f!=null)this.markItemLayoutDirty(f)}if(this.render(),a)throw l}requireItemFromState(n){let s=this.idToItem.get(n.id)?.item??n.removedItem;if(s==null)throw Error(`CodeView.onItemEditComplete: unknown item "${n.id}"`);return s}completeFileItemEdit(n,s){let a=this.requireItemFromState(n);if(a.type!=="file")throw Error(`CodeView.onItemEditComplete: item "${n.id}" is not a file item`);let l={...a,file:s.file,annotations:s.lineAnnotations,edit:!1,version:(a.version??0)+1};if((this.options.onItemEditComplete?.(s,a,l)??"reject")==="reject")return"reject";if(this.idToItem.has(a.id))this.updateItem(l);return"accept"}completeDiffItemEdit(n,s){let a=this.requireItemFromState(n);if(a.type!=="diff")throw Error(`CodeView.onItemEditComplete: item "${n.id}" is not a diff item`);let l={...a,fileDiff:s.fileDiff,annotations:s.lineAnnotations,edit:!1,version:(a.version??0)+1};if((this.options.onItemEditComplete?.(s,a,l)??"reject")==="reject")return"reject";if(this.idToItem.has(a.id))this.updateItem(l);return"accept"}renamePendingScrollTarget(n,s){let{pendingScrollTarget:a}=this;if(a==null||a.type==="position"||a.id!==n)return;this.pendingScrollTarget={...a,id:s}}renamePendingLayoutAnchor(n,s){if(this.pendingLayoutAnchor?.id===n)this.pendingLayoutAnchor.id=s}createFileOptionsPrototype(){let n={};for(let s of VF)li(n,s,()=>this.options[s]);li(n,"stickyHeader",()=>this.options.stickyHeaders),li(n,"collapsed",(s)=>{let a=Lo(s);if(a==null)return;return this.getItemOptions(a,"file")?.item.collapsed}),li(n,"onEditComplete",(s)=>{if(this.options.onItemEditComplete==null)return;let a=Lo(s);if(a==null)return;return(l)=>this.completeFileItemEdit(a,l)});for(let s of N0)this.defineItemSharedCallback(n,"file",s);for(let s of D0)this.defineItemSelectionCallback(n,"file",s);return n}createDiffOptionsPrototype(){let n={};for(let s of KF)li(n,s,()=>this.options[s]);li(n,"stickyHeader",()=>this.options.stickyHeaders),li(n,"hunkSeparators",()=>this.options.hunkSeparators),li(n,"collapsed",(s)=>{let a=Lo(s);if(a==null)return;return this.getItemOptions(a,"diff")?.item.collapsed}),li(n,"onEditComplete",(s)=>{if(this.options.onItemEditComplete==null)return;let a=Lo(s);if(a==null)return;return(l)=>this.completeDiffItemEdit(a,l)});for(let s of N0)this.defineItemSharedCallback(n,"diff",s);for(let s of D0)this.defineItemSelectionCallback(n,"diff",s);return n}createFileOptions(n){let s=Object.create(this.fileOptionsPrototype);return H0(s,{id:n}),s}createDiffOptions(n){let s=Object.create(this.diffOptionsPrototype);return H0(s,{id:n}),s}updateItemOptionsId(n,s){let a=Lo(n);if(a==null)throw Error("CodeView.updateItemOptionsId: No valid state");a.id=s}getItemOptions(n,s){let a=this.idToItem.get(n.id);if(a==null||a.type!==s)return;return a}defineItemSharedCallback(n,s,a){li(n,a,(l)=>{if(this.options[a]==null)return;let d=Lo(l);if(d==null)return;let f=d.callbackCache??={},h=f[a];if(h==null)h=(...g)=>{let I=this.getItemOptions(d,s);if(I==null)return;let b=this.options[a];return b?.(...g,I)},f[a]=h;return h})}defineItemSelectionCallback(n,s,a){li(n,a,(l)=>{let d=Lo(l);if(d==null)return;let f=d.callbackCache??={},h=f[a];if(h==null)h=(g)=>{let I=this.getItemOptions(d,s);if(I==null)return;let b=g==null?null:{id:I.item.id,range:g};if(this.options.controlledSelection!==!0){if(g!=null||this.selectedLines?.id===I.item.id)this.applySelectedLines(b,{notify:!1})}this.options.onSelectedLinesChange?.(b);let v=this.options[a];return v?.(g,I)},f[a]=h;return h})}markLayoutDirtyFromIndex(n){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??n,n)}markItemLayoutDirty(n){if(this.items[n.index]!==n)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${n.item.id}"`);this.markLayoutDirtyFromIndex(n.index)}tryAppendItems(n){if(n.length<=this.items.length)return!1;for(let s=0;s<this.items.length;s++){let a=this.items[s];if(a==null)throw Error("CodeView.tryAppendItems: missing existing item");let l=n[s];if(l==null||a.item.id!==l.id||a.type!==l.type)return!1}for(let s=0;s<this.items.length;s++){let a=this.items[s];if(a==null)throw Error("CodeView.tryAppendItems: missing existing item");let l=n[s];if(l==null)throw Error("CodeView.tryAppendItems: append candidate missing prefix item");if(this.syncItemRecord(a,l))this.markLayoutDirtyFromIndex(s)}return this.appendItemsInternal(n.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(n){let{items:s,idToItem:a}=this,l=new Set(s),d=[],f=new Map,h=new Map,g=new Map,I;for(let b=0;b<n.length;b++){let v=n[b];if(v==null)throw Error("CodeView.reconcileItems: missing input item");if(f.has(v.id))throw Error(`CodeView.setItems: duplicate id "${v.id}"`);let k=a.get(v.id),w=k!=null&&k.type===v.type?k:this.createItem(v,b,0);if(w.index=b,k!=null&&k.type===v.type){if(l.delete(k),this.syncItemRecord(w,v))I=Math.min(I??b,b)}else I=Math.min(I??b,b);if(s[b]!==w)I=Math.min(I??b,b);d.push(w),f.set(v.id,w),h.set(w.instance,w)}if(I==null){if(l.size===0)return;I=Math.max(d.length-1,0)}this.capturePendingLayoutAnchor(f);for(let b=0;b<s.length;b++){let v=s[b];if(v==null||!l.has(v))continue;g.set(v.item.id,v),this.releaseRenderedItem(v);let k=Math.max(d.length-1,0);I=Math.min(I??k,k)}if(this.items=d,this.idToItem=f,this.instanceToItem=h,this.renderState.firstIndex>=d.length)this.resetRenderState();else if(this.renderState.lastIndex>=d.length)this.renderState.lastIndex=d.length-1;return this.markLayoutDirtyFromIndex(I),this.scrollDirty=!0,this.render(),g.size>0?g:void 0}syncItemRecord(n,s){if(n.type!==s.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${s.id}"`);if(n.version===s.version)return!1;return n.item=s,n.version=s.version,n.renderedOptionsRevision=-1,!0}getMaxScrollTopForHeight(n){let{paddingBottom:s,paddingTop:a}=this.getLayout();return Math.max(a+this.header.height+n+this.footer.height+s-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>G0}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),XF):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(n){let s=this.getMaxPagedScrollTop();return Math.max(0,Math.min(n,s))}clampScrollTop(n){let s=this.getMaxScrollTop();return Math.max(0,Math.min(n,s))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(n){let s=this.getMaxScrollPageOffset();return Math.max(0,Math.min(n,s))}resolveScrollPageWindow(n,s){let a=oi(this.clampPagedScrollTop(s)),l=this.clampScrollPageOffset(n-a);return a=oi(this.clampPagedScrollTop(n-l)),l=this.clampScrollPageOffset(n-a),{pagedScrollTop:a,scrollPageOffset:l}}resolvePagedScrollPosition(n){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(n),scrollPageOffset:0};let s=this.clampScrollPageOffset(this.scrollPageOffset),a=n-s,l=this.getMaxPagedScrollTop(),d=this.getMaxScrollPageOffset(),f=a>G0&&s<d,h=a<YF&&s>0;if(a<0||a>l||f||h)return this.resolveScrollPageWindow(n,h?Math.min(QF,l):JF);return{pagedScrollTop:oi(this.clampPagedScrollTop(a)),scrollPageOffset:s}}needsScrollPageUpdate(n){let s=oi(this.clampScrollTop(n)),{scrollPageOffset:a}=this.resolvePagedScrollPosition(s);return a!==this.scrollPageOffset}getPagedLayoutTop(n){if(!this.shouldRebaseScroll())return n;return Math.max(n-this.scrollPageOffset,0)}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(n){let s=this.idToItem.get(n.id);if(s==null){console.warn(`CodeView.scrollTo: unknown item id "${n.id}"`);return}if(n.type==="item")return{top:s.top,height:s.height};if(n.type==="range"){let l=this.getRangeScrollPosition(s,n);if(l==null){console.warn(`CodeView.scrollTo: unable to resolve range ${z0(n.range)} for item "${n.id}"`);return}return{top:s.top+l.top,height:l.height}}let a=this.getLineScrollPosition(s,n);if(a==null){console.warn(`CodeView.scrollTo: unable to resolve line ${n.lineNumber} for item "${n.id}"`);return}return{top:s.top+a.top,height:a.height}}normalizeScrollTarget(n){if(n.type==="position"||n.align!=="nearest")return n;let s=this.getScrollTargetRect(n);if(s==null)return;let a=n.offset??0,l=this.getItemTopOffset()+s.top,d=l+s.height,f=this.getScrollTop(),h=f+(n.type==="line"||n.type==="range"?this.getStickyHeaderOffset():0),g=f+this.getHeight();if(l-a<=h&&d+a>=g)return;if(l-a<h)return{...n,align:"start"};if(d+a>g)return{...n,align:"end"}}resolveScrollTargetTop(n){if(n.type==="position"){let l=this.clampScrollTop(n.position);return l!==n.position?l:this.clampScrollTop(n.position-this.getStickyHeaderOffset())}let s=this.idToItem.get(n.id);if(s==null){console.warn(`CodeView.scrollTo: unknown item id "${n.id}"`);return}if(n.type==="item")return this.clampScrollTop(this.resolveAlignedScrollPosition(s.top,s.height,n.align,n.offset));if(n.type==="range"){let l=this.getRangeScrollPosition(s,n);if(l==null){console.warn(`CodeView.scrollTo: unable to resolve range ${z0(n.range)} for item "${n.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(s.top+l.top,l.height,n.align,n.offset,this.getStickyHeaderOffset()))}let a=this.getLineScrollPosition(s,n);if(a==null){console.warn(`CodeView.scrollTo: unable to resolve line ${n.lineNumber} for item "${n.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(s.top+a.top,a.height,n.align,n.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(n,s,a,l=0,d=0){n+=this.getItemTopOffset();let f=this.getHeight();if(a==="center"&&s+l<f)return n-(f-s)/2+l;if(a==="end")return n-(f-s)+l;return n-d-l}getLineScrollPosition(n,s){if(n.type==="diff")return n.instance.getLinePosition(s.lineNumber,s.side);return n.instance.getLinePosition(s.lineNumber)}getRangeScrollPosition(n,s){let{range:a}=s,l=this.getLineScrollPosition(n,{type:"line",id:s.id,lineNumber:a.start,side:a.side}),d=this.getLineScrollPosition(n,{type:"line",id:s.id,lineNumber:a.end,side:a.endSide??a.side});if(l==null||d==null)return;let f=l.top,h=f+l.height,g=d.top,I=g+d.height,b=Math.min(f,g);return{top:b,height:Math.max(h,I)-b}}computeTargetScrollTopForFrame(n,s){if(this.pendingScrollTarget==null)return n;let a=this.resolveScrollTargetTop(this.pendingScrollTarget);if(a==null)return n;let{scrollAnimation:l}=this;if(l==null)return a;return this.computeSpringStep(l,a,s).position}computeSpringStep(n,s,a){let l=Math.max(0,a-n.lastTimestamp),{omega:d}=this.getSmoothScrollSettings(),f=Math.exp(-d*l),h=n.position-s,g=n.velocity+d*h;return{position:s+(h+g*l)*f,velocity:(g*(1-d*l)-d*h)*f}}advanceScrollAnimation(n,s){if(this.pendingScrollTarget==null)return;let a=this.resolveScrollTargetTop(this.pendingScrollTarget);if(a==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let l=this.scrollAnimation;if(l==null)return a;l.position+=s;let{position:d,velocity:f}=this.computeSpringStep(l,a,n);l.lastTimestamp=n,l.position=d,l.velocity=f;let{positionEpsilon:h,velocityEpsilon:g}=this.getSmoothScrollSettings();if(Math.abs(a-d)<=h&&Math.abs(f)<=g)return l.position=a,l.velocity=0,this.scrollAnimation=void 0,a;return l.position}computeRenderRangeAndEmit=(n=performance.now())=>{if(t.__STOP||this.container==null)return;if(!this.isReady())return;let s=this.getHeight(),a=this.getScrollTop(),l=a,d=this.pendingLayoutAnchor!=null,f=this.getScrollAnchor(l);if(this.layoutDirtyIndex!=null)this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,d=!0;if(d&&f!=null){let W=this.resolveAnchoredScrollTop(f);if(W!=null){let J=W-l;if(l=W,this.scrollAnimation!=null)this.scrollAnimation.position+=J}}if(d)l=this.clampScrollTop(l),this.syncContainerHeight();let h=this.computeTargetScrollTopForFrame(l,n),g=!d&&(this.renderState.scrollTop===-1||Math.abs(h-this.renderState.scrollTop)>s+this.config.overscrollSize*2);if(g)f=void 0;this.windowSpecs=Ep({scrollTop:h-this.header.height,height:s,scrollHeight:this.getScrollHeight(),fitPerfectly:g,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let I=a;if(this.pendingScrollTarget!=null&&h!==I||this.needsScrollPageUpdate(h))this.applyScrollFix(h,I,this.windowSpecs),I=h;let{top:b,bottom:v}=this.windowSpecs,{firstIndex:k,lastIndex:w}=this.renderState;if(k>=0)for(let W=k;W<=w;W++){let J=this.items[W];if(J==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${W}`);if(!(J.top>b-J.height&&J.top<=v))this.releaseRenderedItem(J)}let P=this.reconcileHeaderFooterHosts(),M,N=new Set,_=this.findFirstVisibleIndex(b),O=this.findLastVisibleIndex(v);for(let W=_;W<=O;W++){let J=this.items[W];if(J==null)throw Error("CodeView.computeRenderRangeAndEmit: missing item");let{instance:ee}=J;if(J.element==null){if(J.element=this.acquireElement(),K0(this.stickyContainer,J.element,M),ee.virtualizedSetup(),q0(J,J.element))J.renderedOptionsRevision=this.renderOptionsRevision,N.add(J);M=J.element}else{if(K0(this.stickyContainer,J.element,M),q0(J,void 0,J.renderedOptionsRevision!==this.renderOptionsRevision))J.renderedOptionsRevision=this.renderOptionsRevision,N.add(J);M=J.element}if(J.item.edit===!0)this.attachItemEditor(J)}if(this.renderState.firstIndex=_<=O?_:-1,this.renderState.lastIndex=O,this.flushSlotCoordinator(),this.flushManagers(N),P)this.measureMountedHosts();this.reconcileRenderedItems(N),this.syncContainerHeight(),this.updateStickyPositioning();let B=f!=null?this.resolveAnchoredScrollTop(f):void 0;if(f===this.pendingLayoutAnchor)this.pendingLayoutAnchor=void 0;let X=B!=null?B-l:0,z=h,K=!1;if(this.pendingScrollTarget!=null){let W=this.advanceScrollAnimation(n,X);if(W!=null)z=W,K=!0;else z=l}else z=B??h;if(z!==I)this.applyScrollFix(z,I,this.windowSpecs),I=z;if(K&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget))this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;if(this.renderState.scrollTop=oi(I),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),g||this.scrollAnimation!=null)this.render()};flushManagers(n){for(let s of n)s.instance.flushManagers()}syncContainerHeight(){let n=this.getPagedScrollHeight();if(this.container==null||this.containerHeight===n)return;this.container.style.height=`${n}px`,this.containerHeight=n}getStickyBounds(n){let{firstIndex:s,lastIndex:a}=n!=null?{firstIndex:this.findFirstVisibleIndex(n.top),lastIndex:this.findLastVisibleIndex(n.bottom)}:this.renderState;if(s===-1||a===-1||s>a)return;let l=this.items[s]?.instance.getAdvancedStickySpecs(n),d=this.items[a]?.instance.getAdvancedStickySpecs(n);if(l==null||d==null)return;return{stickyTop:this.getPagedLayoutTop(Math.max(l.topOffset,0)),stickyBottom:this.getPagedLayoutTop(d.topOffset+d.height)}}applyStickyPositioning({stickyTop:n,stickyBottom:s}){let a=this.getHeight(),{itemMetricsCache:l}=this,d=s-n;this.renderState.stickyHeight=d,this.renderState.stickyTop=n,this.renderState.stickyBottom=s,this.stickyOffset.style.height=`${n}px`;let f=(Math.random()*l.lineHeight>>0)*-1,h=-Math.max(d+f,0)+a;this.stickyContainer.style.top=`${h}px`,this.stickyContainer.style.bottom=`${h+l.diffHeaderHeight}px`}syncPagedScrollScaffolding(n){this.syncContainerHeight();let s=this.getStickyBounds(n);if(s==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(n.top)}px`;return}this.applyStickyPositioning(s)}reconcileRenderedItems(n){let{firstIndex:s,lastIndex:a}=this.renderState;if(s===-1)return;let l=-1,d=!1;for(let f=s;f<this.items.length;f++){if(!d&&f>a)break;let h=this.items[f];if(h==null)throw Error("CodeView.reconcileRenderedItems: Invalid item");if(l===-1)l=h.top;else if(h.top!==l)h.top=l,h.instance.syncVirtualizedTop(),d=!0;if(n==null?f<=a:n.has(h)){if(h.instance.reconcileHeights())d=!0,h.height=h.instance.getVirtualizedHeight();this.validateRenderedItemHeight(h)}if(l+=h.instance.getVirtualizedHeight(),f<this.items.length-1)l+=this.getLayout().gap}if(d&&l!=null)this.scrollDirty=!0,this.scrollHeight=l}updateStickyPositioning(){let n=this.getStickyBounds();if(n==null){if(this.renderState.firstIndex===-1)this.stickyOffset.style.height="";return}let{stickyTop:s,stickyBottom:a}=n;if(a-s===this.renderState.stickyHeight&&s===this.renderState.stickyTop&&a===this.renderState.stickyBottom)return;this.applyStickyPositioning(n)}handleScroll=()=>{if(t.__STOP)return;this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render()};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=(n)=>{let s=!1;for(let a of n)if(a.target===this.stickyContainer){let l=a.borderBoxSize[0].blockSize;if(Math.abs(l-this.renderState.stickyHeight)>=U0){let d=this.getScrollTop(),f=this.getScrollAnchor(d);this.reconcileRenderedItems(),this.updateStickyPositioning();let h=f!=null?this.resolveAnchoredScrollTop(f):void 0;if(h!=null){let g=h-d;if(this.applyScrollFix(h,d,this.windowSpecs),this.scrollAnimation!=null)this.scrollAnimation.position+=g}if(this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget))this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;s=!0}}else if(a.target===this.header.element||a.target===this.footer.element){let l=a.target===this.header.element?this.header:this.footer,d=a.borderBoxSize[0].blockSize;if(d!==l.height){let f=this.getScrollTop(),h=this.getScrollAnchor(f);this.setHostHeight(l,d);let g=h!=null?this.resolveAnchoredScrollTop(h):void 0;if(g!=null){let I=g-f;if(this.applyScrollFix(g,f,this.windowSpecs),this.scrollAnimation!=null)this.scrollAnimation.position+=I}if(this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget))this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;s=!0}}else this.scrollDirty=!0,this.heightDirty=!0,s=!0;if(s)this.render(!0)};getScrollAnchorViewportTop(n,s){return n<s?s+this.getStickyHeaderOffset():s}getScrollAnchor(n,s=this.idToItem){let a,{pendingLayoutAnchor:l}=this;if(l!=null){let b=this.idToItem.get(l.id);if(b!=null&&s.get(l.id)===b)return l;if(b!=null)a=b}if(n<=0)return;let{firstIndex:d,lastIndex:f,stickyTop:h,stickyBottom:g}=this.renderState;if(d===-1||f===-1)return;let I=this.getHeight();if(h===-1||g===-1)return;for(let b=d;b<=f;b++){let v=this.items[b];if(v==null)continue;let k=this.getItemTopOffset()+v.top;if(k+v.height<=n)continue;if(k>=n+I)break;if(s.get(v.item.id)!==v){a??=v;continue}if(k>=n)return{type:"item",id:v.item.id,viewportOffset:k-n};let w=this.getScrollAnchorViewportTop(k,n)-k,P=v.instance.getNumericScrollAnchor(w);if(P!=null){let M=k+P.top;return{type:"line",id:v.item.id,lineNumber:P.lineNumber,side:P.side,viewportOffset:M-n}}}if(a!=null)for(let b=a.index+1;b<this.items.length;b++){let v=this.items[b];if(v!=null&&s.get(v.item.id)===v)return{type:"item",id:v.item.id,viewportOffset:0}}}resolveAnchoredScrollTop(n){let s=this.idToItem.get(n.id);if(s==null)return;let a=this.getItemTopOffset();if(n.type==="item"){let f=a+s.top;return this.clampScrollTop(f-n.viewportOffset)}let l=s.type==="diff"?s.instance.getLinePosition(n.lineNumber,n.side):s.instance.getLinePosition(n.lineNumber);if(l==null)return;let d=a+s.top+l.top;return this.clampScrollTop(d-n.viewportOffset)}applyScrollFix(n,s,a){if(this.root==null)return;let l=oi(this.clampScrollTop(n)),d=oi(s),{scrollPageOffset:f}=this,h=oi(this.clampPagedScrollTop(d-f)),{pagedScrollTop:g,scrollPageOffset:I}=this.resolvePagedScrollPosition(l),b=g,v=f!==I;if(l===this.renderState.scrollTop&&l===d&&b===h&&!v)return;if(this.suspendScrollInteractions(),b!==h||v)this.scrollPageOffset=I,this.syncPagedScrollScaffolding(a);if(b!==h)this.root.scrollTo({top:b,behavior:"instant"});this.renderState.scrollTop=l,this.scrollTop=l,this.scrollDirty=!1}isPendingTargetSettled(n){let s=this.resolveScrollTargetTop(n);if(s==null)return!0;return oi(this.getScrollTop())===oi(s)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let n=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(n+this.scrollPageOffset),this.scrollTop}getHeight(){if(!this.heightDirty)return this.height;return this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let n=this.buildSlotSnapshot(this.slotCoordinator);if(IS(this.slotSnapshot,n))return;this.slotSnapshot=n,this.slotCoordinator.onSnapshotChange(n)}notifyScroll(){if(this.scrollListeners.size===0)return;let n=this.getScrollTop();for(let s of this.scrollListeners)s(n,this)}findFirstVisibleIndex(n){let s=0,a=this.items.length-1,l=this.items.length;while(s<=a){let d=s+a>>1,f=this.items[d];if(f==null)throw Error("CodeView.findFirstVisibleIndex: invalid item index");if(f.top+f.height>n)l=d,a=d-1;else s=d+1}return l}findLastVisibleIndex(n){let s=0,a=this.items.length-1,l=-1;while(s<=a){let d=s+a>>1,f=this.items[d];if(f==null)throw Error("CodeView.findLastVisibleIndex: invalid item index");if(f.top<=n)l=d,s=d+1;else a=d-1}return l}recomputeLayout(n=0,s){if(this.items.length===0){this.scrollHeight=0;return}let a=this.getLayout(),l=0;if(n>0){let d=this.items[n-1];if(d==null)throw Error("CodeView.recomputeLayout: invalid dirty index");l=d.top+d.height+a.gap}for(let d=n;d<this.items.length;d++){let f=this.items[d];if(f==null)throw Error("CodeView.recomputeLayout: invalid item index");if(f.top=l,f.type==="diff")f.height=f.instance.updateCodeViewLayout(f.item.fileDiff,l,s,f.item.annotations??[]);else f.height=f.instance.updateCodeViewLayout(f.item.file,l,s,f.item.annotations??[]);if(l+=f.height,d<this.items.length-1)l+=a.gap}if(l!==this.scrollHeight)this.scrollDirty=!0;this.scrollHeight=l}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function tN(t){if(t.instance.cleanUp(!0),t.type==="diff")return t.instance.updateCodeViewLayout(t.item.fileDiff,t.top,void 0,t.item.annotations??[]);else return t.instance.updateCodeViewLayout(t.item.file,t.top,void 0,t.item.annotations??[])}function nN(t,n){return!E(t.theme??u,n.theme??u)||(t.themeType??"system")!==(n.themeType??"system")||t.unsafeCSS!==n.unsafeCSS}function rN(t,n){return(t.overflow??"scroll")!==(n.overflow??"scroll")||(t.disableLineNumbers??!1)!==(n.disableLineNumbers??!1)||(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||t.unsafeCSS!==n.unsafeCSS||(t.diffStyle??"split")!==(n.diffStyle??"split")||(t.diffIndicators??"bars")!==(n.diffIndicators??"bars")||(t.hunkSeparators??"line-info")!==(n.hunkSeparators??"line-info")||(t.expandUnchanged??!1)!==(n.expandUnchanged??!1)||(t.collapsedContextThreshold??1)!==(n.collapsedContextThreshold??1)}function iN(t,n){return(t.disableFileHeader??!1)!==(n.disableFileHeader??!1)||(t.hunkSeparators??"line-info")!==(n.hunkSeparators??"line-info")||(t.expandUnchanged??!1)!==(n.expandUnchanged??!1)||(t.collapsedContextThreshold??1)!==(n.collapsedContextThreshold??1)}function oN(t){if(t instanceof SVGElement)return!0;return Co(t)&&(t.hasAttribute("data-core-css")||t.hasAttribute("data-theme-css")||t.hasAttribute("data-unsafe-css"))}function z0(t){let n=j0(t.start,t.side),s=j0(t.end,t.endSide??t.side);return n===s?n:`${n}-${s}`}function j0(t,n){if(n==null)return`${t}`;return`${n==="deletions"?"D":"A"}${t}`}function q0(t,n,s=!1){if(t.type==="diff")return t.instance.render({deferManagers:!0,fileContainer:n,fileDiff:t.item.fileDiff,forceRender:s,lineAnnotations:t.item.annotations??[]});else return t.instance.render({deferManagers:!0,fileContainer:n,file:t.item.file,forceRender:s,lineAnnotations:t.item.annotations??[]})}function K0(t,n,s){if(s==null){if(t.firstChild!==n)t.prepend(n);return}if(s.nextSibling!==n)s.after(n)}function sN(t){return(t.annotations?.length??0)>0}function aN(t,{hasHeaderRenderers:n,hasAnnotationRenderer:s,hasGutterRenderer:a}){if(t.length===0)return;if(n||a)return t;if(!s)return;let l=[];for(let d of t)if(sN(d.item))l.push(d);return l.length>0?l:void 0}var wi={assign:0,create:0,clone:0,discard:0,update:0};var H={};De(H,{Counted:()=>rh,Entries:()=>Ln,EntriesRegExp:()=>ih,Every:()=>Rn,EveryAll:()=>Vn,GraphemeCount:()=>mN,HasPropertyKey:()=>Y,IsArray:()=>Te,IsBigInt:()=>Qt,IsBoolean:()=>wn,IsClassInstance:()=>ib,IsConstructor:()=>th,IsDeepEqual:()=>xa,IsEqual:()=>F,IsFunction:()=>Ao,IsGreaterEqualThan:()=>ga,IsGreaterThan:()=>ys,IsInteger:()=>Bd,IsLessEqualThan:()=>Ri,IsLessThan:()=>Fl,IsMaxLength:()=>ob,IsMinLength:()=>sb,IsMultipleOf:()=>rb,IsNull:()=>Or,IsNumber:()=>ft,IsObject:()=>Be,IsObjectNotArray:()=>eo,IsString:()=>ut,IsSymbol:()=>nh,IsUndefined:()=>bt,IsUnsafePropertyKey:()=>Nl,IsValueLike:()=>xs,Keys:()=>pe,ShiftLeft:()=>Je,Some:()=>ya,SomeAll:()=>ab,Symbols:()=>lb,Values:()=>oh});function gs(t,n,s){return t>=n&&t<=s}function Y0(t){return t===8205}function lN(t){return gs(t,55296,56319)}function W0(t){return gs(t,127462,127487)}function J0(t){return gs(t,65024,65039)}function Q0(t){return gs(t,768,879)||gs(t,6832,6911)||gs(t,7616,7679)||gs(t,65056,65071)}function Ud(t){return t>65535?2:1}function X0(t,n){while(n<t.length){let s=t.codePointAt(n);if(Q0(s)||J0(s))n+=Ud(s);else break}return n}function eh(t,n){let s=t.codePointAt(n),a=n+Ud(s);a=X0(t,a);while(a<t.length-1&&Y0(t.codePointAt(a))){let l=t.codePointAt(a+1);a+=1+Ud(l),a=X0(t,a)}if(W0(s)&&a<t.length&&W0(t.codePointAt(a)))a+=Ud(t.codePointAt(a));return a}function Z0(t){return t>=768&&(lN(t)||Q0(t)||J0(t)||Y0(t))}function eb(t){let n=0,s=0;while(s<t.length)s=eh(t,s),n++;return n}function uN(t,n){let s=0,a=0;while(a<t.length)if(a=eh(t,a),++s>=n)return!0;return!1}function cN(t,n){let s=0,a=0;while(a<t.length)if(a=eh(t,a),++s>n)return!1;return!0}function tb(t,n){if(n===0)return!0;if(t.length<n)return!1;let s=0;while(!0){if(Z0(t.charCodeAt(s)))return uN(t,n);if(++s>=n)return!0}}function nb(t,n){if(t.length<=n)return!0;let s=0;while(!0){if(Z0(t.charCodeAt(s)))return cN(t,n);if(++s>n)return!1}}function Te(t){return Array.isArray(t)}function Qt(t){return F(typeof t,"bigint")}function wn(t){return F(typeof t,"boolean")}function th(t){if(bt(t)||!Ao(t))return!1;let n=Function.prototype.toString.call(t);if(/^class\s/.test(n))return!0;if(/\[native code\]/.test(n))return!0;return!1}function Ao(t){return F(typeof t,"function")}function Bd(t){return Number.isInteger(t)}function Or(t){return F(t,null)}function ft(t){return Number.isFinite(t)}function eo(t){return Be(t)&&!Te(t)}function Be(t){return F(typeof t,"object")&&!Or(t)}function ut(t){return F(typeof t,"string")}function nh(t){return F(typeof t,"symbol")}function bt(t){return F(t,void 0)}function F(t,n){return t===n}function ys(t,n){return t>n}function Fl(t,n){return t<n}function Ri(t,n){return t<=n}function ga(t,n){return t>=n}function rb(t,n){if(Qt(t)||Qt(n))return BigInt(t)%BigInt(n)===0n;let s=0.0000000001;if(!ft(t))return!0;if(Bd(t)&&1/n%1===0)return!0;let a=t%n;return Math.min(Math.abs(a),Math.abs(a-n),Math.abs(a+n))<s}function ib(t){if(!Be(t))return!1;let n=globalThis.Object.getPrototypeOf(t);if(Or(n))return!1;return F(typeof n.constructor,"function")&&!(F(n.constructor,globalThis.Object)||F(n.constructor.name,"Object"))}function xs(t){return Qt(t)||wn(t)||Or(t)||ft(t)||ut(t)||bt(t)}function mN(t){return eb(t)}function ob(t,n){return nb(t,n)}function sb(t,n){return tb(t,n)}function Rn(t,n,s){return t.every((a,l)=>l<n||s(a,l))}function Vn(t,n,s){let a=!0;return t.forEach((l,d)=>{if(d>=n&&!s(l,d))a=!1}),a}function ya(t,n){return t.some((s,a)=>n(s,a))}function ab(t,n){let s=!1;return t.forEach((a,l)=>{if(n(a,l))s=!0}),s}function rh(t,n){return t.reduce((s,a,l)=>n(a,l)?++s:s,0)}function Je(t,n,s){return F(t.length,0)?s():n(t[0],t.slice(1))}function Nl(t){return F(t,"__proto__")||F(t,"constructor")||F(t,"prototype")}function Y(t,n){return Nl(n)?Object.prototype.hasOwnProperty.call(t,n):(n in t)}function ih(t){return pe(t).map((n)=>[new RegExp(`^${n}$`),t[n]])}function Ln(t){return Object.entries(t)}function pe(t){return Object.getOwnPropertyNames(t)}function lb(t){return Object.getOwnPropertySymbols(t)}function oh(t){return Object.values(t)}function fN(t,n){if(!Be(n))return!1;let s=pe(t);return F(s.length,pe(n).length)&&s.every((a)=>xa(t[a],n[a]))}function pN(t,n){return Te(n)&&F(t.length,n.length)&&t.every((s,a)=>xa(t[a],n[a]))}function xa(t,n){return Te(t)?pN(t,n):Be(t)?fN(t,n):F(t,n)}var hN=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function gN(t){return hN.test(t)}function Gn(t,n){return`(${t} && ${n})`}function Nt(t,n){return`(${t} || ${n})`}function rr(t){return`!(${t})`}function Gd(t){return`Array.isArray(${t})`}function ub(t){return`typeof ${t} === "bigint"`}function yN(t){return`typeof ${t} === "boolean"`}function xN(t){return`Number.isInteger(${t})`}function IN(t){return`${t} === null`}function cb(t){return`Number.isFinite(${t})`}function db(t){return Gn(mb(t),rr(Gd(t)))}function mb(t){return`typeof ${t} === "object" && ${t} !== null`}function fb(t){return`typeof ${t} === "string"`}function SN(t){return`typeof ${t} === "symbol"`}function sh(t){return`${t} === undefined`}function bN(t){return`typeof ${t} === "function"`}function CN(t){return`Guard.IsConstructor(${t})`}function br(t,n){return`${t} === ${n}`}function pb(t,n){return`${t} > ${n}`}function ah(t,n){return`${t} < ${n}`}function Is(t,n){return`${t} <= ${n}`}function Dl(t,n){return`${t} >= ${n}`}function EN(t,n){return`Guard.IsMinLength(${t}, ${n})`}function vN(t,n){return`Guard.IsMaxLength(${t}, ${n})`}function Li(t,n,s,a){return F(n,"0")?`${t}.every((${s[0]}, ${s[1]}) => (${a}))`:`${t}.every((${s[0]}, ${s[1]}) => (${s[1]} < ${n}) || (${a}))`}function kN(t,n,s){return`${t}.some((${n[0]}, ${n[1]}) => ${s})`}function TN(t,n,s){return`((value) => { let result = false; value.forEach((${n[0]}, ${n[1]}) => { if (${s}) result = true }); return result })(${t})`}function zd(t,n,s){return`${t}.reduce((result, ${n[0]}, ${n[1]}) => (${s}) ? ++result : result, 0)`}function hb(t){return`Object.entries(${t})`}function Ss(t){return`Object.getOwnPropertyNames(${t})`}function bs(t,n){return F(n,'"__proto__"')||F(n,'"constructor"')?`Object.prototype.hasOwnProperty.call(${t}, ${n})`:`${n} in ${t}`}function gb(t,n){return`Guard.IsDeepEqual(${t}, ${n})`}function wN(t){return`[${t.join(", ")}]`}function Po(t,n){return`((${t.join(", ")}) => ${n})`}function Dt(t,n){return`${t}(${n.join(", ")})`}function lh(t,n){return`new ${t}(${n.join(", ")})`}function Xe(t,n){return`${t}${gN(n)?`.${n}`:`[${Ie(n)}]`}`}function Ie(t){if(!xs(t))throw Error("Unsupported Constant");return ut(t)?JSON.stringify(t):`${t}`}function RN(t,n,s){return`(${t} ? ${n} : ${s})`}function jd(t){return`{ ${t.join("; ")}; }`}function to(t,n){return`const ${t} = ${n}`}function yb(t,n){return`if(${t}) { ${n} }`}function qd(t){return`return ${t}`}function Wn(t){return F(t.length,0)?"true":t.reduce((n,s)=>Gn(n,s))}function uh(t){return F(t.length,0)?"false":t.reduce((n,s)=>Nt(n,s))}function LN(t,n){return`Guard.IsMultipleOf(${t}, ${n})`}function AN(t){return t instanceof Boolean}function PN(t){return t instanceof Number}function MN(t){return t instanceof String}function xb(t){return globalThis.ArrayBuffer.isView(t)}function Ib(t){return t instanceof globalThis.RegExp}function _N(t){return t instanceof globalThis.Date}function ON(t){return t instanceof globalThis.Set}function $N(t){return t instanceof globalThis.Map}var NN={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Jr(){return NN}function Mo(t){return Jr().immutableTypes?Object.freeze(t):t}function ir(t,n){return wi.assign+=1,Mo({...t,...n})}function DN(t){return t}function HN(t){return Y(t,"~kind")||Y(t,"~unsafe")}function UN(t){let n={};for(let s of pe(t)){if(Nl(s))continue;let a=Object.getOwnPropertyDescriptor(t,s);if(a.value=Cs(a.value),F(a.enumerable,!0))n[s]=a.value;else Object.defineProperty(n,s,a)}return n}function BN(t){let n={};for(let s of pe(t)){if(Nl(s))continue;n[s]=Cs(t[s])}for(let s of lb(t))n[s]=Cs(t[s]);return n}function GN(t){return ib(t)?DN(t):HN(t)?UN(t):BN(t)}function zN(t){return t.map((n)=>Cs(n))}function jN(t){return t.slice()}function qN(t){return new RegExp(t.source,t.flags)}function KN(t){return new Map(Cs([...t.entries()]))}function VN(t){return new Set(Cs([...t.values()]))}function Cs(t){return xb(t)?jN(t):Ib(t)?qN(t):$N(t)?KN(t):ON(t)?VN(t):Te(t)?zN(t):Be(t)?GN(t):t}function Ia(t){return wi.clone+=1,Cs(t)}function WN(t,n){for(let s of Object.keys(n))Object.defineProperty(t,s,{configurable:!0,writable:!0,enumerable:!1,value:n[s]});return t}function Sb(t,n){return{...t,...n}}function Et(t,n,s={}){wi.create+=1;let a=Sb(n,s),l=Jr().enumerableKind?Sb(a,t):WN(a,t);return Mo(l)}function ui(t,n){wi.discard+=1;let s={};for(let a of pe(t)){if(n.includes(a))continue;let l=Object.getOwnPropertyDescriptor(t,a);l.value=Ia(l.value),Object.defineProperty(s,a,l)}return Mo(s)}function pt(t,n,s){wi.update+=1;let a=Jr(),l=Ia(t);for(let d of Object.keys(n))Object.defineProperty(l,d,{configurable:!0,writable:!0,enumerable:a.enumerableKind,value:n[d]});for(let d of Object.keys(s))Object.defineProperty(l,d,{configurable:!0,enumerable:!0,writable:!0,value:s[d]});return Mo(l)}function xe(t,n){return Be(t)&&Y(t,"~kind")&&F(t["~kind"],n)}function ln(t){return Be(t)}function Ee(t,n,s){return Et({"~kind":"Deferred"},{type:"deferred",action:t,parameters:n,options:s},{})}function _o(t){return xe(t,"Deferred")}function XN(t){return pt(t,{"~readonly":!0},{})}function Ul(t,n){return pt(XN(t),{},n)}function bb(t,n,s,a){let l=te(t,n,s);return Ul(l,a)}function YN(t){return pt(t,{"~optional":!0},{})}function Bl(t,n){return pt(YN(t),{},n)}function Cb(t,n,s,a){let l=te(t,n,s);return Bl(l,a)}function x(t,n){return Et({"~kind":"Array"},{type:"array",items:t},n)}function Qe(t){return xe(t,"Array")}function Sa(t){return ui(t,["~kind","type","items"])}function Oo(t,n,s={}){return Et({"~kind":"Constructor"},{type:"constructor",parameters:t,instanceType:n},s)}function hn(t){return xe(t,"Constructor")}function Eb(t){return ui(t,["~kind","type","parameters","instanceType"])}function $o(t,n,s={}){return Et({["~kind"]:"Function"},{type:"function",parameters:t,returnType:n},s)}function gn(t){return xe(t,"Function")}function vb(t){return ui(t,["~kind","type","parameters","returnType"])}function Xn(t,n){return Et({["~kind"]:"Ref"},{$ref:t},n)}function Ct(t){return xe(t,"Ref")}function Kd(t,n){return Et({"~kind":"Generic"},{type:"generic",parameters:t,expression:n})}function Gl(t){return xe(t,"Generic")}function Vd(t){return Et({["~kind"]:"Any"},{},t)}function en(t){return xe(t,"Any")}var kb="(?!)";function At(t){return Et({"~kind":"Never"},{not:{}},t)}function Fr(t){return xe(t,"Never")}function Es(t,n={}){return Bl(t,n)}function Zt(t){return Es(t)}function An(t){return ln(t)&&Y(t,"~optional")}function Tb(t){return pe(t).filter((n)=>!An(t[n]))}function Wd(t){return pe(t)}function Xd(t){return oh(t)}function r(t,n={}){let s=Tb(t),a=s.length>0?{required:s}:{};return Et({"~kind":"Object"},{type:"object",...a,properties:t},n)}function Re(t){return xe(t,"Object")}function wb(t){return ui(t,["~kind","type","properties","required"])}function ci(t){return Et({["~kind"]:"Unknown"},{},t)}function yn(t){return xe(t,"Unknown")}function no(t,n,s){let a=pe(t).reduce((l,d)=>({...l,[d]:pt(t[d],{},{$id:d})}),{});return Et({["~kind"]:"Cyclic"},{$defs:a,$ref:n},s)}function Pt(t){return xe(t,"Cyclic")}function ch(t){return eo(t)&&Y(t,"~unsafe")&&Or(t["~unsafe"])}function dr(t,n){return n[t.length]?.(...t)??(()=>{throw Error("Invalid Arguments")})()}function xn(t){return xe(t,"Infer")}function Yd(t,n,s,a={}){return Et({"~kind":"Dependent"},{if:t,then:n,else:s},a)}function un(t){return xe(t,"Dependent")}function Rb(t){return ui(t,["~kind","if","then","else"])}function In(t){return xe(t,"Enum")}function Cr(t,n={}){return Et({"~kind":"Intersect"},{allOf:t},n)}function we(t){return xe(t,"Intersect")}function Lb(t){return ui(t,["~kind","allOf"])}var dh=void 0;function JN(){try{return Pb("null")(),!0}catch{return!1}}function Ab(){if(bt(dh))dh=JN();return dh&&Jr().useAcceleration}function Pb(...t){return new globalThis.Function(...t)}var vs={};De(vs,{Hash:()=>fh,HashCode:()=>Db});function cn(){throw Error("Unreachable")}function QN(t){let n=new Set,s=t;while(s&&s!==Object.prototype){for(let a of Reflect.ownKeys(s))if(a!=="constructor"&&typeof a!=="symbol")n.add(a);s=Object.getPrototypeOf(s)}return[...n]}function ZN(t){return typeof t==="number"}var or;(function(t){t[t.Array=0]="Array",t[t.BigInt=1]="BigInt",t[t.Boolean=2]="Boolean",t[t.Date=3]="Date",t[t.Constructor=4]="Constructor",t[t.Function=5]="Function",t[t.Null=6]="Null",t[t.Number=7]="Number",t[t.Object=8]="Object",t[t.RegExp=9]="RegExp",t[t.String=10]="String",t[t.Symbol=11]="Symbol",t[t.TypeArray=12]="TypeArray",t[t.Undefined=13]="Undefined"})(or||(or={}));var ba=BigInt("14695981039346656037"),[eD,tD]=[BigInt("1099511628211"),BigInt("18446744073709551616")],nD=Array.from({length:256}).map((t,n)=>BigInt(n)),$b=new Float64Array(1),Fb=new DataView($b.buffer),Nb=new Uint8Array($b.buffer);function Hn(t){ba=ba^nD[t],ba=ba*eD%tD}function rD(t){Hn(or.Array);for(let n of t)Fo(n)}function iD(t){Hn(or.BigInt),Fb.setBigInt64(0,t);for(let n of Nb)Hn(n)}function _b(t){Hn(or.Boolean),Hn(t?1:0)}function oD(t){Hn(or.Constructor),Fo(t.toString())}function sD(t){Hn(or.Date),Fo(t.getTime())}function aD(t){Hn(or.Function),Fo(t.toString())}function lD(t){Hn(or.Null)}function Ob(t){Hn(or.Number),Fb.setFloat64(0,t,!0);for(let n of Nb)Hn(n)}function uD(t){Hn(or.Object);for(let n of QN(t).sort())Fo(n),Fo(t[n])}function cD(t){Hn(or.RegExp),mh(t.toString())}var dD=new TextEncoder;function mh(t){Hn(or.String);for(let n of dD.encode(t))Hn(n)}function mD(t){Hn(or.Symbol),Fo(t.toString())}function fD(t){Hn(or.TypeArray);let n=new Uint8Array(t.buffer);for(let s=0;s<n.length;s++)Hn(n[s])}function pD(t){return Hn(or.Undefined)}function Fo(t){return xb(t)?fD(t):_N(t)?sD(t):Ib(t)?cD(t):AN(t)?_b(t.valueOf()):MN(t)?mh(t.valueOf()):PN(t)?Ob(t.valueOf()):ZN(t)?Ob(t):Te(t)?rD(t):wn(t)?_b(t):Qt(t)?iD(t):th(t)?oD(t):Or(t)?lD(t):Be(t)?uD(t):ut(t)?mh(t):nh(t)?mD(t):bt(t)?pD(t):Ao(t)?aD(t):cn()}function Db(t){return ba=BigInt("14695981039346656037"),Fo(t),ba}function fh(t){return Db(t).toString(16).padStart(16,"0")}function Hb(t){switch(t.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${t.params.dependencies.join(", ")} when property ${t.params.property} is present`;case"dependentRequired":return`must have properties ${t.params.dependencies.join(", ")} when property ${t.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${t.params.comparison} ${t.params.limit}`;case"exclusiveMinimum":return`must be ${t.params.comparison} ${t.params.limit}`;case"format":return`must match format "${t.params.format}"`;case"if":return`must match "${t.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${t.params.limit} items`;case"maxLength":return`must not have more than ${t.params.limit} characters`;case"maxProperties":return`must not have more than ${t.params.limit} properties`;case"maximum":return`must be ${t.params.comparison} ${t.params.limit}`;case"minItems":return`must not have fewer than ${t.params.limit} items`;case"minLength":return`must not have fewer than ${t.params.limit} characters`;case"minProperties":return`must not have fewer than ${t.params.limit} properties`;case"minimum":return`must be ${t.params.comparison} ${t.params.limit}`;case"multipleOf":return`must be multiple of ${t.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${t.params.pattern}"`;case"propertyNames":return`property names ${t.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${t.params.requiredProperties.join(", ")}`;case"type":return typeof t.params.type==="string"?`must be ${t.params.type}`:`must be either ${t.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return t.params.message;default:return"an unknown validation error occurred"}}var hD=Hb;function Ub(){return hD}function Nr(t){return ln(t)&&Y(t,"~codec")&&Be(t["~codec"])&&Y(t["~codec"],"encode")&&Y(t["~codec"],"decode")}function Ca(t){return ln(t)&&Y(t,"~immutable")}function Ea(t,n={}){return Ul(t,n)}function va(t){return ln(t)&&Y(t,"~readonly")}var Gb="-?(?:0|[1-9][0-9]*)n";function ph(t){return Et({"~kind":"BigInt"},{type:"bigint"},t)}function Dr(t){return xe(t,"BigInt")}function We(t){return Et({"~kind":"Boolean"},{type:"boolean"},t)}function mr(t){return xe(t,"Boolean")}var Jd="-?(?:0|[1-9][0-9]*)";function jl(t){return Et({"~kind":"Integer"},{type:"integer"},t)}function zn(t){return xe(t,"Integer")}class zb extends Error{constructor(t){super("Invalid Literal value");Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}}function yD(t){return Qt(t)?"bigint":wn(t)?"boolean":ft(t)?"number":ut(t)?"string":(()=>{throw new zb(t)})()}function o(t,n){return Et({"~kind":"Literal"},{type:yD(t),const:t},n)}function hh(t){return Qt(t)||wn(t)||ft(t)||ut(t)}function jb(t){return Ye(t)&&Qt(t.const)}function qb(t){return Ye(t)&&wn(t.const)}function Qd(t){return Ye(t)&&ft(t.const)}function Zd(t){return Ye(t)&&ut(t.const)}function Ye(t){return xe(t,"Literal")}function he(t){return Et({"~kind":"Null"},{type:"null"},t)}function ro(t){return xe(t,"Null")}var em="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function y(t){return Et({"~kind":"Number"},{type:"number"},t)}function tn(t){return xe(t,"Number")}function tm(t){return Et({"~kind":"Symbol"},{type:"symbol"},t)}function No(t){return xe(t,"Symbol")}var nm=".*";function c(t){return Et({"~kind":"String"},{type:"string"},t)}function Pn(t){return xe(t,"String")}function i(t,n={}){return Et({"~kind":"Union"},{anyOf:t},n)}function ae(t){return xe(t,"Union")}function Kb(t){return ui(t,["~kind","anyOf"])}function ql(t){let n=Vb(t);return F(n.length,2)?n[0]:[]}function xD(t){return!0}function Wb(t){return Je(t,(n,s)=>ID(n)?Wb(s):!1,()=>!0)}function Xb(t){return F(t.length,0)?!1:Wb(t)}function ID(t){return ae(t)?Xb(t.anyOf):Ye(t)?xD(t.const):!1}function rm(t){return Xb(t)}function im(t){return Et({["~kind"]:"TemplateLiteral"},{type:"string",pattern:t},{})}function Yb(t,n,s=[]){return Je(t,(a,l)=>Yb(l,n,[...s,`${a}${n}`]),()=>s)}function SD(t,n){return F(t.length,0)?[`${n}`]:Yb(t,n)}function Jb(t,n,s=[]){return Je(n,(a,l)=>Jb(t,l,[...s,...Qb(t,a)]),()=>s)}function Qb(t,n){return ae(n)?Jb(t,n.anyOf):Ye(n)?SD(t,n.const):cn()}function Zb(t,n){return Je(n,(s,a)=>Zb(Qb(t,s),a),()=>t)}function bD(t){return t.map((n)=>o(n))}function CD(t){let n=Zb([],t),s=bD(n);return i(s)}function ED(t){return F(t.length,0)?cn():F(t.length,1)&&Ye(t[0])?t[0]:CD(t)}function gh(t){let n=ql(t);return F(n.length,0)?c():rm(n)?ED(n):im(t)}function Kl(t){let n=gh(t);return $t(n)?c():n}function fr(t,n){let a={[t]:n};return Et({["~kind"]:"Record"},{type:"object",patternProperties:a})}function eC(t){return fr(Do,t)}function tC(t){return r({true:t,false:t})}function Sn(t,n={}){let[s,a,l]=[t,t.length,!1];return Et({["~kind"]:"Tuple"},{type:"array",additionalItems:l,items:s,minItems:a},n)}function Ve(t){return xe(t,"Tuple")}function nC(t){return ui(t,["~kind","type","items","minItems","additionalItems"])}function vD(t){return ui(t,["~readonly"])}function yh(t,n){return pt(vD(t),{},n)}function rC(t,n,s,a){let l=te(t,n,s);return yh(l,a)}function iC(t,n={}){return yh(t,n)}function kD(t){return ui(t,["~optional"])}function xh(t,n){return pt(kD(t),{},n)}function oC(t,n,s,a){let l=te(t,n,s);return xh(l,a)}function om(t,n={}){return xh(t,n)}function Ih(t){return t.reduceRight((s,a,l)=>({[l]:a,...s}),{})}function sC(t){let n=Ih(t.items);return r(n)}function Sh(t){return Re(t)||Ve(t)}function TD(t,n){return va(t)?va(n)?!0:!1:!1}function wD(t,n){return An(t)?An(n)?!0:!1:!1}function RD(t,n){let s=TD(t,n),a=wD(t,n),l=Vt([t,n]),d=iC(om(l));return s&&a?Ea(Es(d)):s&&!a?Ea(d):!s&&a?Es(d):d}function LD(t,n,s){return s in t?s in n?RD(t[s],n[s]):t[s]:(s in n)?n[s]:At()}function AD(t,n){return[...new Set([...pe(t),...pe(n)])].reduce((l,d)=>({...l,[d]:LD(t,n,d)}),{})}function aC(t){return Re(t)?t.properties:Ve(t)?Ih(t.items):{}}function lC(t,n){let s=aC(t),a=aC(n),l=AD(s,a);return r(l)}function PD(t,n){let s=ka(t,n);return F(s,Wl)?t:F(s,Xl)?n:F(s,Vl)?n:At()}function MD(t,n){let s=Sh(t),a=Sh(n);return s&&a?lC(t,n):s&&!a?t:!s&&a?n:PD(t,n)}function uC(t,n){return Fr(t)?t:en(t)?t:yn(t)?n:Fr(n)?n:en(n)?n:yn(n)?t:MD(t,n)}function _D(t,n){return ae(t)||ae(n)}function OD(t,n){let s=Qr(t),a=Qr(n);return _D(s,a)?Vt([s,a]):uC(s,a)}function cC(t,n,s=[]){return Je(n,(a,l)=>cC(t,l,[...s,OD(a,t)]),()=>F(s.length,0)?[t]:s)}function dC(t,n,s=[]){return Je(t,(a,l)=>dC(l,n,[...s,...Yl([a],n)]),()=>s)}function Yl(t,n=[]){return Je(t,(s,a)=>ae(s)?Yl(a,dC(s.anyOf,n)):Yl(a,cC(s,n)),()=>n)}function $D(t,n){let s=Yn({},t,n);return Er(s)?[]:[t]}function mC(t,n,s=[]){return Je(t,(a,l)=>mC(l,n,[...s,...$D(a,n)]),()=>s)}function sm(t,n){let s=Qr(t),a=ae(s)?s.anyOf:[s],l=mC(a,n);return pr(l)}function di(t,n,s){let a=Vt([t,n]),l=sm(s,t);return pr([a,l])}function sr(t,n=[]){return Je(t,(s,a)=>sr(a,[...n,o(s)]),()=>pr(n))}function Vt(t){let n=Yl(t),s=bh(n);return pr(s)}function Jn(t){let n=Kl(t);return Qr(n)}function pr(t){let n=bh(t);return Ho(n)}function Qr(t){return un(t)?di(t.if,t.then,t.else):In(t)?sr(t.enum):we(t)?Vt(t.allOf):$t(t)?Jn(t.pattern):ae(t)?pr(t.anyOf):t}function Ho(t){return F(t.length,1)?t[0]:F(t.length,0)?At():i(t)}function fC(t,n){let s=sr(t);return Uo(s,n)}function pC(t,n){return fr(Ta,n)}function hC(t,n){let s=Vt(t);return Uo(s,n)}function gC(t,n){return ut(t)||ft(t)?r({[t]:n}):F(t,!1)?r({false:n}):F(t,!0)?r({true:n}):r({})}function yC(t,n){return fr(am,n)}function xC(t,n){return Y(t,"pattern")&&(ut(t.pattern)||t.pattern instanceof RegExp)?fr(t.pattern.toString(),n):fr(Do,n)}function IC(t,n){let s=ql(t);return rm(s)?Uo(Jn(t),n):fr(t,n)}function FD(t){return ae(t)?ks(t.anyOf):[t]}function ks(t,n=[]){return Je(t,(s,a)=>ks(a,[...n,...FD(s)]),()=>n)}function ND(t){return t.some((n)=>Pn(n)||tn(n)||zn(n))}function DD(t,n){return F(ND(t),!0)?fr(Do,n):void 0}function HD(t,n){return t.reduce((s,a)=>Ye(a)&&(ut(a.const)||ft(a.const))?{...s,[a.const]:n}:s,{})}function UD(t,n){let s=HD(t,n);return r(s)}function SC(t,n){let s=ks(t),a=DD(s,n);return ln(a)?a:UD(s,n)}function Uo(t,n){return en(t)?eC(n):mr(t)?tC(n):In(t)?fC(t.enum,n):zn(t)?pC(t,n):we(t)?hC(t.allOf,n):Ye(t)?gC(t.const,n):tn(t)?yC(t,n):ae(t)?SC(t.anyOf,n):Pn(t)?xC(t,n):$t(t)?IC(t.pattern,n):r({})}function Ch(t,n,s){return je([t])?pt(Uo(t,n),{},s):Eh(t,n,s)}function bC(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return Ch(d,f,l)}var Ta=`^${Jd}$`,am=`^${em}$`,Do=`^${nm}$`;function Eh(t,n,s={}){return Ee("Record",[t,n],s)}function Jl(t,n,s={}){return Ch(t,n,s)}function CC(t,n){return fr(t,n)}function lm(t){return F(t,Do)?c():F(t,Ta)?jl():F(t,am)?y():gh(t)}function Un(t){return pe(t.patternProperties)[0]}function Ts(t){let n=Un(t);return lm(n)}function Bt(t){return t.patternProperties[Un(t)]}function vt(t){return xe(t,"Record")}function um(t){return Et({"~kind":"Rest"},{type:"rest",items:t},{})}function ws(t){return xe(t,"Rest")}function vh(t){return xe(t,"This")}function cm(t){return Et({"~kind":"Undefined"},{type:"undefined"},t)}function Ai(t){return xe(t,"Undefined")}function Hr(t){return xe(t,"Void")}function EC(t){return ph()}function vC(t){return c()}function kC(t){return y()}function TC(t){return jl()}function wC(t){return At()}function RC(t){return o(t)}function LC(t){return t}function AC(t){return i(t[1])}function PC(t){return t.length===3?[...t[0],...t[2]]:t.length===1?[...t[0]]:[]}function MC(t){return[t[0],...t[1]]}function _C(t){return t}function OC(t){return t[1]}function mm(t){return F(t.length,2)}function vr(t,n,s){return mm(t)?n(t[0],t[1]):s()}function XD(t,n){return F(n.indexOf(t),0)?[t,n.slice(t.length)]:[]}function Pi(t,n){for(let s=0;s<t.length;s++){let a=XD(t[s],n);if(mm(a))return a}return[]}function Wh(t,n){return Array.from({length:n-t+1},(s,a)=>String.fromCharCode(t+a))}var $C=[...Wh(97,122),...Wh(65,90)],FC="0",NC=Wh(49,57),wa=[FC,...NC],DC=" ",Ql=`
|
|
310
|
+
`;var Ra="_";var HC="$";var UC="//",BC="/*",JD="*/";function GC(t){let n=t.indexOf(JD);return F(n,-1)?"":t.slice(n+2)}function zC(t){let n=t.indexOf(Ql);return F(n,-1)?"":t.slice(n)}function QD(t){return t.replace(/^[ \t\r\f\v]+/,"")}function fm(t){let n=QD(t);return n.startsWith(BC)?fm(GC(n.slice(2))):n.startsWith(UC)?fm(zC(n.slice(2))):n}function mi(t){let n=t.trimStart();return n.startsWith(BC)?mi(GC(n.slice(2))):n.startsWith(UC)?mi(zC(n.slice(2))):n}var Jse=[...wa,Ra];function Xh(t,n){return Pi([t],n)}function fi(t,n){return F(t,"")?["",n]:t.startsWith(Ql)?Xh(t,fm(n)):t.startsWith(DC)?Xh(t,n):Xh(t,mi(n))}var rH=[...$C,Ra,HC];var vae=[...rH,...wa];var $ae=[...wa,Ra];function iH(t){return F(t,"")?[]:[t.slice(0,1),t.slice(1)]}function jC(t,n){return Je(t,(s,a)=>n.startsWith(s)?!0:jC(a,n),()=>!1)}function Zl(t,n,s=""){return vr(iH(n),(a,l)=>jC(t,n)?[s,n]:Zl(t,l,`${s}${a}`),()=>[])}function qC(t,n){return vr(Zl(t,n),(s,a)=>F(s,"")?[]:[s,a],()=>[])}var ht=(t,n,s=()=>[])=>t.length===2?n(t):s();var sH=(t)=>ht(fi("-?(?:0|[1-9][0-9]*)n",t),([n,s])=>[EC(n),s]),aH=(t)=>ht(fi(".*",t),([n,s])=>[vC(n),s]),lH=(t)=>ht(fi("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",t),([n,s])=>[kC(n),s]),uH=(t)=>ht(fi("-?(?:0|[1-9][0-9]*)",t),([n,s])=>[TC(n),s]),cH=(t)=>ht(fi("(?!)",t),([n,s])=>[wC(n),s]),dH=(t)=>ht(qC(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],t),([n,s])=>[RC(n),s]),mH=(t)=>ht(ht(sH(t),([n,s])=>[n,s],()=>ht(aH(t),([n,s])=>[n,s],()=>ht(lH(t),([n,s])=>[n,s],()=>ht(uH(t),([n,s])=>[n,s],()=>ht(cH(t),([n,s])=>[n,s],()=>ht(fH(t),([n,s])=>[n,s],()=>ht(dH(t),([n,s])=>[n,s],()=>[]))))))),([n,s])=>[LC(n),s]),fH=(t)=>ht(ht(fi("(",t),([n,s])=>ht(Jh(s),([a,l])=>ht(fi(")",l),([d,f])=>[[n,a,d],f]))),([n,s])=>[AC(n),s]),KC=(t)=>ht(ht(ht(Yh(t),([n,s])=>ht(fi("|",s),([a,l])=>ht(KC(l),([d,f])=>[[n,a,d],f]))),([n,s])=>[n,s],()=>ht(ht(Yh(t),([n,s])=>[[n],s]),([n,s])=>[n,s],()=>ht([[],t],([n,s])=>[n,s],()=>[]))),([n,s])=>[PC(n),s]),Yh=(t)=>ht(ht(mH(t),([n,s])=>ht(Jh(s),([a,l])=>[[n,a],l])),([n,s])=>[MC(n),s]),Jh=(t)=>ht(ht(KC(t),([n,s])=>[n,s],()=>ht(Yh(t),([n,s])=>[n,s],()=>[])),([n,s])=>[_C(n),s]),Vb=(t)=>ht(ht(fi("^",t),([n,s])=>ht(Jh(s),([a,l])=>ht(fi("$",l),([d,f])=>[[n,a,d],f]))),([n,s])=>[OC(n),s]);function hH(t){return t.join("|")}function gH(t){return t.slice(1,t.length-1)}function yH(t,n,s){return Bo(n,`${s}${t}`)}function xH(t,n){return Bo(t,`${n}${Gb}`)}function IH(t,n){return Bo(t,`${n}${Jd}`)}function SH(t,n){return Bo(t,`${n}${em}`)}function bH(t,n){return eu(i([o("false"),o("true")]),t,n)}function CH(t,n){return Bo(t,`${n}${nm}`)}function EH(t,n,s){return Bo(n,`${s}${gH(t)}`)}function vH(t,n,s){let a=pm(t,{});return eu(a,n,s)}function kH(t,n,s){let a=sr(t);return eu(a,n,s)}function VC(t,n,s,a=[]){return Je(t,(l,d)=>VC(d,n,s,[...a,eu(l,[],"")]),()=>Bo(n,`${s}(${hH(a)})`))}function eu(t,n,s){return In(t)?kH(t.enum,n,s):zn(t)?IH(n,s):Ye(t)?yH(t.const,n,s):Dr(t)?xH(n,s):mr(t)?bH(n,s):tn(t)?SH(n,s):Pn(t)?CH(n,s):$t(t)?EH(t.pattern,n,s):XC(t)?vH(t.parameters[0],n,s):ae(t)?VC(t.anyOf,n,s):kb}function Bo(t,n){return Je(t,(s,a)=>eu(s,a,n),()=>n)}function TH(t){return`^${Bo(t,"")}$`}function WC(t){let n=TH(t);return im(n)}function pm(t,n){return je(t)?pt(WC(t),{},n):kh(t,n)}function YC(t,n,s,a){let l=Ur(t,n,s);return pm(l,a)}function kh(t,n={}){return Ee("TemplateLiteral",[t],n)}function XC(t){return ln(t)&&Y(t,"action")&&F(t.action,"TemplateLiteral")}function $t(t){return xe(t,"TemplateLiteral")}function JC(t){return Et({["~kind"]:"ExtendsUnion"},{inferred:t})}function QC(t){return Be(t)&&Y(t,"~kind")&&Y(t,"inferred")&&F(t["~kind"],"ExtendsUnion")&&Be(t.inferred)}function ce(t){return Et({["~kind"]:"ExtendsTrue"},{inferred:t})}function ZC(t){return Be(t)&&Y(t,"~kind")&&Y(t,"inferred")&&F(t["~kind"],"ExtendsTrue")&&Be(t.inferred)}function Fe(){return Et({["~kind"]:"ExtendsFalse"},{})}function eE(t){return Be(t)&&Y(t,"~kind")&&F(t["~kind"],"ExtendsFalse")}function Er(t){return QC(t)||ZC(t)}function Wt(t,n,s){return Er(t)?n(t.inferred):s()}function wH(t,n,s,a){return Wt(dt(t,s,a),(l)=>ce(ir(ir(t,l),{[n]:s})),()=>Fe())}function RH(t,n){return ce(t)}function LH(t,n,s,a,l){return Wt(dt(t,n,s),(d)=>Wt(dt(d,n,a),(f)=>ce(f),()=>Fe()),()=>Wt(dt(t,n,l),(d)=>ce(d),()=>Fe()))}function AH(t,n,s){let a=sr(s);return dt(t,n,a)}function tE(t,n,s){return Je(s,(a,l)=>Wt(dt(t,n,a),(d)=>tE(d,n,l),()=>Fe()),()=>ce(t))}function PH(t,n,s){let a=Jn(s);return dt(t,n,a)}function nE(t,n,s){return Je(s,(a,l)=>Wt(dt(t,n,a),(d)=>ce(d),()=>nE(t,n,l)),()=>Fe())}function xt(t,n,s){return en(s)?RH(t,n):un(s)?LH(t,n,s.if,s.then,s.else):In(s)?AH(t,n,s.enum):xn(s)?wH(t,s.name,n,s.extends):we(s)?tE(t,n,s.allOf):$t(s)?PH(t,n,s.pattern):ae(s)?nE(t,n,s.anyOf):yn(s)?ce(t):Fe()}function rE(t,n,s){return xn(s)?xt(t,n,s):en(s)?ce(t):yn(s)?ce(t):JC(t)}function MH(t,n){let s=Ca(t),a=Ca(n);return s&&a?!0:!s&&a?!0:s&&!a?!1:!0}function iE(t,n,s,a){return Qe(a)?MH(n,a)?dt(t,s,a.items):Fe():xt(t,n,a)}function oE(t,n,s){return Dr(s)?ce(t):xt(t,n,s)}function sE(t,n,s){return mr(s)?ce(t):xt(t,n,s)}function _H(t,n,s,a,l){let d=xn(a)?n:a,f=xn(a)?a:n,h=An(n),g=An(a);return!h&&g?Fe():Wt(dt(t,d,f),(I)=>tu(I,s,l),()=>Fe())}function OH(t,n,s,a){return Je(a,(l,d)=>_H(t,n,s,l,d),()=>An(n)?ce(t):Fe())}function $H(t,n,s){return Je(n,(a,l)=>OH(t,a,l,s),()=>ce(t))}function tu(t,n,s){return $H(t,n,s)}function hm(t,n,s){return Hr(s)?ce(t):dt(t,n,s)}function aE(t,n,s,a){return en(a)?ce(t):yn(a)?ce(t):hn(a)?Wt(tu(t,n,a.parameters),(l)=>hm(l,s,a.instanceType),()=>Fe()):Fe()}function lE(t,n,s,a,l){return Wt(dt(t,n,l),()=>dt(t,s,l),()=>dt(t,a,l))}function uE(t,n,s){let a=sr(n);return dt(t,a,s)}function cE(t,n,s,a){return en(a)?ce(t):yn(a)?ce(t):gn(a)?Wt(tu(t,n,a.parameters),(l)=>hm(l,s,a.returnType),()=>Fe()):Fe()}function dE(t,n,s){return zn(s)?ce(t):tn(s)?ce(t):xt(t,n,s)}function mE(t,n,s){let a=Vt(n);return dt(t,a,s)}function gm(t,n,s){return n===s?ce(t):Fe()}function FH(t,n,s){return Ye(s)?gm(t,n,s.const):Dr(s)?ce(t):xt(t,o(n),s)}function NH(t,n,s){return Ye(s)?gm(t,n,s.const):mr(s)?ce(t):xt(t,o(n),s)}function DH(t,n,s){return Ye(s)?gm(t,n,s.const):tn(s)?ce(t):xt(t,o(n),s)}function HH(t,n,s){return Ye(s)?gm(t,n,s.const):Pn(s)?ce(t):xt(t,o(n),s)}function fE(t,n,s){return Qt(n.const)?FH(t,n.const,s):wn(n.const)?NH(t,n.const,s):ft(n.const)?DH(t,n.const,s):ut(n.const)?HH(t,n.const,s):cn()}function pE(t,n,s){return xn(s)?xt(t,n,s):ce(t)}function hE(t,n,s){return ro(s)?ce(t):xt(t,n,s)}function gE(t,n,s){return tn(s)?ce(t):xt(t,n,s)}function UH(t,n,s){return An(n)?An(s)?ce(t):Fe():ce(t)}function BH(t,n,s){return xn(s)&&Fr(s.extends)?Fe():Wt(dt(t,n,s),(a)=>UH(a,n,s),()=>Fe())}function GH(t,n){return t.reduce((s,a)=>(a in n)?Er(n[a])?{...s,...n[a].inferred}:cn():cn(),{})}function zH(t,n,s){let a={};for(let f of pe(s))a[f]=f in n?BH({},n[f],s[f]):An(s[f])?xn(s[f])?ce(ir(t,{[s[f].name]:s[f].extends})):ce(t):Fe();let l=oh(a).every((f)=>Er(f)),d=l?GH(pe(a),a):{};return l?ce(d):Fe()}function jH(t,n,s){let a=zH(t,n,s);return Er(a)?ce(ir(t,a.inferred)):Fe()}function qH(t,n,s){return jH(t,n,s)}function KH(t,n){return pe(n).reduce((s,a)=>({...s,[a]:Y(t,a)?ae(s[a])?i([...s[a].anyOf,n[a]]):i([t[a],n[a]]):n[a]}),t)}function yE(t,n,s,a){return Je(n,(l,d)=>Wt(dt({},t[l],s),(f)=>yE(t,d,s,KH(a,f)),()=>Fe()),()=>ce(a))}function VH(t,n,s,a){let l=pe(n);return yE(n,l,a,t)}function xE(t,n,s){return vt(s)?VH(t,n,Un(s),Bt(s)):Re(s)?qH(t,n,s.properties):xt(t,r(n),s)}function WH(t,n){return F(pe(n).length,0)?ce(t):Fe()}function XH(t,n,s,a,l){return dt(t,s,l)}function IE(t,n,s,a){return vt(a)?XH(t,lm(n),s,lm(Un(a)),Bt(a)):Re(a)?WH(t,a.properties):en(a)?ce(t):yn(a)?ce(t):Fe()}function SE(t,n,s){return Pn(s)?ce(t):xt(t,n,s)}function bE(t,n,s){return No(s)?ce(t):xt(t,n,s)}function CE(t,n,s){let a=Jn(n);return dt(t,a,s)}function Qh(t,n){return Et({"~kind":"Inferrable"},{name:t,type:n},{})}function nu(t){return Be(t)&&Y(t,"~kind")&&Y(t,"name")&&Y(t,"type")&&F(t["~kind"],"Inferrable")&&ut(t.name)&&Be(t.type)}function Zh(t){return ws(t)?xn(t.items)?Qe(t.items.extends)?Qh(t.items.name,t.items.extends.items):yn(t.items.extends)?Qh(t.items.name,t.items.extends):void 0:cn():void 0}function ym(t){return xn(t)?Qh(t.name,t.extends):void 0}function eg(t,n,s=[]){return Je(t,(a,l)=>Wt(dt({},a,n),()=>eg(l,n,[...s,a]),()=>{return}),()=>s)}function EE(t,n,s,a){let l=eg(s,a);return Te(l)?ce(ir(t,{[n]:Sn(l)})):Fe()}function xm(t,n,s,a){let l=eg(s,a);return Te(l)?ce(ir(t,{[n]:i(l)})):Fe()}function YH(t){return[...t].reverse()}function tg(t,n){return n?YH(t):t}function JH(t){let n=t.length>0?t[0]:void 0,s=ln(n)?Zh(n):void 0;return ln(s)}function QH(t,n,s,a,l,d){return Wt(dt(t,s,l),(f)=>vE(f,n,a,d),()=>Fe())}function ZH(t,n,s,a,l){let d=Zh(a);return nu(d)?EE(t,d.name,tg(s,n),d.type):Je(s,(f,h)=>QH(t,n,f,h,a,l),()=>Fe())}function e2(t,n,s,a){return Je(a,(l,d)=>ZH(t,n,s,l,d),()=>F(s.length,0)?ce(t):Fe())}function vE(t,n,s,a){return e2(t,n,s,a)}function t2(t,n,s){let a=Go(t,dn([],[]),s),l=JH(a);return vE(t,l,tg(n,l),tg(a,l))}function kE(t,n,s){let a=ym(s);return nu(a)?xm(t,a.name,n,a.type):Je(n,(l,d)=>Wt(dt(t,l,s),(f)=>kE(f,d,s),()=>Fe()),()=>ce(t))}function TE(t,n,s){let a=Go(t,dn([],[]),n);return Ve(s)?t2(t,a,s.items):Qe(s)?kE(t,a,s.items):xt(t,Sn(a),s)}function wE(t,n,s){return Hr(s)?ce(t):Ai(s)?ce(t):xt(t,n,s)}function RE(t,n,s){return Je(s,(a,l)=>Wt(dt(t,n,a),(d)=>ce(d),()=>RE(t,n,l)),()=>Fe())}function ng(t,n,s){return Je(n,(a,l)=>Wt(RE(t,a,s),(d)=>ng(d,l,s),()=>Fe()),()=>ce(t))}function LE(t,n,s){let a=ym(s);return nu(a)?xm(t,a.name,n,a.type):ae(s)?ng(t,n,s.anyOf):ng(t,n,[s])}function AE(t,n,s){return xn(s)?xt(t,n,s):en(s)?ce(t):yn(s)?ce(t):Fe()}function PE(t,n,s){return Hr(s)?ce(t):xt(t,n,s)}function dt(t,n,s){return en(n)?rE(t,n,s):Qe(n)?iE(t,n,n.items,s):Dr(n)?oE(t,n,s):mr(n)?sE(t,n,s):hn(n)?aE(t,n.parameters,n.instanceType,s):un(n)?lE(t,n.if,n.then,n.else,s):In(n)?uE(t,n.enum,s):gn(n)?cE(t,n.parameters,n.returnType,s):zn(n)?dE(t,n,s):we(n)?mE(t,n.allOf,s):Ye(n)?fE(t,n,s):Fr(n)?pE(t,n,s):ro(n)?hE(t,n,s):tn(n)?gE(t,n,s):Re(n)?xE(t,n.properties,s):vt(n)?IE(t,Un(n),Bt(n),s):Pn(n)?SE(t,n,s):No(n)?bE(t,n,s):$t(n)?CE(t,n.pattern,s):Ve(n)?TE(t,n.items,s):Ai(n)?wE(t,n,s):ae(n)?LE(t,n.anyOf,s):yn(n)?AE(t,n,s):Hr(n)?PE(t,n,s):Fe()}function n2(t,n){return Vt([...t,r(n)])}function ME(t,n,s){return je(t)?pt(n2(t,n),{},s):Th(t,n,s)}function _E(t,n,s,a,l){let d=Ur(t,n,s),f=ru(t,n,a);return ME(d,f,l)}function Th(t,n,s={}){return Ee("Interface",[t,n],s)}function La(t){return ln(t)&&Y(t,"action")&&F(t.action,"Interface")}function r2(t,n,s){return t.includes(s)?!0:iu([...t,s],n,n[s])}function OE(t,n,s){let a=Xd(s);return Rs(t,n,a)}function Rs(t,n,s){return Je(s,(a,l)=>iu(t,n,a)?!0:Rs(t,n,l),()=>!1)}function iu(t,n,s){return Ct(s)?r2(t,n,s.$ref):Qe(s)?iu(t,n,s.items):hn(s)?Rs(t,n,[...s.parameters,s.instanceType]):gn(s)?Rs(t,n,[...s.parameters,s.returnType]):La(s)?OE(t,n,s.parameters[1]):we(s)?Rs(t,n,s.allOf):Re(s)?OE(t,n,s.properties):ae(s)?Rs(t,n,s.anyOf):Ve(s)?Rs(t,n,s.items):vt(s)?iu(t,n,Bt(s)):!1}function $E(t,n,s){return iu(t,n,s)}function i2(t,n){return n.reduce((s,a)=>$E([a],t,t[a])?[...s,a]:s,[])}function FE(t){let n=Wd(t);return i2(t,n)}function o2(t,n,s){return s.includes(n)?s:(n in t)?ou(t,t[n],[...s,n]):cn()}function NE(t,n,s){let a=Xd(n);return Aa(t,a,s)}function Aa(t,n,s){return n.reduce((a,l)=>ou(t,l,a),s)}function ou(t,n,s){return Ct(n)?o2(t,n.$ref,s):Qe(n)?ou(t,n.items,s):hn(n)?Aa(t,[...n.parameters,n.instanceType],s):gn(n)?Aa(t,[...n.parameters,n.returnType],s):La(n)?NE(t,n.parameters[1],s):we(n)?Aa(t,n.allOf,s):Re(n)?NE(t,n.properties,s):ae(n)?Aa(t,n.anyOf,s):Ve(n)?Aa(t,n.items,s):vt(n)?ou(t,Bt(n),s):s}function DE(t,n,s){return ou(t,s,[n])}function s2(t){return Vd()}function a2(t){return pe(t).reduce((n,s)=>({...n,[s]:Ls(t[s])}),{})}function su(t){return t.reduce((n,s)=>[...n,Ls(s)],[])}function Ls(t){return Ct(t)?s2(t.$ref):Qe(t)?x(Ls(t.items),Sa(t)):hn(t)?Oo(su(t.parameters),Ls(t.instanceType)):gn(t)?$o(su(t.parameters),Ls(t.returnType)):we(t)?Cr(su(t.allOf)):Re(t)?r(a2(t.properties)):vt(t)?Jl(Ts(t),Ls(Bt(t))):ae(t)?i(su(t.anyOf)):Ve(t)?Sn(su(t.items)):t}function l2(t,n){return n in t?Ls(t[n]):ci()}function HE(t){return l2(t.$defs,t.$ref)}function u2(t,n,s){let a=Ur(t,dn([],[]),n),l=ru({},dn([],[]),s);return Vt([...a,r(l)])}function c2(t,n){return pe(t).filter((a)=>n.includes(a)).reduce((a,l)=>{let d=t[l],f=La(d)?u2(t,d.parameters[0],d.parameters[1]):d;return{...a,[l]:f}},{})}function UE(t,n,s){let a=DE(t,n,s),l=c2(t,a);return no(l,n)}function BE(t,n){return n in t?Ct(t[n])?BE(t,t[n].$ref):t[n]:At()}function Mi(t,n){return BE(t,n)}function GE(t){return Pt(t)?HE(t):ch(t)?ci():t}function Yn(t,n,s){let a=GE(n),l=GE(s);return dt(t,a,l)}var Vl=0,au=1,Wl=2,Xl=3;function ka(t,n){let s=[Yn({},t,n),Yn({},n,t)];return Er(s[0])&&Er(s[1])?Vl:Er(s[0])&&eE(s[1])?Wl:eE(s[0])&&Er(s[1])?Xl:au}function rg(t,n,s=[],a=n){return Je(n,(l,d)=>{let f=ka(t,l);return F(f,Wl)||F(f,Vl)?a:F(f,au)?rg(t,d,[...s,l],a):rg(t,d,s,a)},()=>[...s,t])}function d2(t,n,s){let a=Qr(t);return en(a)?[a]:yn(a)?[a]:Fr(a)?Im(n,s):Re(a)?Im(n,[...s,a]):Im(n,rg(a,s))}function Im(t,n=[]){return Je(t,(s,a)=>d2(s,a,n),()=>n)}function bh(t){let n=Im(t);return ks(n)}function ig(t,n){return pt(Qr(t),{},n)}function zE(t,n,s,a){let l=te(t,n,s);return ig(l,a)}function lu(t,n=[]){return _o(t)&&F(t.action,"Conditional")?Ct(t.parameters[0])?lu(t.parameters[2],lu(t.parameters[3],[...n,t.parameters[0].$ref])):lu(t.parameters[2],lu(t.parameters[3],n)):_o(t)&&F(t.action,"Mapped")?_o(t.parameters[1])&&F(t.parameters[1].action,"KeyOf")&&Ct(t.parameters[1].parameters[0])?[...n,t.parameters[1].parameters[0].$ref]:n:n}function m2(t,n){return t.reduce((s,a)=>[...s,n.includes(a.name)],[])}function KE(t,n,s=[]){return Je(t,(a,l)=>Je(n,(d,f)=>KE(l,f,[...s,[d,a]]),()=>s),()=>s)}function f2(t){return $t(t)?Jn(t.pattern):In(t)?sr(t.enum):t}function p2(t){let n=f2(t);return ae(n)?[...n.anyOf]:[n]}function h2(t,n){return t.reduce((s,a)=>[...s,[...a,n]],[])}function jE(t,n){return n.reduce((s,a)=>[...s,...h2(t,a)],[])}function qE(t){return t.reduce((n,s)=>F(s[0],!0)?jE(n,p2(s[1])):jE(n,[s[1]]),[[]])}function VE(t,n,s){let a=lu(s),l=m2(t,a),d=KE(n,l);return _o(s)&&F(s.action,"Conditional")?qE(d):_o(s)&&F(s.action,"Mapped")?qE(d):[n]}function g2(){return["(not-resolvable)",At()]}function y2(){return["(not-generic)",At()]}function x2(t,n,s){return[t,Kd(n,s)]}function I2(t,n,s){return n in t?WE(t,n,t[n],s):g2()}function WE(t,n,s,a){return Gl(s)?x2(n,s.parameters,s.expression):Ct(s)?I2(t,s.$ref,a):y2()}function XE(t,n,s){return WE(t,"(anonymous)",n,s)}function S2(t,n,s){if(xn(n)||uu(n)||Er(Yn({},n,s)))return;let a={parameter:t,expect:s,actual:n};throw Error(`Argument for parameter ${t} does not satisfy constraint`,{cause:a})}function YE(t,n,s,a,l){let d=te(t,n,l);return S2(s,d,a),ir(t,{[s]:d})}function b2(t,n,s,a,l){let d=te(t,n,s.extends),f=te(t,n,s.equals);return Je(l,(h,g)=>og(YE(t,n,s.name,d,h),n,a,g),()=>og(YE(t,n,s.name,d,f),n,a,[]))}function og(t,n,s,a){return Je(s,(l,d)=>b2(t,n,l,d,a),()=>t)}function JE(t,n,s,a){return og(t,n,s,a)}var sg=0,ag=0;function C2(){if(Fl(ag,Jr().maxInstantiationCount))return;throw Error("Type instantiation is excessively deep and possibly infinite")}function E2(){C2(),ag++,sg++}function v2(){if(sg--,F(sg,0))ag=0}function k2(t){return ys(t.callstack.length,0)?t.callstack[t.callstack.length-1]:""}function T2(t,n){return F(k2(t),n)}function w2(t,n,s,a,l,d){E2();try{let f=JE(t,n,a,d),h=te(f,dn([...n.callstack,s.$ref],n.visited),l);return te(f,dn([],[]),h)}finally{v2()}}function R2(t,n,s,a,l,d){return d.reduce((f,h)=>{let g=w2(t,n,s,a,l,h);return[...f,g]},[])}function L2(t,n,s,a,l,d){let f=VE(a,d,l),h=R2(t,n,s,a,l,f);return F(h.length,1)?h[0]:pr(h)}function lg(t,n,s,a){let l=Ur(t,n,a),d=XE(t,s,a),f=d[0],h=d[1];return Gl(h)?T2(n,f)?dm(Xn(f),l):L2(t,n,Xn(f),h.parameters,h.expression,l):dm(s,l)}function dm(t,n){return Et({["~kind"]:"Call"},{type:"call",target:t,arguments:n},{})}function uu(t){return xe(t,"Call")}function A2(t){return ui(t,["~immutable"])}function QE(t,n){return pt(A2(t),{},n)}function ZE(t,n,s,a){let l=te(t,n,s);return QE(l,a)}function ev(t,n){return t(n)}function tv(t,n){return ut(n)?o(ev(t,n)):o(n)}function nv(t,n){let s=Jn(n);return io(t,s)}function rv(t,n){let s=n.map((a)=>io(t,a));return i(s)}function io(t,n){return Ye(n)?tv(t,n.const):$t(n)?nv(t,n.pattern):ae(n)?rv(t,n.anyOf):n}function wh(t,n={}){return Ee("Capitalize",[t],n)}function Rh(t,n={}){return Ee("Lowercase",[t],n)}function Lh(t,n={}){return Ee("Uncapitalize",[t],n)}function Ah(t,n={}){return Ee("Uppercase",[t],n)}var P2=(t)=>t[0].toUpperCase()+t.slice(1),M2=(t)=>t.toLowerCase(),_2=(t)=>t[0].toLowerCase()+t.slice(1),O2=(t)=>t.toUpperCase();function iv(t,n){return je([t])?pt(io(P2,t),{},n):wh(t,n)}function ov(t,n){return je([t])?pt(io(M2,t),{},n):Rh(t,n)}function sv(t,n){return je([t])?pt(io(_2,t),{},n):Lh(t,n)}function av(t,n){return je([t])?pt(io(O2,t),{},n):Ah(t,n)}function lv(t,n,s,a){let l=te(t,n,s);return iv(l,a)}function uv(t,n,s,a){let l=te(t,n,s);return ov(l,a)}function cv(t,n,s,a){let l=te(t,n,s);return sv(l,a)}function dv(t,n,s,a){let l=te(t,n,s);return av(l,a)}function Ph(t,n,s,a,l={}){return Ee("Conditional",[t,n,s,a],l)}function $2(t,n,s,a,l,d){let f=Yn(t,s,a);return QC(f)?i([te(f.inferred,n,l),te(t,n,d)]):ZC(f)?te(f.inferred,n,l):te(t,n,d)}function mv(t,n,s,a,l,d,f){return je([s,a])?pt($2(t,n,s,a,l,d),{},f):Ph(s,a,l,d,f)}function fv(t,n,s,a,l,d,f){let h=te(t,n,s),g=te(t,n,a);return mv(t,n,h,g,l,d,f)}function Mh(t,n={}){return Ee("ConstructorParameters",[t],n)}function F2(t){let n=hn(t)?t.parameters:[],s=Go({},dn([],[]),n);return Sn(s)}function pv(t,n){return je([t])?pt(F2(t),{},n):Mh(t,n)}function hv(t,n,s,a){let l=te(t,n,s);return pv(l,a)}function _h(t,n,s={}){return Ee("Exclude",[t,n],s)}function Sm(t,n,s){return je([t,n])?pt(sm(t,n),{},s):_h(t,n,s)}function gv(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return Sm(d,f,l)}function Oh(t,n,s={}){return Ee("Extract",[t,n],s)}function N2(t,n){let s=Yn({},t,n);return Er(s)?[t]:[]}function xv(t,n,s=[]){return Je(t,(a,l)=>xv(l,n,[...s,...N2(a,n)]),()=>s)}function Iv(t,n){let s=Qr(t),a=ae(s)?s.anyOf:[s],l=xv(a,n);return pr(l)}function yv(t,n,s){return je([t,n])?pt(Iv(t,n),{},s):Oh(t,n,s)}function Sv(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return yv(d,f,l)}function $h(t,n,s={}){return Ee("Index",[t,n],s)}function Ev(t,n){let s=Mi(t,n);return Br(s)}function vv(t,n,s){let a=di(t,n,s);return Br(a)}function D2(t,n){let s=pe(t).filter((b)=>!Y(n,b)),a=pe(n).filter((b)=>!Y(t,b)),l=pe(t).filter((b)=>Y(n,b)),d=s.reduce((b,v)=>({...b,[v]:t[v]}),{}),f=a.reduce((b,v)=>({...b,[v]:n[v]}),{}),h=l.reduce((b,v)=>({...b,[v]:Vt([t[v],n[v]])}),{}),g=ir(d,f);return ir(g,h)}function kv(t){return t.reduce((n,s)=>D2(n,Br(s)),{})}function Tv(t){return t}function wv(t){let n=sC(Sn(t));return Br(n)}function H2(t,n){return pe(t).filter((l)=>(l in n)).reduce((l,d)=>({...l,[d]:pr([t[d],n[d]])}),{})}function Rv(t,n){return Je(t,(s,a)=>Rv(a,H2(n,Br(s))),()=>n)}function Lv(t){return Je(t,(n,s)=>Rv(s,Br(n)),()=>cn())}function Br(t){return Pt(t)?Ev(t.$defs,t.$ref):un(t)?vv(t.if,t.then,t.else):we(t)?kv(t.allOf):ae(t)?Lv(t.anyOf):Ve(t)?wv(t.items):Re(t)?Tv(t.properties):{}}function Pa(t){let n=Br(t);return r(n)}var U2=new RegExp("^(?:0|[1-9][0-9]*)$");function Ma(t){let n=`${t}`;return U2.test(n)?parseInt(n):t}function B2(t){return o(Ma(t))}function Av(t){return t.map((n)=>Pv(n))}function Pv(t){return we(t)?Cr(Av(t.allOf)):ae(t)?i(Av(t.anyOf)):Ye(t)?B2(t.const):t}function Mv(t,n){let s=Pv(n),a=Yn({},s,y());return Er(a)?t:Ye(n)&&F(n.const,"length")?y():At()}function _v(t,n){let s=Mi(t,n);return kr(s)}function Ov(t,n,s){let a=di(t,n,s);return kr(a)}function $v(t){let n=sr(t);return kr(n)}function Fv(t){let n=Vt(t);return kr(n)}function Nv(t){return[`${t}`]}function Dv(t){let n=Jn(t);return kr(n)}function Hv(t){return t.reduce((n,s)=>[...n,...kr(s)],[])}function kr(t){return Pt(t)?_v(t.$defs,t.$ref):un(t)?Ov(t.if,t.then,t.else):In(t)?$v(t.enum):we(t)?Fv(t.allOf):Ye(t)?Nv(t.const):$t(t)?Dv(t.pattern):ae(t)?Hv(t.anyOf):[]}function _a(t){return kr(t)}function cu(t,n){return n.map((s)=>du(t,s))}function du(t,n){return Qe(n)?x(du(t,n.items)):hn(n)?Oo(cu(t,n.parameters),du(t,n.instanceType)):gn(n)?$o(cu(t,n.parameters),du(t,n.returnType)):Ve(n)?Sn(cu(t,n.items)):ae(n)?i(cu(t,n.anyOf)):we(n)?Cr(cu(t,n.allOf)):vh(n)?r(t):n}function Uv(t,n){return du(t,n)}function G2(t,n){let s=n in t?t[n]:At();return Uv(t,s)}function Bv(t,n){return n.reduce((s,a)=>[...s,G2(t,a)],[])}function z2(t,n){let s=_a(n),a=Bv(t,s);return pr(a)}var j2=new RegExp(Ta);function q2(t){return t.filter((s)=>j2.test(s))}function K2(t){let n=Wd(t),s=q2(n),a=Bv(t,s);return pr(a)}function Gv(t,n){return tn(n)?K2(t):z2(t,n)}function V2(t){return o(Ma(t))}function zv(t){return t.map((n)=>ug(n))}function ug(t){return we(t)?Cr(zv(t.allOf)):ae(t)?i(zv(t.anyOf)):Ye(t)?V2(t.const):t}function W2(t,n){return t.reduceRight((s,a,l)=>{let d=Yn({},o(l),n);return Er(d)?[a,...s]:s},[])}function X2(t,n){let s=ug(n),a=W2(t,s);return Ho(a)}function Y2(t){return Ho(t)}function jv(t,n){return Ye(n)&&F(n.const,"length")?o(t.length):tn(n)||zn(n)?Y2(t):X2(t,n)}function qv(t,n){return Qe(t)?Mv(t.items,n):Re(t)?Gv(t.properties,n):Ve(t)?jv(t.items,n):At()}function J2(t){return Pt(t)||un(t)||we(t)||ae(t)?Pa(t):t}function Cv(t,n,s){return je([t,n])?pt(qv(J2(t),n),{},s):$h(t,n,s)}function Kv(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return Cv(d,f,l)}function Fh(t,n={}){return Ee("InstanceType",[t],n)}function Q2(t){return hn(t)?t.instanceType:At()}function Vv(t,n){return je([t])?pt(Q2(t),{},n):Fh(t,n)}function Wv(t,n,s,a={}){let l=te(t,n,s);return Vv(l,a)}function Nh(t,n={}){return Ee("KeyOf",[t],n)}function Yv(){return i([y(),c(),tm()])}function Jv(t){return y()}function Z2(t){return t.reduce((s,a)=>hh(a)?[...s,o(Ma(a))]:cn(),[])}function Qv(t){let n=pe(t),s=Z2(n);return Ho(s)}function Zv(t){return Ts(t)}function ek(t){let n=t.map((s,a)=>o(a));return Ho(n)}function tk(t){return en(t)?Yv():Qe(t)?Jv(t.items):Re(t)?Qv(t.properties):vt(t)?Zv(t):Ve(t)?ek(t.items):At()}function eU(t){return Pt(t)||un(t)||we(t)||ae(t)?Pa(t):t}function Xv(t,n){return je([t])?pt(tk(eU(t)),{},n):Nh(t,n)}function nk(t,n,s,a){let l=te(t,n,s);return Xv(l,a)}function Dh(t,n,s,a,l={}){return Ee("Mapped",[t,n,s,a],l)}function tU(t){let n=Jn(t);return bm(n)}function nU(t){return t.reduce((n,s)=>[...n,...bm(s)],[])}function rU(t){let n=sr(t);return bm(n)}function iU(t){return ft(t)?[o(`${t}`)]:[o(t)]}function bm(t){return In(t)?rU(t.enum):Ye(t)?iU(t.const):$t(t)?tU(t.pattern):ae(t)?nU(t.anyOf):[t]}function ik(t){return bm(t)}function oU(t){return $t(t)?Jn(t.pattern):t}function sU(t,n,s,a,l,d){let f=ir(t,{[s.name]:a}),h=te(f,n,l),g=oU(h),I=te(f,n,d);return Qd(g)||Zd(g)?{[g.const]:I}:{}}function aU(t,n,s,a,l,d){return a.reduce((f,h)=>[...f,sU(t,n,s,h,l,d)],[])}function lU(t){return t.reduce((n,s)=>[...n,r(s)],[])}function ok(t,n,s,a,l,d){let f=ik(a),h=aU(t,n,s,f,l,d),g=lU(h);return Vt(g)}function rk(t,n,s,a,l,d,f){return je([a])?pt(ok(t,n,s,a,l,d),{},f):Dh(s,a,l,d,f)}function sk(t,n,s,a,l,d,f){let h=te(t,n,a);return rk(t,n,s,h,l,d,f)}function uU(t,n,s){let a=ir(t,n);return pe(n).filter((d)=>s.includes(d)).reduce((d,f)=>({...d,[f]:UE(a,f,n[f])}),{})}function cU(t,n,s){let a=ir(t,n);return pe(n).filter((d)=>!s.includes(d)).reduce((d,f)=>({...d,[f]:te(a,dn([],[]),n[f])}),{})}function dU(t,n,s){let a=FE(n),l=uU(t,n,a),d=cU(t,n,a),f={...l,...d};return pt(f,{},s)}function cg(t,n,s,a){return dU(t,s,a)}function Hh(t,n={}){return Ee("NonNullable",[t],n)}function mU(t){let n=i([he(),cm()]);return Sm(t,n,{})}function ak(t,n){return je([t])?pt(mU(t),{},n):Hh(t,n)}function lk(t,n,s,a){let l=te(t,n,s);return ak(l,a)}function Uh(t,n,s={}){return Ee("Omit",[t,n],s)}function Cm(t){let n=Pa(t);return Re(n)?n.properties:cn()}function fU(t,n){return pe(t).reduce((a,l)=>n.includes(l)?a:{...a,[l]:t[l]},{})}function ck(t,n){let s=Cm(t),a=_a(n),l=fU(s,a);return r(l)}function uk(t,n,s){return je([t,n])?pt(ck(t,n),{},s):Uh(t,n,s)}function dk(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return uk(d,f,l)}function Bh(t,n={}){return Ee("Parameters",[t],n)}function pU(t){let n=gn(t)?t.parameters:[],s=Go({},dn([],[]),n);return Sn(s)}function mk(t,n){return je([t])?pt(pU(t),{},n):Bh(t,n)}function fk(t,n,s,a){let l=te(t,n,s);return mk(l,a)}function Gh(t,n={}){return Ee("Partial",[t],n)}function hk(t,n){let s=Mi(t,n),a=_i(s);return no(ir(t,{[n]:a}),n)}function gk(t,n,s){let a=di(t,n,s);return _i(a)}function yk(t){let n=Vt(t);return _i(n)}function xk(t){let n=t.map((s)=>_i(s));return i(n)}function Ik(t){let n=pe(t).reduce((a,l)=>({...a,[l]:Es(t[l])}),{});return r(n)}function _i(t){return Pt(t)?hk(t.$defs,t.$ref):un(t)?gk(t.if,t.then,t.else):we(t)?yk(t.allOf):ae(t)?xk(t.anyOf):Re(t)?Ik(t.properties):r({})}function pk(t,n){return je([t])?pt(_i(t),{},n):Gh(t,n)}function Sk(t,n,s,a){let l=te(t,n,s);return pk(l,a)}function zh(t,n,s={}){return Ee("Pick",[t,n],s)}function hU(t,n){return pe(t).reduce((a,l)=>n.includes(l)?ir(a,{[l]:t[l]}):a,{})}function Ck(t,n){let s=Cm(t),a=_a(n),l=hU(s,a);return r(l)}function bk(t,n,s){return je([t,n])?pt(Ck(t,n),{},s):zh(t,n,s)}function Ek(t,n,s,a,l){let d=te(t,n,s),f=te(t,n,a);return bk(d,f,l)}function jh(t,n={}){return Ee("ReadonlyObject",[t],n)}function se(t,n={}){return dg(t,n)}function vk(t){return zl(x(t))}function kk(t,n){let s=Mi(t,n),a=Oi(s);return no(ir(t,{[n]:a}),n)}function Tk(t,n,s){let a=di(t,n,s);return Oi(a)}function wk(t){let n=Vt(t);return Oi(n)}function Rk(t){let n=pe(t).reduce((a,l)=>({...a,[l]:Ea(t[l])}),{});return r(n)}function Lk(t){return zl(Sn(t))}function Ak(t){let n=t.map((s)=>Oi(s));return i(n)}function Oi(t){return Qe(t)?vk(t.items):Pt(t)?kk(t.$defs,t.$ref):un(t)?Tk(t.if,t.then,t.else):we(t)?wk(t.allOf):Re(t)?Rk(t.properties):Ve(t)?Lk(t.items):ae(t)?Ak(t.anyOf):t}function dg(t,n){return je([t])?pt(Oi(t),{},n):jh(t)}function Pk(t,n,s,a){let l=te(t,n,s);return dg(l,a)}function Mk(t,n,s,a){return n.visited.includes(a)?s:(a in t)?te(t,dn(n.callstack,[...n.visited,a]),t[a]):s}function _k(t,n){let s=Mi(t,n),a=$i(s);return no(ir(t,{[n]:a}),n)}function Ok(t,n,s){let a=di(t,n,s);return $i(a)}function $k(t){let n=Vt(t);return $i(n)}function Fk(t){let n=t.map((s)=>$i(s));return i(n)}function Nk(t){let n=pe(t).reduce((a,l)=>({...a,[l]:om(t[l])}),{});return r(n)}function $i(t){return Pt(t)?_k(t.$defs,t.$ref):un(t)?Ok(t.if,t.then,t.else):we(t)?$k(t.allOf):ae(t)?Fk(t.anyOf):Re(t)?Nk(t.properties):r({})}function qh(t,n={}){return Ee("Required",[t],n)}function Dk(t,n){return je([t])?pt($i(t),{},n):qh(t,n)}function Hk(t,n,s,a){let l=te(t,n,s);return Dk(l,a)}function Kh(t,n={}){return Ee("ReturnType",[t],n)}function gU(t){return gn(t)?t.returnType:At()}function Uk(t,n){return je([t])?pt(gU(t),{},n):Kh(t,n)}function Bk(t,n,s,a={}){let l=te(t,n,s);return Uk(l,a)}function Vh(t,n){return Ee("With",[t,n],{})}function mg(t,n){return fg(t,n)}function fg(t,n){return je([t])?pt(t,{},n):Vh(t,n)}function Gk(t,n,s,a){let l=te(t,n,s);return fg(l,a)}function yU(t){return ws(t)?Ve(t.items)?pg(t.items.items):xn(t.items)?[t]:Ct(t.items)?[t]:[At()]:[t]}function pg(t){return t.reduce((s,a)=>[...s,...yU(a)],[])}function dn(t,n){return{callstack:t,visited:n}}function je(t){return Je(t,(n,s)=>Ct(n)?!1:je(s),()=>!0)}function ru(t,n,s){return pe(s).reduce((a,l)=>({...a,[l]:te(t,n,s[l])}),{})}function Go(t,n,s){let a=Ur(t,n,s);return pg(a)}function Ur(t,n,s){return s.map((a)=>te(t,n,a))}function xU(t,n){let s=An(t)?Bl(n,{}):n,a=va(t)?Ul(s,{}):s;return Ca(t)?mu(a,{}):a}function IU(t,n,s,a,l){return F(s,"AddImmutable")?zk(t,n,a[0],l):F(s,"RemoveImmutable")?ZE(t,n,a[0],l):F(s,"AddReadonly")?bb(t,n,a[0],l):F(s,"RemoveReadonly")?rC(t,n,a[0],l):F(s,"AddOptional")?Cb(t,n,a[0],l):F(s,"RemoveOptional")?oC(t,n,a[0],l):F(s,"Capitalize")?lv(t,n,a[0],l):F(s,"Conditional")?fv(t,n,a[0],a[1],a[2],a[3],l):F(s,"ConstructorParameters")?hv(t,n,a[0],l):F(s,"Evaluate")?zE(t,n,a[0],l):F(s,"Exclude")?gv(t,n,a[0],a[1],l):F(s,"Extract")?Sv(t,n,a[0],a[1],l):F(s,"Index")?Kv(t,n,a[0],a[1],l):F(s,"InstanceType")?Wv(t,n,a[0],l):F(s,"Interface")?_E(t,n,a[0],a[1],l):F(s,"KeyOf")?nk(t,n,a[0],l):F(s,"Lowercase")?uv(t,n,a[0],l):F(s,"Mapped")?sk(t,n,a[0],a[1],a[2],a[3],l):F(s,"Module")?cg(t,n,a[0],l):F(s,"NonNullable")?lk(t,n,a[0],l):F(s,"Pick")?Ek(t,n,a[0],a[1],l):F(s,"Parameters")?fk(t,n,a[0],l):F(s,"Partial")?Sk(t,n,a[0],l):F(s,"Omit")?dk(t,n,a[0],a[1],l):F(s,"ReadonlyObject")?Pk(t,n,a[0],l):F(s,"Record")?bC(t,n,a[0],a[1],l):F(s,"Required")?Hk(t,n,a[0],l):F(s,"ReturnType")?Bk(t,n,a[0],l):F(s,"TemplateLiteral")?YC(t,n,a[0],l):F(s,"Uncapitalize")?cv(t,n,a[0],l):F(s,"Uppercase")?dv(t,n,a[0],l):F(s,"With")?Gk(t,n,a[0],a[1]):Ee(s,a,l)}function SU(t,n,s){let a=Ct(s)?Mk(t,n,s,s.$ref):Qe(s)?x(te(t,n,s.items),Sa(s)):uu(s)?lg(t,n,s.target,s.arguments):hn(s)?Oo(Ur(t,n,s.parameters),te(t,n,s.instanceType),Eb(s)):gn(s)?$o(Ur(t,n,s.parameters),te(t,n,s.returnType),vb(s)):un(s)?Yd(te(t,n,s.if),te(t,n,s.then),te(t,n,s.else),Rb(s)):we(s)?Cr(Ur(t,n,s.allOf),Lb(s)):Re(s)?r(ru(t,n,s.properties),wb(s)):vt(s)?CC(Un(s),te(t,n,Bt(s))):ws(s)?um(te(t,n,s.items)):Ve(s)?Sn(Go(t,n,s.items),nC(s)):ae(s)?i(Ur(t,n,s.anyOf),Kb(s)):s;return xU(s,a)}function te(t,n,s){return _o(s)?IU(t,n,s.action,s.parameters,s.options):SU(t,n,s)}function pi(t,n){return te(t,dn([],[]),n)}function bU(t){return pt(t,{"~immutable":!0},{})}function mu(t,n){return pt(bU(t),{},n)}function zk(t,n,s,a){let l=te(t,n,s);return mu(l,a)}function zl(t,n={}){return mu(t,n)}function Qn(t,n={}){return ig(t,n)}function CU(t,n){let s=ka(t,n);return F(s,Xl)?1:F(s,au)?1:0}function jk(t,n,s=[]){return Je(n,(a,l)=>F(CU(t,a),1)?jk(t,l,[...s,a]):[...s,t,...n],()=>[...s,t])}function qk(t,n=[]){return Je(t,(s,a)=>qk(a,jk(s,n)),()=>n)}function Kk(t){return qk(t)}function fu(t){return Y(t,"~refine")&&Te(t["~refine"])&&Rn(t["~refine"],0,(n)=>Be(n)&&Y(n,"check")&&Y(n,"error")&&Ao(n.check)&&Ao(n.error))}function Mn(t){return Be(t)&&!Te(t)}function oo(t){return wn(t)}function Le(t){return Mn(t)||oo(t)}function Oa(t){return Y(t,"additionalItems")&&Le(t.additionalItems)}function Zr(t){return Y(t,"additionalProperties")&&Le(t.additionalProperties)}function pu(t){return Y(t,"allOf")&&Te(t.allOf)&&t.allOf.every((n)=>Le(n))}function hu(t){return Y(t,"$anchor")&&ut(t.$anchor)}function gu(t){return Y(t,"anyOf")&&Te(t.anyOf)&&t.anyOf.every((n)=>Le(n))}function Em(t){return Y(t,"const")}function Fi(t){return Y(t,"contains")&&Le(t.contains)}function Gr(t){return Y(t,"default")}function yu(t){return Y(t,"dependencies")&&Be(t.dependencies)&&Object.values(t.dependencies).every((n)=>Le(n)||Te(n)&&n.every((s)=>ut(s)))}function xu(t){return Y(t,"dependentRequired")&&Be(t.dependentRequired)&&Object.values(t.dependentRequired).every((n)=>Te(n)&&n.every((s)=>ut(s)))}function $a(t){return Y(t,"dependentSchemas")&&Be(t.dependentSchemas)&&Object.values(t.dependentSchemas).every((n)=>Le(n))}function so(t){return Y(t,"$dynamicAnchor")&&ut(t.$dynamicAnchor)}function Iu(t){return Y(t,"$dynamicRef")&&ut(t.$dynamicRef)}function Su(t){return Y(t,"else")&&Le(t.else)}function vm(t){return Y(t,"enum")&&Te(t.enum)}function bu(t){return Y(t,"exclusiveMaximum")&&(ft(t.exclusiveMaximum)||Qt(t.exclusiveMaximum))}function hi(t){return Y(t,"exclusiveMinimum")&&(ft(t.exclusiveMinimum)||Qt(t.exclusiveMinimum))}function As(t){return Y(t,"format")&&ut(t.format)}function zr(t){return Y(t,"$id")&&ut(t.$id)}function Cu(t){return Y(t,"if")&&Le(t.if)}function ao(t){return Y(t,"items")&&(Le(t.items)||Te(t.items)&&t.items.every((n)=>Le(n)))}function Eu(t){return ao(t)&&Te(t.items)}function vu(t){return Y(t,"maximum")&&(ft(t.maximum)||Qt(t.maximum))}function ku(t){return Y(t,"maxContains")&&ft(t.maxContains)}function Fa(t){return Y(t,"maxItems")&&ft(t.maxItems)}function Tu(t){return Y(t,"maxLength")&&ft(t.maxLength)}function wu(t){return Y(t,"maxProperties")&&ft(t.maxProperties)}function gi(t){return Y(t,"minimum")&&(ft(t.minimum)||Qt(t.minimum))}function lo(t){return Y(t,"minContains")&&ft(t.minContains)}function zo(t){return Y(t,"minItems")&&ft(t.minItems)}function Ps(t){return Y(t,"minLength")&&ft(t.minLength)}function Ms(t){return Y(t,"minProperties")&&ft(t.minProperties)}function Ru(t){return Y(t,"multipleOf")&&(ft(t.multipleOf)||Qt(t.multipleOf))}function Lu(t){return Y(t,"not")&&Le(t.not)}function Au(t){return Y(t,"oneOf")&&Te(t.oneOf)&&t.oneOf.every((n)=>Le(n))}function _s(t){return Y(t,"pattern")&&(ut(t.pattern)||t.pattern instanceof RegExp)}function uo(t){return Y(t,"patternProperties")&&Be(t.patternProperties)&&Object.values(t.patternProperties).every((n)=>Le(n))}function yi(t){return Y(t,"prefixItems")&&Te(t.prefixItems)&&t.prefixItems.every((n)=>Le(n))}function co(t){return Y(t,"properties")&&Be(t.properties)&&Object.values(t.properties).every((n)=>Le(n))}function Na(t){return Y(t,"propertyNames")&&(Be(t.propertyNames)||Le(t.propertyNames))}function vU(t){return Y(t,"$recursiveAnchor")&&wn(t.$recursiveAnchor)}function Pu(t){return vU(t)&&F(t.$recursiveAnchor,!0)}function Mu(t){return Y(t,"$recursiveRef")&&ut(t.$recursiveRef)}function _u(t){return Y(t,"$ref")&&ut(t.$ref)}function xi(t){return Y(t,"required")&&Te(t.required)&&t.required.every((n)=>ut(n))}function Ou(t){return Y(t,"then")&&Le(t.then)}function $u(t){return Y(t,"type")&&(ut(t.type)||Te(t.type)&&t.type.every((n)=>ut(n)))}function jo(t){return Y(t,"uniqueItems")&&wn(t.uniqueItems)}function qo(t){return Y(t,"unevaluatedItems")&&Le(t.unevaluatedItems)}function Ko(t){return Y(t,"unevaluatedProperties")&&Le(t.unevaluatedProperties)}function kU(t){return qo(t)||Ko(t)||ya(pe(t),(n)=>km(t[n]))}function TU(t){return ya(t,(n)=>km(n))}function km(t){return Te(t)?TU(t):Be(t)?kU(t):!1}function Vk(t,n){return km(n)||ya(pe(t),(s)=>km(t[s]))}class gg{constructor(t){this.hasUnevaluated=t}UseUnevaluated(){return this.hasUnevaluated}Push(){return Dt(Xe("context","Push"),[])}Pop(){return Dt(Xe("context","Pop"),[])}AddIndex(t){return Dt(Xe("context","AddIndex"),[t])}AddKey(t){return Dt(Xe("context","AddKey"),[t])}Merge(t){return Dt(Xe("context","Merge"),[t])}}class er{constructor(){let t=new Set,n=new Set;this.stack=[{indices:t,keys:n}]}Push(){let t=new Set,n=new Set;return this.stack.push({indices:t,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(let n of t)n.GetIndices().forEach((s)=>this.GetIndices().add(s)),n.GetKeys().forEach((s)=>this.GetKeys().add(s));return!0}}class tr extends er{constructor(){super();this.errors=[]}AtCapacity(){return this.errors.length>=Jr().maxErrors}AddError(t){if(!this.AtCapacity())this.errors.push(t);return!1}GetErrors(){return this.errors}}var Tm={identifier:"External",variables:[]};function ei(t){let n=`External[${Tm.variables.length}]`;return Tm.variables.push(t),n}function Wk(){Tm.variables=[]}function Xk(){return{...Tm}}function Yk(t,n,s,a){let l=ei(s["~refine"].map((d)=>d));return Li(l,Ie(0),["refinement","_"],Dt(Xe("refinement","check"),[a]))}function Jk(t,n,s,a){return Rn(s["~refine"],0,(l,d)=>l.check(a))}function Qk(t,n,s,a,l,d){return Vn(l["~refine"],0,(f,h)=>f.check(d)||n.AddError({keyword:"~refine",schemaPath:s,instancePath:a,params:{index:h,message:f.error(d)}}))}var wU=0;function kt(){return`var_${wU++}`}function yg(t){return ao(t)&&Te(t.items)}function RU(t,n,s,a){let[l,d]=[kt(),kt()],f=ar(t,n,s.additionalItems,l),h=ah(d,Ie(s.items.length)),g=n.AddIndex(d);return Li(a,Ie(0),[l,d],Nt(h,Gn(f,g)))}function LU(t,n,s,a){let[l,d]=[kt(),kt()],f=ar(t,n,s.additionalItems,l),h=ah(d,Ie(s.items.length));return Li(a,Ie(0),[l,d],Nt(h,f))}function Zk(t,n,s,a){if(!yg(s))return Ie(!0);return n.UseUnevaluated()?RU(t,n,s,a):LU(t,n,s,a)}function eT(t,n,s,a){if(!yg(s))return!0;return Rn(a,0,(d,f)=>Fl(f,s.items.length)||jr(t,n,s.additionalItems,d)&&n.AddIndex(f))}function tT(t,n,s,a,l,d){if(!yg(l))return!0;return Rn(d,0,(h,g)=>{let I=`${s}/additionalItems`,b=`${a}/${g}`;return Fl(g,l.items.length)||qr(t,n,I,b,l.additionalItems,h)&&n.AddIndex(g)})}function Ii(t){return new RegExp(t,"u")}function AU(t,n){return!t.UseUnevaluated()&&(F(n,!0)||Be(n)&&F(pe(n).length,0))}function PU(t){return`^${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function xg(t){let n=[];if(uo(t))n.push(...pe(t.patternProperties));if(co(t))n.push(...pe(t.properties).map(PU));return F(n.length,0)?"(?!)":`(${n.join("|")})`}function MU(t,n,s){return xi(n)&&co(n)&&!uo(n)&&F(n.additionalProperties,!1)&&F(pe(n.properties).length,n.required.length)}function _U(t,n,s){return br(Xe(Dt(Xe("Object","getOwnPropertyNames"),[s]),"length"),Ie(n.required.length))}function OU(t,n,s,a){let[l,d]=[kt(),kt()],f=ei(Ii(xg(s))),h=ar(t,n,s.additionalProperties,`${a}[${l}]`),g=Dt(Xe(f,"test"),[l]),I=n.AddKey(l),b=n.UseUnevaluated()?Nt(g,Gn(h,I)):Nt(g,h);return Li(Ss(a),Ie(0),[l,d],b)}function nT(t,n,s,a){if(AU(n,s.additionalProperties))return Ie(!0);return MU(n,s,a)?_U(n,s,a):OU(t,n,s,a)}function rT(t,n,s,a){let l=Ii(xg(s));return Rn(pe(a),0,(f,h)=>l.test(f)||jr(t,n,s.additionalProperties,a[f])&&n.AddKey(f))}function iT(t,n,s,a,l,d){let f=Ii(xg(l)),h=[];return Vn(pe(d),0,(I,b)=>{let v=`${s}/additionalProperties`,k=`${a}/${I}`,w=f.test(I)||qr(t,n,v,k,l.additionalProperties,d[I])&&n.AddKey(I);if(!w)h.push(I);return w})||n.AddError({keyword:"additionalProperties",schemaPath:s,instancePath:a,params:{additionalProperties:h}})}function Vo(t,n,s,a,l){let d=to("results","[]"),f=s.map((b,v)=>to(`context_${v}`,lh("CheckContext",[]))),h=s.map((b,v)=>to(`condition_${v}`,Dt(Po(["context"],gt(t,n,b,a)),[`context_${v}`]))),g=s.map((b,v)=>yb(`condition_${v}`,Dt(Xe("results","push"),[`context_${v}`]))),I=qd(Gn(l,n.Merge("results")));return Dt(Po([],jd([d,...f,...h,...g,I])),[])}function $U(t,n,s,a){return Vo(t,n,s.allOf,a,br(Xe("results","length"),Ie(s.allOf.length)))}function FU(t,n,s,a){return Wn(s.allOf.map((l)=>gt(t,n,l,a)))}function oT(t,n,s,a){return n.UseUnevaluated()?$U(t,n,s,a):FU(t,n,s,a)}function sT(t,n,s,a){let l=s.allOf.reduce((d,f)=>{let h=new er;return mt(t,h,f,a)?[...d,h]:d},[]);return F(l.length,s.allOf.length)&&n.Merge(l)}function aT(t,n,s,a,l,d){let f=[],h=l.allOf.reduce((I,b,v)=>{let k=`${s}/allOf/${v}`,w=new tr,P=_t(t,w,k,a,b,d);if(!P)f.push(w);return P?[...I,w]:I},[]),g=F(h.length,l.allOf.length)&&n.Merge(h);if(!g)f.forEach((I)=>I.GetErrors().forEach((b)=>n.AddError(b)));return g}function NU(t,n,s,a){return Vo(t,n,s.anyOf,a,pb(Xe("results","length"),Ie(0)))}function DU(t,n,s,a){return uh(s.anyOf.map((l)=>gt(t,n,l,a)))}function lT(t,n,s,a){return n.UseUnevaluated()?NU(t,n,s,a):DU(t,n,s,a)}function uT(t,n,s,a){let l=s.anyOf.reduce((d,f)=>{let h=new er;return mt(t,h,f,a)?[...d,h]:d},[]);return ys(l.length,0)&&n.Merge(l)}function cT(t,n,s,a,l,d){let f=[],h=l.anyOf.reduce((I,b,v)=>{let k=new tr,w=`${s}/anyOf/${v}`,P=_t(t,k,w,a,b,d);if(!P)f.push(k);return P?[...I,k]:I},[]),g=ys(h.length,0)&&n.Merge(h);if(!g)f.forEach((I)=>I.GetErrors().forEach((b)=>n.AddError(b)));return g||n.AddError({keyword:"anyOf",schemaPath:s,instancePath:a,params:{}})}function dT(t,n,s,a){return s?Ie(!0):Ie(!1)}function Ig(t,n,s,a){return s}function mT(t,n,s,a,l,d){return Ig(t,n,l,d)||n.AddError({keyword:"boolean",schemaPath:s,instancePath:a,params:{}})}function fT(t,n,s,a){return xs(s.const)?br(a,Ie(s.const)):gb(a,ei(s.const))}function Sg(t,n,s,a){return xs(s.const)?F(a,s.const):xa(a,s.const)}function pT(t,n,s,a,l,d){return Sg(t,n,l,d)||n.AddError({keyword:"const",schemaPath:s,instancePath:a,params:{allowedValue:l.const}})}function hT(t){return!(lo(t)&&F(t.minContains,0))}function HU(t,n,s,a){let[l,d]=[kt(),kt()],f=rr(br(Xe(a,"length"),Ie(0))),h=TN(a,[l,d],Gn(gt(t,n,s.contains,l),n.AddIndex(d)));return Gn(f,h)}function UU(t,n,s,a){let[l]=[kt()],d=rr(br(Xe(a,"length"),Ie(0))),f=kN(a,[l,"_"],gt(t,n,s.contains,l));return Gn(d,f)}function gT(t,n,s,a){if(!hT(s))return Ie(!0);return n.UseUnevaluated()?HU(t,n,s,a):UU(t,n,s,a)}function bg(t,n,s,a){if(!hT(s))return!0;return!F(a.length,0)&&ab(a,(l,d)=>mt(t,n,s.contains,l)&&n.AddIndex(d))}function yT(t,n,s,a,l,d){return bg(t,n,l,d)||n.AddError({keyword:"contains",schemaPath:s,instancePath:a,params:{minContains:1}})}function xT(t,n,s,a){let l=br(Xe(Ss(a),"length"),Ie(0)),d=Wn(Ln(s.dependencies).map(([f,h])=>{let g=rr(bs(a,Ie(f))),I=gt(t,n,h,a),b=(v)=>Wn(v.map((k)=>bs(a,Ie(k))));return Nt(g,Te(h)?b(h):I)}));return Nt(l,d)}function IT(t,n,s,a){let l=F(pe(a).length,0),d=Rn(Ln(s.dependencies),0,([f,h])=>!Y(a,f)||(Te(h)?h.every((g)=>Y(a,g)):mt(t,n,h,a)));return l||d}function ST(t,n,s,a,l,d){let f=F(pe(d).length,0),h=Vn(Ln(l.dependencies),0,([g,I])=>{let b=`${s}/dependencies/${g}`;return!Y(d,g)||(Te(I)?I.every((v)=>Y(d,v)||n.AddError({keyword:"dependencies",schemaPath:s,instancePath:a,params:{property:g,dependencies:I}})):_t(t,n,b,a,I,d))});return f||h}function bT(t,n,s,a){let l=br(Xe(Ss(a),"length"),Ie(0)),d=Wn(Ln(s.dependentRequired).map(([f,h])=>{let g=rr(bs(a,Ie(f))),I=Wn(h.map((b)=>bs(a,Ie(b))));return Nt(g,I)}));return Nt(l,d)}function CT(t,n,s,a){let l=F(pe(a).length,0),d=Rn(Ln(s.dependentRequired),0,([f,h])=>!Y(a,f)||h.every((g)=>Y(a,g)));return l||d}function ET(t,n,s,a,l,d){let f=F(pe(d).length,0),h=Vn(Ln(l.dependentRequired),0,([g,I])=>!Y(d,g)||Vn(I,0,(b)=>Y(d,b)||n.AddError({keyword:"dependentRequired",schemaPath:s,instancePath:a,params:{property:g,dependencies:I}})));return f||h}function vT(t,n,s,a){let l=br(Xe(Ss(a),"length"),Ie(0)),d=Wn(Ln(s.dependentSchemas).map(([f,h])=>{let g=rr(bs(a,Ie(f))),I=gt(t,n,h,a);return Nt(g,I)}));return Nt(l,d)}function kT(t,n,s,a){let l=F(pe(a).length,0),d=Rn(Ln(s.dependentSchemas),0,([f,h])=>!Y(a,f)||mt(t,n,h,a));return l||d}function TT(t,n,s,a,l,d){let f=F(pe(d).length,0),h=Vn(Ln(l.dependentSchemas),0,([g,I])=>{let b=`${s}/dependentSchemas/${g}`;return!Y(d,g)||_t(t,n,b,a,I,d)});return f||h}function wT(t,n,s,a){let l=t.DynamicRef(s)??!1;return mo(t,n,l,a)}function RT(t,n,s,a){let l=t.DynamicRef(s)??!1;return Le(l)&&mt(t,n,l,a)}function LT(t,n,s,a,l,d){let f=t.DynamicRef(l)??!1;return Le(f)&&_t(t,n,"#",a,f,d)}function AT(t,n,s,a){return uh(s.enum.map((l)=>{if(xs(l))return br(a,Ie(l));let d=ei(l);return gb(a,d)}))}function Eg(t,n,s,a){return ya(s.enum,(l)=>xs(l)?F(a,l):xa(a,l))}function PT(t,n,s,a,l,d){return Eg(t,n,l,d)||n.AddError({keyword:"enum",schemaPath:s,instancePath:a,params:{allowedValues:l.enum}})}function MT(t,n,s,a){return ah(a,Ie(s.exclusiveMaximum))}function vg(t,n,s,a){return Fl(a,s.exclusiveMaximum)}function _T(t,n,s,a,l,d){return vg(t,n,l,d)||n.AddError({keyword:"exclusiveMaximum",schemaPath:s,instancePath:a,params:{comparison:"<",limit:l.exclusiveMaximum}})}function OT(t,n,s,a){return pb(a,Ie(s.exclusiveMinimum))}function kg(t,n,s,a){return ys(a,s.exclusiveMinimum)}function $T(t,n,s,a,l,d){return kg(t,n,l,d)||n.AddError({keyword:"exclusiveMinimum",schemaPath:s,instancePath:a,params:{comparison:">",limit:l.exclusiveMinimum}})}var Ga={};De(Ga,{Clear:()=>lw,Entries:()=>A8,Get:()=>_8,Has:()=>M8,IsDate:()=>Ha,IsDateTime:()=>wm,IsDuration:()=>Rm,IsEmail:()=>Lm,IsHostname:()=>Nm,IsIPv4:()=>Um,IsIPv6:()=>Bm,IsIdnEmail:()=>Dm,IsIdnHostname:()=>Hm,IsIri:()=>zm,IsIriReference:()=>Gm,IsJsonPointer:()=>qm,IsJsonPointerUriFragment:()=>jm,IsRegex:()=>Km,IsRelativeJsonPointer:()=>Vm,IsTime:()=>Ua,IsUri:()=>Ym,IsUriReference:()=>Wm,IsUriTemplate:()=>Xm,IsUrl:()=>Jm,IsUuid:()=>Qm,Reset:()=>cw,Set:()=>P8,Test:()=>uw});var BU=[0,31,28,31,30,31,30,31,31,30,31,30,31],GU=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function zU(t){return t%4===0&&(t%100!==0||t%400===0)}function Ha(t){let n=GU.exec(t);if(!n)return!1;let s=+n[1],a=+n[2],l=+n[3];return a>=1&&a<=12&&l>=1&&l<=(a===2&&zU(s)?29:BU[a])}var jU=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;function Ua(t,n=!0){let s=jU.exec(t);if(!s)return!1;if(n&&!s[4]&&!s[5])return!1;let a=+s[1],l=+s[2],d=+s[3];if(a>23||l>59||d>60)return!1;if(s[5]){let b=+s[6],v=+s[7];if(b>23||v>59)return!1}if(d<60)return!0;let f=s[5]==="-"?-1:1,h=+(s[6]||0),g=+(s[7]||0);return((a*60+l-f*(h*60+g))%1440+1440)%1440===1439}function wm(t){let n=t.split(/T/i);return n.length===2&&Ha(n[0])&&Ua(n[1])}var qU=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function Rm(t){return qU.test(t)}var KU=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;function Lm(t){return KU.test(t)}var FT=/^(?!-).*(?<!-)$/,NT=/^(?!..--)/,DT=/^[a-zA-Z0-9-]*$/;var Ba=/[^\p{ASCII}]/u;var VU=/[0-9]/,HT=/[\u{0660}-\u{0669}]/u,WU=/[\u{06f0}-\u{06f9}]/u,XU=/[\u{002e}\u{002c}\u{003a}\u{002f}]/u,YU=/[\u{002d}\u{002b}]/u,Tg=/\p{Mn}/u,JU=/\p{Mc}/u;var UT=/[\p{Mn}\p{Mc}\p{Me}]/u,wg=/\p{L}/u,QU=/\p{Nd}/u,BT=/\p{Script=Greek}/u,Am=/\p{Script=Hebrew}/u,GT=/[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u,zT=/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u,Rg=/[\u{094d}\u{09cd}\u{0a4d}\u{0acd}\u{0b4d}\u{0bcd}\u{0c4d}\u{0ccd}\u{0d3b}\u{0d3c}\u{0d4d}\u{0dca}\u{1b44}\u{1baa}\u{1bab}\u{a9c0}\u{11046}\u{1107f}\u{110b9}\u{11133}\u{11134}\u{111c0}\u{11235}\u{1134d}\u{11442}\u{114c2}\u{115bf}\u{1163f}\u{116b6}\u{11c3f}\u{11d44}\u{11d45}]/u,jT=/[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u,ZU=/[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u,e8=/[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u,qT=new RegExp([VU,WU].map((t)=>t.source).join("|"),"u"),KT=new RegExp([wg,YU,XU,QU,Tg,JU,ZU,e8].map((t)=>t.source).join("|"),"u");function VT(t){return FT.test(t)&&NT.test(t)&&DT.test(t)}var Si=36,Nu=1,Du=26,n8=38,r8=700,XT=72,YT=128;function Lg(){throw null}function Pm(t){return t.toLowerCase().startsWith("xn--")}function JT(t,n,s){t=s?Math.floor(t/r8):t>>1,t+=Math.floor(t/n);let a=0;while(t>(Si-Nu)*Du>>1)t=Math.floor(t/(Si-Nu)),a+=Si;return a+Math.floor((Si-Nu+1)*t/(t+n8))}function Mm(t){let n=[],s=YT,a=0,l=XT,d=t.lastIndexOf("-");if(d>0)for(let h=0;h<d;h++){let g=t.charCodeAt(h);if(g>=128)Lg();n.push(g)}let f=d<0?0:d+1;while(f<t.length){let h=a,g=1,I=Si;while(!0){if(f>=t.length)Lg();let v=t.charCodeAt(f++),k;if(v>=97&&v<=122)k=v-97;else if(v>=48&&v<=57)k=v-48+26;else Lg();a+=k*g;let w=I<=l?Nu:I>=l+Du?Du:I-l;if(k<w)break;g*=Si-w,I+=Si}let b=n.length+1;l=JT(a-h,b,h===0),s+=Math.floor(a/b),a%=b,n.splice(a,0,s),a++}return String.fromCodePoint(...n)}function WT(t){return t<26?String.fromCharCode(t+97):String.fromCharCode(t-26+48)}var i8=new RegExp(Ba.source,"gu");function QT(t){let n=t.replace(i8,""),s=n.length,a=s>0?[n,"-"]:[],l=Array.from(t,(I)=>I.codePointAt(0)),d=YT,f=0,h=XT,g=s;while(g<l.length){let I=1/0;for(let b of l)if(b>=d&&b<I)I=b;f+=(I-d)*(g+1),d=I;for(let b of l){if(b<d)f++;if(b===d){let v=f;for(let k=Si;;k+=Si){let w=k<=h?Nu:k>=h+Du?Du:k-h;if(v<w)break;let P=w+(v-w)%(Si-w);a.push(WT(P)),v=Math.floor((v-w)/(Si-w))}a.push(WT(v)),h=JT(f,g+1,g===s),f=0,g++}}f++,d++}return a.join("")}var o8=/^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/,ZT=/^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/,s8=/^(?:R|AL|AN)$/;function ew(t){if(Pm(t))try{return _m(Mm(t.slice(4).toLowerCase()))}catch{return!1}return _m(t)}function tw(t){let n=String.fromCodePoint(t);return qT.test(n)?"EN":HT.test(n)?"AN":Tg.test(n)?"NSM":Am.test(n)?"R":zT.test(n)?"AL":wg.test(n)?"L":"ON"}function _m(t){for(let n of t)if(s8.test(tw(n.codePointAt(0))))return!0;return!1}function Om(t){let n=!1,s=ZT,a=!1,l=!1,d=!0;for(let f of t){let h=tw(f.codePointAt(0));if(d){if(h!=="L"&&h!=="R"&&h!=="AL")return!1;n=h==="R"||h==="AL",s=n?o8:ZT,d=!1}if(!s.test(h))return!1;if(h==="EN")a=!0;else if(h==="AN")l=!0}if(n&&a&&l)return!1;return!0}function a8(t){return Ba.test(t)&&QT(t).length+4>63}function l8(t){if(t[0]==="-"||t[t.length-1]==="-")return!0;return t.slice(2).join("").startsWith("--")}function $m(t){if(a8(t))return!1;if(_m(t)&&!Om(t))return!1;let n=[...t],s=n.map((d)=>d.codePointAt(0)),a=s.length;if(l8(n))return!1;if(UT.test(n[0]))return!1;let l=!1;for(let d=0;d<a;d++){let f=s[d],h=n[d];if(jT.test(h))return!1;if(!KT.test(h))return!1;if(GT.test(h))l=!0;let g=s[d-1],I=s[d+1];switch(f){case 183:if(g!==108||I!==108)return!1;break;case 885:if(!I||!BT.test(n[d+1]))return!1;break;case 1523:case 1524:if(!g||!Am.test(n[d-1]))return!1;break;case 8204:if(!g||g<128&&!Rg.test(n[d-1]))return!1;break;case 8205:if(!g||!Rg.test(n[d-1]))return!1;break;case 12539:break}}if(t.includes("・")&&!l)return!1;return!0}function Fm(t){if(!Pm(t))return!1;try{let n=t.slice(4).toLowerCase();if(n.lastIndexOf("-")===0)return!1;let s=Mm(n);if(!Ba.test(s))return!1;return $m(s)}catch{return!1}}function u8(t){return t.length>0&&t.length<=63}function c8(t){return u8(t)&&(Fm(t)||VT(t))}function ow(t){if(t.length===0||t.length>253)return!1;if(t.charCodeAt(t.length-1)===46)return!1;return t.split(".").every((n)=>c8(n))}function d8(t){return t.length>0&&t.length<=63}function m8(t){return d8(t)&&(Fm(t)||$m(t))}function f8(t){return t.replace(/[\uff01-\uff5e]/g,(n)=>String.fromCharCode(n.charCodeAt(0)-65248)).normalize("NFC").replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu,"").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".")}function sw(t){if(t.length===0||t.includes(" "))return!1;let n=f8(t);if(n.length>253)return!1;let s=n.split("."),a=s.some((l)=>ew(l));return s.every((l)=>m8(l)&&(!a||Om(l)))}function Nm(t){return ow(t)}var p8=/^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;function Dm(t){return p8.test(t.normalize("NFC"))}function Hm(t){return sw(t)}var h8=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function Um(t){return h8.test(t)}var g8=/^(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:)?[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)$/i;function Bm(t){return g8.test(t)}var y8=/[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/,x8=/^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;function Gm(t){return!y8.test(t)&&!x8.test(t)&&URL.canParse(t,"http://example.com")}var I8=/\[[vV][0-9a-fA-F]+\.[^\]]+\]/,S8=/[\x00-\x20<>\^`{|}\\]/,b8=/%(?![0-9a-fA-F]{2})/;function C8(t){return t.length<2048?t.replace(I8,"[::1]"):t}function zm(t){if(S8.test(t))return!1;if(b8.test(t))return!1;return URL.canParse(C8(t))}var E8=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function jm(t){return E8.test(t)}var v8=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function qm(t){return v8.test(t)}function Km(t){try{return new RegExp(t,"u"),!0}catch{return!1}}var k8=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Vm(t){return k8.test(t)}var T8=/^(?:[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Wm(t){return T8.test(t)}var w8=/^(?:(?:[^\x00-\x20"<>%\\^`{|}\x7f]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?)*\})*$/i;function Xm(t){return w8.test(t)}var R8=/^[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Ym(t){return R8.test(t)}function Jm(t){return URL.canParse(t)}var L8=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Qm(t){return L8.test(t)}var zt=new Map;function lw(){zt.clear()}function A8(){return[...zt.entries()]}function P8(t,n){zt.set(t,n)}function M8(t){return zt.has(t)}function _8(t){return zt.get(t)}function uw(t,n){return zt.get(t)?.(n)??!0}function cw(){lw(),zt.set("date-time",wm),zt.set("date",Ha),zt.set("duration",Rm),zt.set("email",Lm),zt.set("hostname",Nm),zt.set("idn-email",Dm),zt.set("idn-hostname",Hm),zt.set("ipv4",Um),zt.set("ipv6",Bm),zt.set("iri-reference",Gm),zt.set("iri",zm),zt.set("json-pointer-uri-fragment",jm),zt.set("json-pointer",qm),zt.set("regex",Km),zt.set("relative-json-pointer",Vm),zt.set("time",Ua),zt.set("uri-reference",Wm),zt.set("uri-template",Xm),zt.set("uri",Ym),zt.set("url",Jm),zt.set("uuid",Qm)}cw();function dw(t,n,s,a){return Dt(Xe("Format","Test"),[Ie(s.format),a])}function Pg(t,n,s,a){return uw(s.format,a)}function mw(t,n,s,a,l,d){return Pg(t,n,l,d)||n.AddError({keyword:"format",schemaPath:s,instancePath:a,params:{format:l.format}})}function fw(t,n,s,a){let l=Ou(s)?s.then:!0,d=Su(s)?s.else:!0;return RN(gt(t,n,s.if,a),gt(t,n,l,a),gt(t,n,d,a))}function pw(t,n,s,a){let l=Ou(s)?s.then:!0,d=Su(s)?s.else:!0;return mt(t,n,s.if,a)?mt(t,n,l,a):mt(t,n,d,a)}function hw(t,n,s,a,l,d){let f=Ou(l)?l.then:!0,h=Su(l)?l.else:!0,g=new tr,I=_t(t,g,`${s}/if`,a,l.if,d)?_t(t,g,`${s}/then`,a,f,d)||n.AddError({keyword:"if",schemaPath:s,instancePath:a,params:{failingKeyword:"then"}}):_t(t,n,`${s}/else`,a,h,d)||n.AddError({keyword:"if",schemaPath:s,instancePath:a,params:{failingKeyword:"else"}});if(I)n.Merge([g]);return I}function O8(t,n,s,a){return Wn(s.items.map((l,d)=>{let f=Is(Xe(a,"length"),Ie(d)),h=ar(t,n,l,`${a}[${d}]`),g=n.AddIndex(Ie(d));return Nt(f,Gn(h,g))}))}function $8(t,n,s,a){return Wn(s.items.map((l,d)=>{let f=Is(Xe(a,"length"),Ie(d)),h=ar(t,n,l,`${a}[${d}]`);return Nt(f,h)}))}function F8(t,n,s,a){return n.UseUnevaluated()?O8(t,n,s,a):$8(t,n,s,a)}function N8(t,n,s,a){return Rn(s.items,0,(l,d)=>Ri(a.length,d)||jr(t,n,l,a[d])&&n.AddIndex(d))}function D8(t,n,s,a,l,d){return Vn(l.items,0,(f,h)=>{let g=`${s}/items/${h}`,I=`${a}/${h}`;return Ri(d.length,h)||qr(t,n,g,I,f,d[h])&&n.AddIndex(h)})}function H8(t,n,s,a){let l=yi(s)?s.prefixItems.length:0,d=ar(t,n,s.items,"element"),f=n.AddIndex("index");return Li(a,Ie(l),["element","index"],Gn(d,f))}function U8(t,n,s,a){let l=yi(s)?s.prefixItems.length:0,d=ar(t,n,s.items,"element");return Li(a,Ie(l),["element","index"],d)}function B8(t,n,s,a){return n.UseUnevaluated()?H8(t,n,s,a):U8(t,n,s,a)}function G8(t,n,s,a){let l=yi(s)?s.prefixItems.length:0;return Rn(a,l,(d,f)=>jr(t,n,s.items,d)&&n.AddIndex(f))}function z8(t,n,s,a,l,d){let f=yi(l)?l.prefixItems.length:0;return Vn(d,f,(h,g)=>{let I=`${s}/items`,b=`${a}/${g}`;return qr(t,n,I,b,l.items,h)&&n.AddIndex(g)})}function gw(t,n,s,a){return Eu(s)?F8(t,n,s,a):B8(t,n,s,a)}function yw(t,n,s,a){return Eu(s)?N8(t,n,s,a):G8(t,n,s,a)}function xw(t,n,s,a,l,d){return Eu(l)?D8(t,n,s,a,l,d):z8(t,n,s,a,l,d)}function Iw(t){return Fi(t)}function Sw(t,n,s,a){if(!Iw(s))return Ie(!0);let[l]=[kt()],d=zd(a,[l,"_"],gt(t,n,s.contains,l));return Is(d,Ie(s.maxContains))}function Mg(t,n,s,a){if(!Iw(s))return!0;let l=rh(a,(d)=>mt(t,n,s.contains,d));return Ri(l,s.maxContains)}function bw(t,n,s,a,l,d){let f=lo(l)?l.minContains:1;return Mg(t,n,l,d)||n.AddError({keyword:"contains",schemaPath:s,instancePath:a,params:{minContains:f,maxContains:l.maxContains}})}function Cw(t,n,s,a){return Is(a,Ie(s.maximum))}function _g(t,n,s,a){return Ri(a,s.maximum)}function Ew(t,n,s,a,l,d){return _g(t,n,l,d)||n.AddError({keyword:"maximum",schemaPath:s,instancePath:a,params:{comparison:"<=",limit:l.maximum}})}function vw(t,n,s,a){return Is(Xe(a,"length"),Ie(s.maxItems))}function Og(t,n,s,a){return Ri(a.length,s.maxItems)}function kw(t,n,s,a,l,d){return Og(t,n,l,d)||n.AddError({keyword:"maxItems",schemaPath:s,instancePath:a,params:{limit:l.maxItems}})}function Tw(t,n,s,a){return vN(a,Ie(s.maxLength))}function $g(t,n,s,a){return ob(a,s.maxLength)}function ww(t,n,s,a,l,d){return $g(t,n,l,d)||n.AddError({keyword:"maxLength",schemaPath:s,instancePath:a,params:{limit:l.maxLength}})}function Rw(t,n,s,a){return Is(Xe(Ss(a),"length"),Ie(s.maxProperties))}function Fg(t,n,s,a){return Ri(pe(a).length,s.maxProperties)}function Lw(t,n,s,a,l,d){return Fg(t,n,l,d)||n.AddError({keyword:"maxProperties",schemaPath:s,instancePath:a,params:{limit:l.maxProperties}})}function Aw(t){return Fi(t)}function j8(t,n,s,a){let[l,d]=[kt(),kt()],f=zd(a,[l,d],Gn(gt(t,n,s.contains,l),n.AddIndex(d)));return Dl(f,Ie(s.minContains))}function q8(t,n,s,a){let[l]=[kt()],d=zd(a,[l,"_"],gt(t,n,s.contains,l));return Dl(d,Ie(s.minContains))}function Pw(t,n,s,a){if(!Aw(s))return Ie(!0);return n.UseUnevaluated()?j8(t,n,s,a):q8(t,n,s,a)}function Ng(t,n,s,a){if(!Aw(s))return!0;let l=rh(a,(d,f)=>mt(t,n,s.contains,d)&&n.AddIndex(f));return ga(l,s.minContains)}function Mw(t,n,s,a,l,d){return Ng(t,n,l,d)||n.AddError({keyword:"contains",schemaPath:s,instancePath:a,params:{minContains:l.minContains}})}function _w(t,n,s,a){return Dl(a,Ie(s.minimum))}function Dg(t,n,s,a){return ga(a,s.minimum)}function Ow(t,n,s,a,l,d){return Dg(t,n,l,d)||n.AddError({keyword:"minimum",schemaPath:s,instancePath:a,params:{comparison:">=",limit:l.minimum}})}function $w(t,n,s,a){return Dl(Xe(a,"length"),Ie(s.minItems))}function Hg(t,n,s,a){return ga(a.length,s.minItems)}function Fw(t,n,s,a,l,d){return Hg(t,n,l,d)||n.AddError({keyword:"minItems",schemaPath:s,instancePath:a,params:{limit:l.minItems}})}function Nw(t,n,s,a){return EN(a,Ie(s.minLength))}function Ug(t,n,s,a){return sb(a,s.minLength)}function Dw(t,n,s,a,l,d){return Ug(t,n,l,d)||n.AddError({keyword:"minLength",schemaPath:s,instancePath:a,params:{limit:l.minLength}})}function Hw(t,n,s,a){return Dl(Xe(Ss(a),"length"),Ie(s.minProperties))}function Bg(t,n,s,a){return ga(pe(a).length,s.minProperties)}function Uw(t,n,s,a,l,d){return Bg(t,n,l,d)||n.AddError({keyword:"minProperties",schemaPath:s,instancePath:a,params:{limit:l.minProperties}})}function Bw(t,n,s,a){return LN(a,Ie(s.multipleOf))}function Gg(t,n,s,a){return rb(a,s.multipleOf)}function Gw(t,n,s,a,l,d){return Gg(t,n,l,d)||n.AddError({keyword:"multipleOf",schemaPath:s,instancePath:a,params:{multipleOf:l.multipleOf}})}function K8(t,n,s,a){return Vo(t,n,[s.not],a,rr(br(Xe("results","length"),Ie(1))))}function V8(t,n,s,a){return rr(gt(t,n,s.not,a))}function zw(t,n,s,a){return n.UseUnevaluated()?K8(t,n,s,a):V8(t,n,s,a)}function zg(t,n,s,a){let l=new er;return!mt(t,l,s.not,a)&&n.Merge([l])}function jw(t,n,s,a,l,d){return zg(t,n,l,d)||n.AddError({keyword:"not",schemaPath:s,instancePath:a,params:{}})}function W8(t,n,s,a){return Vo(t,n,s.oneOf,a,br(Xe("results","length"),Ie(1)))}function X8(t,n,s,a){let[l]=[kt()],d=wN(s.oneOf.map((h)=>gt(t,n,h,a))),f=zd(d,[l,"_"],br(l,Ie(!0)));return br(f,Ie(1))}function qw(t,n,s,a){return n.UseUnevaluated()?W8(t,n,s,a):X8(t,n,s,a)}function Kw(t,n,s,a){let l=s.oneOf.reduce((d,f)=>{let h=new er;return mt(t,h,f,a)?[...d,h]:d},[]);return F(l.length,1)&&n.Merge(l)}function Vw(t,n,s,a,l,d){let f=[],h=[],g=l.oneOf.reduce((b,v,k)=>{let w=new tr,P=`${s}/oneOf/${k}`,M=_t(t,w,P,a,v,d);if(M)h.push(k);if(!M)f.push(w);return M?[...b,w]:b},[]),I=F(g.length,1)&&n.Merge(g);if(!I&&F(h.length,0))f.forEach((b)=>b.GetErrors().forEach((v)=>n.AddError(v)));return I||n.AddError({keyword:"oneOf",schemaPath:s,instancePath:a,params:{passingSchemas:h}})}function Ww(t,n,s,a){let l=ei(ut(s.pattern)?Ii(s.pattern):s.pattern);return Dt(Xe(l,"test"),[a])}function jg(t,n,s,a){return(ut(s.pattern)?Ii(s.pattern):s.pattern).test(a)}function Xw(t,n,s,a,l,d){return jg(t,n,l,d)||n.AddError({keyword:"pattern",schemaPath:s,instancePath:a,params:{pattern:l.pattern}})}function Yw(t,n,s,a){return Wn(Ln(s.patternProperties).map(([l,d])=>{let[f,h]=[kt(),kt()],g=ei(Ii(l)),I=rr(Dt(Xe(g,"test"),[f])),b=ar(t,n,d,h),v=n.AddKey(f),k=n.UseUnevaluated()?Nt(I,Gn(b,v)):Nt(I,b);return Li(hb(a),Ie(0),[`[${f}, ${h}]`,"_"],k)}))}function Jw(t,n,s,a){return Rn(Ln(s.patternProperties),0,([l,d])=>{let f=Ii(l);return Rn(Ln(a),0,([h,g])=>!f.test(h)||jr(t,n,d,g)&&n.AddKey(h))})}function Qw(t,n,s,a,l,d){return Vn(Ln(l.patternProperties),0,([f,h])=>{let g=`${s}/patternProperties/${f}`,I=Ii(f);return Vn(Ln(d),0,([b,v])=>{let k=`${a}/${b}`;return!I.test(b)||qr(t,n,g,k,h,v)&&n.AddKey(b)})})}function Zw(t,n,s,a){return Wn(s.prefixItems.map((l,d)=>{let f=Is(Xe(a,"length"),Ie(d)),h=ar(t,n,l,`${a}[${d}]`),g=n.AddIndex(Ie(d)),I=n.UseUnevaluated()?Gn(h,g):h;return Nt(f,I)}))}function eR(t,n,s,a){return F(a.length,0)||Rn(s.prefixItems,0,(l,d)=>Ri(a.length,d)||jr(t,n,l,a[d])&&n.AddIndex(d))}function tR(t,n,s,a,l,d){return F(d.length,0)||Vn(l.prefixItems,0,(f,h)=>{let g=`${s}/prefixItems/${h}`,I=`${a}/${h}`;return Ri(d.length,h)||qr(t,n,g,I,f,d[h])&&n.AddIndex(h)})}function Zm(t,n){return t.includes(n)||Jr().exactOptionalPropertyTypes}function nR(t,n){return sh(Xe(t,n))}function qg(t,n){return bt(t[n])}function rR(t,n,s,a){let l=xi(s)?s.required:[],d=Ln(s.properties).map(([f,h])=>{let g=rr(bs(a,Ie(f))),I=ar(t,n,h,Xe(a,f)),b=n.AddKey(Ie(f)),v=n.UseUnevaluated()?Gn(I,b):I,k=l.includes(f)?v:Nt(g,v);return Zm(l,f)?k:Nt(nR(a,f),k)});return Wn(d)}function iR(t,n,s,a){let l=xi(s)?s.required:[];return Rn(Ln(s.properties),0,([f,h])=>{let g=!Y(a,f)||jr(t,n,h,a[f])&&n.AddKey(f);return Zm(l,f)?g:qg(a,f)||g})}function oR(t,n,s,a,l,d){let f=xi(l)?l.required:[];return Vn(Ln(l.properties),0,([g,I])=>{let b=`${s}/properties/${g}`,v=`${a}/${g}`,k=()=>!Y(d,g)||qr(t,n,b,v,I,d[g])&&n.AddKey(g);return Zm(f,g)?k():qg(d,g)||k()})}function sR(t,n,s,a){let[l,d]=[kt(),kt()];return Li(Ss(a),Ie(0),[l,d],gt(t,n,s.propertyNames,l))}function aR(t,n,s,a){return Rn(pe(a),0,(l,d)=>mt(t,n,s.propertyNames,l))}function lR(t,n,s,a,l,d){let f=[];return Vn(pe(d),0,(g,I)=>{let b=`${a}/${g}`,v=`${s}/propertyNames`,k=_t(t,n,v,b,l.propertyNames,g);if(!k)f.push(g);return k})||n.AddError({keyword:"propertyNames",schemaPath:s,instancePath:a,params:{propertyNames:f}})}function uR(t,n,s,a){let l=t.RecursiveRef(s)??!1;return mo(t,n,l,a)}function cR(t,n,s,a){let l=t.RecursiveRef(s)??!1;return Le(l)&&mt(t,n,l,a)}function dR(t,n,s,a,l,d){let f=t.RecursiveRef(l)??!1;return Le(f)&&_t(t,n,"#",a,f,d)}function Y8(t,n,s,a){let l=Po(["context","value"],mo(t,n,s,"value")),d=Po(["context","value"],jd([to("nextContext",lh("CheckContext",[])),to("result",Dt(l,["nextContext","value"])),yb("result",n.Merge("[nextContext]")),qd("result")]));return Dt(d,["context",a])}function J8(t,n,s,a){return mo(t,n,s,a)}function mR(t,n,s,a){let l=t.Ref(s)??!1;return n.UseUnevaluated()?Y8(t,n,l,a):J8(t,n,l,a)}function fR(t,n,s,a){let l=t.Ref(s)??!1,d=new er,f=Le(l)&&mt(t,d,l,a);if(f)n.Merge([d]);return f}function pR(t,n,s,a,l,d){let f=t.Ref(l)??!1,h=new tr,g=Le(f)&&_t(t,h,"#",a,f,d);if(g)n.Merge([h]);if(!g)h.GetErrors().forEach((I)=>n.AddError(I));return g}function hR(t,n,s,a){return Wn(s.required.map((l)=>bs(a,Ie(l))))}function gR(t,n,s,a){return Rn(s.required,0,(l)=>Y(a,l))}function yR(t,n,s,a,l,d){let f=[];return Vn(l.required,0,(g)=>{let I=Y(d,g);if(!I)f.push(g);return I})||n.AddError({keyword:"required",schemaPath:s,instancePath:a,params:{requiredProperties:f}})}function xR(t,n,s,a){return F(s,"object")?db(a):F(s,"array")?Gd(a):F(s,"boolean")?yN(a):F(s,"integer")?xN(a):F(s,"number")?cb(a):F(s,"null")?IN(a):F(s,"string")?fb(a):F(s,"bigint")?ub(a):F(s,"constructor")?CN(a):F(s,"function")?bN(a):F(s,"symbol")?SN(a):F(s,"undefined")?sh(a):F(s,"void")?sh(a):Ie(!0)}function Kg(t,n,s,a,l){return F(s,"object")?eo(l):F(s,"array")?Te(l):F(s,"boolean")?wn(l):F(s,"integer")?Bd(l):F(s,"number")?ft(l):F(s,"null")?Or(l):F(s,"string")?ut(l):F(s,"bigint")?Qt(l):F(s,"constructor")?th(l):F(s,"function")?Ao(l):F(s,"symbol")?nh(l):F(s,"undefined")?bt(l):F(s,"void")?bt(l):!0}function Q8(t,n,s,a){return uh(s.map((l)=>xR(t,n,l,a)))}function IR(t,n,s,a,l){return ya(s,(d)=>Kg(t,n,d,a,l))}function SR(t,n,s,a){return Te(s.type)?Q8(t,n,s.type,a):xR(t,n,s.type,a)}function bR(t,n,s,a){return Te(s.type)?IR(t,n,s.type,s,a):Kg(t,n,s.type,s,a)}function CR(t,n,s,a,l,d){return(Te(l.type)?IR(t,n,l.type,l,d):Kg(t,n,l.type,l,d))||n.AddError({keyword:"type",schemaPath:s,instancePath:a,params:{type:l.type}})}function ER(t,n,s,a){let[l,d]=[kt(),kt()],f=Dt(Xe("context","GetIndices"),[]),h=Dt(Xe("indices","has"),[l]),g=gt(t,n,s.unevaluatedItems,d),I=Dt(Xe("context","AddIndex"),[l]),b=Li(a,Ie(0),[d,l],Gn(Nt(h,g),I));return Dt(Po(["context"],jd([to("indices",f),qd(b)])),["context"])}function vR(t,n,s,a){let l=n.GetIndices();return Rn(a,0,(d,f)=>(l.has(f)||mt(t,n,s.unevaluatedItems,d))&&n.AddIndex(f))}function kR(t,n,s,a,l,d){let f=n.GetIndices(),h=[];return Vn(d,0,(I,b)=>{let v=new tr,k=(f.has(b)||_t(t,v,s,a,l.unevaluatedItems,I))&&n.AddIndex(b);if(!k)h.push(b);return k})||n.AddError({keyword:"unevaluatedItems",schemaPath:s,instancePath:a,params:{unevaluatedItems:h}})}function TR(t,n,s,a){let[l,d]=[kt(),kt()],f=Dt(Xe("context","GetKeys"),[]),h=Dt(Xe("keys","has"),[l]),g=Dt(Xe("context","AddKey"),[l]),I=gt(t,n,s.unevaluatedProperties,d),b=Li(hb(a),Ie(0),[`[${l}, ${d}]`,"_"],Nt(h,Gn(I,g)));return Dt(Po(["context"],jd([to("keys",f),qd(b)])),["context"])}function wR(t,n,s,a){let l=n.GetKeys();return Rn(Ln(a),0,([d,f])=>l.has(d)||mt(t,n,s.unevaluatedProperties,f)&&n.AddKey(d))}function RR(t,n,s,a,l,d){let f=n.GetKeys(),h=[];return Vn(Ln(d),0,([I,b])=>{let v=new tr,k=f.has(I)||_t(t,v,s,a,l.unevaluatedProperties,b)&&n.AddKey(I);if(!k)h.push(I);return k})||n.AddError({keyword:"unevaluatedProperties",schemaPath:s,instancePath:a,params:{unevaluatedProperties:h}})}function Vg(t){return!F(t.uniqueItems,!1)}function LR(t,n,s,a){if(!Vg(s))return Ie(!0);let l=Xe(lh("Set",[Dt(Xe(a,"map"),[Xe("Hashing","Hash")])]),"size"),d=Xe(a,"length");return br(l,d)}function AR(t,n,s,a){if(!Vg(s))return!0;let l=new Set(a.map(fh)).size,d=a.length;return F(l,d)}function PR(t,n,s,a,l,d){if(!Vg(l))return!0;let f=new Set,h=d.reduce((I,b,v)=>{let k=fh(b);if(f.has(k))return[...I,v];return f.add(k),I},[]);return F(h.length,0)||n.AddError({keyword:"uniqueItems",schemaPath:s,instancePath:a,params:{duplicateItems:h}})}function Hu(t,n){return $u(t)&&(Te(t.type)&&ys(t.type.length,0)&&Rn(t.type,0,(s)=>F(s,n))||F(t.type,n))}function Z8(t){return Hu(t,"object")}function eB(t){return Mn(t)&&(Zr(t)||yu(t)||xu(t)||$a(t)||co(t)||uo(t)||Na(t)||Ms(t)||wu(t)||xi(t)||Ko(t))}function tB(t){return Hu(t,"array")}function nB(t){return Mn(t)&&(Oa(t)||ao(t)||Fi(t)||ku(t)||Fa(t)||lo(t)||zo(t)||yi(t)||qo(t)||jo(t))}function rB(t){return Hu(t,"string")}function iB(t){return Mn(t)&&(Ps(t)||Tu(t)||As(t)||_s(t))}function oB(t){return Hu(t,"number")||Hu(t,"bigint")}function sB(t){return Mn(t)&&(gi(t)||vu(t)||bu(t)||hi(t)||Ru(t))}function ar(t,n,s,a){return n.UseUnevaluated()?Gn(Gn(n.Push(),gt(t,n,s,a)),n.Pop()):gt(t,n,s,a)}function gt(t,n,s,a){t.Push(s);let l=[];if(oo(s))return dT(t,n,s,a);if($u(s))l.push(SR(t,n,s,a));if(eB(s)){let f=[];if(xi(s))f.push(hR(t,n,s,a));if(Zr(s))f.push(nT(t,n,s,a));if(yu(s))f.push(xT(t,n,s,a));if(xu(s))f.push(bT(t,n,s,a));if($a(s))f.push(vT(t,n,s,a));if(uo(s))f.push(Yw(t,n,s,a));if(co(s))f.push(rR(t,n,s,a));if(Na(s))f.push(sR(t,n,s,a));if(Ms(s))f.push(Hw(t,n,s,a));if(wu(s))f.push(Rw(t,n,s,a));let h=Wn(f),g=Nt(rr(db(a)),h);l.push(Z8(s)?h:g)}if(nB(s)){let f=[];if(Oa(s))f.push(Zk(t,n,s,a));if(Fi(s))f.push(gT(t,n,s,a));if(ao(s))f.push(gw(t,n,s,a));if(ku(s))f.push(Sw(t,n,s,a));if(Fa(s))f.push(vw(t,n,s,a));if(lo(s))f.push(Pw(t,n,s,a));if(zo(s))f.push($w(t,n,s,a));if(yi(s))f.push(Zw(t,n,s,a));if(jo(s))f.push(LR(t,n,s,a));let h=Wn(f),g=Nt(rr(Gd(a)),h);l.push(tB(s)?h:g)}if(iB(s)){let f=[];if(Tu(s))f.push(Tw(t,n,s,a));if(Ps(s))f.push(Nw(t,n,s,a));if(As(s))f.push(dw(t,n,s,a));if(_s(s))f.push(Ww(t,n,s,a));let h=Wn(f),g=Nt(rr(fb(a)),h);l.push(rB(s)?h:g)}if(sB(s)){let f=[];if(bu(s))f.push(MT(t,n,s,a));if(hi(s))f.push(OT(t,n,s,a));if(vu(s))f.push(Cw(t,n,s,a));if(gi(s))f.push(_w(t,n,s,a));if(Ru(s))f.push(Bw(t,n,s,a));let h=Wn(f),g=Nt(rr(Nt(cb(a),ub(a))),h);l.push(oB(s)?h:g)}if(_u(s))l.push(mR(t,n,s,a));if(Mu(s))l.push(uR(t,n,s,a));if(Iu(s))l.push(wT(t,n,s,a));if(Em(s))l.push(fT(t,n,s,a));if(vm(s))l.push(AT(t,n,s,a));if(Cu(s))l.push(fw(t,n,s,a));if(Lu(s))l.push(zw(t,n,s,a));if(pu(s))l.push(oT(t,n,s,a));if(gu(s))l.push(lT(t,n,s,a));if(Au(s))l.push(qw(t,n,s,a));if(qo(s))l.push(Nt(rr(Gd(a)),ER(t,n,s,a)));if(Ko(s))l.push(Nt(rr(mb(a)),TR(t,n,s,a)));if(fu(s))l.push(Yk(t,n,s,a));let d=Wn(l);return t.Pop(s),d}function jr(t,n,s,a){return n.Push()&&mt(t,n,s,a)&&n.Pop()}function mt(t,n,s,a){t.Push(s);let l=oo(s)?Ig(t,n,s,a):(!$u(s)||bR(t,n,s,a))&&(!(Be(a)&&!Te(a))||(!xi(s)||gR(t,n,s,a))&&(!Zr(s)||rT(t,n,s,a))&&(!yu(s)||IT(t,n,s,a))&&(!xu(s)||CT(t,n,s,a))&&(!$a(s)||kT(t,n,s,a))&&(!uo(s)||Jw(t,n,s,a))&&(!co(s)||iR(t,n,s,a))&&(!Na(s)||aR(t,n,s,a))&&(!Ms(s)||Bg(t,n,s,a))&&(!wu(s)||Fg(t,n,s,a)))&&(!Te(a)||(!Oa(s)||eT(t,n,s,a))&&(!Fi(s)||bg(t,n,s,a))&&(!ao(s)||yw(t,n,s,a))&&(!ku(s)||Mg(t,n,s,a))&&(!Fa(s)||Og(t,n,s,a))&&(!lo(s)||Ng(t,n,s,a))&&(!zo(s)||Hg(t,n,s,a))&&(!yi(s)||eR(t,n,s,a))&&(!jo(s)||AR(t,n,s,a)))&&(!ut(a)||(!Tu(s)||$g(t,n,s,a))&&(!Ps(s)||Ug(t,n,s,a))&&(!As(s)||Pg(t,n,s,a))&&(!_s(s)||jg(t,n,s,a)))&&(!(ft(a)||Qt(a))||(!bu(s)||vg(t,n,s,a))&&(!hi(s)||kg(t,n,s,a))&&(!vu(s)||_g(t,n,s,a))&&(!gi(s)||Dg(t,n,s,a))&&(!Ru(s)||Gg(t,n,s,a)))&&(!_u(s)||fR(t,n,s,a))&&(!Mu(s)||cR(t,n,s,a))&&(!Iu(s)||RT(t,n,s,a))&&(!Em(s)||Sg(t,n,s,a))&&(!vm(s)||Eg(t,n,s,a))&&(!Cu(s)||pw(t,n,s,a))&&(!Lu(s)||zg(t,n,s,a))&&(!pu(s)||sT(t,n,s,a))&&(!gu(s)||uT(t,n,s,a))&&(!Au(s)||Kw(t,n,s,a))&&(!qo(s)||(!Te(a)||vR(t,n,s,a)))&&(!Ko(s)||(!Be(a)||wR(t,n,s,a)))&&(!fu(s)||Jk(t,n,s,a));return t.Pop(s),l}function qr(t,n,s,a,l,d){return n.Push()&&_t(t,n,s,a,l,d)&&n.Pop()}function _t(t,n,s,a,l,d){if(n.AtCapacity())return!1;t.Push(l);let f=oo(l)?mT(t,n,s,a,l,d):!!(+(!$u(l)||CR(t,n,s,a,l,d))&+(!(Be(d)&&!Te(d))||!!(+(!xi(l)||yR(t,n,s,a,l,d))&+(!Zr(l)||iT(t,n,s,a,l,d))&+(!yu(l)||ST(t,n,s,a,l,d))&+(!xu(l)||ET(t,n,s,a,l,d))&+(!$a(l)||TT(t,n,s,a,l,d))&+(!uo(l)||Qw(t,n,s,a,l,d))&+(!co(l)||oR(t,n,s,a,l,d))&+(!Na(l)||lR(t,n,s,a,l,d))&+(!Ms(l)||Uw(t,n,s,a,l,d))&+(!wu(l)||Lw(t,n,s,a,l,d))))&+(!Te(d)||!!(+(!Oa(l)||tT(t,n,s,a,l,d))&+(!Fi(l)||yT(t,n,s,a,l,d))&+(!ao(l)||xw(t,n,s,a,l,d))&+(!ku(l)||bw(t,n,s,a,l,d))&+(!Fa(l)||kw(t,n,s,a,l,d))&+(!lo(l)||Mw(t,n,s,a,l,d))&+(!zo(l)||Fw(t,n,s,a,l,d))&+(!yi(l)||tR(t,n,s,a,l,d))&+(!jo(l)||PR(t,n,s,a,l,d))))&+(!ut(d)||!!(+(!Tu(l)||ww(t,n,s,a,l,d))&+(!Ps(l)||Dw(t,n,s,a,l,d))&+(!As(l)||mw(t,n,s,a,l,d))&+(!_s(l)||Xw(t,n,s,a,l,d))))&+(!(ft(d)||Qt(d))||!!(+(!bu(l)||_T(t,n,s,a,l,d))&+(!hi(l)||$T(t,n,s,a,l,d))&+(!vu(l)||Ew(t,n,s,a,l,d))&+(!gi(l)||Ow(t,n,s,a,l,d))&+(!Ru(l)||Gw(t,n,s,a,l,d))))&+(!_u(l)||pR(t,n,s,a,l,d))&+(!Mu(l)||dR(t,n,s,a,l,d))&+(!Iu(l)||LT(t,n,s,a,l,d))&+(!Em(l)||pT(t,n,s,a,l,d))&+(!vm(l)||PT(t,n,s,a,l,d))&+(!Cu(l)||hw(t,n,s,a,l,d))&+(!Lu(l)||jw(t,n,s,a,l,d))&+(!pu(l)||aT(t,n,s,a,l,d))&+(!gu(l)||cT(t,n,s,a,l,d))&+(!Au(l)||Vw(t,n,s,a,l,d))&+(!qo(l)||(!Te(d)||kR(t,n,s,a,l,d)))&+(!Ko(l)||(!Be(d)||RR(t,n,s,a,l,d))))&&(!fu(l)||Qk(t,n,s,a,l,d));return t.Pop(l),f}var MR=[0],ef=new Map,Uu=new Map;function aB(){return`${MR[0]++}`}function lB(t,n){if(!ef.has(t))ef.set(t,new Map);let s=ef.get(t);if(s.has(n))return s.get(n);let a=aB();return s.set(n,a),a}function uB(t,n,s,a){return t.UseUnevaluated()?Dt(`check_${s}`,["context",a]):Dt(`check_${s}`,[a])}function cB(t,n,s,a){let l=gt(t,n,s,"value");return n.UseUnevaluated()?to(`check_${a}`,Po(["context","value"],l)):to(`check_${a}`,Po(["value"],l))}function _R(){MR[0]=0,ef.clear(),Uu.clear()}function OR(){return[...Uu.values()]}function mo(t,n,s,a){let l=lB(s,t.LexicalBaseURL()),d=uB(n,s,l,a);if(Uu.has(l))return d;return Uu.set(l,""),Uu.set(l,cB(t,n,s,l)),d}function dB(t,n){return Be(n)&&!Nl(t)?n[t]:void 0}function mB(t,n){return t.reduce((s,a)=>dB(a,s),n)}function fB(t){if(F(t.length,0))return[];let n=t.split("/").map((s)=>s.replace(/~1/g,"/").replace(/~0/g,"~"));return n.length>0&&n[0]===""?n.slice(1):n}function pB(t,n){let s=fB(n);return mB(s,t)}var nf="https://json-schema.org";function FR(t,n){if(Be(t)&&so(t)&&F(t.$dynamicAnchor,n))return t;if(Be(t))for(let s of pe(t)){let a=FR(t[s],n);if(a)return a}return}function Wg(t,n,s){if(F(t,s))return n.href;let a=Mn(t)&&zr(t)?new URL(t.$id,n.href):n;if(Te(t))for(let l of t){let d=Wg(l,a,s);if(!bt(d))return d}else if(Be(t))for(let l of pe(t)){let d=Wg(t[l],a,s);if(!bt(d))return d}return}function hB(t,n,s){if(F(t.$id,s.hash))return t;let a=new URL(s.href,n.href);if(F(n.pathname,a.pathname))return s.hash.startsWith("#")?NR(t,s):t;return}function gB(t,n,s){let a=new URL(`#${t.$anchor}`,n.href),l=new URL(s.href,n.href);return F(a.href,l.href)?t:void 0}function yB(t,n,s){let a=new URL(`#${t.$dynamicAnchor}`,n.href),l=new URL(s.href,n.href);return F(a.href,l.href)?t:void 0}function NR(t,n){if(n.href.endsWith("#"))return t;if(!n.hash.startsWith("#"))return;let s=decodeURIComponent(n.hash.slice(1));if(!s.startsWith("/"))return;return pB(t,s)}function xB(t,n,s){if(zr(t)){let a=hB(t,n,s);if(!bt(a))return a}if(hu(t)){let a=gB(t,n,s);if(!bt(a))return a}if(so(t)){let a=yB(t,n,s);if(!bt(a))return a}return NR(t,s)}function IB(t,n,s){return t.reduce((a,l)=>{let d=rf(l,n,s);return!bt(d)?d:a},void 0)}function SB(t){return F(t,"const")||F(t,"enum")}function bB(t,n,s){return pe(t).reduce((a,l)=>{if(SB(l))return a;let d=rf(t[l],n,s);return!bt(d)?d:a},void 0)}function rf(t,n,s){let a=Mn(t)&&zr(t)?new URL(t.$id,n.href):n;if(Mn(t)){let l=xB(t,a,s);if(!bt(l))return l}if(Te(t))return IB(t,a,s);if(Be(t))return bB(t,a,s);return}function CB(t,n,s){return Wg(t,new URL(n||".",nf),s)}function EB(t,n,s,a){let l=of(t,n,s,a,!1);return Mn(l)&&zr(l)?l:void 0}function $R(t){return t.href.split("#")[0]}function vB(t,n){return Y(t,n)?t[n]:void 0}function kB(t,n,s){return rf(t,n,s)}function TB(t,n,s){let a=$R(s);if(F(a,$R(n)))return;if(!Y(t,a))return;let l=t[a],d=Mn(l)&&zr(l)?new URL(l.$id,a):new URL(a);return F(s.hash,"")?l:rf(l,d,s)}function wB(t,n,s,a,l){if(!a.$ref.startsWith("#"))return;if(Y(t,"$schema"))return;let d=CB(n,s,l);if(bt(d)||F(d,s))return;return{target:l,base:d,root:n}}function RB(t,n,s){let a=t[n];if(!Mn(a))return;return{target:s,base:n,root:a}}function LB(t,n,s,a,l){let d=l?RB(t.context,a,s):void 0;if(!bt(d))return d;return wB(t.root,t.lexicalSchema,t.referenceBase,n,s)}function AB(t,n,s,a,l,d){if(zr(l))return;let f=EB(t,n,s,a);if(!f||d.includes(f))return;return{target:l,resource:f}}function of(t,n,s,a,l=!0){let d=new URL(s||".",nf),f=l&&zr(n)?new URL(n.$id,d):d,h=new URL(a,f.href);return vB(t,a)??kB(n,f,h)??TB(t,f,h)}function PB(t,n,s,a,l,d){let f=new URL(s||".",nf),h=l.$dynamicRef.startsWith("#")?a:n,g=of(t,h,s,l.$dynamicRef,!1);if(bt(g)){let v=new URL(l.$dynamicRef,f).hash;if(!v.startsWith("#/")&&v.startsWith("#")){let k=decodeURIComponent(v.slice(1));return d.find((P)=>F(P.$dynamicAnchor,k))??FR(n,k)}return}if(!Mn(g)||!so(g))return g;if(new URL(l.$dynamicRef,f).hash.startsWith("#/"))return g;return d.find((v)=>F(v.$dynamicAnchor,g.$dynamicAnchor))??g}function MB(t,n){let s=t.inRetrievedFrame?t.lexicalSchema:t.root,a=n.$ref.startsWith("#")?t.lexicalSchema:s,l=of(t.context,a,t.referenceBase,n.$ref,!1);if(!l||!Mn(l))return{schema:l};let d=new URL(n.$ref,t.referenceBase).href.split("#")[0],f=!F(d,t.resourceBase),h=LB(t,n,l,d,f),g=f?AB(t.context,t.root,t.referenceBase,d,l,t.ids):void 0;return{schema:l,retrievedResource:h,resolvedResource:g}}function _B(t,n){let s=Pu(t.lexicalSchema)?t.recursiveAnchors[0]:t.lexicalSchema;return of(t.context,s,t.lexicalBase,n.$recursiveRef,!1)}function OB(t,n){return PB(t.context,t.root,t.lexicalBase,t.lexicalSchema,n,t.dynamicAnchors)}var Jt=function(t,n,s,a){if(s==="a"&&!a)throw TypeError("Private accessor was defined without a getter");if(typeof n==="function"?t!==n||!a:!n.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?a:s==="a"?a.call(t):a?a.value:n.get(t)},jt,af,zR,Qg,sf,DR,HR,UR,BR,Yg,Jg,Zg,ey,GR,jR;class Wo{constructor(t,n){jt.add(this),this.context=t,this.schema=n,this.ids=[],this.resourceIds=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[],this.retrievedResources=new Map,this.retrievedFrames=[],this.resolvedResources=new Map,this.pendingResource=!0}LexicalBaseURL(){return Jt(this,jt,"m",Qg).call(this,this.ids)}Push(t){if(!Mn(t))return;if(zr(t))Jt(this,jt,"m",Zg).call(this,t);if(hu(t))this.anchors.push(t);if(Pu(t))this.recursiveAnchors.push(t);if(so(t))this.dynamicAnchors.push(t);let n=this.retrievedResources.get(t);if(n)this.retrievedFrames.push({schema:n.root,base:n.base,idDepth:this.ids.length,resourceDepth:this.resourceIds.length})}Pop(t){if(!Mn(t))return;if(zr(t))Jt(this,jt,"m",ey).call(this,t);if(hu(t))this.anchors.pop();if(Pu(t))this.recursiveAnchors.pop();if(so(t))this.dynamicAnchors.pop();if(this.retrievedResources.has(t))this.retrievedFrames.pop();Jt(this,jt,"m",jR).call(this,t)}Ref(t){let n=MB(Jt(this,jt,"m",af).call(this),t);return Jt(this,jt,"m",zR).call(this,n),n.schema}RecursiveRef(t){let n=_B(Jt(this,jt,"m",af).call(this),t);if(n)this.pendingResource=!0;return n}DynamicRef(t){let n=OB(Jt(this,jt,"m",af).call(this),t);if(n)this.pendingResource=!0;return n}}jt=new WeakSet,af=function(){return{context:this.context,root:this.schema,ids:this.ids,lexicalSchema:Jt(this,jt,"m",HR).call(this),lexicalBase:this.LexicalBaseURL(),referenceBase:Jt(this,jt,"m",DR).call(this),resourceBase:Jt(this,jt,"m",sf).call(this),recursiveAnchors:this.recursiveAnchors,dynamicAnchors:this.dynamicAnchors,inRetrievedFrame:this.retrievedFrames.length>0}},zR=function(n){if(!bt(n.schema))this.pendingResource=!0;if(!bt(n.resolvedResource))Jt(this,jt,"m",GR).call(this,n.resolvedResource.target,n.resolvedResource.resource);if(!bt(n.retrievedResource))this.retrievedResources.set(n.retrievedResource.target,{base:n.retrievedResource.base,root:n.retrievedResource.root})},Qg=function(n){let s=this.retrievedFrames[this.retrievedFrames.length-1],a=s?new URL(s.base):new URL(nf);return(s?n.slice(s.idDepth):n).reduce((d,f)=>new URL(f.$id,d),a).href},sf=function(){let n=this.retrievedFrames[this.retrievedFrames.length-1];if(!n)return Jt(this,jt,"m",Qg).call(this,this.resourceIds);return this.resourceIds.slice(n.resourceDepth).reduce((s,a)=>new URL(a.$id,s),new URL(n.base)).href},DR=function(){if(this.retrievedFrames.length>0)return Jt(this,jt,"m",sf).call(this);let n=this.ids[this.ids.length-1];if(n&&!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(n.$id))return this.LexicalBaseURL();return Jt(this,jt,"m",sf).call(this)},HR=function(){let n=this.retrievedFrames[this.retrievedFrames.length-1];if(n)return this.ids.length>n.idDepth?this.ids[this.ids.length-1]:n.schema;return this.ids.length>0?this.ids[this.ids.length-1]:this.schema},UR=function(n){n.forEach((s)=>Jt(this,jt,"m",Yg).call(this,s,!1))},BR=function(n){n.forEach((s)=>Jt(this,jt,"m",Jg).call(this,s,!1))},Yg=function t(n,s=!0){if(oo(n))return;if(Te(n))return Jt(this,jt,"m",UR).call(this,n);if(!Mn(n))return;let a=n;if(!s&&zr(a))return;if(!s&&so(a))this.dynamicAnchors.push(a);for(let l of pe(a))Jt(this,jt,"m",t).call(this,a[l],!1)},Jg=function t(n,s=!0){if(oo(n))return;if(Te(n))return Jt(this,jt,"m",BR).call(this,n);if(!Mn(n))return;let a=n;if(!s&&zr(a))return;if(!s&&so(a))this.dynamicAnchors.pop();for(let l of pe(a))Jt(this,jt,"m",t).call(this,a[l],!1)},Zg=function(n){this.ids.push(n);let s=this.pendingResource;if(this.pendingResource=!1,s)this.resourceIds.push(n);Jt(this,jt,"m",Yg).call(this,n,!0)},ey=function(n){if(this.ids.pop(),this.resourceIds.length>0&&F(this.resourceIds[this.resourceIds.length-1],n))this.resourceIds.pop();Jt(this,jt,"m",Jg).call(this,n,!0)},GR=function(n,s){Jt(this,jt,"m",Zg).call(this,s),this.resolvedResources.set(n,s)},jR=function(n){if(!this.resolvedResources.has(n))return;let s=this.resolvedResources.get(n);Jt(this,jt,"m",ey).call(this,s),this.resolvedResources.delete(n)};function $B(t){let n=t.Functions().join(`;
|
|
311
|
+
`),s=t.UseUnevaluated()?["const context = new CheckContext({}, {})",`return ${t.Entry()}`]:[`return ${t.Entry()}`];return`${n}; return (value) => { ${s.join("; ")} }`}function FB(t,n){return Pb("CheckContext","Guard","Format","Hashing",t.External().identifier,n)(er,H,Ga,vs,t.External().variables)}function NB(t){let n=new Wo(t.Context(),t.Schema()),s=new er;return(a)=>mt(n,s,t.Schema(),a)}function DB(t,n){return Ab()?FB(t,n):NB(t)}class qR{constructor(t,n,s){this.isAccelerated=t,this.code=n,this.check=s}IsAccelerated(){return this.isAccelerated}Code(){return this.code}Check(t){return this.check(t)}}class KR{constructor(t,n,s,a,l,d){this.context=t,this.schema=n,this.external=s,this.functions=a,this.entry=l,this.useUnevaluated=d}Context(){return this.context}Schema(){return this.schema}UseUnevaluated(){return this.useUnevaluated}External(){return this.external}Functions(){return this.functions}Entry(){return this.entry}Evaluate(){let t=$B(this),n=DB(this,t);return new qR(Ab(),t,n)}}function lf(...t){let[n,s]=dr(t,{2:(g,I)=>[g,I],1:(g)=>[{},g]});Wk(),_R();let a=new Wo(n,s),l=new gg(Vk(n,s)),d=mo(a,l,s,"value"),f=OR(),h=Xk();return new KR(n,s,h,f,d,l.UseUnevaluated())}function uf(...t){let[n,s,a]=dr(t,{3:(b,v,k)=>[b,v,k],2:(b,v)=>[{},b,v]}),l=new Wo(n,s),d=new tr,f=_t(l,d,"#","",s,a),h=d.GetErrors(),g=Ub(),I=h.map((b)=>({...b,message:g(b)}));return[f,I]}function ny(...t){let[n,s,a]=dr(t,{3:(f,h,g)=>[f,h,g],2:(f,h)=>[{},f,h]}),l=new Wo(n,s),d=new er;return mt(l,d,s,a)}function wt(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return ny(n,s,a)}function bi(...t){let[n,s,a]=dr(t,{3:(f,h,g)=>[f,h,g],2:(f,h)=>[{},f,h]}),[l,d]=uf(n,s,a);return d}class Os extends Error{constructor(t,n,s){super(t);Object.defineProperty(this,"cause",{value:{source:t,errors:s,value:n},writable:!1,configurable:!1,enumerable:!1})}}function VR(t,n,s){if(!Te(s))return s;return s.map((a)=>_n(t,n.items,a))}function WR(t,n,s){return _n({...t,...n.$defs},Xn(n.$ref),s)}function BB(t,n){let s=Y(n,"unevaluatedProperties")?{additionalProperties:n.unevaluatedProperties}:{},a=pi(t,n),l=Qn(a);return Re(l)?mg(l,s):l}function XR(t,n,s){let a=BB(t,n);return _n(t,a,s)}function cf(t){return Y(t,"additionalProperties")?t.additionalProperties:void 0}function YR(t,n,s){if(!Be(s)||Te(s))return s;let a=cf(n);for(let l of pe(s)){if(Y(n.properties,l)){s[l]=_n(t,n.properties[l],s[l]);continue}if(wn(a)&&F(a,!0)||ln(a)&&wt(t,a,s[l])){s[l]=_n(t,a,s[l]);continue}delete s[l]}return s}function JR(t,n,s){if(!Be(s))return s;let a=cf(n),[l,d]=[new RegExp(Un(n)),Bt(n)];for(let f of pe(s)){if(l.test(f)){s[f]=_n(t,d,s[f]);continue}if(wn(a)&&F(a,!0)||ln(a)&&wt(t,a,s[f])){s[f]=_n(t,a,s[f]);continue}delete s[f]}return s}function QR(t,n,s){return Y(t,n.$ref)?_n(t,t[n.$ref],s):s}function ZR(t,n,s){if(!Te(s))return s;let a=Math.min(s.length,n.items.length);for(let l=0;l<a;l++)s[l]=_n(t,n.items[l],s[l]);return ys(s.length,a)?s.slice(0,a):s}function nn(t){return Ia(t)}function eL(t,n,s){for(let a of n.anyOf){let l=_n(t,a,nn(s));if(wt(t,a,l))return l}return s}function _n(t,n,s){return Qe(n)?VR(t,n,s):Pt(n)?WR(t,n,s):we(n)?XR(t,n,s):Re(n)?YR(t,n,s):vt(n)?JR(t,n,s):Ct(n)?QR(t,n,s):Ve(n)?ZR(t,n,s):ae(n)?eL(t,n,s):s}function GB(t,n){for(let s of pe(t)){if(Y(n,s))continue;n[s]=t[s]}return n}function zB(t){let n={};for(let s of pe(t))n[s]=Bu(t[s]);return n}function jB(t){return ry(Kk(t))}function ry(t){return t.map((n)=>Bu(n))}function Bu(t){let n=Qe(t)?x(Bu(t.items),Sa(t)):we(t)?Cr(ry(t.allOf)):ae(t)?i(jB(t.anyOf)):Re(t)?r(zB(t.properties)):vt(t)?Jl(Ts(t),Bu(Bt(t))):Ve(t)?Sn(ry(t.items)):t;return GB(t,n)}function za(t){return Bu(t)}function ti(...t){let[n,s,a]=dr(t,{3:(d,f,h)=>[d,f,h],2:(d,f)=>[{},d,f]}),l=Jr().unionPrioritySort?za(s):s;return _n(n,l,a)}function Tr(t){return Be(t)&&Y(t,"value")}function ve(t){return{value:t}}function qt(){return}function qB(t){return Te(t)?ve(t):ve([t])}function KB(t){return F(t,!0)?ve(BigInt(1)):ve(BigInt(0))}var VB=/^-?(0|[1-9]\d*)n$/,WB=/^-?(0|[1-9]\d*)\.\d+$/,XB=/^-?(0|[1-9]\d*)$/;function YB(t){return VB.test(t)}function JB(t){return WB.test(t)}function QB(t){return XB.test(t)}function ZB(t){let n=t.toLowerCase();return YB(t)?ve(BigInt(t.slice(0,t.length-1))):JB(t)?ve(BigInt(t.split(".")[0])):QB(t)?ve(BigInt(t)):F(n,"false")?ve(BigInt(0)):F(n,"true")?ve(BigInt(1)):qt()}function df(t){return Qt(t)?ve(t):wn(t)?KB(t):ft(t)?ve(BigInt(Math.trunc(t))):Or(t)?ve(BigInt(0)):ut(t)?ZB(t):bt(t)?ve(BigInt(0)):qt()}function eG(t){return F(t,BigInt(0))?ve(!1):F(t,BigInt(1))?ve(!0):qt()}function tG(t){return F(t,0)?ve(!1):F(t,1)?ve(!0):qt()}function nG(t){return F(t.toLowerCase(),"false")?ve(!1):F(t.toLowerCase(),"true")?ve(!0):F(t,"0")?ve(!1):F(t,"1")?ve(!0):qt()}function tL(t){return Qt(t)?eG(t):wn(t)?ve(t):ft(t)?tG(t):Or(t)?ve(!1):ut(t)?nG(t):bt(t)?ve(!1):qt()}function rG(t){return F(t,BigInt(0))?ve(null):qt()}function iG(t){return F(t,!1)?ve(null):qt()}function oG(t){return F(t,0)?ve(null):qt()}function sG(t){let n=t.toLowerCase();return F(n,"undefined")||F(n,"null")||F(t,"")||F(t,"0")?ve(null):qt()}function aG(t){return Qt(t)?rG(t):wn(t)?iG(t):ft(t)?oG(t):Or(t)?ve(null):ut(t)?sG(t):bt(t)?ve(null):qt()}var nL=BigInt(Number.MAX_SAFE_INTEGER),rL=BigInt(Number.MIN_SAFE_INTEGER);function lG(t){return t<=nL&&t>=rL?ve(Number(t)):qt()}function uG(t){return ve(t?1:0)}function cG(t){let n=+t;if(ft(n))return ve(n);let s=t.toLowerCase();if(F(s,"false"))return ve(0);if(F(s,"true"))return ve(1);let a=df(t);if(Tr(a))return a.value<=nL&&a.value>=rL?ve(Number(a.value)):qt();return qt()}function iy(t){return Qt(t)?lG(t):wn(t)?uG(t):ft(t)?ve(t):Or(t)?ve(0):ut(t)?cG(t):bt(t)?ve(0):qt()}function iL(t){return Qt(t)?ve(t.toString()):wn(t)?ve(t.toString()):ft(t)?ve(t.toString()):Or(t)?ve("null"):ut(t)?ve(t):bt(t)?ve(""):qt()}function dG(t){return F(t,BigInt(0))?ve(void 0):qt()}function mG(t){return F(t,!1)?ve(void 0):qt()}function fG(t){return F(t,0)?ve(void 0):qt()}function pG(t){let n=t.toLowerCase();return F(n,"undefined")||F(n,"null")||F(t,"")||F(t,"0")?ve(void 0):qt()}function oL(t){return Qt(t)?dG(t):wn(t)?mG(t):ft(t)?fG(t):Or(t)?ve(void 0):ut(t)?pG(t):bt(t)?ve(t):qt()}function sL(t,n,s){return qB(s).value.map((l)=>rn(t,n.items,l))}function aL(t,n,s){let a=df(s);return Tr(a)?a.value:s}function lL(t,n,s){let a=tL(s);return Tr(a)?a.value:s}function uL(t,n,s){return rn({...t,...n.$defs},Xn(n.$ref),s)}function cL(t,n,s){return rn(t,Qn(n),s)}function dL(t,n,s){let a=iy(s);return Tr(a)?Math.trunc(a.value):s}function mL(t,n,s){let a=pi(t,n),l=Qn(a);return rn(t,l,s)}function hG(t,n,s){let a=df(s);return Tr(a)&&F(n.const,a.value)?a.value:s}function gG(t,n,s){let a=tL(s);return Tr(a)&&F(n.const,a.value)?a.value:s}function yG(t,n,s){let a=iy(s);return Tr(a)&&F(n.const,a.value)?a.value:s}function xG(t,n,s){let a=iL(s);return Tr(a)&&F(n.const,a.value)?a.value:s}function fL(t,n,s){if(F(n.const,s))return s;return jb(n)?hG(t,n,s):qb(n)?gG(t,n,s):Qd(n)?yG(t,n,s):Zd(n)?xG(t,n,s):cn()}function pL(t,n,s){let a=aG(s);return Tr(a)?a.value:s}function hL(t,n,s){let a=iy(s);return Tr(a)?a.value:s}function mf(t,n,s,a){let l=pe(a);for(let[d,f]of n)for(let h of l)if(!d.test(h))a[h]=rn(t,s,a[h]);return a}function Gu(t,n,s){return An(t)&&bt(s[n])}function IG(t,n,s){let a=ih(n.properties),l=pe(s);for(let[d,f]of a)for(let h of l){if(!d.test(h)||Gu(f,h,s))continue;s[h]=rn(t,f,s[h])}return Y(n,"additionalProperties")&&Be(n.additionalProperties)?mf(t,a,n.additionalProperties,s):s}function gL(t,n,s){return eo(s)?IG(t,n,s):s}function SG(t,n,s){let a=ih(n.patternProperties),l=pe(s);for(let[d,f]of a)for(let h of l)if(d.test(h))s[h]=rn(t,f,s[h]);return Y(n,"additionalProperties")&&Be(n.additionalProperties)?mf(t,a,n.additionalProperties,s):s}function yL(t,n,s){return eo(s)?SG(t,n,s):s}function xL(t,n,s){return Y(t,n.$ref)?rn(t,t[n.$ref],s):s}function IL(t,n,s){let a=iL(s);return Tr(a)?a.value:s}function SL(t,n,s){return rn(t,Qn(n),s)}function bL(t,n,s){if(!Te(s))return s;for(let a=0;a<Math.min(n.items.length,s.length);a++)s[a]=rn(t,n.items[a],s[a]);return s}function CL(t,n,s){let a=oL(s);return Tr(a)?a.value:s}function EL(t,n,s){if(n.anyOf.some((f)=>wt(t,f,s)))return s;let d=n.anyOf.map((f)=>rn(t,f,nn(s))).find((f)=>wt(t,n,f));return bt(d)?s:d}function vL(t,n,s){let a=oL(s);return Tr(a)?void 0:s}function rn(t,n,s){return Qe(n)?sL(t,n,s):Dr(n)?aL(t,n,s):mr(n)?lL(t,n,s):Pt(n)?uL(t,n,s):In(n)?cL(t,n,s):zn(n)?dL(t,n,s):we(n)?mL(t,n,s):Ye(n)?fL(t,n,s):ro(n)?pL(t,n,s):tn(n)?hL(t,n,s):Re(n)?gL(t,n,s):vt(n)?yL(t,n,s):Ct(n)?xL(t,n,s):Pn(n)?IL(t,n,s):$t(n)?SL(t,n,s):Ve(n)?bL(t,n,s):Ai(n)?CL(t,n,s):ae(n)?EL(t,n,s):Hr(n)?vL(t,n,s):s}function Ni(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return rn(n,s,a)}function kL(t,n,s){if(!Te(s))return s;for(let a=0;a<s.length;a++)s[a]=On(t,n.items,s[a]);return s}function TL(t,n,s){return On({...t,...n.$defs},Xn(n.$ref),s)}function wL(t,n){if(!bt(n))return n;return Ao(t.default)?t.default():nn(t.default)}function RL(t,n,s){let a=pi(t,n),l=Qn(a);return On(t,l,s)}function LL(t,n,s){if(!Be(s))return s;let a=pe(n.properties);for(let l of a){let d=On(t,n.properties[l],s[l]);if(bt(d)&&(An(n.properties[l])||!Y(n.properties[l],"default")))continue;s[l]=d}if(!Zr(n)||wn(n.additionalProperties))return s;for(let l of pe(s)){if(a.includes(l))continue;s[l]=On(t,n.additionalProperties,s[l])}return s}function AL(t,n,s){if(!Be(s))return s;let[a,l]=[new RegExp(Un(n)),Bt(n)];for(let d of pe(s)){if(!(a.test(d)&&Gr(l)))continue;s[d]=On(t,l,s[d])}if(!Zr(n))return s;for(let d of pe(s)){if(a.test(d))continue;s[d]=On(t,n.additionalProperties,s[d])}return s}function PL(t,n,s){return Y(t,n.$ref)?On(t,t[n.$ref],s):s}function ML(t,n,s){if(!Te(s))return s;let[a,l]=[n.items,Math.max(n.items.length,s.length)];for(let d=0;d<l;d++)if(d<a.length)s[d]=On(t,a[d],s[d]);return s}function _L(t,n,s){for(let a of n.anyOf){let l=On(t,a,nn(s));if(wt(t,a,l))return l}return s}function On(t,n,s){let a=Gr(n)?wL(n,s):s;return Qe(n)?kL(t,n,a):Pt(n)?TL(t,n,a):we(n)?RL(t,n,a):Re(n)?LL(t,n,a):vt(n)?AL(t,n,a):Ct(n)?PL(t,n,a):Ve(n)?ML(t,n,a):ae(n)?_L(t,n,a):a}function fo(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return On(n,s,a)}function ja(t){return(...n)=>{let[s,a,l]=dr(n,{3:(d,f,h)=>[d,f,h],2:(d,f)=>[{},d,f]});return t.reduce((d,f)=>f(s,a,d),l)}}function bG(t,n,s){return n["~codec"].decode(s)}function CG(t,n,s){return n["~codec"].encode(s)}function Kt(t,n,s,a){if(!Nr(s))return a;return F(t,"Decode")?bG(n,s,a):CG(n,s,a)}function EG(t,n,s,a){if(!Te(a))return a;for(let l=0;l<a.length;l++)a[l]=Xt(t,n,s.items,a[l]);return Kt(t,n,s,a)}function vG(t,n,s,a){let l=Kt(t,n,s,a);if(!Te(l))return l;for(let d=0;d<l.length;d++)l[d]=Xt(t,n,s.items,l[d]);return l}function OL(t,n,s,a){return F(t,"Decode")?EG(t,n,s,a):vG(t,n,s,a)}function $L(t,n,s,a){return a=Xt(t,{...n,...s.$defs},Xn(s.$ref),a),Kt(t,n,s,a)}function FL(t){return t.reduce((n,s)=>({...n,...s}),{})}function NL(t,n){for(let s of n)if(!xa(t,s))return s;return t}function kG(t,n,s,a){if(F(s.allOf.length,0))return Kt(t,n,s,a);let l=s.allOf.map((h)=>Xt(t,n,h,ti(h,nn(a)))),f=l.every((h)=>Be(h))?FL(l):NL(a,l);return Kt(t,n,s,f)}function TG(t,n,s,a){if(F(s.allOf.length,0))return Kt(t,n,s,a);let l=Kt(t,n,s,a),d=s.allOf.map((h)=>Xt(t,n,h,ti(h,nn(l))));if(d.every((h)=>Be(h)))return FL(d);return NL(l,d)}function DL(t,n,s,a){return F(t,"Decode")?kG(t,n,s,a):TG(t,n,s,a)}function wG(t,n,s,a){if(!eo(a))return a;for(let l of pe(s.properties)){if(!Y(a,l)||Gu(s.properties[l],l,a))continue;a[l]=Xt(t,n,s.properties[l],a[l])}return Kt(t,n,s,a)}function RG(t,n,s,a){let l=Kt(t,n,s,a);if(!eo(l))return l;for(let d of pe(s.properties)){if(!Y(l,d)||Gu(s.properties[d],d,l))continue;l[d]=Xt(t,n,s.properties[d],l[d])}return l}function HL(t,n,s,a){return F(t,"Decode")?wG(t,n,s,a):RG(t,n,s,a)}function LG(t,n,s,a){if(!eo(a))return a;let l=new RegExp(Un(s));for(let d of pe(a)){if(!l.test(d))continue;a[d]=Xt(t,n,Bt(s),a[d])}return Kt(t,n,s,a)}function AG(t,n,s,a){let l=Kt(t,n,s,a);if(!eo(l))return l;let d=new RegExp(Un(s));for(let f of pe(l)){if(!d.test(f))continue;l[f]=Xt(t,n,Bt(s),l[f])}return l}function UL(t,n,s,a){return F(t,"Decode")?LG(t,n,s,a):AG(t,n,s,a)}function BL(t,n,s,a){return Y(n,s.$ref)?Xt(t,n,n[s.$ref],a):a}function GL(t,n,s,a){return F(t,"Decode")?Kt(t,n,s,BL(t,n,s,a)):BL(t,n,s,Kt(t,n,s,a))}function PG(t,n,s,a){if(!Te(a))return a;for(let l=0;l<Math.min(s.items.length,a.length);l++)a[l]=Xt(t,n,s.items[l],a[l]);return Kt(t,n,s,a)}function MG(t,n,s,a){let l=Kt(t,n,s,a);if(!Te(l))return a;for(let d=0;d<Math.min(s.items.length,l.length);d++)l[d]=Xt(t,n,s.items[d],l[d]);return l}function zL(t,n,s,a){return F(t,"Decode")?PG(t,n,s,a):MG(t,n,s,a)}function _G(t,n,s,a){for(let l of s.anyOf){if(!wt(n,l,a))continue;let d=Xt(t,n,l,a);return Kt(t,n,s,d)}return a}function OG(t,n,s,a){let l=Kt(t,n,s,a);for(let d of s.anyOf){let f=Xt(t,n,d,nn(l));if(!wt(n,d,f))continue;return f}return l}function jL(t,n,s,a){return F(t,"Decode")?_G(t,n,s,a):OG(t,n,s,a)}function Xt(t,n,s,a){return Qe(s)?OL(t,n,s,a):Pt(s)?$L(t,n,s,a):we(s)?DL(t,n,s,a):Re(s)?HL(t,n,s,a):vt(s)?UL(t,n,s,a):Ct(s)?GL(t,n,s,a):Ve(s)?zL(t,n,s,a):ae(s)?jL(t,n,s,a):Kt(t,n,s,a)}class qL extends Os{constructor(t,n){super("Decode",t,n)}}function $G(t,n,s){if(!wt(t,n,s))throw new qL(s,bi(t,n,s));return s}function FG(t,n,s){let a=Jr().unionPrioritySort?za(n):n;return Xt("Decode",t,a,s)}var NG=ja([(t,n,s)=>nn(s),(t,n,s)=>fo(t,n,s),(t,n,s)=>Ni(t,n,s),(t,n,s)=>ti(t,n,s),(t,n,s)=>$G(t,n,s),(t,n,s)=>FG(t,n,s)]);function oy(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return NG(n,s,a)}class KL extends Os{constructor(t,n){super("Encode",t,n)}}function DG(t,n,s){if(!wt(t,n,s))throw new KL(s,bi(t,n,s));return s}function HG(t,n,s){let a=Jr().unionPrioritySort?za(n):n;return Xt("Encode",t,a,s)}var UG=ja([(t,n,s)=>nn(s),(t,n,s)=>HG(t,n,s),(t,n,s)=>fo(t,n,s),(t,n,s)=>Ni(t,n,s),(t,n,s)=>ti(t,n,s),(t,n,s)=>DG(t,n,s)]);function sy(...t){let[n,s,a]=dr(t,{3:(l,d,f)=>[l,d,f],2:(l,d)=>[{},l,d]});return UG(n,s,a)}function BG(t,n){return Nr(n)||Xo(t,n.items)}function GG(t,n){return Nr(n)||VL({...t,...n.$defs},Xn(n.$ref))}function zG(t,n){return Nr(n)||n.allOf.some((s)=>Xo(t,s))}function jG(t,n){return Nr(n)||pe(n.properties).some((s)=>Xo(t,n.properties[s]))}function qG(t,n){return Nr(n)||Xo(t,Bt(n))}function VL(t,n){if(ay.has(n.$ref))return!1;return ay.add(n.$ref),Nr(n)||Y(t,n.$ref)&&Xo(t,t[n.$ref])}function KG(t,n){return Nr(n)||n.items.some((s)=>Xo(t,s))}function VG(t,n){return Nr(n)||n.anyOf.some((s)=>Xo(t,s))}function Xo(t,n){return Qe(n)?BG(t,n):Pt(n)?GG(t,n):we(n)?zG(t,n):Re(n)?jG(t,n):vt(n)?qG(t,n):Ct(n)?VL(t,n):Ve(n)?KG(t,n):ae(n)?VG(t,n):Nr(n)}var ay=new Set;function ly(...t){let[n,s]=dr(t,{2:(a,l)=>[a,l],1:(a)=>[{},a]});return ay.clear(),Xo(n,s)}class Ei extends Error{constructor(t,n){super(n);this.type=t}}function WL(t,n){return Ao(n.default)?n.default(n):Be(n.default)?nn(n.default):n.default}function XL(t,n){if(jo(n)&&!Gr(n))throw new Ei(n,"Arrays with uniqueItems constraints must specify a default annotation");let s=zo(n)?n.minItems:0;return Array.from({length:s},()=>on(t,n.items))}function YL(t,n){return hi(n)?BigInt(n.exclusiveMinimum)+BigInt(1):gi(n)?BigInt(n.minimum):BigInt(0)}function JL(t,n){return!1}function QL(t,n){let s=on(t,n.instanceType);return class{constructor(){Object.assign(this,s)}}}function ZL(t,n){return on({...t,...n.$defs},Xn(n.$ref))}function e1(t,n){return on(t,Qn(n))}function t1(t,n){let s=on(t,n.returnType);return()=>s}function n1(t,n){return hi(n)&&ft(n.exclusiveMinimum)?n.exclusiveMinimum+1:gi(n)?n.minimum:0}function r1(t,n){let s=pi(t,n),a=Qn(s);return on(t,a)}function i1(t,n){return n.const}function o1(t,n){throw new Ei(n,"Cannot create TNever types")}function s1(t,n){return null}function a1(t,n){return hi(n)&&ft(n.exclusiveMinimum)?n.exclusiveMinimum+1:gi(n)?n.minimum:0}function l1(t,n){return(bt(n.required)?[]:n.required).reduce((a,l)=>({...a,[l]:on(t,n.properties[l])}),{})}function u1(t,n){if(Ms(n)&&!Gr(n))throw new Ei(n,"Record with the minProperties constraint must have a default annotation");return{}}function c1(t,n){return Y(t,n.$ref)?on(t,t[n.$ref]):(()=>{throw new Ei(n,"Unable to deref Ref")})()}function d1(t,n){if((_s(n)||As(n))&&!Gr(n))throw Error("Strings with format or pattern constraints must specify default");let a=Ps(n)?n.minLength:0;return"".padEnd(a)}function m1(t,n){return Symbol()}function f1(t,n){let s=Kl(n.pattern);if(Pn(s))throw new Ei(n,"Unable to create TemplateLiteral due to infinite type expansion");return on(t,s)}function p1(t,n){return Array.from({length:n.minItems},(s,a)=>on(t,n.items[a]))}function h1(t,n){return}function g1(t,n){if(F(n.anyOf.length,0))throw Error("Unable to create Union with no variants");return on(t,n.anyOf[0])}function y1(t,n){return}function on(t,n){return Gr(n)?WL(t,n):Qe(n)?XL(t,n):Dr(n)?YL(t,n):mr(n)?JL(t,n):hn(n)?QL(t,n):Pt(n)?ZL(t,n):In(n)?e1(t,n):gn(n)?t1(t,n):zn(n)?n1(t,n):we(n)?r1(t,n):Ye(n)?i1(t,n):Fr(n)?o1(t,n):ro(n)?s1(t,n):tn(n)?a1(t,n):Re(n)?l1(t,n):vt(n)?u1(t,n):Ct(n)?c1(t,n):Pn(n)?d1(t,n):No(n)?m1(t,n):$t(n)?f1(t,n):Ve(n)?p1(t,n):Ai(n)?h1(t,n):ae(n)?g1(t,n):Hr(n)?y1(t,n):void 0}function Di(...t){let[n,s]=dr(t,{2:(a,l)=>[a,l],1:(a)=>[{},a]});return on(n,s)}class zu extends Os{constructor(t,n){super("Parse",t,n)}}function WG(t,n,s){if(!wt(t,n,s))throw new zu(s,bi(t,n,s));return s}var uy=ja([(t,n,s)=>nn(s),(t,n,s)=>fo(t,n,s),(t,n,s)=>Ni(t,n,s),(t,n,s)=>ti(t,n,s),(t,n,s)=>WG(t,n,s)]);function st(...t){let[n,s,a]=dr(t,{3:(d,f,h)=>[d,f,h],2:(d,f)=>[{},d,f]});if(wt(n,s,a))return a;if(Jr().correctiveParse)return uy(n,s,a);throw new zu(a,bi(n,s,a))}var YG=r({type:o("insert"),path:c(),value:ci()}),JG=Object({type:o("update"),path:c(),value:ci()}),QG=r({type:o("delete"),path:c()}),S6e=i([YG,JG,QG]);class ff{constructor(t,n){this.hasCodec=ly(t,n),this.buildResult=lf(t,n),this.evaluateResult=this.buildResult.Evaluate()}IsAccelerated(){return this.evaluateResult.IsAccelerated()}Context(){return this.buildResult.Context()}Type(){return this.buildResult.Schema()}Code(){return this.evaluateResult.Code()}Check(t){return this.evaluateResult.Check(t)}Parse(t){if(this.Check(t))return t;if(Jr().correctiveParse)return uy(this.Context(),this.Type(),t);throw new zu(t,this.Errors(t))}Errors(t){if(this.IsAccelerated()&&this.Check(t))return[];return bi(this.Context(),this.Type(),t)}Clean(t){return ti(this.Context(),this.Type(),t)}Convert(t){return Ni(this.Context(),this.Type(),t)}Create(){return Di(this.Context(),this.Type())}Default(t){return fo(this.Context(),this.Type(),t)}Decode(t){return this.hasCodec?oy(this.Context(),this.Type(),t):this.Parse(t)}Encode(t){return this.hasCodec?sy(this.Context(),this.Type(),t):this.Parse(t)}}function de(...t){let[n,s]=dr(t,{2:(a,l)=>[a,l],1:(a)=>[{},a]});return new ff(n,s)}var t5=de(r({dark:c(),light:c()}));function Me(t){return t5.Check(t)}var Oe={dark:"pierre-dark-soft",light:"pierre-light"},S1=Oe;function ye(){return S1}function ct(t){S1={dark:t.dark,light:t.light}}var b1=class t{options;tokensStable=[];tokensUnstable=[];lastUnstableCodeChunk="";lastStableGrammarState;constructor(n){this.options=n}async enqueue(n){let s=(this.lastUnstableCodeChunk+n).split(`
|
|
312
312
|
`),a=[],l=[],d=this.tokensUnstable.length;return s.forEach((f,h)=>{let g=h===s.length-1,I=this.options.highlighter.codeToTokens(f,{...this.options,grammarState:this.lastStableGrammarState}),b=I.tokens[0];if(!g)b.push({content:`
|
|
313
|
-
`,offset:0});if(!g)this.lastStableGrammarState=I.grammarState,a.push(...b);else l=b,this.lastUnstableCodeChunk=f}),ds(this.tokensStable,a),this.tokensUnstable=l,{recall:d,stable:a,unstable:l}}close(){let n=this.tokensUnstable;return this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0,{stable:n}}clear(){this.tokensStable=[],this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0}clone(){let n=new t(this.options);return n.lastUnstableCodeChunk=this.lastUnstableCodeChunk,n.tokensUnstable=this.tokensUnstable,n.tokensStable=this.tokensStable,n.lastStableGrammarState=this.lastStableGrammarState,n}};var I3e=class extends TransformStream{tokenizer;options;constructor(t){let n=new b1(t),{allowRecalls:s=!1}=t;super({async transform(a,l){let{stable:d,unstable:f,recall:h}=await n.enqueue(a);if(s&&h>0)l.enqueue({recall:h});for(let g of d)l.enqueue(g);if(s)for(let g of f)l.enqueue(g)},async flush(a){let{stable:l}=n.close();if(!s)for(let d of l)a.enqueue(d)}});this.tokenizer=n,this.options=t}};var n5=1000,w3e=n5*4;function
|
|
314
|
-
export{u,U,G,R,C,Ne,Ge,j,T,
|
|
313
|
+
`,offset:0});if(!g)this.lastStableGrammarState=I.grammarState,a.push(...b);else l=b,this.lastUnstableCodeChunk=f}),ds(this.tokensStable,a),this.tokensUnstable=l,{recall:d,stable:a,unstable:l}}close(){let n=this.tokensUnstable;return this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0,{stable:n}}clear(){this.tokensStable=[],this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0}clone(){let n=new t(this.options);return n.lastUnstableCodeChunk=this.lastUnstableCodeChunk,n.tokensUnstable=this.tokensUnstable,n.tokensStable=this.tokensStable,n.lastStableGrammarState=this.lastStableGrammarState,n}};var I3e=class extends TransformStream{tokenizer;options;constructor(t){let n=new b1(t),{allowRecalls:s=!1}=t;super({async transform(a,l){let{stable:d,unstable:f,recall:h}=await n.enqueue(a);if(s&&h>0)l.enqueue({recall:h});for(let g of d)l.enqueue(g);if(s)for(let g of f)l.enqueue(g)},async flush(a){let{stable:l}=n.close();if(!s)for(let d of l)a.enqueue(d)}});this.tokenizer=n,this.options=t}};var n5=1000,w3e=n5*4;function nt(t){let n=[];for(let s of t){let a=Lr.get(s);if(a==null)throw Error(`getResolvedLanguages: ${s} is not resolved. Please resolve languages before calling getResolvedLanguages`);n.push(a)}return n}function at(t){for(let n of Array.isArray(t)?t:[t])if(!Lr.has(n))return!1;return!0}async function rt(t){let n=[],s=[];for(let a of t){if(a==="text"||a==="ansi")continue;let l=Nc(a)??Fc(a);if("then"in l)s.push(l);else n.push(l)}if(s.length>0)await Promise.all(s).then((a)=>{for(let l of a){if(l==null)throw Error("resolvedLanguages: unable to resolve language");n.push(l)}});return n}function it(t){return vn.getResolvedThemes(t)}async function ot(t){for(let s of t)gc(s);let n=await vn.resolveThemes(t);for(let s=0;s<t.length;s++)yc(t[s],n[s]);return n}
|
|
314
|
+
export{u,U,G,R,C,Ne,Ge,j,T,re,q,D,E,ie,ze,L,p,et,tt,S,Mt,me,Ot,He,V,ge,Gt,fe,oe,Ue,m,be,Pe,Ht,A,Ze,Z,Ut,nt,at,rt,it,ot,x,Zt,r,We,o,he,y,c,i,se,st,de,Me,Oe,ye,ct};
|