const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-CU67Zn6k.js","assets/html-GMplVEZG.js","assets/javascript-wDzz0qaB.js","assets/css-DPfMkruS.js","assets/angular-ts-BwZT4LLn.js","assets/scss-OYdSNvt2.js","assets/apl-dKokRX4l.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-CbQHKStN.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-DVc8C-J4.js","assets/html-derivative-BFtXZ54Q.js","assets/sql-BLtJtn59.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nwyudZeR.js","assets/coffee-Ch7k5sss.js","assets/cpp-CofmeUqb.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-tKQVLTB8.js","assets/shellscript-Yzrsuije.js","assets/edge-BkV0erSs.js","assets/elixir-CDX3lj18.js","assets/elm-DbKCFpqz.js","assets/erb-BOJIQeun.js","assets/ruby-BvKwtOVI.js","assets/haml-B8DHNrY2.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BbnMAYS6.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-BZjJHVRy.js","assets/fortran-free-form-D22FLkUw.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-B7Tvp0Sc.js","assets/gdshader-DkwncUOv.js","assets/gdscript-DTMYz4Jt.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-Rg0-pVw9.js","assets/glimmer-ts-U6CK756n.js","assets/hack-CaT9iCJl.js","assets/handlebars-BL8al0AC.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-4LBKfQ-Z.js","assets/jison-wvAkD_A8.js","assets/julia-C8NyazO9.js","assets/r-DiinP2Uv.js","assets/latex-BdAV_C_H.js","assets/tex-CxkMU7Pf.js","assets/liquid-DYVedYrR.js","assets/marko-CPi9NSCl.js","assets/less-B1dDrJ26.js","assets/mdc-DUICxH0z.js","assets/nginx-DknmC5AR.js","assets/nim-CVrawwO9.js","assets/perl-C0TMdlhV.js","assets/php-CDn_0X-4.js","assets/pug-CGlum2m_.js","assets/qml-3beO22l8.js","assets/razor-CE9lU5zL.js","assets/csharp-K5feNrxe.js","assets/rst-B0xPkSld.js","assets/cmake-D1j8_8rp.js","assets/sas-cz2c8ADy.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-Brmx7dQM.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-BH5u7GGu.js","assets/svelte-3Dk4HxPD.js","assets/templ-W15q3VgB.js","assets/go-Dn2_MT6a.js","assets/ts-tags-zn1MmPIZ.js","assets/twig-CO9l9SDP.js","assets/vue-DnHKYNfI.js","assets/vue-html-CChd_i61.js","assets/vue-vine-8moa0y9V.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js"])))=>i.map(i=>d[i]); (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();const He={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Wy(this.context.count)},getNextContextId(){return Wy(this.context.count++)}};function Wy(t){const e=String(t),n=e.length-1;return He.context.id+(n?String.fromCharCode(96+n):"")+e}function Ni(t){He.context=t}const Fx=!1,VM=(t,e)=>t===e,Ko=Symbol("solid-proxy"),$x=typeof Proxy=="function",ip=Symbol("solid-track"),sp={equals:VM};let Tc=null,Bx=qx;const So=1,Rc=2,Vx={owned:null,cleanups:null,context:null,owner:null},Vf={};var dt=null;let ze=null,UM=null,Ht=null,fr=null,Xn=null,gm=0;function er(t,e){const n=Ht,r=dt,o=t.length===0,i=e===void 0?r:e,s=o?Vx:{owned:null,cleanups:null,context:i?i.context:null,owner:i},a=o?t:()=>t(()=>ut(()=>Cs(s)));dt=s,Ht=null;try{return Zr(a,!0)}finally{Ht=n,dt=r}}function me(t,e){e=e?Object.assign({},sp,e):sp;const n={value:t,observers:null,observerSlots:null,comparator:e.equals||void 0},r=o=>(typeof o=="function"&&(ze&&ze.running&&ze.sources.has(n)?o=o(n.tValue):o=o(n.value)),Hx(n,o));return[Ux.bind(n),r]}function uh(t,e,n){const r=cd(t,e,!0,So);Ol(r)}function Be(t,e,n){const r=cd(t,e,!1,So);Ol(r)}function oe(t,e,n){Bx=JM;const r=cd(t,e,!1,So),o=ca&&xt(ca);o&&(r.suspense=o),(!n||!n.render)&&(r.user=!0),Xn?Xn.push(r):Ol(r)}function V(t,e,n){n=n?Object.assign({},sp,n):sp;const r=cd(t,e,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Ol(r),Ux.bind(r)}function HM(t){return t&&typeof t=="object"&&"then"in t}function Dl(t,e,n){let r,o,i;typeof e=="function"?(r=t,o=e,i=n||{}):(r=!0,o=t,i=e||{});let s=null,a=Vf,l=null,c=!1,d=!1,u="initialValue"in i,f=typeof r=="function"&&V(r);const m=new Set,[p,g]=(i.storage||me)(i.initialValue),[h,k]=me(void 0),[y,w]=me(void 0,{equals:!1}),[A,b]=me(u?"ready":"unresolved");He.context&&(l=He.getNextContextId(),i.ssrLoadFrom==="initial"?a=i.initialValue:He.load&&He.has(l)&&(a=He.load(l)));function x(N,R,M,C){return s===N&&(s=null,C!==void 0&&(u=!0),(N===a||R===a)&&i.onHydrated&&queueMicrotask(()=>i.onHydrated(C,{value:R})),a=Vf,ze&&N&&c?(ze.promises.delete(N),c=!1,Zr(()=>{ze.running=!0,I(R,M)},!1)):I(R,M)),R}function I(N,R){Zr(()=>{R===void 0&&g(()=>N),b(R!==void 0?"errored":u?"ready":"unresolved"),k(R);for(const M of m.keys())M.decrement();m.clear()},!1)}function P(){const N=ca&&xt(ca),R=p(),M=h();if(M!==void 0&&!s)throw M;return Ht&&!Ht.user&&N&&uh(()=>{y(),s&&(N.resolved&&ze&&c?ze.promises.add(s):m.has(N)||(N.increment(),m.add(N)))}),R}function E(N=!0){if(N!==!1&&d)return;d=!1;const R=f?f():r;if(c=ze&&ze.running,R==null||R===!1){x(s,ut(p));return}ze&&s&&ze.promises.delete(s);let M;const C=a!==Vf?a:ut(()=>{try{return o(R,{value:p(),refetching:N})}catch(L){M=L}});if(M!==void 0){x(s,void 0,Vu(M),R);return}else if(!HM(C))return x(s,C,void 0,R),C;return s=C,"v"in C?(C.s===1?x(s,C.v,void 0,R):x(s,void 0,Vu(C.v),R),C):(d=!0,queueMicrotask(()=>d=!1),Zr(()=>{b(u?"refreshing":"pending"),w()},!1),C.then(L=>x(C,L,void 0,R),L=>x(C,void 0,Vu(L),R)))}Object.defineProperties(P,{state:{get:()=>A()},error:{get:()=>h()},loading:{get(){const N=A();return N==="pending"||N==="refreshing"}},latest:{get(){if(!u)return P();const N=h();if(N&&!s)throw N;return p()}}});let z=dt;return f?uh(()=>(z=dt,E(!1))):E(!1),[P,{refetch:N=>Fi(z,()=>E(N)),mutate:g}]}function Lt(t){return Zr(t,!1)}function ut(t){if(Ht===null)return t();const e=Ht;Ht=null;try{return t()}finally{Ht=e}}function Jt(t,e,n){const r=Array.isArray(t);let o,i=n&&n.defer;return s=>{let a;if(r){a=Array(t.length);for(let c=0;ce(a,o,s));return o=a,l}}function en(t){oe(()=>ut(t))}function fe(t){return dt===null||(dt.cleanups===null?dt.cleanups=[t]:dt.cleanups.push(t)),t}function qM(t,e){Tc||(Tc=Symbol("error")),dt=cd(void 0,void 0,!0),dt.context={...dt.context,[Tc]:[e]},ze&&ze.running&&ze.sources.add(dt);try{return t()}catch(n){dd(n)}finally{dt=dt.owner}}function ph(){return Ht}function vi(){return dt}function Fi(t,e){const n=dt,r=Ht;dt=t,Ht=null;try{return Zr(e,!0)}catch(o){dd(o)}finally{dt=n,Ht=r}}function KM(t){if(ze&&ze.running)return t(),ze.done;const e=Ht,n=dt;return Promise.resolve().then(()=>{Ht=e,dt=n;let r;return ca&&(r=ze||(ze={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),r.done||(r.done=new Promise(o=>r.resolve=o)),r.running=!0),Zr(t,!1),Ht=dt=null,r?r.done:void 0})}const[Que,Gy]=me(!1);function WM(t){Xn.push.apply(Xn,t),t.length=0}function Et(t,e){const n=Symbol("context");return{id:n,Provider:QM(n),defaultValue:t}}function xt(t){let e;return dt&&dt.context&&(e=dt.context[t.id])!==void 0?e:t.defaultValue}function zl(t){const e=V(t),n=V(()=>mh(e()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}let ca;function GM(){return ca||(ca=Et())}function Ux(){const t=ze&&ze.running;if(this.sources&&(t?this.tState:this.state))if((t?this.tState:this.state)===So)Ol(this);else{const e=fr;fr=null,Zr(()=>lp(this),!1),fr=e}if(Ht){const e=this.observers?this.observers.length:0;Ht.sources?(Ht.sources.push(this),Ht.sourceSlots.push(e)):(Ht.sources=[this],Ht.sourceSlots=[e]),this.observers?(this.observers.push(Ht),this.observerSlots.push(Ht.sources.length-1)):(this.observers=[Ht],this.observerSlots=[Ht.sources.length-1])}return t&&ze.sources.has(this)?this.tValue:this.value}function Hx(t,e,n){let r=ze&&ze.running&&ze.sources.has(t)?t.tValue:t.value;if(!t.comparator||!t.comparator(r,e)){if(ze){const o=ze.running;(o||!n&&ze.sources.has(t))&&(ze.sources.add(t),t.tValue=e),o||(t.value=e)}else t.value=e;t.observers&&t.observers.length&&Zr(()=>{for(let o=0;o1e6)throw fr=[],new Error},!1)}return e}function Ol(t){if(!t.fn)return;Cs(t);const e=gm;Zy(t,ze&&ze.running&&ze.sources.has(t)?t.tValue:t.value,e),ze&&!ze.running&&ze.sources.has(t)&&queueMicrotask(()=>{Zr(()=>{ze&&(ze.running=!0),Ht=dt=t,Zy(t,t.tValue,e),Ht=dt=null},!1)})}function Zy(t,e,n){let r;const o=dt,i=Ht;Ht=dt=t;try{r=t.fn(e)}catch(s){return t.pure&&(ze&&ze.running?(t.tState=So,t.tOwned&&t.tOwned.forEach(Cs),t.tOwned=void 0):(t.state=So,t.owned&&t.owned.forEach(Cs),t.owned=null)),t.updatedAt=n+1,dd(s)}finally{Ht=i,dt=o}(!t.updatedAt||t.updatedAt<=n)&&(t.updatedAt!=null&&"observers"in t?Hx(t,r,!0):ze&&ze.running&&t.pure?(ze.sources.add(t),t.tValue=r):t.value=r,t.updatedAt=n)}function cd(t,e,n,r=So,o){const i={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:dt,context:dt?dt.context:null,pure:n};return ze&&ze.running&&(i.state=0,i.tState=r),dt===null||dt!==Vx&&(ze&&ze.running&&dt.pure?dt.tOwned?dt.tOwned.push(i):dt.tOwned=[i]:dt.owned?dt.owned.push(i):dt.owned=[i]),i}function ap(t){const e=ze&&ze.running;if((e?t.tState:t.state)===0)return;if((e?t.tState:t.state)===Rc)return lp(t);if(t.suspense&&ut(t.suspense.inFallback))return t.suspense.effects.push(t);const n=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt=0;r--){if(t=n[r],e){let o=t,i=n[r+1];for(;(o=o.owner)&&o!==i;)if(ze.disposed.has(o))return}if((e?t.tState:t.state)===So)Ol(t);else if((e?t.tState:t.state)===Rc){const o=fr;fr=null,Zr(()=>lp(t,n[0]),!1),fr=o}}}function Zr(t,e){if(fr)return t();let n=!1;e||(fr=[]),Xn?n=!0:Xn=[],gm++;try{const r=t();return ZM(n),r}catch(r){n||(Xn=null),fr=null,dd(r)}}function ZM(t){if(fr&&(qx(fr),fr=null),t)return;let e;if(ze){if(!ze.promises.size&&!ze.queue.size){const r=ze.sources,o=ze.disposed;Xn.push.apply(Xn,ze.effects),e=ze.resolve;for(const i of Xn)"tState"in i&&(i.state=i.tState),delete i.tState;ze=null,Zr(()=>{for(const i of o)Cs(i);for(const i of r){if(i.value=i.tValue,i.owned)for(let s=0,a=i.owned.length;sBx(n),!1),e&&e()}function qx(t){for(let e=0;e=0;e--)Cs(t.tOwned[e]);delete t.tOwned}if(ze&&ze.running&&t.pure)Wx(t,!0);else if(t.owned){for(e=t.owned.length-1;e>=0;e--)Cs(t.owned[e]);t.owned=null}if(t.cleanups){for(e=t.cleanups.length-1;e>=0;e--)t.cleanups[e]();t.cleanups=null}ze&&ze.running?t.tState=0:t.state=0}function Wx(t,e){if(e||(t.tState=0,ze.disposed.add(t)),t.owned)for(let n=0;no=ut(()=>(dt.context={...dt.context,[t]:r.value},zl(()=>r.children))),void 0),o}}const XM=Symbol("fallback");function Qy(t){for(let e=0;e1?[]:null;return fe(()=>Qy(i)),()=>{let l=t()||[],c=l.length,d,u;return l[ip],ut(()=>{let m,p,g,h,k,y,w,A,b;if(c===0)s!==0&&(Qy(i),i=[],r=[],o=[],s=0,a&&(a=[])),n.fallback&&(r=[XM],o[0]=er(x=>(i[0]=x,n.fallback())),s=1);else if(s===0){for(o=new Array(c),u=0;u=y&&A>=y&&r[w]===l[A];w--,A--)g[A]=o[w],h[A]=i[w],a&&(k[A]=a[w]);for(m=new Map,p=new Array(A+1),u=A;u>=y;u--)b=l[u],d=m.get(b),p[u]=d===void 0?-1:d,m.set(b,u);for(d=y;d<=w;d++)b=r[d],u=m.get(b),u!==void 0&&u!==-1?(g[u]=o[d],h[u]=i[d],a&&(k[u]=a[d]),u=p[u],m.set(b,u)):i[d]();for(u=y;ut(e||{}))}function Yd(){return!0}const fh={get(t,e,n){return e===Ko?n:t.get(e)},has(t,e){return e===Ko?!0:t.has(e)},set:Yd,deleteProperty:Yd,getOwnPropertyDescriptor(t,e){return{configurable:!0,enumerable:!0,get(){return t.get(e)},set:Yd,deleteProperty:Yd}},ownKeys(t){return t.keys()}};function Uf(t){return(t=typeof t=="function"?t():t)?t:{}}function eL(){for(let t=0,e=this.length;t=0;a--){const l=Uf(t[a])[s];if(l!==void 0)return l}},has(s){for(let a=t.length-1;a>=0;a--)if(s in Uf(t[a]))return!0;return!1},keys(){const s=[];for(let a=0;a=0;s--){const a=t[s];if(!a)continue;const l=Object.getOwnPropertyNames(a);for(let c=l.length-1;c>=0;c--){const d=l[c];if(d==="__proto__"||d==="constructor")continue;const u=Object.getOwnPropertyDescriptor(a,d);if(!r[d])r[d]=u.get?{enumerable:!0,configurable:!0,get:eL.bind(n[d]=[u.get.bind(a)])}:u.value!==void 0?u:void 0;else{const f=n[d];f&&(u.get?f.push(u.get.bind(a)):u.value!==void 0&&f.push(()=>u.value))}}}const o={},i=Object.keys(r);for(let s=i.length-1;s>=0;s--){const a=i[s],l=r[a];l&&l.get?Object.defineProperty(o,a,l):o[a]=l?l.value:void 0}return o}function ce(t,...e){const n=e.length;if($x&&Ko in t){const o=n>1?e.flat():e[0],i=e.map(s=>new Proxy({get(a){return s.includes(a)?t[a]:void 0},has(a){return s.includes(a)&&a in t},keys(){return s.filter(a=>a in t)}},fh));return i.push(new Proxy({get(s){return o.includes(s)?void 0:t[s]},has(s){return o.includes(s)?!1:s in t},keys(){return Object.keys(t).filter(s=>!o.includes(s))}},fh)),i}const r=[];for(let o=0;o<=n;o++)r[o]={};for(const o of Object.getOwnPropertyNames(t)){let i=n;for(let l=0;l{const i=He.context;if(i){const[a,l]=me();He.count||(He.count=0),He.count++,(n||(n=t())).then(c=>{!He.done&&Ni(i),He.count--,l(()=>c.default),Ni()}),e=a}else if(!e){const[a]=Dl(()=>(n||(n=t())).then(l=>l.default));e=a}let s;return V(()=>(s=e())?ut(()=>{if(!i||He.done)return s(o);const a=He.context;Ni(i);const l=s(o);return Ni(a),l}):"")};return r.preload=()=>n||((n=t()).then(o=>e=()=>o.default),n),r}let tL=0;function mn(){return He.context?He.getNextContextId():`cl-${tL++}`}const Zx=t=>`Stale read from <${t}>.`;function un(t){const e="fallback"in t&&{fallback:()=>t.fallback};return V(YM(()=>t.each,t.children,e||void 0))}function ge(t){const e=t.keyed,n=V(()=>t.when,void 0,void 0),r=e?n:V(n,void 0,{equals:(o,i)=>!o==!i});return V(()=>{const o=r();if(o){const i=t.children;return typeof i=="function"&&i.length>0?ut(()=>i(e?o:()=>{if(!ut(r))throw Zx("Show");return n()})):i}return t.fallback},void 0,void 0)}function vo(t){const e=zl(()=>t.children),n=V(()=>{const r=e(),o=Array.isArray(r)?r:[r];let i=()=>{};for(let s=0;sc()?void 0:l.when,void 0,void 0),u=l.keyed?d:V(d,void 0,{equals:(f,m)=>!f==!m});i=()=>c()||(u()?[a,d,l]:void 0)}return i});return V(()=>{const r=n()();if(!r)return t.fallback;const[o,i,s]=r,a=s.children;return typeof a=="function"&&a.length>0?ut(()=>a(s.keyed?i():()=>{if(ut(n)()?.[0]!==o)throw Zx("Match");return i()})):a},void 0,void 0)}function Xt(t){return t}let rl;function nL(){rl&&[...rl].forEach(t=>t())}function rL(t){let e;He.context&&He.load&&(e=He.load(He.getContextId()));const[n,r]=me(e,void 0);return rl||(rl=new Set),rl.add(r),fe(()=>rl.delete(r)),V(()=>{let o;if(o=n()){const i=t.fallback;return typeof i=="function"&&i.length?ut(()=>i(o,()=>r())):i}return qM(()=>t.children,r)},void 0,void 0)}const oL=Et();function Jx(t){let e=0,n,r,o,i,s;const[a,l]=me(!1),c=GM(),d={increment:()=>{++e===1&&l(!0)},decrement:()=>{--e===0&&l(!1)},inFallback:a,effects:[],resolved:!1},u=vi();if(He.context&&He.load){const p=He.getContextId();let g=He.load(p);if(g&&(typeof g!="object"||g.s!==1?o=g:He.gather(p)),o&&o!=="$$f"){const[h,k]=me(void 0,{equals:!1});i=h,o.then(()=>{if(He.done)return k();He.gather(p),Ni(r),k(),Ni()},y=>{s=y,k()})}}const f=xt(oL);f&&(n=f.register(d.inFallback));let m;return fe(()=>m&&m()),v(c.Provider,{value:d,get children(){return V(()=>{if(s)throw s;if(r=He.context,i)return i(),i=void 0;r&&o==="$$f"&&Ni();const p=V(()=>t.children);return V(g=>{const h=d.inFallback(),{showContent:k=!0,showFallback:y=!0}=n?n():{};if((!h||o&&o!=="$$f")&&k)return d.resolved=!0,m&&m(),m=r=o=void 0,WM(d.effects),p();if(y)return m?g:er(w=>(m=w,r&&(Ni({id:r.id+"F",count:0}),r=void 0),t.fallback),u)})})}})}const iL=["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"],sL=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...iL]),aL=new Set(["innerHTML","textContent","innerText","children"]),lL=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),cL=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function dL(t,e){const n=cL[t];return typeof n=="object"?n[e]?n.$:void 0:n}const uL=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),pL=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),mL={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},$e=t=>V(()=>t());function fL(t,e,n){let r=n.length,o=e.length,i=r,s=0,a=0,l=e[o-1].nextSibling,c=null;for(;sd-a){const p=e[s];for(;a{o=i,e===document?t():D(e,t(),e.firstChild?null:void 0,n)},r.owner),()=>{o(),e.textContent=""}}function X(t,e,n,r){let o;const i=()=>{const a=r?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return a.innerHTML=t,n?a.content.firstChild.firstChild:r?a.firstChild:a.content.firstChild},s=e?()=>ut(()=>document.importNode(o||(o=i()),!0)):()=>(o||(o=i())).cloneNode(!0);return s.cloneNode=s,s}function sr(t,e=window.document){const n=e[Xy]||(e[Xy]=new Set);for(let r=0,o=t.length;ro.call(t,n[1],i))}else t.addEventListener(e,n,typeof n!="function"&&n)}function on(t,e,n={}){const r=Object.keys(e||{}),o=Object.keys(n);let i,s;for(i=0,s=o.length;io.children=Nc(t,e.children,o.children)),Be(()=>typeof e.ref=="function"&&Rn(e.ref,t)),Be(()=>bL(t,e,n,!0,o,!0)),o}function Rn(t,e,n){return ut(()=>t(e,n))}function D(t,e,n,r){if(n!==void 0&&!r&&(r=[]),typeof e!="function")return Nc(t,e,r,n);Be(o=>Nc(t,e(),o,n),r)}function bL(t,e,n,r,o={},i=!1){e||(e={});for(const s in o)if(!(s in e)){if(s==="children")continue;o[s]=ek(t,s,null,o[s],n,i,e)}for(const s in e){if(s==="children")continue;const a=e[s];o[s]=ek(t,s,a,o[s],n,i,e)}}function yL(t){let e,n;return!xa()||!(e=He.registry.get(n=xL()))?t():(He.completed&&He.completed.add(e),He.registry.delete(n),e)}function xa(t){return!!He.context&&!He.done&&(!t||t.isConnected)}function kL(t){return t.toLowerCase().replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function Yy(t,e,n){const r=e.trim().split(/\s+/);for(let o=0,i=r.length;o-1&&mL[e.split(":")[0]];f?hL(t,f,e,n):kt(t,lL[e]||e,n)}return n}function wL(t){if(He.registry&&He.events&&He.events.find(([l,c])=>c===t))return;let e=t.target;const n=`$$${t.type}`,r=t.target,o=t.currentTarget,i=l=>Object.defineProperty(t,"target",{configurable:!0,value:l}),s=()=>{const l=e[n];if(l&&!e.disabled){const c=e[`${n}Data`];if(c!==void 0?l.call(e,c,t):l.call(e,t),t.cancelBubble)return}return e.host&&typeof e.host!="string"&&!e.host._$host&&e.contains(t.target)&&i(e.host),!0},a=()=>{for(;s()&&(e=e._$host||e.parentNode||e.host););};if(Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return e||document}}),He.registry&&!He.done&&(He.done=_$HY.done=!0),t.composedPath){const l=t.composedPath();i(l[0]);for(let c=0;c{let l=e();for(;typeof l=="function";)l=l();n=Nc(t,l,n,r)}),()=>n;if(Array.isArray(e)){const l=[],c=n&&Array.isArray(n);if(gh(l,e,n,o))return Be(()=>n=Nc(t,l,n,r,!0)),()=>n;if(i){if(!l.length)return n;if(r===void 0)return n=[...t.childNodes];let d=l[0];if(d.parentNode!==t)return n;const u=[d];for(;(d=d.nextSibling)!==r;)u.push(d);return n=u}if(l.length===0){if(n=ja(t,n,r),a)return n}else c?n.length===0?tk(t,l,r):fL(t,n,l):(n&&ja(t),tk(t,l));n=l}else if(e.nodeType){if(i&&e.parentNode)return n=a?[e]:e;if(Array.isArray(n)){if(a)return n=ja(t,n,r,e);ja(t,n,null,e)}else n==null||n===""||!t.firstChild?t.appendChild(e):t.replaceChild(e,t.firstChild);n=e}}return n}function gh(t,e,n,r){let o=!1;for(let i=0,s=e.length;i=0;s--){const a=e[s];if(o!==a){const l=a.parentNode===t;!i&&!s?l?t.replaceChild(o,a):t.insertBefore(o,n):l&&a.remove()}else i=!0}}else t.insertBefore(o,n);return[o]}function xL(){return He.getNextContextId()}const SL=!1,AL="http://www.w3.org/2000/svg";function Qx(t,e=!1,n=void 0){return e?document.createElementNS(AL,t):document.createElement(t,{is:n})}function Ds(t){const{useShadow:e}=t,n=document.createTextNode(""),r=()=>t.mount||document.body,o=vi();let i,s=!!He.context;return oe(()=>{s&&(vi().user=s=!1),i||(i=Fi(o,()=>V(()=>t.children)));const a=r();if(a instanceof HTMLHeadElement){const[l,c]=me(!1),d=()=>c(!0);er(u=>D(a,()=>l()?u():i(),null)),fe(d)}else{const l=Qx(t.isSVG?"g":"div",t.isSVG),c=e&&l.attachShadow?l.attachShadow({mode:"open"}):l;Object.defineProperty(l,"_$host",{get(){return n.parentNode},configurable:!0}),D(c,i),a.appendChild(l),t.ref&&t.ref(l),fe(()=>a.removeChild(l))}},void 0,{render:!s}),n}function CL(t,e){const n=V(t);return V(()=>{const r=n();switch(typeof r){case"function":return ut(()=>r(e));case"string":const o=pL.has(r),i=He.context?yL():Qx(r,o,ut(()=>e.is));return nr(i,e,o),i}})}function IL(t){const[,e]=ce(t,["component"]);return CL(()=>t.component,e)}function TL(t){return t()}const EL="modulepreload",ML=function(t){return"/"+t},nk={},F=function(e,n,r){let o=Promise.resolve();if(n&&n.length>0){let l=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=s?.nonce||s?.getAttribute("nonce");o=l(n.map(c=>{if(c=ML(c),c in nk)return;nk[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":EL,d||(f.as="script"),f.crossOrigin="",f.href=c,a&&f.setAttribute("nonce",a),document.head.appendChild(f),d)return new Promise((m,p)=>{f.addEventListener("load",m),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return o.then(s=>{for(const a of s||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})},cp="diffs-container",LL=/(?=^diff --git)/gm,PL=/(?=^@@ )/gm,_L=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,Uu=/(?<=\n)/,DL=/^(---|\+\+\+)\s+([^\t\r\n]+)/,zL=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,OL=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,jL=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,tv="header-metadata",mr={dark:"pierre-dark",light:"pierre-light"},nv="data-unsafe-css",ll=1,rv={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},RL=Object.freeze({fromStart:0,fromEnd:0}),dp={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0};function NL(t,e){return t?.start===e?.start&&t?.end===e?.end&&t?.side===e?.side&&t?.endSide===e?.endSide}var Xx=class{pre;selectedRange=null;renderedSelectionRange;anchor;_queuedRender;constructor(t={}){this.options=t}setOptions(t){this.options={...this.options,...t},this.removeEventListeners(),this.options.enableLineSelection===!0&&this.attachEventListeners()}cleanUp(){this.removeEventListeners(),this._queuedRender!=null&&(cancelAnimationFrame(this._queuedRender),this._queuedRender=void 0),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0}setup(t){if(this.setDirty(),this.pre!==t){this.cleanUp(),this.pre=t;const{enableLineSelection:e=!1}=this.options;e?this.attachEventListeners():this.removeEventListeners()}this.setSelection(this.selectedRange)}setDirty(){this.renderedSelectionRange=void 0}isDirty(){return this.renderedSelectionRange===void 0}setSelection(t){const e=!(t===this.selectedRange||NL(t??void 0,this.selectedRange??void 0));!this.isDirty()&&!e||(this.selectedRange=t,this.renderSelection(),e&&this.notifySelectionChange())}getSelection(){return this.selectedRange}getLineIndex(t,e){const{getLineIndex:n}=this.options;return n!=null?n(t,e):[t-1,t-1]}attachEventListeners(){this.pre!=null&&(this.removeEventListeners(),this.pre.setAttribute("data-interactive-line-numbers",""),this.pre.addEventListener("pointerdown",this.handleMouseDown))}removeEventListeners(){this.pre!=null&&(this.pre.removeEventListener("pointerdown",this.handleMouseDown),document.removeEventListener("pointermove",this.handleMouseMove),document.removeEventListener("pointerup",this.handleMouseUp),this.pre.removeAttribute("data-interactive-line-numbers"))}handleMouseDown=t=>{const e=t.button===0?this.getMouseEventDataForPath(t.composedPath(),"click"):void 0;if(e==null||this.pre==null)return;t.preventDefault();const{lineNumber:n,eventSide:r,lineIndex:o}=e;if(t.shiftKey&&this.selectedRange!=null){const i=this.getIndexesFromSelection(this.selectedRange,this.pre.getAttribute("data-diff-type")==="split");if(i==null)return;const s=i.start<=i.end?o>=i.start:o<=i.end;this.anchor={line:s?this.selectedRange.start:this.selectedRange.end,side:(s?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side)??"additions"},this.updateSelection(n,r),this.notifySelectionStart(this.selectedRange)}else{if(this.selectedRange?.start===n&&this.selectedRange?.end===n){this.updateSelection(null),this.notifySelectionEnd(null),this.notifySelectionChange();return}this.selectedRange=null,this.anchor={line:n,side:r},this.updateSelection(n,r),this.notifySelectionStart(this.selectedRange)}document.addEventListener("pointermove",this.handleMouseMove),document.addEventListener("pointerup",this.handleMouseUp)};handleMouseMove=t=>{const e=this.getMouseEventDataForPath(t.composedPath(),"move");if(e==null||this.anchor==null)return;const{lineNumber:n,eventSide:r}=e;this.updateSelection(n,r)};handleMouseUp=()=>{this.anchor=void 0,document.removeEventListener("pointermove",this.handleMouseMove),document.removeEventListener("pointerup",this.handleMouseUp),this.notifySelectionEnd(this.selectedRange),this.notifySelectionChange()};updateSelection(t,e){if(t==null)this.selectedRange=null;else{const n=this.anchor?.side??e;this.selectedRange={start:this.anchor?.line??t,end:t,side:n,endSide:n!==e?e:void 0}}this._queuedRender??=requestAnimationFrame(this.renderSelection)}getIndexesFromSelection(t,e){if(this.pre==null)return;const n=this.getLineIndex(t.start,t.side),r=this.getLineIndex(t.end,t.endSide??t.side);return n!=null&&r!=null?{start:e?n[1]:n[0],end:e?r[1]:r[0]}:void 0}renderSelection=()=>{if(this._queuedRender!=null&&(cancelAnimationFrame(this._queuedRender),this._queuedRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;const t=this.pre.querySelectorAll("[data-selected-line]");for(const a of t)a.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;const{children:e}=this.pre;if(e.length===0)return;if(e.length>2)throw console.error(e),new Error("LineSelectionManager.applySelectionToDOM: Somehow there are more than 2 code elements...");const n=this.pre.getAttribute("data-diff-type")==="split",r=this.getIndexesFromSelection(this.selectedRange,n);if(r==null)throw console.error({rowRange:r,selectedRange:this.selectedRange}),new Error("LineSelectionManager.renderSelection: No valid rowRange");const o=r.start===r.end,i=Math.min(r.start,r.end),s=Math.max(r.start,r.end);for(const a of e){const[l,c]=a.children,d=c.children.length;if(d!==l.children.length)throw new Error("LineSelectionManager.renderSelection: gutter and content children dont match, something is wrong");for(let u=0;us)break;if(p==null||pparseInt(r)).filter(r=>!Number.isNaN(r));if(e&&n.length===2)return n[1];if(!e)return n[0]}};function up({enableLineSelection:t,onLineSelected:e,onLineSelectionStart:n,onLineSelectionEnd:r},o){return{enableLineSelection:t,onLineSelected:e,onLineSelectionStart:n,onLineSelectionEnd:r,getLineIndex:o}}function Hf(t,e){return t==null?!1:e==="file"?t.type==="line":t.type==="diff-line"}function FL(t){return t?.type==="line-info"}var Yx=class{hoveredLine;pre;hoverSlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasEventListeners=!1;constructor(t,e){this.mode=t,this.options=e}setOptions(t){this.options=t}cleanUp(){this.pre?.removeEventListener("click",this.handleMouseClick),this.pre?.removeEventListener("pointermove",this.handleMouseMove),this.pre?.removeEventListener("pointerleave",this.handleMouseLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.clearHoveredLine(),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasEventListeners=!1,this.pre=void 0}setup(t){const{__debugMouseEvents:e,onLineClick:n,onLineNumberClick:r,onLineEnter:o,onLineLeave:i,onHunkExpand:s,enableHoverUtility:a=!1,lineHoverHighlight:l="disabled"}=this.options,c=this.pre!==t;if(c&&(this.cleanUp(),this.pre=t,this.hasEventListeners=!1),a&&this.hoverSlot==null){this.hoverSlot=document.createElement("div"),this.hoverSlot.setAttribute("data-hover-slot","");const u=document.createElement("slot");u.name="hover-slot",this.hoverSlot.appendChild(u)}else!a&&this.hoverSlot!=null&&(this.hoverSlot.parentNode?.removeChild(this.hoverSlot),this.hoverSlot=void 0);const d=l!=="disabled"||n!=null||r!=null||s!=null||o!=null||i!=null||a;(c||!this.hasEventListeners)&&d?(this.hasEventListeners=!0,t.addEventListener("click",this.handleMouseClick),n!=null?(t.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0,this.interactiveLineNumbersAttr=!1):r!=null&&(t.setAttribute("data-interactive-line-numbers",""),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!0),ir(e,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const u=[];return(e==="both"||e==="click")&&(n!=null&&u.push("onLineClick"),r!=null&&u.push("onLineNumberClick"),s!=null&&u.push("expandable hunk separators")),u})()),t.addEventListener("pointermove",this.handleMouseMove),ir(e,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),t.addEventListener("pointerleave",this.handleMouseLeave),ir(e,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!d&&this.hasEventListeners&&(this.pre?.removeEventListener("click",this.handleMouseClick),this.pre?.removeEventListener("pointermove",this.handleMouseMove),this.pre?.removeEventListener("pointerleave",this.handleMouseLeave),this.hasEventListeners=!1),c||(n!=null?(this.interactiveLineNumbersAttr&&(t.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1),this.interactiveLinesAttr||(t.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0)):r!=null?(this.interactiveLinesAttr&&(t.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),this.interactiveLineNumbersAttr||(t.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0)):(this.interactiveLinesAttr&&(t.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),this.interactiveLineNumbersAttr&&(t.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)))}getHoveredLine=()=>{if(this.hoveredLine!=null){if(this.mode==="diff"&&this.hoveredLine.type==="diff-line")return{lineNumber:this.hoveredLine.lineNumber,side:this.hoveredLine.annotationSide};if(this.mode==="file"&&this.hoveredLine.type==="line")return{lineNumber:this.hoveredLine.lineNumber}}};handleMouseClick=t=>{const{onLineClick:e,onLineNumberClick:n,onHunkExpand:r}=this.options;e==null&&n==null&&r==null||(ir(this.options.__debugMouseEvents,"click","FileDiff.DEBUG.handleMouseClick:",t),this.handleMouseEvent({eventType:"click",event:t}))};handleMouseMove=t=>{const{lineHoverHighlight:e="disabled",onLineEnter:n,onLineLeave:r,enableHoverUtility:o=!1}=this.options;e==="disabled"&&!o&&n==null&&r==null||(ir(this.options.__debugMouseEvents,"move","FileDiff.DEBUG.handleMouseMove:",t),this.handleMouseEvent({eventType:"move",event:t}))};handleMouseLeave=t=>{const{__debugMouseEvents:e}=this.options;if(ir(e,"move","FileDiff.DEBUG.handleMouseLeave: no event"),this.hoveredLine==null){ir(e,"move","FileDiff.DEBUG.handleMouseLeave: returned early, no .hoveredLine");return}this.hoverSlot?.parentElement?.removeChild(this.hoverSlot),this.options.onLineLeave?.({...this.hoveredLine,event:t}),this.clearHoveredLine()};handleMouseEvent({eventType:t,event:e}){const{__debugMouseEvents:n}=this.options,r=e.composedPath();ir(n,t,"FileDiff.DEBUG.handleMouseEvent:",{eventType:t,composedPath:r});const o=this.getLineData(r);ir(n,t,"FileDiff.DEBUG.handleMouseEvent: getLineData result:",o);const{onLineClick:i,onLineNumberClick:s,onLineEnter:a,onLineLeave:l,onHunkExpand:c}=this.options;switch(t){case"move":if(Hf(o,this.mode)&&this.hoveredLine?.lineElement===o.lineElement){ir(n,"move","FileDiff.DEBUG.handleMouseEvent: switch, 'move', returned early because same line");break}this.hoveredLine!=null&&(ir(n,"move","FileDiff.DEBUG.handleMouseEvent: switch, 'move', clearing an existing hovered line and firing onLineLeave"),this.hoverSlot?.parentElement?.removeChild(this.hoverSlot),l?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),Hf(o,this.mode)&&(ir(n,"move","FileDiff.DEBUG.handleMouseEvent: switch, 'move', setting up a new hoveredLine and firing onLineEnter"),this.setHoveredLine(o),this.hoverSlot!=null&&o.numberElement?.appendChild(this.hoverSlot),a?.({...this.hoveredLine,event:e}));break;case"click":if(ir(n,"click","FileDiff.DEBUG.handleMouseEvent: switch, 'click', with data:",o),o==null)break;if(FL(o)&&c!=null){ir(n,"click","FileDiff.DEBUG.handleMouseEvent: switch, 'click', expanding a hunk"),c(o.hunkIndex,o.direction);break}Hf(o,this.mode)&&(s!=null&&o.numberColumn?(ir(n,"click","FileDiff.DEBUG.handleMouseEvent: switch, 'click', firing 'onLineNumberClick'"),s({...o,event:e})):i!=null?(ir(n,"click","FileDiff.DEBUG.handleMouseEvent: switch, 'click', firing 'onLineClick'"),i({...o,event:e})):ir(n,"click","FileDiff.DEBUG.handleMouseEvent: switch, 'click', fell through, no event to fire"));break}}clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(t){const{lineHoverHighlight:e="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=t,e!=="disabled"&&((e==="both"||e==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(e==="both"||e==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}getLineData(t){let e=!1,n,r,o,i,s,a,l;for(const c of t){if(!(c instanceof HTMLElement))continue;const d=s==null?c.getAttribute("data-column-number")??void 0:void 0;if(d){s=c,l=Number.parseInt(d,10),e=!0,n=ok(c),i=c.getAttribute("data-line-index")??void 0;continue}const u=o==null?c.getAttribute("data-line")??void 0:void 0;if(u){o=c,l=Number.parseInt(u,10),n=ok(c),i=c.getAttribute("data-line-index")??void 0;continue}if(a==null&&c.hasAttribute("data-expand-button")){a={hunkIndex:void 0,direction:c.hasAttribute("data-expand-up")?"up":c.hasAttribute("data-expand-down")?"down":"both"};continue}const f=a!=null?c.getAttribute("data-expand-index")??void 0:void 0;if(a!=null&&f!=null){const m=Number.parseInt(f,10);Number.isNaN(m)||(a.hunkIndex=m);continue}if(r==null&&c.hasAttribute("data-code")){r=c;break}}if(a?.hunkIndex!=null){const{hunkIndex:c,direction:d}=a;return{type:"line-info",hunkIndex:c,direction:d}}if(o??=i!=null?rk(r,`[data-line][data-line-index="${i}"]`):void 0,s??=i!=null?rk(r,`[data-column-number][data-line-index="${i}"]`):void 0,!(r==null||o==null||s==null||n==null))return this.mode==="file"?{type:"line",lineElement:o,lineNumber:l,numberElement:s,numberColumn:e}:{type:"diff-line",annotationSide:(()=>{switch(n){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return r.hasAttribute("data-deletions")?"deletions":"additions"}})(),lineType:n,lineElement:o,numberElement:s,lineNumber:l,numberColumn:e}}};function ir(t="none",e,...n){switch(t){case"none":return;case"both":break;case"click":if(e!=="click")return;break;case"move":if(e!=="move")return;break}console.log(...n)}function pp({lineHoverHighlight:t,onLineClick:e,onLineNumberClick:n,onLineEnter:r,onLineLeave:o,enableHoverUtility:i,__debugMouseEvents:s},a){return{lineHoverHighlight:t,onLineClick:e,onLineNumberClick:n,onLineEnter:r,onLineLeave:o,enableHoverUtility:i,__debugMouseEvents:s,onHunkExpand:a}}function rk(t,e){const n=t?.querySelector(e);return n instanceof HTMLElement?n:void 0}function ok(t){const e=t.getAttribute("data-line-type");if(e!=null)switch(e){case"change-deletion":case"change-addition":case"context":case"context-expanded":return e;default:return}}var e6=class{observedNodes=new Map;timeoutID;queuedUpdates=new Map;cleanUp(){this.resizeObserver?.disconnect(),this.observedNodes.clear(),this.timeoutID!=null&&clearTimeout(this.timeoutID)}resizeObserver;setup(t,e){this.resizeObserver??=new ResizeObserver(this.handleResizeObserver);const n=t.querySelectorAll("code"),r=new Map(this.observedNodes);this.observedNodes.clear();for(const o of n){let i=r.get(o);if(i!=null){this.observedNodes.set(o,i),r.delete(o);continue}let s=o.querySelector("[data-gutter]");s instanceof HTMLElement||(s=null),i={type:"code",codeElement:o,numberElement:s,codeWidth:"auto",numberWidth:0},this.observedNodes.set(o,i),this.resizeObserver.observe(o),s!=null&&(this.observedNodes.set(s,i),this.resizeObserver.observe(s))}if(n.length>1&&!e){const o=t.querySelectorAll('[data-line-annotation*=","]'),i=new Map;for(const s of o){if(!(s instanceof HTMLElement))continue;const{lineAnnotation:a=""}=s.dataset;if(!/^\d+,\d+$/.test(a)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:a,element:s});continue}let l=i.get(a);l==null&&(l=[],i.set(a,l)),l.push(s)}for(const[s,a]of i){if(a.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",s,a);continue}const[l,c]=a,d=l.firstElementChild,u=c.firstElementChild;if(!(l instanceof HTMLElement)||!(c instanceof HTMLElement)||!(d instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let f=r.get(d);if(f!=null){this.observedNodes.set(d,f),this.observedNodes.set(u,f),r.delete(d),r.delete(u);continue}f={type:"annotations",column1:{container:l,child:d,childHeight:d.getBoundingClientRect().height},column2:{container:c,child:u,childHeight:u.getBoundingClientRect().height},currentHeight:"auto"};const m=Math.max(f.column1.childHeight,f.column2.childHeight);this.applyNewHeight(f,m),this.observedNodes.set(d,f),this.observedNodes.set(u,f),this.resizeObserver.observe(d),this.resizeObserver.observe(u)}}for(const o of r.keys())o.isConnected&&(o.style.removeProperty("--diffs-column-content-width"),o.style.removeProperty("--diffs-column-number-width"),o.style.removeProperty("--diffs-column-width"),o.parentElement instanceof HTMLElement&&o.parentElement.style.removeProperty("--diffs-annotation-min-height")),this.resizeObserver.unobserve(o);r.clear()}handleResizeObserver=t=>{for(const e of t){const{target:n,borderBoxSize:r}=e;if(!(n instanceof HTMLElement)){console.error("FileDiff.handleResizeObserver: Invalid element for ResizeObserver",e);continue}const o=this.observedNodes.get(n);if(o==null){console.error("FileDiff.handleResizeObserver: Not a valid observed node",e);continue}const i=r[0];if(o.type==="annotations"){const s=(()=>{if(n===o.column1.child)return o.column1;if(n===o.column2.child)return o.column2})();if(s==null){console.error("FileDiff.handleResizeObserver: Couldn't find a column for",{item:o,target:n});continue}s.childHeight=i.blockSize;const a=Math.max(o.column1.childHeight,o.column2.childHeight);this.applyNewHeight(o,a)}else o.type==="code"&&(this.queuedUpdates.set(n,[o,i]),this.queueColumnUpdate())}};queueColumnUpdate(){this.timeoutID!=null&&clearTimeout(this.timeoutID),this.timeoutID=setTimeout(this.handleColumnChange,1e3/30)}handleColumnChange=()=>{this.timeoutID=void 0;for(const[t,[e,n]]of this.queuedUpdates)if(t===e.codeElement){const r=Math.max(Math.floor(n.inlineSize),0);if(r!==e.codeWidth){e.codeWidth=r;const o=Math.max(e.codeWidth-e.numberWidth,0);e.codeElement.style.setProperty("--diffs-column-content-width",`${o===0?"auto":`${o}px`}`),e.codeElement.style.setProperty("--diffs-column-width",`${e.codeWidth===0?"auto":`${e.codeWidth}px`}`)}}else if(t===e.numberElement){const r=Math.max(Math.ceil(n.inlineSize),0);if(r!==e.numberWidth&&(e.numberWidth=r,e.codeElement.style.setProperty("--diffs-column-number-width",`${e.numberWidth===0?"auto":`${e.numberWidth}px`}`),e.codeWidth!=="auto")){const o=Math.max(e.codeWidth-e.numberWidth,0);e.codeElement.style.setProperty("--diffs-column-content-width",`${o===0?"auto":`${o}px`}`)}}this.queuedUpdates.clear()};applyNewHeight(t,e){e!==t.currentHeight&&(t.currentHeight=Math.max(e,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};const da=new Map,qf=new Map,$L=new Map,hh=new Set;function mp(t){for(const e of Array.isArray(t)?t:[t])if(!hh.has(e))return!1;return!0}function ik(t,e){t=Array.isArray(t)?t:[t];for(const n of t){if(hh.has(n.name))continue;let r=da.get(n.name);r==null&&(r=n,da.set(n.name,r)),hh.add(r.name),e.loadLanguageSync(r.data)}}function t6(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let jn=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function BL(t){return ov(t)}function ov(t){return Array.isArray(t)?VL(t):t instanceof RegExp?t:typeof t=="object"?UL(t):t}function VL(t){let e=[];for(let n=0,r=t.length;n{for(let r in n)t[r]=n[r]}),t}function r6(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?r6(t.substring(0,t.length-1)):t.substr(~e+1)}var Kf=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,eu=class{static hasCaptures(t){return t===null?!1:(Kf.lastIndex=0,Kf.test(t))}static replaceCaptures(t,e,n){return t.replace(Kf,(r,o,i,s)=>{let a=n[parseInt(o||i,10)];if(a){let l=e.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(s){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function o6(t,e){return te?1:0}function i6(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let o=0;othis._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(o=>HL(t.parent,o.parentScopes));return r?new l6(r.fontStyle,r.foreground,r.background):null}},Wf=class Hu{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Hu(e,r);return e}static from(...e){let n=null;for(let r=0;r"){if(n===e.length-1)return!1;r=e[++n],o=!0}for(;t&&!qL(t.scopeName,r);){if(o)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function qL(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var l6=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function KL(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let o=0,i=e.length;o1&&(h=p.slice(0,p.length-1),h.reverse()),n[r++]=new WL(g,h,o,l,c,d)}}return n}var WL=class{constructor(t,e,n,r,o,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=o,this.background=i}},ur=(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))(ur||{});function GL(t,e){t.sort((l,c)=>{let d=o6(l.scope,c.scope);return d!==0||(d=i6(l.parentScopes,c.parentScopes),d!==0)?d:l.index-c.index});let n=0,r="#000000",o="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(o=l.background)}let i=new ZL(e),s=new l6(n,i.getId(r),i.getId(o)),a=new QL(new vh(0,null,-1,0,0),[]);for(let l=0,c=t.length;le?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),o!==0&&(this.background=o)}},QL=class bh{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,o=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[o]===">"&&o++,!(r>=e.parentScopes.length||o>=n.parentScopes.length);){const i=n.parentScopes[o].length-e.parentScopes[r].length;if(i!==0)return i;r++,o++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),o,i;if(r===-1?(o=e,i=""):(o=e.substring(0,r),i=e.substring(r+1)),this._children.hasOwnProperty(o))return this._children[o].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(bh._cmpBySpecificity),n}insert(e,n,r,o,i,s){if(n===""){this._doInsertHere(e,r,o,i,s);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new bh(this._mainRule.clone(),vh.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(e+1,c,r,o,i,s)}_doInsertHere(e,n,r,o,i){if(n===null){this._mainRule.acceptOverwrite(e,r,o,i);return}for(let s=0,a=this._rulesWithParentScopes.length;s>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,o,i,s,a){let l=po.getLanguageId(e),c=po.getTokenType(e),d=po.containsBalancedBrackets(e)?1:0,u=po.getFontStyle(e),f=po.getForeground(e),m=po.getBackground(e);return n!==0&&(l=n),r!==8&&(c=r),o!==null&&(d=o?1:0),i!==-1&&(u=i),s!==0&&(f=s),a!==0&&(m=a),(l<<0|c<<8|d<<10|u<<11|f<<15|m<<24)>>>0}};function gp(t,e){const n=[],r=XL(t);let o=r.next();for(;o!==null;){let l=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=r.next()}let c=s();if(n.push({matcher:c,priority:l}),o!==",")break;o=r.next()}return n;function i(){if(o==="-"){o=r.next();const l=i();return c=>!!l&&!l(c)}if(o==="("){o=r.next();const l=a();return o===")"&&(o=r.next()),l}if(ak(o)){const l=[];do l.push(o),o=r.next();while(ak(o));return c=>e(l,c)}return null}function s(){const l=[];let c=i();for(;c;)l.push(c),c=i();return d=>l.every(u=>u(d))}function a(){const l=[];let c=s();for(;c&&(l.push(c),o==="|"||o===",");){do o=r.next();while(o==="|"||o===",");c=s()}return d=>l.some(u=>u(d))}}function ak(t){return!!t&&!!t.match(/[\w\.:]+/)}function XL(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function d6(t){typeof t.dispose=="function"&&t.dispose()}var Fc=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},YL=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},eP=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},tP=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Fc(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new eP;for(const n of t)nP(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Fc){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function nP(t,e,n,r){const o=n.lookup(t.scopeName);if(!o){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof Fc?qu({baseGrammar:i,selfGrammar:o},r):yh(t.ruleName,{baseGrammar:i,selfGrammar:o,repository:o.repository},r);const s=n.injections(t.scopeName);if(s)for(const a of s)r.add(new Fc(a))}function yh(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];hp([r],e,n)}}function qu(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&hp(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&hp(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function hp(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const o=r.repository?n6({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&hp(r.patterns,{...e,repository:o},n);const i=r.include;if(!i)continue;const s=u6(i);switch(s.kind){case 0:qu({...e,selfGrammar:e.baseGrammar},n);break;case 1:qu(e,n);break;case 2:yh(s.ruleName,{...e,repository:o},n);break;case 3:case 4:const a=s.scopeName===e.selfGrammar.scopeName?e.selfGrammar:s.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){const l={baseGrammar:e.baseGrammar,selfGrammar:a,repository:o};s.kind===4?yh(s.ruleName,l,n):qu(l,n)}else s.kind===4?n.add(new YL(s.scopeName,s.ruleName)):n.add(new Fc(s.scopeName));break}}}var rP=class{kind=0},oP=class{kind=1},iP=class{constructor(t){this.ruleName=t}kind=2},sP=class{constructor(t){this.scopeName=t}kind=3},aP=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function u6(t){if(t==="$base")return new rP;if(t==="$self")return new oP;const e=t.indexOf("#");if(e===-1)return new sP(t);if(e===0)return new iP(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new aP(n,r)}}var lP=/\\(\d+)/,lk=/\\(\d+)/g,cP=-1,p6=-2;var ud=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=eu.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=eu.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${r6(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:eu.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:eu.replaceCaptures(this._contentName,t,e)}},dP=class extends ud{retokenizeCapturedWithRuleId;constructor(t,e,n,r,o){super(t,e,n,r),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},uP=class extends ud{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,o){super(t,e,n,null),this._match=new $c(r,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Bc,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ck=class extends ud{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,o){super(t,e,n,r),this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Bc,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},kh=class extends ud{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,o,i,s,a,l,c){super(t,e,n,r),this._begin=new $c(o,this.id),this.beginCaptures=i,this._end=new $c(s||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Bc;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},vp=class extends ud{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,o,i,s,a,l){super(t,e,n,r),this._begin=new $c(o,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new $c(s,p6),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Bc;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Bc,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},m6=class lr{static createCaptureRule(e,n,r,o,i){return e.registerRule(s=>new dP(n,s,r,o,i))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(o=>{if(e.id=o,e.match)return new uP(e.$vscodeTextmateLocation,e.id,e.name,e.match,lr._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=n6({},r,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new ck(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,lr._compilePatterns(i,n,r))}return e.while?new vp(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,lr._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,lr._compileCaptures(e.whileCaptures||e.captures,n,r),lr._compilePatterns(e.patterns,n,r)):new kh(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,lr._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,lr._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,lr._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let o=[];if(e){let i=0;for(const s in e){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);a>i&&(i=a)}for(let s=0;s<=i;s++)o[s]=null;for(const s in e){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);let l=0;e[s].patterns&&(l=lr.getCompiledRuleId(e[s],n,r)),o[a]=lr.createCaptureRule(n,e[s].$vscodeTextmateLocation,e[s].name,e[s].contentName,l)}}return o}static _compilePatterns(e,n,r){let o=[];if(e)for(let i=0,s=e.length;ie.substring(o.start,o.end));return lk.lastIndex=0,this.source.replace(lk,(o,i)=>s6(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],o=[],i,s,a,l;for(i=0,s=this.source.length;in.source);this._cached=new dk(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(o=>o.resolveAnchors(e,n));return new dk(t,r,this._items.map(o=>o.ruleId))}},dk=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new Gf(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(wh.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},mP=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>s6(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},uk=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function g6(t,e,n,r,o,i,s,a){const l=e.content.length;let c=!1,d=-1;if(s){const m=fP(t,e,n,r,o,i);o=m.stack,r=m.linePos,n=m.isFirstLine,d=m.anchorPosition}const u=Date.now();for(;!c;){if(a!==0&&Date.now()-u>a)return new uk(o,!0);f()}return new uk(o,!1);function f(){const m=gP(t,e,n,r,o,d);if(!m){i.produce(o,l),c=!0;return}const p=m.captureIndices,g=m.matchedRuleId,h=p&&p.length>0?p[0].end>r:!1;if(g===cP){const k=o.getRule(t);i.produce(o,p[0].start),o=o.withContentNameScopesList(o.nameScopesList),fc(t,e,n,o,i,k.endCaptures,p),i.produce(o,p[0].end);const y=o;if(o=o.parent,d=y.getAnchorPos(),!h&&y.getEnterPos()===r){o=y,i.produce(o,l),c=!0;return}}else{const k=t.getRule(g);i.produce(o,p[0].start);const y=o,w=k.getName(e.content,p),A=o.contentNameScopesList.pushAttributed(w,t);if(o=o.push(g,r,d,p[0].end===l,null,A,A),k instanceof kh){const b=k;fc(t,e,n,o,i,b.beginCaptures,p),i.produce(o,p[0].end),d=p[0].end;const x=b.getContentName(e.content,p),I=A.pushAttributed(x,t);if(o=o.withContentNameScopesList(I),b.endHasBackReferences&&(o=o.withEndRule(b.getEndWithResolvedBackReferences(e.content,p))),!h&&y.hasSameRuleAs(o)){o=o.pop(),i.produce(o,l),c=!0;return}}else if(k instanceof vp){const b=k;fc(t,e,n,o,i,b.beginCaptures,p),i.produce(o,p[0].end),d=p[0].end;const x=b.getContentName(e.content,p),I=A.pushAttributed(x,t);if(o=o.withContentNameScopesList(I),b.whileHasBackReferences&&(o=o.withEndRule(b.getWhileWithResolvedBackReferences(e.content,p))),!h&&y.hasSameRuleAs(o)){o=o.pop(),i.produce(o,l),c=!0;return}}else if(fc(t,e,n,o,i,k.captures,p),i.produce(o,p[0].end),o=o.pop(),!h){o=o.safePop(),i.produce(o,l),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function fP(t,e,n,r,o,i){let s=o.beginRuleCapturedEOL?0:-1;const a=[];for(let l=o;l;l=l.pop()){const c=l.getRule(t);c instanceof vp&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:d}=bP(l.rule,t,l.stack.endRule,n,r===s),u=c.findNextMatchSync(e,r,d);if(u){if(u.ruleId!==p6){o=l.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(i.produce(l.stack,u.captureIndices[0].start),fc(t,e,n,l.stack,i,l.rule.whileCaptures,u.captureIndices),i.produce(l.stack,u.captureIndices[0].end),s=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{o=l.stack.pop();break}}return{stack:o,linePos:r,anchorPosition:s,isFirstLine:n}}function gP(t,e,n,r,o,i){const s=hP(t,e,n,r,o,i),a=t.getInjections();if(a.length===0)return s;const l=vP(a,t,e,n,r,o,i);if(!l)return s;if(!s)return l;const c=s.captureIndices[0].start,d=l.captureIndices[0].start;return d=a)&&(a=w,l=y.captureIndices,c=y.ruleId,d=p.priority,a===o))break}return l?{priorityMatch:d===-1,captureIndices:l,matchedRuleId:c}:null}function h6(t,e,n,r,o){return{ruleScanner:t.compileAG(e,n,r,o),findOptions:0}}function bP(t,e,n,r,o){return{ruleScanner:t.compileWhileAG(e,n,r,o),findOptions:0}}function fc(t,e,n,r,o,i,s){if(i.length===0)return;const a=e.content,l=Math.min(i.length,s.length),c=[],d=s[0].end;for(let u=0;ud)break;for(;c.length>0&&c[c.length-1].endPos<=m.start;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?o.produceFromScopes(c[c.length-1].scopes,m.start):o.produce(r,m.start),f.retokenizeCapturedWithRuleId){const g=f.getName(a,s),h=r.contentNameScopesList.pushAttributed(g,t),k=f.getContentName(a,s),y=h.pushAttributed(k,t),w=r.push(f.retokenizeCapturedWithRuleId,m.start,-1,!1,null,h,y),A=t.createOnigString(a.substring(0,m.end));g6(t,A,n&&m.start===0,m.start,w,o,!1,0),d6(A);continue}const p=f.getName(a,s);if(p!==null){const h=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);c.push(new yP(h,m.end))}}for(;c.length>0;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var yP=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function kP(t,e,n,r,o,i,s,a){return new xP(t,e,n,r,o,i,s,a)}function pk(t,e,n,r,o){const i=gp(e,bp),s=m6.getCompiledRuleId(n,r,o.repository);for(const a of i)t.push({debugSelector:e,matcher:a.matcher,ruleId:s,grammar:o,priority:a.priority})}function bp(t,e){if(e.length{for(let o=n;on&&t.substr(0,n)===e&&t[n]==="."}var xP=class{constructor(t,e,n,r,o,i,s,a){if(this._rootScopeName=t,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new pP(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=s,this._grammar=mk(e,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const l of Object.keys(o)){const c=gp(l,bp);for(const d of c)this._tokenTypeMatchers.push({matcher:d.matcher,type:o[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)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(){const t={lookup:o=>o===this._rootScopeName?this._grammar:this.getExternalGrammar(o),injections:o=>this._grammarRepository.injections(o)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const o=r.injections;if(o)for(let s in o)pk(e,s,o[s],this,r);const i=this._grammarRepository.injections(n);i&&i.forEach(s=>{const a=this.getExternalGrammar(s);if(a){const l=a.injectionSelector;l&&pk(e,l,a,this,a)}})}return e.sort((o,i)=>o.priority-i.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=mk(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=m6.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let o;if(!e||e===xh.NULL){o=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),u=yl.set(0,c.languageId,c.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),f=this.getRule(this._rootId).getName(null,null);let m;f?m=Ec.createRootAndLookUpScopeName(f,u,this):m=Ec.createRoot("unknown",u),e=new xh(null,this._rootId,-1,-1,!1,null,m,m)}else o=!1,e.reset();t=t+` `;const i=this.createOnigString(t),s=i.content.length,a=new AP(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),l=g6(this,i,o,0,e,a,!0,r);return d6(i),{lineLength:s,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function mk(t,e){return t=BL(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var Ec=class ri{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,o=e?.scopePath??null;for(const i of n)o=Wf.push(o,i.scopeNames),r=new ri(r,o,i.encodedTokenAttributes);return r}static createRoot(e,n){return new ri(null,new Wf(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const o=r.getMetadataForScope(e),i=new Wf(null,e),s=r.themeProvider.themeMatch(i),a=ri.mergeAttributes(n,o,s);return new ri(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return ri.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let o=-1,i=0,s=0;return r!==null&&(o=r.fontStyle,i=r.foregroundId,s=r.backgroundId),yl.set(e,n.languageId,n.tokenType,null,o,i,s)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return ri._pushAttributed(this,e,n);const r=e.split(/ /g);let o=this;for(const i of r)o=ri._pushAttributed(o,i,n);return o}static _pushAttributed(e,n,r){const o=r.getMetadataForScope(n),i=e.scopePath.push(n),s=r.themeProvider.themeMatch(i),a=ri.mergeAttributes(e.tokenAttributes,o,s);return new ri(e,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},xh=class Js{constructor(e,n,r,o,i,s,a,l){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=s,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=o}_stackElementBrand=void 0;static NULL=new Js(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:Js._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?Ec.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){Js._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,o,i,s,a){return new Js(this,e,n,r,o,i,s,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new Js(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const r=Ec.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new Js(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Ec.fromExtension(r,n.contentNameScopesList))}},SP=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):gp(n,bp).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>gp(n,bp).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},AP=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,o=!1;if(this.balancedBracketSelectors?.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=t?.getScopeNames()??[];for(const s of this._tokenTypeOverrides)s.matcher(i)&&(r=yl.set(r,0,s.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(i))}if(o&&(r=yl.set(r,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,o=this._binaryTokens.length;r0;)s.Q.map(a=>this._loadSingleGrammar(a.scopeName)),s.processQueue();return this._grammarForScopeName(e,n,r,o,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,o=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,o)}_grammarForScopeName(e,n=0,r=null,o=null,i=null){return this._syncRegistry.grammarForScopeName(e,n,r,o,i)}},Sh=xh.NULL;const TP=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class pd{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}pd.prototype.normal={};pd.prototype.property={};pd.prototype.space=void 0;function v6(t,e){const n={},r={};for(const o of t)Object.assign(n,o.property),Object.assign(r,o.normal);return new pd(n,r,e)}function Ah(t){return t.toLowerCase()}let Or=class{constructor(e,n){this.attribute=n,this.property=e}};Or.prototype.attribute="";Or.prototype.booleanish=!1;Or.prototype.boolean=!1;Or.prototype.commaOrSpaceSeparated=!1;Or.prototype.commaSeparated=!1;Or.prototype.defined=!1;Or.prototype.mustUseProperty=!1;Or.prototype.number=!1;Or.prototype.overloadedBoolean=!1;Or.prototype.property="";Or.prototype.spaceSeparated=!1;Or.prototype.space=void 0;let EP=0;const gt=Sa(),Dn=Sa(),Ch=Sa(),Me=Sa(),rn=Sa(),cl=Sa(),Hr=Sa();function Sa(){return 2**++EP}const Ih=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:Dn,commaOrSpaceSeparated:Hr,commaSeparated:cl,number:Me,overloadedBoolean:Ch,spaceSeparated:rn},Symbol.toStringTag,{value:"Module"})),Zf=Object.keys(Ih);class iv extends Or{constructor(e,n,r,o){let i=-1;if(super(e,n),fk(this,"space",o),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&_P.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(gk,OP);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!gk.test(i)){let s=i.replace(PP,zP);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}o=iv}return new o(r,e)}function zP(t){return"-"+t.toLowerCase()}function OP(t){return t.charAt(1).toUpperCase()}const jP=v6([b6,MP,w6,x6,S6],"html"),A6=v6([b6,LP,w6,x6,S6],"svg"),hk={}.hasOwnProperty;function RP(t,e){const n=e||{};function r(o,...i){let s=r.invalid;const a=r.handlers;if(o&&hk.call(o,t)){const l=String(o[t]);s=hk.call(a,l)?a[l]:r.unknown}if(s)return s.call(this,o,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const NP=/["&'<>`]/g,FP=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,$P=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,BP=/[|\\{}()[\]^$+*?.]/g,vk=new WeakMap;function VP(t,e){if(t=t.replace(e.subset?UP(e.subset):NP,r),e.subset||e.escapeOnly)return t;return t.replace(FP,n).replace($P,r);function n(o,i,s){return e.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,s.charCodeAt(i+2),e)}function r(o,i,s){return e.format(o.charCodeAt(0),s.charCodeAt(i+1),e)}}function UP(t){let e=vk.get(t);return e||(e=HP(t),vk.set(t,e)),e}function HP(t){const e=[];let n=-1;for(;++n",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:"€"},JP=["cent","copy","divide","gt","lt","not","para","times"],C6={}.hasOwnProperty,Th={};let tu;for(tu in Jf)C6.call(Jf,tu)&&(Th[Jf[tu]]=tu);const QP=/[^\dA-Za-z]/;function XP(t,e,n,r){const o=String.fromCharCode(t);if(C6.call(Th,o)){const i=Th[o],s="&"+i;return n&&ZP.includes(i)&&!JP.includes(i)&&(!r||e&&e!==61&&QP.test(String.fromCharCode(e)))?s:s+";"}return""}function YP(t,e,n){let r=KP(t,e,n.omitOptionalSemicolons),o;if((n.useNamedReferences||n.useShortestReferences)&&(o=XP(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){const i=GP(t,e,n.omitOptionalSemicolons);i.length|^->||--!>|"],n_=["<",">"];function r_(t,e,n,r){return r.settings.bogusComments?"":"";function o(i){return dl(i,Object.assign({},r.settings.characterReferences,{subset:n_}))}}function o_(t,e,n,r){return""}function bk(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(e);for(;o!==-1;)r++,o=n.indexOf(e,o+e.length);return r}function i_(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function s_(t){return t.join(" ").trim()}const a_=/[ \t\n\f\r]/g;function sv(t){return typeof t=="object"?t.type==="text"?yk(t.value):!1:yk(t)}function yk(t){return t.replace(a_,"")===""}const Gn=T6(1),I6=T6(-1),l_=[];function T6(t){return e;function e(n,r,o){const i=n?n.children:l_;let s=(r||0)+t,a=i[s];if(!o)for(;a&&sv(a);)s+=t,a=i[s];return a}}const c_={}.hasOwnProperty;function E6(t){return e;function e(n,r,o){return c_.call(t,n.tagName)&&t[n.tagName](n,r,o)}}const av=E6({body:u_,caption:Qf,colgroup:Qf,dd:g_,dt:f_,head:Qf,html:d_,li:m_,optgroup:h_,option:v_,p:p_,rp:kk,rt:kk,tbody:y_,td:wk,tfoot:k_,th:wk,thead:b_,tr:w_});function Qf(t,e,n){const r=Gn(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&sv(r.value.charAt(0)))}function d_(t,e,n){const r=Gn(n,e);return!r||r.type!=="comment"}function u_(t,e,n){const r=Gn(n,e);return!r||r.type!=="comment"}function p_(t,e,n){const r=Gn(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function m_(t,e,n){const r=Gn(n,e);return!r||r.type==="element"&&r.tagName==="li"}function f_(t,e,n){const r=Gn(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function g_(t,e,n){const r=Gn(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function kk(t,e,n){const r=Gn(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function h_(t,e,n){const r=Gn(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function v_(t,e,n){const r=Gn(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function b_(t,e,n){const r=Gn(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function y_(t,e,n){const r=Gn(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function k_(t,e,n){return!Gn(n,e)}function w_(t,e,n){const r=Gn(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function wk(t,e,n){const r=Gn(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const x_=E6({body:C_,colgroup:I_,head:A_,html:S_,tbody:T_});function S_(t){const e=Gn(t,-1);return!e||e.type!=="comment"}function A_(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function C_(t){const e=Gn(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&sv(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function I_(t,e,n){const r=I6(n,e),o=Gn(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&av(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function T_(t,e,n){const r=I6(n,e),o=Gn(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&av(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const nu={name:[[` \f\r &/=>`.split(""),` \f\r "&'/=>\``.split("")],[`\0 \f\r "&'/<=>`.split(""),`\0 \f\r "&'/<=>\``.split("")]],unquoted:[[` \f\r &>`.split(""),`\0 \f\r "&'<=>\``.split("")],[`\0 \f\r "&'<=>\``.split(""),`\0 \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function E_(t,e,n,r){const o=r.schema,i=o.space==="svg"?!1:r.settings.omitOptionalTags;let s=o.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;o.space==="html"&&t.tagName==="svg"&&(r.schema=A6);const c=M_(r,t.properties),d=r.all(o.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=o,d&&(s=!1),(c||!i||!x_(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),s&&(o.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(d),!s&&(!i||!av(t,e,n))&&a.push(""),a.join("")}function M_(t,e){const n=[];let r=-1,o;if(e){for(o in e)if(e[o]!==null&&e[o]!==void 0){const i=L_(t,o,e[o]);i&&n.push(i)}}for(;++rbk(n,t.alternative)&&(s=t.alternative),a=s+dl(n,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?nu.single:nu.double)[o][i],attribute:!0}))+s),l+(a&&"="+a))}const P_=["<","&"];function M6(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:dl(t.value,Object.assign({},r.settings.characterReferences,{subset:P_}))}function __(t,e,n,r){return r.settings.allowDangerousHtml?t.value:M6(t,e,n,r)}function D_(t,e,n,r){return r.all(t)}const z_=RP("type",{invalid:O_,unknown:j_,handlers:{comment:r_,doctype:o_,element:E_,raw:__,root:D_,text:M6}});function O_(t){throw new Error("Expected node, not `"+t+"`")}function j_(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const R_={},N_={},F_=[];function qi(t,e){const n=e||R_,r=n.quote||'"',o=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:$_,all:B_,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||TP,characterReferences:n.characterReferences||N_,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?A6:jP,quote:r,alternative:o}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function $_(t,e,n){return z_(t,e,n,this)}function B_(t){const e=[],n=t&&t.children||F_;let r=-1;for(;++re.default||e)}function lv(t){return!t||["plaintext","txt","text","plain"].includes(t)}function P6(t){return t==="ansi"||lv(t)}function cv(t){return t==="none"}function _6(t){return cv(t)}function D6(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}function hm(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(/(\r?\n)/g);let r=0;const o=[];for(let i=0;io);function n(o){if(o===t.length)return{line:e.length-1,character:e[e.length-1].length};let i=o,s=0;for(const a of e){if(in&&r.push({...t,content:t.content.slice(n,o),offset:t.offset+n}),n=o;return nr-o);return n.length?t.map(r=>r.flatMap(o=>{const i=n.filter(s=>o.offsets-o.offset).sort((s,a)=>s-a);return i.length?q_(o,i):o})):t}function W_(t,e,n,r,o="css-vars"){const i={content:t.content,explanation:t.explanation,offset:t.offset},s=e.map(d=>kp(t.variants[d])),a=new Set(s.flatMap(d=>Object.keys(d))),l={},c=(d,u)=>{const f=u==="color"?"":u==="background-color"?"-bg":`-${u}`;return n+e[d]+(u==="color"?"":f)};return s.forEach((d,u)=>{for(const f of a){const m=d[f]||"inherit";if(u===0&&r&&H_.includes(f))if(r===dv&&s.length>1){const p=e.findIndex(y=>y==="light"),g=e.findIndex(y=>y==="dark");if(p===-1||g===-1)throw new jn('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const h=s[p][f]||"inherit",k=s[g][f]||"inherit";l[f]=`light-dark(${h}, ${k})`,o==="css-vars"&&(l[c(u,f)]=m)}else l[f]=m;else o==="css-vars"&&(l[c(u,f)]=m)}}),i.htmlStyle=l,i}function kp(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&ur.Italic&&(e["font-style"]="italic"),t.fontStyle&ur.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&ur.Underline&&n.push("underline"),t.fontStyle&ur.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function Eh(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const z6=new WeakMap;function vm(t,e){z6.set(t,e)}function Vc(t){return z6.get(t)}class Rl{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new Rl(Object.fromEntries(V_(n).map(r=>[r,Sh])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,o]=e;this.lang=r,this._stacks={[o]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return G_(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function G_(t){const e=[],n=new Set;function r(o){if(n.has(o))return;n.add(o);const i=o?.nameScopesList?.scopeName;i&&e.push(i),o.parent&&r(o.parent)}return r(t),e}function Z_(t,e){if(!(t instanceof Rl))throw new jn("Invalid grammar state");return t.getInternalStack(e)}function J_(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(s){if(typeof s=="number"){if(s<0||s>n.source.length)throw new jn(`Invalid decoration offset: ${s}. Code length: ${n.source.length}`);return{...o.indexToPos(s),offset:s}}else{const a=o.lines[s.line];if(a===void 0)throw new jn(`Invalid decoration position ${JSON.stringify(s)}. Lines length: ${o.lines.length}`);let l=s.character;if(l<0&&(l=a.length+l),l<0||l>a.length)throw new jn(`Invalid decoration position ${JSON.stringify(s)}. Line ${s.line} length: ${a.length}`);return{...s,character:l,offset:o.posToIndex(s.line,l)}}};const o=U_(n.source),i=(n.options.decorations||[]).map(s=>({...s,start:r(s.start),end:r(s.end)}));Q_(i),t.set(n.meta,{decorations:i,converter:o,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const o=e(this).decorations.flatMap(s=>[s.start.offset,s.end.offset]);return K_(n,o)},code(n){if(!this.options.decorations?.length)return;const r=e(this),o=Array.from(n.children).filter(d=>d.type==="element"&&d.tagName==="span");if(o.length!==r.converter.lines.length)throw new jn(`Number of lines in code element (${o.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(d,u,f,m){const p=o[d];let g="",h=-1,k=-1;if(u===0&&(h=0),f===0&&(k=0),f===Number.POSITIVE_INFINITY&&(k=p.children.length),h===-1||k===-1)for(let w=0;wg);return d.tagName=u.tagName||"span",d.properties={...d.properties,...m,class:d.properties.class},u.properties?.class&&D6(d,u.properties.class),d=p(d,f)||d,d}const l=[],c=r.decorations.sort((d,u)=>u.start.offset-d.start.offset||d.end.offset-u.end.offset);for(const d of c){const{start:u,end:f}=d;if(u.line===f.line)i(u.line,u.character,f.character,d);else if(u.lines(m,d));i(f.line,0,f.character,d)}}l.forEach(d=>d())}}}function Q_(t){for(let e=0;en.end.offset)throw new jn(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;rNumber.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function tD(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)Xf[r]&&e.push({type:"setDecoration",value:Xf[r]});else if(r<=29){const o=Xf[r-20];o&&(e.push({type:"resetDecoration",value:o}),o==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:ea[r-30]}});else if(r===38){const o=xk(t);o&&e.push({type:"setForegroundColor",value:o})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:ea[r-40]}});else if(r===48){const o=xk(t);o&&e.push({type:"setBackgroundColor",value:o})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:ea[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:ea[r-100+8]}})}return e}function nD(){let t=null,e=null,n=new Set;return{parse(r){const o=[];let i=0;do{const s=eD(r,i),a=s.sequence?r.substring(i,s.startPosition):r.substring(i);if(a.length>0&&o.push({value:a,foreground:t,background:e,decorations:new Set(n)}),s.sequence){const l=tD(s.sequence);for(const c of l)c.type==="resetAll"?(t=null,e=null,n.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&n.add(c.value)}i=s.position}while(iMath.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function o(){if(r)return r;r=[];for(let c=0;c{const c=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,d=t.colors?.[c];return[l,d||iD[l]]})),s=oD(i),a=nD();return o.map(l=>a.parse(l[0]).map(c=>{let d,u;c.decorations.has("reverse")?(d=c.background?s.value(c.background):t.bg,u=c.foreground?s.value(c.foreground):t.fg):(d=c.foreground?s.value(c.foreground):t.fg,u=c.background?s.value(c.background):void 0),d=Ss(d,r),u=Ss(u,r),c.decorations.has("dim")&&(d=aD(d));let f=ur.None;return c.decorations.has("bold")&&(f|=ur.Bold),c.decorations.has("italic")&&(f|=ur.Italic),c.decorations.has("underline")&&(f|=ur.Underline),c.decorations.has("strikethrough")&&(f|=ur.Strikethrough),{content:c.value,offset:l[1],color:d,bgColor:u,fontStyle:f}}))}function aD(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const r=e[1];if(r.length===8){const o=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${o}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const o=r[0],i=r[1],s=r[2],a=r[3],l=Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0");return`#${o}${o}${i}${i}${s}${s}${l}`}else if(r.length===3){const o=r[0],i=r[1],s=r[2];return`#${o}${o}${i}${i}${s}${s}80`}}}const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function uv(t,e,n={}){const{theme:r=t.getLoadedThemes()[0]}=n,o=t.resolveLangAlias(n.lang||"text");if(lv(o)||cv(r))return hm(e).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:s}=t.setTheme(r);if(o==="ansi")return sD(i,e,n);const a=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==a.name)throw new jn(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new jn(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return cD(e,a,i,s,n)}function lD(...t){if(t.length===2)return Vc(t[1]);const[e,n,r={}]=t,{lang:o="text",theme:i=e.getLoadedThemes()[0]}=r;if(lv(o)||cv(i))throw new jn("Plain language does not have grammar state");if(o==="ansi")throw new jn("ANSI language does not have grammar state");const{theme:s,colorMap:a}=e.setTheme(i),l=e.getLanguage(o);return new Rl(pv(n,l,s,a,r).stateStack,l.name,s.name)}function cD(t,e,n,r,o){const i=pv(t,e,n,r,o),s=new Rl(i.stateStack,e.name,n.name);return vm(i.tokens,s),i.tokens}function pv(t,e,n,r,o){const i=yp(n,o),{tokenizeMaxLineLength:s=0,tokenizeTimeLimit:a=500}=o,l=hm(t);let c=o.grammarState?Z_(o.grammarState,n.name)??Sh:o.grammarContextCode!=null?pv(o.grammarContextCode,e,n,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:Sh,d=[];const u=[];for(let f=0,m=l.length;f0&&p.length>=s){d=[],u.push([{content:p,offset:g,color:"",fontStyle:0}]);continue}let h,k,y;o.includeExplanation&&(h=e.tokenizeLine(p,c,a),k=h.tokens,y=0);const w=e.tokenizeLine2(p,c,a),A=w.tokens.length/2;for(let b=0;bO.trim());break;case"object":L=C.scope;break;default:continue}R.push({settings:C,selectors:L.map(O=>O.split(/ /))})}N.explanation=[];let M=0;for(;x+M({scopeName:e}))}function uD(t,e){const n=[];for(let r=0,o=e.length;r=0&&o>=0;)Sk(t[r],n[o])&&(r-=1),o-=1;return r===-1}function mD(t,e,n){const r=[];for(const{selectors:o,settings:i}of t)for(const s of o)if(pD(s,e,n)){r.push(i);break}return r}function j6(t,e,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=r.map(l=>{const c=uv(t,e,{...n,theme:l.theme}),d=Vc(c),u=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:d,theme:u}}),i=fD(...o.map(l=>l.tokens)),s=i[0].map((l,c)=>l.map((d,u)=>{const f={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=d.explanation),i.forEach((m,p)=>{const{content:g,explanation:h,offset:k,...y}=m[c][u];f.variants[r[p].color]=y}),f})),a=o[0].state?new Rl(Object.fromEntries(o.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),o[0].state.lang):void 0;return a&&vm(s,a),s}function fD(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;rl[r]),i=e.map(()=>[]);e.forEach((l,c)=>l.push(i[c]));const s=o.map(()=>0),a=o.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(c=>c.content.length));for(let c=0;ck[1]).map(k=>({color:k[0],theme:k[1]})).sort((k,y)=>k.color===c?-1:y.color===c?1:0);if(f.length===0)throw new jn("`themes` option must not be empty");const m=j6(t,e,n);if(l=Vc(m),c&&dv!==c&&!f.find(k=>k.color===c))throw new jn(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=f.map(k=>t.getTheme(k.theme)),g=f.map(k=>k.color);i=m.map(k=>k.map(y=>W_(y,g,d,c,u))),l&&vm(i,l);const h=f.map(k=>yp(k.theme,n));o=Ak(f,p,h,d,c,"fg",u),r=Ak(f,p,h,d,c,"bg",u),s=`shiki-themes ${p.map(k=>k.name).join(" ")}`,a=c?void 0:[o,r].join(";")}else if("theme"in n){const c=yp(n.theme,n);i=uv(t,e,n);const d=t.getTheme(n.theme);r=Ss(d.bg,c),o=Ss(d.fg,c),s=d.name,l=Vc(i)}else throw new jn("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:o,bg:r,themeName:s,rootStyle:a,grammarState:l}}function Ak(t,e,n,r,o,i,s){return t.map((a,l)=>{const c=Ss(e[l][i],n[l])||"inherit",d=`${r+a.color}${i==="bg"?"-bg":""}:${c}`;if(l===0&&o){if(o===dv&&t.length>1){const u=t.findIndex(g=>g.color==="light"),f=t.findIndex(g=>g.color==="dark");if(u===-1||f===-1)throw new jn('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const m=Ss(e[u][i],n[u])||"inherit",p=Ss(e[f][i],n[f])||"inherit";return`light-dark(${m}, ${p});${d}`}return c}return s==="css-vars"?d:null}).filter(a=>!!a).join(";")}function Sp(t,e,n,r={meta:{},options:n,codeToHast:(o,i)=>Sp(t,o,i),codeToTokens:(o,i)=>xp(t,o,i)}){let o=e;for(const p of wp(n))o=p.preprocess?.call(r,o,n)||o;let{tokens:i,fg:s,bg:a,themeName:l,rootStyle:c,grammarState:d}=xp(t,o,n);const{mergeWhitespaces:u=!0,mergeSameStyleTokens:f=!1}=n;u===!0?i=hD(i):u==="never"&&(i=vD(i)),f&&(i=bD(i));const m={...r,get source(){return o}};for(const p of wp(n))i=p.tokens?.call(m,i)||i;return gD(i,{...n,fg:s,bg:a,themeName:l,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},m,d)}function gD(t,e,n,r=Vc(t)){const o=wp(e),i=[],s={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=e,c={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?c.style=e.rootStyle:c.style=`background-color:${e.bg};color:${e.fg}`),l!==!1&&l!=null&&(c.tabindex=l.toString());for(const[g,h]of Object.entries(e.meta||{}))g.startsWith("_")||(c[g]=h);let d={type:"element",tagName:"pre",properties:c,children:[]},u={type:"element",tagName:"code",properties:{},children:i};const f=[],m={...n,structure:a,addClassToHast:D6,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return s},get pre(){return d},get code(){return u},get lines(){return f}};if(t.forEach((g,h)=>{h&&(a==="inline"?s.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:` `}));let k={type:"element",tagName:"span",properties:{class:"line"},children:[]},y=0;for(const w of g){let A={type:"element",tagName:"span",properties:{...w.htmlAttrs},children:[{type:"text",value:w.content}]};const b=Eh(w.htmlStyle||kp(w));b&&(A.properties.style=b);for(const x of o)A=x?.span?.call(m,A,h+1,y,k,w)||A;a==="inline"?s.children.push(A):a==="classic"&&k.children.push(A),y+=w.content.length}if(a==="classic"){for(const w of o)k=w?.line?.call(m,k,h+1)||k;f.push(k),i.push(k)}else a==="inline"&&f.push(k)}),a==="classic"){for(const g of o)u=g?.code?.call(m,u)||u;d.children.push(u);for(const g of o)d=g?.pre?.call(m,d)||d;s.children.push(d)}else if(a==="inline"){const g=[];let h={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const w of s.children)w.type==="element"&&w.tagName==="br"?(g.push(h),h={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(w.type==="element"||w.type==="text")&&h.children.push(w);g.push(h);let y={type:"element",tagName:"code",properties:{},children:g};for(const w of o)y=w?.code?.call(m,y)||y;s.children=[];for(let w=0;w0&&s.children.push({type:"element",tagName:"br",properties:{},children:[]});const A=y.children[w];A.type==="element"&&s.children.push(...A.children)}}let p=s;for(const g of o)p=g?.root?.call(m,p)||p;return r&&vm(p,r),p}function hD(t){return t.map(e=>{const n=[];let r="",o;return e.forEach((i,s)=>{const l=!(i.fontStyle&&(i.fontStyle&ur.Underline||i.fontStyle&ur.Strikethrough));l&&i.content.match(/^\s+$/)&&e[s+1]?(o===void 0&&(o=i.offset),r+=i.content):r?(l?n.push({...i,offset:o,content:r+i.content}):n.push({content:r,offset:o},i),o=void 0,r=""):n.push(i)}),n})}function vD(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,o,i,s]=r;if(!o&&!s)return n;const a=[{...n,offset:n.offset+o.length,content:i}];return o&&a.unshift({content:o,offset:n.offset}),s&&a.push({content:s,offset:n.offset+o.length+i.length}),a}))}function bD(t){return t.map(e=>{const n=[];for(const r of e){if(n.length===0){n.push({...r});continue}const o=n[n.length-1],i=Eh(o.htmlStyle||kp(o)),s=Eh(r.htmlStyle||kp(r)),a=o.fontStyle&&(o.fontStyle&ur.Underline||o.fontStyle&ur.Strikethrough),l=r.fontStyle&&(r.fontStyle&ur.Underline||r.fontStyle&ur.Strikethrough);!a&&!l&&i===s?o.content+=r.content:n.push({...r})}return n})}const yD=qi;function kD(t,e,n){const r={meta:{},options:n,codeToHast:(i,s)=>Sp(t,i,s),codeToTokens:(i,s)=>xp(t,i,s)};let o=yD(Sp(t,e,n,r));for(const i of wp(n))o=i.postprocess?.call(r,o,n)||o;return o}const Ck={light:"#333333",dark:"#bbbbbb"},Ik={light:"#fffffe",dark:"#1e1e1e"},Tk="__shiki_resolved";function bm(t){if(t?.[Tk])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const a=e.settings?e.settings.find(l=>!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?Ck.light:Ck.dark),n||(n=e.type==="light"?Ik.light:Ik.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let o=0;const i=new Map;function s(a){if(i.has(a))return i.get(a);o+=1;const l=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${l}`]?s(a):(i.set(a,l),l)}e.settings=e.settings.map(a=>{const l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),c=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!c)return a;const d={...a,settings:{...a.settings}};if(l){const u=s(a.settings.foreground);e.colorReplacements[u]=a.settings.foreground,d.settings.foreground=u}if(c){const u=s(a.settings.background);e.colorReplacements[u]=a.settings.background,d.settings.background=u}return d});for(const a of Object.keys(e.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!e.colors[a]?.startsWith("#")){const l=s(e.colors[a]);e.colorReplacements[l]=e.colors[a],e.colors[a]=l}return Object.defineProperty(e,Tk,{enumerable:!1,writable:!1,value:!0}),e}async function R6(t){return Array.from(new Set((await Promise.all(t.filter(e=>!P6(e)).map(async e=>await L6(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function N6(t){return(await Promise.all(t.map(async n=>_6(n)?null:bm(await L6(n))))).filter(n=>!!n)}let wD=3;function xD(t,e=3){e>wD||console.trace(`[SHIKI DEPRECATE]: ${t}`)}let ol=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function F6(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new ol(`Circular alias \`${Array.from(n).join(" -> ")} -> ${t}\``);n.add(t)}}return t}class SD extends IP{constructor(e,n,r,o={}){super(e),this._resolver=e,this._themes=n,this._langs=r,this._alias=o,this._themes.map(i=>this.loadTheme(i)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=bm(e);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let n=this._textmateThemeCache.get(e);n||(n=fp.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){return e=F6(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(i=>i.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const o=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(o.name=e.name,this._resolvedGrammars.set(e.name,o),e.aliases&&e.aliases.forEach(i=>{this._alias[i]=e.name}),this._loadedLanguagesCache=null,n.size)for(const i of n)this._resolvedGrammars.delete(i.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(i.scopeName),this._syncRegistry?._grammars?.delete(i.scopeName),this.loadLanguage(this._langMap.get(i.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const o of e)this.resolveEmbeddedLanguages(o);const n=Array.from(this._langGraph.entries()),r=n.filter(([o,i])=>!i);if(r.length){const o=n.filter(([i,s])=>s?(s.embeddedLanguages||s.embeddedLangs)?.some(l=>r.map(([c])=>c).includes(l)):!1).filter(i=>!r.includes(i));throw new ol(`Missing languages ${r.map(([i])=>`\`${i}\``).join(", ")}, required by ${o.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[o,i]of n)this._resolver.addLanguage(i);for(const[o,i]of n)this.loadLanguage(i)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const n=e.embeddedLanguages??e.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}}class AD{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let o=1;o<=n.length;o++){const i=n.slice(0,o).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let Yl=0;function CD(t){Yl+=1,t.warnings!==!1&&Yl>=10&&Yl%10===0&&console.warn(`[Shiki] ${Yl} 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 e=!1;if(!t.engine)throw new ol("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(bm),o=new AD(t.engine,n),i=new SD(o,r,n,t.langAlias);let s;function a(w){return F6(w,t.langAlias)}function l(w){k();const A=i.getGrammar(typeof w=="string"?w:w.name);if(!A)throw new ol(`Language \`${w}\` not found, you may need to load it first`);return A}function c(w){if(w==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};k();const A=i.getTheme(w);if(!A)throw new ol(`Theme \`${w}\` not found, you may need to load it first`);return A}function d(w){k();const A=c(w);s!==w&&(i.setTheme(A),s=w);const b=i.getColorMap();return{theme:A,colorMap:b}}function u(){return k(),i.getLoadedThemes()}function f(){return k(),i.getLoadedLanguages()}function m(...w){k(),i.loadLanguages(w.flat(1))}async function p(...w){return m(await R6(w))}function g(...w){k();for(const A of w.flat(1))i.loadTheme(A)}async function h(...w){return k(),g(await N6(w))}function k(){if(e)throw new ol("Shiki instance has been disposed")}function y(){e||(e=!0,i.dispose(),Yl-=1)}return{setTheme:d,getTheme:c,getLanguage:l,getLoadedThemes:u,getLoadedLanguages:f,resolveLangAlias:a,loadLanguage:p,loadLanguageSync:m,loadTheme:h,loadThemeSync:g,dispose:y,[Symbol.dispose]:y}}async function ID(t){t.engine||xD("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,r]=await Promise.all([N6(t.themes||[]),R6(t.langs||[]),t.engine]);return CD({...t,themes:e,langs:n,engine:r})}async function TD(t){const e=await ID(t);return{getLastGrammarState:(...n)=>lD(e,...n),codeToTokensBase:(n,r)=>uv(e,n,r),codeToTokensWithThemes:(n,r)=>j6(e,n,r),codeToTokens:(n,r)=>xp(e,n,r),codeToHast:(n,r)=>Sp(e,n,r),codeToHtml:(n,r)=>kD(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function ED(t){const e=t.langs,n=t.themes,r=t.engine;async function o(i){function s(u){if(typeof u=="string"){if(u=i.langAlias?.[u]||u,P6(u))return[];const f=e[u];if(!f)throw new jn(`Language \`${u}\` is not included in this bundle. You may want to load it from external source.`);return f}return u}function a(u){if(_6(u))return"none";if(typeof u=="string"){const f=n[u];if(!f)throw new jn(`Theme \`${u}\` is not included in this bundle. You may want to load it from external source.`);return f}return u}const l=(i.themes??[]).map(u=>a(u)),c=(i.langs??[]).map(u=>s(u)),d=await TD({engine:i.engine??r(),...i,themes:l,langs:c});return{...d,loadLanguage(...u){return d.loadLanguage(...u.map(s))},loadTheme(...u){return d.loadTheme(...u.map(a))},getBundledLanguages(){return e},getBundledThemes(){return n}}}return o}const $6=[{id:"abap",name:"ABAP",import:(()=>F(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>F(()=>import("./actionscript-3-CfeIJUat.js"),[]))},{id:"ada",name:"Ada",import:(()=>F(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>F(()=>import("./angular-html-CU67Zn6k.js").then(t=>t.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>F(()=>import("./angular-ts-BwZT4LLn.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>F(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>F(()=>import("./apex-DDbsPZ6N.js"),[]))},{id:"apl",name:"APL",import:(()=>F(()=>import("./apl-dKokRX4l.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>F(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>F(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>F(()=>import("./asciidoc-Dv7Oe6Be.js"),[]))},{id:"asm",name:"Assembly",import:(()=>F(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>F(()=>import("./astro-CbQHKStN.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>F(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>F(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>F(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>F(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>F(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>F(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>F(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"blade",name:"Blade",import:(()=>F(()=>import("./blade-DVc8C-J4.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>F(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>F(()=>import("./c-BIGW1oBm.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>F(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>F(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>F(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>F(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>F(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>F(()=>import("./cobol-nwyudZeR.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>F(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>F(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>F(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>F(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>F(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>F(()=>import("./cpp-CofmeUqb.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>F(()=>import("./crystal-tKQVLTB8.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>F(()=>import("./csharp-K5feNrxe.js"),[]))},{id:"css",name:"CSS",import:(()=>F(()=>import("./css-DPfMkruS.js"),[]))},{id:"csv",name:"CSV",import:(()=>F(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>F(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>F(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>F(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>F(()=>import("./dart-CF10PKvl.js"),[]))},{id:"dax",name:"DAX",import:(()=>F(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>F(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>F(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>F(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>F(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>F(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>F(()=>import("./edge-BkV0erSs.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>F(()=>import("./elixir-CDX3lj18.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>F(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>F(()=>import("./emacs-lisp-C9XAeP06.js"),[]))},{id:"erb",name:"ERB",import:(()=>F(()=>import("./erb-BOJIQeun.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>F(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>F(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>F(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>F(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>F(()=>import("./fortran-fixed-form-BZjJHVRy.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>F(()=>import("./fortran-free-form-D22FLkUw.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>F(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",import:(()=>F(()=>import("./gdresource-B7Tvp0Sc.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",import:(()=>F(()=>import("./gdscript-DTMYz4Jt.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>F(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>F(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>F(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>F(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>F(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>F(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>F(()=>import("./glimmer-js-Rg0-pVw9.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>F(()=>import("./glimmer-ts-U6CK756n.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>F(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gnuplot",name:"Gnuplot",import:(()=>F(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>F(()=>import("./go-Dn2_MT6a.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>F(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>F(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>F(()=>import("./hack-CaT9iCJl.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>F(()=>import("./haml-B8DHNrY2.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>F(()=>import("./handlebars-BL8al0AC.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>F(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>F(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>F(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>F(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>F(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>F(()=>import("./html-GMplVEZG.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>F(()=>import("./html-derivative-BFtXZ54Q.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>F(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>F(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>F(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>F(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>F(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>F(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>F(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>F(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>F(()=>import("./jinja-4LBKfQ-Z.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>F(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>F(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>F(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>F(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>F(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>F(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>F(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>F(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>F(()=>import("./julia-C8NyazO9.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"kdl",name:"KDL",import:(()=>F(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>F(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>F(()=>import("./kusto-BvAqAH-y.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>F(()=>import("./latex-BdAV_C_H.js"),__vite__mapDeps([63,64,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>F(()=>import("./lean-Bc6EcWN3.js"),[]))},{id:"less",name:"Less",import:(()=>F(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>F(()=>import("./liquid-DYVedYrR.js"),__vite__mapDeps([65,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>F(()=>import("./llvm-BtvRca6l.js"),[]))},{id:"log",name:"Log file",import:(()=>F(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>F(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>F(()=>import("./lua-BbnMAYS6.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>F(()=>import("./luau-CXu1NL6O.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>F(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>F(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>F(()=>import("./marko-CPi9NSCl.js"),__vite__mapDeps([66,3,67,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>F(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>F(()=>import("./mdc-DUICxH0z.js"),__vite__mapDeps([68,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>F(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>F(()=>import("./mermaid-DKYwYmdq.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>F(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>F(()=>import("./mojo-1DNp92w6.js"),[]))},{id:"move",name:"Move",import:(()=>F(()=>import("./move-Bu9oaDYs.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>F(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>F(()=>import("./nextflow-BrzmwbiE.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>F(()=>import("./nginx-DknmC5AR.js"),__vite__mapDeps([69,37,26])))},{id:"nim",name:"Nim",import:(()=>F(()=>import("./nim-CVrawwO9.js"),__vite__mapDeps([70,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>F(()=>import("./nix-c8nO5XWb.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>F(()=>import("./nushell-C-sUppwS.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>F(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>F(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>F(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>F(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>F(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>F(()=>import("./perl-C0TMdlhV.js"),__vite__mapDeps([71,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>F(()=>import("./php-CDn_0X-4.js"),__vite__mapDeps([72,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>F(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>F(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>F(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>F(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>F(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>F(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>F(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>F(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>F(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>F(()=>import("./proto-DyJlTyXw.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>F(()=>import("./pug-CGlum2m_.js"),__vite__mapDeps([73,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>F(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>F(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>F(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>F(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([74,2])))},{id:"qmldir",name:"QML Directory",import:(()=>F(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>F(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>F(()=>import("./r-DiinP2Uv.js"),[]))},{id:"racket",name:"Racket",import:(()=>F(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>F(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>F(()=>import("./razor-CE9lU5zL.js"),__vite__mapDeps([75,1,2,3,76])))},{id:"reg",name:"Windows Registry Script",import:(()=>F(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>F(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>F(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>F(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>F(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>F(()=>import("./rst-B0xPkSld.js"),__vite__mapDeps([77,15,1,2,3,23,24,25,26,16,20,28,38,78,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>F(()=>import("./ruby-BvKwtOVI.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>F(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>F(()=>import("./sas-cz2c8ADy.js"),__vite__mapDeps([79,16])))},{id:"sass",name:"Sass",import:(()=>F(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>F(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>F(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>F(()=>import("./scss-OYdSNvt2.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>F(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>F(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([80,81])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>F(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>F(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([82,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>F(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>F(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>F(()=>import("./soy-Brmx7dQM.js"),__vite__mapDeps([83,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>F(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([84,85])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>F(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>F(()=>import("./sql-BLtJtn59.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>F(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>F(()=>import("./stata-BH5u7GGu.js"),__vite__mapDeps([86,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>F(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"svelte",name:"Svelte",import:(()=>F(()=>import("./svelte-3Dk4HxPD.js"),__vite__mapDeps([87,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>F(()=>import("./swift-Dg5xB15N.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>F(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>F(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>F(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>F(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>F(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>F(()=>import("./templ-W15q3VgB.js"),__vite__mapDeps([88,89,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>F(()=>import("./terraform-BETggiCN.js"),[]))},{id:"tex",name:"TeX",import:(()=>F(()=>import("./tex-CxkMU7Pf.js"),__vite__mapDeps([64,62])))},{id:"toml",name:"TOML",import:(()=>F(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>F(()=>import("./ts-tags-zn1MmPIZ.js"),__vite__mapDeps([90,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>F(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>F(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>F(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>F(()=>import("./twig-CO9l9SDP.js"),__vite__mapDeps([91,3,2,5,72,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>F(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>F(()=>import("./typespec-BGHnOYBU.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>F(()=>import("./typst-DHCkPAjA.js"),[]))},{id:"v",name:"V",import:(()=>F(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>F(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>F(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>F(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>F(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>F(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>F(()=>import("./vue-DnHKYNfI.js"),__vite__mapDeps([92,3,2,11,9,15,1])))},{id:"vue-html",name:"Vue HTML",import:(()=>F(()=>import("./vue-html-CChd_i61.js"),__vite__mapDeps([93,92,3,2,11,9,15,1])))},{id:"vue-vine",name:"Vue Vine",import:(()=>F(()=>import("./vue-vine-8moa0y9V.js"),__vite__mapDeps([94,3,5,67,95,12,92,2,11,9,15,1])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>F(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>F(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:(()=>F(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>F(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>F(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>F(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>F(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>F(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>F(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([96,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>F(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>F(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>F(()=>import("./zig-VOosw3JB.js"),[]))}],MD=Object.fromEntries($6.map(t=>[t.id,t.import])),LD=Object.fromEntries($6.flatMap(t=>t.aliases?.map(e=>[e,t.import])||[])),Uc={...MD,...LD},PD=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>F(()=>import("./andromeeda-C-Jbm3Hp.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>F(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>F(()=>import("./ayu-dark-Cv9koXgw.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>F(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>F(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>F(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>F(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>F(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>F(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>F(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>F(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>F(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>F(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>F(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>F(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>F(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>F(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>F(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>F(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>F(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>F(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>F(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>F(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>F(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>F(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>F(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>F(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>F(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>F(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>F(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>F(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>F(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>F(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>F(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>F(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>F(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>F(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>F(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>F(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>F(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>F(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>F(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>F(()=>import("./one-light-PoHY5YXO.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>F(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>F(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>F(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>F(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>F(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>F(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>F(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>F(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>F(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>F(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>F(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>F(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>F(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>F(()=>import("./vesper-DU1UobuO.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>F(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>F(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>F(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],B6=Object.fromEntries(PD.map(t=>[t.id,t.import]));class mv extends Error{constructor(e){super(e),this.name="ShikiError"}}function _D(){return 2147483648}function DD(){return typeof performance<"u"?performance.now():Date.now()}const zD=(t,e)=>t+(e-t%e)%e;async function OD(t){let e,n;const r={};function o(m){n=m,r.HEAPU8=new Uint8Array(m),r.HEAPU32=new Uint32Array(m)}function i(m,p,g){r.HEAPU8.copyWithin(m,p,p+g)}function s(m){try{return e.grow(m-n.byteLength+65535>>>16),o(e.buffer),1}catch{}}function a(m){const p=r.HEAPU8.length;m=m>>>0;const g=_D();if(m>g)return!1;for(let h=1;h<=4;h*=2){let k=p*(1+.2/h);k=Math.min(k,m+100663296);const y=Math.min(g,zD(Math.max(m,k),65536));if(s(y))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(m,p,g=1024){const h=p+g;let k=p;for(;m[k]&&!(k>=h);)++k;if(k-p>16&&m.buffer&&l)return l.decode(m.subarray(p,k));let y="";for(;p>10,56320|x&1023)}}return y}function d(m,p){return m?c(r.HEAPU8,m,p):""}const u={emscripten_get_now:DD,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const p=await t({env:u,wasi_snapshot_preview1:u});e=p.memory,o(e.buffer),Object.assign(r,p),r.UTF8ToString=d}return await f(),r}var jD=Object.defineProperty,RD=(t,e,n)=>e in t?jD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Un=(t,e,n)=>RD(t,typeof e!="symbol"?e+"":e,n);let Qn=null;function ND(t){throw new mv(t.UTF8ToString(t.getLastOnigError()))}class ym{constructor(e){Un(this,"utf16Length"),Un(this,"utf8Length"),Un(this,"utf16Value"),Un(this,"utf8Value"),Un(this,"utf16OffsetToUtf8"),Un(this,"utf8OffsetToUtf16");const n=e.length,r=ym._utf8ByteLength(e),o=r!==n,i=o?new Uint32Array(n+1):null;o&&(i[n]=r);const s=o?new Uint32Array(r+1):null;o&&(s[r]=n);const a=new Uint8Array(r);let l=0;for(let c=0;c=55296&&d<=56319&&c+1=56320&&m<=57343&&(u=(d-55296<<10)+65536|m-56320,f=!0)}o&&(i[c]=l,f&&(i[c+1]=l),u<=127?s[l+0]=c:u<=2047?(s[l+0]=c,s[l+1]=c):u<=65535?(s[l+0]=c,s[l+1]=c,s[l+2]=c):(s[l+0]=c,s[l+1]=c,s[l+2]=c,s[l+3]=c)),u<=127?a[l++]=u:u<=2047?(a[l++]=192|(u&1984)>>>6,a[l++]=128|(u&63)>>>0):u<=65535?(a[l++]=224|(u&61440)>>>12,a[l++]=128|(u&4032)>>>6,a[l++]=128|(u&63)>>>0):(a[l++]=240|(u&1835008)>>>18,a[l++]=128|(u&258048)>>>12,a[l++]=128|(u&4032)>>>6,a[l++]=128|(u&63)>>>0),f&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=e,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=s}static _utf8ByteLength(e){let n=0;for(let r=0,o=e.length;r=55296&&i<=56319&&r+1=56320&&l<=57343&&(s=(i-55296<<10)+65536|l-56320,a=!0)}s<=127?n+=1:s<=2047?n+=2:s<=65535?n+=3:n+=4,a&&r++}return n}createString(e){const n=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,n),n}}const km=class oi{constructor(e){if(Un(this,"id",++oi.LAST_ID),Un(this,"_onigBinding"),Un(this,"content"),Un(this,"utf16Length"),Un(this,"utf8Length"),Un(this,"utf16OffsetToUtf8"),Un(this,"utf8OffsetToUtf16"),Un(this,"ptr"),!Qn)throw new mv("Must invoke loadWasm first.");this._onigBinding=Qn,this.content=e;const n=new ym(e);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!oi._sharedPtrInUse?(oi._sharedPtr||(oi._sharedPtr=Qn.omalloc(1e4)),oi._sharedPtrInUse=!0,Qn.HEAPU8.set(n.utf8Value,oi._sharedPtr),this.ptr=oi._sharedPtr):this.ptr=n.createString(Qn)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===oi._sharedPtr?oi._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Un(km,"LAST_ID",0);Un(km,"_sharedPtr",0);Un(km,"_sharedPtrInUse",!1);let V6=km;class FD{constructor(e){if(Un(this,"_onigBinding"),Un(this,"_ptr"),!Qn)throw new mv("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=e.length;a{let r=t;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),$D(r)?r=await r.instantiator(n):BD(r)?r=await r.default(n):(VD(r)&&(r=r.data),UD(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await KD(r)(n):r=await WD(r)(n):HD(r)?r=await Yf(r)(n):r instanceof WebAssembly.Module?r=await Yf(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Yf(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return ru=e(),ru}function Yf(t){return e=>WebAssembly.instantiate(t,e)}function KD(t){return e=>WebAssembly.instantiateStreaming(t,e)}function WD(t){return async e=>{const n=await t.arrayBuffer();return WebAssembly.instantiate(n,e)}}async function U6(t){return t&&await qD(t),{createScanner(e){return new FD(e.map(n=>typeof n=="string"?n:n.source))},createString(e){return new V6(e)}}}const GD=ED({langs:Uc,themes:B6,engine:()=>U6(F(()=>import("./wasm-CG6Dc4jp.js"),[]))});function Nl(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function ZD(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}const fv=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),Yn=String.raw;function Fl(t,e){if(t==null)throw new Error(e??"Value expected");return t}const H6=Yn`\[\^?`,q6=`c.? | C(?:-.?)?|${Yn`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Yn`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Yn`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Yn`o\{[^\}]*\}?`}|${Yn`\d{1,3}`}`,gv=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,ou=new RegExp(Yn` \\ (?: ${q6} | [gk]<[^>]*>? | [gk]'[^']*'? | . ) | \( (?: \? (?: [:=!>({] | <[=!] | <[^>]*> | '[^']*' | ~\|? | #(?:[^)\\]|\\.?)* | [^:)]*[:)] )? | \*[^\)]*\)? )? | (?:${gv.source})+ | ${H6} | . `.replace(/\s+/g,""),"gsu"),eg=new RegExp(Yn` \\ (?: ${q6} | . ) | \[:(?:\^?\p{Alpha}+|\^):\] | ${H6} | && | . `.replace(/\s+/g,""),"gsu");function JD(t,e={}){const n={flags:"",...e,rules:{captureGroup:!1,singleline:!1,...e.rules}};if(typeof t!="string")throw new Error("String expected as pattern");const r=gz(n.flags),o=[r.extended],i={captureGroup:n.rules.captureGroup,getCurrentModX(){return o.at(-1)},numOpenGroups:0,popModX(){o.pop()},pushModX(u){o.push(u)},replaceCurrentModX(u){o[o.length-1]=u},singleline:n.rules.singleline};let s=[],a;for(ou.lastIndex=0;a=ou.exec(t);){const u=QD(i,t,a[0],ou.lastIndex);u.tokens?s.push(...u.tokens):u.token&&s.push(u.token),u.lastIndex!==void 0&&(ou.lastIndex=u.lastIndex)}const l=[];let c=0;s.filter(u=>u.type==="GroupOpen").forEach(u=>{u.kind==="capturing"?u.number=++c:u.raw==="("&&l.push(u)}),c||l.forEach((u,f)=>{u.kind="capturing",u.number=f+1});const d=c||l.length;return{tokens:s.map(u=>u.type==="EscapedNumber"?vz(u,d):u).flat(),flags:r}}function QD(t,e,n,r){const[o,i]=n;if(n==="["||n==="[^"){const s=XD(e,n,r);return{tokens:s.tokens,lastIndex:s.lastIndex}}if(o==="\\"){if("AbBGyYzZ".includes(i))return{token:Ek(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:lz(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:W6(n)}}if(i==="K")return{token:G6("keep",n)};if(i==="N"||i==="R")return{token:ta("newline",n,{negate:i==="N"})};if(i==="O")return{token:ta("any",n)};if(i==="X")return{token:ta("text_segment",n)};const s=K6(n,{inCharClass:!1});return Array.isArray(s)?{tokens:s}:{token:s}}if(o==="("){if(i==="*")return{token:pz(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(e[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:uz(n,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,n==="("&&!t.captureGroup||n==="(?:")return{token:Ja("group",n)};if(n==="(?>")return{token:Ja("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?")||n.startsWith("(?'")&&n.endsWith("'"))return{token:Ja("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:Ja("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:iz(n)}}if(t.getCurrentModX()){if(n==="#"){const s=e.indexOf(` `,r);return{lastIndex:s===-1?e.length:s}}if(/^\s$/.test(n)){const s=/\s+/y;return s.lastIndex=r,{lastIndex:s.exec(e)?s.lastIndex:r}}}if(n===".")return{token:ta("dot",n)};if(n==="^"||n==="$"){const s=t.singleline?{"^":Yn`\A`,$:Yn`\Z`}[n]:n;return{token:Ek(s,n)}}return n==="|"?{token:ez(n)}:gv.test(n)?{tokens:bz(n)}:{token:$i(Nl(n),n)}}function XD(t,e,n){const r=[Mk(e[1]==="^",e)];let o=1,i;for(eg.lastIndex=n;i=eg.exec(t);){const s=i[0];if(s[0]==="["&&s[1]!==":")o++,r.push(Mk(s[1]==="^",s));else if(s==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push($i(93,s));else if(o--,r.push(tz(s)),!o)break}else{const a=YD(s);Array.isArray(a)?r.push(...a):r.push(a)}}return{tokens:r,lastIndex:eg.lastIndex||t.length}}function YD(t){if(t[0]==="\\")return K6(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?\^?)(?[a-z]+):\]/.exec(t);if(!e||!fv.has(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return ta("posix",t,{value:e.groups.name,negate:!!e.groups.negate})}return t==="-"?nz(t):t==="&&"?rz(t):$i(Nl(t),t)}function K6(t,{inCharClass:e}){const n=t[1];if(n==="c"||n==="C")return dz(t);if("dDhHsSwW".includes(n))return mz(t);if(t.startsWith(Yn`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${t}"`);if(/^\\[pP]\{/.test(t)){if(t.length===3)throw new Error(`Incomplete or invalid Unicode property "${t}"`);return fz(t)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(t))try{const r=t.split(/\\x/).slice(1).map(s=>parseInt(s,16)),o=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),i=new TextEncoder;return[...o].map(s=>{const a=[...i.encode(s)].map(l=>`\\x${l.toString(16)}`).join("");return $i(Nl(s),a)})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return $i(hz(t),t);if(Lk.has(n))return $i(Lk.get(n),t);if(/\d/.test(n))return oz(e,t);if(t==="\\")throw new Error(Yn`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return $i(t.codePointAt(1),t);throw new Error(`Unexpected escape "${t}"`)}function ez(t){return{type:"Alternator",raw:t}}function Ek(t,e){return{type:"Assertion",kind:t,raw:e}}function W6(t){return{type:"Backreference",raw:t}}function $i(t,e){return{type:"Character",value:t,raw:e}}function tz(t){return{type:"CharacterClassClose",raw:t}}function nz(t){return{type:"CharacterClassHyphen",raw:t}}function rz(t){return{type:"CharacterClassIntersector",raw:t}}function Mk(t,e){return{type:"CharacterClassOpen",negate:t,raw:e}}function ta(t,e,n={}){return{type:"CharacterSet",kind:t,...n,raw:e}}function G6(t,e,n={}){return t==="keep"?{type:"Directive",kind:t,raw:e}:{type:"Directive",kind:t,flags:Fl(n.flags),raw:e}}function oz(t,e){return{type:"EscapedNumber",inCharClass:t,raw:e}}function iz(t){return{type:"GroupClose",raw:t}}function Ja(t,e,n={}){return{type:"GroupOpen",kind:t,...n,raw:e}}function sz(t,e,n,r){return{type:"NamedCallout",kind:t,tag:e,arguments:n,raw:r}}function az(t,e,n,r){return{type:"Quantifier",kind:t,min:e,max:n,raw:r}}function lz(t){return{type:"Subroutine",raw:t}}const cz=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),Lk=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function dz(t){const e=t[1]==="c"?t[2]:t[3];if(!e||!/[A-Za-z]/.test(e))throw new Error(`Unsupported control character "${t}"`);return $i(Nl(e.toUpperCase())-64,t)}function uz(t,e){let{on:n,off:r}=/^\(\?(?[imx]*)(?:-(?[-imx]*))?/.exec(t).groups;r??="";const o=(e.getCurrentModX()||n.includes("x"))&&!r.includes("x"),i=_k(n),s=_k(r),a={};if(i&&(a.enable=i),s&&(a.disable=s),t.endsWith(")"))return e.replaceCurrentModX(o),G6("flags",t,{flags:a});if(t.endsWith(":"))return e.pushModX(o),e.numOpenGroups++,Ja("group",t,{...(i||s)&&{flags:a}});throw new Error(`Unexpected flag modifier "${t}"`)}function pz(t){const e=/\(\*(?[A-Za-z_]\w*)?(?:\[(?(?:[A-Za-z_]\w*)?)\])?(?:\{(?[^}]*)\})?\)/.exec(t);if(!e)throw new Error(`Incomplete or invalid named callout "${t}"`);const{name:n,tag:r,args:o}=e.groups;if(!n)throw new Error(`Invalid named callout "${t}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${t}"`);const i=o?o.split(",").filter(d=>d!=="").map(d=>/^[+-]?\d+$/.test(d)?+d:d):[],[s,a,l]=i,c=cz.has(n)?n.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(i.length>0)throw new Error(`Named callout arguments not allowed "${i}"`);break;case"error":if(i.length>1)throw new Error(`Named callout allows only one argument "${i}"`);if(typeof s=="string")throw new Error(`Named callout argument must be a number "${s}"`);break;case"max":if(!i.length||i.length>2)throw new Error(`Named callout must have one or two arguments "${i}"`);if(typeof s=="string"&&!/^[A-Za-z_]\w*$/.test(s))throw new Error(`Named callout argument one must be a tag or number "${s}"`);if(i.length===2&&(typeof a=="number"||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(i.length>1)throw new Error(`Named callout allows only one argument "${i}"`);if(i.length===1&&(typeof s=="number"||!/^[<>X]$/.test(s)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${s}"`);break;case"cmp":if(i.length!==3)throw new Error(`Named callout must have three arguments "${i}"`);if(typeof s=="string"&&!/^[A-Za-z_]\w*$/.test(s))throw new Error(`Named callout argument one must be a tag or number "${s}"`);if(typeof a=="number"||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if(typeof l=="string"&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return sz(c,r??null,o?.split(",")??null,t)}function Pk(t){let e=null,n,r;if(t[0]==="{"){const{minStr:o,maxStr:i}=/^\{(?\d*)(?:,(?\d*))?/.exec(t).groups,s=1e5;if(+o>s||i&&+i>s)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+o,r=i===void 0?+o:i===""?1/0:+i,n>r&&(e="possessive",[n,r]=[r,n]),t.endsWith("?")){if(e==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');e="lazy"}else e||(e="greedy")}else n=t[0]==="+"?1:0,r=t[0]==="?"?1:1/0,e=t[1]==="+"?"possessive":t[1]==="?"?"lazy":"greedy";return az(e,n,r,t)}function mz(t){const e=t[1].toLowerCase();return ta({d:"digit",h:"hex",s:"space",w:"word"}[e],t,{negate:t[1]!==e})}function fz(t){const{p:e,neg:n,value:r}=/^\\(?

[pP])\{(?\^?)(?[^}]+)/.exec(t).groups;return ta("property",t,{value:r,negate:e==="P"&&!n||e==="p"&&!!n})}function _k(t){const e={};return t.includes("i")&&(e.ignoreCase=!0),t.includes("m")&&(e.dotAll=!0),t.includes("x")&&(e.extended=!0),Object.keys(e).length?e:null}function gz(t){const e={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n\p{AHex}+)/u.exec(t).groups.hex:t.slice(2);return parseInt(e,16)}function vz(t,e){const{raw:n,inCharClass:r}=t,o=n.slice(1);if(!r&&(o!=="0"&&o.length===1||o[0]!=="0"&&+o<=e))return[W6(n)];const i=[],s=o.match(/^[0-7]+|\d/g);for(let a=0;a127)throw new Error(Yn`Octal encoded byte above 177 unsupported "${n}"`)}else c=Nl(l);i.push($i(c,(a===0?"\\":"")+l))}return i}function bz(t){const e=[],n=new RegExp(gv,"gy");let r;for(;r=n.exec(t);){const o=r[0];if(o[0]==="{"){const i=/^\{(?\d+),(?\d+)\}\??$/.exec(o);if(i){const{min:s,max:a}=i.groups;if(+s>+a&&o.endsWith("?")){n.lastIndex--,e.push(Pk(o.slice(0,-1)));continue}}}e.push(Pk(o))}return e}function Z6(t,e){if(!Array.isArray(t.body))throw new Error("Expected node with body array");if(t.body.length!==1)return!1;const n=t.body[0];return!e||Object.keys(e).every(r=>e[r]===n[r])}function yz(t){return kz.has(t.type)}const kz=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function J6(t,e={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e,rules:{captureGroup:!1,singleline:!1,...e.rules}},r=JD(t,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),o=(f,m)=>{const p=r.tokens[i.nextIndex];switch(i.parent=f,i.nextIndex++,p.type){case"Alternator":return ua();case"Assertion":return wz(p);case"Backreference":return xz(p,i);case"Character":return wm(p.value,{useLastValid:!!m.isCheckingRangeEnd});case"CharacterClassHyphen":return Sz(p,i,m);case"CharacterClassOpen":return Az(p,i,m);case"CharacterSet":return Cz(p,i);case"Directive":return Pz(p.kind,{flags:p.flags});case"GroupOpen":return Iz(p,i,m);case"NamedCallout":return Dz(p.kind,p.tag,p.arguments);case"Quantifier":return Tz(p,i);case"Subroutine":return Ez(p,i);default:throw new Error(`Unexpected token type "${p.type}"`)}},i={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:o},s=Oz(_z(r.flags));let a=s.body[0];for(;i.nextIndexl.length)throw new Error("Subroutine uses a group number that's not defined");f&&(l[f-1].isSubroutined=!0)}else if(d.has(f)){if(d.get(f).length>1)throw new Error(Yn`Subroutine uses a duplicate group name "\g<${f}>"`);d.get(f)[0].isSubroutined=!0}else throw new Error(Yn`Subroutine uses a group name that's not defined "\g<${f}>"`);return s}function wz({kind:t}){return Mh(Fl({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[t],`Unexpected assertion kind "${t}"`),{negate:t===Yn`\B`||t===Yn`\Y`})}function xz({raw:t},e){const n=/^\\k[<']/.test(t),r=n?t.slice(3,-1):t.slice(1),o=(i,s=!1)=>{const a=e.capturingGroups.length;let l=!1;if(i>a)if(e.skipBackrefValidation)l=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,Lh(s?a+1-i:i,{orphan:l})};if(n){const i=/^(?-?)0*(?[1-9]\d*)$/.exec(r);if(i)return o(+i.groups.num,!!i.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${t}"`);return Lh(r)}return o(+r)}function Sz(t,e,n){const{tokens:r,walk:o}=e,i=e.parent,s=i.body.at(-1),a=r[e.nextIndex];if(!n.isCheckingRangeEnd&&s&&s.type!=="CharacterClass"&&s.type!=="CharacterClassRange"&&a&&a.type!=="CharacterClassOpen"&&a.type!=="CharacterClassClose"&&a.type!=="CharacterClassIntersector"){const l=o(i,{...n,isCheckingRangeEnd:!0});if(s.type==="Character"&&l.type==="Character")return i.body.pop(),Lz(s,l);throw new Error("Invalid character class range")}return wm(Nl("-"))}function Az({negate:t},e,n){const{tokens:r,walk:o}=e,i=r[e.nextIndex],s=[Ku()];let a=Ok(i);for(;a.type!=="CharacterClassClose";){if(a.type==="CharacterClassIntersector")s.push(Ku()),e.nextIndex++;else{const c=s.at(-1);c.body.push(o(c,n))}a=Ok(r[e.nextIndex],i)}const l=Ku({negate:t});return s.length===1?l.body=s[0].body:(l.kind="intersection",l.body=s.map(c=>c.body.length===1?c.body[0]:c)),e.nextIndex++,l}function Cz({kind:t,negate:e,value:n},r){const{normalizeUnknownPropertyNames:o,skipPropertyNameValidation:i,unicodePropertyMap:s}=r;if(t==="property"){const a=xm(n);if(fv.has(a)&&!s?.has(a))t="posix",n=a;else return Qa(n,{negate:e,normalizeUnknownPropertyNames:o,skipPropertyNameValidation:i,unicodePropertyMap:s})}return t==="posix"?zz(n,{negate:e}):Ph(t,{negate:e})}function Iz(t,e,n){const{tokens:r,capturingGroups:o,namedGroupsByName:i,skipLookbehindValidation:s,walk:a}=e,l=jz(t),c=l.type==="AbsenceFunction",d=zk(l),u=d&&l.negate;if(l.type==="CapturingGroup"&&(o.push(l),l.name&&ZD(i,l.name,[]).push(l)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let f=jk(r[e.nextIndex]);for(;f.type!=="GroupClose";){if(f.type==="Alternator")l.body.push(ua()),e.nextIndex++;else{const m=l.body.at(-1),p=a(m,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||d,isInNegLookbehind:n.isInNegLookbehind||u});if(m.body.push(p),(d||n.isInLookbehind)&&!s){const g="Lookbehind includes a pattern not allowed by Oniguruma";if(u||n.isInNegLookbehind){if(Dk(p)||p.type==="CapturingGroup")throw new Error(g)}else if(Dk(p)||zk(p)&&p.negate)throw new Error(g)}}f=jk(r[e.nextIndex])}return e.nextIndex++,l}function Tz({kind:t,min:e,max:n},r){const o=r.parent,i=o.body.at(-1);if(!i||!yz(i))throw new Error("Quantifier requires a repeatable token");const s=X6(t,e,n,i);return o.body.pop(),s}function Ez({raw:t},e){const{capturingGroups:n,subroutines:r}=e;let o=t.slice(3,-1);const i=/^(?[-+]?)0*(?[1-9]\d*)$/.exec(o);if(i){const a=+i.groups.num,l=n.length;if(e.hasNumberedRef=!0,o={"":a,"+":l+a,"-":l+1-a}[i.groups.sign],o<1)throw new Error("Invalid subroutine number")}else o==="0"&&(o=0);const s=Y6(o);return r.push(s),s}function Mz(t,e){return{type:"AbsenceFunction",kind:t,body:md(e?.body)}}function ua(t){return{type:"Alternative",body:e3(t?.body)}}function Mh(t,e){const n={type:"Assertion",kind:t};return(t==="word_boundary"||t==="text_segment_boundary")&&(n.negate=!!e?.negate),n}function Lh(t,e){const n=!!e?.orphan;return{type:"Backreference",ref:t,...n&&{orphan:n}}}function Q6(t,e){const n={name:void 0,isSubroutined:!1,...e};if(n.name!==void 0&&!Rz(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:t,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:md(e?.body)}}function wm(t,e){const n={useLastValid:!1,...e};if(t>1114111){const r=t.toString(16);if(n.useLastValid)t=1114111;else throw t>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:"Character",value:t}}function Ku(t){const e={kind:"union",negate:!1,...t};return{type:"CharacterClass",kind:e.kind,negate:e.negate,body:e3(t?.body)}}function Lz(t,e){if(e.valuen)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:t,min:e,max:n,body:r}}function Oz(t,e){return{type:"Regex",body:md(e?.body),flags:t}}function Y6(t){return{type:"Subroutine",ref:t}}function Qa(t,e){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e};let r=n.unicodePropertyMap?.get(xm(t));if(!r){if(n.normalizeUnknownPropertyNames)r=Nz(t);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(Yn`Invalid Unicode property "\p{${t}}"`)}return{type:"CharacterSet",kind:"property",value:r??t,negate:n.negate}}function jz({flags:t,kind:e,name:n,negate:r,number:o}){switch(e){case"absence_repeater":return Mz("repeater");case"atomic":return Fo({atomic:!0});case"capturing":return Q6(o,{name:n});case"group":return Fo({flags:t});case"lookahead":case"lookbehind":return Xs({behind:e==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${e}"`)}}function md(t){if(t===void 0)t=[ua()];else if(!Array.isArray(t)||!t.length||!t.every(e=>e.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return t}function e3(t){if(t===void 0)t=[];else if(!Array.isArray(t)||!t.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return t}function Dk(t){return t.type==="LookaroundAssertion"&&t.kind==="lookahead"}function zk(t){return t.type==="LookaroundAssertion"&&t.kind==="lookbehind"}function Rz(t){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(t)}function Nz(t){return t.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function xm(t){return t.replace(/[- _]+/g,"").toLowerCase()}function Ok(t,e){return Fl(t,`${e?.type==="Character"&&e.value===93?"Empty":"Unclosed"} character class`)}function jk(t){return Fl(t,"Unclosed group")}function Mc(t,e,n=null){function r(i,s){for(let a=0;aA-Za-z\-]|<[=!]|\(DEFINE\))`;function $z(t,e){for(let n=0;n=e&&t[n]++}function Bz(t,e,n,r){return t.slice(0,e)+r+t.slice(e+n.length)}const bo=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function hv(t,e,n,r){const o=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),i=[!1];let s=0,a="";for(const l of t.matchAll(o)){const{0:c,groups:{$skip:d}}=l;if(!d&&(!r||r===bo.DEFAULT==!s)){n instanceof Function?a+=n(l,{context:s?bo.CHAR_CLASS:bo.DEFAULT,negated:i[i.length-1]}):a+=n;continue}c[0]==="["?(s++,i.push(c[1]==="^")):c==="]"&&s&&(s--,i.pop()),a+=c}return a}function t3(t,e,n,r){hv(t,e,n,r)}function Vz(t,e,n=0,r){if(!new RegExp(e,"su").test(t))return null;const o=new RegExp(`${e}|(?<$skip>\\\\?.)`,"gsu");o.lastIndex=n;let i=0,s;for(;s=o.exec(t);){const{0:a,groups:{$skip:l}}=s;if(!l&&(!r||r===bo.DEFAULT==!i))return s;a==="["?i++:a==="]"&&i&&i--,o.lastIndex==s.index&&o.lastIndex++}return null}function su(t,e,n){return!!Vz(t,e,0,n)}function Uz(t,e){const n=/\\?./gsu;n.lastIndex=e;let r=t.length,o=0,i=1,s;for(;s=n.exec(t);){const[a]=s;if(a==="[")o++;else if(o)a==="]"&&o--;else if(a==="(")i++;else if(a===")"&&(i--,!i)){r=s.index;break}}return t.slice(e,r)}const Rk=new RegExp(String.raw`(?${Fz})|(?\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Hz(t,e){const n=e?.hiddenCaptures??[];let r=e?.captureTransfers??new Map;if(!/\(\?>/.test(t))return{pattern:t,captureTransfers:r,hiddenCaptures:n};const o="(?>",i="(?:(?=(",s=[0],a=[];let l=0,c=0,d=NaN,u;do{u=!1;let f=0,m=0,p=!1,g;for(Rk.lastIndex=Number.isNaN(d)?0:d+i.length;g=Rk.exec(t);){const{0:h,index:k,groups:{capturingStart:y,noncapturingStart:w}}=g;if(h==="[")f++;else if(f)h==="]"&&f--;else if(h===o&&!p)d=k,p=!0;else if(p&&w)m++;else if(y)p?m++:(l++,s.push(l+c));else if(h===")"&&p){if(!m){c++;const A=l+c;if(t=`${t.slice(0,d)}${i}${t.slice(d+o.length,k)}))<$$${A}>)${t.slice(k+1)}`,u=!0,a.push(A),$z(n,A),r.size){const b=new Map;r.forEach((x,I)=>{b.set(I>=A?I+1:I,x.map(P=>P>=A?P+1:P))}),r=b}break}m--}}}while(u);return n.push(...a),t=hv(t,String.raw`\\(?[1-9]\d*)|<\$\$(?\d+)>`,({0:f,groups:{backrefNum:m,wrappedBackrefNum:p}})=>{if(m){const g=+m;if(g>s.length-1)throw new Error(`Backref "${f}" greater than number of captures`);return`\\${s[g]}`}return`\\${p}`},bo.DEFAULT),{pattern:t,captureTransfers:r,hiddenCaptures:n}}const n3=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,tg=new RegExp(String.raw` \\(?: \d+ | c[A-Za-z] | [gk]<[^>]+> | [pPu]\{[^\}]+\} | u[A-Fa-f\d]{4} | x[A-Fa-f\d]{2} ) | \((?: \? (?: [:=!>] | <(?:[=!]|[^>]+>) | [A-Za-z\-]+: | \(DEFINE\) ))? | (?${n3})(?[?+]?)(?[?*+\{]?) | \\?. `.replace(/\s+/g,""),"gsu");function qz(t){if(!new RegExp(`${n3}\\+`).test(t))return{pattern:t};const e=[];let n=null,r=null,o="",i=0,s;for(tg.lastIndex=0;s=tg.exec(t);){const{0:a,index:l,groups:{qBase:c,qMod:d,invalidQ:u}}=s;if(a==="[")i||(r=l),i++;else if(a==="]")i?i--:r=null;else if(!i)if(d==="+"&&o&&!o.startsWith("(")){if(u)throw new Error(`Invalid quantifier "${a}"`);let f=-1;if(/^\{\d+\}$/.test(c))t=Bz(t,l+c.length,d,"");else{if(o===")"||o==="]"){const m=o===")"?n:r;if(m===null)throw new Error(`Invalid unmatched "${o}"`);t=`${t.slice(0,m)}(?>${t.slice(m,l)}${c})${t.slice(l+a.length)}`}else t=`${t.slice(0,l-o.length)}(?>${o}${c})${t.slice(l+a.length)}`;f+=4}tg.lastIndex+=f}else a[0]==="("?e.push(l):a===")"&&(n=e.length?e.pop():null);o=a}return{pattern:t}}const ho=String.raw,Kz=ho`\\g<(?[^>&]+)&R=(?[^>]+)>`,_h=ho`\(\?R=(?[^\)]+)\)|${Kz}`,Sm=ho`\(\?<(?![=!])(?[^>]+)>`,r3=ho`${Sm}|(?\()(?!\?)`,Vs=new RegExp(ho`${Sm}|${_h}|\(\?|\\?.`,"gsu"),ng="Cannot use multiple overlapping recursions";function Wz(t,e){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...e};let o=e?.captureTransfers??new Map;if(!new RegExp(_h,"su").test(t))return{pattern:t,captureTransfers:o,hiddenCaptures:n};if(r==="plugin"&&su(t,ho`\(\?\(DEFINE\)`,bo.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const i=[],s=su(t,ho`\\[1-9]`,bo.DEFAULT),a=new Map,l=[];let c=!1,d=0,u=0,f;for(Vs.lastIndex=0;f=Vs.exec(t);){const{0:m,groups:{captureName:p,rDepth:g,gRNameOrNum:h,gRDepth:k}}=f;if(m==="[")d++;else if(d)m==="]"&&d--;else if(g){if(Nk(g),c)throw new Error(ng);if(s)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const y=t.slice(0,f.index),w=t.slice(Vs.lastIndex);if(su(w,_h,bo.DEFAULT))throw new Error(ng);const A=+g-1;t=Fk(y,w,A,!1,n,i,u),o=Bk(o,y,A,i.length,0,u);break}else if(h){Nk(k);let y=!1;for(const R of l)if(R.name===h||R.num===+h){if(y=!0,R.hasRecursedWithin)throw new Error(ng);break}if(!y)throw new Error(ho`Recursive \g cannot be used outside the referenced group "${r==="external"?h:ho`\g<${h}&R=${k}>`}"`);const w=a.get(h),A=Uz(t,w);if(s&&su(A,ho`${Sm}|\((?!\?)`,bo.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const b=t.slice(w,f.index),x=A.slice(b.length+m.length),I=i.length,P=+k-1,E=Fk(b,x,P,!0,n,i,u);o=Bk(o,b,P,i.length-I,I,u);const z=t.slice(0,w),N=t.slice(w+A.length);t=`${z}${E}${N}`,Vs.lastIndex+=E.length-m.length-b.length-x.length,l.forEach(R=>R.hasRecursedWithin=!0),c=!0}else if(p)u++,a.set(String(u),Vs.lastIndex),a.set(p,Vs.lastIndex),l.push({num:u,name:p});else if(m[0]==="("){const y=m==="(";y&&(u++,a.set(String(u),Vs.lastIndex)),l.push(y?{num:u}:{})}else m===")"&&l.pop()}return n.push(...i),{pattern:t,captureTransfers:o,hiddenCaptures:n}}function Nk(t){const e=`Max depth must be integer between 2 and 100; used ${t}`;if(!/^[1-9]\d*$/.test(t))throw new Error(e);if(t=+t,t<2||t>100)throw new Error(e)}function Fk(t,e,n,r,o,i,s){const a=new Set;r&&t3(t+e,Sm,({groups:{captureName:c}})=>{a.add(c)},bo.DEFAULT);const l=[n,r?a:null,o,i,s];return`${t}${$k(`(?:${t}`,"forward",...l)}(?:)${$k(`${e})`,"backward",...l)}${e}`}function $k(t,e,n,r,o,i,s){const l=d=>e==="forward"?d+2:n-d+2-1;let c="";for(let d=0;d[^>]+)>`,({0:f,groups:{captureName:m,unnamed:p,backref:g}})=>{if(g&&r&&!r.has(g))return f;const h=`_$${u}`;if(p||m){const k=s+i.length+1;return i.push(k),Gz(o,k),p?f:`(?<${m}${h}>`}return ho`\k<${g}${h}>`},bo.DEFAULT)}return c}function Gz(t,e){for(let n=0;n=e&&t[n]++}function Bk(t,e,n,r,o,i){if(t.size&&r){let s=0;t3(e,r3,()=>s++,bo.DEFAULT);const a=i-s+o,l=new Map;return t.forEach((c,d)=>{const u=(r-s*n)/n,f=s*n,m=d>a+s?d+r:d,p=[];for(const g of c)if(g<=a)p.push(g);else if(g>a+s+u)p.push(g+r);else if(g<=a+s)for(let h=0;h<=n;h++)p.push(g+s*h);else for(let h=0;h<=n;h++)p.push(g+f+u*h);l.set(m,p)}),l}return t}var Hn=String.fromCodePoint,mt=String.raw,Ki={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("[[]]","v")}catch{return!1}return!0})()};Ki.bugFlagVLiteralHyphenIsRange=Ki.unicodeSets?(()=>{try{new RegExp(mt`[\d\-a]`,"v")}catch{return!0}return!1})():!1;Ki.bugNestedClassIgnoresNegation=Ki.unicodeSets&&new RegExp("[[^a]]","v").test("a");function Ap(t,{enable:e,disable:n}){return{dotAll:!n?.dotAll&&!!(e?.dotAll||t.dotAll),ignoreCase:!n?.ignoreCase&&!!(e?.ignoreCase||t.ignoreCase)}}function Hc(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}function Dh(t,e){return Vk[t]>=Vk[e]}function Zz(t,e){if(t==null)throw new Error(e??"Value expected");return t}var Vk={ES2025:2025,ES2024:2024,ES2018:2018},Jz={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function o3(t={}){if({}.toString.call(t)!=="[object Object]")throw new Error("Unexpected options");if(t.target!==void 0&&!Jz[t.target])throw new Error(`Unexpected target "${t.target}"`);const e={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}};return e.target==="auto"&&(e.target=Ki.flagGroups?"ES2025":Ki.unicodeSets?"ES2024":"ES2018"),e}var Qz="[ -\r ]",Xz=new Set([Hn(304),Hn(305)]),Mi=mt`[\p{L}\p{M}\p{N}\p{Pc}]`;function i3(t){if(Xz.has(t))return[t];const e=new Set,n=t.toLowerCase(),r=n.toUpperCase(),o=tO.get(n),i=Yz.get(n),s=eO.get(n);return[...r].length===1&&e.add(r),s&&e.add(s),o&&e.add(o),e.add(n),i&&e.add(i),[...e]}var vv=new Map(`C Other Cc Control cntrl Cf Format Cn Unassigned Co Private_Use Cs Surrogate L Letter LC Cased_Letter Ll Lowercase_Letter Lm Modifier_Letter Lo Other_Letter Lt Titlecase_Letter Lu Uppercase_Letter M Mark Combining_Mark Mc Spacing_Mark Me Enclosing_Mark Mn Nonspacing_Mark N Number Nd Decimal_Number digit Nl Letter_Number No Other_Number P Punctuation punct Pc Connector_Punctuation Pd Dash_Punctuation Pe Close_Punctuation Pf Final_Punctuation Pi Initial_Punctuation Po Other_Punctuation Ps Open_Punctuation S Symbol Sc Currency_Symbol Sk Modifier_Symbol Sm Math_Symbol So Other_Symbol Z Separator Zl Line_Separator Zp Paragraph_Separator Zs Space_Separator ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component EComp Emoji_Modifier EMod Emoji_Modifier_Base EBase Emoji_Presentation EPres Extended_Pictographic ExtPict Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`.split(/\s/).map(t=>[xm(t),t])),Yz=new Map([["s",Hn(383)],[Hn(383),"s"]]),eO=new Map([[Hn(223),Hn(7838)],[Hn(107),Hn(8490)],[Hn(229),Hn(8491)],[Hn(969),Hn(8486)]]),tO=new Map([us(453),us(456),us(459),us(498),...rg(8072,8079),...rg(8088,8095),...rg(8104,8111),us(8124),us(8140),us(8188)]),nO=new Map([["alnum",mt`[\p{Alpha}\p{Nd}]`],["alpha",mt`\p{Alpha}`],["ascii",mt`\p{ASCII}`],["blank",mt`[\p{Zs}\t]`],["cntrl",mt`\p{Cc}`],["digit",mt`\p{Nd}`],["graph",mt`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",mt`\p{Lower}`],["print",mt`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",mt`[\p{P}\p{S}]`],["space",mt`\p{space}`],["upper",mt`\p{Upper}`],["word",mt`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",mt`\p{AHex}`]]);function rO(t,e){const n=[];for(let r=t;r<=e;r++)n.push(r);return n}function us(t){const e=Hn(t);return[e.toLowerCase(),e]}function rg(t,e){return rO(t,e).map(n=>us(n))}var s3=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function oO(t,e){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...e};a3(t);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Dh(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};Mc(t,iO,r);const o={dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},i={currentFlags:o,prevFlags:null,globalFlags:o,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};Mc(t,sO,i);const s={groupsByName:i.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:i.reffedNodesByReferencer};return Mc(t,aO,s),t._originMap=i.groupOriginByCopy,t._strategy=r.strategy,t}var iO={AbsenceFunction({node:t,parent:e,replaceWith:n}){const{body:r,kind:o}=t;if(o==="repeater"){const i=Fo();i.body[0].body.push(Xs({negate:!0,body:r}),Qa("Any"));const s=Fo();s.body[0].body.push(X6("greedy",0,1/0,i)),n(In(s,e),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:t,parent:e,key:n},{flagDirectivesByAlt:r}){const o=t.body.filter(i=>i.kind==="flags");for(let i=n+1;i\r\n|${o?mt`\p{RGI_Emoji}`:f}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),e))}else if(l==="hex")n(ps(Qa("AHex",{negate:c}),e));else if(l==="newline")n(In(Li(c?`[^ ]`:`(?>\r ?|[ \v\f…\u2028\u2029])`),e));else if(l==="posix")if(!o&&(d==="graph"||d==="print")){if(r==="strict")throw new Error(`POSIX class "${d}" requires min target ES2024 or non-strict accuracy`);let u={graph:"!-~",print:" -~"}[d];c&&(u=`\0-${Hn(u.codePointAt(0)-1)}${Hn(u.codePointAt(2)+1)}-􏿿`),n(In(Li(`[${u}]`),e))}else n(In(sg(Li(nO.get(d)),c),e));else if(l==="property")vv.has(xm(d))||(t.key="sc");else if(l==="space")n(ps(Qa("space",{negate:c}),e));else if(l==="word")n(In(sg(Li(Mi),c),e));else throw new Error(`Unexpected character set kind "${l}"`)},Directive({node:t,parent:e,root:n,remove:r,replaceWith:o,removeAllPrevSiblings:i,removeAllNextSiblings:s}){const{kind:a,flags:l}=t;if(a==="flags")if(!l.enable&&!l.disable)r();else{const c=Fo({flags:l});c.body[0].body=s(),o(In(c,e),{traverse:!0})}else if(a==="keep"){const c=n.body[0],u=n.body.length===1&&Z6(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(e.parent!==u||u.body.length>1)throw new Error(mt`Uses "\K" in a way that's unsupported`);const f=Xs({behind:!0});f.body[0].body=i(),o(In(f,e))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:t,parent:e}){if(t.posixIsAscii)throw new Error('Unsupported flag "P"');if(t.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete t[n]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),e.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;const{enable:e,disable:n}=t.flags;e?.extended&&delete e.extended,n?.extended&&delete n.extended,e?.dotAll&&n?.dotAll&&delete e.dotAll,e?.ignoreCase&&n?.ignoreCase&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,n&&!Object.keys(n).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},e){const{kind:n}=t;n==="lookbehind"&&(e.passedLookbehind=!0)},NamedCallout({node:t,parent:e,replaceWith:n}){const{kind:r}=t;if(r==="fail")n(In(Xs({negate:!0}),e));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){const e=Fo();e.body[0].body.push(t.body),t.body=In(e,t)}},Regex:{enter({node:t},{supportedGNodes:e}){const n=[];let r=!1,o=!1;for(const i of t.body)if(i.body.length===1&&i.body[0].kind==="search_start")i.body.pop();else{const s=u3(i.body);s?(r=!0,Array.isArray(s)?n.push(...s):n.push(s)):o=!0}r&&!o&&n.forEach(i=>e.add(i))},exit(t,{accuracy:e,passedLookbehind:n,strategy:r}){if(e==="strict"&&n&&r)throw new Error(mt`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!ig(n)&&(n=og(n,e),t.ref=n)}},sO={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:n}){const{orphan:r,ref:o}=t;r||n.set(t,[...e.get(o).map(({node:i})=>i)])},CapturingGroup:{enter({node:t,parent:e,replaceWith:n,skip:r},{groupOriginByCopy:o,groupsByName:i,multiplexCapturesToLeftByRef:s,openRefs:a,reffedNodesByReferencer:l}){const c=o.get(t);if(c&&a.has(t.number)){const u=ps(Uk(t.number),e);l.set(u,a.get(t.number)),n(u);return}a.set(t.number,t),s.set(t.number,[]),t.name&&Hc(s,t.name,[]);const d=s.get(t.name??t.number);for(let u=0;uf.type==="Group"&&!!f.flags)),u=d?Ap(r.globalFlags,d):r.globalFlags;lO(u,r.currentFlags)||(c=Fo({flags:uO(u)}),c.body[0].body.push(l))}n(In(c,e),{traverse:!a})}},aO={Backreference({node:t,parent:e,replaceWith:n},r){if(t.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,t.ref);return}const i=r.reffedNodesByReferencer.get(t).filter(s=>cO(s,t));if(!i.length)n(In(Xs({negate:!0}),e));else if(i.length>1){const s=Fo({atomic:!0,body:i.reverse().map(a=>ua({body:[Lh(a.number)]}))});n(In(s,e))}else t.ref=i[0].number},CapturingGroup({node:t},e){t.number=++e.numCapturesToLeft,t.name&&e.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove&&delete t.name},Regex:{exit({node:t},e){const n=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let r=0;r{e.forEach(o=>{r.enable?.[o]&&(delete n.disable[o],n.enable[o]=!0),r.disable?.[o]&&(n.disable[o]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function uO({dotAll:t,ignoreCase:e}){const n={};return(t||e)&&(n.enable={},t&&(n.enable.dotAll=!0),e&&(n.enable.ignoreCase=!0)),(!t||!e)&&(n.disable={},!t&&(n.disable.dotAll=!0),!e&&(n.disable.ignoreCase=!0)),n}function d3(t){if(!t)throw new Error("Node expected");const{body:e}=t;return Array.isArray(e)?e:e?[e]:null}function u3(t){const e=t.find(n=>n.kind==="search_start"||fO(n,{negate:!1})||!pO(n));if(!e)return null;if(e.kind==="search_start")return e;if(e.type==="LookaroundAssertion")return e.body[0].body[0];if(e.type==="CapturingGroup"||e.type==="Group"){const n=[];for(const r of e.body){const o=u3(r.body);if(!o)return null;Array.isArray(o)?n.push(...o):n.push(o)}return n}return null}function p3(t,e){const n=d3(t)??[];for(const r of n)if(r===e||p3(r,e))return!0;return!1}function pO({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function mO(t){const e=["Character","CharacterClass","CharacterSet"];return e.includes(t.type)||t.type==="Quantifier"&&t.min&&e.includes(t.body.type)}function fO(t,e){const n={negate:null,...e};return t.type==="LookaroundAssertion"&&(n.negate===null||t.negate===n.negate)&&t.body.length===1&&Z6(t.body[0],{type:"Assertion",kind:"search_start"})}function ig(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function Li(t,e){const r=J6(t,{...e,unicodePropertyMap:vv}).body;return r.length>1||r[0].body.length>1?Fo({body:r}):r[0].body[0]}function sg(t,e){return t.negate=e,t}function ps(t,e){return t.parent=e,t}function In(t,e){return a3(t),t.parent=e,t}function gO(t,e){const n=o3(e),r=Dh(n.target,"ES2024"),o=Dh(n.target,"ES2025"),i=n.rules.recursionLimit;if(!Number.isInteger(i)||i<2||i>20)throw new Error("Invalid recursionLimit; use 2-20");let s=null,a=null;if(!o){const m=[t.flags.ignoreCase];Mc(t,hO,{getCurrentModI:()=>m.at(-1),popModI(){m.pop()},pushModI(p){m.push(p)},setHasCasedChar(){m.at(-1)?s=!0:a=!0}})}const l={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||s)&&!a)};let c=t;const d={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:t._originMap,recursionLimit:i,useAppliedIgnoreCase:!!(!o&&s&&a),useFlagMods:o,useFlagV:r,verbose:n.verbose};function u(m){return d.lastNode=c,c=m,Zz(vO[m.type],`Unexpected node type "${m.type}"`)(m,d,u)}const f={pattern:t.body.map(u).join("|"),flags:u(t.flags),options:{...t.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],d.captureMap.forEach((m,p)=>{m.hidden&&f._hiddenCaptures.push(p),m.transferTo&&Hc(f._captureTransfers,m.transferTo,[]).push(p)}),f}var hO={"*":{enter({node:t},e){if(qk(t)){const n=e.getCurrentModI();e.pushModI(t.flags?Ap({ignoreCase:n},t.flags).ignoreCase:n)}},exit({node:t},e){qk(t)&&e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){bv(Hn(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},n){e(),m3(t,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:t},e){t.kind==="property"&&s3.has(t.value)&&e.setHasCasedChar()}},vO={Alternative({body:t},e,n){return t.map(n).join("")},Assertion({kind:t,negate:e}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return e?mt`\B`:mt`\b`;throw new Error(`Unexpected assertion kind "${t}"`)},Backreference({ref:t},e){if(typeof t!="number")throw new Error("Unexpected named backref in transformed AST");if(!e.useFlagMods&&e.accuracy==="strict"&&e.currentFlags.ignoreCase&&!e.captureMap.get(t).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t},CapturingGroup(t,e,n){const{body:r,name:o,number:i}=t,s={ignoreCase:e.currentFlags.ignoreCase},a=e.originMap.get(t);return a&&(s.hidden=!0,i>a.number&&(s.transferTo=a.number)),e.captureMap.set(i,s),`(${o?`?<${o}>`:""}${r.map(n).join("|")})`},Character({value:t},e){const n=Hn(t),r=Na(t,{escDigit:e.lastNode.type==="Backreference",inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(r!==n)return r;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&bv(n)){const o=i3(n);return e.inCharClass?o.join(""):o.length>1?`[${o.join("")}]`:o[0]}return n},CharacterClass(t,e,n){const{kind:r,negate:o,parent:i}=t;let{body:s}=t;if(r==="intersection"&&!e.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");Ki.bugFlagVLiteralHyphenIsRange&&e.useFlagV&&s.some(Kk)&&(s=[wm(45),...s.filter(c=>!Kk(c))]);const a=()=>`[${o?"^":""}${s.map(n).join(r==="intersection"?"&&":"")}]`;if(!e.inCharClass){if((!e.useFlagV||Ki.bugNestedClassIgnoresNegation)&&!o){const d=s.filter(u=>u.type==="CharacterClass"&&u.kind==="union"&&u.negate);if(d.length){const u=Fo(),f=u.body[0];return u.parent=i,f.parent=u,s=s.filter(m=>!d.includes(m)),t.body=s,s.length?(t.parent=f,f.body.push(t)):u.body.pop(),d.forEach(m=>{const p=ua({body:[m]});m.parent=p,p.parent=u,u.body.push(p)}),n(u)}}e.inCharClass=!0;const c=a();return e.inCharClass=!1,c}const l=s[0];if(r==="union"&&!o&&l&&((!e.useFlagV||!e.verbose)&&i.kind==="union"&&!(Ki.bugFlagVLiteralHyphenIsRange&&e.useFlagV)||!e.verbose&&i.kind==="intersection"&&s.length===1&&l.type!=="CharacterClassRange"))return s.map(n).join("");if(!e.useFlagV&&i.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(t,e){const n=t.min.value,r=t.max.value,o={escDigit:!1,inCharClass:!0,useFlagV:e.useFlagV},i=Na(n,o),s=Na(r,o),a=new Set;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase){const l=m3(t);xO(l).forEach(d=>{a.add(Array.isArray(d)?`${Na(d[0],o)}-${Na(d[1],o)}`:Na(d,o))})}return`${i}-${s}${[...a].join("")}`},CharacterSet({kind:t,negate:e,value:n,key:r},o){if(t==="dot")return o.currentFlags.dotAll?o.appliedGlobalFlags.dotAll||o.useFlagMods?".":"[^]":mt`[^\n]`;if(t==="digit")return e?mt`\D`:mt`\d`;if(t==="property"){if(o.useAppliedIgnoreCase&&o.currentFlags.ignoreCase&&s3.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${e?mt`\P`:mt`\p`}{${r?`${r}=`:""}${n}}`}if(t==="word")return e?mt`\W`:mt`\w`;throw new Error(`Unexpected character set kind "${t}"`)},Flags(t,e){return(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:e,flags:n,parent:r},o,i){const s=o.currentFlags;n&&(o.currentFlags=Ap(s,n));const a=e.map(i).join("|"),l=!o.verbose&&e.length===1&&r.type!=="Quantifier"&&!t&&(!o.useFlagMods||!n)?a:`(?${SO(t,n,o.useFlagMods)}${a})`;return o.currentFlags=s,l},LookaroundAssertion({body:t,kind:e,negate:n},r,o){return`(?${`${e==="lookahead"?"":"<"}${n?"!":"="}`}${t.map(o).join("|")})`},Quantifier(t,e,n){return n(t.body)+AO(t)},Subroutine({isRecursive:t,ref:e},n){if(!t)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return e===0?`(?R=${r})`:mt`\g<${e}&R=${r}>`}},bO=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),yO=new Set(["-","\\","]","^","["]),kO=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),Hk=new Map([[9,mt`\t`],[10,mt`\n`],[11,mt`\v`],[12,mt`\f`],[13,mt`\r`],[8232,mt`\u2028`],[8233,mt`\u2029`],[65279,mt`\uFEFF`]]),wO=/^\p{Cased}$/u;function bv(t){return wO.test(t)}function m3(t,e){const n=!!e?.firstOnly,r=t.min.value,o=t.max.value,i=[];if(r<65&&(o===65535||o>=131071)||r===65536&&o>=131071)return i;for(let s=r;s<=o;s++){const a=Hn(s);if(!bv(a))continue;const l=i3(a).filter(c=>{const d=c.codePointAt(0);return do});if(l.length&&(i.push(...l),n))break}return i}function Na(t,{escDigit:e,inCharClass:n,useFlagV:r}){if(Hk.has(t))return Hk.get(t);if(t<32||t>126&&t<160||t>262143||e&&CO(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;const o=n?r?kO:yO:bO,i=Hn(t);return(o.has(i)?"\\":"")+i}function xO(t){const e=t.map(o=>o.codePointAt(0)).sort((o,i)=>o-i),n=[];let r=null;for(let o=0;o";let r="";if(e&&n){const{enable:o,disable:i}=e;r=(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")+(i?"-":"")+(i?.ignoreCase?"i":"")+(i?.dotAll?"s":"")}return`${r}:`}function AO({kind:t,max:e,min:n}){let r;return!n&&e===1?r="?":!n&&e===1/0?r="*":n===1&&e===1/0?r="+":n===e?r=`{${n}}`:r=`{${n},${e===1/0?"":e}}`,r+{greedy:"",lazy:"?",possessive:"+"}[t]}function qk({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function CO(t){return t>47&&t<58}function Kk({type:t,value:e}){return t==="Character"&&e===45}var IO=class zh extends RegExp{#t=new Map;#e=null;#r;#n=null;#o=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(e,n,r){const o=!!r?.lazyCompile;if(e instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const i=e;super(i,n),this.#r=i.source,i instanceof zh&&(this.#t=i.#t,this.#n=i.#n,this.#o=i.#o,this.rawOptions=i.rawOptions)}else{const i={hiddenCaptures:[],strategy:null,transfers:[],...r};super(o?"":e,n),this.#r=e,this.#t=EO(i.hiddenCaptures,i.transfers),this.#o=i.strategy,this.rawOptions=r??{}}o||(this.#e=this)}exec(e){if(!this.#e){const{lazyCompile:o,...i}=this.rawOptions;this.#e=new zh(this.#r,this.flags,i)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#o==="clip_search"&&n&&r){this.lastIndex=0;const o=this.#i(e.slice(r));return o&&(TO(o,r,e,this.hasIndices),this.lastIndex+=r),o}return this.#i(e)}#i(e){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,e);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let o;this.hasIndices&&(o=[...n.indices],n.indices.length=1);const i=[0];for(let s=1;s{const a=i[s];a&&(i[s]=[a[0]+e,a[1]+e])})}}function EO(t,e){const n=new Map;for(const r of t)n.set(r,{hidden:!0});for(const[r,o]of e)for(const i of o)Hc(n,i,{}).transferTo=r;return n}function MO(t){const e=/(?\((?:\?<(?![=!])(?[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,o=0,i;for(;i=e.exec(t);){const{0:s,groups:{capture:a,name:l}}=i;s==="["?r++:r?s==="]"&&r--:a&&(o++,l&&n.set(o,l))}return n}function LO(t,e){const n=PO(t,e);return n.options?new IO(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function PO(t,e){const n=o3(e),r=J6(t,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:vv}),o=oO(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=gO(o,n),s=Wz(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:"external"}),a=qz(s.pattern),l=Hz(a.pattern,{captureTransfers:s.captureTransfers,hiddenCaptures:s.hiddenCaptures}),c={pattern:l.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${i.flags}${i.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const d=l.hiddenCaptures.sort((p,g)=>p-g),u=Array.from(l.captureTransfers),f=o._strategy,m=c.pattern.length>=n.lazyCompileLength;(d.length||u.length||f||m)&&(c.options={...d.length&&{hiddenCaptures:d},...u.length&&{transfers:u},...f&&{strategy:f},...m&&{lazyCompile:m}})}return c}const Wk=4294967295;class _O{constructor(e,n={}){this.patterns=e,this.options=n;const{forgiving:r=!1,cache:o,regexConstructor:i}=n;if(!i)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(s=>{if(typeof s!="string")return s;const a=o?.get(s);if(a){if(a instanceof RegExp)return a;if(r)return null;throw a}try{const l=i(s);return o?.set(s,l),l}catch(l){if(o?.set(s,l),r)return null;throw l}})}regexps;findNextMatchSync(e,n,r){const o=typeof e=="string"?e:e.content,i=[];function s(a,l,c=0){return{index:a,captureIndices:l.indices.map(d=>d==null?{start:Wk,end:Wk,length:0}:{start:d[0]+c,end:d[1]+c,length:d[1]-d[0]})}}for(let a=0;al[1].index));for(const[l,c,d]of i)if(c.index===a)return s(l,c,d)}return null}}function DO(t,e){return LO(t,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...e})}function zO(t={}){const e=Object.assign({target:"auto",cache:new Map},t);return e.regexConstructor||=n=>DO(n,{target:e.target}),{createScanner(n){return new _O(n,e)},createString(n){return{content:n}}}}async function f3(t){if(t6())throw new 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.`);const e=qf.get(t);if(e!=null)return e;try{let n=$L.get(t);if(n==null&&Object.prototype.hasOwnProperty.call(Uc,t)&&(n=Uc[t]),n==null)throw new Error(`resolveLanguage: "${t}" not found in bundled or custom languages`);const r=n().then(({default:o})=>{const i={name:t,data:o};return da.has(t)||da.set(t,i),i});return qf.set(t,r),await r}finally{qf.delete(t)}}function g3(t){return da.get(t)??f3(t)}const Wi=new Map,ag=new Map,Oh=new Map,jh=new Set;function Rh(t,e){t=Array.isArray(t)?t:[t];for(let n of t){let r;if(typeof n=="string"){if(r=Wi.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Wi.has(n)||Wi.set(n,r);jh.has(n)||(jh.add(n),e.loadThemeSync(r))}}async function h3(t){if(t6())throw new Error(`resolveTheme("${t}") cannot be called from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const e=ag.get(t);if(e!=null)return e;try{const n=Oh.get(t)??B6[t];if(n==null)throw new Error(`resolveTheme: No valid loader for ${t}`);const r=n().then(i=>OO(t,"default"in i?i.default:i));ag.set(t,r);const o=await r;if(o.name!==t)throw new Error(`resolvedTheme: themeName: ${t} does not match theme.name: ${o.name}`);return Wi.set(o.name,o),o}finally{ag.delete(t)}}function OO(t,e){const n=Wi.get(t);return n??(e=bm(e),Wi.set(t,e),e)}function v3(t){return Wi.get(t)??h3(t)}function yv(t,e){if(Oh.has(t)){console.error("SharedHighlight.registerCustomTheme: theme name already registered",t);return}Oh.set(t,e)}let ai;async function kl({themes:t,langs:e,preferredHighlighter:n="shiki-js"}){ai??=GD({themes:[],langs:["text"],engine:n==="shiki-wasm"?U6(F(()=>import("./wasm-CG6Dc4jp.js"),[])):zO()});const r=jO(ai)?await ai:ai;ai=r;const o=[];for(const s of e){if(s==="text"||s==="ansi")continue;const a=g3(s);"then"in a?o.push(a):ik(a,r)}const i=[];for(const s of t){const a=v3(s);"then"in a?i.push(a):Rh(a,ai)}return(o.length>0||i.length>0)&&await Promise.all([Promise.all(o).then(s=>{ik(s,r)}),Promise.all(i).then(s=>{Rh(s,r)})]),r}function b3(){if(ai!=null&&!("then"in ai))return ai}function jO(t=ai){return t!=null&&"then"in t}yv("pierre-dark",()=>F(()=>import("./pierre-dark-BXuwtOqb.js"),[]));yv("pierre-light",()=>F(()=>import("./pierre-light-dckrK0oj.js"),[]));function qc(t=mr){const e=[];return typeof t=="string"?e.push(t):(e.push(t.dark),e.push(t.light)),e}function Lc(t){for(const e of qc(t))if(!jh.has(e))return!1;return!0}function Nh(t){for(const e of t)if(!Wi.has(e))return!1;return!0}function Am(t,e){return t==null||e==null?t===e:t.startingLine===e.startingLine&&t.totalLines===e.totalLines&&t.bufferBefore===e.bufferBefore&&t.bufferAfter===e.bufferAfter}function kv(t,e){return t==null||e==null||typeof t=="string"||typeof e=="string"?t===e:t.dark===e.dark&&t.light===e.light}function Ji(t){return{type:"text",value:t}}function _t({tagName:t,children:e=[],properties:n={}}){return{type:"element",tagName:t,properties:n,children:e}}function Fh({name:t,width:e=16,height:n=16,properties:r}){return _t({tagName:"svg",properties:{width:e,height:n,viewBox:"0 0 16 16",...r},children:[_t({tagName:"use",properties:{href:`#${t.replace(/^#/,"")}`}})]})}function RO(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e;"children"in e?e=e.children[0]:e=null}}function il(t){return _t({tagName:"div",properties:{"data-gutter":""},children:t})}function y3(t,e,n){return _t({tagName:"div",properties:{"data-line-type":t,"data-column-number":e,"data-line-index":n},children:e!=null?[_t({tagName:"span",properties:{"data-line-number-content":""},children:[Ji(`${e}`)]})]:void 0})}function go(t,e,n){return _t({tagName:"div",properties:{"data-gutter-buffer":e,"data-buffer-size":n,"data-line-type":e==="annotation"?void 0:t,style:e==="annotation"?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Wu(t){return _t({tagName:"div",children:[_t({tagName:"div",children:t.annotations?.map(e=>_t({tagName:"slot",properties:{name:e}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${t.hunkIndex},${t.lineIndex}`}})}function NO(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 k3({fileOrDiff:t,themeStyles:e,themeType:n}){const r="type"in t?t:void 0,o={"data-diffs-header":"","data-change-type":r?.type,"data-theme-type":n!=="system"?n:void 0,style:e};return _t({tagName:"div",children:[FO({name:t.name,prevName:"prevName"in t?t.prevName:void 0,iconType:r?.type??"file"}),$O(r)],properties:o})}function FO({name:t,prevName:e,iconType:n}){const r=[Fh({name:NO(n),properties:{"data-change-icon":n}})];return e!=null&&(r.push(_t({tagName:"div",children:[Ji(e)],properties:{"data-prev-name":""}})),r.push(Fh({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),r.push(_t({tagName:"div",children:[Ji(t)],properties:{"data-title":""}})),_t({tagName:"div",children:r,properties:{"data-header-content":""}})}function $O(t){const e=[];if(t!=null){let n=0,r=0;for(const o of t.hunks)n+=o.additionLines,r+=o.deletionLines;(r>0||n===0)&&e.push(_t({tagName:"span",children:[Ji(`-${r}`)],properties:{"data-deletions-count":""}})),(n>0||r===0)&&e.push(_t({tagName:"span",children:[Ji(`+${n}`)],properties:{"data-additions-count":""}}))}return e.push(_t({tagName:"slot",properties:{name:tv}})),_t({tagName:"div",children:e,properties:{"data-metadata":""}})}function w3(t){return _t({tagName:"pre",properties:BO(t)})}function BO({diffIndicators:t,disableBackground:e,disableLineNumbers:n,overflow:r,split:o,themeType:i,themeStyles:s,totalLines:a,type:l}){const c={"data-diff":l==="diff"?"":void 0,"data-file":l==="file"?"":void 0,"data-diff-type":l==="diff"?o?"split":"single":void 0,"data-overflow":r,"data-disable-line-numbers":n?"":void 0,"data-background":e?void 0:"","data-indicators":t==="bars"||t==="classic"?t:void 0,"data-theme-type":i!=="system"?i:void 0,style:s,tabIndex:0};return c.style+=`--diffs-min-number-column-width-default:${`${a}`.length}ch;`,c}const Fa=new Map,ec={"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","🔥":"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",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",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 xo(t){if(Fa.has(t))return Fa.get(t)??"text";if(ec[t]!=null)return ec[t];const e=t.match(/\.([^/\\]+\.[^/\\]+)$/);if(e!=null){if(Fa.has(e[1]))return Fa.get(e[1])??"text";if(ec[e[1]]!=null)return ec[e[1]]??"text"}const n=t.match(/\.([^.]+)$/)?.[1]??"";return Fa.has(n)?Fa.get(n)??"text":ec[n]??"text"}function x3(t,{theme:e,preferredHighlighter:n="shiki-js"}){return{langs:[t??"text"],themes:qc(e),preferredHighlighter:n}}function pa(t){return`annotation-${"side"in t?`${t.side}-`:""}${t.lineNumber}`}function ma(t){return t.replace(/\n$|\r\n$/,"")}function VO(t,e,n){const r=typeof n.lineInfo=="function"?n.lineInfo(e):n.lineInfo[e-1];if(r==null){const o=`processLine: line ${e}, contains no state.lineInfo`;throw console.error(o,{node:t,line:e,state:n}),new Error(o)}return t.tagName="div",t.properties["data-line"]=r.lineNumber,t.properties["data-alt-line"]=r.altLineNumber,t.properties["data-line-type"]=r.type,t.properties["data-line-index"]=r.lineIndex,t.children.length===0&&t.children.push(Ji(` `)),t}function UO(t={}){const{classPrefix:e="__shiki_",classSuffix:n="",classReplacer:r=a=>a}=t,o=new Map;function i(a){return Object.entries(a).map(([l,c])=>`${l}:${c}`).join(";")}function s(a){const l=typeof a=="string"?a:i(a);let c=e+HO(l)+n;return c=r(c),o.has(c)||o.set(c,typeof a=="string"?a:{...a}),c}return{name:"@shikijs/transformers:style-to-class",pre(a){if(!a.properties.style)return;const l=s(a.properties.style);delete a.properties.style,this.addClassToHast(a,l)},tokens(a){for(const l of a)for(const c of l){if(!c.htmlStyle)continue;const d=s(c.htmlStyle);c.htmlStyle={},c.htmlAttrs||={},c.htmlAttrs.class?c.htmlAttrs.class+=` ${d}`:c.htmlAttrs.class=d}},getClassRegistry(){return o},getCSS(){let a="";for(const[l,c]of o.entries())a+=`.${l}{${typeof c=="string"?c:i(c)}}`;return a},clearRegistry(){o.clear()}}}function HO(t,e=0){let n=3735928559^e,r=1103547991^e;for(let o=0,i;o>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function S3(t=!1){const e={lineInfo:[]},n=[{line(r){return delete r.properties.class,r},pre(r){const o=RO(r),i=[];if(o!=null){let s=1;for(const a of o.children)a.type==="element"&&(i.push(VO(a,s,e)),s++);o.children=i}return r}}];return t&&n.push(qO,Gk),{state:e,transformers:n,toClass:Gk}}const Gk=UO({classPrefix:"hl-"}),qO={name:"token-style-normalizer",tokens(t){for(const e of t)for(const n of e){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function qr(t){return`--${t==="token"?"diffs-token":"diffs"}-`}function A3({theme:t=mr,highlighter:e,prefix:n}){let r="";if(typeof t=="string"){const o=e.getTheme(t);r+=`color:${o.fg};`,r+=`background-color:${o.bg};`,r+=`${qr("global")}fg:${o.fg};`,r+=`${qr("global")}bg:${o.bg};`,r+=lg(o,n)}else{let o=e.getTheme(t.dark);r+=`${qr("global")}dark:${o.fg};`,r+=`${qr("global")}dark-bg:${o.bg};`,r+=lg(o,"dark"),o=e.getTheme(t.light),r+=`${qr("global")}light:${o.fg};`,r+=`${qr("global")}light-bg:${o.bg};`,r+=lg(o,"light")}return r}function lg(t,e){e=e!=null?`${e}-`:"";let n="";const r=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];r!=null&&(n+=`${qr("global")}${e}addition-color:${r};`);const o=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];o!=null&&(n+=`${qr("global")}${e}deletion-color:${o};`);const i=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];return i!=null&&(n+=`${qr("global")}${e}modified-color:${i};`),n}function $h(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e.children;"children"in e?e=e.children[0]:e=null}throw console.error(t),new Error("getLineNodes: Unable to find children")}function Cp({lines:t,startingLine:e=0,totalLines:n=1/0,callback:r}){const o=Math.min(e+n,t.length),i=(()=>{const s=t.at(-1);return s===""||s===` `||s===`\r `||s==="\r"?Math.max(0,t.length-2):t.length-1})();for(let s=e;s0||s<1/0,{state:c,transformers:d}=S3(),u=o?"text":t.lang??xo(t.name),f=(()=>{if(typeof n=="string")return e.getTheme(n).type})(),m=A3({theme:n,highlighter:e});c.lineInfo=k=>({type:"context",lineIndex:k-1+i,lineNumber:k+i});const p=typeof n=="string"?{lang:u,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:qr("token"),tokenizeMaxLineLength:r}:{lang:u,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:qr("token"),tokenizeMaxLineLength:r},g=$h(e.codeToHast(l?WO(a??Bh(t.contents),i,s):ma(t.contents),p)),h=l?new Array(i):g;return l&&h.push(...g),{code:h,themeStyles:m,baseThemeType:f}}function WO(t,e,n){let r="";return Cp({lines:t,startingLine:e,totalLines:n,callback({content:o}){r+=o}}),r}function I3(t,e){return _t({tagName:"div",children:t,properties:{"data-content":"",style:`grid-row: span ${e}`}})}let GO=-1;var ZO=class{__id=`file-renderer:${++GO}`;highlighter;renderCache;computedLang="text";lineAnnotations={};lineCache;constructor(t={theme:mr},e,n){this.options=t,this.onRenderUpdate=e,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Lc(t.theme??mr)?b3():void 0)}setOptions(t){this.options=t}mergeOptions(t){this.options={...this.options,...t}}setThemeType(t){(this.options.themeType??"system")!==t&&this.mergeOptions({themeType:t})}setLineAnnotations(t){this.lineAnnotations={};for(const e of t){const n=this.lineAnnotations[e.lineNumber]??[];this.lineAnnotations[e.lineNumber]=n,n.push(e)}}cleanUp(){this.renderCache=void 0,this.highlighter=void 0,this.workerManager=void 0,this.onRenderUpdate=void 0,this.lineCache=void 0}hydrate(t){const{options:e}=this.getRenderOptions(t);let n=this.workerManager?.getFileResultCache(t);n!=null&&!cg(e,n.options)&&(n=void 0),this.renderCache??={file:t,options:e,highlighted:!0,result:n?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0&&this.renderCache.result==null?this.workerManager.highlightFileAST(this,t):this.asyncHighlight(t).then(({result:r,options:o})=>{this.onHighlightSuccess(t,r,o)})}getRenderOptions(t){const e=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();const{theme:r=mr,tokenizeMaxLineLength:o=1e3}=this.options;return{theme:r,tokenizeMaxLineLength:o}})(),{renderCache:n}=this;return n?.result==null?{options:e,forceRender:!0}:t!==n.file||!cg(e,n.options)?{options:e,forceRender:!0}:{options:e,forceRender:!1}}getOrCreateLineCache(t){if(t.cacheKey==null)return this.lineCache=void 0,Bh(t.contents);let{lineCache:e}=this;return(e==null||e.cacheKey!==t.cacheKey)&&(e={cacheKey:t.cacheKey,lines:Bh(t.contents)}),this.lineCache=e,e.lines}renderFile(t=this.renderCache?.file,e=dp){if(t==null)return;const n=this.workerManager?.getFileResultCache(t);n!=null&&this.renderCache==null&&(this.renderCache={file:t,highlighted:!0,renderRange:void 0,...n});const{options:r,forceRender:o}=this.getRenderOptions(t);if(this.renderCache??={file:t,highlighted:!1,options:r,result:void 0,renderRange:void 0},this.workerManager?.isWorkingPool()===!0)(this.renderCache.result==null||!this.renderCache.highlighted&&!Am(this.renderCache.renderRange,e))&&(this.renderCache.result=this.workerManager.getPlainFileAST(t,e.startingLine,e.totalLines,this.getOrCreateLineCache(t)),this.renderCache.renderRange=e),e.totalLines>0&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightFileAST(this,t);else{this.computedLang=t.lang??xo(t.name);const i=this.highlighter!=null&&Lc(r.theme),s=this.highlighter!=null&&mp(this.computedLang);if(this.highlighter!=null&&i&&(o||!this.renderCache.highlighted&&s||this.renderCache.result==null)){const{result:a,options:l}=this.renderFileWithHighlighter(t,this.highlighter,!s);this.renderCache={file:t,options:l,highlighted:s,result:a,renderRange:void 0}}(!i||!s)&&this.asyncHighlight(t).then(({result:a,options:l})=>{this.onHighlightSuccess(t,a,l)})}return this.renderCache.result!=null?this.processFileResult(this.renderCache.file,e,this.renderCache.result):void 0}async asyncRender(t,e=dp){const{result:n}=await this.asyncHighlight(t);return this.processFileResult(t,e,n)}async asyncHighlight(t){this.computedLang=t.lang??xo(t.name);const e=this.highlighter!=null&&Nh(qc(this.options.theme)),n=this.highlighter!=null&&mp(this.computedLang);return(this.highlighter==null||!e||!n)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(t,this.highlighter)}renderFileWithHighlighter(t,e,n=!1){const{options:r}=this.getRenderOptions(t);return{result:C3(t,e,r,{forcePlainText:n}),options:r}}processFileResult(t,e,{code:n,themeStyles:r,baseThemeType:o}){const{disableFileHeader:i=!1}=this.options,s=[],a=il(),l=this.getOrCreateLineCache(t);let c=0;return Cp({lines:l,startingLine:e.startingLine,totalLines:e.totalLines,callback:({lineIndex:d,lineNumber:u})=>{const f=n[d];if(f==null){const m="FileRenderer.processFileResult: Line doesnt exist";throw console.error(m,{name:t.name,lineIndex:d,lineNumber:u,lines:l}),new Error(m)}if(f!=null){a.children.push(y3("context",u,`${d}`)),s.push(f),c++;const m=this.lineAnnotations[u];m!=null&&(a.children.push(go("context","annotation",1)),s.push(Wu({hunkIndex:0,lineIndex:u,annotations:m.map(p=>pa(p))})),c++)}}}),a.properties.style=`grid-row: span ${c}`,{gutterAST:a.children??[],contentAST:s,preAST:this.createPreElement(l.length,r,o),headerAST:i?void 0:this.renderHeader(t,r,o),totalLines:l.length,rowCount:c,themeStyles:r,baseThemeType:o,bufferBefore:e.bufferBefore,bufferAfter:e.bufferAfter,css:""}}renderHeader(t,e,n){const{themeType:r="system"}=this.options;return k3({fileOrDiff:t,themeStyles:e,themeType:n??r})}renderFullHTML(t){return qi(this.renderFullAST(t))}renderFullAST(t,e=[]){return e.push(_t({tagName:"code",children:this.renderCodeAST(t),properties:{"data-code":""}})),{...t.preAST,children:e}}renderCodeAST(t){const e=il();return e.children=t.gutterAST,e.properties.style=`grid-row: span ${t.rowCount}`,[e,I3(t.contentAST,t.rowCount)]}renderPartialHTML(t,e=!1){return qi(e?_t({tagName:"code",children:t,properties:{"data-code":""}}):t)}async initializeHighlighter(){return this.highlighter=await kl(x3(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(t,e,n){if(this.renderCache==null)return;const r=this.renderCache.file!==t||!this.renderCache.highlighted||!cg(n,this.renderCache.options);this.renderCache={file:t,options:n,highlighted:!0,result:e,renderRange:void 0},r&&this.onRenderUpdate?.()}onHighlightError(t){console.error(t)}createPreElement(t,e,n){const{disableLineNumbers:r=!1,overflow:o="scroll",themeType:i="system"}=this.options;return w3({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:r,overflow:o,themeStyles:e,themeType:n??i,split:!1,totalLines:t})}};function cg(t,e){return kv(t.theme,e.theme)&&t.tokenizeMaxLineLength===e.tokenizeMaxLineLength}const T3=``;function Ip(t,e){return t?.cacheKey===e?.cacheKey&&t?.contents===e?.contents&&t?.name===e?.name&&t?.lang===e?.lang}function JO(t,e){return t.lineNumber===e.lineNumber&&t.metadata===e.metadata}function E3(t,e){return t==null||e==null?t===e:t.type===e.type&&t.diffIndicators===e.diffIndicators&&t.disableBackground===e.disableBackground&&t.disableLineNumbers===e.disableLineNumbers&&t.overflow===e.overflow&&t.split===e.split&&t.themeStyles===e.themeStyles&&t.themeType===e.themeType&&t.totalLines===e.totalLines}function M3(t){const e=document.createElement("div");return e.dataset.annotationSlot="",e.slot=t,e.style.whiteSpace="normal",e}function L3(){const t=document.createElement("div");return t.slot="hover-slot",t.style.position="absolute",t.style.top="0",t.style.bottom="0",t.style.textAlign="center",t.style.whiteSpace="normal",t}function P3(){const t=document.createElement("style");return t.setAttribute(nv,""),t}var QO=`@layer base, theme, unsafe; @layer base { :host { --diffs-bg: #fff; --diffs-fg: #000; --diffs-font-fallback: 'SF Mono', Monaco, Consolas, 'Ubuntu Mono', 'Liberation Mono', 'Courier New', monospace; --diffs-header-font-fallback: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif; --diffs-mixer: light-dark(black, white); --diffs-gap-fallback: 8px; /* // Available CSS Color Overrides --diffs-bg-buffer-override --diffs-bg-hover-override --diffs-bg-context-override --diffs-bg-separator-override --diffs-fg-number-override --diffs-fg-number-addition-override --diffs-fg-number-deletion-override --diffs-deletion-color-override --diffs-addition-color-override --diffs-modified-color-override --diffs-bg-deletion-override --diffs-bg-deletion-number-override --diffs-bg-deletion-hover-override --diffs-bg-deletion-emphasis-override --diffs-bg-addition-override --diffs-bg-addition-number-override --diffs-bg-addition-hover-override --diffs-bg-addition-emphasis-override // Line Selection Color Overrides (for enableLineSelection) --diffs-selection-color-override --diffs-bg-selection-override --diffs-bg-selection-number-override --diffs-bg-selection-background-override --diffs-bg-selection-number-background-override // Available CSS Layout Overrides --diffs-gap-inline --diffs-gap-block --diffs-gap-style --diffs-tab-size */ color-scheme: light dark; display: block; font-family: var( --diffs-header-font-family, var(--diffs-header-font-fallback) ); font-size: var(--diffs-font-size, 13px); line-height: var(--diffs-line-height, 20px); font-feature-settings: var(--diffs-font-features); } /* NOTE(mdo): Some semantic HTML elements (e.g. \`pre\`, \`code\`) have default * user-agent styles. These must be overridden to use our custom styles. */ pre, code, [data-error-wrapper] { isolation: isolate; margin: 0; padding: 0; display: block; outline: none; font-family: var(--diffs-font-family, var(--diffs-font-fallback)); } pre, code { background-color: var(--diffs-bg); } code { contain: content; } *, *::before, *::after { box-sizing: border-box; } [data-icon-sprite] { display: none; } /* NOTE(mdo): Headers and separators are within pre/code, so we need to reset * their font-family explicitly. */ [data-diffs-header], [data-separator] { font-family: var( --diffs-header-font-family, var(--diffs-header-font-fallback) ); } [data-file-info] { padding: 10px; font-weight: 700; color: var(--fg); /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor * and vscode use an older build of chrome that appears to have a bug with * color-mix and 'in oklch', so use 'in lab' instead */ background-color: color-mix(in lab, var(--bg) 98%, var(--fg)); border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg)); } [data-diffs-header], [data-diff], [data-file], [data-error-wrapper], [data-virtualizer-buffer] { --diffs-bg: light-dark(var(--diffs-light-bg), var(--diffs-dark-bg)); /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor * and vscode use an older build of chrome that appears to have a bug with * color-mix and 'in oklch', so use 'in lab' instead */ --diffs-bg-buffer: var( --diffs-bg-buffer-override, light-dark( color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)) ) ); --diffs-bg-hover: var( --diffs-bg-hover-override, light-dark( color-mix(in lab, var(--diffs-bg) 97%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-mixer)) ) ); --diffs-bg-context: var( --diffs-bg-context-override, light-dark( color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer)) ) ); --diffs-bg-context-number: var( --diffs-bg-context-number-override, light-dark( color-mix(in lab, var(--diffs-bg-context) 80%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 60%, var(--diffs-bg)) ) ); --diffs-bg-separator: var( --diffs-bg-separator-override, light-dark( color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer)) ) ); --diffs-fg: light-dark(var(--diffs-light), var(--diffs-dark)); --diffs-fg-number: var( --diffs-fg-number-override, light-dark( color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)) ) ); --diffs-deletion-base: var( --diffs-deletion-color-override, light-dark( var( --diffs-light-deletion-color, var(--diffs-deletion-color, rgb(255, 0, 0)) ), var( --diffs-dark-deletion-color, var(--diffs-deletion-color, rgb(255, 0, 0)) ) ) ); --diffs-addition-base: var( --diffs-addition-color-override, light-dark( var( --diffs-light-addition-color, var(--diffs-addition-color, rgb(0, 255, 0)) ), var( --diffs-dark-addition-color, var(--diffs-addition-color, rgb(0, 255, 0)) ) ) ); --diffs-modified-base: var( --diffs-modified-color-override, light-dark( var( --diffs-light-modified-color, var(--diffs-modified-color, rgb(0, 0, 255)) ), var( --diffs-dark-modified-color, var(--diffs-modified-color, rgb(0, 0, 255)) ) ) ); /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor * and vscode use an older build of chrome that appears to have a bug with * color-mix and 'in oklch', so use 'in lab' instead */ --diffs-bg-deletion: var( --diffs-bg-deletion-override, light-dark( color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)) ) ); --diffs-bg-deletion-number: var( --diffs-bg-deletion-number-override, light-dark( color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-deletion-base)) ) ); --diffs-bg-deletion-hover: var( --diffs-bg-deletion-hover-override, light-dark( color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-deletion-base)) ) ); --diffs-bg-deletion-emphasis: var( --diffs-bg-deletion-emphasis-override, light-dark( rgb(from var(--diffs-deletion-base) r g b / 0.15), rgb(from var(--diffs-deletion-base) r g b / 0.2) ) ); --diffs-bg-addition: var( --diffs-bg-addition-override, light-dark( color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)) ) ); --diffs-bg-addition-number: var( --diffs-bg-addition-number-override, light-dark( color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-addition-base)) ) ); --diffs-bg-addition-hover: var( --diffs-bg-addition-hover-override, light-dark( color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-addition-base)) ) ); --diffs-bg-addition-emphasis: var( --diffs-bg-addition-emphasis-override, light-dark( rgb(from var(--diffs-addition-base) r g b / 0.15), rgb(from var(--diffs-addition-base) r g b / 0.2) ) ); --diffs-selection-base: var(--diffs-modified-base); --diffs-selection-number-fg: light-dark( color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)) ); --diffs-bg-selection: var( --diffs-bg-selection-override, light-dark( color-mix(in lab, var(--diffs-bg) 82%, var(--diffs-selection-base)), color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base)) ) ); --diffs-bg-selection-number: var( --diffs-bg-selection-number-override, light-dark( color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base)), color-mix(in lab, var(--diffs-bg) 60%, var(--diffs-selection-base)) ) ); background-color: var(--diffs-bg); color: var(--diffs-fg); } [data-diff], [data-file] { /* This feels a bit crazy to me... so I need to think about it a bit more... */ --diffs-grid-number-column-width: minmax(min-content, max-content); --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr; &[data-dehydrated] { --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr); } &[data-theme-type='light'], & { [data-line] span { color: light-dark( var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)) ); font-weight: var(--diffs-token-light-font-weight, inherit); font-style: var(--diffs-token-light-font-style, inherit); -webkit-text-decoration: var(--diffs-token-light-text-decoration, inherit); text-decoration: var(--diffs-token-light-text-decoration, inherit); } } &[data-theme-type='dark'] [data-line] span { font-weight: var(--diffs-token-dark-font-weight, inherit); font-style: var(--diffs-token-dark-font-style, inherit); -webkit-text-decoration: var(--diffs-token-dark-text-decoration, inherit); text-decoration: var(--diffs-token-dark-text-decoration, inherit); } &:hover [data-code]::-webkit-scrollbar-thumb { background-color: var(--diffs-bg-context); } } [data-line] span { background-color: light-dark( var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit) ); } [data-line], [data-gutter-buffer], [data-line-annotation], [data-no-newline] { color: var(--diffs-fg); background-color: var(--diffs-line-bg, var(--diffs-bg)); } [data-no-newline] { -webkit-user-select: none; user-select: none; span { opacity: 0.6; } } @media (prefers-color-scheme: dark) { [data-diffs-header], [data-error-wrapper], [data-diff], [data-file] { color-scheme: dark; } [data-content] [data-line] span { font-weight: var(--diffs-token-dark-font-weight, inherit); font-style: var(--diffs-token-dark-font-style, inherit); -webkit-text-decoration: var(--diffs-token-dark-text-decoration, inherit); text-decoration: var(--diffs-token-dark-text-decoration, inherit); } } [data-diffs-header], [data-diff], [data-file] { &[data-theme-type='light'] { color-scheme: light; } &[data-theme-type='dark'] { color-scheme: dark; } } [data-diff-type='split'][data-overflow='scroll'] { display: grid; grid-template-columns: 1fr 1fr; [data-additions] { border-left: 1px solid var(--diffs-bg); } [data-deletions] { border-right: 1px solid var(--diffs-bg); } } [data-code] { display: grid; grid-auto-flow: dense; grid-template-columns: var(--diffs-code-grid); overflow: scroll clip; overscroll-behavior-x: none; tab-size: var(--diffs-tab-size, 2); align-self: flex-start; padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback)); padding-bottom: max( 0px, calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) - 6px) ); container-type: inline-size; } [data-code]::-webkit-scrollbar { width: 0; height: 6px; } [data-code]::-webkit-scrollbar-track { background: transparent; } [data-code]::-webkit-scrollbar-thumb { background-color: transparent; border: 1px solid transparent; background-clip: content-box; border-radius: 3px; } [data-code]::-webkit-scrollbar-corner { background-color: transparent; } /* * If we apply these rules globally it will mean that webkit will opt into the * standards compliant version of custom css scrollbars, which we do not want * because the custom stuff will look better */ @supports (-moz-appearance: none) { [data-code] { scrollbar-width: thin; scrollbar-color: var(--diffs-bg-context) transparent; padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback)); } } [data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] { [data-code], &[data-overflow='wrap'] { padding-top: 0; } } [data-gutter] { display: grid; grid-template-rows: subgrid; grid-template-columns: subgrid; grid-column: 1; z-index: 3; position: relative; background-color: var(--diffs-bg); [data-gutter-buffer], [data-column-number] { border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg)); } } [data-content] { display: grid; grid-template-rows: subgrid; grid-template-columns: subgrid; grid-column: 2; min-width: 0; } [data-diff-type='split'][data-overflow='wrap'] { display: grid; grid-auto-flow: dense; grid-template-columns: repeat(2, var(--diffs-code-grid)); padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback)); [data-deletions] { display: contents; [data-gutter] { grid-column: 1; } [data-content] { grid-column: 2; border-right: 1px solid var(--diffs-bg); } } [data-additions] { display: contents; [data-gutter] { grid-column: 3; border-left: 1px solid var(--diffs-bg); } [data-content] { grid-column: 4; } } } [data-overflow='scroll'] [data-gutter] { position: sticky; left: 0; } [data-line-annotation][data-selected-line] { background-color: unset; &::before { content: ''; /* FIXME(amadeus): This needs to be audited ... */ position: sticky; top: 0; left: 0; display: block; border-right: var(--diffs-gap-style, 1px solid var(--diffs-bg)); background-color: var(--diffs-bg-selection-number); } [data-annotation-content] { background-color: var(--diffs-bg-selection); } } [data-interactive-lines] [data-line] { cursor: pointer; } [data-content-buffer], [data-gutter-buffer] { position: relative; -webkit-user-select: none; user-select: none; min-height: 1lh; } [data-gutter-buffer='annotation'] { min-height: 0; } [data-gutter-buffer='buffer'] { background-size: 8px 8px; background-position: 0 0; background-origin: border-box; background-color: var(--diffs-bg); /* This is incredibley expensive... */ background-image: repeating-linear-gradient( -45deg, transparent, transparent calc(3px * 1.414), rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(3px * 1.414), rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(4px * 1.414) ); } [data-content-buffer] { grid-column: 1; /* We multiply by 1.414 (√2) to better approximate the diagonal repeat distance */ background-size: 8px 8px; background-position: 5px 0; background-origin: border-box; background-color: var(--diffs-bg); /* This is incredibley expensive... */ background-image: repeating-linear-gradient( -45deg, transparent, transparent calc(3px * 1.414), var(--diffs-bg-buffer) calc(3px * 1.414), var(--diffs-bg-buffer) calc(4px * 1.414) ); } [data-separator] { box-sizing: content-box; background-color: var(--diffs-bg); } [data-separator='simple'] { min-height: 4px; } [data-separator='line-info'], [data-separator='line-info-basic'], [data-separator='metadata'], [data-separator='simple'] { background-color: var(--diffs-bg-separator); } [data-separator='line-info'], [data-separator='line-info-basic'], [data-separator='metadata'] { height: 32px; position: relative; } [data-separator-wrapper] { -webkit-user-select: none; user-select: none; fill: currentColor; position: absolute; inset-inline: 0; display: flex; align-items: center; background-color: var(--diffs-bg); height: 100%; } [data-content] [data-separator-wrapper] { display: none; } [data-separator='metadata'] [data-separator-wrapper] { inset-inline: 100% auto; padding-inline: 1ch; height: 100%; background-color: var(--diffs-bg-separator); color: var(--diffs-fg-number); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: min-content; } [data-separator='line-info'] { margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback)); } [data-separator='line-info-basic'], [data-separator='metadata'] { margin-block: 0; } [data-separator='line-info'][data-separator-first] { margin-top: 0; } [data-separator='line-info'][data-separator-last] { margin-bottom: 0; } [data-expand-index] [data-separator-wrapper] { display: grid; grid-template-columns: 32px auto; } [data-expand-index] [data-separator-wrapper][data-separator-multi-button] { grid-template-columns: 32px 32px auto; } [data-expand-button], [data-separator-content] { display: flex; flex: 0 0 auto; align-items: center; background-color: var(--diffs-bg-separator); } [data-expand-button] { justify-content: center; flex-shrink: 0; cursor: pointer; min-width: 32px; align-self: stretch; color: var(--diffs-fg-number); border-right: 2px solid var(--diffs-bg); &:hover { color: var(--diffs-fg); } } [data-expand-down] [data-icon] { transform: scaleY(-1); } [data-separator-content] { flex: 1 1 auto; padding: 0 1ch; height: 100%; color: var(--diffs-fg-number); overflow: hidden; justify-content: flex-start; } [data-separator='line-info'], [data-separator='line-info-basic'] { [data-separator-content] { height: 100%; -webkit-user-select: none; user-select: none; overflow: clip; } } @supports (width: 1cqi) { [data-unified] { [data-separator='line-info'] [data-separator-wrapper] { padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback)); width: 100cqi; [data-separator-content] { border-radius: 6px; } } [data-separator='line-info'][data-expand-index] [data-separator-wrapper] [data-separator-content] { border-top-left-radius: unset; border-bottom-left-radius: unset; } } [data-gutter] { [data-separator='line-info'] [data-separator-wrapper] { padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback)); } [data-separator='line-info'] [data-separator-content] { border-top-left-radius: 6px; border-bottom-left-radius: 6px; } [data-separator='line-info'][data-expand-index] [data-separator-content] { border-top-left-radius: unset; border-bottom-left-radius: unset; } } [data-additions] { [data-content] [data-separator='line-info'] { background-color: var(--diffs-bg); [data-separator-wrapper] { display: none; } } [data-gutter] [data-separator='line-info'] [data-separator-wrapper] { display: block; height: 100%; background-color: var(--diffs-bg-separator); border-top-right-radius: 6px; border-bottom-right-radius: 6px; [data-separator-content], [data-expand-button] { display: none; } } } [data-overflow='scroll'] [data-additions] [data-gutter] [data-separator='line-info'] [data-separator-wrapper] { width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback))); } [data-overflow='wrap'] [data-additions] [data-content] [data-separator='line-info'] [data-separator-wrapper] { background-color: var(--diffs-bg-separator); display: block; height: 100%; margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback)); border-top-right-radius: 6px; border-bottom-right-radius: 6px; [data-separator-content], [data-expand-button] { display: none; } } [data-separator='line-info'] [data-separator-wrapper] { [data-expand-both], [data-expand-down], [data-expand-up] { border-top-left-radius: 6px; border-bottom-left-radius: 6px; } } @media (pointer: fine) { [data-separator='line-info'] [data-separator-wrapper] { &[data-separator-multi-button] { [data-expand-up] { border-top-left-radius: 6px; border-bottom-left-radius: unset; } [data-expand-down] { border-bottom-left-radius: 6px; border-top-left-radius: unset; } } } } } @media (pointer: coarse) { [data-separator='line-info-basic'] [data-separator-wrapper][data-separator-multi-button] { grid-template-columns: 34px 34px auto; [data-separator-content] { grid-column: unset; grid-row: unset; } } @supports (width: 1cqi) { [data-separator='line-info'] [data-separator-wrapper] { [data-expand-both], [data-expand-down], [data-expand-up] { border-top-left-radius: 6px; border-bottom-left-radius: 6px; } &[data-separator-multi-button] { [data-expand-up] { border-top-left-radius: 6px; border-bottom-left-radius: 6px; } [data-expand-down] { border-bottom-left-radius: unset; border-top-left-radius: unset; } } } } } @media (pointer: fine) { [data-separator-wrapper][data-separator-multi-button] { display: grid; grid-template-rows: 50% 50%; [data-separator-content] { grid-column: 2; grid-row: 1 / -1; min-width: min-content; } [data-expand-button] { grid-column: 1; } } [data-separator='line-info'] [data-separator-wrapper], [data-separator='line-info'] [data-separator-wrapper][data-separator-multi-button] { grid-template-columns: 34px auto; } [data-separator='line-info-basic'][data-expand-index] [data-separator-wrapper] { grid-template-columns: 100% auto; } [data-separator='line-info'], [data-separator='line-info-basic'] { [data-separator-multi-button] { [data-expand-up] { border-bottom: 1px solid var(--diffs-bg); border-right: 2px solid var(--diffs-bg); } [data-expand-down] { border-top: 1px solid var(--diffs-bg); border-right: 2px solid var(--diffs-bg); } } } } [data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator='line-info-basic'] [data-separator-wrapper], [data-content] [data-separator-wrapper] { display: none; } [data-line-annotation], [data-gutter-buffer='annotation'] { --diffs-line-bg: var(--diffs-bg-context); } [data-line-annotation] { min-height: var(--diffs-annotation-min-height, 0); z-index: 2; } [data-separator='custom'] { display: grid; grid-template-columns: subgrid; } [data-line], [data-column-number], [data-no-newline] { position: relative; padding-inline: 1ch; } [data-indicators='classic'] [data-line] { padding-inline-start: 2ch; } [data-indicators='classic'] { [data-line-type='change-addition'], [data-line-type='change-deletion'] { &[data-no-newline], &[data-line] { &::before { display: inline-block; width: 1ch; height: 1lh; position: absolute; top: 0; left: 0; -webkit-user-select: none; user-select: none; } } } [data-line-type='change-addition'] { &[data-line], &[data-no-newline] { &::before { content: '+'; color: var(--diffs-addition-base); } } } [data-line-type='change-deletion'] { &[data-line], &[data-no-newline] { &::before { content: '-'; color: var(--diffs-deletion-base); } } } } [data-indicators='bars'] { [data-line-type='change-deletion'], [data-line-type='change-addition'] { &[data-column-number] { &::before { content: ''; display: block; width: 4px; height: 100%; position: absolute; top: 0; left: 0; -webkit-user-select: none; user-select: none; contain: strict; } } } [data-line-type='change-deletion'] { &[data-column-number] { &::before { background-image: linear-gradient( 0deg, var(--diffs-bg-deletion) 50%, var(--diffs-deletion-base) 50% ); background-repeat: repeat; background-size: 2px 2px; background-size: calc(1lh / round(1lh / 2px)) calc(1lh / round(1lh / 2px)); } } } [data-line-type='change-addition'] { &[data-column-number] { &::before { background-color: var(--diffs-addition-base); } } } } [data-overflow='wrap'] { [data-line], [data-annotation-content] { white-space: pre-wrap; word-break: break-word; } } [data-overflow='scroll'] [data-line] { white-space: pre; min-height: 1lh; } [data-column-number] { box-sizing: content-box; text-align: right; -webkit-user-select: none; user-select: none; background-color: var(--diffs-bg); color: var(--diffs-fg-number); padding-left: 2ch; } [data-line-number-content] { display: inline-block; min-width: var( --diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch) ); } [data-disable-line-numbers] { [data-column-number] { min-width: 4px; padding: 0; } [data-line-number-content] { display: none; } [data-hover-slot] { right: unset; left: 0; justify-content: flex-start; } &[data-indicators='bars'] [data-hover-slot] { /* Using 5px here because theres a 1px separator after the bar */ left: 5px; } } [data-file][data-disable-line-numbers] { [data-gutter-buffer], [data-column-number] { min-width: 0; border-right: 0; } } [data-interactive-line-numbers] [data-column-number] { cursor: pointer; } [data-diff-span] { border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; } [data-line-type='change-addition'] { &[data-column-number] { color: var( --diffs-fg-number-addition-override, var(--diffs-addition-base) ); } > [data-diff-span] { background-color: var(--diffs-bg-addition-emphasis); } } [data-line-type='change-deletion'] { &[data-column-number] { color: var( --diffs-fg-number-deletion-override, var(--diffs-deletion-base) ); } [data-diff-span] { background-color: var(--diffs-bg-deletion-emphasis); } } [data-background] [data-line-type='change-addition'] { --diffs-line-bg: var(--diffs-bg-addition); &[data-column-number] { background-color: var(--diffs-bg-addition-number); } } [data-background] [data-line-type='change-deletion'] { --diffs-line-bg: var(--diffs-bg-deletion); &[data-column-number] { background-color: var(--diffs-bg-deletion-number); } } @media (pointer: fine) { [data-column-number], [data-line] { &[data-hovered] { background-color: var(--diffs-bg-hover); } } [data-background] { [data-column-number], [data-line] { &[data-hovered] { &[data-line-type='change-deletion'] { background-color: var(--diffs-bg-deletion-hover); } &[data-line-type='change-addition'] { background-color: var(--diffs-bg-addition-hover); } } } } } [data-diffs-header] { position: relative; display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: var(--diffs-gap-inline, var(--diffs-gap-fallback)); min-height: calc( 1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3) ); padding-inline: 16px; top: 0; z-index: 2; } [data-header-content] { display: flex; flex-direction: row; align-items: center; gap: var(--diffs-gap-inline, var(--diffs-gap-fallback)); min-width: 0; white-space: nowrap; } [data-header-content] [data-prev-name], [data-header-content] [data-title] { direction: rtl; overflow: hidden; text-overflow: ellipsis; min-width: 0; white-space: nowrap; } [data-prev-name] { opacity: 0.7; } [data-rename-icon] { fill: currentColor; flex-shrink: 0; flex-grow: 0; } [data-diffs-header] [data-metadata] { display: flex; align-items: center; gap: 1ch; white-space: nowrap; } [data-diffs-header] [data-additions-count] { font-family: var(--diffs-font-family, var(--diffs-font-fallback)); color: var(--diffs-addition-base); } [data-diffs-header] [data-deletions-count] { font-family: var(--diffs-font-family, var(--diffs-font-fallback)); color: var(--diffs-deletion-base); } [data-annotation-content] { position: relative; display: flow-root; align-self: flex-start; z-index: 2; min-width: 0; isolation: isolate; } /* Sticky positioning has a composite costs, so we should _only_ pay it if we * need to */ [data-overflow='scroll'] [data-annotation-content] { position: sticky; width: var(--diffs-column-content-width, auto); left: var(--diffs-column-number-width, 0); } /* Undo some of the stuff that the 'pre' tag does */ [data-annotation-slot] { text-wrap-mode: wrap; word-break: normal; white-space-collapse: collapse; } [data-change-icon] { fill: currentColor; flex-shrink: 0; } [data-change-icon='change'], [data-change-icon='rename-pure'], [data-change-icon='rename-changed'] { color: var(--diffs-modified-base); } [data-change-icon='new'] { color: var(--diffs-addition-base); } [data-change-icon='deleted'] { color: var(--diffs-deletion-base); } [data-change-icon='file'] { opacity: 0.6; } /* Line selection highlighting */ [data-selected-line] { &[data-gutter-buffer='annotation'], &[data-column-number] { color: var(--diffs-selection-number-fg); background-color: var(--diffs-bg-selection-number); } &[data-line] { background-color: var(--diffs-bg-selection); } } [data-line-type='change-addition'], [data-line-type='change-deletion'] { &[data-selected-line] { &[data-line], &[data-line][data-hovered] { background-color: light-dark( color-mix( in lab, var(--diffs-line-bg, var(--diffs-bg)) 82%, var(--diffs-selection-base) ), color-mix( in lab, var(--diffs-line-bg, var(--diffs-bg)) 75%, var(--diffs-selection-base) ) ); } &[data-column-number], &[data-column-number][data-hovered] { color: var(--diffs-selection-number-fg); background-color: light-dark( color-mix( in lab, var(--diffs-line-bg, var(--diffs-bg)) 75%, var(--diffs-selection-base) ), color-mix( in lab, var(--diffs-line-bg, var(--diffs-bg)) 60%, var(--diffs-selection-base) ) ); } } } [data-hover-slot] { position: absolute; top: 0; bottom: 0; right: 0; display: flex; justify-content: flex-end; } [data-unmodified-lines] { display: block; overflow: hidden; min-width: 0; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; } [data-error-wrapper] { overflow: auto; padding: var(--diffs-gap-block, var(--diffs-gap-fallback)) var(--diffs-gap-inline, var(--diffs-gap-fallback)); max-height: 400px; scrollbar-width: none; [data-error-message] { font-weight: bold; font-size: 18px; color: var(--diffs-deletion-base); } [data-error-stack] { color: var(--diffs-fg-number); } } [data-placeholder] { contain: strict; } } `;const XO="@layer base, theme, unsafe;";function _3(t){return`${XO} @layer unsafe { ${t} }`}function Gu({code:t,pre:e,columnType:n,rowSpan:r}={}){return t==null&&(t=document.createElement("code"),t.dataset.code="",n!=null&&(t.dataset[n]=""),e?.appendChild(t)),r!=null?t.style.setProperty("grid-row",`span ${r}`):t.style.removeProperty("grid-row"),t}function D3(t,e){if(e==null)return;const n=t.shadowRoot??t.attachShadow({mode:"open"});n.innerHTML===""&&(n.innerHTML=e)}function z3(t,{type:e,diffIndicators:n,disableBackground:r,disableLineNumbers:o,overflow:i,split:s,themeStyles:a,themeType:l,totalLines:c}){switch(e==="diff"?(t.setAttribute("data-diff",""),t.removeAttribute("data-file")):(t.setAttribute("data-file",""),t.removeAttribute("data-diff")),l==="system"?t.removeAttribute("data-theme-type"):t.setAttribute("data-theme-type",l),n){case"bars":case"classic":t.setAttribute("data-indicators",n);break;case"none":t.removeAttribute("data-indicators");break}return o?t.setAttribute("data-disable-line-numbers",""):t.removeAttribute("data-disable-line-numbers"),r?t.removeAttribute("data-background"):t.setAttribute("data-background",""),e==="diff"?t.setAttribute("data-diff-type",s?"split":"single"):t.removeAttribute("data-diff-type"),t.setAttribute("data-overflow",i),t.tabIndex=0,t.style=a,t.style.setProperty("--diffs-min-number-column-width-default",`${`${c}`.length}ch`),t}if(typeof HTMLElement<"u"&&customElements.get(cp)==null){let t;class e extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;const r=this.attachShadow({mode:"open"});t==null&&(t=new CSSStyleSheet,t.replaceSync(QO)),r.adoptedStyleSheets=[t]}}customElements.define(cp,e)}const O3=!0,YO=[];let ej=-1;var j3=class{static LoadedCustomComponent=O3;__id=`file:${++ej}`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;unsafeCSSStyle;hoverContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;appliedPreAttributes;lastRowCount;headerElement;headerMetadata;fileRenderer;resizeManager;mouseEventManager;lineSelectionManager;annotationCache=new Map;lineAnnotations=[];file;renderRange;constructor(e={theme:mr},n,r=!1){this.options=e,this.workerManager=n,this.isContainerManaged=r,this.fileRenderer=new ZO(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new e6,this.mouseEventManager=new Yx("file",pp(e)),this.lineSelectionManager=new Xx(up(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){this.file!=null&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}setOptions(e){e!=null&&(this.options=e,this.mouseEventManager.setOptions(pp(e)),this.lineSelectionManager.setOptions(up(e)))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){if((this.options.themeType??"system")!==e&&(this.mergeOptions({themeType:e}),this.fileRenderer.setThemeType(e),this.headerElement!=null&&(e==="system"?delete this.headerElement.dataset.themeType:this.headerElement.dataset.themeType=e),this.pre!=null))switch(e){case"system":delete this.pre.dataset.themeType;break;case"light":case"dark":this.pre.dataset.themeType=e;break}}getHoveredLine=()=>this.mouseEventManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e){this.lineSelectionManager.setSelection(e)}cleanUp(){this.fileRenderer.cleanUp(),this.resizeManager.cleanUp(),this.mouseEventManager.cleanUp(),this.lineSelectionManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.workerManager=void 0,this.renderRange=void 0,this.file=void 0,this.isContainerManaged||this.fileContainer?.parentNode?.removeChild(this.fileContainer),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=""),this.fileContainer=void 0,this.pre=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0,this.errorWrapper=void 0,this.unsafeCSSStyle=void 0,this.placeHolder=void 0}hydrate(e){const{fileContainer:n,prerenderedHTML:r}=e;D3(n,r);for(const o of Array.from(n.shadowRoot?.children??[])){if(o instanceof SVGElement){this.spriteSVG=o;continue}if(o instanceof HTMLElement){if(o instanceof HTMLPreElement){this.pre=o,this.appliedPreAttributes=void 0;continue}if(o instanceof HTMLStyleElement&&o.hasAttribute(nv)){this.unsafeCSSStyle=o;continue}if("diffsHeader"in o.dataset){this.headerElement=o,this.lastRenderedHeaderHTML=void 0;continue}}}if(this.pre==null)this.render(e);else{const{file:o,lineAnnotations:i}=e,{overflow:s="scroll"}=this.options;this.fileContainer=n,delete this.pre.dataset.dehydrated,this.lineAnnotations=i??this.lineAnnotations,this.file=o,this.fileRenderer.hydrate(o),this.renderAnnotations(),this.renderHoverUtility(),this.injectUnsafeCSS(),this.mouseEventManager.setup(this.pre),this.lineSelectionManager.setup(this.pre),this.resizeManager.setup(this.pre,s==="wrap")}}getOrCreateLineCache(e=this.file){return e!=null?this.fileRenderer.getOrCreateLineCache(e):YO}render({file:e,fileContainer:n,forceRender:r=!1,containerWrapper:o,lineAnnotations:i,renderRange:s}){const a=this.renderRange,l=i!=null&&(i.length>0||this.lineAnnotations.length>0)?i!==this.lineAnnotations:!1,c=!Ip(this.file,e);if(!r&&Am(s,this.renderRange)&&!c&&!l)return!1;this.renderRange=s,this.file=e,this.fileRenderer.setOptions(this.options),i!=null&&this.setLineAnnotations(i),this.fileRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:d=!1,disableFileHeader:u=!1,overflow:f="scroll"}=this.options;u&&this.headerElement!=null&&(this.headerElement.parentNode?.removeChild(this.headerElement),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),n=this.getOrCreateFileContainerNode(n,o);try{const m=this.getOrCreatePreNode(n);if(!this.canPartiallyRender(r,l,c)||!this.applyPartialRender(a,s)){const p=this.fileRenderer.renderFile(e,s);if(p==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;p.headerAST!=null&&this.applyHeaderToDOM(p.headerAST,n),this.applyFullRender(p,m)}this.applyBuffers(m,s),this.injectUnsafeCSS(),this.mouseEventManager.setup(m),this.lineSelectionManager.setup(m),this.resizeManager.setup(m,f==="wrap"),this.renderAnnotations(),this.renderHoverUtility()}catch(m){if(d)throw m;console.error(m),m instanceof Error&&this.applyErrorToDOM(m,n)}return!0}canPartiallyRender(e,n,r){return!(e||n||r)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.cleanChildNodes(),this.placeHolder==null){const n=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",n.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}cleanChildNodes(){this.resizeManager.cleanUp(),this.mouseEventManager.cleanUp(),this.lineSelectionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.hoverContent?.remove(),this.pre?.remove(),this.spriteSVG?.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.hoverContent=void 0,this.pre=void 0,this.spriteSVG=void 0,this.unsafeCSSStyle=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(const{element:r}of this.annotationCache.values())r.parentNode?.removeChild(r);this.annotationCache.clear();return}const e=new Map(this.annotationCache),{renderAnnotation:n}=this.options;if(n!=null&&this.lineAnnotations.length>0)for(const[r,o]of this.lineAnnotations.entries()){const i=`${r}-${pa(o)}`;let s=this.annotationCache.get(i);if(s==null||!JO(o,s.annotation)){s?.element.parentElement?.removeChild(s.element);const a=n(o);if(a==null)continue;s={element:M3(pa(o)),annotation:o},s.element.appendChild(a),this.fileContainer.appendChild(s.element),this.annotationCache.set(i,s)}e.delete(i)}for(const[r,{element:o}]of e.entries())this.annotationCache.delete(r),o.parentNode?.removeChild(o)}renderHoverUtility(){const{renderHoverUtility:e}=this.options;if(this.fileContainer==null||e==null)return;const n=e(this.mouseEventManager.getHoveredLine);if(!(n!=null&&this.hoverContent!=null)){if(n==null){this.hoverContent?.parentNode?.removeChild(this.hoverContent),this.hoverContent=void 0;return}this.hoverContent=L3(),this.hoverContent.appendChild(n),this.fileContainer.appendChild(this.hoverContent)}}injectUnsafeCSS(){if(this.fileContainer?.shadowRoot==null)return;const{unsafeCSS:e}=this.options;if(e==null||e===""){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.parentNode?.removeChild(this.unsafeCSSStyle),this.unsafeCSSStyle=void 0);return}this.unsafeCSSStyle==null&&(this.unsafeCSSStyle=P3(),this.fileContainer.shadowRoot.appendChild(this.unsafeCSSStyle)),this.unsafeCSSStyle.innerText=_3(e)}applyFullRender(e,n){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(n,e),this.code=Gu({code:this.code}),this.code.innerHTML=this.fileRenderer.renderPartialHTML(this.fileRenderer.renderCodeAST(e)),n.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,n){if(e==null||n==null)return!1;const{file:r,code:o}=this,i=o!=null?this.getColumns(o):void 0;if(r==null||o==null||i==null)return!1;const s=e.startingLine,a=n.startingLine,l=e.totalLines===1/0?Number.POSITIVE_INFINITY:s+e.totalLines,c=n.totalLines===1/0?Number.POSITIVE_INFINITY:a+n.totalLines,d=Math.max(s,a),u=Math.min(l,c);if(u<=d||!this.trimDOMToOverlap(i.gutter,d,u)||!this.trimDOMToOverlap(i.content,d,u))return!1;let{length:f}=i.content.children;const m=(k,y)=>{if(!(y<=0))return this.fileRenderer.renderFile(r,{startingLine:k,totalLines:y,bufferBefore:0,bufferAfter:0})},p=au?m(u,g):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(p.contentAST)),f+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(h.contentAST)),f+=h.rowCount),this.lastRowCount!==f&&(i.gutter.style.setProperty("grid-row",`span ${f}`),i.content.style.setProperty("grid-row",`span ${f}`),this.lastRowCount=f),!0)}getColumns(e){const n=e.children[0],r=e.children[1];if(!(!(n instanceof HTMLElement)||!(r instanceof HTMLElement)||n.dataset.gutter==null||r.dataset.content==null))return{gutter:n,content:r}}trimDOMToOverlap(e,n,r){const o=this.getDOMBoundaryIndices(e,[n,r]),i=o.get(n)??e.children.length,s=o.get(r)??e.children.length;if(i>s)return!1;for(let a=e.children.length-1;a>=s;a-=1)e.children[a]?.remove();for(let a=i-1;a>=0;a-=1)e.children[a]?.remove();return!0}getDOMBoundaryIndices(e,n){const r=[...new Set(n)].sort((l,c)=>l-c),o=new Map;if(r.length===0)return o;let i=0,s=r[i];const{children:a}=e;for(let l=0;l=s;)o.set(s,l),i+=1,s=r[i];if(i>=r.length)break}}for(const l of r)o.has(l)||o.set(l,a.length);return o}getLineIndexFromDOMNode(e){const n=e.dataset.lineIndex;if(n==null)return;const r=Number(n);return Number.isNaN(r)?void 0:r}applyBuffers(e,n){const{disableVirtualizationBuffers:r=!1}=this.options;if(r||n==null){this.bufferBefore!=null&&(this.bufferBefore.parentNode?.removeChild(this.bufferBefore),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.parentNode?.removeChild(this.bufferAfter),this.bufferAfter=void 0);return}n.bufferBefore>0?(this.bufferBefore==null&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${n.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):this.bufferBefore!=null&&(this.bufferBefore.parentNode?.removeChild(this.bufferBefore),this.bufferBefore=void 0),n.bufferAfter>0?(this.bufferAfter==null&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${n.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):this.bufferAfter!=null&&(this.bufferAfter.parentNode?.removeChild(this.bufferAfter),this.bufferAfter=void 0)}applyHeaderToDOM(e,n){const{file:r}=this;if(r==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;const o=qi(e);if(o!==this.lastRenderedHeaderHTML){const a=document.createElement("div");a.innerHTML=o;const l=a.firstElementChild;if(!(l instanceof HTMLElement))return;this.headerElement!=null?n.shadowRoot?.replaceChild(l,this.headerElement):n.shadowRoot?.prepend(l),this.headerElement=l,this.lastRenderedHeaderHTML=o}if(this.isContainerManaged)return;const{renderCustomMetadata:i}=this.options;this.headerMetadata!=null&&this.headerMetadata.parentNode?.removeChild(this.headerMetadata);const s=i?.(r)??void 0;s!=null&&(this.headerMetadata=document.createElement("div"),this.headerMetadata.slot=tv,s instanceof Element?this.headerMetadata.appendChild(s):this.headerMetadata.innerText=`${s}`,n.appendChild(this.headerMetadata))}getOrCreateFileContainerNode(e,n){const r=this.fileContainer;if(this.fileContainer=e??this.fileContainer??document.createElement(cp),r!=null&&r!==this.fileContainer&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),n!=null&&this.fileContainer.parentNode!==n&&n.appendChild(this.fileContainer),this.spriteSVG==null){const o=document.createElement("div");o.innerHTML=T3;const i=o.firstChild;i instanceof SVGElement&&(this.spriteSVG=i,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getOrCreatePreNode(e){const n=e.shadowRoot??e.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.code=void 0,n.appendChild(this.pre)):this.pre.parentNode!==n&&(e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}applyPreNodeAttributes(e,{totalLines:n,themeStyles:r,baseThemeType:o}){const{overflow:i="scroll",themeType:s="system",disableLineNumbers:a=!1}=this.options,l={type:"file",split:!1,themeStyles:r,overflow:i,disableLineNumbers:a,themeType:o??s,diffIndicators:"none",disableBackground:!0,totalLines:n};E3(l,this.appliedPreAttributes)||(z3(e,l),this.appliedPreAttributes=l)}applyErrorToDOM(e,n){this.cleanupErrorWrapper();const r=this.getOrCreatePreNode(n);r.innerHTML="",r.parentNode?.removeChild(r),this.pre=void 0,this.appliedPreAttributes=void 0;const o=n.shadowRoot??n.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.innerHTML="",o.appendChild(this.errorWrapper);const i=document.createElement("div");i.dataset.errorMessage="",i.innerText=e.message,this.errorWrapper.appendChild(i);const s=document.createElement("pre");s.dataset.errorStack="",s.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(s)}cleanupErrorWrapper(){this.errorWrapper?.parentNode?.removeChild(this.errorWrapper),this.errorWrapper=void 0}},tj=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(t,e,n){if(e==null||n==null)for(const r of t.children??[])r instanceof HTMLElement&&("deletions"in r.dataset?e=r:"additions"in r.dataset&&(n=r));if(n==null||e==null){this.cleanUp();return}this.codeDeletions!==e&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=e,e.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function au(t){return _t({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":t,style:`grid-row: span ${t};min-height:calc(${t} * 1lh)`}})}function lu(t){return _t({tagName:"div",children:[_t({tagName:"span",children:[Ji("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":t,"data-column-content":""}})}function dg(t){return _t({tagName:"div",children:[Fh({name:t==="both"?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{"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 $a({type:t,content:e,expandIndex:n,chunked:r=!1,slotName:o,isFirstHunk:i,isLastHunk:s}){const a=[];if(t==="metadata"&&e!=null&&a.push(_t({tagName:"div",children:[Ji(e)],properties:{"data-separator-wrapper":""}})),(t==="line-info"||t==="line-info-basic")&&e!=null){const l=[];n!=null&&(r?(i||l.push(dg("up")),s||l.push(dg("down"))):l.push(dg(!i&&!s?"both":i?"down":"up"))),l.push(_t({tagName:"div",children:[_t({tagName:"span",children:[Ji(e)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),a.push(_t({tagName:"div",children:l,properties:{"data-separator-wrapper":"","data-separator-multi-button":l.length>2?"":void 0}}))}return t==="custom"&&o!=null&&a.push(_t({tagName:"slot",properties:{name:o}})),_t({tagName:"div",children:a,properties:{"data-separator":a.length===0?"simple":t,"data-expand-index":n,"data-separator-first":i?"":void 0,"data-separator-last":s?"":void 0}})}function nj(t,e){return`hunk-separator-${t}-${e}`}function rj(t){const e=t.at(-1);return e==null?0:Math.max(e.additionStart+e.additionCount,e.deletionStart+e.deletionCount)}function oj(t){return t.startingLine===0&&t.totalLines===1/0&&t.bufferBefore===0&&t.bufferAfter===0}let wv=class{diff(e,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const i=this.castInput(e,r),s=this.castInput(n,r),a=this.removeEmpty(this.tokenize(i,r)),l=this.removeEmpty(this.tokenize(s,r));return this.diffWithOptionsObj(a,l,r,o)}diffWithOptionsObj(e,n,r,o){var i;const s=y=>{if(y=this.postProcess(y,r),o){setTimeout(function(){o(y)},0);return}else return y},a=n.length,l=e.length;let c=1,d=a+l;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const u=(i=r.timeout)!==null&&i!==void 0?i:1/0,f=Date.now()+u,m=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(m[0],n,e,0,r);if(m[0].oldPos+1>=l&&p+1>=a)return s(this.buildValues(m[0].lastComponent,n,e));let g=-1/0,h=1/0;const k=()=>{for(let y=Math.max(g,-c);y<=Math.min(h,c);y+=2){let w;const A=m[y-1],b=m[y+1];A&&(m[y-1]=void 0);let x=!1;if(b){const P=b.oldPos-y;x=b&&0<=P&&P=l&&p+1>=a)return s(this.buildValues(w.lastComponent,n,e))||!0;m[y]=w,w.oldPos+1>=l&&(h=Math.min(h,y-1)),p+1>=a&&(g=Math.max(g,y+1))}c++};if(o)(function y(){setTimeout(function(){if(c>d||Date.now()>f)return o(void 0);k()||y()},0)})();else for(;c<=d&&Date.now()<=f;){const y=k();if(y)return y}}addToPath(e,n,r,o,i){const s=e.lastComponent;return s&&!i.oneChangePerToken&&s.added===n&&s.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:s.count+1,added:n,removed:r,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:s}}}extractCommon(e,n,r,o,i){const s=n.length,a=r.length;let l=e.oldPos,c=l-o,d=0;for(;c+1f.length?p:f}),d.value=this.join(u)}else d.value=this.join(n.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return o}};class ij extends wv{}const sj=new ij;function aj(t,e,n){return sj.diff(t,e,n)}const Zk="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}";class lj extends wv{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${Zk}]+|[^\\S\\n\\r]+|[^${Zk}]`,"ug");return e.match(n)||[]}}const cj=new lj;function dj(t,e,n){return cj.diff(t,e,n)}class uj extends wv{constructor(){super(...arguments),this.tokenize=mj}equals(e,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(` `))&&(e=e.trim()),(!r.newlineIsToken||!n.includes(` `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(` `)&&(e=e.slice(0,-1)),n.endsWith(` `)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const pj=new uj;function Jk(t,e,n){return pj.diff(t,e,n)}function mj(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` `));const n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o"u"&&(a.context=4);const l=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){const{callback:d}=a;Jk(n,r,Object.assign(Object.assign({},a),{callback:u=>{const f=c(u);d(f)}}))}else return c(Jk(n,r,a));function c(d){if(!d)return;d.push({value:"",lines:[]});function u(y){return y.map(function(w){return" "+w})}const f=[];let m=0,p=0,g=[],h=1,k=1;for(let y=0;y0?u(b.lines.slice(-l)):[],m-=g.length,p-=g.length)}for(const b of A)g.push((w.added?"+":"-")+b);w.added?k+=A.length:h+=A.length}else{if(m)if(A.length<=l*2&&y1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(r=>R3(r,e)).join(` `)}const n=[];e.includeIndex&&t.oldFileName==t.newFileName&&n.push("Index: "+t.oldFileName),e.includeUnderline&&n.push("==================================================================="),e.includeFileHeaders&&(n.push("--- "+t.oldFileName+(typeof t.oldHeader>"u"?"":" "+t.oldHeader)),n.push("+++ "+t.newFileName+(typeof t.newHeader>"u"?"":" "+t.newHeader)));for(let r=0;rr+` `);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function Qk({line:t,spanStart:e,spanLength:n}){return{start:{line:t,character:e},end:{line:t,character:e+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function cu({item:t,arr:e,enableJoin:n,isNeutral:r=!1,isLastItem:o=!1}){const i=e[e.length-1];if(i==null||o||!n){e.push([r?0:1,t.value]);return}const s=i[0]===0;if(r===s||r&&t.value.length===1&&!s){i[1]+=t.value;return}e.push([r?0:1,t.value])}function Tp({diff:t,diffStyle:e,startingLine:n=0,totalLines:r=1/0,expandedHunks:o,collapsedContextThreshold:i=ll,callback:s}){const a={finalHunk:t.hunks.at(-1),viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:0,unifiedCount:0,shouldBreak(){if(!a.isWindowedHighlight)return!1;const l=a.unifiedCount>=n+r,c=a.splitCount>=n+r;return e==="unified"?l:(e==="split"||l)&&c},shouldSkip(l,c){if(!a.isWindowedHighlight)return!1;const d=a.unifiedCount+l=n-l&&a.unifiedCount=n-l&&a.splitCount0?0:e==="unified"?x===c.unifiedLineStart+c.unifiedLineCount-1?u.collapsedLines:0:I===c.splitLineStart+c.splitLineCount-1?u.collapsedLines:0},p=function(){if(d.collapsedLines===0)return 0;const x=d.collapsedLines;return d.collapsedLines=0,x};if(a.shouldBreak())break;const d=Xk(t.isPartial,c.collapsedBefore,o,l,i),u=(()=>{if(c!==a.finalHunk||!bj(t))return;const x=t.additionLines.length-(c.additionLineIndex+c.additionCount),I=t.deletionLines.length-(c.deletionLineIndex+c.deletionCount);if(x!==I)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${x}, deletions=${I}) for ${t.name}`);const P=Math.min(x,I);return Xk(t.isPartial,P,o,t.hunks.length,i)})(),f=d.fromStart+d.fromEnd;if(a.shouldSkip(f,f))a.incrementCounts(f,f),p();else{let x=c.unifiedLineStart-d.rangeSize,I=c.splitLineStart-d.rangeSize,P=c.deletionLineIndex-d.rangeSize,E=c.additionLineIndex-d.rangeSize,z=c.deletionStart-d.rangeSize,N=c.additionStart-d.rangeSize,R=0;for(;R=e;return{fromStart:c?e:s,fromEnd:c?0:a,rangeSize:e,collapsedLines:Math.max(e-l,0)}}function bj(t){const e=t.hunks.at(-1);return e==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0?!1:e.additionLineIndex+e.additionCount=t.viewportEnd)return;const m=Math.max(0,t.viewportStart-u),p=Math.min(f,t.viewportEnd-u);return p>m?[m,p]:void 0}function l(u,f){return i==="split"?u:f==="additions"?[u[0]+e.deletions,u[1]+e.deletions]:u}function c(u,f){if(u==null)return;const[m,p]=l(u,f);p>m&&s.push([m,p])}if(r&&(c(a(t.unifiedCount,e.deletions),"deletions"),c(a(t.unifiedCount+e.deletions,e.additions),"additions")),o&&(c(a(t.splitCount,e.deletions),"deletions"),c(a(t.splitCount,e.additions),"additions")),s.length===0)return s;s.sort((u,f)=>u[0]-f[0]);const d=[s[0]];for(const[u,f]of s.slice(1)){const m=d[d.length-1];u<=m[1]?m[1]=Math.max(m[1],f):d.push([u,f])}return d}function kj({hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,diffStyle:o,index:i,unifiedLineIndex:s,splitLineIndex:a,additionLineIndex:l,deletionLineIndex:c,additionLineNumber:d,deletionLineNumber:u,content:f,isLastContent:m,unifiedCount:p,splitCount:g}){const h=i=f.deletions?s+i:void 0:i=f.deletions?l+(i-f.deletions):void 0:i=f.deletions?d+(i-f.deletions):void 0:i0||i<1/0,c=(()=>{const y=n.theme??mr;if(typeof y=="string")return e.getTheme(y).type})(),d=A3({theme:n.theme,highlighter:e}),u=r&&!l&&(t.unifiedLineCount>1e3||t.splitLineCount>1e3)?"none":n.lineDiffType,f={deletionLines:[],additionLines:[]},m=!r&&!t.isPartial,p=r?s:void 0,g=new Map;function h(y){const w=m?0:y,A=g.get(w)??Sj();return g.set(w,A),A}function k(y,w,A,b){if(l){let x=A.at(-1);(x==null||x.targetIndex+x.count!==w)&&(x={targetIndex:w,originalOffset:b.length,count:0},A.push(x)),x.count++}b.push(y)}Tp({diff:t,diffStyle:"both",startingLine:o,totalLines:i,expandedHunks:l?p:!0,collapsedContextThreshold:a,callback:({hunkIndex:y,additionLine:w,deletionLine:A,type:b})=>{const x=h(y),I=w!=null?w.splitLineIndex:A.splitLineIndex;b==="change"&&w!=null&&A!=null&&xj({additionLine:t.additionLines[w.lineIndex],deletionLine:t.deletionLines[A.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:u}),A!=null&&(k(t.deletionLines[A.lineIndex],A.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:b==="change"?"change-deletion":b,lineNumber:A.lineNumber,altLineNumber:b==="change"?void 0:w.lineNumber??void 0,lineIndex:`${A.unifiedLineIndex},${I}`})),w!=null&&(k(t.additionLines[w.lineIndex],w.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:b==="change"?"change-addition":b,lineNumber:w.lineNumber,altLineNumber:b==="change"?void 0:A.lineNumber??void 0,lineIndex:`${w.unifiedLineIndex},${I}`}))}});for(const y of g.values()){if(y.deletionContent.length===0&&y.additionContent.length===0)continue;const w={name:t.prevName??t.name,contents:y.deletionContent.value},A={name:t.name,contents:y.additionContent.value},{deletionLines:b,additionLines:x}=Aj({deletionFile:w,deletionInfo:y.deletionInfo,deletionDecorations:y.deletionDecorations,additionFile:A,additionInfo:y.additionInfo,additionDecorations:y.additionDecorations,highlighter:e,options:n,languageOverride:r?"text":t.lang});if(m){f.deletionLines=b,f.additionLines=x;continue}if(y.deletionSegments.length>0)for(const I of y.deletionSegments)for(let P=0;P0)for(const I of y.additionSegments)for(let P=0;P{switch(e.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),r=n[e.lineNumber]??[];n[e.lineNumber]=r,r.push(e)}}getOptionsWithDefaults(){const{diffIndicators:t="bars",diffStyle:e="split",disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:o=!1,disableVirtualizationBuffers:i=!1,expandUnchanged:s=!1,collapsedContextThreshold:a=ll,expansionLineCount:l=100,hunkSeparators:c="line-info",lineDiffType:d="word-alt",maxLineDiffLength:u=1e3,overflow:f="scroll",theme:m=mr,themeType:p="system",tokenizeMaxLineLength:g=1e3,useCSSClasses:h=!1}=this.options;return{diffIndicators:t,diffStyle:e,disableBackground:n,disableFileHeader:r,disableLineNumbers:o,disableVirtualizationBuffers:i,expandUnchanged:s,collapsedContextThreshold:a,expansionLineCount:l,hunkSeparators:c,lineDiffType:d,maxLineDiffLength:u,overflow:f,theme:this.workerManager?.getDiffRenderOptions().theme??m,themeType:p,tokenizeMaxLineLength:g,useCSSClasses:h}}async initializeHighlighter(){return this.highlighter=await kl(x3(this.computedLang,this.options)),this.highlighter}hydrate(t){if(t==null)return;this.diff=t;const{options:e}=this.getRenderOptions(t);let n=this.workerManager?.getDiffResultCache(t);n!=null&&!ug(e,n.options)&&(n=void 0),this.renderCache??={diff:t,highlighted:!0,options:e,result:n?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0&&this.renderCache.result==null?this.workerManager.highlightDiffAST(this,this.diff):this.asyncHighlight(t).then(({result:r,options:o})=>{this.onHighlightSuccess(t,r,o)})}getRenderOptions(t){const e=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();const{theme:r,tokenizeMaxLineLength:o,lineDiffType:i}=this.getOptionsWithDefaults();return{theme:r,tokenizeMaxLineLength:o,lineDiffType:i}})();this.getOptionsWithDefaults();const{renderCache:n}=this;return n?.result==null?{options:e,forceRender:!0}:t!==n.diff||!ug(e,n.options)?{options:e,forceRender:!0}:{options:e,forceRender:!1}}renderDiff(t=this.renderCache?.diff,e=dp){if(t==null)return;const{expandUnchanged:n=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),o=this.workerManager?.getDiffResultCache(t);o!=null&&this.renderCache==null&&(this.renderCache={diff:t,highlighted:!0,renderRange:void 0,...o});const{options:i,forceRender:s}=this.getRenderOptions(t);if(this.renderCache??={diff:t,highlighted:!1,options:i,result:void 0,renderRange:void 0},this.workerManager?.isWorkingPool()===!0)(this.renderCache.result==null||!this.renderCache.highlighted&&!Am(this.renderCache.renderRange,e))&&(this.renderCache.result=this.workerManager.getPlainDiffAST(t,e.startingLine,e.totalLines,oj(e)||n?!0:this.expandedHunks,r),this.renderCache.renderRange=e),e.totalLines>0&&(!this.renderCache.highlighted||s)&&this.workerManager.highlightDiffAST(this,t);else{this.computedLang=t.lang??xo(t.name);const a=this.highlighter!=null&&Lc(i.theme),l=this.highlighter!=null&&mp(this.computedLang);if(this.highlighter!=null&&a&&(s||!this.renderCache.highlighted&&l||this.renderCache.result==null)){const{result:c,options:d}=this.renderDiffWithHighlighter(t,this.highlighter,!l);this.renderCache={diff:t,options:d,highlighted:l,result:c,renderRange:void 0}}(!a||!l)&&this.asyncHighlight(t).then(({result:c,options:d})=>{this.onHighlightSuccess(t,c,d)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,e,this.renderCache.result):void 0}async asyncRender(t,e=dp){const{result:n}=await this.asyncHighlight(t);return this.processDiffResult(t,e,n)}createPreElement(t,e,n,r){const{diffIndicators:o,disableBackground:i,disableLineNumbers:s,overflow:a,themeType:l}=this.getOptionsWithDefaults();return w3({type:"diff",diffIndicators:o,disableBackground:i,disableLineNumbers:s,overflow:a,themeStyles:n,split:t,themeType:r??l,totalLines:e})}async asyncHighlight(t){this.computedLang=t.lang??xo(t.name);const e=this.highlighter!=null&&Lc(this.options.theme??mr),n=this.highlighter!=null&&mp(this.computedLang);return(this.highlighter==null||!e||!n)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(t,this.highlighter)}renderDiffWithHighlighter(t,e,n=!1){const{options:r}=this.getRenderOptions(t),{collapsedContextThreshold:o}=this.getOptionsWithDefaults();return{result:N3(t,e,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:o}),options:r}}onHighlightSuccess(t,e,n){if(this.renderCache==null)return;const r=this.renderCache.diff!==t||!this.renderCache.highlighted||!ug(this.renderCache.options,n);this.renderCache={diff:t,options:n,highlighted:!0,result:e,renderRange:void 0},r&&this.onRenderUpdate?.()}onHighlightError(t){console.error(t)}processDiffResult(t,e,{code:n,themeStyles:r,baseThemeType:o}){const{diffStyle:i,disableFileHeader:s,expandUnchanged:a,expansionLineCount:l,collapsedContextThreshold:c,hunkSeparators:d}=this.getOptionsWithDefaults();this.diff=t;const u=i==="unified";let f=[],m=[],p=[];const g=[],{additionLines:h,deletionLines:k}=n,y={rowCount:0,hunkSeparators:d,additionsContentAST:f,deletionsContentAST:m,unifiedContentAST:p,unifiedGutterAST:il(),deletionsGutterAST:il(),additionsGutterAST:il(),expansionLineCount:l,hunkData:g,incrementRowCount(L=1){y.rowCount+=L},pushToGutter(L,O){switch(L){case"unified":y.unifiedGutterAST.children.push(O);break;case"deletions":y.deletionsGutterAST.children.push(O);break;case"additions":y.additionsGutterAST.children.push(O);break}}},w=Tj(t);let A=0,b;function x(L,O,B,K){y.pushToGutter(L,y3(O,B,K))}function I(){if(i!=="unified"){if(A<=0||b==null){A=0,b=void 0;return}b==="additions"?(y.pushToGutter("additions",go(void 0,"buffer",A)),f?.push(au(A))):(y.pushToGutter("deletions",go(void 0,"buffer",A)),m?.push(au(A))),A=0,b=void 0}}function P(L){I(),i==="unified"?pg("unified",L,y):(pg("deletions",L,y),pg("additions",L,y))}Tp({diff:t,diffStyle:i,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:a?!0:this.expandedHunks,collapsedContextThreshold:c,callback:({hunkIndex:L,hunk:O,collapsedBefore:B,collapsedAfter:K,additionLine:Q,deletionLine:J,type:pe})=>{const Te=J!=null?J.splitLineIndex:Q.splitLineIndex,Ve=Q!=null?Q.unifiedLineIndex:J.unifiedLineIndex;i==="split"&&pe!=="change"&&I(),B>0&&P({hunkIndex:L,collapsedLines:B,rangeSize:Math.max(O?.collapsedBefore??0,0),hunkSpecs:O?.hunkSpecs,isFirstHunk:L===0,isLastHunk:!1,isExpandable:!t.isPartial});const ie=i==="unified"?Ve:Te;if(i==="unified"){const W=J!=null?k[J.lineIndex]:void 0,Z=Q!=null?h[Q.lineIndex]:void 0;if(W==null&&Z==null){const ue="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(ue,{file:t.name}),new Error(ue)}x("unified",pe==="change"?Q!=null?"change-addition":"change-deletion":pe,Q!=null?Q.lineNumber:J.lineNumber,`${Ve},${Te}`),ew({diffStyle:"unified",type:pe,deletionLine:W,additionLine:Z,unifiedSpan:this.getAnnotations("unified",J?.lineNumber,Q?.lineNumber,L,ie),context:y})}else{const W=J!=null?k[J.lineIndex]:void 0,Z=Q!=null?h[Q.lineIndex]:void 0;if(W==null&&Z==null){const Ae="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(Ae,{file:t.name}),new Error(Ae)}const ue=(()=>{if(pe==="change"){if(Z==null)return"additions";if(W==null)return"deletions"}})();if(ue!=null){if(b!=null&&b!==ue)throw new Error("DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits");b=ue,A++}const de=this.getAnnotations("split",J?.lineNumber,Q?.lineNumber,L,ie);de!=null&&A>0&&I(),J!=null&&x("deletions",pe==="change"?"change-deletion":pe,J.lineNumber,`${J.unifiedLineIndex},${Te}`),Q!=null&&x("additions",pe==="change"?"change-addition":pe,Q.lineNumber,`${Q.unifiedLineIndex},${Te}`),ew({diffStyle:"split",type:pe,additionLine:Z,deletionLine:W,...de,context:y})}const Y=J?.noEOFCR??!1,ye=Q?.noEOFCR??!1;if(ye||Y){if(Y){const W=pe==="context"||pe==="context-expanded"?pe:"change-deletion";i==="unified"?(y.unifiedContentAST.push(lu(W)),y.pushToGutter("unified",go(W,"metadata",1))):(y.deletionsContentAST.push(lu(W)),y.pushToGutter("deletions",go(W,"metadata",1)),ye||(y.pushToGutter("additions",go(void 0,"buffer",1)),y.additionsContentAST.push(au(1))))}if(ye){const W=pe==="context"||pe==="context-expanded"?pe:"change-addition";i==="unified"?(y.unifiedContentAST.push(lu(W)),y.pushToGutter("unified",go(W,"metadata",1))):(y.additionsContentAST.push(lu(W)),y.pushToGutter("additions",go(W,"metadata",1)),Y||(y.pushToGutter("deletions",go(void 0,"buffer",1)),y.deletionsContentAST.push(au(1))))}y.incrementRowCount(1)}K>0&&d!=="simple"&&P({hunkIndex:pe==="context-expanded"?L:L+1,collapsedLines:K,rangeSize:w,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!t.isPartial}),y.incrementRowCount(1)}}),i==="split"&&I();const E=Math.max(rj(t.hunks),t.additionLines.length??0,t.deletionLines.length??0),z=e.bufferBefore>0||e.bufferAfter>0,N=!u&&t.type!=="deleted",R=!u&&t.type!=="new",M=y.rowCount>0||z;f=N&&M?f:void 0,m=R&&M?m:void 0,p=u&&M?p:void 0;const C=this.createPreElement(m!=null&&f!=null,E,r,o);return{unifiedGutterAST:u&&M?y.unifiedGutterAST.children:void 0,unifiedContentAST:p,deletionsGutterAST:R&&M?y.deletionsGutterAST.children:void 0,deletionsContentAST:m,additionsGutterAST:N&&M?y.additionsGutterAST.children:void 0,additionsContentAST:f,hunkData:g,preNode:C,themeStyles:r,baseThemeType:o,headerElement:s?void 0:this.renderHeader(this.diff,r,o),totalLines:E,rowCount:y.rowCount,bufferBefore:e.bufferBefore,bufferAfter:e.bufferAfter,css:""}}renderCodeAST(t,e){const n=t==="unified"?e.unifiedGutterAST:t==="deletions"?e.deletionsGutterAST:e.additionsGutterAST,r=t==="unified"?e.unifiedContentAST:t==="deletions"?e.deletionsContentAST:e.additionsContentAST;if(n==null||r==null)return;const o=il(n);return o.properties.style=`grid-row: span ${e.rowCount}`,[o,I3(r,e.rowCount)]}renderFullAST(t,e=[]){const n=this.renderCodeAST("unified",t);if(n!=null)return e.push(_t({tagName:"code",children:n,properties:{"data-code":"","data-unified":""}})),{...t.preNode,children:e};const r=this.renderCodeAST("deletions",t);r!=null&&e.push(_t({tagName:"code",children:r,properties:{"data-code":"","data-deletions":""}}));const o=this.renderCodeAST("additions",t);return o!=null&&e.push(_t({tagName:"code",children:o,properties:{"data-code":"","data-additions":""}})),{...t.preNode,children:e}}renderFullHTML(t,e=[]){return qi(this.renderFullAST(t,e))}renderPartialHTML(t,e){return e==null?qi(t):qi(_t({tagName:"code",children:t,properties:{"data-code":"",[`data-${e}`]:""}}))}getAnnotations(t,e,n,r,o){const i={type:"annotation",hunkIndex:r,lineIndex:o,annotations:[]};if(e!=null)for(const a of this.deletionAnnotations[e]??[])i.annotations.push(pa(a));const s={type:"annotation",hunkIndex:r,lineIndex:o,annotations:[]};if(n!=null)for(const a of this.additionAnnotations[n]??[])(t==="unified"?i:s).annotations.push(pa(a));if(t==="unified")return i.annotations.length>0?i:void 0;if(!(s.annotations.length===0&&i.annotations.length===0))return{deletionSpan:i,additionSpan:s}}renderHeader(t,e,n){const{themeType:r}=this.getOptionsWithDefaults();return k3({fileOrDiff:t,themeStyles:e,themeType:n??r})}};function ug(t,e){return kv(t.theme,e.theme)&&t.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&t.lineDiffType===e.lineDiffType}function Yk(t){return`${t} unmodified line${t>1?"s":""}`}function ew({diffStyle:t,type:e,deletionLine:n,additionLine:r,unifiedSpan:o,deletionSpan:i,additionSpan:s,context:a}){let l=!1;if(t==="unified"){if(r!=null?a.unifiedContentAST.push(r):n!=null&&a.unifiedContentAST.push(n),o!=null){const c=e==="change"?n!=null?"change-deletion":"change-addition":e;a.unifiedContentAST.push(Wu(o)),a.pushToGutter("unified",go(c,"annotation",1)),l=!0}}else if(t==="split"){if(n!=null&&a.deletionsContentAST.push(n),r!=null&&a.additionsContentAST.push(r),i!=null){const c=e==="change"?n!=null?"change-deletion":"context":e;a.deletionsContentAST.push(Wu(i)),a.pushToGutter("deletions",go(c,"annotation",1)),l=!0}if(s!=null){const c=e==="change"?r!=null?"change-addition":"context":e;a.additionsContentAST.push(Wu(s)),a.pushToGutter("additions",go(c,"annotation",1)),l=!0}}l&&a.incrementRowCount(1)}function pg(t,{hunkIndex:e,collapsedLines:n,rangeSize:r,hunkSpecs:o,isFirstHunk:i,isLastHunk:s,isExpandable:a},l){if(n<=0)return;const c=t==="unified"?l.unifiedContentAST:t==="deletions"?l.deletionsContentAST:l.additionsContentAST;if(l.hunkSeparators==="metadata"){o!=null&&(l.pushToGutter(t,$a({type:"metadata",content:o,isFirstHunk:i,isLastHunk:s})),c.push($a({type:"metadata",content:o,isFirstHunk:i,isLastHunk:s})),t!=="additions"&&l.incrementRowCount(1));return}if(l.hunkSeparators==="simple"){e>0&&(l.pushToGutter(t,$a({type:"simple",isFirstHunk:i,isLastHunk:!1})),c.push($a({type:"simple",isFirstHunk:i,isLastHunk:!1})),t!=="additions"&&l.incrementRowCount(1));return}const d=nj(t,e),u=r>l.expansionLineCount,f=a?e:void 0;l.pushToGutter(t,$a({type:l.hunkSeparators,content:Yk(n),expandIndex:f,chunked:u,slotName:d,isFirstHunk:i,isLastHunk:s})),c.push($a({type:l.hunkSeparators,content:Yk(n),expandIndex:f,chunked:u,slotName:d,isFirstHunk:i,isLastHunk:s})),t!=="additions"&&l.incrementRowCount(1),l.hunkData.push({slotName:d,hunkIndex:e,lines:n,type:t,expandable:a?{up:!i,down:!s,chunked:u}:void 0})}function Tj(t){const e=t.hunks.at(-1);if(e==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0)return 0;const n=t.additionLines.length-(e.additionLineIndex+e.additionCount),r=t.deletionLines.length-(e.deletionLineIndex+e.deletionCount);if(n!==r)throw new Error(`DiffHunksRenderer.processDiffResult: trailing context mismatch (additions=${n}, deletions=${r}) for ${t.name}`);return Math.min(n,r)}function Ej(t,e){return t.lineNumber===e.lineNumber&&t.side===e.side&&t.metadata===e.metadata}function Mj(t,e){return t.slotName===e.slotName&&t.hunkIndex===e.hunkIndex&&t.lines===e.lines&&t.type===e.type&&t.expandable?.chunked===e.expandable?.chunked&&t.expandable?.up===e.expandable?.up&&t.expandable?.down===e.expandable?.down}function Lj(t){const e=t[0];if(e!=="+"&&e!=="-"&&e!==" "&&e!=="\\"){console.error(`parseLineType: Invalid firstChar: "${e}", full line: "${t}"`);return}const n=t.substring(1);return{line:n===""?` `:n,type:e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}}function Pj(t,{cacheKey:e,isGitDiff:n=LL.test(t),oldFile:r,newFile:o,throwOnError:i=!1}={}){let s=0;const a=t.split(PL);let l;const c=r==null||o==null;let d=0,u=0;for(const f of a){const m=f.split(Uu),p=m.shift();if(p==null){if(i)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",f);continue}const g=p.match(_L);let h=0,k=0;if(g==null||l==null){if(l!=null){if(i)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",f);continue}l={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:c,additionLines:!c&&r!=null&&o!=null?o.contents.split(Uu):[],deletionLines:!c&&r!=null&&o!=null?r.contents.split(Uu):[],cacheKey:e},l.additionLines.length===1&&o?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&r?.contents===""&&(l.deletionLines.length=0),m.unshift(p);for(const I of m){const P=I.match(n?zL:DL);if(I.startsWith("diff --git")){const[,,E,,z]=I.trim().match(OL)??[];l.name=z.trim(),E!==z&&(l.prevName=E.trim())}else if(P!=null){const[,E,z]=P;E==="---"&&z!=="/dev/null"?(l.prevName=z.trim(),l.name=z.trim()):E==="+++"&&z!=="/dev/null"&&(l.name=z.trim())}else if(n){if(I.startsWith("new mode ")&&(l.mode=I.replace("new mode","").trim()),I.startsWith("old mode ")&&(l.prevMode=I.replace("old mode","").trim()),I.startsWith("new file mode")&&(l.type="new",l.mode=I.replace("new file mode","").trim()),I.startsWith("deleted file mode")&&(l.type="deleted",l.mode=I.replace("deleted file mode","").trim()),I.startsWith("similarity index")&&(I.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),I.startsWith("index ")){const[,E,z,N]=I.trim().match(jL)??[];E!=null&&(l.prevObjectId=E),z!=null&&(l.newObjectId=z),N!=null&&(l.mode=N)}I.startsWith("rename from ")&&(l.prevName=I.replace("rename from ","")),I.startsWith("rename to ")&&(l.name=I.replace("rename to ","").trim())}}continue}let y,w;for(;m.length>0&&(m[m.length-1]===` `||m[m.length-1]==="\r"||m[m.length-1]===`\r `||m[m.length-1]==="");)m.pop();const A=parseInt(g[3]),b=parseInt(g[1]);d=c?d:b-1,u=c?u:A-1;const x={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:parseInt(g[4]??"1"),additionStart:A,additionLines:h,deletionCount:parseInt(g[2]??"1"),deletionStart:b,deletionLines:k,deletionLineIndex:d,additionLineIndex:u,hunkContent:[],hunkContext:g[5],hunkSpecs:p,noEOFCRAdditions:!1,noEOFCRDeletions:!1};if(isNaN(x.additionCount)||isNaN(x.deletionCount)||isNaN(x.additionStart)||isNaN(x.deletionStart)){if(i)throw Error("parsePatchContent: invalid hunk metadata");console.error("parsePatchContent: invalid hunk metadata",x);continue}for(const I of m){const P=Lj(I);if(P==null){console.error("processFile: invalid rawLine:",I);continue}const{type:E,line:z}=P;if(E==="addition")(y==null||y.type!=="change")&&(y=mg("change",d,u),x.hunkContent.push(y)),u++,c&&l.additionLines.push(z),y.additions++,h++,w="addition";else if(E==="deletion")(y==null||y.type!=="change")&&(y=mg("change",d,u),x.hunkContent.push(y)),d++,c&&l.deletionLines.push(z),y.deletions++,k++,w="deletion";else if(E==="context")(y==null||y.type!=="context")&&(y=mg("context",d,u),x.hunkContent.push(y)),u++,d++,c&&(l.deletionLines.push(z),l.additionLines.push(z)),y.lines++,w="context";else if(E==="metadata"&&y!=null){if(y.type==="context"?(x.noEOFCRAdditions=!0,x.noEOFCRDeletions=!0):w==="deletion"?x.noEOFCRDeletions=!0:w==="addition"&&(x.noEOFCRAdditions=!0),c&&(w==="addition"||w==="context")){const N=l.additionLines.length-1;N>=0&&(l.additionLines[N]=ma(l.additionLines[N]))}if(c&&(w==="deletion"||w==="context")){const N=l.deletionLines.length-1;N>=0&&(l.deletionLines[N]=ma(l.deletionLines[N]))}}}x.additionLines=h,x.deletionLines=k,x.collapsedBefore=Math.max(x.additionStart-1-s,0),l.hunks.push(x),s=x.additionStart+x.additionCount-1;for(const I of x.hunkContent)I.type==="context"?(x.splitLineCount+=I.lines,x.unifiedLineCount+=I.lines):(x.splitLineCount+=Math.max(I.additions,I.deletions),x.unifiedLineCount+=I.deletions+I.additions);x.splitLineStart=l.splitLineCount+x.collapsedBefore,x.unifiedLineStart=l.unifiedLineCount+x.collapsedBefore,l.splitLineCount+=x.collapsedBefore+x.splitLineCount,l.unifiedLineCount+=x.collapsedBefore+x.unifiedLineCount}if(l!=null){if(l.hunks.length>0&&!c&&l.additionLines.length>0&&l.deletionLines.length>0){const f=l.hunks[l.hunks.length-1],m=f.additionStart+f.additionCount-1,p=l.additionLines.length,g=Math.max(p-m,0);l.splitLineCount+=g,l.unifiedLineCount+=g}return n||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type="rename-changed":l.type="rename-pure":o!=null&&o.contents===""?l.type="deleted":r!=null&&r.contents===""&&(l.type="new")),l.type!=="rename-pure"&&l.type!=="rename-changed"&&(l.prevName=void 0),l}}function mg(t,e,n){return t==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:e}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:e}}function Vh(t,e,n,r=!1){const o=Pj(hj(t.name,e.name,t.contents,e.contents,t.header,e.header),{cacheKey:(()=>{if(t.cacheKey!=null&&e.cacheKey!=null)return`${t.cacheKey}:${e.cacheKey}`})(),oldFile:t,newFile:e,throwOnError:r});if(o==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return o}let _j=-1;var F3=class{static LoadedCustomComponent=O3;__id=`file-diff:${++_j}`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;unsafeCSSStyle;hoverContent;headerElement;headerMetadata;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;mouseEventManager;lineSelectionManager;annotationCache=new Map;lineAnnotations=[];deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;lastRowCount;enabled=!0;constructor(t={theme:mr},e,n=!1){this.options=t,this.workerManager=e,this.isContainerManaged=n,this.hunksRenderer=new Ij({...t,hunkSeparators:typeof t.hunkSeparators=="function"?"custom":t.hunkSeparators},this.handleHighlightRender,this.workerManager),this.resizeManager=new e6,this.scrollSyncManager=new tj,this.mouseEventManager=new Yx("diff",pp(t,typeof t.hunkSeparators=="function"||(t.hunkSeparators??"line-info")==="line-info"||t.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0)),this.lineSelectionManager=new Xx(up(t,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getLineIndex=(t,e="additions")=>{if(this.fileDiff==null)return;const n=this.fileDiff.hunks.at(-1);let r,o;e:for(const i of this.fileDiff.hunks){let s=e==="deletions"?i.deletionStart:i.additionStart;const a=e==="deletions"?i.deletionCount:i.additionCount;let l=i.splitLineStart,c=i.unifiedLineStart;if(t=s+a){if(i===n){const d=t-(s+a);r=c+i.unifiedLineCount+d,o=l+i.splitLineCount+d;break e}continue}for(const d of i.hunkContent)if(d.type==="context")if(tthis.mouseEventManager.getHoveredLine();setLineAnnotations(t){this.lineAnnotations=t}canPartiallyRender(t,e,n){return!(t||e||n||typeof this.options.hunkSeparators=="function")}setSelectedLines(t){this.lineSelectionManager.setSelection(t)}cleanUp(t=!1){this.resizeManager.cleanUp(),this.mouseEventManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.lineSelectionManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.parentNode?.removeChild(this.fileContainer),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=""),this.fileContainer=void 0,this.pre!=null&&(this.pre.innerHTML="",this.pre=void 0),this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0,this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,t?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(t){const{overflow:e="scroll",diffStyle:n="split"}=this.options,{fileContainer:r,prerenderedHTML:o}=t;D3(r,o);for(const i of r.shadowRoot?.children??[]){if(i instanceof SVGElement){this.spriteSVG=i;continue}if(i instanceof HTMLElement){if(i instanceof HTMLPreElement){this.pre=i;for(const s of i.children)!(s instanceof HTMLElement)||s.tagName.toLowerCase()!=="code"||("deletions"in s.dataset&&(this.codeDeletions=s),"additions"in s.dataset&&(this.codeAdditions=s),"unified"in s.dataset&&(this.codeUnified=s));continue}if("diffsHeader"in i.dataset){this.headerElement=i;continue}if(i instanceof HTMLStyleElement&&i.hasAttribute(nv)){this.unsafeCSSStyle=i;continue}}}if(this.pre!=null&&this.syncCodeNodesFromPre(this.pre),this.pre==null)this.render(t);else{const{lineAnnotations:i,oldFile:s,newFile:a,fileDiff:l}=t;this.fileContainer=r,delete this.pre.dataset.dehydrated,this.lineAnnotations=i??this.lineAnnotations,this.additionFile=a,this.deletionFile=s,this.fileDiff=l??(s!=null&&a!=null?Vh(s,a):void 0),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderHoverUtility(),this.injectUnsafeCSS(),this.mouseEventManager.setup(this.pre),this.lineSelectionManager.setup(this.pre),this.resizeManager.setup(this.pre,e==="wrap"),e==="scroll"&&n==="split"&&this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions)}}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({oldFile:this.deletionFile,newFile:this.additionFile,fileDiff:this.fileDiff,forceRender:!0,renderRange:this.renderRange})}handleExpandHunk=(t,e)=>{this.expandHunk(t,e)};expandHunk(t,e){this.hunksRenderer.expandHunk(t,e),this.rerender()}render({oldFile:t,newFile:e,fileDiff:n,forceRender:r=!1,lineAnnotations:o,fileContainer:i,containerWrapper:s,renderRange:a}){if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");const l=t!=null&&e!=null&&(!Ip(t,this.deletionFile)||!Ip(e,this.additionFile));let c=n!=null&&n!==this.fileDiff;const d=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1;if(Am(a,this.renderRange)&&!r&&!d&&(n!=null&&n===this.fileDiff||n==null&&!l))return!1;const{renderRange:u}=this;if(this.renderRange=a,this.deletionFile=t,this.additionFile=e,n!=null?this.fileDiff=n:t!=null&&e!=null&&l&&(c=!0,this.fileDiff=Vh(t,e)),o!=null&&this.setLineAnnotations(o),this.fileDiff==null)return!1;this.hunksRenderer.setOptions({...this.options,hunkSeparators:typeof this.options.hunkSeparators=="function"?"custom":this.options.hunkSeparators}),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);const{diffStyle:f="split",disableErrorHandling:m=!1,disableFileHeader:p=!1,overflow:g="scroll"}=this.options;p&&this.headerElement!=null&&(this.headerElement.parentNode?.removeChild(this.headerElement),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),i=this.getOrCreateFileContainer(i,s);try{const h=this.getOrCreatePreNode(i);if(!(this.canPartiallyRender(r,d,l||c)&&this.applyPartialRender({previousRenderRange:u,renderRange:a}))){const k=this.hunksRenderer.renderDiff(this.fileDiff,a);if(k==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;k.headerElement!=null&&this.applyHeaderToDOM(k.headerElement,i),k.additionsContentAST!=null||k.deletionsContentAST!=null||k.unifiedContentAST!=null?this.applyHunksToDOM(h,k):this.pre!=null&&(this.pre.parentNode?.removeChild(this.pre),this.pre=void 0),this.renderSeparators(k.hunkData)}this.applyBuffers(h,a),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderHoverUtility(),this.mouseEventManager.setup(h),this.lineSelectionManager.setup(h),this.resizeManager.setup(h,g==="wrap"),g==="scroll"&&f==="split"?this.scrollSyncManager.setup(h,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp()}catch(h){if(m)throw h;console.error(h),h instanceof Error&&this.applyErrorToDOM(h,i)}return!0}renderPlaceholder(t){if(this.fileContainer==null)return!1;if(this.cleanChildNodes(),this.placeHolder==null){const e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${t}px`),!0}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.mouseEventManager.cleanUp(),this.lineSelectionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.hoverContent?.remove(),this.pre?.remove(),this.spriteSVG?.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.hoverContent=void 0,this.pre=void 0,this.spriteSVG=void 0,this.unsafeCSSStyle=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0}renderSeparators(t){const{hunkSeparators:e}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof e!="function"){for(const{element:r}of this.separatorCache.values())r.parentNode?.removeChild(r);this.separatorCache.clear();return}const n=new Map(this.separatorCache);for(const r of t){const o=r.slotName;let i=this.separatorCache.get(o);if(i==null||!Mj(r,i.hunkData)){i?.element.parentNode?.removeChild(i.element);const s=document.createElement("div");s.style.display="contents",s.slot=r.slotName,s.appendChild(e(r,this)),this.fileContainer.appendChild(s),i={element:s,hunkData:r},this.separatorCache.set(o,i)}n.delete(o)}for(const[r,{element:o}]of n.entries())this.separatorCache.delete(r),o.parentNode?.removeChild(o)}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(const{element:n}of this.annotationCache.values())n.parentNode?.removeChild(n);this.annotationCache.clear();return}const t=new Map(this.annotationCache),{renderAnnotation:e}=this.options;if(e!=null&&this.lineAnnotations.length>0)for(const[n,r]of this.lineAnnotations.entries()){const o=`${n}-${pa(r)}`;let i=this.annotationCache.get(o);if(i==null||!Ej(r,i.annotation)){i?.element.parentElement?.removeChild(i.element);const s=e(r);if(s==null)continue;i={element:M3(pa(r)),annotation:r},i.element.appendChild(s),this.fileContainer.appendChild(i.element),this.annotationCache.set(o,i)}t.delete(o)}for(const[n,{element:r}]of t.entries())this.annotationCache.delete(n),r.parentNode?.removeChild(r)}renderHoverUtility(){const{renderHoverUtility:t}=this.options;if(this.fileContainer==null||t==null)return;const e=t(this.mouseEventManager.getHoveredLine);if(!(e!=null&&this.hoverContent!=null)){if(e==null){this.hoverContent?.parentNode?.removeChild(this.hoverContent),this.hoverContent=void 0;return}this.hoverContent=L3(),this.hoverContent.appendChild(e),this.fileContainer.appendChild(this.hoverContent)}}getOrCreateFileContainer(t,e){const n=this.fileContainer;if(this.fileContainer=t??this.fileContainer??document.createElement(cp),n!=null&&n!==this.fileContainer&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),e!=null&&this.fileContainer.parentNode!==e&&e.appendChild(this.fileContainer),this.spriteSVG==null){const r=document.createElement("div");r.innerHTML=T3;const o=r.firstChild;o instanceof SVGElement&&(this.spriteSVG=o,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getFileContainer(){return this.fileContainer}getOrCreatePreNode(t){const e=t.shadowRoot??t.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,e.appendChild(this.pre)):this.pre.parentNode!==e&&(e.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(t){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(const e of Array.from(t.children))e instanceof HTMLElement&&("unified"in e.dataset?this.codeUnified=e:"deletions"in e.dataset?this.codeDeletions=e:"additions"in e.dataset&&(this.codeAdditions=e))}applyHeaderToDOM(t,e){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;const n=qi(t);if(n!==this.lastRenderedHeaderHTML){const i=document.createElement("div");i.innerHTML=n;const s=i.firstElementChild;if(!(s instanceof HTMLElement))return;this.headerElement!=null?e.shadowRoot?.replaceChild(s,this.headerElement):e.shadowRoot?.prepend(s),this.headerElement=s,this.lastRenderedHeaderHTML=n}if(this.isContainerManaged)return;const{renderHeaderMetadata:r}=this.options;this.headerMetadata!=null&&this.headerMetadata.parentNode?.removeChild(this.headerMetadata);const o=r?.({deletionFile:this.deletionFile,additionFile:this.additionFile,fileDiff:this.fileDiff})??void 0;o!=null&&(this.headerMetadata=document.createElement("div"),this.headerMetadata.slot=tv,o instanceof Element?this.headerMetadata.appendChild(o):this.headerMetadata.innerText=`${o}`,e.appendChild(this.headerMetadata))}injectUnsafeCSS(){if(this.fileContainer?.shadowRoot==null)return;const{unsafeCSS:t}=this.options;t==null||t===""||(this.unsafeCSSStyle==null&&(this.unsafeCSSStyle=P3(),this.fileContainer.shadowRoot.appendChild(this.unsafeCSSStyle)),this.unsafeCSSStyle.innerText=_3(t))}applyHunksToDOM(t,e){const{overflow:n="scroll"}=this.options,r=n==="wrap"?e.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let o=!1;const i=[],s=this.hunksRenderer.renderCodeAST("unified",e),a=this.hunksRenderer.renderCodeAST("deletions",e),l=this.hunksRenderer.renderCodeAST("additions",e);s!=null?(o=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=Gu({code:this.codeUnified,columnType:"unified",rowSpan:r}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s),i.push(this.codeUnified)):a!=null||l!=null?(a!=null?(o=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Gu({code:this.codeDeletions,columnType:"deletions",rowSpan:r}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(a),i.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),l!=null?(o=o||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Gu({code:this.codeAdditions,columnType:"additions",rowSpan:r}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l),i.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),i.length===0?t.textContent="":o&&t.replaceChildren(...i),this.lastRowCount=e.rowCount}applyPartialRender({previousRenderRange:t,renderRange:e}){const{pre:n,codeUnified:r,codeAdditions:o,codeDeletions:i,options:{diffStyle:s="split"}}=this;if(n==null||t==null||e==null||!Number.isFinite(t.totalLines)||!Number.isFinite(e.totalLines)||this.lastRowCount==null)return!1;const a=this.getCodeColumns(s,r,i,o);if(a==null)return!1;const l=t.startingLine,c=e.startingLine,d=l+t.totalLines,u=c+e.totalLines,f=Math.max(l,c),m=Math.min(d,u);if(m<=f)return!1;const p=Math.max(0,f-l),g=Math.max(0,d-m),h=this.trimColumns({columns:a,trimStart:p,trimEnd:g,previousStart:l,overlapStart:f,overlapEnd:m,diffStyle:s});if(h<0)throw new Error("applyPartialRender: failed to trim to overlap");if(this.lastRowCount{if(!(I<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:x,totalLines:I,bufferBefore:0,bufferAfter:0})},w=y(c,Math.max(f-c,0));if(w==null&&cm)return!1;const b=(x,I)=>{if(x!=null){if(s==="unified"&&!Array.isArray(a))this.insertPartialHTML(s,a,x,I);else if(s==="split"&&Array.isArray(a))this.insertPartialHTML(s,a,x,I);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");k+=x.rowCount}};return this.cleanupErrorWrapper(),b(w,"afterbegin"),b(A,"beforeend"),this.lastRowCount!==k&&(this.applyRowSpan(s,a,k),this.lastRowCount=k),!0}insertPartialHTML(t,e,n,r){if(t==="unified"&&!Array.isArray(e)){const o=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(e,o,r)}else if(t==="split"&&Array.isArray(e)){const o=this.hunksRenderer.renderCodeAST("deletions",n),i=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(e[0],o,r),this.renderPartialColumn(e[1],i,r)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}renderPartialColumn(t,e,n){if(t==null||e==null)return;const r=tw(e[0]),o=tw(e[1]);if(r==null||o==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");const i=o.at(0);n==="beforeend"&&i?.type==="element"&&typeof i.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(i.properties["data-buffer-size"],t.content.children[t.content.children.length-1],t.gutter.children[t.gutter.children.length-1],r,o,!0);const s=o.at(-1);n==="afterbegin"&&s?.type==="element"&&typeof s.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(s.properties["data-buffer-size"],t.content.children[0],t.gutter.children[0],r,o,!1),t.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),t.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(o))}mergeBuffersIfNecessary(t,e,n,r,o,i){if(!(e instanceof HTMLElement)||!(n instanceof HTMLElement))return;const s=this.getBufferSize(e.dataset);s!=null&&(i?(r.shift(),o.shift()):(r.pop(),o.pop()),this.updateBufferSize(e,s+t),this.updateBufferSize(n,s+t))}applyRowSpan(t,e,n){const r=o=>{o!=null&&(o.gutter.style.setProperty("grid-row",`span ${n}`),o.content.style.setProperty("grid-row",`span ${n}`))};if(t==="unified"&&!Array.isArray(e))r(e);else if(t==="split"&&Array.isArray(e))r(e[0]),r(e[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(t,e,n){let r=0,o=0,i=0,s=!1;const a=n>=0;if(t==null)return 0;const l=Array.from(t.content.children),c=Array.from(t.gutter.children);if(l.length!==c.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;i0||a&&r>=n)&&(d.remove(),u.remove(),e>0&&(e--,e===0&&(s=!0)),o++),r++;continue}if("separator"in d.dataset&&"separator"in u.dataset){(e>0||a&&r>=n)&&(d.remove(),u.remove(),o++);continue}if(d.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in u.dataset){(e>0||a&&r>=n)&&(d.remove(),u.remove(),o++);continue}if(d.dataset.gutterBuffer==="metadata"&&"noNewline"in u.dataset){(e>0||a&&r>=n)&&(d.remove(),u.remove(),o++);continue}if(d.dataset.gutterBuffer==="buffer"&&"contentBuffer"in u.dataset){const f=this.getBufferSize(u.dataset);if(f==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(e>0){const m=Math.min(e,f),p=f-m;p>0?(this.updateBufferSize(d,p),this.updateBufferSize(u,p),o+=m):(d.remove(),u.remove(),o+=f),e-=m}else if(a){const m=r,p=r+f-1;if(n<=m)d.remove(),u.remove(),o+=f;else if(n<=p){const g=p-n+1,h=f-g;this.updateBufferSize(d,h),this.updateBufferSize(u,h),o+=g}}r+=f;continue}throw console.error({gutterElement:d,contentElement:u}),new Error("FileDiff.trimColumnRows: unknown row elements")}return o}trimColumns({columns:t,diffStyle:e,overlapEnd:n,overlapStart:r,previousStart:o,trimEnd:i,trimStart:s}){const a=Math.max(0,r-o),l=n-o;if(l<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");const c=s>0,d=i>0;if(!c&&!d)return 0;const u=c?a:0,f=d?l:-1;if(e==="unified"&&!Array.isArray(t))return this.trimColumnRows(t,u,f);if(e==="split"&&Array.isArray(t)){const m=this.trimColumnRows(t[0],u,f),p=this.trimColumnRows(t[1],u,f);if(t[0]!=null&&t[1]!=null&&m!==p)throw new Error("FileDiff.trimColumns: split columns out of sync");return t[0]!=null?m:p}else throw console.error({diffStyle:e,columns:t}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(t){const e=Number.parseInt(t?.bufferSize??"",10);return Number.isNaN(e)?void 0:e}updateBufferSize(t,e){t.dataset.bufferSize=`${e}`,t.style.setProperty("grid-row",`span ${e}`),t.style.setProperty("min-height",`calc(${e} * 1lh)`)}getCodeColumns(t,e,n,r){function o(i){if(i==null)return;const s=i.children[0],a=i.children[1];if(!(!(s instanceof HTMLElement)||!(a instanceof HTMLElement)||s.dataset.gutter==null||a.dataset.content==null))return{gutter:s,content:a}}if(t==="unified")return o(e);{const i=o(n),s=o(r);return i!=null||s!=null?[i,s]:void 0}}applyBuffers(t,e){const{disableVirtualizationBuffers:n=!1}=this.options;if(n||e==null){this.bufferBefore!=null&&(this.bufferBefore.parentNode?.removeChild(this.bufferBefore),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.parentNode?.removeChild(this.bufferAfter),this.bufferAfter=void 0);return}e.bufferBefore>0?(this.bufferBefore==null&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",t.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${e.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):this.bufferBefore!=null&&(this.bufferBefore.parentNode?.removeChild(this.bufferBefore),this.bufferBefore=void 0),e.bufferAfter>0?(this.bufferAfter==null&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",t.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${e.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):this.bufferAfter!=null&&(this.bufferAfter.parentNode?.removeChild(this.bufferAfter),this.bufferAfter=void 0)}applyPreNodeAttributes(t,{themeStyles:e,baseThemeType:n,additionsContentAST:r,deletionsContentAST:o,totalLines:i}){const{diffIndicators:s="bars",disableBackground:a=!1,disableLineNumbers:l=!1,overflow:c="scroll",themeType:d="system",diffStyle:u="split"}=this.options,f={type:"diff",diffIndicators:s,disableBackground:a,disableLineNumbers:l,overflow:c,split:u==="unified"?!1:r!=null&&o!=null,themeStyles:e,themeType:n??d,totalLines:i};E3(f,this.appliedPreAttributes)||(z3(t,f),this.appliedPreAttributes=f)}applyErrorToDOM(t,e){this.cleanupErrorWrapper();const n=this.getOrCreatePreNode(e);n.innerHTML="",n.parentNode?.removeChild(n),this.pre=void 0,this.appliedPreAttributes=void 0;const r=e.shadowRoot??e.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.innerHTML="",r.appendChild(this.errorWrapper);const o=document.createElement("div");o.dataset.errorMessage="",o.innerText=t.message,this.errorWrapper.appendChild(o);const i=document.createElement("pre");i.dataset.errorStack="",i.innerText=t.stack??"No Error Stack",this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.parentNode?.removeChild(this.errorWrapper),this.errorWrapper=void 0}};function tw(t){if(!(t==null||t.type!=="element"))return t.children??[]}const Zu=new Set;let Ju=new Set,Uh=null,Hh=!1;function _o(t){if(Hh){Zu.add(t);return}Ju.add(t),Uh??=requestAnimationFrame($3)}function $3(t){Hh=!0;for(const e of Ju)try{e(t)}catch(n){console.error(n)}Ju.clear(),Zu.size>0?(Ju=new Set(Zu),Zu.clear(),Uh=requestAnimationFrame($3)):Uh=null,Hh=!1}let Dj=-1;var zj=class extends j3{__id=`virtualized-file:${++Dj}`;top;height=0;heightCache=new Map;isVisible=!1;constructor(t,e,n=rv,r,o=!1){super(t,r,o),this.virtualizer=e,this.metrics=n}getLineHeight(t,e=!1){const n=this.heightCache.get(t);if(n!=null)return n;const r=e?2:1;return this.metrics.lineHeight*r}setOptions(t){if(t==null)return;const e=this.options.overflow;super.setOptions(t),e!==this.options.overflow&&(this.heightCache.clear(),this.computeApproximateSize(),this.renderRange=void 0),this.virtualizer.instanceChanged(this)}reconcileHeights(){if(this.fileContainer==null||this.file==null){this.height=0;return}const{overflow:t="scroll"}=this.options;if(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),t==="scroll"&&this.lineAnnotations.length===0&&!this.virtualizer.config.resizeDebugging)return;let e=!1;if(this.code==null)return;const n=this.code.children[1];if(n instanceof HTMLElement){for(const r of n.children){if(!(r instanceof HTMLElement))continue;const o=r.dataset.lineIndex;if(o==null)continue;const i=Number(o);let s=r.getBoundingClientRect().height,a=!1;r.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in r.nextElementSibling.dataset||"noNewline"in r.nextElementSibling.dataset)&&("noNewline"in r.nextElementSibling.dataset&&(a=!0),s+=r.nextElementSibling.getBoundingClientRect().height);const l=this.getLineHeight(i,a);s!==l&&(e=!0,s===this.metrics.lineHeight*(a?2:1)?this.heightCache.delete(i):this.heightCache.set(i,s))}(e||this.virtualizer.config.resizeDebugging)&&this.computeApproximateSize()}}onRender=t=>this.fileContainer==null||this.file==null?!1:(t&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),this.render({file:this.file}));cleanUp(){this.fileContainer!=null&&this.virtualizer.disconnect(this.fileContainer),super.cleanUp()}computeApproximateSize(){const t=this.height===0;if(this.height=0,this.file==null)return;const{disableFileHeader:e=!1,overflow:n="scroll"}=this.options,{diffHeaderHeight:r,fileGap:o,lineHeight:i}=this.metrics,s=this.getOrCreateLineCache(this.file);if(e?this.height+=o:this.height+=r,n==="scroll"&&this.lineAnnotations.length===0?this.height+=this.getOrCreateLineCache(this.file).length*i:Cp({lines:s,callback:({lineIndex:a})=>{this.height+=this.getLineHeight(a,!1)}}),s.length>0&&(this.height+=o),this.fileContainer!=null&&this.virtualizer.config.resizeDebugging&&!t){const a=this.fileContainer.getBoundingClientRect();a.height!==this.height?console.log("VirtualizedFile.computeApproximateSize: computed height doesnt match",{name:this.file.name,elementHeight:a.height,computedHeight:this.height}):console.log("VirtualizedFile.computeApproximateSize: computed height IS CORRECT")}}setVisibility(t){this.fileContainer!=null&&(t&&!this.isVisible?(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),this.isVisible=!0):!t&&this.isVisible&&(this.isVisible=!1,this.rerender()))}render({fileContainer:t,file:e,...n}){const r=this.fileContainer==null;if(this.file??=e,t=this.getOrCreateFileContainerNode(t),this.file==null)return console.error("VirtualizedFile.render: attempting to virtually render when we dont have file"),!1;if(r?(this.computeApproximateSize(),this.virtualizer.connect(t,this),this.top??=this.virtualizer.getOffsetInScrollContainer(t),this.isVisible=this.virtualizer.isInstanceVisible(this.top,this.height)):this.top??=this.virtualizer.getOffsetInScrollContainer(t),!this.isVisible)return this.renderPlaceholder(this.height);const o=this.virtualizer.getWindowSpecs(),i=this.computeRenderRangeFromWindow(this.file,this.top,o);return super.render({file:this.file,fileContainer:t,renderRange:i,...n})}computeRenderRangeFromWindow(t,e,{top:n,bottom:r}){const{disableFileHeader:o=!1,overflow:i="scroll"}=this.options,{diffHeaderHeight:s,fileGap:a,hunkLineCount:l,lineHeight:c}=this.metrics,d=this.getOrCreateLineCache(t),u=d.length,f=this.height,m=o?a:s;if(er)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-a};if(u<=l)return{startingLine:0,totalLines:l,bufferBefore:0,bufferAfter:0};const p=Math.ceil(Math.max(r-n,0)/c),g=Math.ceil(p/l)*l+l*2,h=g/l,k=(n+r)/2;if(i==="scroll"&&this.lineAnnotations.length===0){const B=Math.floor((k-(e+m))/c),K=Math.floor(B/l)-Math.floor(h/2),Q=Math.ceil(u/l),J=Math.max(0,Math.min(K,Q))*l,pe=K<0?g+K*l:g,Te=J*c,Ve=Math.min(pe,u-J);return{startingLine:J,totalLines:pe,bufferBefore:Te,bufferAfter:Math.max(0,(u-J-Ve)*c)}}const y=h,w=[];let A=e+m,b=0,x,I,P;if(Cp({lines:d,callback:({lineIndex:B})=>{const K=b%l===0;if(K&&(w.push(A-(e+m)),P!=null)){if(P<=0)return!0;P--}const Q=this.getLineHeight(B,!1),J=Math.floor(b/l);return A>n-Q&&Ak&&(I??=J),P==null&&A>=r&&K&&(P=y),b++,A+=Q,!1}}),x==null)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-a};const E=w.length;I??=x;const z=Math.round(I-h/2),N=Math.max(0,E-h),R=Math.max(0,Math.min(z,N)),M=R*l,C=z<0?g+z*l:g,L=w[R]??0,O=R+C/l;return{startingLine:M,totalLines:C,bufferBefore:L,bufferAfter:Othis.fileContainer==null?!1:(t&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),this.render());cleanUp(){this.fileContainer!=null&&this.virtualizer.disconnect(this.fileContainer),super.cleanUp()}expandHunk(t,e){this.hunksRenderer.expandHunk(t,e),this.computeApproximateSize(),this.renderRange=void 0,this.virtualizer.instanceChanged(this)}setVisibility(t){this.fileContainer!=null&&(this.renderRange=void 0,t&&!this.isVisible?(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),this.isVisible=!0):!t&&this.isVisible&&(this.isVisible=!1,this.rerender()))}computeApproximateSize(){const t=this.height===0;if(this.height=0,this.fileDiff==null)return;const{disableFileHeader:e=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=ll,hunkSeparators:o="line-info"}=this.options,{diffHeaderHeight:i,fileGap:s,hunkSeparatorHeight:a}=this.metrics,l=this.getDiffStyle(),c=o!=="simple"&&o!=="metadata"&&o!=="line-info-basic"?s:0;if(e?o!=="simple"&&o!=="metadata"&&(this.height+=s):this.height+=i,Tp({diff:this.fileDiff,diffStyle:l,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,callback:({hunkIndex:d,collapsedBefore:u,collapsedAfter:f,deletionLine:m,additionLine:p})=>{const g=p!=null?p.splitLineIndex:m.splitLineIndex,h=p!=null?p.unifiedLineIndex:m.unifiedLineIndex,k=(p?.noEOFCR??!1)||(m?.noEOFCR??!1);u>0&&(d>0&&(this.height+=c),this.height+=a+c),this.height+=this.getLineHeight(l==="split"?g:h,k),f>0&&o!=="simple"&&(this.height+=c+a)}}),this.fileDiff.hunks.length>0&&(this.height+=s),this.fileContainer!=null&&this.virtualizer.config.resizeDebugging&&!t){const d=this.fileContainer.getBoundingClientRect();d.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:this.fileDiff.name,elementHeight:d.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}}render({fileContainer:t,oldFile:e,newFile:n,fileDiff:r,...o}={}){const i=this.fileContainer==null;if(this.fileDiff??=r??(e!=null&&n!=null?Vh(e,n):void 0),t=this.getOrCreateFileContainer(t),this.fileDiff==null)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(i?(this.computeApproximateSize(),this.virtualizer.connect(t,this),this.top??=this.virtualizer.getOffsetInScrollContainer(t),this.isVisible=this.virtualizer.isInstanceVisible(this.top,this.height)):this.top??=this.virtualizer.getOffsetInScrollContainer(t),!this.isVisible)return this.renderPlaceholder(this.height);const s=this.virtualizer.getWindowSpecs(),a=this.computeRenderRangeFromWindow(this.fileDiff,this.top,s);return super.render({fileDiff:this.fileDiff,fileContainer:t,renderRange:a,oldFile:e,newFile:n,...o})}getDiffStyle(){return this.options.diffStyle??"split"}getExpandedRegion(t,e,n){if(n<=0||t)return{fromStart:0,fromEnd:0,collapsedLines:Math.max(n,0),renderAll:!1};const{expandUnchanged:r=!1,collapsedContextThreshold:o=ll}=this.options;if(r||n<=o)return{fromStart:n,fromEnd:0,collapsedLines:0,renderAll:!0};const i=this.hunksRenderer.getExpandedHunk(e),s=Math.min(Math.max(i.fromStart,0),n),a=Math.min(Math.max(i.fromEnd,0),n),l=s+a,c=l>=n;return{fromStart:s,fromEnd:a,collapsedLines:Math.max(n-l,0),renderAll:c}}getExpandedLineCount(t,e){let n=0;if(t.isPartial){for(const o of t.hunks)n+=e==="split"?o.splitLineCount:o.unifiedLineCount;return n}for(const[o,i]of t.hunks.entries()){const s=e==="split"?i.splitLineCount:i.unifiedLineCount;n+=s;const a=Math.max(i.collapsedBefore,0),{fromStart:l,fromEnd:c,renderAll:d}=this.getExpandedRegion(t.isPartial,o,a);a>0&&(n+=d?a:l+c)}const r=t.hunks.at(-1);if(r!=null&&Fj(t)){const o=t.additionLines.length-(r.additionLineIndex+r.additionCount),i=t.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(r!=null&&o!==i)throw new Error(`VirtualizedFileDiff: trailing context mismatch (additions=${o}, deletions=${i}) for ${t.name}`);const s=Math.min(o,i);if(r!=null&&s>0){const{fromStart:a,renderAll:l}=this.getExpandedRegion(t.isPartial,t.hunks.length,s);n+=l?s:a}}return n}computeRenderRangeFromWindow(t,e,{top:n,bottom:r}){const{disableFileHeader:o=!1,expandUnchanged:i=!1,collapsedContextThreshold:s=ll,hunkSeparators:a="line-info"}=this.options,{diffHeaderHeight:l,fileGap:c,hunkLineCount:d,hunkSeparatorHeight:u,lineHeight:f}=this.metrics,m=this.getDiffStyle(),p=this.height,g=this.getExpandedLineCount(t,m),h=o?c:l;if(er)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:p-h-c};if(g<=d||t.hunks.length===0)return{startingLine:0,totalLines:d,bufferBefore:0,bufferAfter:0};const k=Math.ceil(Math.max(r-n,0)/f),y=Math.ceil(k/d)*d+d,w=y/d,A=w,b=[],x=(n+r)/2,I=a==="simple"||a==="metadata"||a==="line-info-basic"?0:c;let P=e+h,E=0,z,N,R;if(Tp({diff:t,diffStyle:m,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:pe,collapsedBefore:Te,collapsedAfter:Ve,deletionLine:ie,additionLine:Y})=>{const ye=Y!=null?Y.splitLineIndex:ie.splitLineIndex,W=Y!=null?Y.unifiedLineIndex:ie.unifiedLineIndex,Z=(Y?.noEOFCR??!1)||(ie?.noEOFCR??!1);let ue=Te>0?u+I+(pe>0?I:0):0;pe===0&&a==="simple"&&(ue=0),P+=ue;const de=E%d===0;if(de&&(b.push(P-(e+h+ue)),R!=null)){if(R<=0)return!0;R--}const Ae=this.getLineHeight(m==="split"?ye:W,Z),Ee=Math.floor(E/d);return P>n-Ae&&Px&&(N=Ee),R==null&&P>=r&&de&&(R=A),E++,P+=Ae,Ve>0&&a!=="simple"&&(P+=u+I),!1}}),z==null)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:p-h-c};const M=b.length;N??=z;const C=Math.round(N-w/2),L=Math.max(0,M-w),O=Math.max(0,Math.min(C,L)),B=O*d,K=C<0?y+C*d:y,Q=b[O]??0,J=O+K/d;return{startingLine:B,totalLines:K,bufferBefore:Q,bufferAfter:J=e||o){const d=Math.max(t-r,0),u=Math.min(t+a,e)-r;return{top:d,bottom:Math.max(u,d)}}let l=t+n/2-s/2,c=l+s;return l<0&&(l=0),c>e&&(c=e),l=Math.floor(Math.max(l-r,0)),{top:l,bottom:Math.ceil(Math.max(Math.min(c,e)-r,l))}}const B3=1e3,Vj=B3*4,Uj=[0,1e-6,.99999,1],Hj={overscrollSize:B3,intersectionObserverMargin:Vj,resizeDebugging:!1};let du=0,qj=-1;var V3=class ii{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++qj}`;config;type="basic";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Hj,...e}}setup(e,n){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Uj,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{ii.__STOP?(ii.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:ii.__lastScrollPosition}),_o(this.computeRenderRangeAndEmit)):(ii.__lastScrollPosition=this.getScrollTop(),ii.__STOP=!0)};for(const[r,o]of this.connectQueue.entries())this.connect(r,o);this.connectQueue.clear(),this.markDOMDirty(),_o(this.computeRenderRangeAndEmit)}}instanceChanged(e){this.instancesChanged.add(e),_o(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=nw({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),fitPerfectly:!1,overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,n){const r=this.getScrollTop(),o=this.getHeight(),i=this.config.intersectionObserverMargin,s=r-i,a=r+o+i;return!(ea)}handleContainerResize=e=>{if(this.root==null)return;let n=!1;for(const r of e){const o=r.borderBoxSize[0].blockSize;this.root instanceof Document?o!==this.scrollHeight&&(this.scrollHeightDirty=!0,n=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:o-du,newSize:o}),du=o)):r.target===this.root?o!==this.height&&(this.heightDirty=!0,n=!0):r.target===this.contentContainer&&(this.scrollHeightDirty=!0,n=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:o-du,newSize:o}),du=o))}n&&_o(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+tc(e,this.getScrollContainerElement())}connect(e,n){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,n):(this.intersectionObserver.observe(e),this.observers.set(e,n),this.instancesChanged.add(n),this.markDOMDirty(),_o(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const n=this.observers.get(e);this.connectQueue.delete(e),n!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),_o(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{ii.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,_o(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{ii.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,_o(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{ii.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,_o(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(ii.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;if(this.instancesChanged.size===0){const o=nw({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),fitPerfectly:!1,overscrollSize:this.config.overscrollSize});if(Bj(this.windowSpecs,o)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;this.windowSpecs=o}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),r=new Set;for(const o of this.visibleInstances.values())o.onRender(e)&&r.add(o);for(const o of this.instancesChanged)r.has(o)||o.onRender(e)&&r.add(o);this.scrollFix(n),this.instancesChanged.size>0&&this.markDOMDirty();for(const o of r)o.reconcileHeights();(this.instancesChanged.size>0||e)&&_o(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const n=this.getScrollContainerElement(),{lineIndex:r,lineOffset:o,fileElement:i,fileOffset:s,fileTypeOffset:a}=e;if(r!=null&&o!=null){const c=i.shadowRoot?.querySelector(`[data-line][data-line-index="${r}"]`);if(c instanceof HTMLElement){const d=tc(c,n);if(d!==o){const u=d-o;this.applyScrollFix(u)}return}}const l=tc(i,n);if(a==="top")l!==s&&this.applyScrollFix(l-s);else{const c=l+i.getBoundingClientRect().height;c!==s&&this.applyScrollFix(c-s)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const n=this.getScrollContainerElement();let r;for(const[o]of this.visibleInstances.entries()){const i=tc(o,n),s=i+o.offsetHeight;let a,l;s<=0?(a=s,l="bottom"):(a=i,l="top");let c,d;if(s>0&&i=0&&(r.fileOffset<0||ar.fileOffset))&&(u=!0),u&&(r={fileElement:o,fileTypeOffset:l,fileOffset:a,lineIndex:c,lineOffset:d})}return r}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:n,isIntersecting:r}of e){if(!(n instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const o=this.observers.get(n);if(o==null)throw new Error("Virtualizer.handleIntersectionChange: no instance for target");r&&!this.visibleInstances.has(n)?(o.setVisibility(!0),this.visibleInstances.set(n,o),this.visibleInstancesDirty=!0):!r&&this.visibleInstances.has(n)&&(o.setVisibility(!1),this.visibleInstances.delete(n),this.visibleInstancesDirty=!0)}this.visibleInstancesDirty&&_o(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function tc(t,e){const n=t.getBoundingClientRect(),r=e?.getBoundingClientRect().top??0;return n.top-r}function rw(t){const e=[];for(const n of t){const r=da.get(n);if(r==null)throw new Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);e.push(r)}return e}function ow(t){for(const e of Array.isArray(t)?t:[t])if(!da.has(e))return!1;return!0}async function iw(t){const e=[],n=[];for(const r of t){if(r==="text"||r==="ansi")continue;const o=g3(r)??f3(r);"then"in o?n.push(o):e.push(o)}return n.length>0&&await Promise.all(n).then(r=>{for(const o of r){if(o==null)throw new Error("resolvedLanguages: unable to resolve language");e.push(o)}}),e}function sw(t){const e=[];for(const n of t){const r=Wi.get(n);if(r==null)throw new Error(`getAllResolvedThemes: ${n} is unresolved, you must resolve all necessary themes before calling this function`);e.push(r)}return e}async function aw(t){const e=[],n=[];for(const r of t){const o=v3(r)??h3(r);"then"in o?n.push(o):e.push(o)}return n.length>0&&await Promise.all(n).then(r=>{for(const o of r)o!=null&&e.push(o)}),e}const Kj=` [data-diff] { --diffs-bg: light-dark(var(--diffs-light-bg), var(--diffs-dark-bg)); --diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark( color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)))); --diffs-bg-hover: var(--diffs-bg-hover-override, light-dark( color-mix(in lab, var(--diffs-bg) 97%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-mixer)))); --diffs-bg-context: var(--diffs-bg-context-override, light-dark( color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer)))); --diffs-bg-separator: var(--diffs-bg-separator-override, light-dark( color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer)))); --diffs-fg: light-dark(var(--diffs-light), var(--diffs-dark)); --diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)))); --diffs-deletion-base: var(--syntax-diff-delete); --diffs-addition-base: var(--syntax-diff-add); --diffs-modified-base: var(--syntax-diff-unknown); --diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark( color-mix(in lab, var(--diffs-bg) 98%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-deletion-base)))); --diffs-bg-deletion-number: var(--diffs-bg-deletion-number-override, light-dark( color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-deletion-base)))); --diffs-bg-deletion-hover: var(--diffs-bg-deletion-hover-override, light-dark( color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-deletion-base)))); --diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / 0.7), rgb(from var(--diffs-deletion-base) r g b / 0.1))); --diffs-bg-addition: var(--diffs-bg-addition-override, light-dark( color-mix(in lab, var(--diffs-bg) 98%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-addition-base)))); --diffs-bg-addition-number: var(--diffs-bg-addition-number-override, light-dark( color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-addition-base)))); --diffs-bg-addition-hover: var(--diffs-bg-addition-hover-override, light-dark( color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-addition-base)))); --diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / 0.07), rgb(from var(--diffs-addition-base) r g b / 0.1))); --diffs-selection-base: var(--surface-warning-strong); --diffs-selection-border: var(--border-warning-base); --diffs-selection-number-fg: #1c1917; /* Use explicit alpha instead of color-mix(..., transparent) to avoid Safari's non-premultiplied interpolation bugs. */ --diffs-bg-selection: var(--diffs-bg-selection-override, rgb(from var(--surface-warning-base) r g b / 0.65)); --diffs-bg-selection-number: var( --diffs-bg-selection-number-override, rgb(from var(--surface-warning-base) r g b / 0.85) ); --diffs-bg-selection-text: rgb(from var(--surface-warning-strong) r g b / 0.2); } :host([data-color-scheme='dark']) [data-diff] { --diffs-selection-number-fg: #fdfbfb; --diffs-bg-selection: var(--diffs-bg-selection-override, rgb(from var(--solaris-dark-6) r g b / 0.65)); --diffs-bg-selection-number: var( --diffs-bg-selection-number-override, rgb(from var(--solaris-dark-6) r g b / 0.85) ); } [data-diff] ::selection { background-color: var(--diffs-bg-selection-text); } ::highlight(opencode-find) { background-color: rgb(from var(--surface-warning-base) r g b / 0.35); } ::highlight(opencode-find-current) { background-color: rgb(from var(--surface-warning-strong) r g b / 0.55); } [data-diff] [data-line][data-comment-selected]:not([data-selected-line]) { box-shadow: inset 0 0 0 9999px var(--diffs-bg-selection); } [data-diff] [data-column-number][data-comment-selected]:not([data-selected-line]) { box-shadow: inset 0 0 0 9999px var(--diffs-bg-selection-number); color: var(--diffs-selection-number-fg); } [data-diff] [data-line-annotation][data-comment-selected]:not([data-selected-line]) [data-annotation-content] { box-shadow: inset 0 0 0 9999px var(--diffs-bg-selection); } [data-diff] [data-line][data-selected-line] { background-color: var(--diffs-bg-selection); box-shadow: inset 2px 0 0 var(--diffs-selection-border); } [data-diff] [data-column-number][data-selected-line] { background-color: var(--diffs-bg-selection-number); color: var(--diffs-selection-number-fg); } [data-diff] [data-column-number][data-line-type='context'][data-selected-line], [data-diff] [data-column-number][data-line-type='context-expanded'][data-selected-line], [data-diff] [data-column-number][data-line-type='change-addition'][data-selected-line], [data-diff] [data-column-number][data-line-type='change-deletion'][data-selected-line] { color: var(--diffs-selection-number-fg); } /* The deletion word-diff emphasis is stronger than additions; soften it while selected so the selection highlight reads consistently. */ [data-diff] [data-line][data-line-type='change-deletion'][data-selected-line] { --diffs-bg-deletion-emphasis: light-dark( rgb(from var(--diffs-deletion-base) r g b / 0.07), rgb(from var(--diffs-deletion-base) r g b / 0.1) ); } [data-diff-header], [data-diff], [data-file] { [data-separator] { height: 24px; } [data-column-number] { background-color: var(--background-stronger); cursor: default !important; } &[data-interactive-line-numbers] [data-column-number] { cursor: default !important; } &[data-interactive-lines] [data-line] { cursor: auto !important; } [data-code] { overflow-x: auto !important; overflow-y: hidden !important; } }`;function U3(t){return{theme:"OpenCode",themeType:"system",disableLineNumbers:!1,overflow:"wrap",diffStyle:t??"unified",diffIndicators:"bars",lineHoverHighlight:"both",disableBackground:!1,expansionLineCount:20,hunkSeparators:"line-info-basic",lineDiffType:t==="split"?"word-alt":"none",maxLineDiffLength:1e3,maxLineLengthForHighlighting:1e3,disableFileHeader:!0,unsafeCSS:Kj}}const H3={"--diffs-font-family":"var(--font-family-mono)","--diffs-font-size":"var(--font-size-small)","--diffs-line-height":"24px","--diffs-tab-size":2,"--diffs-font-features":"var(--font-family-mono--font-feature-settings)","--diffs-header-font-family":"var(--font-family-sans)","--diffs-gap-block":0,"--diffs-min-number-column-width":"4ch"};function q3(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gc={exports:{}},Wj=gc.exports,lw;function Gj(){return lw||(lw=1,(function(t,e){(function(n,r){r(e)})(Wj,function(n){const r=Symbol("newer"),o=Symbol("older");class i{constructor(u,f){typeof u!="number"&&(f=u,u=0),this.size=0,this.limit=u,this.oldest=this.newest=void 0,this._keymap=new Map,f&&(this.assign(f),u<1&&(this.limit=this.size))}_markEntryAsUsed(u){u!==this.newest&&(u[r]&&(u===this.oldest&&(this.oldest=u[r]),u[r][o]=u[o]),u[o]&&(u[o][r]=u[r]),u[r]=void 0,u[o]=this.newest,this.newest&&(this.newest[r]=u),this.newest=u)}assign(u){let f,m=this.limit||Number.MAX_VALUE;this._keymap.clear();let p=u[Symbol.iterator]();for(let g=p.next();!g.done;g=p.next()){let h=new s(g.value[0],g.value[1]);if(this._keymap.set(h.key,h),f?(f[r]=h,h[o]=f):this.oldest=h,f=h,m--==0)throw new Error("overflow")}this.newest=f,this.size=this._keymap.size}get(u){var f=this._keymap.get(u);return f?(this._markEntryAsUsed(f),f.value):void 0}set(u,f){var m=this._keymap.get(u);return m?(m.value=f,this._markEntryAsUsed(m),this):(this._keymap.set(u,m=new s(u,f)),this.newest?(this.newest[r]=m,m[o]=this.newest):this.oldest=m,this.newest=m,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var u=this.oldest;if(u)return this.oldest[r]?(this.oldest=this.oldest[r],this.oldest[o]=void 0):(this.oldest=void 0,this.newest=void 0),u[r]=u[o]=void 0,this._keymap.delete(u.key),--this.size,[u.key,u.value]}find(u){let f=this._keymap.get(u);return f?f.value:void 0}has(u){return this._keymap.has(u)}delete(u){var f=this._keymap.get(u);return f?(this._keymap.delete(f.key),f[r]&&f[o]?(f[o][r]=f[r],f[r][o]=f[o]):f[r]?(f[r][o]=void 0,this.oldest=f[r]):f[o]?(f[o][r]=void 0,this.newest=f[o]):this.oldest=this.newest=void 0,this.size--,f.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new l(this.oldest)}values(){return new c(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(u,f){typeof f!="object"&&(f=this);let m=this.oldest;for(;m;)u.call(f,m.value,m.key,this),m=m[r]}toJSON(){for(var u=new Array(this.size),f=0,m=this.oldest;m;)u[f++]={key:m.key,value:m.value},m=m[r];return u}toString(){for(var u="",f=this.oldest;f;)u+=String(f.key)+":"+f.value,f=f[r],f&&(u+=" < ");return u}}n.LRUMap=i;function s(d,u){this.key=d,this.value=u,this[r]=void 0,this[o]=void 0}function a(d){this.entry=d}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let d=this.entry;return d?(this.entry=d[r],{done:!1,value:[d.key,d.value]}):{done:!0,value:void 0}};function l(d){this.entry=d}l.prototype[Symbol.iterator]=function(){return this},l.prototype.next=function(){let d=this.entry;return d?(this.entry=d[r],{done:!1,value:d.key}):{done:!0,value:void 0}};function c(d){this.entry=d}c.prototype[Symbol.iterator]=function(){return this},c.prototype.next=function(){let d=this.entry;return d?(this.entry=d[r],{done:!1,value:d.value}):{done:!0,value:void 0}}})})(gc,gc.exports)),gc.exports}var Zj=Gj();const cw=q3(Zj),fg=Symbol("IGNORE_RESPONSE");var Jj=class{highlighter;preferredHighlighter;renderOptions;initialized=!1;workers=[];taskQueue=new Map;pendingTasks=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;instanceRequestMap=new Map;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;constructor(t,{langs:e,theme:n=mr,lineDiffType:r="word-alt",tokenizeMaxLineLength:o=1e3,preferredHighlighter:i="shiki-js"}){this.options=t,this.preferredHighlighter=i,this.renderOptions={theme:n,lineDiffType:r,tokenizeMaxLineLength:o},this.fileCache=new cw.LRUMap(t.totalASTLRUCacheSize??100),this.diffCache=new cw.LRUMap(t.totalASTLRUCacheSize??100),this.initialize(e)}isWorkingPool(){return!this.workersFailed}getFileResultCache(t){return t.cacheKey!=null?this.fileCache.get(t.cacheKey):void 0}getDiffResultCache(t){return t.cacheKey!=null?this.diffCache.get(t.cacheKey):void 0}inspectCaches(){const{fileCache:t,diffCache:e}=this;return{fileCache:t,diffCache:e}}evictFileFromCache(t){try{return this.fileCache.delete(t)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(t){try{return this.diffCache.delete(t)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:t=mr,lineDiffType:e="word-alt",tokenizeMaxLineLength:n=1e3}){const r={theme:t,lineDiffType:e,tokenizeMaxLineLength:n};this.isInitialized()||await this.initialize();const o=kv(r.theme,this.renderOptions.theme);if(o&&r.lineDiffType===this.renderOptions.lineDiffType&&r.tokenizeMaxLineLength===this.renderOptions.tokenizeMaxLineLength)return;const i=qc(t);let s=[];if(o||(Nh(i)?s=sw(i):s=await aw(i)),this.highlighter!=null)Rh(s,this.highlighter),await this.setRenderOptionsOnWorkers(r,s);else{const[a]=await Promise.all([kl({themes:i,langs:["text"],preferredHighlighter:this.preferredHighlighter}),this.setRenderOptionsOnWorkers(r,s)]);this.highlighter=a}this.renderOptions=r,this.diffCache.clear(),this.fileCache.clear();for(const a of this.themeSubscribers)a.rerender()}getFileRenderOptions(){const{tokenizeMaxLineLength:t,theme:e}=this.renderOptions;return{theme:e,tokenizeMaxLineLength:t}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(t,e){if(this.workersFailed)return;this.isInitialized()||await this.initialize();const n=[];for(const r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),new Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");n.push(new Promise((o,i)=>{const s=this.generateRequestId(),a={type:"set-render-options",id:s,request:{type:"set-render-options",id:s,renderOptions:t,resolvedThemes:e},resolve:o,reject:i,requestStart:Date.now()};this.pendingTasks.set(s,a),r.worker.postMessage(a.request)}))}await Promise.all(n)}subscribeToThemeChanges(t){return this.themeSubscribers.add(t),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(t),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(t){this.themeSubscribers.delete(t),this.queueBroadcastStateChanges()}subscribeToStatChanges(t){return this.statSubscribers.add(t),t(this.getStats()),()=>{this.statSubscribers.delete(t)}}queueBroadcastStateChanges(){this._queuedBroadcast==null&&(this._queuedBroadcast=requestAnimationFrame(this._broadcastStateChanges))}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);const t=this.getStats();for(const e of this.statSubscribers)e(t)};cleanUpPendingTasks(t){this.taskQueue.delete(t);const e=this.instanceRequestMap.get(t);e!=null&&(this.pendingTasks.delete(e),this.instanceRequestMap.delete(t)),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(t=[]){if(this.initialized!==!0)if(this.initialized===!1)this.initialized=new Promise((e,n)=>{(async()=>{try{const r=qc(this.renderOptions.theme);let o=[];Nh(r)?o=sw(r):o=await aw(r);let i=[];ow(t)?i=rw(t):i=await iw(t);const[s]=await Promise.all([kl({themes:r,langs:["text",...t],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(o,i)]);if(this.initialized===!1)throw this.terminateWorkers(),new Error("WorkerPoolManager: workers failed to initialize");this.highlighter=s,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),e()}catch(r){this.initialized=!1,this.workersFailed=!0,this.queueBroadcastStateChanges(),n(r)}})()}),this.queueBroadcastStateChanges();else return this.initialized}async initializeWorkers(t,e){this.workersFailed=!1;const n=[];this.workers.length>0&&this.terminateWorkers();for(let r=0;r<(this.options.poolSize??8);r++){const o=this.options.workerFactory(),i={worker:o,request_id:void 0,initialized:!1,langs:new Set(["text",...e.map(({name:s})=>s)])};o.addEventListener("message",s=>{this.handleWorkerMessage(i,s.data)}),o.addEventListener("error",s=>console.error("Worker error:",s,i)),this.workers.push(i),n.push(new Promise((s,a)=>{const l=this.generateRequestId(),c={type:"initialize",id:l,request:{type:"initialize",id:l,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:t,resolvedLanguages:e},resolve(){i.initialized=!0,s()},reject:a,requestStart:Date.now()};this.pendingTasks.set(l,c),this.executeTask(i,c)}))}await Promise.all(n)}drainQueue=()=>{if(this._queuedDrain=void 0,!(this.initialized!==!0||this.taskQueue.size===0)){for(const[t,e]of this.taskQueue){if(this.instanceRequestMap.has(t))continue;const n=dw(e),r=this.getAvailableWorker(n);if(r==null)break;this.assignWorkerToTask(e,r),this.resolveLanguagesAndExecuteTask(r,e,n)}this.queueBroadcastStateChanges()}};highlightFileAST(t,e){if((e.lang??xo(e.name))!=="text"){for(const n of[this.taskQueue,this.pendingTasks.values()])for(const r of n)if("instance"in r&&r.instance===t&&r.request.type==="file"&&Ip(e,r.request.file))return;this.submitTask(t,{type:"file",file:e})}}getPlainFileAST(t,e,n,r){if(this.highlighter==null){this.initialize();return}return C3(t,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:e,totalLines:n,lines:r})}highlightDiffAST(t,e){if((e.lang??xo(e.name))!=="text"){for(const n of[this.taskQueue,this.pendingTasks.values()])for(const r of n)if("instance"in r&&r.instance===t&&r.request.type==="diff"&&r.request.diff===e)return;this.submitTask(t,{type:"diff",diff:e})}}getPlainDiffAST(t,e,n,r,o){return this.highlighter!=null?N3(t,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:e,totalLines:n,expandedHunks:r,collapsedContextThreshold:o}):void 0}terminate(){this.terminateWorkers(),this.fileCache.clear(),this.diffCache.clear(),this.instanceRequestMap.clear(),this.taskQueue.clear(),this.pendingTasks.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}terminateWorkers(){for(const t of this.workers)t.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?"waiting":this.initialized!==!0?"initializing":"initialized",totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(t=>t.request_id!=null).length,queuedTasks:this.taskQueue.size,pendingTasks:this.pendingTasks.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(t,e){this.initialized===!1&&this.initialize();const n=this.generateRequestId(),r=Date.now(),o=(()=>{switch(e.type){case"file":return{type:"file",id:n,request:{...e,id:n},instance:t,requestStart:r};case"diff":return{type:"diff",id:n,request:{...e,id:n},instance:t,requestStart:r}}})();this.taskQueue.set(t,o),this.queueDrain()}async resolveLanguagesAndExecuteTask(t,e,n){try{const r=n.filter(o=>!t.langs.has(o));r.length>0&&(ow(r)?e.request.resolvedLanguages=rw(r):e.request.resolvedLanguages=await iw(r)),this.executeTask(t,e)}catch{this.clearWorkerTask(e,t)}}handleWorkerMessage(t,e){const n=this.pendingTasks.get(e.id);try{if(n==null)throw fg;if(e.type==="error"){const r=new Error(e.error);throw e.stack&&(r.stack=e.stack),"reject"in n?n.reject(r):n.instance.onHighlightError(r),r}else{if("instance"in n&&this.instanceRequestMap.get(n.instance)!==e.id)throw fg;switch(e.requestType){case"initialize":if(n.type!=="initialize")throw new Error("handleWorkerMessage: task/response dont match");n.resolve();break;case"set-render-options":if(n.type!=="set-render-options")throw new Error("handleWorkerMessage: task/response dont match");n.resolve();break;case"file":{if(n.type!=="file")throw new Error("handleWorkerMessage: task/response dont match");const{result:r,options:o}=e,{instance:i,request:s}=n;s.file.cacheKey!=null&&this.fileCache.set(s.file.cacheKey,{result:r,options:o}),i.onHighlightSuccess(s.file,r,o);break}case"diff":{if(n.type!=="diff")throw new Error("handleWorkerMessage: task/response dont match");const{result:r,options:o}=e,{instance:i,request:s}=n;s.diff.cacheKey!=null&&this.diffCache.set(s.diff.cacheKey,{result:r,options:o}),i.onHighlightSuccess(s.diff,r,o);break}}}}catch(r){r!==fg&&console.error(r,n,e)}n!=null&&this.clearWorkerTask(n,t),this.queueBroadcastStateChanges(),this.taskQueue.size>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain==null&&(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(t,e){e.request_id=t.id,"instance"in t&&(this.taskQueue.delete(t.instance),this.instanceRequestMap.set(t.instance,t.id)),this.pendingTasks.set(t.id,t)}clearWorkerTask(t,e){e.request_id=void 0,"instance"in t&&this.instanceRequestMap.delete(t.instance),this.pendingTasks.delete(t.id)}executeTask(t,e){this.assignWorkerToTask(e,t);for(const n of dw(e))t.langs.add(n);try{t.worker.postMessage(e.request)}catch(n){this.clearWorkerTask(e,t),console.error("Failed to post message to worker:",n),"instance"in e?e.instance.onHighlightError(n):"reject"in e&&e.reject(n)}this.queueBroadcastStateChanges()}getAvailableWorker(t){let e;for(const n of this.workers){if(n.request_id!=null||!n.initialized)continue;if(e=n,t.length===0)break;let r=!0;for(const o of t)if(!n.langs.has(o)){r=!1;break}if(r)break}return e}generateRequestId(){return`req_${++this.nextRequestId}`}};function dw(t){const e=new Set;if(t.type==="initialize"||t.type==="set-render-options")return[];switch(t.type){case"file":e.add(t.request.file.lang??xo(t.request.file.name));break;case"diff":e.add(t.request.diff.lang??xo(t.request.diff.name)),e.add(t.request.diff.lang??xo(t.request.diff.prevName??"-"));break}return e.delete("text"),Array.from(e)}const Qj="/assets/worker-DXsJPwkg.js";function Xj(){return new Worker(Qj,{type:"module"})}function uw(t){const e=new Jj({workerFactory:Xj,poolSize:2},{theme:"OpenCode",lineDiffType:t,preferredHighlighter:"shiki-wasm"});return e.initialize(),e}let gg,hg;function qh(t){if(!(typeof window>"u"))return t==="split"?(hg||(hg=uw("word-alt")),hg):(gg||(gg=uw("none")),gg)}var Yj=X("