offsite 0.0.50 → 0.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/apps/server/dist/main.mjs +2 -1
  2. package/apps/server/dist/main.mjs.map +1 -1
  3. package/apps/web/dist/assets/accounts-DFhyPLRl.js +513 -0
  4. package/apps/web/dist/assets/{audio-player-BE-oXEaT.js → audio-player-dA2OYPGm.js} +1 -1
  5. package/apps/web/dist/assets/{button-Dhs1rqob.js → button-CvTVUHeO.js} +1 -1
  6. package/apps/web/dist/assets/{dialog-Bnoy9Qj1.js → dialog-BferUxFi.js} +2 -2
  7. package/apps/web/dist/assets/dist-BF1ehGE9.js +1 -0
  8. package/apps/web/dist/assets/{editor-dialog-Dam_lnif.js → editor-dialog-Dsw9vpjf.js} +3 -3
  9. package/apps/web/dist/assets/image-viewer-H78MKvch.js +1 -0
  10. package/apps/web/dist/assets/{index-BNbxMM9D.js → index-DHTZLQW3.js} +2 -2
  11. package/apps/web/dist/assets/{preview-dialog-dl8oUCEx.js → preview-dialog-CXQtRB9z.js} +1 -1
  12. package/apps/web/dist/assets/{react-DHkIXOR_.js → react-BzGNAlhs.js} +1 -1
  13. package/apps/web/dist/assets/{tooltip-Pl1ZsI1C.js → tooltip-BVy8llWO.js} +1 -1
  14. package/apps/web/dist/assets/{utils-KVq36YOZ.js → utils-DPxKzVJp.js} +1 -1
  15. package/apps/web/dist/assets/{video-viewer-DIbmaY7P.js → video-viewer-Dc2ZMyL5.js} +1 -1
  16. package/apps/web/dist/assets/{zoomable-image-CmK5g_2H.js → zoomable-image-Cevmy_zk.js} +1 -1
  17. package/apps/web/dist/assets/zoomable-image-Dugv4kyQ.js +1 -0
  18. package/apps/web/dist/index.html +6 -6
  19. package/apps/web/dist/sw.js +1 -1
  20. package/package.json +1 -1
  21. package/apps/web/dist/assets/accounts-CcxlY38a.js +0 -513
  22. package/apps/web/dist/assets/dist-BR1NVf87.js +0 -1
  23. package/apps/web/dist/assets/image-viewer-AlNpsjfB.js +0 -1
  24. package/apps/web/dist/assets/zoomable-image-C5zI0AEw.js +0 -1
@@ -1,513 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/image-viewer-AlNpsjfB.js","assets/utils-KVq36YOZ.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/zoomable-image-CmK5g_2H.js","assets/button-Dhs1rqob.js","assets/MinusSignIcon-DGIm2EHe.js","assets/tooltip-Pl1ZsI1C.js","assets/preview-dialog-dl8oUCEx.js","assets/dialog-Bnoy9Qj1.js","assets/dist-BR1NVf87.js","assets/dist-BrDshb6Z.js","assets/preload-helper-BLdHbfdN.js","assets/video-viewer-DIbmaY7P.js","assets/react-DHkIXOR_.js","assets/audio-player-BE-oXEaT.js","assets/mermaid.core-BvdElKsv.js","assets/tags-DrTyXsO5.js","assets/chunk-7S6XSTFO-VvdR34BD.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-BbHDS76q.js","assets/chunk-DSNLSHJZ-Npz5XPWZ.js","assets/dist-B_J_HbC0.js","assets/chunk-OYAV6JZA-rT8O_-D6.js","assets/chunk-YZO67HFG-B_UXK566.js","assets/chunk-AQDTSKZB-DWCLLcEu.js","assets/chunk-UHW7PFBP-Cu9Ayl_R.js","assets/chunk-HAGFOTED-B1IVU9Z4.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-ZAUX2LTX-BaD-GxqC.js","assets/chunk-WQQL4CDK-BAxY1EoE.js","assets/line-QLqjjjjp.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-HNE4Q36P-ByoLUQMm.js","assets/chunk-EJLWFMJV-DyjKClu9.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-LNGE3PJU-Cz3NAIRA.js","assets/editor-dialog-Dam_lnif.js","assets/editor.api-4LH2ijIL.js","assets/editor-DjpsE8to.css","assets/editor-dialog-BNFI__d8.css"])))=>i.map(i=>d[i]);
2
- import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{a as r,c as i,i as a,n as o,r as s,s as c,t as l}from"./utils-KVq36YOZ.js";import{S as u,_ as d,a as f,b as p,d as m,f as h,g,h as _,i as v,l as y,m as b,n as x,o as S,p as C,r as w,s as T,t as E,u as D,v as O,x as k}from"./button-Dhs1rqob.js";import{A,C as j,D as M,E as N,O as ee,S as te,T as ne,_ as re,a as ie,b as ae,c as oe,d as se,f as ce,g as le,h as ue,i as de,k as fe,l as pe,m as me,n as he,o as ge,p as _e,r as ve,s as ye,u as be,v as xe,w as Se,x as Ce,y as we}from"./tags-DrTyXsO5.js";import{a as Te,c as Ee,i as De,n as Oe,o as eee,r as ke,s as Ae,t as je}from"./tooltip-Pl1ZsI1C.js";import{C as Me,S as Ne,_ as Pe,a as Fe,b as Ie,c as Le,d as Re,f as ze,g as Be,h as Ve,i as He,l as Ue,m as We,n as Ge,o as Ke,p as qe,r as Je,s as Ye,t as Xe,u as Ze,v as Qe,x as $e,y as et}from"./dialog-Bnoy9Qj1.js";import{t as tt}from"./preload-helper-BLdHbfdN.js";import{$ as nt,A as rt,B as it,D as at,E as ot,F as st,G as ct,H as lt,I as ut,J as dt,K as ft,L as pt,M as mt,N as ht,O as gt,P as _t,Q as vt,R as yt,U as bt,V as xt,W as St,X as Ct,Y as wt,Z as Tt,et as Et,j as Dt,k as Ot,l as kt,n as At,nt as jt,p as Mt,q as Nt,rt as Pt,s as Ft,t as It,tt as Lt,x as Rt,z as zt}from"./dist-BrDshb6Z.js";function Bt(e){return e[e.length-1]}function Vt(e,t){return typeof e==`function`?e(t):e}var Ht=Object.prototype.hasOwnProperty;function Ut(e){for(let t in e)if(Ht.call(e,t))return!0;return!1}var Wt=()=>Object.create(null),Gt=(e,t)=>Kt(e,t,!0);function Kt(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(qt(e)&&qt(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&&Bt(a)!==`${o-1}`||c&&Bt(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;l<c&&(f=l,d=e[f],u=t[f],u=d===u?d:typeof d==`object`?Kt(d,u,n,r):u,u===d);l++);if(l===c&&o===c)return e}else{let i=o===c,p=!0;for(;l<c;l++){f=s[l],d=e[f];let o=t[f];u=d===o?d:typeof d==`object`?Kt(d,o,n,r):o,i&&=u===d&&(a[l]===f||Ht.call(e,f)),p&&=Object.is(u,o),a[l]=u}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(p)return t}let p=i?s.fill(0):n?Wt():{};for(let o=0;o<c;o++)f=i?o:s[o],i?(d=e[f],o>l&&(u=t[f],u=d===u?d:typeof d==`object`?Kt(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function qt(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function Jt(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!Jt(a,o,n,r))return!1}return!0}if(qt(e)&&qt(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!Jt(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!Jt(e[a],t[a],n,r)))return!1;return i===0}return!1}var tee=/[\x00-\x1f\x7f"<>`{}]/g;function nee(e){return e.replace(tee,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Yt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return nee(t)}var Xt=[`http:`,`https:`,`mailto:`,`tel:`];function Zt(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var Qt=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function $t(e,t){if(!e)return!1;if(Qt.test(e))return!0;let n=Zt(e);return n?!t.has(n):!1}function en(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=Yt(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=Yt(r?e.slice(r):e)}return t}function tn(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function nn(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function rn(){throw Error(`Invariant failed`)}function an(e){return e.replace(/\/{2,}/g,`/`)}function on(e){return e===`/`?e:e.replace(/^\/+/,``)}function sn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function cn(e){return sn(on(e))}function ln(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function un(e,t,n=`never`,r){if(t.includes(`//`)&&(t=an(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=an(e)),o=e.split(`/`);o.length>1&&Bt(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(Bt(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?an(s):s)||`/`;return a&&r&&r.set(a,c),c}function dn(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function fn(e){return e==null||e===``}function pn(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function mn(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&fn(f)){if(c===`/`&&!d)continue;f=``}o+=c+pn(s,f,r)+(d||``)}}return o+a||`/`}function hn(e){return e?.isNotFound===!0}function gn(){try{return sessionStorage}catch{return}}var _n=`tsr-scroll-restoration-v1_3`,vn=gn();function yn(){try{return JSON.parse(vn?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var bn=yn(),xn=`data-scroll-restoration-id`,Sn=e=>e.state.__TSR_key||e.href;function Cn(e){let t=e.getAttribute(xn);if(t)return`[${xn}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var wn=!1,Tn=`window`;function En(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Dn(e){let t=new Set;for(let n of e){if(n===Tn)continue;let e=En(n);e&&t.add(e)}return t}function ree(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||Sn,a=new Set,o=e=>{let t=bn[e]||={};for(let e of a)e===document?t[Tn]={scrollX,scrollY}:e.isConnected&&(t[Cn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,wn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{wn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{history.scrollRestoration=`auto`,o(i(e.stores.resolvedLocation.get()??e.stores.location.get()));try{vn?.setItem(_n,JSON.stringify(bn))}catch{}}),addEventListener(`pageshow`,e=>{e.persisted&&(history.scrollRestoration=`manual`)})),!r.r&&(r.r=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.n,c=r.h,l;if(a.clear(),r.n=!0,r.h=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.e&&d&&d!==u){let e=bn[d];if(e){let t=bn[u];for(let n in e){if(n===Tn){if(s)continue}else{let e=En(n);if(!e||s&&o&&(l??=Dn(o),l.has(e)))continue}t||=bn[u]={},t[n]??=e[n]}}}wn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Dn(o));let t=e&&i&&c,s=r.e?bn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Tn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=En(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{wn=!1}}))}function iee(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function On(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function aee(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=On(r):Array.isArray(t)?t.push(On(r)):n[e]=[t,On(r)]}return n}var kn=/^(?:\s|["[{\d-]|fa|nu|tr)/,oee=jn(JSON.parse),An=Mn(JSON.stringify,JSON.parse);function jn(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=aee(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!kn.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function Mn(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!kn.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=iee(e,r);return t?`?${t}`:``}}var Nn=`__root__`;function Pn(e){e.statusCode=e.statusCode||e.code||307;let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Fn(e){return e instanceof Response&&!!e.options}function In(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var Ln=4,Rn=5;function zn(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function Bn(e,t,n){let r=e.slice(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.slice(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s<a)){let c=r.slice(s,a);return[o?3:c?1:2,c||`_splat`,r.slice(0,i),e.slice(t+a+1,c?n:e.length)]}}return r}function Vn(e,t,n,r,i,a){let o=n,s=t.fullPath??t.from,c=t.options,l=s.length,u=s.endsWith(`/`)?l-1:l,d=c?.caseSensitive??e,f=c?.params?.parse??c?.parseParams,p,m=a?n-1:0;if(!r||s.includes(`$`)){p=a?.slice()??[];let e=Bt(p);e&&typeof e!=`string`&&e[0]===2&&(p[p.length-1]=[e[0],e[1],e[2],e[3]===void 0?void 0:e[3]+s.substring(n-(s[n-2]===`/`?2:1),u)],m=l)}for(;o<l;){let e=o,t=s.indexOf(`/`,e),n=t===-1?l:t,a=Bn(s,e,n);o=n+1;let c;if(typeof a==`string`){if(!r)continue;let e=a,t;d?t=r.static??=new Map:(e=a.toLowerCase(),t=r.staticInsensitive??=new Map);let n=t.get(e);if(n)c=n;else{let n=Un(r);c=n,t.set(e,n)}}else{let t=a[0],h=a[2],g=a[3]??``;if(t===2&&(n=l,o=n+1),p&&m<n&&(m<e-1&&p.push(s.slice(m,e-1)),a[2]=`/`+h,t===2&&a[3]!==void 0&&u<l&&(a[3]=g.slice(0,-1)),p.push(a),m=n),!r)continue;let _=d&&!!(h||g);d||(h=h.toLowerCase(),g=g.toLowerCase());let v=t===1?r.dynamic??=[]:t===3?r.optional??=[]:r.wildcard??=[],y=t!==2&&!f&&v.find(e=>!e.parse&&e.caseSensitive===_&&e.prefix===h&&e.suffix===g);if(y)c=y;else{let e=Un(r,t,_,h,g);c=e,v.push(e),v.length===2&&i?.push(v)}}r=c}p&&m<u&&p.push(s.slice(m,u));let h=p?.slice();if(!r)return h;if(f&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=Un(r,Rn);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=Un(r,Ln);r.index=e,r=e}return r.parse=f??null,r.priority=c?.params?.priority??0,r.route||(r.data=h,g&&(r.route=t)),[r,o,h]}function Hn(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Un(e,t=0,n,r,i){return{kind:t,depth:e?e.depth+1:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,data:void 0,parent:e,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Wn(e,t){let n=Un(),r=[];function i(e,t,n,a){let[o,s,c]=Vn(!1,e,t,n,r,a);if(e.children)for(let t of e.children)i(t,s,o,c)}for(let t of e)i(t,1,n);for(let e of r)e.sort(Hn);t.masksTree=n,t.flatCache=In(1e3)}function Gn(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Yn(e,t.masksTree);return t.flatCache.set(e,r),r}function Kn(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Un(),Vn(t,{from:e},1,o),i.singleCache.set(a,o)),Yn(r,o,n)}function qn(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Yn(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Zn(a.route)),t.matchCache.set(r,a),a}function Jn(e,t=!1){let n=Un(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&rn(),i[e.id]=e,o!==0&&e.path){let t=sn(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=Vn(t,e,n,c,r,l);if(e._interpolation=f,e.children)for(let t of e.children)s(t,d,u,f)}s(e,1,n);for(let e of r)e.sort(Hn);return{processedTree:{segmentTree:n,singleCache:In(1e3),matchCache:In(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function Yn(e,t,n=!1){let r=e.split(`/`),i=$n(e,r,t,n);if(!i)return null;let[a]=Xn(e,r,i);return{route:i.node.route,rawParams:a}}function Xn(e,t,n){let r=Qn(n.node),i=n.node.data&&zn(n.node.data),a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.param??0;for(;s<r.length;o++,s++,c++){let u=r[s];if(u.kind===Ln)break;if(u.kind===Rn){o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1||u.kind===3){let e=i[l++];if(u.kind===3&&n.skipped&1<<s){o--,c=f-1;continue}let t=u.suffix||u.prefix?d.substring(u.prefix.length,d.length-u.suffix.length):d;(t||u.kind===1)&&(a[e]=decodeURIComponent(t))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,param:l}]}function Zn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Qn(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function $n(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!Bt(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!rr(l,n))continue;if(i.parse){if(!nr(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==Ln&&rr(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===Ln||i.kind===2)&&rr(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(nr(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&tr(f,o))return n;rr(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+er(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+er(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+er(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+er(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function er(e,t){return 2**(e-t-1)}function tr(e,t){return e===2**(t-1)-1}function nr(e,t,n){let r,i;try{[r,i]=Xn(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function rr(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Ln)>(e.node.kind===Ln)||t.node.kind===Ln==(e.node.kind===Ln)&&t.node.depth>e.node.depth)))}function ir(e,t,n){let r=cn(e),i=`/${r}`,a=t?i:i.toLowerCase(),o=`${a}/`,s={input:({url:e})=>{let n=t?e.pathname:e.pathname.toLowerCase();return n===a?e.pathname=`/`:n.startsWith(o)&&(e.pathname=e.pathname.slice(i.length)),e},output:({url:e})=>(e.pathname=an(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>ar(n,s.input({url:e})),output:({url:e})=>s.output({url:or(n,e)})}:s}function ar(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function or(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function sr(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{nn(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var cr=`__TSR_index`,lr=`popstate`,ur=`beforeunload`,dr=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function fr(e){let t=dr.exec(e);return t?`/`+e.slice(t[0].length):e}function pr(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
3
- \r`.includes(e)?``:encodeURIComponent(e))),fr(e)}function mr(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async n=>{let r=n.navigateOpts?.ignoreBlocker?void 0:e.getBlockers?.();if(typeof document<`u`&&r?.length&&(n.type===`PUSH`||n.type===`REPLACE`))for(let i of r){let r=_r(n.path,n.state);if(await i.blockerFn({currentLocation:t,nextLocation:r,action:n.type})){e.onBlocked?.();return}}n.task()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[cr];i=hr(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[cr];i=hr(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[cr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function hr(e,t){let n=vr();return{...t,key:n,__TSR_key:n,[cr]:e}}function gr(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>pr(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>_r(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=vr();t.history.replaceState({[cr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=_r(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[cr]-l.state[cr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0||typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=mr({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:s,flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(ur,x,{capture:!0}),t.removeEventListener(lr,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(ur,x,{capture:!0}),t.addEventListener(lr,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function _r(e,t){let n=pr(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=vr();t={[cr]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.slice(0,r>-1?i>-1?Math.min(r,i):r:i>-1?i:n.length),hash:r>-1?n.slice(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function vr(){return(Math.random()+1).toString(36).slice(7)}function yr(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function br(e){return e.pathname+e.search+e.hash}function xr(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Sr(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Cr({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function wr(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Tr(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var see=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={n:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:gr()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&cn(n)?ir(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=sr(this.latestLocation,e),ree(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Jn(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&Wn(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:In(1e3)}},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i},a)=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:en(e),external:!1,searchStr:o,search:Gt(t?.search,i),hash:en(r.slice(1)),state:Kt(t?.state,a)}}let o=ar(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:en(fr(o.pathname)),external:!!this.rewrite&&yr(o,this.origin),searchStr:c,search:Gt(t?.search,s),hash:en(o.hash.slice(1)),state:Kt(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=qn(sn(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=_r(n.href,{});n={...n,to:ar(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=e._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>i??=this.matchRoutesLightweight(a()),s=n.to?`${n.to}`:`.`,c=un(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[sn(c)],u=c.includes(`$`),d;if(l)d=l._branch??=Zn(l);else if(u)d=[];else{let[e,t,n]=this.getMatchedRoutes(c);d=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(d=[...d,this.options.notFoundRoute])}let f=u?l?._interpolation??Vn(!1,{fullPath:c},0):void 0,p;for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(p??=kr(n.params,e),!Ut(p))break;p===e&&(p=Object.assign(Wt(),p));try{Object.assign(p,t(p))}catch{}}}p??=kr(n.params,lee(n.params,f)?o()[3]:Ar);let m=e.leaveParams?c:fr(en(f?mn(c,f,p,this.pathParamsDecoder):c)),h=uee(d,e._includeValidateSearch),g=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,Or(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?dee(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||Ar,v=this.options.stringifySearch(_),y=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,b=y?`#${y}`:``,x=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:Ar,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=or(this.rewrite,e);C=br(e),yr(n,t)?(w=n.href,T=!0):w=fr(br(n))}else C=tn(S),w=C;return{publicHref:w,href:C,pathname:m,search:_,searchStr:v,state:x,hash:y??``,external:T,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=Gn(r.pathname,this.processedTree);if(t){let i=Object.assign(Wt(),t.rawParams),{from:a,params:o,...s}=t.route,c=kr(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return Er(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=sn(this.latestLocation.href)===sn(n.href)&&Jt(Cr(n.state),Cr(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.n=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?Zt(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return Er(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.h=e.action.type===`PUSH`||e.action.type===`REPLACE`),await xi(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Sr(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&xr(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i){let t=this._flights?.get(e);this._flights?.delete(e),t&&!t[2]&&o.push(t[1])}for(let e of o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(Qt.test(n)||(r=Zt(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:yr(e,this.origin)||(n=br(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=Nr,this.preloadRoute=e=>Si(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?un(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=Kn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!Jt(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?Jt(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=dn(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??An,parseSearch:e.parseSearch??oee,protocolAllowlist:e.protocolAllowlist??Xt}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=Vn(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:sn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?fee(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=Or(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof Dr||(r=new Dr(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let g=Wt(),_=i._interpolation?mn(i.fullPath,i._interpolation,r,this.pathParamsDecoder,g):i.fullPath,v=i.id+_+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(g,d);let x;if(!b)try{jr(i,d)}catch(e){if(x=hn(e)||Fn(e)?e:new cee(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:Gt(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=xr(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:_,updatedAt:Date.now(),search:y?Gt(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?Kt(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?Gt(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=Bt(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=Bt(a),c={...e.search};for(let e of a)try{Object.assign(c,Or(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=o;for(let t of a)try{jr(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function Er(e,t,{replace:n,ignoreBlocker:r}){if(!$t(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var Dr=class extends Error{},cee=class extends Error{};function Or(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Dr(`Async validation not supported`);if(n.issues)throw new Dr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function kr(e,t){if(e===void 0||e===!0)return t;let n=Object.create(null);return e===!1||e===null?n:typeof e==`function`?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function lee(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!Ht.call(e,t[1]))}var Ar=Object.freeze({});function uee(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=Or(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function dee(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=Vt(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function fee(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return Nn}function jr(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Mr(e,t){return e.options[t]?.preload?.()}function pee(e,t){let n=Mr(e,`component`),r=Mr(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Nr(e,t,n){let r=()=>t===!1?void 0:t?Mr(e,t):pee(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function Pr(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function Fr(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}var Ir=0,Lr=1,Rr=2,zr=3,Br=[4];function Vr(e){return typeof e[0]==`number`}function Hr(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function Ur(e,t){return e.routesById[t.routeId]}function Wr(e,t,n){return Fn(e)?[zr,e]:hn(e)?(e.routeId||=n,[Rr,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[Lr,e]):[Ir,e]}function Gr(e,t){let n=Wr(t,!0,e.id);if(n[0]!==Lr)return n;try{e.options.onError?.(n[1])}catch(t){n=Wr(t,!0,e.id)}return n}function Kr(e,t,n,r,i){return i[0].signal.aborted?Br:ci(e,t,n,Gr(n,r),i)}async function qr(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=Ur(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Yr(e,r),[i,Kr(e,t,u,a,n)]}if(c.aborted)return[i,Br];let p=r.paramsError??r.searchError;if(p!==void 0)return Yr(e,r),[i,Kr(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Qr(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?Hr(a,c):a);if(c.aborted)return[i,Br];let s=ci(e,t,u,Wr(o,!1,u.id),n);if(s[0]!==Ir)return Yr(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Yr(e,r),[i,Kr(e,t,u,a,n)]}finally{r.status=h,Qr(e,r,!1,n[0])}}i()}function Jr(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Yr(e,t){let n=t._flight;t._flight=void 0,Jr(e,t,n)?.abort()}function Xr(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Jr(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Zr(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Qr(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function $r(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function ei(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return Br;if(!i)return[Ir,void 0];let l=n._flight;Qr(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i($r(e,t,n,r,s,a,!!o[3]))).then(e=>Wr(e,!1,r.id),e=>Wr(e,!0,r.id)).then(t=>(t[0]!==Ir&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Lr&&l[2]?Gr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],ci(e,t,r,await Hr(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Yr(e,n),Br}finally{Qr(e,n,!1,s)}}function ti(e,t,n){t[0]!==zr&&(e.status=`success`,e.error=void 0,t[0]===Ir?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function ni(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Yr(e,r)}function ri(e,t){return t[0]===Lr||t[0]===Rr?{...e,status:t[0]===Lr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function ii(e,t,n,r,i,a,o){let s=t[1][n],c=Ur(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d($r(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=Br)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Yr(e,s),p=Kr(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Jr(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?ei(e,t,s,c,g,i,a).then(t=>(ti(s,t,l),t[0]===Ir&&(m&&!a[0].signal.aborted&&ni(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[Ir,s.loaderData]),T=(async()=>{try{let e=Nr(c,void 0,C);e&&await Hr(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,Kr(e,t,c,r,a)]}let r=await w;x&&r[0]===Ir&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>ri(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=ei(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,ti(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>ri(E,e))}async function ai(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Ur(e,t[n]);try{let e=Nr(i,!1);e&&await Hr(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function oi(e,t){t[2]&&=(Xr(e,t[2].map(e=>e[3])),void 0)}async function si(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=zr)throw[a,t];!i&&t[0]!==Ir&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===zr)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function ci(e,t,n,r,i,a){for(;r[0]===zr;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[zr,t]:[zr,t,a]}return[zr,o,n]}catch(e){r=a?[Lr,e]:Gr(n,e),a=!0}}return r}async function li(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===Rr?ai(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=zr)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==Ir&&t[0]<zr&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=zr){let n=s[1];if(n[0]!==zr||n[1].options.reloadDocument||n[2])return oi(e,t),n;c=!0,s=[0,[Lr,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===Lr?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=Ur(e,u);try{await Hr(i?Promise.resolve().then(()=>Nr(m,l===Lr?`errorComponent`:`notFoundComponent`)):Promise.all([Nr(m),Nr(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return oi(e,t),Br}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),oi(e,t),Xr(e,o),p()):u.status=`success`}return t}async function ui(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=Ur(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await Hr(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function di(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await ai(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=ii(e,i,t,u,f,r,l)},m=await qr(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===Rr){let t=await ai(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=zr&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=li(e,i,u,r[0],si(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=si(i[2],void 0,void 0,h.then(e=>Vr(e)?0:Pr(n).length,()=>0))),o=await h}catch(t){if(oi(e,i),t===a&&a.aborted)return Br;throw t}return Vr(o)?o:ui(e,o,a,r[6]===n.length?r[6]:0)}function fi(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=Ur(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>fi(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function pi(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function mi(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!Pr(t[3]).some(e=>e.id===n[1]))return;let i;try{await Hr(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function hi(e,t){e._committed=t,e.stores.setMatches(t)}function gi(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=Pr(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=Ur(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=wr(n);hi(e,n),Xr(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Tr(e,i,n,a,l,t)}async function _i(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function vi(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function yi(e,t,n,r,i){let a=n.map(e=>({...e}));Zr(a);for(let t of r)Yr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await li(e,o,r,t[0],i)}catch(t){throw Xr(e,a),t}if(Vr(s))Xr(e,a),s[0]===zr&&e._tx===t&&e._committed===n&&await vi(e,t,s);else if(await ui(e,s,t[0].signal),e._tx!==t||e._committed!==n)Xr(e,a);else{for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Yr(e,n))}hi(e,a),Xr(e,n,a)}}async function bi(e,t,n,r,i,a){let o=await di(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Vr(o)){let n=o[0]===zr&&e._tx===t;if((!n||o[1].options.reloadDocument)&&pi(e,t),Xr(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){pi(e,t);return}await vi(e,t,o);return}let s=o[1];if(e._tx===t&&await mi(e,t),e._tx!==t){pi(e,t),Xr(e,s),oi(e,o);return}let c=t[2],l=Sr(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await mi(e,t),e._tx!==t){pi(e,t),Xr(e,s),oi(e,o);return}let n=await e.startTransition(()=>{pi(e,t),gi(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);e._tx===t?(u?.length&&yi(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)):oi(e,o)})}async function xi(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=Sr(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await _i(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Zr(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){Xr(e,m),await _i(e,n);return}e._preflight=void 0;let g,_=()=>bi(e,y,f,()=>fi(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>_i(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Qr(e,t,!1)}n[0].abort(),Xr(e,n[3],y[3],!0)}e._tx===y?(e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&fi(e,y),g?.(_()),await y[5]):(Xr(e,y[3]),y[3]=[],g?.(),await _i(e,y))}async function Si(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Zr(a),o=(e._preloads??=new Map).set(i,a),s=await di(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),Xr(e,a)),i.abort()}if(!Vr(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){hn(e)||console.error(e);return}}}var Ci=`Error preloading route! ☝️`,wi=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Nn:this.parentRoute||rn();let r=n?Nn:t?.path;r&&r!==`/`&&(r=on(r));let i=t?.id||r,a=n?Nn:an((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:an(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=sn(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Pn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Ti=class extends wi{constructor(e){super(e)}},P=e(i(),1),Ei=P.createContext(null);function Di(e){return P.useContext(Ei)}function Oi(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{Fr(e,t,n)||(i=n,r.forEach(e=>e()))};return[()=>i??n.get(),e=>(r.size||(i=n.get(),a=n.subscribe(o).unsubscribe),r.add(e),()=>{r.delete(e),r.size||(a(),i=void 0)})]}var ki=P.createContext(void 0),Ai=P.createContext(void 0);function ji({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0)n=e.nextSub;else{for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Mi(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Ni=[],Pi=0,{link:Fi,unlink:Ii,propagate:Li,checkDirty:Ri,shallowPropagate:zi}=ji({update(e){return e._update()},notify(e){Ni[Vi++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Gi(e))}}),Bi=0,Vi=0,Hi,Ui=0;function Wi(e){try{++Ui,e()}finally{--Ui||Ki()}}function Gi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ii(n,e)}function Ki(){if(!(Ui>0)){for(;Bi<Vi;){let e=Ni[Bi];Ni[Bi++]=void 0,e.notify()}Bi=0,Vi=0}}function qi(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return Hi!==void 0&&Fi(i,Hi,Pi),i._snapshot},subscribe(e){let t=Mi(e),n={current:!1},r=mee(()=>{i.get(),n.current?(Hi=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Hi,o=t?.compare??Object.is;if(n)Hi=i,++Pi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Hi=a,n&&(i.flags&=-5),Gi(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Ri(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&zi(e)}}else e&32&&(i.flags=e&-33);return Hi!==void 0&&Fi(i,Hi,Pi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Li(e),zi(e),Ki())}},i}function mee(e){let t=()=>{let t=Hi;Hi=n,++Pi,n.depsTail=void 0,n.flags=6;try{return e()}finally{Hi=t,n.flags&=-5,Gi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Ri(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Gi(this)}};return t(),n}var hee=n((e=>{var t=i();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),gee=n(((e,t)=>{t.exports=hee()})),_ee=n((e=>{var t=i(),n=gee();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:r,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),vee=n(((e,t)=>{t.exports=_ee()}))();function yee(e,t){return e===t}function Ji(e,t=e=>e,n){let r=n?.compare??yee,i=(0,P.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,P.useCallback)(()=>e.get(),[e]);return(0,vee.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Yi={};function bee(e,t){let n=P.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Kt(n.current,i):i}}function Xi(e){let t=Di(),n=P.useContext(e.from?Ai:ki),r=e.from??n,i=t.stores.getMatchStore(r),a=bee(e,t),o=Ji(i,e=>e?a(e):Yi);if(o!==Yi)return o;(e.shouldThrow??!0)&&rn()}function Zi(e){return Xi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Qi(e){let{select:t,...n}=e;return Xi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function $i(e){return Xi({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function ea(e){return Xi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function ta(e){let t=Di();return P.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function na(e){return Xi({...e,select:t=>e.select?e.select(t.context):t.context})}var F=c();function xee(...e){let t=P.useRef(e),n=t.current;return e.forEach((e,t)=>{Jt(n[t],e,!1,!0)||(n[t]=e)}),t.current}function ra(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(Ci)})}function See(e,t){let n=typeof e==`string`&&Zt(e);if(n)return t.has(n)?e:null}function Cee(e,t,n,r){let i=ln(e.pathname,r),a=ln(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!Jt(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function wee(e,t,n){let r=Di(),i=P.useRef(null),a=P.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,disabled:u,target:d,onClick:f,onBlur:p,onFocus:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:_}=e,[v,y,b]=xee(e.search,e.params,o),x=P.useContext(ki),S=(r.stores._linkScopes??={})[x]??=Oi(r,x),[C,w,T]=P.useMemo(()=>{let t=See(s,r.protocolAllowlist);if(t!==void 0){let n=[t??void 0];return[e,()=>n]}let n={...e},i,a,o,c=()=>{let e=S[0]();if(e!==i){n._fromLocation=e;let t=r.buildLocation(n),o=ca(t,r,u),s=u||o&&!Zt(o)?Cee(e,t,b,r.basepath):void 0;(!a||a[0]!==o||a[1]!==s)&&(a=[o,s]),i=e}return a};return[n,c,b?.includeHash&&(()=>{let e=c();return e[1]?o??=[e[0],!1]:e})]},[r,S,e.from,e.hash,e.href,s,v,y,e.state,e.mask,e.unsafeRelative,b,u]),[E,D]=P.useSyncExternalStore(S[1],w,T||w),O=D===void 0&&E,k=u||E===void 0,A=P.useRef(!1),j=e.reloadDocument||O||k?!1:c??r.options.defaultPreload,M=l??r.options.defaultPreloadDelay??0,N=P.useCallback(e=>{let t=e?.isIntersecting;t??j===`intent`?M?i.t??=setTimeout(()=>{i.t=void 0,ra(r,C)},M):ra(r,C):t===!1&&oa(i)},[r,C,i,j,M]);P.useEffect(()=>{if(!j)return;j===`render`&&!A.current&&(A.current=!0,ra(r,C));let e=!0,t;return j===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&N(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),oa(i)}},[r,C,j,N,i]);let ee=Dee(e,n);if(ee.ref=t?a:i,O)return ee.href=O,ee;let te=t=>{let n=d??t.currentTarget.getAttribute(`target`);!k&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&(!n||n===`_self`)&&t.button===0&&(t.preventDefault(),oa(i),r.navigate({...e,_fromLocation:C._fromLocation}))},ne=()=>{j===`intent`&&ra(r,C)},re=()=>{j===`intent`&&oa(i)};return ee.onClick=sa(f,te),ee.onBlur=sa(p,re),ee.onFocus=sa(m,N),ee.onMouseEnter=sa(h,N),ee.onMouseLeave=sa(g,re),ee.onTouchStart=sa(_,ne),aa(ee,e,D,E,k,n)}var Tee={},Eee={className:`active`},ia=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function Dee(e,t){let n={};for(let r in e)ia.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function aa(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=Vt(n?o:s,{})??(n?Eee:Tee);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var oa=e=>{clearTimeout(e.t),e.t=void 0},sa=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function ca(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!$t(i,t.protocolAllowlist))return i}var la=P.memo(P.forwardRef((e,t)=>{let n=e._asChild||`a`,r=wee(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return P.createElement(n,r,i)}),ua);function ua(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!ia.has(r)||!Jt(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var da=class extends wi{constructor(e){super(e),this.useMatch=e=>Xi({...e,from:this.id}),this.useRouteContext=e=>na({...e,from:this.id}),this.useSearch=e=>ea({...e,from:this.id}),this.useParams=e=>$i({...e,from:this.id}),this.useLoaderDeps=e=>Qi({...e,from:this.id}),this.useLoaderData=e=>Zi({...e,from:this.id}),this.useNavigate=()=>ta({from:this.fullPath}),this.Link=P.forwardRef((e,t)=>(0,F.jsx)(la,{ref:t,from:this.fullPath,...e}))}};function fa(e){return new da(e)}var pa=class extends Ti{constructor(e){super(e),this.useMatch=e=>Xi({...e,from:this.id}),this.useRouteContext=e=>na({...e,from:this.id}),this.useSearch=e=>ea({...e,from:this.id}),this.useParams=e=>$i({...e,from:this.id}),this.useLoaderDeps=e=>Qi({...e,from:this.id}),this.useLoaderData=e=>Zi({...e,from:this.id}),this.useNavigate=()=>ta({from:this.fullPath}),this.Link=P.forwardRef((e,t)=>(0,F.jsx)(la,{ref:t,from:this.fullPath,...e}))}};function ma(e){return new pa(e)}var ha=e=>({createMutableStore:qi,createReadonlyStore:qi,batch:Wi}),ga=e=>new _a(e),_a=class extends see{constructor(e){super(e,ha)}},va=`global`;function ya(e,t,n){let r=new Uint8Array(5+n.length);return r[0]=e,new DataView(r.buffer).setUint32(1,t),r.set(n,5),r}function ba(e){if(e.length<5)throw Error(`terminal frame is too short`);return{kind:e[0],id:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(1),data:e.subarray(5)}}function xa(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Sa(e,t){let n,r=()=>{if(n)return n;let r=indexedDB.open(e);return r.onupgradeneeded=()=>r.result.createObjectStore(t),n=xa(r),n.then(e=>{e.onclose=()=>n=void 0},()=>{n=void 0}),n};return(e,n)=>r().then(r=>n(r.transaction(t,e).objectStore(t)))}var Ca;function wa(){return Ca||=Sa(`keyval-store`,`keyval`),Ca}function Ta(e,t=wa()){return t(`readonly`,t=>xa(t.get(e)))}function Ea(e,t,n=wa()){return n(`readwrite`,n=>(n.put(t,e),xa(n.transaction)))}function Da(e,t=wa()){return t(`readwrite`,t=>(t.delete(e),xa(t.transaction)))}var Oa=Sa(`offsite`,`tokens`);function ka(e){return Ta(e,Oa)}function Aa(e,t){return Ea(e,t,Oa)}function ja(e){return Da(e,Oa)}var Ma=1e3,Na=3e4,Pa=1e4,Fa=1e4,Ia=3e3,La=3e4,Ra=3e5,za=[`sessions.send`,`sessions.rewind`,`sessions.fork`,`git.commit`,`git.push`,`git.pullRequest`,`git.createPullRequest`],Ba=new Set,Va=new Map,Ha=0;function Ua(){window.setInterval(()=>{for(let e of Va.keys())Za(e)},Pa),document.addEventListener(`visibilitychange`,()=>{document.hidden||Wa()}),window.addEventListener(`online`,Wa)}function Wa(){for(let[e,t]of Va)t.connected?Za(e):t.timer!==void 0&&(window.clearTimeout(t.timer),t.timer=void 0,t.failures=0,Qa(e,t,0))}function Ga(e,t){if(Va.has(e))return;let n={urls:t,url:t[0],socket:null,connected:!1,ping:null,timer:void 0,failures:0,pending:new Map};Va.set(e,n),Qa(e,n,0)}function Ka(e){let t=Va.get(e);t!==void 0&&(Va.delete(e),window.clearTimeout(t.timer),t.socket!==null&&(t.socket.onclose=null,t.socket.close()),no(e,t))}function qa(e){Ba.add(e)}function Ja(e){return Va.get(e)?.connected===!0}function Ya(e){let t=Va.get(e);if(t===void 0)throw Error(`This machine is not connected`);return t.url}function I(e,t,n){let r=Va.get(e);if(r===void 0||r.socket===null||!r.connected)return Promise.reject(Error(r===void 0?`That machine was removed`:`Not connected to ${new URL(r.url).host}; reconnecting`));Ha+=1;let i=Ha;r.socket.send(JSON.stringify({id:i,method:t,params:n}));let a=za.includes(t)?Ra:La;return new Promise((e,n)=>{let o=window.setTimeout(()=>{r.pending.delete(i),n(Error(`${new URL(r.url).host} did not answer ${t} within ${a/1e3} seconds`))},a);r.pending.set(i,{resolve:t=>{window.clearTimeout(o),e(t)},reject:e=>{window.clearTimeout(o),n(e)}})})}function Xa(e,t,n,r){let i=Va.get(e);i!==void 0&&i.socket!==null&&i.connected&&i.socket.send(ya(t,n,r))}async function Za(e){let t=Va.get(e);return t!==void 0&&(t.ping??=ro(e,t).finally(()=>{t.ping=null}),await t.ping)}async function Qa(e,t,n){let r=t.urls[n%t.urls.length];t.url=r;let i=await $a(e,r).catch(()=>void 0);if(Va.get(e)!==t)return;if(i===`unpaired`){for(let t of Ba)t.unpaired?.(e);return}if(i===void 0){eo(e,t,n);return}let a=i===null?``:`?${new URLSearchParams({ticket:i})}`,o=new WebSocket(`${r.replace(/^http/,`ws`)}/ws${a}`);o.binaryType=`arraybuffer`;let s=window.setTimeout(()=>o.close(),Ia);o.onopen=()=>{window.clearTimeout(s),t.connected=!0,t.failures=0;for(let t of Ba)t.open?.(e,r)},o.onmessage=n=>io(e,t,n.data),o.onclose=()=>{window.clearTimeout(s),t.connected?(no(e,t),to(e,t,0)):eo(e,t,n)},t.socket=o}async function $a(e,t){let n=await ka(e),r=await fetch(`${t}/api/ticket`,{method:`POST`,headers:n===void 0?{}:{authorization:`Bearer ${n}`},signal:AbortSignal.timeout(Ia)});if(r.status===401)return`unpaired`;if(!r.ok)throw Error(await r.text());return(await r.json()).ticket}function eo(e,t,n){if((n+1)%t.urls.length!==0)Qa(e,t,n+1);else{for(let t of Ba)t.close?.(e);to(e,t,n+1)}}function to(e,t,n){let r=Math.min(Na,Ma*2**t.failures)*(.8+Math.random()*.4);t.failures+=1,t.timer=window.setTimeout(()=>{t.timer=void 0,Qa(e,t,n)},r)}function no(e,t){for(let e of t.pending.values())e.reject(Error(`Disconnected from ${new URL(t.url).host}`));t.pending.clear(),t.connected=!1;for(let t of Ba)t.close?.(e)}async function ro(e,t){let n=t.socket;if(n===null||!t.connected)return!1;let r=await Promise.race([I(e,`ping`,void 0).then(()=>!0,()=>!1),new Promise(e=>window.setTimeout(()=>e(!1),Fa))]);return r||t.socket!==n?r:(n.onclose=null,n.close(),no(e,t),Va.get(e)===t&&to(e,t,0),!1)}function io(e,t,n){if(n instanceof ArrayBuffer){let t=ba(new Uint8Array(n));for(let n of Ba)n.frame?.(e,t);return}let r=JSON.parse(String(n));if(r.type===`reply`)ao(t,r);else if(r.type===`terminal`)for(let t of Ba)t.terminal?.(e,r.event);else for(let t of Ba)t.event?.(e,r)}function ao(e,t){let n=e.pending.get(t.id);n!==void 0&&(e.pending.delete(t.id),`error`in t?n.reject(Error(t.error)):n.resolve(t.result))}function oo(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function so(e,t){let n=0;for(let r=0;r<e.length;r++)n+=t(e[r],r);return n}function co(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:Object.prototype.toString.call(e)===`[object Object]`}function lo(e,t){let n={...e};for(let e=0;e<t.length;e++){let r=t[e];delete n[r]}return n}function uo(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function fo(e,t,n){return po(e,t,void 0,void 0,void 0,void 0,n)}function po(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return mo(e,t,a,o)}return mo(e,t,a,o)}function mo(e,t,n,r){if(Object.is(e,t))return!0;let i=M(e),a=M(t);if(i===`[object Arguments]`&&(i=xe),a===`[object Arguments]`&&(a=xe),i!==a)return!1;switch(i){case Ce:return e.toString()===t.toString();case re:return uo(e.valueOf(),t.valueOf());case ge:case oe:case te:return Object.is(e.valueOf(),t.valueOf());case we:return e.source===t.source&&e.flags===t.flags;case ce:return e===t}n??=new Map;let o=n.get(e),s=n.get(t);if(o!=null&&s!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(i){case le:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!po(a,t.get(i),i,e,t,n,r))return!1;return!0;case ae:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;o<i.length;o++){let s=i[o],c=a.findIndex(i=>po(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case ve:case ne:case N:case j:case Se:case ie:case ue:case _e:case me:case de:case be:case se:if(fe(e)!==fe(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!po(e[i],t[i],i,e,t,n,r))return!1;return!0;case he:return e.byteLength===t.byteLength&&mo(new Uint8Array(e),new Uint8Array(t),n,r);case ye:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:mo(new Uint8Array(e),new Uint8Array(t),n,r);case pe:return e.name===t.name&&e.message===t.message;case xe:{if(!(mo(e.constructor,t.constructor,n,r)||co(e)&&co(t)))return!1;let i=[...Object.keys(e),...ee(e)],a=[...Object.keys(t),...ee(t)];if(i.length!==a.length)return!1;for(let a=0;a<i.length;a++){let o=i[a],s=e[o];if(!Object.hasOwn(t,o))return!1;let c=t[o];if(!po(s,c,o,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function ho(e,t){return fo(e,t,A)}var go=new Set,_o=null,vo=null;function yo(e){vo!==null&&clearTimeout(vo),_o=e,vo=window.setTimeout(()=>{vo=null,_o=null;for(let e of go)e()},3e3);for(let e of go)e()}function bo(e){return go.add(e),()=>{go.delete(e)}}function xo(){let e=(0,P.useSyncExternalStore)(bo,()=>_o);return e===null?null:(0,F.jsx)(`div`,{className:`bg-popover text-popover-foreground rounded-md border px-3 py-2 shadow-md`,children:e})}var So=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Co=(e=>e?So(e):So),wo=e=>e;function To(e,t=wo){let n=P.useSyncExternalStore(e.subscribe,P.useCallback(()=>t(e.getState()),[e,t]),P.useCallback(()=>t(e.getInitialState()),[e,t]));return P.useDebugValue(n),n}var Eo=e=>{let t=Co(e),n=e=>To(t,e);return Object.assign(n,t),n},Do=(e=>e?Eo(e):Eo);function Oo(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var ko=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return ko(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return ko(t)(e)}}}},Ao=(e,t)=>(n,r,i)=>{let a={storage:Oo(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>(f(e,t),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return ko(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p},jo=`composerDrafts`,Mo={text:``,images:[],files:[],settings:null},No=Sa(`offsite-drafts`,`drafts`),Po=Sa(`offsite-draft-files`,`files`),Fo=oo(e=>void Ea(jo,e,No),300),Io=Do()(Ao(()=>({drafts:{}}),{name:jo,storage:{getItem:async e=>await Ta(e,No)??null,setItem:(e,t)=>Fo(t),removeItem:e=>Da(e,No)},skipHydration:!0,version:1,migrate:()=>({drafts:{}})}));window.addEventListener(`pagehide`,Fo.flush);function Lo(){return Io.persist.rehydrate()}function Ro(e){return Io(t=>t.drafts[e]??Mo)}function zo(e,t){let n=Uo(e),r=t(n);for(let e of n.files)r.files.some(t=>t.id===e.id)||Da(e.id,Po);Io.setState(t=>{let n={...t.drafts,[e]:r};return r.text===``&&r.images.length===0&&r.files.length===0&&r.settings===null&&delete n[e],{drafts:n}})}async function Bo(e){let t=crypto.randomUUID();return await Ea(t,e,Po),t}async function Vo(e){return await Ta(e,Po)}function Ho(e){zo(e,()=>Mo)}function Uo(e){return Io.getState().drafts[e]??Mo}function Wo(e){return Io.getState().drafts[e]?.settings??null}function Go(e,t){zo(e,e=>({...e,settings:t}))}function Ko(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function qo(e,t=`|`){return e.map(e=>ps(e)).join(t)}function Jo(e,t){return typeof t==`bigint`?t.toString():t}var Yo=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Xo(e){return new Yo(e)}function Zo(e){return e==null}function Qo(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function $o(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function es(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ts(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function ns(e){return ts(e._zod.def)??e._zod.def.shape}function rs(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return es(this,t,e),e},enumerable:!0,configurable:!0})}function is(e,t,n){t in e?es(e,t,n):e[t]=n}function as(e,t,n,r){let i=ns(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?rs(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):is(e,a,r?r(n.value,a):n.value))}}function Oee(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?rs(e,n,()=>t[n]):is(e,n,r.value))}}function os(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function kee(e){return JSON.stringify(e)}function Aee(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ss=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function cs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var jee=Xo(()=>{if(Bs.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ls(e){if(cs(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return cs(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function us(e){return ls(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Mee=new Set([`string`,`number`,`symbol`]);function ds(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fs(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ps(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Nee(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var ms={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Pee={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Fee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return as(i,e,hs(e,t)),fs(e,os(n,{shape:i,checks:[]}))}function hs(e,t){let n=ns(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Iee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(hs(e,t)),a={};return as(a,e,Reflect.ownKeys(ns(e)).filter(e=>!i.has(e))),fs(e,os(n,{shape:a,checks:[]}))}function Lee(e,t){if(!ls(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=ns(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return fs(e,os(e._zod.def,{shape:gs(e,t)}))}function gs(e,t){let n={};return as(n,e,Reflect.ownKeys(ns(e))),Oee(n,t),n}function Ree(e,t){if(!ls(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return fs(e,os(e._zod.def,{shape:gs(e,t)}))}function zee(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return as(n,e,Reflect.ownKeys(ns(e))),as(n,t,Reflect.ownKeys(ns(t))),fs(e,os(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function _s(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(hs(t,n)):void 0,o={};return as(o,t,Reflect.ownKeys(ns(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),fs(t,os(t._zod.def,{shape:o,checks:[]}))}function Bee(e,t,n){let r=n?new Set(hs(t,n)):void 0,i={};return as(i,t,Reflect.ownKeys(ns(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),fs(t,os(t._zod.def,{shape:i}))}function vs(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Vee(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ys(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function bs(e){return typeof e==`string`?e:e?.message}function xs(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Ss(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Cs(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:bs(e.inst?._zod.def?.error?.(e))??bs(a?.(e))??bs(t?.error?.(e))??bs(n.customError?.(e))??bs(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Hee=/[\uD800-\uDBFF]/;function ws(e){let t=e.length;if(!Hee.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ts(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Uee(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Es(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Wee(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Gee(e,n,r.value)}}function Ds(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Os(e,t,n){return Ds(e,t,n,!1)}function ks(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ds(this,n,r(this))},set(e){Ds(this,n,e)}})}return t}function Gee(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ds(this,t,n.bind(this))},set(e){Ds(this,t,e)}})}function Kee(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var As,js=!1,qee={configurable:!0,get(){js=!0}};function Ms(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&As!==e._zod?As=void 0:(As=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,qee);let e=js;js=!1;try{let r=n(this);return js?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),js||=e,r}catch(n){throw delete this[t],js||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Jee(e,t,n,r){let i=Kee(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Yee=`~constantCatch`;function Ns(e){let t=()=>e;return t[Yee]=!0,t}var Ps,Fs={value:void 0,enumerable:!1},Is=`captureStackTrace`in Error?Error:null;function Ls(e){let t=Is;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Is=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function R(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Fs.value=new a(r);try{Object.defineProperty(n,"_zod",Fs)}finally{Fs.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Wee(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ls(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Rs=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},zs=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ps=globalThis).__zod_globalConfig??(Ps.__zod_globalConfig={});var Bs=globalThis.__zod_globalConfig;function Vs(e){return e&&Object.assign(Bs,e),Bs}function Hs(){let e=this._zod;return e.message??=JSON.stringify(e.def,Jo,2),e.message}function Us(e){this._zod.message=e}var Ws={get:Hs,set:Us,enumerable:!0,configurable:!0},Gs={value:void 0,enumerable:!1},Ks=new WeakSet([Object.prototype,Error.prototype]),qs=(e,t)=>{e.name=`$ZodError`,Gs.value=t,Object.defineProperty(e,"issues",Gs),Gs.value=void 0,Object.defineProperty(e,"message",Ws);let n=Object.getPrototypeOf(e);Ks.has(n)||(Ks.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Js=R(`$ZodError`,qs);R(`$ZodError`,qs,void 0,{Parent:Error});function Ys(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Xs(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Ys(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Zs(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Qs(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function $s(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${Qs(e.path)}`);return t.join(`
4
- `)}function ec(e,t){return{callee:t?.callee??e,Err:t?.Err}}var tc=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Rs;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Cs(e,o,Vs())));throw ss(n,a?.callee??t),n}return s.value};return t},nc=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Cs(e,o,Vs())));throw ss(n,a?.callee??t),n}return s.value};return t},rc=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Rs;return a.issues.length?ic(e,a.issues,i):{success:!0,data:a.value}};function ic(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Cs(e,n,Vs()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var ac=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?ic(e,a.issues,i):{success:!0,data:a.value}},oc=Symbol.for(`zod.compile.invalid`),sc=Symbol.for(`zod.compile.fallback`),cc=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==oc)return!0;if(r.definite===!0&&n===void 0)return!1}return lc(e,t,n)});function lc(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[sc]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Rs;return a.issues.length===0}var uc=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},dc=e=>{let t=tc(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ec(n,a))};return n},fc=e=>{let t=tc(e),n=(e,r,i,a)=>t(e,r,i,ec(n,a));return n},pc=e=>{let t=nc(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ec(n,a))};return n},mc=e=>{let t=nc(e),n=async(e,r,i,a)=>await t(e,r,i,ec(n,a));return n},hc=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return rc(e)(t,n,i)},gc=e=>(t,n,r)=>rc(e)(t,n,r),_c=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ac(e)(t,n,i)},vc=e=>async(t,n,r)=>ac(e)(t,n,r),yc=/^[cC][0-9a-z]{6,}$/,bc=/^[0-9a-z]+$/,xc=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Sc=/^[0-9a-vA-V]{20}$/,Cc=/^[A-Za-z0-9]{27}$/,wc=/^[a-zA-Z0-9_-]{21}$/;function Tc(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ec=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Dc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Oc=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,kc=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ac=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function jc(){return new RegExp(Ac,`u`)}var Mc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Pc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Fc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ic=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Lc=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Rc=/^https?$/,zc=/^\+[1-9]\d{6,14}$/,Bc=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Vc(e){return RegExp(`^${e}$`)}var Hc=Vc(Bc);function Uc(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Wc(e){return RegExp(`^${Uc(e)}$`)}function Gc(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Uc({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Uc({precision:e.precision})}`:n;return RegExp(`^${Bc}T(?:${r})$`)}var Kc=/^[\s\S]{0,}$/,qc=/^-?\d+(?:\.\d+)?$/,Jc=/^(?:true|false)$/i,Yc=/^[^A-Z]*$/,Xc=/^[^a-z]*$/,Zc=R(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Qc=e=>{let t=e.value;return!Zo(t)&&t.length!==void 0},$c={number:`number`,bigint:`bigint`,object:`date`},el=R(`$ZodCheckLessThan`,(e,t)=>{Zc.init(e,t);let n=$c[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:$c[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tl=R(`$ZodCheckGreaterThan`,(e,t)=>{Zc.init(e,t);let n=$c[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:$c[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nl=R(`$ZodCheckMultipleOf`,(e,t)=>{Zc.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):$o(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),rl=R(`$ZodCheckNumberFormat`,(e,t)=>{Zc.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ms[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),il=R(`$ZodCheckMaxLength`,(e,t)=>{var n;Zc.init(e,t),(n=e._zod.def).when??(n.when=Qc),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?ws(r):i)<=t.maximum)return;let a=Ts(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),al=R(`$ZodCheckMinLength`,(e,t)=>{var n;Zc.init(e,t),(n=e._zod.def).when??(n.when=Qc),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?ws(r):i)>=t.minimum)return;let a=Ts(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ol=R(`$ZodCheckLengthEquals`,(e,t)=>{var n;Zc.init(e,t),(n=e._zod.def).when??(n.when=Qc),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?ws(r):i;if(a===t.length)return;let o=Ts(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),sl=R(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Zc.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),cl=R(`$ZodCheckRegex`,(e,t)=>{sl.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ll=R(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Yc,sl.init(e,t)}),ul=R(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Xc,sl.init(e,t)}),dl=R(`$ZodCheckIncludes`,(e,t)=>{Zc.init(e,t);let n=ds(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),fl=R(`$ZodCheckStartsWith`,(e,t)=>{Zc.init(e,t);let n=RegExp(`^${ds(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),pl=R(`$ZodCheckEndsWith`,(e,t)=>{Zc.init(e,t);let n=RegExp(`.*${ds(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ml=R(`$ZodCheckOverwrite`,(e,t)=>{Zc.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),hl=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
5
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
6
- `)}\n};`)(...Object.values(this.closed))}},gl={major:4,minor:6,patch:7},_l=R(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gl;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=vs(t),a;for(let o of n){if(o._zod.def.when){if(Vee(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Rs;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ss(t.issues,n,e),i||=vs(t,n))});else{if(t.issues.length===n)continue;Ss(t.issues,n,e),i||=vs(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(vs(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Rs;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Rs;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Os(this,`~standard`,bl(this))},set"~standard"(e){Ds(this,`~standard`,e)}}),vl=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Cs(e,t,Vs()))}:{value:e.value};async function yl(e,t){let n={async:!0};return vl(await e._zod.run({value:t,issues:[]},n),n)}function bl(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return vl(r,n)}catch{}return yl(e,t)},vendor:`zod`,version:1}}var xl=R(`$ZodString`,(e,t)=>{_l.init(e,t),e._zod.pattern=t.pattern??Kc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Sl=R(`$ZodStringFormat`,(e,t)=>{sl.init(e,t),xl.init(e,t)}),Cl=R(`$ZodGUID`,(e,t)=>{t.pattern??=Dc,Sl.init(e,t)}),wl=R(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Oc(e)}else t.pattern??=Oc();Sl.init(e,t)}),Tl=R(`$ZodEmail`,(e,t)=>{t.pattern??=kc,Sl.init(e,t)});function El(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Dl(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?El(e)||2:Ol(e,t)}function Ol(e,t){if(!t.normalize&&t.protocol?.source===Rc.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var kl=/[\t\n\r]/g;function Al(e){return e.replace(kl,``)}function jl(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ml(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Nl=R(`$ZodURL`,(e,t)=>{Sl.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Dl(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Al(r);return}t.hostname&&!jl(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Ml(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Al(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Pl=R(`$ZodEmoji`,(e,t)=>{t.pattern??=jc(),Sl.init(e,t)}),Fl=R(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?wc:Tc(t.length),Sl.init(e,t)}),Il=R(`$ZodCUID`,(e,t)=>{t.pattern??=yc,Sl.init(e,t)}),Ll=R(`$ZodCUID2`,(e,t)=>{t.pattern??=bc,Sl.init(e,t)}),Rl=R(`$ZodULID`,(e,t)=>{t.pattern??=xc,Sl.init(e,t)}),zl=R(`$ZodXID`,(e,t)=>{t.pattern??=Sc,Sl.init(e,t)}),Bl=R(`$ZodKSUID`,(e,t)=>{t.pattern??=Cc,Sl.init(e,t)}),Vl=R(`$ZodISODateTime`,(e,t)=>{t.pattern??=Gc(t),Sl.init(e,t)}),Hl=R(`$ZodISODate`,(e,t)=>{t.pattern??=Hc,Sl.init(e,t)}),Ul=R(`$ZodISOTime`,(e,t)=>{t.pattern??=Wc(t),Sl.init(e,t)}),Wl=R(`$ZodISODuration`,(e,t)=>{t.pattern??=Ec,Sl.init(e,t)}),Gl=R(`$ZodIPv4`,(e,t)=>{t.pattern??=Mc,Sl.init(e,t)}),Kl=/^[0-9a-fA-F:.]+$/;function ql(e){return Kl.test(e)?El(`http://[${e}]`):!1}var Jl=R(`$ZodIPv6`,(e,t)=>{t.pattern??=Nc,Sl.init(e,t),e._zod.check=n=>{ql(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Yl=R(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Pc,Sl.init(e,t)});function Xl(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:ql(n)}var Zl=R(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Fc,Sl.init(e,t),e._zod.check=n=>{Xl(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Ql(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var $l=/^[0-9a-zA-Z+/]*={0,2}$/,eu=R(`$ZodBase64`,(e,t)=>{t.pattern??=$l,Sl.init(e,t),e._zod.check=n=>{Ql(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),tu=/^[A-Za-z0-9_-]*$/;function nu(e){if(!tu.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ql(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var ru=R(`$ZodBase64URL`,(e,t)=>{t.pattern??=tu,Sl.init(e,t),e._zod.check=n=>{nu(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),iu=R(`$ZodE164`,(e,t)=>{t.pattern??=zc,Sl.init(e,t)});function au(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ou=R(`$ZodJWT`,(e,t)=>{Sl.init(e,t),e._zod.check=n=>{au(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),su=R(`$ZodNumber`,(e,t)=>{_l.init(e,t),e._zod.pattern=qc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),cu=R(`$ZodNumberFormat`,(e,t)=>{rl.init(e,t),su.init(e,t)}),lu=R(`$ZodBoolean`,(e,t)=>{_l.init(e,t),e._zod.pattern=Jc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),uu=R(`$ZodUnknown`,(e,t)=>{_l.init(e,t),e._zod.parse=e=>e}),du=R(`$ZodNever`,(e,t)=>{_l.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function fu(e,t){let n=xs(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of xs(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Ss(n.issues,t,e),n}}return i(n,a)}}var pu=e=>Array.isArray(e)?e.length:-1;function mu(e,t,n){e.issues.length&&t.issues.push(...ys(n,e.issues)),t.value[n]=e.value}var hu=R(`$ZodArray`,(e,t)=>{_l.init(e,t);let n=Bs.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>mu(t,r,e)));else if(mu(c,r,e),s&&c.issues.length!==0&&vs(c))break}return o.length?Promise.all(o).then(()=>r):r},fu(e,pu)});function gu(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ys(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var _u=[];function vu(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:_u,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Nee(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function yu(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(vs(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>gu(e,n,i,t,d,f))):gu(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var bu=R(`$ZodObject`,(e,t)=>{_l.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Xo(()=>vu(t));Ms(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||es(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=cs,o=t.catchall,s,c=Bs.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(vs(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>gu(n,t,e,r,a,o))):gu(s,t,e,r,a,o)}return o?yu(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),xu=R(`$ZodObjectJIT`,(e,t)=>{bu.init(e,t);let n=e._zod.parse,r=Xo(()=>vu(t)),i=Bs.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new hl([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
7
- let ${e}_ab = false;
8
- for (let i = 0; i < ${e}.issues.length; i++) {
9
- const iss = ${e}.issues[i];
10
- iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
11
- payload.issues.push(iss);
12
- if (iss.continue !== true) ${e}_ab = true;
13
- }
14
- if (${e}_ab && ctx && ctx.abortEarly) {
15
- payload.value = newResult;
16
- return payload;
17
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:kee(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
18
- const ${n}_present = ${i};
19
- if (!${n}.issues.length || ${n}_present) {
20
- if (${n}.issues.length) {${c(n,r)}
21
- }
22
-
23
- if (${e}) {
24
- newResult[${r}] = ${n}.value;
25
- }
26
- }
27
-
28
- `)}else f?(o.write(`
29
- if (${n}.issues.length) {${c(n,r)}
30
- }
31
- `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
32
- if (${n}.value !== undefined || ${i}) {
33
- newResult[${r}] = ${n}.value;
34
- }
35
- `)):o.write(`
36
- const ${n}_present = ${i};
37
- if (${n}.issues.length) {${c(n,r)}
38
- }
39
- if (!${n}_present && !${n}.issues.length) {
40
- payload.issues.push({
41
- code: "invalid_type",
42
- expected: "nonoptional",
43
- input: undefined,
44
- path: [${r}]
45
- });
46
- if (ctx && ctx.abortEarly) {
47
- payload.value = newResult;
48
- return payload;
49
- }
50
- }
51
-
52
- if (${n}_present) {
53
- newResult[${r}] = ${n}.value;
54
- }
55
-
56
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=cs,c=!Bs.jitless,l=c&&jee.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?yu([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Su(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!vs(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Cs(e,r,Vs())))}),t)}var Cu=R(`$ZodUnion`,(e,t)=>{_l.init(e,t),Ms(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),Ms(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Ms(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),Ms(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Qo(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Su(t,r,e,i)):Su(o,r,e,i)}});function wu(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Tu=R(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Cu.init(e,t);let n=e._zod.parse;Ms(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||es(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=ts(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Xo(()=>wu(t));e._zod.parse=(i,a)=>{let o=i.value;if(!cs(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Eu=R(`$ZodIntersection`,(e,t)=>{_l.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ou(e,t,n)):Ou(e,i,a)}});function Du(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ls(e)&&ls(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Du(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Du(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ou(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Du(t.value,n.value);if(!c.valid){if(vs(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ku=R(`$ZodEnum`,(e,t)=>{_l.init(e,t);let n=Ko(t.entries),r=new Set(n);e._zod.values=r,Ms(e,`pattern`,e=>{let t=Ko(e.def.entries).filter(e=>Mee.has(typeof e));return RegExp(t.length?`^(${t.map(e=>ds(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Au=R(`$ZodLiteral`,(e,t)=>{_l.init(e,t);let n=new Set(t.values);e._zod.values=n,Ms(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?ds(e):e?ds(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),ju=R(`$ZodTransform`,(e,t)=>{_l.init(e,t),e._zod.optin=`optional`,Bs.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new zs(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Rs;return n.value=i,n}});function Mu(e,t){return e.value=t.issues.length?void 0:t.value,e}var Nu=R(`$ZodOptional`,(e,t)=>{_l.init(e,t),Ms(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,Ms(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),Ms(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Qo(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Mu(e,t)):Mu(e,r)}return t.innerType._zod.run(e,n)}}),Pu=R(`$ZodExactOptional`,(e,t)=>{Nu.init(e,t),Ms(e,`values`,e=>e.def.innerType._zod.values),Ms(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Fu=R(`$ZodNullable`,(e,t)=>{_l.init(e,t),Ms(e,`optin`,e=>e.def.innerType._zod.optin),Ms(e,`optout`,e=>e.def.innerType._zod.optout),Ms(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Qo(t.source)}|null)$`):void 0}),Ms(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Iu=R(`$ZodDefault`,(e,t)=>{_l.init(e,t),e._zod.optin=`defaulted`,Ms(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Lu(e,t)):Lu(r,t)}});function Lu(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ru=R(`$ZodPrefault`,(e,t)=>{_l.init(e,t),e._zod.optin=`defaulted`,Ms(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),zu=R(`$ZodNonOptional`,(e,t)=>{_l.init(e,t),Ms(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Bu(t,e)):Bu(i,e)}});function Bu(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Vu(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Cs(e,r,Vs()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Hu=R(`$ZodCatch`,(e,t)=>{_l.init(e,t),Ms(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),Ms(e,`optout`,e=>e.def.innerType._zod.optout),Ms(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Vu(e,r,t,n)):Vu(e,r,t,n)}}),Uu=R(`$ZodPipe`,(e,t)=>{_l.init(e,t),Ms(e,`values`,e=>e.def.in._zod.values),Ms(e,`optin`,e=>e.def.in._zod.optin),Ms(e,`optout`,e=>e.def.out._zod.optout),Ms(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Wu(e,t.in,n)):Wu(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Wu(e,t.out,n)):Wu(r,t.out,n)}});function Wu(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Gu=R(`$ZodReadonly`,(e,t)=>{_l.init(e,t),Ms(e,`propValues`,e=>e.def.innerType._zod.propValues),Ms(e,`values`,e=>e.def.innerType._zod.values),Ms(e,`optin`,e=>e.def.innerType?._zod?.optin),Ms(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ku):Ku(r)}});function Ku(e){return e.memo||(e.value=Object.freeze(e.value)),e}var qu=R(`$ZodCustom`,(e,t)=>{Zc.init(e,t),_l.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ju(t,n,r,e));Ju(i,n,r,e)}});function Ju(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Es(e))}}var Yu=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Xu=`~memo`,Zu=[];function Qu(e){return typeof e==`object`&&!!e}function $u(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var ed=new WeakMap,td=0,nd=1,rd=2;function id(e,t,n){let r=ed.get(e);if(r!==void 0)return r?rd:td;if(t.has(e))return rd;t.add(e);let i=td,a=e=>{if(i!==rd&&e?._zod){let r=id(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=td;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?nd:o.value?._zod?id(o.value,t,n):td;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ts(c);s(e?o(e,!0):nd),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?id(r,t,!1):nd);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),ad(e,i)}function ad(e,t){return t!==nd&&ed.set(e,t===rd),t}function od(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var sd,cd=[],ld={alloc(e,t,n){let r=sd;if(!r)return n;sd=void 0;let i={value:n,issues:null};return r.set(t.value,i),cd.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&dd(n,e.value))throw new Yu;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=id(e,new Set,!1);if(i===td)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===rd||r?n=!0:r=!0}let l=s.value;if(!Qu(l))return t(s,c);let u=c[Xu];u||(u={buckets:new WeakMap,backEdges:void 0},c[Xu]=u);let d;i===c?d=a:(d=od(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...$u(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;sd=d;let p=cd.length,m=t(s,c);sd=void 0;let h=cd.length>p?cd.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?$u(e.issues):Zu),e)):(h&&(h.issues=m.issues.length?$u(m.issues):Zu),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function ud(){return ld}function dd(e,t){let n=e[Xu]?.backEdges;return n!==void 0&&Qu(t)&&n.has(t)}var fd=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Uee(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ps(e.values[0])}`:`Invalid option: expected one of ${qo(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${qo(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function pd(){return{localeError:fd()}}var md,hd=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function gd(){return new hd}(md=globalThis).__zod_globalRegistry??(md.__zod_globalRegistry=gd());var _d=globalThis.__zod_globalRegistry;function vd(e){return e.checks&&=[...e.checks],e}function yd(e,t){return new e(vd({type:`string`,...L(t)}))}function bd(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...L(t)})}function xd(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...L(t)})}function Sd(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...L(t)})}function Cd(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...L(t)})}function wd(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...L(t)})}function Td(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...L(t)})}function Ed(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...L(t)})}function Dd(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...L(t)})}function Od(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...L(t)})}function kd(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...L(t)})}function Ad(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...L(t)})}function jd(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...L(t)})}function Md(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...L(t)})}function Nd(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...L(t)})}function Pd(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...L(t)})}function Fd(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...L(t)})}function Id(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...L(t)})}function Ld(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...L(t)})}function Rd(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...L(t)})}function zd(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...L(t)})}function Bd(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...L(t)})}function Vd(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...L(t)})}function Hd(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...L(t)})}function Ud(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...L(t)})}function Wd(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...L(t)})}function Gd(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...L(t)})}function Kd(e,t){return new e(vd({type:`number`,checks:[],...L(t)}))}function qd(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...L(t)})}function Jd(e,t){return new e({type:`boolean`,...L(t)})}function Yd(e){return new e({type:`unknown`})}function Xd(e,t){return new e({type:`never`,...L(t)})}function Zd(e,t){return new el({check:`less_than`,...L(t),value:e,inclusive:!1})}function Qd(e,t){return new el({check:`less_than`,...L(t),value:e,inclusive:!0})}function $d(e,t){return new tl({check:`greater_than`,...L(t),value:e,inclusive:!1})}function ef(e,t){return new tl({check:`greater_than`,...L(t),value:e,inclusive:!0})}function tf(e,t){return new nl({check:`multiple_of`,...L(t),value:e})}function nf(e,t){return new il({check:`max_length`,...L(t),maximum:e})}function rf(e,t){return new al({check:`min_length`,...L(t),minimum:e})}function af(e,t){return new ol({check:`length_equals`,...L(t),length:e})}function of(e,t){return new cl({check:`string_format`,format:`regex`,...L(t),pattern:e})}function sf(e){return new ll({check:`string_format`,format:`lowercase`,...L(e)})}function cf(e){return new ul({check:`string_format`,format:`uppercase`,...L(e)})}function lf(e,t){return new dl({check:`string_format`,format:`includes`,...L(t),includes:e})}function uf(e,t){return new fl({check:`string_format`,format:`starts_with`,...L(t),prefix:e})}function df(e,t){return new pl({check:`string_format`,format:`ends_with`,...L(t),suffix:e})}function ff(e){return new ml({check:`overwrite`,tx:e})}function pf(e){return ff(t=>t.normalize(e))}function mf(){return ff(e=>e.trim())}function hf(){return ff(e=>e.toLowerCase())}function gf(){return ff(e=>e.toUpperCase())}function _f(){return ff(e=>Aee(e))}function vf(e,t,n){return new e({type:`array`,element:t,...L(n)})}function yf(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...L(n)})}function bf(e,t){let n=xf(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Es(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Es(r))}},e(t.value,t)),t);return n}function xf(e,t){let n=new Zc({check:`custom`,...L(t)});return n._zod.check=e,n}function Sf(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&es(e,t,n[t]);return e}function Cf(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??_d,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function wf(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Tf(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Tf(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Sf(o.schema,c),t.io===`input`&&Ff(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ef(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Df(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ef(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ef(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
57
-
58
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Of(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Of(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var kf=new Set([`type`,`properties`,`required`,`additionalProperties`]),Af=[`oneOf`,`anyOf`];function jf(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Mf(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!kf.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??jf(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}es(n,r,e.length===1?e[0]:Mf(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=jf(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Nf(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of kf)if(t in e)return;let n=t.filter(e=>Af.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Mf(t);else{let e=n[0],i=Af.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Mf([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Sf(e,r))}function Pf(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Sf(i,s),Sf(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Of(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Nf(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Sf(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,es(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Lf(t,`input`,e.processors),output:Lf(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ff(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Ff(r.element,n);if(r.type===`set`)return Ff(r.valueType,n);if(r.type===`lazy`)return Ff(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Ff(r.innerType,n);if(r.type===`intersection`)return Ff(r.left,n)||Ff(r.right,n);if(r.type===`record`||r.type===`map`)return Ff(r.keyType,n)||Ff(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ff(r.in,n)||Ff(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ff(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ff(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ff(e,n))return!0;return!!(r.rest&&Ff(r.rest,n))}return!1}var If=(e,t={})=>n=>{let r=Cf({...n,processors:t});return Tf(e,r),Df(r,e),Pf(r,e)},Lf=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Cf({...i??{},target:a,io:t,processors:n});return Tf(e,o),Df(o,e),Pf(o,e)},Rf=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},zf=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Bf=(e,t)=>{Rf(e,`minimum`,t),zf(e,`maximum`,t)},Vf=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Hf=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Uf=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Wf=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Gf=(e,t)=>Rf(e,`minimum`,t.minimum),Kf=(e,t)=>zf(e,`maximum`,t.maximum),qf=e=>(t,n)=>{Wf(t,n.format);let[r,i]=e[n.format];Rf(t,`minimum`,r),zf(t,`maximum`,i)},Jf={greater_than:(e,t)=>Rf(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>zf(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Vf(e,t.value),number_format:qf(ms),bigint_format:qf(Pee),min_length:Gf,max_length:Kf,length_equals:(e,t)=>Bf(e,t.length),min_size:Gf,max_size:Kf,size_equals:(e,t)=>Bf(e,t.size),string_format:(e,t)=>{Wf(e,t.format),t.pattern&&Hf(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Uf(e,t.mime)};function Yf(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Jf[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Rf(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Rf(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&zf(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&zf(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Vf(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Uf(t,i.mime);for(let e of i.patterns??[])Hf(t,e);return t}var Xf={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Zf=new Map([[$l,Ic],[tu,Lc]]),Qf=e=>Zf.get(e)??e,$f=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Yf(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Xf[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Qf);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ep=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Yf(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):wf(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},tp=(e,t,n,r)=>{n.type=`boolean`},np=(e,t,n,r)=>{n.not={}},rp=(e,t,n,r)=>{let i=e._zod.def,a=Ko(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},ip=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(wf(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(wf(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ap=(e,t,n,r)=>{wf(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},op=(e,t,n,r)=>{wf(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},sp=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Yf(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Tf(a.element,t,{...r,path:[...r.path,`items`]})};function cp(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?cp(t.out):t.type===`catch`?cp(t.innerType):e._zod.optin}var lp=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&wf(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)es(i.properties,e,Tf(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?cp(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Tf(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},up=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Tf(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},dp=(e,t,n,r)=>{let i=e._zod.def,a=Tf(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Tf(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},fp=(e,t,n,r)=>{let i=e._zod.def,a=Tf(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},pp=(e,t,n,r)=>{let i=e._zod.def;Tf(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},mp=Symbol();function hp(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(wf(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),mp):JSON.parse(o)}var gp=(e,t,n,r)=>{let i=e._zod.def;Tf(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=hp(i.defaultValue,e,t,n,r);o!==mp&&(n.default=o)},_p=(e,t,n,r)=>{let i=e._zod.def;Tf(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=hp(i.defaultValue,e,t,n,r);o!==mp&&(n._prefault=o)},vp=(e,t,n,r)=>{let i=e._zod.def;Tf(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{wf(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},yp=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Tf(o,t,r);let s=t.seen.get(e);s.ref=o},bp=(e,t,n,r)=>{let i=e._zod.def;Tf(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},xp=(e,t,n,r)=>{let i=e._zod.def;Tf(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Sp=new WeakSet([Object.prototype,Error.prototype]);function Cp(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var wp=R(`ZodError`,(e,t)=>{Js.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Sp.has(n)||(Sp.add(n),Cp(n,`format`,e=>t=>Zs(e,t)),Cp(n,`flatten`,e=>t=>Xs(e,t)),Cp(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Jo,2)}),Cp(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Jo,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Tp=tc(wp),Ep=nc(wp),Dp=rc(wp),Op=ac(wp),kp=dc(wp),Ap=fc(wp),jp=pc(wp),Mp=mc(wp),Np=hc(wp),Pp=gc(wp),Fp=_c(wp),Ip=vc(wp);function Lp(){Bs.localeError||Vs(pd())}function Rp(){Bs.memoizer||Vs({memoizer:ud()})}var zp=R(`ZodType`,(e,t)=>(Lp(),_l.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(os(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return fs(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Kte(e,t))},superRefine(e,t){return this.check(qte(e,t))},overwrite(e){return this.check(ff(e))},optional(){return im(this)},exactOptional(){return Nte(this)},nullable(){return om(this)},nullish(){return im(om(this))},nonoptional(e){return zte(this,e)},array(){return wte(this)},or(e){return Tte([this,e])},and(e){return kte(this,e)},transform(e){return cm(this,Mte(e))},default(e){return Ite(this,e)},prefault(e){return Rte(this,e)},catch(e){return Vte(this,e)},pipe(e){return cm(this,e)},readonly(){return Wte(this)},describe(e){let t=this.clone();return _d.add(t,{description:e}),t},meta(...e){if(e.length===0)return _d.get(this);let t=this.clone();return _d.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Os(this,`~standard`,{...bl(this),jsonSchema:{input:Lf(this,`input`),output:Lf(this,`output`)}})},set"~standard"(e){Ds(this,`~standard`,e)},parse:function e(t,n){return Tp(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ep(this,t,n,{callee:e})},safeParse(e,t){return Dp(this,e,t)},async safeParseAsync(e,t){return Op(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ds(this,`spa`,e)},validate(e,t){return cc(this,e,t)},validateAsync(e,t){return uc(this,e,t)},encode:function e(t,n){return kp(this,t,n,{callee:e})},decode:function e(t,n){return Ap(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await jp(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Mp(this,t,n,{callee:e})},safeEncode(e,t){return Np(this,e,t)},safeDecode(e,t){return Pp(this,e,t)},async safeEncodeAsync(e,t){return Fp(this,e,t)},async safeDecodeAsync(e,t){return Ip(this,e,t)},toJSONSchema(e){return If(this,{})(e)},get description(){return _d.get(this)?.description},get _def(){return this._zod.def}}),Bp=R(`_ZodString`,(e,t)=>{xl.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$f(e,t,n,r)},ks({format:e=>Yf(e).format??null,minLength:e=>Yf(e).minimum??null,maxLength:e=>Yf(e).maximum??null},{regex(...e){return this.check(of(...e))},includes(...e){return this.check(lf(...e))},startsWith(...e){return this.check(uf(...e))},endsWith(...e){return this.check(df(...e))},min(...e){return this.check(rf(...e))},max(...e){return this.check(nf(...e))},length(...e){return this.check(af(...e))},nonempty(...e){return this.check(rf(1,...e))},lowercase(e){return this.check(sf(e))},uppercase(e){return this.check(cf(e))},trim(){return this.check(mf())},normalize(...e){return this.check(pf(...e))},toLowerCase(){return this.check(hf())},toUpperCase(){return this.check(gf())},slugify(){return this.check(_f())}})),Xee=R(`ZodString`,(e,t)=>{xl.init(e,t),Bp.init(e,t)},{email(e){return this.check(bd(tte,e))},url(e){return this.check(Ed(rte,e))},jwt(e){return this.check(Vd(vte,e))},emoji(e){return this.check(Dd(ite,e))},guid(e){return this.check(xd(nte,e))},uuid(e){return this.check(Sd(Up,e))},uuidv4(e){return this.check(Cd(Up,e))},uuidv6(e){return this.check(wd(Up,e))},uuidv7(e){return this.check(Td(Up,e))},nanoid(e){return this.check(Od(ate,e))},cuid(e){return this.check(kd(ote,e))},cuid2(e){return this.check(Ad(ste,e))},ulid(e){return this.check(jd(cte,e))},base64(e){return this.check(Rd(hte,e))},base64url(e){return this.check(zd(gte,e))},xid(e){return this.check(Md(lte,e))},ksuid(e){return this.check(Nd(ute,e))},ipv4(e){return this.check(Pd(dte,e))},ipv6(e){return this.check(Fd(fte,e))},cidrv4(e){return this.check(Id(pte,e))},cidrv6(e){return this.check(Ld(mte,e))},e164(e){return this.check(Bd(_te,e))},datetime(e){return this.check(Hd(Zee,e))},date(e){return this.check(Ud(Qee,e))},time(e){return this.check(Wd($ee,e))},duration(e){return this.check(Gd(ete,e))}});function Vp(e){return yd(Xee,e)}var Hp=R(`ZodStringFormat`,(e,t)=>{Sl.init(e,t),Bp.init(e,t)}),Zee=R(`ZodISODateTime`,(e,t)=>{Vl.init(e,t),Hp.init(e,t)}),Qee=R(`ZodISODate`,(e,t)=>{Hl.init(e,t),Hp.init(e,t)}),$ee=R(`ZodISOTime`,(e,t)=>{Ul.init(e,t),Hp.init(e,t)}),ete=R(`ZodISODuration`,(e,t)=>{Wl.init(e,t),Hp.init(e,t)}),tte=R(`ZodEmail`,(e,t)=>{Tl.init(e,t),Hp.init(e,t)}),nte=R(`ZodGUID`,(e,t)=>{Cl.init(e,t),Hp.init(e,t)}),Up=R(`ZodUUID`,(e,t)=>{wl.init(e,t),Hp.init(e,t)}),rte=R(`ZodURL`,(e,t)=>{Nl.init(e,t),Hp.init(e,t)}),ite=R(`ZodEmoji`,(e,t)=>{Pl.init(e,t),Hp.init(e,t)}),ate=R(`ZodNanoID`,(e,t)=>{Fl.init(e,t),Hp.init(e,t)}),ote=R(`ZodCUID`,(e,t)=>{Il.init(e,t),Hp.init(e,t)}),ste=R(`ZodCUID2`,(e,t)=>{Ll.init(e,t),Hp.init(e,t)}),cte=R(`ZodULID`,(e,t)=>{Rl.init(e,t),Hp.init(e,t)}),lte=R(`ZodXID`,(e,t)=>{zl.init(e,t),Hp.init(e,t)}),ute=R(`ZodKSUID`,(e,t)=>{Bl.init(e,t),Hp.init(e,t)}),dte=R(`ZodIPv4`,(e,t)=>{Gl.init(e,t),Hp.init(e,t)}),fte=R(`ZodIPv6`,(e,t)=>{Jl.init(e,t),Hp.init(e,t)}),pte=R(`ZodCIDRv4`,(e,t)=>{Yl.init(e,t),Hp.init(e,t)}),mte=R(`ZodCIDRv6`,(e,t)=>{Zl.init(e,t),Hp.init(e,t)}),hte=R(`ZodBase64`,(e,t)=>{eu.init(e,t),Hp.init(e,t)}),gte=R(`ZodBase64URL`,(e,t)=>{ru.init(e,t),Hp.init(e,t)}),_te=R(`ZodE164`,(e,t)=>{iu.init(e,t),Hp.init(e,t)}),vte=R(`ZodJWT`,(e,t)=>{ou.init(e,t),Hp.init(e,t)}),Wp=R(`ZodNumber`,(e,t)=>{su.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ep(e,t,n,r),e.isFinite=!0},ks({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Yf(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Yf(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Yf(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Yf(e).format??null},{gt(e,t){return this.check($d(e,t))},gte(e,t){return this.check(ef(e,t))},min(e,t){return this.check(ef(e,t))},lt(e,t){return this.check(Zd(e,t))},lte(e,t){return this.check(Qd(e,t))},max(e,t){return this.check(Qd(e,t))},int(e){return this.check(Kp(e))},safe(e){return this.check(Kp(e))},positive(e){return this.check($d(0,e))},nonnegative(e){return this.check(ef(0,e))},negative(e){return this.check(Zd(0,e))},nonpositive(e){return this.check(Qd(0,e))},multipleOf(e,t){return this.check(tf(e,t))},step(e,t){return this.check(tf(e,t))},finite(){return this}}));function Gp(e){return Kd(Wp,e)}var yte=R(`ZodNumberFormat`,(e,t)=>{cu.init(e,t),Wp.init(e,t)});function Kp(e){return qd(yte,e)}var bte=R(`ZodBoolean`,(e,t)=>{lu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tp(e,t,n,r)});function qp(e){return Jd(bte,e)}var xte=R(`ZodUnknown`,(e,t)=>{uu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Jp(){return Yd(xte)}var Ste=R(`ZodNever`,(e,t)=>{du.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>np(e,t,n,r)});function Yp(e){return Xd(Ste,e)}var Cte=R(`ZodArray`,(e,t)=>{Rp(),hu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sp(e,t,n,r),e.element=t.element},{min(e,t){return this.check(rf(e,t))},nonempty(e){return this.check(rf(1,e))},max(e,t){return this.check(nf(e,t))},length(e,t){return this.check(af(e,t))},unwrap(){return this.element}});function wte(e,t){return vf(Cte,e,t)}var Xp=R(`ZodObject`,(e,t)=>{Rp(),xu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lp(e,t,n,r),Jee(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return tm(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(os(this._zod.def,{catchall:e}))},passthrough(){return this.clone(os(this._zod.def,{catchall:Jp()}))},loose(){return this.clone(os(this._zod.def,{catchall:Jp()}))},strict(){return this.clone(os(this._zod.def,{catchall:Yp()}))},strip(){return this.clone(os(this._zod.def,{catchall:void 0}))},extend(e){return Lee(this,e)},safeExtend(e){return Ree(this,e)},merge(e){return zee(this,e)},pick(e){return Fee(this,e)},omit(e){return Iee(this,e)},partial(...e){return _s(rm,this,e[0])},exactPartial(...e){return _s(am,this,e[0],`exactPartial`)},required(...e){return Bee(sm,this,e[0])}});function Zp(e,t){return new Xp({type:`object`,shape:e??{},...L(t)})}function Qp(e,t){return new Xp({type:`object`,shape:e,catchall:Yp(),...L(t)})}var $p=R(`ZodUnion`,(e,t)=>{Cu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>up(e,t,n,r),e.options=t.options});function Tte(e,t){return new $p({type:`union`,options:e,...L(t)})}var Ete=R(`ZodDiscriminatedUnion`,(e,t)=>{$p.init(e,t),Tu.init(e,t)});function Dte(e,t,n){return new Ete({type:`union`,options:t,discriminator:e,...L(n)})}var Ote=R(`ZodIntersection`,(e,t)=>{Eu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dp(e,t,n,r)});function kte(e,t){return new Ote({type:`intersection`,left:e,right:t})}var em=R(`ZodEnum`,(e,t)=>{ku.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rp(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new em({...t,checks:[],...L(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new em({...t,checks:[],...L(r),entries:i})}});function tm(e,t){return new em({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}var Ate=R(`ZodLiteral`,(e,t)=>{Au.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ip(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function nm(e,t){return new Ate({type:`literal`,values:Array.isArray(e)?e:[e],...L(t)})}var jte=R(`ZodTransform`,(e,t)=>{Rp(),ju.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>op(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new zs(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Es(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Es(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Mte(e){return new jte({type:`transform`,transform:e})}var rm=R(`ZodOptional`,(e,t)=>{Nu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function im(e){return new rm({type:`optional`,innerType:e})}var am=R(`ZodExactOptional`,(e,t)=>{Pu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nte(e){return new am({type:`optional`,innerType:e})}var Pte=R(`ZodNullable`,(e,t)=>{Fu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function om(e){return new Pte({type:`nullable`,innerType:e})}var Fte=R(`ZodDefault`,(e,t)=>{Iu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ite(e,t){return new Fte({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():us(t)}})}var Lte=R(`ZodPrefault`,(e,t)=>{Ru.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_p(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rte(e,t){return new Lte({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():us(t)}})}var sm=R(`ZodNonOptional`,(e,t)=>{zu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zte(e,t){return new sm({type:`nonoptional`,innerType:e,...L(t)})}var Bte=R(`ZodCatch`,(e,t)=>{Hu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vte(e,t){return new Bte({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Ns(t)})}var Hte=R(`ZodPipe`,(e,t)=>{Uu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yp(e,t,n,r),e.in=t.in,e.out=t.out});function cm(e,t){return new Hte({type:`pipe`,in:e,out:t})}var Ute=R(`ZodReadonly`,(e,t)=>{Gu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wte(e){return new Ute({type:`readonly`,innerType:e})}var Gte=R(`ZodCustom`,(e,t)=>{qu.init(e,t),zp.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ap(e,t,n,r)});function Kte(e,t={}){return yf(Gte,e,t)}function qte(e,t){return bf(e,t)}var lm=[[`path`,{d:`M12.001 5.00003V19.002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19.002 12.002L4.99998 12.002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],um=[[`path`,{d:`M9.40379 4.40379C10.2222 4.14157 11.0946 4 12 4C16.6944 4 20.5 7.80558 20.5 12.5C20.5 13.4054 20.3584 14.2778 20.0962 15.0962M6.24476 6.24476C4.5573 7.79814 3.5 10.0256 3.5 12.5C3.5 17.1944 7.30558 21 12 21C14.4744 21 16.7019 19.9427 18.2552 18.2552`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.88 18.7031L3.5 21.0031`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2 2L22 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M4 4L2 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M22 6L19 3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],dm=[[`path`,{d:`M20.5 12.5C20.5 17.1944 16.6944 21 12 21C7.30558 21 3.5 17.1944 3.5 12.5C3.5 7.80558 7.30558 4 12 4C16.6944 4 20.5 7.80558 20.5 12.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.88 18.7031L3.5 21.0031`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M18.14 18.668L20.5 20.998`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M5 3L2 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M22 6L19 3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M12 8V12.5L14 14.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],fm=[[`path`,{d:`M13.9248 21H10.0752C5.44476 21 3.12955 21 2.27636 19.4939C1.42317 17.9879 2.60736 15.9914 4.97574 11.9985L6.90057 8.75333C9.17559 4.91778 10.3131 3 12 3C13.6869 3 14.8244 4.91777 17.0994 8.75332L19.0243 11.9985C21.3926 15.9914 22.5768 17.9879 21.7236 19.4939C20.8704 21 18.5552 21 13.9248 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 9V13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],pm=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 8V12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 15.75H12M12.25 15.75C12.25 15.8881 12.1381 16 12 16C11.8619 16 11.75 15.8881 11.75 15.75C11.75 15.6119 11.8619 15.5 12 15.5C12.1381 15.5 12.25 15.6119 12.25 15.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],mm=[[`path`,{d:`M5.92089 5.92089C8.15836 3.68342 9.2771 2.56468 10.5857 2.19562C11.5105 1.93479 12.4895 1.93479 13.4143 2.19562C14.7229 2.56468 15.8416 3.68342 18.0791 5.92089C20.3166 8.15836 21.4353 9.2771 21.8044 10.5857C22.0652 11.5105 22.0652 12.4895 21.8044 13.4143C21.4353 14.7229 20.3166 15.8416 18.0791 18.0791C15.8416 20.3166 14.7229 21.4353 13.4143 21.8044C12.4895 22.0652 11.5105 22.0652 10.5857 21.8044C9.2771 21.4353 8.15836 20.3166 5.92089 18.0791C3.68342 15.8416 2.56468 14.7229 2.19562 13.4143C1.93479 12.4895 1.93479 11.5105 2.19562 10.5857C2.56468 9.2771 3.68342 8.15836 5.92089 5.92089Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 8V12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 15.75H12M12.25 15.75C12.25 15.8881 12.1381 16 12 16C11.8619 16 11.75 15.8881 11.75 15.75C11.75 15.6119 11.8619 15.5 12 15.5C12.1381 15.5 12.25 15.6119 12.25 15.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],hm=[[`path`,{d:`M15 19L15 6.65856C15 5.65277 15 5.14987 15.3087 5.02472C15.6173 4.89956 15.9806 5.25517 16.7071 5.96637L19 8.21091`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9 5L9 17.3414C9 18.3472 9 18.8501 8.69134 18.9753C8.38268 19.1004 8.01942 18.7448 7.29289 18.0336L5 15.7891`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],gm=[[`path`,{d:`M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],_m=[[`path`,{d:`M12 18.502V5.00195`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 13.002C18 13.002 13.5811 19.0019 12 19.002C10.4188 19.002 6 13.002 6 13.002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],vm=[[`path`,{d:`M15 6C15 6 9.00001 10.4189 9 12C8.99999 13.5812 15 18 15 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],ym=[[`path`,{d:`M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Jte=[[`path`,{d:`M11 6H15.5C17.9853 6 20 8.01472 20 10.5C20 12.9853 17.9853 15 15.5 15H4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6.99998 12C6.99998 12 4.00001 14.2095 4 15C3.99999 15.7906 7 18 7 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Yte=[[`path`,{d:`M17.9998 15C17.9998 15 13.5809 9.00001 11.9998 9C10.4187 8.99999 5.99985 15 5.99985 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],bm=[[`path`,{d:`M12 5.5V19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 11C18 11 13.5811 5.00001 12 5C10.4188 4.99999 6 11 6 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Xte=[[`path`,{d:`M14.3942 3.00083L14.1481 2.79115C12.9103 1.73628 11.0897 1.73628 9.85189 2.79115L9.60584 3.00083C8.96518 3.54679 8.16862 3.87674 7.32956 3.9437L7.00731 3.96941C5.38613 4.09878 4.09878 5.38613 3.96941 7.00731L3.9437 7.32956C3.87674 8.16862 3.54679 8.96518 3.00083 9.60584L2.79115 9.85189C1.73628 11.0897 1.73628 12.9103 2.79115 14.1481L3.00083 14.3942C3.54679 15.0348 3.87674 15.8314 3.9437 16.6704L3.96941 16.9927C4.09878 18.6139 5.38613 19.9012 7.00731 20.0306L7.32956 20.0563C8.16862 20.1233 8.96518 20.4532 9.60584 20.9992L9.85188 21.2089C11.0897 22.2637 12.9103 22.2637 14.1481 21.2089L14.3942 20.9992C15.0348 20.4532 15.8314 20.1233 16.6704 20.0563L16.9927 20.0306C18.6139 19.9012 19.9012 18.6139 20.0306 16.9927L20.0563 16.6704C20.1233 15.8314 20.4532 15.0348 20.9992 14.3942L21.2089 14.1481C22.2637 12.9103 22.2637 11.0897 21.2089 9.85188L20.9992 9.60584C20.4532 8.96518 20.1233 8.16862 20.0563 7.32956L20.0306 7.00731C19.9012 5.38613 18.6139 4.09878 16.9927 3.96941L16.6704 3.9437C15.8314 3.87674 15.0348 3.54679 14.3942 3.00083Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.5 9.5C9.5 8.11929 10.6193 7 12 7C13.3807 7 14.5 8.11929 14.5 9.5C14.5 10.3569 14.0689 11.1131 13.4117 11.5636C12.7283 12.0319 12 12.6716 12 13.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Zte=[[`path`,{d:`M16.998 7.12652C17.3182 7.04393 17.654 7 18 7C20.2091 7 22 8.79086 22 11C22 13.2091 20.2091 15 18 15C17.6451 15 17.3009 14.9538 16.9733 14.867M16.998 7.12652C16.9993 7.08451 17 7.04233 17 7C17 4.79086 15.2091 3 13 3C11.0824 3 9.47994 4.34939 9.09041 6.15043M16.998 7.12652C16.9769 7.80763 16.7854 8.44584 16.4649 9M16.9733 14.867C16.9909 14.7472 17 14.6247 17 14.5C17 13.2905 16.1411 12.2816 15 12.05M16.9733 14.867C16.7957 16.0737 15.756 17 14.5 17H14C11.7909 17 10 18.7909 10 21M9.09041 6.15043C8.74377 6.05243 8.37801 6 8 6C5.79086 6 4 7.79086 4 10C4 10.3886 4.05542 10.7643 4.15878 11.1195M9.09041 6.15043C10.1015 6.43625 10.9498 7.10965 11.4649 8M4.15878 11.1195C2.9114 11.4832 2 12.6352 2 14C2 15.6569 3.34315 17 5 17C6.30622 17 7.41746 16.1652 7.82929 15M4.15878 11.1195C4.24921 11.4303 4.37632 11.7255 4.53513 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.8361 11.7435C11.3257 12.2353 10.453 12.3202 9.70713 11.9008C8.9612 11.4814 8.58031 10.6917 8.73535 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],Qte=[[`path`,{d:`M3 12C3 7.75736 3 5.63604 4.31802 4.31802C5.63604 3 7.75736 3 12 3C16.2426 3 18.364 3 19.682 4.31802C21 5.63604 21 7.75736 21 12C21 16.2426 21 18.364 19.682 19.682C18.364 21 16.2426 21 12 21C7.75736 21 5.63604 21 4.31802 19.682C3 18.364 3 16.2426 3 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 9H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],$te=[[`path`,{d:`M21.5 12C21.5 17.2467 17.2467 21.5 12 21.5C10.3719 21.5 8.8394 21.0904 7.5 20.3687C5.63177 19.362 4.37462 20.2979 3.26592 20.4658C3.09774 20.4913 2.93024 20.4302 2.80997 20.31C2.62741 20.1274 2.59266 19.8451 2.6935 19.6074C3.12865 18.5818 3.5282 16.6382 2.98341 15C2.6698 14.057 2.5 13.0483 2.5 12C2.5 6.75329 6.75329 2.5 12 2.5C17.2467 2.5 21.5 6.75329 21.5 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M10.2367 15.1527L8.5 15.5L8.84733 13.7633C8.91788 13.4106 9.09126 13.0866 9.34563 12.8323L13.4111 8.76684C13.7668 8.41105 14.3437 8.41105 14.6995 8.76684L15.2332 9.30052C15.5889 9.65631 15.5889 10.2332 15.2332 10.5889L11.1677 14.6544C10.9134 14.9087 10.5894 15.0821 10.2367 15.1527Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],ene=[[`path`,{d:`M16 10L18.1494 10.6448C19.5226 11.0568 20.2092 11.2628 20.6046 11.7942C21 12.3256 21 13.0425 21 14.4761V22`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 9L11 9M8 13L11 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 22V19C12 18.0572 12 17.5858 11.7071 17.2929C11.4142 17 10.9428 17 10 17H9C8.05719 17 7.58579 17 7.29289 17.2929C7 17.5858 7 18.0572 7 19V22`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M2 22L22 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M3 22V6.71724C3 4.20649 3 2.95111 3.79118 2.32824C4.58237 1.70537 5.74742 2.04355 8.07752 2.7199L13.0775 4.17122C14.4836 4.57937 15.1867 4.78344 15.5933 5.33965C16 5.89587 16 6.65344 16 8.16857V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],xm=[[`path`,{d:`M18 6L6.00081 17.9992M17.9992 18L6 6.00085`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],tne=[[`path`,{d:`M9 9L5 5M16 12H22M12 16V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],nne=[[`path`,{d:`M11.7453 14.85L6.90436 12V7C6.90436 4.79086 8.72949 3 10.9809 3C12.3782 3 13.6113 3.6898 14.3458 4.74128`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.59961 19.1791C10.3266 20.2757 11.5866 21.0008 13.0192 21.0008C15.2707 21.0008 17.0958 19.21 17.0958 17.0008V12.0008L12.1612 9.0957`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M9.45166 13.5L9.45123 7.66938L13.8642 5.16938C15.814 4.06481 18.3072 4.72031 19.4329 6.63348C20.1593 7.86806 20.1388 9.32466 19.5089 10.4995`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M4.48963 13.4993C3.8595 14.6742 3.83887 16.131 4.56539 17.3657C5.6911 19.2789 8.18428 19.9344 10.1341 18.8298L14.5471 16.3298L14.643 10.7344`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M17.0959 17.6309C18.4415 17.5734 19.7295 16.8634 20.4529 15.634C21.5786 13.7209 20.9106 11.2745 18.9608 10.1699L14.5478 7.66992L9.48907 10.4255`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M6.90454 6.36938C5.55865 6.42662 4.27032 7.13672 3.54684 8.3663C2.42113 10.2795 3.08917 12.7258 5.03896 13.8304L9.45196 16.3304L14.5 13.5807`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],Sm=[[`path`,{d:`M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17 9.00004 17C9.41425 17 9.74759 16.6523 10.4143 15.9568L19 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],rne=[[`path`,{d:`M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 12.5L10.5 15L16 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],ine=[[`path`,{d:`M17 3.33782C15.5291 2.48697 13.8214 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 11.3151 21.9311 10.6462 21.8 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 12.5C8 12.5 9.5 12.5 11.5 16C11.5 16 17.0588 6.83333 22 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Cm=[[`path`,{d:`M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],wm=[[`path`,{d:`M9.00005 18C9.00005 18 15 13.5811 15 12C15 10.4188 9 6 9 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],ane=[[`path`,{d:`M18 15C18 15 13.5811 9.00001 12 9C10.4188 8.99999 6 15 6 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Tm=[[`path`,{d:`M7 19C7 19 10.6824 14 12 14C13.3176 14 17 19 17 19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 5.00004C7 5.00004 10.6824 9.99999 12 10C13.3176 10 17 5 17 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Em=[[`path`,{d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 12.5L10 14.5L15.5 9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Dm=[[`path`,{d:`M9.50293 21.6846C10.302 21.8902 11.1397 21.9996 12.0029 21.9996C12.8662 21.9996 13.7039 21.8902 14.5029 21.6846`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.5029 2.31504C13.7039 2.10938 12.8662 2 12.0029 2C11.1397 2 10.302 2.10938 9.50293 2.31504`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2.37109 14.6777C2.59251 15.4726 2.91663 16.2527 3.34826 17.0003C3.77988 17.7479 4.29346 18.4187 4.87109 19.0079`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M21.6451 9.32261C21.4237 8.52778 21.0996 7.74762 20.668 7.00002C20.2363 6.25243 19.7228 5.58165 19.1451 4.99248`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M21.6436 14.6777C21.4221 15.4726 21.098 16.2527 20.6664 17.0003C20.2348 17.7479 19.7212 18.4187 19.1436 19.0079`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M2.36952 9.32261C2.59093 8.52778 2.91506 7.74762 3.34668 7.00002C3.7783 6.25243 4.29188 5.58165 4.86952 4.99248`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],one=[[`path`,{d:`M9.50293 21.6846C10.302 21.8902 11.1397 21.9996 12.0029 21.9996C12.8662 21.9996 13.7039 21.8902 14.5029 21.6846`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.5029 2.31504C13.7039 2.10938 12.8662 2 12.0029 2C11.1397 2 10.302 2.10938 9.50293 2.31504`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2.37109 14.6777C2.59251 15.4726 2.91663 16.2527 3.34826 17.0003C3.77988 17.7479 4.29346 18.4187 4.87109 19.0079`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M21.6451 9.32261C21.4237 8.52778 21.0996 7.74762 20.668 7.00002C20.2363 6.25243 19.7228 5.58165 19.1451 4.99248`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M21.6436 14.6777C21.4221 15.4726 21.098 16.2527 20.6664 17.0003C20.2348 17.7479 19.7212 18.4187 19.1436 19.0079`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M2.36952 9.32261C2.59093 8.52778 2.91506 7.74762 3.34668 7.00002C3.7783 6.25243 4.29188 5.58165 4.86952 4.99248`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}],[`path`,{d:`M12.0039 11.5V12M13.0039 12C13.0039 12.5523 12.5562 13 12.0039 13C11.4516 13 11.0039 12.5523 11.0039 12C11.0039 11.4477 11.4516 11 12.0039 11C12.5562 11 13.0039 11.4477 13.0039 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`6`}]],sne=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],cne=[[`path`,{d:`M17.4776 8.00005C17.485 8.00002 17.4925 8 17.5 8C19.9853 8 22 10.0147 22 12.5C22 14.9853 19.9853 17 17.5 17H7C4.23858 17 2 14.7614 2 12C2 9.40034 3.98398 7.26407 6.52042 7.0227M17.4776 8.00005C17.4924 7.83536 17.5 7.66856 17.5 7.5C17.5 4.46243 15.0376 2 12 2C9.12324 2 6.76233 4.20862 6.52042 7.0227M17.4776 8.00005C17.3753 9.1345 16.9286 10.1696 16.2428 11M6.52042 7.0227C6.67826 7.00768 6.83823 7 7 7C8.12582 7 9.16474 7.37209 10.0005 8`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14 20.75V20.5C14 19.9477 13.5523 19.5 13 19.5H12M14 20.75V21C14 21.5523 13.5523 22 13 22H11C10.4477 22 10 21.5523 10 21V20.75M14 20.75H19M10 20.75V20.5C10 19.9477 10.4477 19.5 11 19.5H12M10 20.75H5M12 19.5V17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Om=[[`path`,{d:`M17.4776 10.0001C17.485 10 17.4925 10 17.5 10C19.9853 10 22 12.0147 22 14.5C22 16.9853 19.9853 19 17.5 19H7C4.23858 19 2 16.7614 2 14C2 11.4003 3.98398 9.26407 6.52042 9.0227M17.4776 10.0001C17.4924 9.83536 17.5 9.66856 17.5 9.5C17.5 6.46243 15.0376 4 12 4C9.12324 4 6.76233 6.20862 6.52042 9.0227M17.4776 10.0001C17.3753 11.1345 16.9286 12.1696 16.2428 13M6.52042 9.0227C6.67826 9.00768 6.83823 9 7 9C8.12582 9 9.16474 9.37209 10.0005 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],km=[[`path`,{d:`M17.4776 9.01106C17.485 9.01102 17.4925 9.01101 17.5 9.01101C19.9853 9.01101 22 11.0294 22 13.5193C22 15.8398 20.25 17.7508 18 18M17.4776 9.01106C17.4924 8.84606 17.5 8.67896 17.5 8.51009C17.5 5.46695 15.0376 3 12 3C9.12324 3 6.76233 5.21267 6.52042 8.03192M17.4776 9.01106C17.3753 10.1476 16.9286 11.1846 16.2428 12.0165M6.52042 8.03192C3.98398 8.27373 2 10.4139 2 13.0183C2 15.4417 3.71776 17.4632 6 17.9273M6.52042 8.03192C6.67826 8.01687 6.83823 8.00917 7 8.00917C8.12582 8.00917 9.16474 8.38194 10.0005 9.01101`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 13L12 21M12 13C11.2998 13 9.99153 14.9943 9.5 15.5M12 13C12.7002 13 14.0085 14.9943 14.5 15.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],lne=[[`path`,{d:`M18.2505 10.5H19.6403C21.4918 10.5 22.0421 10.7655 21.9975 12.0838C21.9237 14.2674 20.939 16.8047 17 17.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.94627 20.6145C2.57185 18.02 2.07468 14.3401 2.00143 10.5001C1.96979 8.8413 2.45126 8.5 4.65919 8.5H15.3408C17.5487 8.5 18.0302 8.8413 17.9986 10.5001C17.9253 14.3401 17.4281 18.02 14.0537 20.6145C13.0934 21.3528 12.2831 21.5 10.9194 21.5H9.08064C7.71686 21.5 6.90658 21.3528 5.94627 20.6145Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.3089 2.5C10.7622 2.83861 10.0012 4 10.0012 5.5M7.53971 4C7.53971 4 7 4.5 7 5.5M14.0012 4C13.7279 4.1693 13.5 5 13.5 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Am=[[`path`,{d:`M14 4H10C6.22876 4 4.34315 4 3.17157 5.17157C2 6.34315 2 8.22876 2 12C2 15.7712 2 17.6569 3.17157 18.8284C4.34315 20 6.22876 20 10 20H14C17.7712 20 19.6569 20 20.8284 18.8284C22 17.6569 22 15.7712 22 12C22 8.22876 22 6.34315 20.8284 5.17157C19.6569 4 17.7712 4 14 4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 9L8.83981 10.5858C9.61327 11.2525 10 11.5858 10 12C10 12.4142 9.61327 12.7475 8.83981 13.4142L7 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13 16H17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],jm=[[`path`,{d:`M14 21H16M14 21C13.1716 21 12.5 20.3284 12.5 19.5V17L12 17M14 21H10M10 21H8M10 21C10.8284 21 11.5 20.3284 11.5 19.5V17L12 17M12 17V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16 3H8C5.17157 3 3.75736 3 2.87868 3.87868C2 4.75736 2 6.17157 2 9V11C2 13.8284 2 15.2426 2.87868 16.1213C3.75736 17 5.17157 17 8 17H16C18.8284 17 20.2426 17 21.1213 16.1213C22 15.2426 22 13.8284 22 11V9C22 6.17157 22 4.75736 21.1213 3.87868C20.2426 3 18.8284 3 16 3Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],une=[[`path`,{d:`M7.5 7.5L8.72654 8.55719C9.24218 9.00163 9.5 9.22386 9.5 9.5C9.5 9.77614 9.24218 9.99836 8.72654 10.4428L7.5 11.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.5 12.5H15.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 21C15.7497 21 17.6246 21 18.9389 20.0451C19.3634 19.7367 19.7367 19.3634 20.0451 18.9389C21 17.6246 21 15.7497 21 12C21 8.25027 21 6.3754 20.0451 5.06107C19.7367 4.6366 19.3634 4.26331 18.9389 3.95491C17.6246 3 15.7497 3 12 3C8.25027 3 6.3754 3 5.06107 3.95491C4.6366 4.26331 4.26331 4.6366 3.95491 5.06107C3 6.3754 3 8.25027 3 12C3 15.7497 3 17.6246 3.95491 18.9389C4.26331 19.3634 4.6366 19.7367 5.06107 20.0451C6.3754 21 8.25027 21 12 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Mm=[[`path`,{d:`M7 11V9C7 5.70017 7 4.05025 8.02513 3.02513C9.05025 2 10.7002 2 14 2C17.2998 2 18.9497 2 19.9749 3.02513C21 4.05025 21 5.70017 21 9V11C21 14.2998 21 15.9497 19.9749 16.9749C18.9497 18 17.2998 18 14 18C10.7002 18 9.05025 18 8.02513 16.9749C7 15.9497 7 14.2998 7 11Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 6V15C3 18.2998 3 19.9497 4.02513 20.9749C5.05025 22 6.70017 22 10 22H17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],dne=[[`path`,{d:`M4 12C4 8.22876 4 6.34315 5.17157 5.17157C6.34315 4 8.22876 4 12 4C15.7712 4 17.6569 4 18.8284 5.17157C20 6.34315 20 8.22876 20 12C20 15.7712 20 17.6569 18.8284 18.8284C17.6569 20 15.7712 20 12 20C8.22876 20 6.34315 20 5.17157 18.8284C4 17.6569 4 15.7712 4 12Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.5 2V4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M14.5 2V4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M9.5 20V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M14.5 20V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M13 9L9 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}],[`path`,{d:`M15 13L13 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`6`}],[`path`,{d:`M22 14.5L20 14.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`7`}],[`path`,{d:`M4 9.5L2 9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`8`}],[`path`,{d:`M4 14.5L2 14.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`9`}],[`path`,{d:`M22 9.5L20 9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`10`}]],Nm=[[`path`,{d:`M19.5 5.5L18.8803 15.5251C18.7219 18.0864 18.6428 19.3671 18.0008 20.2879C17.6833 20.7431 17.2747 21.1273 16.8007 21.416C15.8421 22 14.559 22 11.9927 22C9.42312 22 8.1383 22 7.17905 21.4149C6.7048 21.1257 6.296 20.7408 5.97868 20.2848C5.33688 19.3626 5.25945 18.0801 5.10461 15.5152L4.5 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 5.5H21M16.0557 5.5L15.3731 4.09173C14.9196 3.15626 14.6928 2.68852 14.3017 2.39681C14.215 2.3321 14.1231 2.27454 14.027 2.2247C13.5939 2 13.0741 2 12.0345 2C10.9688 2 10.436 2 9.99568 2.23412C9.8981 2.28601 9.80498 2.3459 9.71729 2.41317C9.32164 2.7167 9.10063 3.20155 8.65861 4.17126L8.05292 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M9.5 16.5L9.5 10.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M14.5 16.5L14.5 10.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}]],fne=[[`path`,{d:`M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],pne=[[`path`,{d:`M16 6C16 6.55228 15.5523 7 15 7C14.4477 7 14 6.55228 14 6C14 5.44772 14.4477 5 15 5C15.5523 5 16 5.44772 16 6Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M10 6C10 6.55228 9.55228 7 9 7C8.44772 7 8 6.55228 8 6C8 5.44772 8.44772 5 9 5C9.55228 5 10 5.44772 10 6Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M16 18C16 18.5523 15.5523 19 15 19C14.4477 19 14 18.5523 14 18C14 17.4477 14.4477 17 15 17C15.5523 17 16 17.4477 16 18Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11C15.5523 11 16 11.4477 16 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M10 18C10 18.5523 9.55228 19 9 19C8.44772 19 8 18.5523 8 18C8 17.4477 8.44772 17 9 17C9.55228 17 10 17.4477 10 18Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11C9.55228 11 10 11.4477 10 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],mne=[[`path`,{d:`M12 12H12.5M19 12H19.5M5 12H5.5M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13ZM19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11C18.4477 11 18 11.4477 18 12C18 12.5523 18.4477 13 19 13ZM5 13C5.55228 13 6 12.5523 6 12C6 11.4477 5.55228 11 5 11C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],hne=[[`path`,{d:`M8 7L16 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 11L12 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13 21.5V21C13 18.1716 13 16.7574 13.8787 15.8787C14.7574 15 16.1716 15 19 15H19.5M20 13.3431V10C20 6.22876 20 4.34315 18.8284 3.17157C17.6569 2 15.7712 2 12 2C8.22877 2 6.34315 2 5.17157 3.17157C4 4.34314 4 6.22876 4 10L4 14.5442C4 17.7892 4 19.4117 4.88607 20.5107C5.06508 20.7327 5.26731 20.9349 5.48933 21.1139C6.58831 22 8.21082 22 11.4558 22C12.1614 22 12.5141 22 12.8372 21.886C12.9044 21.8623 12.9702 21.835 13.0345 21.8043C13.3436 21.6564 13.593 21.407 14.0919 20.9081L18.8284 16.1716C19.4065 15.5935 19.6955 15.3045 19.8478 14.9369C20 14.5694 20 14.1606 20 13.3431Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Pm=[[`path`,{d:`M4.5 13V9.45584C4.5 6.21082 4.5 4.58831 5.38607 3.48933C5.56508 3.26731 5.76731 3.06508 5.98933 2.88607C7.08831 2 8.71082 2 11.9558 2C12.6614 2 13.0141 2 13.3372 2.11401C13.4044 2.13772 13.4702 2.165 13.5345 2.19575C13.8436 2.34355 14.093 2.593 14.5919 3.09188L19.3284 7.82843C19.9065 8.40649 20.1955 8.69552 20.3478 9.06306C20.5 9.4306 20.5 9.83935 20.5 10.6569V14C20.5 17.7712 20.5 19.6569 19.3284 20.8284C18.1569 22 16.2712 22 12.5 22C12.1508 22 11.8178 22 11.5 21.9991M13.5 2.5V3C13.5 5.82843 13.5 7.24264 14.3787 8.12132C15.2574 9 16.6716 9 19.5 9H20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3.5 22V20.6611C3.5 20.0548 3.74082 19.4735 4.16947 19.0448L8.81022 14.4041C9.06894 14.1453 9.41983 14 9.78571 14C10.1516 14 10.5025 14.1453 10.7612 14.4041L11.0959 14.7388C11.3547 14.9975 11.5 15.3484 11.5 15.7143C11.5 16.0802 11.3547 16.4311 11.0959 16.6898L6.45518 21.3305C6.02653 21.7592 5.44515 22 4.83894 22H3.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Fm=[[`path`,{d:`M8 7H16.75C18.8567 7 19.91 7 20.6667 7.50559C20.9943 7.72447 21.2755 8.00572 21.4944 8.33329C22 9.08996 22 10.1433 22 12.25C22 15.7612 22 17.5167 21.1573 18.7779C20.7926 19.3238 20.3238 19.7926 19.7779 20.1573C18.5167 21 16.7612 21 13.25 21H12C7.28595 21 4.92893 21 3.46447 19.5355C2 18.0711 2 15.714 2 11V7.94427C2 6.1278 2 5.21956 2.38032 4.53806C2.65142 4.05227 3.05227 3.65142 3.53806 3.38032C4.21956 3 5.1278 3 6.94427 3C8.10802 3 8.6899 3 9.19926 3.19101C10.3622 3.62712 10.8418 4.68358 11.3666 5.73313L12 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}]],Im=[[`path`,{d:`M7 19H13C15.8284 19 17.2426 19 18.1213 18.1213C19 17.2426 19 15.8284 19 13V10M19 10C19.7002 10 21.0085 11.9943 21.5 12.5M19 10C18.2998 10 16.9915 11.9943 16.5 12.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5 7L5 17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`5`,cy:`5`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`3`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`4`}]],Lm=[[`circle`,{cx:`12`,cy:`12`,r:`3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9 12H3M15 12H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Rm=[[`path`,{d:`M19 17L19 11C19 8.17157 19 6.75736 18.1213 5.87868C17.2426 5 15.8284 5 13 5H10M10 5C10 4.29977 11.9943 2.99153 12.5 2.5M10 5C10 5.70023 11.9943 7.00847 12.5 7.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5 7.5L5 13.5C5 16.3284 5 17.7426 5.87868 18.6213C6.75736 19.5 8.17157 19.5 11 19.5H14M14 19.5C14 20.2002 12.0057 21.5085 11.5 22M14 19.5C14 18.7998 12.0057 17.4915 11.5 17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`19`,cy:`19`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`circle`,{cx:`5`,cy:`5`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`3`}]],zm=[[`path`,{d:`M6 8C7.10457 8 8 7.10457 8 6C8 4.89543 7.10457 4 6 4C4.89543 4 4 4.89543 4 6C4 7.10457 4.89543 8 6 8Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 20C13.1046 20 14 19.1046 14 18C14 16.8954 13.1046 16 12 16C10.8954 16 10 16.8954 10 18C10 19.1046 10.8954 20 12 20Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M18 8C19.1046 8 20 7.10457 20 6C20 4.89543 19.1046 4 18 4C16.8954 4 16 4.89543 16 6C16 7.10457 16.8954 8 18 8Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M6.01734 8.74067C6.01734 10.4142 5.77537 12.1995 9.22051 11.9855H12.0053M17.9929 8.57617C18.1259 11.9855 16.9199 11.7648 15.7861 11.9855H12.0053M12.0053 15.7001V11.9855`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Bm=[[`path`,{d:`M6 8L6 16`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 16V12C18 9.17156 18 7.75735 17.1213 6.87867C16.2426 5.99999 14.8284 5.99999 12 5.99999L11 5.99999M11 5.99999C11 5.29976 12.9943 3.99152 13.5 3.49999M11 5.99999C11 6.70022 12.9943 8.00846 13.5 8.49999`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`6`,cy:`18`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`circle`,{cx:`6`,cy:`6`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`3`}],[`circle`,{cx:`18`,cy:`18`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`4`}]],Vm=[[`path`,{d:`M10 20.5675C6.57143 21.7248 3.71429 20.5675 2 17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M10 22V18.7579C10 18.1596 10.1839 17.6396 10.4804 17.1699C10.6838 16.8476 10.5445 16.3904 10.1771 16.2894C7.13394 15.4528 5 14.1077 5 9.64606C5 8.48611 5.38005 7.39556 6.04811 6.4464C6.21437 6.21018 6.29749 6.09208 6.31748 5.9851C6.33746 5.87813 6.30272 5.73852 6.23322 5.45932C5.95038 4.32292 5.96871 3.11619 6.39322 2.02823C6.39322 2.02823 7.27042 1.74242 9.26698 2.98969C9.72282 3.27447 9.95075 3.41686 10.1515 3.44871C10.3522 3.48056 10.6206 3.41384 11.1573 3.28041C11.8913 3.09795 12.6476 3 13.5 3C14.3524 3 15.1087 3.09795 15.8427 3.28041C16.3794 3.41384 16.6478 3.48056 16.8485 3.44871C17.0493 3.41686 17.2772 3.27447 17.733 2.98969C19.7296 1.74242 20.6068 2.02823 20.6068 2.02823C21.0313 3.11619 21.0496 4.32292 20.7668 5.45932C20.6973 5.73852 20.6625 5.87813 20.6825 5.9851C20.7025 6.09207 20.7856 6.21019 20.9519 6.4464C21.6199 7.39556 22 8.48611 22 9.64606C22 14.1077 19.8661 15.4528 16.8229 16.2894C16.4555 16.3904 16.3162 16.8476 16.5196 17.1699C16.8161 17.6396 17 18.1596 17 18.7579V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Hm=[[`path`,{d:`M12.5 19L12.5 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M10.5 22H14.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`7`,cy:`7`,r:`7`,transform:`matrix(-1 0 0 1 20.5 2)`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M8.5 4C9.15431 4.0385 9.49236 4.35899 10.0735 4.97301C11.1231 6.08206 12.1727 6.1746 12.8724 5.80492C13.922 5.2504 13.04 4.35221 14.2719 3.86409C15.0748 3.54595 15.1868 2.68026 14.7399 2`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M20 10C18.5 10 18.2338 11.2468 17 11C14.5 10.5 13.7916 11.0589 13.7916 12.2511C13.7916 13.4432 13.7916 13.4432 13.2717 14.3373C12.9335 14.9189 12.8153 15.5004 13.4894 16`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M6.5 2C4.64864 3.79995 3.5 6.3082 3.5 9.08251C3.5 14.5598 7.97715 19 13.5 19C16.2255 19 18.6962 17.9187 20.5 16.165`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`5`}]],Um=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.5 9.5C9.5 8.11929 10.6193 7 12 7C13.3807 7 14.5 8.11929 14.5 9.5C14.5 10.3569 14.0689 11.1131 13.4117 11.5636C12.7283 12.0319 12 12.6716 12 13.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Wm=[[`path`,{d:`M3 11.9896V14.5C3 17.7998 3 19.4497 4.02513 20.4749C5.05025 21.5 6.70017 21.5 10 21.5H14C17.2998 21.5 18.9497 21.5 19.9749 20.4749C21 19.4497 21 17.7998 21 14.5V11.9896C21 10.3083 21 9.46773 20.6441 8.74005C20.2882 8.01237 19.6247 7.49628 18.2976 6.46411L16.2976 4.90855C14.2331 3.30285 13.2009 2.5 12 2.5C10.7991 2.5 9.76689 3.30285 7.70242 4.90855L5.70241 6.46411C4.37533 7.49628 3.71179 8.01237 3.3559 8.74005C3 9.46773 3 10.3083 3 11.9896Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Gm=[[`path`,{d:`M12.8924 2.80982L21.4876 9.59547C21.8112 9.85095 22 10.2405 22 10.6528C22 11.3969 21.3969 12 20.6528 12H20V15.5C20 18.3284 20 19.7426 19.1213 20.6213C18.2426 21.5 16.8284 21.5 14 21.5H10C7.17157 21.5 5.75736 21.5 4.87868 20.6213C4 19.7426 4 18.3284 4 15.5V12H3.34716C2.60315 12 2 11.3969 2 10.6528C2 10.2405 2.1888 9.85095 2.5124 9.59547L11.1076 2.80982C11.3617 2.60915 11.6761 2.5 12 2.5C12.3239 2.5 12.6383 2.60915 12.8924 2.80982Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.5 21.5V17C14.5 16.0654 14.5 15.5981 14.299 15.25C14.1674 15.022 13.978 14.8326 13.75 14.701C13.4019 14.5 12.9346 14.5 12 14.5C11.0654 14.5 10.5981 14.5 10.25 14.701C10.022 14.8326 9.83261 15.022 9.70096 15.25C9.5 15.5981 9.5 16.0654 9.5 17V21.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Km=[[`circle`,{cx:`7.5`,cy:`7.5`,r:`1.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],qm=[[`path`,{d:`M15.5 8C15.7761 8 16 7.77614 16 7.5C16 7.22386 15.7761 7 15.5 7M15.5 8C15.2239 8 15 7.77614 15 7.5C15 7.22386 15.2239 7 15.5 7M15.5 8V7`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2 2L22 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M17.2997 21.2997C16.0187 21.5 14.3303 21.5 12 21.5C7.77027 21.5 5.6554 21.5 4.25276 20.302C4.05358 20.1319 3.86808 19.9464 3.69797 19.7472C2.5 18.3446 2.5 16.2297 2.5 12C2.5 9.66971 2.5 7.98134 2.70033 6.70033M20.0355 20.0355C20.1281 19.943 20.217 19.8468 20.302 19.7472C21.5 18.3446 21.5 16.2297 21.5 12C21.5 7.77027 21.5 5.6554 20.302 4.25276C20.1319 4.05358 19.9464 3.86808 19.7472 3.69797C18.3446 2.5 16.2297 2.5 12 2.5C7.77027 2.5 5.6554 2.5 4.25276 3.69797C4.15317 3.78303 4.057 3.87193 3.96447 3.96447`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M3 16L7.50036 11.5004M21 16L18.5303 13.5303C18.1908 13.1908 17.7302 13 17.25 13C16.7698 13 16.3092 13.1908 15.9697 13.5303L14.75 14.75`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Jm=[[`path`,{d:`M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M21.5 13.5H16.5743C15.7322 13.5 15.0706 14.2036 14.6995 14.9472C14.2963 15.7551 13.4889 16.5 12 16.5C10.5111 16.5 9.70373 15.7551 9.30054 14.9472C8.92942 14.2036 8.26777 13.5 7.42566 13.5H2.5`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Ym=[[`circle`,{cx:`12`,cy:`11.9999`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 15.9999L12 11.9999`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.875 8.24994L12 8.24994M11.75 8.24994C11.75 8.11187 11.8619 7.99994 12 7.99994C12.1381 7.99994 12.25 8.11187 12.25 8.24994C12.25 8.38801 12.1381 8.49994 12 8.49994C11.8619 8.49994 11.75 8.38801 11.75 8.24994Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Xm=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 16V12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 8.25H12M12.25 8.25C12.25 8.11193 12.1381 8 12 8C11.8619 8 11.75 8.11193 11.75 8.25C11.75 8.38807 11.8619 8.5 12 8.5C12.1381 8.5 12.25 8.38807 12.25 8.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Zm=[[`path`,{d:`M20.4999 16.5V8.5C20.4999 6.14298 20.4999 4.96447 19.7676 4.23223C19.0354 3.5 17.8569 3.5 15.4999 3.5H8.49988C6.14286 3.5 4.96434 3.5 4.23211 4.23223C3.49988 4.96447 3.49988 6.14298 3.49988 8.5V16.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M21.9841 20.5H2.01567C1.63273 20.5 1.38367 20.1088 1.55493 19.7764L3.49988 16.5H20.4999L22.4448 19.7764C22.6161 20.1088 22.367 20.5 21.9841 20.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Qm=[[`path`,{d:`M3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 2.5V21.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],$m=[[`path`,{d:`M15.4812 16.9043C15.48 16.7344 15.4793 16.6494 15.4796 16.6252C15.4889 15.5876 15.6101 15.2943 16.3363 14.553C16.3532 14.5357 16.5411 14.35 16.917 13.9785C18.2007 12.7095 18.9961 10.9476 18.9961 9C18.9961 5.13401 15.8621 2 11.9961 2C8.1301 2 4.99609 5.13401 4.99609 9C4.99609 10.948 5.79184 12.7102 7.07601 13.9792C7.46075 14.3594 7.65312 14.5495 7.67314 14.5701C8.38589 15.3019 8.50393 15.5845 8.52348 16.6059C8.52402 16.6345 8.52402 16.7241 8.52402 16.9033C8.52402 16.9931 8.52402 17.038 8.52547 17.0759C8.56516 18.1209 9.40314 18.9589 10.4481 18.9986C10.486 19 10.5309 19 10.6207 19H13.4004C13.4759 19 13.5137 19 13.5456 18.999C14.6056 18.9652 15.4549 18.1098 15.4812 17.0495C15.482 17.0176 15.4817 16.9799 15.4812 16.9043Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.99609 19V20C9.99609 21.1046 10.8915 22 11.9961 22C13.1007 22 13.9961 21.1046 13.9961 20V19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M8.49609 16H15.4961`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],eh=[[`path`,{d:`M9.14339 10.691L9.35031 10.4841C11.329 8.50532 14.5372 8.50532 16.5159 10.4841C18.4947 12.4628 18.4947 15.671 16.5159 17.6497L13.6497 20.5159C11.671 22.4947 8.46279 22.4947 6.48405 20.5159C4.50532 18.5372 4.50532 15.329 6.48405 13.3503L6.9484 12.886`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M17.0516 11.114L17.5159 10.6497C19.4947 8.67095 19.4947 5.46279 17.5159 3.48405C15.5372 1.50532 12.329 1.50532 10.3503 3.48405L7.48405 6.35031C5.50532 8.32904 5.50532 11.5372 7.48405 13.5159C9.46279 15.4947 12.671 15.4947 14.6497 13.5159L14.8566 13.309`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],th=[[`path`,{d:`M11.0991 3.00012C7.45013 3.00669 5.53932 3.09629 4.31817 4.31764C3.00034 5.63568 3.00034 7.75704 3.00034 11.9997C3.00034 16.2424 3.00034 18.3638 4.31817 19.6818C5.63599 20.9999 7.75701 20.9999 11.9991 20.9999C16.241 20.9999 18.3621 20.9999 19.6799 19.6818C20.901 18.4605 20.9906 16.5493 20.9972 12.8998`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20.556 3.49612L11.0487 13.0586M20.556 3.49612C20.062 3.00151 16.7343 3.04761 16.0308 3.05762M20.556 3.49612C21.05 3.99074 21.0039 7.32273 20.9939 8.02714`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],nh=[[`path`,{d:`M3 5H17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 12H11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M15 12.0009H21M17.995 15.0059L17.995 9.00586`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M3 19H17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],rh=[[`path`,{d:`M12.9961 6L20.9961 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.9961 12L20.9961 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.9961 18L20.9961 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M4.23073 19.3478C4.59827 19.5 5.06421 19.5 5.99609 19.5C6.92798 19.5 7.39392 19.5 7.76146 19.3478C8.25152 19.1448 8.64086 18.7554 8.84385 18.2654C8.99609 17.8978 8.99609 17.4319 8.99609 16.5C8.99609 15.5681 8.99609 15.1022 8.84385 14.7346C8.64086 14.2446 8.25152 13.8552 7.76146 13.6522C7.39392 13.5 6.92798 13.5 5.99609 13.5C5.06421 13.5 4.59827 13.5 4.23073 13.6522C3.74067 13.8552 3.35132 14.2446 3.14833 14.7346C2.99609 15.1022 2.99609 15.5681 2.99609 16.5C2.99609 17.4319 2.99609 17.8978 3.14833 18.2654C3.35132 18.7554 3.74067 19.1448 4.23073 19.3478Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M2.99609 7.16667C2.99609 7.16667 3.74609 7.16667 4.49609 8.5C4.49609 8.5 6.87845 5.16667 8.99609 4.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],ih=[[`path`,{d:`M19.9264 22.2516V20.691C19.9264 20.288 20.0525 19.8966 20.2639 19.5531C21.7583 17.1245 22.2279 14.5196 21.9002 13.505C20.857 11.3418 17.3758 10.4907 15.76 10.2878L16.7966 5.12292C16.9705 4.30387 16.3513 3.47938 15.4135 3.28136C14.4758 3.08334 13.5746 3.58679 13.4007 4.40583L11.3462 14.0815L8.77462 12.4424C8.77462 12.4424 7.47969 11.406 6.44041 12.4424C5.40114 13.4788 6.44041 14.7701 6.44041 14.7701L10.3488 19.7776C10.6003 20.0997 10.7468 20.4908 10.7688 20.8984L10.8401 22.2177`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7.32936 1.85194C7.32936 1.85194 9.54861 1.58797 9.867 1.90156C10.1124 2.14335 9.867 4.36134 9.867 4.36134M9.867 1.90156L6.89808 4.84002M4.6477 9.59694C4.6477 9.59694 2.42845 9.86092 2.11005 9.54732C1.86463 9.30553 2.11005 7.08754 2.11005 7.08754M2.11005 9.54732L5.07898 6.60886`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],ah=[[`path`,{d:`M7.86292 12.6614L9.99786 14.4926L12.6639 4.26536C12.8615 3.5074 13.5456 2.97852 14.3283 2.97852C15.4379 2.97852 16.2572 4.01415 16.0026 5.09485L14.801 10.1953L16.489 10.4653C18.4186 10.755 19.3835 10.8997 20.063 11.3072C21.1856 11.9802 21.9988 12.9908 21.9988 14.4662C21.9988 15.4938 21.745 16.1833 21.128 18.0356C20.7365 19.211 20.5407 19.7988 20.2215 20.2639C19.6959 21.0299 18.9205 21.589 18.0283 21.8459C17.4863 22.0017 16.8673 22.0017 15.6292 22.0017H14.5798C12.9337 22.0017 12.1107 22.0017 11.3781 21.6995C11.2467 21.6453 11.1182 21.5841 10.9934 21.5163C10.2969 21.1378 9.77798 20.4986 8.74003 19.2203L5.37984 15.0816C4.86348 14.4458 4.86004 13.5355 5.37157 12.8957C5.98639 12.1266 7.11568 12.0204 7.86292 12.6614Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7.33204 2.10402C7.33204 2.10402 9.55241 1.83972 9.87097 2.1537C10.1165 2.39578 9.87097 4.61648 9.87097 4.61648M9.87097 2.1537L6.90055 5.09574M4.64903 9.85845C4.64903 9.85845 2.42866 10.1227 2.11011 9.80877C1.86456 9.56668 2.11011 7.34599 2.11011 7.34599M2.11011 9.80877L5.08053 6.86673`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],oh=[[`path`,{d:`M4 5L20 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M4 12L20 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M4 19L20 19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],sh=[[`path`,{d:`M21.4961 12C21.4961 17.2467 17.2428 21.5 11.9961 21.5C10.368 21.5 8.83549 21.0904 7.49609 20.3687C5.62786 19.362 4.37071 20.2979 3.26202 20.4658C3.09383 20.4913 2.92634 20.4302 2.80606 20.31C2.6235 20.1274 2.58875 19.8451 2.6896 19.6074C3.12475 18.5818 3.5243 16.6382 2.9795 15C2.6659 14.057 2.49609 13.0483 2.49609 12C2.49609 6.75329 6.74939 2.5 11.9961 2.5C17.2428 2.5 21.4961 6.75329 21.4961 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.49609 9.5C9.49609 8.11929 10.6154 7 11.9961 7C13.3768 7 14.4961 8.11929 14.4961 9.5C14.4961 10.3569 14.0649 11.1131 13.4078 11.5636C12.7244 12.0319 11.9961 12.6716 11.9961 13.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.1211 16.75H11.9961M12.2461 16.75C12.2461 16.8881 12.1342 17 11.9961 17C11.858 17 11.7461 16.8881 11.7461 16.75C11.7461 16.6119 11.858 16.5 11.9961 16.5C12.1342 16.5 12.2461 16.6119 12.2461 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],ch=[[`path`,{d:`M1.99609 10.5C1.99609 9.72921 2.00956 8.97679 2.03519 8.2503C2.11892 5.87683 2.16078 4.69009 3.12616 3.71745C4.09154 2.74481 5.31179 2.6926 7.75229 2.58819C9.09126 2.5309 10.517 2.5 11.9961 2.5C13.4752 2.5 14.9009 2.5309 16.2399 2.58819C18.6804 2.6926 19.9006 2.74481 20.866 3.71745C21.8314 4.69009 21.8733 5.87683 21.957 8.2503C21.9826 8.97679 21.9961 9.72921 21.9961 10.5C21.9961 11.2708 21.9826 12.0232 21.957 12.7497C21.8733 15.1232 21.8314 16.3099 20.866 17.2826C19.9006 18.2552 18.6804 18.3074 16.2398 18.4118C15.5059 18.4432 14.7459 18.4667 13.9654 18.4815C13.2242 18.4955 12.8537 18.5026 12.5281 18.6266C12.2025 18.7506 11.9285 18.9855 11.3806 19.4553L9.20113 21.3242C9.06882 21.4376 8.90029 21.5 8.726 21.5C8.32289 21.5 7.99609 21.1732 7.99609 20.7701V18.4219C7.91451 18.4186 7.83324 18.4153 7.75229 18.4118C5.31179 18.3074 4.09154 18.2552 3.12616 17.2825C2.16078 16.3099 2.11892 15.1232 2.03519 12.7497C2.00956 12.0232 1.99609 11.2708 1.99609 10.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.9961 10.5V6.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.1211 14.25H11.9961M12.2461 14.25C12.2461 14.3881 12.1342 14.5 11.9961 14.5C11.858 14.5 11.7461 14.3881 11.7461 14.25C11.7461 14.1119 11.858 14 11.9961 14C12.1342 14 12.2461 14.1119 12.2461 14.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],lh=[[`path`,{d:`M7.87124 12.6711L10.0051 14.5001L12.6698 4.28528C12.8673 3.52824 13.5511 3 14.3334 3C15.4424 3 16.2613 4.03438 16.0068 5.11376L14.8058 10.208L16.493 10.4777C18.4216 10.767 19.386 10.9116 20.0652 11.3186C21.1872 11.9907 22 13.0001 22 14.4737C22 15.5001 21.7463 16.1887 21.1296 18.0388C20.7383 19.2128 20.5426 19.7998 20.2236 20.2644C19.6983 21.0294 18.9233 21.5879 18.0315 21.8444C17.4898 22.0001 16.8711 22.0001 15.6336 22.0001H14.5847C12.9395 22.0001 12.1169 22.0001 11.3846 21.6982C11.2533 21.6441 11.1249 21.583 11.0001 21.5152C10.304 21.1372 9.78533 20.4988 8.74791 19.222L5.38941 15.0884C4.87331 14.4533 4.86987 13.5442 5.38114 12.9051C5.99565 12.137 7.12437 12.0309 7.87124 12.6711Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6.95596 2.49064C6.95596 2.49064 6.70432 4.76405 6.95596 5.01188M6.95596 5.01188C7.28241 5.33331 9.55781 5.06274 9.55781 5.06274M6.95596 5.01188L10 2M5.04404 9.50936C5.04404 9.50936 5.29568 7.23595 5.04404 6.98812M5.04404 6.98812C4.71759 6.66669 2.44219 6.93726 2.44219 6.93726M5.04404 6.98812L2 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],uh=[[`path`,{d:`M2.46186 20.4697C2.16896 20.7626 2.16896 21.2374 2.46186 21.5303C2.75475 21.8232 3.22962 21.8232 3.52252 21.5303L2.99219 21L2.46186 20.4697ZM10.0225 15.0303C10.3154 14.7374 10.3154 14.2626 10.0225 13.9697C9.72962 13.6768 9.25475 13.6768 8.96186 13.9697L9.49219 14.5L10.0225 15.0303ZM2.99219 21L3.52252 21.5303L10.0225 15.0303L9.49219 14.5L8.96186 13.9697L2.46186 20.4697L2.99219 21Z`,fill:`currentColor`,key:`0`}],[`path`,{d:`M21.5225 3.53033C21.8154 3.23744 21.8154 2.76256 21.5225 2.46967C21.2296 2.17678 20.7548 2.17678 20.4619 2.46967L20.9922 3L21.5225 3.53033ZM13.9619 8.96967C13.669 9.26256 13.669 9.73744 13.9619 10.0303C14.2548 10.3232 14.7296 10.3232 15.0225 10.0303L14.4922 9.5L13.9619 8.96967ZM20.9922 3L20.4619 2.46967L13.9619 8.96967L14.4922 9.5L15.0225 10.0303L21.5225 3.53033L20.9922 3Z`,fill:`currentColor`,key:`1`}],[`path`,{d:`M14.2688 5.00098C14.2688 5.00098 13.6464 9.10202 14.2688 9.72438C14.8911 10.3467 18.9922 9.72436 18.9922 9.72436`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M9.71561 19.001C9.71561 19.001 10.3379 14.8999 9.71558 14.2776C9.09323 13.6552 4.99219 14.2776 4.99219 14.2776`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],dh=[[`path`,{d:`M16 12H8`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}]],fh=[[`path`,{d:`M6.00449 12.5V12M18.0045 12.5V12M12.0045 12.5V12M7.00449 12.5C7.00449 11.9477 6.55677 11.5 6.00449 11.5C5.4522 11.5 5.00449 11.9477 5.00449 12.5C5.00449 13.0523 5.4522 13.5 6.00449 13.5C6.55677 13.5 7.00449 13.0523 7.00449 12.5ZM19.0045 12.5C19.0045 11.9477 18.5568 11.5 18.0045 11.5C17.4522 11.5 17.0045 11.9477 17.0045 12.5C17.0045 13.0523 17.4522 13.5 18.0045 13.5C18.5568 13.5 19.0045 13.0523 19.0045 12.5ZM13.0045 12.5C13.0045 11.9477 12.5568 11.5 12.0045 11.5C11.4522 11.5 11.0045 11.9477 11.0045 12.5C11.0045 13.0523 11.4522 13.5 12.0045 13.5C12.5568 13.5 13.0045 13.0523 13.0045 12.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],ph=[[`path`,{d:`M11.9967 12.5V12M11.9967 6.5V6M11.9967 18.5V18M12.9967 12.5C12.9967 11.9477 12.549 11.5 11.9967 11.5C11.4444 11.5 10.9967 11.9477 10.9967 12.5C10.9967 13.0523 11.4444 13.5 11.9967 13.5C12.549 13.5 12.9967 13.0523 12.9967 12.5ZM12.9967 6.5C12.9967 5.94772 12.549 5.5 11.9967 5.5C11.4444 5.5 10.9967 5.94772 10.9967 6.5C10.9967 7.05228 11.4444 7.5 11.9967 7.5C12.549 7.5 12.9967 7.05228 12.9967 6.5ZM12.9967 18.5C12.9967 17.9477 12.549 17.5 11.9967 17.5C11.4444 17.5 10.9967 17.9477 10.9967 18.5C10.9967 19.0523 11.4444 19.5 11.9967 19.5C12.549 19.5 12.9967 19.0523 12.9967 18.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],mh=[[`path`,{d:`M7 9.5C7 10.8807 5.88071 12 4.5 12C3.11929 12 2 10.8807 2 9.5C2 8.11929 3.11929 7 4.5 7C5.88071 7 7 8.11929 7 9.5ZM7 9.5V2C7.33333 2.5 7.6 4.6 10 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`circle`,{cx:`10.5`,cy:`19.5`,r:`2.5`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`20`,cy:`18`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M13 19.5L13 11C13 10.09 13 9.63502 13.2466 9.35248C13.4932 9.06993 13.9938 9.00163 14.9949 8.86504C18.0085 8.45385 20.2013 7.19797 21.3696 6.42937C21.6498 6.24509 21.7898 6.15295 21.8949 6.20961C22 6.26627 22 6.43179 22 6.76283V17.9259`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M13 13C17.8 13 21 10.6667 22 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],hh=[[`path`,{d:`M11.9922 8L11.9922 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.1172 15.75L11.9922 15.75M12.2422 15.75C12.2422 15.8881 12.1303 16 11.9922 16C11.8541 16 11.7422 15.8881 11.7422 15.75C11.7422 15.6119 11.8541 15.5 11.9922 15.5C12.1303 15.5 12.2422 15.6119 12.2422 15.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13.5067 2C14.733 2 15.3461 2 15.8974 2.22836C16.4487 2.45672 16.8823 2.89027 17.7494 3.75736L20.2346 6.24264C21.1017 7.10973 21.5353 7.54328 21.7636 8.09459C21.992 8.6459 21.992 9.25903 21.992 10.4853V13.5147C21.992 14.741 21.992 15.3541 21.7636 15.9054C21.5353 16.4567 21.1017 16.8903 20.2346 17.7574L17.7494 20.2426C16.8823 21.1097 16.4487 21.5433 15.8974 21.7716C15.3461 22 14.733 22 13.5067 22H10.4773C9.25105 22 8.63792 22 8.08659 21.7716C7.53527 21.5433 7.10172 21.1097 6.23462 20.2426L3.74948 17.7573C2.88242 16.8903 2.44889 16.4567 2.22054 15.9054C1.99219 15.3541 1.99219 14.741 1.99219 13.5148V10.4852C1.99219 9.259 1.99219 8.64589 2.22054 8.09458C2.44889 7.54328 2.88242 7.10974 3.74948 6.24265L6.23463 3.75743C7.10172 2.8903 7.53527 2.45674 8.08659 2.22837C8.63792 2 9.25105 2 10.4773 2H13.5067Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],gh=[[`path`,{d:`M21 11C21 7.22876 21 5.34315 19.8284 4.17157C18.6569 3 16.7712 3 13 3H11C7.22876 3 5.34315 3 4.17157 4.17157C3 5.34315 3 7.22876 3 11V13C3 16.7712 3 18.6569 4.17157 19.8284C5.34315 21 7.22876 21 11 21H13C16.7712 21 18.6569 21 19.8284 19.8284C21 18.6569 21 16.7712 21 13V11Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9 3V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M16 9L14.8918 9.87868C13.6306 10.8787 13 11.3787 13 12C13 12.6213 13.6306 13.1213 14.8918 14.1213L16 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],_h=[[`path`,{d:`M13 3H11C7.22876 3 5.34315 3 4.17157 4.17157C3 5.34315 3 7.22876 3 11V13C3 16.7712 3 18.6569 4.17157 19.8284C5.34315 21 7.22876 21 11 21H13C16.7712 21 18.6569 21 19.8284 19.8284C21 18.6569 21 16.7712 21 13V11C21 7.22876 21 5.34315 19.8284 4.17157C18.6569 3 16.7712 3 13 3Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9 3V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],vh=[[`path`,{d:`M18.1688 12L19.713 10.4558C21.4186 8.75022 21.4186 5.98485 19.713 4.27922C18.0073 2.57359 15.242 2.57359 13.5363 4.27922L4.27141 13.5442C2.56578 15.2498 2.56578 18.0152 4.27141 19.7208C5.97704 21.4264 8.7424 21.4264 10.448 19.7208L13.9224 16.2464C14.9884 15.1804 14.9884 13.4521 13.9224 12.386C12.8564 11.32 11.128 11.32 10.062 12.386L8.1318 14.3162`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],yh=[[`path`,{d:`M16.4249 4.60509L17.4149 3.6151C18.2351 2.79497 19.5648 2.79497 20.3849 3.6151C21.205 4.43524 21.205 5.76493 20.3849 6.58507L19.3949 7.57506M16.4249 4.60509L9.76558 11.2644C9.25807 11.772 8.89804 12.4078 8.72397 13.1041L8 16L10.8959 15.276C11.5922 15.102 12.228 14.7419 12.7356 14.2344L19.3949 7.57506M16.4249 4.60509L19.3949 7.57506`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18.9999 13.5C18.9999 16.7875 18.9999 18.4312 18.092 19.5376C17.9258 19.7401 17.7401 19.9258 17.5375 20.092C16.4312 21 14.7874 21 11.4999 21H11C7.22876 21 5.34316 21 4.17159 19.8284C3.00003 18.6569 3 16.7712 3 13V12.5C3 9.21252 3 7.56879 3.90794 6.46244C4.07417 6.2599 4.2599 6.07417 4.46244 5.90794C5.56879 5 7.21252 5 10.5 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],bh=[[`path`,{d:`M6 22V13.6944C6 12.1287 6 11.3459 6.21454 10.6077C6.42908 9.86948 6.84589 9.21812 7.6795 7.91542L10.3359 3.76419C11.0885 2.58806 11.4648 2 12 2C12.5352 2 12.9115 2.58806 13.6641 3.76419L16.3205 7.91542C17.1541 9.21812 17.5709 9.86948 17.7855 10.6077C18 11.3459 18 12.1287 18 13.6944V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 11C7.63152 11.3231 8.4887 11.9732 9.28009 11.9991C10.2988 12.0324 10.9868 11.1372 12 11.1372C13.0132 11.1372 13.7012 12.0324 14.7199 11.9991C15.5113 11.9732 16.3685 11.3231 17 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 12L12 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M10 5H14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],xh=[[`path`,{d:`M7.5 8C6.95863 8.1281 6.49932 8.14239 5.99268 8.45891C5.07234 9.03388 4.85108 9.71674 5.08821 10.7612C5.94028 14.5139 9.48599 18.0596 13.2388 18.9117C14.2834 19.1489 14.9661 18.928 15.5416 18.0077C15.8411 17.5288 15.8716 17.0081 16 16.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 7.79915C12.1776 7.77794 12.3182 7.74034 12.4295 7.68235C13.3997 7.17686 13.9291 5.53361 14.4498 4.60009C14.9311 3.73715 15.1718 3.30567 15.7379 3.10227C16.3041 2.89888 16.6448 3.02205 17.3262 3.26839C18.9197 3.8445 20.1555 5.08032 20.7316 6.6738C20.9779 7.35521 21.1011 7.69591 20.8977 8.26204C20.6943 8.82817 20.2628 9.06884 19.3999 9.55018C18.4608 10.074 16.7954 10.6108 16.2905 11.5898C16.2345 11.6983 16.1978 11.8327 16.1769 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M3 21L8 16`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M3 3L21 21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Sh=[[`path`,{d:`M3 21L8 16`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M13.2585 18.8714C9.51516 18.0215 5.97844 14.4848 5.12853 10.7415C4.99399 10.1489 4.92672 9.85266 5.12161 9.37197C5.3165 8.89129 5.55457 8.74255 6.03071 8.44509C7.10705 7.77265 8.27254 7.55888 9.48209 7.66586C11.1793 7.81598 12.0279 7.89104 12.4512 7.67048C12.8746 7.44991 13.1622 6.93417 13.7376 5.90269L14.4664 4.59604C14.9465 3.73528 15.1866 3.3049 15.7513 3.10202C16.316 2.89913 16.6558 3.02199 17.3355 3.26771C18.9249 3.84236 20.1576 5.07505 20.7323 6.66449C20.978 7.34417 21.1009 7.68401 20.898 8.2487C20.6951 8.8134 20.2647 9.05346 19.4039 9.53358L18.0672 10.2792C17.0376 10.8534 16.5229 11.1406 16.3024 11.568C16.0819 11.9955 16.162 12.8256 16.3221 14.4859C16.4399 15.7068 16.2369 16.88 15.5555 17.9697C15.2577 18.4458 15.1088 18.6839 14.6283 18.8786C14.1477 19.0733 13.8513 19.006 13.2585 18.8714Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Ch=[[`path`,{d:`M18.8906 12.846C18.5371 14.189 16.8667 15.138 13.5257 17.0361C10.296 18.8709 8.6812 19.7884 7.37983 19.4196C6.8418 19.2671 6.35159 18.9776 5.95624 18.5787C5 17.6139 5 15.7426 5 12C5 8.2574 5 6.3861 5.95624 5.42132C6.35159 5.02245 6.8418 4.73288 7.37983 4.58042C8.6812 4.21165 10.296 5.12907 13.5257 6.96393C16.8667 8.86197 18.5371 9.811 18.8906 11.154C19.0365 11.7084 19.0365 12.2916 18.8906 12.846Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],wh=[[`path`,{d:`M15.5 2V6M8.5 6V2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6.00446 7.61331C5.93719 6.74273 6.63957 6 7.53014 6H16.4699C17.3604 6 18.0628 6.74273 17.9955 7.61331L17.8117 9.99197C17.6796 11.7019 17.1011 13.3498 16.132 14.7773L15.5312 15.6622C14.9638 16.4979 14.0077 17 12.9838 17H11.0162C9.99228 17 9.03617 16.4979 8.46881 15.6622L7.86803 14.7773C6.89885 13.3498 6.32041 11.7019 6.18827 9.99197L6.00446 7.61331Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 17V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M11 9H13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Th=[[`path`,{d:`M11.9922 8.99988L9.49219 11.4999`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.9922 11.9999L12.4922 14.4999`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M4.99219 18.9999L2.99237 21.0002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M7.19135 9.52039L14.4716 16.8006`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M7.71255 10.0399L6.15251 11.6C5.32501 12.4275 4.86013 13.5498 4.86013 14.72C4.86013 14.8523 4.80343 14.9876 4.70894 15.1227C4.03073 16.0921 3.71818 17.2257 4.55476 18.0623L5.93031 19.4378C6.76675 20.2743 7.90038 19.9622 8.86953 19.2839C9.00474 19.1893 9.14021 19.1325 9.2726 19.1325C10.4429 19.1325 11.5652 18.6676 12.3927 17.8401L13.9527 16.2801L7.71255 10.0399Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M18.9922 2.99988L17.4072 4.84909C16.7965 5.56152 16.4912 5.91773 16.625 6.20881C16.7589 6.49988 17.2281 6.49988 18.1664 6.49988H18.5398C19.5813 6.49988 20.1021 6.49988 20.229 6.81109C20.3559 7.12229 19.9836 7.48644 19.2391 8.21474L17.4141 9.99988`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],Eh=[[`path`,{d:`M21 14C21 15.4001 21 16.1002 20.7275 16.635C20.4878 17.1054 20.1054 17.4878 19.635 17.7275C19.1002 18 18.4001 18 17 18H7C5.59987 18 4.8998 18 4.36502 17.7275C3.89462 17.4878 3.51217 17.1054 3.27248 16.635C3 16.1002 3 15.4001 3 14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6 14H18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M6 10H18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M6 6H18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Dh=[[`path`,{d:`M20.4879 15C19.2524 18.4956 15.9187 21 12 21C7.02943 21 3 16.9706 3 12C3 7.02943 7.02943 3 12 3C15.7292 3 18.9286 5.26806 20.2941 8.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M15 9H18C19.4142 9 20.1213 9 20.5607 8.56066C21 8.12132 21 7.41421 21 6V3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Oh=[[`path`,{d:`M3.04712 13C3.01082 12.6717 2.99219 12.338 2.99219 12C2.99219 7.02944 7.02162 3 11.9922 3C14.8195 3 17.3422 4.30367 18.9922 6.34267M20.9373 11C20.9736 11.3283 20.9922 11.662 20.9922 12C20.9922 16.9706 16.9628 21 11.9922 21C9.16492 21 6.64214 19.6963 4.99219 17.6573`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M15.9922 7H16.9922C18.4064 7 19.1135 7 19.5528 6.56066C19.9922 6.12132 19.9922 5.41421 19.9922 4V3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M7.99219 17H6.99219C5.57797 17 4.87087 17 4.43153 17.4393C3.99219 17.8787 3.99219 18.5858 3.99219 20V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],kh=[[`path`,{d:`M2.49219 15.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.49219 8.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2.49219 12C2.49219 7.52166 2.49219 5.28249 3.88343 3.89124C5.27467 2.5 7.51384 2.5 11.9922 2.5C16.4705 2.5 18.7097 2.5 20.1009 3.89124C21.4922 5.28249 21.4922 7.52166 21.4922 12C21.4922 16.4783 21.4922 18.7175 20.1009 20.1088C18.7097 21.5 16.4705 21.5 11.9922 21.5C7.51384 21.5 5.27467 21.5 3.88343 20.1088C2.49219 18.7175 2.49219 16.4783 2.49219 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],Ah=[[`path`,{d:`M17 17L21 21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19C15.4183 19 19 15.4183 19 11Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],jh=[[`path`,{d:`M21.0477 3.05293C18.8697 0.707363 2.48648 6.4532 2.50001 8.551C2.51535 10.9299 8.89809 11.6617 10.6672 12.1581C11.7311 12.4565 12.016 12.7625 12.2613 13.8781C13.3723 18.9305 13.9301 21.4435 15.2014 21.4996C17.2278 21.5892 23.1733 5.342 21.0477 3.05293Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.4999 12.5L14.9999 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Mh=[[`path`,{d:`M19 4H5C4.06812 4 3.60218 4 3.23463 4.15224C2.74458 4.35523 2.35523 4.74458 2.15224 5.23463C2 5.60218 2 6.06812 2 7C2 7.93188 2 8.39782 2.15224 8.76537C2.35523 9.25542 2.74458 9.64477 3.23463 9.84776C3.60218 10 4.06812 10 5 10H19C19.9319 10 20.3978 10 20.7654 9.84776C21.2554 9.64477 21.6448 9.25542 21.8478 8.76537C22 8.39782 22 7.93188 22 7C22 6.06812 22 5.60218 21.8478 5.23463C21.6448 4.74458 21.2554 4.35523 20.7654 4.15224C20.3978 4 19.9319 4 19 4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19 14H5C4.06812 14 3.60218 14 3.23463 14.1522C2.74458 14.3552 2.35523 14.7446 2.15224 15.2346C2 15.6022 2 16.0681 2 17C2 17.9319 2 18.3978 2.15224 18.7654C2.35523 19.2554 2.74458 19.6448 3.23463 19.8478C3.60218 20 4.06812 20 5 20H19C19.9319 20 20.3978 20 20.7654 19.8478C21.2554 19.6448 21.6448 19.2554 21.8478 18.7654C22 18.3978 22 17.9319 22 17C22 16.0681 22 15.6022 21.8478 15.2346C21.6448 14.7446 21.2554 14.3552 20.7654 14.1522C20.3978 14 19.9319 14 19 14Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M6.125 7H6M6.25 7C6.25 7.13807 6.13807 7.25 6 7.25C5.86193 7.25 5.75 7.13807 5.75 7C5.75 6.86193 5.86193 6.75 6 6.75C6.13807 6.75 6.25 6.86193 6.25 7Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M10.125 7H10M10.25 7C10.25 7.13807 10.1381 7.25 10 7.25C9.86193 7.25 9.75 7.13807 9.75 7C9.75 6.86193 9.86193 6.75 10 6.75C10.1381 6.75 10.25 6.86193 10.25 7Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M6.125 17H6M6.25 17C6.25 17.1381 6.13807 17.25 6 17.25C5.86193 17.25 5.75 17.1381 5.75 17C5.75 16.8619 5.86193 16.75 6 16.75C6.13807 16.75 6.25 16.8619 6.25 17Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M10.125 17H10M10.25 17C10.25 17.1381 10.1381 17.25 10 17.25C9.86193 17.25 9.75 17.1381 9.75 17C9.75 16.8619 9.86193 16.75 10 16.75C10.1381 16.75 10.25 16.8619 10.25 17Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],Nh=[[`path`,{d:`M21.3175 7.14139L20.8239 6.28479C20.4506 5.63696 20.264 5.31305 19.9464 5.18388C19.6288 5.05472 19.2696 5.15664 18.5513 5.36048L17.3311 5.70418C16.8725 5.80994 16.3913 5.74994 15.9726 5.53479L15.6357 5.34042C15.2766 5.11043 15.0004 4.77133 14.8475 4.37274L14.5136 3.37536C14.294 2.71534 14.1842 2.38533 13.9228 2.19657C13.6615 2.00781 13.3143 2.00781 12.6199 2.00781H11.5051C10.8108 2.00781 10.4636 2.00781 10.2022 2.19657C9.94085 2.38533 9.83106 2.71534 9.61149 3.37536L9.27753 4.37274C9.12465 4.77133 8.84845 5.11043 8.48937 5.34042L8.15249 5.53479C7.73374 5.74994 7.25259 5.80994 6.79398 5.70418L5.57375 5.36048C4.85541 5.15664 4.49625 5.05472 4.17867 5.18388C3.86109 5.31305 3.67445 5.63696 3.30115 6.28479L2.80757 7.14139C2.45766 7.74864 2.2827 8.05227 2.31666 8.37549C2.35061 8.69871 2.58483 8.95918 3.05326 9.48012L4.0843 10.6328C4.3363 10.9518 4.51521 11.5078 4.51521 12.0077C4.51521 12.5078 4.33636 13.0636 4.08433 13.3827L3.05326 14.5354C2.58483 15.0564 2.35062 15.3168 2.31666 15.6401C2.2827 15.9633 2.45766 16.2669 2.80757 16.8741L3.30114 17.7307C3.67443 18.3785 3.86109 18.7025 4.17867 18.8316C4.49625 18.9608 4.85542 18.8589 5.57377 18.655L6.79394 18.3113C7.25263 18.2055 7.73387 18.2656 8.15267 18.4808L8.4895 18.6752C8.84851 18.9052 9.12464 19.2442 9.2775 19.6428L9.61149 20.6403C9.83106 21.3003 9.94085 21.6303 10.2022 21.8191C10.4636 22.0078 10.8108 22.0078 11.5051 22.0078H12.6199C13.3143 22.0078 13.6615 22.0078 13.9228 21.8191C14.1842 21.6303 14.294 21.3003 14.5136 20.6403L14.8476 19.6428C15.0004 19.2442 15.2765 18.9052 15.6356 18.6752L15.9724 18.4808C16.3912 18.2656 16.8724 18.2055 17.3311 18.3113L18.5513 18.655C19.2696 18.8589 19.6288 18.9608 19.9464 18.8316C20.264 18.7025 20.4506 18.3785 20.8239 17.7307L21.3175 16.8741C21.6674 16.2669 21.8423 15.9633 21.8084 15.6401C21.7744 15.3168 21.5402 15.0564 21.0718 14.5354L20.0407 13.3827C19.7887 13.0636 19.6098 12.5078 19.6098 12.0077C19.6098 11.5078 19.7888 10.9518 20.0407 10.6328L21.0718 9.48012C21.5402 8.95918 21.7744 8.69871 21.8084 8.37549C21.8423 8.05227 21.6674 7.74864 21.3175 7.14139Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M15.5195 12C15.5195 13.933 13.9525 15.5 12.0195 15.5C10.0865 15.5 8.51953 13.933 8.51953 12C8.51953 10.067 10.0865 8.5 12.0195 8.5C13.9525 8.5 15.5195 10.067 15.5195 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}]],Ph=[[`path`,{d:`M11.9922 8L11.9922 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.1172 15.75L11.9922 15.75M12.2422 15.75C12.2422 15.8881 12.1303 16 11.9922 16C11.8541 16 11.7422 15.8881 11.7422 15.75C11.7422 15.6119 11.8541 15.5 11.9922 15.5C12.1303 15.5 12.2422 15.6119 12.2422 15.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M20.9922 11.1835V8.28041C20.9922 6.64041 20.9922 5.82041 20.5881 5.28541C20.184 4.75042 19.2703 4.49068 17.4429 3.97122C16.1944 3.61632 15.0938 3.18875 14.2145 2.79841C13.0156 2.26622 12.4161 2.00012 11.9922 2.00012C11.5682 2.00012 10.9688 2.26622 9.7699 2.79841C8.89057 3.18875 7.79002 3.61632 6.54152 3.97122C4.71411 4.49068 3.80041 4.75042 3.3963 5.28541C2.99219 5.82041 2.99219 6.64041 2.99219 8.28041V11.1835C2.99219 16.8086 8.05496 20.1836 10.5861 21.5195C11.1932 21.8399 11.4968 22.0001 11.9922 22.0001C12.4876 22.0001 12.7911 21.8399 13.3982 21.5195C15.9294 20.1836 20.9922 16.8086 20.9922 11.1835Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}]],Fh=[[`path`,{d:`M20.9922 11.1833V8.28029C20.9922 6.64029 20.9922 5.82028 20.5881 5.28529C20.184 4.75029 19.2703 4.49056 17.4429 3.9711C16.1944 3.6162 15.0938 3.18863 14.2145 2.79829C13.0156 2.2661 12.4161 2 11.9922 2C11.5682 2 10.9688 2.2661 9.7699 2.79829C8.89057 3.18863 7.79002 3.61619 6.54152 3.9711C4.71411 4.49056 3.80041 4.75029 3.3963 5.28529C2.99219 5.82028 2.99219 6.64029 2.99219 8.28029V11.1833C2.99219 16.8085 8.05496 20.1835 10.5861 21.5194C11.1932 21.8398 11.4968 22 11.9922 22C12.4876 22 12.7911 21.8398 13.3982 21.5194C15.9294 20.1835 20.9922 16.8085 20.9922 11.1833Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8.49219 11.8333C8.49219 11.8333 9.36719 11.8333 10.2422 13.5C10.2422 13.5 13.0216 9.33333 15.4922 8.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Ih=[[`path`,{d:`M20.5455 14C20.8286 13.133 20.9922 12.1945 20.9922 11.1833V8.28029C20.9922 6.64029 20.9922 5.82028 20.5881 5.28529C20.184 4.75029 19.2703 4.49056 17.4429 3.9711C16.1944 3.6162 15.0938 3.18863 14.2145 2.79829C13.0156 2.2661 12.4161 2 11.9922 2C11.5682 2 10.9688 2.2661 9.7699 2.79829C9.52703 2.9061 9.26727 3.01676 8.99219 3.12793`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M17.9922 18.1221C16.4419 19.7483 14.6235 20.8728 13.3982 21.5194C12.7911 21.8398 12.4876 22 11.9922 22C11.4968 22 11.1932 21.8398 10.5861 21.5194C8.05496 20.1836 2.99219 16.8085 2.99219 11.1834V8.28033C2.99219 6.64032 2.99219 5.82032 3.3963 5.28533C3.60583 5.00794 3.95235 4.80455 4.49219 4.60059`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M1.99219 2L21.9922 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}]],Lh=[[`path`,{d:`M9.5 9C9.5 7.61929 10.6193 6.5 12 6.5C13.3807 6.5 14.5 7.61929 14.5 9C14.5 9.85691 14.0689 10.6131 13.4117 11.0636C12.7283 11.5319 12 12.1716 12 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.125 16.25H12M12.25 16.25C12.25 16.3881 12.1381 16.5 12 16.5C11.8619 16.5 11.75 16.3881 11.75 16.25C11.75 16.1119 11.8619 16 12 16C12.1381 16 12.25 16.1119 12.25 16.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M18.7088 3.49534C16.8165 2.55382 14.5009 2 12 2C9.4991 2 7.1835 2.55382 5.29116 3.49534C4.36318 3.95706 3.89919 4.18792 3.4496 4.91378C3 5.63965 3 6.34248 3 7.74814V11.2371C3 16.9205 7.54236 20.0804 10.173 21.4338C10.9067 21.8113 11.2735 22 12 22C12.7265 22 13.0933 21.8113 13.8269 21.4338C16.4576 20.0804 21 16.9205 21 11.2371L21 7.74814C21 6.34249 21 5.63966 20.5504 4.91378C20.1008 4.18791 19.6368 3.95706 18.7088 3.49534Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Rh=[[`path`,{d:`M17 8L18.8398 9.85008C19.6133 10.6279 20 11.0168 20 11.5C20 11.9832 19.6133 12.3721 18.8398 13.1499L17 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 8L5.16019 9.85008C4.38673 10.6279 4 11.0168 4 11.5C4 11.9832 4.38673 12.3721 5.16019 13.1499L7 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M14.5 4L9.5 20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],zh=[[`path`,{d:`M15 2L15.5387 4.39157C15.9957 6.42015 17.5798 8.00431 19.6084 8.46127L22 9L19.6084 9.53873C17.5798 9.99569 15.9957 11.5798 15.5387 13.6084L15 16L14.4613 13.6084C14.0043 11.5798 12.4202 9.99569 10.3916 9.53873L8 9L10.3916 8.46127C12.4201 8.00431 14.0043 6.42015 14.4613 4.39158L15 2Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 12L7.38481 13.7083C7.71121 15.1572 8.84275 16.2888 10.2917 16.6152L12 17L10.2917 17.3848C8.84275 17.7112 7.71121 18.8427 7.38481 20.2917L7 22L6.61519 20.2917C6.28879 18.8427 5.15725 17.7112 3.70827 17.3848L2 17L3.70827 16.6152C5.15725 16.2888 6.28879 15.1573 6.61519 13.7083L7 12Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Bh=[[`path`,{d:`M7.99219 16L8.71615 13.1041C8.89023 12.4078 9.25026 11.772 9.75776 11.2644L16.4171 4.60509L17.4071 3.6151C18.2272 2.79497 19.557 2.79497 20.3771 3.6151C21.1972 4.43524 21.1972 5.76493 20.3771 6.58507L19.3871 7.57506L12.7277 14.2344C12.2202 14.7419 11.5843 15.102 10.888 15.276L7.99219 16Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18.9921 13.5C18.9921 16.7875 18.9921 18.4312 18.0842 19.5376C17.918 19.7401 17.7322 19.9258 17.5297 20.092C16.4234 21 14.7796 21 11.4921 21H10.9922C7.22095 21 5.33535 21 4.16378 19.8284C2.99222 18.6569 2.99219 16.7712 2.99219 13V12.5C2.99219 9.21252 2.99219 7.56879 3.90013 6.46244C4.06636 6.2599 4.25208 6.07417 4.45463 5.90794C5.56098 5 7.20471 5 10.4922 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Vh=[[`path`,{d:`M7.99219 16L15.9922 8`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.49219 12C2.49219 7.52166 2.49219 5.28249 3.88343 3.89124C5.27467 2.5 7.51384 2.5 11.9922 2.5C16.4705 2.5 18.7097 2.5 20.1009 3.89124C21.4922 5.28249 21.4922 7.52166 21.4922 12C21.4922 16.4783 21.4922 18.7175 20.1009 20.1088C18.7097 21.5 16.4705 21.5 11.9922 21.5C7.51384 21.5 5.27467 21.5 3.88343 20.1088C2.49219 18.7175 2.49219 16.4783 2.49219 12Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Hh=[[`path`,{d:`M7.49219 7.5L8.71873 8.55719C9.23437 9.00163 9.49219 9.22386 9.49219 9.5C9.49219 9.77614 9.23437 9.99836 8.71873 10.4428L7.49219 11.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.4922 12.5H15.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.9922 21C15.7419 21 17.6168 21 18.9311 20.0451C19.3556 19.7367 19.7289 19.3634 20.0373 18.9389C20.9922 17.6246 20.9922 15.7497 20.9922 12C20.9922 8.25027 20.9922 6.3754 20.0373 5.06107C19.7289 4.6366 19.3556 4.26331 18.9311 3.95491C17.6168 3 15.7419 3 11.9922 3C8.24246 3 6.36759 3 5.05326 3.95491C4.62879 4.26331 4.2555 4.6366 3.9471 5.06107C2.99219 6.3754 2.99219 8.25027 2.99219 12C2.99219 15.7497 2.99219 17.6246 3.9471 18.9389C4.2555 19.3634 4.62879 19.7367 5.05326 20.0451C6.36759 21 8.24246 21 11.9922 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Uh=[[`path`,{d:`M14.4961 2.00027H9.49609C8.66767 2.00027 7.99609 2.67184 7.99609 3.50027C7.99609 4.32869 8.66767 5.00027 9.49609 5.00027H14.4961C15.3245 5.00027 15.9961 4.32869 15.9961 3.50027C15.9961 2.67184 15.3245 2.00027 14.4961 2.00027Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M15.9961 3.50027C17.5496 3.54708 18.4761 3.72034 19.1174 4.36163C19.9961 5.24031 19.9961 6.6545 19.9961 9.4829L19.9961 15.9997C19.9961 18.8282 19.9961 20.2424 19.1174 21.1211C18.2387 21.9997 16.8245 21.9997 13.9961 21.9997L9.99609 21.9997C7.16767 21.9997 5.75346 21.9997 4.87478 21.1211C3.9961 20.2424 3.9961 18.8282 3.99609 15.9998L3.99611 9.48295C3.9961 6.65452 3.9961 5.2403 4.87478 4.36162C5.51606 3.72033 6.44261 3.54708 7.99599 3.50027`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M7.49609 11.0003L8.49609 12.0003L10.4961 9.50027`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M13.5 17.0003H16.5M13.5 11.0003H16.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M8.625 17.0003H8.5M8.75 17.0003C8.75 17.1383 8.63807 17.2503 8.5 17.2503C8.36193 17.2503 8.25 17.1383 8.25 17.0003C8.25 16.8622 8.36193 16.7503 8.5 16.7503C8.63807 16.7503 8.75 16.8622 8.75 17.0003Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],Wh=[[`path`,{d:`M3 3H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 15H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M3 21H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M3 9H16.5C18.9853 9 21 11.0147 21 13.5C21 15.9853 18.9853 18 16.5 18H12M12 18C12 17.1597 14.3932 15.5898 15 15M12 18C12 18.8403 14.3932 20.4102 15 21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Gh=[[`path`,{d:`M5 14L8.5 17.5L19 6.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Kh=[[`path`,{d:`M13.9248 21H10.0752C5.44476 21 3.12955 21 2.27636 19.4939C1.42317 17.9879 2.60736 15.9914 4.97574 11.9985L6.90057 8.75333C9.17559 4.91778 10.3131 3 12 3C13.6869 3 14.8244 4.91777 17.0994 8.75332L19.0243 11.9985C21.3926 15.9914 22.5768 17.9879 21.7236 19.4939C20.8704 21 18.5552 21 13.9248 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 9V13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],qh=[[`path`,{d:`M5.25 5L19.25 19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M22.25 12C22.25 6.47715 17.7728 2 12.25 2C6.72715 2 2.25 6.47715 2.25 12C2.25 17.5228 6.72715 22 12.25 22C17.7728 22 22.25 17.5228 22.25 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}]],Jh=[[`path`,{d:`M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Yh=[[`path`,{d:`M5.25 21H18.75C18.9822 21 19.0983 21 19.196 20.9904C20.1456 20.8968 20.8968 20.1456 20.9904 19.196C21 19.0983 21 18.9822 21 18.75C21 18.5178 21 18.4017 20.9904 18.304C20.8968 17.3544 20.1456 16.6032 19.196 16.5096C19.0983 16.5 18.9822 16.5 18.75 16.5H17.0607C16.8324 16.5 16.7182 16.5 16.6087 16.5121C16.2317 16.5538 15.8742 16.7018 15.5781 16.939C15.4921 17.0079 15.4114 17.0886 15.25 17.25C15.0886 17.4114 15.0079 17.4921 14.9219 17.561C14.6258 17.7982 14.2683 17.9462 13.8913 17.9879C13.7818 18 13.6676 18 13.4393 18H10.5607C10.3324 18 10.2182 18 10.1087 17.9879C9.73165 17.9462 9.37423 17.7982 9.07814 17.561C8.99213 17.4921 8.91142 17.4114 8.75 17.25C8.58858 17.0886 8.50787 17.0079 8.42186 16.939C8.12577 16.7018 7.76835 16.5538 7.3913 16.5121C7.28177 16.5 7.16763 16.5 6.93934 16.5H5.25C5.01783 16.5 4.90175 16.5 4.80397 16.5096C3.85441 16.6032 3.10315 17.3544 3.00963 18.304C3 18.4017 3 18.5178 3 18.75C3 18.9822 3 19.0983 3.00963 19.196C3.10315 20.1456 3.85441 20.8968 4.80397 20.9904C4.90175 21 5.01783 21 5.25 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16.5 7.49996C16.5 7.49996 13.1858 3.00001 12 3C10.8141 2.99999 7.5 7.5 7.5 7.5M12 4V15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Xh=[[`path`,{d:`M11 13.5C10.6446 13.5097 10.3134 13.5226 10.0008 13.5379C6.3 13.7193 3.28417 16.8058 3 20.5002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19.6709 16.2593C19.8803 16.6249 20 17.0485 20 17.5C20 17.9514 19.8804 18.3749 19.671 18.7404C19.2402 19.493 18.4293 20 17.5 20M15.3291 16.2593C15.1197 16.6249 15 17.0485 15 17.5C15 17.9514 15.1196 18.3749 15.329 18.7404C15.7598 19.493 16.5707 20 17.5 20M17.5 20L17.5 21.5M17.5 15C18.4292 15 19.24 15.5069 19.6709 16.2593M17.5 15C16.5708 15 15.76 15.5069 15.3291 16.2593M17.5 15L17.5 13.5M21 15.4998L19.6709 16.2593M14 19.4998L15.329 18.7404M21 19.4998L19.671 18.7404M14 15.4998L15.3291 16.2593`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`11`,cy:`6.5`,r:`4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Zh=[[`path`,{d:`M2 11C2 7.70017 2 6.05025 3.02513 5.02513C4.05025 4 5.70017 4 9 4H10C13.2998 4 14.9497 4 15.9749 5.02513C17 6.05025 17 7.70017 17 11V13C17 16.2998 17 17.9497 15.9749 18.9749C14.9497 20 13.2998 20 10 20H9C5.70017 20 4.05025 20 3.02513 18.9749C2 17.9497 2 16.2998 2 13V11Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M17 8.90585L17.1259 8.80196C19.2417 7.05623 20.2996 6.18336 21.1498 6.60482C22 7.02628 22 8.42355 22 11.2181V12.7819C22 15.5765 22 16.9737 21.1498 17.3952C20.2996 17.8166 19.2417 16.9438 17.1259 15.198L17 15.0941`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`11.5`,cy:`9.5`,r:`1.5`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],Qh=[[`path`,{d:`M2.00189 1.99988L21.9772 21.9999`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16.8516 16.8677C16.7224 17.8061 16.4665 18.4668 15.9595 18.9744C14.9356 19.9996 13.2877 19.9996 9.992 19.9996H8.99323C5.69749 19.9996 4.04961 19.9996 3.02575 18.9744C2.00189 17.9493 2.00189 16.2994 2.00189 12.9996V10.9996C2.00189 7.69971 2.00189 6.04979 3.02575 5.02466C3.36827 4.68172 3.78062 4.45351 4.30114 4.30164`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M8.23627 4.0004C8.47815 3.99988 8.72995 3.99988 8.99217 3.99988H9.99093C13.2867 3.99988 14.9346 3.99988 15.9584 5.02501C16.9822 6.05013 16.9822 7.70005 16.9822 10.9999V12.7573M16.9822 9.2313L19.3018 7.52901C20.7729 6.54061 21.4489 7.17184 21.6674 7.64835C22.1191 8.92801 21.9768 11.3935 21.9768 14.5416C21.8703 16.5549 21.5952 16.7718 21.3137 16.9938L21.3107 16.9961`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],$h=[[`path`,{d:`M17.0158 16.5V21.282C17.0158 21.6025 16.8064 21.874 16.5174 21.9663M17.0158 16.5L10.8772 12M17.0158 16.5V7.5M7.74691 9.7053L4.25118 7.03035C3.85429 6.72665 3.29466 6.76425 2.94169 7.11833L2.2921 7.76997C1.89399 8.16933 1.90433 8.81995 2.31494 9.20638L5.28343 12M7.74691 9.7053L10.8772 12M7.74691 9.7053L15.8129 2.19186C15.9453 2.06854 16.1193 2 16.3 2C16.3758 2 16.4488 2.01181 16.5174 2.0337M10.8772 12L17.0158 7.5M17.0158 7.5V2.71803C17.0158 2.39749 16.8064 2.126 16.5174 2.0337M7.74691 14.2947L4.25118 16.9696C3.85429 17.2733 3.29466 17.2357 2.94169 16.8817L2.2921 16.23C1.89399 15.8307 1.90433 15.18 2.31494 14.7936L5.28343 12M7.74691 14.2947L15.8129 21.8081C15.9453 21.9315 16.1193 22 16.3 22C16.3758 22 16.4488 21.9882 16.5174 21.9663M7.74691 14.2947L5.28343 12M16.5174 2.0337L21.4111 4.23506C21.7695 4.39626 22.0001 4.75353 22.0001 5.14752V18.8525C22.0001 19.2465 21.7695 19.6037 21.4111 19.7649L16.5174 21.9663`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],eg=[`shift`,`alt`,`meta`,`mod`,`ctrl`,`control`];function tg(){return typeof navigator>`u`?!1:/mac/i.test(navigator.userAgent)&&!/iphone|ipad|ipod/i.test(navigator.userAgent)}var ng={esc:`escape`,return:`enter`,left:`arrowleft`,right:`arrowright`,up:`arrowup`,down:`arrowdown`,ShiftLeft:`shift`,ShiftRight:`shift`,AltLeft:`alt`,AltRight:`alt`,MetaLeft:`meta`,MetaRight:`meta`,OSLeft:`meta`,OSRight:`meta`,ControlLeft:`ctrl`,ControlRight:`ctrl`};function rg(e){return(ng[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,``)}function ig(e){return eg.includes(e)}function ag(e,t=`,`){return e.toLowerCase().split(t)}function og(e,t=`+`,n=`>`,r=!1,i,a){let o=[],s=!1;e=e.trim(),e.includes(n)?(s=!0,o=e.toLocaleLowerCase().split(n).map(e=>rg(e))):o=e.toLocaleLowerCase().split(t).map(e=>rg(e));let c={alt:o.includes(`alt`),ctrl:o.includes(`ctrl`)||o.includes(`control`),shift:o.includes(`shift`),meta:o.includes(`meta`),mod:o.includes(`mod`),useKey:r},l=o.filter(e=>!eg.includes(e));return{...c,keys:l,description:i,isSequence:s,hotkey:e,metadata:a}}typeof document<`u`&&(document.addEventListener(`keydown`,e=>{e.code!==void 0&&ug([rg(e.code)])}),document.addEventListener(`keyup`,e=>{e.code!==void 0&&dg([rg(e.code)])})),typeof window<`u`&&(window.addEventListener(`blur`,()=>{sg.clear()}),window.addEventListener(`focus`,()=>{sg.clear()}),window.addEventListener(`contextmenu`,()=>{setTimeout(()=>{sg.clear()},0)})),typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{sg.clear()});var sg=new Set;function cg(e){return Array.isArray(e)}function lg(e,t=`,`){return(cg(e)?e:e.split(t)).every(e=>sg.has(e.trim().toLowerCase()))}function ug(e){let t=Array.isArray(e)?e:[e];sg.has(`meta`)&&sg.forEach(e=>{ig(e)||sg.delete(e.toLowerCase())}),t.forEach(e=>{sg.add(e.toLowerCase())})}function dg(e){e===`meta`?sg.clear():(Array.isArray(e)?e:[e]).forEach(e=>{sg.delete(e.toLowerCase())})}function fg(e,t,n){(typeof n==`function`&&n(e,t)||n===!0)&&e.preventDefault()}function pg(e,t,n){return typeof n==`function`?n(e,t):n===!0||n===void 0}var mg=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`];function hg(e){return gg(e,mg)}function gg(e,t=!1){let{target:n,composed:r}=e,i,a;return _g(n)&&r?(i=e.composedPath()[0]&&e.composedPath()[0].tagName,a=e.composedPath()[0]&&e.composedPath()[0].role):(i=n&&n.tagName,a=n&&n.role),cg(t)?!!(i&&t?.some(e=>e.toLowerCase()===i.toLowerCase()||e===a)):!!(i&&t&&t)}function _g(e){return!!e.tagName&&!e.tagName.startsWith(`-`)&&e.tagName.includes(`-`)}function vg(e,t){return e.length===0&&t?!1:!t||e.some(e=>t.includes(e))||e.includes(`*`)}var yg=(e,t,n=!1)=>{let{alt:r,meta:i,mod:a,shift:o,ctrl:s,keys:c,useKey:l}=t,{code:u,key:d,ctrlKey:f,metaKey:p,shiftKey:m,altKey:h}=e,g=rg(u),_=typeof e.getModifierState==`function`&&e.getModifierState(`AltGraph`);if(!l&&!c?.includes(g)&&![`ctrl`,`control`,`unknown`,`meta`,`alt`,`shift`,`os`].includes(g))return!1;if(!n){if(r!==h&&g!==`alt`||o!==m&&g!==`shift`)return!1;if(a){if(tg()?!p:!f)return!1}else if(i!==p&&g!==`meta`&&g!==`os`||s!==f&&g!==`ctrl`&&g!==`control`)return!1;if(_&&!r&&!s&&!a&&![`alt`,`ctrl`,`control`].includes(g))return!1}return l&&c?.length===1&&c.includes(d.toLowerCase())||c&&c.length===1&&c.includes(g)?!0:c&&c.length>0?c.includes(g)?lg(c):!1:!c||c.length===0},bg=(0,P.createContext)(void 0),xg=()=>(0,P.useContext)(bg);function Sg(e,t){return e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((n,r)=>n&&Sg(e[r],t[r]),!0):e===t}var Cg=(0,P.createContext)({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),wg=()=>(0,P.useContext)(Cg);function Tg(e){let t=(0,P.useRef)(void 0);return Sg(t.current,e)||(t.current=e),t.current}var Eg=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},Dg=typeof window<`u`?P.useLayoutEffect:P.useEffect;function Og(e){if(!e)return;let{enabled:t,preventDefault:n,ignoreEventWhen:r,...i}=e;return typeof t==`function`?i:{...i,enabled:t}}function kg(e,t,n,r){let[i,a]=(0,P.useState)(null),o=(0,P.useCallback)(e=>(a(e),()=>a(null)),[]),s=(0,P.useRef)(!1),c=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=cg(e)?e.join(c?.delimiter):e,u=Array.isArray(n)?n:Array.isArray(r)?r:void 0,d=(0,P.useCallback)(t,u??[]),f=(0,P.useRef)(d);f.current=u?d:t;let p=Tg(Og(c)),m=(0,P.useRef)(c?.enabled);m.current=c?.enabled;let h=(0,P.useRef)(c?.preventDefault);h.current=c?.preventDefault;let g=(0,P.useRef)(c?.ignoreEventWhen);g.current=c?.ignoreEventWhen;let{activeScopes:_}=wg(),v=xg();return Dg(()=>{if(m.current===!1||!vg(_,p?.scopes))return;let e=[],t,n=(n,r=!1)=>{if(!hg(n)||gg(n,p?.enableOnFormTags)){if(i!==null){let e=i.getRootNode();if((e instanceof Document||e instanceof ShadowRoot)&&e.activeElement!==i&&!i.contains(e.activeElement)){Eg(n);return}}n.target?.isContentEditable&&!p?.enableOnContentEditable||ag(l,p?.delimiter).forEach(i=>{if(i.includes(p?.splitKey??`+`)&&i.includes(p?.sequenceSplitKey??`>`)){console.warn(`Hotkey ${i} contains both ${p?.splitKey??`+`} and ${p?.sequenceSplitKey??`>`} which is not supported.`);return}let a=og(i,p?.splitKey,p?.sequenceSplitKey,p?.useKey,p?.description,p?.metadata);if(a.isSequence){t=setTimeout(()=>{e=[]},p?.sequenceTimeoutMs??1e3);let r=a.useKey?n.key:rg(n.code);if(ig(r.toLowerCase()))return;if(e.push(r),r!==a.keys?.[e.length-1]){e=[],t&&clearTimeout(t);return}e.length===a.keys?.length&&(f.current(n,a),t&&clearTimeout(t),e=[])}else if(yg(n,a,p?.ignoreModifiers)||a.keys?.includes(`*`)){if(g.current?.(n)||r&&s.current||(fg(n,a,h.current),!pg(n,a,m.current)))return;f.current(n,a),r||(s.current=!0)}})}},r=e=>{e.code!==void 0&&(ug(rg(e.code)),(p?.keydown===void 0&&p?.keyup!==!0||p?.keydown)&&n(e))},a=e=>{e.code!==void 0&&(dg(rg(e.code)),s.current=!1,p?.keyup&&n(e,!0))},o=i||c?.document||document;return o.addEventListener(`keyup`,a,c?.eventListenerOptions),o.addEventListener(`keydown`,r,c?.eventListenerOptions),v&&ag(l,p?.delimiter).forEach(e=>{v.addHotkey(og(e,p?.splitKey,p?.sequenceSplitKey,p?.useKey,p?.description,p?.metadata))}),()=>{o.removeEventListener(`keyup`,a,c?.eventListenerOptions),o.removeEventListener(`keydown`,r,c?.eventListenerOptions),v&&ag(l,p?.delimiter).forEach(e=>{v.removeHotkey(og(e,p?.splitKey,p?.sequenceSplitKey,p?.useKey,p?.description,p?.metadata))}),e=[],t&&clearTimeout(t)}},[i,p,_,l]),o}var Ag=e(n(((e,t)=>{var n=NaN,r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,c=typeof global==`object`&&global&&global.Object===Object&&global,l=typeof self==`object`&&self&&self.Object===Object&&self,u=c||l||Function(`return this`)(),d=Object.prototype.toString,f=Math.max,p=Math.min,m=function(){return u.Date.now()};function h(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,h=!0;if(typeof e!=`function`)throw TypeError(`Expected a function`);t=y(t)||0,g(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?f(y(n.maxWait)||0,t):a,h=`trailing`in n?!!n.trailing:h);function _(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function v(e){return l=e,s=setTimeout(S,t),u?_(e):o}function b(e){var n=e-c,r=e-l,i=t-n;return d?p(i,a-r):i}function x(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function S(){var e=m();if(x(e))return C(e);s=setTimeout(S,b(e))}function C(e){return s=void 0,h&&r?_(e):(r=i=void 0,o)}function w(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function T(){return s===void 0?o:C(m())}function E(){var e=m(),n=x(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return v(c);if(d)return s=setTimeout(S,t),_(c)}return s===void 0&&(s=setTimeout(S,t)),o}return E.cancel=w,E.flush=T,E}function g(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function _(e){return!!e&&typeof e==`object`}function v(e){return typeof e==`symbol`||_(e)&&d.call(e)==`[object Symbol]`}function y(e){if(typeof e==`number`)return e;if(v(e))return n;if(g(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=g(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(r,``);var c=a.test(e);return c||o.test(e)?s(e.slice(2),c?2:8):i.test(e)?n:+e}t.exports=h}))(),1),jg=typeof window<`u`?P.useLayoutEffect:P.useEffect;function Mg(e,t,n,r){let i=(0,P.useRef)(t);jg(()=>{i.current=t},[t]),(0,P.useEffect)(()=>{let t=n?.current??window;if(!(t&&t.addEventListener))return;let a=e=>{i.current(e)};return t.addEventListener(e,a,r),()=>{t.removeEventListener(e,a,r)}},[e,n,r])}function Ng(e){let t=(0,P.useRef)(()=>{throw Error(`Cannot call an event handler while rendering.`)});return jg(()=>{t.current=e},[e]),(0,P.useCallback)((...e)=>t.current?.call(t,...e),[t])}var Pg=typeof window>`u`;function Fg(e,t,n={}){let{initializeWithValue:r=!0}=n,i=(0,P.useCallback)(e=>n.serializer?n.serializer(e):JSON.stringify(e),[n]),a=(0,P.useCallback)(e=>{if(n.deserializer)return n.deserializer(e);if(e===`undefined`)return;let r=t instanceof Function?t():t,i;try{i=JSON.parse(e)}catch(e){return console.error(`Error parsing JSON:`,e),r}return i},[n,t]),o=(0,P.useCallback)(()=>{let n=t instanceof Function?t():t;if(Pg)return n;try{let t=window.localStorage.getItem(e);return t?a(t):n}catch(t){return console.warn(`Error reading localStorage key \u201C${e}\u201D:`,t),n}},[t,e,a]),[s,c]=(0,P.useState)(()=>r?o():t instanceof Function?t():t),l=Ng(t=>{Pg&&console.warn(`Tried setting localStorage key \u201C${e}\u201D even though environment is not a client`);try{let n=t instanceof Function?t(o()):t;window.localStorage.setItem(e,i(n)),c(n),window.dispatchEvent(new StorageEvent(`local-storage`,{key:e}))}catch(t){console.warn(`Error setting localStorage key \u201C${e}\u201D:`,t)}}),u=Ng(()=>{Pg&&console.warn(`Tried removing localStorage key \u201C${e}\u201D even though environment is not a client`);let n=t instanceof Function?t():t;window.localStorage.removeItem(e),c(n),window.dispatchEvent(new StorageEvent(`local-storage`,{key:e}))});(0,P.useEffect)(()=>{c(o())},[e]);let d=(0,P.useCallback)(t=>{t.key&&t.key!==e||c(o())},[e,o]);return Mg(`storage`,d),Mg(`local-storage`,d),[s,l,u]}function Ig(e){let t=(0,P.useRef)(e);t.current=e,(0,P.useEffect)(()=>()=>{t.current()},[])}function Lg(e,t=500,n){let r=(0,P.useRef)();Ig(()=>{r.current&&r.current.cancel()});let i=(0,P.useMemo)(()=>{let i=(0,Ag.default)(e,t,n),a=(...e)=>i(...e);return a.cancel=()=>{i.cancel()},a.isPending=()=>!!r.current,a.flush=()=>i.flush(),a},[e,t,n]);return(0,P.useEffect)(()=>{r.current=(0,Ag.default)(e,t,n)},[e,t,n]),i}function Rg(e,t,n){let r=n?.equalityFn??((e,t)=>e===t),i=e instanceof Function?e():e,[a,o]=(0,P.useState)(i),s=(0,P.useRef)(i),c=Lg(o,t,n);return r(s.current,i)||(c(i),s.current=i),[a,c]}function zg(e,t){return Q(n=>E9(n,e,t)?.name??``)}async function Bg(e,t){return await I(e,`projects.add`,{path:t})}async function Vg(e,t,n){await I(e,`projects.update`,{id:t,patch:n})}async function Hg(e,t){await I(e,`projects.remove`,{id:t})}async function Ug(e,t){await I(e,`projects.reorder`,{ids:t})}var Wg={computer:jm,laptop:Zm,server:Mh,cloud:cne,terminal:une,cpu:dne,home:Wm,office:ene},Gg=[`text-gray-600 dark:text-gray-400`,`text-red-600 dark:text-red-400`,`text-orange-600 dark:text-orange-400`,`text-amber-600 dark:text-amber-400`,`text-yellow-600 dark:text-yellow-400`,`text-lime-600 dark:text-lime-400`,`text-green-600 dark:text-green-400`,`text-emerald-600 dark:text-emerald-400`,`text-teal-600 dark:text-teal-400`,`text-cyan-600 dark:text-cyan-400`,`text-sky-600 dark:text-sky-400`,`text-blue-600 dark:text-blue-400`,`text-indigo-600 dark:text-indigo-400`,`text-violet-600 dark:text-violet-400`,`text-purple-600 dark:text-purple-400`,`text-fuchsia-600 dark:text-fuchsia-400`,`text-pink-600 dark:text-pink-400`,`text-rose-600 dark:text-rose-400`];function Kg(e){let t=Q(t=>E9(t,e.machine,e.projectId));return(0,F.jsx)(qg,{name:t?.name??``,logo:t?.logo??null,className:e.className})}function qg(e){let t=e.name.normalize(`NFKC`).trim(),n=t.match(/[\p{L}\p{N}]+/gu)??[],r=Array.from(n[0]??`P`),i=r.slice(1).find(e=>/\p{N}/u.test(e))??(n.length>1?Array.from(n.at(-1)??``)[0]:r.at(-1))??r[0],a=Array.from(`${r[0]}${i}`.toUpperCase()).slice(0,2).join(``),o=0;for(let e of t.toLowerCase())o=(o*31+(e.codePointAt(0)??0))%Gg.length;return(0,F.jsx)(`span`,{"aria-hidden":`true`,className:l(`inline-flex size-4 shrink-0 items-center justify-center`,e.className),children:e.logo===null?(0,F.jsx)(`svg`,{viewBox:`0 0 16 16`,className:l(`size-full overflow-hidden rounded-[25%] font-mono select-none`,Gg[o]),style:{backgroundColor:`color-mix(in srgb, currentColor 14%, transparent)`},children:(0,F.jsx)(`text`,{x:`8`,y:`10.8`,textAnchor:`middle`,fill:`currentColor`,fontSize:`8.25`,fontWeight:`700`,textLength:a.length===1?6:12,lengthAdjust:`spacingAndGlyphs`,children:a})}):(0,F.jsx)(`img`,{src:e.logo,alt:``,className:`size-full rounded-[25%] object-cover`})})}function Jg(e){switch(e.provider){case`claude`:return(0,F.jsx)(Xg,{className:e.className});case`codex`:return(0,F.jsx)(k,{icon:nne,className:e.className});case`opencode`:return(0,F.jsx)(Yg,{className:e.className})}}function Yg(e){return(0,F.jsxs)(`svg`,{viewBox:`0 0 240 300`,"aria-hidden":`true`,className:l(`fill-current`,e.className),children:[(0,F.jsx)(`path`,{d:`M180 240H60V120H180V240Z`,opacity:`0.4`}),(0,F.jsx)(`path`,{d:`M180 60H60V240H180V60ZM240 300H0V0H240V300Z`})]})}function Xg(e){return(0,F.jsx)(`svg`,{viewBox:`0 0 256 257`,preserveAspectRatio:`xMidYMid`,"aria-hidden":`true`,className:l(`fill-[#d97757]`,e.className),children:(0,F.jsx)(`path`,{d:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`})})}var Zg=Object.defineProperty,Qg=(e,t)=>Zg(e,`name`,{value:t,configurable:!0});function $g(e){let t=e+`CollectionProvider`,[n,r]=_(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Qg(e=>{let{scope:t,children:n}=e,r=P.useRef(null),a=P.useRef(new Map).current;return(0,F.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=O(s),l=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(s,n),o=p(t,i.collectionRef);return(0,F.jsx)(c,{ref:o,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=O(u),m=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),s=p(t,o),c=a(u,n);return P.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,F.jsx)(f,{[d]:``,ref:s,children:r})});m.displayName=u;function h(t){let n=a(e+`CollectionConsumer`,t);return P.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return Qg(h,`useCollection`),[{Provider:o,Slot:l,ItemSlot:m},h,r]}Qg($g,`createCollection`);var e_=new WeakMap,t_=class e extends Map{static{Qg(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],e_.set(this,!0)}set(e,t){return e_.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=r?this.size:this.size+1,a=i_(e),o=a>=0?Math.min(a,i-1):Math.max(i+a,0);if(r?this.#e.indexOf(t)===o:o===this.size)return this.set(t,n),this;let s=this.#e.filter(e=>e!==t);s.splice(o,0,t);let c=s.map(e=>[e,e===t?n:this.get(e)]);this.clear();for(let[e,t]of c)this.set(e,t);return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<r?r-1:r;return this.insert(a,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<=r?r:r+1;return this.insert(a,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=n_(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=n_(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return n_(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=0,a=n;for(let e of this)a=i===0&&!r?e:Reflect.apply(t,this,[a,e,i,this]),i++;return a}reduceRight(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=n;for(let e=this.size-1;e>=0;e--){let n=this.entryAt(e);i=e===this.size-1&&!r?n:Reflect.apply(t,this,[i,n,e,this])}return i}sort(e){if(typeof e!=`function`)throw TypeError(`OrderedDict.sort requires a compare function`);let t=[...this.entries()].sort(e);this.clear();for(let[e,n]of t)this.set(e,n);return this}toSorted(t){if(typeof t!=`function`)throw TypeError(`OrderedDict.toSorted requires a compare function`);let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e;for(let e of this.#e.slice(t,n))r.set(e,this.get(e));return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function n_(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=r_(e,t);return n===-1?void 0:e[n]}Qg(n_,`at`);function r_(e,t){let n=e.length,r=i_(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Qg(r_,`toSafeIndex`);function i_(e){return e!==e||e===0?0:Math.trunc(e)}Qg(i_,`toSafeInteger`);function a_(e){let t=e+`CollectionProvider`,[n,r]=_(t),[i,a]=n(t);i.displayName=e+`CollectionStableContextProvider`;let[o,s]=n(t);o.displayName=e+`CollectionStatefulContextProvider`;let c=Qg(({state:e,...t})=>e?(0,F.jsx)(u,{...t,state:e}):(0,F.jsx)(l,{...t}),`CollectionProvider`);c.displayName=t;let l=Qg(e=>{let t=y();return(0,F.jsx)(u,{...e,state:t})},`CollectionInit`);l.displayName=e+`CollectionInit`;let u=Qg(e=>{let{scope:t,children:n,state:r}=e,a=P.useRef(null),[s,c]=P.useState(null),l=p(a,c),[u,d]=r,f=P.useRef(new t_),m=P.useCallback(()=>{let e=f.current;return c_(e)||e.sort(l_),e},[]);return P.useEffect(()=>{if(!s)return;let e=u_(()=>{d(e=>{let t=e.toSorted(l_);return t.some(([t],n)=>e.keyAt(n)!==t)?t:e})});return e.observe(s,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[s,d]),(0,F.jsx)(i,{scope:t,collectionElementRef:l,collectionElementRefObject:a,getCollection:m,setCollection:d,registryRef:f,children:(0,F.jsx)(o,{scope:t,collectionElement:s,collection:u,children:n})})},`CollectionProviderImpl`);u.displayName=e+`CollectionProviderImpl`;let d=e+`CollectionSlot`,f=O(d),m=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(d,n),o=p(t,i.collectionElementRef);return(0,F.jsx)(f,{ref:o,children:r})});m.displayName=d;let h=e+`CollectionItemSlot`,g=O(h),v=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),{setCollection:s,registryRef:c}=a(h,n),l=P.useRef(i);o_(l.current,i)||(l.current=i);let u=l.current,d=P.useCallback(e=>{let t=c.current;e?t.set(e,{...l.current,element:e}):o.current&&t.delete(o.current)},[c]),f=p(t,d,o);b(()=>{let e=o.current,t=c.current;e&&t.has(e)&&t.set(e,{...u,element:e})},[u,c]);let m=P.useRef(null);return P.useEffect(()=>{let e=o.current,t=m.current;((t?.element??null)!==e||e&&t?.itemData!==u)&&(m.current=e?{element:e,itemData:u}:null,s(n=>{let r=new t_(n);return t&&t.element!==e&&r.delete(t.element),e&&r.set(e,{...u,element:e}),r.sort(l_)}))}),P.useEffect(()=>()=>{let e=m.current;m.current=null,e&&s(t=>{if(!t.has(e.element))return t;let n=new t_(t);return n.delete(e.element),n})},[s]),(0,F.jsx)(g,{"data-radix-collection-item":``,ref:f,children:r})});v.displayName=h;function y(){return P.useState(new t_)}Qg(y,`useInitCollection`);function x(t){let{collection:n}=s(e+`CollectionConsumer`,t);return n}Qg(x,`useCollection`);function S(t){let{getCollection:n}=a(e+`CollectionConsumer`,t);return n}return Qg(S,`useGetCollection`),[{Provider:c,Slot:m,ItemSlot:v},{createCollectionScope:r,useCollection:x,useGetCollection:S,useInitCollection:y}]}Qg(a_,`createCollection`);function o_(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}Qg(o_,`shallowEqual`);function s_(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Qg(s_,`isElementPreceding`);function c_(e){let t;for(let n of e.keys()){if(t){let e=t.compareDocumentPosition(n);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}Qg(c_,`isInDocumentOrder`);function l_(e,t){return!e[1].element||!t[1].element?0:s_(e[1].element,t[1].element)?-1:1}Qg(l_,`sortByDocumentPosition`);function u_(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}Qg(u_,`getChildListObserver`);var d_=Object.defineProperty,f_=(e,t)=>d_(e,`name`,{value:t,configurable:!0}),p_={LTR:`ltr`,RTL:`rtl`},m_=P.createContext(void 0);function h_(e){let t=P.useContext(m_);return e||t||p_.LTR}f_(h_,`useDirection`);var g_=Object.defineProperty,__=(e,t)=>g_(e,`name`,{value:t,configurable:!0}),[v_,gne]=_(`AlertDialog`,[et]),y_=et(),b_=__(e=>{let{__scopeAlertDialog:t,...n}=e,r=y_(t);return(0,F.jsx)(Re,{...r,...n,modal:!0})},`AlertDialog`),x_=P.forwardRef(__(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=y_(n);return(0,F.jsx)(Qe,{...i,...r,ref:t})},`AlertDialogTrigger`)),S_=__(e=>{let{__scopeAlertDialog:t,...n}=e,r=y_(t);return(0,F.jsx)(Be,{...r,...n})},`AlertDialogPortal`),C_=P.forwardRef(__(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=y_(n);return(0,F.jsx)(Ve,{...i,...r,ref:t})},`AlertDialogOverlay`)),[w_,T_]=v_(`AlertDialogContent`),E_=P.forwardRef(__(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=y_(n),o=P.useRef(null),s=p(t,o),c=P.useRef(null);return(0,F.jsx)(w_,{scope:n,cancelRef:c,children:(0,F.jsx)(qe,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),D_=P.forwardRef(__(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=y_(n);return(0,F.jsx)(Pe,{...i,...r,ref:t})},`AlertDialogTitle`)),O_=P.forwardRef(__(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=y_(n);return(0,F.jsx)(We,{...i,...r,ref:t})},`AlertDialogDescription`)),k_=P.forwardRef(__(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=y_(n);return(0,F.jsx)(ze,{...i,...r,ref:t})},`AlertDialogAction`)),A_=`AlertDialogCancel`,j_=P.forwardRef(__(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=T_(A_,n),a=y_(n),o=p(t,i);return(0,F.jsx)(ze,{...a,...r,ref:o})},`AlertDialogCancel`)),M_=Object.defineProperty,N_=(e,t)=>M_(e,`name`,{value:t,configurable:!0}),P_=!1;function F_(){let[e,t]=P.useState(P_);return P.useEffect(()=>{P_||(P_=!0,t(!0))},[]),e}N_(F_,`useIsHydrated`);var I_=P.useSyncExternalStore;function L_(){return()=>{}}N_(L_,`subscribe`);function R_(){return I_(L_,()=>!0,()=>!1)}N_(R_,`useIsHydratedModern`);var z_=typeof I_==`function`?R_:F_,B_=Object.defineProperty,V_=(e,t)=>B_(e,`name`,{value:t,configurable:!0}),H_=`rovingFocusGroup.onEntryFocus`,U_={bubbles:!1,cancelable:!0},W_=`RovingFocusGroup`,[G_,K_,q_]=$g(W_),[J_,Y_]=_(W_,[q_]),X_={Vertical:`vertical`,Horizontal:`horizontal`},Z_={LTR:`ltr`,RTL:`rtl`},[Q_,$_]=J_(W_),ev=P.forwardRef(V_(function(e,t){return(0,F.jsx)(G_.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,F.jsx)(G_.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,F.jsx)(tv,{...e,ref:t})})})},`RovingFocusGroup`)),tv=P.forwardRef(V_(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=P.useRef(null),m=p(t,f),_=h_(a),[v,b]=h({prop:o,defaultProp:s??null,onChange:c,caller:W_}),[x,S]=P.useState(!1),w=y(l),T=K_(n),E=P.useRef(!1),[D,O]=P.useState(0);return P.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(H_,w),()=>e.removeEventListener(H_,w)},[w]),(0,F.jsx)(Q_,{scope:n,orientation:r,dir:_,loop:i,currentTabStopId:v,onItemFocus:P.useCallback(e=>b(e),[b]),onItemShiftTab:P.useCallback(()=>S(!0),[]),onFocusableItemAdd:P.useCallback(()=>O(e=>e+1),[]),onFocusableItemRemove:P.useCallback(()=>O(e=>e-1),[]),children:(0,F.jsx)(g.div,{tabIndex:x||D===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:`none`,...e.style},onMouseDown:C(e.onMouseDown,()=>{E.current=!0}),onFocus:C(e.onFocus,e=>{let t=!E.current;if(e.target===e.currentTarget&&t&&!x){let t=new CustomEvent(H_,U_);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);sv([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),u)}}E.current=!1}),onBlur:C(e.onBlur,()=>S(!1))})})},`RovingFocusGroupImpl`)),nv=`RovingFocusGroupItem`,rv=P.forwardRef(V_(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=D(),l=a||c,u=$_(nv,n),d=u.currentTabStopId===l,f=K_(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,_=z_();return b(()=>{if(_&&r)return p(),()=>m()},[_,r,p,m]),P.useEffect(()=>{if(!_&&r)return p(),()=>m()},[_,r,p,m]),(0,F.jsx)(G_.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,F.jsx)(g.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:C(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:C(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:C(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ov(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?cv(n,r+1):n.slice(r+1)}setTimeout(()=>sv(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),iv={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function av(e,t){return t===Z_.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}V_(av,`getDirectionAwareKey`);function ov(e,t,n){let r=av(e.key,n);if(!(t===X_.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===X_.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return iv[r]}V_(ov,`getFocusIntent`);function sv(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}V_(sv,`focusFirst`);function cv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}V_(cv,`wrapArray`);var lv=Object.defineProperty,uv=(e,t)=>lv(e,`name`,{value:t,configurable:!0}),dv={LTR:`ltr`,RTL:`rtl`},fv=[`Enter`,` `],pv=[`ArrowDown`,`PageUp`,`Home`],mv=[`ArrowUp`,`PageDown`,`End`],hv=[...pv,...mv],gv={ltr:[...fv,`ArrowRight`],rtl:[...fv,`ArrowLeft`]},_v={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},vv=`Menu`,[yv,bv,xv]=$g(vv),[Sv,Cv]=_(vv,[xv,Te,Y_]),wv=Te(),Tv=Y_(),[Ev,Dv]=Sv(vv),[Ov,kv]=Sv(vv),Av=uv(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=wv(t),[c,l]=P.useState(null),u=P.useRef(!1),d=y(a),f=h_(i);return P.useEffect(()=>{let e=uv(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=uv(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),P.useEffect(()=>{if(!n)return;let e=uv(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,F.jsx)(Oe,{...s,children:(0,F.jsx)(Ev,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,F.jsx)(Ov,{scope:t,onClose:P.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),jv=P.forwardRef(uv(function(e,t){let{__scopeMenu:n,...r}=e,i=wv(n);return(0,F.jsx)(ke,{...i,...r,ref:t})},`MenuAnchor`)),Mv=`MenuPortal`,[Nv,Pv]=Sv(Mv,{forceMount:void 0}),Fv=uv(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Dv(Mv,t);return(0,F.jsx)(Nv,{scope:t,forceMount:n,children:(0,F.jsx)(m,{present:n||a.open,children:(0,F.jsx)(x,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Iv=`MenuContent`,[Lv,Rv]=Sv(Iv),zv=P.forwardRef(uv(function(e,t){let n=Pv(Iv,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Dv(Iv,e.__scopeMenu),o=kv(Iv,e.__scopeMenu);return(0,F.jsx)(yv.Provider,{scope:e.__scopeMenu,children:(0,F.jsx)(m,{present:r||a.open,children:(0,F.jsx)(yv.Slot,{scope:e.__scopeMenu,children:o.modal?(0,F.jsx)(Bv,{...i,ref:t}):(0,F.jsx)(Vv,{...i,ref:t})})})})},`MenuContent`)),Bv=P.forwardRef(uv(function(e,t){let n=Dv(Iv,e.__scopeMenu),r=P.useRef(null),i=p(t,r);return P.useEffect(()=>{let e=r.current;if(e)return Ie(e)},[]),(0,F.jsx)(Uv,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:C(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Vv=P.forwardRef(uv(function(e,t){let n=Dv(Iv,e.__scopeMenu);return(0,F.jsx)(Uv,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Hv=O(`MenuContent.ScrollLock`),Uv=P.forwardRef(uv(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,..._}=e,y=Dv(Iv,n),b=kv(Iv,n),x=wv(n),E=Tv(n),D=bv(n),[O,k]=P.useState(null),A=P.useRef(null),[j,M]=P.useState(null);f(j);let{nodes:N,registry:ee}=S(),te=!!(i||g),ne=p(t,A,y.onContentChange,M),re=P.useRef(0),ie=P.useRef(``),ae=P.useRef(0),oe=P.useRef(null),se=P.useRef(`right`),ce=P.useRef(0),le=P.useMemo(()=>g?[A,...N.map(e=>({current:e}))]:[],[A,N,g]),ue=g?$e:P.Fragment,de=g?{as:Hv,allowPinchZoom:!0,shards:le}:void 0,fe=uv(e=>{let t=ie.current+e,n=D().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=by(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){ie.current=e,window.clearTimeout(re.current),e!==``&&(re.current=window.setTimeout(()=>s(``),1e3))}uv(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);P.useEffect(()=>()=>window.clearTimeout(re.current),[]),Ne();let pe=P.useCallback(e=>se.current===oe.current?.side&&Sy(e,oe.current?.area),[]);return(0,F.jsx)(Lv,{scope:n,searchRef:ie,onItemEnter:P.useCallback(e=>{pe(e)&&e.preventDefault()},[pe]),onItemLeave:P.useCallback(e=>{pe(e)||(A.current?.focus(),k(null))},[pe]),onTriggerLeave:P.useCallback(e=>{pe(e)&&e.preventDefault()},[pe]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:P.useCallback(e=>{oe.current=e},[]),children:(0,F.jsx)(v,{registry:te?ee:null,children:(0,F.jsx)(ue,{...de,children:(0,F.jsx)(w,{asChild:!0,trapped:i,branches:N,onMountAutoFocus:C(a,e=>{e.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,F.jsx)(T,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:m,onDismiss:h,children:(0,F.jsx)(ev,{asChild:!0,...E,dir:b.dir,orientation:`vertical`,loop:r,currentTabStopId:O,onCurrentTabStopIdChange:k,onEntryFocus:C(c,e=>{b.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,F.jsx)(De,{role:`menu`,"aria-orientation":`vertical`,"data-state":hy(y.open),"data-radix-menu-content":``,dir:b.dir,...x,..._,ref:ne,style:{outline:`none`,..._.style},onKeyDown:C(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&fe(e.key));let i=A.current;if(e.target!==i||!hv.includes(e.key))return;e.preventDefault();let a=D().filter(e=>!e.disabled).map(e=>e.ref.current);mv.includes(e.key)&&a.reverse(),vy(a)}),onBlur:C(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(re.current),ie.current=``)}),onPointerMove:C(e.onPointerMove,Cy(e=>{let t=e.target,n=ce.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>ce.current?`right`:`left`;se.current=t,ce.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Wv=P.forwardRef(uv(function(e,t){let{__scopeMenu:n,...r}=e;return(0,F.jsx)(g.div,{role:`group`,...r,ref:t})},`MenuGroup`)),Gv=P.forwardRef(uv(function(e,t){let{__scopeMenu:n,...r}=e;return(0,F.jsx)(g.div,{...r,ref:t})},`MenuLabel`)),Kv=`MenuItem`,qv=`menu.itemSelect`,Jv=P.forwardRef(uv(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=P.useRef(null),o=kv(Kv,e.__scopeMenu),s=Rv(Kv,e.__scopeMenu),c=p(t,a),l=P.useRef(!1),u=uv(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(qv,{bubbles:!0,cancelable:!0});e.addEventListener(qv,e=>r?.(e),{once:!0}),d(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,F.jsx)(Yv,{...i,ref:c,disabled:n,onClick:C(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:C(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:C(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&fv.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Yv=P.forwardRef(uv(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Rv(Kv,n),s=Tv(n),c=P.useRef(null),l=p(t,c),[u,d]=P.useState(!1),[f,m]=P.useState(``);return P.useEffect(()=>{let e=c.current;e&&m((e.textContent??``).trim())},[a.children]),(0,F.jsx)(yv.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,F.jsx)(rv,{asChild:!0,...s,focusable:!r,children:(0,F.jsx)(g.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:C(e.onPointerMove,Cy(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:C(e.onPointerLeave,Cy(e=>o.onItemLeave(e))),onFocus:C(e.onFocus,()=>d(!0)),onBlur:C(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),Xv=P.forwardRef(uv(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,F.jsx)(ry,{scope:e.__scopeMenu,checked:n,children:(0,F.jsx)(Jv,{role:`menuitemcheckbox`,"aria-checked":gy(n)?`mixed`:n,...i,ref:t,"data-state":_y(n),onSelect:C(i.onSelect,()=>r?.(gy(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[Zv,Qv]=Sv(`MenuRadioGroup`,{value:void 0,onValueChange:uv(()=>{},`onValueChange`)}),$v=P.forwardRef(uv(function(e,t){let{value:n,onValueChange:r,...i}=e,a=y(r);return(0,F.jsx)(Zv,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,F.jsx)(Wv,{...i,ref:t})})},`MenuRadioGroup`)),ey=`MenuRadioItem`,ty=P.forwardRef(uv(function(e,t){let{value:n,...r}=e,i=Qv(ey,e.__scopeMenu),a=n===i.value;return(0,F.jsx)(ry,{scope:e.__scopeMenu,checked:a,children:(0,F.jsx)(Jv,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":_y(a),onSelect:C(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),ny=`MenuItemIndicator`,[ry,iy]=Sv(ny,{checked:!1}),ay=P.forwardRef(uv(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=iy(ny,n);return(0,F.jsx)(m,{present:r||gy(a.checked)||a.checked===!0,children:(0,F.jsx)(g.span,{...i,ref:t,"data-state":_y(a.checked)})})},`MenuItemIndicator`)),oy=P.forwardRef(uv(function(e,t){let{__scopeMenu:n,...r}=e;return(0,F.jsx)(g.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),sy=`MenuSub`,[cy,ly]=Sv(sy),uy=uv(e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Dv(sy,t),o=wv(t),[s,c]=P.useState(null),[l,u]=P.useState(null),d=y(i);return P.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,F.jsx)(Oe,{...o,children:(0,F.jsx)(Ev,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,F.jsx)(cy,{scope:t,contentId:D(),triggerId:D(),trigger:s,onTriggerChange:c,children:n})})})},`MenuSub`),dy=`MenuSubTrigger`,fy=P.forwardRef(uv(function(e,t){let n=Dv(dy,e.__scopeMenu),r=kv(dy,e.__scopeMenu),i=ly(dy,e.__scopeMenu),a=Rv(dy,e.__scopeMenu),o=P.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=P.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);P.useEffect(()=>u,[u]),P.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=p(t,i.onTriggerChange);return(0,F.jsx)(jv,{asChild:!0,...l,children:(0,F.jsx)(Yv,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":hy(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:C(e.onPointerMove,Cy(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:C(e.onPointerLeave,Cy(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:C(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(a.searchRef.current===``||t.key!==` `)&&gv[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})},`MenuSubTrigger`)),py=`MenuSubContent`,my=P.forwardRef(uv(function(e,t){let n=Pv(Iv,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=Dv(Iv,e.__scopeMenu),s=kv(Iv,e.__scopeMenu),c=ly(py,e.__scopeMenu),l=P.useRef(null),u=p(t,l);return(0,F.jsx)(yv.Provider,{scope:e.__scopeMenu,children:(0,F.jsx)(m,{present:r||o.open,children:(0,F.jsx)(yv.Slot,{scope:e.__scopeMenu,children:(0,F.jsx)(Uv,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===dv.RTL?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:C(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:C(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:C(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=_v[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})},`MenuSubContent`));function hy(e){return e?`open`:`closed`}uv(hy,`getOpenState`);function gy(e){return e===`indeterminate`}uv(gy,`isIndeterminate`);function _y(e){return gy(e)?`indeterminate`:e?`checked`:`unchecked`}uv(_y,`getCheckedState`);function vy(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}uv(vy,`focusFirst`);function yy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}uv(yy,`wrapArray`);function by(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=yy(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}uv(by,`getNextMatch`);function xy(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}uv(xy,`isPointInPolygon`);function Sy(e,t){return t?xy({x:e.clientX,y:e.clientY},t):!1}uv(Sy,`isPointerInGraceArea`);function Cy(e){return t=>t.pointerType===`mouse`?e(t):void 0}uv(Cy,`whenMouse`);var wy=Object.defineProperty,Ty=(e,t)=>wy(e,`name`,{value:t,configurable:!0}),Ey=`ContextMenu`,[Dy,_ne]=_(Ey,[Cv]),Oy=Cv(),[ky,Ay]=Dy(Ey),jy=Ty(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=P.useRef(!1),[c,l]=h({prop:i,defaultProp:!1,onChange:r,caller:Ey}),u=Oy(t);return(0,F.jsx)(ky,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,F.jsx)(Av,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),My=`ContextMenuTrigger`,Ny=P.forwardRef(Ty(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Ay(My,n),o=Oy(n),[s,c]=P.useState({x:0,y:0}),l=P.useMemo(()=>({current:{getBoundingClientRect:Ty(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=P.useRef(0),d=P.useCallback(()=>window.clearTimeout(u.current),[]),f=Ty(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return P.useEffect(()=>d,[d]),P.useEffect(()=>void(r&&d()),[r,d]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(jv,{...o,virtualRef:l}),(0,F.jsx)(g.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:C(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:C(e.onPointerDown,Ky(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:C(e.onPointerMove,Ky(d)),onPointerCancel:r?e.onPointerCancel:C(e.onPointerCancel,Ky(d)),onPointerUp:r?e.onPointerUp:C(e.onPointerUp,Ky(d))})]})},`ContextMenuTrigger`)),Py=Ty(e=>{let{__scopeContextMenu:t,...n}=e,r=Oy(t);return(0,F.jsx)(Fv,{...r,...n})},`ContextMenuPortal`),Fy=`ContextMenuContent`,Iy=P.forwardRef(Ty(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Ay(Fy,n),a=Oy(n),o=P.useRef(!1);return(0,F.jsx)(zv,{...a,side:`right`,sideOffset:2,align:`start`,...r,ref:t,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),Ly=P.forwardRef(Ty(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Oy(n);return(0,F.jsx)(Jv,{...i,...r,ref:t})},`ContextMenuItem`)),Ry=P.forwardRef(Ty(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Oy(n);return(0,F.jsx)($v,{...i,...r,ref:t})},`ContextMenuRadioGroup`)),zy=P.forwardRef(Ty(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Oy(n);return(0,F.jsx)(ty,{...i,...r,ref:t})},`ContextMenuRadioItem`)),By=P.forwardRef(Ty(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Oy(n);return(0,F.jsx)(ay,{...i,...r,ref:t})},`ContextMenuItemIndicator`)),Vy=P.forwardRef(Ty(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Oy(n);return(0,F.jsx)(oy,{...i,...r,ref:t})},`ContextMenuSeparator`)),Hy=`ContextMenuSub`,Uy=Ty(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Oy(t),[s,c]=h({prop:i,defaultProp:a??!1,onChange:r,caller:Hy});return(0,F.jsx)(uy,{...o,open:s,onOpenChange:c,children:n})},`ContextMenuSub`),Wy=P.forwardRef(Ty(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Oy(n);return(0,F.jsx)(fy,{...i,...r,ref:t})},`ContextMenuSubTrigger`)),Gy=P.forwardRef(Ty(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Oy(n);return(0,F.jsx)(my,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuSubContent`));function Ky(e){return t=>t.pointerType===`mouse`?void 0:e(t)}Ty(Ky,`whenTouchOrPen`);var qy=Object.defineProperty,Jy=(e,t)=>qy(e,`name`,{value:t,configurable:!0}),Yy=`DropdownMenu`,[Xy,vne]=_(Yy,[Cv]),Zy=Cv(),[Qy,$y]=Xy(Yy),eb=Jy(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Zy(t),l=P.useRef(null),[u,d]=h({prop:i,defaultProp:a??!1,onChange:o,caller:Yy});return(0,F.jsx)(Qy,{scope:t,triggerId:D(),triggerRef:l,contentId:D(),open:u,onOpenChange:d,onOpenToggle:P.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,F.jsx)(Av,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),tb=`DropdownMenuTrigger`,nb=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=$y(tb,n),o=Zy(n),s=p(t,a.triggerRef);return(0,F.jsx)(jv,{asChild:!0,...o,children:(0,F.jsx)(g.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:C(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:C(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),rb=Jy(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Zy(t);return(0,F.jsx)(Fv,{...r,...n})},`DropdownMenuPortal`),ib=`DropdownMenuContent`,ab=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=$y(ib,n),a=Zy(n),o=P.useRef(!1);return(0,F.jsx)(zv,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:C(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:C(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),ob=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zy(n);return(0,F.jsx)(Gv,{...i,...r,ref:t})},`DropdownMenuLabel`)),sb=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zy(n);return(0,F.jsx)(Jv,{...i,...r,ref:t})},`DropdownMenuItem`)),cb=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zy(n);return(0,F.jsx)(Xv,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),lb=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zy(n);return(0,F.jsx)($v,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),ub=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zy(n);return(0,F.jsx)(ty,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),db=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zy(n);return(0,F.jsx)(ay,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),fb=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zy(n);return(0,F.jsx)(oy,{...i,...r,ref:t})},`DropdownMenuSeparator`)),pb=Jy(e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Zy(t),[s,c]=h({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,F.jsx)(uy,{...o,open:s,onOpenChange:c,children:n})},`DropdownMenuSub`),mb=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zy(n);return(0,F.jsx)(fy,{...i,...r,ref:t})},`DropdownMenuSubTrigger`)),hb=P.forwardRef(Jy(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zy(n);return(0,F.jsx)(my,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuSubContent`)),gb=Object.defineProperty,_b=P.forwardRef(((e,t)=>gb(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,F.jsx)(g.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),vb=e(u(),1),yb=Object.defineProperty,bb=(e,t)=>yb(e,`name`,{value:t,configurable:!0});function xb(e,[t,n]){return Math.min(n,Math.max(t,e))}bb(xb,`clamp`);var Sb=Object.defineProperty,Cb=(e,t)=>Sb(e,`name`,{value:t,configurable:!0}),wb=`Popover`,[Tb,yne]=_(wb,[Te]),Eb=Te(),[Db,Ob]=Tb(wb),kb=Cb(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Eb(t),c=P.useRef(null),[l,u]=P.useState(!1),[d,f]=P.useState(0),[p,m]=P.useState(0),[g,_]=h({prop:r,defaultProp:i??!1,onChange:a,caller:wb});return(0,F.jsx)(Oe,{...s,children:(0,F.jsx)(Db,{scope:t,contentId:D(),titleId:D(),descriptionId:D(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:g,onOpenChange:_,onOpenToggle:P.useCallback(()=>_(e=>!e),[_]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),Ab=`PopoverTrigger`,jb=P.forwardRef(Cb(function(e,t){let{__scopePopover:n,...r}=e,i=Ob(Ab,n),a=Eb(n),o=p(t,i.triggerRef),s=(0,F.jsx)(g.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Wb(i.open),...r,ref:o,onClick:C(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,F.jsx)(ke,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Mb=`PopoverPortal`,[Nb,Pb]=Tb(Mb,{forceMount:void 0}),Fb=Cb(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Ob(Mb,t);return(0,F.jsx)(Nb,{scope:t,forceMount:n,children:(0,F.jsx)(m,{present:n||a.open,children:(0,F.jsx)(x,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Ib=`PopoverContent`,Lb=P.forwardRef(Cb(function(e,t){let n=Pb(Ib,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Ob(Ib,e.__scopePopover);return(0,F.jsx)(m,{present:r||a.open,children:a.modal?(0,F.jsx)(zb,{...i,ref:t}):(0,F.jsx)(Bb,{...i,ref:t})})},`PopoverContent`)),Rb=O(`PopoverContent.RemoveScroll`),zb=P.forwardRef(Cb(function(e,t){let n=Ob(Ib,e.__scopePopover),r=P.useRef(null),i=p(t,r),a=P.useRef(!1),{nodes:o,registry:s}=S();return P.useEffect(()=>{let e=r.current;if(e)return Ie(e)},[]),(0,F.jsx)($e,{as:Rb,allowPinchZoom:!0,shards:P.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,F.jsx)(Vb,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:C(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:C(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:C(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Bb=P.forwardRef(Cb(function(e,t){let n=Ob(Ib,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return(0,F.jsx)(Vb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Vb=P.forwardRef(Cb(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":d,branchNodes:m,branchRegistry:h,...g}=e,_=Ob(Ib,n),y=Eb(n),[b,x]=P.useState(null),S=p(t,x);return f(b),Ne(),(0,F.jsx)(v,{registry:h,children:(0,F.jsx)(w,{asChild:!0,loop:!0,trapped:r,branches:m,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,F.jsx)(T,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>_.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,F.jsx)(De,{"data-state":Wb(_.open),role:`dialog`,id:_.contentId,"aria-labelledby":_.titlePresent?_.titleId:void 0,"aria-describedby":_.descriptionPresent?Gb(d,_.descriptionId):d,...y,...g,ref:S,style:{...g.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`)),Hb=`PopoverClose`,Ub=P.forwardRef(Cb(function(e,t){let{__scopePopover:n,...r}=e,i=Ob(Hb,n);return(0,F.jsx)(g.button,{type:`button`,...r,ref:t,onClick:C(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function Wb(e){return e?`open`:`closed`}Cb(Wb,`getState`);function Gb(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Cb(Gb,`concatAriaDescribedby`);var Kb=Object.defineProperty,qb=(e,t)=>Kb(e,`name`,{value:t,configurable:!0}),Jb={ItemAligned:`item-aligned`,Popper:`popper`},Yb={LTR:`ltr`,RTL:`rtl`},Xb=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Zb=[` `,`Enter`],Qb=`Select`,[$b,ex,tx]=$g(Qb),[nx,bne]=_(Qb,[tx,Te]),rx=Te(),[ix,ax]=nx(Qb),[ox,sx]=nx(Qb);function cx(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:g}=e,_=rx(t),[v,y]=P.useState(null),[b,x]=P.useState(null),[S,C]=P.useState(!1),w=h_(l),[T,E]=h({prop:r,defaultProp:i??!1,onChange:a,caller:Qb}),[O,k]=h({prop:o,defaultProp:s,onChange:c,caller:Qb}),A=P.useRef(null),j=P.useRef(!1),[M,N]=P.useState(null),ee=qb(e=>{N({value:e,hasConsumerStoppedPropagation:j.current}),k(e)},`handleUserSelect`),te=P.useRef(O);P.useEffect(()=>{let e=m?v?.ownerDocument.getElementById(m):v?.form;if(e instanceof HTMLFormElement){let t=qb(()=>k(te.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,v,k]);let ne=!v||!!m||!!v.closest(`form`),[re,ie]=P.useState(new Set),ae=D(),oe=Array.from(re).map(e=>e.props.value).join(`;`),se=P.useCallback(e=>{ie(t=>new Set(t).add(e))},[]),ce=P.useCallback(e=>{ie(t=>{let n=new Set(t);return n.delete(e),n})},[]),le={required:p,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:ae,value:O,onValueChange:k,hasConsumerStoppedPropagationRef:j,userSelection:M,onUserSelect:ee,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:A,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:re,nativeSelectKey:oe,isFormControl:ne};return(0,F.jsx)(Oe,{..._,children:(0,F.jsx)(ix,{scope:t,...le,children:(0,F.jsx)($b.Provider,{scope:t,children:(0,F.jsx)(ox,{scope:t,onNativeOptionAdd:se,onNativeOptionRemove:ce,children:qx(g)?g(le):n})})})})}qb(cx,`SelectProvider`);var lx=qb(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(cx,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Kx,{__scopeSelect:t}):null]})})},`Select`),ux=`SelectTrigger`,dx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=rx(n),o=ax(ux,n),s=o.disabled||r,c=p(t,o.onTriggerChange),l=ex(n),u=P.useRef(`touch`),[d,f,m]=Yx(e=>{let t=l().filter(e=>!e.disabled),n=Xx(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),h=qb(e=>{s||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,F.jsx)(ke,{asChild:!0,...a,children:(0,F.jsx)(g.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Jx(o.value)?``:void 0,...i,ref:c,onClick:C(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&h(e)}),onPointerDown:C(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:C(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),f(e.key)),!(t&&e.key===` `)&&Xb.includes(e.key)&&(h(),e.preventDefault())})})})},`SelectTrigger`)),fx=`SelectValue`,px=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=ax(fx,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=p(t,c.onValueNodeChange);b(()=>{l(u)},[l,u]);let f=Jx(c.value);return(0,F.jsx)(g.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,F.jsx)(P.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),mx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(g.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[hx,gx]=nx(`SelectPortal`,{forceMount:void 0}),_x=qb(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(hx,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(x,{asChild:!0,...r})})},`SelectPortal`),vx=`SelectContent`,yx=P.forwardRef(qb(function(e,t){let n=gx(vx,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=ax(vx,e.__scopeSelect),[o,s]=P.useState();return b(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(m,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(Tx,{...i,ref:t}):(0,F.jsx)(bx,{...i,fragment:o})})},`SelectContent`)),bx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?vb.createPortal((0,F.jsx)(Sx,{scope:n,children:(0,F.jsx)($b.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),xx=10,[Sx,Cx]=nx(vx),wx=O(`SelectContent.RemoveScroll`),Tx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n}=e,{position:r=Jb.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_,...v}=e,y=ax(vx,n),[b,x]=P.useState(null),[S,E]=P.useState(null),D=p(t,x),[O,k]=P.useState(null),[A,j]=P.useState(null),M=ex(n),[N,ee]=P.useState(!1),te=P.useRef(!1),ne=P.useRef(!1),re=P.useRef(!1);P.useEffect(()=>{if(b)return Ie(b)},[b]),Ne();let ie=P.useCallback(e=>{let[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[M,S]),ae=P.useCallback(()=>ie([O,b]),[ie,O,b]);P.useEffect(()=>{N&&ae()},[N,ae]);let{onOpenChange:oe,triggerPointerDownPosRef:se}=y;P.useEffect(()=>{if(b){let e={x:0,y:0},t=qb(t=>{e={x:Math.abs(Math.round(t.pageX)-(se.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(se.current?.y??0))}},`handlePointerMove`),n=qb(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(b)||oe(!1),document.removeEventListener(`pointermove`,t),se.current=null},`handlePointerUp`);return se.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,oe,se]),P.useEffect(()=>{let e=qb(()=>oe(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[oe]);let[ce,le]=Yx(e=>{let t=M().filter(e=>!e.disabled),n=Xx(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ue=P.useCallback((e,t,n)=>{let r=!ne.current;r&&(ne.current=!0);let i=!te.current&&!n;y.value!==void 0&&y.value===t||i?(k(e),i&&(te.current=!0)):r&&k(e)},[y.value]),de=P.useCallback(()=>b?.focus(),[b]),fe=P.useCallback((e,t,n)=>{if(!e)return;let r=!re.current;r&&(re.current=!0);let i=!te.current&&!n;(y.value!==void 0&&y.value===t||i||r)&&j(e)},[y.value]),pe=r===Jb.Popper?Dx:Ex,me=pe===Dx?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_}:{};return(0,F.jsx)(Sx,{scope:n,content:b,viewport:S,onViewportChange:E,itemRefCallback:ue,selectedItem:O,onItemLeave:de,itemTextRefCallback:fe,focusSelectedItem:ae,selectedItemText:A,position:r,isPositioned:N,searchRef:ce,children:(0,F.jsx)($e,{as:wx,allowPinchZoom:!0,children:(0,F.jsx)(w,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:C(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(T,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,F.jsx)(pe,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...me,onPlaced:()=>ee(!0),ref:D,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:C(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&le(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=M().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ie(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Ex=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=ax(vx,n),o=Cx(vx,n),[s,c]=P.useState(null),[l,u]=P.useState(null),d=p(t,u),f=ex(n),m=P.useRef(!1),h=P.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:x}=o,S=P.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==Yb.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-xx,d=xb(a,[xx,Math.max(xx,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-xx,d=xb(a,[xx,Math.max(xx,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-xx*2,u=_.scrollHeight,d=window.getComputedStyle(l),p=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=p+h+u+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-xx,D=c-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=p+h+k,j=x-A;if(A<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,p+_.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}s.style.margin=`${xx}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[f,a.trigger,a.valueNode,s,l,_,v,y,a.dir,r]);b(()=>S(),[S]);let[C,w]=P.useState();b(()=>{l&&w(window.getComputedStyle(l).zIndex)},[l]);let T=P.useCallback(e=>{e&&h.current===!0&&(S(),x?.(),h.current=!1)},[S,x]);return(0,F.jsx)(Ox,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:T,children:(0,F.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(g.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),Dx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=xx,...a}=e,o=rx(n);return(0,F.jsx)(De,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[Ox,kx]=nx(vx,{}),Ax=`SelectViewport`,jx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Cx(Ax,n),o=kx(Ax,n),s=p(t,a.onViewportChange),c=P.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)($b.Slot,{scope:n,children:(0,F.jsx)(g.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:C(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-xx*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[xne,Sne]=nx(`SelectGroup`),Mx=`SelectItem`,[Nx,Px]=nx(Mx),Fx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=ax(Mx,n),c=Cx(Mx,n),l=s.value===r,[u,d]=P.useState(a??``),[f,m]=P.useState(!1),h=y(e=>c.itemRefCallback?.(e,r,i)),_=p(t,h),v=D(),b=P.useRef(`touch`);function x(e){s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),s.onUserSelect(r),s.onOpenChange(!1)}return qb(x,`handleSelect`),(0,F.jsx)(Nx,{scope:n,value:r,disabled:i,textId:v,isSelected:l,onItemTextChange:P.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)($b.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,F.jsx)(g.div,{role:`option`,"aria-labelledby":v,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:C(o.onFocus,()=>m(!0)),onBlur:C(o.onBlur,()=>m(!1)),onClick:C(o.onClick,e=>{i||b.current!==`mouse`&&x(e)}),onPointerUp:C(o.onPointerUp,e=>{i||b.current===`mouse`&&x(e)}),onPointerDown:C(o.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:C(o.onPointerMove,e=>{b.current=e.pointerType,i?c.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:C(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:C(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(Zb.includes(e.key)&&x(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Ix=`SelectItemText`,Lx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=ax(Ix,n),s=Cx(Ix,n),c=Px(Ix,n),l=sx(Ix,n),[u,d]=P.useState(null),f=y(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),m=p(t,d,c.onItemTextChange,f),h=u?.textContent,_=P.useMemo(()=>(0,F.jsx)(`option`,{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=l;return b(()=>(v(_),()=>x(_)),[v,x,_]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(g.span,{id:c.textId,...a,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Jx(o.value)?vb.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),Rx=`SelectItemIndicator`,zx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,...r}=e;return Px(Rx,n).isSelected?(0,F.jsx)(g.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Bx=`SelectScrollUpButton`,Vx=P.forwardRef(qb(function(e,t){let n=Cx(Bx,e.__scopeSelect),r=kx(Bx,e.__scopeSelect),[i,a]=P.useState(!1),o=p(t,r.onScrollButtonChange);return b(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};qb(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Wx,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Hx=`SelectScrollDownButton`,Ux=P.forwardRef(qb(function(e,t){let n=Cx(Hx,e.__scopeSelect),r=kx(Hx,e.__scopeSelect),[i,a]=P.useState(!1),o=p(t,r.onScrollButtonChange);return b(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};qb(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Wx,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),Wx=P.forwardRef(qb(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Cx(`SelectScrollButton`,n),o=P.useRef(null),s=ex(n),c=P.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return P.useEffect(()=>()=>c(),[c]),b(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(g.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:C(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:C(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:C(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),Gx=`SelectBubbleInput`,Kx=P.forwardRef(qb(function({__scopeSelect:e,...t},n){let r=ax(Gx,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u,userSelection:d}=r,{nativeOptions:f,nativeSelectKey:m}=r,h=P.useRef(null),_=p(n,h),v=i??``,y=P.useRef(v),b=P.useRef(d),x=P.useRef(!1),S=Array.from(f).some(e=>(e.props.value??``)===``);return P.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=d!==null&&d!==b.current;b.current=d;let i=y.current!==v;y.current=v;let a=r&&i;if(r&&!i&&d.value!==v&&!d.hasConsumerStoppedPropagation&&n){x.current=!0;try{n.call(e,d.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{x.current=!1,n.call(e,v)}return}let o=a&&!d.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,v),e.dispatchEvent(t)}},[v,d]),(0,F.jsxs)(g.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>{x.current||a(e.target.value)},...t,style:{...Ae,...t.style},ref:_,defaultValue:v,children:[Jx(i)&&!S?(0,F.jsx)(`option`,{value:``}):null,Array.from(f)]},m)},`SelectBubbleInput`));function qx(e){return typeof e==`function`}qb(qx,`isFunction`);function Jx(e){return e===``||e===void 0}qb(Jx,`shouldShowPlaceholder`);function Yx(e){let t=y(e),n=P.useRef(``),r=P.useRef(0),i=P.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}qb(a,`updateSearch`),a(i)},[t]),a=P.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}qb(Yx,`useTypeaheadSearch`);function Xx(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Zx(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}qb(Xx,`findNextItem`);function Zx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}qb(Zx,`wrapArray`);var Qx=Object.defineProperty,$x=(e,t)=>Qx(e,`name`,{value:t,configurable:!0}),eS=`Switch`,[tS,Cne]=_(eS),[nS,rS]=tS(eS);function iS(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=h({prop:n,defaultProp:i??!1,onChange:c,caller:eS}),[m,g]=P.useState(null),[_,v]=P.useState(null),[y,b]=P.useState(null),x={checked:f,setChecked:p,disabled:a,control:m,setControl:g,name:s,form:o,value:u,userClick:y,onUserClick:b,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,F.jsx)(nS,{scope:t,...x,children:fS(d)?d(x):r})}$x(iS,`SwitchProvider`);var aS=`SwitchTrigger`,oS=P.forwardRef($x(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,onUserClick:f,isFormControl:m,bubbleInput:h}=rS(aS,e),_=p(r,u),v=P.useRef(c);return P.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=$x(()=>d(v.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,F.jsx)(g.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":pS(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:_,onClick:C(t,e=>{let t=e.isPropagationStopped();f({requestedChecked:!c,hasConsumerStoppedPropagation:t}),d(e=>!e),h&&m&&(t||e.stopPropagation())})})},`SwitchTrigger`)),sS=P.forwardRef($x(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,F.jsx)(iS,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(oS,{...d,ref:t,__scopeSwitch:n}),e&&(0,F.jsx)(dS,{__scopeSwitch:n})]})})},`Switch`)),cS=`SwitchThumb`,lS=P.forwardRef($x(function(e,t){let{__scopeSwitch:n,...r}=e,i=rS(cS,n);return(0,F.jsx)(g.span,{"data-state":pS(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),uS=`SwitchBubbleInput`,dS=P.forwardRef($x(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:h}=rS(uS,e),_=p(r,h),v=eee(i),y=P.useRef(!1),b=P.useRef(o),x=P.useRef(a),S=P.useRef(null);P.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=b.current!==o;b.current=o;let i=a!==null&&a!==x.current;if(x.current=a,i)S.current=r?null:a,r&&n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=S.current;S.current=null;let r=t?.requestedChecked===o;y.current=!0,n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),y.current=!1}},[m,o,a]);let w=P.useRef(o);return(0,F.jsx)(g.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??w.current,required:c,disabled:l,name:u,value:d,form:f,...n,tabIndex:-1,ref:_,onClick:C(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function fS(e){return typeof e==`function`}$x(fS,`isFunction`);function pS(e){return e?`checked`:`unchecked`}$x(pS,`getState`);function mS({...e}){return(0,F.jsx)(eb,{"data-slot":`dropdown-menu`,...e})}function hS({...e}){return(0,F.jsx)(rb,{"data-slot":`dropdown-menu-portal`,...e})}function gS({...e}){return(0,F.jsx)(nb,{"data-slot":`dropdown-menu-trigger`,...e})}function _S({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,F.jsx)(rb,{children:(0,F.jsx)(ab,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:l(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg dropdown-glass p-1 text-popover-foreground shadow-[0_16px_40px_-18px_rgb(0_0_0/55%)] dark:shadow-[0_18px_44px_-18px_rgb(0_0_0/80%)] duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function vS({className:e,inset:t,variant:n=`default`,...r}){return(0,F.jsx)(sb,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:l(`group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function yS({className:e,children:t,checked:n,inset:r,...i}){return(0,F.jsxs)(cb,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:l(`relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...i,children:[(0,F.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,F.jsx)(db,{children:(0,F.jsx)(k,{icon:Sm})})}),t]})}function bS({...e}){return(0,F.jsx)(lb,{"data-slot":`dropdown-menu-radio-group`,...e})}function xS({className:e,children:t,inset:n,...r}){return(0,F.jsxs)(ub,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:l(`relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,F.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,F.jsx)(db,{children:(0,F.jsx)(k,{icon:Sm})})}),t]})}function SS({className:e,inset:t,...n}){return(0,F.jsx)(ob,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:l(`px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function CS({className:e,...t}){return(0,F.jsx)(fb,{"data-slot":`dropdown-menu-separator`,className:l(`-mx-1 my-1 h-px bg-border`,e),...t})}function wS({...e}){return(0,F.jsx)(pb,{"data-slot":`dropdown-menu-sub`,...e})}function TS({className:e,inset:t,children:n,...r}){return(0,F.jsxs)(mb,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:l(`flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,F.jsx)(k,{icon:wm,className:`ml-auto`})]})}function ES({className:e,...t}){return(0,F.jsx)(hb,{"data-slot":`dropdown-menu-sub-content`,className:l(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}async function DS(e,t){if(t.size>52428800)throw Error(`File is larger than 50 MB`);return I(e,`files.upload`,{name:t.name,data:await OS(t)})}function OS(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=String(r.result);t(e.slice(e.indexOf(`,`)+1))},r.onerror=()=>n(r.error),r.readAsDataURL(e)})}function kS(e){return(0,F.jsx)(`div`,{className:l(`mx-auto w-full`,e.width===`chat`&&`max-w-[min(var(--chat-content-max-width),calc(100%-2*var(--wrapper-gutter)))]`,e.width===`composer`&&`max-w-[calc(min(var(--chat-content-max-width),calc(100%-2*var(--wrapper-gutter)))+0.75rem)]`,e.className),children:e.children})}function AS(){return s9.parseLocation(s9.history.location).search}function jS(){let e=/^\/terminal\/([^/]+)$/.exec(s9.history.location.pathname);if(e===null)return null;let t=decodeURIComponent(e[1]);return Z().machines.some(e=>e.id===t)?t:null}function MS(){let e=$i({strict:!1,select:e=>e.machine??null});return Q(t=>t.machines.some(t=>t.id===e)?e:null)}function NS(e){let t=AS();return t.machine===void 0||t.project===void 0||!e.includes(t.machine)?null:{machine:t.machine,projectId:t.project,sessionId:t.session??null}}function PS(e){zS({...AS(),...e},!0,s9.history.location.state.layer)}function FS(e,t){zS({...AS(),...e},!1,t)}function IS(e){let t=Z();if(t.selection===null)throw Error(`no project is open to show the browser in`);if(e.startsWith(`file:`)){PS({panel:`browser`,browse:decodeURIComponent(new URL(e).pathname)});return}if(/^https?:\/\//i.test(e)||e.startsWith(`/`)||/^[a-z]:[\\/]/i.test(e)){PS({panel:`browser`,browse:e});return}let n=E9(t,t.selection.machine,t.selection.projectId);if(n===void 0)throw Error(`project ${t.selection.projectId} is not listed`);PS({panel:`browser`,browse:`${n.path}/${e}`})}function LS(e,t){s9.history.location.state.layer===e?s9.history.back():t()}function RS(){let e=Z().selection;if(e===null){zS({},!0,s9.history.location.state.layer);return}let t={machine:e.machine,project:e.projectId,session:e.sessionId??void 0};jS()===null?AS().machine===void 0?FS(t,`chat`):PS(t):s9.navigate({to:`/`,search:t,state:{layer:`chat`},resetScroll:!1})}function zS(e,t,n){let r=jS();r===null?s9.navigate({to:`/`,search:e,replace:t,state:{layer:n},resetScroll:!1}):s9.navigate({to:`/terminal/$machine`,params:{machine:r},search:e,replace:t,state:{layer:n},resetScroll:!1})}function BS(e){let t=T9(Z(),e.machine),n=Z().selection;localStorage.setItem(`lastProject`,JSON.stringify({machine:e.machine,projectId:e.projectId})),$({selection:e,loaded:e.sessionId===null,items:[],earlier:[],before:null,partial:``,requests:[],queue:[],settings:e.sessionId===null?n?.sessionId===null&&n.machine===e.machine?Z().settings:J9(t):Wo(M9(e))??q9(t.composer,Z().sessions.find(t=>t.machine===e.machine&&t.id===e.sessionId)?.provider??t.composer?.provider??`claude`),context:null,paletteOpen:!1,unseen:Z().unseen.filter(t=>e.sessionId===null||t!==f9(e.machine,e.sessionId))}),RS(),Q9(e.machine),e.sessionId!==null&&t.status===`online`&&VS(e.machine,e.projectId,e.sessionId)}function VS(e,t,n){I(e,`sessions.open`,{projectId:t,sessionId:n}).then(t=>{t===null||Z().sessions.some(n=>n.machine===e&&n.id===t.id)||$({sessions:[...Z().sessions,{...t,machine:e}]})}).catch(R9)}function HS(){$({selection:null,loaded:!1,items:[],earlier:[],before:null,partial:``,requests:[],queue:[],context:null}),RS()}function US(){let e=Z().machines,t=localStorage.getItem(`lastTerminal`);return t!==null&&e.some(e=>e.id===t)?t:e.at(0)?.id??null}function WS(e){let t=jS();t!==e&&(s9.navigate({to:`/terminal/$machine`,params:{machine:e},search:{},replace:t!==null,state:{layer:`chat`},resetScroll:!1}),HS())}async function GS(e,t){let n=Z().selection;if(n===null)throw Error(`no session selected`);`Notification`in window&&Notification.permission==="default"&&Notification.requestPermission(),$({sentAt:Date.now()}),await I(n.machine,`sessions.send`,{sessionId:n.sessionId,projectId:n.projectId,prompt:e,settings:Z().settings,delivery:t})}function KS(e){let t=Z().selection;t!==null&&t.sessionId!==null&&I(t.machine,`sessions.unqueue`,{sessionId:t.sessionId,id:e}).catch(R9)}function qS(e){let t=Z().selection;t!==null&&t.sessionId!==null&&I(t.machine,`sessions.steer`,{sessionId:t.sessionId,id:e}).catch(R9)}function JS(){let e=Z().selection;e!==null&&e.sessionId!==null&&I(e.machine,`sessions.interrupt`,{sessionId:e.sessionId}).catch(R9)}function YS(e,t,n){I(e,`sessions.stopTask`,{sessionId:t,taskId:n}).catch(R9)}function XS(e,t,n){let r=Z().selection;r!==null&&r.sessionId!==null&&I(r.machine,`sessions.respond`,{sessionId:r.sessionId,requestId:e,decision:t,answers:n}).catch(R9)}async function ZS(e){let t=Z().selection;if(t!==null&&t.sessionId!==null)try{let n=await I(t.machine,`sessions.fork`,{sessionId:t.sessionId,projectId:t.projectId,messageId:e});BS({...t,sessionId:n.sessionId})}catch(e){R9(e)}}async function QS(){let e=Z().selection,t=Z().before;if(e!==null&&e.sessionId!==null&&t!==null)try{let n=await I(e.machine,`sessions.earlier`,{sessionId:e.sessionId,before:t});if(Z().selection!==e||Z().before!==t)return;$({earlier:[...n.items,...Z().earlier],before:n.before})}catch(e){R9(e)}}async function $S(e,t){let n=Z().selection;if(n!==null&&n.sessionId!==null)try{let r=await I(n.machine,`sessions.agent`,{sessionId:n.sessionId,projectId:n.projectId,agentId:t,parent:e});if(Z().selection!==n)return;let i=new Set(r.map(e=>e.id)),a=Z().items;$({items:[...a.filter(t=>t.parent!==e),...r,...a.filter(t=>t.parent===e&&!i.has(t.id))]})}catch(e){R9(e)}}async function eC(e,t,n){let r=Z();function i(n){return n.machine===e&&n.id===t}let a=[...r.sessions,...r.inactive].find(i);if(a!==void 0){let e={...a,...n};$({sessions:r.sessions.some(i)?r.sessions.map(t=>i(t)?e:t):e.status===`inactive`?r.sessions:[...r.sessions,e],inactive:e.status===`inactive`?r.inactive.some(i)?r.inactive.map(t=>i(t)?e:t):[e,...r.inactive]:r.inactive.filter(e=>!i(e))})}try{await I(e,`sessions.update`,{id:t,patch:n})}catch(e){R9(e)}}async function tC(e,t,n){let r=Z().selection;if(r?.machine===e&&r.sessionId===t){let i=Z().sessions.filter(r=>(r.status===`pinned`||r.status===`active`||r.status===`snoozed`)&&(r.machine!==e||r.id!==t)&&(n===null||r.machine===n.machine&&r.projectId===n.projectId)).sort((e,t)=>t.updatedAt-e.updatedAt).at(0);BS(i===void 0?{...r,sessionId:null}:{machine:i.machine,projectId:i.projectId,sessionId:i.id})}await eC(e,t,{status:`inactive`})}async function nC(e,t){$({sessions:Z().sessions.filter(n=>n.machine!==e||n.id!==t),inactive:Z().inactive.filter(n=>n.machine!==e||n.id!==t)}),Ho(f9(e,t));let n=Z().selection;n?.machine===e&&n.sessionId===t&&BS({...n,sessionId:null});try{await I(e,`sessions.remove`,{id:t})}catch(e){R9(e)}}var rC=(0,P.lazy)(async()=>({default:(await tt(async()=>{let{ImageViewer:e}=await import(`./image-viewer-AlNpsjfB.js`);return{ImageViewer:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]))).ImageViewer}));function iC(e){let[t,n]=(0,P.useState)(!1);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,"aria-label":e.alt===``?`View image`:`View ${e.alt}`,className:l(`focus-visible:ring-ring cursor-zoom-in rounded-lg outline-none focus-visible:ring-2`,e.className),onClick:()=>n(!0),children:(0,F.jsx)(`img`,{src:e.src,alt:e.alt,loading:`lazy`,decoding:`async`,className:e.imageClassName,onError:e.onError})}),t&&(0,F.jsx)(P.Suspense,{children:(0,F.jsx)(rC,{src:e.src,alt:e.alt,name:e.name,onClose:()=>n(!1)})})]})}function aC(e){let t=Ro(e.draftKey).images;return(0,F.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-2 px-3 sm:px-4`,children:t.map(t=>(0,F.jsxs)(`div`,{className:`border-border/80 bg-background relative size-16 overflow-hidden rounded-lg border`,children:[(0,F.jsx)(iC,{src:`data:${t.mediaType};base64,${t.data}`,alt:``,name:`Image #${t.number}`,className:`block size-full`,imageClassName:`size-full object-cover`}),(0,F.jsx)(`button`,{className:`absolute top-1 right-1 grid size-5 cursor-pointer place-items-center rounded-full bg-black/60 text-white`,title:`Remove image`,onClick:()=>zo(e.draftKey,e=>({...e,text:e.text.replace(RegExp(`\\[Image #${t.number}\\] ?`),``),images:e.images.filter(e=>e.number!==t.number)})),children:(0,F.jsx)(k,{icon:Me,className:`size-3`})})]},t.number))})}function oC(e,t){let n=0;for(let r of[...t,...e.flatMap(e=>e.parent===null?e.kind===`user`?[e.text]:e.kind===`question`&&e.answers!==null?Object.values(e.answers):[]:[])])for(let e of r.matchAll(/\[Image #(\d+)\]/g))n=Math.max(n,Number(e[1]));return n}function sC(e){let t=[...new Set([...e.text.matchAll(/\[Image #(\d+)\]/g)].map(e=>Number(e[1])))].sort((e,t)=>e-t);if(t.length===e.images.length)return{text:e.text,images:e.images.map((e,n)=>({...e,number:t[n]}))};let n=Math.max(0,...t)+1,r=e.images.map((e,t)=>({...e,number:n+t}));return{text:`${r.map(e=>`[Image #${e.number}] `).join(``)}${e.text}`,images:r}}function cC(e){let t=(0,P.useRef)(null);return(0,P.useLayoutEffect)(()=>{t.current?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})},[e.active]),(0,F.jsx)(`div`,{ref:t,className:`composer-glass mx-auto -mb-[calc(1rem+1px)] max-h-72 w-[calc(100%-2.75rem)] overflow-y-auto rounded-t-2xl border border-b-0 border-(--composer-outline) p-1 pb-[calc(1rem+1px+0.25rem)]`,children:e.items.map((t,n)=>(0,F.jsxs)(`button`,{"data-active":n===e.active,className:l(`flex min-h-7 w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-left`,n===e.active&&`bg-accent`),onMouseEnter:()=>e.onHover(n),onMouseDown:n=>{n.preventDefault(),e.onPick(t)},children:[(0,F.jsx)(k,{icon:t.insert.startsWith(`/`)?Vh:hne,className:`text-muted-foreground size-4 shrink-0`}),(0,F.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:t.label}),(0,F.jsx)(`span`,{className:`text-secondary-label min-w-0 truncate text-xs`,children:t.description})]},t.key))})}var lC={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`},uC=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),dC=new Intl.DateTimeFormat(void 0,{month:`numeric`,day:`numeric`}),fC=new Intl.DateTimeFormat(void 0,{month:`numeric`,day:`numeric`,year:`numeric`}),pC=new Intl.DateTimeFormat(`en-US`,{month:`long`});function mC(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??e}function hC(e){let t=Math.round((Date.now()-e)/1e3);return t<60?`now`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function gC(e){let t=new Date(e),n=uC.format(t),r=new Date,i=Math.round((new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime()-new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime())/864e5);return i<=0?n:i===1?`yesterday at ${n}`:`${(t.getFullYear()===r.getFullYear()?dC:fC).format(t)} ${n}`}function _C(e){let t=new Date(e),n=t.getDate(),r=n%100>=11&&n%100<=13?`th`:n%10==1?`st`:n%10==2?`nd`:n%10==3?`rd`:`th`;return`${uC.format(t)}, ${n}${r} ${pC.format(t)} ${t.getFullYear()}`}function vC(e){return new Intl.NumberFormat(void 0,{notation:`compact`}).format(e)}function yC(e){let t=Math.round(e),n=Math.floor(t/60),r=String(t%60).padStart(2,`0`);return n<60?`${n}:${r}`:`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}:${r}`}var bC={claude:[{value:`default`,label:`Ask before edits`,icon:Fh},{value:`acceptEdits`,label:`Accept edits`,icon:Pm},{value:`plan`,label:`Plan mode`,icon:rh},{value:`auto`,label:`Auto mode`,icon:zh},{value:`bypassPermissions`,label:`Bypass permissions`,icon:Ih}],codex:[{value:`read-only`,label:`Read only`,icon:Fh},{value:`auto`,label:`Auto`,icon:Pm},{value:`full-access`,label:`Full access`,icon:Ih}]};function xC(e,t){return e===`opencode`?(t?.agents??[]).map(e=>({value:e.id,label:e.name,icon:e.id===`plan`?rh:Pm})):bC[e]}function SC(e){let t=Q(e=>e.settings),n=Q(e=>e.context),i=Q(e=>e.capabilities),a=xC(t.provider,i),o=a.find(e=>e.value===t.mode),s=t.provider===`opencode`?`Agent`:`Permission mode`;return(0,F.jsxs)(mS,{children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,title:`More`,"aria-label":`More composer controls`,children:(0,F.jsx)(k,{icon:fh})})}),(0,F.jsxs)(_S,{className:`w-56`,side:`top`,align:`end`,onCloseAutoFocus:e=>{e.preventDefault(),document.querySelector(`[data-composer]`)?.focus()},children:[(0,F.jsxs)(wS,{children:[(0,F.jsxs)(TS,{children:[(0,F.jsx)(k,{icon:o?.icon??Fh}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o?.label??`Default`})]}),(0,F.jsx)(hS,{children:(0,F.jsxs)(ES,{className:`w-56`,children:[(0,F.jsx)(SS,{children:s}),(0,F.jsx)(bS,{value:t.mode??``,children:a.map(e=>(0,F.jsxs)(xS,{value:e.value,onSelect:()=>Y9({mode:e.value}),children:[(0,F.jsx)(k,{icon:e.icon}),e.label]},e.value))})]})})]}),t.provider===`codex`&&(0,F.jsxs)(yS,{checked:t.plan,onCheckedChange:e=>Y9({plan:e}),children:[(0,F.jsx)(k,{icon:rh}),`Plan first`]}),n!==null&&(0,F.jsxs)(`div`,{className:`flex min-h-7 items-center gap-2 px-2 py-1 text-sm [&_svg]:size-4`,children:[(0,F.jsx)(k,{icon:tne}),(0,F.jsx)(`span`,{className:`flex-1`,children:`Context`}),(0,F.jsx)(`span`,{className:`text-muted-foreground text-xs tabular-nums`,children:vC(n.tokens)}),(0,F.jsx)(E,{variant:`outline`,size:`xs`,onClick:()=>GS({text:`/compact`,images:[]},`queue`).catch(R9),children:`Compact`})]}),e.delivery!==null&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(CS,{}),(0,F.jsxs)(vS,{disabled:e.empty,onSelect:e.onSubmit,children:[(0,F.jsx)(k,{icon:e.delivery===`steer`?Eh:jh}),(0,F.jsxs)(`span`,{className:`flex-1`,children:[e.delivery===`steer`&&`Queue`,e.delivery===`queue`&&`Send now`]}),(0,F.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[r,`+Enter`]})]})]})]})]})}var CC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TC={};function EC(e,t){return((t||TC).jsx?wC:CC).test(e)}var DC={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},OC=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
59
- `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),kC=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(OC());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),AC=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),jC=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(kC()),r=AC();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),MC=PC(`end`),NC=PC(`start`);function PC(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function FC(e){let t=NC(e),n=MC(e);if(t&&n)return{start:t,end:n}}function IC(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?RC(e.position):`start`in e||`end`in e?RC(e):`line`in e||`column`in e?LC(e):``}function LC(e){return zC(e&&e.line)+`:`+zC(e&&e.column)}function RC(e){return LC(e&&e.start)+`-`+LC(e&&e.end)}function zC(e){return e&&typeof e==`number`?e:1}var BC=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=IC(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};BC.prototype.file=``,BC.prototype.name=``,BC.prototype.reason=``,BC.prototype.message=``,BC.prototype.stack=``,BC.prototype.column=void 0,BC.prototype.line=void 0,BC.prototype.ancestors=void 0,BC.prototype.cause=void 0,BC.prototype.fatal=void 0,BC.prototype.place=void 0,BC.prototype.ruleId=void 0,BC.prototype.source=void 0;var VC=e(jC(),1),HC={}.hasOwnProperty,UC=new Map,WC=/[A-Z]/g,GC=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),KC=new Set([`td`,`th`]),qC=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function JC(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=aw(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=iw(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?vt:Tt,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=YC(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function YC(e,t,n){if(t.type===`element`)return XC(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ZC(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return $C(e,t,n);if(t.type===`mdxjsEsm`)return QC(e,t);if(t.type===`root`)return ew(e,t,n);if(t.type===`text`)return tw(e,t)}function XC(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=vt,e.schema=i),e.ancestors.push(t);let a=dw(e,t.tagName,!1),o=ow(e,t),s=cw(e,t);return GC.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Lt(e)})),nw(e,o,a,t),rw(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ZC(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}fw(e,t.position)}function QC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);fw(e,t.position)}function $C(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=vt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:dw(e,t.name,!0),o=sw(e,t),s=cw(e,t);return nw(e,o,a,t),rw(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ew(e,t,n){let r={};return rw(r,cw(e,t)),e.create(t,e.Fragment,r,n)}function tw(e,t){return t.value}function nw(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function rw(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function iw(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function aw(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=NC(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function ow(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&HC.call(t.properties,i)){let a=lw(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&KC.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function sw(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else fw(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else fw(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function cw(e,t){let n=[],r=-1,i=e.passKeys?new Map:UC;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=YC(e,a,o);s!==void 0&&n.push(s)}return n}function lw(e,t,n){let r=nt(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Pt(n):Ct(n)),r.property===`style`){let t=typeof n==`object`?n:uw(e,String(n));return e.stylePropertyNameCase===`css`&&(t=pw(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?DC[r.property]||r.property:r.attribute,n]}}function uw(e,t){try{return(0,VC.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new BC("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=qC+`#cannot-parse-style-attribute`,r}}function dw(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=EC(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=EC(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return HC.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);fw(e)}function fw(e,t){let n=new BC("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=qC+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function pw(e){let t={},n;for(n in e)HC.call(e,n)&&(t[mw(n)]=e[n]);return t}function mw(e){let t=e.replace(WC,hw);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function hw(e){return`-`+e.toLowerCase()}var gw={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},_w={};function vw(e,t){let n=t||_w;return yw(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function yw(e,t,n){if(xw(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return bw(e.children,t,n)}return Array.isArray(e)?bw(e,t,n):``}function bw(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=yw(e[i],t,n);return r.join(``)}function xw(e){return!!(e&&typeof e==`object`)}var Sw=document.createElement(`i`);function Cw(e){let t=`&`+e+`;`;Sw.innerHTML=t;let n=Sw.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function ww(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Tw(e,t){return e.length>0?(ww(e,e.length,0,t),e):t}var Ew={}.hasOwnProperty;function Dw(e){let t={},n=-1;for(;++n<e.length;)Ow(t,e[n]);return t}function Ow(e,t){let n;for(n in t){let r=(Ew.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Ew.call(r,a)||(r[a]=[]);let e=i[a];kw(r[a],Array.isArray(e)?e:e?[e]:[])}}}function kw(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);ww(e,0,0,r)}function Aw(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function jw(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Mw=Uw(/[A-Za-z]/),Nw=Uw(/[\dA-Za-z]/),Pw=Uw(/[#-'*+\--9=?A-Z^-~]/);function Fw(e){return e!==null&&(e<32||e===127)}var Iw=Uw(/\d/),Lw=Uw(/[\dA-Fa-f]/),Rw=Uw(/[!-/:-@[-`{-~]/);function z(e){return e!==null&&e<-2}function zw(e){return e!==null&&(e<0||e===32)}function Bw(e){return e===-2||e===-1||e===32}var Vw=Uw(/\p{P}|\p{S}/u),Hw=Uw(/\s/);function Uw(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Ww(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Nw(e.charCodeAt(n+1))&&Nw(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Gw(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Bw(r)?(e.enter(n),s(r)):t(r)}function s(r){return Bw(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function Kw(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&Bw(t)?(e.enter(r),c(t)):l(t)}function c(t){return Bw(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var qw={tokenize:Jw};function Jw(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Gw(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return z(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Yw=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Xw(this,e,t,n,!1)}addBefore(e,t,n){Xw(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Xw(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var Zw={tokenize:$w},Qw={tokenize:eT};function $w(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new Yw;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Qw,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Qw,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return z(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new Yw;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function eT(e,t,n){return Gw(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function tT(e){if(e===null||zw(e)||Hw(e))return 1;if(Vw(e))return 2}function nT(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var rT={name:`attention`,resolveAll:iT,tokenize:aT};function iT(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};oT(o,-a),oT(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=Tw(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=Tw(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=Tw(r,nT(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=Tw(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=Tw(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),ww(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function aT(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=tT(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=tT(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function oT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var sT={name:`autolink`,tokenize:cT};function cT(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Mw(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Nw(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Nw(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Fw(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Pw(t)?(e.consume(t),l):n(t)}function u(e){return Nw(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Nw(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var lT={partial:!0,tokenize:uT};function uT(e,t,n){return r;function r(t){return Bw(t)?Gw(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||z(e)?t(e):n(e)}}var dT={continuation:{tokenize:pT},exit:mT,name:`blockQuote`,tokenize:fT};function fT(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Bw(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function pT(e,t,n){let r=this;return i;function i(t){return Bw(t)?Gw(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(dT,t,n)(r)}}function mT(e){e.exit(`blockQuote`)}var hT={name:`characterEscape`,tokenize:wne};function wne(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Rw(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var gT={name:`characterReference`,tokenize:_T};function _T(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Nw,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Lw,u):(e.enter(`characterReferenceValue`),a=7,o=Iw,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Nw&&!Cw(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var vT={partial:!0,tokenize:yT};function yT(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var bT={concrete:!0,name:`codeFenced`,tokenize:xT};function xT(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Bw(t)?Gw(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||z(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(vT,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Bw(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Gw(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||z(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Bw(t)?Gw(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||z(t)?e.check(vT,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||z(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Bw(t)?Gw(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Bw(t)?Gw(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||z(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var ST={name:`codeIndented`,tokenize:wT},CT={partial:!0,tokenize:TT};function wT(e,t,n){return r;function r(t){return e.enter(`codeIndented`),Kw(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):z(t)?e.attempt(CT,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||z(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function TT(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):z(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):Kw(e,t,a,`linePrefix`,4,4)(o)}function a(e){return z(e)?i(e):n(e)}}var ET={name:`codeText`,previous:OT,resolve:DT,tokenize:kT};function DT(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function OT(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function kT(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||z(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var AT=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&jT(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),jT(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),jT(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);jT(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);jT(this.left,t.reverse())}}}};function jT(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function MT(e){let t={},n=-1,r,i,a,o,s,c,l,u=new AT(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,NT(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return ww(e,0,1/0,u.slice(0)),!l}function NT(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var PT={resolve:IT,tokenize:LT},FT={partial:!0,tokenize:RT};function IT(e){return MT(e),e}function LT(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):z(t)?e.check(FT,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function RT(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Gw(e,a,`linePrefix`)}function a(i){if(i===null||z(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function zT(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Fw(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||z(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||zw(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Fw(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function BT(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):z(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||z(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Bw(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function VT(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Gw(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||z(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function HT(e,t){let n;return r;function r(i){return z(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Bw(i)?Gw(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var UT={name:`definition`,tokenize:GT},WT={partial:!0,tokenize:KT};function GT(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return BT.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=jw(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return zw(t)?HT(e,l)(t):l(t)}function l(t){return zT(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(WT,d,d)(t)}function d(t){return Bw(t)?Gw(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||z(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function KT(e,t,n){return r;function r(t){return zw(t)?HT(e,i)(t):n(t)}function i(t){return VT(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Bw(t)?Gw(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||z(e)?t(e):n(e)}}var qT={name:`hardBreakEscape`,tokenize:JT};function JT(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return z(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var YT={name:`headingAtx`,resolve:XT,tokenize:ZT};function XT(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};ww(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function ZT(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||zw(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||z(n)?(e.exit(`atxHeading`),t(n)):Bw(n)?Gw(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||zw(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var QT=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),$T=[`pre`,`script`,`style`,`textarea`],eE={concrete:!0,name:`htmlFlow`,resolveTo:nE,tokenize:rE},tE={partial:!0,tokenize:iE};function nE(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function rE(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ne):Mw(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Mw(a)?(e.consume(a),i=4,r.interrupt?t:ne):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ne):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Mw(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||zw(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&$T.includes(l)?(i=1,r.interrupt?t(s):O(s)):QT.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Nw(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Bw(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Mw(t)?(e.consume(t),b):Bw(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Nw(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Bw(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Bw(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||z(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||zw(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Bw(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||z(t)?O(t):Bw(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),ne):t===93&&i===5?(e.consume(t),te):z(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(tE,ie,k)(t)):t===null||z(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(vT,A,ie)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||z(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),ne):O(t)}function N(t){return t===47?(e.consume(t),o=``,ee):O(t)}function ee(t){if(t===62){let n=o.toLowerCase();return $T.includes(n)?(e.consume(t),re):O(t)}return Mw(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ee):O(t)}function te(t){return t===93?(e.consume(t),ne):O(t)}function ne(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),ne):O(t)}function re(t){return t===null||z(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function iE(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(lT,t,n)}}var aE={name:`htmlText`,tokenize:oE};function oE(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Mw(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Mw(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):z(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):z(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):z(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):z(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Mw(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Nw(t)?(e.consume(t),S):C(t)}function C(t){return z(t)?(o=C,N(t)):Bw(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Nw(t)?(e.consume(t),w):t===47||t===62||zw(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Mw(t)?(e.consume(t),E):z(t)?(o=T,N(t)):Bw(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Nw(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):z(t)?(o=D,N(t)):Bw(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):z(t)?(o=O,N(t)):Bw(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):z(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||zw(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||zw(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return Bw(t)?Gw(e,te,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):te(t)}function te(t){return e.enter(`htmlTextData`),o(t)}}var sE={name:`labelEnd`,resolveAll:dE,resolveTo:fE,tokenize:pE},cE={tokenize:mE},lE={tokenize:hE},uE={tokenize:gE};function dE(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&ww(e,0,e.length,n),e}function fE(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=Tw(o,e.slice(i+1,i+r+3)),o=Tw(o,[[`enter`,l,t]]),o=Tw(o,nT(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=Tw(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=Tw(o,e.slice(a+1)),o=Tw(o,[[`exit`,s,t]]),ww(e,i,e.length,o),e}function pE(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(jw(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(cE,u,o?u:d)(t):t===91?e.attempt(lE,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(uE,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function mE(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return zw(t)?HT(e,a)(t):a(t)}function a(t){return t===41?u(t):zT(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return zw(t)?HT(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?VT(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return zw(t)?HT(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function hE(e,t,n){let r=this;return i;function i(t){return BT.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(jw(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function gE(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var _E={name:`labelStartImage`,resolveAll:sE.resolveAll,tokenize:vE};function vE(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var yE={name:`labelStartLink`,resolveAll:sE.resolveAll,tokenize:bE};function bE(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var xE={name:`lineEnding`,tokenize:SE};function SE(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Gw(e,t,`linePrefix`)}}var CE={name:`thematicBreak`,tokenize:wE};function wE(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||z(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Bw(t)?Gw(e,s,`whitespace`)(t):s(t))}}var TE={continuation:{tokenize:kE},exit:jE,name:`list`,tokenize:OE},EE={partial:!0,tokenize:ME},DE={partial:!0,tokenize:AE};function OE(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Iw(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(CE,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Iw(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(lT,r.interrupt?n:u,e.attempt(EE,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Bw(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function kE(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(lT,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Gw(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Bw(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(DE,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Gw(e,e.attempt(TE,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function AE(e,t,n){let r=this;return Gw(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function jE(e){e.exit(this.containerState.type)}function ME(e,t,n){let r=this;return Gw(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Bw(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var NE={name:`setextUnderline`,resolveTo:PE,tokenize:FE};function PE(e,t){let n=new Yw,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function FE(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Bw(t)?Gw(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||z(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var IE={tokenize:LE};function LE(e){let t=this,n=e.attempt(lT,r,e.attempt(this.parser.constructs.flowInitial,i,Gw(e,e.attempt(this.parser.constructs.flow,i,e.attempt(PT,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var RE={resolveAll:HE()},zE=VE(`string`),BE=VE(`text`);function VE(e){return{resolveAll:HE(e===`text`?UE:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function HE(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function UE(e,t){let n=new Yw,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var WE=t({attentionMarkers:()=>QE,contentInitial:()=>KE,disable:()=>$E,document:()=>GE,flow:()=>JE,flowInitial:()=>qE,insideSpan:()=>ZE,string:()=>YE,text:()=>XE}),GE={42:TE,43:TE,45:TE,48:TE,49:TE,50:TE,51:TE,52:TE,53:TE,54:TE,55:TE,56:TE,57:TE,62:dT},KE={91:UT},qE={[-2]:ST,[-1]:ST,32:ST},JE={35:YT,42:CE,45:[NE,CE],60:eE,61:NE,95:CE,96:bT,126:bT},YE={38:gT,92:hT},XE={[-5]:xE,[-4]:xE,[-3]:xE,33:_E,38:gT,42:rT,60:[sT,aE],91:yE,92:[qT,hT],93:sE,95:rT,96:ET},ZE={null:[rT,RE]},QE={null:[42,95]},$E={null:[]};function eD(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Tw(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=nT(a,l.events,l),l.events):[]}function f(e,t){return nD(p(e),t)}function p(e){return tD(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){z(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&ww(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function tD(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function nD(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
60
- `;break;case-3:o=`\r
61
- `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function rD(e){let t={constructs:Dw([WE,...(e||{}).extensions||[]]),content:n(qw),defined:[],document:n(Zw),flow:n(IE),lazy:{},string:n(zE),text:n(BE)};return t;function n(e){return n;function n(n){return eD(t,e,n)}}}function iD(e){for(;!MT(e););return e}var aD=/[\0\t\n\r]/g;function oD(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){aD.lastIndex=c;let n=aD.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var sD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function cD(e){return e.replace(sD,lD)}function lD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Aw(n.slice(t?2:1),t?16:10)}return Cw(n)||e}var uD={}.hasOwnProperty;function dD(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),fD(n)(iD(rD(n).document().write(oD()(e,t,!0))))}function fD(e){let t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:o(Se),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(ve),blockQuote:o(pe),characterEscape:E,characterReference:E,codeFenced:o(me),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(me,s),codeText:o(he,s),codeTextData:E,data:E,codeFlowValue:E,definition:o(ge),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(_e),hardBreakEscape:o(ye),hardBreakTrailing:o(ye),htmlFlow:o(be,s),htmlFlowData:E,htmlText:o(be,s),htmlTextData:E,image:o(xe),label:s,link:o(Se),listItem:o(we),listItemValue:p,listOrdered:o(Ce,f),listUnordered:o(Ce),paragraph:o(Te),reference:oe,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(ve),strong:o(Ee),thematicBreak:o(Oe)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:fe,autolinkProtocol:de,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:le,characterReference:ue,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:D,codeIndented:l(v),codeText:l(M),codeTextData:D,data:D,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:D,htmlText:l(j),htmlTextData:D,image:l(ee),label:ne,labelText:te,lineEnding:O,link:l(N),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:re,resourceTitleString:ie,resource:ae,setextHeading:l(T),setextHeadingLineSequence:w,setextHeadingText:C,strong:l(),thematicBreak:l()}};mD(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[],position:void 0},o={stack:[r],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:d,data:n},l=[],f=[],p=-1;for(;++p<e.length;)f.push(e[p]),(e[p][1].type===`listOrdered`||e[p][1].type===`listUnordered`)&&(e[p][0]===`enter`?l.push(f.length-1):a(f,l.pop()));for(e=f,p=-1;++p<e.length;){let n=t[e[p][0]];e[p][0]===`enter`&&t.beforeEnter.length>0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),uD.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||gD).call(o,void 0,e[0])}for(r.position={start:pD(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:pD(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p<t.transforms.length;)r=t.transforms[p](r)||r;return r}function i(e,t,n){let r=-1;for(;++r<e.length;)e[r].call(t,n)}function a(e,t){let n=e.length-1,r=t-1,i=-1,a=!1,o,s,c,l,u=[];for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let n=r;for(s=void 0;n--;){let t=e[n];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=n}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),u.push({at:s||r,event:[`exit`,o,t[2]]})}if(t[1].type===`listItemPrefix`){let e={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=e,u.push({at:r,event:[`enter`,e,t[2]]}),c=void 0,l=!0}}}let d=e.splice(t),f=0;for(r=-1;++r<d.length;){for(;f<u.length&&u[f].at===t+r;)e.push(u[f++].event);e.push(d[r])}e[t][1]._spread=a}function o(e,t){return n;function n(n){c.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:`fragment`,children:[]})}function c(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:pD(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),u.call(this,t)}}function u(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw Error("Cannot close `"+e.type+"` ("+IC({start:e.start,end:e.end})+`): it’s not open`);r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||gD).call(this,e,r[0])),n.position.end=pD(e.end)}function d(){return vw(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function h(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function v(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function y(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=jw(this.sliceSerialize(e)).toLowerCase()}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function x(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function S(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function C(){this.data.setextHeadingSlurpLineEnding=!0}function w(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=De(),n.position={start:pD(e.start),end:void 0},t.push(n)),this.stack.push(n)}function D(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=pD(e.end)}function O(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=pD(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),D.call(this,e))}function k(){this.data.atHardBreak=!0}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ee(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function te(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=cD(t),n.identifier=jw(t).toLowerCase()}function ne(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ae(){this.data.inReference=void 0}function oe(){this.data.referenceType=`collapsed`}function se(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=jw(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ce(e){this.data.characterReferenceType=e.type}function le(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Aw(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Cw(t);let i=this.stack[this.stack.length-1];i.value+=r}function ue(e){let t=this.stack.pop();t.position.end=pD(e.end)}function de(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function fe(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function pe(){return{type:`blockquote`,children:[],position:void 0}}function me(){return{type:`code`,lang:null,meta:null,value:``,position:void 0}}function he(){return{type:`inlineCode`,value:``,position:void 0}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``,position:void 0}}function _e(){return{type:`emphasis`,children:[],position:void 0}}function ve(){return{type:`heading`,depth:0,children:[],position:void 0}}function ye(){return{type:`break`,position:void 0}}function be(){return{type:`html`,value:``,position:void 0}}function xe(){return{type:`image`,title:null,url:``,alt:null,position:void 0}}function Se(){return{type:`link`,title:null,url:``,children:[],position:void 0}}function Ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[],position:void 0}}function we(e){return{type:`listItem`,spread:e._spread,checked:null,children:[],position:void 0}}function Te(){return{type:`paragraph`,children:[],position:void 0}}function Ee(){return{type:`strong`,children:[],position:void 0}}function De(){return{type:`text`,value:``,position:void 0}}function Oe(){return{type:`thematicBreak`,position:void 0}}}function pD(e){return{line:e.line,column:e.column,offset:e.offset}}function mD(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?mD(e,r):hD(e,r)}}function hD(e,t){let n;for(n in t)if(uD.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`afterExit`:case`beforeEnter`:{let r=t[n];r&&e[n].push(r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function gD(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+IC({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+IC({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+IC({start:t.start,end:t.end})+`) is still open`)}function _D(e){let t=this;t.parser=n;function n(n){return dD(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function vD(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function yD(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
62
- `}]}function bD(e,t){let n=t.value?t.value+`
63
- `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function xD(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function SD(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CD(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Ww(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function wD(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TD(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ED(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function DD(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ED(e,t);let i={src:Ww(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function OD(e,t){let n={src:Ww(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function kD(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function AD(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ED(e,t);let i={href:Ww(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function jD(e,t){let n={href:Ww(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function MD(e,t,n){let r=e.all(t),i=n?ND(n):PD(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
64
- `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
65
- `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function ND(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=PD(n[r])}return t}function PD(e){return e.spread??e.children.length>1}function FD(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function ID(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function LD(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function RD(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zD(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=NC(t.children[1]),o=MC(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function BD(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function VD(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var HD=9,UD=32;function WD(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(GD(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(GD(t.slice(i),i>0,!1)),a.join(``)}function GD(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===HD||t===UD;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===HD||t===UD;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function KD(e,t){let n={type:`text`,value:WD(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function qD(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var JD={blockquote:vD,break:yD,code:bD,delete:xD,emphasis:SD,footnoteReference:CD,heading:wD,html:TD,imageReference:DD,image:OD,inlineCode:kD,linkReference:AD,link:jD,listItem:MD,list:FD,paragraph:ID,root:LD,strong:RD,table:zD,tableCell:VD,tableRow:BD,text:KD,thematicBreak:qD,toml:YD,yaml:YD,definition:YD,footnoteDefinition:YD};function YD(){}var{defineProperty:XD}=Object,ZD=typeof self==`object`?self:globalThis,QD=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new ZD[e](t)},$D=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?XD(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof ZD[e]==`function`?QD(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(QD(a,o),i)};return r},eO=e=>$D(new Map,e)(0),tO=``,{toString:nO}={},{keys:rO,is:iO}=Object,aO=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=nO.call(e).slice(8,-1);switch(n){case`Array`:return[1,tO];case`Object`:return[2,tO];case`Date`:return[3,tO];case`RegExp`:return[4,tO];case`Map`:return[5,tO];case`Set`:return[6,tO];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},oO=([e,t])=>e===0&&(t===`function`||t===`symbol`),sO=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=aO(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&iO(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of rO(o))(e||!oO(aO(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?tO:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(oO(aO(n))||oO(aO(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!oO(aO(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},cO=(e,{json:t,lossy:n}={})=>{let r=[];return sO(!(t||n),!!t,new Map,r)(e),r},lO=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?eO(cO(e,t)):structuredClone(e):(e,t)=>eO(cO(e,t));function uO(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function dO(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function fO(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||uO,r=e.options.footnoteBackLabel||dO,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Ww(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...lO(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
66
- `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
67
- `}]}}var pO=(function(e){if(e==null)return vO;if(typeof e==`function`)return _O(e);if(typeof e==`object`)return Array.isArray(e)?mO(e):hO(e);if(typeof e==`string`)return gO(e);throw Error(`Expected function, string, or object as test`)});function mO(e){let t=[],n=-1;for(;++n<e.length;)t[n]=pO(e[n]);return _O(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function hO(e){let t=e;return _O(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function gO(e){return _O(t);function t(t){return t&&t.type===e}}function _O(e){return t;function t(t,n,r){return!!(Tne(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function vO(){return!0}function Tne(e){return typeof e==`object`&&!!e&&`type`in e}function Ene(e){return e}var yO=[];function bO(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=pO(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Ene(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=yO,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Dne(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Dne(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?yO:[e]}function xO(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),bO(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var SO={}.hasOwnProperty,One={};function kne(e,t){let n=t||One,r=new Map,i=new Map,a={all:s,applyData:jne,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...JD,...n.handlers},one:o,options:n,patch:Ane,wrap:Nne};return xO(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(SO.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=lO(n);return r.children=a.all(e),r}return lO(e)}return(a.options.unknownHandler||Mne)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=CO(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=CO(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Ane(e,t){e.position&&(t.position=FC(e))}function jne(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,lO(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Mne(e,t){let n=t.data||{},r=`value`in t&&!(SO.call(n,`hProperties`)||SO.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Nne(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
68
- `});++r<e.length;)r&&n.push({type:`text`,value:`
69
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
70
- `}),n}function CO(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function wO(e,t){let n=kne(e,t),r=n.one(e,void 0),i=fO(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
71
- `},i)),a}function Pne(e,t){return e&&`run`in e?async function(n,r){let i=wO(n,{file:r,...t});await e.run(i,r)}:function(n,r){return wO(n,{file:r,...e||t})}}function TO(e){if(e)throw e}var EO=e(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}))(),1);function DO(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Fne(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Ine(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Ine(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var OO={basename:Lne,dirname:Rne,extname:zne,join:Bne,sep:`/`};function Lne(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);kO(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Rne(e){if(kO(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function zne(e){kO(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Bne(...e){let t=-1,n;for(;++t<e.length;)kO(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Vne(n)}function Vne(e){kO(e);let t=e.codePointAt(0)===47,n=Hne(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Hne(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function kO(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Une={cwd:Wne};function Wne(){return`/`}function AO(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Gne(e){if(typeof e==`string`)e=new URL(e);else if(!AO(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Kne(e)}function Kne(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var jO=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],MO=class{constructor(e){let t;t=e?AO(e)?{path:e}:typeof e==`string`||qne(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Une.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<jO.length;){let e=jO[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)jO.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?OO.basename(this.path):void 0}set basename(e){PO(e,`basename`),NO(e,`basename`),this.path=OO.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?OO.dirname(this.path):void 0}set dirname(e){FO(this.basename,`dirname`),this.path=OO.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?OO.extname(this.path):void 0}set extname(e){if(NO(e,`extname`),FO(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=OO.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){AO(e)&&(e=Gne(e)),PO(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?OO.basename(this.path,this.extname):void 0}set stem(e){PO(e,`stem`),NO(e,`stem`),this.path=OO.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new BC(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function NO(e,t){if(e&&e.includes(OO.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+OO.sep+"`")}function PO(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function FO(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function qne(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Jne=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Yne={}.hasOwnProperty,Xne=new class e extends Jne{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Fne()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,EO.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(RO(`data`,this.frozen),this.namespace[e]=t,this):Yne.call(this.namespace,e)&&this.namespace[e]||void 0:e?(RO(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=VO(e),n=this.parser||this.Parser;return IO(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),IO(`process`,this.parser||this.Parser),LO(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=VO(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Qne(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),IO(`processSync`,this.parser||this.Parser),LO(`processSync`,this.compiler||this.Compiler),this.process(e,r),BO(`processSync`,`process`,t),n;function r(e,r){t=!0,TO(e),n=r}}run(e,t,n){zO(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=VO(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),BO(`runSync`,`run`,n),r;function i(e,t){TO(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=VO(t),r=this.compiler||this.Compiler;return LO(`stringify`,r),zO(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(RO(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,EO.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];DO(o)&&DO(r)&&(r=(0,EO.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function IO(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function LO(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function RO(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zO(e){if(!DO(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function BO(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function VO(e){return Zne(e)?e:new MO(e)}function Zne(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Qne(e){return typeof e==`string`||$ne(e)}function $ne(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var HO=[],UO={allowDangerousHtml:!0},ere=/^(https?|ircs?|mailto|xmpp)$/i,tre=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function nre(e){let t=rre(e),n=ire(e);return are(t.runSync(t.parse(n),n),e)}function rre(e){let t=e.rehypePlugins||HO,n=e.remarkPlugins||HO,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...UO}:UO;return Xne().use(_D).use(n).use(Pne,r).use(t)}function ire(e){let t=e.children||``,n=new MO;return typeof t==`string`?n.value=t:``+t,n}function are(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||WO;for(let e of tre)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return xO(e,l),JC(e,{Fragment:F.Fragment,components:i,ignoreInvalidStyle:!0,jsx:F.jsx,jsxs:F.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in gw)if(Object.hasOwn(gw,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=gw[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function WO(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||ere.test(e.slice(0,t))?e:``}var GO=/[#.]/g;function ore(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){GO.lastIndex=i;let e=GO.exec(n),t=n.slice(i,e?e.index:n.length);t&&(a?a===`#`?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:o=t,i+=t.length),e&&(a=e[0],i++)}return{type:`element`,tagName:o||t||`div`,properties:r,children:[]}}function KO(e,t,n){let r=n?ure(n):void 0;function i(n,i,...a){let o;if(n==null){o={type:`root`,children:[]};let e=i;a.unshift(e)}else{o=ore(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,sre(i))a.unshift(i);else for(let[t,n]of Object.entries(i))cre(e,o.properties,t,n)}for(let e of a)qO(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function sre(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,n=Object.keys(e);for(let e of n){let n=t[e];if(n&&typeof n==`object`){if(!Array.isArray(n))return!0;let e=n;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function cre(e,t,n,r){let i=nt(e,n),a;if(r!=null){if(typeof r==`number`){if(Number.isNaN(r))return;a=r}else a=typeof r==`boolean`?r:typeof r==`string`?i.spaceSeparated?wt(r):i.commaSeparated?jt(r):i.commaOrSpaceSeparated?wt(jt(r).join(` `)):JO(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?lre(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(JO(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function qO(e,t){if(t!=null){if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let n of t)qO(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?qO(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}}function JO(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||Et(n)===Et(t)))return!0}return n}function lre(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function ure(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var dre=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.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.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),fre=KO(Tt,`div`),pre=KO(vt,`g`,dre);function mre(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=YO(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=YO(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function YO(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
72
- `,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var XO={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},ZO={}.hasOwnProperty,hre=Object.prototype;function gre(e,t){let n=t||{};return QO({file:n.file||void 0,location:!1,schema:n.space===`svg`?vt:Tt,verbose:n.verbose||!1},e)}function QO(e,t){let n;switch(t.nodeName){case`#comment`:{let r=t;return n={type:`comment`,value:r.data},ek(e,r,n),n}case`#document`:case`#document-fragment`:{let r=t,i=`mode`in r?r.mode===`quirks`||r.mode===`limited-quirks`:!1;if(n={type:`root`,children:$O(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){let t=String(e.file),r=mre(t),i=r.toPoint(0),a=r.toPoint(t.length);n.position={start:i,end:a}}return n}case`#documentType`:{let r=t;return n={type:`doctype`},ek(e,r,n),n}case`#text`:{let r=t;return n={type:`text`,value:r.value},ek(e,r,n),n}default:return n=_re(e,t),n}}function $O(e,t){let n=-1,r=[];for(;++n<t.length;){let i=QO(e,t[n]);r.push(i)}return r}function _re(e,t){let n=e.schema;e.schema=t.namespaceURI===XO.svg?vt:Tt;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+`:`:``)+e.name;ZO.call(hre,n)||(i[n]=e.value)}let a=(e.schema.space===`svg`?pre:fre)(t.tagName,i,$O(e,t.childNodes));if(ek(e,t,a),a.tagName===`template`){let n=t,r=n.sourceCodeLocation,i=r&&r.startTag&&tk(r.startTag),o=r&&r.endTag&&tk(r.endTag),s=QO(e,n.content);i&&o&&e.file&&(s.position={start:i.end,end:o.start}),a.content=s}return e.schema=n,a}function ek(e,t,n){if(`sourceCodeLocation`in t&&t.sourceCodeLocation&&e.file){let r=vre(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function vre(e,t,n){let r=tk(n);if(t.type===`element`){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r={},i;if(n.attrs)for(i in n.attrs)ZO.call(n.attrs,i)&&(r[nt(e.schema,i).property]=tk(n.attrs[i]));n.startTag;let a=tk(n.startTag),o=n.endTag?tk(n.endTag):void 0,s={opening:a};o&&(s.closing=o),s.properties=r,t.data={position:s}}}return r}function tk(e){let t=nk({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=nk({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function nk(e){return e.line&&e.column?e:void 0}var yre={},bre={}.hasOwnProperty,rk=dt(`type`,{handlers:{root:Sre,element:Dre,text:Tre,comment:Ere,doctype:wre}});function xre(e,t){let n=(t||yre).space;return rk(e,n===`svg`?vt:Tt)}function Sre(e,t){let n={nodeName:`#document`,mode:(e.data||{}).quirksMode?`quirks`:`no-quirks`,childNodes:[]};return n.childNodes=ik(e.children,n,t),ak(e,n),n}function Cre(e,t){let n={nodeName:`#document-fragment`,childNodes:[]};return n.childNodes=ik(e.children,n,t),ak(e,n),n}function wre(e){let t={nodeName:`#documentType`,name:`html`,publicId:``,systemId:``,parentNode:null};return ak(e,t),t}function Tre(e){let t={nodeName:`#text`,value:e.value,parentNode:null};return ak(e,t),t}function Ere(e){let t={nodeName:`#comment`,data:e.value,parentNode:null};return ak(e,t),t}function Dre(e,t){let n=t,r=n;e.type===`element`&&e.tagName.toLowerCase()===`svg`&&n.space===`html`&&(r=vt);let i=[],a;if(e.properties){for(a in e.properties)if(a!==`children`&&bre.call(e.properties,a)){let t=Ore(r,a,e.properties[a]);t&&i.push(t)}}let o=r.space,s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:XO[o],childNodes:[],parentNode:null};return s.childNodes=ik(e.children,s,r),ak(e,s),e.tagName===`template`&&e.content&&(s.content=Cre(e.content,r)),s}function Ore(e,t,n){let r=nt(e,t);if(n===!1||n==null||typeof n==`number`&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?Pt(n):Ct(n));let i={name:r.attribute,value:n===!0?``:String(n)};if(r.space&&r.space!==`html`&&r.space!==`svg`){let e=i.name.indexOf(`:`);e<0?i.prefix=``:(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=XO[r.space]}return i}function ik(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let a=rk(e[r],n);a.parentNode=t,i.push(a)}return i}function ak(e,t){let n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}var kre=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),B;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(B||={});var ok={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function sk(e){return e>=55296&&e<=57343}function Are(e){return e>=56320&&e<=57343}function jre(e,t){return(e-55296)*1024+9216+t}function ck(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function lk(e){return e>=64976&&e<=65007||kre.has(e)}var V;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(V||={});var Mre=65536,Nre=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=Mre,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(Are(t))return this.pos++,this._addGap(),jre(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,B.EOF;return this._err(V.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;let n=this.html.charCodeAt(t);return n===B.CARRIAGE_RETURN?B.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;let e=this.html.charCodeAt(this.pos);return e===B.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,B.LINE_FEED):e===B.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,sk(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===B.LINE_FEED||e===B.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){ck(e)?this._err(V.controlCharacterInInputStream):lk(e)&&this._err(V.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},uk;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(uk||={});function dk(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var Pre=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),Fre=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function Ire(e){return e>=55296&&e<=57343||e>1114111?65533:Fre.get(e)??e}var fk;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(fk||={});var Lre=32,pk;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(pk||={});function mk(e){return e>=fk.ZERO&&e<=fk.NINE}function Rre(e){return e>=fk.UPPER_A&&e<=fk.UPPER_F||e>=fk.LOWER_A&&e<=fk.LOWER_F}function zre(e){return e>=fk.UPPER_A&&e<=fk.UPPER_Z||e>=fk.LOWER_A&&e<=fk.LOWER_Z||mk(e)}function Bre(e){return e===fk.EQUALS||zre(e)}var hk;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(hk||={});var gk;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(gk||={});var Vre=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=hk.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=gk.Strict}startEntity(e){this.decodeMode=e,this.state=hk.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case hk.EntityStart:return e.charCodeAt(t)===fk.NUM?(this.state=hk.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=hk.NamedEntity,this.stateNamedEntity(e,t));case hk.NumericStart:return this.stateNumericStart(e,t);case hk.NumericDecimal:return this.stateNumericDecimal(e,t);case hk.NumericHex:return this.stateNumericHex(e,t);case hk.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|Lre)===fk.LOWER_X?(this.state=hk.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=hk.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(mk(r)||Rre(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(mk(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===fk.SEMI)this.consumed+=1;else if(this.decodeMode===gk.Strict)return 0;return this.emitCodePoint(Ire(this.result),this.consumed),this.errors&&(e!==fk.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&pk.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=Hre(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===gk.Attribute&&(i===0||Bre(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&pk.VALUE_LENGTH)>>14,i!==0){if(a===fk.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==gk.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&pk.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~pk.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case hk.NamedEntity:return this.result!==0&&(this.decodeMode!==gk.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case hk.NumericDecimal:return this.emitNumericEntity(0,2);case hk.NumericHex:return this.emitNumericEntity(0,3);case hk.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case hk.EntityStart:return 0}}};function Hre(e,t,n,r){let i=(t&pk.BRANCH_LENGTH)>>7,a=t&pk.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var H;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(H||={});var _k;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(_k||={});var vk;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(vk||={});var U;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(U||={});var W;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(W||={});var Ure=new Map([[U.A,W.A],[U.ADDRESS,W.ADDRESS],[U.ANNOTATION_XML,W.ANNOTATION_XML],[U.APPLET,W.APPLET],[U.AREA,W.AREA],[U.ARTICLE,W.ARTICLE],[U.ASIDE,W.ASIDE],[U.B,W.B],[U.BASE,W.BASE],[U.BASEFONT,W.BASEFONT],[U.BGSOUND,W.BGSOUND],[U.BIG,W.BIG],[U.BLOCKQUOTE,W.BLOCKQUOTE],[U.BODY,W.BODY],[U.BR,W.BR],[U.BUTTON,W.BUTTON],[U.CAPTION,W.CAPTION],[U.CENTER,W.CENTER],[U.CODE,W.CODE],[U.COL,W.COL],[U.COLGROUP,W.COLGROUP],[U.DD,W.DD],[U.DESC,W.DESC],[U.DETAILS,W.DETAILS],[U.DIALOG,W.DIALOG],[U.DIR,W.DIR],[U.DIV,W.DIV],[U.DL,W.DL],[U.DT,W.DT],[U.EM,W.EM],[U.EMBED,W.EMBED],[U.FIELDSET,W.FIELDSET],[U.FIGCAPTION,W.FIGCAPTION],[U.FIGURE,W.FIGURE],[U.FONT,W.FONT],[U.FOOTER,W.FOOTER],[U.FOREIGN_OBJECT,W.FOREIGN_OBJECT],[U.FORM,W.FORM],[U.FRAME,W.FRAME],[U.FRAMESET,W.FRAMESET],[U.H1,W.H1],[U.H2,W.H2],[U.H3,W.H3],[U.H4,W.H4],[U.H5,W.H5],[U.H6,W.H6],[U.HEAD,W.HEAD],[U.HEADER,W.HEADER],[U.HGROUP,W.HGROUP],[U.HR,W.HR],[U.HTML,W.HTML],[U.I,W.I],[U.IMG,W.IMG],[U.IMAGE,W.IMAGE],[U.INPUT,W.INPUT],[U.IFRAME,W.IFRAME],[U.KEYGEN,W.KEYGEN],[U.LABEL,W.LABEL],[U.LI,W.LI],[U.LINK,W.LINK],[U.LISTING,W.LISTING],[U.MAIN,W.MAIN],[U.MALIGNMARK,W.MALIGNMARK],[U.MARQUEE,W.MARQUEE],[U.MATH,W.MATH],[U.MENU,W.MENU],[U.META,W.META],[U.MGLYPH,W.MGLYPH],[U.MI,W.MI],[U.MO,W.MO],[U.MN,W.MN],[U.MS,W.MS],[U.MTEXT,W.MTEXT],[U.NAV,W.NAV],[U.NOBR,W.NOBR],[U.NOFRAMES,W.NOFRAMES],[U.NOEMBED,W.NOEMBED],[U.NOSCRIPT,W.NOSCRIPT],[U.OBJECT,W.OBJECT],[U.OL,W.OL],[U.OPTGROUP,W.OPTGROUP],[U.OPTION,W.OPTION],[U.P,W.P],[U.PARAM,W.PARAM],[U.PLAINTEXT,W.PLAINTEXT],[U.PRE,W.PRE],[U.RB,W.RB],[U.RP,W.RP],[U.RT,W.RT],[U.RTC,W.RTC],[U.RUBY,W.RUBY],[U.S,W.S],[U.SCRIPT,W.SCRIPT],[U.SEARCH,W.SEARCH],[U.SECTION,W.SECTION],[U.SELECT,W.SELECT],[U.SOURCE,W.SOURCE],[U.SMALL,W.SMALL],[U.SPAN,W.SPAN],[U.STRIKE,W.STRIKE],[U.STRONG,W.STRONG],[U.STYLE,W.STYLE],[U.SUB,W.SUB],[U.SUMMARY,W.SUMMARY],[U.SUP,W.SUP],[U.TABLE,W.TABLE],[U.TBODY,W.TBODY],[U.TEMPLATE,W.TEMPLATE],[U.TEXTAREA,W.TEXTAREA],[U.TFOOT,W.TFOOT],[U.TD,W.TD],[U.TH,W.TH],[U.THEAD,W.THEAD],[U.TITLE,W.TITLE],[U.TR,W.TR],[U.TRACK,W.TRACK],[U.TT,W.TT],[U.U,W.U],[U.UL,W.UL],[U.SVG,W.SVG],[U.VAR,W.VAR],[U.WBR,W.WBR],[U.XMP,W.XMP]]);function yk(e){return Ure.get(e)??W.UNKNOWN}var G=W,Wre={[H.HTML]:new Set([G.ADDRESS,G.APPLET,G.AREA,G.ARTICLE,G.ASIDE,G.BASE,G.BASEFONT,G.BGSOUND,G.BLOCKQUOTE,G.BODY,G.BR,G.BUTTON,G.CAPTION,G.CENTER,G.COL,G.COLGROUP,G.DD,G.DETAILS,G.DIR,G.DIV,G.DL,G.DT,G.EMBED,G.FIELDSET,G.FIGCAPTION,G.FIGURE,G.FOOTER,G.FORM,G.FRAME,G.FRAMESET,G.H1,G.H2,G.H3,G.H4,G.H5,G.H6,G.HEAD,G.HEADER,G.HGROUP,G.HR,G.HTML,G.IFRAME,G.IMG,G.INPUT,G.LI,G.LINK,G.LISTING,G.MAIN,G.MARQUEE,G.MENU,G.META,G.NAV,G.NOEMBED,G.NOFRAMES,G.NOSCRIPT,G.OBJECT,G.OL,G.P,G.PARAM,G.PLAINTEXT,G.PRE,G.SCRIPT,G.SECTION,G.SELECT,G.SOURCE,G.STYLE,G.SUMMARY,G.TABLE,G.TBODY,G.TD,G.TEMPLATE,G.TEXTAREA,G.TFOOT,G.TH,G.THEAD,G.TITLE,G.TR,G.TRACK,G.UL,G.WBR,G.XMP]),[H.MATHML]:new Set([G.MI,G.MO,G.MN,G.MS,G.MTEXT,G.ANNOTATION_XML]),[H.SVG]:new Set([G.TITLE,G.FOREIGN_OBJECT,G.DESC]),[H.XLINK]:new Set,[H.XML]:new Set,[H.XMLNS]:new Set},bk=new Set([G.H1,G.H2,G.H3,G.H4,G.H5,G.H6]);U.STYLE,U.SCRIPT,U.XMP,U.IFRAME,U.NOEMBED,U.NOFRAMES,U.PLAINTEXT;var K;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(K||={});var xk={DATA:K.DATA,RCDATA:K.RCDATA,RAWTEXT:K.RAWTEXT,SCRIPT_DATA:K.SCRIPT_DATA,PLAINTEXT:K.PLAINTEXT,CDATA_SECTION:K.CDATA_SECTION};function Gre(e){return e>=B.DIGIT_0&&e<=B.DIGIT_9}function Sk(e){return e>=B.LATIN_CAPITAL_A&&e<=B.LATIN_CAPITAL_Z}function Kre(e){return e>=B.LATIN_SMALL_A&&e<=B.LATIN_SMALL_Z}function Ck(e){return Kre(e)||Sk(e)}function wk(e){return Ck(e)||Gre(e)}function Tk(e){return e+32}function Ek(e){return e===B.SPACE||e===B.LINE_FEED||e===B.TABULATION||e===B.FORM_FEED}function Dk(e){return Ek(e)||e===B.SOLIDUS||e===B.GREATER_THAN_SIGN}function qre(e){return e===B.NULL?V.nullCharacterReference:e>1114111?V.characterReferenceOutsideUnicodeRange:sk(e)?V.surrogateCharacterReference:lk(e)?V.noncharacterCharacterReference:ck(e)||e===B.CARRIAGE_RETURN?V.controlCharacterReference:null}var Jre=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=K.DATA,this.returnState=K.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new Nre(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Vre(Pre,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(V.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(V.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=qre(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:uk.START_TAG,tagName:``,tagID:W.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:uk.END_TAG,tagName:``,tagID:W.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:uk.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:uk.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e;let t=this.currentToken;if(dk(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(V.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=yk(e.tagName),e.type===uk.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(V.endTagWithAttributes),e.selfClosing&&this._err(V.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case uk.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case uk.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case uk.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:uk.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken){if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk()}this._createCharacterToken(e,t)}_emitCodePoint(e){let t=Ek(e)?uk.WHITESPACE_CHARACTER:e===B.NULL?uk.NULL_CHARACTER:uk.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(uk.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=K.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?gk.Attribute:gk.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===K.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===K.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===K.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case K.DATA:this._stateData(e);break;case K.RCDATA:this._stateRcdata(e);break;case K.RAWTEXT:this._stateRawtext(e);break;case K.SCRIPT_DATA:this._stateScriptData(e);break;case K.PLAINTEXT:this._statePlaintext(e);break;case K.TAG_OPEN:this._stateTagOpen(e);break;case K.END_TAG_OPEN:this._stateEndTagOpen(e);break;case K.TAG_NAME:this._stateTagName(e);break;case K.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case K.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case K.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case K.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case K.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case K.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case K.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case K.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case K.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case K.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case K.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case K.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case K.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case K.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case K.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case K.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case K.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case K.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case K.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case K.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case K.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case K.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case K.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case K.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case K.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case K.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case K.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case K.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case K.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case K.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case K.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case K.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case K.BOGUS_COMMENT:this._stateBogusComment(e);break;case K.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case K.COMMENT_START:this._stateCommentStart(e);break;case K.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case K.COMMENT:this._stateComment(e);break;case K.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case K.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case K.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case K.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case K.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case K.COMMENT_END:this._stateCommentEnd(e);break;case K.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case K.DOCTYPE:this._stateDoctype(e);break;case K.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case K.DOCTYPE_NAME:this._stateDoctypeName(e);break;case K.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case K.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case K.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case K.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case K.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case K.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case K.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case K.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case K.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case K.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case K.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case K.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case K.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case K.CDATA_SECTION:this._stateCdataSection(e);break;case K.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case K.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case K.CHARACTER_REFERENCE:this._stateCharacterReference();break;case K.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case B.LESS_THAN_SIGN:this.state=K.TAG_OPEN;break;case B.AMPERSAND:this._startCharacterReference();break;case B.NULL:this._err(V.unexpectedNullCharacter),this._emitCodePoint(e);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case B.AMPERSAND:this._startCharacterReference();break;case B.LESS_THAN_SIGN:this.state=K.RCDATA_LESS_THAN_SIGN;break;case B.NULL:this._err(V.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case B.LESS_THAN_SIGN:this.state=K.RAWTEXT_LESS_THAN_SIGN;break;case B.NULL:this._err(V.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case B.LESS_THAN_SIGN:this.state=K.SCRIPT_DATA_LESS_THAN_SIGN;break;case B.NULL:this._err(V.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case B.NULL:this._err(V.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Ck(e))this._createStartTagToken(),this.state=K.TAG_NAME,this._stateTagName(e);else switch(e){case B.EXCLAMATION_MARK:this.state=K.MARKUP_DECLARATION_OPEN;break;case B.SOLIDUS:this.state=K.END_TAG_OPEN;break;case B.QUESTION_MARK:this._err(V.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=K.BOGUS_COMMENT,this._stateBogusComment(e);break;case B.EOF:this._err(V.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(V.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=K.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Ck(e))this._createEndTagToken(),this.state=K.TAG_NAME,this._stateTagName(e);else switch(e){case B.GREATER_THAN_SIGN:this._err(V.missingEndTagName),this.state=K.DATA;break;case B.EOF:this._err(V.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(V.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=K.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=K.BEFORE_ATTRIBUTE_NAME;break;case B.SOLIDUS:this.state=K.SELF_CLOSING_START_TAG;break;case B.GREATER_THAN_SIGN:this.state=K.DATA,this.emitCurrentTagToken();break;case B.NULL:this._err(V.unexpectedNullCharacter),t.tagName+=`�`;break;case B.EOF:this._err(V.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(Sk(e)?Tk(e):e)}}_stateRcdataLessThanSign(e){e===B.SOLIDUS?this.state=K.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=K.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Ck(e)?(this.state=K.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=K.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=K.BEFORE_ATTRIBUTE_NAME,!1;case B.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=K.SELF_CLOSING_START_TAG,!1;case B.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=K.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=K.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===B.SOLIDUS?this.state=K.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=K.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Ck(e)?(this.state=K.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=K.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=K.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case B.SOLIDUS:this.state=K.SCRIPT_DATA_END_TAG_OPEN;break;case B.EXCLAMATION_MARK:this.state=K.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=K.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Ck(e)?(this.state=K.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=K.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=K.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===B.HYPHEN_MINUS?(this.state=K.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=K.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===B.HYPHEN_MINUS?(this.state=K.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=K.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case B.HYPHEN_MINUS:this.state=K.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=K.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case B.NULL:this._err(V.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case B.HYPHEN_MINUS:this.state=K.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=K.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case B.NULL:this._err(V.unexpectedNullCharacter),this.state=K.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=K.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=K.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case B.GREATER_THAN_SIGN:this.state=K.SCRIPT_DATA,this._emitChars(`>`);break;case B.NULL:this._err(V.unexpectedNullCharacter),this.state=K.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=K.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===B.SOLIDUS?this.state=K.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ck(e)?(this._emitChars(`<`),this.state=K.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=K.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Ck(e)?(this.state=K.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=K.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=K.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(ok.SCRIPT,!1)&&Dk(this.preprocessor.peek(ok.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<ok.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=K.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case B.HYPHEN_MINUS:this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case B.NULL:this._err(V.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case B.HYPHEN_MINUS:this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case B.NULL:this._err(V.unexpectedNullCharacter),this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case B.GREATER_THAN_SIGN:this.state=K.SCRIPT_DATA,this._emitChars(`>`);break;case B.NULL:this._err(V.unexpectedNullCharacter),this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===B.SOLIDUS?(this.state=K.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(ok.SCRIPT,!1)&&Dk(this.preprocessor.peek(ok.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<ok.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=K.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=K.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:this.state=K.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case B.EQUALS_SIGN:this._err(V.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=K.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=K.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:this._leaveAttrName(),this.state=K.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case B.EQUALS_SIGN:this._leaveAttrName(),this.state=K.BEFORE_ATTRIBUTE_VALUE;break;case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:this._err(V.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case B.NULL:this._err(V.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(Sk(e)?Tk(e):e)}}_stateAfterAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:this.state=K.SELF_CLOSING_START_TAG;break;case B.EQUALS_SIGN:this.state=K.BEFORE_ATTRIBUTE_VALUE;break;case B.GREATER_THAN_SIGN:this.state=K.DATA,this.emitCurrentTagToken();break;case B.EOF:this._err(V.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=K.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:this.state=K.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case B.APOSTROPHE:this.state=K.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(V.missingAttributeValue),this.state=K.DATA,this.emitCurrentTagToken();break;default:this.state=K.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case B.QUOTATION_MARK:this.state=K.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case B.AMPERSAND:this._startCharacterReference();break;case B.NULL:this._err(V.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case B.EOF:this._err(V.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case B.APOSTROPHE:this.state=K.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case B.AMPERSAND:this._startCharacterReference();break;case B.NULL:this._err(V.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case B.EOF:this._err(V.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this._leaveAttrValue(),this.state=K.BEFORE_ATTRIBUTE_NAME;break;case B.AMPERSAND:this._startCharacterReference();break;case B.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=K.DATA,this.emitCurrentTagToken();break;case B.NULL:this._err(V.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:case B.EQUALS_SIGN:case B.GRAVE_ACCENT:this._err(V.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case B.EOF:this._err(V.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this._leaveAttrValue(),this.state=K.BEFORE_ATTRIBUTE_NAME;break;case B.SOLIDUS:this._leaveAttrValue(),this.state=K.SELF_CLOSING_START_TAG;break;case B.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=K.DATA,this.emitCurrentTagToken();break;case B.EOF:this._err(V.eofInTag),this._emitEOFToken();break;default:this._err(V.missingWhitespaceBetweenAttributes),this.state=K.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case B.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=K.DATA,this.emitCurrentTagToken();break}case B.EOF:this._err(V.eofInTag),this._emitEOFToken();break;default:this._err(V.unexpectedSolidusInTag),this.state=K.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:this.state=K.DATA,this.emitCurrentComment(t);break;case B.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case B.NULL:this._err(V.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(ok.DASH_DASH,!0)?(this._createCommentToken(ok.DASH_DASH.length+1),this.state=K.COMMENT_START):this._consumeSequenceIfMatch(ok.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(ok.DOCTYPE.length+1),this.state=K.DOCTYPE):this._consumeSequenceIfMatch(ok.CDATA_START,!0)?this.inForeignNode?this.state=K.CDATA_SECTION:(this._err(V.cdataInHtmlContent),this._createCommentToken(ok.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=K.BOGUS_COMMENT):this._ensureHibernation()||(this._err(V.incorrectlyOpenedComment),this._createCommentToken(2),this.state=K.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case B.HYPHEN_MINUS:this.state=K.COMMENT_START_DASH;break;case B.GREATER_THAN_SIGN:{this._err(V.abruptClosingOfEmptyComment),this.state=K.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=K.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:this.state=K.COMMENT_END;break;case B.GREATER_THAN_SIGN:this._err(V.abruptClosingOfEmptyComment),this.state=K.DATA,this.emitCurrentComment(t);break;case B.EOF:this._err(V.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=K.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:this.state=K.COMMENT_END_DASH;break;case B.LESS_THAN_SIGN:t.data+=`<`,this.state=K.COMMENT_LESS_THAN_SIGN;break;case B.NULL:this._err(V.unexpectedNullCharacter),t.data+=`�`;break;case B.EOF:this._err(V.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case B.EXCLAMATION_MARK:t.data+=`!`,this.state=K.COMMENT_LESS_THAN_SIGN_BANG;break;case B.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=K.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===B.HYPHEN_MINUS?this.state=K.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=K.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===B.HYPHEN_MINUS?this.state=K.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=K.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==B.GREATER_THAN_SIGN&&e!==B.EOF&&this._err(V.nestedComment),this.state=K.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:this.state=K.COMMENT_END;break;case B.EOF:this._err(V.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=K.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:this.state=K.DATA,this.emitCurrentComment(t);break;case B.EXCLAMATION_MARK:this.state=K.COMMENT_END_BANG;break;case B.HYPHEN_MINUS:t.data+=`-`;break;case B.EOF:this._err(V.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=K.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:t.data+=`--!`,this.state=K.COMMENT_END_DASH;break;case B.GREATER_THAN_SIGN:this._err(V.incorrectlyClosedComment),this.state=K.DATA,this.emitCurrentComment(t);break;case B.EOF:this._err(V.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=K.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=K.BEFORE_DOCTYPE_NAME;break;case B.GREATER_THAN_SIGN:this.state=K.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case B.EOF:{this._err(V.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(V.missingWhitespaceBeforeDoctypeName),this.state=K.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Sk(e))this._createDoctypeToken(String.fromCharCode(Tk(e))),this.state=K.DOCTYPE_NAME;else switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.NULL:this._err(V.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=K.DOCTYPE_NAME;break;case B.GREATER_THAN_SIGN:{this._err(V.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=K.DATA;break}case B.EOF:{this._err(V.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=K.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=K.AFTER_DOCTYPE_NAME;break;case B.GREATER_THAN_SIGN:this.state=K.DATA,this.emitCurrentDoctype(t);break;case B.NULL:this._err(V.unexpectedNullCharacter),t.name+=`�`;break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(Sk(e)?Tk(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:this.state=K.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(ok.PUBLIC,!1)?this.state=K.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(ok.SYSTEM,!1)?this.state=K.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(V.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=K.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=K.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case B.QUOTATION_MARK:this._err(V.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=K.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:this._err(V.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=K.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(V.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=K.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(V.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=K.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:t.publicId=``,this.state=K.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:t.publicId=``,this.state=K.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(V.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=K.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(V.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=K.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case B.QUOTATION_MARK:this.state=K.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case B.NULL:this._err(V.unexpectedNullCharacter),t.publicId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(V.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=K.DATA;break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case B.APOSTROPHE:this.state=K.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case B.NULL:this._err(V.unexpectedNullCharacter),t.publicId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(V.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=K.DATA;break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=K.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case B.GREATER_THAN_SIGN:this.state=K.DATA,this.emitCurrentDoctype(t);break;case B.QUOTATION_MARK:this._err(V.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=K.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:this._err(V.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=K.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(V.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=K.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=K.DATA;break;case B.QUOTATION_MARK:t.systemId=``,this.state=K.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:t.systemId=``,this.state=K.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(V.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=K.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=K.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case B.QUOTATION_MARK:this._err(V.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=K.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:this._err(V.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=K.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(V.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=K.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(V.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=K.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:t.systemId=``,this.state=K.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:t.systemId=``,this.state=K.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(V.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=K.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(V.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=K.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case B.QUOTATION_MARK:this.state=K.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case B.NULL:this._err(V.unexpectedNullCharacter),t.systemId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(V.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=K.DATA;break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case B.APOSTROPHE:this.state=K.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case B.NULL:this._err(V.unexpectedNullCharacter),t.systemId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(V.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=K.DATA;break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=K.DATA;break;case B.EOF:this._err(V.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(V.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=K.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=K.DATA;break;case B.NULL:this._err(V.unexpectedNullCharacter);break;case B.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case B.RIGHT_SQUARE_BRACKET:this.state=K.CDATA_SECTION_BRACKET;break;case B.EOF:this._err(V.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===B.RIGHT_SQUARE_BRACKET?this.state=K.CDATA_SECTION_END:(this._emitChars(`]`),this.state=K.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case B.GREATER_THAN_SIGN:this.state=K.DATA;break;case B.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=K.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0){if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(B.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&wk(this.preprocessor.peek(1))?K.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){wk(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===B.SEMICOLON&&this._err(V.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},Ok=new Set([W.DD,W.DT,W.LI,W.OPTGROUP,W.OPTION,W.P,W.RB,W.RP,W.RT,W.RTC]),kk=new Set([...Ok,W.CAPTION,W.COLGROUP,W.TBODY,W.TD,W.TFOOT,W.TH,W.THEAD,W.TR]),Ak=new Set([W.APPLET,W.CAPTION,W.HTML,W.MARQUEE,W.OBJECT,W.TABLE,W.TD,W.TEMPLATE,W.TH]),Yre=new Set([...Ak,W.OL,W.UL]),Xre=new Set([...Ak,W.BUTTON]),jk=new Set([W.ANNOTATION_XML,W.MI,W.MN,W.MO,W.MS,W.MTEXT]),Mk=new Set([W.DESC,W.FOREIGN_OBJECT,W.TITLE]),Zre=new Set([W.TR,W.TEMPLATE,W.HTML]),Qre=new Set([W.TBODY,W.TFOOT,W.THEAD,W.TEMPLATE,W.HTML]),$re=new Set([W.TABLE,W.TEMPLATE,W.HTML]),eie=new Set([W.TD,W.TH]),tie=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=W.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===W.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===H.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==H.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(bk,H.HTML)}popUntilTableCellPopped(){this.popUntilPopped(eie,H.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo($re,H.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Qre,H.HTML)}clearBackToTableRowContext(){this.clearBackTo(Zre,H.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===W.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===W.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case H.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case H.SVG:if(Mk.has(r))return!1;break;case H.MATHML:if(jk.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Ak)}hasInListItemScope(e){return this.hasInDynamicScope(e,Yre)}hasInButtonScope(e){return this.hasInDynamicScope(e,Xre)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case H.HTML:if(bk.has(t))return!0;if(Ak.has(t))return!1;break;case H.SVG:if(Mk.has(t))return!1;break;case H.MATHML:if(jk.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===H.HTML)switch(this.tagIDs[t]){case e:return!0;case W.TABLE:case W.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===H.HTML)switch(this.tagIDs[e]){case W.TBODY:case W.THEAD:case W.TFOOT:return!0;case W.TABLE:case W.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===H.HTML)switch(this.tagIDs[t]){case e:return!0;case W.OPTION:case W.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Ok.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&kk.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&kk.has(this.currentTagId);)this.pop()}},Nk=3,Pk;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(Pk||={});var Fk={type:Pk.Marker},nie=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===Pk.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<Nk)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<Nk)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=Nk&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(Fk)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:Pk.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:Pk.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(Fk);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===Pk.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===Pk.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===Pk.Element&&t.element===e)}},Ik={createDocument(){return{nodeName:`#document`,mode:vk.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};Ik.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(Ik.isTextNode(n)){n.value+=t;return}}Ik.appendChild(e,Ik.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Ik.isTextNode(r)?r.value+=t:Ik.insertBefore(e,Ik.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},Lk=`html`,rie=`about:legacy-compat`,iie=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,Rk=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),aie=[...Rk,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],oie=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),zk=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],sie=[...zk,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function Bk(e,t){return t.some(t=>e.startsWith(t))}function cie(e){return e.name===Lk&&e.publicId===null&&(e.systemId===null||e.systemId===rie)}function lie(e){if(e.name!==Lk)return vk.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===iie)return vk.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),oie.has(n))return vk.QUIRKS;let e=t===null?aie:Rk;if(Bk(n,e))return vk.QUIRKS;if(e=t===null?zk:sie,Bk(n,e))return vk.LIMITED_QUIRKS}return vk.NO_QUIRKS}var Vk={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},uie=`definitionurl`,die=`definitionURL`,fie=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),pie=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:H.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:H.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:H.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:H.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:H.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:H.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:H.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:H.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:H.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:H.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:H.XMLNS}]]),mie=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),hie=new Set([W.B,W.BIG,W.BLOCKQUOTE,W.BODY,W.BR,W.CENTER,W.CODE,W.DD,W.DIV,W.DL,W.DT,W.EM,W.EMBED,W.H1,W.H2,W.H3,W.H4,W.H5,W.H6,W.HEAD,W.HR,W.I,W.IMG,W.LI,W.LISTING,W.MENU,W.META,W.NOBR,W.OL,W.P,W.PRE,W.RUBY,W.S,W.SMALL,W.SPAN,W.STRONG,W.STRIKE,W.SUB,W.SUP,W.TABLE,W.TT,W.U,W.UL,W.VAR]);function gie(e){let t=e.tagID;return t===W.FONT&&e.attrs.some(({name:e})=>e===_k.COLOR||e===_k.SIZE||e===_k.FACE)||hie.has(t)}function Hk(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===uie){e.attrs[t].name=die;break}}function Uk(e){for(let t=0;t<e.attrs.length;t++){let n=fie.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Wk(e){for(let t=0;t<e.attrs.length;t++){let n=pie.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function _ie(e){let t=mie.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=yk(e.tagName))}function vie(e,t){return t===H.MATHML&&(e===W.MI||e===W.MO||e===W.MN||e===W.MS||e===W.MTEXT)}function yie(e,t,n){if(t===H.MATHML&&e===W.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===_k.ENCODING){let t=n[e].value.toLowerCase();return t===Vk.TEXT_HTML||t===Vk.APPLICATION_XML}}return t===H.SVG&&(e===W.FOREIGN_OBJECT||e===W.DESC||e===W.TITLE)}function bie(e,t,n,r){return(!r||r===H.HTML)&&yie(e,t,n)||(!r||r===H.MATHML)&&vie(e,t)}var xie=`hidden`,Sie=8,Cie=3,q;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(q||={});var wie={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Gk=new Set([W.TABLE,W.TBODY,W.TFOOT,W.THEAD,W.TR]),Kk={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Ik,onParseError:null},qk=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=q.INITIAL,this.originalInsertionMode=q.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...Kk,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new Jre(this.options,this),this.activeFormattingElements=new nie(this.treeAdapter),this.fragmentContextID=n?yk(this.treeAdapter.getTagName(n)):W.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new tie(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...Kk,...t};e??=n.treeAdapter.createElement(U.TEMPLATE,H.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,H.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===W.TEMPLATE&&i.tmplInsertionModeStack.unshift(q.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??wie,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===H.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,H.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=q.TEXT}switchToPlaintextParsing(){this.insertionMode=q.TEXT,this.originalInsertionMode=q.IN_BODY,this.tokenizer.state=xk.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===U.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(this.fragmentContext&&this.treeAdapter.getNamespaceURI(this.fragmentContext)===H.HTML)switch(this.fragmentContextID){case W.TITLE:case W.TEXTAREA:this.tokenizer.state=xk.RCDATA;break;case W.STYLE:case W.XMP:case W.IFRAME:case W.NOEMBED:case W.NOFRAMES:case W.NOSCRIPT:this.tokenizer.state=xk.RAWTEXT;break;case W.SCRIPT:this.tokenizer.state=xk.SCRIPT_DATA;break;case W.PLAINTEXT:this.tokenizer.state=xk.PLAINTEXT}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,H.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,H.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(U.HTML,H.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,W.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===uk.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===W.SVG&&this.treeAdapter.getTagName(t)===U.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===H.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===W.MGLYPH||e.tagID===W.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,H.HTML)}_processToken(e){switch(e.type){case uk.CHARACTER:this.onCharacter(e);break;case uk.NULL_CHARACTER:this.onNullCharacter(e);break;case uk.COMMENT:this.onComment(e);break;case uk.DOCTYPE:this.onDoctype(e);break;case uk.START_TAG:this._processStartTag(e);break;case uk.END_TAG:this.onEndTag(e);break;case uk.EOF:this.onEof(e);break;case uk.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){return bie(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===Pk.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=q.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(W.P),this.openElements.popUntilTagNamePopped(W.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case W.TR:this.insertionMode=q.IN_ROW;return;case W.TBODY:case W.THEAD:case W.TFOOT:this.insertionMode=q.IN_TABLE_BODY;return;case W.CAPTION:this.insertionMode=q.IN_CAPTION;return;case W.COLGROUP:this.insertionMode=q.IN_COLUMN_GROUP;return;case W.TABLE:this.insertionMode=q.IN_TABLE;return;case W.BODY:this.insertionMode=q.IN_BODY;return;case W.FRAMESET:this.insertionMode=q.IN_FRAMESET;return;case W.SELECT:this._resetInsertionModeForSelect(e);return;case W.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case W.HTML:this.insertionMode=this.headElement?q.AFTER_HEAD:q.BEFORE_HEAD;return;case W.TD:case W.TH:if(e>0){this.insertionMode=q.IN_CELL;return}break;case W.HEAD:if(e>0){this.insertionMode=q.IN_HEAD;return}}this.insertionMode=q.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===W.TEMPLATE)break;if(e===W.TABLE){this.insertionMode=q.IN_SELECT_IN_TABLE;return}}this.insertionMode=q.IN_SELECT}_isElementCausesFosterParenting(e){return Gk.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case W.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===H.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case W.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return Wre[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)XA(this,e);else switch(this.insertionMode){case q.INITIAL:Zk(this,e);break;case q.BEFORE_HTML:Qk(this,e);break;case q.BEFORE_HEAD:$k(this,e);break;case q.IN_HEAD:nA(this,e);break;case q.IN_HEAD_NO_SCRIPT:rA(this,e);break;case q.AFTER_HEAD:iA(this,e);break;case q.IN_BODY:case q.IN_CAPTION:case q.IN_CELL:case q.IN_TEMPLATE:sA(this,e);break;case q.TEXT:case q.IN_SELECT:case q.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case q.IN_TABLE:case q.IN_TABLE_BODY:case q.IN_ROW:gA(this,e);break;case q.IN_TABLE_TEXT:xA(this,e);break;case q.IN_COLUMN_GROUP:TA(this,e);break;case q.AFTER_BODY:VA(this,e);break;case q.AFTER_AFTER_BODY:qA(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)YA(this,e);else switch(this.insertionMode){case q.INITIAL:Zk(this,e);break;case q.BEFORE_HTML:Qk(this,e);break;case q.BEFORE_HEAD:$k(this,e);break;case q.IN_HEAD:nA(this,e);break;case q.IN_HEAD_NO_SCRIPT:rA(this,e);break;case q.AFTER_HEAD:iA(this,e);break;case q.TEXT:this._insertCharacters(e);break;case q.IN_TABLE:case q.IN_TABLE_BODY:case q.IN_ROW:gA(this,e);break;case q.IN_COLUMN_GROUP:TA(this,e);break;case q.AFTER_BODY:VA(this,e);break;case q.AFTER_AFTER_BODY:qA(this,e)}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML)Yk(this,e);else switch(this.insertionMode){case q.INITIAL:case q.BEFORE_HTML:case q.BEFORE_HEAD:case q.IN_HEAD:case q.IN_HEAD_NO_SCRIPT:case q.AFTER_HEAD:case q.IN_BODY:case q.IN_TABLE:case q.IN_CAPTION:case q.IN_COLUMN_GROUP:case q.IN_TABLE_BODY:case q.IN_ROW:case q.IN_CELL:case q.IN_SELECT:case q.IN_SELECT_IN_TABLE:case q.IN_TEMPLATE:case q.IN_FRAMESET:case q.AFTER_FRAMESET:Yk(this,e);break;case q.IN_TABLE_TEXT:SA(this,e);break;case q.AFTER_BODY:jie(this,e);break;case q.AFTER_AFTER_BODY:case q.AFTER_AFTER_FRAMESET:Mie(this,e)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case q.INITIAL:Nie(this,e);break;case q.BEFORE_HEAD:case q.IN_HEAD:case q.IN_HEAD_NO_SCRIPT:case q.AFTER_HEAD:this._err(e,V.misplacedDoctype);break;case q.IN_TABLE_TEXT:SA(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,V.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?QA(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case q.INITIAL:Zk(this,e);break;case q.BEFORE_HTML:Pie(this,e);break;case q.BEFORE_HEAD:Iie(this,e);break;case q.IN_HEAD:eA(this,e);break;case q.IN_HEAD_NO_SCRIPT:zie(this,e);break;case q.AFTER_HEAD:Vie(this,e);break;case q.IN_BODY:fA(this,e);break;case q.IN_TABLE:_A(this,e);break;case q.IN_TABLE_TEXT:SA(this,e);break;case q.IN_CAPTION:Lae(this,e);break;case q.IN_COLUMN_GROUP:wA(this,e);break;case q.IN_TABLE_BODY:EA(this,e);break;case q.IN_ROW:OA(this,e);break;case q.IN_CELL:AA(this,e);break;case q.IN_SELECT:MA(this,e);break;case q.IN_SELECT_IN_TABLE:PA(this,e);break;case q.IN_TEMPLATE:IA(this,e);break;case q.AFTER_BODY:zA(this,e);break;case q.IN_FRAMESET:HA(this,e);break;case q.AFTER_FRAMESET:WA(this,e);break;case q.AFTER_AFTER_BODY:KA(this,e);break;case q.AFTER_AFTER_FRAMESET:JA(this,e)}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?$A(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case q.INITIAL:Zk(this,e);break;case q.BEFORE_HTML:Fie(this,e);break;case q.BEFORE_HEAD:Lie(this,e);break;case q.IN_HEAD:Rie(this,e);break;case q.IN_HEAD_NO_SCRIPT:Bie(this,e);break;case q.AFTER_HEAD:Hie(this,e);break;case q.IN_BODY:mA(this,e);break;case q.TEXT:Dae(this,e);break;case q.IN_TABLE:vA(this,e);break;case q.IN_TABLE_TEXT:SA(this,e);break;case q.IN_CAPTION:Rae(this,e);break;case q.IN_COLUMN_GROUP:zae(this,e);break;case q.IN_TABLE_BODY:DA(this,e);break;case q.IN_ROW:kA(this,e);break;case q.IN_CELL:jA(this,e);break;case q.IN_SELECT:NA(this,e);break;case q.IN_SELECT_IN_TABLE:FA(this,e);break;case q.IN_TEMPLATE:LA(this,e);break;case q.AFTER_BODY:BA(this,e);break;case q.IN_FRAMESET:UA(this,e);break;case q.AFTER_FRAMESET:GA(this,e);break;case q.AFTER_AFTER_BODY:qA(this,e)}}onEof(e){switch(this.insertionMode){case q.INITIAL:Zk(this,e);break;case q.BEFORE_HTML:Qk(this,e);break;case q.BEFORE_HEAD:$k(this,e);break;case q.IN_HEAD:nA(this,e);break;case q.IN_HEAD_NO_SCRIPT:rA(this,e);break;case q.AFTER_HEAD:iA(this,e);break;case q.IN_BODY:case q.IN_TABLE:case q.IN_CAPTION:case q.IN_COLUMN_GROUP:case q.IN_TABLE_BODY:case q.IN_ROW:case q.IN_CELL:case q.IN_SELECT:case q.IN_SELECT_IN_TABLE:hA(this,e);break;case q.TEXT:Oae(this,e);break;case q.IN_TABLE_TEXT:SA(this,e);break;case q.IN_TEMPLATE:RA(this,e);break;case q.AFTER_BODY:case q.IN_FRAMESET:case q.AFTER_FRAMESET:case q.AFTER_AFTER_BODY:case q.AFTER_AFTER_FRAMESET:Xk(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===B.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode)this._insertCharacters(e);else switch(this.insertionMode){case q.IN_HEAD:case q.IN_HEAD_NO_SCRIPT:case q.AFTER_HEAD:case q.TEXT:case q.IN_COLUMN_GROUP:case q.IN_SELECT:case q.IN_SELECT_IN_TABLE:case q.IN_FRAMESET:case q.AFTER_FRAMESET:this._insertCharacters(e);break;case q.IN_BODY:case q.IN_CAPTION:case q.IN_CELL:case q.IN_TEMPLATE:case q.AFTER_BODY:case q.AFTER_AFTER_BODY:case q.AFTER_AFTER_FRAMESET:oA(this,e);break;case q.IN_TABLE:case q.IN_TABLE_BODY:case q.IN_ROW:gA(this,e);break;case q.IN_TABLE_TEXT:bA(this,e)}}};function Tie(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):pA(e,t),n}function Eie(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function Die(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=Cie;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=Oie(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function Oie(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function kie(e,t,n){let r=yk(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===W.TEMPLATE&&i===H.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function Aie(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function Jk(e,t){for(let n=0;n<Sie;n++){let n=Tie(e,t);if(!n)break;let r=Eie(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=Die(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&kie(e,a,i),Aie(e,r,n)}}function Yk(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function jie(e,t){e._appendCommentNode(t,e.openElements.items[0])}function Mie(e,t){e._appendCommentNode(t,e.document)}function Xk(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function Nie(e,t){e._setDocumentType(t);let n=t.forceQuirks?vk.QUIRKS:lie(t);cie(t)||e._err(t,V.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=q.BEFORE_HTML}function Zk(e,t){e._err(t,V.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,vk.QUIRKS),e.insertionMode=q.BEFORE_HTML,e._processToken(t)}function Pie(e,t){t.tagID===W.HTML?(e._insertElement(t,H.HTML),e.insertionMode=q.BEFORE_HEAD):Qk(e,t)}function Fie(e,t){let n=t.tagID;(n===W.HTML||n===W.HEAD||n===W.BODY||n===W.BR)&&Qk(e,t)}function Qk(e,t){e._insertFakeRootElement(),e.insertionMode=q.BEFORE_HEAD,e._processToken(t)}function Iie(e,t){switch(t.tagID){case W.HTML:fA(e,t);break;case W.HEAD:e._insertElement(t,H.HTML),e.headElement=e.openElements.current,e.insertionMode=q.IN_HEAD;break;default:$k(e,t)}}function Lie(e,t){let n=t.tagID;n===W.HEAD||n===W.BODY||n===W.HTML||n===W.BR?$k(e,t):e._err(t,V.endTagWithoutMatchingOpenElement)}function $k(e,t){e._insertFakeElement(U.HEAD,W.HEAD),e.headElement=e.openElements.current,e.insertionMode=q.IN_HEAD,e._processToken(t)}function eA(e,t){switch(t.tagID){case W.HTML:fA(e,t);break;case W.BASE:case W.BASEFONT:case W.BGSOUND:case W.LINK:case W.META:e._appendElement(t,H.HTML),t.ackSelfClosing=!0;break;case W.TITLE:e._switchToTextParsing(t,xk.RCDATA);break;case W.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,xk.RAWTEXT):(e._insertElement(t,H.HTML),e.insertionMode=q.IN_HEAD_NO_SCRIPT);break;case W.NOFRAMES:case W.STYLE:e._switchToTextParsing(t,xk.RAWTEXT);break;case W.SCRIPT:e._switchToTextParsing(t,xk.SCRIPT_DATA);break;case W.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=q.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(q.IN_TEMPLATE);break;case W.HEAD:e._err(t,V.misplacedStartTagForHeadElement);break;default:nA(e,t)}}function Rie(e,t){switch(t.tagID){case W.HEAD:e.openElements.pop(),e.insertionMode=q.AFTER_HEAD;break;case W.BODY:case W.BR:case W.HTML:nA(e,t);break;case W.TEMPLATE:tA(e,t);break;default:e._err(t,V.endTagWithoutMatchingOpenElement)}}function tA(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==W.TEMPLATE&&e._err(t,V.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(W.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,V.endTagWithoutMatchingOpenElement)}function nA(e,t){e.openElements.pop(),e.insertionMode=q.AFTER_HEAD,e._processToken(t)}function zie(e,t){switch(t.tagID){case W.HTML:fA(e,t);break;case W.BASEFONT:case W.BGSOUND:case W.HEAD:case W.LINK:case W.META:case W.NOFRAMES:case W.STYLE:eA(e,t);break;case W.NOSCRIPT:e._err(t,V.nestedNoscriptInHead);break;default:rA(e,t)}}function Bie(e,t){switch(t.tagID){case W.NOSCRIPT:e.openElements.pop(),e.insertionMode=q.IN_HEAD;break;case W.BR:rA(e,t);break;default:e._err(t,V.endTagWithoutMatchingOpenElement)}}function rA(e,t){let n=t.type===uk.EOF?V.openElementsLeftAfterEof:V.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=q.IN_HEAD,e._processToken(t)}function Vie(e,t){switch(t.tagID){case W.HTML:fA(e,t);break;case W.BODY:e._insertElement(t,H.HTML),e.framesetOk=!1,e.insertionMode=q.IN_BODY;break;case W.FRAMESET:e._insertElement(t,H.HTML),e.insertionMode=q.IN_FRAMESET;break;case W.BASE:case W.BASEFONT:case W.BGSOUND:case W.LINK:case W.META:case W.NOFRAMES:case W.SCRIPT:case W.STYLE:case W.TEMPLATE:case W.TITLE:e._err(t,V.abandonedHeadElementChild),e.openElements.push(e.headElement,W.HEAD),eA(e,t),e.openElements.remove(e.headElement);break;case W.HEAD:e._err(t,V.misplacedStartTagForHeadElement);break;default:iA(e,t)}}function Hie(e,t){switch(t.tagID){case W.BODY:case W.HTML:case W.BR:iA(e,t);break;case W.TEMPLATE:tA(e,t);break;default:e._err(t,V.endTagWithoutMatchingOpenElement)}}function iA(e,t){e._insertFakeElement(U.BODY,W.BODY),e.insertionMode=q.IN_BODY,aA(e,t)}function aA(e,t){switch(t.type){case uk.CHARACTER:sA(e,t);break;case uk.WHITESPACE_CHARACTER:oA(e,t);break;case uk.COMMENT:Yk(e,t);break;case uk.START_TAG:fA(e,t);break;case uk.END_TAG:mA(e,t);break;case uk.EOF:hA(e,t)}}function oA(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function sA(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function Uie(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Wie(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function Gie(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,H.HTML),e.insertionMode=q.IN_FRAMESET)}function Kie(e,t){e.openElements.hasInButtonScope(W.P)&&e._closePElement(),e._insertElement(t,H.HTML)}function qie(e,t){e.openElements.hasInButtonScope(W.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&bk.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,H.HTML)}function Jie(e,t){e.openElements.hasInButtonScope(W.P)&&e._closePElement(),e._insertElement(t,H.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Yie(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(W.P)&&e._closePElement(),e._insertElement(t,H.HTML),n||(e.formElement=e.openElements.current))}function Xie(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===W.LI&&r===W.LI||(n===W.DD||n===W.DT)&&(r===W.DD||r===W.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==W.ADDRESS&&r!==W.DIV&&r!==W.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(W.P)&&e._closePElement(),e._insertElement(t,H.HTML)}function Zie(e,t){e.openElements.hasInButtonScope(W.P)&&e._closePElement(),e._insertElement(t,H.HTML),e.tokenizer.state=xk.PLAINTEXT}function Qie(e,t){e.openElements.hasInScope(W.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(W.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,H.HTML),e.framesetOk=!1}function $ie(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(U.A);n&&(Jk(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,H.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function eae(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,H.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function tae(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(W.NOBR)&&(Jk(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,H.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function nae(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,H.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function rae(e,t){e.treeAdapter.getDocumentMode(e.document)!==vk.QUIRKS&&e.openElements.hasInButtonScope(W.P)&&e._closePElement(),e._insertElement(t,H.HTML),e.framesetOk=!1,e.insertionMode=q.IN_TABLE}function cA(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,H.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function lA(e){let t=dk(e,_k.TYPE);return t!=null&&t.toLowerCase()===xie}function iae(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,H.HTML),lA(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function aae(e,t){e._appendElement(t,H.HTML),t.ackSelfClosing=!0}function oae(e,t){e.openElements.hasInButtonScope(W.P)&&e._closePElement(),e._appendElement(t,H.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function sae(e,t){t.tagName=U.IMG,t.tagID=W.IMG,cA(e,t)}function cae(e,t){e._insertElement(t,H.HTML),e.skipNextNewLine=!0,e.tokenizer.state=xk.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=q.TEXT}function lae(e,t){e.openElements.hasInButtonScope(W.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,xk.RAWTEXT)}function uae(e,t){e.framesetOk=!1,e._switchToTextParsing(t,xk.RAWTEXT)}function uA(e,t){e._switchToTextParsing(t,xk.RAWTEXT)}function dae(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,H.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===q.IN_TABLE||e.insertionMode===q.IN_CAPTION||e.insertionMode===q.IN_TABLE_BODY||e.insertionMode===q.IN_ROW||e.insertionMode===q.IN_CELL?q.IN_SELECT_IN_TABLE:q.IN_SELECT}function fae(e,t){e.openElements.currentTagId===W.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,H.HTML)}function pae(e,t){e.openElements.hasInScope(W.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,H.HTML)}function mae(e,t){e.openElements.hasInScope(W.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(W.RTC),e._insertElement(t,H.HTML)}function hae(e,t){e._reconstructActiveFormattingElements(),Hk(t),Wk(t),t.selfClosing?e._appendElement(t,H.MATHML):e._insertElement(t,H.MATHML),t.ackSelfClosing=!0}function gae(e,t){e._reconstructActiveFormattingElements(),Uk(t),Wk(t),t.selfClosing?e._appendElement(t,H.SVG):e._insertElement(t,H.SVG),t.ackSelfClosing=!0}function dA(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,H.HTML)}function fA(e,t){switch(t.tagID){case W.I:case W.S:case W.B:case W.U:case W.EM:case W.TT:case W.BIG:case W.CODE:case W.FONT:case W.SMALL:case W.STRIKE:case W.STRONG:eae(e,t);break;case W.A:$ie(e,t);break;case W.H1:case W.H2:case W.H3:case W.H4:case W.H5:case W.H6:qie(e,t);break;case W.P:case W.DL:case W.OL:case W.UL:case W.DIV:case W.DIR:case W.NAV:case W.MAIN:case W.MENU:case W.ASIDE:case W.CENTER:case W.FIGURE:case W.FOOTER:case W.HEADER:case W.HGROUP:case W.DIALOG:case W.DETAILS:case W.ADDRESS:case W.ARTICLE:case W.SEARCH:case W.SECTION:case W.SUMMARY:case W.FIELDSET:case W.BLOCKQUOTE:case W.FIGCAPTION:Kie(e,t);break;case W.LI:case W.DD:case W.DT:Xie(e,t);break;case W.BR:case W.IMG:case W.WBR:case W.AREA:case W.EMBED:case W.KEYGEN:cA(e,t);break;case W.HR:oae(e,t);break;case W.RB:case W.RTC:pae(e,t);break;case W.RT:case W.RP:mae(e,t);break;case W.PRE:case W.LISTING:Jie(e,t);break;case W.XMP:lae(e,t);break;case W.SVG:gae(e,t);break;case W.HTML:Uie(e,t);break;case W.BASE:case W.LINK:case W.META:case W.STYLE:case W.TITLE:case W.SCRIPT:case W.BGSOUND:case W.BASEFONT:case W.TEMPLATE:eA(e,t);break;case W.BODY:Wie(e,t);break;case W.FORM:Yie(e,t);break;case W.NOBR:tae(e,t);break;case W.MATH:hae(e,t);break;case W.TABLE:rae(e,t);break;case W.INPUT:iae(e,t);break;case W.PARAM:case W.TRACK:case W.SOURCE:aae(e,t);break;case W.IMAGE:sae(e,t);break;case W.BUTTON:Qie(e,t);break;case W.APPLET:case W.OBJECT:case W.MARQUEE:nae(e,t);break;case W.IFRAME:uae(e,t);break;case W.SELECT:dae(e,t);break;case W.OPTION:case W.OPTGROUP:fae(e,t);break;case W.NOEMBED:case W.NOFRAMES:uA(e,t);break;case W.FRAMESET:Gie(e,t);break;case W.TEXTAREA:cae(e,t);break;case W.NOSCRIPT:e.options.scriptingEnabled?uA(e,t):dA(e,t);break;case W.PLAINTEXT:Zie(e,t);break;case W.COL:case W.TH:case W.TD:case W.TR:case W.HEAD:case W.FRAME:case W.TBODY:case W.TFOOT:case W.THEAD:case W.CAPTION:case W.COLGROUP:break;default:dA(e,t)}}function _ae(e,t){if(e.openElements.hasInScope(W.BODY)&&(e.insertionMode=q.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function vae(e,t){e.openElements.hasInScope(W.BODY)&&(e.insertionMode=q.AFTER_BODY,BA(e,t))}function yae(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function bae(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(W.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(W.FORM):n&&e.openElements.remove(n))}function xae(e){e.openElements.hasInButtonScope(W.P)||e._insertFakeElement(U.P,W.P),e._closePElement()}function Sae(e){e.openElements.hasInListItemScope(W.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(W.LI),e.openElements.popUntilTagNamePopped(W.LI))}function Cae(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function wae(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Tae(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function Eae(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(U.BR,W.BR),e.openElements.pop(),e.framesetOk=!1}function pA(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==W.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function mA(e,t){switch(t.tagID){case W.A:case W.B:case W.I:case W.S:case W.U:case W.EM:case W.TT:case W.BIG:case W.CODE:case W.FONT:case W.NOBR:case W.SMALL:case W.STRIKE:case W.STRONG:Jk(e,t);break;case W.P:xae(e);break;case W.DL:case W.UL:case W.OL:case W.DIR:case W.DIV:case W.NAV:case W.PRE:case W.MAIN:case W.MENU:case W.ASIDE:case W.BUTTON:case W.CENTER:case W.FIGURE:case W.FOOTER:case W.HEADER:case W.HGROUP:case W.DIALOG:case W.ADDRESS:case W.ARTICLE:case W.DETAILS:case W.SEARCH:case W.SECTION:case W.SUMMARY:case W.LISTING:case W.FIELDSET:case W.BLOCKQUOTE:case W.FIGCAPTION:yae(e,t);break;case W.LI:Sae(e);break;case W.DD:case W.DT:Cae(e,t);break;case W.H1:case W.H2:case W.H3:case W.H4:case W.H5:case W.H6:wae(e);break;case W.BR:Eae(e);break;case W.BODY:_ae(e,t);break;case W.HTML:vae(e,t);break;case W.FORM:bae(e);break;case W.APPLET:case W.OBJECT:case W.MARQUEE:Tae(e,t);break;case W.TEMPLATE:tA(e,t);break;default:pA(e,t)}}function hA(e,t){e.tmplInsertionModeStack.length>0?RA(e,t):Xk(e,t)}function Dae(e,t){var n;t.tagID===W.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Oae(e,t){e._err(t,V.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function gA(e,t){if(e.openElements.currentTagId!==void 0&&Gk.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=q.IN_TABLE_TEXT,t.type){case uk.CHARACTER:xA(e,t);break;case uk.WHITESPACE_CHARACTER:bA(e,t)}else yA(e,t)}function kae(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,H.HTML),e.insertionMode=q.IN_CAPTION}function Aae(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,H.HTML),e.insertionMode=q.IN_COLUMN_GROUP}function jae(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(U.COLGROUP,W.COLGROUP),e.insertionMode=q.IN_COLUMN_GROUP,wA(e,t)}function Mae(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,H.HTML),e.insertionMode=q.IN_TABLE_BODY}function Nae(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(U.TBODY,W.TBODY),e.insertionMode=q.IN_TABLE_BODY,EA(e,t)}function Pae(e,t){e.openElements.hasInTableScope(W.TABLE)&&(e.openElements.popUntilTagNamePopped(W.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Fae(e,t){lA(t)?e._appendElement(t,H.HTML):yA(e,t),t.ackSelfClosing=!0}function Iae(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,H.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function _A(e,t){switch(t.tagID){case W.TD:case W.TH:case W.TR:Nae(e,t);break;case W.STYLE:case W.SCRIPT:case W.TEMPLATE:eA(e,t);break;case W.COL:jae(e,t);break;case W.FORM:Iae(e,t);break;case W.TABLE:Pae(e,t);break;case W.TBODY:case W.TFOOT:case W.THEAD:Mae(e,t);break;case W.INPUT:Fae(e,t);break;case W.CAPTION:kae(e,t);break;case W.COLGROUP:Aae(e,t);break;default:yA(e,t)}}function vA(e,t){switch(t.tagID){case W.TABLE:e.openElements.hasInTableScope(W.TABLE)&&(e.openElements.popUntilTagNamePopped(W.TABLE),e._resetInsertionMode());break;case W.TEMPLATE:tA(e,t);break;case W.BODY:case W.CAPTION:case W.COL:case W.COLGROUP:case W.HTML:case W.TBODY:case W.TD:case W.TFOOT:case W.TH:case W.THEAD:case W.TR:break;default:yA(e,t)}}function yA(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,aA(e,t),e.fosterParentingEnabled=n}function bA(e,t){e.pendingCharacterTokens.push(t)}function xA(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function SA(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)yA(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var CA=new Set([W.CAPTION,W.COL,W.COLGROUP,W.TBODY,W.TD,W.TFOOT,W.TH,W.THEAD,W.TR]);function Lae(e,t){let n=t.tagID;CA.has(n)?e.openElements.hasInTableScope(W.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(W.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=q.IN_TABLE,_A(e,t)):fA(e,t)}function Rae(e,t){let n=t.tagID;switch(n){case W.CAPTION:case W.TABLE:e.openElements.hasInTableScope(W.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(W.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=q.IN_TABLE,n===W.TABLE&&vA(e,t));break;case W.BODY:case W.COL:case W.COLGROUP:case W.HTML:case W.TBODY:case W.TD:case W.TFOOT:case W.TH:case W.THEAD:case W.TR:break;default:mA(e,t)}}function wA(e,t){switch(t.tagID){case W.HTML:fA(e,t);break;case W.COL:e._appendElement(t,H.HTML),t.ackSelfClosing=!0;break;case W.TEMPLATE:eA(e,t);break;default:TA(e,t)}}function zae(e,t){switch(t.tagID){case W.COLGROUP:e.openElements.currentTagId===W.COLGROUP&&(e.openElements.pop(),e.insertionMode=q.IN_TABLE);break;case W.TEMPLATE:tA(e,t);break;case W.COL:break;default:TA(e,t)}}function TA(e,t){e.openElements.currentTagId===W.COLGROUP&&(e.openElements.pop(),e.insertionMode=q.IN_TABLE,e._processToken(t))}function EA(e,t){switch(t.tagID){case W.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,H.HTML),e.insertionMode=q.IN_ROW;break;case W.TH:case W.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(U.TR,W.TR),e.insertionMode=q.IN_ROW,OA(e,t);break;case W.CAPTION:case W.COL:case W.COLGROUP:case W.TBODY:case W.TFOOT:case W.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=q.IN_TABLE,_A(e,t));break;default:_A(e,t)}}function DA(e,t){let n=t.tagID;switch(t.tagID){case W.TBODY:case W.TFOOT:case W.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=q.IN_TABLE);break;case W.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=q.IN_TABLE,vA(e,t));break;case W.BODY:case W.CAPTION:case W.COL:case W.COLGROUP:case W.HTML:case W.TD:case W.TH:case W.TR:break;default:vA(e,t)}}function OA(e,t){switch(t.tagID){case W.TH:case W.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,H.HTML),e.insertionMode=q.IN_CELL,e.activeFormattingElements.insertMarker();break;case W.CAPTION:case W.COL:case W.COLGROUP:case W.TBODY:case W.TFOOT:case W.THEAD:case W.TR:e.openElements.hasInTableScope(W.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=q.IN_TABLE_BODY,EA(e,t));break;default:_A(e,t)}}function kA(e,t){switch(t.tagID){case W.TR:e.openElements.hasInTableScope(W.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=q.IN_TABLE_BODY);break;case W.TABLE:e.openElements.hasInTableScope(W.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=q.IN_TABLE_BODY,DA(e,t));break;case W.TBODY:case W.TFOOT:case W.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(W.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=q.IN_TABLE_BODY,DA(e,t));break;case W.BODY:case W.CAPTION:case W.COL:case W.COLGROUP:case W.HTML:case W.TD:case W.TH:break;default:vA(e,t)}}function AA(e,t){let n=t.tagID;CA.has(n)?(e.openElements.hasInTableScope(W.TD)||e.openElements.hasInTableScope(W.TH))&&(e._closeTableCell(),OA(e,t)):fA(e,t)}function jA(e,t){let n=t.tagID;switch(n){case W.TD:case W.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=q.IN_ROW);break;case W.TABLE:case W.TBODY:case W.TFOOT:case W.THEAD:case W.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),kA(e,t));break;case W.BODY:case W.CAPTION:case W.COL:case W.COLGROUP:case W.HTML:break;default:mA(e,t)}}function MA(e,t){switch(t.tagID){case W.HTML:fA(e,t);break;case W.OPTION:e.openElements.currentTagId===W.OPTION&&e.openElements.pop(),e._insertElement(t,H.HTML);break;case W.OPTGROUP:e.openElements.currentTagId===W.OPTION&&e.openElements.pop(),e.openElements.currentTagId===W.OPTGROUP&&e.openElements.pop(),e._insertElement(t,H.HTML);break;case W.HR:e.openElements.currentTagId===W.OPTION&&e.openElements.pop(),e.openElements.currentTagId===W.OPTGROUP&&e.openElements.pop(),e._appendElement(t,H.HTML),t.ackSelfClosing=!0;break;case W.INPUT:case W.KEYGEN:case W.TEXTAREA:case W.SELECT:e.openElements.hasInSelectScope(W.SELECT)&&(e.openElements.popUntilTagNamePopped(W.SELECT),e._resetInsertionMode(),t.tagID!==W.SELECT&&e._processStartTag(t));break;case W.SCRIPT:case W.TEMPLATE:eA(e,t)}}function NA(e,t){switch(t.tagID){case W.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===W.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===W.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===W.OPTGROUP&&e.openElements.pop();break;case W.OPTION:e.openElements.currentTagId===W.OPTION&&e.openElements.pop();break;case W.SELECT:e.openElements.hasInSelectScope(W.SELECT)&&(e.openElements.popUntilTagNamePopped(W.SELECT),e._resetInsertionMode());break;case W.TEMPLATE:tA(e,t)}}function PA(e,t){let n=t.tagID;n===W.CAPTION||n===W.TABLE||n===W.TBODY||n===W.TFOOT||n===W.THEAD||n===W.TR||n===W.TD||n===W.TH?(e.openElements.popUntilTagNamePopped(W.SELECT),e._resetInsertionMode(),e._processStartTag(t)):MA(e,t)}function FA(e,t){let n=t.tagID;n===W.CAPTION||n===W.TABLE||n===W.TBODY||n===W.TFOOT||n===W.THEAD||n===W.TR||n===W.TD||n===W.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(W.SELECT),e._resetInsertionMode(),e.onEndTag(t)):NA(e,t)}function IA(e,t){switch(t.tagID){case W.BASE:case W.BASEFONT:case W.BGSOUND:case W.LINK:case W.META:case W.NOFRAMES:case W.SCRIPT:case W.STYLE:case W.TEMPLATE:case W.TITLE:eA(e,t);break;case W.CAPTION:case W.COLGROUP:case W.TBODY:case W.TFOOT:case W.THEAD:e.tmplInsertionModeStack[0]=q.IN_TABLE,e.insertionMode=q.IN_TABLE,_A(e,t);break;case W.COL:e.tmplInsertionModeStack[0]=q.IN_COLUMN_GROUP,e.insertionMode=q.IN_COLUMN_GROUP,wA(e,t);break;case W.TR:e.tmplInsertionModeStack[0]=q.IN_TABLE_BODY,e.insertionMode=q.IN_TABLE_BODY,EA(e,t);break;case W.TD:case W.TH:e.tmplInsertionModeStack[0]=q.IN_ROW,e.insertionMode=q.IN_ROW,OA(e,t);break;default:e.tmplInsertionModeStack[0]=q.IN_BODY,e.insertionMode=q.IN_BODY,fA(e,t)}}function LA(e,t){t.tagID===W.TEMPLATE&&tA(e,t)}function RA(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(W.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Xk(e,t)}function zA(e,t){t.tagID===W.HTML?fA(e,t):VA(e,t)}function BA(e,t){if(t.tagID===W.HTML){if(e.fragmentContext||(e.insertionMode=q.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===W.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else VA(e,t)}function VA(e,t){e.insertionMode=q.IN_BODY,aA(e,t)}function HA(e,t){switch(t.tagID){case W.HTML:fA(e,t);break;case W.FRAMESET:e._insertElement(t,H.HTML);break;case W.FRAME:e._appendElement(t,H.HTML),t.ackSelfClosing=!0;break;case W.NOFRAMES:eA(e,t)}}function UA(e,t){t.tagID===W.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==W.FRAMESET&&(e.insertionMode=q.AFTER_FRAMESET))}function WA(e,t){switch(t.tagID){case W.HTML:fA(e,t);break;case W.NOFRAMES:eA(e,t)}}function GA(e,t){t.tagID===W.HTML&&(e.insertionMode=q.AFTER_AFTER_FRAMESET)}function KA(e,t){t.tagID===W.HTML?fA(e,t):qA(e,t)}function qA(e,t){e.insertionMode=q.IN_BODY,aA(e,t)}function JA(e,t){switch(t.tagID){case W.HTML:fA(e,t);break;case W.NOFRAMES:eA(e,t)}}function YA(e,t){t.chars=`�`,e._insertCharacters(t)}function XA(e,t){e._insertCharacters(t),e.framesetOk=!1}function ZA(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==H.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function QA(e,t){if(gie(t))ZA(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===H.MATHML?Hk(t):r===H.SVG&&(_ie(t),Uk(t)),Wk(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function $A(e,t){if(t.tagID===W.P||t.tagID===W.BR)ZA(e),e._endTagOutsideForeignContent(t);else for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===H.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}U.AREA,U.BASE,U.BASEFONT,U.BGSOUND,U.BR,U.COL,U.EMBED,U.FRAME,U.HR,U.IMG,U.INPUT,U.KEYGEN,U.LINK,U.META,U.PARAM,U.SOURCE,U.TRACK,U.WBR;var ej=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,tj=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),nj={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function rj(e,t){let n=_j(e),r=dt(`type`,{handlers:{root:aj,element:oj,text:sj,comment:uj,doctype:cj,raw:dj},unknown:fj}),i={parser:n?new qk(nj):qk.getFragmentParser(void 0,nj),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),pj(i,NC());let a=gre(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&xO(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function ij(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function aj(e,t){ij(e.children,t)}function oj(e,t){hj(e,t),ij(e.children,t),gj(e,t)}function sj(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:uk.CHARACTER,chars:e.value,location:vj(e)};pj(t,NC(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function cj(e,t){let n={type:uk.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:vj(e)};pj(t,NC(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function lj(e,t){t.stitches=!0;let n=yj(e);`children`in e&&`children`in n&&(n.children=rj({type:`root`,children:e.children},t.options).children),uj({type:`comment`,value:{stitch:n}},t)}function uj(e,t){let n=e.value,r={type:uk.COMMENT,data:n,location:vj(e)};pj(t,NC(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function dj(e,t){if(t.parser.tokenizer.preprocessor.html=``,t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,mj(t,NC(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(ej,`&lt;$1$2`):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function fj(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))lj(n,t);else{let e=``;throw tj.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function pj(e,t){mj(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=xk.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:``,value:``}}function mj(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function hj(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===xk.PLAINTEXT)return;pj(t,NC(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:XO.html;i===XO.html&&n===`svg`&&(i=XO.svg);let a=xre({...e,children:[]},{space:i===XO.svg?`svg`:`html`}),o={type:uk.START_TAG,tagName:n,tagID:yk(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:vj(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function gj(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&Nt.includes(n)||t.parser.tokenizer.state===xk.PLAINTEXT)return;pj(t,MC(e));let r={type:uk.END_TAG,tagName:n,tagID:yk(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:vj(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===xk.RCDATA||t.parser.tokenizer.state===xk.RAWTEXT||t.parser.tokenizer.state===xk.SCRIPT_DATA)&&(t.parser.tokenizer.state=xk.DATA)}function _j(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function vj(e){let t=NC(e)||{line:void 0,column:void 0,offset:void 0},n=MC(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function yj(e){return`children`in e?lO({...e,children:[]}):lO(e)}function bj(e){return function(t,n){return rj(t,{...e,file:n})}}var xj=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],Sj={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...xj,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...xj],h2:[[`className`,`sr-only`]],img:[...xj,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...xj,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...xj],table:[...xj],ul:[...xj,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},Cj={}.hasOwnProperty;function wj(e,t){let n={type:`root`,children:[]},r=Tj({schema:t?{...Sj,...t}:Sj,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function Tj(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return Ej(e,n);case`doctype`:return Dj(e,n);case`element`:return Oj(e,n);case`root`:return kj(e,n);case`text`:return Aj(e,n)}}}function Ej(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return Lj(r,t),r}}function Dj(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return Lj(e,t),e}}function Oj(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=jj(e,t.children),i=Mj(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&Cj.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:`element`,tagName:n,properties:i,children:r};return Lj(o,t),o}function kj(e,t){let n={type:`root`,children:jj(e,t.children)};return Lj(n,t),n}function Aj(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return Lj(n,t),n}function jj(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=Tj(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function Mj(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&Cj.call(r,n)?r[n]:void 0,o=r&&Cj.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(Cj.call(s,l)){let t=s[l],n=Nj(e,Rj(a,l),l,t);n??=Nj(e,Rj(o,l),l,t),n!=null&&(c[l]=n)}if(i&&Cj.call(i,n)){let e=i[n];for(l in e)Cj.call(e,l)&&!Cj.call(c,l)&&(c[l]=e[l])}return c}function Nj(e,t,n,r){return t?Array.isArray(r)?Pj(e,t,n,r):Fj(e,t,n,r):void 0}function Pj(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=Fj(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function Fj(e,t,n,r){if((typeof r==`boolean`||typeof r==`number`||typeof r==`string`)&&Ij(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function Ij(e,t,n){let r=e.schema.protocols&&Cj.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),a=i.indexOf(`:`),o=i.indexOf(`?`),s=i.indexOf(`#`),c=i.indexOf(`/`);if(a<0||c>-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l<r.length;){let e=r[l];if(a===e.length&&i.slice(0,e.length)===e)return!0}return!1}function Lj(e,t){let n=FC(t);t.data&&(e.data=lO(t.data)),n&&(e.position=n)}function Rj(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}function zj(e){return function(t){return wj(t,e)}}function Bj(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Vj(e,t,n){let r=pO((n||{}).ignore||[]),i=Hj(t),a=-1;for(;++a<i.length;)bO(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1)r.lastIndex=n+1;else{if(s!==n&&f({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a))for(let e of a)f(e);else a&&f(a);s=n+d[0].length,l=!0}if(!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&f({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length;function f(e){let t=u[u.length-1];t&&t.type===`text`&&e.type===`text`?t.value+=e.value:u.push(e)}}}function Hj(e){if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let t=[],n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([Uj(e[0]),Wj(e[1])])}return t}function Uj(e){return typeof e==`string`?new RegExp(Bj(e),`g`):e}function Wj(e){return typeof e==`function`?e:function(){return e}}function Gj(e){Vj(e,[/\r?\n|\r/g,Kj])}function Kj(){return{type:`break`}}function qj(){return function(e){Gj(e)}}var Jj=`phrasing`,Yj=[`autolink`,`link`,`image`,`label`];function Xj(){return{transforms:[iM],enter:{literalAutolink:Qj,literalAutolinkEmail:$j,literalAutolinkHttp:$j,literalAutolinkWww:$j},exit:{literalAutolink:rM,literalAutolinkEmail:nM,literalAutolinkHttp:eM,literalAutolinkWww:tM}}}function Zj(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Jj,notInConstruct:Yj},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Jj,notInConstruct:Yj},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Jj,notInConstruct:Yj}]}}function Qj(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function $j(e){this.config.enter.autolinkProtocol.call(this,e)}function eM(e){this.config.exit.autolinkProtocol.call(this,e)}function tM(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function nM(e){this.config.exit.autolinkEmail.call(this,e)}function rM(e){this.exit(e)}function iM(e){Vj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,aM],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,oM]],{ignore:[`link`,`linkReference`]})}function aM(e,t,n,r,i){let a=``;if(!lM(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!sM(n)))return!1;let o=cM(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function oM(e,t,n,r){return!lM(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function sM(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function cM(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=ft(e,`(`),a=ft(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function lM(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Hw(n)||Vw(n))&&(!t||n!==47)}yM.peek=vM;function uM(){this.buffer()}function dM(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function fM(){this.buffer()}function pM(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function mM(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jw(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hM(e){this.exit(e)}function gM(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jw(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _M(e){this.exit(e)}function vM(){return`[`}function yM(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function bM(){return{enter:{gfmFootnoteCallString:uM,gfmFootnoteCall:dM,gfmFootnoteDefinitionLabelString:fM,gfmFootnoteDefinition:pM},exit:{gfmFootnoteCallString:mM,gfmFootnoteCall:hM,gfmFootnoteDefinitionLabelString:gM,gfmFootnoteDefinition:_M}}}function xM(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:yM},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
73
- `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?CM:SM))),s(),o}}function SM(e,t,n){return t===0?e:CM(e,t,n)}function CM(e,t,n){return(n?``:` `)+e}var wM=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];kM.attention=AM,kM.peek=jM;function TM(){return{canContainEols:[`delete`],enter:{strikethrough:DM},exit:{strikethrough:OM}}}function EM(){return{handlers:{delete:kM},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:wM}]}}function DM(e){this.enter({type:`delete`,children:[],position:void 0},e)}function OM(e){this.exit(e)}function kM(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function AM(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function jM(){return`~`}function MM(e){return e.length}function NM(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||MM,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=PM(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=FM(r[d]);else{let e=FM(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
74
- `)}function PM(e){return e==null?``:String(e)}function FM(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}var IM=pO([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function LM(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),RM);return i(),o}function RM(e,t,n){return`>`+(n?``:` `)+e}function zM(e,t){return BM(e,t.inConstruct,!0)&&!BM(e,t.notInConstruct,!1)}function BM(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function VM(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){let e=n.unsafe[i];if(e.character===`
75
- `&&!e.before&&!e.after&&zM(n.stack,e))return/[\t ]/.test(r.before)?``:` `}return`\\
76
- `}function HM(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function UM(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function WM(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function GM(e,t,n,r){let i=WM(n),a=e.value||``;if(UM(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,KM);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(HM(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:`
77
- `,encode:["`"],...o.current()})),t()}return u+=o.move(`
78
- `),a&&(u+=o.move(a+`
79
- `)),u+=o.move(s),c(),u}function KM(e,t,n){return(n?``:` `)+e}function qM(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function JM(e,t,n,r){let i=qM(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
80
- `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function YM(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}XM.attention=ZM,XM.peek=QM;function XM(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function ZM(e,t){return{construct:`emphasis`,markers:YM(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function QM(e,t,n){return n.options.emphasis||`*`}function $M(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function eN(e,t){let n=!1;return xO(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&vw(e)&&(t.options.setext||n))}function tN(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(eN(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
81
- `,after:`
82
- `});return r(),t(),o+`
83
- `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
84
- `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
85
- `,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=$M(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}nN.peek=rN;function nN(e){return e.value||``}function rN(){return`<`}iN.peek=aN;function iN(e,t,n,r){let i=qM(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function aN(){return`!`}oN.peek=sN;function oN(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function sN(){return`!`}cN.peek=lN;function cN(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e);if(!e.atBreak)continue;let i;for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function lN(){return"`"}function uN(e,t){let n=vw(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][+\-.a-z]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}dN.peek=fN;function dN(e,t,n,r){let i=qM(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(uN(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function fN(e,t,n){return uN(e,n)?`<`:`[`}pN.peek=mN;function pN(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function mN(){return`[`}function hN(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function gN(e){let t=hN(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function _N(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function vN(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function yN(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?_N(n):hN(n),s=e.ordered?o===`.`?`)`:`.`:gN(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),vN(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function bN(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function xN(e,t,n,r){let i=bN(n),a=n.bulletCurrent||hN(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function SN(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function CN(e,t,n,r){if(!e.children.some(function(e){return IM(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function wN(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}TN.attention=EN,TN.peek=DN;function TN(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function EN(e,t){return{construct:`strong`,markers:wN(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function DN(e,t,n){return n.options.strong||`*`}function ON(e,t,n,r){let i=t?t.children:[],a=i.indexOf(e);return n.safe(e.value,{...r,afterNode:i[a+1],beforeNode:i[a-1]})}function kN(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function AN(e,t,n){let r=(vN(n)+(n.options.ruleSpaces?` `:``)).repeat(kN(n));return n.options.ruleSpaces?r.slice(0,-1):r}var jN={blockquote:LM,break:VM,code:GM,definition:JM,emphasis:XM,hardBreak:VM,heading:tN,html:nN,image:iN,imageReference:oN,inlineCode:cN,link:dN,linkReference:pN,list:yN,listItem:xN,paragraph:SN,root:CN,strong:TN,text:ON,thematicBreak:AN};function MN(){return{enter:{table:NN,tableData:LN,tableHeader:LN,tableRow:FN},exit:{codeText:RN,table:PN,tableData:IN,tableHeader:IN,tableRow:IN}}}function NN(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function PN(e){this.exit(e),this.data.inTable=void 0}function FN(e){this.enter({type:`tableRow`,children:[]},e)}function IN(e){this.exit(e)}function LN(e){this.enter({type:`tableCell`,children:[]},e)}function RN(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,zN));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function zN(e,t){return t===`|`?t:e}function BN(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
86
- `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
87
- `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return NM(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=jN.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function VN(){return{exit:{taskListCheckValueChecked:UN,taskListCheckValueUnchecked:UN,paragraph:WN}}}function HN(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:GN}}}function UN(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function WN(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function GN(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=jN.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function KN(){return[Xj(),bM(),TM(),MN(),VN()]}function qN(e){return{extensions:[Zj(),xM(e),EM(),BN(e),HN()]}}var JN={tokenize:cP,partial:!0},YN={tokenize:lP,partial:!0},XN={tokenize:uP,partial:!0},ZN={tokenize:dP,partial:!0},QN={tokenize:fP,partial:!0},$N={name:`wwwAutolink`,tokenize:oP,previous:pP},eP={name:`protocolAutolink`,tokenize:sP,previous:mP},tP={name:`emailAutolink`,tokenize:aP,previous:hP},nP={};function rP(){return{text:nP}}for(var iP=48;iP<123;)nP[iP]=tP,iP++,iP===58?iP=65:iP===91&&(iP=97);nP[43]=tP,nP[45]=tP,nP[46]=tP,nP[95]=tP,nP[72]=[tP,eP],nP[104]=[tP,eP],nP[87]=[tP,$N],nP[119]=[tP,$N];function aP(e,t,n){let r=this,i,a;return o;function o(t){return!gP(t)||!hP.call(r,r.previous)||_P(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return gP(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(QN,u,l)(t):t===45||t===95||Nw(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Mw(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function oP(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!pP.call(r,r.previous)||_P(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(JN,e.attempt(YN,e.attempt(XN,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function sP(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&mP.call(r,r.previous)&&!_P(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Mw(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Fw(t)||zw(t)||Hw(t)||Vw(t)?n(t):e.attempt(YN,e.attempt(XN,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function cP(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function lP(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(ZN,c,s)(t):t===null||zw(t)||Hw(t)||t!==45&&Vw(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function uP(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(ZN,t,a)(o):o===null||zw(o)||Hw(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function dP(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||zw(o)||Hw(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||zw(e)||Hw(e)?t(e):r(e)}function a(e){return Mw(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Mw(t)?(e.consume(t),o):n(t)}}function fP(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Nw(e)?n(e):t(e)}}function pP(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||zw(e)}function mP(e){return!Mw(e)}function hP(e){return!(e===47||gP(e))}function gP(e){return e===43||e===45||e===46||e===95||Nw(e)}function _P(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var vP={tokenize:EP,partial:!0};function yP(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:CP,continuation:{tokenize:wP},exit:TP}},text:{91:{name:`gfmFootnoteCall`,tokenize:SP},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:bP,resolveTo:xP}}}}function bP(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=jw(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function xP(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function SP(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||zw(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(jw(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return zw(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function CP(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||zw(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=jw(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return zw(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Gw(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function wP(e,t,n){return e.check(lT,t,e.attempt(vP,t,n))}function TP(e){e.exit(`gfmFootnoteDefinition`)}function EP(e,t,n){let r=this;return Gw(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function DP(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ww(o,o.length,0,nT(s,e.slice(r+1,n),t)),ww(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ww(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=tT(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=tT(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var OP=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){kP(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function kP(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function AP(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function jP(){return{flow:{null:{name:`table`,tokenize:MP,resolveAll:NP}}}}function MP(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):z(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Bw(t)?Gw(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||zw(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Bw(t)?Gw(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Bw(t)?Gw(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||z(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Bw(t)?Gw(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||z(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||z(n)?(e.exit(`tableRow`),t(n)):Bw(n)?Gw(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||zw(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function NP(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new OP;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(FP(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=PP(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=PP(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=PP(f,t,o,i,n,d)):(o[0]=o[1],d=PP(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&FP(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=AP(t.events,n))}return e}function PP(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},IP(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=IP(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=IP(t.events,n[2]),a=IP(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},IP(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function FP(e,t,n,r,i){let a=[],o=IP(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function IP(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var LP={name:`tasklistCheck`,tokenize:zP};function RP(){return{text:{91:LP}}}function zP(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return zw(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return z(r)?t(r):Bw(r)?e.check({tokenize:BP},t,n)(r):n(r)}}function BP(e,t,n){return Gw(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function VP(e){return Dw([rP(),yP(),DP(e),jP(),RP()])}var HP={};function UP(e){let t=this,n=e||HP,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(VP(n)),a.push(KN()),o.push(qN(n))}var WP=[{id:`one-dark-darker`,name:`One Dark Darker`,codeTheme:`one-dark-pro`,background:`#15181C`,foreground:`#ABB2BF`,cursor:`#B3BAC5`,selectionBackground:`#3B414D`,palette:[`#4A4F5A`,`#EE5D69`,`#97C775`,`#B68353`,`#61AFEF`,`#C678DD`,`#56B6C2`,`#CCCCCC`,`#616A7B`,`#FE808A`,`#C2DEAD`,`#D1A47A`,`#93CFFF`,`#E0A8F1`,`#82D2DC`,`#FFFFFF`]},{id:`one-dark-pro`,name:`One Dark Pro`,codeTheme:`one-dark-pro`,background:`#282C34`,foreground:`#ABB2BF`,cursor:`#528BFF`,selectionBackground:`#41454E`,palette:[`#3F4451`,`#E05561`,`#8CC265`,`#D18F52`,`#4AA5F0`,`#C162DE`,`#42B3C2`,`#D7DAE0`,`#4F5666`,`#FF616E`,`#A5E075`,`#F0A45D`,`#4DC4FF`,`#DE73FF`,`#4CD1E0`,`#E6E6E6`]},{id:`dracula`,name:`Dracula`,codeTheme:`dracula`,background:`#282A36`,foreground:`#F8F8F2`,cursor:`#F8F8F2`,selectionBackground:`#44475A`,palette:[`#21222C`,`#FF5555`,`#50FA7B`,`#F1FA8C`,`#BD93F9`,`#FF79C6`,`#8BE9FD`,`#F8F8F2`,`#6272A4`,`#FF6E6E`,`#69FF94`,`#FFFFA5`,`#D6ACFF`,`#FF92DF`,`#A4FFFF`,`#FFFFFF`]},{id:`tokyo-night`,name:`Tokyo Night`,codeTheme:`tokyo-night`,background:`#1A1B26`,foreground:`#C0CAF5`,cursor:`#C0CAF5`,selectionBackground:`#33467C`,palette:[`#15161E`,`#F7768E`,`#9ECE6A`,`#E0AF68`,`#7AA2F7`,`#BB9AF7`,`#7DCFFF`,`#A9B1D6`,`#414868`,`#F7768E`,`#9ECE6A`,`#E0AF68`,`#7AA2F7`,`#BB9AF7`,`#7DCFFF`,`#C0CAF5`]},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,codeTheme:`catppuccin-mocha`,background:`#1E1E2E`,foreground:`#CDD6F4`,cursor:`#F5E0DC`,selectionBackground:`#585B70`,palette:[`#45475A`,`#F38BA8`,`#A6E3A1`,`#F9E2AF`,`#89B4FA`,`#F5C2E7`,`#94E2D5`,`#BAC2DE`,`#585B70`,`#F38BA8`,`#A6E3A1`,`#F9E2AF`,`#89B4FA`,`#F5C2E7`,`#94E2D5`,`#A6ADC8`]},{id:`nord`,name:`Nord`,codeTheme:`nord`,background:`#2E3440`,foreground:`#D8DEE9`,cursor:`#D8DEE9`,selectionBackground:`#434C5E`,palette:[`#3B4252`,`#BF616A`,`#A3BE8C`,`#EBCB8B`,`#81A1C1`,`#B48EAD`,`#88C0D0`,`#E5E9F0`,`#4C566A`,`#BF616A`,`#A3BE8C`,`#EBCB8B`,`#81A1C1`,`#B48EAD`,`#8FBCBB`,`#ECEFF4`]},{id:`gruvbox-dark`,name:`Gruvbox Dark`,codeTheme:`gruvbox-dark-medium`,background:`#282828`,foreground:`#EBDBB2`,cursor:`#EBDBB2`,selectionBackground:`#504945`,palette:[`#282828`,`#CC241D`,`#98971A`,`#D79921`,`#458588`,`#B16286`,`#689D6A`,`#A89984`,`#928374`,`#FB4934`,`#B8BB26`,`#FABD2F`,`#83A598`,`#D3869B`,`#8EC07C`,`#EBDBB2`]},{id:`solarized-dark`,name:`Solarized Dark`,codeTheme:`solarized-dark`,background:`#002B36`,foreground:`#839496`,cursor:`#839496`,selectionBackground:`#073642`,palette:[`#073642`,`#DC322F`,`#859900`,`#B58900`,`#268BD2`,`#D33682`,`#2AA198`,`#EEE8D5`,`#002B36`,`#CB4B16`,`#586E75`,`#657B83`,`#839496`,`#6C71C4`,`#93A1A1`,`#FDF6E3`]},{id:`github-dark`,name:`GitHub Dark`,codeTheme:`github-dark`,background:`#0D1117`,foreground:`#E6EDF3`,cursor:`#E6EDF3`,selectionBackground:`#264F78`,palette:[`#484F58`,`#FF7B72`,`#3FB950`,`#D29922`,`#58A6FF`,`#BC8CFF`,`#39C5CF`,`#B1BAC4`,`#6E7681`,`#FFA198`,`#56D364`,`#E3B341`,`#79C0FF`,`#D2A8FF`,`#56D4DD`,`#FFFFFF`]},{id:`rose-pine`,name:`Rosé Pine`,codeTheme:`rose-pine`,background:`#191724`,foreground:`#E0DEF4`,cursor:`#E0DEF4`,selectionBackground:`#403D52`,palette:[`#26233A`,`#EB6F92`,`#31748F`,`#F6C177`,`#9CCFD8`,`#C4A7E7`,`#EBBCBA`,`#E0DEF4`,`#6E6A86`,`#EB6F92`,`#31748F`,`#F6C177`,`#9CCFD8`,`#C4A7E7`,`#EBBCBA`,`#E0DEF4`]}];function GP(){let e=Z().prefs.theme,t=WP.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t}function KP(){let e=Q(e=>e.prefs.theme),t=WP.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t.codeTheme}function qP(){let e=GP(),t=document.documentElement.style;t.setProperty(`--bg`,e.background),t.setProperty(`--text`,e.foreground),t.setProperty(`--blue`,e.palette[4]),t.setProperty(`--danger`,e.palette[1]),t.setProperty(`--green`,e.palette[2]),t.setProperty(`--yellow`,e.palette[3]),document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,e.background)}function JP(e){let[t,n]=(0,P.useState)(null),r=KP();return(0,P.useEffect)(()=>{let t=!0;return tt(async()=>{let{getSharedHighlighter:e}=await import(`./dist-BR1NVf87.js`);return{getSharedHighlighter:e}},__vite__mapDeps([9,10,2,11])).then(({getSharedHighlighter:t})=>t({themes:[r],langs:[e.language],preferredHighlighter:`shiki-wasm`}).then(t=>({highlighter:t,lang:e.language})).catch(()=>t({themes:[r],langs:[`text`],preferredHighlighter:`shiki-wasm`}).then(e=>({highlighter:e,lang:`text`})))).then(({highlighter:t,lang:n})=>t.codeToHast(e.code,{lang:n,themes:{dark:r},defaultColor:!1,transformers:[{pre(e){delete e.properties.style}}]})).then(e=>{t&&n((0,F.jsx)(`div`,{className:`chat-markdown-shiki`,children:JC(e,{Fragment:P.Fragment,jsx:F.jsx,jsxs:F.jsxs})}))}).catch(e=>console.error(e)),()=>{t=!1}},[e.code,e.language,r]),t===null?(0,F.jsx)(`pre`,{children:(0,F.jsx)(`code`,{children:e.code})}):t}function YP(){let[e,t]=(0,P.useState)(!1);async function n(e){try{if(!window.isSecureContext)throw Error(`Copying needs https or localhost`);await navigator.clipboard.writeText(e),t(!0),setTimeout(()=>t(!1),1500)}catch(e){R9(e)}}return{copied:e,copy:n}}function XP(e){let t=(0,P.useRef)(null),[n,r]=(0,P.useState)(!0),i=YP(),a=n?`Collapse table cells`:`Expand table cells`,o=i.copied?`Copied`:`Copy table`;function s(e){let n=t.current;if(n===null)return;let r=[...n.rows].map(e=>[...e.cells].map(e=>(e.textContent??``).trim())),a=e===`markdown`?r.flatMap((e,t)=>{let n=`| ${e.map(e=>e.replaceAll(`|`,`\\|`)).join(` | `)} |`;return t===0?[n,`| ${e.map(()=>`---`).join(` | `)} |`]:[n]}).join(`
88
- `):r.map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replaceAll(`"`,`""`)}"`:e).join(`,`)).join(`
89
- `);i.copy(a)}return(0,F.jsxs)(`div`,{className:`chat-markdown-table-container`,"data-expanded":n,children:[(0,F.jsx)(`div`,{className:`chat-markdown-table-scroll`,children:(0,F.jsx)(`table`,{ref:t,children:e.children})}),(0,F.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between select-none`,children:[(0,F.jsx)(je,{label:a,children:(0,F.jsx)(E,{type:`button`,variant:n?`secondary`:`ghost-muted`,size:`icon-xs`,"aria-pressed":n,"aria-label":a,onClick:()=>{let e=t.current;if(e!==null&&!n){let t=[];for(let n of e.rows)[...n.cells].forEach((e,n)=>{t[n]=Math.max(t[n]??0,e.getBoundingClientRect().width)});[...e.tHead?.rows[0]?.cells??[]].forEach((e,n)=>{e.style.minWidth=`${t[n]}px`})}r(!n)},children:(0,F.jsx)(k,{icon:n?lh:ah,className:`size-3`})})}),(0,F.jsxs)(mS,{children:[(0,F.jsx)(je,{label:o,children:(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(E,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":o,children:(0,F.jsx)(k,{icon:i.copied?Sm:Mm,className:`size-3`})})})}),(0,F.jsxs)(_S,{align:`end`,children:[(0,F.jsx)(vS,{onSelect:()=>s(`markdown`),children:`Copy as Markdown`}),(0,F.jsx)(vS,{onSelect:()=>s(`csv`),children:`Copy as CSV`})]})]})]})]})}function ZP(e){let[t,n]=(0,P.useState)(e.open),r=P.Children.toArray(e.children),i=r.findIndex(e=>(0,P.isValidElement)(e)&&e.type===`summary`),a=r[i];return(0,F.jsxs)(`div`,{className:`border-border/60 my-2 border-y`,children:[(0,F.jsxs)(`button`,{type:`button`,"aria-expanded":t,className:`text-foreground flex w-full items-center gap-2 py-2 text-left text-sm font-medium`,onClick:()=>n(!t),children:[(0,F.jsx)(k,{icon:wm,"aria-hidden":!0,className:l(`text-muted-foreground size-4 shrink-0 transition-transform`,t&&`rotate-90`)}),(0,F.jsx)(`span`,{children:(0,P.isValidElement)(a)&&a.props.children!==void 0?a.props.children:`Details`})]}),t&&(0,F.jsx)(`div`,{className:`text-foreground/80 ps-6 pb-3`,children:r.filter((e,t)=>t!==i)})]})}var QP=(0,P.lazy)(async()=>({default:(await tt(async()=>{let{VideoViewer:e}=await import(`./video-viewer-DIbmaY7P.js`);return{VideoViewer:e}},__vite__mapDeps([12,1,2,13,7,8,4]))).VideoViewer}));function $P(e){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(null),a=e.alt===``?e.name:e.alt;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{type:`button`,"aria-label":`Play ${a}`,className:l(`group focus-visible:ring-ring border-border/40 relative inline-block cursor-pointer overflow-hidden rounded-lg border bg-black align-top outline-none focus-visible:ring-2`,e.className),onClick:()=>n(!0),children:[(0,F.jsx)(`video`,{src:`${e.src}#t=0.001`,"aria-hidden":!0,tabIndex:-1,muted:!0,playsInline:!0,preload:`metadata`,className:`pointer-events-none block size-full object-contain`,onError:e.onError,onLoadedMetadata:e=>i(Number.isFinite(e.currentTarget.duration)?e.currentTarget.duration:null)}),(0,F.jsx)(`span`,{className:`absolute inset-0 grid place-items-center bg-black/10 transition-colors group-hover:bg-black/25`,children:(0,F.jsx)(`span`,{className:`grid size-12 place-items-center rounded-full bg-black/60 text-white backdrop-blur-sm transition-transform group-hover:scale-105`,children:(0,F.jsx)(k,{icon:Ch,className:`size-5 translate-x-px fill-current`})})}),r!==null&&(0,F.jsx)(`span`,{className:`text-2xs absolute right-2 bottom-2 rounded-md bg-black/60 px-1.5 py-0.5 font-mono text-white tabular-nums`,children:yC(r)})]}),t&&(0,F.jsx)(P.Suspense,{children:(0,F.jsx)(QP,{src:e.src,label:a,name:e.name,onClose:()=>n(!1)})})]})}var eF=new Map([[`.png`,`image/png`],[`.jpg`,`image/jpeg`],[`.jpeg`,`image/jpeg`],[`.gif`,`image/gif`],[`.webp`,`image/webp`],[`.svg`,`image/svg+xml`],[`.mp4`,`video/mp4`],[`.m4v`,`video/mp4`],[`.webm`,`video/webm`],[`.mov`,`video/quicktime`],[`.mp3`,`audio/mpeg`],[`.wav`,`audio/wav`],[`.ogg`,`audio/ogg`],[`.opus`,`audio/ogg`],[`.m4a`,`audio/mp4`],[`.aac`,`audio/aac`],[`.flac`,`audio/flac`]]);function tF(e){let t=/\.[a-z0-9]+$/i.exec(e.split(/[?#]/)[0])?.[0],n=t===void 0?void 0:eF.get(t.toLowerCase());return n?.startsWith(`image/`)===!0?`image`:n?.startsWith(`video/`)===!0?`video`:n?.startsWith(`audio/`)===!0?`audio`:null}async function nF(e,t,n){let r=await I(e,`files.media`,{projectId:t,path:n});return`${Ya(e)}/api/media?${new URLSearchParams({token:r})}`}async function rF(e,t){let n=await fetch(e);if(!n.ok)throw Error(await n.text());let r=URL.createObjectURL(await n.blob()),i=document.createElement(`a`);i.href=r,i.download=t.slice(t.lastIndexOf(`/`)+1),i.click(),setTimeout(()=>URL.revokeObjectURL(r),6e4)}var iF=(0,P.lazy)(async()=>({default:(await tt(async()=>{let{AudioPlayer:e}=await import(`./audio-player-BE-oXEaT.js`);return{AudioPlayer:e}},__vite__mapDeps([14,1,2,13]))).AudioPlayer})),aF={image:Km,video:Zh,audio:mh},oF={image:qm,video:Qh,audio:qh},sF={image:`Image unavailable`,video:`Video unavailable`,audio:`Audio unavailable`};function cF(e){let t=Q(e=>e.selection),n=YP(),[r,i]=(0,P.useState)(null);(0,P.useEffect)(()=>{if(t===null)return;let n=!0;async function r(e,t,r){try{let a=await nF(e,t,r);n&&i({path:r,src:a})}catch(e){n&&i({path:r,error:s(e)})}}return r(t.machine,t.projectId,e.path),()=>{n=!1}},[t,e.path]);let a=r!==null&&r.path===e.path?r:null;return a!==null&&`error`in a?(0,F.jsx)(uF,{kind:tF(e.path)??`image`,reason:a.error,raw:e.raw}):(0,F.jsxs)(`span`,{className:l(`border-border bg-muted/50 flex flex-col gap-1 rounded-xl border p-1`,tF(e.path)===`audio`&&`w-fit max-w-[min(100%,36rem)]`,tF(e.path)!==`audio`&&`w-1/2`),children:[(0,F.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1.5 pl-1.5 [contain:inline-size]`,children:[(0,F.jsx)(k,{icon:aF[tF(e.path)??`image`],"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`text-2xs min-w-0 flex-1 truncate font-mono`,title:e.path,children:e.path}),(0,F.jsx)(je,{label:n.copied?`Copied`:`Copy path`,children:(0,F.jsx)(E,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Copy path`,onClick:()=>void n.copy(e.path),children:(0,F.jsx)(k,{icon:n.copied?Sm:Mm,className:`size-3`})})}),(0,F.jsx)(je,{label:`Download`,children:(0,F.jsx)(E,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Download`,disabled:a===null,onClick:()=>{if(a===null)throw Error(`media is still loading`);rF(a.src,e.path).catch(R9)},children:(0,F.jsx)(k,{icon:fne,className:`size-3`})})})]}),a!==null&&(0,F.jsx)(lF,{src:a.src,alt:e.alt,name:e.path,kind:tF(e.path)??`image`,raw:e.raw}),a===null&&tF(e.path)!==`audio`&&(0,F.jsx)(`span`,{className:`border-border/40 block aspect-[3/2] w-full rounded-lg border`})]})}function lF(e){let[t,n]=(0,P.useState)(null);return t===e.src?(0,F.jsx)(uF,{kind:e.kind,reason:`It could not be loaded`,raw:e.raw}):e.kind===`video`?(0,F.jsx)($P,{src:e.src,alt:e.alt,name:e.name,className:`block aspect-[3/2] w-full`,onError:()=>n(e.src)}):e.kind===`audio`?(0,F.jsx)(P.Suspense,{children:(0,F.jsx)(iF,{src:e.src,label:e.alt===``?e.name:e.alt,className:`flex w-[28rem] max-w-full`,onError:()=>n(e.src)})}):(0,F.jsx)(iC,{src:e.src,alt:e.alt,name:e.name,className:`border-border/40 block aspect-[3/2] w-full overflow-hidden rounded-lg border`,imageClassName:`pointer-events-auto size-full object-contain`,onError:()=>n(e.src)})}function uF(e){return(0,F.jsxs)(`span`,{className:`border-border/70 text-muted-foreground flex w-fit max-w-full flex-col gap-1 rounded-lg border border-dashed px-3 py-2 text-xs`,children:[(0,F.jsxs)(`span`,{className:`flex items-start gap-1.5`,children:[(0,F.jsx)(k,{icon:oF[e.kind],"aria-hidden":!0,className:`mt-px size-3.5 shrink-0`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-foreground/80 font-medium`,children:sF[e.kind]}),` · ${e.reason}`]})]}),(0,F.jsx)(`span`,{className:`text-2xs font-mono break-all opacity-80`,children:e.raw})]})}function dF(){let e=null;return function(){let t=this.parser;if(t===void 0)throw Error(`Markdown parser is missing`);this.parser=(n,r)=>{let i=fF(t,e,n,r);return i.cached!==null&&(e=i.cached),i.root}}}function fF(e,t,n,r){if(n.includes(`\r`)||n.includes(``))return{root:e(n,r),cached:null};let i=t!==null&&n.startsWith(t.source)?t:null,a=e(i===null?n:n.slice(i.offset),r),o=a.children;if(o===void 0)throw Error(`Markdown root has no children`);if(pF(a))return{root:i===null?a:e(n,r),cached:null};i!==null&&(mF(a,i.offset,i.line-1),a.position!==void 0&&(a.position.start={line:1,column:1,offset:0}),o.unshift(...structuredClone(i.children)));for(let e=o.length-1;e>=0;e--){let t=o[e],r=t.position;if(t.type!==`code`||r===void 0||r.start.offset===void 0||r.end.offset===void 0)continue;if(i!==null&&r.end.offset<i.offset)break;let s=n.slice(r.start.offset,r.end.offset),c=/^ {0,3}(`{3,}|~{3,})[^\n]*\n/.exec(s)?.[1],l=/^\n[ \t]*\n/.exec(n.slice(r.end.offset))?.[0];if(c===void 0||l===void 0||!RegExp(`^ {0,3}${c[0]}{${c.length},}[ \\t]*$`).test(s.slice(s.lastIndexOf(`
90
- `)+1)))continue;let u=r.end.offset+l.length;return{root:a,cached:{source:n.slice(0,u),offset:u,line:r.end.line+2,children:structuredClone(o.slice(0,e+1))}}}return{root:a,cached:null}}function pF(e){return e.type===`definition`||e.type===`footnoteDefinition`||e.children?.some(pF)===!0}function mF(e,t,n){if(e.position!==void 0)for(let r of[e.position.start,e.position.end])r.offset!==void 0&&(r.offset+=t),r.line+=n;e.children?.forEach(e=>mF(e,t,n))}var hF=(0,P.lazy)(async()=>({default:(await tt(async()=>{let{ImageViewer:e}=await import(`./image-viewer-AlNpsjfB.js`);return{ImageViewer:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]))).ImageViewer})),gF=0;function _F(e){let t=Q(e=>e.prefs.theme),[n,r]=(0,P.useState)(null);return(0,P.useEffect)(()=>{if(e===null)return;let t=!0,n=setTimeout(()=>{let n=GP();tt(async()=>{let{default:e}=await import(`./mermaid.core-BvdElKsv.js`);return{default:e}},__vite__mapDeps([15,16,17,18,19,2,20,11,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37])).then(({default:t})=>(t.initialize({startOnLoad:!1,theme:`base`,themeCSS:`rect.basic, .node rect, .cluster rect, rect.actor { rx: 6px; ry: 6px } * { filter: none !important } .edgeLabel, .edgeLabel p { background-color: var(--mermaid-surface, ${n.background}) } .edgeLabel rect, .cluster rect, .relationshipLabelBox { fill: var(--mermaid-surface, ${n.background}); opacity: 1 }`,themeVariables:{darkMode:!0,fontFamily:getComputedStyle(document.body).fontFamily,fontSize:`13px`,useGradient:!1,background:n.background,primaryColor:n.selectionBackground,primaryTextColor:n.foreground,primaryBorderColor:n.palette[8],lineColor:n.palette[8],textColor:n.foreground,edgeLabelBackground:n.background,clusterBkg:n.background,clusterBorder:n.palette[0],noteBkgColor:n.palette[0],noteTextColor:n.foreground,noteBorderColor:n.palette[8],pieOpacity:`0.8`,pieStrokeColor:n.background,pieOuterStrokeColor:n.background,pieSectionTextColor:n.background,...Object.fromEntries([4,5,6,2,3,1].flatMap((e,t)=>[[`pie${t+1}`,n.palette[e]],[`git${t}`,n.palette[e]],[`cScale${t}`,n.palette[e]],[`cScaleLabel${t}`,n.background]]))}}),gF+=1,t.render(`mermaid-${gF}`,e))).then(e=>{t&&r(e.svg)}).catch(()=>{t&&r(null)})},400);return()=>{t=!1,clearTimeout(n)}},[e,t]),e===null?null:n}function vF(e){let[t,n]=(0,P.useState)(!1);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,"aria-label":`View diagram`,className:`focus-visible:ring-ring flex w-full cursor-zoom-in justify-center rounded-lg px-3 pt-2 pb-3 outline-none [--mermaid-surface:color-mix(in_srgb,var(--text)_3.2%,var(--bg))] focus-visible:ring-2 [&>svg]:h-auto`,onClick:()=>n(!0),dangerouslySetInnerHTML:{__html:e.svg}}),t&&(0,F.jsx)(P.Suspense,{children:(0,F.jsx)(hF,{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e.svg)}`,alt:`Diagram`,name:`Mermaid diagram`,onClose:()=>n(!1)})})]})}var yF={note:{label:`Note`,icon:Ym,border:`border-blue-500/70`,title:`text-blue-600 dark:text-blue-400`},tip:{label:`Tip`,icon:$m,border:`border-emerald-500/70`,title:`text-emerald-600 dark:text-emerald-400`},important:{label:`Important`,icon:ch,border:`border-purple-500/70`,title:`text-purple-600 dark:text-purple-400`},warning:{label:`Warning`,icon:Kh,border:`border-amber-500/70`,title:`text-amber-600 dark:text-amber-500`},caution:{label:`Caution`,icon:hh,border:`border-red-500/70`,title:`text-red-600 dark:text-red-400`}},bF={...Sj,attributes:{...Sj.attributes,blockquote:[...Sj.attributes?.blockquote??[],`dataAlert`]},protocols:{...Sj.protocols,href:[...Sj.protocols?.href??[],`file`]}},xF=new Set;function SF(){return e=>{function t(e){e.children?.forEach(t),CF(e)}t(e)}}function CF(e){if(e.type!==`blockquote`)return;let t=e.children?.[0],n=t?.children?.[0];if(t?.type!==`paragraph`||n?.type!==`text`||typeof n.value!=`string`)return;let r=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\](?:\r?\n|$)/i.exec(n.value);if(r===null)return;let i=n.value.slice(r[0].length);if(i.length>0)n.value=i;else if(r[0].endsWith(`
91
- `)||t.children?.length===1)t.children?.shift(),t.children?.length===0&&e.children?.shift();else return;e.data={...e.data,hProperties:{...e.data?.hProperties,dataAlert:r[1].toLowerCase()}}}var wF={blockquote({node:e,children:t}){let n=e?.properties.dataAlert,r=n===`note`||n===`tip`||n===`important`||n===`warning`||n===`caution`?yF[n]:null;return r===null?(0,F.jsx)(`blockquote`,{children:t}):(0,F.jsxs)(`div`,{role:`note`,className:l(`my-1 border-l-2 pl-3`,r.border),children:[(0,F.jsxs)(`p`,{className:l(`flex items-center gap-1.5 font-medium`,r.title),children:[(0,F.jsx)(k,{icon:r.icon,"aria-hidden":!0,className:`size-3.5 shrink-0`}),r.label]}),t]})},ol({node:e,start:t,children:n}){let r=e?.children.filter(e=>e.type===`element`&&e.tagName===`li`).length??0,i=t??1,a=Math.max(String(i).length,String(i+Math.max(r-1,0)).length);return(0,F.jsx)(`ol`,{start:t,ref:e=>{e!==null&&a>1&&e.style.setProperty(`--list-gutter`,`${a+2}ch`)},children:n})},a({node:e,href:t,children:n}){let r=DF(t);if(r!==null)return(0,F.jsx)(`a`,{href:t,onClick:e=>{e.preventDefault(),IS(r)},children:n});let i=OF(t);if(i===null)return(0,F.jsx)(`a`,{href:t,children:n});let a=e?.children.every(e=>e.type===`text`)?e.children.map(e=>e.type===`text`?e.value:``).join(``):``;return(0,F.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:a===``?n:(0,F.jsx)(kF,{host:i,text:a})})},table({children:e}){return(0,F.jsx)(XP,{children:e})},details({open:e,children:t}){return(0,F.jsx)(ZP,{open:e===!0,children:t})},img({src:e,alt:t}){return typeof e==`string`?e.startsWith(`/`)&&!e.startsWith(`//`)||e.startsWith(`./`)?(0,F.jsx)(cF,{path:decodeURI(e),alt:t??``,raw:`![${t??``}](${e})`}):(0,F.jsx)(`span`,{className:l(`block`,tF(e)!==`audio`&&`w-1/2`),children:(0,F.jsx)(lF,{src:e,alt:t??``,name:e.startsWith(`data:`)?`Image`:e.split(/[?#]/)[0],kind:tF(e)??`image`,raw:`![${t??``}](${e})`})}):null},pre({node:e,children:t}){let n=e?.children[0];if(n?.type!==`element`||n.tagName!==`code`)return(0,F.jsx)(`pre`,{children:t});let r=n.children.map(e=>e.type===`text`?e.value:``).join(``),i=n.properties.className,a=Array.isArray(i)?i.map(String).find(e=>e.startsWith(`language-`))?.slice(9):void 0;return(0,F.jsx)(jF,{code:r.replace(/\n$/,``),language:a===`gitignore`?`ini`:a??`text`})}},TF=(0,P.memo)(EF);function EF(e){let[t]=(0,P.useState)(dF);return(0,F.jsx)(`div`,{className:l(`chat-markdown text-foreground w-full min-w-0 text-sm leading-relaxed [overflow-wrap:anywhere] [word-break:break-word]`,e.className),"data-streaming":e.streaming===!0?``:void 0,children:(0,F.jsx)(nre,{remarkPlugins:[UP,SF,...e.lineBreaks===!0?[qj]:[],...e.streaming===!0?[t]:[]],rehypePlugins:e.rawHtml===!1?[]:[bj,[zj,bF]],components:wF,urlTransform:e=>e.startsWith(`file:`)?e:WO(e),children:e.text})})}function DF(e){if(e===void 0||e===``||e.startsWith(`#`)||e.startsWith(`//`))return null;if(e.startsWith(`file:`))return e;if(!/^[a-z]:[\\/]/i.test(e)&&/^[a-z][a-z0-9+.-]*:/i.test(e))return null;try{return decodeURI(e)}catch{return e}}function OF(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).host}catch{return null}}function kF(e){let t=/^https?:\/\//i.exec(e.text)?.[0].length??Math.min(e.text.length,1);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,F.jsx)(AF,{host:e.host}),e.text.slice(0,t)]}),Array.from(e.text.slice(t),(e,t)=>(0,F.jsxs)(`span`,{children:[e,(0,F.jsx)(`wbr`,{})]},t))]})}function AF(e){let[t,n]=(0,P.useState)(xF.has(e.host)),r=e.host.toLowerCase(),i=r===`github.com`||r.endsWith(`.github.com`);return(0,F.jsx)(`span`,{className:`ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]`,"aria-hidden":!0,children:i?(0,F.jsx)(k,{icon:Vm,className:`block size-full shrink-0 select-none`}):t?(0,F.jsx)(k,{icon:Hm,className:`block size-full shrink-0 select-none`}):(0,F.jsx)(`img`,{src:`https://${e.host}/favicon.ico`,alt:``,loading:`lazy`,draggable:!1,className:`block size-full shrink-0 rounded-sm select-none`,onError:()=>{xF.add(e.host),n(!0)}})})}function jF(e){let[t,n]=(0,P.useState)(!0),[r,i]=(0,P.useState)(!1),a=_F(e.language===`mermaid`?e.code:null),o=YP(),s=t?`Disable line wrap`:`Wrap lines`,c=r?`Show diagram`:`Show code`,l=o.copied?`Copied`:`Copy code`;return(0,F.jsxs)(`div`,{className:`chat-markdown-codeblock border-border/70 bg-secondary dark:bg-input/32 my-[0.65rem] overflow-hidden rounded-lg border leading-snug dark:border-transparent`,"data-language":e.language,"data-wrap":t,children:[(0,F.jsxs)(`div`,{className:`chat-markdown-codeblock-header flex items-center justify-between gap-2 pt-1.5 pr-1.5 pb-0 pl-3 select-none`,children:[(0,F.jsx)(`span`,{className:`text-2xs inline-flex min-w-0 items-center gap-1.5 font-mono`,children:Ue(e.language)?(0,F.jsx)(je,{label:e.language,children:(0,F.jsx)(`span`,{className:`inline-flex shrink-0 rounded-sm`,"aria-label":`Language: ${e.language}`,children:(0,F.jsx)(Le,{path:Ze(e.language),className:`size-3.5`})})}):(0,F.jsx)(`span`,{className:`truncate`,children:e.language})}),(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5`,role:`toolbar`,children:[a!==null&&(0,F.jsx)(je,{label:c,children:(0,F.jsx)(E,{type:`button`,variant:r?`secondary`:`ghost-muted`,size:`icon-xs`,"aria-pressed":r,"aria-label":c,onClick:()=>i(!r),children:(0,F.jsx)(k,{icon:Rh,className:`size-3`})})}),(a===null||r)&&(0,F.jsx)(je,{label:s,children:(0,F.jsx)(E,{type:`button`,variant:t?`secondary`:`ghost-muted`,size:`icon-xs`,"aria-pressed":t,"aria-label":s,onClick:()=>n(!t),children:(0,F.jsx)(k,{icon:Wh,className:`size-3`})})}),(0,F.jsx)(je,{label:l,children:(0,F.jsx)(E,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":l,onClick:()=>void o.copy(e.code),children:(0,F.jsx)(k,{icon:o.copied?Sm:Mm,className:`size-3`})})})]})]}),a!==null&&!r?(0,F.jsx)(vF,{svg:a}):(0,F.jsx)(JP,{code:e.code,language:e.language})]})}var MF=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},NF=new class extends MF{};function PF(e,t,n){return NF.diff(e,t,n)}function FF(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function IF(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function LF(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function RF(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function zF(e,t){return LF(e,t,``)}function BF(e,t){return RF(e,t,``)}function VF(e,t){return t.slice(0,HF(e,t))}function HF(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function UF(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function WF(e,t){if(t)return KF(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function GF(e,t){if(t)return KF(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function KF(e,t){if(!t)return[GF(e),WF(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=UF(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var qF=`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}`,JF=RegExp(`[${qF}]+|\\s+|[^${qF}]`,`ug`);new class extends MF{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=UF(e,r)}else n=e.match(JF)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&YF(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&YF(n,i,r,null,t.intlSegmenter),e}};function YF(e,t,n,r,i){if(t&&n){let[a,o]=KF(t.value,i),[s,c]=KF(n.value,i);if(e){let r=FF(a,s);e.value=RF(e.value,s,r),t.value=zF(t.value,r),n.value=zF(n.value,r)}if(r){let e=IF(o,c);r.value=LF(r.value,c,e),t.value=BF(t.value,e),n.value=BF(n.value,e)}}else if(n){if(e){let e=GF(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=GF(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=GF(r.value,i),[a,o]=KF(t.value,i),s=FF(n,a);t.value=zF(t.value,s);let c=IF(zF(n,s),o);t.value=BF(t.value,c),r.value=LF(r.value,n,c),e.value=RF(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=GF(r.value,i),n=VF(WF(t.value,i),e);t.value=BF(t.value,n)}else if(e){let n=VF(WF(e.value,i),GF(t.value,i));t.value=zF(t.value,n)}}var XF=new class extends MF{tokenize(e){let t=RegExp(`(\\r?\\n)|[${qF}]+|[^\\S\\n\\r]+|[^${qF}]`,`ug`);return e.match(t)||[]}};function ZF(e,t,n){return XF.diff(e,t,n)}var QF=new class extends MF{constructor(){super(...arguments),this.tokenize=eI}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
92
- `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
93
- `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
94
- `)&&(e=e.slice(0,-1)),t.endsWith(`
95
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function $F(e,t,n){return QF.diff(e,t,n)}function eI(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
96
- `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function tI(e){return e==`.`||e==`!`||e==`?`}new class extends MF{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(tI(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends MF{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends MF{constructor(){super(...arguments),this.tokenize=eI}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(nI(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function nI(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=nI(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=nI(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends MF{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function rI(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function iI(e){if(!rI(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var aI={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function oI(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;$F(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l($F(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||lI(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
97
- `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function sI(e,t){if(t||=aI,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw 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 e.map(e=>sI(e,t)).join(`
98
- `)}let n=[];if(e.isGit){if(t=aI,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+iI(r)+` `+iI(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+iI((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+iI((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+iI((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+iI((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+iI(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+iI(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
99
- `)+`
100
- `}function cI(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;oI(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?sI(e,o.headerOptions):void 0)}}))}else{let s=oI(e,t,n,r,i,a,o);return s?sI(s,o?.headerOptions):void 0}}function lI(e){let t=e.endsWith(`
101
- `),n=e.split(`
102
- `).map(e=>e+`
103
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function uI(e){let t=e.item;switch(t.kind){case`file_change`:return(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:t.diffs.map((e,t)=>(0,F.jsx)(gI,{before:e.before,after:e.after},t))});case`todo_list`:return(0,F.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:t.steps.map((e,t)=>(0,F.jsxs)(`li`,{className:l(`text-secondary-label`,e.status===`completed`&&`text-muted-foreground line-through`,e.status===`running`&&`text-foreground`),children:[e.status===`completed`?`☑`:`☐`,` `,e.text]},t))});case`plan`:return(0,F.jsx)(TF,{text:t.plan});case`tool`:return fI(t.name)===`other`?(0,F.jsx)(hI,{text:JSON.stringify(t.input,null,2)}):null;default:return null}}function dI(e,t){switch(e.kind){case`command`:return e.command;case`file_change`:return vI(e.path,t);case`web_search`:return e.url??e.query??``;case`subagent`:return e.description;case`skill`:return e.skill;case`tool`:{let n=fI(e.name);return n===`read`?vI(pI(e.input),t):n===`search`?_I(e.input.pattern):``}default:return``}}function fI(e){switch(e.toLowerCase()){case`read`:return`read`;case`grep`:case`glob`:return`search`;default:return`other`}}function pI(e){return[e.file_path,e.filePath,e.path].map(_I).find(e=>e!==``)??``}function mI(e){let t=0,n=0;for(let r of e.diffs)for(let e of $F(r.before,r.after))e.added&&(t+=e.count),e.removed&&(n+=e.count);return{added:t,removed:n}}function hI(e){return(0,F.jsx)(`pre`,{className:`text-foreground/80 text-2xs max-h-64 overflow-auto font-mono leading-relaxed whitespace-pre-wrap`,children:e.text})}function gI(e){return(0,F.jsx)(`pre`,{className:`border-border/60 text-2xs max-h-80 overflow-auto rounded-md border font-mono leading-relaxed`,children:$F(e.before,e.after).flatMap((e,t)=>e.value.replace(/\n$/,``).split(`
104
- `).map((n,r)=>(0,F.jsxs)(`div`,{className:l(`px-2 whitespace-pre-wrap`,e.added&&`bg-diff-addition/10 text-diff-addition`,e.removed&&`bg-diff-deletion/10 text-diff-deletion`,!e.added&&!e.removed&&`text-muted-foreground`),children:[e.added?`+`:e.removed?`-`:` `,` `,n]},`${t}:${r}`)))})}function _I(e){return typeof e==`string`?e:``}function vI(e,t){return e.startsWith(t+`/`)?e.slice(t.length+1):e}var yI=`(Recommended)`;function bI(e){let t=e.options.map(e=>e.label).filter(e=>e.endsWith(yI));return e.multiSelect?t:t.slice(0,1)}function xI(e){return(0,F.jsxs)(`span`,{className:l(`mt-0.5 grid size-4 shrink-0 place-items-center border transition-colors`,e.multi?`rounded`:`rounded-full`,e.selected&&`border-primary bg-primary text-primary-foreground`,e.suggested&&`border-primary border-dashed`,!e.selected&&!e.suggested&&`border-muted-foreground/40`),children:[e.selected&&e.multi&&(0,F.jsx)(k,{icon:Sm,strokeWidth:3,className:`size-3`}),e.selected&&!e.multi&&(0,F.jsx)(`span`,{className:`bg-primary-foreground size-1.5 rounded-full`})]})}function SI(e){let[t,n]=(0,P.useState)(Date.now);(0,P.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=Math.max(0,Math.ceil((e.at-t)/1e3));return(0,F.jsxs)(`span`,{className:`text-muted-foreground text-2xs mr-1 tabular-nums`,children:[e.label,` in`,` `,r<60?`${r}s`:`${Math.ceil(r/60)}m`]})}var CI=`composer-glass relative mx-auto -mb-[calc(1rem+1px)] w-[calc(100%-2.75rem)] rounded-t-2xl border border-b-0 px-1 pt-1 pb-[calc(1rem+1px+0.25rem)] text-xs/4`;function wI(e){let t=e.request;if(t.kind===`question`)return(0,F.jsx)(TI,{machine:e.machine,request:t,draft:e.draft});let n=t.kind===`plan`,r=n?``:dI(t.item,e.cwd);return(0,F.jsx)(`div`,{className:l(CI,`border-warning/28 bg-linear-to-b from-warning/8 to-warning/8`),children:(0,F.jsxs)(`div`,{className:`grid grid-cols-[1.5rem_minmax(0,1fr)_auto] items-start gap-x-2 gap-y-3 px-1 py-1`,children:[(0,F.jsx)(`span`,{className:`text-warning flex justify-center pt-0.5`,children:(0,F.jsx)(k,{icon:Ph,className:`size-4`})}),(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,F.jsxs)(`span`,{className:`text-muted-foreground text-2xs flex w-full min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-warning shrink-0 font-medium`,children:n?`Ready to code?`:t.title}),e.count>1&&(0,F.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[`1/`,e.count]})]}),r!==``&&(0,F.jsx)(`span`,{className:`text-foreground block max-h-20 w-full min-w-0 overflow-auto font-mono text-xs whitespace-pre`,children:r})]}),(0,F.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[t.autoResolve!==void 0&&(0,F.jsx)(SI,{label:t.autoResolve.decision===`allow`?`Approve`:`Decline`,at:t.autoResolve.at}),(0,F.jsx)(E,{size:`xs`,variant:`outline`,onClick:()=>XS(t.id,`deny`,null),children:n?`Keep planning`:`Decline`}),t.kind===`approval`&&t.canAlwaysAllow&&(0,F.jsx)(E,{size:`xs`,variant:`outline`,onClick:()=>XS(t.id,`always`,null),children:`Always`}),(0,F.jsx)(E,{size:`xs`,onClick:()=>XS(t.id,`allow`,null),children:n?`Approve plan`:`Approve`})]}),n&&(0,F.jsx)(`div`,{className:`col-span-3 max-h-60 overflow-auto px-1 empty:hidden`,children:(0,F.jsx)(TF,{text:t.plan})}),t.kind===`approval`&&t.item.kind!==`command`&&(0,F.jsx)(`div`,{className:`col-span-3 max-h-60 overflow-auto px-1 empty:hidden`,children:(0,F.jsx)(uI,{item:t.item})})]})})}function TI(e){let t=e.request.questions,[n,r]=(0,P.useState)(0),[i,a]=(0,P.useState)({}),[o,s]=(0,P.useState)({}),c=Object.fromEntries(t.map(e=>[e.question,[...i[e.question]??[],o[e.question]?.trim()??``].filter(e=>e!==``)])),u=Object.fromEntries(t.map(e=>[e.question,(c[e.question].length>0?c[e.question]:bI(e)).join(`, `)])),d=t[n],f=t.flatMap((e,t)=>c[e.question].length===0?[t]:[]),p=f.find(e=>e>n)??f[0];function m(e,c){let l=i[e.question]??[];e.multiSelect?a({...i,[e.question]:l.includes(c)?l.filter(e=>e!==c):[...l,c]}):(a({...i,[e.question]:[c]}),s({...o,[e.question]:``}),n<t.length-1&&r(n+1))}function h(e,t){s({...o,[e.question]:t}),!e.multiSelect&&t.trim()!==``&&a({...i,[e.question]:[]})}async function g(t,n){let r=oC(Z().items,[e.draft,...Object.values(o)]);for(let i of n)try{let n=await DS(e.machine,i),o=n;i.type.startsWith(`image/`)&&(r+=1,o=`[Image #${r}] (saved at ${n})`),s(e=>{let n=e[t.question]??``;return{...e,[t.question]:`${n}${/(^|\s)$/.test(n)?``:` `}${o}`}}),t.multiSelect||a(e=>({...e,[t.question]:[]}))}catch(e){R9(e)}}return(0,F.jsx)(`div`,{className:`composer-glass shadow-composer relative z-10 rounded-3xl border border-(--composer-outline)`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 p-2.5`,children:[(0,F.jsxs)(`div`,{role:`tabpanel`,className:`flex min-w-0 flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`mb-1 flex items-start gap-1.5 pt-1 pr-1 pl-1.5`,children:[(0,F.jsx)(`span`,{className:`bg-primary/18 text-primary grid size-6 shrink-0 place-items-center rounded-md`,children:(0,F.jsx)(k,{icon:sh,className:`size-4`})}),(0,F.jsx)(`p`,{className:`text-foreground min-w-0 flex-1 pt-0.5 text-[15px] leading-5 font-medium`,children:d.question}),(0,F.jsx)(E,{size:`icon-xs`,variant:`ghost`,"aria-label":`Skip questions`,title:`Skip questions`,onClick:()=>XS(e.request.id,`deny`,null),children:(0,F.jsx)(k,{icon:Me})})]}),(0,F.jsxs)(`div`,{role:d.multiSelect?`group`:`radiogroup`,"aria-label":d.question,className:`flex max-h-[min(18rem,32dvh)] flex-col gap-0.5 overflow-y-auto`,children:[d.options.map(e=>{let t=i[d.question]?.includes(e.label)===!0,n=c[d.question].length===0&&bI(d).includes(e.label),r=e.label.endsWith(yI);return(0,F.jsxs)(`button`,{role:d.multiSelect?`checkbox`:`radio`,"aria-checked":t,className:l(`flex cursor-pointer items-start gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors`,t?`bg-muted/70`:`hover:bg-muted/40`),onClick:()=>m(d,e.label),children:[(0,F.jsx)(xI,{multi:d.multiSelect,selected:t,suggested:n}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,F.jsx)(`span`,{className:`text-foreground text-sm`,children:r?e.label.slice(0,-13).trim():e.label}),r&&(0,F.jsx)(`span`,{className:`text-muted-foreground/70 text-[11px]`,children:`Recommended`})]}),e.description!==``&&(0,F.jsx)(`span`,{className:`text-secondary-label mt-0.5 block text-xs leading-4`,children:e.description})]})]},e.label)}),(0,F.jsxs)(`label`,{className:l(`flex cursor-text items-start gap-2.5 rounded-lg px-2.5 py-2 transition-colors`,(o[d.question]??``).trim()===``?`focus-within:bg-muted/40 hover:bg-muted/40`:`bg-muted/70`),children:[(0,F.jsx)(xI,{multi:d.multiSelect,selected:(o[d.question]??``).trim()!==``,suggested:!1}),(0,F.jsx)(`textarea`,{value:o[d.question]??``,rows:1,onChange:e=>h(d,e.target.value),onPaste:e=>{let t=e.clipboardData.getData(`text/plain`);if(t!==``){e.preventDefault(),document.execCommand(`insertText`,!1,t);return}let n=[...e.clipboardData.files];n.length!==0&&(e.preventDefault(),g(d,n))},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),g(d,[...e.dataTransfer.files])},placeholder:`Something else…`,className:`placeholder:text-placeholder/75 [field-sizing:content] max-h-40 min-w-0 flex-1 resize-none bg-transparent text-sm leading-5 outline-none`})]})]})]},d.question),(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t.length>1&&(0,F.jsx)(`div`,{role:`tablist`,className:`flex min-w-0 [scrollbar-width:none] gap-1 overflow-x-auto`,children:t.map((e,t)=>(0,F.jsxs)(`button`,{role:`tab`,"aria-selected":t===n,className:l(`flex h-6 shrink-0 cursor-pointer items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,t===n?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`),onClick:()=>r(t),children:[c[e.question].length>0&&(0,F.jsx)(k,{icon:rne,"aria-label":`Answered`,className:`text-success size-3.5`}),c[e.question].length===0&&u[e.question]!==``&&(0,F.jsx)(k,{icon:Dm,"aria-label":`Using the recommended answer`,className:`text-primary size-3.5`}),u[e.question]===``&&(0,F.jsx)(k,{icon:Um,"aria-label":`Not answered`,className:`text-muted-foreground size-3.5`}),e.header]},e.question))}),(0,F.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5 pr-1`,children:[e.request.autoResolve!==void 0&&(0,F.jsx)(SI,{label:`Skip`,at:e.request.autoResolve.at}),(0,F.jsx)(E,{size:`xs`,variant:`outline`,onClick:()=>XS(e.request.id,`allow`,{}),children:`Skip`}),(0,F.jsx)(E,{size:`xs`,variant:p===void 0?`default`:`outline`,onClick:()=>XS(e.request.id,`allow`,Object.fromEntries(t.flatMap(e=>c[e.question].length===0?[]:[[e.question,c[e.question].join(`, `)]]))),children:`Submit`}),p!==void 0&&(0,F.jsx)(E,{size:`xs`,onClick:()=>{c[d.question].length===0&&a({...i,[d.question]:bI(d)}),r(p)},children:`Next`})]})]})]})})}function EI({...e}){return(0,F.jsx)(kb,{"data-slot":`popover`,...e})}function DI({...e}){return(0,F.jsx)(jb,{"data-slot":`popover-trigger`,...e})}function OI({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,F.jsx)(Fb,{children:(0,F.jsx)(Lb,{"data-slot":`popover-content`,sideOffset:n,align:t,className:l(`z-50 origin-(--radix-popover-content-transform-origin) overflow-hidden rounded-lg dropdown-glass text-popover-foreground shadow-[0_16px_40px_-18px_rgb(0_0_0/55%)] outline-none dark:shadow-[0_18px_44px_-18px_rgb(0_0_0/80%)] duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function kI(e,t,n,r,i){let a=AI(e,n,r+Math.asin(.5/n)),o=AI(e,n,i-Math.asin(.5/n)),s=AI(e,t,i-Math.asin(.5/t)),c=AI(e,t,r+Math.asin(.5/t)),l=[a,o,s,c,...r<Math.PI/2&&i>Math.PI/2?[AI(e,n,Math.PI/2)]:[]],u=Math.min(...l.map(e=>e.x)),d=Math.min(...l.map(e=>e.y)),f=AI(e,(t+n)/2,(r+i)/2);return{style:{left:u,top:d,width:Math.max(...l.map(e=>e.x))-u,height:Math.max(...l.map(e=>e.y))-d,clipPath:`path('M${a.x-u} ${a.y-d} A${n} ${n} 0 0 0 ${o.x-u} ${o.y-d} L${s.x-u} ${s.y-d} A${t} ${t} 0 0 1 ${c.x-u} ${c.y-d}Z')`},center:{left:f.x-u,top:f.y-d}}}function AI(e,t,n){return{x:e+t*Math.cos(n),y:e-t*Math.sin(n)}}var jI=`relative inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap rounded-(--control-radius) border border-transparent outline-none hover:bg-accent data-[state=open]:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-64 [&_svg]:pointer-events-none [&_svg]:shrink-0`,MI=`h-7 gap-1.5 px-1.5 text-sm font-medium text-secondary-label hover:text-foreground [&_svg:not([class*=text-])]:text-muted-foreground [&_svg:not([class*=size-])]:size-4`;function NI(){let e=Q(e=>e.settings),t=Q(e=>e.capabilities)?.models.find(t=>t.value===e.model);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(PI,{}),(0,F.jsx)(`span`,{className:`bg-border mx-0.5 hidden h-4 w-px shrink-0 sm:block`}),t!==void 0&&t.efforts.length>0&&(0,F.jsx)(FI,{title:`Effort`,trigger:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(k,{icon:Zte}),(0,F.jsx)(`span`,{className:`capitalize`,children:e.effort??`Default`})]}),value:e.effort??`default`,options:[...e.provider===`opencode`?[{value:`default`,label:`Default`}]:[],...t.efforts.map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1)}))],onChange:e=>Y9({effort:e==="default"?null:e})})]})}function PI(){let e=Q(e=>e.settings),t=Q(e=>e.selection),n=Q(e=>e.machines.find(t=>t.id===e.selection?.machine)),r=[...[...n?.claudeAccounts??[],...n?.codexAccounts??[]].filter(e=>e.valid).map(e=>({key:e.id,provider:e.provider,accountId:e.id,name:e.name,color:e.color,plan:e.plan,error:e.error})),...n?.openCode.available===!0?[{key:`opencode`,provider:`opencode`,accountId:null,name:`OpenCode`,color:null,plan:null,error:null}]:[]].filter(n=>t?.sessionId===null||n.provider===e.provider),i=e.provider===`opencode`?`opencode`:e.accountId,a=Q(e=>e.capabilities),[o,s]=(0,P.useState)(!1),[c,u]=(0,P.useState)(i),[d,f]=(0,P.useState)(``),[p,m]=(0,P.useState)({}),h=(0,P.useRef)(null),g=a?.models.find(t=>t.value===e.model)?.name??e.model??`Choose a model`,_=r.find(e=>e.key===i),v=c===null?[]:c===i?a?.models??null:p[c]??null,y=r.find(e=>e.key===c)?.provider,b=(v??[]).filter(e=>!e.hidden),x=b.length>=5,S=x?d.trim().toLowerCase():``,C=b.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(S));function w(e){if(s(e),e&&(u(i),f(``),t!==null))for(let e of r)e.key!==i&&e.error===null&&I(t.machine,`capabilities`,{provider:e.provider,accountId:e.accountId,projectId:t.projectId}).then(t=>m(n=>({...n,[e.key]:t.models})),R9)}function T(n,i){let a=r.find(e=>e.key===n);if(a===void 0||t===null)return;let o=a.provider,s={accountId:a.accountId,model:i.value,...i.effort===null?{}:{effort:i.effort}};o===e.provider?Y9(s):Y9({...q9(T9(Z(),t.machine).composer,o),...s})}return(0,F.jsxs)(EI,{open:o,onOpenChange:w,children:[(0,F.jsx)(DI,{asChild:!0,children:(0,F.jsxs)(`button`,{className:l(jI,MI),title:_===void 0?`Model`:`${_.name} · ${g}`,children:[(0,F.jsxs)(`span`,{className:`relative`,children:[(0,F.jsx)(Jg,{provider:e.provider,className:`size-4`}),r.filter(t=>t.provider===e.provider).length>1&&_!==void 0&&(0,F.jsx)(`span`,{className:l(`pointer-events-none absolute -right-1 -bottom-1 flex h-3 min-w-3 items-center justify-center rounded-full border px-0.5 text-[8px] leading-none font-semibold shadow-sm`,_.color===null?`bg-card text-muted-foreground`:`border-card text-white`),style:_.color===null?void 0:{backgroundColor:_.color},children:_.name.charAt(0).toUpperCase()})]}),(0,F.jsx)(`span`,{className:`max-w-40 truncate`,children:g})]})}),(0,F.jsxs)(OI,{side:`top`,className:`flex max-h-86.5 w-screen max-w-90 flex-row`,onOpenAutoFocus:e=>{e.preventDefault(),h.current?.focus()},onCloseAutoFocus:e=>{e.preventDefault(),document.querySelector(`[data-composer]`)?.focus()},children:[r.length>1&&(0,F.jsxs)(`div`,{className:`bg-muted/30 flex w-11 shrink-0 [scrollbar-width:none] flex-col gap-1 overflow-y-auto p-1`,children:[r.map(t=>(0,F.jsxs)(`div`,{className:`relative w-full`,children:[t.key===c&&(0,F.jsx)(`div`,{className:`bg-primary pointer-events-none absolute top-1/2 -right-1 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full`}),(0,F.jsx)(je,{side:`left`,label:t.error===null?[t.name,t.plan].filter(e=>e!==null).join(` · `):`${t.name} — ${t.error}`,children:(0,F.jsxs)(`button`,{className:l(`hover:bg-foreground/10 focus-visible:bg-foreground/10 relative flex aspect-square w-full cursor-pointer items-center justify-center rounded-md transition-colors focus-visible:outline-none`,t.error!==null&&`cursor-not-allowed opacity-50 hover:bg-transparent`),"aria-label":t.name,"aria-pressed":t.key===c,"aria-disabled":t.error!==null,onClick:()=>{if(t.error!==null)return;let n=p[t.key]?.find(t=>t.value===e.model);t.key!==i&&i!==null&&a!==null&&n!==void 0&&(m(e=>({...e,[i]:a.models})),T(t.key,n)),u(t.key)},children:[(0,F.jsx)(Jg,{provider:t.provider,className:`size-5`}),r.filter(e=>e.provider===t.provider).length>1&&(0,F.jsx)(`span`,{className:l(`text-3xs pointer-events-none absolute right-0.5 bottom-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full border px-0.5 leading-none font-semibold shadow-sm`,t.color===null?`bg-card text-muted-foreground`:`border-card text-white`),style:t.color===null?void 0:{backgroundColor:t.color},children:t.name.charAt(0).toUpperCase()})]})})]},t.key)),(0,F.jsx)(je,{side:`left`,label:`Manage accounts`,children:(0,F.jsx)(`button`,{className:`text-muted-foreground hover:bg-foreground/10 hover:text-foreground focus-visible:bg-foreground/10 mt-auto flex aspect-square w-full shrink-0 cursor-pointer items-center justify-center rounded-md transition-colors focus-visible:outline-none`,"aria-label":`Manage accounts`,onClick:()=>{s(!1),I9(C9[e.provider])},children:(0,F.jsx)(k,{icon:Xh,className:`size-4.5`})})})]}),(0,F.jsxs)(`div`,{className:l(`bg-muted/40 flex min-h-0 min-w-0 flex-1 flex-col`,r.length>1&&`border-border/70 border-l`),children:[x&&(0,F.jsx)(`div`,{className:`shrink-0 px-3 pt-2.5`,children:(0,F.jsxs)(`div`,{className:`border-border/70 focus-within:border-ring relative border-b pb-1.5 transition-colors`,children:[(0,F.jsx)(k,{icon:Ah,className:`text-muted-foreground/55 pointer-events-none absolute top-1.5 left-0 size-4`}),(0,F.jsx)(`input`,{ref:h,value:d,placeholder:`Search models...`,className:`placeholder:text-muted-foreground/70 h-6.5 w-full bg-transparent ps-5 text-sm outline-none`,onChange:e=>f(e.target.value),onKeyDown:e=>{if(e.key!==`Enter`||c===null)return;let t=C.at(0);t!==void 0&&(e.preventDefault(),T(c,t),s(!1))}})]})}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 py-1.5`,children:C.length===0?(0,F.jsx)(`p`,{className:`text-muted-foreground p-2 text-center text-sm`,children:v===null?`Loading models…`:`No models found`}):C.map(t=>(0,F.jsx)(`button`,{className:l(`hover:bg-accent hover:text-accent-foreground mb-0.5 flex min-h-8 w-full cursor-pointer flex-col justify-center rounded-sm px-2 py-1.5 text-left`,c===i&&t.value===e.model&&`text-foreground bg-foreground/[0.08]`),onClick:()=>{c!==null&&(T(c,t),s(!1))},children:(0,F.jsxs)(`span`,{className:`truncate text-sm leading-snug font-medium`,children:[t.name,y===`opencode`&&(0,F.jsx)(`span`,{className:`text-muted-foreground ml-2 text-xs font-normal`,children:t.description})]})},t.value))})]})]})]})}function FI(e){let t=Math.min(190,(window.innerWidth-16)/2);return(0,F.jsxs)(mS,{modal:e.options.length>5,children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(`button`,{className:l(jI,MI),title:e.title,children:e.trigger})}),e.options.length>5&&(0,F.jsx)(_S,{className:`w-72`,side:`top`,align:`start`,onCloseAutoFocus:e=>{e.preventDefault(),document.querySelector(`[data-composer]`)?.focus()},children:(0,F.jsx)(bS,{value:e.value,onValueChange:e.onChange,children:e.options.map(e=>(0,F.jsx)(xS,{value:e.value,children:e.label},e.value))})}),e.options.length<=5&&(0,F.jsx)(rb,{children:(0,F.jsxs)(ab,{"data-slot":`dropdown-menu-content`,side:`top`,sideOffset:-28,className:`data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 pointer-events-none relative z-50 origin-(--radix-dropdown-menu-content-transform-origin) drop-shadow-[0_12px_28px_rgb(0_0_0/45%)] duration-100 outline-none`,style:{width:t*2,height:t},onCloseAutoFocus:e=>{e.preventDefault(),document.querySelector(`[data-composer]`)?.focus()},children:[(0,F.jsx)(`div`,{className:`bg-background pointer-events-auto absolute`,style:kI(t,t*.35,t,0,Math.PI).style}),(0,F.jsx)(lb,{value:e.value,onValueChange:e.onChange,children:e.options.map((n,r)=>{let i=kI(t,t*.35,t,Math.PI-(r+1)*Math.PI/e.options.length,Math.PI-r*Math.PI/e.options.length);return(0,F.jsx)(ub,{value:n.value,className:l(`pointer-events-auto absolute cursor-pointer transition-colors outline-none`,n.value===e.value&&`text-foreground bg-[color-mix(in_srgb,var(--primary)_30%,var(--popover))]`,n.value!==e.value&&`bg-popover text-secondary-label data-highlighted:bg-accent data-highlighted:text-accent-foreground`),style:i.style,children:(0,F.jsx)(`span`,{className:`absolute -translate-x-1/2 -translate-y-1/2 text-sm font-medium whitespace-nowrap`,style:i.center,children:n.label})},n.value)})})]})})]})}function II(e){let t=Q(e=>e.selection?.sessionId),n=Q(t=>E9(t,e.machine,e.projectId)),r=Q(e=>e.projects),i=Q(e=>e.machines);return(0,F.jsx)(`div`,{className:`absolute inset-x-0 bottom-full pb-4`,children:(0,F.jsxs)(`h1`,{className:`text-foreground w-full text-center text-2xl font-normal tracking-tight sm:text-3xl`,children:[`What should we build in`,` `,t===null?(0,F.jsxs)(mS,{children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsxs)(`button`,{className:`border-muted-foreground/35 hover:border-foreground/60 inline-flex max-w-64 cursor-pointer border-b border-dotted align-bottom outline-none`,title:n?.path,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:n?.name}),`?`]})}),(0,F.jsx)(_S,{className:`max-h-80 w-64`,onCloseAutoFocus:t=>{t.preventDefault(),e.onCloseMenu()},children:(0,F.jsx)(bS,{value:f9(e.machine,e.projectId),children:i.map(e=>({machine:e,items:r.filter(t=>t.machine===e.id)})).filter(e=>e.items.length>0).map(({machine:e,items:t},n)=>(0,F.jsxs)(P.Fragment,{children:[n>0&&(0,F.jsx)(CS,{}),i.length>1&&(0,F.jsxs)(SS,{className:`text-2xs flex items-center gap-1`,children:[(0,F.jsx)(k,{icon:Wg[e.icon],className:`size-3 shrink-0`}),(0,F.jsx)(`span`,{className:`truncate`,children:e.name})]}),t.map(e=>(0,F.jsxs)(xS,{value:f9(e.machine,e.id),title:e.path,onSelect:()=>BS({machine:e.machine,projectId:e.id,sessionId:null}),children:[(0,F.jsx)(Kg,{machine:e.machine,projectId:e.id,className:`size-4 shrink-0 [&>img]:rounded-[4px] [&>svg]:rounded-[4px]`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]},f9(e.machine,e.id)))]},e.id))})})]}):(0,F.jsx)(`span`,{className:`border-muted-foreground/35 inline-block max-w-64 truncate border-b border-dotted align-bottom`,title:n?.path,children:n?.name}),t!==null&&`?`]})})}function LI(){let e=Q(e=>e.queue);return(0,F.jsx)(`div`,{className:`composer-glass relative mx-auto -mb-[calc(1rem+1px)] w-[calc(100%-2.75rem)] rounded-t-2xl border border-b-0 border-(--composer-outline) px-1 pt-1 pb-[calc(1rem+1px+0.25rem)] text-xs/4`,children:e.map(e=>(0,F.jsxs)(`div`,{className:`grid min-h-6 grid-cols-[1.5rem_minmax(0,1fr)_auto_auto] items-center gap-x-1`,children:[(0,F.jsx)(k,{icon:nh,className:`text-muted-foreground mx-auto size-3`}),(0,F.jsx)(`span`,{className:`text-secondary-label truncate`,children:e.prompt.text===``?`${e.prompt.images.length} image(s)`:e.prompt.text}),(0,F.jsx)(E,{variant:`ghost-muted`,size:`icon-xs`,title:`Send now`,onClick:()=>qS(e.id),children:(0,F.jsx)(k,{icon:bm})}),(0,F.jsx)(E,{variant:`ghost-muted`,size:`icon-xs`,title:`Remove from queue`,onClick:()=>KS(e.id),children:(0,F.jsx)(k,{icon:Me})})]},e.id))})}function RI(e){return(0,F.jsxs)(F.Fragment,{children:[e.running&&e.empty&&(0,F.jsx)(`button`,{className:`bg-destructive/90 shadow-destructive/24 hover:bg-destructive flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full text-white shadow-xs transition-colors`,title:`Stop (Esc)`,"aria-label":`Stop generation`,onClick:e.onStop,children:(0,F.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`currentColor`,"aria-hidden":`true`,children:(0,F.jsx)(`rect`,{x:`2`,y:`2`,width:`8`,height:`8`,rx:`1.5`})})}),!(e.running&&e.empty)&&(0,F.jsx)(`button`,{className:`bg-message-action text-message-action-foreground shadow-message-action/24 hover:bg-message-action-hover disabled:bg-foreground/12 disabled:text-muted-foreground relative flex size-9 items-center justify-center overflow-hidden rounded-full shadow-xs transition-all duration-150 hover:scale-105 enabled:cursor-pointer disabled:pointer-events-none disabled:shadow-none`,title:e.running&&e.delivery===`steer`?`Send now (Enter) · Queue (${r}+Enter)`:e.running?`Queue (Enter) · Send now (${r}+Enter)`:`Send (Enter)`,"aria-label":`Send message`,disabled:e.empty,onClick:t=>e.onSubmit(t.metaKey||t.ctrlKey),children:(0,F.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{d:`M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})})})]})}var zI=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`],BI=5242880,VI=window.matchMedia(`(pointer: coarse)`);function HI(){let e=Q(e=>e.selection),t=Q(e=>e.loaded),n=Q(e=>e.items.length===0&&e.partial===``),i=Q(e=>e.requests),a=Q(e=>e.queue),o=Q(e=>e.draft),s=Q(e=>e.capabilities),c=Q(e=>e.settings.provider===`opencode`?e.machines.find(t=>t.id===e.selection?.machine)?.openCode.available!==!0:e.settings.accountId===null),[u,d]=(0,P.useState)(!1),[f,p]=(0,P.useState)(0),[m,h]=(0,P.useState)(!1),[g,_]=(0,P.useState)([]),v=(0,P.useRef)(null),y=(0,P.useRef)(null),b=e?.machine??``,x=e?.projectId??``,S=Q(e=>E9(e,b,x)),C=Q(e=>T9(e,b).status),w=Q(e=>T9(e,b).config?.delivery??null),T=e===null?``:M9(e),D=Ro(T),O=D.text,A=D.images,j=D.files,[M,N]=(0,P.useState)(O.length),ee=Q(j9),te=t&&n&&!ee,ne=i.at(0);(0,P.useEffect)(()=>{let e=v.current;e===null||VI.matches||(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},[e]),(0,P.useEffect)(()=>{if(o===null)return;let e=sC(o);zo(T,t=>({...t,...e})),N(e.text.length),N9(null),v.current?.focus()},[o,T]),(0,P.useEffect)(()=>{C===`online`&&I(b,`files.list`,{projectId:x}).then(_,R9)},[b,x,C]);let re=O.slice(0,M),ie=/^\/\S*$/.exec(re)?.[0]??/(?:^|\s)(@\S*)$/.exec(re)?.[1]??null,ae=ie?.slice(1).toLowerCase()??``,oe=ie===null||m?[]:ie.startsWith(`/`)?(s?.commands??[]).filter(e=>e.name.toLowerCase().includes(ae)).sort((e,t)=>Number(!e.name.toLowerCase().startsWith(ae))-Number(!t.name.toLowerCase().startsWith(ae))).map(e=>({key:e.name,label:`/${e.name}${e.hint===``?``:` ${e.hint}`}`,description:e.description,insert:`/${e.name}`})):g.filter(e=>e.toLowerCase().includes(ae)).slice(0,50).map(e=>({key:e,label:e,description:``,insert:`@${e}`})),se=Math.min(f,oe.length-1),ce=O.trim()===``&&A.length===0||u||c;function le(e,t){zo(T,t=>({...t,text:e,images:t.images.filter(t=>e.includes(`[Image #${t.number}]`)),files:t.files.filter(t=>e.includes(UI(t)))})),N(t),p(0),h(!1)}function ue(e){if(ie===null)return;let t=M-ie.length,n=t+e.insert.length+1;le(`${O.slice(0,t)}${e.insert} ${O.slice(M)}`,n),requestAnimationFrame(()=>v.current?.setSelectionRange(n,n))}async function de(e){if(!ce){d(!0);try{if(w===null)throw Error(`This machine is not connected`);let t=O.trim();for(let e of j){let n=await Vo(e.id);if(n===void 0)throw Error(`${e.name} is no longer saved, attach it again`);let r=await DS(b,n);t=t.replace(UI(e),()=>`@${r}`)}await GS({text:t,images:A.map(e=>({mediaType:e.mediaType,data:e.data}))},e?w===`queue`?`steer`:`queue`:w),zo(T,e=>({...e,text:``,images:[],files:[]})),N(0)}catch(e){R9(e)}finally{d(!1)}}}async function fe(e){let t=M,n=/(^|\s)$/.test(O.slice(0,M))?``:` `;for(let r of e){if(zI.includes(r.type)&&r.size<=BI){let e=await OS(r),i=oC(Z().items,[Uo(T).text])+1,a={number:i,mediaType:r.type,data:e},o=t,s=`${n}[Image #${i}] `;n=``,zo(T,e=>({...e,text:`${e.text.slice(0,o)}${s}${e.text.slice(o)}`,images:[...e.images,a]})),t+=s.length,N(t),requestAnimationFrame(()=>v.current?.setSelectionRange(t,t));continue}if(r.size>52428800){R9(Error(`${r.name} is larger than 50 MB`));continue}let e=await Bo(r),i={number:Math.max(0,...Uo(T).files.map(e=>e.number))+1,id:e,name:r.name},a=t,o=`${n}${UI(i)} `;n=``,zo(T,e=>({...e,text:`${e.text.slice(0,a)}${o}${e.text.slice(a)}`,files:[...e.files,i]})),t+=o.length,N(t),requestAnimationFrame(()=>v.current?.setSelectionRange(t,t))}}return(0,F.jsx)(`div`,{className:l(`pointer-events-none z-20`,te?`absolute inset-0 flex items-center pb-3 sm:pb-4`:`relative shrink-0 before:absolute before:right-(--app-scrollbar-width) before:bottom-full before:left-0 before:h-8 before:bg-linear-to-t before:from-background before:to-transparent`),children:(0,F.jsxs)(kS,{width:`composer`,className:`pointer-events-auto relative z-10`,children:[te&&(0,F.jsx)(II,{machine:b,projectId:x,onCloseMenu:()=>v.current?.focus()}),a.length>0&&oe.length===0&&(0,F.jsx)(LI,{}),ne!==void 0&&oe.length===0&&(0,F.jsx)(wI,{request:ne,machine:b,cwd:S?.path??``,count:i.length,draft:O},ne.id),oe.length>0&&(0,F.jsx)(cC,{items:oe,active:se,onHover:p,onPick:ue}),(0,F.jsxs)(`div`,{className:l(`composer-glass shadow-composer relative z-10 border border-(--composer-outline) transition-[border-color,box-shadow] duration-150 ease-out focus-within:border-[color-mix(in_srgb,var(--text)_16%,transparent)] focus-within:ring-4 focus-within:ring-[color-mix(in_srgb,var(--text)_4%,transparent)] dark:shadow-none`,te?`rounded-3xl`:`rounded-t-3xl border-b-0`,ne?.kind===`question`&&`hidden`),onMouseDown:e=>{e.target instanceof Element&&e.currentTarget.contains(e.target)&&(e.target.closest(`button, a, input, textarea`)||(e.preventDefault(),v.current?.focus()))},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),fe([...e.dataTransfer.files])},children:[(0,F.jsxs)(`div`,{className:l(`pb-2`,A.length>0&&`pt-3.5 sm:pt-4`),children:[A.length>0&&(0,F.jsx)(aC,{draftKey:T}),(0,F.jsx)(`textarea`,{ref:v,"data-composer":!0,rows:1,spellCheck:!1,autoCorrect:`off`,"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`,"data-lt-active":`false`,value:O,onChange:e=>le(e.target.value,e.target.selectionStart),onSelect:e=>N(e.currentTarget.selectionStart),onPaste:e=>{let t=e.clipboardData.getData(`text/plain`);if(t!==``){e.preventDefault(),document.execCommand(`insertText`,!1,t);return}let n=[...e.clipboardData.files];n.length!==0&&(e.preventDefault(),fe(n))},onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(oe.length>0){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;p((se+t+oe.length)%oe.length);return}if(e.key===`Enter`&&!e.shiftKey||e.key===`Tab`){e.preventDefault(),ue(oe[se]);return}if(e.key===`Escape`){e.preventDefault(),h(!0);return}}if(e.key===`Enter`&&!e.shiftKey&&!VI.matches)e.preventDefault(),de(e.metaKey||e.ctrlKey);else if(e.key===`ArrowUp`&&O===``){let t=WI(Z().items);if(t===null)return;e.preventDefault(),le(t,t.length)}else e.key===`Escape`&&ee&&JS()}},placeholder:c?`Add an account in Settings to start`:ee&&w===`steer`?`Steer the agent… (${r}+Enter to queue)`:ee?`Queue a follow-up… (${r}+Enter to send now)`:`Ask anything, @tag files/folders, or / for commands`,className:l(`placeholder:text-placeholder/75 block [field-sizing:content] w-full resize-none bg-transparent px-3 text-sm leading-relaxed outline-none sm:px-4`,A.length>0?`max-h-52 min-h-19.5`:`max-h-55.5 min-h-20 pt-3.5 sm:max-h-56 sm:pt-4 [@media(min-height:840px)]:min-h-23 sm:[@media(min-height:840px)]:min-h-23.5`)})]}),(0,F.jsxs)(`div`,{className:l(`flex min-w-0 items-center justify-between gap-2 px-3 sm:px-3.5`,te?`pb-2.5 sm:pb-3.5`:`pb-2 sm:pb-3`),children:[(0,F.jsx)(`div`,{className:`-m-1 -ms-3.5 flex min-w-0 flex-1 [scrollbar-width:none] items-center gap-1 overflow-x-auto p-1 ps-3 sm:ps-4`,children:(0,F.jsx)(NI,{})}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2`,children:[(0,F.jsx)(`input`,{ref:y,type:`file`,multiple:!0,hidden:!0,onChange:e=>{fe([...e.target.files??[]]),e.target.value=``}}),u&&j.length>0&&(0,F.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Uploading…`}),(0,F.jsx)(SC,{empty:ce,delivery:w,onSubmit:()=>void de(!0)}),(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,title:`Attach files`,"aria-label":`Attach files`,onClick:()=>y.current?.click(),children:(0,F.jsx)(k,{icon:vh})}),(0,F.jsx)(RI,{running:ee,empty:ce,delivery:w,onSubmit:e=>void de(e),onStop:JS})]})]})]})]})})}function UI(e){return`[File #${e.number}: ${e.name}]`}function WI(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.kind===`user`&&n.parent===null&&n.format===`text`&&n.text!==``)return n.text}return null}var GI=window.matchMedia(`(pointer: coarse)`);function KI(e){let[t,n]=(0,P.useState)(!1),r=XI(e.repo);return(0,F.jsxs)(EI,{open:t,onOpenChange:n,children:[(0,F.jsx)(DI,{asChild:!0,children:(0,F.jsxs)(`button`,{className:`text-muted-foreground hover:text-foreground hidden max-w-48 cursor-pointer items-center gap-1 text-xs sm:flex`,title:`Switch or create a branch`,children:[(0,F.jsx)(k,{icon:r===null?Im:r.icon,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`truncate`,children:e.repo.branch??`detached`})]})}),(0,F.jsx)(OI,{align:`end`,className:`flex max-h-86.5 w-72 flex-col`,children:(0,F.jsx)(JI,{target:e,onClose:()=>n(!1)})})]})}function qI(e){return(0,F.jsx)(Xe,{open:!0,onOpenChange:e.onClose,children:(0,F.jsxs)(Je,{showCloseButton:!1,"aria-describedby":void 0,className:`flex max-h-[min(30rem,calc(100dvh-2rem))] flex-col gap-0 p-0`,onOpenAutoFocus:e=>{GI.matches&&e.preventDefault()},children:[(0,F.jsx)(Ye,{className:`sr-only`,children:`Switch branch`}),(0,F.jsx)(JI,{target:e,onClose:e.onClose})]})})}function JI(e){let t=e.target,n=t.machine,r=t.projectId,i=t.repo.path,a=t.onRefresh,[o,s]=(0,P.useState)(null),[c,u]=(0,P.useState)(null),[d,f]=(0,P.useState)(``),[p,m]=(0,P.useState)(!1),[h,g]=(0,P.useState)(!1),_=XI(t.repo),v=d.trim(),y=(o??[]).filter(e=>e.toLowerCase().includes(v.toLowerCase())),b=(c??[]).filter(e=>e.toLowerCase().includes(v.toLowerCase())),x=(o??[]).includes(v);(0,P.useEffect)(()=>{I(n,`git.localBranches`,{projectId:r,repo:i}).then(s,R9),I(n,`git.fetch`,{projectId:r}).then(a,R9)},[n,r,i,a]);async function S(){g(!0);try{await I(n,`git.sync`,{projectId:r,repo:i}),e.onClose()}catch(e){R9(e)}finally{g(!1),a()}}async function C(t,o){m(!0);try{await I(n,`git.switch`,{projectId:r,repo:i,branch:t,create:o}),e.onClose()}catch(e){R9(e)}finally{m(!1),a()}}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`shrink-0 px-3 pt-2.5`,children:(0,F.jsxs)(`div`,{className:`border-border/70 focus-within:border-ring relative border-b pb-1.5 transition-colors`,children:[(0,F.jsx)(k,{icon:Ah,className:`text-muted-foreground/55 pointer-events-none absolute top-1.5 left-0 size-4`}),(0,F.jsx)(`input`,{value:d,placeholder:`Search or create a branch...`,disabled:p,className:`placeholder:text-muted-foreground/70 h-6.5 w-full bg-transparent ps-5 text-sm outline-none`,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v!==``&&o!==null&&(e.preventDefault(),C(v,!x))}})]})}),_!==null&&(0,F.jsx)(`div`,{className:`border-border/70 shrink-0 border-b px-2 py-1.5`,children:(0,F.jsxs)(`button`,{disabled:h||p,className:`hover:bg-accent hover:text-accent-foreground flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm disabled:cursor-default disabled:opacity-50`,onClick:()=>void S(),children:[(0,F.jsx)(k,{icon:h?Dm:_.icon,className:l(`size-3.5 shrink-0`,h&&`animate-spin`)}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_.label}),(0,F.jsx)(YI,{behind:t.repo.behind,ahead:t.repo.ahead})]})}),(0,F.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 py-1.5`,children:[o===null&&(0,F.jsx)(`p`,{className:`text-muted-foreground p-2 text-center text-sm`,children:`Loading branches…`}),o!==null&&y.length===0&&v===``&&(0,F.jsx)(`p`,{className:`text-muted-foreground p-2 text-center text-sm`,children:`No branches`}),y.map(n=>(0,F.jsxs)(`button`,{disabled:p,className:l(`hover:bg-accent hover:text-accent-foreground mb-0.5 flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm disabled:cursor-default disabled:opacity-50`,n===t.repo.branch&&`text-foreground bg-foreground/[0.08]`),onClick:()=>{n===t.repo.branch?e.onClose():C(n,!1)},children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),n===t.repo.branch&&(0,F.jsx)(k,{icon:Sm,strokeWidth:2.25,className:`size-3.5 shrink-0`})]},n)),c!==null&&b.length>0&&(0,F.jsx)(`p`,{className:`text-muted-foreground px-2 pt-2 pb-1 text-xs font-medium`,children:`Remote`}),b.map(e=>(0,F.jsx)(`button`,{disabled:p,className:`hover:bg-accent hover:text-accent-foreground mb-0.5 flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm disabled:cursor-default disabled:opacity-50`,onClick:()=>void C(e.slice(e.indexOf(`/`)+1),!1),children:(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e})},e)),o!==null&&v!==``&&!x&&(0,F.jsxs)(`button`,{disabled:p,className:`hover:bg-accent hover:text-accent-foreground flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm disabled:cursor-default disabled:opacity-50`,onClick:()=>void C(v,!0),children:[(0,F.jsx)(k,{icon:Ee,className:`size-3.5 shrink-0`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`Create branch `,(0,F.jsx)(`span`,{className:`font-medium`,children:v})]})]})]}),(0,F.jsx)(`div`,{className:`border-border/70 shrink-0 border-t px-2 py-1.5`,children:(0,F.jsxs)(`button`,{className:`text-muted-foreground hover:bg-accent hover:text-accent-foreground flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm`,onClick:()=>{c===null?I(n,`git.remoteBranches`,{projectId:r,repo:i}).then(u,R9):u(null)},children:[(0,F.jsx)(k,{icon:Om,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:c===null?`Show remote branches`:`Hide remote branches`})]})})]})}function YI(e){return(0,F.jsxs)(F.Fragment,{children:[e.behind>0&&(0,F.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[`↓`,e.behind]}),e.ahead>0&&(0,F.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[`↑`,e.ahead]})]})}function XI(e){return e.branch===null||!e.remote?null:e.upstream===null?{icon:km,label:`Publish branch`}:e.behind>0&&e.ahead>0?{icon:hm,label:`Pull and push`}:e.behind>0?{icon:_m,label:`Pull commits`}:e.ahead>0?{icon:bm,label:`Push commits`}:null}var ZI={working:Dm,done:Em,failed:pm},QI=new Set,$I=null,eL=0;function tL(e){$I=e;for(let e of QI)e();e?.state===`done`&&setTimeout(()=>{$I?.id===e.id&&tL(null)},5e3)}function nL(e){return QI.add(e),()=>{QI.delete(e)}}function rL(e,t){eL+=1,tL(`url`in t?{id:eL,state:`done`,label:e,error:``,url:t.url}:{id:eL,state:`failed`,label:e,error:t.error,url:null})}async function iL(e){eL+=1;let t=eL;tL({id:t,state:`working`,label:e.labels.working,error:``,url:null});try{let n=await e.task();$I?.id===t&&tL({id:t,state:`done`,label:e.labels.done,error:``,url:n})}catch(n){$I?.id===t&&tL({id:t,state:`failed`,label:e.labels.failed,error:s(n),url:null})}finally{e.onRefresh()}}function aL(e,t,n,r){iL({labels:r?{working:`Committing and pushing…`,done:`Committed and pushed`,failed:`Commit and push failed`}:{working:`Committing…`,done:`Committed`,failed:`Commit failed`},task:async()=>(await I(e.machine,`git.commit`,{projectId:e.projectId,repo:t,message:n,push:r}),null),onRefresh:e.onRefresh})}function oL(e,t,n){iL({labels:{working:`Creating pull request…`,done:`Pull request created`,failed:`Couldn't create pull request`},task:async()=>(await I(e.machine,`git.createPullRequest`,{projectId:e.projectId,repo:t,base:n.base,head:n.head,title:n.title,body:n.body})).url,onRefresh:e.onRefresh})}function sL(){let e=(0,P.useSyncExternalStore)(nL,()=>$I),[t,n]=(0,P.useState)(!1);return e===null?null:(0,F.jsxs)(`div`,{className:`bg-popover text-popover-foreground flex max-w-80 items-center gap-3 rounded-md border py-2 pr-2 pl-3 shadow-md`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,F.jsx)(k,{icon:ZI[e.state],className:l(`size-4 shrink-0`,e.state===`working`&&`animate-spin`,e.state===`done`&&`text-success`,e.state===`failed`&&`text-destructive`)}),(0,F.jsx)(`span`,{className:`truncate`,children:e.label})]}),e.url!==null&&(0,F.jsx)(E,{asChild:!0,size:`xs`,variant:`outline`,children:(0,F.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open`})}),e.state===`failed`&&(0,F.jsx)(E,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>n(!0),children:`View`}),(0,F.jsx)(E,{type:`button`,size:`icon-micro`,variant:`ghost-muted`,"aria-label":`Dismiss`,onClick:()=>{n(!1),tL(null)},children:(0,F.jsx)(k,{icon:Me,className:`size-3.5`})}),(0,F.jsx)(Xe,{open:t&&e.state===`failed`,onOpenChange:n,children:(0,F.jsxs)(Je,{className:`sm:max-w-lg`,children:[(0,F.jsx)(Ke,{children:(0,F.jsx)(Ye,{children:e.label})}),(0,F.jsx)(`pre`,{className:`bg-muted/50 max-h-[60vh] overflow-y-auto rounded-lg border p-3 font-mono text-xs break-words whitespace-pre-wrap`,children:e.error})]})})]})}function cL({className:e,type:t,...n}){return(0,F.jsx)(`input`,{type:t,"data-slot":`input`,className:l(`h-9 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-[color,background-color,border-color,box-shadow] duration-200 ease-out outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/33 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function lL({...e}){return(0,F.jsx)(lx,{"data-slot":`select`,...e})}function uL({...e}){return(0,F.jsx)(px,{"data-slot":`select-value`,...e})}function dL({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(dx,{"data-slot":`select-trigger`,"data-size":t,className:l(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-[color,background-color,border-color,box-shadow] duration-200 ease-out outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/33 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,F.jsx)(mx,{asChild:!0,children:(0,F.jsx)(k,{icon:Jh,className:`text-muted-foreground pointer-events-none size-4`})})]})}function fL({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,F.jsx)(_x,{children:(0,F.jsxs)(yx,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:l(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,F.jsx)(mL,{}),(0,F.jsx)(jx,{"data-position":n,className:l(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,F.jsx)(hL,{})]})})}function pL({className:e,children:t,...n}){return(0,F.jsxs)(Fx,{"data-slot":`select-item`,className:l(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,F.jsx)(zx,{children:(0,F.jsx)(k,{icon:Sm,className:`pointer-events-none`})})}),(0,F.jsx)(Lx,{children:t})]})}function mL({className:e,...t}){return(0,F.jsx)(Vx,{"data-slot":`select-scroll-up-button`,className:l(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,F.jsx)(k,{icon:ane})})}function hL({className:e,...t}){return(0,F.jsx)(Ux,{"data-slot":`select-scroll-down-button`,className:l(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,F.jsx)(k,{icon:Cm})})}function gL(e){return e.target?.kind===`failed`?(0,F.jsx)(`span`,{className:`text-destructive truncate text-xs`,children:e.target.text}):(0,F.jsxs)(`span`,{className:`text-muted-foreground flex min-w-0 items-center gap-1.5 text-xs`,children:[(0,F.jsxs)(`span`,{className:`truncate`,children:[e.head,` →`]}),(0,F.jsxs)(lL,{value:e.target?.base??``,disabled:e.target===void 0,onValueChange:e.onBase,children:[(0,F.jsx)(dL,{size:`sm`,className:`max-w-48`,children:(0,F.jsx)(uL,{placeholder:`Loading branches…`})}),(0,F.jsx)(fL,{children:(e.target?.branches??[]).map(e=>(0,F.jsx)(pL,{value:e,children:e},e))})]})]})}function _L(e){return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 ps-6`,children:[(0,F.jsxs)(`span`,{className:`text-muted-foreground truncate text-xs`,children:[e.draft.head,` → `,e.draft.base]}),(0,F.jsx)(cL,{value:e.draft.title,onChange:t=>e.onChange({...e.draft,title:t.target.value})}),(0,F.jsx)(`textarea`,{value:e.draft.body,onChange:t=>e.onChange({...e.draft,body:t.target.value}),rows:8,className:`bg-background focus-visible:border-ring focus-visible:ring-ring/33 w-full resize-y rounded-lg border px-3 py-2 font-mono text-xs transition-[border-color,box-shadow] duration-200 ease-out outline-none focus-visible:ring-3`}),(0,F.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[e.onSkip!==null&&(0,F.jsx)(E,{variant:`ghost`,size:`sm`,onClick:e.onSkip,children:`Skip`}),(0,F.jsx)(E,{variant:`outline`,size:`sm`,onClick:e.onRegenerate,children:`Regenerate`}),(0,F.jsx)(E,{size:`sm`,disabled:e.draft.title.trim()===``,onClick:e.onCreate,children:`Create PR`})]})]})}var vL={working:Dm,review:sne,done:Em,failed:pm,skipped:dh};function yL(e){let t=Q(t=>E9(t,e.machine,e.projectId)?.name)??``,[n]=(0,P.useState)(()=>bL(e.repos,e.action)),[r,i]=(0,P.useState)(()=>n.map(e=>e.path)),[a,o]=(0,P.useState)(``),[c,u]=(0,P.useState)({}),[d,f]=(0,P.useState)(null),p=n.filter(e=>r.includes(e.path)&&c[e.path]?.kind!==`failed`),m=e.action===`pullRequest`&&p.some(e=>c[e.path]===void 0),h=p.filter(e=>e.changed>0);(0,P.useEffect)(()=>{if(e.action===`pullRequest`)for(let t of n)I(e.machine,`git.branches`,{projectId:e.projectId,repo:t.path}).then(e=>u(n=>({...n,[t.path]:{kind:`ready`,...e}})),e=>u(n=>({...n,[t.path]:{kind:`failed`,text:s(e)}})))},[e.machine,e.projectId,e.action,n]);function g(e,t){f(n=>n?.map(n=>n.path===e?{...n,...t}:n)??null)}async function _(t,r){try{await r()}catch(r){if(n.length===1){e.onClose(),rL(`Pull request failed`,{error:s(r)});return}g(t,{state:`failed`,text:s(r),draft:null})}finally{e.onRefresh()}}function v(e,t){u(n=>{let r=n[e];return r?.kind===`ready`?{...n,[e]:{...r,base:t}}:n})}function y(e,t){f(p.map(t=>({path:t.path,state:`working`,text:e,url:null,draft:null})));for(let e of p)_(e.path,()=>t(e.path))}function b(t){if(n.length===1){e.onClose(),aL(e,n[0].path,a,t);return}let r=t?`Committed and pushed`:`Committed`;y(t?`Committing and pushing…`:`Committing…`,async n=>{await I(e.machine,`git.commit`,{projectId:e.projectId,repo:n,message:a,push:t}),g(n,{state:`done`,text:r})})}function x(){y(`Pushing…`,async t=>{await I(e.machine,`git.push`,{projectId:e.projectId,repo:t}),g(t,{state:`done`,text:`Pushed`})})}async function S(t,r,i){g(t,{state:`working`,text:r?`Committing local changes and writing pull request…`:`Writing pull request…`,draft:null});let a=await I(e.machine,`git.pullRequest`,{projectId:e.projectId,repo:t,base:i,commit:r});if(a.kind===`open`){if(n.length===1){e.onClose(),rL(`Pull request already open`,{url:a.url});return}g(t,{state:`done`,text:`A pull request is already open`,url:a.url})}else g(t,{state:`review`,text:`Review and create`,draft:{base:a.base,head:a.head,title:a.title,body:a.body}})}function C(e){y(`Starting…`,async t=>{let n=c[t];if(n?.kind!==`ready`)throw Error(`The branches are not loaded`);await S(t,e&&h.some(e=>e.path===t),n.base)})}function w(t,r){n.length===1?(e.onClose(),oL(e,t,r)):_(t,async()=>{g(t,{state:`working`,text:`Creating pull request…`,draft:null}),g(t,{state:`done`,text:`Created pull request`,url:(await I(e.machine,`git.createPullRequest`,{projectId:e.projectId,repo:t,base:r.base,head:r.head,title:r.title,body:r.body})).url})})}return(0,F.jsx)(Xe,{open:!0,onOpenChange:()=>e.onClose(),children:(0,F.jsxs)(Je,{className:`top-[12vh] translate-y-0 sm:max-w-lg`,children:[(0,F.jsxs)(Ke,{children:[(0,F.jsxs)(Ye,{children:[e.action===`commit`&&`Commit changes`,e.action===`push`&&`Push`,e.action===`pullRequest`&&`Create pull request`]}),(0,F.jsxs)(He,{children:[e.action===`commit`&&(n.length===1?`Stages every change and commits it.`:`Stages every change in the selected repositories and commits it.`),e.action===`push`&&`Pushes the selected repositories to their remote.`,e.action===`pullRequest`&&`AI writes the title and description. You review them before the pull request is created.`]})]}),d===null&&(0,F.jsxs)(F.Fragment,{children:[n.length===1&&(0,F.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 text-xs`,children:[e.action===`pullRequest`?(0,F.jsx)(gL,{head:n[0].branch??`detached`,target:c[n[0].path],onBase:e=>v(n[0].path,e)}):n[0].branch??`detached`,(0,F.jsxs)(`span`,{className:`shrink-0`,children:[`· `,n[0].changed,` `,n[0].changed===1?`change`:`changes`]})]}),n.length>1&&(0,F.jsx)(`div`,{className:`flex max-h-60 flex-col gap-0.5 overflow-y-auto`,children:n.map(n=>(0,F.jsxs)(`label`,{className:`hover:bg-accent flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5`,children:[(0,F.jsx)(`input`,{type:`checkbox`,disabled:c[n.path]?.kind===`failed`,checked:r.includes(n.path)&&c[n.path]?.kind!==`failed`,onChange:e=>i(e.target.checked?[...r,n.path]:r.filter(e=>e!==n.path))}),(0,F.jsx)(`span`,{className:`truncate font-medium`,children:xL(n.path,t)}),e.action===`pullRequest`?(0,F.jsx)(gL,{head:n.branch??`detached`,target:c[n.path],onBase:e=>v(n.path,e)}):(0,F.jsx)(`span`,{className:`text-muted-foreground truncate text-xs`,children:n.branch??`detached`}),(0,F.jsx)(`span`,{className:`text-muted-foreground ml-auto shrink-0 text-xs tabular-nums`,children:e.action===`push`?n.upstream===null?`not pushed yet`:`↑${n.ahead}`:n.changed>0&&`${n.changed} ${n.changed===1?`change`:`changes`}`})]},n.path))}),e.action===`commit`&&(0,F.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),placeholder:`Leave empty to write the message with AI`,rows:5,className:`bg-background focus-visible:border-ring focus-visible:ring-ring/33 w-full resize-none rounded-lg border px-3 py-2 font-mono text-xs transition-[border-color,box-shadow] duration-200 ease-out outline-none focus-visible:ring-3`}),e.action===`pullRequest`&&h.length>0&&(0,F.jsxs)(`p`,{children:[`You have local changes`,n.length>1&&` in ${h.map(e=>xL(e.path,t)).join(`, `)}`,`. Do you want to commit and push them before creating the pull request?`]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[e.action===`commit`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(E,{variant:`outline`,size:`sm`,disabled:p.length===0,onClick:()=>b(!1),children:`Commit`}),(0,F.jsx)(E,{size:`sm`,disabled:p.length===0,onClick:()=>b(!0),children:`Commit and Push`})]}),e.action===`push`&&(0,F.jsx)(E,{size:`sm`,disabled:p.length===0,onClick:x,children:`Push`}),e.action===`pullRequest`&&h.length>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(E,{variant:`outline`,size:`sm`,disabled:m,onClick:()=>C(!1),children:`Continue without them`}),(0,F.jsx)(E,{size:`sm`,disabled:m,onClick:()=>C(!0),children:`Commit and continue`})]}),e.action===`pullRequest`&&h.length===0&&(0,F.jsx)(E,{size:`sm`,disabled:m||p.length===0,onClick:()=>C(!1),children:`Create pull request`})]})]}),d!==null&&(0,F.jsx)(`div`,{className:`flex max-h-[60vh] flex-col gap-2 overflow-y-auto`,children:d.map(e=>{let r=e.draft;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(`span`,{className:`mt-0.5 flex size-4 shrink-0 overflow-hidden`,children:(0,F.jsx)(k,{icon:vL[e.state],className:l(`size-4`,e.state===`working`&&`animate-spin`,e.state===`review`&&`text-info`,e.state===`done`&&`text-success`,e.state===`failed`&&`text-destructive`,e.state===`skipped`&&`text-muted-foreground`)})}),(0,F.jsx)(`span`,{className:`shrink-0 font-medium`,children:xL(e.path,t)}),(0,F.jsxs)(`span`,{className:l(`min-w-0 text-xs leading-5 break-words whitespace-pre-wrap`,e.state===`failed`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.url!==null&&(0,F.jsxs)(F.Fragment,{children:[` `,(0,F.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline hover:underline-offset-2`,children:e.url})]})]})]}),e.state===`review`&&r!==null&&(0,F.jsx)(_L,{draft:r,onChange:t=>g(e.path,{draft:t}),onSkip:n.length===1?null:()=>g(e.path,{state:`skipped`,text:`Skipped`,draft:null}),onRegenerate:()=>void _(e.path,()=>S(e.path,!1,r.base)),onCreate:()=>w(e.path,r)})]},e.path)})})]})})}function bL(e,t){if(t===`commit`)return e.filter(e=>e.changed>0);if(t===`push`)return e.filter(e=>e.branch!==null&&(e.upstream===null||e.ahead>0));if(t===`pullRequest`)return e.filter(e=>e.branch!==null);throw Error(`Unknown git action ${String(t)}`)}function xL(e,t){return e===``?t:e}var SL=3e3,CL=18e4;function wL(e,t,n){let[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(0);(0,P.useEffect)(()=>{if(t===null)return;let n=f9(e,t),r={projectId:t},a=!0,o=!1,s=!1;async function c(){if(!o){o=!0;try{let t=await I(e,`git.status`,r);if(!a)return;s=!1,i(e=>e!==null&&e.key===n&&ho(e.repos,t)?e:{key:n,repos:t})}catch(e){a&&!s&&(s=!0,R9(e))}finally{o=!1}}}function l(){document.hidden||c()}c();let u=window.setInterval(l,SL);return window.addEventListener(`focus`,l),()=>{a=!1,window.clearInterval(u),window.removeEventListener(`focus`,l)}},[e,t,n,a]),(0,P.useEffect)(()=>{if(t===null)return;let n={projectId:t},r=!0,i=!1;async function a(){if(!document.hidden)try{await I(e,`git.fetch`,n),r&&(i=!1,o(e=>e+1))}catch(e){r&&!i&&(i=!0,R9(e))}}a();let s=window.setInterval(a,CL);return()=>{r=!1,window.clearInterval(s)}},[e,t]);let s=(0,P.useCallback)(()=>o(e=>e+1),[]);return{repos:r!==null&&t!==null&&r.key===f9(e,t)?r.repos:[],refresh:s}}function TL(e){let[t,n]=(0,P.useState)(null),[r,i]=(0,P.useState)(!1),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),l=bL(e.repos,`push`),u=bL(e.repos,`commit`);function d(t){iL({labels:{working:`Pushing…`,done:`Pushed`,failed:`Push failed`},task:async()=>(await I(e.machine,`git.push`,{projectId:e.projectId,repo:t}),null),onRefresh:e.onRefresh})}async function f(){if(u.length===1)i(!1),aL(e,u[0].path,``,!1);else{c(!0);try{for(let t of u)await I(e.machine,`git.commit`,{projectId:e.projectId,repo:t.path,message:``,push:!1});i(!1)}catch(e){R9(e)}finally{c(!1),e.onRefresh()}}}return{target:e,action:t,setAction:n,menuOpen:r,setMenuOpen:i,branchRepo:a,setBranchRepo:o,committing:s,pushable:l,committable:u,push:d,yoloCommit:f}}function EL(e){let t=e.git,n=t.target.repos,r=n.reduce((e,t)=>e+t.ahead,0);return(0,F.jsxs)(F.Fragment,{children:[e.collapsed&&n.map(e=>(0,F.jsxs)(vS,{onSelect:()=>t.setBranchRepo(e.path),children:[(0,F.jsx)(k,{icon:Im}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path===``?e.branch??`detached`:`${e.path}: ${e.branch??`detached`}`}),(0,F.jsx)(`span`,{className:`text-muted-foreground flex gap-1 text-xs`,children:(0,F.jsx)(YI,{behind:e.behind,ahead:e.ahead})})]},e.path)),e.collapsed&&(0,F.jsx)(CS,{}),e.collapsed&&(0,F.jsxs)(vS,{disabled:t.committable.length===0,onSelect:()=>t.setAction(`commit`),children:[(0,F.jsx)(k,{icon:Lm}),`Commit…`]}),(0,F.jsxs)(vS,{disabled:t.pushable.length===0||t.committing,onSelect:()=>{t.pushable.length===1?t.push(t.pushable[0].path):t.setAction(`push`)},children:[(0,F.jsx)(k,{icon:km}),t.pushable.length>1?`Just Push…`:`Just Push`,r>0&&(0,F.jsxs)(`span`,{className:`text-muted-foreground ml-auto text-xs tabular-nums`,children:[`↑`,r]})]}),(0,F.jsxs)(vS,{disabled:t.committable.length===0||t.committing,onSelect:e=>{e.preventDefault(),t.yoloCommit()},children:[(0,F.jsx)(k,{icon:t.committing?Dm:Lm,className:l(t.committing&&`animate-spin`)}),t.committing?`Committing…`:`Yolo Commit`]}),(0,F.jsx)(CS,{}),(0,F.jsxs)(vS,{disabled:bL(n,`pullRequest`).length===0,onSelect:()=>t.setAction(`pullRequest`),children:[(0,F.jsx)(k,{icon:Bm}),`Create pull request…`]})]})}function DL(e){let t=e.git,n=t.target.repos.find(e=>e.path===t.branchRepo);return(0,F.jsxs)(F.Fragment,{children:[t.action!==null&&(0,F.jsx)(yL,{machine:t.target.machine,projectId:t.target.projectId,action:t.action,repos:t.target.repos,onClose:()=>t.setAction(null),onRefresh:t.target.onRefresh}),t.branchRepo!==null&&n!==void 0&&(0,F.jsx)(qI,{machine:t.target.machine,projectId:t.target.projectId,repo:n,onRefresh:t.target.onRefresh,onClose:()=>t.setBranchRepo(null)})]})}function OL(e){let t=TL(e),[n,r]=(0,P.useState)(!1),i=[...new Set(e.repos.map(e=>e.branch??`detached`))],a=e.repos.flatMap(e=>{let t=XI(e);return t===null?[]:[{repo:e,next:t}]}),o=e.repos.map(e=>e.path===``?e.branch??`detached`:`${e.path}: ${e.branch??`detached`}`).join(`
105
- `),s=i.length===1?i[0]:`${i.length} branches`;async function c(t){r(!0);try{await I(e.machine,`git.sync`,{projectId:e.projectId,repo:t})}catch(e){R9(e)}finally{r(!1),e.onRefresh()}}return(0,F.jsxs)(F.Fragment,{children:[e.repos.length===1&&(0,F.jsx)(KI,{machine:e.machine,projectId:e.projectId,repo:e.repos[0],onRefresh:e.onRefresh}),e.repos.length>1&&a.length===0&&(0,F.jsxs)(`span`,{className:`text-muted-foreground hidden max-w-48 items-center gap-1 text-xs sm:flex`,title:o,children:[(0,F.jsx)(k,{icon:Im,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`truncate`,children:s})]}),e.repos.length>1&&a.length>0&&(0,F.jsxs)(mS,{children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsxs)(`button`,{className:`text-muted-foreground hover:text-foreground hidden max-w-48 cursor-pointer items-center gap-1 text-xs sm:flex`,title:o,children:[(0,F.jsx)(k,{icon:n?Dm:a.length===1?a[0].next.icon:hm,className:l(`size-3.5 shrink-0`,n&&`animate-spin`)}),(0,F.jsx)(`span`,{className:`truncate`,children:s})]})}),(0,F.jsx)(_S,{align:`end`,className:`w-64`,children:a.map(e=>(0,F.jsxs)(vS,{disabled:n,onSelect:()=>void c(e.repo.path),children:[(0,F.jsx)(k,{icon:e.next.icon}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.next.label,` ·`,` `,e.repo.path===``?e.repo.branch:e.repo.path]}),(0,F.jsx)(`span`,{className:`text-muted-foreground flex gap-1 text-xs`,children:(0,F.jsx)(YI,{behind:e.repo.behind,ahead:e.repo.ahead})})]},e.repo.path))})]}),(0,F.jsxs)(`div`,{className:`ml-2.5 flex w-fit`,children:[(0,F.jsxs)(E,{variant:`outline`,size:`xs`,className:`rounded-e-none border-e-0`,disabled:t.committable.length===0,onClick:()=>t.setAction(`commit`),children:[(0,F.jsx)(k,{icon:Lm}),(0,F.jsx)(`span`,{className:`hidden sm:inline`,children:`Commit`})]}),(0,F.jsxs)(mS,{open:t.menuOpen,onOpenChange:t.setMenuOpen,children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(E,{variant:`outline`,size:`icon-xs`,className:`rounded-s-none`,"aria-label":`Git actions`,children:(0,F.jsx)(k,{icon:t.committing?Dm:Cm,className:l(`size-4`,t.committing&&`animate-spin`)})})}),(0,F.jsx)(_S,{align:`end`,className:`w-56`,children:(0,F.jsx)(EL,{git:t,collapsed:!1})})]})]}),(0,F.jsx)(DL,{git:t})]})}function kL({...e}){return(0,F.jsx)(b_,{"data-slot":`alert-dialog`,...e})}function AL({...e}){return(0,F.jsx)(x_,{"data-slot":`alert-dialog-trigger`,...e})}function jL({...e}){return(0,F.jsx)(S_,{"data-slot":`alert-dialog-portal`,...e})}function ML({className:e,...t}){return(0,F.jsx)(C_,{"data-slot":`alert-dialog-overlay`,className:l(`fixed inset-0 z-50 bg-background/80 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function NL({className:e,size:t=`default`,...n}){return(0,F.jsxs)(jL,{children:[(0,F.jsx)(ML,{}),(0,F.jsx)(E_,{"data-slot":`alert-dialog-content`,"data-size":t,className:l(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-background p-4 text-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function PL({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:l(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function FL({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:l(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function IL({className:e,...t}){return(0,F.jsx)(D_,{"data-slot":`alert-dialog-title`,className:l(`text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function LL({className:e,...t}){return(0,F.jsx)(O_,{"data-slot":`alert-dialog-description`,className:l(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function RL({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,F.jsx)(E,{variant:t,size:n,asChild:!0,children:(0,F.jsx)(k_,{"data-slot":`alert-dialog-action`,className:l(e),...r})})}function zL({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,F.jsx)(E,{variant:t,size:n,asChild:!0,children:(0,F.jsx)(j_,{"data-slot":`alert-dialog-cancel`,className:l(e),...r})})}function BL({className:e,size:t=`default`,...n}){return(0,F.jsx)(sS,{"data-slot":`switch`,"data-size":t,className:l(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,F.jsx)(lS,{"data-slot":`switch-thumb`,className:`bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0`})})}var VL=Qp({theme:Vp().refine(e=>WP.some(t=>t.id===e)).default(WP[0].id),terminal:Qp({font:Qp({family:Vp().default(`FiraCode Nerd Font`),size:Gp().default(14),lineHeight:Gp().default(1.35),ligatures:qp().default(!0)}).prefault({}),cursor:Qp({style:tm([`block`,`bar`,`underline`]).default(`bar`),blink:qp().default(!0)}).prefault({}),padding:Qp({top:Gp().default(4),right:Gp().default(4),bottom:Gp().default(0),left:Gp().default(4)}).prefault({}),scrollback:Gp().default(1e3),boldIsBright:qp().default(!0),behavior:Qp({modernizeShiftEnter:qp().default(!0),pasteBrowserImages:qp().default(!0),captureShortcuts:qp().default(!0),bellFlash:qp().default(!0),bellSound:qp().default(!0),clickToMoveCursor:qp().default(!0),optionAsMeta:tm([`off`,`left`,`right`,`both`]).default(`off`),confirmCloseBusyTab:qp().default(!0)}).prefault({})}).prefault({}),editor:Qp({font:Qp({family:Vp().default(`FiraCode Nerd Font`),size:Gp().default(15.3),lineHeight:Gp().default(1.8),ligatures:qp().default(!0),features:Vp().default(`'zero', 'ss02', 'ss06', 'cv02', 'cv14', 'cv26'`)}).prefault({}),cursor:Qp({style:tm([`block`,`bar`,`underline`]).default(`bar`),blink:qp().default(!0)}).prefault({}),tabSize:Gp().default(2),wordWrap:qp().default(!0)}).prefault({}),diff:Qp({split:qp().default(!1),wrap:qp().default(!0),collapsed:qp().default(!1)}).prefault({}),rewind:tm([`all`,`chat`,`code`]).default(`chat`)}),HL=`prefs`,UL=VL.parse({});function WL(){let e=localStorage.getItem(HL);if(e===null)return structuredClone(UL);let t=VL.safeParse(JSON.parse(e));return t.success?t.data:(console.warn(`invalid stored prefs, using the defaults:\n${$s(t.error)}`),structuredClone(UL))}function GL(e){localStorage.setItem(HL,JSON.stringify(e))}var KL=`3.6.8`,qL=`1.3.1`,JL=[{family:`FiraCode Nerd Font`,label:`Fira Code`},{family:`JetBrainsMono Nerd Font`,label:`JetBrains Mono`},{family:`CaskaydiaCove Nerd Font`,label:`Cascadia Code`},{family:`Hack Nerd Font`,label:`Hack`}],YL=[{value:`macos`,label:`macOS`},{value:`linux`,label:`Linux`},{value:`windows`,label:`Windows`}];async function XL(e){let t=`${e.font.size}px ${e.font.family}`;await Promise.all([document.fonts.load(t),document.fonts.load(`bold ${t}`)]);let n=document.documentElement.style;n.setProperty(`--pad-top`,`${e.padding.top}px`),n.setProperty(`--pad-right`,`${e.padding.right}px`),n.setProperty(`--pad-bottom`,`${e.padding.bottom}px`),n.setProperty(`--pad-left`,`${e.padding.left}px`)}function ZL(e,t){let n=GP();return{fontFamily:e.font.family,fontSize:e.font.size,lineHeight:e.font.lineHeight,ligatures:e.font.ligatures,cursorStyle:e.cursor.style,cursorBlink:e.cursor.blink,scrollback:e.scrollback,boldIsBright:e.boldIsBright,colors:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorText:n.background,selectionBackground:n.selectionBackground,selectionForeground:n.foreground,palette:n.palette},version:QL(t),clickToMoveCursor:e.behavior.clickToMoveCursor,optionAsMeta:e.behavior.optionAsMeta}}function QL(e){if(e===`offsite`)return`offsite 0.0.0`;if(e===`ghostty`)return`ghostty ${qL}`;if(e===`iterm2`)return`iTerm2 ${KL}`;throw Error(`unknown terminal identity ${e}`)}function $L(e){return(0,F.jsxs)(`section`,{children:[(0,F.jsxs)(`h2`,{className:`text-muted-foreground mb-2 px-1 text-xs font-medium`,children:[e.title,e.note&&(0,F.jsxs)(`span`,{className:`font-normal`,children:[` · `,e.note]})]}),(0,F.jsx)(`div`,{className:`@container divide-y overflow-hidden rounded-xl border`,children:e.children})]})}function J(e){return(0,F.jsxs)(`label`,{className:`flex min-h-13 flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2.5`,children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 text-sm font-medium`,children:e.label}),(0,F.jsx)(`div`,{className:`max-w-full shrink-0 @max-lg:has-[[data-slot=select-trigger],input:not([type=number])]:w-full @max-lg:has-[[data-slot=select-trigger],input:not([type=number])]:*:w-full @max-lg:**:data-[slot=select-trigger]:w-full`,children:e.children})]})}function eR(e){let[t,n]=(0,P.useState)(e.value);function r(){t!==e.value&&(e.valid&&!e.valid(t)?n(e.value):e.onCommit(t))}return(0,F.jsx)(cL,{className:l(`w-56`,e.className),type:e.type,min:e.type===`number`?0:void 0,step:e.step,placeholder:e.placeholder,disabled:e.disabled,value:t,onChange:e=>n(e.target.value),onBlur:r,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}})}function tR(e){return(0,F.jsx)(eR,{type:`number`,className:`w-24`,step:e.step??1,value:String(e.value),valid:e=>e!==``&&Number(e)>=0,onCommit:t=>e.onCommit(Number(t))},e.value)}function nR(e){let t=e.prefs.editor,[n,r]=(0,P.useState)(!JL.some(e=>e.family===t.font.family));function i(t){L9({...e.prefs,editor:t})}function a(e,n){i({...t,[e]:{...t[e],...n}})}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)($L,{title:`Font`,children:[(0,F.jsx)(J,{label:`Family`,children:(0,F.jsxs)(lL,{value:n?`custom`:t.font.family,onValueChange:e=>{r(e===`custom`),e!==`custom`&&a(`font`,{family:e})},children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[JL.map(e=>(0,F.jsx)(pL,{value:e.family,children:e.label},e.family)),(0,F.jsx)(pL,{value:`custom`,children:`Custom`})]})]})}),n&&(0,F.jsx)(J,{label:`Custom family`,children:(0,F.jsx)(eR,{placeholder:`Installed font name`,value:t.font.family,onCommit:e=>a(`font`,{family:e})})}),(0,F.jsx)(J,{label:`Size`,children:(0,F.jsx)(tR,{value:t.font.size,step:.5,onCommit:e=>a(`font`,{size:e})})}),(0,F.jsx)(J,{label:`Line height`,children:(0,F.jsx)(tR,{value:t.font.lineHeight,step:.05,onCommit:e=>a(`font`,{lineHeight:e})})}),(0,F.jsx)(J,{label:`Ligatures`,children:(0,F.jsx)(BL,{checked:t.font.ligatures,onCheckedChange:e=>a(`font`,{ligatures:e})})}),(0,F.jsx)(J,{label:`Font features`,children:(0,F.jsx)(eR,{placeholder:`'ss01', 'zero'`,value:t.font.features,onCommit:e=>a(`font`,{features:e})})})]}),(0,F.jsxs)($L,{title:`Cursor`,children:[(0,F.jsx)(J,{label:`Style`,children:(0,F.jsxs)(lL,{value:t.cursor.style,onValueChange:e=>a(`cursor`,{style:e}),children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[(0,F.jsx)(pL,{value:`block`,children:`Block`}),(0,F.jsx)(pL,{value:`bar`,children:`Bar`}),(0,F.jsx)(pL,{value:`underline`,children:`Underline`})]})]})}),(0,F.jsx)(J,{label:`Blink`,children:(0,F.jsx)(BL,{checked:t.cursor.blink,onCheckedChange:e=>a(`cursor`,{blink:e})})})]}),(0,F.jsxs)($L,{title:`Text`,children:[(0,F.jsx)(J,{label:`Tab size`,children:(0,F.jsx)(tR,{value:t.tabSize,onCommit:e=>i({...t,tabSize:e})})}),(0,F.jsx)(J,{label:`Word wrap`,children:(0,F.jsx)(BL,{checked:t.wordWrap,onCheckedChange:e=>i({...t,wordWrap:e})})})]})]})}function rR(e){let t=e.prefs;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)($L,{title:`Appearance`,children:(0,F.jsx)(J,{label:`Theme`,children:(0,F.jsxs)(lL,{value:t.theme,onValueChange:e=>L9({...t,theme:e}),children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsx)(fL,{children:WP.map(e=>(0,F.jsx)(pL,{value:e.id,children:e.name},e.id))})]})})}),(0,F.jsx)(iR,{}),(0,F.jsx)(E,{variant:`outline`,onClick:e.onRestore,children:`Restore browser defaults`})]})}function iR(){let[e,t]=(0,P.useState)(`idle`),[n,r]=(0,P.useState)(null);async function i(){t(`checking`),r(null);try{let e=`serviceWorker`in navigator?await navigator.serviceWorker.getRegistration():void 0;if(e===void 0){location.reload();return}await e.update(),t(e.installing===null&&e.waiting===null?`current`:`updating`)}catch(e){console.error(`could not check for updates`,e),r(s(e)),t(`idle`)}}return(0,F.jsx)($L,{title:`App`,children:(0,F.jsx)(J,{label:`Load the newest version of OffSite in this browser`,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[n!==null&&(0,F.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Could not check: `,n]}),e===`current`&&(0,F.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Up to date`}),e===`updating`&&(0,F.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Updating, the page reloads when it's ready`}),(0,F.jsx)(E,{size:`sm`,variant:`outline`,disabled:e===`checking`||e===`updating`,onClick:()=>void i(),children:`Check for updates`})]})})})}function aR(e){for(let t=0;t<e.length;t++){let n=e[t];if(!n.startsWith(`-`)&&!n.startsWith(`+`))return!1;let r=n.startsWith(`-`),i=n.slice(1);if(i===``||i===`-`)return!1;if(i.startsWith(`-`)){if(!oR(i.slice(1),r))return!1}else for(let n=0;n<i.length;n++){let a=i[n];if(a===`o`){let a=i.slice(n+1);if(a===``){if(t++,t===e.length)return!1;a=e[t]}if(!oR(a,r))return!1;break}if(a===`b`||a===`c`||r&&`dfnprvx`.includes(a)||!r&&a===`i`)return!1}}return!0}function oR(e,t){let n=e.toLowerCase().replace(/[-_]/g,``),r=t;return n.startsWith(`no`)&&(n=n.slice(2),r=!t),[`rcs`,`globalrcs`,`interactive`,`exec`].includes(n)?r:![`privileged`,`restricted`,`sourcetrace`,`verbose`,`xtrace`].includes(n)||!r}function sR(e,t,n){if(t===`windows`)return`Not available on Windows`;if(e!==null&&/[\n"'\\$`;&|<>()*?[\]{}#!]/.test(e))return`Not available for commands with shell syntax`;let r=e===null?[n]:e.split(/[ \t]/).filter(e=>e!==``);if(r.length===0)return`Available for bash, zsh and fish`;let i=r[0],a=i.split(`/`).pop(),o=r.slice(1);return a===`bash`?t===`macos`&&(i===`/bin/bash`||!i.includes(`/`))?`Needs a newer bash than the one macOS includes`:o.every(e=>[`-l`,`--login`,`-i`].includes(e))?null:`Not available with these bash options`:a===`zsh`?aR(o)?null:`Not available with these zsh options`:a===`fish`?o.every(e=>{if(e.startsWith(`--`)){let t=e.slice(2).split(`=`)[0];return t===``||![`command`,`no-config`,`no-execute`].some(e=>e.startsWith(t))}return!(e.startsWith(`-`)&&/[cNn]/.test(e))})?null:`Not available with these fish options`:`Available for bash, zsh and fish`}var cR=[10,15,30,45,60,120,180,300,600,900,1800,3600];function lR(e){let t=e.config;function n(n){U9(e.machine,{...t,...n})}return(0,F.jsxs)($L,{title:`Agents`,children:[(0,F.jsx)(J,{label:`Send while working`,children:(0,F.jsxs)(lL,{value:t.delivery,onValueChange:n=>{if(n!==`queue`&&n!==`steer`)throw Error(`Unknown delivery ${n}`);U9(e.machine,{...t,delivery:n})},children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[(0,F.jsx)(pL,{value:`queue`,children:`Queue messages`}),(0,F.jsx)(pL,{value:`steer`,children:`Steer the agent`})]})]})}),(0,F.jsx)(J,{label:`Auto-skip questions`,children:(0,F.jsx)(uR,{value:t.autoSkipQuestionTimeout,onChange:e=>n({autoSkipQuestionTimeout:e})})}),(0,F.jsx)(J,{label:`Auto-resolve permissions`,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t.autoPermissionTimeout!==null&&(0,F.jsxs)(lL,{value:t.autoPermissionMode,onValueChange:e=>{if(e!==`allow`&&e!==`deny`)throw Error(`Unknown decision ${e}`);n({autoPermissionMode:e})},children:[(0,F.jsx)(dL,{className:`w-24`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[(0,F.jsx)(pL,{value:`allow`,children:`Allow`}),(0,F.jsx)(pL,{value:`deny`,children:`Deny`})]})]}),(0,F.jsx)(uR,{value:t.autoPermissionTimeout,onChange:e=>n({autoPermissionTimeout:e})})]})})]})}function uR(e){let t=e.value===null||cR.includes(e.value)?cR:[...cR,e.value].sort((e,t)=>e-t);return(0,F.jsxs)(lL,{value:e.value===null?`off`:String(e.value),onValueChange:t=>e.onChange(t===`off`?null:Number(t)),children:[(0,F.jsx)(dL,{className:`w-40`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[(0,F.jsx)(pL,{value:`off`,children:`Off`}),t.map(e=>(0,F.jsx)(pL,{value:String(e),children:e===3600?`After 1 hour`:e===60?`After 1 minute`:e%60==0?`After ${e/60} minutes`:`After ${e} seconds`},e))]})]})}function dR(e){let t=e.config.commitMessage,[n,r]=(0,P.useState)(null),[i,a]=(0,P.useState)(null);(0,P.useEffect)(()=>{if(t.provider===null)return;let n=!0;return r(null),a(null),I(e.machine,`capabilities`,{provider:t.provider,accountId:t.accountId,projectId:null}).then(e=>{n&&r(e.models)},e=>{n&&a(s(e))}),()=>{n=!1}},[e.machine,t.provider,t.accountId]);function o(t){U9(e.machine,{...e.config,commitMessage:t})}function c(t){if(t===`off`){o({provider:null,accountId:null,model:null});return}if(t===`opencode`){o({provider:`opencode`,accountId:null,model:null});return}let n=[...e.claudeAccounts,...e.codexAccounts].find(e=>e.id===t);if(n===void 0)throw Error(`That account was removed`);o({provider:n.provider,accountId:n.id,model:null})}return(0,F.jsxs)($L,{title:`Commit messages and pull requests`,children:[(0,F.jsx)(J,{label:`Account`,children:(0,F.jsxs)(lL,{value:t.provider===null?`off`:t.provider===`opencode`?`opencode`:t.accountId??`off`,onValueChange:c,children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[(0,F.jsx)(pL,{value:`off`,children:`Off`}),[...e.claudeAccounts,...e.codexAccounts].map(e=>(0,F.jsxs)(pL,{value:e.id,disabled:!e.valid,children:[(0,F.jsx)(Jg,{provider:e.provider,className:`size-4`}),`${lC[e.provider]} · ${e.name}`]},e.id)),e.openCode.available&&(0,F.jsxs)(pL,{value:`opencode`,children:[(0,F.jsx)(Jg,{provider:`opencode`,className:`size-4`}),lC.opencode]})]})]})}),t.provider!==null&&(0,F.jsx)(J,{label:`Model`,children:(0,F.jsxs)(lL,{value:t.model??void 0,disabled:n===null,onValueChange:e=>o({...t,model:e}),children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{placeholder:i===null?n===null?`Loading…`:`Choose a model`:`Unavailable`})}),(0,F.jsx)(fL,{children:(n??[]).map(e=>(0,F.jsx)(pL,{value:e.value,children:e.name},e.value))})]})}),i!==null&&(0,F.jsx)(`p`,{className:`text-destructive px-4 py-3 text-xs`,children:i})]})}var fR={zsh:`M11.415 5.038a.58.58 0 0 0-.543.197L.135 18.021a.58.58 0 0 0 .071.814.58.58 0 0 0 .815-.07L11.757 5.979a.58.58 0 0 0-.07-.815.6.6 0 0 0-.272-.126m-8.113.317a3.133 3.133 0 0 0-3.12 3.12 3.13 3.13 0 0 0 3.12 3.119A3.133 3.133 0 0 0 6.42 8.475a3.13 3.13 0 0 0-3.119-3.119m0 1.806a1.3 1.3 0 0 1 1.314 1.313 1.3 1.3 0 0 1-1.314 1.312A1.3 1.3 0 0 1 1.99 8.475a1.3 1.3 0 0 1 1.312-1.314m5.253 5.253a3.13 3.13 0 0 0-3.119 3.119 3.13 3.13 0 0 0 3.12 3.118 3.133 3.133 0 0 0 3.118-3.12 3.133 3.133 0 0 0-3.119-3.118m0 1.805a1.3 1.3 0 0 1 1.313 1.314c0 .735-.577 1.312-1.312 1.312a1.3 1.3 0 0 1-1.314-1.312 1.3 1.3 0 0 1 1.313-1.314m7.201 3.276a.58.58 0 0 0-.578.578.58.58 0 0 0 .578.578h7.666a.58.58 0 0 0 .579-.578.58.58 0 0 0-.579-.578Z`,bash:`M21.038,4.9l-7.577-4.498C13.009,0.134,12.505,0,12,0c-0.505,0-1.009,0.134-1.462,0.403L2.961,4.9 C2.057,5.437,1.5,6.429,1.5,7.503v8.995c0,1.073,0.557,2.066,1.462,2.603l7.577,4.497C10.991,23.866,11.495,24,12,24 c0.505,0,1.009-0.134,1.461-0.402l7.577-4.497c0.904-0.537,1.462-1.529,1.462-2.603V7.503C22.5,6.429,21.943,5.437,21.038,4.9z M15.17,18.946l0.013,0.646c0.001,0.078-0.05,0.167-0.111,0.198l-0.383,0.22c-0.061,0.031-0.111-0.007-0.112-0.085L14.57,19.29 c-0.328,0.136-0.66,0.169-0.872,0.084c-0.04-0.016-0.057-0.075-0.041-0.142l0.139-0.584c0.011-0.046,0.036-0.092,0.069-0.121 c0.012-0.011,0.024-0.02,0.036-0.026c0.022-0.011,0.043-0.014,0.062-0.006c0.229,0.077,0.521,0.041,0.802-0.101 c0.357-0.181,0.596-0.545,0.592-0.907c-0.003-0.328-0.181-0.465-0.613-0.468c-0.55,0.001-1.064-0.107-1.072-0.917 c-0.007-0.667,0.34-1.361,0.889-1.8l-0.007-0.652c-0.001-0.08,0.048-0.168,0.111-0.2l0.37-0.236 c0.061-0.031,0.111,0.007,0.112,0.087l0.006,0.653c0.273-0.109,0.511-0.138,0.726-0.088c0.047,0.012,0.067,0.076,0.048,0.151 l-0.144,0.578c-0.011,0.044-0.036,0.088-0.065,0.116c-0.012,0.012-0.025,0.021-0.038,0.028c-0.019,0.01-0.038,0.013-0.057,0.009 c-0.098-0.022-0.332-0.073-0.699,0.113c-0.385,0.195-0.52,0.53-0.517,0.778c0.003,0.297,0.155,0.387,0.681,0.396 c0.7,0.012,1.003,0.318,1.01,1.023C16.105,17.747,15.736,18.491,15.17,18.946z M19.143,17.859c0,0.06-0.008,0.116-0.058,0.145 l-1.916,1.164c-0.05,0.029-0.09,0.004-0.09-0.056v-0.494c0-0.06,0.037-0.093,0.087-0.122l1.887-1.129 c0.05-0.029,0.09-0.004,0.09,0.056V17.859z M20.459,6.797l-7.168,4.427c-0.894,0.523-1.553,1.109-1.553,2.187v8.833 c0,0.645,0.26,1.063,0.66,1.184c-0.131,0.023-0.264,0.039-0.398,0.039c-0.42,0-0.833-0.114-1.197-0.33L3.226,18.64 c-0.741-0.44-1.201-1.261-1.201-2.142V7.503c0-0.881,0.46-1.702,1.201-2.142l7.577-4.498c0.363-0.216,0.777-0.33,1.197-0.33 c0.419,0,0.833,0.114,1.197,0.33l7.577,4.498c0.624,0.371,1.046,1.013,1.164,1.732C21.686,6.557,21.12,6.411,20.459,6.797z`,fish:`m19.164 9.228-3.016 2.688v.527l3.016 2.688v-1.228l-1.936-1.723 1.936-1.724V9.228m-6.658.046v1.208l1.905 1.696-1.905 1.695v1.209l2.968-2.645v-.518l-2.968-2.645M9.781 7.847a6.519 6.519 0 0 0-2.038-.335c-.672 0-1.349.112-2.03.335a9.23 9.23 0 0 0-2.088 1.017v.723c.69-.4 1.377-.7 2.06-.897a7.388 7.388 0 0 1 2.058-.296c.684 0 1.368.098 2.052.296a9.452 9.452 0 0 1 2.075.897v-.723a9.229 9.229 0 0 0-2.09-1.017m.014 7.78a7.371 7.371 0 0 1-2.052.296 7.388 7.388 0 0 1-2.057-.296 9.18 9.18 0 0 1-2.061-.897v.723a9.228 9.228 0 0 0 2.088 1.017 6.492 6.492 0 0 0 2.03.335c.678 0 1.357-.112 2.038-.335a9.227 9.227 0 0 0 2.089-1.017v-.723c-.7.4-1.391.7-2.075.897m.602-11.23h-.51L7.28 6.92h1.19l1.672-1.62 1.671 1.62h1.191l-2.607-2.525m-2.965 13.68v-.824H6.427v.825l.786 1.527h.614l-.395-1.527M4.127 10.95v1.216H5.13V10.95H4.127m-1.16-1.695L0 11.901v.518l2.967 2.645v-1.208L1.063 12.16l1.904-1.695V9.256m20.68 3.28c-.235-.3-.574-.509-1.017-.626.395-.103.696-.278.902-.525.206-.247.31-.556.31-.926 0-.546-.197-.984-.59-1.314-.393-.33-.919-.495-1.575-.495-.22 0-.473.025-.758.073-.284.048-.61.12-.974.217v.84c.314-.12.613-.21.9-.27a4.05 4.05 0 0 1 .832-.091c.403 0 .714.093.933.278.218.185.328.451.328.798 0 .328-.118.584-.353.768-.235.184-.562.276-.98.276h-.697v.75h.696c.458 0 .821.116 1.09.346.268.23.402.542.402.934 0 .425-.134.75-.402.976-.269.226-.653.339-1.153.339a3.55 3.55 0 0 1-.89-.117 4.395 4.395 0 0 1-.91-.358v.909a6.1 6.1 0 0 0 .95.249c.323.057.639.085.95.085.738 0 1.315-.177 1.733-.53.417-.355.626-.842.626-1.463 0-.449-.118-.823-.353-1.123`,powershell:`M23.181 2.974c.568 0 .923.463.792 1.035l-3.659 15.982c-.13.572-.697 1.035-1.265 1.035H.819c-.568 0-.923-.463-.792-1.035L3.686 4.009c.13-.572.697-1.035 1.265-1.035zm-8.375 9.346c.251-.394.227-.905-.09-1.243L9.122 5.125c-.38-.404-1.037-.407-1.466-.003-.429.402-.468 1.056-.088 1.46l4.662 4.96v.11l-7.42 5.374c-.45.327-.533.977-.187 1.453.346.476.991.597 1.44.27l8.229-5.91c.28-.196.438-.365.514-.52zm-2.796 4.399a.928.928 0 00-.934.923c0 .51.418.923.934.923h4.433a.928.928 0 00.934-.923.928.928 0 00-.934-.923z`,cmd:`M8.165 6V3h7.665v3H8.165zm-.5-3H1c-.55 0-1 .45-1 1v2h7.665V3zM23 3h-6.67v3H24V4c0-.55-.45-1-1-1zM0 6.5h24V20c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V6.5zM11.5 18c0 .3.2.5.5.5h8c.3 0 .5-.2.5-.5v-1.5c0-.3-.2-.5-.5-.5h-8c-.3 0-.5.2-.5.5V18zm-5.2-4.55l-3.1 3.1c-.25.25-.25.6 0 .8l.9.9c.25.25.6.25.8 0l4.4-4.4a.52.52 0 0 0 0-.8l-4.4-4.4c-.2-.2-.6-.2-.8 0l-.9.9c-.25.2-.25.55 0 .8l3.1 3.1z`},pR={zsh:`zsh`,bash:`bash`,fish:`fish`,pwsh:`powershell`,powershell:`powershell`,cmd:`cmd`},mR={macos:[`zsh`,`bash`,`fish`,`pwsh`],linux:[`bash`,`zsh`,`fish`,`pwsh`],windows:[`pwsh`,`powershell`,`cmd`]};function hR(e){let t=e.trim().split(/[\\/]/).pop()?.toLowerCase().replace(/\.exe$/,``);return t===void 0?void 0:pR[t]}function gR(e){return e.replace(/[\\/][^\\/]*$/,``)}function _R(e){return(0,F.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-4 flex-none`,fill:`currentColor`,children:(0,F.jsx)(`path`,{d:fR[e.logo]})})}function vR(e){let[t,n]=(0,P.useState)(e.value??``),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),c=hR(t),l=e.platform===e.device,u=l?r:mR[e.platform].map(e=>({name:e,path:null}));(0,P.useEffect)(()=>{l&&I(e.machine,`terminal.shells`,void 0).then(i,e=>o(s(e)))},[e.machine,l]);function d(t){n(t),t!==(e.value??``)&&e.onCommit(t===``?null:t)}return(0,F.jsxs)(`div`,{className:`relative w-56`,children:[c&&(0,F.jsx)(`span`,{className:`text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2`,children:(0,F.jsx)(_R,{logo:c})}),(0,F.jsx)(cL,{className:c?`pr-9 pl-8`:`pr-9`,placeholder:`System default`,value:t,onChange:e=>n(e.target.value),onBlur:()=>d(t),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}}),(0,F.jsxs)(mS,{children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(E,{variant:`ghost`,size:`icon-xs`,"aria-label":`Known shells`,className:`text-muted-foreground absolute top-1/2 right-1.5 -translate-y-1/2`,children:(0,F.jsx)(k,{icon:gm})})}),(0,F.jsxs)(_S,{align:`end`,className:`w-72`,children:[a&&(0,F.jsx)(`p`,{className:`text-destructive px-2 py-1.5 text-xs`,children:a}),u?.length===0&&(0,F.jsx)(`p`,{className:`text-muted-foreground px-2 py-1.5 text-xs`,children:`No known shells found`}),u?.map(e=>(0,F.jsxs)(vS,{onSelect:()=>d(e.path??e.name),children:[(0,F.jsx)(_R,{logo:pR[e.name]}),e.name,e.path!==null&&(0,F.jsx)(`span`,{className:`text-muted-foreground ml-auto min-w-0 truncate pl-3 text-xs [direction:rtl]`,title:e.path,children:(0,F.jsx)(`bdi`,{children:gR(e.path)})})]},e.path??e.name)),(0,F.jsx)(CS,{}),(0,F.jsx)(vS,{onSelect:()=>d(``),children:`System default`})]})]})]})}function yR(e){let t=e.config.workingDir[e.platform]??``,n=e.config.newThreads;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)($L,{title:`Projects`,children:(0,F.jsx)(J,{label:`Working directory`,children:(0,F.jsx)(eR,{className:`w-72 font-mono`,value:t,placeholder:`Home folder`,onCommit:t=>U9(e.machine,{...e.config,workingDir:{...e.config.workingDir,[e.platform]:t.trim()===``?null:t.trim()}})},`${e.machine}-${t}`)})}),(0,F.jsx)($L,{title:`New threads`,children:(0,F.jsx)(J,{label:`Account`,children:(0,F.jsxs)(lL,{value:n.provider===`opencode`?`opencode`:n.accountId??void 0,onValueChange:t=>{if(t===`opencode`){U9(e.machine,{...e.config,newThreads:{...n,provider:`opencode`,accountId:null}});return}let r=[...e.claudeAccounts,...e.codexAccounts].find(e=>e.id===t);if(r===void 0)throw Error(`That account was removed`);U9(e.machine,{...e.config,newThreads:{...n,provider:r.provider,accountId:r.id}})},children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{placeholder:`First available`})}),(0,F.jsxs)(fL,{children:[[...e.claudeAccounts,...e.codexAccounts].map(e=>(0,F.jsxs)(pL,{value:e.id,disabled:!e.valid,children:[(0,F.jsx)(Jg,{provider:e.provider,className:`size-4`}),`${lC[e.provider]} · ${e.name}`]},e.id)),e.openCode.available&&(0,F.jsxs)(pL,{value:`opencode`,children:[(0,F.jsx)(Jg,{provider:`opencode`,className:`size-4`}),lC.opencode]})]})]})})}),(0,F.jsx)(bR,{machine:e.machine,config:e.config,platform:e.platform,defaultShell:e.defaultShell},e.machine),(0,F.jsx)(lR,{machine:e.machine,config:e.config}),(0,F.jsx)(dR,{machine:e.machine,config:e.config,claudeAccounts:e.claudeAccounts,codexAccounts:e.codexAccounts,openCode:e.openCode},`git-${e.machine}`),(0,F.jsx)(E,{variant:`outline`,onClick:e.onRestore,children:`Restore machine defaults`})]})}function bR(e){let t=e.config.terminal,[n,r]=(0,P.useState)(e.platform),i=sR(t.shell[e.platform],e.platform,e.defaultShell);function a(t){U9(e.machine,{...e.config,terminal:t})}return(0,F.jsxs)($L,{title:`Shell`,note:`Applies to new terminals`,children:[(0,F.jsx)(J,{label:`Platform`,children:(0,F.jsxs)(lL,{value:n,onValueChange:e=>r(e),children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsx)(fL,{children:YL.map(t=>(0,F.jsxs)(pL,{value:t.value,children:[t.label,t.value===e.platform&&(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:`(this machine)`})]},t.value))})]})}),(0,F.jsx)(J,{label:`Command`,children:(0,F.jsx)(vR,{machine:e.machine,platform:n,device:e.platform,value:t.shell[n],onCommit:e=>a({...t,shell:{...t.shell,[n]:e}})},`${e.machine}-${n}-command`)}),(0,F.jsx)(J,{label:(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Shell integration`,(0,F.jsx)(je,{label:(0,F.jsxs)(`div`,{children:[`Tells the terminal where prompts and commands start and end.`,(0,F.jsxs)(`ul`,{className:`mt-1 list-disc pl-4`,children:[(0,F.jsx)(`li`,{children:`Click in the command line to move the cursor`}),(0,F.jsx)(`li`,{children:`Ignore clipboard reads once the command that asked has finished`})]})]}),children:(0,F.jsx)(`span`,{onClick:e=>e.preventDefault(),children:(0,F.jsx)(k,{icon:Xm,"aria-label":`About shell integration`,className:`text-muted-foreground size-3.5`})})})]}),children:(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i!==null&&(0,F.jsx)(`span`,{className:`text-muted-foreground max-w-32 text-right text-xs sm:max-w-none`,children:i}),(0,F.jsx)(BL,{checked:i===null&&t.behavior.shellIntegration,disabled:i!==null,onCheckedChange:e=>a({...t,behavior:{...t.behavior,shellIntegration:e}})})]})}),(0,F.jsx)(xR,{identity:t.behavior.terminalIdentity,onChange:e=>a({...t,behavior:{...t.behavior,terminalIdentity:e}})})]})}function xR(e){return(0,F.jsx)(J,{label:`Report the terminal as`,children:(0,F.jsxs)(lL,{value:e.identity,onValueChange:e.onChange,children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[(0,F.jsx)(pL,{value:`offsite`,children:`OffSite`}),(0,F.jsx)(pL,{value:`ghostty`,children:`Ghostty`}),(0,F.jsx)(pL,{value:`iterm2`,children:`iTerm2`})]})]})})}var SR=(0,P.createContext)({});function CR(e){let t=(0,P.useRef)(null);return t.current===null&&(t.current=e()),t.current}var wR=typeof window<`u`?P.useLayoutEffect:P.useEffect,TR=(0,P.createContext)(null);function ER(e,t){e.indexOf(t)===-1&&e.push(t)}function DR(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}function OR([...e],t,n){let r=t<0?e.length+t:t;if(r>=0&&r<e.length){let r=n<0?e.length+n:n,[i]=e.splice(t,1);e.splice(r,0,i)}return e}var kR=(e,t,n)=>n>t?t:n<e?e:n,AR={},jR=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),MR=e=>typeof e==`object`&&!!e,NR=e=>/^0[^.\s]+$/u.test(e);function PR(e){let t;return()=>(t===void 0&&(t=e()),t)}var FR=e=>e,IR=(...e)=>e.reduce((e,t)=>n=>t(e(n))),LR=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},RR=class{constructor(){this.subscriptions=[]}add(e){return ER(this.subscriptions,e),()=>this.remove(e)}remove(e){DR(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r){if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},zR=e=>e*1e3,BR=e=>e/1e3,VR=(e,t)=>t?1e3/t*e:0,HR=(e,t,n)=>e*(3*(1-e)*((1-e)*t+e*n)+e*e);function UR(e,t,n,r){return e===t&&n===r?FR:i=>{let a=0,o=1,s=i;for(let t=0;;t++){s>=a&&s<=o||(s=(a+o)/2);let r=HR(s,e,n)-i;if(r*r<1e-28||t===40)break;r>0?o=s:a=s,s-=r*1e-7/(HR(s+1e-7,e,n)-i-r)}return HR(s,t,r)}}var WR=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,GR=e=>t=>1-e(1-t),KR=UR(.33,1.53,.69,.99),qR=GR(KR),JR=WR(qR),YR=e=>e>=1?1:(e*=2)<1?.5*qR(e):.5*(2-2**(-10*(e-1))),XR=e=>1-Math.sin(Math.acos(e)),ZR=GR(XR),QR=WR(XR),$R=UR(.42,0,1,1),ez=UR(0,0,.58,1),tz=UR(.42,0,.58,1),nz=e=>Array.isArray(e)&&typeof e[0]!=`number`,rz=e=>Array.isArray(e)&&typeof e[0]==`number`,iz={linear:FR,easeIn:$R,easeInOut:tz,easeOut:ez,circIn:XR,circInOut:QR,circOut:ZR,backIn:qR,backInOut:JR,backOut:KR,anticipate:YR},az=e=>typeof e==`string`,oz=e=>{if(rz(e)){e.length;let[t,n,r,i]=e;return UR(t,n,r,i)}return az(e)?(iz[e],`${e}`,iz[e]):e},sz={delta:0,timestamp:0,isProcessing:!1},cz;function lz(){cz=void 0}var uz={now:()=>(cz===void 0&&uz.set(sz.isProcessing||AR.useManualTiming?sz.timestamp:performance.now()),cz),set:e=>{cz=e,queueMicrotask(lz)}},dz=e=>Math.round(e*1e5)/1e5,fz=e=>t=>typeof t==`string`&&t.startsWith(e),pz=fz(`--`),mz=fz(`var(--`),hz=e=>mz(e)?gz.test(e.split(`/*`)[0].trim()):!1,gz=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function _z(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var vz={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},yz={...vz,transform:e=>kR(0,1,e)},bz={...vz,default:1},xz=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Sz(e){return e==null}var Cz=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,wz=(e,t)=>n=>!!(typeof n==`string`&&Cz.test(n)&&n.startsWith(e)||t&&!Sz(n)&&Object.prototype.hasOwnProperty.call(n,t)),Tz=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(xz);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Ez=e=>kR(0,255,e),Dz={...vz,transform:e=>Math.round(Ez(e))},Oz={test:wz(`rgb`,`red`),parse:Tz(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Dz.transform(e)+`, `+Dz.transform(t)+`, `+Dz.transform(n)+`, `+dz(yz.transform(r))+`)`};function kz(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Az={test:wz(`#`),parse:kz,transform:Oz.transform},jz=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Mz=jz(`deg`),Nz=jz(`%`),Y=jz(`px`),Pz=jz(`vh`),Fz=jz(`vw`),Iz={...Nz,parse:e=>Nz.parse(e)/100,transform:e=>Nz.transform(e*100)},Lz={test:wz(`hsl`,`hue`),parse:Tz(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Nz.transform(dz(t))+`, `+Nz.transform(dz(n))+`, `+dz(yz.transform(r))+`)`},Rz={test:e=>Oz.test(e)||Az.test(e)||Lz.test(e),parse:e=>Oz.test(e)?Oz.parse(e):Lz.test(e)?Lz.parse(e):Az.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Oz.transform(e):Lz.transform(e),getAnimatableNone:e=>{let t=Rz.parse(e);return t.alpha=0,Rz.transform(t)}},zz=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Bz=new RegExp(xz.source),Vz=new RegExp(zz.source,`i`);function Hz(e){return isNaN(e)&&typeof e==`string`&&(Bz.test(e)||Vz.test(e))}var Uz=`number`,Wz=`color`,Gz=`var`,Kz=`var(`,qz="${}",Jz=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)(?![a-z]*\()/giu;function Yz(e){let t=e.toString();return Bz.test(t)||Vz.test(t)}function Xz(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Jz,e=>(Rz.test(e)?(r.color.push(a),i.push(Wz),n.push(Rz.parse(e))):e.startsWith(Kz)?(r.var.push(a),i.push(Gz),n.push(e)):(r.number.push(a),i.push(Uz),n.push(parseFloat(e))),++a,qz)).split(qz),indexes:r,types:i}}function Zz(e){return Xz(e).values}function Qz({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];i+=e===Uz?dz(r[a]):e===Wz?Rz.transform(r[a]):r[a]}return i}}function $z(e){return Qz(Xz(e))}var eB=e=>typeof e==`number`?0:Rz.test(e)?Rz.getAnimatableNone(e):e,tB=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:eB(e);function nB(e){let t=Xz(e);return Qz(t)(t.values.map((e,n)=>tB(e,t.split[n])))}var rB={test:Hz,parse:Zz,createTransformer:$z,getAnimatableNone:nB};function iB(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function aB({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=iB(s,r,e+1/3),a=iB(s,r,e),o=iB(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function oB(e,t){return n=>n>0?t:e}var sB=(e,t,n)=>e+(t-e)*n,cB=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},lB=[Az,Oz,Lz],uB=e=>lB.find(t=>t.test(e));function dB(e){let t=uB(e);if(!t)return`${e}`,!1;let n=t.parse(e);return t===Lz&&(n=aB(n)),n}var fB=(e,t)=>{let n=dB(e),r=dB(t);if(!n||!r)return oB(e,t);let i={...n};return e=>(i.red=cB(n.red,r.red,e),i.green=cB(n.green,r.green,e),i.blue=cB(n.blue,r.blue,e),i.alpha=sB(n.alpha,r.alpha,e),Oz.transform(i))},pB=new Set([`none`,`hidden`]);function mB(e,t){return pB.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function hB(e,t){return n=>sB(e,t,n)}function gB(e){return typeof e==`number`?hB:typeof e==`string`?hz(e)?oB:Rz.test(e)?fB:bB:Array.isArray(e)?_B:typeof e==`object`?Rz.test(e)?fB:vB:oB}function _B(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>gB(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function vB(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=gB(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function yB(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]],s=e.values[o]??0;n[i]=s,r[a]++}return n}var bB=(e,t)=>{let n=rB.createTransformer(t),r=Xz(e),i=Xz(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?pB.has(e)&&!i.values.length||pB.has(t)&&!r.values.length?mB(e,t):IR(_B(yB(r,i),i.values),n):(`${e}${t}`,oB(e,t))},xB=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function SB(e,t){let n=xB.exec(e);if(!n)return;let r=xB.exec(t);if(!r||n[2]!==r[2])return;let i=n[2],a=parseFloat(n[1]),o=parseFloat(r[1]);return e=>dz(sB(a,o,e))+i}function CB(e,t,n){if(typeof e==`number`&&typeof t==`number`&&typeof n==`number`)return sB(e,t,n);if(typeof e==`string`&&typeof t==`string`){let n=SB(e,t);if(n)return n}return gB(e)(e,t)}var wB=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function TB(e){let t=new Set,n=new Set,r=!1,i=!1,a=new Set,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(n.add(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var EB=40;function DB(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0,a=()=>r=!0,o=wB.reduce((e,t)=>(e[t]=TB(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=AR.useManualTiming,o=a?n.timestamp:performance.now();r=!1,a||(n.delta=i?1e3/60:Math.max(Math.min(o-n.timestamp,EB),1)),n.timestamp=o,n.isProcessing=!0,s.process(n),c.process(n),l.process(n),u.process(n),d.process(n),f.process(n),p.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(h))},g=()=>{r=!0,i=!0,n.isProcessing||e(h)};return{schedule:wB.reduce((e,t)=>{let n=o[t];return e[t]=(e,t=!1,i=!1)=>(r||g(),n.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<wB.length;t++)o[wB[t]].cancel(e)},state:n,steps:o}}var{schedule:OB,cancel:kB,steps:AB}=DB(typeof requestAnimationFrame<`u`?requestAnimationFrame:FR,!0,sz),jB=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>OB.update(t,e),stop:()=>kB(t),now:()=>sz.isProcessing?sz.timestamp:uz.now()}},MB=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},NB=2e4;function PB(e,t=50,n=NB,r){let i=0,a=e.next(i);for(r?.push(a.value);!a.done&&i<n;)i+=t,a=e.next(i),r?.push(a.value);return i>=n?1/0:i}function FB(e,t=100,n){let{keyframes:r,velocity:i}=e,a=r&&r[r.length-1]-r[0],o=n({...e,velocity:i&&a?i*t/a:i,keyframes:[0,t]}),s=Math.min(PB(o),NB);return{type:`keyframes`,ease:e=>o.next(s*e).value/t,duration:BR(s)}}var IB={stiffness:100,damping:10,mass:1,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05},LB=e=>e<0?1/Math.max(1+e,IB.minDamping):Math.max(1-e,IB.minDamping);function RB(e,t){if(!(e>1))return 1;let n=Math.sqrt(e*e-1),r=e-n,i=e+n,a=2*n*Math.exp(-t)*(1+t);return VB(e=>i*Math.exp(-r*e)-r*Math.exp(-i*e)-a,e=>Math.exp(-i*e)-Math.exp(-r*e),t)/t}function zB(e,t){return e*Math.sqrt(1-t*t)}var BB=12;function VB(e,t,n){let r=n;for(let n=1;n<BB;n++)r-=e(r)/t(r);return r}var HB=.001;function UB({duration:e=IB.duration,bounce:t=IB.bounce}){let n,r;IB.maxDuration;let i=LB(t);e=kR(IB.minDuration,IB.maxDuration,BR(e)),i<1?(n=t=>{let n=t*i,r=n*e,a=zB(t,i),o=Math.exp(-r);return HB-n/a*o},r=t=>{let r=t*i*e,a=i*i*t*t*e,o=Math.exp(-r),s=zB(t*t,i);return(-n(t)+HB>0?-1:1)*-a*o/s}):(n=t=>-.001+Math.exp(-t*e)*(t*e+1),r=t=>Math.exp(-t*e)*(-t*(e*e)));let a=5/e,o=VB(n,r,a),s=o*RB(i,o*e),c=s*s;return{stiffness:c,damping:i*2*Math.sqrt(c),duration:zR(e)}}var WB=(e,t)=>(t?e>=0:e>0)&&e<1/0;function GB(e,t){if(WB(e,t))return e}function KB(e){let t=GB(e.stiffness),n=GB(e.damping,!0),r=GB(e.mass),i={...e,stiffness:t??IB.stiffness,damping:n??IB.damping,mass:r??IB.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){let t=LB(e.bounce||0),n=2*Math.PI/(e.visualDuration*1.2)*RB(t,2*Math.PI/1.2);i.stiffness=n*n,i.damping=2*t*Math.sqrt(i.stiffness)}else Object.assign(i,UB(i)),i.isResolvedFromDuration=!0;(!WB(i.stiffness)||!WB(i.damping,!0))&&(i.stiffness=IB.stiffness,i.damping=IB.damping)}return i}function qB(e=IB.visualDuration,t=IB.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:o,damping:s,mass:c,duration:l,isResolvedFromDuration:u,isTimeDefined:d}=KB({...n}),f=e=>d?0:-BR(e),p=s/(2*Math.sqrt(o*c)),m=BR(Math.sqrt(o/c)),h=p*m,g={target:i,delta:i-r,velocity:f(n.velocity||0)||0,restSpeed:0,restDelta:0},_=()=>{let e=Math.abs(g.delta)<5;g.restSpeed=n.restSpeed||(e?IB.restSpeed.granular:IB.restSpeed.default),g.restDelta=n.restDelta||(e?IB.restDelta.granular:IB.restDelta.default)};_();let v,y,b;if(p<1){let e=zB(m,p),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};b=()=>{t.A=(g.velocity+h*g.delta)/e,t.sinC=h*t.A+g.delta*e,t.cosC=h*g.delta-t.A*e};let n=n=>{n!==t.t&&(t.t=n,t.env=Math.exp(-h*n),t.sin=Math.sin(e*n),t.cos=Math.cos(e*n))};v=e=>(n(e),g.target-t.env*(t.A*t.sin+g.delta*t.cos)),y=e=>(n(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(p===1){v=e=>g.target-Math.exp(-m*e)*(g.delta+(g.velocity+m*g.delta)*e);let e={C:0};b=()=>{e.C=g.velocity+m*g.delta},y=t=>Math.exp(-m*t)*(m*e.C*t-g.velocity)}else{let e=m*Math.sqrt(p*p-1),t=h-e,n=h+e,r=d?1/0:300/e,i=(e,t)=>Math.exp(t>r?-e*r-h*(t-r):-e*t),a={S:0,F:0};b=()=>{let t=(g.velocity+h*g.delta)/e;a.S=(g.delta+t)/2,a.F=(g.delta-t)/2},v=e=>g.target-a.S*i(t,e)-a.F*i(n,e),y=e=>t*a.S*i(t,e)+n*a.F*i(n,e)}b();let x=u&&l||null,S={calculatedDuration:x,retarget:(e,t)=>{g.target=e[e.length-1],g.delta=g.target-e[0],g.velocity=f(t),n.restSpeed&&n.restDelta||_(),S.calculatedDuration=x,a.done=!1,b()},velocity:e=>zR(y(e)),next:e=>{let t=v(e);if(u)a.done=e>=l;else{let n=zR(y(e));a.done=Math.abs(n)<=g.restSpeed&&Math.abs(g.target-t)<=g.restDelta}return a.value=a.done?g.target:t,a},toString:()=>{let e=Math.min(PB(S),NB),t=MB(t=>S.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return S}qB.applyToOptions=e=>{let t=FB(e,100,qB);return e.ease=t.ease,e.duration=zR(t.duration),e.type=`keyframes`,e};function JB({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>e<s||e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>{let t=v(e);f.done=Math.abs(t)<=l,f.value=f.done?_:_+t},b,x,S=e=>{p(f.value)&&(b=e,x=qB({keyframes:[f.value,m(f.value)],velocity:-v(e)/r*1e3,damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return!x&&b===void 0&&(t=!0,y(e),S(e)),b!==void 0&&e>=b?x.next(e-b):(!t&&y(e),f)}}}function YB(e,t,n){let r=[],i=n||AR.mix||CB,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=IR(Array.isArray(t)?t[n]||FR:t,a)),r.push(a)}return r}function XB(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=YB(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=LR(e[r],e[r+1],n);return s[r](i)};return n?t=>l(kR(e[0],e[a-1],t)):l}function ZB(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=LR(0,t,r);e.push(sB(n,1,i))}}function QB(e){let t=[0];return ZB(t,e.length-1),t}function $B(e,t){return e.map(e=>e*t)}function eV(e,t){return e.map(()=>t||tz).splice(0,e.length-1)}function tV({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=nz(r)?r.map(oz):oz(r)||tz,a={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(i)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){let[n,r]=t,o=n===r?void 0:(AR.mix||CB)(n,r);return{calculatedDuration:e,next:t=>(a.value=o?o(i(e>0?kR(0,1,t/e):1)):r,a.done=t>=e,a)}}let o=XB($B(n&&n.length===t.length?n:QB(t),e),t,{ease:Array.isArray(i)?i:eV(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var nV=5;function rV(e,t,n){let r=Math.max(t-nV,0);return VR(n-e(r),t-r)}function iV(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):rV(t=>e.next(t).value,t,e.next(t).value)}var aV=e=>e!==null;function oV(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(aV),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var sV={decay:JB,inertia:JB,tween:tV,keyframes:tV,spring:qB};function cV(e){typeof e.type==`string`&&(e.type=sV[e.type])}var lV=40,uV=(e,t)=>t-e>lV&&!AR.useManualTiming?t:e;function dV(e,t){return{kind:e,animation:t,timestamp:uz.now(),frameTimestamp:sz.timestamp,frameIsProcessing:sz.isProcessing}}function fV(e,t,n){let r=globalThis.__MOTION_INSPECT__;if(r)try{r({...dV(`animation-start`,e),options:n?{...t,...n}:t})}catch{}}function pV(e,t){let n=globalThis.__MOTION_INSPECT__;if(n)try{n({...dV(`layout-animation-start`,e),node:t})}catch{}}var mV=class{constructor(){this.isResolved=!1}get finished(){return this._finished||=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e}),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}},hV=e=>e/100,gV=e=>Math.round(e*1e4)/1e4,_V=class extends mV{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==uz.now()&&this.tick(uz.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),fV(this,this.options)}initAnimation(){let{options:e}=this;cV(e);let{type:t=tV,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||tV;s!==tV&&typeof o[0]!=`number`&&(this.mixKeyframes=IR(hV,CB(o[0],o[1])),o=[0,100]);let c=s(o===e.keyframes?e:{...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=PB(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.currentTime=this.holdTime===null?t:this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,calculatedDuration:i}=this;if(this.startTime===null)return n.next(0);let{delay:a=0,keyframes:o,type:s,onUpdate:c,finalKeyframe:l}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=uV(this.startTime,e)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let u=this.currentTime-a*(this.playbackSpeed>=0?1:-1),d=this.playbackSpeed>=0?u<0:u>r;this.currentTime=Math.max(u,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let f=this.generate(this.currentTime,d),{done:p}=f;!d&&i!==null&&(p=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let m=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&p);return m&&s!==JB&&(f.value=oV(o,this.options,l,this.speed)),c&&c(f.value),m&&this.finish(),f}at(e){return this.holdTime??gV((e-this.startTime)*this.playbackSpeed)}sampleAt(e,t){let{options:n,totalDuration:r}=this,i=this.at(e)-(n.delay||0);return i>=r&&n.type!==JB?oV(n.keyframes,n,t?void 0:n.finalKeyframe):this.generate(Math.max(i,0),i<0).value}generate(e,t){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o}=this,{keyframes:s,repeat:c,repeatType:l,repeatDelay:u}=this.options,d=e,f=n;if(c){let t=Math.min(e,r)/o,n=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),i===1&&n--,n=Math.min(n,c+1),n%2&&(l===`reverse`?(i=1-i,u&&(i-=u/o)):l===`mirror`&&(f=a)),d=kR(0,1,i)*o}let p;return t?(this.delayState.value=s[0],p=this.delayState):p=f.next(d),i&&!t&&(p.value=i(p.value)),p}then(e,t){return this.finished.then(e,t)}get duration(){return BR(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+BR(e)}get time(){return BR(this.currentTime)}set time(e){e=zR(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return iV(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(uz.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=BR(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=jB,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??(this.pendingStartTime=n):this.startTime=n-this.holdTime/(this.playbackSpeed||1),this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(uz.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}},vV=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function yV(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(xz)||[];if(!r)return e;let i=n.replace(r,``),a=+!!vV.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var bV=/\b([a-z-]*)\(.*?\)/gu,xV={...rB,getAnimatableNone:e=>{let t=e.match(bV);return t?t.map(yV).join(` `):e}},SV={...rB,getAnimatableNone:e=>{let t=rB.parse(e);return rB.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},CV={...vz,transform:Math.round},wV={borderWidth:Y,borderTopWidth:Y,borderRightWidth:Y,borderBottomWidth:Y,borderLeftWidth:Y,borderRadius:Y,borderTopLeftRadius:Y,borderTopRightRadius:Y,borderBottomRightRadius:Y,borderBottomLeftRadius:Y,width:Y,maxWidth:Y,height:Y,maxHeight:Y,top:Y,right:Y,bottom:Y,left:Y,inset:Y,insetBlock:Y,insetBlockStart:Y,insetBlockEnd:Y,insetInline:Y,insetInlineStart:Y,insetInlineEnd:Y,padding:Y,paddingTop:Y,paddingRight:Y,paddingBottom:Y,paddingLeft:Y,paddingBlock:Y,paddingBlockStart:Y,paddingBlockEnd:Y,paddingInline:Y,paddingInlineStart:Y,paddingInlineEnd:Y,margin:Y,marginTop:Y,marginRight:Y,marginBottom:Y,marginLeft:Y,marginBlock:Y,marginBlockStart:Y,marginBlockEnd:Y,marginInline:Y,marginInlineStart:Y,marginInlineEnd:Y,fontSize:Y,backgroundPositionX:Y,backgroundPositionY:Y,rotate:Mz,pathRotation:Mz,rotateX:Mz,rotateY:Mz,rotateZ:Mz,scale:bz,scaleX:bz,scaleY:bz,scaleZ:bz,skew:Mz,skewX:Mz,skewY:Mz,distance:Y,translateX:Y,translateY:Y,translateZ:Y,x:Y,y:Y,z:Y,perspective:Y,transformPerspective:Y,opacity:yz,originX:Iz,originY:Iz,originZ:Y,zIndex:CV,fillOpacity:yz,strokeOpacity:yz,numOctaves:CV},TV={...wV,color:Rz,backgroundColor:Rz,outlineColor:Rz,fill:Rz,stroke:Rz,borderColor:Rz,borderTopColor:Rz,borderRightColor:Rz,borderBottomColor:Rz,borderLeftColor:Rz,filter:xV,WebkitFilter:xV,mask:SV,WebkitMask:SV},EV=e=>TV[e],DV=new Set([xV,SV]);function OV(e,t){let n=EV(e);return DV.has(n)||(n=rB),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function kV(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var AV=e=>e*180/Math.PI,jV=e=>NV(AV(Math.atan2(e[1],e[0]))),MV={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scaleZ:()=>1,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:jV,rotateZ:jV,skewX:e=>AV(Math.atan(e[1])),skewY:e=>AV(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},NV=e=>(e%=360,e<0&&(e+=360),e),PV=jV,FV=e=>Math.hypot(e[0],e[1]),IV=e=>Math.hypot(e[4],e[5]),LV={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:FV,scaleY:IV,scaleZ:e=>Math.hypot(e[8],e[9],e[10]),scale:e=>(FV(e)+IV(e))/2,rotateX:e=>NV(AV(Math.atan2(e[6],e[5]))),rotateY:e=>NV(AV(Math.atan2(-e[2],e[0]))),rotateZ:PV,rotate:PV,skewX:e=>AV(Math.atan(e[4])),skewY:e=>AV(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function RV(e){return+!!e.includes(`scale`)}function zV(e,t){if(!e||e===`none`)return RV(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=LV,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=MV,i=t}if(!i)return RV(t);let a=r[t],o=i[1].split(`,`).map(VV);return typeof a==`function`?a(o):o[a]}var BV=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return zV(n,t)};function VV(e){return parseFloat(e.trim())}var HV=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],UV=new Set([...HV,`pathRotation`]),WV=e=>e===vz||e===Y,GV=new Set([`x`,`y`,`z`]),KV=HV.filter(e=>!GV.has(e));function qV(e){let t=[];return KV.forEach(n=>{let r=e.getValue(n);if(r!==void 0){let e=r.get(),i=+!!n.startsWith(`scale`);if(e===i)return;t.push([n,e]),r.set(i)}}),t}var JV=new Set([`bottom`,`right`]);function YV(e,t,n,r,i,a){let o=parseFloat(e);if(!isNaN(o))return o;let{min:s,max:c}=t()[n],l=c-s;return a===`border-box`?l:l-parseFloat(r)-parseFloat(i)}var XV={width:({width:e,paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r},i)=>YV(e,i,`x`,t,n,r),height:({height:e,paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r},i)=>YV(e,i,`y`,t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{let{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{let{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:({transform:e})=>zV(e,`x`),y:({transform:e})=>zV(e,`y`)};XV.translateX=XV.x,XV.translateY=XV.y;var ZV=new Set,QV=!1,$V=!1,eH=!1;function tH(){if($V){let e=[],t=new Set,n=new Set;ZV.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),JV.has(r.name)&&n.add(r.element))});let r=new Map;n.forEach(e=>{let t=qV(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}$V=!1,QV=!1,ZV.forEach(e=>e.complete(eH)),ZV.clear()}function nH(){ZV.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&($V=!0)})}function rH(){eH=!0,nH(),tH(),eH=!1}function iH(e,t,n){if(typeof e==`string`){if(jR(e)||NR(e))return parseFloat(e);if(!rB.test(e)&&rB.test(n))return OV(t,n)}return e??void 0}var aH=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(ZV.add(this),QV||(QV=!0,OB.read(nH),OB.resolveKeyframes(tH))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=iH(n.readValue(t,a),t,a);r!==void 0&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}kV(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ZV.delete(this)}cancel(){this.state===`scheduled`&&(ZV.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},oH=e=>e.startsWith(`--`);function sH(e,t,n){oH(t)?e.style.setProperty(t,n):e.style[t]=n}var cH={};function lH(e,t){let n=PR(e);return()=>cH[t]??n()}var uH=lH(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),dH=lH(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),fH=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,pH={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:fH([0,.65,.55,1]),circOut:fH([.55,0,1,.45]),backIn:fH([.31,.01,.66,-.59]),backOut:fH([.33,1.53,.69,.99])};function mH(e,t){if(e)return typeof e==`function`?dH()?MB(e,t):`ease-out`:rz(e)?fH(e):Array.isArray(e)?e.map(e=>mH(e,t)||pH.easeOut):pH[e]}function hH(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=mH(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function gH(e){return typeof e==`function`&&`applyToOptions`in e}function _H({type:e,...t}){return gH(e)&&dH()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var vH=class extends mV{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=_H(e);this.animation=hH(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=oV(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),sH(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()},fV(this,e,c)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e!==`idle`&&e!==`finished`&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return BR(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+BR(e)}get time(){return BR(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=zR(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&uH()?(this.animation.timeline=e,t?.(this.animation),FR):n(this)}},yH={anticipate:YR,backInOut:JR,circInOut:QR};function bH(e){return e in yH}function xH(e){typeof e.ease==`string`&&bH(e.ease)&&(e.ease=yH[e.ease])}var SH=class extends vH{constructor(e){xH(e),cV(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}elapsed(){return this.state===`running`?(uz.now()-this.startTime)*this.speed:this.time*1e3}sample(e){if(!this.sampler){let{motionValue:e,onUpdate:t,onComplete:n,onPlay:r,onStop:i,element:a,...o}=this.options;this.sampler=new _V({...o,autoplay:!1}),this.sampler.stop()}return this.sampler.sample(Math.max(0,e)).value}liveValue(){let{state:e}=this;if(e===`running`||e===`paused`)return this.sample(this.elapsed())}updateMotionValue(e){let{motionValue:t,element:n,name:r}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let{speed:i}=this,a=this.elapsed(),o=this.state===`running`&&i?kR(0,10,a):0,s=this.sample(a);n&&r&&sH(n,r,s),t.setWithVelocity(this.sample(a-o*Math.sign(i)),s,o/Math.abs(i||1))}},CH=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(rB.test(e)||e===`0`)&&!e.startsWith(`url(`));function wH(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function TH(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=CH(i,t),s=CH(a,t);return!o||!s?(o!==s&&`${t}${i}${a}${o?a:i}`,!1):wH(e)||(n===`spring`||gH(n))&&r}function EH(e){e.duration=0,e.type=`keyframes`}var DH=new Set([`opacity`,`clipPath`,`filter`,`transform`,`backgroundColor`]),OH=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function kH(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&OH.test(e[t]))return!0;return!1}var AH=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),jH=PR(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function MH(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!n||!(DH.has(n)||AH.has(n)))return!1;let c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return jH()&&(DH.has(n)||AH.has(n)&&kH(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var NH=(e,t)=>t&&typeof e==`number`?t.transform(e):e,PH={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},FH=HV.length;function IH(e,t,n){let r=``,i=!0;for(let a=0;a<FH;a++){let o=HV[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=NH(s,wV[o]);if(!c){i=!1;let t=PH[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${NH(a,wV.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}var LH=new WeakMap,RH=200,zH=.001,BH=.1,VH=.001,HH=100,UH=e=>/^(linear|ease(In|Out|InOut))$/.test(e),WH=(e,t)=>e-t,GH=(e,t,n)=>{let r=[];for(let i=0;i<=n;i++)r.push(sB(e,t,i/n));return r},KH=e=>e.motionValue.owner,qH=e=>LH.get(e),JH=(e,t)=>e.latestValues?e.latestValues[t]:e.getValue(t)?.get(),YH=({name:e,motionValue:t})=>e&&HV.includes(e)&&t?.owner?.current instanceof HTMLElement&&jH()&&dH();function XH(e){let t=KH(e),{onUpdate:n,transformTemplate:r}=t.getProps();return!e.isHandoff&&!n&&!e.hasOnUpdate&&!r&&e.type!==`inertia`&&(JH(t,`transform`)||`none`)===`none`&&!JH(t,`pathRotation`)&&!t.projection?.isProjecting()}var ZH=class extends _V{constructor(e){let t=KH(e).current,{driver:n=jB}=e,r=XH(e);e.driver=e=>{let r=n(e);return{js:r,now:r.now,start:(e=!0)=>{let n=qH(t);!n||n.isJS?r.start(e):n.schedule(!1,!e)},stop:()=>{r.stop();let e=qH(t);e?.schedule(!e.isFinishing)}}},super(e),this.canAccelerate=r;let{stop:i}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),i()}}get group(){return qH(KH(this.options).current)}get js(){return this.driver?.js}get name(){return this.options.name}timing(){let{startTime:e,speed:t,totalDuration:n}=this,{delay:r=0,repeatType:i}=this.options;return this.holdTime===null?n===1/0?[e+r/t,this.resolvedDuration*(i===`loop`?1:2)/t||1]:[e+(r+n)/t,0]:[1/0,0]}isAccelerated(){let{group:e,state:t}=this;return e?.tracks.has(this)&&!e.isJS&&this.canAccelerate&&(t===`running`||t===`paused`)}liveValue(){return this.isAccelerated()?this.sampleAt(uz.now()):void 0}tween(){let{keyframes:e,type:t,ease:n,times:r,repeat:i,delay:a=0}=this.options,o=rz(n)?fH(n):UH(n)&&pH[n];if(o&&!i&&!r&&e.length===2&&t===tV&&this.holdTime===null){let e=this.startTime+a/this.speed;return[e,e+this.resolvedDuration/this.speed,o]}}boundaries(e,t){let{startTime:n,speed:r,resolvedDuration:i,options:a}=this,{delay:o=0,repeat:s=0,repeatDelay:c=0,repeatType:l,times:u,keyframes:d,type:f}=a,p=(f||tV)===tV?u||QB(d):[0,1],m=n+o/r,h=[];if(this.holdTime!==null||!(i>0))return h;for(let n=Math.max(0,Math.floor((e-m)*r/i));n<=s;n++){let a=m+n*i/r;if(a>t)break;for(let o of p){let s=a+(n%2&&l&&l!==`loop`?1-o:o)*(i-c)/r;s>e&&s<t&&h.push(s)}}return h}numberAt(e){return parseFloat(this.sampleAt(e,!0))}sync(){let e=uz.now();this.options.motionValue.setWithVelocity(this.sampleAt(e-10,!0),this.sampleAt(e,!0),10)}play(){this.isStopped||((this.group||QH(KH(this.options))).tracks.add(this),super.play())}pause(){super.pause(),this.isAccelerated()&&(this.sync(),this.group.schedule(!1))}complete(){super.complete();let{group:e}=this;e&&!e.isJS&&this.canAccelerate&&this.tick(uz.now())}get time(){return this.isAccelerated()?BR(kR(0,this.totalDuration,this.at(uz.now())-(this.options.delay||0))):super.time}set time(e){super.time=e}attachTimeline(e){return this.canAccelerate=!1,this.group?.demote(!0),super.attachTimeline(e)}};function QH(e){let t=e.current,n=new Set,r=new Map,i={},a=[],o=new Map,s=[],c=!1,l=!1,u=!1,d=-1/0,f=e=>{for(let t of n)if(t.name===e)return!0},p=(t,n)=>{let o={};for(let s of t===void 0?HV:a){let a=r.get(s),c=t===void 0?JH(e,s):a?a.sampleAt(n>t&&!a.timing()[1]?n:t):i[s];c!==void 0&&(o[s]=c)}return o},m=(e,t)=>{let n=``,r=p(e,t);for(let e in r)n+=(PH[e]||e)+`(`+NH(r[e],wV[e])+`) `;return n||`none`},h=(e=p())=>{t.style.transform=IH(e,{})},g=(e=!0)=>{e&&h(),s.forEach(({animation:e})=>e.cancel()),s=[]},_=(e,t,n=1/0)=>{let r={animation:e,offset:t,end:n};e.startTime=uz.now()+t,n<1/0&&(e.onfinish=()=>{r.isDone=!0,s.some(e=>e.end===1/0)&&(e.cancel(),s=s.filter(e=>e!==r)),E.schedule(!1)}),e.oncancel=()=>s.includes(r)&&E.demote(),s.push(r)},v=(e,t,n)=>{let r=(t,n)=>Math.abs(e(n)-e(t)),i=r(t,n);for(;n-t>.01;){let e=(t+n)/2;r(t,e)>r(e,n)?n=e:t=e}return r(t,n)>i/2?[t,n]:[]},y=(e,t,n,r)=>{let i=Math.min(RH,Math.max(2,Math.ceil((n-t)/10)));if(r.length*4>i)return;let a=GH(t,n,i).concat(r).sort(WH),o=e=>LR(t,n,e),s,c;for(let t of e){let e=a.map(e=>t.numberAt(e)),[n]=e,r=e[e.length-1]-n,i=e.map(e=>r?(e-n)/r:e-n);if(!r){if(i.some(e=>!(Math.abs(e)<=zH)))return}else if(!s)s=i,c=e=>(t.numberAt(e)-n)/r;else if(i.some((e,t)=>!(Math.abs(e-s[t])<=zH)))return}if(!s||s.every((e,t)=>Math.abs(e-o(a[t]))<=zH))return`linear`;let l=[],u=(e,t=c(e))=>l.push(gV(t)+` `+gV(o(e)*100)+`%`);return s.forEach((e,t)=>{t&&Math.abs(e-s[t-1])>.2&&v(c,a[t-1],a[t]).forEach(e=>u(e)),u(a[t],e)}),`linear(`+l+`)`},b=(e,t,n,r)=>{let i=[t],a=(t,n)=>e.every(e=>!(Math.abs(e.numberAt((t+n)/2)-(e.numberAt(t)+e.numberAt(n))/2)>(e.name.startsWith(`scale`)?VH:BH))),o=(t,n,r)=>{if(n-t<1||a(t,n))i.push(n);else if(r<4)o(t,(t+n)/2,r+1),o((t+n)/2,n,r+1);else{for(let r of e)i.push(...v(e=>r.numberAt(e),t,n));i.push(n)}},s=GH(t,n,Math.ceil((n-t)/100));for(let e of r)s.push(e,Math.min(e+.01,n));let c=t;for(let e of s.sort(WH))e>c&&o(c,e,0),c=e;return i.sort(WH)},x=e=>{let t;for(let n of e){let e=n.tween();if(!e||t?.some((t,n)=>n<2?Math.abs(e[n]-t)>1:e[n]!==t))return;t=e}return t},S=(e,n,r,i={fill:`both`},a,o)=>{let s=e.flatMap(e=>e.boundaries(n,r)),c=o||y(e,n,r,s),l=c?[n,r]:b(e,n,r,s),u=l.map(e=>m(e,a)),d={transform:u};return c||(d.offset=l.map(e=>LR(n,r,e))),u.every(e=>e===u[0])&&(h(p(n,a)),d=null),t.animate(d,{...i,duration:r-n,easing:c||`linear`})},C=c=>{let l=c,u=0,d=0,f=[],p=[],m=new Set;r.clear(),o=new Map;for(let e of n){r.set(e.name,e);let[t,n]=e.timing(),i=t===1/0;if(o.set(e,[e.at(c),e.speed,i]),i)e.sync();else{if(e.speed<0)return;if(n){if(u){let e=(t-d)/n;if(Math.abs(n-u)>1||Math.abs(e-Math.round(e))*u>1)return}else u=n,d=t;p.push(e)}else m.add(t);f.push(e),l=Math.max(l,t)}}i={},a=HV.filter(t=>{if(r.has(t))return!0;let n=i[t]=JH(e,t);return n!==void 0&&parseFloat(n)!==+!!t.startsWith(`scale`)}),g(!1);let h=!u&&x(f);try{if(h&&h[1]>c){let[e,t,n]=h;_(S(f,e,t,void 0,void 0,n),e-c,t-e)}else l>c&&(_(S(f,c,l),0,l-c),m.forEach(e=>e<l-1&&_(t.animate(null,{duration:e-c}),0,e-c)));if(u){let e=d+Math.floor((l-d)/u)*u;_(S(p,e,e+u,{iterations:1/0,iterationStart:(l-e)/u,fill:`forwards`},l),l-c)}}catch{return}return s.length||g(),!0},w=e=>{let t,r=0;for(let i of n){let n=o.get(i);if(!n)return!1;let[a,s,c]=n,l=i.at(e),u=i.timing()[0]===1/0;if(c){if(u&&l===a)continue;return!1}let d=(l-a)/s,f=u?0:i.speed/s;if(t===void 0)t=d,r=f;else if(Math.abs(d-t)>1||f!==r)return!1}if(t===void 0)return!0;if(!s.length)return!1;for(let{offset:e,end:n,isDone:r}of s){let i=t-e;if(n<1/0&&(r?i<n-1:i<0||i>=n))return!1}for(let{animation:n,offset:i,isDone:a}of s){if(a)continue;let o=t-i;r?(n.playbackRate=r,n.startTime=e-o/r):(n.pause(),n.currentTime=o)}return!0},T=()=>{let r=uz.now();if(E.isJS||(E.isFinishing=!0,n.forEach(t=>{let[n,a]=t.timing();t.state===`running`&&t.speed>0&&!a&&n<=r+1&&(t.complete(),i[t.name]=JH(e,t.name),o.has(t)||(c=!0))}),E.isFinishing=!1),l=!1,n.forEach(({state:e},t)=>{(e===`idle`||e===`finished`)&&n.delete(t)}),!n.size){LH.delete(t),E.isJS||g();return}for(let e of n)if(!e.canAccelerate)return E.demote(!0);E.isJS&&(E.isJS=!1,c=!0,n.forEach(e=>e.js?.stop()));let a=c,s=u;if(c=u=!1,a||!w(r)){if(s){if(r-d<HH)return E.demote();d=r}if(!C(r))return E.demote()}},E={tracks:n,isJS:!1,isFinishing:!1,schedule(e,t){c||=e,u||=!!t,l||(l=!0,sz.isProcessing?OB.render(T,!1,!0):queueMicrotask(T))},check(){if(!E.isJS){for(let t in i)if(JH(e,t)!==i[t]&&!f(t))return E.schedule(!0,!0)}},demote(e){E.isJS||(n.forEach(t=>{t.isAccelerated()&&t.sync(),e||(t.canAccelerate=!1)}),E.isJS=!0,o=new Map,g(),n.forEach(e=>e.state===`running`&&e.js?.start()))}};return LH.set(t,E),E}var $H=class extends mV{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=uz.now();let{keyframes:t,name:n,motionValue:r,element:i}=e,a=e;a.autoplay??=!0,a.delay??=0,a.type??=`keyframes`,a.repeat??=0,a.repeatDelay??=0,a.repeatType??=`loop`;let o=i?.KeyframeResolver||aH;this.keyframeResolver=new o(t,(e,t,n)=>this.onKeyframesResolved(e,t,a,!n),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=uz.now();let u=!0;TH(e,i,a,o)||(u=!1,(AR.instantAnimations||!s)&&l?.(oV(e,n,t)),e[0]=e[e.length-1],EH(n),n.repeat=0);let{onComplete:d}=n;n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{d?.(),this.notifyFinished()};let f=u&&!c&&MH(n),p=!f&&YH(n);r&&(f||p||this.resolvedAt!==this.createdAt)&&(n.startTime??=uV(this.createdAt,this.resolvedAt));let m;if(f){n.element=n.motionValue?.owner?.current;try{m=new SH(n)}catch{m=new _V(n)}}else m=p?new ZH(n):new _V(n);this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}liveValue(){return this._animation?.liveValue?.()}get animation(){return this._animation||(this.keyframeResolver?.resume(),rH()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function eU(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var tU=30,nU=e=>!isNaN(parseFloat(e)),rU={current:void 0},iU=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=uz.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=uz.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=nU(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){var n;return e===`change`?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new RR)).add(t)}onChangeSubscribe(e){let{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new RR,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){OB.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){let{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){rU.current&&rU.current.push(this);let e=this.animation?.liveValue?.();return e===void 0?this.current:e}getCurrent(){return this.current}getPrevious(){return this.prev}getVelocity(){let e=uz.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>tU)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,tU);return VR(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&this.clearAnimation(),t()}),n||(this.animation=r),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function aU(e,t){return new iU(e,t)}function oU(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function sU(e,t){let n=e?.[t]??e?.default??e;return n===e?n:oU(n,e)}var cU={type:`spring`,stiffness:500,damping:25,restSpeed:10},lU=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),uU={type:`keyframes`,duration:.8},dU={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},fU=(e,{keyframes:t})=>t.length>2?uU:UV.has(e)?e.startsWith(`scale`)?lU(t[1]):cU:dU,pU=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function mU(e){for(let t in e)if(!pU.has(t))return!0;return!1}var hU=(e,t,n,r={},i,a)=>o=>{let s=sU(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=zR(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i,hasOnUpdate:!!s.onUpdate};mU(s)||Object.assign(u,fU(e,u)),u.duration&&=zR(u.duration),u.repeatDelay&&=zR(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(EH(u),u.delay===0&&(d=!0)),(AR.instantAnimations||AR.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,EH(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=oV(u.keyframes,s);if(e!==void 0){OB.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new _V(u):new $H(u)},gU=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _U(e){let t=gU.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function vU(e,t,n=1){`${e}`;let[r,i]=_U(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return jR(e)?parseFloat(e):e}return hz(i)?vU(i,t,n+1):i}function yU(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function bU(e,t,n,r){let i=t=>typeof t==`function`?t(n===void 0?e.custom:n,...yU(r)):t;return t=i(t),typeof t==`string`&&(t=e.variants&&e.variants[t]),i(t)}function xU(e,t,n){return bU(e.getProps(),t,n,e)}var SU=(e,t)=>t===`exit`?e.presenceContext?.custom:void 0,CU=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...HV]),wU=e=>Array.isArray(e);function TU(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,aU(n))}function EU(e){return wU(e)?e[e.length-1]||0:e}function DU(e,t){let{transitionEnd:n={},transition:r={},...i}=xU(e,t)||{};i={...i,...n};for(let t in i)TU(e,t,EU(i[t]))}var OU=e=>!!(e&&e.getVelocity);function kU(e){return!!(OU(e)&&e.add)}function AU(e,t){let n=e.getValue(`willChange`);if(kU(n))return n.add(t);if(!n&&AR.WillChange){let n=new AR.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function jU(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var MU=`data-`+jU(`framerAppearId`);function NU(e){return e.props[MU]}var PU=typeof window<`u`;function FU({protectedKeys:e,needsAnimating:t},n){let r=n in e&&!t[n];return t[n]=!1,r}function IU(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?oU(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState?.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&FU(f,t))continue;let o={delay:n,...sU(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){OB.update(()=>r.set(i));continue}let p=!1;if(PU&&window.MotionHandoffAnimation){let n=NU(e);if(n){let e=window.MotionHandoffAnimation(n,t,OB);e!==null&&(o.startTime=e,p=!0)}}AU(e,t);let m=l??e.shouldReduceMotion;r.start(hU(t,r,i,m&&CU.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>OB.update(()=>{o&&DU(e,o)});d.length?Promise.all(d).then(t):t()}return d}function LU(e,t,n={}){let r=xU(e,t,SU(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),a=()=>Promise.all(r?IU(e,r,n):[]),o=(r=0)=>{let{variantChildren:a}=e,{delayChildren:o=0,staggerChildren:s,staggerDirection:c}=i,l=[];return a?.forEach(e=>{e.notify(`AnimationStart`,t),l.push(LU(e,t,{...n,delay:r+(typeof o==`function`?0:o)+eU(a,e,o,s,c)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(l)},{when:s}=i;return s?s===`beforeChildren`?a().then(()=>o()):o().then(a):Promise.all([a(),o(n.delay)])}function RU(e,t,n={}){return e.notify(`AnimationStart`,t),(Array.isArray(t)?Promise.all(t.map(t=>LU(e,t,n))):typeof t==`string`?LU(e,t,n):Promise.all(IU(e,xU(e,t,n.custom),n))).then(()=>{e.notify(`AnimationComplete`,t)})}var zU={test:e=>e===`auto`,parse:e=>e},BU=e=>t=>t.test(e),VU=[vz,Y,Nz,Mz,Fz,Pz,zU],HU=e=>VU.find(BU(e));function UU(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||NR(e)}var WU=new Set([`auto`,`none`,`0`]);function GU(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!WU.has(t)&&Yz(t)&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]!==i&&(e[r]=OV(n,i))}var KU=class extends aH{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}scheduleResolve(){if(this.canReadNow()&&(this.readKeyframes(),!this.needsMeasurement))return this.complete();super.scheduleResolve()}canReadNow(){let{unresolvedKeyframes:e,element:t,motionValue:n}=this,r=e[0]??n?.get();if(!t?.current||r===void 0)return!1;for(let t=0;t<e.length;t++)if(_z(t?e[t]:r))return!1;return!0}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),hz(r))){let i=vU(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!CU.has(n)||e.length!==2)return;let[r,i]=e;if(typeof r==`number`&&typeof i==`number`)return;let a=HU(r),o=HU(i);if(_z(r)!==_z(i)&&XV[n])this.needsMeasurement=!0;else if(a!==o){if(WV(a)&&WV(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else XV[n]&&(this.needsMeasurement=!0)}}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||UU(e[t]))&&n.push(t);n.length&&GU(e,n,t)}measure(){let{element:e,name:t}=this;return XV[t](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){let{element:e,unresolvedKeyframes:t}=this;if(!e||!e.current)return;this.motionValue?.jump(this.measuredOrigin,!1);let n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},qU=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function JU(e){return MR(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}function YU(e){return MR(e)&&`ownerSVGElement`in e}function XU(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}function ZU(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(UV.has(e))o=!0;else if(pz(e))i[e]=n;else{let t=NH(n,wV[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=IH(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var QU={offset:`stroke-dashoffset`,array:`stroke-dasharray`},$U={offset:`strokeDashoffset`,array:`strokeDasharray`};function eW(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?QU:$U;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var tW=[`transform`,`opacity`,`clipPath`,`filter`,`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function nW(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(ZU(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;for(let e of tW)d[e]!==void 0&&(f[e]=d[e],delete d[e]);(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&eW(d,i,a,o,!1)}function rW({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function iW({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function aW(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function oW(e){return e===void 0||e===1}function sW({scale:e,scaleX:t,scaleY:n}){return!oW(e)||!oW(t)||!oW(n)}function cW(e){return sW(e)||lW(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function lW(e){return uW(e.x)||uW(e.y)}function uW(e){return e&&e!==`0%`}function dW(e,t,n){return n+t*(e-n)}function fW(e,t,n,r,i){return i!==void 0&&(e=dW(e,i,r)),dW(e,n,r)+t}function pW(e,t=0,n=1,r,i){e.min=fW(e.min,t,n,r,i),e.max=fW(e.max,t,n,r,i)}function mW(e,{x:t,y:n}){pW(e.x,t.translate,t.scale,t.originPoint),pW(e.y,n.translate,n.scale,n.originPoint)}var hW=.999999999999,gW=1.0000000000001;function _W(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(vW(e.x,-a.scroll.offset.x),vW(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,mW(e,o)),r&&cW(a.latestValues)&&xW(e,a.latestValues,a.layout?.layoutBox))}t.x<gW&&t.x>hW&&(t.x=1),t.y<gW&&t.y>hW&&(t.y=1)}function vW(e,t){e.min+=t,e.max+=t}function yW(e,t,n,r,i=.5){pW(e,t,n,sB(e.min,e.max,i),r)}function bW(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function xW(e,t,n){let r=n??e;yW(e.x,bW(t.x,r.x),t.scaleX,t.scale,t.originX),yW(e.y,bW(t.y,r.y),t.scaleY,t.scale,t.originY)}function SW(e,t){return rW(aW(e.getBoundingClientRect(),t))}function CW(e,t,n){let r=SW(e,n),{scroll:i}=t;return i&&(vW(r.x,i.offset.x),vW(r.y,i.offset.y)),r}var{schedule:wW,cancel:Bae}=DB(queueMicrotask,!1),TW={x:!1,y:!1};function EW(){return TW.x||TW.y}function DW(e){return e===`x`||e===`y`?TW[e]?null:(TW[e]=!0,()=>{TW[e]=!1}):TW.x||TW.y?null:(TW.x=TW.y=!0,()=>{TW.x=TW.y=!1})}function OW(e,t){let n=XU(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function kW(e){return!(e.pointerType===`touch`||EW())}function AW(e,t,n={}){let[r,i,a]=OW(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{e.pointerType!==`touch`&&(n?r=!0:s(e))};e.addEventListener(`pointerenter`,n=>{if(!kW(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var jW=(e,t)=>t?e===t||jW(e,t.parentElement):!1,MW=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,NW=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function PW(e){return NW.has(e.tagName)||e.isContentEditable===!0}var FW=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function IW(e){return FW.has(e.tagName)||e.isContentEditable===!0}var LW=new WeakSet;function RW(e){return t=>{t.key===`Enter`&&e(t)}}function zW(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var BW=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=RW(()=>{if(LW.has(n))return;zW(n,`down`);let e=RW(()=>{zW(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>zW(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function VW(e){return MW(e)&&!EW()}var HW=new WeakSet;function UW(e,t,n={}){let[r,i,a]=OW(e,n),o=e=>{let r=e.currentTarget;if(!VW(e)||HW.has(e))return;LW.add(r),n.stopPropagation&&HW.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),LW.has(r)&&LW.delete(r),VW(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||jW(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),JU(e)&&(e.addEventListener(`focus`,e=>BW(e,i)),!PW(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}var WW=new WeakMap,GW,KW=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:YU(r)&&`getBBox`in r?r.getBBox()[t]:r[n],qW=KW(`inline`,`width`,`offsetWidth`),JW=KW(`block`,`height`,`offsetHeight`);function YW({target:e,borderBoxSize:t}){WW.get(e)?.forEach(n=>{n(e,{get width(){return qW(e,t)},get height(){return JW(e,t)}})})}function XW(e){e.forEach(YW)}function ZW(){typeof ResizeObserver<`u`&&(GW=new ResizeObserver(XW))}function QW(e,t){GW||ZW();let n=XU(e);return n.forEach(e=>{let n=WW.get(e);n||(n=new Set,WW.set(e,n)),n.add(t),GW?.observe(e)}),()=>{n.forEach(e=>{let n=WW.get(e);n?.delete(t),n?.size||GW?.unobserve(e)})}}var $W=new Set,eG;function tG(){eG=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};$W.forEach(t=>t(e))},window.addEventListener(`resize`,eG)}function nG(e){return $W.add(e),eG||tG(),()=>{$W.delete(e),!$W.size&&typeof eG==`function`&&(window.removeEventListener(`resize`,eG),eG=void 0)}}function rG(e,t){return typeof e==`function`?nG(e):QW(e,t)}var iG={value:null,addProjectionMetrics:null};function aG(e){return YU(e)&&e.tagName===`svg`}function oG(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=XB(i,a,o);return t?s(r):s}var sG=e=>typeof e==`number`?e:parseFloat(e),cG=()=>({translate:0,scale:1,origin:0,originPoint:0}),lG=()=>({x:cG(),y:cG()}),uG=()=>({min:0,max:0}),dG=()=>({x:uG(),y:uG()}),fG=new WeakMap;function pG(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function mG(e){return typeof e==`string`||Array.isArray(e)}var hG=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],gG=[`initial`,...hG];function _G(e){if(pG(e.animate))return!0;for(let t=0;t<gG.length;t++)if(mG(e[gG[t]]))return!0;return!1}function vG(e){return!!(_G(e)||e.variants)}function yG(e,t,n){for(let r in t){let i=t[r],a=n[r];if(OU(i))e.addValue(r,i);else if(OU(a))e.addValue(r,aU(i,{owner:e}));else if(a!==i){if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,aU(t===void 0?i:t,{owner:e}))}}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var bG={current:null},xG={current:!1},SG=typeof window<`u`;function CG(){if(xG.current=!0,SG){if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>bG.current=e.matches;e.addEventListener(`change`,t),t()}else bG.current=!1}}var wG=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],TG={};function EG(e){TG=e}function DG(){return TG}var OG=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=aH,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=uz.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,OB.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=_G(t),this.isVariantNode=vG(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&OU(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];if(this.current=e,fG.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.isVariantNode&&!this.isControllingVariants){let e=this;do e=e.props.inherit!==!1&&e.parent;while(e&&!e.isVariantNode);if(e){let{variantChildren:t}=e;t.add(this),this.removeFromVariantTree=()=>t.delete(this)}}this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(xG.current||CG(),this.shouldReduceMotion=bG.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),kB(this.notifyUpdate),kB(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&DH.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new vH({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:zR(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=UV.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&OB.preRender(this.notifyUpdate),n&&(this.projection&&(this.projection.isTransformDirty=!0),LH.get(this.current)?.check()),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in TG){let t=TG[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):dG()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){let{transformTemplate:n,onUpdate:r}=this.props;(e.transformTemplate||n)&&this.scheduleRender(),(e.transformTemplate&&!n||e.onUpdate&&!r)&&LH.get(this.current)?.demote(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<wG.length;t++){let n=wG[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=yG(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(e,t){let n=this.values.get(e);if(t!==n){n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t);let r=t.get();r!==void 0&&(this.latestValues[e]=r)}}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=aU(t??this.getDefaultValue?.(e),{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(jR(n)||NR(n))?n=parseFloat(n):typeof n!=`number`&&!rB.test(n)&&rB.test(t)&&(n=OV(e,t)),this.setBaseTarget(e,OU(n)?n.get():n)),OU(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return this.events[e]||(this.events[e]=new RR),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){wW.render(this.render)}},kG=class extends OG{constructor(){super(...arguments),this.KeyframeResolver=KU}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;OU(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},AG=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function jG(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}var MG={};function NG(e,{layout:t,layoutId:n}){return UV.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!MG[e]||e===`opacity`)}function PG(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(OU(r[t])||i&&OU(i[t])||NG(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function FG(e){return window.getComputedStyle(e)}var IG=class extends kG{constructor(){super(...arguments),this.type=`html`,this.renderInstance=jG}mount(e){e.style,super.mount(e)}readValueFromInstance(e,t){if(UV.has(t))return this.projection?.isProjecting?RV(t):BV(e,t);{let n=FG(e),r=(pz(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return SW(e,t)}build(e,t,n){ZU(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return PG(e,t,n)}},LG=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),RG=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function zG(e,t,n,r){jG(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(LG.has(n)?n:jU(n),t.attrs[n])}function BG(e,t,n){let r=PG(e,t,n);for(let n in e)if(n!==`children`&&(OU(e[n])||OU(t[n]))){let t=HV.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var VG=class extends kG{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=dG}getBaseTargetFromProps(e,t){return UV.has(t)?super.getBaseTargetFromProps(e,t)??RV(t):e[t]}getDefaultValue(e){return UV.has(e)?this.latestValues[e]??RV(e):void 0}readValueFromInstance(e,t){if(UV.has(t)){let e=EV(t);return e&&e.default||0}if(tW.includes(t)){let n=getComputedStyle(e)[t];if(typeof n==`string`&&n)return n.trim()}return t=LG.has(t)?t:jU(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return BG(e,t,n)}build(e,t,n){nW(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){zG(e,t,n,r)}mount(e){this.isSVGTag=RG(e.tagName),super.mount(e)}};function HG(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var UG=[...hG].reverse();function WG(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>RU(e,t,n))),n=KG(),r=!0,i=!1;function a(a){let{props:o,parent:s,manuallyAnimateOnMount:c}=e,l=r||i,u=[],d=new Set,f={},p=1/0,m=e;do m=m.props.inherit!==!1&&m.parent;while(m&&!m.isControllingVariants);if(UG.forEach((t,r)=>{let i=n[t],h=o[t],g=m&&m.props[t],_=h===void 0?mG(g)||g===!1?g:void 0:h,v=mG(_),y=t===a?i.isActive:null;y===!1&&(p=r);let b=v&&h===void 0&&!(l&&c);if(i.protectedKeys={...f},!i.isActive&&y===null||!_&&!i.prevProp||pG(_)||typeof _==`boolean`)return;if(t===`exit`&&i.isActive&&y!==!0){f={...f,...i.prevResolvedValues};return}let x=GG(i.prevProp,_),S=x||v&&(y&&!b||r>p),C=!1,w=Array.isArray(_)?_:[_],T={};if(y!==!1)for(let n of w){let{transition:r,transitionEnd:i,...a}=xU(e,n,SU(e,t))||{};T={...T,...a,...i}}let{prevResolvedValues:E}=i;for(let t in{...E,...T}){if(t in f)continue;let n=T[t],r=E[t],a=Array.isArray(n)&&Array.isArray(r)?!HG(n,r)||x:n!==r;if(a&&n==null)d.add(t);else if(a||n!==void 0&&d.has(t)){S=!0,d.delete(t)&&(C=!0),i.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)}else i.protectedKeys[t]=!0}if(i.prevProp=_,i.prevResolvedValues=T,i.isActive&&(f={...f,...T}),S&&(!(b&&x)||C))for(let n of w){let r={type:t};if(typeof n==`string`&&l&&c&&s?.enteringChildren){let t=xU(s,n)?.transition?.delayChildren;r.delay=eU(s.enteringChildren,e,t)}u.push({animation:n,options:r})}}),d.size){let{initial:t}=o,n={},r=typeof t!=`boolean`&&xU(e,Array.isArray(t)?t[0]:t,e.presenceContext?.custom);r&&r.transition&&(n.transition=r.transition),d.forEach(i=>{let a=e.getValue(i);a&&(a.liveStyle=!0);let s=r&&!Array.isArray(t)?r[i]:void 0,c=e.getBaseTargetFromProps(o,i);n[i]=(s===void 0?c!==void 0&&!OU(c)?c:e.initialValues[i]===void 0?e.baseTarget[i]:void 0:s)??null}),u.push({animation:n})}let h=l&&e.blockInitialAnimation||r&&!c&&(o.initial===!1||o.initial===o.animate);return r=i=!1,!h&&u.length?t(u):Promise.resolve()}function o(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=a(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:a,setActive:o,setAnimateFunction:n=>{t=n(e)},getState:()=>n,reset:()=>{n=KG(),i=!0}}}function GG(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!HG(t,e):!1}function KG(){let e={};for(let t of hG)e[t]={isActive:t===`animate`,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}function qG(e,t){e.min=t.min,e.max=t.max}function JG(e,t){qG(e.x,t.x),qG(e.y,t.y)}function YG(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var XG=.9999,ZG=1.0001,QG=-.01,$G=.01;function eK(e){return e.max-e.min}function tK(e,t,n){return Math.abs(e-t)<=n}function nK(e,t,n,r=.5){e.origin=r,e.originPoint=sB(t.min,t.max,e.origin),e.scale=eK(n)/eK(t),e.translate=sB(n.min,n.max,e.origin)-e.originPoint,(e.scale>=XG&&e.scale<=ZG||isNaN(e.scale))&&(e.scale=1),(e.translate>=QG&&e.translate<=$G||isNaN(e.translate))&&(e.translate=0)}function rK(e,t,n,r){nK(e.x,t.x,n.x,r?r.originX:void 0),nK(e.y,t.y,n.y,r?r.originY:void 0)}function iK(e,t,n,r=0){e.min=(r?sB(n.min,n.max,r):n.min)+t.min,e.max=e.min+eK(t)}function aK(e,t,n,r){iK(e.x,t.x,n.x,r?.x),iK(e.y,t.y,n.y,r?.y)}function oK(e,t,n,r=0){let i=r?sB(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+eK(t)}function sK(e,t,n,r){oK(e.x,t.x,n.x,r?.x),oK(e.y,t.y,n.y,r?.y)}function cK(e,t,n,r,i){return e-=t,e=dW(e,1/n,r),i!==void 0&&(e=dW(e,1/i,r)),e}function lK(e,t=0,n=1,r=.5,i,a=e,o=e){if(Nz.test(t)&&(t=parseFloat(t),t=sB(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=sB(a.min,a.max,r);e===a&&(s-=t),e.min=cK(e.min,t,n,s,i),e.max=cK(e.max,t,n,s,i)}function uK(e,t,[n,r,i],a,o){lK(e,t[n],t[r],t[i],t.scale,a,o)}var dK=[`x`,`scaleX`,`originX`],fK=[`y`,`scaleY`,`originY`];function pK(e,t,n,r){uK(e.x,t,dK,n?n.x:void 0,r?r.x:void 0),uK(e.y,t,fK,n?n.y:void 0,r?r.y:void 0)}function mK(e){return e.translate===0&&e.scale===1}function hK(e){return mK(e.x)&&mK(e.y)}function gK(e,t){return e.min===t.min&&e.max===t.max}function _K(e,t){return gK(e.x,t.x)&&gK(e.y,t.y)}function vK(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function yK(e,t){return vK(e.x,t.x)&&vK(e.y,t.y)}function bK(e){return eK(e.x)/eK(e.y)}function xK(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function SK(e){return[e(`x`),e(`y`)]}function CK(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var wK={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`){if(Y.test(e))e=parseFloat(e);else return e}return`${CK(e,t.target.x)}% ${CK(e,t.target.y)}%`}},TK={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=rB.parse(e);if(i.length>5)return r;let a=rB.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=sB(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}};function EK(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var DK=qU.length,OK=e=>typeof e==`number`||Y.test(e);function kK(e,t,n,r,i,a){i?(e.opacity=sB(0,n.opacity??1,jK(r)),e.opacityExit=sB(t.opacity??1,0,MK(r))):a&&(e.opacity=sB(t.opacity??1,n.opacity??1,r));for(let i=0;i<DK;i++){let a=qU[i],o=AK(t,a),s=AK(n,a);(o!==void 0||s!==void 0)&&(o||=0,s||=0,o===0||s===0||OK(o)===OK(s)?(e[a]=Math.max(sB(sG(o),sG(s),r),0),(Nz.test(s)||Nz.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=sB(t.rotate||0,n.rotate||0,r))}function AK(e,t){return e[t]===void 0?e.borderRadius:e[t]}var jK=NK(0,.5,ZR),MK=NK(.5,.95,FR);function NK(e,t,n){return r=>r<e?0:r>t?1:n(LR(e,t,r))}function PK(e,t,n){let r=OU(e)?e:aU(e);return r.start(hU(``,r,t,n)),r.animation}function FK(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var IK=(e,t)=>e.depth-t.depth,LK=class{constructor(){this.children=[],this.isDirty=!1}add(e){ER(this.children,e),this.isDirty=!0}remove(e){DR(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(IK),this.isDirty=!1,this.children.forEach(e)}};function RK(e,t){let n=uz.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(kB(r),e(a-t))};return OB.setup(r,!0),()=>kB(r)}function zK(e){return OU(e)?e.get():e}var BK=class{constructor(){this.members=[]}add(e){ER(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(DR(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(DR(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},VK={borderRadius:{...wK,applyTo:[...qU]},borderTopLeftRadius:wK,borderTopRightRadius:wK,borderBottomLeftRadius:wK,borderBottomRightRadius:wK,boxShadow:TK},HK={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(MG,{...VK,...MG});var UK={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},WK=[``,`X`,`Y`,`Z`],GK=1e3,KK=0;function qK(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}var JK=({instance:e})=>e&&LH.get(e)?.demote();function YK(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=NU(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,OB,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&YK(r)}function XK({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=KK++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,iG.value&&(UK.nodes=UK.calculatedTargetDeltas=UK.calculatedProjections=0),this.nodes.forEach($K),this.nodes.forEach(uq),this.nodes.forEach(dq),this.nodes.forEach(eq),iG.addProjectionMetrics&&iG.addProjectionMetrics(UK)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new LK)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new RR),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=YU(t)&&!aG(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;OB.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=RK(i,250),HK.hasAnimatedSinceResize&&(HK.hasAnimatedSinceResize=!1,this.nodes.forEach(lq)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isAnimationBlocked){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||vq,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!yK(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...sU(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||lq(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),kB(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(fq),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&YK(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;JK(this),this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,JK(t),(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1),t.isAnimationBlocked&&(t.dragSnapshot||=t.measure(),this.dragAncestor=t)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(rq),this.nodes.forEach(nq);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(iq);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(oq),this.nodes.forEach(sq),this.nodes.forEach(cq),this.nodes.forEach(ZK),this.nodes.forEach(QK)):this.nodes.forEach(iq),this.clearAllSnapshots();let e=uz.now();sz.delta=kR(0,1e3/60,e-sz.timestamp),sz.timestamp=e,sz.isProcessing=!0,AB.update.process(sz),AB.preRender.process(sz),AB.render.process(sz),sz.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,wW.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(tq),this.sharedNodes.forEach(pq)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,OB.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){OB.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),this.snapshot&&!eK(this.snapshot.measuredBox.x)&&!eK(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected||=dG(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout;e&&JK(this);let t=this.projectionDelta&&!hK(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||cW(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),Sq(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return dG();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(wq))){let{scroll:e}=this.root;e&&(vW(t.x,e.offset.x),vW(t.y,e.offset.y))}return t}removeElementScroll(e){let t=dG();if(JG(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&JG(t,e),vW(t.x,i.offset.x),vW(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||dG();JG(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(vW(r.x,-n.scroll.offset.x),vW(r.y,-n.scroll.offset.y)),cW(n.latestValues)&&xW(r,n.latestValues,n.layout?.layoutBox)}return cW(this.latestValues)&&xW(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=dG();JG(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!cW(n.latestValues))continue;let r;n.instance&&(sW(n.latestValues)&&n.updateSnapshot(),r=dG(),JG(r,n.measurePageBox())),pK(t,n.latestValues,n.snapshot?.layoutBox,r)}return cW(this.latestValues)&&pK(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==sz.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=sz.timestamp;let a=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=dG(),this.targetWithTransforms=dG()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),aK(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):JG(this.target,this.layout.layoutBox),mW(this.target,this.targetDelta)):JG(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),iG.value&&UK.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||sW(this.parent.latestValues)||lW(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dG(),this.relativeTargetOrigin=dG(),sK(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),JG(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===sz.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;JG(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;_W(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=dG());let{target:s}=e;s?(!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(YG(this.prevProjectionDelta.x,this.projectionDelta.x),YG(this.prevProjectionDelta.y,this.projectionDelta.y)),rK(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!xK(this.projectionDelta.x,this.prevProjectionDelta.x)||!xK(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),iG.value&&UK.calculatedProjections++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=lG(),this.projectionDelta=lG(),this.projectionDeltaWithTransform=lG()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=lG();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=dG(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!(!c||u||this.options.crossfade!==!0||this.path.some(_q));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=sB(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=sB(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(mq(o.x,e.x,n),mq(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sK(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),gq(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&_K(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=dG(),JG(f,this.relativeTarget)),c&&(this.animationValues=a,kK(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(kB(this.pendingAnimation),void 0),this.pendingAnimation=OB.update(()=>{HK.hasAnimatedSinceResize=!0,this.motionValue||=aU(0),this.motionValue.jump(0,!1),this.currentAnimation=PK(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),pV(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(GK),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,layout:n,latestValues:r}=e,{target:i}=e;if(t&&i&&n){if(this!==e&&this.layout&&n&&Cq(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||dG();let t=eK(this.layout.layoutBox.x);i.x.min=e.target.x.min,i.x.max=i.x.min+t;let n=eK(this.layout.layoutBox.y);i.y.min=e.target.y.min,i.y.max=i.y.min+n}JG(t,i),xW(t,r),rK(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new BK),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&qK(`z`,e,r,this.animationValues);for(let t=0;t<WK.length;t++)qK(`rotate${WK[t]}`,e,r,this.animationValues),qK(`skew${WK[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=zK(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=zK(t?.pointerEvents)||``),this.hasProjected&&!cW(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=EK(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,e.opacity=r.animationValues?r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in MG){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=MG[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?zK(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=this.dragSnapshot=this.dragAncestor=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(nq),this.root.sharedNodes.clear()}}}function ZK(e){e.updateLayout(),aq(e)}function QK(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)SK(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=eK(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;qG(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else Cq(i,t.layoutBox,n)&&SK(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=eK(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=lG();rK(o,n,t.layoutBox);let s=lG();a?rK(s,e.applyTransform(r,!0),t.measuredBox):rK(s,n,t.layoutBox);let c=!hK(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=dG();sK(s,t.layoutBox,i.layoutBox,o);let c=dG();sK(c,n,a.layoutBox,o),yK(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function $K(e){iG.value&&UK.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function eq(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function tq(e){e.clearSnapshot()}function nq(e){e.clearMeasurements()}function rq(e){e.isLayoutDirty=!0,e.updateLayout()}function iq(e){e.isLayoutDirty=!1}function aq(e){let{snapshot:t,dragAncestor:n}=e,r=n?.layout;if(!t||!r||e.resumeFrom||e.isAnimationBlocked)return;let i=n.dragSnapshot;SK(e=>vW(t.layoutBox[e],r.layoutBox[e].min-i.layoutBox[e].min))}function oq(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.dragSnapshot||e.layout,e.isLayoutDirty=!0)}function sq(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function cq(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function lq(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function uq(e){e.resolveTargetDelta()}function dq(e){e.calcProjection()}function fq(e){e.resetSkewAndRotation()}function pq(e){e.removeLeadSnapshot()}function mq(e,t,n){e.translate=sB(t.translate,0,n),e.scale=sB(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function hq(e,t,n,r){e.min=sB(t.min,n.min,r),e.max=sB(t.max,n.max,r)}function gq(e,t,n,r){hq(e.x,t.x,n.x,r),hq(e.y,t.y,n.y,r)}function _q(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var vq={duration:.45,ease:[.4,0,.1,1]},yq=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),bq=yq(`applewebkit/`)&&!yq(`chrome/`)?Math.round:FR;function xq(e){e.min=bq(e.min),e.max=bq(e.max)}function Sq(e){xq(e.x),xq(e.y)}function Cq(e,t,n){return e===`position`||e===`preserve-aspect`&&!tK(bK(t),bK(n),.2)}function wq(e){return e!==e.root&&e.scroll?.wasRoot}var Tq=XK({attachResizeListener:(e,t)=>FK(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Eq={current:void 0},Dq=XK({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Eq.current){let e=new Tq({});e.mount(window),e.setOptions({layoutScroll:!0}),Eq.current=e}return Eq.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),Oq=(0,P.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function kq(e=!0){let t=(0,P.useContext)(TR);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,P.useId)();(0,P.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,P.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var Aq=(0,P.createContext)({strict:!1}),jq={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Mq=!1;function Nq(){if(Mq)return;let e={};for(let t in jq)e[t]={isEnabled:e=>jq[t].some(t=>!!e[t])};EG(e),Mq=!0}function Pq(){return Nq(),DG()}function Fq(e){let t=Pq();for(let n in e)t[n]={...t[n],...e[n]};EG(t)}var Iq=(0,P.createContext)({});function Lq(e,t){if(_G(e)){let{initial:t,animate:n}=e;return{initial:t===!1||mG(t)?t:void 0,animate:mG(n)?n:void 0}}return e.inherit===!1?{}:t}function Rq(e){let{initial:t,animate:n}=Lq(e,(0,P.useContext)(Iq));return(0,P.useMemo)(()=>({initial:t,animate:n}),[zq(t),zq(n)])}function zq(e){return Array.isArray(e)?e.join(` `):e}var Bq=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Vq(e,t,n){for(let r in t)!OU(t[r])&&!NG(r,n)&&(e[r]=t[r])}function Hq({transformTemplate:e},t){return(0,P.useMemo)(()=>{let n=Bq();return ZU(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Uq(e,t){let n=e.style||{},r={};return Vq(r,n,e),Object.assign(r,Hq(e,t)),r}function Wq(e,t){let n={},r=Uq(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Gq=()=>({...Bq(),attrs:{}});function Kq(e,t,n,r){let i=(0,P.useMemo)(()=>{let n=Gq();return nW(n,t,RG(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};Vq(t,e.style,e),i.style={...t,...i.style}}return i}var qq=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function Jq(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||qq.has(e)}function Yq(e,t){return e.startsWith(`on`)?!Jq(e):t?.(e)??!Jq(e)}function Xq(e,t,n,r){let i={};for(let a in e)(a!==`values`||typeof e.values!=`object`)&&(OU(e[a])||(Yq(a,r)||n===!0&&Jq(a)||!t&&!Jq(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]));return i}var Zq=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Qq(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Zq.indexOf(e)>-1||/[A-Z]/u.test(e))}function $q(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??Qq(e)?Kq:Wq)(t,r,i,e),l=Xq(t,typeof e==`string`,a,s),u=e===P.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,P.useMemo)(()=>OU(d)?d.get():d,[d]);return(0,P.createElement)(e,{...u,children:f})}function eJ({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:tJ(n,r,i,e),renderState:t()}}function tJ(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=zK(a[e]);let{initial:o,animate:s}=e,c=_G(e),l=vG(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!pG(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=bU(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var nJ=e=>(t,n)=>{let r=(0,P.useContext)(Iq),i=(0,P.useContext)(TR),a=()=>eJ(e,t,r,i);return n?a():CR(a)},rJ=nJ({scrapeMotionValuesFromProps:PG,createRenderState:Bq}),iJ=nJ({scrapeMotionValuesFromProps:BG,createRenderState:Gq}),aJ=Symbol.for(`motionComponentSymbol`);function oJ(e,t,n){let r=(0,P.useRef)(n);(0,P.useInsertionEffect)(()=>{r.current=n});let i=(0,P.useRef)(null);return(0,P.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`){if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n)}else a&&(a.current=n)},[t])}var sJ=(0,P.createContext)({});function cJ(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function lJ(e,t,n,r,i,a){let{visualElement:o}=(0,P.useContext)(Iq),s=(0,P.useContext)(Aq),c=(0,P.useContext)(TR),l=(0,P.useContext)(Oq),u=l.reducedMotion,d=l.skipAnimations,f=(0,P.useRef)(null),p=(0,P.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,P.useContext)(sJ);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&uJ(f.current,n,i,h);let g=(0,P.useRef)(!1);(0,P.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[MU],v=(0,P.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return wR(()=>{p.current&&m&&(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),wR(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,P.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function uJ(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:dJ(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&cJ(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function dJ(e){if(e)return e.options.allowProjection===!1?dJ(e.parent):e.projection}function fJ(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Fq(r);let a=n?n===`svg`:Qq(e),o=a?iJ:rJ;function s(n,s){let c,l={...(0,P.useContext)(Oq),...n,layoutId:pJ(n)},{isStatic:u,isValidProp:d}=l,f=Rq(n),p=o(n,u);if(!u&&typeof window<`u`){mJ(l,r);let t=hJ(l);c=t.MeasureLayout,f.visualElement=lJ(e,p,l,i,t.ProjectionNode,a)}return(0,F.jsxs)(Iq.Provider,{value:f,children:[c&&f.visualElement?(0,F.jsx)(c,{visualElement:f.visualElement,...l}):null,$q(e,n,oJ(p,f.visualElement,s),p,u,t,a,d)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,P.forwardRef)(s);return c[aJ]=e,c}function pJ({layoutId:e}){let t=(0,P.useContext)(SR).id;return t&&e!==void 0?t+`-`+e:e}function mJ(e,t){(0,P.useContext)(Aq).strict}function hJ(e){let{drag:t,layout:n}=Pq();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function gJ(e,t){if(typeof Proxy>`u`)return fJ;let n=new Map,r=(n,r)=>fJ(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,fJ(a,void 0,e,t)),n.get(a))})}var _J=(e,t)=>t.isSVG??Qq(e)?new VG(t):new IG(t,{allowProjection:e!==P.Fragment}),vJ=class extends AG{constructor(e){super(e),e.animationState||=WG(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();pG(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},yJ=0,bJ={animation:{Feature:vJ},exit:{Feature:class extends AG{constructor(){super(...arguments),this.id=yJ++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=xU(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function xJ(e){return{point:{x:e.pageX,y:e.pageY}}}var SJ=e=>t=>MW(t)&&e(t,xJ(t));function CJ(e,t,n,r){return FK(e,t,SJ(n),r)}var wJ=({current:e})=>e?e.ownerDocument.defaultView:null,TJ=(e,t)=>Math.abs(e-t);function EJ(e,t){let n=TJ(e.x,t.x),r=TJ(e.y,t.y);return Math.sqrt(n**2+r**2)}var DJ=new Set([`auto`,`scroll`]),OJ=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=kJ(this.lastRawMoveEventInfo,this.transformPagePoint));let e=jJ(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=EJ(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e;this.history.push({...r,timestamp:uz.now()});let{onStart:i,onMove:a}=this.handlers;t||(i&&i(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=kJ(t,this.transformPagePoint),this.hasPendingMove=!0,OB.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.hasPendingMove&&this.updatePoint(),this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=jJ(e.type===`pointercancel`?this.lastMoveEventInfo:kJ(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!MW(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=kJ(xJ(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=sz;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,jJ(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=IR(CJ(this.contextWindow,`pointermove`,this.handlePointerMove,d),CJ(this.contextWindow,`pointerup`,this.handlePointerUp,d),CJ(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(DJ.has(e.overflowX)||DJ.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};(i.x!==0||i.y!==0)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),OB.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),kB(this.updatePoint)}};function kJ(e,t){return t?{point:t(e.point)}:e}function AJ(e,t){return{x:e.x-t.x,y:e.y-t.y}}function jJ({point:e},t){return{point:e,delta:AJ(e,NJ(t)),offset:AJ(e,MJ(t)),velocity:PJ(t,.1)}}function MJ(e){return e[0]}function NJ(e){return e[e.length-1]}function PJ(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=NJ(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>zR(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>zR(t)*2&&(r=e[1]);let a=BR(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function FJ(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?sB(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?sB(n,e,r.max):Math.min(e,n)),e}function IJ(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function LJ(e,{top:t,left:n,bottom:r,right:i}){return{x:IJ(e.x,n,i),y:IJ(e.y,t,r)}}function RJ(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function zJ(e,t){return{x:RJ(e.x,t.x),y:RJ(e.y,t.y)}}function BJ(e,t){let n=.5,r=eK(e),i=eK(t);return i>r?n=LR(t.min,t.max-r,e.min):r>i&&(n=LR(e.min,e.max-i,t.min)),kR(0,1,n)}function VJ(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var HJ=.35;function UJ(e=HJ){return e===!1?e=0:e===!0&&(e=HJ),{x:WJ(e,`left`,`right`),y:WJ(e,`top`,`bottom`)}}function WJ(e,t,n){return{min:GJ(e,t),max:GJ(e,n)}}function GJ(e,t){return typeof e==`number`?e:e[t]||0}var KJ=new WeakMap,qJ=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=dG(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(e),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=DW(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),SK(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Nz.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=eK(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&OB.update(()=>i(e,t),!1,!0),AU(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;r&&this.currentDirection===null?(this.currentDirection=ZJ(o),this.currentDirection!==null&&i&&i(this.currentDirection)):(this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&OB.update(()=>a(e,t),!1,!0))},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new OJ(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:wJ(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&OB.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!XJ(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=FJ(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&cJ(e)?this.constraints||=this.resolveRefConstraints():this.constraints=e&&n?LJ(n.layoutBox,e):!1,this.elastic=UJ(t),r!==this.constraints&&!cJ(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&SK(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=VJ(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!cJ(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=CW(n,r.root,this.visualElement.getTransformPagePoint()),a=zJ(r.layout.layoutBox,i);if(t){let e=t(iW(a));this.hasMutatedConstraints=!!e,e&&(a=rW(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=SK(o=>{if(!XJ(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return AU(this.visualElement,e),n.start(hU(e,n,0,t,this.visualElement,!1))}stopAnimation(){SK(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){let{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,a=this.visualElement.measureViewportBox();SK(e=>{if(!XJ(e,n,this.currentDirection))return;let t=this.getAxisMotionValue(e),{min:r,max:o}=a[e];t.set((t.get()||0)+i[e]-sB(r,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!cJ(t)||!n||!this.constraints)return;this.stopAnimation();let r=this.constraints,i={x:0,y:0};SK(e=>{let t=this.getAxisMotionValue(e).get();i[e]=BJ({min:t,max:t},r[e])});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),SK(t=>{let n=this.getAxisMotionValue(t);if(!XJ(t,e,null)||!n.get())return;let{min:r,max:a}=this.constraints[t];n.set(sB(r,a,i[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;KJ.set(this.visualElement,this);let e=this.visualElement.current,t=CJ(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&IW(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();cJ(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=YJ(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),OB.read(r);let o=FK(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(SK(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=HJ,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function JJ(e){let t=!0;return()=>{t?t=!1:e()}}function YJ(e,t,n){let r=rG(e,JJ(n)),i=rG(t,JJ(n));return()=>{r(),i()}}function XJ(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function ZJ(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var QJ=class extends AG{constructor(e){super(e),this.removeGroupControls=FR,this.removeListeners=FR,this.controls=new qJ(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||FR}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},$J=e=>(t,n)=>{e&&OB.update(()=>e(t,n),!1,!0)},eY=class extends AG{constructor(){super(...arguments),this.removePointerDownListener=FR}onPointerDown(e){this.session=new OJ(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:wJ(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:$J(e),onStart:$J(t),onMove:$J(n),onEnd:(e,t)=>{delete this.session,r&&OB.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=CJ(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},tY=!1,nY=class extends P.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),tY&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),HK.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a&&(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),tY=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||OB.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),wW.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;tY=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function rY(e){let[t,n]=kq(),r=(0,P.useContext)(SR);return(0,F.jsx)(nY,{...e,layoutGroup:r,switchLayoutGroup:(0,P.useContext)(sJ),isPresent:t,safeToRemove:n})}var iY={pan:{Feature:eY},drag:{Feature:QJ,ProjectionNode:Dq,MeasureLayout:rY}};function aY(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&OB.postRender(()=>i(t,xJ(t)))}var oY=class extends AG{mount(){let{current:e}=this.node;e&&(this.unmount=AW(e,(e,t)=>(aY(this.node,t,`Start`),e=>aY(this.node,e,`End`))))}unmount(){}},sY=class extends AG{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}e&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=IR(FK(this.node.current,`focus`,()=>this.onFocus()),FK(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function cY(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&OB.postRender(()=>i(t,xJ(t)))}var lY=class extends AG{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=UW(e,(e,t)=>(cY(this.node,t,`Start`),(e,{success:t})=>cY(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},uY=new WeakMap,dY=new WeakMap,fY=e=>{let t=uY.get(e.target);t&&t(e)},pY=e=>{e.forEach(fY)};function mY({root:e,...t}){let n=e||document;dY.has(n)||dY.set(n,{});let r=dY.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(pY,{root:e,...t})),r[i]}function hY(e,t,n){let r=mY(t);return uY.set(e,n),r.observe(e),()=>{uY.delete(e),r.unobserve(e)}}var gY={some:0,all:1},_Y=class extends AG{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:gY[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=hY(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(vY(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function vY({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var yY={inView:{Feature:_Y},tap:{Feature:lY},focus:{Feature:sY},hover:{Feature:oY}},bY={layout:{ProjectionNode:Dq,MeasureLayout:rY}},xY=gJ({...bJ,...yY,...iY,...bY},_J);function SY(e){let t=CR(()=>aU(e)),{isStatic:n}=(0,P.useContext)(Oq);if(n){let[,n]=(0,P.useState)(e);(0,P.useEffect)(()=>t.on(`change`,n),[])}return t}function CY(e,t){let n=SY(t()),r=()=>n.set(t());return r(),wR(()=>{let t=()=>OB.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return r(),()=>{n.forEach(e=>e()),kB(r)}}),n}function wY(e){rU.current=[],e();let t=CY(rU.current,e);return rU.current=void 0,t}function TY(e,t,n,r){if(typeof e==`function`)return wY(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return DY(e,t,n,r);let i=typeof t==`function`?t:oG(t,n,r),a=Array.isArray(e)?EY(e,i):EY([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;if(o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1){let e=r?.ease;a.accelerate={...o,times:[0,...t,1],keyframes:[n[0],...n,n[n.length-1]],isTransformed:!0,...e?{ease:Array.isArray(e)?[e[0],...e]:e}:{}}}return a}function EY(e,t){let n=CR(()=>[]);return CY(e,()=>{n.length=0;let r=e.length;for(let t=0;t<r;t++)n[t]=e[t].get();return t(n)})}function DY(e,t,n,r){let i=CR(()=>Object.keys(n)),a=CR(()=>({}));for(let o of i)a[o]=TY(e,t,n[o],r);return a}var OY=class{constructor(){this.componentControls=new Set}subscribe(e){return this.componentControls.add(e),()=>this.componentControls.delete(e)}start(e,t){this.componentControls.forEach(n=>{n.start(e.nativeEvent||e,t)})}cancel(){this.componentControls.forEach(e=>{e.cancel()})}stop(){this.componentControls.forEach(e=>{e.stop()})}},kY=()=>new OY;function AY(){return CR(kY)}var jY=(0,P.createContext)(null);function MY(e,t,n,r,i,a=`ltr`){let o=e.findIndex(e=>e.value===t);if(o===-1)return e;if(i===`xy`){let{layout:t}=e[o],r={x:sB(t.x.min,t.x.max,.5)+n.x,y:sB(t.y.min,t.y.max,.5)+n.y},i=NY(e),s=i.find(t=>t.items.includes(e[o])),c=i.reduce((e,t)=>PY(r.y,t)<PY(r.y,e)?t:e);if(c!==s)return FY(e,o,r.x,c,a);let l=IY(r,t),u=-1,d=l;return e.forEach((e,t)=>{if(t===o)return;let n=IY(r,e.layout);n<d&&(u=t,d=n)}),u===-1?e:OR(e,o,o+Math.sign(u-o))}if(!r[i])return e;let s=r[i]>0?1:-1,c=e[o+s];if(!c)return e;let l=e[o].layout[i],u=c.layout[i],d=sB(u.min,u.max,.5);return s===1&&l.max+n[i]>d||s===-1&&l.min+n[i]<d?OR(e,o,o+s):e}function NY(e){let t=[];return e.forEach(e=>{let{min:n,max:r}=e.layout.y,i=t[t.length-1];!i||n>=i.max||r<=i.min?t.push({items:[e],min:n,max:r}):(i.items.push(e),i.min=Math.min(i.min,n),i.max=Math.max(i.max,r))}),t}function PY(e,t){return e<t.min?t.min-e:e>t.max?e-t.max:0}function FY(e,t,n,r,i){let a=e.filter((e,n)=>n!==t),o=r.items.find(e=>{let t=sB(e.layout.x.min,e.layout.x.max,.5);return i===`ltr`?n<t:n>t}),s=o?a.indexOf(o):a.indexOf(r.items[r.items.length-1])+1,c=[...a];return c.splice(s,0,e[t]),c.every((t,n)=>t===e[n])?e:c}function IY(e,t){let n=Math.max(t.x.min-e.x,0,e.x-t.x.max),r=Math.max(t.y.min-e.y,0,e.y-t.y.max);return n*n+r*r}var LY=(e,t)=>e.max<=t.min||t.max<=e.min;function RY(e){let t=!1,n=!1;for(let r=0;r<e.length;r++)for(let i=r+1;i<e.length;i++)if(t||=LY(e[r].x,e[i].x),n||=LY(e[r].y,e[i].y),t&&n)return`xy`;return t?`x`:`y`}function zY({children:e,as:t=`ul`,axis:n,onReorder:r,values:i,onPointerDownCapture:a,onClickCapture:o,...s},c){let l=CR(()=>xY[t]),u=(0,P.useRef)(new Map),[d,f]=(0,P.useState)(`y`),p=(0,P.useRef)(!1),m=(0,P.useRef)(!1),h=(0,P.useRef)(null),g=n||d,_=new Set(i);u.current.forEach((e,t)=>{_.has(t)||u.current.delete(t)});let v={axis:g,groupRef:h,hasReordered:m,registerItem:(e,t)=>{if(u.current.set(e,t),!n){let e=RY(i.flatMap(e=>{let t=u.current.get(e);return t?[t]:[]}));e!==d&&f(e)}},updateOrder:(e,t,n)=>{if(p.current)return;let a=i.flatMap(e=>{let t=u.current.get(e);return t?[{value:e,layout:t}]:[]}),o=h.current?.ownerDocument.defaultView?.getComputedStyle(h.current).direction===`rtl`?`rtl`:`ltr`,s=MY(a,e,t,n,g,o);if(a!==s){p.current=!0,m.current=!0;let e=[...i],t=a.map(({value:e})=>i.indexOf(e));s.forEach(({value:n},r)=>{e[t[r]]=n}),r(e)}}};(0,P.useEffect)(()=>{p.current=!1},[i]);let y=e=>{h.current=e,typeof c==`function`?c(e):c&&(c.current=e)},b={overflowAnchor:`none`,...s.style};return(0,F.jsx)(l,{...s,style:b,ref:y,onPointerDownCapture:e=>{m.current=!1,a?.(e)},onClickCapture:e=>{m.current&&e.detail&&(m.current=!1,e.stopPropagation(),e.preventDefault()),o?.(e)},ignoreStrict:!0,children:(0,F.jsx)(jY.Provider,{value:v,children:e})})}var BY=(0,P.forwardRef)(zY),VY=50,HY=25,UY=new Set([`auto`,`scroll`]),WY=new WeakMap,GY=new WeakMap,KY=null;function qY(){if(KY){let e=YY(KY,`y`);e&&(GY.delete(e),WY.delete(e));let t=YY(KY,`x`);t&&t!==e&&(GY.delete(t),WY.delete(t)),KY=null}}function JY(e,t){let n=getComputedStyle(e),r=t===`x`?n.overflowX:n.overflowY,i=e===document.body||e===document.documentElement;return UY.has(r)||i}function YY(e,t){let n=e?.parentElement;for(;n;){if(JY(n,t))return n;n=n.parentElement}return null}function XY(e,t,n){let r=t.getBoundingClientRect(),i=n===`x`?Math.max(0,r.left):Math.max(0,r.top),a=n===`x`?Math.min(window.innerWidth,r.right):Math.min(window.innerHeight,r.bottom),o=e-i,s=a-e;if(o<VY){let e=1-o/VY;return{amount:-25*e*e,edge:`start`}}if(s<VY){let e=1-s/VY;return{amount:HY*e*e,edge:`end`}}return{amount:0,edge:null}}function ZY(e,t,n,r){if(!e)return;KY=e;let i=YY(e,n);if(!i)return;let{amount:a,edge:o}=XY(t-(n===`x`?window.scrollX:window.scrollY),i,n);if(o===null){GY.delete(i),WY.delete(i);return}let s=GY.get(i),c=i===document.body||i===document.documentElement;if(s!==o){if(!(o===`start`&&r<0||o===`end`&&r>0))return;GY.set(i,o);let e=n===`x`?i.scrollWidth-(c?window.innerWidth:i.clientWidth):i.scrollHeight-(c?window.innerHeight:i.clientHeight);WY.set(i,e)}if(a>0){let e=WY.get(i);if((n===`x`?c?window.scrollX:i.scrollLeft:c?window.scrollY:i.scrollTop)>=e)return}n===`x`?c?window.scrollBy({left:a}):i.scrollLeft+=a:c?window.scrollBy({top:a}):i.scrollTop+=a}function QY(e,t=0){return OU(e)?e:SY(t)}function $Y({children:e,style:t={},value:n,as:r=`li`,onDrag:i,onDragEnd:a,layout:o=!0,...s},c){let l=CR(()=>xY[r]),u=(0,P.useContext)(jY),d={x:QY(t.x),y:QY(t.y)},f=TY([d.x,d.y],([e,t])=>e||t?1:`unset`),{axis:p,registerItem:m,updateOrder:h,groupRef:g,hasReordered:_}=u;return(0,F.jsx)(l,{drag:p===`xy`||p,...s,dragSnapToOrigin:!0,style:{...t,x:d.x,y:d.y,zIndex:f},layout:o,onDrag:(e,t)=>{let{velocity:r,point:a}=t,o={x:d.x.get(),y:d.y.get()};h(n,o,r);let s=p===`xy`?Math.abs(r.x)>Math.abs(r.y)?`x`:`y`:p;ZY(g.current,a[s],s,r[s]),i&&i(e,t)},onDragEnd:(e,t)=>{_.current=!1,qY(),a&&a(e,t)},onLayoutMeasure:e=>{m(n,e)},ref:c,ignoreStrict:!0,children:e})}var eX=(0,P.forwardRef)($Y);function tX(e){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(``),[c,u]=(0,P.useState)(``),[d,f]=(0,P.useState)(null);return(0,F.jsxs)(`form`,{className:`grid`,onSubmit:async n=>{n.preventDefault(),f(null);try{if(t)await h9([d9(a).address],c.trim()===``?null:c.trim());else{let e=d9(r);await h9([e.address],e.code)}e.onAdded?.()}catch(e){f(s(e))}},children:[(0,F.jsxs)(`div`,{className:l(`grid gap-2`,e.fieldsClassName),children:[t?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(cL,{"aria-label":`Server URL`,placeholder:`Server URL, e.g. http://127.0.0.1:47841`,spellCheck:!1,autoComplete:`off`,value:a,onChange:e=>o(e.target.value)}),(0,F.jsx)(cL,{"aria-label":`Pairing code`,placeholder:`Pairing code, empty if auth is off`,spellCheck:!1,autoComplete:`off`,value:c,onChange:e=>u(e.target.value)})]}):(0,F.jsx)(cL,{"aria-label":`Pairing link`,placeholder:`Pairing link`,spellCheck:!1,autoComplete:`off`,value:r,onChange:e=>i(e.target.value)}),d!==null&&(0,F.jsx)(`p`,{className:`text-destructive text-sm break-all`,children:d}),(0,F.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground w-fit cursor-pointer text-xs`,onClick:()=>{n(!t),f(null)},children:t?`Paste a pairing link instead`:`Enter the server URL and code separately`})]}),e.actions(t?a.trim()!==``:r.trim()!==``)]})}function nX(e){return(0,F.jsx)(Xe,{open:!0,onOpenChange:()=>e.onClose(),children:(0,F.jsxs)(Je,{className:`gap-0 overflow-hidden p-0 sm:max-w-md`,children:[(0,F.jsxs)(Ke,{className:`gap-1 px-6 pt-4 pr-12`,children:[(0,F.jsx)(Ye,{className:`text-base`,children:`Add machine`}),(0,F.jsx)(He,{children:`Paste the pairing link that OffSite printed when it started.`})]}),(0,F.jsx)(tX,{fieldsClassName:`p-6`,onAdded:e.onClose,actions:t=>(0,F.jsxs)(Fe,{className:`bg-muted/40 border-t px-6 py-4`,children:[(0,F.jsx)(E,{type:`button`,variant:`outline`,onClick:e.onClose,children:`Cancel`}),(0,F.jsx)(E,{type:`submit`,disabled:!t,children:`Add machine`})]})})]})})}var rX={connecting:`Connecting…`,online:`Online`,offline:`Offline`,unpaired:`Needs pairing`};function iX(){let e=Q(e=>e.machines),t=Q(e=>e.machines.find(t=>t.id===e.settingsEditedMachine)),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(null),o=i===null?e:[...e].sort((e,t)=>i.indexOf(e.id)-i.indexOf(t.id));return t===void 0?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)($L,{title:`Machines`,note:`This browser connects to each one directly. The list stays in this browser`,children:(0,F.jsx)(BY,{as:`div`,axis:`y`,className:`divide-y`,values:o.map(e=>e.id),onReorder:a,children:o.map(e=>(0,F.jsxs)(oX,{value:e.id,disabled:!1,className:`min-h-13 gap-4`,onDragEnd:()=>{i!==null&&gue(i),a(null)},children:[(0,F.jsx)(k,{icon:Wg[e.icon],className:`text-muted-foreground size-5 shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.name}),e.addresses.map(e=>(0,F.jsx)(`p`,{className:`text-muted-foreground truncate font-mono text-xs`,children:e},e)),e.providers.filter(e=>e.state===`error`).map(e=>(0,F.jsxs)(`p`,{className:`text-destructive truncate text-xs`,title:e.error??void 0,children:[lC[e.provider],` threads: `,e.error]},e.provider))]}),(0,F.jsxs)(`span`,{className:`text-muted-foreground shrink-0 text-xs`,children:[rX[e.status],e.status===`online`&&e.via!==null&&e.via!==e.addresses[0]&&` · via ${new URL(e.via).host}`]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Reconnect, trying the first address first`,onClick:()=>b9(e.id),children:(0,F.jsx)(k,{icon:Dh})}),(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost-muted`,title:`Open machine`,onClick:()=>$({settingsEditedMachine:e.id}),children:(0,F.jsx)(k,{icon:ym})})]})]},e.id))})}),(0,F.jsx)(`div`,{className:`flex gap-2`,children:(0,F.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>r(!0),children:`Add machine…`})}),n&&(0,F.jsx)(nX,{onClose:()=>r(!1)})]}):(0,F.jsx)(aX,{machine:t})}function aX(e){let t=e.machine,[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(``),[o,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(null),d=l??t.addresses,f=t.addresses.some(e=>l9!==null&&l9.includes(e)),p=(0,P.useRef)(null);(0,P.useEffect)(()=>{n&&p.current?.focus()},[n]);function m(e){c(null);try{return v9(t.id,{addresses:[...new Set(e.map(e=>d9(e).address))]}),!0}catch(e){return c(s(e)),!1}}async function h(e){c(null);let n=e.trim();if(n===``)return!0;try{let e=n.includes(`#`)?d9(n).code:n;if(e===null)throw Error(`That link has no pairing code`);return await g9(t.id,e),!0}catch(e){return c(s(e)),!1}}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)($L,{title:`Machine`,children:[(0,F.jsx)(J,{label:`Name`,children:(0,F.jsx)(eR,{value:t.label??``,placeholder:t.hostname,onCommit:e=>v9(t.id,{label:e.trim()===``?null:e.trim()})},t.label)}),(0,F.jsxs)(`div`,{className:`flex min-h-13 items-center justify-between gap-4 px-4 py-2.5`,children:[(0,F.jsx)(`span`,{className:`text-sm font-medium`,children:`Icon`}),(0,F.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:Object.entries(Wg).map(e=>(0,F.jsx)(E,{size:`icon-sm`,variant:e[0]===t.icon?`default`:`ghost`,title:e[0],"aria-pressed":e[0]===t.icon,onClick:()=>v9(t.id,{icon:e[0]}),children:(0,F.jsx)(k,{icon:e[1]})},e[0]))})]})]}),!f&&(0,F.jsx)($L,{title:`Pairing`,children:(0,F.jsxs)(`div`,{className:`flex min-h-13 items-center justify-between gap-4 px-4 py-2.5`,children:[t.pairedAt!==null&&t.status!==`unpaired`&&(0,F.jsx)(`span`,{className:`text-sm`,children:t.pairedAt===null?`Paired`:`Paired ${_C(t.pairedAt)}`}),(t.pairedAt===null||t.status===`unpaired`)&&(0,F.jsxs)(`form`,{className:`flex flex-1 items-center gap-3`,onSubmit:async e=>{e.preventDefault(),await h(i)&&a(``)},children:[(0,F.jsx)(cL,{className:`flex-1 font-mono`,placeholder:`Pairing link or code`,spellCheck:!1,autoComplete:`off`,value:i,onChange:e=>a(e.target.value)}),(0,F.jsxs)(E,{type:`submit`,variant:`outline`,className:`px-4`,disabled:i.trim()===``,children:[(0,F.jsx)(k,{icon:eh}),`Pair`]})]})]})}),(0,F.jsxs)($L,{title:`Addresses`,note:`OffSite tries them in order whenever it reconnects`,children:[(0,F.jsx)(BY,{as:`div`,axis:`y`,className:`divide-y`,values:d,onReorder:u,children:d.map((e,t)=>(0,F.jsxs)(oX,{value:e,disabled:f,onDragEnd:()=>{l!==null&&m(l),u(null)},children:[(0,F.jsx)(eR,{className:`flex-1 font-mono`,value:e,disabled:f,onCommit:e=>m(d.map((n,r)=>r===t?e:n))}),(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Remove address`,disabled:f||d.length===1,onClick:()=>m(d.filter((e,n)=>n!==t)),children:(0,F.jsx)(k,{icon:Nm})})]},e))}),n&&(0,F.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,F.jsx)(cL,{ref:p,className:`font-mono`,placeholder:`http://192.168.1.10:47841`,spellCheck:!1,autoComplete:`off`,onBlur:e=>{let n=e.target.value.trim();(n===``||m([...t.addresses,n]))&&r(!1)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}})}),!n&&!f&&(0,F.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:bg-muted/50 hover:text-foreground flex w-full items-center gap-2 px-4 py-3 text-sm transition-colors`,onClick:()=>r(!0),children:[(0,F.jsx)(k,{icon:lm,className:`size-4`}),`Add address`]})]}),o!==null&&(0,F.jsx)(`p`,{className:`text-destructive px-1 text-xs break-all`,children:o}),!f&&(0,F.jsxs)(kL,{children:[(0,F.jsx)(AL,{asChild:!0,children:(0,F.jsx)(E,{variant:`outline`,className:`text-destructive`,children:`Remove machine`})}),(0,F.jsxs)(NL,{children:[(0,F.jsxs)(PL,{children:[(0,F.jsxs)(IL,{children:[`Remove `,t.name,`?`]}),(0,F.jsx)(LL,{children:`This browser forgets the machine. The machine and its threads stay untouched.`})]}),(0,F.jsxs)(FL,{children:[(0,F.jsx)(zL,{children:`Cancel`}),(0,F.jsx)(RL,{variant:`destructive`,onClick:()=>{$({settingsEditedMachine:null}),_ue(t.id)},children:`Remove machine`})]})]})]})]})}function oX(e){let t=AY();return(0,F.jsxs)(eX,{as:`div`,value:e.value,dragListener:!1,dragControls:t,onDragEnd:e.onDragEnd,className:l(`bg-background relative flex items-center gap-3 px-4 py-2.5`,e.className),children:[(0,F.jsx)(`span`,{className:l(`text-muted-foreground hover:text-foreground cursor-grab touch-none active:cursor-grabbing`,e.disabled&&`pointer-events-none opacity-50`),title:`Drag to reorder`,onPointerDown:e=>t.start(e),children:(0,F.jsx)(k,{icon:pne,className:`size-4`})}),e.children]})}var sX=`notifications`,cX=Promise.resolve(),lX=new Set;function uX(){return window.isSecureContext?!(`Notification`in window)||!(`serviceWorker`in navigator)?`unsupported`:Notification.permission:`insecure`}function dX(){let e=localStorage.getItem(sX);if(e===null||e===`on`)return!0;if(e===`off`)return!1;throw Error(`unknown notification setting ${e}`)}async function fX(e){e&&Notification.permission==="default"&&await Notification.requestPermission(),localStorage.setItem(sX,e?`on`:`off`)}async function pX(e,t){(await navigator.permissions.query({name:`notifications`})).addEventListener(`change`,t,{signal:e})}function mX(e,t,n){if(document.hidden)for(let r of t){let t=gX(e,r);_X(e,r,`${t===void 0?`Agent`:lC[t.provider]} ${n}`,t?.title??`Session`,f9(e,r)).catch(e=>console.error(`could not show a notification`,e))}}function hX(e,t,n){_X(e,t,gX(e,t)?.title??`Session`,n,`push:${f9(e,t)}`).catch(e=>console.error(`could not show a notification`,e))}function gX(e,t){return Z().sessions.find(n=>n.machine===e&&n.id===t)}async function _X(e,t,n,r,i){if(uX()!==`granted`||!dX()||!T9(Z(),e).notifier)return;let a=gX(e,t);await(await navigator.serviceWorker.ready).showNotification(n,{body:r,tag:i,data:a===void 0?null:{kind:`session`,machine:e,project:a.projectId,sessionId:t}})}async function vX(e,t,n){uX()===`granted`&&dX()&&T9(Z(),n.machine).notifier&&await(await navigator.serviceWorker.ready).showNotification(e,{body:t,data:{kind:`terminal`,...n}})}function yX(){let e=Z().machines.filter(e=>Ja(e.id)&&!e.notifier&&!lX.has(e.id)).map(e=>e.id);if(e.length!==0){for(let t of e)lX.add(t);bX().then(t=>Promise.all(e.map(e=>I(e,`notifications.claim`,{endpoint:t})))).catch(e=>console.error(`could not claim notifications`,e)).finally(()=>{for(let t of e)lX.delete(t)})}}async function bX(){if(xX()!==`supported`)return null;let e=await navigator.serviceWorker.getRegistration();if(e===void 0)return null;let t=await e.pushManager.getSubscription();return t===null?null:t.endpoint}function xX(){return window.isSecureContext?!(`Notification`in window)||!(`serviceWorker`in navigator)||!(`PushManager`in window)?SX()?`install`:`unsupported`:Notification.permission===`denied`?`denied`:`supported`:`insecure`}function SX(){return/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.userAgent.includes(`Mac`)&&navigator.maxTouchPoints>1}async function CX(){return await(await navigator.serviceWorker.ready).pushManager.getSubscription()!==null}async function wX(){return Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission===`granted`&&(await DX(OX),!0)}function TX(){return DX(kX)}function EX(e){return DX(async()=>{if(xX()!==`supported`)return;let t=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!t)return;let n=await AX(),r=t.options.applicationServerKey;r!==null&&MX(r)===n.publicKey?await NX(e,t,n):await OX()})}function DX(e){let t=cX.then(e);return cX=t.catch(()=>void 0),t}async function OX(){await kX();let e=await AX(),t=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e.publicKey});await Promise.all(jX().map(n=>NX(n,t,e)))}async function kX(){let e=await(await navigator.serviceWorker.ready).pushManager.getSubscription();e&&(await Promise.all(jX().map(t=>I(t,`push.unsubscribe`,{endpoint:e.endpoint}))),await e.unsubscribe())}async function AX(){let e=await caches.open(`offsite-worker`),t=await e.match(`/push-keys`);if(t!==void 0)return await t.json();let n=await crypto.subtle.generateKey({name:`ECDSA`,namedCurve:`P-256`},!0,[`sign`,`verify`]),r=(await crypto.subtle.exportKey(`jwk`,n.privateKey)).d;if(r===void 0)throw Error(`the browser did not export the push key`);let i={publicKey:MX(await crypto.subtle.exportKey(`raw`,n.publicKey)),privateKey:r};return await e.put(`/push-keys`,new Response(JSON.stringify(i))),i}function jX(){return Z().machines.filter(e=>Ja(e.id)).map(e=>e.id)}function MX(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/,``)}async function NX(e,t,n){await I(e,`push.subscribe`,{subscription:t.toJSON(),...n,machine:e})}var PX=new Map([[`denied`,`Blocked in the browser's site settings`],[`insecure`,`Needs https or localhost`],[`install`,`Add OffSite to the Home Screen first`],[`unsupported`,`Not supported in this browser`]]);function FX(e){let t=e.prefs.terminal,n=t.behavior;function r(r){L9({...e.prefs,terminal:{...t,behavior:{...n,...r}}})}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)($L,{title:`Notifications`,children:[(0,F.jsx)(J,{label:`Desktop notifications on this device`,children:(0,F.jsx)(IX,{})}),(0,F.jsx)(J,{label:`Push terminal alerts when no OffSite page is open`,children:(0,F.jsx)(LX,{})})]}),(0,F.jsxs)($L,{title:`Terminal bell`,children:[(0,F.jsx)(J,{label:`Flash the screen on bell`,children:(0,F.jsx)(BL,{checked:n.bellFlash,onCheckedChange:e=>r({bellFlash:e})})}),(0,F.jsx)(J,{label:`Play a sound on bell`,children:(0,F.jsx)(BL,{checked:n.bellSound,onCheckedChange:e=>r({bellSound:e})})})]})]})}function IX(){let[e,t]=(0,P.useState)(uX),[n,r]=(0,P.useState)(dX);(0,P.useEffect)(()=>{let e=uX();if(e===`insecure`||e===`unsupported`)return;let n=new AbortController;return pX(n.signal,()=>t(uX())).catch(e=>console.error(`could not watch the notification permission`,e)),()=>n.abort()},[]);async function i(e){await fX(e),r(e),t(uX())}return(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[PX.has(e)&&(0,F.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:PX.get(e)}),(0,F.jsx)(BL,{checked:e===`granted`&&n,disabled:e!==`granted`&&e!=="default",onCheckedChange:e=>void i(e)})]})}function LX(){let[e,t]=(0,P.useState)(xX),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(()=>xX()===`supported`),[o,c]=(0,P.useState)(null);(0,P.useEffect)(()=>{if(xX()!==`supported`)return;let e=!0;async function t(){try{let t=await CX();e&&r(t)}catch(e){console.error(`could not read the push subscription`,e)}e&&a(!1)}return t(),()=>{e=!1}},[]);async function l(e){a(!0),c(null);try{e?r(await wX()):(await TX(),r(!1))}catch(e){console.error(`could not change push notifications`,e),c(s(e))}t(xX()),a(!1)}return(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[o!==null&&(0,F.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Could not update: `,o]}),PX.has(e)&&(0,F.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:PX.get(e)}),(0,F.jsx)(BL,{checked:e===`supported`&&n,disabled:e!==`supported`||i,onCheckedChange:e=>void l(e)})]})}var RX={five_hour:`5h`,seven_day:`Week`,seven_day_opus:`Week (Opus)`,seven_day_sonnet:`Week (Sonnet)`};function zX(e){return RX[e.window]??e.window}function BX(e){let t=e.account,[n,r]=(0,P.useState)(null);async function i(n){r(null);try{await I(e.machine,`accounts.update`,{id:t.id,name:t.name,color:t.color,configDir:t.configDir,enabled:t.enabled,...n})}catch(e){r(s(e))}}async function a(){r(null);try{await I(e.machine,`accounts.remove`,{id:t.id}),$({settingsAccount:null})}catch(e){r(s(e))}}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)($L,{title:`Account`,children:[(0,F.jsx)(J,{label:`Name`,children:(0,F.jsx)(eR,{value:t.name,valid:e=>e.trim()!==``,onCommit:e=>void i({name:e})},t.name)}),(0,F.jsx)(J,{label:`Color`,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t.color!==null&&(0,F.jsx)(`span`,{className:`size-5 shrink-0 rounded-full`,style:{backgroundColor:t.color}}),(0,F.jsx)(eR,{className:`w-28 font-mono`,value:t.color??``,placeholder:`#3b82f6`,valid:e=>e===``||/^#[0-9a-f]{6}$/i.test(e),onCommit:e=>void i({color:e===``?null:e})},t.color??``)]})}),(0,F.jsx)(J,{label:`Config directory`,children:(0,F.jsx)(eR,{className:`w-72 font-mono`,value:t.configDir??``,placeholder:t.provider===`claude`?`~/.claude or empty for default`:`~/.codex or empty for default`,onCommit:e=>void i({configDir:e})},t.configDir??``)})]}),n!==null&&(0,F.jsx)(`p`,{className:`text-destructive px-1 text-xs`,children:n}),(0,F.jsxs)(kL,{children:[(0,F.jsx)(AL,{asChild:!0,children:(0,F.jsx)(E,{variant:`outline`,className:`text-destructive`,children:`Remove account`})}),(0,F.jsxs)(NL,{children:[(0,F.jsxs)(PL,{children:[(0,F.jsxs)(IL,{children:[`Remove `,t.name,`?`]}),(0,F.jsx)(LL,{children:`OffSite stops using this account. Its config directory and sessions stay untouched.`})]}),(0,F.jsxs)(FL,{children:[(0,F.jsx)(zL,{children:`Cancel`}),(0,F.jsx)(RL,{variant:`destructive`,onClick:()=>void a(),children:`Remove account`})]})]})]})]})}function VX(e){let[t,n]=(0,P.useState)(``),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(!1),[c,l]=(0,P.useState)(null);async function u(){o(!0),l(null);try{await I(e.machine,`accounts.add`,{provider:e.provider,name:t,configDir:r}),$({settingsAccount:null})}catch(e){l(s(e)),o(!1)}}return(0,F.jsxs)(`form`,{className:`space-y-5`,onSubmit:e=>{e.preventDefault(),u()},children:[(0,F.jsxs)($L,{title:`Account`,children:[(0,F.jsx)(J,{label:`Name`,children:(0,F.jsx)(cL,{className:`w-56`,value:t,onChange:e=>n(e.target.value),placeholder:`Work`})}),(0,F.jsx)(J,{label:`Config directory`,children:(0,F.jsx)(cL,{className:`w-72 font-mono`,value:r,onChange:e=>i(e.target.value),placeholder:e.provider===`claude`?`~/.claude or empty for default`:`~/.codex or empty for default`})})]}),c!==null&&(0,F.jsx)(`p`,{className:`text-destructive px-1 text-xs`,children:c}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(E,{type:`button`,variant:`ghost`,onClick:()=>$({settingsAccount:null}),children:`Cancel`}),(0,F.jsx)(E,{type:`submit`,disabled:a||t.trim()===``,children:`Add account`})]})]})}function HX(e){let t=e.config,n=t.enabledProviders[e.provider],r=e.provider===`claude`?e.claudeAccounts:e.provider===`codex`?e.codexAccounts:[],i=r.find(e=>e.valid),a=t.claudeBaseDir[e.platform]??e.defaultClaudeBaseDir;if(e.selected===`new`){if(e.provider===`opencode`)throw Error(`OpenCode accounts cannot be added`);return(0,F.jsx)(VX,{machine:e.machine,provider:e.provider})}if(e.selected!==null){let t=r.find(t=>t.id===e.selected);return t===void 0?(0,F.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This account no longer exists.`}):(0,F.jsx)(BX,{machine:e.machine,account:t})}return(0,F.jsxs)(F.Fragment,{children:[e.provider===`claude`&&(0,F.jsx)(`div`,{className:`divide-y overflow-hidden rounded-xl border`,children:(0,F.jsx)(J,{label:`Base directory`,children:(0,F.jsx)(eR,{className:`w-72 font-mono`,value:a,valid:e=>e.trim()!==``,onCommit:n=>U9(e.machine,{...t,claudeBaseDir:{...t.claudeBaseDir,[e.platform]:n}})},a)})}),(0,F.jsxs)(`div`,{className:l(`space-y-5 transition-opacity`,!n&&`opacity-50`),children:[e.provider!==`opencode`&&(0,F.jsx)($L,{title:`Accounts`,children:(0,F.jsx)(WX,{machine:e.machine,accounts:r})}),n&&e.provider===`opencode`&&e.openCode.available&&(0,F.jsx)(UX,{machine:e.machine,config:t,provider:e.provider,accountId:null}),n&&e.provider!==`opencode`&&i!==void 0&&(0,F.jsx)(UX,{machine:e.machine,config:t,provider:e.provider,accountId:i.id})]})]})}function UX(e){let[t,n]=(0,P.useState)(null),[r,i]=(0,P.useState)(null),a=e.config.models[e.provider],o=t===null?null:t.models,c=e.config.newThreads.models[e.provider]??(t===null?null:t.defaultModel);(0,P.useEffect)(()=>{let t=!0;return n(null),i(null),I(e.machine,`capabilities`,{provider:e.provider,accountId:e.accountId,projectId:null}).then(e=>{t&&n(e)},e=>{t&&i(s(e))}),()=>{t=!1}},[e.machine,e.provider,e.accountId]);function u(t,n){U9(e.machine,{...e.config,models:{...e.config.models,[e.provider]:{...a,[t]:n}}})}return(0,F.jsxs)($L,{title:`Models`,children:[o!==null&&(0,F.jsx)(J,{label:`Default model`,children:(0,F.jsxs)(lL,{value:c??void 0,onValueChange:t=>void U9(e.machine,{...e.config,newThreads:{...e.config.newThreads,models:{...e.config.newThreads.models,[e.provider]:t}}}),children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{placeholder:`Choose a model`})}),(0,F.jsx)(fL,{children:o.filter(e=>!(a[e.value]?.hidden??e.deprecated)||e.value===c).map(e=>(0,F.jsx)(pL,{value:e.value,children:e.name},e.value))})]})}),r!==null&&(0,F.jsx)(`p`,{className:`text-destructive px-4 py-3 text-xs`,children:r}),r===null&&o===null&&(0,F.jsx)(`p`,{className:`text-muted-foreground px-4 py-3 text-xs`,children:`Loading…`}),(o??[]).map(t=>{let n=a[t.value]??{hidden:t.deprecated,effort:t.effort};return(0,F.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3 px-4 py-1.5`,children:[(0,F.jsxs)(`div`,{className:l(`min-w-0 flex-1 truncate text-sm`,n.hidden&&`text-muted-foreground`),children:[t.name,e.provider===`opencode`&&(0,F.jsx)(`span`,{className:`text-muted-foreground ml-2 text-xs`,children:t.description})]}),t.efforts.length>0&&(0,F.jsxs)(lL,{value:n.effort??t.effort??void 0,onValueChange:e=>u(t.value,{...n,effort:e}),children:[(0,F.jsx)(dL,{size:`sm`,className:`w-28`,children:(0,F.jsx)(uL,{placeholder:`Effort`})}),(0,F.jsx)(fL,{children:t.efforts.map(e=>(0,F.jsx)(pL,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,F.jsx)(BL,{size:`sm`,checked:!n.hidden,onCheckedChange:e=>u(t.value,{...n,hidden:!e}),"aria-label":`Show ${t.name}`})]},t.value)})]})}function WX(e){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(null);async function a(e){n(!0),i(null);try{await e()}catch(e){i(s(e))}finally{n(!1)}}return(0,F.jsxs)(F.Fragment,{children:[e.accounts.map(n=>(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:l(`min-w-0 flex-1`,!n.enabled&&`opacity-50`),children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:l(`size-2 shrink-0 rounded-full`,!n.enabled&&`bg-muted-foreground/40`,n.enabled&&n.error!==null&&`bg-destructive`,n.enabled&&n.error===null&&!n.linked&&`bg-warning`,n.enabled&&n.error===null&&n.linked&&`bg-success`)}),(0,F.jsx)(`span`,{className:`truncate text-sm font-medium`,children:n.name}),n.plan!==null&&(0,F.jsx)(`span`,{className:`text-muted-foreground shrink-0 text-xs`,children:n.plan})]}),n.error!==null&&(0,F.jsx)(`p`,{className:`text-destructive mt-1 truncate pl-4 text-xs`,children:n.error}),n.error===null&&!n.linked&&(0,F.jsx)(`p`,{className:`text-warning mt-1 truncate pl-4 text-xs`,children:`Not linked to shared threads · hidden in the composer`}),n.error===null&&n.linked&&n.limits.length>0&&(0,F.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-5 gap-y-1.5 pl-4`,children:n.limits.map(e=>(0,F.jsx)(GX,{limit:e},e.window))})]}),(0,F.jsx)(BL,{size:`sm`,checked:n.enabled,disabled:t,onCheckedChange:t=>void a(()=>I(e.machine,`accounts.update`,{id:n.id,name:n.name,color:n.color,configDir:n.configDir,enabled:t})),"aria-label":`Enable ${n.name}`}),(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost-muted`,title:`Open account`,onClick:()=>$({settingsAccount:n.id}),children:(0,F.jsx)(k,{icon:ym})})]},n.id)),(0,F.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:bg-muted/50 hover:text-foreground flex w-full items-center gap-2 px-4 py-3 text-sm transition-colors`,onClick:()=>$({settingsAccount:`new`}),children:[(0,F.jsx)(k,{icon:lm,className:`size-4`}),`Add account`]}),r!==null&&(0,F.jsx)(`p`,{className:`text-destructive px-4 py-3 text-xs`,children:r})]})}function GX(e){let t=e.limit,n=t.rejected?100:t.utilization===null?null:Math.min(100,Math.round(t.utilization*100));return n===null?null:(0,F.jsx)(je,{label:t.resetsAt===null?`Reset time unknown`:`Resets ${_C(t.resetsAt*1e3)}`,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:zX(t)}),(0,F.jsx)(`div`,{className:`bg-foreground/10 h-1 w-16 overflow-hidden rounded-full`,children:(0,F.jsx)(`div`,{className:l(`h-full rounded-full`,t.rejected&&`bg-destructive`,!t.rejected&&n>=80&&`bg-warning`,!t.rejected&&n<80&&`bg-foreground/50`),style:{width:`${n}%`}})}),(0,F.jsxs)(`span`,{className:l(`tabular-nums`,t.rejected&&`text-destructive`,!t.rejected&&`text-muted-foreground`),children:[n,`%`]})]})})}var KX=a?`⌘`:`Ctrl+Shift`,qX=[[`Enter`,`Send, or queue or steer while the agent works`],[`${r}+Enter`,`Send the other way while the agent works`],[`Shift+Enter`,`New line`],[`↑`,`Recall your last message`],[`Esc`,`Stop the agent`],[`/`,`Slash commands`],[`@`,`Mention a file`],[`${r}+K`,`Search sessions and actions`],[`${r}+N or ${r}+T`,`New thread`],[a?"⌘+` or Ctrl+`":"Ctrl+`",`Toggle the terminal`],[`${r}+B`,`Toggle the sidebar`],[`${r}+J`,`Toggle the right panel`],[`${KX}+T`,`New terminal tab, in the terminal`],[`${KX}+W`,`Close the terminal tab`],[`${KX}+F`,`Find in the terminal`],[`Ctrl+Tab`,`Next terminal tab`],[`Ctrl+Shift+Tab`,`Previous terminal tab`]];function JX(){return(0,F.jsx)($L,{title:`Keyboard shortcuts`,children:qX.map(([e,t])=>(0,F.jsx)(J,{label:t,children:(0,F.jsx)(`kbd`,{className:`bg-muted text-muted-foreground rounded px-1.5 py-0.5 font-sans text-xs`,children:e})},e))})}var YX=1048576;function XX(e){window.isSecureContext?navigator.clipboard.writeText(e).catch(e=>{console.warn(`could not copy to the clipboard`,e),yo(`Could not copy to the clipboard`)}):console.warn(`copy from the terminal needs https or localhost`)}async function ZX(e){if(!window.isSecureContext){console.warn(`programs can read the clipboard only over https or localhost`),yo(`Programs can read the clipboard only over https or localhost`);return}let t;try{t=await navigator.clipboard.readText()}catch(e){console.warn(`could not read the clipboard`,e),yo(`Could not read the clipboard`);return}new TextEncoder().encode(t).length>YX?(console.warn(`the clipboard is over 1 MiB, not replying`),yo(`The clipboard is too large to share (over 1 MiB)`)):e(t)}var QX={macos:{label:`Ctrl+V`,ctrl:!0,alt:!1,data:``},linux:{label:`Ctrl+V`,ctrl:!0,alt:!1,data:``},windows:{label:`Alt+V`,ctrl:!1,alt:!0,data:`\x1Bv`}};function $X(e,t){let n=QX[t];return e.key.toLowerCase()===`v`&&e.ctrlKey===n.ctrl&&e.altKey===n.alt&&!e.shiftKey&&!e.metaKey}async function eZ(e,t){let n=[];for(let e of await navigator.clipboard.read()){let t=e.types.find(e=>e.startsWith(`image/`));t&&n.push(await e.getType(t))}return n.length===0?(yo(`No image in the clipboard`),!1):(await tZ(e,t,n),!0)}async function tZ(e,t,n){let r=[];for(let t of n){let n=await I(e,`terminal.paste`,{type:t.type,data:await OS(t)});r.push(/\s/.test(n)?`"${n}"`:n)}t.paste(r.join(` `))}function nZ(e){console.error(`could not paste image`,e),yo(`Could not paste the image`)}function rZ(e){let t=e.prefs.terminal,[n,r]=(0,P.useState)(!JL.some(e=>e.family===t.font.family));function i(t){L9({...e.prefs,terminal:t})}function a(e,n){i({...t,[e]:{...t[e],...n}})}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)($L,{title:`Font`,children:[(0,F.jsx)(J,{label:`Family`,children:(0,F.jsxs)(lL,{value:n?`custom`:t.font.family,onValueChange:e=>{r(e===`custom`),e!==`custom`&&a(`font`,{family:e})},children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[JL.map(e=>(0,F.jsx)(pL,{value:e.family,children:e.label},e.family)),(0,F.jsx)(pL,{value:`custom`,children:`Custom`})]})]})}),n&&(0,F.jsx)(J,{label:`Custom family`,children:(0,F.jsx)(eR,{placeholder:`Installed font name`,value:t.font.family,onCommit:e=>a(`font`,{family:e})})}),(0,F.jsx)(J,{label:`Size`,children:(0,F.jsx)(tR,{value:t.font.size,step:.5,onCommit:e=>a(`font`,{size:e})})}),(0,F.jsx)(J,{label:`Line height`,children:(0,F.jsx)(tR,{value:t.font.lineHeight,step:.05,onCommit:e=>a(`font`,{lineHeight:e})})}),(0,F.jsx)(J,{label:`Ligatures`,children:(0,F.jsx)(BL,{checked:t.font.ligatures,onCheckedChange:e=>a(`font`,{ligatures:e})})}),(0,F.jsx)(J,{label:`Bold text in bright colors`,children:(0,F.jsx)(BL,{checked:t.boldIsBright,onCheckedChange:e=>i({...t,boldIsBright:e})})})]}),(0,F.jsxs)($L,{title:`Cursor`,children:[(0,F.jsx)(J,{label:`Style`,children:(0,F.jsxs)(lL,{value:t.cursor.style,onValueChange:e=>a(`cursor`,{style:e}),children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[(0,F.jsx)(pL,{value:`block`,children:`Block`}),(0,F.jsx)(pL,{value:`bar`,children:`Bar`}),(0,F.jsx)(pL,{value:`underline`,children:`Underline`})]})]})}),(0,F.jsx)(J,{label:`Blink`,children:(0,F.jsx)(BL,{checked:t.cursor.blink,onCheckedChange:e=>a(`cursor`,{blink:e})})})]}),(0,F.jsx)(iZ,{behavior:t.behavior,onChange:e=>a(`behavior`,e)}),(0,F.jsx)(aZ,{behavior:t.behavior,onChange:e=>a(`behavior`,e)}),(0,F.jsxs)($L,{title:`Layout`,children:[[`top`,`right`,`bottom`,`left`].map(e=>(0,F.jsx)(J,{label:`Padding ${e}`,children:(0,F.jsx)(tR,{value:t.padding[e],onCommit:t=>a(`padding`,{[e]:t})})},e)),(0,F.jsx)(J,{label:`Scrollback lines`,children:(0,F.jsx)(tR,{value:t.scrollback,step:1e3,onCommit:e=>i({...t,scrollback:e})})})]})]})}function iZ(e){return(0,F.jsxs)($L,{title:`Behavior`,children:[(0,F.jsx)(J,{label:`Modernize Shift+Enter`,children:(0,F.jsx)(BL,{checked:e.behavior.modernizeShiftEnter,onCheckedChange:t=>e.onChange({modernizeShiftEnter:t})})}),(0,F.jsx)(J,{label:`${QX.linux.label} (${QX.windows.label} on Windows machines) pastes images from the browser clipboard`,children:(0,F.jsx)(BL,{checked:e.behavior.pasteBrowserImages,onCheckedChange:t=>e.onChange({pasteBrowserImages:t})})}),(0,F.jsx)(J,{label:`Capture browser shortcuts`,children:(0,F.jsx)(BL,{checked:e.behavior.captureShortcuts,onCheckedChange:t=>e.onChange({captureShortcuts:t})})}),(0,F.jsx)(J,{label:`Click moves the cursor in the command line`,children:(0,F.jsx)(BL,{checked:e.behavior.clickToMoveCursor,onCheckedChange:t=>e.onChange({clickToMoveCursor:t})})}),(0,F.jsx)(J,{label:`Ask before closing a tab that is running a program`,children:(0,F.jsx)(BL,{checked:e.behavior.confirmCloseBusyTab,onCheckedChange:t=>e.onChange({confirmCloseBusyTab:t})})})]})}function aZ(e){return a?(0,F.jsx)($L,{title:`Mac keys`,note:`Meta keeps that Option key from typing @, | and other symbols. Safari and Firefox use US key positions`,children:(0,F.jsx)(J,{label:`Use Option as Meta`,children:(0,F.jsxs)(lL,{value:e.behavior.optionAsMeta,onValueChange:t=>e.onChange({optionAsMeta:t}),children:[(0,F.jsx)(dL,{className:`w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsxs)(fL,{children:[(0,F.jsx)(pL,{value:`off`,children:`Off`}),(0,F.jsx)(pL,{value:`left`,children:`Left Option`}),(0,F.jsx)(pL,{value:`right`,children:`Right Option`}),(0,F.jsx)(pL,{value:`both`,children:`Both Options`})]})]})})}):null}var oZ=[`General`,`Editor`,`Terminal`,`Notifications`,`Shortcuts`,`Machines`],sZ=[`Machine`,`Claude`,`Codex`,`OpenCode`];function cZ(){let e=Q(e=>e.machines),t=Q(e=>e.settingsMachine===null?null:T9(e,e.settingsMachine)),n=Q(e=>e.settingsPage),r=pZ(n),i=Q(e=>r===null?null:e.settingsAccount),a=Q(e=>n===`Machines`?e.machines.find(t=>t.id===e.settingsEditedMachine)??null:null);return{machines:e,machine:t,config:t===null?null:t.config,system:t===null?null:t.system,page:n,provider:r,account:i,editedMachine:a,subpage:i!==null||a!==null,subpageTitle:i===`new`?`New account`:i===null?a?.name:[...t?.claudeAccounts??[],...t?.codexAccounts??[]].find(e=>e.id===i)?.name}}function lZ(){let e=Q(e=>e.settingsOpen),t=cZ(),n=t.page,r=t.machine;function i(e){return(0,F.jsx)(`button`,{className:l(`text-muted-foreground hover:bg-accent hover:text-foreground flex h-9 flex-none items-center rounded-md px-2 text-sm transition-colors`,e===n&&`bg-accent text-foreground`),onClick:()=>I9(e),children:(0,F.jsx)(uZ,{page:e})},e)}return(0,F.jsx)(Xe,{open:e,onOpenChange:F9,children:(0,F.jsxs)(Je,{showCloseButton:!1,"aria-describedby":void 0,className:`flex h-[min(44rem,calc(100dvh-2rem))] flex-col gap-0 overflow-hidden p-0 sm:max-w-4xl sm:flex-row`,children:[(0,F.jsxs)(`nav`,{className:`flex flex-none gap-1 overflow-x-auto border-b p-3 sm:w-48 sm:flex-col sm:border-r sm:border-b-0`,children:[(0,F.jsx)(Ye,{className:`hidden px-2 pt-1 pb-3 text-base font-semibold sm:block`,children:`Settings`}),oZ.map(i),(0,F.jsxs)(`div`,{className:`flex flex-none items-center gap-1 sm:mt-6 sm:flex-col sm:items-stretch`,children:[r!==null&&t.machines.length>1&&(0,F.jsxs)(lL,{value:r.id,onValueChange:e=>$({settingsMachine:e,settingsAccount:null}),children:[(0,F.jsx)(dL,{className:`mb-1 w-40 sm:w-full`,children:(0,F.jsx)(uL,{})}),(0,F.jsx)(fL,{children:t.machines.map(e=>(0,F.jsxs)(pL,{value:e.id,children:[(0,F.jsx)(k,{icon:Wg[e.icon]}),e.name]},e.id))})]}),r!==null&&t.machines.length===1&&(0,F.jsxs)(`p`,{className:`text-muted-foreground flex h-9 items-center gap-1.5 px-2 text-xs font-medium [&_svg]:size-4`,children:[(0,F.jsx)(k,{icon:Wg[r.icon]}),(0,F.jsx)(`span`,{className:`truncate`,children:r.name})]}),sZ.map(i)]})]}),(0,F.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 pt-4 pb-7`,children:[(0,F.jsxs)(`div`,{className:`mb-5 flex h-9 items-center`,children:[t.subpage&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{className:`text-muted-foreground hover:text-foreground text-xl font-semibold tracking-tight transition-colors`,onClick:()=>$({settingsAccount:null,settingsEditedMachine:null}),children:n}),(0,F.jsx)(k,{icon:ym,className:`text-muted-foreground mx-1.5 size-5`}),(0,F.jsx)(`h2`,{className:`truncate text-xl font-semibold tracking-tight`,children:t.subpageTitle})]}),!t.subpage&&(0,F.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight`,children:n===`Machine`?`General`:n}),(0,F.jsx)(dZ,{view:t,className:`ml-3`}),(0,F.jsx)(Ge,{asChild:!0,children:(0,F.jsx)(E,{variant:`ghost`,size:`icon`,className:`-mr-2 ml-auto`,"aria-label":`Close settings`,children:(0,F.jsx)(k,{icon:xm})})})]}),(0,F.jsx)(fZ,{view:t})]})]})})}function uZ(e){let t=pZ(e.page);return(0,F.jsxs)(F.Fragment,{children:[t!==null&&(0,F.jsx)(`span`,{className:`mr-2.5 flex size-4 items-center justify-center`,children:(0,F.jsx)(Jg,{provider:t,className:l(t===`claude`&&`size-4`,t===`codex`&&`size-[19px] shrink-0`,t===`opencode`&&`h-3.5`)})}),e.page===`Machine`?`General`:e.page]})}function dZ(e){let t=e.view.machine,n=e.view.config,r=e.view.provider;return r===null||e.view.account!==null||t===null||n===null?null:(0,F.jsx)(BL,{className:e.className,checked:n.enabledProviders[r],onCheckedChange:e=>void U9(t.id,{...n,enabledProviders:{...n.enabledProviders,[r]:e}}),"aria-label":`Enable ${e.view.page}`})}function fZ(e){let t=Q(e=>e.prefs),n=e.view.page,r=e.view.machine,i=e.view.config,a=e.view.system,o=sZ.includes(n),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(0);return(0,F.jsxs)(F.Fragment,{children:[o&&r!==null&&r.configError!==null&&(0,F.jsxs)(`p`,{className:`text-destructive mb-5 text-sm whitespace-pre-wrap`,children:[`Not saved: `,r.configError]}),(0,F.jsxs)(`div`,{className:`w-full space-y-5`,children:[n===`General`&&(0,F.jsx)(rR,{prefs:t,onRestore:()=>c(`browser`)}),n===`Machine`&&r!==null&&i!==null&&a!==null&&(0,F.jsx)(yR,{machine:r.id,config:i,platform:a.platform,defaultShell:a.defaultShell,claudeAccounts:r.claudeAccounts,codexAccounts:r.codexAccounts,openCode:r.openCode,onRestore:()=>c(`machine`)}),o&&r===null&&(0,F.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Add a machine to see its settings.`}),o&&r!==null&&(i===null||a===null)&&(0,F.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[r.name,` is not connected. Its settings show up once it is.`]}),n===`Editor`&&(0,F.jsx)(nR,{prefs:t}),n===`Terminal`&&(0,F.jsx)(rZ,{prefs:t}),n===`Notifications`&&(0,F.jsx)(FX,{prefs:t}),e.view.provider!==null&&r!==null&&i!==null&&a!==null&&(0,F.jsx)(HX,{machine:r.id,config:i,platform:a.platform,defaultClaudeBaseDir:a.defaultClaudeBaseDir,provider:e.view.provider,claudeAccounts:r.claudeAccounts,codexAccounts:r.codexAccounts,openCode:r.openCode,selected:e.view.account},e.view.provider),n===`Machines`&&(0,F.jsx)(iX,{}),n===`Shortcuts`&&(0,F.jsx)(JX,{})]},l),(0,F.jsx)(kL,{open:s!==null,onOpenChange:e=>{e||c(null)},children:(0,F.jsxs)(NL,{children:[(0,F.jsxs)(PL,{children:[(0,F.jsx)(IL,{children:s===`browser`?`Restore browser defaults?`:`Restore machine defaults?`}),(0,F.jsx)(LL,{children:s===`browser`?`All settings of this browser go back to their defaults.`:`All settings of ${r?.name} go back to their defaults.`})]}),(0,F.jsxs)(FL,{children:[(0,F.jsx)(zL,{children:`Cancel`}),(0,F.jsx)(RL,{variant:`destructive`,onClick:()=>{if(u(l+1),s===`browser`)L9(UL);else{if(r===null||i===null||a===null)throw Error(`Restoring machine defaults needs a connected machine`);U9(r.id,{...a.defaults,claudeAccounts:i.claudeAccounts,codexAccounts:i.codexAccounts})}},children:`Restore defaults`})]})]})})]})}function pZ(e){return e===`Claude`?`claude`:e===`Codex`?`codex`:e===`OpenCode`?`opencode`:null}function mZ(){let e=Q(e=>e.settingsOpen),t=Q(e=>e.settingsListing),n=cZ(),r=n.machine;function i(){t?F9(!1):n.subpage?$({settingsAccount:null,settingsEditedMachine:null}):$({settingsListing:!0})}function a(e){return(0,F.jsxs)(`button`,{className:`active:bg-accent flex min-h-12 w-full items-center px-4 text-left text-sm font-medium`,onClick:()=>I9(e),children:[(0,F.jsx)(uZ,{page:e}),(0,F.jsx)(k,{icon:ym,className:`text-muted-foreground ml-auto size-4`})]},e)}return(0,F.jsx)(Re,{open:e,onOpenChange:F9,children:(0,F.jsx)(Be,{children:(0,F.jsxs)(qe,{"aria-describedby":void 0,className:`bg-background text-foreground data-open:animate-in data-open:slide-in-from-right fixed inset-0 z-50 flex flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] text-sm duration-200 outline-none [--workspace-topbar-height:44px] motion-reduce:animate-none`,children:[(0,F.jsxs)(`header`,{className:`flex h-(--workspace-topbar-height) shrink-0 items-center gap-1.5 pr-3 pl-1`,children:[(0,F.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":`Back`,onClick:i,children:(0,F.jsx)(k,{icon:vm,className:`text-foreground size-5`,strokeWidth:2})}),(0,F.jsxs)(Pe,{className:`min-w-0 flex-1 truncate font-medium`,children:[t&&`Settings`,!t&&n.subpage&&n.subpageTitle,!t&&!n.subpage&&n.page]}),!t&&(0,F.jsx)(dZ,{view:n,className:`shrink-0`})]}),(0,F.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pt-2 pb-6`,children:[t&&(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsx)($L,{title:`This browser`,children:oZ.map(a)}),(0,F.jsxs)($L,{title:`Machine`,children:[r!==null&&(0,F.jsxs)(J,{label:`Machine`,children:[n.machines.length>1&&(0,F.jsxs)(lL,{value:r.id,onValueChange:e=>$({settingsMachine:e,settingsAccount:null}),children:[(0,F.jsx)(dL,{className:`w-40`,children:(0,F.jsx)(uL,{})}),(0,F.jsx)(fL,{children:n.machines.map(e=>(0,F.jsxs)(pL,{value:e.id,children:[(0,F.jsx)(k,{icon:Wg[e.icon]}),e.name]},e.id))})]}),n.machines.length===1&&(0,F.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1.5 text-sm [&_svg]:size-4`,children:[(0,F.jsx)(k,{icon:Wg[r.icon]}),r.name]})]}),sZ.map(a)]})]}),!t&&(0,F.jsx)(fZ,{view:n})]})]})})})}function hZ(){return(0,F.jsx)(`div`,{className:`grid flex-1 place-items-center p-6`,children:(0,F.jsxs)(`div`,{className:`w-full max-w-md`,children:[(0,F.jsx)(`h1`,{className:`text-foreground text-center text-2xl font-normal tracking-tight sm:text-3xl`,children:`Connect a machine`}),(0,F.jsx)(`p`,{className:`text-muted-foreground mt-2 text-center text-sm`,children:`Run this on the computer you want to use, then open the pairing link it prints.`}),(0,F.jsx)(`pre`,{className:`bg-muted text-foreground mt-5 rounded-lg px-4 py-3 font-mono text-sm select-all`,children:`npx offsite serve`}),(0,F.jsx)(`p`,{className:`text-muted-foreground mt-8 mb-3 text-sm`,children:`Or connect it here.`}),(0,F.jsx)(tX,{actions:e=>(0,F.jsx)(E,{type:`submit`,className:`mt-4`,disabled:!e,children:`Connect`})})]})})}function gZ(){let e=Q(e=>e.paletteOpen),t=Q(e=>e.selection),n=Q(e=>e.machines),r=Q(e=>e.projects),[i,a]=(0,P.useState)(``),[o]=Rg(i,150),[s,c]=(0,P.useState)([]),[u,d]=(0,P.useState)(0),f=(0,P.useRef)(null),p=i.toLowerCase().split(/\s+/).filter(Boolean),m=[...t===null?[]:[{key:`new`,label:`New thread`,detail:r.find(e=>e.machine===t.machine&&e.id===t.projectId)?.path??``,run:()=>BS({...t,sessionId:null})}],{key:`accounts`,label:`Manage accounts`,detail:``,run:()=>I9(C9[Z().settings.provider])},{key:`settings`,label:`Settings`,detail:`Theme, notifications, keyboard shortcuts`,run:()=>F9(!0)}],h=s.map(e=>({key:f9(e.machine,e.id),label:e.title,detail:`${e.status===`minimized`?`Minimized · `:``}${n.length>1?`${n.find(t=>t.id===e.machine)?.name??``}:`:``}${r.find(t=>t.machine===e.machine&&t.id===e.projectId)?.path??``}`,run:()=>BS({machine:e.machine,projectId:e.projectId,sessionId:e.id})})),g=[...m.filter(e=>{let t=`${e.label} ${e.detail}`.toLowerCase();return p.every(e=>t.includes(e))}),...h],_=Math.min(u,g.length-1);(0,P.useEffect)(()=>{if(!e)return;let t=!0;return Promise.all(Z().machines.filter(e=>e.status===`online`).map(async e=>(await I(e.id,`sessions.search`,{query:o})).map(t=>({...t,machine:e.id})))).then(e=>{t&&c(e.flat())}).catch(R9),()=>{t=!1}},[e,o]),(0,P.useLayoutEffect)(()=>{f.current?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})},[_]);function v(e){P9(!1),e.run()}return(0,F.jsx)(Xe,{open:e,onOpenChange:e=>{P9(e),a(``),d(0)},children:(0,F.jsxs)(Je,{showCloseButton:!1,className:`top-[20%] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-xl`,children:[(0,F.jsx)(Ye,{className:`sr-only`,children:`Search threads`}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 border-b px-4`,children:[(0,F.jsx)(k,{icon:Ah,className:`text-muted-foreground size-4 shrink-0`}),(0,F.jsx)(`input`,{value:i,onChange:e=>{a(e.target.value),d(0)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;d((_+t+g.length)%g.length)}e.key===`Enter`&&_>=0&&(e.preventDefault(),v(g[_]))},placeholder:`Search threads and actions…`,className:`placeholder:text-placeholder/75 h-11 w-full bg-transparent text-sm outline-none`})]}),(0,F.jsxs)(`div`,{ref:f,className:`max-h-96 overflow-y-auto p-1`,children:[g.length===0&&(0,F.jsx)(`p`,{className:`text-muted-foreground px-3 py-6 text-center text-xs`,children:`Nothing matches.`}),g.map((e,t)=>(0,F.jsxs)(`button`,{"data-active":t===_,className:l(`flex w-full cursor-pointer flex-col rounded-lg px-2.5 py-1.5 text-left`,t===_&&`bg-accent`),onMouseMove:()=>d(t),onClick:()=>v(e),children:[(0,F.jsx)(`span`,{className:`truncate text-sm`,children:e.label}),e.detail!==``&&(0,F.jsx)(`span`,{className:`text-secondary-label truncate text-xs`,children:e.detail})]},e.key))]})]})})}function _Z(e){return e.activity?.approval===!0&&e.activity?.question===!0?(0,F.jsx)(`span`,{title:`Waiting for approval and an answer`,className:`text-question flex`,children:(0,F.jsx)(k,{icon:Lh,className:`size-4 shrink-0`})}):e.activity?.approval===!0?(0,F.jsx)(`span`,{title:`Waiting for approval`,className:`text-question flex`,children:(0,F.jsx)(k,{icon:Ph,className:`size-4 shrink-0`})}):e.activity?.question===!0?(0,F.jsx)(`span`,{title:`Waiting for an answer`,className:`text-question flex`,children:(0,F.jsx)(k,{icon:Xte,className:`size-4 shrink-0`})}):e.activity?.running===!0?(0,F.jsx)(`span`,{title:`Working`,className:`text-info flex`,children:(0,F.jsx)(k,{icon:one,className:`size-4 shrink-0 animate-spin`})}):e.backgroundRunning?e.activity?.backgroundAgent===!0?(0,F.jsx)(`span`,{title:`Agent running in background`,className:`text-info flex`,children:(0,F.jsx)(k,{icon:Dm,className:`size-4 shrink-0 animate-spin`})}):(0,F.jsx)(`span`,{title:`Task running in background`,className:`text-muted-foreground flex`,children:(0,F.jsx)(k,{icon:Dm,className:`size-4 shrink-0 animate-spin`})}):e.done?(0,F.jsx)(`span`,{title:`Done`,className:`text-success flex`,children:(0,F.jsx)(k,{icon:ine,className:`size-4 shrink-0`})}):null}var vZ=`group/sidebar-row relative w-full cursor-pointer overflow-hidden rounded-md text-left outline-none select-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`;function yZ(e){let t=e.session,n=zg(t.machine,t.projectId),r=Q(e=>Wg[T9(e,t.machine).icon]),[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(!1),[c,u]=(0,P.useState)(!1),d=(0,P.useRef)(null),f=e.activity?.waiting===!0,p=Object.values(e.activity?.tasks??{}).includes(`running`),m=!f&&(e.activity?.running===!0||p),h=e.activity?.running===!0||p,g=!f&&!m&&e.unseen,_=!e.selected&&!f&&!g;function v(){tC(t.machine,t.id,e.scope)}function y(){h?u(!0):v()}let b=(0,F.jsx)(kL,{open:c,onOpenChange:u,children:(0,F.jsxs)(NL,{children:[(0,F.jsxs)(PL,{children:[(0,F.jsx)(IL,{children:`Stop running work?`}),(0,F.jsx)(LL,{children:`The agent or background tasks are running. Do you really want to stop them?`})]}),(0,F.jsxs)(FL,{children:[(0,F.jsx)(zL,{children:`Cancel`}),(0,F.jsx)(RL,{variant:`destructive`,onClick:v,children:`Stop and Make Inactive`})]})]})}),x=e.saved&&(0,F.jsxs)(mS,{onOpenChange:()=>s(!1),children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(`button`,{className:`text-muted-foreground hover:text-foreground inline-flex h-5 cursor-pointer items-center rounded-md px-1.5`,title:`Thread actions`,onClick:e=>e.stopPropagation(),children:(0,F.jsx)(k,{icon:mne,className:`size-3.5`})})}),(0,F.jsxs)(_S,{align:`end`,className:`w-44`,onClick:e=>e.stopPropagation(),onCloseAutoFocus:e=>{d.current!==null&&(e.preventDefault(),d.current.focus(),d.current.select())},children:[t.status===`inactive`?(0,F.jsxs)(vS,{onSelect:()=>void eC(t.machine,t.id,{status:`active`}),children:[(0,F.jsx)(k,{icon:Th}),`Make active`]}):(0,F.jsxs)(vS,{onSelect:()=>y(),children:[(0,F.jsx)(k,{icon:wh}),`Inactive`]}),(0,F.jsxs)(vS,{onSelect:()=>void eC(t.machine,t.id,{status:t.status===`snoozed`?`active`:`snoozed`}),children:[(0,F.jsx)(k,{icon:t.status===`snoozed`?um:dm}),t.status===`snoozed`?`Unsnooze`:`Snooze`]}),(0,F.jsxs)(vS,{onSelect:()=>void eC(t.machine,t.id,{status:t.status===`minimized`?`active`:`minimized`}),children:[(0,F.jsx)(k,{icon:t.status===`minimized`?ih:uh}),t.status===`minimized`?`Restore`:`Minimize`]}),(0,F.jsxs)(vS,{onSelect:()=>void eC(t.machine,t.id,{status:t.status===`pinned`?`active`:`pinned`}),children:[(0,F.jsx)(k,{icon:t.status===`pinned`?xh:Sh}),t.status===`pinned`?`Unpin`:`Pin`]}),(0,F.jsx)(CS,{}),(0,F.jsxs)(vS,{onSelect:()=>a(t.title),children:[(0,F.jsx)(k,{icon:bh}),`Rename`]}),(0,F.jsxs)(vS,{variant:`destructive`,title:`Also removes it from ${lC[t.provider]}`,onSelect:e=>{o?nC(t.machine,t.id):(e.preventDefault(),s(!0))},children:[(0,F.jsx)(k,{icon:Nm}),o?`Click again to delete`:`Delete`]})]})]}),S=i===null?(0,F.jsx)(`span`,{className:l(`min-w-0 flex-1 truncate text-sm`,_?`text-secondary-label font-normal`:`font-medium`,!_&&(e.unseen||f)&&`text-foreground`,!_&&!e.unseen&&!f&&`text-foreground/90`),children:t.title}):(0,F.jsx)(`form`,{className:`min-w-0 flex-1`,onSubmit:e=>{e.preventDefault();let n=i.trim();a(null),n!==``&&n!==t.title&&eC(t.machine,t.id,{title:n})},children:(0,F.jsx)(`input`,{ref:d,value:i,onChange:e=>a(e.target.value),onClick:e=>e.stopPropagation(),onBlur:()=>a(null),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&a(null)},className:`text-foreground ring-ring/50 focus:ring-ring w-full rounded-sm bg-transparent text-sm font-medium ring-1 outline-none ring-inset`})}),C=l(e.selected&&`bg-sidebar-row-active text-sidebar-foreground`,_&&`text-sidebar-muted-foreground/75 hover:bg-sidebar-row-hover hover:text-sidebar-foreground`,!e.selected&&!_&&`text-sidebar-foreground hover:bg-sidebar-row-hover bg-transparent`);return e.slim?(0,F.jsxs)(`li`,{className:`list-none`,children:[(0,F.jsxs)(`div`,{role:`button`,tabIndex:0,className:l(vZ,C,`flex h-9 items-center gap-2.5 px-2.5`),onClick:e.onSelect,onKeyDown:t=>{t.key===`Enter`&&e.onSelect()},children:[(0,F.jsx)(`span`,{className:`flex shrink-0 items-center opacity-40 grayscale transition-opacity group-hover/sidebar-row:opacity-100 group-hover/sidebar-row:grayscale-0`,children:(0,F.jsx)(Kg,{machine:t.machine,projectId:t.projectId})}),S,(0,F.jsxs)(`span`,{className:`relative ml-auto flex h-6 min-w-8 shrink-0 items-center justify-end`,children:[(0,F.jsx)(`span`,{className:`text-secondary-label group-any-hover/sidebar-row:opacity-0 inline-flex justify-end text-xs tabular-nums transition-opacity`,children:hC(t.updatedAt)}),(0,F.jsx)(`span`,{className:`group-any-hover/sidebar-row:opacity-100 absolute inset-y-0 right-0 -mr-1 flex items-center opacity-0 transition-opacity has-[[data-state=open]]:opacity-100`,children:x})]})]}),b]}):(0,F.jsxs)(`li`,{className:`list-none py-0.5`,children:[(0,F.jsxs)(`div`,{role:`button`,tabIndex:0,className:l(vZ,C,m&&!e.selected&&`opacity-70 transition-opacity focus-within:opacity-100 hover:opacity-100`),onClick:e.onSelect,onKeyDown:t=>{t.key===`Enter`&&e.onSelect()},children:[(0,F.jsxs)(`div`,{className:`px-(--sidebar-row-content-inset) py-(--sidebar-content-inset)`,children:[(0,F.jsxs)(`div`,{className:`flex h-6 min-w-0 items-center gap-2`,children:[(0,F.jsx)(Kg,{machine:t.machine,projectId:t.projectId,className:`size-5`}),S,t.status===`pinned`&&(0,F.jsx)(k,{icon:Sh,className:`text-muted-foreground/65 size-3 shrink-0`}),(0,F.jsx)(_Z,{activity:e.activity,backgroundRunning:p,done:g})]}),(0,F.jsxs)(`div`,{className:`text-secondary-label mt-1 flex h-5 min-w-0 items-center gap-1.5 text-xs`,children:[(0,F.jsx)(k,{icon:r,className:`size-3 shrink-0`}),(0,F.jsxs)(`span`,{className:l(`min-w-0 flex-1 truncate`,_?`font-normal`:`font-medium`),children:[n,t.branch!==null&&(0,F.jsx)(`span`,{className:`text-muted-foreground/40 font-normal`,children:` | ${t.branch}`})]}),t.status===`snoozed`&&(0,F.jsx)(k,{icon:dm,className:`size-3 shrink-0`}),(0,F.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:hC(t.updatedAt)})]})]}),e.saved&&(0,F.jsxs)(`div`,{className:l(`group-any-hover/sidebar-row:pointer-events-auto group-any-hover/sidebar-row:opacity-100 pointer-events-none absolute inset-y-0 right-0 flex w-20 flex-col items-end bg-linear-to-l from-50% to-transparent py-(--sidebar-content-inset) pr-1.5 opacity-0 transition-opacity has-[[data-state=open]]:pointer-events-auto has-[[data-state=open]]:opacity-100`,e.selected?`from-sidebar-row-active`:`from-sidebar-row-hover`),children:[(0,F.jsx)(`div`,{className:`flex h-6 items-center`,children:(0,F.jsx)(`button`,{className:`text-muted-foreground hover:text-foreground inline-flex h-5 cursor-pointer items-center rounded-md px-1.5`,title:`Make inactive`,"aria-label":`Make inactive`,onClick:e=>{e.stopPropagation(),y()},children:(0,F.jsx)(k,{icon:wh,className:`size-3.5 scale-160`})})}),(0,F.jsx)(`div`,{className:`mt-1 flex h-5 items-center`,children:x})]})]}),b]})}function bZ(e){let t=zg(e.machine,e.projectId),n=Q(t=>Wg[T9(t,e.machine).icon]);return(0,F.jsx)(`li`,{className:`list-none py-0.5`,children:(0,F.jsx)(`div`,{role:`button`,tabIndex:0,className:l(vZ,`bg-sidebar-row-active text-sidebar-foreground`),onClick:e.onSelect,children:(0,F.jsxs)(`div`,{className:`px-(--sidebar-row-content-inset) py-(--sidebar-content-inset)`,children:[(0,F.jsxs)(`div`,{className:`flex h-6 min-w-0 items-center gap-2`,children:[(0,F.jsx)(Kg,{machine:e.machine,projectId:e.projectId,className:`size-5`}),(0,F.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate text-sm font-medium`,children:`New thread`}),(0,F.jsx)(k,{icon:Bh,className:`text-warning-foreground size-4 shrink-0`})]}),(0,F.jsxs)(`div`,{className:`text-secondary-label mt-1 flex h-5 min-w-0 items-center gap-1.5 text-xs`,children:[(0,F.jsx)(k,{icon:n,className:`size-3 shrink-0`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:[t,(0,F.jsx)(`span`,{className:`text-muted-foreground/40 font-normal`,children:` | Draft`})]}),(0,F.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:`now`})]})]})})})}function xZ(e){return(0,F.jsxs)(mS,{children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(`button`,{className:e.className,title:`Menu`,"aria-label":`Menu`,children:(0,F.jsx)(k,{icon:oh})})}),(0,F.jsxs)(_S,{align:`start`,className:`w-48`,children:[(0,F.jsx)(bS,{value:e.filter,children:[[`active`,Th],[`snoozed`,dm],[`minimized`,uh],[`inactive`,wh]].map(([t,n])=>(0,F.jsxs)(xS,{value:t,className:`capitalize`,onSelect:()=>e.onFilter(t),children:[(0,F.jsx)(k,{icon:n}),t]},t))}),(0,F.jsx)(CS,{}),(0,F.jsxs)(vS,{onSelect:e.onTerminal,children:[(0,F.jsx)(k,{icon:Hh}),`Terminal`]}),(0,F.jsxs)(vS,{onSelect:()=>F9(!0),children:[(0,F.jsx)(k,{icon:Nh}),`Settings`]})]})]})}function SZ({...e}){return(0,F.jsx)(jy,{"data-slot":`context-menu`,...e})}function CZ({className:e,...t}){return(0,F.jsx)(Ny,{"data-slot":`context-menu-trigger`,className:l(`select-none`,e),...t})}function wZ({...e}){return(0,F.jsx)(Uy,{"data-slot":`context-menu-sub`,...e})}function TZ({...e}){return(0,F.jsx)(Ry,{"data-slot":`context-menu-radio-group`,...e})}function EZ({className:e,...t}){return(0,F.jsx)(Py,{children:(0,F.jsx)(Iy,{"data-slot":`context-menu-content`,className:l(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})})}function DZ({className:e,inset:t,variant:n=`default`,...r}){return(0,F.jsx)(Ly,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:l(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function OZ({className:e,inset:t,children:n,...r}){return(0,F.jsxs)(Wy,{"data-slot":`context-menu-sub-trigger`,"data-inset":t,className:l(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,F.jsx)(k,{icon:ym,strokeWidth:2,className:`ml-auto`})]})}function kZ({className:e,...t}){return(0,F.jsx)(Gy,{"data-slot":`context-menu-sub-content`,className:l(`z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}function AZ({className:e,children:t,inset:n,...r}){return(0,F.jsxs)(zy,{"data-slot":`context-menu-radio-item`,"data-inset":n,className:l(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,F.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,F.jsx)(By,{children:(0,F.jsx)(k,{icon:Gh,strokeWidth:2})})}),t]})}function jZ({className:e,...t}){return(0,F.jsx)(Vy,{"data-slot":`context-menu-separator`,className:l(`-mx-1 my-1 h-px bg-border`,e),...t})}var MZ=`relative w-full cursor-pointer overflow-hidden rounded-md text-left outline-none select-none touch-pan-y [-webkit-touch-callout:none] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`;function NZ(e){let t=e.session,n=zg(t.machine,t.projectId),r=Q(e=>Wg[T9(e,t.machine).icon]),[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(!1),[c,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(0),p=(0,P.useRef)(null),m=(0,P.useRef)(null),h=(0,P.useRef)(!1),g=e.activity?.waiting===!0,_=Object.values(e.activity?.tasks??{}).includes(`running`),v=!g&&(e.activity?.running===!0||_),y=e.activity?.running===!0||_,b=!g&&!v&&e.unseen,x=!e.selected&&!g&&!b;function S(){tC(t.machine,t.id,e.scope)}function C(){y?u(!0):S()}function w(e){let n=m.current;m.current=null,f(0),n!==null&&n.swiping&&(h.current=!0,e.clientX-n.x>e.currentTarget.offsetWidth*.4&&(t.status===`inactive`?eC(t.machine,t.id,{status:`active`}):C()))}let T={onClick:()=>{h.current?h.current=!1:e.onSelect()},onPointerDown:t=>{e.saved&&t.pointerType===`touch`&&(h.current=!1,m.current={x:t.clientX,y:t.clientY,swiping:!1})},onPointerMove:e=>{let t=m.current;if(t===null)return;let n=e.clientX-t.x,r=e.clientY-t.y;!t.swiping&&Math.abs(n)<10&&Math.abs(r)<10||(!t.swiping&&n<=Math.abs(r)?m.current=null:(t.swiping=!0,f(Math.max(0,n))))},onPointerUp:w,onPointerCancel:()=>{m.current=null,f(0)}},E=d>0&&(0,F.jsx)(`div`,{className:l(`absolute inset-x-0 flex items-center rounded-md px-4 text-white`,e.slim?`inset-y-0`:`inset-y-0.5`,t.status===`inactive`?`bg-success`:`bg-destructive`),children:(0,F.jsx)(k,{icon:t.status===`inactive`?Th:wh,className:`size-6`})}),D=(0,F.jsx)(kL,{open:c,onOpenChange:u,children:(0,F.jsxs)(NL,{children:[(0,F.jsxs)(PL,{children:[(0,F.jsx)(IL,{children:`Stop running work?`}),(0,F.jsx)(LL,{children:`The agent or background tasks are running. Do you really want to stop them?`})]}),(0,F.jsxs)(FL,{children:[(0,F.jsx)(zL,{children:`Cancel`}),(0,F.jsx)(RL,{variant:`destructive`,onClick:S,children:`Stop and Make Inactive`})]})]})}),O=(0,F.jsxs)(EZ,{className:`w-44`,onCloseAutoFocus:e=>{p.current!==null&&(e.preventDefault(),p.current.focus(),p.current.select())},children:[t.status===`inactive`?(0,F.jsxs)(DZ,{onSelect:()=>void eC(t.machine,t.id,{status:`active`}),children:[(0,F.jsx)(k,{icon:Th}),`Make active`]}):(0,F.jsxs)(DZ,{onSelect:()=>C(),children:[(0,F.jsx)(k,{icon:wh}),`Inactive`]}),(0,F.jsxs)(DZ,{onSelect:()=>void eC(t.machine,t.id,{status:t.status===`snoozed`?`active`:`snoozed`}),children:[(0,F.jsx)(k,{icon:t.status===`snoozed`?um:dm}),t.status===`snoozed`?`Unsnooze`:`Snooze`]}),(0,F.jsxs)(DZ,{onSelect:()=>void eC(t.machine,t.id,{status:t.status===`minimized`?`active`:`minimized`}),children:[(0,F.jsx)(k,{icon:t.status===`minimized`?ih:uh}),t.status===`minimized`?`Restore`:`Minimize`]}),(0,F.jsxs)(DZ,{onSelect:()=>void eC(t.machine,t.id,{status:t.status===`pinned`?`active`:`pinned`}),children:[(0,F.jsx)(k,{icon:t.status===`pinned`?xh:Sh}),t.status===`pinned`?`Unpin`:`Pin`]}),(0,F.jsx)(jZ,{}),(0,F.jsxs)(DZ,{onSelect:()=>a(t.title),children:[(0,F.jsx)(k,{icon:bh}),`Rename`]}),(0,F.jsxs)(DZ,{variant:`destructive`,title:`Also removes it from ${lC[t.provider]}`,onSelect:e=>{o?nC(t.machine,t.id):(e.preventDefault(),s(!0))},children:[(0,F.jsx)(k,{icon:Nm}),o?`Tap again to delete`:`Delete`]})]}),A=i===null?(0,F.jsx)(`span`,{className:l(`min-w-0 flex-1 truncate text-sm`,x?`text-secondary-label font-normal`:`font-medium`,!x&&(e.unseen||g)&&`text-foreground`,!x&&!e.unseen&&!g&&`text-foreground/90`),children:t.title}):(0,F.jsx)(`form`,{className:`min-w-0 flex-1`,onSubmit:e=>{e.preventDefault();let n=i.trim();a(null),n!==``&&n!==t.title&&eC(t.machine,t.id,{title:n})},children:(0,F.jsx)(`input`,{ref:p,value:i,onChange:e=>a(e.target.value),onClick:e=>e.stopPropagation(),onBlur:()=>a(null),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&a(null)},className:`text-foreground ring-ring/50 focus:ring-ring w-full rounded-sm bg-transparent text-sm font-medium ring-1 outline-none ring-inset`})}),j=l(e.selected&&`bg-sidebar-row-active text-sidebar-foreground`,x&&`text-sidebar-muted-foreground/75`,!e.selected&&!x&&`text-sidebar-foreground bg-transparent`);return e.slim?(0,F.jsxs)(`li`,{className:`relative list-none`,children:[E,(0,F.jsxs)(SZ,{onOpenChange:()=>s(!1),children:[(0,F.jsx)(CZ,{asChild:!0,disabled:!e.saved,children:(0,F.jsxs)(`div`,{role:`button`,tabIndex:0,className:l(MZ,j,`flex h-9 items-center gap-2.5 px-2.5`,d>0&&`bg-sidebar`),style:d>0?{transform:`translateX(${d}px)`}:void 0,...T,onKeyDown:t=>{t.key===`Enter`&&e.onSelect()},children:[(0,F.jsx)(`span`,{className:`flex shrink-0 items-center opacity-40 grayscale`,children:(0,F.jsx)(Kg,{machine:t.machine,projectId:t.projectId})}),A,(0,F.jsx)(`span`,{className:`text-secondary-label ml-auto shrink-0 text-xs tabular-nums`,children:hC(t.updatedAt)})]})}),O]}),D]}):(0,F.jsxs)(`li`,{className:`relative list-none py-0.5`,children:[E,(0,F.jsxs)(SZ,{onOpenChange:()=>s(!1),children:[(0,F.jsx)(CZ,{asChild:!0,disabled:!e.saved,children:(0,F.jsx)(`div`,{role:`button`,tabIndex:0,className:l(MZ,j,v&&!e.selected&&`opacity-70`,d>0&&`bg-sidebar`),style:d>0?{transform:`translateX(${d}px)`}:void 0,...T,onKeyDown:t=>{t.key===`Enter`&&e.onSelect()},children:(0,F.jsxs)(`div`,{className:`px-(--sidebar-row-content-inset) py-(--sidebar-content-inset)`,children:[(0,F.jsxs)(`div`,{className:`flex h-6 min-w-0 items-center gap-2`,children:[(0,F.jsx)(Kg,{machine:t.machine,projectId:t.projectId,className:`size-5`}),A,t.status===`pinned`&&(0,F.jsx)(k,{icon:Sh,className:`text-muted-foreground/65 size-3 shrink-0`}),(0,F.jsx)(_Z,{activity:e.activity,backgroundRunning:_,done:b})]}),(0,F.jsxs)(`div`,{className:`text-secondary-label mt-1 flex h-5 min-w-0 items-center gap-1.5 text-xs`,children:[(0,F.jsx)(k,{icon:r,className:`size-3 shrink-0`}),(0,F.jsxs)(`span`,{className:l(`min-w-0 flex-1 truncate`,x?`font-normal`:`font-medium`),children:[n,t.branch!==null&&(0,F.jsx)(`span`,{className:`text-muted-foreground/40 font-normal`,children:` | ${t.branch}`})]}),t.status===`snoozed`&&(0,F.jsx)(k,{icon:dm,className:`size-3 shrink-0`}),(0,F.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:hC(t.updatedAt)})]})]})})}),O]}),D]})}function PZ(e){let t=zg(e.machine,e.projectId),n=Q(t=>Wg[T9(t,e.machine).icon]);return(0,F.jsx)(`li`,{className:`list-none py-0.5`,children:(0,F.jsx)(`div`,{role:`button`,tabIndex:0,className:l(MZ,`bg-sidebar-row-active text-sidebar-foreground`),onClick:e.onSelect,children:(0,F.jsxs)(`div`,{className:`px-(--sidebar-row-content-inset) py-(--sidebar-content-inset)`,children:[(0,F.jsxs)(`div`,{className:`flex h-6 min-w-0 items-center gap-2`,children:[(0,F.jsx)(Kg,{machine:e.machine,projectId:e.projectId,className:`size-5`}),(0,F.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate text-sm font-medium`,children:`New thread`}),(0,F.jsx)(k,{icon:Bh,className:`text-warning-foreground size-4 shrink-0`})]}),(0,F.jsxs)(`div`,{className:`text-secondary-label mt-1 flex h-5 min-w-0 items-center gap-1.5 text-xs`,children:[(0,F.jsx)(k,{icon:n,className:`size-3 shrink-0`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:[t,(0,F.jsx)(`span`,{className:`text-muted-foreground/40 font-normal`,children:` | Draft`})]}),(0,F.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:`now`})]})]})})})}function FZ({className:e,...t}){return(0,F.jsx)(_b,{"data-slot":`label`,className:l(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var IZ={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t`,383:`s`,384:`b`,385:`B`,387:`b`,390:`O`,392:`c`,393:`D`,394:`D`,396:`d`,398:`E`,400:`E`,402:`f`,403:`G`,407:`I`,409:`k`,410:`l`,412:`M`,413:`N`,414:`n`,415:`O`,421:`p`,427:`t`,429:`t`,430:`T`,434:`V`,436:`y`,438:`z`,477:`e`,485:`g`,544:`N`,545:`d`,549:`z`,564:`l`,565:`n`,566:`t`,567:`j`,570:`A`,571:`C`,572:`c`,573:`L`,574:`T`,575:`s`,576:`z`,579:`B`,580:`U`,581:`V`,582:`E`,583:`e`,584:`J`,585:`j`,586:`Q`,587:`q`,588:`R`,589:`r`,590:`Y`,591:`y`,592:`a`,593:`a`,595:`b`,596:`o`,597:`c`,598:`d`,599:`d`,600:`e`,603:`e`,604:`e`,605:`e`,606:`e`,607:`j`,608:`g`,609:`g`,610:`G`,613:`h`,614:`h`,616:`i`,618:`I`,619:`l`,620:`l`,621:`l`,623:`m`,624:`m`,625:`m`,626:`n`,627:`n`,628:`N`,629:`o`,633:`r`,634:`r`,635:`r`,636:`r`,637:`r`,638:`r`,639:`r`,640:`R`,641:`R`,642:`s`,647:`t`,648:`t`,649:`u`,651:`v`,652:`v`,653:`w`,654:`y`,655:`Y`,656:`z`,657:`z`,663:`c`,665:`B`,666:`e`,667:`G`,668:`H`,669:`j`,670:`k`,671:`L`,672:`q`,686:`h`,867:`a`,868:`e`,869:`i`,870:`o`,871:`u`,872:`c`,873:`d`,874:`h`,875:`m`,876:`r`,877:`t`,878:`v`,879:`x`,7424:`A`,7427:`B`,7428:`C`,7429:`D`,7431:`E`,7432:`e`,7433:`i`,7434:`J`,7435:`K`,7436:`L`,7437:`M`,7438:`N`,7439:`O`,7440:`O`,7441:`o`,7442:`o`,7443:`o`,7446:`o`,7447:`o`,7448:`P`,7449:`R`,7450:`R`,7451:`T`,7452:`U`,7453:`u`,7454:`u`,7455:`m`,7456:`V`,7457:`W`,7458:`Z`,7522:`i`,7523:`r`,7524:`u`,7525:`v`,7834:`a`,7835:`s`,8305:`i`,8341:`h`,8342:`k`,8343:`l`,8344:`m`,8345:`n`,8346:`p`,8347:`s`,8348:`t`,8580:`c`};for(let e=`̀`.codePointAt(0);e<=`ͯ`.codePointAt(0);++e){let t=String.fromCodePoint(e);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`){let n=(e+t).normalize().codePointAt(0);n>126&&(IZ[n]=e)}}var LZ={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys(LZ)){let t=e.toUpperCase();for(let n=LZ[e][0];n<=LZ[e][1];++n)IZ[n]=n%2==0?t:e}function RZ(e){if(e<192||e>8580)return e;let t=IZ[e];return t===void 0?e:t.codePointAt(0)}function zZ(e){return e}function BZ(e){return e}function VZ(e,t){return e>t?e:t}var HZ=e=>e.split(``).map(e=>e.codePointAt(0)),UZ=new Set(` \f
106
- \r \v\xA0 \u2028\u2029   `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)UZ.add(e);var WZ=``.codePointAt(0),GZ=`A`.codePointAt(0),KZ=`Z`.codePointAt(0),qZ=`a`.codePointAt(0),JZ=`z`.codePointAt(0),YZ=`0`.codePointAt(0),XZ=`9`.codePointAt(0);function ZZ(e,t,n){return n?e:t-e-1}var QZ=16,$Z=-3,eQ=-1,tQ=QZ/2,nQ=QZ/2,rQ=7,iQ=4,aQ=2;function oQ(e){return e?new Set:null}function sQ(e,t,n){if(t!==null&&t.i16.length>e+n){let r=t.i16.subarray(e,e+n);return[e+n,r]}return[e,new Int16Array(n)]}function cQ(e,t,n){if(t!==null&&t.i32.length>e+n){let r=t.i32.subarray(e,e+n);return[e+n,r]}return[e,new Int32Array(n)]}function lQ(e){return e>=qZ&&e<=JZ?1:e>=GZ&&e<=KZ?2:e>=YZ&&e<=XZ?4:0}function uQ(e){let t=String.fromCodePoint(e);return t===t.toUpperCase()?t===t.toLowerCase()?t.match(/\p{Number}/gu)===null?t.match(/\p{Letter}/gu)===null?0:3:4:2:1}function dQ(e){return e<=WZ?lQ(e):uQ(e)}function fQ(e,t){return e===0&&t!==0?tQ:e===1&&t===2||e!==4&&t===4?rQ:t===0?nQ:0}function pQ(e,t){return t===0?tQ:fQ(dQ(e[t-1]),dQ(e[t]))}function mQ(e,t,n,r){let i=e.slice(r),a=i.indexOf(n);if(a===0)return r;if(!t&&n>=qZ&&n<=JZ){a>0&&(i=i.slice(0,a));let e=i.indexOf(n-32);e>=0&&(a=e)}return a<0?-1:r+a}function hQ(e){for(let t of e)if(t>=128)return!1;return!0}function gQ(e,t,n){if(!hQ(e))return 0;if(!hQ(t))return-1;let r=0,i=0;for(let a=0;a<t.length;a++){if(i=mQ(e,n,t[a],i),i<0)return-1;a===0&&i>0&&(r=i-1),i++}return r}var _Q=(e,t,n,r,i,a,o)=>{let s=i.length;if(s===0)return[{start:0,end:0,score:0},oQ(a)];let c=r.length;if(o!==null&&c*s>o.i16.length)return yQ(e,t,n,r,i,a);let l=gQ(r,i,e);if(l<0)return[{start:-1,end:-1,score:0},null];let u=0,d=0,f=null,p=null,m=null,h=null;[u,f]=sQ(u,o,c),[u,p]=sQ(u,o,c),[u,m]=sQ(u,o,c),[d,h]=cQ(d,o,s);let[,g]=cQ(d,o,c);for(let e=0;e<g.length;e++)g[e]=r[e];let _=zZ(0),v=0,y=0,b=0,x=i[0],S=i[0],C=zZ(0),w=0,T=!1,E=g.subarray(l),D=f.subarray(l).subarray(0,E.length),O=p.subarray(l).subarray(0,E.length),k=m.subarray(l).subarray(0,E.length);for(let[r,a]of E.entries()){let o=null;a<=WZ?(o=lQ(a),!e&&o===2&&(a+=32)):(o=uQ(a),!e&&o===2&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)),t&&(a=RZ(a))),E[r]=a;let c=fQ(w,o);if(k[r]=c,w=o,a===S&&(y<s&&(h[y]=BZ(l+r),y++,S=i[Math.min(y,s-1)]),b=l+r),a===x){let e=QZ+c*aQ;if(D[r]=e,O[r]=1,s===1&&(n&&e>_||!n&&e>=_)&&(_=e,v=l+r,n&&c===tQ))break;T=!1}else D[r]=VZ(T?C+eQ:C+$Z,0),O[r]=0,T=!0;C=D[r]}if(y!==s)return[{start:-1,end:-1,score:0},null];if(s===1){let e={start:v,end:v+1,score:_};if(!a)return[e,null];let t=new Set;return t.add(v),[e,t]}let A=h[0],j=b-A+1,M=null;[u,M]=sQ(u,o,j*s);{let e=f.subarray(A,b+1);for(let[t,n]of e.entries())M[t]=n}let[,N]=sQ(u,o,j*s);{let e=p.subarray(A,b+1);for(let[t,n]of e.entries())N[t]=n}let ee=h.subarray(1),te=i.slice(1).slice(0,ee.length);for(let[e,t]of ee.entries()){let r=!1,i=te[e],a=e+1,o=a*j,c=g.subarray(t,b+1),l=m.subarray(t).subarray(0,c.length),u=N.subarray(o+t-A).subarray(0,c.length),d=N.subarray(o+t-A-1-j).subarray(0,c.length),f=M.subarray(o+t-A).subarray(0,c.length),p=M.subarray(o+t-A-1-j).subarray(0,c.length),h=M.subarray(o+t-A-1).subarray(0,c.length);h[0]=0;for(let[e,o]of c.entries()){let c=e+t,g=0,y=0,b=0;if(y=r?h[e]+eQ:h[e]+$Z,i===o){g=p[e]+QZ;let t=l[e];b=d[e]+1,t===tQ?b=1:b>1&&(t=VZ(t,VZ(iQ,m[c-b+1]))),g+t<y?(g+=l[e],b=0):g+=t}u[e]=b,r=g<y;let x=VZ(VZ(g,y),0);a===s-1&&(n&&x>_||!n&&x>=_)&&(_=x,v=c),f[e]=x}}let ne=oQ(a),re=A;if(a&&ne!==null){let e=s-1;re=v;let t=!0;for(;;){let n=e*j,r=re-A,i=M[n+r],a=0,o=0;if(e>0&&re>=h[e]&&(a=M[n-j+r-1]),re>h[e]&&(o=M[n+r-1]),i>a&&(i>o||i===o&&t)){if(ne.add(re),e===0)break;e--}t=N[n+r]>1||n+j+r+1<N.length&&N[n+j+r+1]>0,re--}}return[{start:re,end:v+1,score:_},ne]};function vQ(e,t,n,r,i,a,o){let s=0,c=0,l=!1,u=0,d=zZ(0),f=oQ(o),p=0;i>0&&(p=dQ(n[i-1]));for(let m=i;m<a;m++){let i=n[m],a=dQ(i);if(e||(i>=GZ&&i<=KZ?i+=32:i>WZ&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),t&&(i=RZ(i)),i===r[s]){o&&f!==null&&f.add(m),c+=QZ;let e=fQ(p,a);u===0?d=e:(e===tQ&&(d=e),e=VZ(VZ(e,d),iQ)),c+=s===0?e*aQ:e,l=!1,u++,s++}else c+=l?eQ:$Z,l=!0,u=0,d=0;p=a}return[c,f]}var yQ=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];if(gQ(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let s=0,c=-1,l=-1,u=r.length,d=i.length;for(let a=0;a<u;a++){let o=r[ZZ(a,u,n)];e||(o>=GZ&&o<=KZ?o+=32:o>WZ&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0))),t&&(o=RZ(o));let f=i[ZZ(s,d,n)];if(o===f&&(c<0&&(c=a),s++,s===d)){l=a+1;break}}if(c>=0&&l>=0){s--;for(let t=l-1;t>=c;t--){let a=r[ZZ(t,u,n)];e||(a>=GZ&&a<=KZ?a+=32:a>WZ&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)));let o=i[ZZ(s,d,n)];if(a===o&&(s--,s<0)){c=t;break}}if(!n){let e=c;c=u-l,l=u-e}let[o,f]=vQ(e,t,r,i,c,l,a);return[{start:c,end:l,score:o},f]}return[{start:-1,end:-1,score:0},null]},bQ=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];let s=r.length,c=i.length;if(s<c||gQ(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,u=-1,d=zZ(0),f=zZ(-1);for(let a=0;a<s;a++){let o=ZZ(a,s,n),p=r[o];e||(p>=GZ&&p<=KZ?p+=32:p>WZ&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=RZ(p));let m=ZZ(l,c,n);if(i[m]===p){if(m===0&&(d=pQ(r,o)),l++,l===c){if(d>f&&(u=a,f=d),d===tQ)break;a-=l-1,l=0,d=0}}else a-=l,l=0,d=0}if(u>=0){let a=0,o=0;n?(a=u-c+1,o=u+1):(a=s-(u+1),o=s-(u-c+1));let[l]=vQ(e,t,r,i,a,o,!1);return[{start:a,end:o,score:l},null]}return[{start:-1,end:-1,score:0},null]},xQ=102400,SQ=2048;function CQ(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}var wQ=CQ(xQ,SQ),TQ=(e,t,n)=>{let r=!1;switch(t){case`smart-case`:e.toLowerCase()!==e&&(r=!0);break;case`case-sensitive`:r=!0;break;case`case-insensitive`:e=e.toLowerCase(),r=!1}let i=HZ(e);return n&&(i=i.map(RZ)),{queryRunes:i,caseSensitive:r}};function EQ(e,t){let n=Object.keys(e).map(e=>parseInt(e,10)).sort((e,t)=>t-e),r=[];for(let i of n)if(r=r.concat(e[i]),r.length>=t)break;return r}function DQ(e,t,n){return r=>{let i=this.runesList[r];if(t.length>i.length)return;let[a,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,i,t,!0,wQ);if(a.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let e=a.start;e<a.end;++e)o.add(e)}let s=this.opts.sort?a.score:0;e[s]===void 0&&(e[s]=[]),e[s].push({item:this.items[r],...a,positions:o??new Set})}}function OQ(e){let{queryRunes:t,caseSensitive:n}=TQ(e,this.opts.casing,this.opts.normalize),r={},i=DQ.bind(this)(r,t,n);for(let e=0,t=this.runesList.length;e<t;++e)i(e);return EQ(r,this.opts.limit)}var kQ={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0},AQ=class{constructor(e,...t){switch(this.opts={...kQ,...t[0]},this.items=e,this.runesList=e.map(e=>HZ(this.opts.selector(e).normalize())),this.algoFn=bQ,this.opts.fuzzy){case`v2`:this.algoFn=_Q;break;case`v1`:this.algoFn=yQ}}},jQ={...kQ,match:OQ},MQ=class extends AQ{constructor(e,...t){super(e,...t),this.opts={...jQ,...t[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(NQ):(e=e.normalize(),PQ(this.opts.match.bind(this)(e),this.opts))}};({...kQ});var NQ=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function PQ(e,t){if(t.sort){let{selector:n}=t;e.sort((e,r)=>{if(e.score===r.score)for(let i of t.tiebreakers){let t=i(e,r,n);if(t!==0)return t}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}function FQ(e,t,n){return n(e.item).length-n(t.item).length}var IQ=class{constructor(e,...t){this.finder=new MQ(e,...t),this.find=this.finder.find.bind(this.finder)}};function LQ(e){let[t,n]=(0,P.useState)(null),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(``),[c,l]=(0,P.useState)(null),u=a===``?``:`${a}/`,d=(t??[]).filter(e=>e.startsWith(u)).map(e=>e.slice(u.length)),f=[...new Set(d.filter(e=>e.includes(`/`)).map(e=>e.split(`/`)[0]))].sort((e,t)=>e.localeCompare(t)),p=r===``?d.filter(e=>!e.includes(`/`)).sort((e,t)=>e.localeCompare(t)).map(e=>`${u}${e}`):new IQ(t??[],{limit:50,casing:`case-insensitive`,tiebreakers:[(e,t)=>RQ(t)-RQ(e),FQ]}).find(r).map(e=>e.item);return(0,P.useEffect)(()=>{let t=!1;return(async()=>{try{let r=await I(e.machine,`projects.logoFiles`,{id:e.projectId});t||n(r)}catch(e){t||l(s(e))}})(),()=>{t=!0}},[e.machine,e.projectId]),(0,F.jsx)(Xe,{open:!0,onOpenChange:()=>e.onClose(),children:(0,F.jsxs)(Je,{className:`gap-0 overflow-hidden p-0 sm:max-w-lg`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,F.jsx)(Ye,{className:`sr-only`,children:`Pick icon`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 border-b p-1`,children:[(0,F.jsxs)(`label`,{className:`flex h-7 min-w-0 flex-1 items-center gap-2.5 px-2`,children:[(0,F.jsx)(k,{icon:Ah,className:`text-muted-foreground size-4 flex-none`}),(0,F.jsx)(`input`,{className:`placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent text-sm outline-none`,placeholder:`Search images in this project`,value:r,onChange:e=>i(e.target.value)})]}),(0,F.jsx)(Ge,{asChild:!0,children:(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,children:(0,F.jsx)(k,{icon:xm})})})]}),r===``&&(0,F.jsxs)(`div`,{className:`flex items-center gap-1 border-b p-1`,children:[(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Parent folder`,disabled:a===``,onClick:()=>o(a.split(`/`).slice(0,-1).join(`/`)),children:(0,F.jsx)(k,{icon:bm})}),(0,F.jsxs)(`span`,{className:`truncate px-1.5 font-mono text-xs`,children:[`/`,a]})]}),(0,F.jsxs)(`div`,{className:`h-72 overflow-y-auto p-1`,children:[r===``&&f.map(e=>(0,F.jsxs)(`button`,{className:`hover:bg-muted flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-left text-sm transition-colors`,onClick:()=>o(`${u}${e}`),children:[(0,F.jsx)(k,{icon:Fm,className:`text-muted-foreground size-4 flex-none`}),(0,F.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e})]},e)),p.map(t=>(0,F.jsxs)(`button`,{className:`hover:bg-muted flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-left text-sm transition-colors`,onClick:async()=>{try{let n=await I(e.machine,`files.read`,{projectId:e.projectId,path:t});n.kind===`image`?e.onPick(`data:${n.mediaType};base64,${n.data}`):n.kind===`large`?l(`${t} is too large`):l(`${t} is not an image`)}catch(e){l(s(e))}},children:[(0,F.jsx)(k,{icon:Km,className:`text-muted-foreground size-4 flex-none`}),(0,F.jsx)(`span`,{className:`truncate font-mono text-xs`,children:r===``?t.slice(u.length):t})]},t)),t?.length===0&&(0,F.jsx)(`p`,{className:`text-muted-foreground grid h-full place-items-center text-sm`,children:`No images in this project`}),t!==null&&t.length>0&&r!==``&&p.length===0&&(0,F.jsx)(`p`,{className:`text-muted-foreground grid h-full place-items-center text-sm`,children:`No matching images`})]}),c!==null&&(0,F.jsx)(`p`,{className:`text-destructive border-t px-3 py-2 text-sm break-all`,children:c})]})})}function RQ(e){let t=e.item.lastIndexOf(`/`)+1;return[...e.positions].filter(e=>e>=t).length}function zQ(e){let t=Q(e=>e.machines),[n,r]=(0,P.useState)(e.machine),[i,a]=(0,P.useState)(null),[o,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(()=>BQ(t.find(t=>t.id===e.machine))),[d,f]=(0,P.useState)(``),[p,m]=(0,P.useState)(!1),h=l.trim()===``?void 0:i?.listing,g=h?.directories.filter(e=>e.name.toLowerCase().includes(d.toLowerCase()));function _(e){u(e),f(``)}return(0,P.useEffect)(()=>{if(l.trim()===``)return;let e=!1,t=setTimeout(async()=>{try{let t=await I(n,`directories.list`,{path:l});if(e)return;a({path:l,listing:t}),c(null)}catch(t){if(e)return;a(null),c(s(t))}},150);return()=>{e=!0,clearTimeout(t)}},[n,l]),(0,F.jsx)(Xe,{open:!0,onOpenChange:()=>e.onClose(),children:(0,F.jsxs)(Je,{className:`gap-0 overflow-hidden p-0 sm:max-w-lg`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,F.jsx)(Ye,{className:`sr-only`,children:`Add project`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 border-b p-1`,children:[(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Home folder`,onClick:()=>_(`~`),children:(0,F.jsx)(k,{icon:Gm})}),(0,F.jsx)(`div`,{className:`bg-border mx-0.5 h-4 w-px`}),(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Parent folder`,disabled:h?.parent===void 0||h.parent===null,onClick:()=>{h?.parent!==void 0&&h.parent!==null&&_(h.parent)},children:(0,F.jsx)(k,{icon:bm})}),(0,F.jsx)(`input`,{"aria-label":`Folder path`,className:`hover:bg-muted focus:bg-muted h-7 min-w-0 flex-1 rounded-md bg-transparent px-1.5 font-mono text-xs outline-none`,spellCheck:!1,value:l,onChange:e=>_(e.target.value)}),(0,F.jsx)(Ge,{asChild:!0,children:(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,children:(0,F.jsx)(k,{icon:xm})})})]}),(0,F.jsxs)(`label`,{className:`flex h-9 items-center gap-2.5 border-b px-3`,children:[(0,F.jsx)(k,{icon:Ah,className:`text-muted-foreground size-4 flex-none`}),(0,F.jsx)(`input`,{className:`placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent text-sm outline-none`,placeholder:`Search this folder`,value:d,onChange:e=>f(e.target.value)})]}),(0,F.jsxs)(`div`,{className:`h-72 overflow-y-auto p-1`,children:[g?.map(e=>(0,F.jsxs)(`button`,{className:`hover:bg-muted flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-left text-sm transition-colors`,onClick:()=>_(e.path),children:[(0,F.jsx)(k,{icon:Fm,className:`text-muted-foreground size-4 flex-none`}),(0,F.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)),g?.length===0&&(0,F.jsx)(`p`,{className:`text-muted-foreground grid h-full place-items-center text-sm`,children:d===``?`No folders here`:`No matching folders`})]}),o!==null&&l.trim()!==``&&(0,F.jsx)(`p`,{className:`text-destructive border-t px-3 py-2 text-sm break-all`,children:o}),(0,F.jsxs)(Fe,{className:`border-t p-3`,children:[t.length>1&&(0,F.jsxs)(lL,{value:n,onValueChange:e=>{r(e),a(null),_(BQ(t.find(t=>t.id===e)))},children:[(0,F.jsx)(dL,{className:`sm:mr-auto sm:w-56`,children:(0,F.jsx)(uL,{})}),(0,F.jsx)(fL,{children:t.map(e=>(0,F.jsx)(pL,{value:e.id,disabled:e.status!==`online`,children:e.name},e.id))})]}),(0,F.jsx)(E,{disabled:i?.path!==l||p,onClick:async()=>{if(i!==null&&i.path===l){m(!0);try{e.onAdd({...await Bg(n,i.listing.path),machine:n})}catch(e){c(s(e)),m(!1)}}},children:`Add project`})]})]})})}function BQ(e){return e===void 0||e.config===null||e.system===null?`~`:e.config.workingDir[e.system.platform]??`~`}function VQ(e){let t=e.project.path,[n,r]=(0,P.useState)(e.project.name),[i,a]=(0,P.useState)(e.project.logo),[o,c]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(!1),g=(0,P.useRef)(null);return(0,F.jsx)(Xe,{open:!0,onOpenChange:()=>e.onClose(),children:(0,F.jsxs)(Je,{className:`gap-0 overflow-hidden p-0 sm:max-w-md`,children:[(0,F.jsxs)(`form`,{className:`grid`,onSubmit:async t=>{t.preventDefault(),d(!0);try{await Vg(e.project.machine,e.project.id,{name:n,logo:i===e.project.logo?void 0:i}),e.onClose()}catch(e){c(s(e)),d(!1)}},children:[(0,F.jsxs)(Ke,{className:`gap-1 px-6 pt-4 pr-12`,children:[(0,F.jsx)(Ye,{className:`text-base`,children:`Edit project`}),(0,F.jsx)(He,{className:`truncate font-mono text-xs`,title:t,children:t})]}),(0,F.jsxs)(`div`,{className:`grid gap-6 p-6`,children:[(0,F.jsxs)(`div`,{className:`grid gap-2.5`,children:[(0,F.jsx)(FZ,{children:`Icon`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,F.jsxs)(`div`,{className:`relative flex-none`,children:[(0,F.jsx)(qg,{name:n.trim()===``?mC(t):n,logo:i,className:`ring-foreground/10 size-16 rounded-2xl ring-1 [&>img]:rounded-2xl [&>svg]:rounded-2xl`}),i!==null&&(0,F.jsx)(`button`,{type:`button`,className:`bg-popover text-muted-foreground hover:text-foreground absolute -top-1.5 -right-1.5 grid size-5 cursor-pointer place-items-center rounded-full border shadow-xs`,title:`Remove icon`,onClick:()=>a(null),children:(0,F.jsx)(k,{icon:xm,className:`size-3`})})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsxs)(E,{type:`button`,variant:`outline`,size:`sm`,title:`Upload an image from this device`,onClick:()=>g.current?.click(),children:[(0,F.jsx)(k,{icon:Yh}),`Upload`]}),(0,F.jsxs)(E,{type:`button`,variant:`outline`,size:`sm`,title:`Choose an image from the project on the server`,onClick:()=>h(!0),children:[(0,F.jsx)(k,{icon:Fm}),`Choose from project`]})]}),(0,F.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`PNG, JPG, WebP, SVG or ICO. SVG and ICO up to 384 KB`})]})]}),(0,F.jsx)(`input`,{ref:g,type:`file`,accept:`image/png,image/jpeg,image/webp,image/svg+xml,image/x-icon`,hidden:!0,onChange:async e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&a(`data:${t.type};base64,${await OS(t)}`)}})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[(0,F.jsx)(FZ,{htmlFor:`project-name`,children:`Name`}),(0,F.jsx)(cL,{id:`project-name`,placeholder:mC(t),value:n,onChange:e=>r(e.target.value)})]}),o!==null&&(0,F.jsx)(`p`,{className:`text-destructive text-sm break-all`,children:o})]}),(0,F.jsxs)(Fe,{className:`bg-muted/40 border-t px-6 py-4`,children:[(0,F.jsxs)(E,{type:`button`,variant:f?`destructive`:`ghost`,className:l(`sm:mr-auto`,!f&&`text-destructive hover:bg-destructive/10 hover:text-destructive`),title:`Its threads stay in their provider`,onClick:async()=>{if(!f)p(!0);else try{await Hg(e.project.machine,e.project.id),e.onRemoved()}catch(e){c(s(e))}},children:[(0,F.jsx)(k,{icon:Nm,className:`text-current`}),f?`Click again to remove`:`Remove project`]}),(0,F.jsx)(E,{type:`button`,variant:`outline`,onClick:e.onClose,children:`Cancel`}),(0,F.jsx)(E,{type:`submit`,disabled:n.trim()===``||u,children:`Save`})]})]}),m&&(0,F.jsx)(LQ,{machine:e.project.machine,projectId:e.project.id,onClose:()=>h(!1),onPick:e=>{a(e),h(!1)}})]})})}function HQ(e){let t=Q(e=>e.machines),n=Q(e=>e.projects),r=Q(e=>e.sessions),i=Q(e=>e.unseen),[a,o]=(0,P.useState)(!1),[s,c]=(0,P.useState)(null),l=(0,P.useRef)(!1),u=t.map(e=>({machine:e,projects:n.filter(t=>t.machine===e.id).sort((t,n)=>s!==null&&s.machine===e.id?s.ids.indexOf(t.id)-s.ids.indexOf(n.id):0)})).filter(e=>e.projects.length>0),d=r.filter(e=>{let n=k9(t,e.machine,e.id);return n?.running===!0||n?.waiting===!0||Object.values(n?.tasks??{}).includes(`running`)||i.includes(f9(e.machine,e.id))});function f(e,t){return n.find(n=>n.machine===e&&n.id===t)}function p(e){return e.status===`online`?e.name:e.status===`unpaired`?`${e.name} · needs pairing`:`${e.name} · offline`}return(0,F.jsxs)(mS,{open:a,onOpenChange:o,children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsxs)(`button`,{className:`hover:bg-sidebar-row-hover data-[state=open]:bg-sidebar-row-hover -ml-1.5 flex h-7 min-w-0 cursor-pointer items-center gap-1.5 rounded-[var(--control-radius)] px-1.5 text-sm font-medium`,title:e.scope===null?`Inbox`:f(e.scope.machine,e.scope.projectId)?.path,children:[e.scope===null?(0,F.jsx)(k,{icon:Jm,className:`size-4 shrink-0 text-(--sidebar-icon-color)`}):(0,F.jsx)(Kg,{machine:e.scope.machine,projectId:e.scope.projectId,className:`size-4 shrink-0 [&>img]:rounded-[4px] [&>svg]:rounded-[4px]`}),(0,F.jsx)(`span`,{className:`truncate`,children:e.scope===null?`Inbox`:f(e.scope.machine,e.scope.projectId)?.name}),(0,F.jsx)(k,{icon:Cm,className:`text-sidebar-muted-foreground size-3.5 shrink-0`})]})}),(0,F.jsxs)(_S,{className:`w-64`,children:[(0,F.jsxs)(bS,{value:e.scope===null?``:f9(e.scope.machine,e.scope.projectId),children:[(0,F.jsxs)(xS,{value:``,className:`pr-9 pl-8 *:data-[slot=dropdown-menu-radio-item-indicator]:right-auto *:data-[slot=dropdown-menu-radio-item-indicator]:left-2`,onSelect:()=>e.onScope(null),children:[(0,F.jsx)(k,{icon:Jm}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Inbox`}),d.length>0&&(0,F.jsx)(`span`,{className:`text-foreground grid h-4 min-w-4 place-items-center rounded-full bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))] px-1 text-[10px] leading-none font-medium tabular-nums`,children:d.length})]}),u.length>0&&(0,F.jsx)(CS,{}),u.map(({machine:n,projects:r},i)=>(0,F.jsxs)(P.Fragment,{children:[i>0&&(0,F.jsx)(CS,{}),t.length>1&&(0,F.jsxs)(SS,{className:`text-2xs flex items-center gap-1 pl-5`,children:[(0,F.jsx)(k,{icon:Wg[n.icon],className:`size-3 shrink-0`}),(0,F.jsx)(`span`,{className:`truncate`,children:p(n)})]}),(0,F.jsx)(BY,{as:`div`,axis:`y`,values:r.map(e=>e.id),onReorder:e=>c({machine:n.id,ids:e}),children:r.map(t=>{let n=d.filter(e=>e.machine===t.machine&&e.projectId===t.id).length;return(0,F.jsx)(eX,{as:`div`,value:t.id,className:`relative`,onDragStart:()=>{l.current=!0},onDragEnd:async()=>{if(s!==null){try{await Ug(s.machine,s.ids)}catch(e){R9(e)}c(null)}},children:(0,F.jsxs)(xS,{value:f9(t.machine,t.id),title:t.path,className:`group/project pr-2 pl-8 *:data-[slot=dropdown-menu-radio-item-indicator]:right-auto *:data-[slot=dropdown-menu-radio-item-indicator]:left-2`,onPointerDown:()=>{l.current=!1},onSelect:n=>{l.current?n.preventDefault():e.onScope({machine:t.machine,projectId:t.id})},onContextMenu:n=>{n.preventDefault(),o(!1),e.onEdit(t)},children:[(0,F.jsx)(Kg,{machine:t.machine,projectId:t.id,className:`size-5 shrink-0 [&>img]:rounded-[4px] [&>svg]:rounded-[4px]`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.name}),n>0&&(0,F.jsx)(`span`,{className:`text-foreground grid h-4 min-w-4 place-items-center rounded-full bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))] px-1 text-[10px] leading-none font-medium tabular-nums`,children:n}),(0,F.jsx)(`button`,{className:`text-muted-foreground hover:text-foreground hover:bg-foreground/10 -my-0.5 grid size-5 shrink-0 cursor-pointer place-items-center rounded-sm opacity-0 transition-opacity group-data-highlighted/project:opacity-100 pointer-coarse:opacity-100 [&_svg]:size-3.5`,title:`Configure project`,"aria-label":`Configure ${t.name}`,onClick:n=>{n.stopPropagation(),o(!1),e.onEdit(t)},children:(0,F.jsx)(k,{icon:Nh})})]})},f9(t.machine,t.id))})})]},n.id))]}),(0,F.jsx)(CS,{}),(0,F.jsxs)(vS,{className:`pl-8`,onSelect:e.onAddProject,children:[(0,F.jsx)(k,{icon:lm}),`Add project…`]}),(0,F.jsxs)(vS,{className:`pl-8`,onSelect:e.onAddMachine,children:[(0,F.jsx)(k,{icon:jm}),`Add machine…`]})]})]})}function UQ(e){let t=Q(e=>e.errors),n=Q(e=>e.machines),r=Q(e=>e.sessions),i=Q(e=>e.unseen),a=n.filter(e=>e.status===`offline`||e.status===`unpaired`),o=r.filter(e=>Object.values(k9(n,e.machine,e.id)?.tasks??{}).includes(`failed`)),s=r.filter(e=>k9(n,e.machine,e.id)?.waiting===!0),c=r.filter(e=>{let t=k9(n,e.machine,e.id);return i.includes(f9(e.machine,e.id))&&t?.waiting!==!0&&t?.running!==!0&&!Object.values(t?.tasks??{}).includes(`running`)}),u=t.length+a.length+o.length,d=!e.hideDone&&c.length>0;if(u===0&&s.length===0&&!d)return null;let f=c.map(e=>(0,F.jsx)(KQ,{session:e,icon:Em,className:`text-success`,detail:`Done`},f9(e.machine,e.id))),p=s.map(e=>(0,F.jsx)(KQ,{session:e,icon:Lh,className:`text-question`,detail:`Waiting for approval`},f9(e.machine,e.id))),m=e.collapsed===!0&&d&&s.length>0&&u>0;return(0,F.jsxs)(`div`,{className:l(`flex shrink-0 items-center gap-1`,e.className),children:[m&&(0,F.jsxs)(WQ,{className:`bg-question/15 text-question`,icon:Lh,count:s.length+c.length,label:`${s.length} waiting for approval, ${c.length} done`,children:[p,f]}),!m&&d&&(0,F.jsx)(WQ,{className:`bg-success/15 text-success`,icon:Em,count:c.length,label:`${c.length} done`,children:f}),!m&&s.length>0&&(0,F.jsx)(WQ,{className:`bg-question/15 text-question`,icon:Lh,count:s.length,label:`${s.length} waiting for approval`,children:p}),u>0&&(0,F.jsxs)(WQ,{className:l(t.length>0&&`bg-error/15 text-error`,t.length===0&&`bg-warning/15 text-warning-foreground`),icon:t.length>0?pm:fm,count:u,label:u===1?`1 problem`:`${u} problems`,onClose:z9,children:[t.map((e,t)=>(0,F.jsx)(GQ,{icon:pm,className:`text-error`,children:(0,F.jsx)(`span`,{className:`text-error-foreground whitespace-pre-wrap`,children:e})},t)),a.map(e=>(0,F.jsxs)(GQ,{icon:fm,className:`text-warning-foreground`,children:[e.status===`offline`&&`${e.name} is offline`,e.status===`unpaired`&&`${e.name} needs pairing`]},e.id)),o.map(e=>(0,F.jsx)(KQ,{session:e,icon:fm,className:`text-warning-foreground`,detail:`Background task failed`},f9(e.machine,e.id)))]})]})}function WQ(e){return(0,F.jsxs)(EI,{onOpenChange:t=>!t&&e.onClose?.(),children:[(0,F.jsx)(DI,{asChild:!0,children:(0,F.jsxs)(`button`,{className:l(`flex h-5 shrink-0 cursor-pointer items-center gap-0.75 rounded-[6px] px-1.25 text-[11px] font-medium tabular-nums`,e.className),title:e.label,"aria-label":e.label,children:[(0,F.jsx)(k,{icon:e.icon,className:`size-3 shrink-0`}),e.count]})}),(0,F.jsx)(OI,{align:`end`,collisionPadding:12,className:`flex max-h-80 w-[min(20rem,calc(100vw-2rem))] flex-col gap-px overflow-y-auto p-1 text-sm`,children:e.children})]})}function GQ(e){return(0,F.jsxs)(`div`,{className:`flex items-start gap-2 px-2 py-1.5`,children:[(0,F.jsx)(k,{icon:e.icon,className:l(`mt-0.5 size-4 shrink-0`,e.className)}),(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:e.children})]})}function KQ(e){return(0,F.jsx)(Ub,{asChild:!0,children:(0,F.jsx)(`button`,{className:`hover:bg-accent cursor-pointer rounded-md text-left`,onClick:()=>BS({machine:e.session.machine,projectId:e.session.projectId,sessionId:e.session.id}),children:(0,F.jsxs)(GQ,{icon:e.icon,className:e.className,children:[(0,F.jsx)(`div`,{className:`text-foreground truncate`,children:e.session.title}),(0,F.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:e.detail})]})})})}var qQ=`text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground flex shrink-0 cursor-pointer items-center justify-center rounded-[var(--control-radius)] [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-(--sidebar-icon-color) hover:[&>svg]:text-sidebar-foreground`;function JQ(e){let t=Q(e=>e.selection),n=Q(e=>e.machines),i=Q(e=>e.sessions),a=Q(e=>e.projects),s=Q(e=>e.settings.provider),c=Q(e=>e.unseen),u=Q(e=>e.loaded),d=Q(e=>e.inactive),f=Q(e=>e.inactiveVersion),[p,m]=Fg(`sidebarScope`,null),[h,g]=(0,P.useState)(!1),[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)(!1),[T,E]=(0,P.useState)(!1),[D,O]=(0,P.useState)(`active`),[A,j]=Fg(`sidebarWidth`,240),M=n.reduce((e,t)=>e+t.terminals.length,0),N=i.filter(e=>p===null||e.machine===p.machine&&e.projectId===p.projectId).sort((e,t)=>t.updatedAt-e.updatedAt),ee=N.filter(e=>{let t=k9(n,e.machine,e.id);return e.status===`snoozed`&&t?.waiting!==!0&&(t?.running===!0||Object.values(t?.tasks??{}).includes(`running`))}),te=[...N.filter(e=>e.status===`pinned`),...N.filter(e=>e.status===`active`||e.status===`snoozed`&&!ee.includes(e))],ne=N.filter(e=>e.status===`minimized`),re={snoozed:ee,minimized:ne,inactive:d},ie=e.mobile?D===`inactive`:T,ae=p?.machine??null,oe=p?.projectId??null,se=t!==null&&t.sessionId!==null&&u&&!i.some(e=>e.machine===t.machine&&e.id===t.sessionId)?{machine:t.machine,id:t.sessionId,provider:s,title:`New thread`,projectId:t.projectId,branch:null,updatedAt:Date.now(),status:`active`}:null,ce=e.mobile?PZ:bZ;(0,P.useEffect)(()=>{if(!ie)return;let e=!0,t=ae===null?Z().machines.filter(e=>e.status===`online`).map(e=>e.id):[ae];return Promise.all(t.map(async e=>(await I(e,`sessions.inactive`,{projectId:oe})).map(t=>({...t,machine:e})))).then(t=>{e&&$({inactive:t.flat()})}).catch(R9),()=>{e=!1}},[ie,ae,oe,f]);let le=p?.machine??t?.machine??n.at(0)?.id;function ue(e,t,n){BS({machine:e,projectId:t,sessionId:n})}function de(){let e=p??t??fe();e===null?g(!0):ue(e.machine,e.projectId,null)}function fe(){let e=localStorage.getItem(`lastProject`),t=e===null?null:JSON.parse(e),n=(t===null?void 0:a.find(e=>e.machine===t.machine&&e.id===t.projectId))??a.at(0);return n===void 0?null:{machine:n.machine,projectId:n.id}}function pe(){let e=US();if(e===null)throw Error(`there is no machine to open a terminal on`);WS(e)}kg([`mod+n`,`mod+t`],de,{enableOnFormTags:!0,preventDefault:!0});function me(e){let t=e.clientX-A;o(e,e=>{let n=Math.min(480,Math.max(200,e.clientX-t));j(n)})}function he(r,i){let a=e.mobile?NZ:yZ;return(0,F.jsx)(a,{session:r,slim:i,selected:t?.machine===r.machine&&t.sessionId===r.id,activity:k9(n,r.machine,r.id),unseen:c.includes(f9(r.machine,r.id)),saved:r!==se,scope:p,onSelect:()=>ue(r.machine,r.projectId,r.id)},f9(r.machine,r.id))}function ge(e,t,n,r,i){return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`li`,{className:l(`mx-0.5 h-9 pt-2`,i&&`mt-auto`),children:(0,F.jsxs)(`button`,{"aria-expanded":n,className:`text-sidebar-muted-foreground/60 flex h-9 w-full cursor-pointer items-center gap-2 rounded-md px-2 text-left text-xs font-medium`,onClick:r,children:[(0,F.jsx)(`span`,{className:`shrink-0`,children:e}),(0,F.jsx)(`span`,{className:`bg-sidebar-border/60 h-px min-w-2 flex-1`}),(0,F.jsx)(k,{icon:Cm,className:l(`size-3 shrink-0 transition-transform`,!n&&`rotate-180`)})]})}),n&&t.map(e=>he(e,e.status===`inactive`))]})}return(0,F.jsxs)(`aside`,{className:l(`bg-sidebar text-sidebar-foreground border-sidebar-border flex flex-none border-r select-none`,e.className),children:[(0,F.jsxs)(`div`,{className:l(`relative flex min-w-0 flex-col`,e.mobile&&`flex-1`),style:e.mobile?void 0:{width:A},children:[(0,F.jsxs)(`div`,{className:`flex h-(--workspace-topbar-height) shrink-0 items-center gap-2 px-3`,children:[e.mobile?(0,F.jsx)(xZ,{className:l(qQ,`size-7`),filter:D,onFilter:O,onTerminal:pe}):(0,F.jsx)(`button`,{className:l(qQ,`size-7`),title:`Hide sidebar (${r}+B)`,"aria-label":`Hide sidebar`,onClick:e.onHide,children:(0,F.jsx)(k,{icon:gh})}),(0,F.jsx)(HQ,{scope:p,onScope:m,onEdit:b,onAddProject:()=>g(!0),onAddMachine:()=>v(!0)}),e.mobile&&(0,F.jsx)(UQ,{hideDone:!0}),(0,F.jsx)(`button`,{className:l(qQ,`ml-auto size-7`),title:`Search (${r}+K)`,"aria-label":`Search`,onClick:()=>P9(!0),children:(0,F.jsx)(k,{icon:Ah})}),(0,F.jsx)(`button`,{className:l(qQ,`size-7`),title:`New thread (${r}+N)`,onClick:de,children:(0,F.jsx)(k,{icon:Bh})})]}),(0,F.jsx)(`nav`,{className:`flex min-h-0 flex-1 [scrollbar-width:none] flex-col overflow-y-auto px-(--sidebar-content-inset) pb-(--sidebar-content-inset)`,children:(0,F.jsxs)(`ul`,{className:`flex flex-1 flex-col gap-px`,children:[e.mobile&&D!==`active`&&(0,F.jsxs)(F.Fragment,{children:[re[D].map(e=>he(e,D===`inactive`)),re[D].length===0&&(0,F.jsxs)(`li`,{className:`text-sidebar-muted-foreground/60 px-2.5 py-6 text-center text-xs`,children:[`No `,D,` threads`]})]}),(!e.mobile||D===`active`)&&(0,F.jsxs)(F.Fragment,{children:[t!==null&&t.sessionId===null&&(0,F.jsx)(ce,{machine:t.machine,projectId:t.projectId,onSelect:()=>ue(t.machine,t.projectId,null)}),se!==null&&he(se,!1),te.map(e=>he(e,!1)),te.length===0&&se===null&&t?.sessionId!==null&&(0,F.jsx)(`li`,{className:`text-sidebar-muted-foreground/60 px-2.5 py-6 text-center text-xs`,children:`No threads yet`})]}),!e.mobile&&(0,F.jsxs)(F.Fragment,{children:[ee.length>0&&ge(x?`Snoozed`:`Snoozed (${ee.length})`,ee,x,()=>S(!x),!0),ne.length>0&&ge(C?`Minimized`:`Minimized (${ne.length})`,ne,C,()=>w(!C),ee.length===0),ge(`Inactive`,d,T,()=>E(!T),ee.length===0&&ne.length===0)]})]})}),!e.mobile&&(0,F.jsxs)(`div`,{className:`border-sidebar-border @container flex shrink-0 flex-col gap-px border-t p-(--sidebar-content-inset)`,children:[n.length>0&&(0,F.jsxs)(`button`,{className:l(qQ,`h-8 justify-start gap-2 px-2.5 text-sm`),title:`Terminal`,onClick:pe,children:[(0,F.jsx)(k,{icon:Hh}),`Terminal`,M>0&&(0,F.jsx)(`span`,{className:`text-foreground ml-auto grid h-4 min-w-4 place-items-center rounded-full bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))] px-1 text-[10px] leading-none font-medium tabular-nums`,children:M})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsxs)(`button`,{className:l(qQ,`h-8 min-w-0 flex-1 justify-start gap-2 px-2.5 text-sm`),title:`Settings`,onClick:()=>F9(!0),children:[(0,F.jsx)(k,{icon:Nh}),(0,F.jsx)(`span`,{className:`truncate`,children:`Settings`})]}),(0,F.jsx)(UQ,{className:`@max-[13rem]:hidden`,hideDone:!1}),(0,F.jsx)(UQ,{className:`hidden @max-[13rem]:flex`,hideDone:!1,collapsed:!0})]})]}),!e.mobile&&(0,F.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:`group absolute inset-y-0 -right-1 z-20 w-2 cursor-col-resize select-none`,onPointerDown:me,children:(0,F.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`})})]}),h&&le===void 0&&(0,F.jsx)(nX,{onClose:()=>g(!1)}),h&&le!==void 0&&(0,F.jsx)(zQ,{machine:le,onClose:()=>g(!1),onAdd:e=>{g(!1),ue(e.machine,e.id,null)}}),_&&(0,F.jsx)(nX,{onClose:()=>v(!1)}),y!==null&&(0,F.jsx)(VQ,{project:y,onClose:()=>b(null),onRemoved:()=>{p?.machine===y.machine&&p.projectId===y.id&&m(null),b(null)}})]})}var YQ=`/assets/ghostty-vt-CQAu1Gs5.wasm`,XQ=Uint8Array,ZQ=Uint16Array,QQ=Int32Array,$Q=new XQ([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),e$=new XQ([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),t$=new XQ([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n$=function(e,t){for(var n=new ZQ(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new QQ(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},r$=n$($Q,2),i$=r$.b,a$=r$.r;i$[28]=258,a$[258]=28;var o$=n$(e$,0),s$=o$.b;o$.r;for(var c$=new ZQ(32768),l$=0;l$<32768;++l$){var u$=(l$&43690)>>1|(l$&21845)<<1;u$=(u$&52428)>>2|(u$&13107)<<2,u$=(u$&61680)>>4|(u$&3855)<<4,c$[l$]=((u$&65280)>>8|(u$&255)<<8)>>1}for(var d$=(function(e,t,n){for(var r=e.length,i=0,a=new ZQ(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new ZQ(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new ZQ(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[c$[d]>>c]=l}else for(s=new ZQ(r),i=0;i<r;++i)e[i]&&(s[i]=c$[o[e[i]-1]++]>>15-e[i]);return s}),f$=new XQ(288),l$=0;l$<144;++l$)f$[l$]=8;for(var l$=144;l$<256;++l$)f$[l$]=9;for(var l$=256;l$<280;++l$)f$[l$]=7;for(var l$=280;l$<288;++l$)f$[l$]=8;for(var p$=new XQ(32),l$=0;l$<32;++l$)p$[l$]=5;var m$=d$(f$,9,1),h$=d$(p$,5,1),g$=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},_$=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},v$=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},y$=function(e){return(e+7)/8|0},b$=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new XQ(e.subarray(t,n))},x$=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],S$=function(e,t,n){var r=Error(t||x$[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,S$),!n)throw r;return r},C$=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new XQ(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new XQ(i*3));var l=function(e){var t=n.length;if(e>t){var r=new XQ(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=_$(e,d,1);var v=_$(e,d+1,3);if(d+=3,!v){var y=y$(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&S$(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}if(v==1)p=m$,m=h$,h=9,g=5;else if(v==2){var S=_$(e,d,31)+257,C=_$(e,d+10,15)+4,w=S+_$(e,d+5,31)+1;d+=14;for(var T=new XQ(w),E=new XQ(19),D=0;D<C;++D)E[t$[D]]=_$(e,d+D*3,7);d+=C*3;for(var O=g$(E),k=(1<<O)-1,A=d$(E,O,1),D=0;D<w;){var j=A[_$(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+_$(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+_$(e,d,7),d+=3):y==18&&(N=11+_$(e,d,127),d+=7);N--;)T[D++]=M}}var ee=T.subarray(0,S),te=T.subarray(S);h=g$(ee),g=g$(te),p=d$(ee,h,1),m=d$(te,g,1)}else S$(1);if(d>_){c&&S$(0);break}}s&&l(f+131072);for(var ne=(1<<h)-1,re=(1<<g)-1,ie=d;;ie=d){var M=p[v$(e,d)&ne],ae=M>>4;if(d+=M&15,d>_){c&&S$(0);break}if(M||S$(2),ae<256)n[f++]=ae;else if(ae==256){ie=d,p=null;break}else{var oe=ae-254;if(ae>264){var D=ae-257,se=$Q[D];oe=_$(e,d,(1<<se)-1)+i$[D],d+=se}var ce=m[v$(e,d)&re],le=ce>>4;ce||S$(3),d+=ce&15;var te=s$[le];if(le>3){var se=e$[le];te+=v$(e,d)&(1<<se)-1,d+=se}if(d>_){c&&S$(0);break}s&&l(f+131072);var ue=f+oe;if(f<te){var de=a-te,fe=Math.min(te,ue);for(de+f<0&&S$(3);f<fe;++f)n[f]=r[de+f]}for(;f<ue;++f)n[f]=n[f-te]}}t.l=p,t.p=ie,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?b$(n,0,f):n.subarray(0,f)},w$=new XQ(0),T$=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&S$(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&S$(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2},E$=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new XQ(32768),this.p=new XQ(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||S$(5),this.d&&S$(4),!this.p.length)this.p=e;else if(e.length){var t=new XQ(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=C$(this.p,this.s,this.o);this.ondata(b$(n,t,this.s.b),this.d),this.o=b$(n,this.s.b-32768),this.s.b=this.o.length,this.p=b$(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),D$=function(){function e(e,t){E$.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(E$.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(T$(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&S$(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),E$.prototype.c.call(this,t)},e}();function O$(e,t){return C$(e.subarray(T$(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var k$=typeof TextDecoder<`u`&&new TextDecoder;try{k$.decode(w$,{stream:!0})}catch{}function A$(e,t=`utf8`){return new TextDecoder(t).decode(e)}var j$=new TextEncoder;function M$(e){return j$.encode(e)}var N$=8192,P$=(()=>{let e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),F$={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array},I$=class e{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=N$,n={}){let r=!1;typeof t==`number`?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);let i=n.offset?n.offset>>>0:0,a=t.byteLength-i,o=i;(ArrayBuffer.isView(t)||t instanceof e)&&(t.byteLength!==t.buffer.byteLength&&(o=t.byteOffset+i),t=t.buffer),this.lastWrittenByte=r?a:0,this.buffer=t,this.length=a,this.byteLength=a,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,a),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let e=this._marks.pop();if(e===void 0)throw Error(`Mark stack empty`);return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){let t=(this.offset+e)*2,n=new Uint8Array(t);n.set(new Uint8Array(this.buffer)),this.buffer=n.buffer,this.length=t,this.byteLength=t,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,`uint8`)}readArray(e,t){let n=F$[t].BYTES_PER_ELEMENT*e,r=this.byteOffset+this.offset,i=this.buffer.slice(r,r+n);if(this.littleEndian===P$&&t!==`uint8`&&t!==`int8`){let e=new Uint8Array(this.buffer.slice(r,r+n));e.reverse();let i=new F$[t](e.buffer);return this.offset+=n,i.reverse(),i}let a=new F$[t](i);return this.offset+=n,a}readInt16(){let e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){let e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){let e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){let e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){let e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){let e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){let e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){let e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let t=``;for(let n=0;n<e;n++)t+=this.readChar();return t}readUtf8(e=1){return A$(this.readBytes(e))}decodeText(e=1,t=`utf8`){return A$(this.readBytes(e),t)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let t=0;t<e.length;t++)this._data.setUint8(this.offset++,e[t]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let t=0;t<e.length;t++)this.writeUint8(e.charCodeAt(t));return this}writeUtf8(e){return this.writeBytes(M$(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}},L$=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t>>>=1;L$[e]=t}var R$=4294967295;function z$(e,t,n){let r=e;for(let e=0;e<n;e++)r=L$[(r^t[e])&255]^r>>>8;return r}function B$(e,t){return(z$(R$,e,t)^R$)>>>0}function V$(e,t,n){let r=e.readUint32(),i=B$(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(i!==r)throw Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function H$(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}function U$(e,t,n,r){let i=0;for(;i<r;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-r]&255}function W$(e,t,n,r){let i=0;if(n.length===0)for(;i<r;i++)t[i]=e[i];else for(;i<r;i++)t[i]=e[i]+n[i]&255}function G$(e,t,n,r,i){let a=0;if(n.length===0){for(;a<i;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+(t[a-i]>>1)&255}else{for(;a<i;a++)t[a]=e[a]+(n[a]>>1)&255;for(;a<r;a++)t[a]=e[a]+(t[a-i]+n[a]>>1)&255}}function K$(e,t,n,r,i){let a=0;if(n.length===0){for(;a<i;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+t[a-i]&255}else{for(;a<i;a++)t[a]=e[a]+n[a]&255;for(;a<r;a++)t[a]=e[a]+q$(t[a-i],n[a],n[a-i])&255}}function q$(e,t,n){let r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}function J$(e,t,n,r,i,a){switch(e){case 0:H$(t,n,i);break;case 1:U$(t,n,i,a);break;case 2:W$(t,n,r,i);break;case 3:G$(t,n,r,i,a);break;case 4:K$(t,n,r,i,a);break;default:throw Error(`Unsupported filter: ${e}`)}}var Y$=new Uint16Array([255]),X$=new Uint8Array(Y$.buffer)[0]===255;function Z$(e){let{data:t,width:n,height:r,channels:i,depth:a}=e,o=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],s=Math.ceil(a/8)*i,c=new Uint8Array(r*n*s),l=0;for(let e=0;e<7;e++){let i=o[e],a=Math.ceil((n-i.x)/i.xStep),u=Math.ceil((r-i.y)/i.yStep);if(a<=0||u<=0)continue;let d=a*s,f=new Uint8Array(d);for(let e=0;e<u;e++){let o=t[l++],u=t.subarray(l,l+d);l+=d;let p=new Uint8Array(d);J$(o,u,p,f,d,s),f.set(p);for(let t=0;t<a;t++){let a=i.x+t*i.xStep,o=i.y+e*i.yStep;if(!(a>=n||o>=r))for(let e=0;e<s;e++)c[(o*n+a)*s+e]=p[t*s+e]}}}if(a===16){let e=new Uint16Array(c.buffer);if(X$)for(let t=0;t<e.length;t++)e[t]=Q$(e[t]);return e}return c}function Q$(e){return(e&255)<<8|e>>8&255}var $$=new Uint16Array([255]),e1=new Uint8Array($$.buffer)[0]===255,t1=new Uint8Array;function n1(e){let{data:t,width:n,height:r,channels:i,depth:a}=e,o=Math.ceil(a/8)*i,s=Math.ceil(a/8*i*n),c=new Uint8Array(r*s),l=t1,u=0,d,f;for(let e=0;e<r;e++){switch(d=t.subarray(u+1,u+1+s),f=c.subarray(e*s,(e+1)*s),t[u]){case 0:H$(d,f,s);break;case 1:U$(d,f,s,o);break;case 2:W$(d,f,l,s);break;case 3:G$(d,f,l,s,o);break;case 4:K$(d,f,l,s,o);break;default:throw Error(`Unsupported filter: ${t[u]}`)}l=f,u+=s+1}if(a===16){let e=new Uint16Array(c.buffer);if(e1)for(let t=0;t<e.length;t++)e[t]=r1(e[t]);return e}return c}function r1(e){return(e&255)<<8|e>>8&255}var i1=Uint8Array.of(137,80,78,71,13,10,26,10);function a1(e){if(!o1(e.readBytes(i1.length)))throw Error(`wrong PNG signature`)}function o1(e){if(e.length<i1.length)return!1;for(let t=0;t<i1.length;t++)if(e[t]!==i1[t])return!1;return!0}var s1=`tEXt`,c1=0,l1=new TextDecoder(`latin1`);function u1(e){if(f1(e),e.length===0||e.length>79)throw Error(`keyword length must be between 1 and 79`)}var d1=/^[\u0000-\u00FF]*$/;function f1(e){if(!d1.test(e))throw Error(`invalid latin1 text`)}function p1(e,t,n){let r=m1(t);e[r]=h1(t,n-r.length-1)}function m1(e){for(e.mark();e.readByte()!==c1;);let t=e.offset;e.reset();let n=l1.decode(e.readBytes(t-e.offset-1));return e.skip(1),u1(n),n}function h1(e,t){return l1.decode(e.readBytes(t))}var g1={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},_1={UNKNOWN:-1,DEFLATE:0},v1={UNKNOWN:-1,ADAPTIVE:0},y1={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},b1={NONE:0,BACKGROUND:1,PREVIOUS:2},x1={SOURCE:0,OVER:1},S1=class extends I${_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;_chunks;_inflatorResult;constructor(e,t={}){super(e);let{checkCrc:n=!1}=t;this._checkCrc=n,this._inflator=new D$((e,t)=>{if(this._chunks.push(e),t){let e=this._chunks.reduce((e,t)=>e+t.length,0);this._inflatorResult=new Uint8Array(e);let t=0;for(let e of this._chunks)this._inflatorResult.set(e,t),t+=e.length;this._chunks=[]}}),this._chunks=[],this._png={width:-1,height:-1,channels:-1,data:new Uint8Array,depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array,this._compressionMethod=_1.UNKNOWN,this._filterMethod=v1.UNKNOWN,this._interlaceMethod=y1.UNKNOWN,this._colorType=g1.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this._inflatorResult=new Uint8Array,this.setBigEndian()}decode(){for(a1(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeChunk(e,t)}return this._inflator.push(new Uint8Array,!0),this.decodeImage(),this._png}decodeApng(){for(a1(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeApngChunk(e,t)}return this.decodeApngImage(),this._apng}decodeChunk(e,t){let n=this.offset;switch(t){case`IHDR`:this.decodeIHDR();break;case`PLTE`:this.decodePLTE(e);break;case`IDAT`:this.decodeIDAT(e);break;case`IEND`:this._end=!0;break;case`tRNS`:this.decodetRNS(e);break;case`iCCP`:this.decodeiCCP(e);break;case s1:p1(this._png.text,this,e);break;case`pHYs`:this.decodepHYs();break;default:this.skip(e)}if(this.offset-n!==e)throw Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?V$(this,e+4,t):this.skip(4)}decodeApngChunk(e,t){let n=this.offset;switch(t!==`fdAT`&&t!==`IDAT`&&this._writingDataChunks&&this.pushDataToFrame(),t){case`acTL`:this.decodeACTL();break;case`fcTL`:this.decodeFCTL();break;case`fdAT`:this.decodeFDAT(e);break;default:this.decodeChunk(e,t),this.offset=n+e}if(this.offset-n!==e)throw Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?V$(this,e+4,t):this.skip(4)}decodeIHDR(){let e=this._png;e.width=this.readUint32(),e.height=this.readUint32(),e.depth=C1(this.readUint8());let t=this.readUint8();this._colorType=t;let n;switch(t){case g1.GREYSCALE:n=1;break;case g1.TRUECOLOUR:n=3;break;case g1.INDEXED_COLOUR:n=1;break;case g1.GREYSCALE_ALPHA:n=2;break;case g1.TRUECOLOUR_ALPHA:n=4;break;case g1.UNKNOWN:default:throw Error(`Unknown color type: ${t}`)}if(this._png.channels=n,this._compressionMethod=this.readUint8(),this._compressionMethod!==_1.DEFLATE)throw Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){let e={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array};this._frames.push(e)}decodePLTE(e){if(e%3!=0)throw RangeError(`PLTE field length must be a multiple of 3. Got ${e}`);let t=e/3;this._hasPalette=!0;let n=[];this._palette=n;for(let e=0;e<t;e++)n.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(e){this._writingDataChunks=!0;let t=e,n=this.offset+this.byteOffset;try{this._inflator.push(new Uint8Array(this.buffer,n,t),!1)}catch(e){throw Error(`Error while decompressing the data:`,{cause:e})}this.skip(e)}decodeFDAT(e){this._writingDataChunks=!0;let t=e,n=this.offset+this.byteOffset;n+=4,t-=4;try{this._inflator.push(new Uint8Array(this.buffer,n,t),!1)}catch(e){throw Error(`Error while decompressing the data:`,{cause:e})}this.skip(e)}decodetRNS(e){switch(this._colorType){case g1.GREYSCALE:case g1.TRUECOLOUR:if(e%2!=0)throw RangeError(`tRNS chunk length must be a multiple of 2. Got ${e}`);if(e/2>this._png.width*this._png.height)throw Error(`tRNS chunk contains more alpha values than there are pixels (${e/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(e/2);for(let t=0;t<e/2;t++)this._transparency[t]=this.readUint16();break;case g1.INDEXED_COLOUR:{if(e>this._palette.length)throw Error(`tRNS chunk contains more alpha values than there are palette colors (${e} vs ${this._palette.length})`);let t=0;for(;t<e;t++){let e=this.readByte();this._palette[t].push(e)}for(;t<this._palette.length;t++)this._palette[t].push(255);break}case g1.UNKNOWN:case g1.GREYSCALE_ALPHA:case g1.TRUECOLOUR_ALPHA:default:throw Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(e){let t=m1(this),n=this.readUint8();if(n!==_1.DEFLATE)throw Error(`Unsupported iCCP compression method: ${n}`);let r=this.readBytes(e-t.length-2);this._png.iccEmbeddedProfile={name:t,profile:O$(r)}}decodepHYs(){let e=this.readUint32(),t=this.readUint32(),n=this.readByte();this._png.resolution={x:e,y:t,unit:n}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let e=0;e<this._numberOfFrames;e++){let t={sequenceNumber:this._frames[e].sequenceNumber,delayNumber:this._frames[e].delayNumber,delayDenominator:this._frames[e].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},n=this._frames.at(e);if(n){if(n.data=n1({data:n.data,width:n.width,height:n.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),e===0||n.xOffset===0&&n.yOffset===0&&n.width===this._png.width&&n.height===this._png.height)t.data=n.data;else{let r=this._apng.frames.at(e-1);this.disposeFrame(n,r,t),this.addFrameDataToCanvas(t,n)}this._apng.frames.push(t)}}return this._apng}disposeFrame(e,t,n){switch(e.disposeOp){case b1.NONE:break;case b1.BACKGROUND:for(let t=0;t<this._png.height;t++)for(let r=0;r<this._png.width;r++){let i=(t*e.width+r)*this._png.channels;for(let e=0;e<this._png.channels;e++)n.data[i+e]=0}break;case b1.PREVIOUS:n.data.set(t.data);break;default:throw Error(`Unknown disposeOp`)}}addFrameDataToCanvas(e,t){let n=1<<this._png.depth,r=(e,n)=>({index:((e+t.yOffset)*this._png.width+t.xOffset+n)*this._png.channels,frameIndex:(e*t.width+n)*this._png.channels});switch(t.blendOp){case x1.SOURCE:for(let n=0;n<t.height;n++)for(let i=0;i<t.width;i++){let{index:a,frameIndex:o}=r(n,i);for(let n=0;n<this._png.channels;n++)e.data[a+n]=t.data[o+n]}break;case x1.OVER:for(let i=0;i<t.height;i++)for(let a=0;a<t.width;a++){let{index:o,frameIndex:s}=r(i,a);for(let r=0;r<this._png.channels;r++){let i=t.data[s+this._png.channels-1]/n,a=r%(this._png.channels-1)==0?1:t.data[s+r],c=Math.floor(i*a+(1-i)*e.data[o+r]);e.data[o+r]+=c}}break;default:throw Error(`Unknown blendOp`)}}decodeImage(){let e=this._inflatorResult;if(this._filterMethod!==v1.ADAPTIVE)throw Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===y1.NO_INTERLACE)this._png.data=n1({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===y1.ADAM7)this._png.data=Z$({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){this._inflator.push(new Uint8Array,!0);let e=this._inflatorResult,t=this._frames.at(-1);t?t.data=e:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:b1.NONE,blendOp:x1.SOURCE,data:e}),this._inflator=new D$((e,t)=>{if(this._chunks.push(e),t){let e=this._chunks.reduce((e,t)=>e+t.length,0);this._inflatorResult=new Uint8Array(e);let t=0;for(let e of this._chunks)this._inflatorResult.set(e,t),t+=e.length;this._chunks=[]}}),this._chunks=[],this._writingDataChunks=!1}};function C1(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw Error(`invalid bit depth: ${e}`);return e}function w1(e){let t=e.palette,n=e.depth;if(!t)throw Error(`Color palette is undefined.`);T1(e);let r=e.width*e.height,i=r*t[0].length,a=new Uint8Array(i),o=0,s=0,c=new Uint8Array(r),l=255;switch(n){case 1:l=128;break;case 2:l=192;break;case 4:l=240;break;case 8:l=255;break;default:throw Error(`Incorrect depth value`)}for(let t of e.data){let r=l,i=8;for(;r&&(i-=n,c[o++]=(t&r)>>i,r>>=n,o%e.width!==0););}if(e.palette)for(let t of c){let n=e.palette.at(t);if(!n)throw Error(`Incorrect index of palette color`);a.set(n,s),s+=n.length}return a}function T1(e){let t=e.depth<8?Math.ceil(e.width*e.depth/8)*e.height*e.channels:e.width*e.height*e.channels;if(e.data.length!==t)throw RangeError(`wrong data size. Found ${e.data.length}, expected ${t}`)}function E1(e,t){return new S1(e,t).decode()}var D1=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=new Uint8Array(new Uint32Array([4278190080]).buffer)[0]===255,e.BIG_ENDIAN&&console.warn(`BE platform detected. This version of node-sixel works only on LE properly.`);function t(e){return e&255}e.red=t;function n(e){return e>>>8&255}e.green=n;function r(e){return e>>>16&255}e.blue=r;function i(e){return e>>>24&255}e.alpha=i;function a(e,t,n,r=255){return((r&255)<<24|(n&255)<<16|(t&255)<<8|e&255)>>>0}e.toRGBA8888=a;function o(e){return[e&255,e>>8&255,e>>16&255,e>>>24]}e.fromRGBA8888=o;function s(e,i){let a=t(e),o=n(e),s=r(e),c=2**53-1,l=-1;for(let e=0;e<i.length;++e){let t=a-i[e][0],n=o-i[e][1],r=s-i[e][2],u=t*t+n*n+r*r;if(!u)return e;u<c&&(c=u,l=e)}return l}e.nearestColorIndex=s;function c(e,t,n){return Math.max(e,Math.min(n,t))}function l(e,t,n){return n<0&&(n+=1),n>1&&--n,n*6<1?t+(e-t)*6*n:n*2<1?e:n*3<2?t+(e-t)*(4-n*6):t}function u(e,t,n){if(!n){let e=Math.round(t*255);return a(e,e,e)}let r=t<.5?t*(1+n):t+n-t*n,i=2*t-r;return a(c(0,255,Math.round(l(r,i,e+1/3)*255)),c(0,255,Math.round(l(r,i,e)*255)),c(0,255,Math.round(l(r,i,e-1/3)*255)))}function d(e,t,n){return(4278190080|Math.round(n/100*255)<<16|Math.round(t/100*255)<<8|Math.round(e/100*255))>>>0}e.normalizeRGB=d;function f(e,t,n){return u((e+240)/360,t/100,n/100)}e.normalizeHLS=f,e.PALETTE_VT340_COLOR=new Uint32Array([d(0,0,0),d(20,20,80),d(80,13,13),d(20,80,20),d(80,20,80),d(20,80,80),d(80,80,20),d(53,53,53),d(26,26,26),d(33,33,60),d(60,26,26),d(33,60,33),d(60,33,60),d(33,60,60),d(60,60,33),d(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([d(0,0,0),d(13,13,13),d(26,26,26),d(40,40,40),d(6,6,6),d(20,20,20),d(33,33,33),d(46,46,46),d(0,0,0),d(13,13,13),d(26,26,26),d(40,40,40),d(6,6,6),d(20,20,20),d(33,33,33),d(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let e=[a(0,0,0),a(205,0,0),a(0,205,0),a(205,205,0),a(0,0,238),a(205,0,205),a(0,250,205),a(229,229,229),a(127,127,127),a(255,0,0),a(0,255,0),a(255,255,0),a(92,92,255),a(255,0,255),a(0,255,255),a(255,255,255)],t=[0,95,135,175,215,255];for(let n=0;n<6;++n)for(let r=0;r<6;++r)for(let i=0;i<6;++i)e.push(a(t[n],t[r],t[i]));for(let t=8;t<=238;t+=10)e.push(a(t,t,t));return new Uint32Array(e)})(),e.DEFAULT_BACKGROUND=a(0,0,0,255),e.DEFAULT_FOREGROUND=a(255,255,255,255)})),O1=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LIMITS=void 0,e.LIMITS={CHUNK_SIZE:16384,PALETTE_SIZE:4096,MAX_WIDTH:16384,BYTES:`AGFzbQEAAAABJAdgAAF/YAJ/fwBgA39/fwF/YAF/AX9gAABgBH9/f38AYAF/AAIlAgNlbnYLaGFuZGxlX2JhbmQAAwNlbnYLbW9kZV9wYXJzZWQAAwMTEgQAAAAAAQQBAQUBAAACAgAGAwQFAXABBwcFBAEBBwcGCAF/AUGAihoLB9wBDgZtZW1vcnkCABFnZXRfc3RhdGVfYWRkcmVzcwADEWdldF9jaHVua19hZGRyZXNzAAQOZ2V0X3AwX2FkZHJlc3MABRNnZXRfcGFsZXR0ZV9hZGRyZXNzAAYEaW5pdAALBmRlY29kZQAMDWN1cnJlbnRfd2lkdGgADQ5jdXJyZW50X2hlaWdodAAOGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtfaW5pdGlhbGl6ZQACCXN0YWNrU2F2ZQARDHN0YWNrUmVzdG9yZQASCnN0YWNrQWxsb2MAEwkMAQBBAQsGCgcJDxACDAEBCq5UEgMAAQsFAEGgCAsGAEGQiQELBgBBsIkCCwUAQZAJC+okAQh/QeQIKAIAIQVB4AgoAgAhA0HoCCgCACEIIAFBkIkBaiIJQf8BOgAAIAAgAUgEQCAAQZCJAWohBgNAIAMhBCAGQQFqIQECQCAGLQAAQf8AcSIDQTBrQQlLBEAgASEGDAELQewIKAIAQQJ0QewIaiICKAIAIQADQCACIAMgAEEKbGpBMGsiADYCACABLQAAIQMgAUEBaiIGIQEgA0H/AHEiA0Ewa0EKSQ0ACwsCQAJAAkACQAJAAkACQAJ/AkACQCADQT9rIgBBP00EQCAERQ0BIARBIUYEQAJAQfAIKAIAIgFBASABGyIHIAhqIgFB1AgoAgAiA0gNACADQf//AEoNAANAIANBAnQiAkGgiQJqIgRBoAgpAwA3AwAgAkGoiQJqQaAIKQMANwMAIAJBsIkCakGgCCkDADcDACACQbiJAmpBoAgpAwA3AwAgAkHAiQJqQaAIKQMANwMAIAJByIkCakGgCCkDADcDACACQdCJAmpBoAgpAwA3AwAgAkHYiQJqQaAIKQMANwMAIAJB4IkCakGgCCkDADcDACACQeiJAmpBoAgpAwA3AwAgAkHwiQJqQaAIKQMANwMAIAJB+IkCakGgCCkDADcDACACQYCKAmpBoAgpAwA3AwAgAkGIigJqQaAIKQMANwMAIAJBkIoCakGgCCkDADcDACACQZiKAmpBoAgpAwA3AwAgAkGgigJqQaAIKQMANwMAIAJBqIoCakGgCCkDADcDACACQbCKAmpBoAgpAwA3AwAgAkG4igJqQaAIKQMANwMAIAJBwIoCakGgCCkDADcDACACQciKAmpBoAgpAwA3AwAgAkHQigJqQaAIKQMANwMAIAJB2IoCakGgCCkDADcDACACQeCKAmpBoAgpAwA3AwAgAkHoigJqQaAIKQMANwMAIAJB8IoCakGgCCkDADcDACACQfiKAmpBoAgpAwA3AwAgAkGAiwJqQaAIKQMANwMAIAJBiIsCakGgCCkDADcDACACQZCLAmpBoAgpAwA3AwAgAkGYiwJqQaAIKQMANwMAIAJBoIsCakGgCCkDADcDACACQaiLAmpBoAgpAwA3AwAgAkGwiwJqQaAIKQMANwMAIAJBuIsCakGgCCkDADcDACACQcCLAmpBoAgpAwA3AwAgAkHIiwJqQaAIKQMANwMAIAJB0IsCakGgCCkDADcDACACQdiLAmpBoAgpAwA3AwAgAkHgiwJqQaAIKQMANwMAIAJB6IsCakGgCCkDADcDACACQfCLAmpBoAgpAwA3AwAgAkH4iwJqQaAIKQMANwMAIAJBgIwCakGgCCkDADcDACACQYiMAmpBoAgpAwA3AwAgAkGQjAJqQaAIKQMANwMAIAJBmIwCakGgCCkDADcDACACQaCMAmpBoAgpAwA3AwAgAkGojAJqQaAIKQMANwMAIAJBsIwCakGgCCkDADcDACACQbiMAmpBoAgpAwA3AwAgAkHAjAJqQaAIKQMANwMAIAJByIwCakGgCCkDADcDACACQdCMAmpBoAgpAwA3AwAgAkHYjAJqQaAIKQMANwMAIAJB4IwCakGgCCkDADcDACACQeiMAmpBoAgpAwA3AwAgAkHwjAJqQaAIKQMANwMAIAJB+IwCakGgCCkDADcDACACQYCNAmpBoAgpAwA3AwAgAkGIjQJqQaAIKQMANwMAIAJBkI0CakGgCCkDADcDACACQZiNAmpBoAgpAwA3AwAgAkGwiQZqIARBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBEGABPwKAABB1AgoAgBBAnRB0IkOaiAEQYAE/AoAAEHUCCgCAEECdEHgiRJqIARBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBEGABPwKAABB1AhB1AgoAgAiAkGAAWoiAzYCACABIANIDQEgAkGA/wBIDQALCwJAIABFDQAgCEH//wBLDQBBgIABIAhrIAcgAUH//wBLGyECAkAgAEEBcUUNACACRQ0AIAhBAnRBoIkCaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBAnFFDQAgAkUNACAIQQJ0QbCJBmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsCQCAAQQRxRQ0AIAJFDQAgCEECdEHAiQpqIQMgAiEEIAJBB3EiBwRAA0AgAyAFNgIAIANBBGohAyAEQQFrIQQgB0EBayIHDQALCyACQQFrQQdJDQADQCADIAU2AhwgAyAFNgIYIAMgBTYCFCADIAU2AhAgAyAFNgIMIAMgBTYCCCADIAU2AgQgAyAFNgIAIANBIGohAyAEQQhrIgQNAAsLAkAgAEEIcUUNACACRQ0AIAhBAnRB0IkOaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBEHFFDQAgAkUNACAIQQJ0QeCJEmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsgAEEgcUUNACACRQ0AIAJBAWshByAIQQJ0QfCJFmohAyACQQdxIgQEQANAIAMgBTYCACADQQRqIQMgAkEBayECIARBAWsiBA0ACwsgB0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgAkEIayICDQALC0HcCEHcCCgCACAAcjYCACAGQQFqIgIgBi0AAEH/AHEiA0E/ayIAQT9LDQQaDAMLAkBB7AgoAgAiBEEBRgRAQfAIKAIAIgNBzAgoAgAiAUkNASADIAFwIQMMAQtB+AgoAgAhAkH0CCgCACEBAkACQCAEQQVHDQAgAUEBRw0AIAJB6QJODQQMAQsgAkHkAEoNA0H8CCgCAEHkAEoNA0GACSgCAEHkAEoNAwsCQCABRQ0AIAFBAkoNACACQfwIKAIAQYAJKAIAIAFBAnRBiAhqKAIAEQIAIQFB8AgoAgAiA0HMCCgCACICTwR/IAMgAnAFIAMLQQJ0QZAJaiABNgIAC0HwCCgCACIDQcwIKAIAIgFJDQAgAyABcCEDCyADQQJ0QZAJaigCACEFDAELIANB/QBxQSFHBEAgCCEBIAYhAgwECyAEQSNHDQQCQEHsCCgCACICQQFGBEBB8AgoAgAiAUHMCCgCACIASQ0BIAEgAHAhAQwBC0H4CCgCACEBQfQIKAIAIQACQAJAIAJBBUcNACAAQQFHDQAgAUHpAkgNAQwHCyABQeQASg0GQfwIKAIAQeQASg0GQYAJKAIAQeQASg0GCwJAIABFDQAgAEECSg0AIAFB/AgoAgBBgAkoAgAgAEECdEGICGooAgARAgAhAEHwCCgCACIBQcwIKAIAIgJPBH8gASACcAUgAQtBAnRBkAlqIAA2AgALQfAIKAIAIgFBzAgoAgAiAEkNACABIABwIQELIAFBAnRBkAlqKAIAIQUMBAsgCCEBIAYhAgtB1AgoAgAhBgNAAkAgASAGSA0AIAZB//8ASg0AIAZBAnQiBEGgiQJqIgZBoAgpAwA3AwAgBEGoiQJqQaAIKQMANwMAIARBsIkCakGgCCkDADcDACAEQbiJAmpBoAgpAwA3AwAgBEHAiQJqQaAIKQMANwMAIARByIkCakGgCCkDADcDACAEQdCJAmpBoAgpAwA3AwAgBEHYiQJqQaAIKQMANwMAIARB4IkCakGgCCkDADcDACAEQeiJAmpBoAgpAwA3AwAgBEHwiQJqQaAIKQMANwMAIARB+IkCakGgCCkDADcDACAEQYCKAmpBoAgpAwA3AwAgBEGIigJqQaAIKQMANwMAIARBkIoCakGgCCkDADcDACAEQZiKAmpBoAgpAwA3AwAgBEGgigJqQaAIKQMANwMAIARBqIoCakGgCCkDADcDACAEQbCKAmpBoAgpAwA3AwAgBEG4igJqQaAIKQMANwMAIARBwIoCakGgCCkDADcDACAEQciKAmpBoAgpAwA3AwAgBEHQigJqQaAIKQMANwMAIARB2IoCakGgCCkDADcDACAEQeCKAmpBoAgpAwA3AwAgBEHoigJqQaAIKQMANwMAIARB8IoCakGgCCkDADcDACAEQfiKAmpBoAgpAwA3AwAgBEGAiwJqQaAIKQMANwMAIARBiIsCakGgCCkDADcDACAEQZCLAmpBoAgpAwA3AwAgBEGYiwJqQaAIKQMANwMAIARBoIsCakGgCCkDADcDACAEQaiLAmpBoAgpAwA3AwAgBEGwiwJqQaAIKQMANwMAIARBuIsCakGgCCkDADcDACAEQcCLAmpBoAgpAwA3AwAgBEHIiwJqQaAIKQMANwMAIARB0IsCakGgCCkDADcDACAEQdiLAmpBoAgpAwA3AwAgBEHgiwJqQaAIKQMANwMAIARB6IsCakGgCCkDADcDACAEQfCLAmpBoAgpAwA3AwAgBEH4iwJqQaAIKQMANwMAIARBgIwCakGgCCkDADcDACAEQYiMAmpBoAgpAwA3AwAgBEGQjAJqQaAIKQMANwMAIARBmIwCakGgCCkDADcDACAEQaCMAmpBoAgpAwA3AwAgBEGojAJqQaAIKQMANwMAIARBsIwCakGgCCkDADcDACAEQbiMAmpBoAgpAwA3AwAgBEHAjAJqQaAIKQMANwMAIARByIwCakGgCCkDADcDACAEQdCMAmpBoAgpAwA3AwAgBEHYjAJqQaAIKQMANwMAIARB4IwCakGgCCkDADcDACAEQeiMAmpBoAgpAwA3AwAgBEHwjAJqQaAIKQMANwMAIARB+IwCakGgCCkDADcDACAEQYCNAmpBoAgpAwA3AwAgBEGIjQJqQaAIKQMANwMAIARBkI0CakGgCCkDADcDACAEQZiNAmpBoAgpAwA3AwAgBEGwiQZqIAZBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBkGABPwKAABB1AgoAgBBAnRB0IkOaiAGQYAE/AoAAEHUCCgCAEECdEHgiRJqIAZBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBkGABPwKAABB1AhB1AgoAgBBgAFqIgY2AgALIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiAFNgIAIABBAXZBAXEgAWxBAnRBsIkGaiAFNgIAIABBAnZBAXEgAWxBAnRBwIkKaiAFNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiAFNgIAIABBBHZBAXEgAWxBAnRB4IkSaiAFNgIAIABBBXYgAWxBAnRB8IkWaiAFNgIAQdQIKAIAIQYLIAFBAWohAUHcCEHcCCgCACAAcjYCACACLQAAIQAgAkEBaiIEIQIgAEH/AHEiA0E/ayIAQcAASQ0ACyAECyECQQAhBCACIQYgASEIIANB/QBxQSFGDQELIANBJGsOCgEDAwMDAwMDAwIDC0HsCEIBNwIADAQLQdgIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbNgIADAILQegIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbIgA2AgBB2AggADYCACAAQQRrEAAEQEHoCEEENgIAQdgIQQQ2AgBB0AhBATYCAA8LEAgMAQsCQCADQTtHDQBB7AgoAgAiAEEHSg0AQewIIABBAWo2AgAgAEECdEHwCGpBADYCAAsgAiEGIAQhAyABIQgMAQtBBCEIIAIhBiAEIQMLIAYgCUkNAAsLQeQIIAU2AgBB4AggAzYCAEHoCCAINgIAC9ELAgF+CH9B2AhCBDcDAEGojQJBoAgpAwAiADcDAEGgjQIgADcDAEGYjQIgADcDAEGQjQIgADcDAEGIjQIgADcDAEGAjQIgADcDAEH4jAIgADcDAEHwjAIgADcDAEHojAIgADcDAEHgjAIgADcDAEHYjAIgADcDAEHQjAIgADcDAEHIjAIgADcDAEHAjAIgADcDAEG4jAIgADcDAEGwjAIgADcDAEGojAIgADcDAEGgjAIgADcDAEGYjAIgADcDAEGQjAIgADcDAEGIjAIgADcDAEGAjAIgADcDAEH4iwIgADcDAEHwiwIgADcDAEHoiwIgADcDAEHgiwIgADcDAEHYiwIgADcDAEHQiwIgADcDAEHIiwIgADcDAEHAiwIgADcDAEG4iwIgADcDAEGwiwIgADcDAEGoiwIgADcDAEGgiwIgADcDAEGYiwIgADcDAEGQiwIgADcDAEGIiwIgADcDAEGAiwIgADcDAEH4igIgADcDAEHwigIgADcDAEHoigIgADcDAEHgigIgADcDAEHYigIgADcDAEHQigIgADcDAEHIigIgADcDAEHAigIgADcDAEG4igIgADcDAEGwigIgADcDAEGoigIgADcDAEGgigIgADcDAEGYigIgADcDAEGQigIgADcDAEGIigIgADcDAEGAigIgADcDAEH4iQIgADcDAEHwiQIgADcDAEHoiQIgADcDAEHgiQIgADcDAEHYiQIgADcDAEHQiQIgADcDAEHIiQIgADcDAEHAiQIgADcDAEG4iQIgADcDAEGwiQIgADcDAEGoCCgCACIEQf8AakGAAW0hCAJAIARBgQFIDQBBASEBIAhBAiAIQQJKG0EBayICQQFxIQMgBEGBAk4EQCACQX5xIQIDQCABQQl0IgdBEHJBoIkCakGwiQJBgAT8CgAAIAdBsI0CakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsLIANFDQAgAUEJdEEQckGgiQJqQbCJAkGABPwKAAALAkAgBEEBSA0AIAhBASAIQQFKGyIDQQFxIQUCQCADQQFrIgdFBEBBACEBDAELIANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQbCJBmpBsIkCQYAE/AoAACAGQZAEckGwiQZqQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACwsgBQRAIAFBCXRBEHJBsIkGakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEFIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiBkEQckHAiQpqQbCJAkGABPwKAAAgBkGQBHJBwIkKakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAFBEAgAUECdEHAiQpqQbCJAkGABPwKAAALIARBAUgNACADQQFxIQUgBwR/IANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQdCJDmpBsIkCQYAE/AoAACAGQZAEckHQiQ5qQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACyABQQd0QQRyBUEECyEBIAUEQCABQQJ0QdCJDmpBsIkCQYAE/AoAAAsgBEEBSA0AIANBAXEhBSAHBH8gA0H+////B3EhAkEAIQEDQCABQQl0IgZBEHJB4IkSakGwiQJBgAT8CgAAIAZBkARyQeCJEmpBsIkCQYAE/AoAACABQQJqIQEgAkECayICDQALIAFBB3RBBHIFQQQLIQEgBQRAIAFBAnRB4IkSakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEEIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiA0EQckHwiRZqQbCJAkGABPwKAAAgA0GQBHJB8IkWakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAERQ0AIAFBAnRB8IkWakGwiQJBgAT8CgAAC0HUCCAIQQd0QQRyNgIAC58TAgh/AX5B5AgoAgAhA0HgCCgCACECQegIKAIAIQcgAUGQiQFqIglB/wE6AAAgACABSARAIABBkIkBaiEIA0AgAiEEIAhBAWohAQJAIAgtAABB/wBxIgJBMGtBCUsEQCABIQgMAQtB7AgoAgBBAnRB7AhqIgUoAgAhAANAIAUgAiAAQQpsakEwayIANgIAIAEtAAAhAiABQQFqIgghASACQf8AcSICQTBrQQpJDQALCwJAAkACQAJAAkACQAJ/AkAgAkE/ayIAQT9NBEAgBEUNASAEQSFGBEBB8AgoAgAiAUEBIAEbIgQgB2ohAQJAIABFDQAgB0H//wBLDQBBgIABIAdrIAQgAUH//wBLGyEFAkAgAEEBcUUNACAHQQJ0QaCJAmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEECcUUNACAHQQJ0QbCJBmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEEcUUNACAHQQJ0QcCJCmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEIcUUNACAHQQJ0QdCJDmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEQcUUNACAHQQJ0QeCJEmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLIABBIHFFDQAgBUEBayEEIAdBAnRB8IkWaiEAIAVBB3EiAgRAA0AgACADNgIAIABBBGohACAFQQFrIQUgAkEBayICDQALCyAEQQdJDQADQCAAIAM2AhwgACADNgIYIAAgAzYCFCAAIAM2AhAgACADNgIMIAAgAzYCCCAAIAM2AgQgACADNgIAIABBIGohACAFQQhrIgUNAAsLIAhBAWoiBSAILQAAQf8AcSICQT9rIgBBP00NAxoMBAsCQEHsCCgCACIFQQFGBEBB8AgoAgAiAUHMCCgCACIESQ0BIAEgBHAhAQwBC0H4CCgCACEEQfQIKAIAIQECQAJAIAVBBUcNACABQQFHDQAgBEHpAk4NBAwBCyAEQeQASg0DQfwIKAIAQeQASg0DQYAJKAIAQeQASg0DCwJAIAFFDQAgAUECSg0AIARB/AgoAgBBgAkoAgAgAUECdEGICGooAgARAgAhBEHwCCgCACIBQcwIKAIAIgVPBH8gASAFcAUgAQtBAnRBkAlqIAQ2AgALQfAIKAIAIgFBzAgoAgAiBEkNACABIARwIQELIAFBAnRBkAlqKAIAIQMMAQsgAkH9AHFBIUcEQCAHIQEgAiEADAQLIARBI0cNBAJAQewIKAIAIgRBAUYEQEHwCCgCACIBQcwIKAIAIgBJDQEgASAAcCEBDAELQfgIKAIAIQFB9AgoAgAhAAJAAkAgBEEFRw0AIABBAUcNACABQekCSA0BDAcLIAFB5ABKDQZB/AgoAgBB5ABKDQZBgAkoAgBB5ABKDQYLAkAgAEUNACAAQQJKDQAgAUH8CCgCAEGACSgCACAAQQJ0QYgIaigCABECACEAQfAIKAIAIgFBzAgoAgAiBE8EfyABIARwBSABC0ECdEGQCWogADYCAAtB8AgoAgAiAUHMCCgCACIASQ0AIAEgAHAhAQsgAUECdEGQCWooAgAhAwwECyAHIQEgCAshBQNAIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiADNgIAIABBAXZBAXEgAWxBAnRBsIkGaiADNgIAIABBAnZBAXEgAWxBAnRBwIkKaiADNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiADNgIAIABBBHZBAXEgAWxBAnRB4IkSaiADNgIAIABBBXYgAWxBAnRB8IkWaiADNgIACyABQQFqIQEgBS0AACEAIAVBAWoiBCEFIABB/wBxIgJBP2siAEHAAEkNAAsgBCEFC0EAIQQgBSEIIAEhByACIQAgAkH9AHFBIUYNAQtBBCEHIAQhAiAAQSRrDgoDAgICAgICAgIBAgtB7AhCATcCAAwCC0GoCCgCAEEEaxAABEBB0AhBATYCAA8LAkBBqAgoAgAiBkEFSA0AQaAIKQMAIQogBkEDa0EBdiIBQQdxIQJBACEAIAFBAWtBB08EQCABQfj///8HcSEFA0AgAEEDdCIBQbCJAmogCjcDACABQQhyQbCJAmogCjcDACABQRByQbCJAmogCjcDACABQRhyQbCJAmogCjcDACABQSByQbCJAmogCjcDACABQShyQbCJAmogCjcDACABQTByQbCJAmogCjcDACABQThyQbCJAmogCjcDACAAQQhqIQAgBUEIayIFDQALCyACRQ0AA0AgAEEDdEGwiQJqIAo3AwAgAEEBaiEAIAJBAWsiAg0ACwtBwIkGQbCJAiAGQQJ0IgD8CgAAQdCJCkGwiQIgAPwKAABB4IkOQbCJAiAA/AoAAEHwiRJBsIkCIAD8CgAAQYCKFkGwiQIgAPwKAAAgBCECDAELAkAgAEE7Rw0AQewIKAIAIgBBB0oNAEHsCCAAQQFqNgIAIABBAnRB8AhqQQA2AgALIAEhBwsgCCAJSQ0ACwtB5AggAzYCAEHgCCACNgIAQegIIAc2AgAL4gcCBX8BfgJAQdAIAn8CQAJAIAAgAU4NACABQZCJAWohBiAAQZCJAWohBQNAIAUtAAAiA0H/AHEhAgJAAkACQAJAAkACQAJAQeAIKAIAIgRBIkcEQCAEDQcgAkEiRgRAQewIQgE3AgBB4AhBIjYCAAwICyACQT9rQcAASQ0GIANBIWsiAkEMTQ0BDAULAkAgAkEwayIEQQlNBEBB7AgoAgBBAnRB7AhqIgIgBCACKAIAQQpsajYCAAwBC0HsCCgCACEEIAJBO0YEQCAEQQdKDQFB7AggBEEBajYCACAEQQJ0QfAIakEANgIADAELIARBBEYEQEHECEECNgIAQbAIQfAIKQMANwMAQbgIQfgIKAIAIgI2AgBBvAhB/AgoAgAiBDYCAEHICEECQQFBwAgoAgAiAxs2AgBBrAggBEEAIAMbNgIAQagIIAJBgIABIAJBgIABSBtBBGpBACADGzYCAEHgCEEANgIADAoLIAJBP2tBwABJDQQLIANBIWsiAkEMTQ0BDAILQQEgAnRBjSBxRQ0DDAQLQQEgAnRBjSBxDQELIANBoQFrIgJBDEsNA0EBIAJ0QY0gcUUNAwtBxAhCgYCAgBA3AgBBsAhB8AgoAgBBAEHsCCgCACICQQBKGzYCAEG0CEH0CCgCAEEAIAJBAUobNgIAQbgIQfgIKAIAQQAgAkECShs2AgBB4AhBADYCAEG8CEEANgIADAQLIANBoQFrIgJBDEsNAUEBIAJ0QY0gcUUNAQtBxAhCgYCAgBA3AgBBsAhCADcDAEG4CEIANwMADAMLIAVBAWoiBSAGSQ0ACwsCQEHICCgCAA4DAwEAAQsCQEGoCCgCACIFQQVIDQBBoAgpAwAhByAFQQNrQQF2IgNBB3EhBEEAIQIgA0EBa0EHTwRAIANB+P///wdxIQYDQCACQQN0IgNBsIkCaiAHNwMAIANBCHJBsIkCaiAHNwMAIANBEHJBsIkCaiAHNwMAIANBGHJBsIkCaiAHNwMAIANBIHJBsIkCaiAHNwMAIANBKHJBsIkCaiAHNwMAIANBMHJBsIkCaiAHNwMAIANBOHJBsIkCaiAHNwMAIAJBCGohAiAGQQhrIgYNAAsLIARFDQADQCACQQN0QbCJAmogBzcDACACQQFqIQIgBEEBayIEDQALC0HAiQZBsIkCIAVBAnQiA/wKAABB0IkKQbCJAiAD/AoAAEHgiQ5BsIkCIAP8CgAAQfCJEkGwiQIgA/wKAABBgIoWQbCJAiAD/AoAAEECDAELEAhByAgoAgALEAEiAjYCACACDQAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLdABB6AhBBDYCAEHkCCAANgIAQewIQgE3AgBBxAhCADcCAEHACCADNgIAQdwIQgA3AgBBqAhCADcDAEGwCEIANwMAQbgIQgA3AwBBzAggAkGAICACQYAgSRs2AgBBoAggAa1CgYCAgBB+NwMAQdAIQQA2AgALIwBB0AgoAgBFBEAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLWgECfwJAAkACQEHICCgCAEEBaw4CAAECC0HYCEHoCCgCACIAQdgIKAIAIgEgACABShsiAEGAgAEgAEGAgAFIGyIANgIAIABBBGsPC0GoCCgCAEEEayEACyAAC0IBAX8Cf0EGQdwIKAIAIgBBIHENABpBBSAAQRBxDQAaQQQgAEEIcQ0AGkEDIABBBHENABpBAiAAQQFxIABBAnEbCwu9BQEFfQJ/IAJFBEAgAUH/AWxBMmpB5ABtIgBBCHQgAHIgAEEQdHIMAQsgArJDAADIQpUhBiAAQfABarJDAAC0Q5UhBQJ9IAGyQwAAyEKVIgNDAAAAP10EQCADIAZDAACAP5KUDAELIAYgA0MAAIA/IAaTlJILIQcgAyADkiEGAkAgBUOrqqo+kiIEQwAAAABdBEAgBEMAAIA/kiEEDAELIARDAACAP15FDQAgBEMAAIC/kiEECyAGIAeTIQMgBUMAAAAAXSEAAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQECQCAABEAgBUMAAIA/kiEEDAELIAUiBEMAAIA/XkUNACAFQwAAgL+SIQQLIAVDq6qqvpIiBUMAAAAAXSECAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQACQCACBEAgBUMAAIA/kiEFDAELIAVDAACAP15FDQAgBUMAAIC/kiEFCwJAIAVDq6oqPl0EQCADIAcgA5NDAADAQJQgBZSSIQcMAQsgBUMAAAA/XQ0AIAVDq6oqP11FBEAgAyEHDAELIAMgByADkyAFQwAAwMCUQwAAgECSlJIhBwsgAEEIdAJ/IAdDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALQRB0ciABcgtBgICAeHILNwAgAEH/AWxBMmpB5ABtIAFB/wFsQTJqQeQAbUEIdHIgAkH/AWxBMmpB5ABtQRB0ckGAgIB4cgsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwsYAQBBgAgLEQEAAAACAAAAAwAAAAQAAAAF`}})),k1=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=D1(),n=O1();function r(e){if(typeof Buffer<`u`)return Buffer.from(e,`base64`);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<n.length;++e)n[e]=t.charCodeAt(e);return n}var i=r(n.LIMITS.BYTES),a,o=new Uint32Array,s=class{constructor(){this.bandHandler=e=>1,this.modeHandler=e=>1}handle_band(e){return this.bandHandler(e)}mode_parsed(e){return this.modeHandler(e)}},c={memoryLimit:134217728,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:n.LIMITS.PALETTE_SIZE,truncate:!0};function l(e){let t=new s,n={env:{handle_band:t.handle_band.bind(t),mode_parsed:t.mode_parsed.bind(t)}};return WebAssembly.instantiate(a||i,n).then(n=>(a||=n.module,new u(e,n.instance||n,t)))}e.DecoderAsync=l;var u=class{constructor(e,r,s){if(this._PIXEL_OFFSET=n.LIMITS.MAX_WIDTH+4,this._canvas=o,this._bandWidths=[],this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},c,e),this._opts.paletteLimit>n.LIMITS.PALETTE_SIZE)throw Error(`DecoderOptions.paletteLimit must not exceed ${n.LIMITS.PALETTE_SIZE}`);if(r)s.bandHandler=this._handle_band.bind(this),s.modeHandler=this._initCanvas.bind(this);else{let e=a||=new WebAssembly.Module(i);r=new WebAssembly.Instance(e,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=r,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),n.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),n.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(e){if(e===2){let e=this.width*this.height;if(e>this._canvas.length){if(this._opts.memoryLimit&&e*4>this._opts.memoryLimit)throw this.release(),Error(`image exceeds memory limit`);this._canvas=new Uint32Array(e)}this._maxWidth=this._width}else if(e===1){if(this._level===2){let e=Math.min(this._rasterWidth,n.LIMITS.MAX_WIDTH)*this._rasterHeight;if(e>this._canvas.length){if(this._opts.memoryLimit&&e*4>this._opts.memoryLimit)throw this.release(),Error(`image exceeds memory limit`);this._canvas=new Uint32Array(e)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536))}return 0}_realloc(e,t){let n=e+t;if(n>this._canvas.length){if(this._opts.memoryLimit&&n*4>this._opts.memoryLimit)throw this.release(),Error(`image exceeds memory limit`);let e=new Uint32Array(Math.ceil(n/65536)*65536);e.set(this._canvas),this._canvas=e}}_handle_band(e){let t=this._PIXEL_OFFSET,n=this._lastOffset;if(this._mode===2){let r=this.height-this._currentHeight,i=0;for(;i<6&&r>0;)this._canvas.set(this._pSrc.subarray(t*i,t*i+e),n+e*i),i++,r--;this._lastOffset+=e*i,this._currentHeight+=i}else if(this._mode===1){this._realloc(n,e*6),this._maxWidth=Math.max(this._maxWidth,e),this._minWidth=Math.min(this._minWidth,e);for(let r=0;r<6;++r)this._canvas.set(this._pSrc.subarray(t*r,t*r+e),n+e*r);this._bandWidths.push(e),this._lastOffset+=e*6,this._currentHeight+=6}return 0}get width(){return this._mode===1?Math.max(this._maxWidth,this._wasm.current_width()):this._width}get height(){return this._mode===1?this._wasm.current_width()?this._bandWidths.length*6+this._wasm.current_height():this._bandWidths.length*6:this._height}get palette(){return this._palette.subarray(0,this._paletteLimit)}get memoryUsage(){return this._canvas.byteLength+this._wasm.memory.buffer.byteLength+8*this._bandWidths.length}get properties(){return{width:this.width,height:this.height,mode:this._mode,level:this._level,truncate:!!this._truncate,paletteLimit:this._paletteLimit,fillColor:this._fillColor,memUsage:this.memoryUsage,rasterAttributes:{numerator:this._states[4],denominator:this._states[5],width:this._rasterWidth,height:this._rasterHeight}}}init(e=this._opts.fillColor,t=this._opts.palette,r=this._opts.paletteLimit,i=this._opts.truncate){this._wasm.init(this._opts.sixelColor,e,r,+!!i),t&&this._palette.set(t.subarray(0,n.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(e,t=0,r=e.length){let i=t;for(;i<r;){let t=Math.min(r-i,n.LIMITS.CHUNK_SIZE);this._chunk.set(e.subarray(i,i+=t)),this._wasm.decode(0,t)}}decodeString(e,t=0,r=e.length){let i=t;for(;i<r;){let t=Math.min(r-i,n.LIMITS.CHUNK_SIZE);for(let n=0,r=i;n<t;++n,++r)this._chunk[n]=e.charCodeAt(r);i+=t,this._wasm.decode(0,t)}}get data32(){if(this._mode===0||!this.width||!this.height)return o;let e=this._wasm.current_width();if(this._mode===2){let t=this.height-this._currentHeight;if(t>0){let n=this._PIXEL_OFFSET,r=this._lastOffset,i=0;for(;i<6&&t>0;)this._canvas.set(this._pSrc.subarray(n*i,n*i+e),r+e*i),i++,t--;t&&this._canvas.fill(this._fillColor,r+e*i)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let t=!1;if(e){if(e!==this._minWidth)t=!0;else{let t=this._PIXEL_OFFSET,n=this._lastOffset;this._realloc(n,e*6);for(let r=0;r<6;++r)this._canvas.set(this._pSrc.subarray(t*r,t*r+e),n+e*r)}}if(!t)return this._canvas.subarray(0,this.width*this.height)}let t=new Uint32Array(this.width*this.height);t.fill(this._fillColor);let n=0,r=0;for(let e=0;e<this._bandWidths.length;++e){let i=this._bandWidths[e];for(let e=0;e<6;++e)t.set(this._canvas.subarray(r,r+=i),n),n+=this.width}if(e){let r=this._PIXEL_OFFSET,i=this._wasm.current_height();for(let a=0;a<i;++a)t.set(this._pSrc.subarray(r*a,r*a+e),n+this.width*a)}return t}return o}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=o,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}};e.Decoder=u;function d(e,t){let n=new u(t);return n.init(),typeof e==`string`?n.decodeString(e):n.decode(e),{width:n.width,height:n.height,data32:n.data32,data8:n.data8}}e.decode=d;async function f(e,t){let n=await l(t);return n.init(),typeof e==`string`?n.decodeString(e):n.decode(e),{width:n.width,height:n.height,data32:n.data32,data8:n.data8}}e.decodeAsync=f})),A1=D1(),j1=k1(),M1=A1.PALETTE_ANSI_256.slice();M1.set(A1.PALETTE_VT340_COLOR);var N1=200,P1=new TextEncoder,F1=`offsite-image:`;async function I1(e){let t=await(0,j1.decodeAsync)(e,{fillColor:0,palette:M1});return!t.width||!t.height?null:createImageBitmap(new ImageData(new Uint8ClampedArray(t.data8),t.width,t.height))}function L1(e,t,n){return e===void 0||e===`auto`?0:e.endsWith(`%`)?parseInt(e.slice(0,-1))*t/100:e.endsWith(`px`)?parseInt(e.slice(0,-2)):parseInt(e)*n}async function R1(e,t){let n=e.indexOf(`:`);if(n===-1)return null;let r=new Map(e.slice(0,n).split(`;`).map(e=>{let t=e.indexOf(`=`);return[e.slice(0,t),e.slice(t+1)]}));if(r.get(`inline`)!==`1`)return null;let i=Uint8Array.from(atob(e.slice(n+1)),e=>e.charCodeAt(0)),a=await createImageBitmap(new Blob([i])),o=L1(r.get(`width`),t.width,t.cellWidth),s=L1(r.get(`height`),t.height,t.cellHeight),c=[a.width,a.height];if(!o&&!s){let e=Math.min(t.width/a.width,(t.height-t.cellHeight)/a.height);e<1&&(c=[a.width*e,a.height*e])}else c=o?r.get(`preserveAspectRatio`)!==`0`||!s?[o,a.height*o/a.width]:[o,s]:[a.width*s/a.height,s];let[l,u]=c.map(e=>Math.max(1,Math.floor(e*t.pixelRatio))),d=await createImageBitmap(a,{resizeWidth:l,resizeHeight:u});return a.close(),d}function z1(e){let t=E1(e),{width:n,height:r,depth:i,channels:a}=t,o=n*r,s=new Uint8Array(o*4);if(t.palette){let e=w1(t),i=t.palette[0].length;for(let t=0;t<o;t+=1)s.set(e.subarray(t*i,t*i+3),t*4),s[t*4+3]=i===4?e[t*i+3]:255;return{width:n,height:r,data:s}}let c=2**i-1,l=Math.ceil(n*i/8);function u(e){if(i>=8)return t.data[e];let r=e%n*i;return t.data[Math.floor(e/n)*l+(r>>3)]>>8-i-(r&7)&c}function d(e){return i===16?e>>8:i===8?e:Math.round(e*255/c)}let f=t.transparency;for(let e=0;e<o;e+=1){let t=e*4;if(a===1||a===2){let n=u(e*a);s.fill(d(n),t,t+3),s[t+3]=a===2?d(u(e*2+1)):f?.[0]===n?0:255}else if(a===3||a===4){let n=u(e*a),r=u(e*a+1),i=u(e*a+2);s[t]=d(n),s[t+1]=d(r),s[t+2]=d(i),s[t+3]=a===4?d(u(e*4+3)):f?.[0]===n&&f[1]===r&&f[2]===i?0:255}else throw Error(`unsupported PNG with ${a} channels`)}return{width:n,height:r,data:s}}var B1=class{core;images=[];nextImage=0;constructor(e){this.core=e}place(e,t,n){let r=`${F1}${this.nextImage++}`;this.core.write(P1.encode(`\x1b]8;;${r}\x1b\\ \x1b]8;;\x1b\\\b`));let i={ref:this.core.trackCursor(),marker:r,bitmap:e,width:e.width/t,height:e.height/t,alternate:this.core.isAlternateScreen()};if(this.images.push(i),this.images.length>N1){let e=this.images.shift();e&&this.remove(e)}let a=Math.ceil(i.height/n);a>1&&this.core.write(P1.encode(`\x1BD`.repeat(a-1)))}visible(e,t,n){if(this.images.length===0)return[];let r=this.core.isAlternateScreen(),i=[],a=[];for(let o of this.images){if(o.alternate!==r){a.push(o);continue}let s=this.core.trackedPoint(o.ref);if(s===null||this.core.trackedHyperlink(o.ref)!==o.marker){this.remove(o);continue}a.push(o);let c=s.y-e;c+Math.ceil(o.height/n)<=0||c>=t||i.push({bitmap:o.bitmap,width:o.width,height:o.height,x:s.x,y:c})}return this.images=a,i}clear(){for(let e of this.images)this.remove(e);this.images=[]}remove(e){this.core.untrack(e.ref),e.bitmap.close()}},V1=new Uint8Array([0,97,115,109,1,0,0,0,1,35,5,96,4,127,127,127,127,0,96,3,127,127,127,1,127,96,2,127,127,0,96,3,127,127,127,0,96,5,127,127,127,127,127,1,127,2,49,6,3,101,110,118,1,119,0,0,3,101,110,118,1,100,0,1,3,101,110,118,1,115,0,1,3,101,110,118,1,98,0,2,3,101,110,118,1,118,0,3,3,101,110,118,1,112,0,4,7,25,6,1,119,0,0,1,100,0,1,1,115,0,2,1,98,0,3,1,118,0,4,1,112,0,5]),H1={userdata:0,writePty:1,bell:2,xtversion:4,size:6,deviceAttributes:8},U1=1,W1=-3,G1={width:0,height:4,data:8,length:12},K1=new TextDecoder,q1=new TextEncoder,J1=class e{memory;layouts;exports;memoryView;hosts=new Map;nextHostId=1;callbacks={writePty:0,deviceAttributes:0,size:0,bell:0,xtversion:0};version={pointer:0,size:0};constructor(e){this.exports=e.exports;let t=e.exports.memory;if(!(t instanceof WebAssembly.Memory))throw Error(`libghostty-vt did not export its memory`);this.memory=t,this.memoryView=new DataView(t.buffer);let n=this.call(`ghostty_type_json`),r=new Uint8Array(t.buffer),i=n;for(;i<r.length&&r[i]!==0;)i+=1;this.layouts=JSON.parse(K1.decode(r.subarray(n,i)))}static async load(){let t=await fetch(YQ);if(!t.ok)throw Error(`could not load libghostty-vt (${t.status})`);let n=null,r=await WebAssembly.instantiate(await t.arrayBuffer(),{env:{log:(e,t)=>{n&&console.debug(`[libghostty-vt]`,K1.decode(new Uint8Array(n.buffer,e,t)))}}}),i=new e(r.instance);return n=i.memory,i.installCallbacks(),i}call(e,...t){let n=this.exports[e];if(typeof n!=`function`)throw Error(`libghostty-vt export is missing: ${e}`);return n(...t)}layout(e){let t=this.layouts[e];if(!t)throw Error(`libghostty-vt layout is missing: ${e}`);return t}field(e,t){let n=this.layout(e).fields[t];if(!n)throw Error(`libghostty-vt field is missing: ${e}.${t}`);return n}alloc(e){let t=this.call(`ghostty_wasm_alloc_u8_array`,e);if(t===0)throw Error(`libghostty-vt could not allocate ${e} bytes`);return new Uint8Array(this.memory.buffer,t,e).fill(0),t}free(e,t){e!==0&&this.call(`ghostty_wasm_free_u8_array`,e,t)}allocOpaque(){let e=this.call(`ghostty_wasm_alloc_opaque`);if(e===0)throw Error(`libghostty-vt could not allocate a pointer`);return new DataView(this.memory.buffer).setUint32(e,0,!0),e}freeOpaque(e){e!==0&&this.call(`ghostty_wasm_free_opaque`,e)}readPointer(e){return this.dataView().getUint32(e,!0)}check(e,t){if(t!==0)throw Error(`${e} failed with result ${t}`)}flag(e,t,n){let r=this.alloc(1),i=this.call(e,t,n,r),a=this.bytes(r,1)[0];return this.free(r,1),i===0&&a!==0}encodeOutput(e){let t=this.call(`ghostty_wasm_alloc_usize`),n=``,r=e(0,0,t),i=this.view(t,4).getUint32(0,!0);if(r===W1&&i>0){let r=this.alloc(i),a=e(r,i,t),o=this.view(t,4).getUint32(0,!0);a===0&&(n=K1.decode(this.bytes(r,o))),this.free(r,i)}return this.call(`ghostty_wasm_free_usize`,t),n}attachHost(e,t){let n=this.nextHostId++;this.hosts.set(n,t),this.call(`ghostty_terminal_set`,e,H1.userdata,n);for(let t of[[H1.writePty,this.callbacks.writePty],[H1.deviceAttributes,this.callbacks.deviceAttributes],[H1.size,this.callbacks.size],[H1.bell,this.callbacks.bell],[H1.xtversion,this.callbacks.xtversion]])this.call(`ghostty_terminal_set`,e,t[0],t[1]);return n}detachHost(e,t){this.call(`ghostty_terminal_set`,e,H1.xtversion,0),this.call(`ghostty_terminal_set`,e,H1.bell,0),this.call(`ghostty_terminal_set`,e,H1.size,0),this.call(`ghostty_terminal_set`,e,H1.deviceAttributes,0),this.call(`ghostty_terminal_set`,e,H1.writePty,0),this.call(`ghostty_terminal_set`,e,H1.userdata,0),this.hosts.delete(t)}view(e,t){return new DataView(this.memory.buffer,e,t)}bytes(e,t){return new Uint8Array(this.memory.buffer,e,t)}dataView(){return this.memoryView.buffer!==this.memory.buffer&&(this.memoryView=new DataView(this.memory.buffer)),this.memoryView}setField(e,t,n,r){let i=this.field(t,n),a=this.dataView(),o=e+i.offset;if(i.type===`bool`||i.type===`u8`)a.setUint8(o,r);else if(i.type===`u16`)a.setUint16(o,r,!0);else if(i.type===`i32`)a.setInt32(o,r,!0);else if(i.type===`u32`||i.type===`enum`)a.setUint32(o,r,!0);else if(i.type===`u64`)a.setBigUint64(o,BigInt(r),!0);else throw Error(`unsupported libghostty-vt field type ${i.type}`)}readField(e,t,n){let r=this.field(t,n),i=this.dataView(),a=e+r.offset;if(r.type===`bool`||r.type===`u8`)return i.getUint8(a);if(r.type===`u16`)return i.getUint16(a,!0);if(r.type===`i32`)return i.getInt32(a,!0);if(r.type===`u32`||r.type===`enum`)return i.getUint32(a,!0);if(r.type===`u64`)return Number(i.getBigUint64(a,!0));throw Error(`unsupported libghostty-vt field type ${r.type}`)}installCallbacks(){let e=new WebAssembly.Instance(new WebAssembly.Module(V1),{env:{w:(e,t,n,r)=>{let i=this.hosts.get(t);i&&r!==0&&i.write(K1.decode(new Uint8Array(this.memory.buffer,n,r)))},d:(e,t,n)=>this.hosts.has(t)?(this.writeDeviceAttributes(n),1):0,s:(e,t,n)=>{let r=this.hosts.get(t);if(!r)return 0;let i=r.size(),a=`GhosttySizeReportSize`;return this.setField(n,a,`rows`,i.rows),this.setField(n,a,`columns`,i.columns),this.setField(n,a,`cell_width`,i.cellWidth),this.setField(n,a,`cell_height`,i.cellHeight),1},b:(e,t)=>{this.hosts.get(t)?.bell()},v:(e,t,n)=>{let r=this.hosts.get(n);r&&this.writeVersion(e,r.version())},p:(e,t,n,r,i)=>this.decodePng(t,n,r,i)}}),t=this.exports.__indirect_function_table;if(!(t instanceof WebAssembly.Table))throw Error(`libghostty-vt did not expose its callback table`);let n=[`w`,`d`,`s`,`b`,`v`,`p`].map(n=>{let r=e.exports[n];if(typeof r!=`function`)throw Error(`libghostty-vt callback is missing: ${n}`);let i=t.length;return t.grow(1),t.set(i,r),i});if(this.callbacks={writePty:n[0],deviceAttributes:n[1],size:n[2],bell:n[3],xtversion:n[4]},this.call(`ghostty_sys_set`,U1,n[5])!==0)throw Error(`libghostty-vt did not accept the PNG decoder`)}decodePng(e,t,n,r){let i;try{i=z1(new Uint8Array(this.memory.buffer,t,n))}catch(e){return console.warn(`could not decode a kitty PNG image`,e),0}let a=this.call(`ghostty_alloc`,e,i.data.length);if(a===0)return 0;this.bytes(a,i.data.length).set(i.data);let o=this.dataView();return o.setUint32(r+G1.width,i.width,!0),o.setUint32(r+G1.height,i.height,!0),o.setUint32(r+G1.data,a,!0),o.setUint32(r+G1.length,i.data.length,!0),1}writeVersion(e,t){let n=q1.encode(t);this.free(this.version.pointer,this.version.size);let r=this.alloc(n.length);this.bytes(r,n.length).set(n),this.version={pointer:r,size:n.length},this.dataView().setUint32(e+this.field(`GhosttyString`,`ptr`).offset,r,!0),this.setField(e,`GhosttyString`,`len`,n.length)}writeDeviceAttributes(e){let t=e+this.field(`GhosttyDeviceAttributes`,`primary`).offset,n=e+this.field(`GhosttyDeviceAttributes`,`secondary`).offset,r=e+this.field(`GhosttyDeviceAttributes`,`tertiary`).offset,i=`GhosttyDeviceAttributesPrimary`,a=`GhosttyDeviceAttributesSecondary`,o=t+this.field(i,`features`).offset,s=this.dataView(),c=[4,22];c.forEach((e,t)=>s.setUint16(o+t*2,e,!0)),this.setField(t,i,`conformance_level`,62),this.setField(t,i,`num_features`,c.length),this.setField(n,a,`device_type`,0),this.setField(n,a,`firmware_version`,276),this.setField(n,a,`rom_cartridge`,0),this.setField(r,`GhosttyDeviceAttributesTertiary`,`unit_id`,0)}},Y1=null;async function X1(){Y1=await J1.load()}function Z1(){if(!Y1)throw Error(`libghostty-vt is not loaded`);return Y1}var Q1=new Map(`Unidentified.Backquote.Backslash.BracketLeft.BracketRight.Comma.Digit0.Digit1.Digit2.Digit3.Digit4.Digit5.Digit6.Digit7.Digit8.Digit9.Equal.IntlBackslash.IntlRo.IntlYen.KeyA.KeyB.KeyC.KeyD.KeyE.KeyF.KeyG.KeyH.KeyI.KeyJ.KeyK.KeyL.KeyM.KeyN.KeyO.KeyP.KeyQ.KeyR.KeyS.KeyT.KeyU.KeyV.KeyW.KeyX.KeyY.KeyZ.Minus.Period.Quote.Semicolon.Slash.AltLeft.AltRight.Backspace.CapsLock.ContextMenu.ControlLeft.ControlRight.Enter.MetaLeft.MetaRight.ShiftLeft.ShiftRight.Space.Tab.Convert.KanaMode.NonConvert.Delete.End.Help.Home.Insert.PageDown.PageUp.ArrowDown.ArrowLeft.ArrowRight.ArrowUp.NumLock.Numpad0.Numpad1.Numpad2.Numpad3.Numpad4.Numpad5.Numpad6.Numpad7.Numpad8.Numpad9.NumpadAdd.NumpadBackspace.NumpadClear.NumpadClearEntry.NumpadComma.NumpadDecimal.NumpadDivide.NumpadEnter.NumpadEqual.NumpadMemoryAdd.NumpadMemoryClear.NumpadMemoryRecall.NumpadMemoryStore.NumpadMemorySubtract.NumpadMultiply.NumpadParenLeft.NumpadParenRight.NumpadSubtract.NumpadSeparator.NumpadArrowUp.NumpadArrowDown.NumpadArrowRight.NumpadArrowLeft.NumpadBegin.NumpadHome.NumpadEnd.NumpadInsert.NumpadDelete.NumpadPageUp.NumpadPageDown.Escape.F1.F2.F3.F4.F5.F6.F7.F8.F9.F10.F11.F12.F13.F14.F15.F16.F17.F18.F19.F20.F21.F22.F23.F24.F25.Fn.FnLock.PrintScreen.ScrollLock.Pause.BrowserBack.BrowserFavorites.BrowserForward.BrowserHome.BrowserRefresh.BrowserSearch.BrowserStop.Eject.LaunchApp1.LaunchApp2.LaunchMail.MediaPlayPause.MediaSelect.MediaStop.MediaTrackNext.MediaTrackPrevious.Power.Sleep.AudioVolumeDown.AudioVolumeMute.AudioVolumeUp.WakeUp.Copy.Cut.Paste`.split(`.`).map((e,t)=>[e,t]));function $1(e){return Q1.get(e)??0}var e0=new Map([[`!`,`1`],[`@`,`2`],[`#`,`3`],[`$`,`4`],[`%`,`5`],[`^`,`6`],[`&`,`7`],[`*`,`8`],[`(`,`9`],[`)`,`0`],[`~`,"`"],[`_`,`-`],[`+`,`=`],[`{`,`[`],[`}`,`]`],[`|`,`\\`],[`:`,`;`],[`"`,`'`],[`<`,`,`],[`>`,`.`],[`?`,`/`]]),t0;function n0(){return t0||(t0=globalThis.navigator?.keyboard?.getLayoutMap().catch(()=>void 0)??Promise.resolve(void 0),t0)}function r0(){return t0=void 0,n0()}function i0(e){return!e.shiftKey||e.ctrlKey||e.altKey||e.metaKey?0:+([...e.key].length===1)}function a0(e,t){if([...e.key].length!==1)return 0;let n=t?.get(e.code);if(n&&[...n].length===1)return n.codePointAt(0)??0;if(/^[A-Z]$/u.test(e.key))return e.key.charCodeAt(0)+32;if(e.shiftKey){let t=e0.get(e.key);if(t)return t.codePointAt(0)??0;let n=e.key.toLowerCase();return n!==e.key&&[...n].length===1?n.codePointAt(0)??0:0}return e.key.codePointAt(0)??0}var o0=new Map([[`Backquote`,"`"],[`Minus`,`-`],[`Equal`,`=`],[`BracketLeft`,`[`],[`BracketRight`,`]`],[`Backslash`,`\\`],[`Semicolon`,`;`],[`Quote`,`'`],[`Comma`,`,`],[`Period`,`.`],[`Slash`,`/`],[`Space`,` `]]),s0=[...`0123456789`].map(e=>[`Digit${e}`,e]),c0=new Map([...e0].map(e=>[e[1],e[0]]));function l0(e){return/^Key[A-Z]$/u.test(e)?e[3].toLowerCase():/^Digit[0-9]$/u.test(e)?e[5]:o0.get(e)}function u0(e){return[...o0,...s0].every(t=>t[0]===`Space`||e.get(t[0])===t[1])}function d0(e,t){let n=t?.get(e.code),r=n&&[...n].length===1?n:l0(e.code);if(r===void 0)return[...e.key].length===1?null:e.key;if(!e.shiftKey)return r;let i=r.toUpperCase();return i!==r&&[...i].length===1?i:t===void 0||!u0(t)?null:c0.get(r)??r}var f0=new TextEncoder,p0=new Map([[`[`,`\x1B`],[`m`,`\r`],[`i`,` `],[`@`,`\0`]]),m0=class{runtime=Z1();terminal;keyEncoderSlot;keyEncoder;keyEventSlot;keyEvent;mouseEncoderSlot;mouseEncoder;mouseEventSlot;mouseEvent;scratch;keyboardLayoutMap;constructor(e){let t=this.runtime;this.terminal=e,this.loadKeyboardLayout(n0()),this.keyEncoderSlot=t.allocOpaque(),t.check(`ghostty_key_encoder_new`,t.call(`ghostty_key_encoder_new`,0,this.keyEncoderSlot)),this.keyEncoder=t.readPointer(this.keyEncoderSlot),this.keyEventSlot=t.allocOpaque(),t.check(`ghostty_key_event_new`,t.call(`ghostty_key_event_new`,0,this.keyEventSlot)),this.keyEvent=t.readPointer(this.keyEventSlot),this.mouseEncoderSlot=t.allocOpaque(),t.check(`ghostty_mouse_encoder_new`,t.call(`ghostty_mouse_encoder_new`,0,this.mouseEncoderSlot)),this.mouseEncoder=t.readPointer(this.mouseEncoderSlot),this.mouseEventSlot=t.allocOpaque(),t.check(`ghostty_mouse_event_new`,t.call(`ghostty_mouse_event_new`,0,this.mouseEventSlot)),this.mouseEvent=t.readPointer(this.mouseEventSlot),this.scratch=t.alloc(1)}encodeKey(e,t=`press`,n=!1){let r=this.runtime,i=e.key.toLowerCase(),a=p0.get(i);if(a!==void 0&&t===`press`&&e.ctrlKey&&!e.altKey&&!e.metaKey&&!(e.shiftKey&&/^[a-z]$/u.test(i))&&!r.flag(`ghostty_terminal_get`,this.terminal,8))return a;let o=n?this.metaText(e):null,s=o??e.key;if(o!==null&&t===`press`&&!e.ctrlKey&&[...s].length===1&&(s.codePointAt(0)??0)>127&&r.flag(`ghostty_terminal_mode_get`,this.terminal,1036)&&this.isLegacyKeyboard())return`\x1b${s}`;r.call(`ghostty_key_encoder_setopt_from_terminal`,this.keyEncoder,this.terminal),r.call(`ghostty_key_event_set_action`,this.keyEvent,t===`release`?0:e.repeat?2:1),r.call(`ghostty_key_event_set_key`,this.keyEvent,$1(e.code));let c=+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)|(e.getModifierState(`CapsLock`)?16:0)|(e.getModifierState(`NumLock`)?32:0);r.call(`ghostty_key_event_set_mods`,this.keyEvent,c),r.call(`ghostty_key_event_set_consumed_mods`,this.keyEvent,i0(e)),r.call(`ghostty_key_event_set_composing`,this.keyEvent,+!!e.isComposing),r.call(`ghostty_key_event_set_unshifted_codepoint`,this.keyEvent,a0({code:e.code,key:s,shiftKey:e.shiftKey},this.keyboardLayoutMap));let l=f0.encode(s.length===1?s:``),u=l.length===0?0:r.alloc(l.length);u!==0&&r.bytes(u,l.length).set(l),r.call(`ghostty_key_event_set_utf8`,this.keyEvent,u,l.length);let d=r.encodeOutput((e,t,n)=>r.call(`ghostty_key_encoder_encode`,this.keyEncoder,this.keyEvent,e,t,n));return u!==0&&r.free(u,l.length),d}metaText(e){return d0(e,this.keyboardLayoutMap)}refreshKeyboardLayout(){this.loadKeyboardLayout(r0())}encodePaste(e){let t=this.runtime,n=f0.encode(e);if(n.length===0)return``;let r=t.alloc(n.length);t.bytes(r,n.length).set(n);let i=+!!t.flag(`ghostty_terminal_mode_get`,this.terminal,2004),a=t.encodeOutput((e,a,o)=>t.call(`ghostty_paste_encode`,r,n.length,i,e,a,o));return t.free(r,n.length),a}encodeMouse(e){let t=this.runtime;t.call(`ghostty_mouse_encoder_setopt_from_terminal`,this.mouseEncoder,this.terminal);let n=t.layout(`GhosttyMouseEncoderSize`),r=t.alloc(n.size);for(let i of[[`size`,n.size],[`screen_width`,e.screenWidth],[`screen_height`,e.screenHeight],[`cell_width`,e.cellWidth],[`cell_height`,e.cellHeight],[`padding_top`,0],[`padding_bottom`,0],[`padding_right`,0],[`padding_left`,0]])t.setField(r,`GhosttyMouseEncoderSize`,i[0],Math.max(0,Math.round(i[1])));t.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,2,r),t.free(r,n.size),t.bytes(this.scratch,1)[0]=+!!e.anyButtonPressed,t.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,3,this.scratch),t.bytes(this.scratch,1)[0]=1,t.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,4,this.scratch),t.call(`ghostty_mouse_event_set_action`,this.mouseEvent,{press:0,release:1,motion:2}[e.action]),e.button===null?t.call(`ghostty_mouse_event_clear_button`,this.mouseEvent):t.call(`ghostty_mouse_event_set_button`,this.mouseEvent,e.button),t.call(`ghostty_mouse_event_set_mods`,this.mouseEvent,e.mods);let i=t.layout(`GhosttyMousePosition`),a=t.alloc(i.size),o=t.view(a,i.size);return o.setFloat32(t.field(`GhosttyMousePosition`,`x`).offset,e.x,!0),o.setFloat32(t.field(`GhosttyMousePosition`,`y`).offset,e.y,!0),t.call(`ghostty_mouse_event_set_position`,this.mouseEvent,a),t.free(a,i.size),t.encodeOutput((e,n,r)=>t.call(`ghostty_mouse_encoder_encode`,this.mouseEncoder,this.mouseEvent,e,n,r))}dispose(){let e=this.runtime;e.call(`ghostty_mouse_event_free`,this.mouseEvent),e.call(`ghostty_mouse_encoder_free`,this.mouseEncoder),e.call(`ghostty_key_event_free`,this.keyEvent),e.call(`ghostty_key_encoder_free`,this.keyEncoder),e.free(this.scratch,1),e.freeOpaque(this.mouseEventSlot),e.freeOpaque(this.mouseEncoderSlot),e.freeOpaque(this.keyEventSlot),e.freeOpaque(this.keyEncoderSlot)}async loadKeyboardLayout(e){this.keyboardLayoutMap=await e}isLegacyKeyboard(){return this.encodeKey(new KeyboardEvent(`keydown`,{key:`Tab`,code:`Tab`,shiftKey:!0}))===`\x1B[Z`}},h0=26,g0=30,_0=1,v0={imageId:1,placementId:2,isVirtual:3,xOffset:4,yOffset:5,columns:10,rows:11,z:12},y0={width:3,height:4,format:5,data:7,length:8},b0={size:48,pixelWidth:4,pixelHeight:8,column:20,row:24,visible:28,sourceX:32,sourceY:36,sourceWidth:40,sourceHeight:44},x0=new Map([[0,3],[1,4],[3,2],[4,1]]),S0=new Map([773,781,782,784,786,829,830,831,838,842,843,844,848,849,850,855,859,867,868,869,870,871,872,873,874,875,876,877,878,879,1155,1156,1157,1158,1159,1426,1427,1428,1429,1431,1432,1433,1436,1437,1438,1439,1440,1441,1448,1449,1451,1452,1455,1476,1552,1553,1554,1555,1556,1557,1558,1559,1623,1624,1625,1626,1627,1629,1630,1750,1751,1752,1753,1754,1755,1756,1759,1760,1761,1762,1764,1767,1768,1771,1772,1840,1842,1843,1845,1846,1850,1853,1855,1856,1857,1859,1861,1863,1865,1866,2027,2028,2029,2030,2031,2032,2033,2035,2070,2071,2072,2073,2075,2076,2077,2078,2079,2080,2081,2082,2083,2085,2086,2087,2089,2090,2091,2092,2093,2385,2387,2388,3970,3971,3974,3975,4957,4958,4959,6109,6458,6679,6773,6774,6775,6776,6777,6778,6779,6780,7019,7021,7022,7023,7024,7025,7026,7027,7376,7377,7378,7386,7387,7392,7616,7617,7619,7620,7621,7622,7623,7624,7625,7627,7628,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7678,8400,8401,8404,8405,8406,8407,8411,8412,8417,8423,8425,8432,11503,11504,11505,11744,11745,11746,11747,11748,11749,11750,11751,11752,11753,11754,11755,11756,11757,11758,11759,11760,11761,11762,11763,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,42607,42620,42621,42736,42737,43232,43233,43234,43235,43236,43237,43238,43239,43240,43241,43242,43243,43244,43245,43246,43247,43248,43249,43696,43698,43699,43703,43704,43710,43711,43713,65056,65057,65058,65059,65060,65061,65062,68111,68152,119173,119174,119175,119176,119177,119210,119211,119212,119213,119362,119363,119364].map((e,t)=>[e,t]));function C0(e,t,n){let r=Array.from(e).slice(1,4).map(e=>S0.get(e.codePointAt(0)??0)??null),i=r[2]??null;return{imageId:t,placementId:n,row:r[0]??null,column:r[1]??null,imageIdHigh:i!==null&&i<256?i:null}}function w0(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n].cells,i=null;for(let e=0;e<r.length;e+=1){let a=r[e].placeholder;i!==null&&a!==null&&a.imageId===i.imageId&&a.placementId===i.placementId&&(a.row===null||a.row===i.row)&&(a.column===null||a.column===i.column+i.width)&&(a.imageIdHigh===null||a.imageIdHigh===i.imageIdHigh)?i.width+=1:(i!==null&&t.push(T0(i)),i=a===null?null:{x:e,y:n,imageId:a.imageId,imageIdHigh:a.imageIdHigh,placementId:a.placementId,row:a.row??0,column:a.column??0,width:1})}i!==null&&t.push(T0(i))}return t}function T0(e){return{x:e.x,y:e.y,imageId:e.imageId+(e.imageIdHigh??0)*2**24,placementId:e.placementId,row:e.row,column:e.column,width:e.width}}function E0(e,t,n,r){let i=t.columns===0?Math.ceil(n.width/r.width):t.columns,a=t.rows===0?Math.ceil(n.height/r.height):t.rows,o=i*r.width,s=a*r.height,c=n.width*s>n.height*o,l=c?o/Math.max(n.width,1):s/Math.max(n.height,1),u=c?0:(o-n.width*l)/2/l,d=c?(s-n.height*l)/2/l:0,f=n.width+u*2,p=n.height+d*2,m={x:f*e.column/i,y:p*e.row/a,width:f*e.width/i,height:p/a},h=0,g=0,_=e.width*r.width,v=r.height;if(m.y<d){let e=d-m.y;m.height-=e,g=e,v-=e*l,m.y=0,m.height>n.height&&(m.height=n.height,v=n.height*l)}else m.y+m.height>p-d?(m.y-=d,m.height=p-d-m.y-d,v=m.height*l):m.y-=d;if(m.x<u){let e=u-m.x;m.width-=e,h=e,_-=e*l,m.x=0,m.width>n.width&&(m.width=n.width,_=n.width*l)}else m.x+m.width>f-u?(m.x-=u,m.width=f-u-m.x-u,_=m.width*l):m.x-=u;if(m.width<=0||m.height<=0)return null;let y={xOffset:Math.round(h*l),yOffset:Math.round(g*l),width:Math.round(_),height:Math.round(v),source:{x:Math.round(m.x),y:Math.round(m.y),width:Math.round(m.width),height:Math.round(m.height)}};return y.width===0||y.height===0?null:y}function D0(e){let t=Z1(),n=t.alloc(16),r=t.call(`ghostty_terminal_get`,e,h0,n);return t.free(n,16),r===0}var O0=class{runtime=Z1();terminal;iteratorSlot;info;scratch;tail=[0,0];commands=0;cachedCommands=0;bitmaps=new Map;constructor(e){let t=this.runtime;this.terminal=e,this.iteratorSlot=t.allocOpaque(),t.check(`ghostty_kitty_graphics_placement_iterator_new`,t.call(`ghostty_kitty_graphics_placement_iterator_new`,0,this.iteratorSlot)),this.info=t.alloc(b0.size),this.scratch=t.alloc(16)}note(e){let t=[...this.tail,...e.subarray(0,2)],n=t.some((e,n)=>e===27&&t[n+1]===95&&t[n+2]===71),r=e.indexOf(27);for(;!n&&r!==-1;)n=e[r+1]===95&&e[r+2]===71,r=e.indexOf(27,r+1);n&&(this.commands+=1),this.tail=[...this.tail,...e.subarray(-2)].slice(-2)}images(e,t){this.commands!==this.cachedCommands&&(this.cachedCommands=this.commands,this.bitmaps.clear());let n=new Map,r=this.placements(e,t).map(e=>{let t=n.get(e.key)??this.bitmaps.get(e.key)??j0(e.image);return n.set(e.key,t),{placement:e,bitmap:t}});return this.bitmaps=n,r}dispose(){let e=this.runtime;e.call(`ghostty_kitty_graphics_placement_iterator_free`,e.readPointer(this.iteratorSlot)),e.free(this.info,b0.size),e.free(this.scratch,16),e.freeOpaque(this.iteratorSlot),this.bitmaps.clear()}placements(e,t){let n=this.runtime;n.check(`ghostty_terminal_get`,n.call(`ghostty_terminal_get`,this.terminal,g0,this.scratch));let r=n.readPointer(this.scratch);n.check(`ghostty_kitty_graphics_get`,n.call(`ghostty_kitty_graphics_get`,r,_0,this.iteratorSlot));let i=n.readPointer(this.iteratorSlot),a=[],o=[];for(;n.call(`ghostty_kitty_graphics_placement_next`,i);){let e=this.placementU32(i,v0.imageId);if(this.placementData(i,v0.isVirtual).getUint8(0)){o.push({imageId:e,placementId:this.placementU32(i,v0.placementId),columns:this.placementU32(i,v0.columns),rows:this.placementU32(i,v0.rows)});continue}let t=n.call(`ghostty_kitty_graphics_image`,r,e);if(t===0)throw Error(`kitty placement points to missing image ${e}`);n.bytes(this.info,b0.size).fill(0);let s=n.view(this.info,b0.size);s.setUint32(0,b0.size,!0),n.check(`ghostty_kitty_graphics_placement_render_info`,n.call(`ghostty_kitty_graphics_placement_render_info`,i,t,this.terminal,this.info)),s.getUint8(b0.visible)!==0&&a.push({...this.image(t,e),z:this.placementData(i,v0.z).getInt32(0,!0),column:s.getInt32(b0.column,!0),row:s.getInt32(b0.row,!0),xOffset:this.placementU32(i,v0.xOffset),yOffset:this.placementU32(i,v0.yOffset),width:s.getUint32(b0.pixelWidth,!0),height:s.getUint32(b0.pixelHeight,!0),source:{x:s.getUint32(b0.sourceX,!0),y:s.getUint32(b0.sourceY,!0),width:s.getUint32(b0.sourceWidth,!0),height:s.getUint32(b0.sourceHeight,!0)}})}if(o.length===0)return a;for(let i of w0(e)){let e=o.find(e=>e.imageId===i.imageId&&(i.placementId===0||e.placementId===i.placementId));if(e===void 0)continue;let s=n.call(`ghostty_kitty_graphics_image`,r,i.imageId);if(s===0)continue;let c=this.image(s,i.imageId),l=E0(i,e,c.image,t);l!==null&&a.push({...c,...l,z:-1,column:i.x,row:i.y})}return a}image(e,t){let n=this.imageData(e,y0.data),r=this.imageData(e,y0.length);return{key:`${t}:${n}:${r}`,image:{width:this.imageData(e,y0.width),height:this.imageData(e,y0.height),format:this.imageData(e,y0.format),pixels:this.runtime.bytes(n,r)}}}placementData(e,t){return this.runtime.bytes(this.scratch,4).fill(0),this.runtime.check(`ghostty_kitty_graphics_placement_get`,this.runtime.call(`ghostty_kitty_graphics_placement_get`,e,t,this.scratch)),this.runtime.view(this.scratch,4)}placementU32(e,t){return this.placementData(e,t).getUint32(0,!0)}imageData(e,t){return this.runtime.bytes(this.scratch,4).fill(0),this.runtime.check(`ghostty_kitty_graphics_image_get`,this.runtime.call(`ghostty_kitty_graphics_image_get`,e,t,this.scratch)),this.runtime.view(this.scratch,4).getUint32(0,!0)}};function k0(e,t,n,r,i){let a=r.width/i.width,o=r.height/i.height;for(let i of t){let t=i.placement;A0(t.z)===n&&e.drawImage(i.bitmap,t.source.x,t.source.y,t.source.width,t.source.height,t.column*r.width+t.xOffset*a,t.row*r.height+t.yOffset*o,t.width*a,t.height*o)}}function A0(e){return e<-1073741824?`belowBackground`:e<0?`belowText`:`aboveText`}function j0(e){let t=x0.get(e.format);if(t===void 0)throw Error(`unsupported kitty image format ${e.format}`);let n=e.width*e.height,r=e.pixels,i=new Uint8ClampedArray(n*4);if(t===4)i.set(r.subarray(0,n*4));else for(let e=0;e<n;e+=1){let n=e*t,a=e*4;t===3?i.set(r.subarray(n,n+3),a):i.fill(r[n],a,a+3),i[a+3]=t===2?r[n+1]:255}let a=new OffscreenCanvas(e.width,e.height),o=a.getContext(`2d`);if(!o)throw Error(`could not create a canvas for a kitty image`);return o.putImageData(new ImageData(i,e.width,e.height),0,0),a}var M0=8,N0=16,P0=0,F0=1,I0=2,L0=8,R0={cols:1,rows:2,dirty:3,rowIterator:4,background:5,foreground:6,cursor:7,cursorHasValue:8,cursorStyle:10,cursorVisible:11,cursorBlinking:12,cursorInViewport:14,cursorX:15,cursorY:16},z0={dirty:1,raw:2,cells:3},B0={raw:1,style:2,graphemesLength:3,graphemes:4,background:5,foreground:6,selected:7},V0={keys:0,values:20,graphemesLength:40,selected:44,background:48,foreground:52,written:56,size:60},H0={narrow:0,wide:1,spacerTail:2},U0={r:229,g:231,b:235},W0={r:0,g:0,b:0};function G0(e,t){return Math.floor((e*155+t*100)/255)}function K0(e,t){return{r:G0(e.r,t.r),g:G0(e.g,t.g),b:G0(e.b,t.b)}}function q0(e,t){let n=``;for(let r=0;r<t;r+=4096){let i=Math.min(4096,t-r),a=Array(i);for(let t=0;t<i;t+=1)a[t]=e.getUint32((r+t)*4,!0);n+=String.fromCodePoint(...a)}return n}function J0(e,t){return{text:``,wide:0,foreground:e,background:t,bold:!1,italic:!1,invisible:!1,strikethrough:!1,overline:!1,underline:0,underlineColor:null,selected:!1,placeholder:null}}function Y0(e,t){let n=e.dataView();return{r:n.getUint8(t),g:n.getUint8(t+1),b:n.getUint8(t+2)}}function X0(e,t){let n=e.alloc(768);e.call(`ghostty_terminal_get`,t,21,n);let r=e.bytes(n,768),i=Array.from({length:256},(e,t)=>({r:r[t*3],g:r[t*3+1],b:r[t*3+2]}));return e.free(n,768),i}function Z0(e,t){let n=[],r=[];return e.cells.forEach((e,i)=>{if(e.wide!==2)for(let a of(e.text||` `).split(``))n.push(a),r.push({x:i,y:t})}),{text:n.join(``),points:r}}var Q0=class{runtime=Z1();stateSlot;state;rowIteratorSlot;rowCellsSlot;scratch;style;cellQuery;graphemes=0;graphemeCapacity=0;rows=[];palette=[];constructor(){let e=this.runtime;this.stateSlot=e.allocOpaque(),e.check(`ghostty_render_state_new`,e.call(`ghostty_render_state_new`,0,this.stateSlot)),this.state=e.readPointer(this.stateSlot),this.rowIteratorSlot=e.allocOpaque(),e.check(`ghostty_render_state_row_iterator_new`,e.call(`ghostty_render_state_row_iterator_new`,0,this.rowIteratorSlot)),this.rowCellsSlot=e.allocOpaque(),e.check(`ghostty_render_state_row_cells_new`,e.call(`ghostty_render_state_row_cells_new`,0,this.rowCellsSlot)),this.scratch=e.alloc(16),this.style=e.alloc(e.layout(`GhosttyStyle`).size),this.cellQuery=e.alloc(V0.size);let t=e.dataView();[[B0.style,this.style],[B0.graphemesLength,this.cellQuery+V0.graphemesLength],[B0.selected,this.cellQuery+V0.selected],[B0.background,this.cellQuery+V0.background],[B0.foreground,this.cellQuery+V0.foreground]].forEach((e,n)=>{t.setUint32(this.cellQuery+V0.keys+n*4,e[0],!0),t.setUint32(this.cellQuery+V0.values+n*4,e[1],!0)})}snapshot(e,t){let n=this.runtime;n.check(`ghostty_render_state_update`,n.call(`ghostty_render_state_update`,this.state,e));let r=this.getRender(R0.cols,2),i=this.getRender(R0.rows,2),a=this.getRender(R0.dirty,4),o=this.getColor(R0.foreground,U0),s=this.getColor(R0.background,W0),c=this.getRender(R0.cursorHasValue,1)===0?o:this.getColor(R0.cursor,o),l=this.getRender(R0.cursorInViewport,1)!==0,u=this.getRender(R0.cursorVisible,1)!==0&&l;(this.rows.length!==i||this.rows.some(e=>e.cells.length!==r))&&(this.rows=Array.from({length:i},()=>({cells:Array.from({length:r},()=>J0(o,s)),isWrapContinuation:!1,wrapsToNext:!1})));let d=new Set;if(a!==0){this.palette=X0(n,e),n.check(`ghostty_render_state_get`,n.call(`ghostty_render_state_get`,this.state,R0.rowIterator,this.rowIteratorSlot));let c=n.readPointer(this.rowIteratorSlot),l=0;for(;l<i&&n.call(`ghostty_render_state_row_iterator_next`,c)!==0;)(a===2||this.getRowFlag(c,z0.dirty))&&(this.rows[l]=this.readRow(c,r,o,s,t),d.add(l),n.bytes(this.scratch,1)[0]=0,n.call(`ghostty_render_state_row_set`,c,0,this.scratch)),l+=1;n.view(this.scratch,4).setUint32(0,0,!0),n.call(`ghostty_render_state_set`,this.state,0,this.scratch)}return{cols:r,rows:i,foreground:o,background:s,cursor:c,cursorX:l?this.getRender(R0.cursorX,2):-1,cursorY:l?this.getRender(R0.cursorY,2):-1,cursorVisible:u,cursorBlinking:this.getRender(R0.cursorBlinking,1)!==0,cursorStyle:this.getRender(R0.cursorStyle,4),dirtyRows:d,rowData:this.rows}}invalidate(){this.rows=[]}dispose(){let e=this.runtime,t=e.readPointer(this.rowCellsSlot);t&&e.call(`ghostty_render_state_row_cells_free`,t);let n=e.readPointer(this.rowIteratorSlot);n&&e.call(`ghostty_render_state_row_iterator_free`,n),e.call(`ghostty_render_state_free`,this.state),e.free(this.style,e.layout(`GhosttyStyle`).size),e.free(this.cellQuery,V0.size),e.free(this.scratch,16),e.free(this.graphemes,this.graphemeCapacity),e.freeOpaque(this.rowCellsSlot),e.freeOpaque(this.rowIteratorSlot),e.freeOpaque(this.stateSlot)}readRow(e,t,n,r,i){let a=this.runtime;a.check(`ghostty_render_state_row_get`,a.call(`ghostty_render_state_row_get`,e,z0.raw,this.scratch));let o=a.view(this.scratch,8).getBigUint64(0,!0);a.bytes(this.scratch+8,1)[0]=0,a.call(`ghostty_row_get`,o,2,this.scratch+8);let s=a.bytes(this.scratch+8,1)[0]!==0;a.bytes(this.scratch+8,1)[0]=0,a.call(`ghostty_row_get`,o,1,this.scratch+8);let c=a.bytes(this.scratch+8,1)[0]!==0;a.check(`ghostty_render_state_row_get`,a.call(`ghostty_render_state_row_get`,e,z0.cells,this.rowCellsSlot));let l=a.readPointer(this.rowCellsSlot),u=a.layout(`GhosttyStyle`),d=u.size,f=u.fields,p=[];for(;p.length<t&&a.call(`ghostty_render_state_row_cells_next`,l)!==0;){a.bytes(this.style,d).fill(0),a.setField(this.style,`GhosttyStyle`,`size`,d);let e=a.call(`ghostty_render_state_row_cells_get_multi`,l,5,this.cellQuery+V0.keys,this.cellQuery+V0.values,this.cellQuery+V0.written),t=a.dataView(),o=t.getUint32(this.cellQuery+V0.written,!0);o<3&&a.check(`ghostty_render_state_row_cells_get_multi`,e);let s=t.getUint32(this.cellQuery+V0.graphemesLength,!0),c=t.getUint8(this.cellQuery+V0.selected)!==0,u=o>=4?Y0(a,this.cellQuery+V0.background):r,m=o===5?Y0(a,this.cellQuery+V0.foreground):o===3?this.getCellColor(l,n):n,h=``;if(s>0){let e=s*4;if(e>this.graphemeCapacity){let t=Math.max(e,this.graphemeCapacity*2),n=a.alloc(t);a.free(this.graphemes,this.graphemeCapacity),this.graphemes=n,this.graphemeCapacity=t}a.call(`ghostty_render_state_row_cells_get`,l,B0.graphemes,this.graphemes)===0&&(h=q0(a.view(this.graphemes,e),s))}let g=0;if(h.length===0&&p.at(-1)?.text.length){a.call(`ghostty_render_state_row_cells_get`,l,B0.raw,this.scratch);let e=a.view(this.scratch,8).getBigUint64(0,!0);a.view(this.scratch+8,4).setUint32(0,0,!0),a.call(`ghostty_cell_get`,e,3,this.scratch+8),g=a.view(this.scratch+8,4).getUint32(0,!0)}let _=a.dataView(),v=e=>_.getUint8(this.style+f[e].offset)!==0,y=v(`bold`);if(i&&y&&_.getUint32(this.style+M0,!0)===F0){let e=_.getUint8(this.style+N0);e<8&&(m=this.palette[e+8]??m)}if(v(`inverse`)){let e=m;m=u,u=e}v(`faint`)&&(m=K0(m,u));let b=this.style+f.underline_color.offset,x=_.getUint32(b,!0),S=b+L0,C=null;h.codePointAt(0)===1109742&&(C=C0(h,this.colorId(this.style+M0),this.colorId(b)),h=``),p.push({text:h,wide:g,foreground:m,background:u,bold:y,italic:v(`italic`),invisible:v(`invisible`),strikethrough:v(`strikethrough`),overline:v(`overline`),underline:_.getInt32(this.style+f.underline.offset,!0),underlineColor:x===F0?this.palette[_.getUint8(S)]:x===I0?Y0(a,S):null,selected:c,placeholder:C})}for(;p.length<t;)p.push(J0(n,r));return{cells:p,isWrapContinuation:s,wrapsToNext:c}}getRender(e,t){this.runtime.bytes(this.scratch,4).fill(0),this.runtime.check(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.state,e,this.scratch));let n=this.runtime.view(this.scratch,4);return t===1?n.getUint8(0):t===2?n.getUint16(0,!0):n.getUint32(0,!0)}getColor(e,t){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_get`,this.state,e,this.scratch)===0?Y0(this.runtime,this.scratch):t}getRowFlag(e,t){return this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_render_state_row_get`,e,t,this.scratch)===0&&this.runtime.bytes(this.scratch,1)[0]!==0}getCellColor(e,t){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_row_cells_get`,e,B0.foreground,this.scratch)===0?Y0(this.runtime,this.scratch):t}colorId(e){let t=this.runtime.dataView(),n=t.getUint32(e,!0);if(n===P0)return 0;if(n===F0)return t.getUint8(e+L0);if(n===I0){let t=Y0(this.runtime,e+L0);return t.r<<16|t.g<<8|t.b}throw Error(`unknown style color tag ${n}`)}},$0=16,e2=589824,t2=381888,n2=5e7,r2=new TextDecoder;function i2(e){let t=[...e],n=[0,95,135,175,215,255];for(let e=16;e<232;e+=1){let r=e-16;t.push({r:n[Math.floor(r/36)],g:n[Math.floor(r/6)%6],b:n[r%6]})}for(let e=0;e<24;e+=1){let n=8+e*10;t.push({r:n,g:n,b:n})}return t}var a2=class{encoder;kitty;runtime=Z1();terminalSlot;terminal;renderState;formatterSlot;formatter;scratch;point;scrollbar;host;hostId=0;sizeReport;disposed=!1;boldIsBright=!1;version=``;constructor(e,t,n,r,i){let a=this.runtime,o=a.layout(`GhosttyTerminalOptions`).size,s=a.alloc(o);a.setField(s,`GhosttyTerminalOptions`,`cols`,e),a.setField(s,`GhosttyTerminalOptions`,`rows`,t);let c=Math.floor(t2/(8*(e+1)));a.setField(s,`GhosttyTerminalOptions`,`max_scrollback`,n===0?0:Math.min((Math.ceil(n/c)+1)*e2,n2)),this.terminalSlot=a.allocOpaque();let l=a.call(`ghostty_terminal_new`,0,this.terminalSlot,s);if(a.free(s,o),a.check(`ghostty_terminal_new`,l),this.terminal=a.readPointer(this.terminalSlot),!D0(this.terminal))throw a.call(`ghostty_terminal_free`,this.terminal),a.freeOpaque(this.terminalSlot),Error(`libghostty-vt was built without kitty graphics, build it with scripts/build-ghostty-wasm.mts`);this.sizeReport={rows:t,columns:e,cellWidth:1,cellHeight:1},this.host={write:r,size:()=>this.sizeReport,bell:i,version:()=>this.version},this.hostId=a.attachHost(this.terminal,this.host),this.renderState=new Q0,this.encoder=new m0(this.terminal),this.kitty=new O0(this.terminal);let u=`GhosttyFormatterTerminalOptions`,d=a.layout(u),f=a.alloc(d.size),p=a.field(u,`extra`),m=a.field(`GhosttyFormatterTerminalExtra`,`screen`);a.setField(f,u,`size`,d.size),a.setField(f,u,`trim`,1),a.setField(f+p.offset,`GhosttyFormatterTerminalExtra`,`size`,p.size),a.setField(f+p.offset+m.offset,`GhosttyFormatterScreenExtra`,`size`,m.size),this.formatterSlot=a.allocOpaque();let h=a.call(`ghostty_formatter_terminal_new`,0,this.formatterSlot,this.terminal,f);a.free(f,d.size),a.check(`ghostty_formatter_terminal_new`,h),this.formatter=a.readPointer(this.formatterSlot),this.scratch=a.alloc(16),this.point=a.alloc(a.layout(`GhosttyPoint`).size),this.scrollbar=a.alloc(a.layout(`GhosttyTerminalScrollbar`).size)}write(e){if(e.length===0)return;this.kitty.note(e);let t=this.runtime.alloc(e.length);this.runtime.bytes(t,e.length).set(e),this.runtime.call(`ghostty_terminal_vt_write`,this.terminal,t,e.length),this.runtime.free(t,e.length)}setReplies(e){e&&this.hostId===0?this.hostId=this.runtime.attachHost(this.terminal,this.host):!e&&this.hostId!==0&&(this.runtime.detachHost(this.terminal,this.hostId),this.hostId=0)}reset(){this.runtime.call(`ghostty_terminal_reset`,this.terminal),this.renderState.invalidate()}resize(e,t,n,r,i){this.sizeReport={rows:t,columns:e,cellWidth:Math.max(1,Math.round(n*i)),cellHeight:Math.max(1,Math.round(r*i))},this.runtime.check(`ghostty_terminal_resize`,this.runtime.call(`ghostty_terminal_resize`,this.terminal,Math.max(1,Math.min(65535,e)),Math.max(1,Math.min(65535,t)),this.sizeReport.cellWidth,this.sizeReport.cellHeight))}setColors(e){let t=this.runtime.alloc(3);for(let n of[[11,e.foreground],[12,e.background],[13,e.cursor]]){let e=n[1];this.runtime.bytes(t,3).set([e.r,e.g,e.b]),this.runtime.call(`ghostty_terminal_set`,this.terminal,n[0],t)}this.runtime.free(t,3);let n=i2(e.palette),r=this.runtime.alloc(n.length*3);this.runtime.bytes(r,n.length*3).set(n.flatMap(e=>[e.r,e.g,e.b])),this.runtime.call(`ghostty_terminal_set`,this.terminal,14,r),this.runtime.free(r,n.length*3),this.renderState.invalidate()}setCursor(e,t){let n={bar:0,block:1,underline:2}[e];this.runtime.view(this.scratch,4).setUint32(0,n,!0),this.runtime.call(`ghostty_terminal_set`,this.terminal,22,this.scratch),this.runtime.bytes(this.scratch,1)[0]=+!!t,this.runtime.call(`ghostty_terminal_set`,this.terminal,23,this.scratch)}title(){if(this.runtime.bytes(this.scratch,8).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,12,this.scratch)!==0)return``;let e=this.runtime.view(this.scratch,8),t=e.getUint32(0,!0),n=e.getUint32(4,!0);return n===0?``:r2.decode(this.runtime.bytes(t,n))}screenText(){let e=this.runtime.alloc(8),t=this.runtime.call(`ghostty_formatter_format_alloc`,this.formatter,0,e,e+4),n=this.runtime.view(e,8),r=n.getUint32(0,!0),i=n.getUint32(4,!0);if(this.runtime.free(e,8),t!==0)return``;let a=r2.decode(this.runtime.bytes(r,i));return this.runtime.call(`ghostty_free`,0,r,i),a}scroll(e){let t=this.runtime.layout(`GhosttyTerminalScrollViewport`),n=this.runtime.alloc(t.size);this.runtime.setField(n,`GhosttyTerminalScrollViewport`,`tag`,2);let r=this.runtime.field(`GhosttyTerminalScrollViewport`,`value`);this.runtime.view(n+r.offset,r.size).setInt32(0,e,!0),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,n),this.runtime.free(n,t.size)}scrollToBottom(){let e=this.runtime.layout(`GhosttyTerminalScrollViewport`),t=this.runtime.alloc(e.size);this.runtime.setField(t,`GhosttyTerminalScrollViewport`,`tag`,1),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,t),this.runtime.free(t,e.size)}scrollbarState(){let e=this.runtime.layout(`GhosttyTerminalScrollbar`);return this.runtime.bytes(this.scrollbar,e.size).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,9,this.scrollbar)===0?{total:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`total`),offset:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`offset`),len:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`len`)}:null}isMouseTracking(){return this.flag(`ghostty_terminal_get`,11)}isMouseAnyEventTracking(){return this.flag(`ghostty_terminal_mode_get`,1003)}isFocusReporting(){return this.flag(`ghostty_terminal_mode_get`,1004)}isSynchronizedOutput(){return this.flag(`ghostty_terminal_mode_get`,2026)}endSynchronizedOutput(){this.runtime.check(`ghostty_terminal_mode_set`,this.runtime.call(`ghostty_terminal_mode_set`,this.terminal,2026,0))}currentColors(){return{foreground:this.terminalColor(18),background:this.terminalColor(19),cursor:this.terminalColor(20),palette:X0(this.runtime,this.terminal)}}isApplicationCursorKeys(){return this.flag(`ghostty_terminal_mode_get`,1)}isKittyKeyboard(){return this.flag(`ghostty_terminal_get`,8)}isAlternateScreen(){return this.runtime.dataView().setUint32(this.scratch,0,!0),this.runtime.call(`ghostty_terminal_get`,this.terminal,6,this.scratch)===0&&this.runtime.dataView().getUint32(this.scratch,!0)===1}setSelection(e,t){let n=this.runtime.layout(`GhosttyGridRef`).size,r=this.gridRef(e.x,e.y,2);try{let e=this.gridRef(t.x,t.y,2),i=this.runtime.layout(`GhosttySelection`),a=this.runtime.alloc(i.size);this.runtime.setField(a,`GhosttySelection`,`size`,i.size);let o=this.runtime.field(`GhosttySelection`,`start`),s=this.runtime.field(`GhosttySelection`,`end`);this.runtime.bytes(a+o.offset,o.size).set(this.runtime.bytes(r,o.size)),this.runtime.bytes(a+s.offset,s.size).set(this.runtime.bytes(e,s.size)),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,a),this.runtime.free(e,n),this.runtime.free(a,i.size)}finally{this.runtime.free(r,n)}}selectWord(e){return this.selectAt(`GhosttyTerminalSelectWordOptions`,`ghostty_terminal_select_word`,e)}selectLine(e){return this.selectAt(`GhosttyTerminalSelectLineOptions`,`ghostty_terminal_select_line`,e)}clearSelection(){this.runtime.call(`ghostty_terminal_set`,this.terminal,21,0)}selectionText(){let e=this.runtime.alloc($0),t=this.runtime.view(e,$0);t.setUint32(0,$0,!0),t.setUint8(8,1),t.setUint8(9,1);let n=this.runtime.encodeOutput((t,n,r)=>this.runtime.call(`ghostty_terminal_selection_format_buf`,this.terminal,e,t,n,r));return this.runtime.free(e,$0),n}hyperlinkAt(e,t){let n=this.gridRef(e,t,1),r=this.hyperlinkOf(n);return this.runtime.free(n,this.runtime.layout(`GhosttyGridRef`).size),r}toScreen(e){let t=this.gridRef(e.x,e.y,1),n=this.pointFromGridRef(t,2);return this.runtime.free(t,this.runtime.layout(`GhosttyGridRef`).size),n}trackCursor(){let e=this.runtime.allocOpaque(),t=this.runtime.call(`ghostty_terminal_grid_ref_track`,this.terminal,this.cursorPoint(),e),n=this.runtime.readPointer(e);return this.runtime.freeOpaque(e),this.runtime.check(`ghostty_terminal_grid_ref_track`,t),n}retrack(e){let t=this.runtime.call(`ghostty_tracked_grid_ref_set`,e,this.terminal,this.cursorPoint());this.runtime.check(`ghostty_tracked_grid_ref_set`,t)}trackedPoint(e){return this.runtime.call(`ghostty_tracked_grid_ref_point`,e,2,this.scratch)===0?{x:this.runtime.readField(this.scratch,`GhosttyPointCoordinate`,`x`),y:this.runtime.readField(this.scratch,`GhosttyPointCoordinate`,`y`)}:null}trackedHyperlink(e){let t=this.runtime.layout(`GhosttyGridRef`).size,n=this.runtime.alloc(t);this.runtime.setField(n,`GhosttyGridRef`,`size`,t);let r=this.runtime.call(`ghostty_tracked_grid_ref_snapshot`,e,n)===0?this.hyperlinkOf(n):null;return this.runtime.free(n,t),r}untrack(e){this.runtime.call(`ghostty_tracked_grid_ref_free`,e)}snapshot(){return this.renderState.snapshot(this.terminal,this.boldIsBright)}invalidate(){this.renderState.invalidate()}cellSize(){return{width:this.sizeReport.cellWidth,height:this.sizeReport.cellHeight}}dispose(){if(this.disposed)return;this.disposed=!0;let e=this.runtime;e.call(`ghostty_formatter_free`,this.formatter),this.encoder.dispose(),this.kitty.dispose(),this.renderState.dispose(),this.hostId!==0&&e.detachHost(this.terminal,this.hostId),e.call(`ghostty_terminal_free`,this.terminal),e.free(this.scrollbar,e.layout(`GhosttyTerminalScrollbar`).size),e.free(this.scratch,16),e.free(this.point,e.layout(`GhosttyPoint`).size),e.freeOpaque(this.formatterSlot),e.freeOpaque(this.terminalSlot)}hyperlinkOf(e){let t=this.runtime.encodeOutput((t,n,r)=>this.runtime.call(`ghostty_grid_ref_hyperlink_uri`,e,t,n,r));return t===``?null:t}cursorPosition(){this.runtime.dataView().setUint32(this.scratch,0,!0),this.runtime.call(`ghostty_terminal_get`,this.terminal,3,this.scratch),this.runtime.call(`ghostty_terminal_get`,this.terminal,4,this.scratch+2);let e=this.runtime.dataView();return{x:e.getUint16(this.scratch,!0),y:e.getUint16(this.scratch+2,!0)}}cursorPoint(){let e=this.cursorPosition();return this.fillPoint(this.point,e.x,e.y,0),this.point}fillPoint(e,t,n,r){this.runtime.setField(e,`GhosttyPoint`,`tag`,r);let i=this.runtime.field(`GhosttyPoint`,`value`),a=this.runtime.dataView();a.setUint16(e+i.offset,Math.max(0,t),!0),a.setUint32(e+i.offset+4,Math.max(0,n),!0)}gridRef(e,t,n){let r=this.runtime.alloc(this.runtime.layout(`GhosttyPoint`).size);this.fillPoint(r,e,t,n);let i=this.runtime.layout(`GhosttyGridRef`).size,a=this.runtime.alloc(i);this.runtime.setField(a,`GhosttyGridRef`,`size`,i);let o=this.runtime.call(`ghostty_terminal_grid_ref`,this.terminal,r,a);return this.runtime.free(r,this.runtime.layout(`GhosttyPoint`).size),o!==0&&(this.runtime.free(a,i),this.runtime.check(`ghostty_terminal_grid_ref`,o)),a}selectAt(e,t,n){let r=this.gridRef(n.x,n.y,2),i=this.runtime.layout(e),a=this.runtime.layout(`GhosttySelection`),o=this.runtime.alloc(i.size),s=this.runtime.alloc(a.size);this.runtime.setField(o,e,`size`,i.size);let c=this.runtime.field(e,`ref`);this.runtime.bytes(o+c.offset,c.size).set(this.runtime.bytes(r,c.size)),this.runtime.setField(s,`GhosttySelection`,`size`,a.size);let l=null;if(this.runtime.call(t,this.terminal,o,s)===0){let e=this.pointFromGridRef(s+this.runtime.field(`GhosttySelection`,`start`).offset,2),t=this.pointFromGridRef(s+this.runtime.field(`GhosttySelection`,`end`).offset,2);e&&t&&(l={start:e,end:t})}return this.runtime.free(s,a.size),this.runtime.free(r,this.runtime.layout(`GhosttyGridRef`).size),this.runtime.free(o,i.size),l}pointFromGridRef(e,t){let n=this.runtime.layout(`GhosttyPointCoordinate`),r=this.runtime.alloc(n.size),i=this.runtime.call(`ghostty_terminal_point_from_grid_ref`,this.terminal,e,t,r)===0?{x:this.runtime.readField(r,`GhosttyPointCoordinate`,`x`),y:this.runtime.readField(r,`GhosttyPointCoordinate`,`y`)}:null;return this.runtime.free(r,n.size),i}flag(e,t){return this.runtime.flag(e,this.terminal,t)}terminalColor(e){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.check(`ghostty_terminal_get`,this.runtime.call(`ghostty_terminal_get`,this.terminal,e,this.scratch)),Y0(this.runtime,this.scratch)}};function o2(e,t){let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=r.indexOf(i);for(;a!==-1;)n.push(a),a=r.indexOf(i,a+i.length);return n}var s2=class{core;redraw;listeners=new Set;query=``;matches=[];activeMatch=-1;stale=!1;timer=null;constructor(e,t){this.core=e,this.redraw=t}find(e,t,n,r){let i=this.matches[this.activeMatch]??null;if(this.query=e,this.refresh(),this.matches.length===0)this.activeMatch=-1;else if(n||i===null){let e=i?.row??r,t=this.matches.findIndex(t=>t.row>=e);this.activeMatch=t===-1?this.matches.length-1:t}else{let e=this.matches.findIndex(e=>e.row===i.row&&e.index===i.index),n=e===-1?0:e,r=t?-1:1;this.activeMatch=(n+r+this.matches.length)%this.matches.length}return this.emit(),this.matches[this.activeMatch]??null}onResults(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}clear(){this.query=``,this.matches=[],this.activeMatch=-1}outputChanged(){this.query!==``&&(this.stale=!0,this.timer===null&&(this.timer=window.setTimeout(()=>{if(this.timer=null,!this.stale||this.query===``)return;let e=this.matches[this.activeMatch];this.refresh();let t=e?this.matches.findIndex(t=>t.row===e.row&&t.index===e.index):-1;this.activeMatch=t===-1?this.matches.length-1:t,this.emit(),this.redraw()},200)))}highlights(e,t){if(this.query===``)return[];let n=this.matches[this.activeMatch],r=[];return e.rowData.forEach((e,i)=>{let a=Z0(e,i);o2(a.text,this.query).forEach((e,o)=>{let s=a.points[e],c=a.points[e+this.query.length-1];s&&c&&r.push({row:i,start:s.x,end:c.x+1,active:n?.row===t+i&&n.index===o})})}),r}dispose(){this.timer!==null&&window.clearTimeout(this.timer),this.timer=null}refresh(){this.stale=!1,this.matches=[],this.query!==``&&this.core.screenText().split(`
107
- `).forEach((e,t)=>{o2(e,this.query).forEach((e,n)=>this.matches.push({row:t,index:n}))})}emit(){let e={resultIndex:this.activeMatch,resultCount:this.matches.length};for(let t of this.listeners)t(e)}},c2=new TextDecoder;function l2(e){function t(e){return e.toString(16).padStart(2,`0`).repeat(2)}return`rgb:${t(e.r)}/${t(e.g)}/${t(e.b)}`}function u2(e){return Math.min(Math.max(e,0),100)}function d2(e){return c2.decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}function f2(e){return e===``?`s0`:[...e].filter(e=>`cpqs01234567`.includes(e)).join(``)}function p2(e){try{return d2(e)}catch(e){return console.warn(`invalid clipboard sequence`,e),null}}function m2(e,t,n){let r=Array.from(new TextEncoder().encode(e),e=>String.fromCharCode(e)).join(``);return`\x1b]52;${t};${btoa(r)}${n}`}function h2(e,t,n){let r=e===`10;?`?t.foreground:e===`11;?`?t.background:t.cursor;return`\x1b]${e.slice(0,2)};${l2(r)}${n}`}function g2(e,t,n){let r=e.split(`;`),i=[];for(let e=1;e+1<r.length;e+=2){if(r[e+1]!==`?`||!/^\d+$/.test(r[e]))continue;let a=t[Number(r[e])];a!==void 0&&i.push(`\x1b]4;${r[e]};${l2(a)}${n}`)}return i}function _2(e,t){let n=e.split(`;`);if(n.length>4)return null;let r=n[2]===void 0||n[2]===``?0:Number(n[2]),i=n[3]===void 0||n[3]===``?-1:Number(n[3]);return!Number.isInteger(r)||!Number.isInteger(i)?null:r===0?{state:r,value:0}:r===1?i<0?null:{state:r,value:u2(i)}:r===2||r===4?i<0?{state:r,value:t.value}:{state:r,value:u2(i||t.value)}:r===3?{state:r,value:t.value}:null}function v2(e,t){if(e.startsWith(`9;`)&&!/^9;\d+(;|$)/.test(e))return{title:``,body:c2.decode(t.subarray(2))};if(e.startsWith(`777;notify;`)){let e=c2.decode(t).split(`;`);return{title:e[2]??``,body:e.slice(3).join(`;`)}}return null}var y2=class{pending={id:``,title:``,body:``};add(e){let t=e.indexOf(`;`,3);if(t===-1)return null;let n=new Map;for(let r of e.slice(3,t).split(`:`)){let e=r.indexOf(`=`);e!==-1&&n.set(r.slice(0,e),r.slice(e+1))}let r=n.get(`p`)??`title`;if(r===`?`||r===`close`||r===`alive`)return null;let i=e.slice(t+1);if(n.get(`e`)===`1`)try{i=d2(i)}catch(e){return console.warn(`invalid notification sequence`,e),null}let a=n.get(`i`)??``;if(a!==this.pending.id&&(this.pending={id:a,title:``,body:``}),r===`title`&&(this.pending.title+=i),r===`body`&&(this.pending.body+=i),n.get(`d`)===`0`)return null;let o=this.pending;return this.pending={id:``,title:``,body:``},o.title===``&&o.body===``?null:{title:o.title,body:o.body}}},b2=27,x2=7,S2=24,C2=26,w2=33554432,T2=class{state=`ground`;params=``;collecting=!1;chunks=[];size=0;reset(){this.state=`ground`,this.drop()}scan(e,t){let n=0;for(let r=0;r<e.length;r+=1){let i=e[r];if(i===S2||i===C2)this.state=`ground`,this.drop();else if(this.state===`ground`)i===b2&&(this.state=`escape`);else if(this.state===`escape`){if(this.params=``,i===93){this.state=`osc`,this.begin(),n=r+1;continue}if(i===80){this.state=`dcsHeader`;continue}this.state=i===b2?`escape`:`ground`}else if(this.state===`osc`){if(i===x2){if(this.state=`ground`,this.append(e,n,r),t({type:`osc`,data:this.take(),terminator:`\x07`},r+1))return r+1;continue}i===b2&&(this.state=`oscEscape`,this.append(e,n,r))}else if(this.state===`oscEscape`){if(i===92){if(this.state=`ground`,t({type:`osc`,data:this.take(),terminator:`\x1B\\`},r+1))return r+1;continue}this.drop(),this.state=`escape`,--r}else if(this.state===`dcsHeader`){if(i===b2){this.state=`dcsEscape`;continue}if(i>=32&&i<=63){this.params.length<16&&(this.params+=String.fromCharCode(i));continue}this.state=`dcs`,i===113&&/^[0-9;]*$/.test(this.params)&&(this.begin(),n=r+1)}else if(this.state===`dcs`)i===b2&&(this.state=`dcsEscape`,this.append(e,n,r));else if(i===92){if(this.state=`ground`,this.collecting&&t({type:`sixel`,data:this.take()},r+1))return r+1}else this.drop(),this.state=`escape`,--r}return(this.state===`osc`||this.state===`dcs`)&&this.append(e,n,e.length),e.length}begin(){this.collecting=!0,this.chunks=[],this.size=0}append(e,t,n){!this.collecting||n<=t||(this.size+n-t>w2?this.drop():(this.chunks.push(e.slice(t,n)),this.size+=n-t))}take(){let e=new Uint8Array(this.size),t=0;for(let n of this.chunks)e.set(n,t),t+=n.length;return this.drop(),e}drop(){this.collecting=!1,this.chunks=[],this.size=0}},E2=`0101.0202.1010.2020.........0110.0210.0120.0220.0011.0012.0021.0022.1100.1200.2100.2200.1001.1002.2001.2002.1110.1210.2110.1120.2120.2210.1220.2220.1011.1012.2011.1021.2021.2012.1022.2022.0111.0112.0211.0212.0121.0122.0221.0222.1101.1102.1201.1202.2101.2102.2201.2202.1111.1112.1211.1212.2111.1121.2121.2112.2211.1122.1221.2212.1222.2122.2221.2222`.split(`.`),D2=[`0001`,`1000`,`0100`,`0010`,`0002`,`2000`,`0200`,`0020`,`0201`,`1020`,`0102`,`2010`],O2=`0303.3030.0310.0130.0330.0013.0031.0033.1300.3100.3300.1003.3001.3003.1310.3130.3330.1013.3031.3033.0313.0131.0333.1303.3101.3303.1313.3131.3333`.split(`.`),k2=[0,0,4,4],A2=[4,0,4,4],j2=[0,4,4,4],M2=[4,4,4,4],N2=[[[0,0,8,4]],[[0,7,8,1]],[[0,6,8,2]],[[0,5,8,3]],[[0,4,8,4]],[[0,3,8,5]],[[0,2,8,6]],[[0,1,8,7]],[[0,0,8,8]],[[0,0,7,8]],[[0,0,6,8]],[[0,0,5,8]],[[0,0,4,8]],[[0,0,3,8]],[[0,0,2,8]],[[0,0,1,8]],[[4,0,4,8]],[],[],[],[[0,0,8,1]],[[7,0,1,8]],[j2],[M2],[k2],[k2,j2,M2],[k2,M2],[k2,A2,j2],[k2,A2,M2],[A2],[A2,j2],[A2,j2,M2]],P2={9617:.25,9618:.5,9619:.75},F2={9581:[1,1],9582:[-1,1],9583:[-1,-1],9584:[1,-1]};function I2(e){return e>=9472&&e<=9547?E2[e-9472]:e>=9552&&e<=9580?O2[e-9552]:e>=9588&&e<=9599?D2[e-9588]:``}function L2(e){if(e.length!==1)return!1;let t=e.charCodeAt(0);return I2(t)!==``||F2[t]!==void 0||t>=9600&&t<=9631}function R2(e){return Math.max(1,Math.round(e.height/20))}function z2(e,t,n){let[r,i,a,o]=t,s=R2(n),c=s*2,l=Math.floor(Math.max(0,n.height-s)/2),u=l+s,d=Math.floor(Math.max(0,n.height-c)/2),f=d+c,p=Math.max(0,l-s),m=u+s,h=Math.floor(Math.max(0,n.width-s)/2),g=h+s,_=Math.floor(Math.max(0,n.width-c)/2),v=_+c,y=Math.max(0,h-s),b=g+s;function x(t,r,i,a){e.fillRect(n.left+t,n.top+r,i-t,a-r)}let S=o===`2`||i===`2`?f:o!==i||a===r?o===`3`||i===`3`?m:u:o===`0`&&i===`0`?u:l,C=o===`2`||i===`2`?d:o!==i||r===a?o===`3`||i===`3`?p:l:o===`0`&&i===`0`?l:u,w=r===`2`||a===`2`?v:r!==a||o===i?r===`3`||a===`3`?b:g:r===`0`&&a===`0`?g:h,T=r===`2`||a===`2`?_:r!==a||i===o?r===`3`||a===`3`?y:h:r===`0`&&a===`0`?h:g;r===`1`&&x(h,0,g,S),r===`2`&&x(_,0,v,S),r===`3`&&(x(y,0,h,o===`3`?l:S),x(g,0,b,i===`3`?l:S)),i===`1`&&x(T,l,n.width,u),i===`2`&&x(T,d,n.width,f),i===`3`&&(x(r===`3`?g:T,p,n.width,l),x(a===`3`?g:T,u,n.width,m)),a===`1`&&x(h,C,g,n.height),a===`2`&&x(_,C,v,n.height),a===`3`&&(x(y,o===`3`?u:C,h,n.height),x(g,i===`3`?u:C,b,n.height)),o===`1`&&x(0,l,w,u),o===`2`&&x(0,d,w,f),o===`3`&&(x(0,p,r===`3`?h:w,l),x(0,u,a===`3`?h:w,m))}function B2(e,[t,n],r){let i=R2(r),a=r.left+Math.floor(Math.max(0,r.width-i)/2)+i/2,o=r.top+Math.floor(Math.max(0,r.height-i)/2)+i/2,s=t===1?r.left+r.width:r.left,c=n===1?r.top+r.height:r.top,l=Math.min(r.width,r.height)/2;e.save(),e.strokeStyle=e.fillStyle,e.lineWidth=i,e.beginPath(),e.moveTo(a,c),e.arcTo(a,o,s,o,l),e.lineTo(s,o),e.stroke(),e.restore()}function V2(e,t,n,r){e.save(),e.setTransform(1,0,0,1,0,0),H2(e,t.charCodeAt(0),{left:Math.round(n.left*r),top:Math.round(n.top*r),width:Math.round((n.left+n.width)*r)-Math.round(n.left*r),height:Math.round((n.top+n.height)*r)-Math.round(n.top*r)}),e.restore()}function H2(e,t,n){let r=I2(t);if(r!==``){z2(e,r,n);return}let i=F2[t];if(i!==void 0){B2(e,i,n);return}let a=P2[t];if(a!==void 0)e.globalAlpha=a,e.fillRect(n.left,n.top,n.width,n.height);else for(let[r,i,a,o]of N2[t-9600]){let t=n.left+Math.round(n.width*r/8),s=n.top+Math.round(n.height*i/8);e.fillRect(t,s,n.left+Math.round(n.width*(r+a)/8)-t,n.top+Math.round(n.height*(i+o)/8)-s)}}function U2(e){return`rgb(${e.r}, ${e.g}, ${e.b})`}function W2(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b}function G2(e,t){return Math.round(e*t)/t}function K2(e,t,n,r){let i=G2(e*n.width,r);return{left:i,width:G2(t*n.width,r)-i}}function q2(e,t,n,r,i){let a=i-2,o=n+r;if(t===1)e.fillRect(n,a,r,1);else if(t===2)e.fillRect(n,a,r,1),e.fillRect(n,a-2,r,1);else if(t===3){function t(e){return a-1+Math.sin(e/3*Math.PI)*1.5}e.save(),e.strokeStyle=e.fillStyle,e.lineWidth=1,e.beginPath(),e.moveTo(n,t(n));for(let r=Math.floor(n)+1;r<o;r+=1)e.lineTo(r,t(r));e.lineTo(o,t(o)),e.stroke(),e.restore()}else if(t===4)for(let t=Math.ceil(n/2)*2;t<o;t+=2)e.fillRect(t,a,1,1);else if(t===5)for(let t=Math.floor(n/5)*5;t<o;t+=5){let r=Math.max(t,n),i=Math.min(t+3,o);i>r&&e.fillRect(r,a,i-r,1)}else throw Error(`unknown underline style ${t}`)}function J2(e,t){return e.selected===t.selected&&W2(e.foreground,t.foreground)&&e.bold===t.bold&&e.italic===t.italic&&e.invisible===t.invisible}function Y2(e,t){return`${e.italic?`italic`:`normal`} ${e.bold?700:400} ${t.fontSize}px ${t.fontFamily}`}function X2(e,t,n,r,i){e.font=`normal 400 ${t}px ${n}`;let a=e.measureText(`M`).width,o=e.measureText(`Mg`),s=o.fontBoundingBoxAscent||t,c=s+o.fontBoundingBoxDescent,l=Math.max(1,Math.round(c*r*i))/i;return{width:Math.max(1,Math.round(a*i))/i,height:l,baseline:G2((l-c)/2+s,i),faceWidth:a}}function Z2(e){return/^[!-/:-@[-`{-~]$/.test(e)}function Q2(e,t,n){return!(e===null||t<e.start.y||t>e.end.y||t===e.start.y&&n<e.start.x||t===e.end.y&&n>e.end.x)}function $2(e){let{context:t,snapshot:n,metrics:r,appearance:i,cursorOn:a,previousCursorY:o,pixelRatio:s}=e,c=e.forceFull?Array.from({length:n.rows},(e,t)=>t):[...n.dirtyRows];o!==null&&!c.includes(o)&&c.push(o),n.cursorVisible&&n.cursorY>=0&&!c.includes(n.cursorY)&&c.push(n.cursorY),e.forceFull&&(t.save(),t.resetTransform(),t.fillStyle=U2(n.background),t.fillRect(0,0,t.canvas.width,t.canvas.height),t.restore());function l(e){let t=e*r.height,n=G2(t,s);return{top:t,cellTop:n,cellHeight:G2(t+r.height,s)-n}}t.textBaseline=`alphabetic`;for(let e of c){if(!n.rowData[e])continue;let{cellTop:r,cellHeight:i}=l(e);t.fillStyle=U2(n.background),t.fillRect(0,r,t.canvas.width,i)}e.drawLayer(`belowBackground`);for(let a of c){let o=n.rowData[a];if(!o)continue;let{cellTop:c,cellHeight:u}=l(a),d=0;for(;d<o.cells.length;){let e=o.cells[d],a=d+1;for(;a<o.cells.length&&o.cells[a].selected===e.selected&&W2(o.cells[a].background,e.background);)a+=1;let{left:l,width:f}=K2(d,a,r,s);e.selected?(t.fillStyle=i.selectionBackground,t.fillRect(l,c,f,u)):W2(e.background,n.background)||(t.fillStyle=U2(e.background),t.fillRect(l,c,f,u)),d=a}for(let n of e.highlights){if(n.row!==a)continue;let{left:e,width:o}=K2(n.start,n.end,r,s);t.fillStyle=i.matchBackground,t.fillRect(e,c,o,u),n.active&&(t.strokeStyle=i.activeMatchBorder,t.strokeRect(e+.5,c+.5,o-1,u-1))}}e.drawLayer(`belowText`);for(let a of c){let o=n.rowData[a];if(!o)continue;let{top:c,cellTop:u,cellHeight:d}=l(a);t.save(),t.beginPath(),t.rect(0,u,t.canvas.width,d),t.clip();for(let e=0;e<o.cells.length;e+=1){let n=o.cells[e];if(n.invisible||n.text.trim().length===0)continue;t.fillStyle=n.selected?i.selectionForeground:U2(n.foreground);let a=e*r.width;if(L2(n.text)){V2(t,n.text,{left:a,top:c,width:r.width,height:r.height},s);continue}t.font=Y2(n,i);let l=a+(r.width-r.faceWidth)/2,u=e,d=e+1;if(i.ligatures&&Z2(n.text)){for(;u>e-3&&u>0&&Z2(o.cells[u-1].text)&&J2(o.cells[u-1],n);)--u;for(;d<e+4&&d<o.cells.length&&Z2(o.cells[d].text)&&J2(o.cells[d],n);)d+=1}d-u===1?t.fillText(n.text,l,c+r.baseline):(t.save(),t.beginPath(),t.rect(a,c,r.width,r.height),t.clip(),t.fillText(o.cells.slice(u,d).map(e=>e.text).join(``),l-(e-u)*r.faceWidth,c+r.baseline),t.restore())}t.restore();for(let n=0;n<o.cells.length;n+=1){let i=o.cells[n],l=Q2(e.hoveredLink,a,n);if(i.underline===0&&!i.strikethrough&&!i.overline&&!l)continue;let{left:f,width:p}=K2(n,n+1,r,s),m=u+d;t.fillStyle=U2(i.foreground),i.strikethrough&&t.fillRect(f,c+Math.floor(r.height*.55),p,1),i.overline&&t.fillRect(f,u+1,p,1),i.underline===0?l&&q2(t,1,f,p,m):(i.underlineColor!==null&&(t.fillStyle=U2(i.underlineColor)),q2(t,i.underline,f,p,m))}}if(!a||!n.cursorVisible||n.cursorX<0||n.cursorY<0)return;let u=n.cursorY*r.height,d=G2(u,s),f=G2(u+r.height,s)-d,p=n.rowData[n.cursorY]?.cells,m=p?.[n.cursorX],h=p?.[n.cursorX+1]?.wide===H0.spacerTail?2:1,{left:g,width:_}=K2(n.cursorX,n.cursorX+h,r,s);t.fillStyle=U2(n.cursor),t.strokeStyle=U2(n.cursor),!e.focused||n.cursorStyle===3?t.strokeRect(g+.5,d+.5,_-1,f-1):n.cursorStyle===0?t.fillRect(g,d,1,f):n.cursorStyle===2?t.fillRect(g,d+f-2,_,2):(t.fillRect(g,d,_,f),m?.text&&(t.fillStyle=i.cursorText,L2(m.text)?V2(t,m.text,{left:n.cursorX*r.width,top:u,width:r.width,height:r.height},s):(t.font=Y2(m,i),t.fillText(m.text,n.cursorX*r.width+(r.width-r.faceWidth)/2,u+r.baseline))))}var e4=navigator.userAgent.includes(`Mac`),t4=500,n4=/https?:\/\/[^\s"'`<>]+/g;function r4(e){return e===0?1:e===1?3:e===2?2:null}function i4(e,t){let n=Math.max(0,e.total-e.len);if(t<=0||e.len<=0||n===0)return null;let r=Math.min(t,Math.max(20,t*e.len/e.total)),i=t-r;return{thumbHeight:r,thumbTop:i*(Math.min(e.offset,n)/n),travel:i,maxOffset:n}}var a4=class{hoveredLink=null;context;linkPointer=null;mousePointer=null;mouseButton=null;lastMotion=``;selectionPointer=null;selectionMode=`cell`;selectionAnchor=null;selectionBase=null;selectionMoved=!1;selectionScroll=null;selectionScrollDelta=0;selectionClient=null;clickMove=null;clicks={count:0,time:0,x:0,y:0};touch=null;wheelRemainder=0;scrollbarDrag=null;constructor(e){this.context=e;let t=e.canvas,n=e.scrollbar;t.addEventListener(`pointerdown`,this.onPointerDown),t.addEventListener(`pointermove`,this.onPointerMove),t.addEventListener(`pointerup`,this.onPointerUp),t.addEventListener(`pointercancel`,this.onPointerUp),t.addEventListener(`pointerleave`,this.onPointerLeave),t.addEventListener(`wheel`,this.onWheel,{passive:!1}),t.addEventListener(`mousedown`,this.onMouseDown),n.addEventListener(`pointerdown`,this.onScrollbarDown),n.addEventListener(`pointermove`,this.onScrollbarMove),n.addEventListener(`pointerup`,this.onScrollbarUp),n.addEventListener(`pointercancel`,this.onScrollbarUp)}updateScrollbar(e){let t=this.context.core.scrollbarState(),n=t===null?null:i4(t,e);this.context.scrollbar.hidden=n===null,n!==null&&(this.context.thumb.style.height=`${n.thumbHeight}px`,this.context.thumb.style.transform=`translateY(${n.thumbTop}px)`)}dispose(){this.setSelectionScroll(0)}scrollRows(e,t){let n=this.context.core,r=this.wheelRemainder+e/this.context.view().metrics.height,i=Math.trunc(r);if(this.wheelRemainder=r-i,i!==0){if(this.reportsMouse(t))for(let e=0;e<Math.abs(i);e+=1)this.sendMouse(`press`,i<0?4:5,t);else if(n.isAlternateScreen()){let e=(n.isApplicationCursorKeys()?`\x1BO`:`\x1B[`)+(i<0?`A`:`B`);this.context.onData(e.repeat(Math.abs(i)))}else this.context.scrollViewport(i)}}cellAt(e,t){let n=this.context.view(),r=this.context.canvas.getBoundingClientRect();return{x:Math.max(0,Math.min(n.cols-1,Math.floor((e-r.left)/n.metrics.width))),y:Math.max(0,Math.min(n.rows-1,Math.floor((t-r.top)/n.metrics.height)))}}reportsMouse(e){return this.context.core.isMouseTracking()&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey}sendMouse(e,t,n){let r=this.context.view(),i=this.context.canvas.getBoundingClientRect(),a=window.devicePixelRatio||1,o=this.context.core.encoder.encodeMouse({action:e,button:t,mods:+!!n.shiftKey|(n.ctrlKey?2:0)|(n.altKey?4:0)|(n.metaKey?8:0),x:Math.max(0,n.clientX-i.left)*a,y:Math.max(0,n.clientY-i.top)*a,screenWidth:r.cols*r.metrics.width*a,screenHeight:r.rows*r.metrics.height*a,cellWidth:r.metrics.width*a,cellHeight:r.metrics.height*a,anyButtonPressed:n.buttons!==0});if(o.length!==0){if(e===`motion`){if(o===this.lastMotion)return;this.lastMotion=o}else this.lastMotion=``;this.context.onData(o)}}linkAt(e,t){let n=this.context.view(),r=this.context.core,i=n.snapshot;if(!i)return null;let a=this.context.canvas.getBoundingClientRect(),o=e-a.left,s=t-a.top;if(o<0||s<0||o>=n.cols*n.metrics.width||s>=n.rows*n.metrics.height)return null;let c={x:Math.floor(o/n.metrics.width),y:Math.floor(s/n.metrics.height)},l=r.hyperlinkAt(c.x,c.y);if(l!==null){if(l.startsWith(`offsite-image:`))return null;let e=c.x,t=c.x;for(;e>0&&r.hyperlinkAt(e-1,c.y)===l;)--e;for(;t<n.cols-1&&r.hyperlinkAt(t+1,c.y)===l;)t+=1;return{uri:l,range:{start:{x:e,y:c.y},end:{x:t,y:c.y}}}}let u=c.y;for(;u>0&&i.rowData[u]?.isWrapContinuation;)--u;let d=c.y;for(;d<i.rows-1&&i.rowData[d]?.wrapsToNext;)d+=1;let f=``,p=[];for(let e=u;e<=d;e+=1){let t=i.rowData[e];if(!t)break;let n=Z0(t,e);f+=n.text,p.push(...n.points)}for(let e of f.matchAll(n4)){let t=e[0].replace(/[.,;:!?)\]}'"]+$/,``),n=p[e.index],r=p[e.index+t.length-1];if(!n||!r)continue;let i={start:n,end:r};if(Q2(i,c.y,c.x))return{uri:t,range:i}}return null}setHoveredLink(e){let t=this.hoveredLink;this.context.canvas.style.cursor=e?`pointer`:``,(t?.uri!==e?.uri||t?.range.start.x!==e?.range.start.x||t?.range.start.y!==e?.range.start.y)&&(this.hoveredLink=e,this.context.redraw())}beginSelection(e,t){let n=this.context.core,r=this.cellAt(e.clientX,e.clientY),i=n.toScreen(r);if(!i)return;this.selectionMoved=!1,this.selectionMode=t>=3?`line`:t===2?`word`:`cell`;let a=this.selectionMode===`line`?n.selectLine(i):this.selectionMode===`word`?n.selectWord(i):null;this.selectionAnchor=a?a.start:i,this.selectionBase=a,a?n.setSelection(a.start,a.end):(this.selectionMode=`cell`,n.setSelection(i,i)),this.context.redraw()}extendSelection(e,t){let n=this.context.core,r=this.selectionAnchor;if(!r)return;let i=this.cellAt(e,t),a=n.toScreen(i);if(!a)return;this.selectionMoved=!0;let o=this.selectionBase;if(o===null)n.setSelection(r,a);else{let e=this.selectionMode===`line`?n.selectLine(a):n.selectWord(a),t=a.y<o.start.y||a.y===o.start.y&&a.x<o.start.x;n.setSelection(t?o.end:o.start,e?t?e.start:e.end:a)}this.context.redraw()}setSelectionScroll(e){this.selectionScrollDelta=e,e===0?(this.selectionScroll!==null&&window.clearInterval(this.selectionScroll),this.selectionScroll=null):this.selectionScroll===null&&(this.selectionScroll=window.setInterval(()=>{this.context.scrollViewport(this.selectionScrollDelta);let e=this.selectionClient;e&&this.extendSelection(e.x,e.y)},80))}dragScrollbar(e){let t=this.context.core.scrollbarState(),n=this.scrollbarDrag;if(t===null||n===null)return;let r=this.context.scrollbar.getBoundingClientRect(),i=i4(t,r.height);if(i===null||i.travel===0)return;let a=Math.max(0,Math.min(e-r.top-n.offset,i.travel)),o=Math.round(a/i.travel*i.maxOffset);this.context.scrollViewport(o-t.offset)}onPointerDown=e=>{let t=this.context.canvas;if(this.context.focus(),e.pointerType===`touch`){this.touch={id:e.pointerId,y:e.clientY,moved:!1},t.setPointerCapture(e.pointerId);return}if(this.reportsMouse(e)){let n=r4(e.button);if(n===null)return;e.preventDefault(),this.mousePointer=e.pointerId,this.mouseButton=n,this.sendMouse(`press`,n,e),t.setPointerCapture(e.pointerId);return}if(e.button!==0)return;if(this.linkAt(e.clientX,e.clientY)&&(e4?e.metaKey:e.ctrlKey)){e.preventDefault(),this.linkPointer=e.pointerId;return}let n=e.timeStamp-this.clicks.time<=t4&&Math.hypot(e.clientX-this.clicks.x,e.clientY-this.clicks.y)<=4;this.clicks={count:n?this.clicks.count>=3?1:this.clicks.count+1:1,time:e.timeStamp,x:e.clientX,y:e.clientY},this.clickMove=!e.altKey&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this.context.view().clickToMoveCursor&&this.clicks.count===1?this.cellAt(e.clientX,e.clientY):null,this.selectionPointer=e.pointerId,this.beginSelection(e,this.clicks.count),t.setPointerCapture(e.pointerId)};onPointerMove=e=>{let t=this.touch;if(t?.id===e.pointerId){let n=t.y-e.clientY;if(Math.abs(n)<1)return;t.y=e.clientY,t.moved=!0,this.scrollRows(n,e)}else if(this.mousePointer===e.pointerId||this.context.core.isMouseAnyEventTracking()&&this.reportsMouse(e)){let t=e.buttons,n=t&1?1:t&4?3:t&2?2:null;this.sendMouse(`motion`,n,e)}else if(this.selectionPointer===e.pointerId){let t=this.cellAt(e.clientX,e.clientY);this.clickMove!==null&&(t.x!==this.clickMove.x||t.y!==this.clickMove.y)&&(this.clickMove=null),this.selectionClient={x:e.clientX,y:e.clientY};let n=this.context.canvas.getBoundingClientRect();this.setSelectionScroll(e.clientY<n.top?-1:+(e.clientY>n.bottom)),this.extendSelection(e.clientX,e.clientY)}else this.setHoveredLink(this.linkAt(e.clientX,e.clientY))};onPointerUp=e=>{let t=this.context.canvas;if(t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),this.touch?.id===e.pointerId)this.touch=null;else if(this.linkPointer===e.pointerId){this.linkPointer=null;let t=this.linkAt(e.clientX,e.clientY);t&&e.type===`pointerup`&&this.context.onLink(t.uri,e)}else if(this.mousePointer===e.pointerId)this.sendMouse(`release`,this.mouseButton,e),this.mousePointer=null,this.mouseButton=null;else if(this.selectionPointer===e.pointerId){this.selectionPointer=null,this.setSelectionScroll(0),!this.selectionMoved&&this.selectionMode===`cell`&&(this.context.core.clearSelection(),this.selectionAnchor=null,this.context.redraw());let t=this.clickMove;this.clickMove=null,t!==null&&e.type===`pointerup`&&this.context.moveCursorTo(t)}};onPointerLeave=()=>{this.lastMotion=``,this.setHoveredLink(null)};onWheel=e=>{if(e.deltaY===0)return;e.preventDefault();let t=this.context.view(),n=e.deltaMode===1?e.deltaY*t.metrics.height:e.deltaMode===2?e.deltaY*t.rows*t.metrics.height:e.deltaY;this.scrollRows(n,e)};onMouseDown=e=>{e.button===0&&e.preventDefault(),this.context.focus()};onScrollbarDown=e=>{let t=this.context.core.scrollbarState();if(e.button!==0||t===null)return;let n=this.context.scrollbar,r=n.getBoundingClientRect(),i=i4(t,r.height);i!==null&&(e.preventDefault(),e.stopPropagation(),this.scrollbarDrag={id:e.pointerId,offset:e.target===this.context.thumb?e.clientY-r.top-i.thumbTop:i.thumbHeight/2},n.setPointerCapture(e.pointerId),this.dragScrollbar(e.clientY))};onScrollbarMove=e=>{this.scrollbarDrag?.id===e.pointerId&&(e.preventDefault(),this.dragScrollbar(e.clientY))};onScrollbarUp=e=>{if(this.scrollbarDrag?.id!==e.pointerId)return;this.scrollbarDrag=null;let t=this.context.scrollbar;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}},o4=[`\r`,`
108
- `,``,``,``,``,`\x1B[99;5u`,`\x1B[100;5u`,`\x1B[111;5u`,`\x1B[122;5u`];function s4(e,t){return e.y<t.y||e.y===t.y&&e.x<t.x}var c4=class{shell=`unknown`;generation=0;core;native=!1;input=!1;clickEvents=!1;inputRef=null;constructor(e){this.core=e}mark(e,t){let n=e.startsWith(`133;`),r=n?4:5;if(e.length>r+1&&e[r+1]!==`;`)return;let i=e.charAt(r);if(!this.core.isAlternateScreen()){if(i===`A`){let r=e.split(`;`);if(r.includes(`k=s`)||r.includes(`k=c`))return;let i=n&&r.includes(`click_events=1`),a=this.shell===`prompt`,o=a&&!this.input&&this.native!==n;if(this.shell=`prompt`,this.native=n,t&&this.trackInput(),o){this.clickEvents=this.clickEvents||i;return}if(this.input=!1,this.clickEvents=i,a)return;this.generation+=1}else if(i===`B`)this.shell=`prompt`,this.input=!0,t&&this.trackInput();else if(i===`C`)this.shell=`command`;else if(i===`D`){if(this.shell===`prompt`&&!this.input)return;this.shell=`unknown`}}}beforeInput(e){this.shell===`prompt`&&o4.some(t=>e.includes(t))&&(this.shell=`unknown`)}reset(){this.release(),this.shell=`unknown`,this.input=!1,this.clickEvents=!1}release(){this.inputRef!==null&&this.core.untrack(this.inputRef),this.inputRef=null}moveCursorInput(e,t,n){if(this.shell!==`prompt`||this.inputRef===null||t===null||t.cursorX<0||t.cursorY<0||this.core.isAlternateScreen()||this.core.isMouseTracking())return null;let r=this.core.trackedPoint(this.inputRef);if(r===null)return null;let i={x:r.x,y:r.y-n};if(s4(e,i))return null;if(this.clickEvents){let t=this.core.scrollbarState();if(t===null)return null;let r=e.y+n-(t.total-t.len);return r<0?null:`\x1b[<0;${e.x+1};${r+1}M`}if(!this.input)return null;let a={x:e.x,y:e.y};a.x>0&&t.rowData[a.y]?.cells[a.x]?.wide===H0.spacerTail&&--a.x;let o={x:t.cursorX,y:t.cursorY};if(s4(a,i)||s4(o,i))return null;let s=s4(a,o),c=s?a:o,l=s?o:a,u=0;for(let e=c.y;e<=l.y;e+=1){let n=t.rowData[e];if(n===void 0)return null;let r=e===l.y?l.x:n.cells.length;for(let t=e===c.y?c.x:0;t<r;t+=1)n.cells[t].text!==``&&(u+=1);if(e<l.y&&!n.wrapsToNext){if(s)return null;break}}let d=s?`ArrowLeft`:`ArrowRight`,f=this.core.encoder.encodeKey(new KeyboardEvent(`keydown`,{key:d,code:d}));return u>0?f.repeat(u):``}trackInput(){this.inputRef===null?this.inputRef=this.core.trackCursor():this.core.retrack(this.inputRef)}},l4=navigator.userAgent.includes(`Mac`),u4=600,d4=1e3,f4=1e4,p4=new TextDecoder(`latin1`),m4=new TextDecoder;function h4(e){let t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!t)throw Error(`unsupported color ${e}`);return{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}}function g4(e){return[...e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0).map(e=>/^(['"]).*\1$/.test(e)||/^[a-zA-Z][a-zA-Z0-9-]*$/.test(e)?e:`"${e.replaceAll(`"`,``)}"`),`monospace`].join(`, `)}async function _4(e){try{(await e)?.close()}catch(e){console.warn(`could not decode image`,e)}}var v4=class{element;cols=80;rows=24;canvas;input;context;core;scanner=new T2;handlers;observer;prompt;search;images;pointer;notifications=new y2;options;appearance;metrics;snapshot=null;sized=!1;fitted=!1;frame=0;forceFull=!0;renderFailed=!1;cursorOn=!0;cursorTimer=null;syncTimer=null;renderedCursorY=null;focused=!1;composing=!1;suppressedKeys=new Set;heldOptionKeys=new Set;backlog=[];blocked=!1;epoch=0;title=``;progress={state:0,value:0};disposed=!1;constructor(e,t){this.options=e,this.handlers=t,this.element=document.createElement(`div`),this.element.className=`relative h-full overflow-hidden`,this.canvas=document.createElement(`canvas`),this.canvas.className=`absolute top-0 left-0 cursor-text touch-none`,this.input=document.createElement(`textarea`),this.input.setAttribute(`aria-label`,`Terminal input`),this.input.autocapitalize=`off`,this.input.autocomplete=`off`,this.input.spellcheck=!1,this.input.style.cssText=`position:absolute;left:0;top:0;width:1px;height:1px;opacity:0;padding:0;border:0;resize:none;pointer-events:none;`;let n=document.createElement(`div`);n.className=`absolute top-0 right-0 bottom-0 w-2 cursor-default touch-none`,n.hidden=!0;let r=document.createElement(`div`);r.className=`bg-foreground/15 hover:bg-foreground/30 absolute inset-x-0.5 top-0 rounded-full`,n.append(r),this.element.append(this.canvas,this.input,n);let i=this.canvas.getContext(`2d`,{alpha:!1});if(!i)throw Error(`canvas 2d is unavailable`);this.context=i,this.appearance=this.appearanceFor(e),this.metrics=this.measure(),this.core=new a2(Math.max(1,Math.floor(window.innerWidth/this.metrics.width)),this.rows,e.scrollback,t.onReply,t.onBell),this.prompt=new c4(this.core),this.search=new s2(this.core,()=>this.redraw()),this.images=new B1(this.core),this.pointer=new a4({canvas:this.canvas,scrollbar:n,thumb:r,core:this.core,view:()=>({cols:this.cols,rows:this.rows,metrics:this.metrics,snapshot:this.snapshot,clickToMoveCursor:this.options.clickToMoveCursor}),focus:()=>this.focus(),redraw:()=>this.redraw(),scrollViewport:e=>this.scrollViewport(e),moveCursorTo:e=>this.moveCursorTo(e),onData:t.onData,onLink:t.onLink}),this.applyTerminalOptions(),this.resizeCore(),this.installEvents(),this.observer=new ResizeObserver(()=>this.fit()),this.observer.observe(this.element)}setOptions(e){this.options=e,this.appearance=this.appearanceFor(e),this.metrics=this.measure(),e.clickToMoveCursor||this.prompt.release(),this.applyTerminalOptions(),this.resizeCore(),this.forceFull=!0,this.fit(),this.requestRender()}write(e,t){this.disposed||(this.backlog.push({data:e,replay:t}),this.blocked||this.drain())}reset(){this.epoch+=1,this.backlog=[],this.blocked=!1,this.scanner.reset(),this.prompt.reset(),this.core.reset(),this.applyTerminalOptions(),this.images.clear(),this.core.clearSelection(),this.redraw()}focus(){this.input.focus({preventScroll:!0})}isKittyKeyboard(){return this.core.isKittyKeyboard()}paste(e){let t=this.core.encoder.encodePaste(e);t.length>0&&this.sendInput(t)}presize(e,t){this.fitted||e===this.cols&&t===this.rows||(this.cols=e,this.rows=t,this.resizeCore())}fit(){if(this.disposed)return;let e=this.element.clientWidth,t=this.element.clientHeight;if(e===0||t===0){this.sized=!1;return}this.sized=!0,this.fitted=!0;let n=window.devicePixelRatio||1,r=Math.round(e*n),i=Math.round(t*n);(this.canvas.width!==r||this.canvas.height!==i)&&(this.canvas.width=r,this.canvas.height=i,this.canvas.style.width=`${e}px`,this.canvas.style.height=`${t}px`,this.context.setTransform(n,0,0,n,0,0),this.metrics=this.measure(),this.resizeCore(),this.forceFull=!0);let a=Math.max(1,Math.floor(e/this.metrics.width)),o=Math.max(1,Math.floor(t/this.metrics.height));(a!==this.cols||o!==this.rows)&&(this.cols=a,this.rows=o,this.resizeCore(),this.forceFull=!0,this.handlers.onResize(a,o)),this.renderFrame()}find(e,t,n){let r=this.viewportTop(),i=this.search.find(e,t,n,r);i!==null&&(i.row<r||i.row>=r+this.rows)&&this.scrollViewport(i.row-r-Math.floor(this.rows/2)),this.redraw()}onFindResults(e){return this.search.onResults(e)}clearFind(){this.search.clear(),this.redraw()}replyClipboard(e,t){t.epoch!==this.epoch||t.generation!==this.prompt.generation||t.atPrompt&&this.prompt.shell!==`prompt`||this.handlers.onReply(m2(e,t.selection,t.terminator))}beforeInput(e){this.prompt.beforeInput(e)}dispose(){this.disposed||(this.disposed=!0,this.observer.disconnect(),this.cancelRender(),this.pointer.dispose(),this.search.dispose(),window.removeEventListener(`focus`,this.onWindowFocus),document.removeEventListener(`visibilitychange`,this.onVisibilityChange),this.images.clear(),this.prompt.release(),this.core.dispose(),this.element.remove())}redraw(){this.forceFull=!0,this.requestRender()}resizeCore(){this.core.resize(this.cols,this.rows,this.metrics.width,this.metrics.height,window.devicePixelRatio||1)}appearanceFor(e){let t=e.colors;return{fontSize:e.fontSize,fontFamily:g4(e.fontFamily),ligatures:e.ligatures,cursorText:t.cursorText,selectionBackground:t.selectionBackground,selectionForeground:t.selectionForeground,matchBackground:t.palette[8],activeMatchBorder:t.palette[3]}}measure(){return X2(this.context,this.options.fontSize,this.appearance.fontFamily,this.options.lineHeight,window.devicePixelRatio||1)}applyTerminalOptions(){let e=this.options.colors;this.core.setColors({foreground:h4(e.foreground),background:h4(e.background),cursor:h4(e.cursor),palette:e.palette.map(h4)}),this.core.setCursor(this.options.cursorStyle,this.options.cursorBlink),this.core.boldIsBright=this.options.boldIsBright,this.core.version=this.options.version,this.core.invalidate()}drain(){for(;!this.blocked&&this.backlog.length>0;){let e=this.backlog.shift();e&&this.process(e)}let e=this.core.title();e!==this.title&&(this.title=e,this.handlers.onTitle(e)),this.search.outputChanged(),this.cursorOn=!0,this.requestRender()}process(e){let t=e.data,n=e.replay;this.core.setReplies(!n);let r=0,i=this.scanner.scan(t,(e,i)=>(this.core.write(t.subarray(r,i)),r=i,this.handleOutput(e,n)));this.core.write(t.subarray(r,i)),i<t.length&&this.backlog.unshift({data:t.subarray(i),replay:n})}handleOutput(e,t){if(e.type===`sixel`)return this.decodeImage(I1(e.data));let n=p4.decode(e.data);if(n.startsWith(`1337;File=`))return this.decodeImage(R1(n.slice(10),{cellWidth:this.metrics.width,cellHeight:this.metrics.height,width:this.cols*this.metrics.width,height:this.rows*this.metrics.height,pixelRatio:window.devicePixelRatio||1}));if(n.startsWith(`133;`)||n.startsWith(`6973;`))return this.prompt.mark(n,this.options.clickToMoveCursor),!1;if(n.startsWith(`52;`)){let r=n.split(`;`),i=r[2];if(t||i===void 0)return!1;if(i===`?`)return this.handlers.onClipboardRead({selection:f2(r[1]),terminator:e.terminator,generation:this.prompt.generation,epoch:this.epoch,atPrompt:this.prompt.shell===`prompt`}),!1;let a=p2(i);return a!==null&&this.handlers.onClipboard(a),!1}if(n===`10;?`||n===`11;?`||n===`12;?`)return t||this.handlers.onReply(h2(n,this.core.currentColors(),e.terminator)),!1;if(n.startsWith(`4;`)){if(!t)for(let t of g2(n,this.core.currentColors().palette,e.terminator))this.handlers.onReply(t);return!1}if(n===`9;4`||n.startsWith(`9;4;`)){let e=_2(n,this.progress);return e!==null&&(this.progress=e,this.handlers.onProgress(e)),!1}if(t)return!1;let r=n.startsWith(`99;`)?this.notifications.add(m4.decode(e.data)):v2(n,e.data);return r!==null&&this.handlers.onNotify(r.title,r.body),!1}decodeImage(e){return this.blocked=!0,this.placeImage(e,this.epoch,window.devicePixelRatio||1),!0}async placeImage(e,t,n){let r=0,i=new Promise(e=>{r=window.setTimeout(()=>e(`timeout`),f4)});try{let r=await Promise.race([e,i]);r===`timeout`?(console.warn(`image decoding took too long, skipping the image`),_4(e)):r!==null&&(t===this.epoch&&!this.disposed?this.images.place(r,n,this.metrics.height):r.close())}catch(e){console.warn(`could not decode image`,e)}window.clearTimeout(r),!(t!==this.epoch||this.disposed)&&(this.blocked=!1,this.drain())}moveCursorTo(e){if(!this.options.clickToMoveCursor)return;let t=this.prompt.moveCursorInput(e,this.snapshot,this.viewportTop());t!==null&&(t!==``&&this.sendInput(t),this.core.clearSelection(),this.redraw())}sendInput(e){this.prompt.beforeInput(e),this.core.scrollbarState()?.offset!==this.maxOffset()&&(this.core.scrollToBottom(),this.redraw()),this.handlers.onData(e)}maxOffset(){let e=this.core.scrollbarState();return e?Math.max(0,e.total-e.len):0}viewportTop(){return this.core.toScreen({x:0,y:0})?.y??0}scrollViewport(e){let t=this.core.scrollbarState(),n=Math.trunc(e);if(t!==null){let e=Math.max(0,t.total-t.len);n=Math.max(0,Math.min(t.offset+n,e))-t.offset}n!==0&&(this.core.scroll(n),this.redraw())}requestRender(){!this.disposed&&this.sized&&this.frame===0&&(this.frame=window.requestAnimationFrame(()=>{this.frame=0,this.renderFrame()}))}cancelRender(){this.frame!==0&&window.cancelAnimationFrame(this.frame),this.frame=0,this.cursorTimer!==null&&window.clearTimeout(this.cursorTimer),this.cursorTimer=null,this.syncTimer!==null&&window.clearTimeout(this.syncTimer),this.syncTimer=null}renderFrame(){if(!this.disposed&&this.sized&&this.element.isConnected){this.frame!==0&&window.cancelAnimationFrame(this.frame),this.frame=0;try{this.draw(),this.renderFailed=!1}catch(e){this.renderFailed||console.error(`could not draw the terminal`,e),this.renderFailed=!0}}}draw(){if(this.core.isSynchronizedOutput()){this.syncTimer===null&&(this.syncTimer=window.setTimeout(()=>{this.syncTimer=null,this.core.endSynchronizedOutput(),this.requestRender()},d4));return}this.syncTimer!==null&&window.clearTimeout(this.syncTimer),this.syncTimer=null;let e=this.core.snapshot();this.snapshot=e;let t=this.focused&&e.cursorBlinking&&e.cursorVisible;t||(this.cursorOn=!0);let n=this.viewportTop(),r=this.images.visible(n,this.rows,this.metrics.height),i=this.core.cellSize(),a=this.core.kitty.images(e.rowData,i);$2({context:this.context,snapshot:e,metrics:this.metrics,appearance:this.appearance,forceFull:this.forceFull||r.length>0||a.length>0,cursorOn:this.cursorOn,previousCursorY:this.renderedCursorY,focused:this.focused,hoveredLink:this.pointer.hoveredLink?.range??null,highlights:this.search.highlights(e,n),pixelRatio:window.devicePixelRatio||1,drawLayer:e=>k0(this.context,a,e,this.metrics,i)}),k0(this.context,a,`aboveText`,this.metrics,i);for(let e of r)this.context.drawImage(e.bitmap,e.x*this.metrics.width,e.y*this.metrics.height,e.width,e.height);this.forceFull=r.length>0||a.length>0,this.renderedCursorY=this.cursorOn&&e.cursorVisible&&e.cursorY>=0?e.cursorY:null,e.cursorX>=0&&e.cursorY>=0&&(this.input.style.left=`${e.cursorX*this.metrics.width}px`,this.input.style.top=`${e.cursorY*this.metrics.height}px`),this.pointer.updateScrollbar(this.element.clientHeight),this.cursorTimer!==null&&window.clearTimeout(this.cursorTimer),this.cursorTimer=null,t&&(this.cursorTimer=window.setTimeout(()=>{this.cursorTimer=null,this.cursorOn=!this.cursorOn,this.requestRender()},u4))}copySelection(){let e=this.core.selectionText();e.length!==0&&(window.isSecureContext?navigator.clipboard.writeText(e):console.warn(`copy from the terminal needs https or localhost`))}optionIsMeta(e){if(!l4||!e.altKey||e.metaKey)return!1;let t=this.options.optionAsMeta;if(t===`off`)return!1;if(t===`both`)return!0;if(t===`left`)return this.heldOptionKeys.has(`AltLeft`);if(t===`right`)return this.heldOptionKeys.has(`AltRight`);throw Error(`unknown option as meta mode ${t}`)}onKeyDown=e=>{if((e.code===`AltLeft`||e.code===`AltRight`)&&this.heldOptionKeys.add(e.code),!this.handlers.beforeKey(e)){this.suppressedKeys.add(e.code);return}let t=this.optionIsMeta(e),n=t&&this.core.encoder.metaText(e)!==null;if(e.isComposing||this.composing||!n&&(e.key===`Process`||e.keyCode===229)||l4&&this.options.optionAsMeta!==`off`&&!t&&e.altKey&&!e.ctrlKey&&!e.metaKey&&([...e.key].length===1||e.key===`Dead`)||!n&&e.getModifierState(`AltGraph`)&&[...e.key].length===1){this.suppressedKeys.add(e.code);return}let r=e.key.toLowerCase();if(l4?e.metaKey&&r===`c`:e.ctrlKey&&e.shiftKey&&r===`c`||e.ctrlKey&&!e.shiftKey&&r===`insert`){this.copySelection(),e.preventDefault(),this.suppressedKeys.add(e.code);return}if((l4?e.metaKey&&r===`v`:e.ctrlKey&&e.shiftKey&&r===`v`||e.shiftKey&&!e.ctrlKey&&r===`insert`)||l4&&e.metaKey&&r===`q`){this.suppressedKeys.add(e.code);return}let i=this.core.encoder.encodeKey(e,`press`,n);i.length!==0&&(this.suppressedKeys.delete(e.code),e.preventDefault(),e.stopPropagation(),this.core.selectionText().length>0&&!e.shiftKey&&(this.core.clearSelection(),this.forceFull=!0),this.sendInput(i))};onKeyUp=e=>{if(this.heldOptionKeys.delete(e.code),this.suppressedKeys.delete(e.code)||e.isComposing||this.composing)return;let t=this.core.encoder.encodeKey(e,`release`,this.optionIsMeta(e));t.length!==0&&(e.preventDefault(),this.handlers.onData(t))};onInput=e=>{let t=e;if(this.composing||t.isComposing)return;let n=this.input.value||t.data||``;this.input.value=``,n.length>0&&this.sendInput(n)};onCompositionStart=()=>{this.composing=!0};onCompositionEnd=e=>{this.composing=!1;let t=this.input.value||e.data;this.input.value=``,t.length>0&&this.sendInput(t)};onPaste=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`)??``;t.length>0&&this.paste(t)};onCopy=e=>{let t=this.core.selectionText();t.length!==0&&e.clipboardData&&(e.preventDefault(),e.clipboardData.setData(`text/plain`,t))};onWindowFocus=()=>{l4&&this.options.optionAsMeta!==`off`&&this.core.encoder.refreshKeyboardLayout()};onContextRestored=()=>{let e=window.devicePixelRatio||1;this.context.setTransform(e,0,0,e,0,0),this.redraw()};onVisibilityChange=()=>{document.visibilityState===`visible`&&this.redraw()};onFocus=()=>{this.focused=!0,this.cursorOn=!0,this.requestRender(),!this.disposed&&this.core.isFocusReporting()&&this.handlers.onReply(`\x1B[I`)};onBlur=()=>{this.focused=!1,this.heldOptionKeys.clear(),this.cursorOn=!0,this.requestRender(),!this.disposed&&this.core.isFocusReporting()&&this.handlers.onReply(`\x1B[O`)};installEvents(){this.input.addEventListener(`keydown`,this.onKeyDown),this.input.addEventListener(`keyup`,this.onKeyUp),this.input.addEventListener(`input`,this.onInput),this.input.addEventListener(`compositionstart`,this.onCompositionStart),this.input.addEventListener(`compositionend`,this.onCompositionEnd),this.input.addEventListener(`paste`,this.onPaste),this.input.addEventListener(`copy`,this.onCopy),this.input.addEventListener(`focus`,this.onFocus),this.input.addEventListener(`blur`,this.onBlur),this.canvas.addEventListener(`contextrestored`,this.onContextRestored),window.addEventListener(`focus`,this.onWindowFocus),document.addEventListener(`visibilitychange`,this.onVisibilityChange)}},y4=new Map,b4=new Map,x4=null,S4=0;function C4(e){return Y4().open&&Q4()?.tabId===e&&!document.hidden&&document.hasFocus()}function w4(e){if(C4(e))return!1;let t=Y4();return t.alerts.includes(e)||X4({alerts:[...t.alerts,e]}),!0}function T4(e){if(!w4(e)||b4.has(e))return;let t=y4.get(e);t!==void 0&&performance.now()-t<5e3||b4.set(e,window.setTimeout(()=>{b4.delete(e),!C4(e)&&(y4.set(e,performance.now()),D4(e,``,`Bell`))},500))}function E4(e,t,n){w4(e)&&(window.clearTimeout(b4.get(e)),b4.delete(e),y4.set(e,performance.now()),D4(e,t,n))}function D4(e,t,n){let r=t3(e);r&&vX(t||n3(r),n,{machine:q4(),project:r.projectId??`global`,tabId:e}).catch(e=>console.error(`could not show a notification`,e))}function O4(){let e=performance.now();if(e-S4<150)return;S4=e,x4??=new AudioContext,x4.state===`suspended`&&x4.resume();let t=x4.createOscillator(),n=x4.createGain(),r=x4.currentTime;t.frequency.value=880,n.gain.setValueAtTime(.1,r),n.gain.exponentialRampToValueAtTime(.001,r+.15),t.connect(n).connect(x4.destination),t.start(r),t.stop(r+.15)}function k4(e){return{alerts:Y4().alerts.filter(t=>e(t)&&!C4(t))}}function A4(e){window.clearTimeout(b4.get(e)),b4.delete(e),y4.delete(e)}function j4(e){return e.key===`Enter`&&e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey}function M4(e){let t=new v4(K4(),{onData:t=>{Y4().status===`active`&&l3(e,N4(t))},onReply:t=>{t===`\x1B[I`||t===`\x1B[O`?l3(e,t):u3(e,t)},onResize:(t,n)=>o3({type:`resize`,id:e,cols:t,rows:n}),onTitle:t=>X4({titles:{...Y4().titles,[e]:t}}),onProgress:t=>X4({progress:{...Y4().progress,[e]:t}}),onBell:()=>{let n=Z4().behavior;n.bellSound&&O4(),n.bellFlash&&t.element.isConnected&&!document.hidden&&t.element.animate([{opacity:.4},{opacity:1}],{duration:200,easing:`ease-out`}),T4(e)},onNotify:(t,n)=>E4(e,t,n),onClipboard:XX,onClipboardRead:n=>{C4(e)&&ZX(e=>t.replyClipboard(e,n))},onLink:e=>{e.startsWith(`file:`)?IS(e):window.open(e,`_blank`,`noopener`)},beforeKey:n=>{if(n.type!==`keydown`)return!0;let r=Z4(),i=T9(Z(),q4()).system;if(i===null)throw Error(`the terminal machine is not connected`);let a=i.platform;if(Y4().status===`active`&&r.behavior.modernizeShiftEnter&&j4(n)&&!t.isKittyKeyboard())return n.preventDefault(),t.beforeInput(`\x1B\r`),l3(e,`\x1B\r`),!1;if(Y4().status===`active`&&r.behavior.pasteBrowserImages&&window.isSecureContext&&$X(n,a)){n.preventDefault();let r=QX[a].data;return t.beforeInput(r),eZ(q4(),t).then(t=>{t||l3(e,r)}).catch(t=>{nZ(t),l3(e,r)}),!1}return!v3(n)||(n.preventDefault(),X4({finding:e}),document.querySelector(`[data-find]`)?.select(),!1)}});return t.element.addEventListener(`paste`,e=>{if(!e.clipboardData||e.clipboardData.getData(`text/plain`)!==``)return;let n=[...e.clipboardData.files].filter(e=>e.type.startsWith(`image/`));n.length!==0&&(e.preventDefault(),e.stopPropagation(),tZ(q4(),t,n).catch(nZ))},!0),t}function N4(e){if(!Y4().ctrl||(X4({ctrl:!1}),e.length!==1))return e;let t=e.toUpperCase().charCodeAt(0);return t>=64&&t<=95?String.fromCharCode(t-64):e}function P4(){return{titles:{},progress:{},alerts:[],finding:null}}var F4=new TextEncoder,I4=new Map,L4=new Set,R4=new Set,z4={status:`connecting`,failure:null,loaded:!1,open:!1,instance:null,layout:{tabs:[],active:{}},pageView:va,ctrl:!1,...P4()},B4=null,V4=null,H4=!1;async function U4(){i3(),s9.history.subscribe(i3);try{await Promise.all([X1(),XL(Z4())]),X4({loaded:!0})}catch(e){console.error(`could not start the terminal`,e),X4({failure:s(e)});return}qa({close:e=>{e===V4&&X4({status:`connecting`})},terminal:(e,t)=>{e===V4&&g3(t)},frame:(e,t)=>{e===V4&&h3(t)}}),W4(),s9.history.subscribe(W4),document.addEventListener(`visibilitychange`,()=>X4({})),window.addEventListener(`focus`,()=>{X4({}),B4!==null&&y3(B4,b3(B4))}),window.addEventListener(`blur`,()=>X4({})),`serviceWorker`in navigator&&navigator.serviceWorker.addEventListener(`message`,e=>{e.data.type===`select`&&a3(e.data.machine,e.data.project,e.data.tabId)});let e=Z().prefs,t=G4();yue(()=>{W4();let n=Z().prefs,r=G4(),i=n.theme!==e.theme||n.terminal!==e.terminal||r!==t;e=n,t=r,i&&S3()}),C3()}function W4(){let e=jS()??Z().selection?.machine??null;if(e!==V4&&(V4!==null&&H4&&o3({type:`detach`}),_3([]),L4.clear(),V4=e,H4=!1,X4({status:`connecting`,instance:null,layout:{tabs:[],active:{}},...P4()})),V4===null)return;let t=T9(Z(),V4).status===`online`;t&&!H4&&(H4=!0,o3({type:`attach`})),t||(H4=!1)}function G4(){return V4===null?null:T9(Z(),V4).config?.terminal.behavior.terminalIdentity??null}function K4(){if(V4===null)throw Error(`the terminal has no machine`);let e=T9(Z(),V4);if(e.config===null||e.system===null)throw Error(`${e.name} is not connected`);return ZL(Z4(),e.config.terminal.behavior.terminalIdentity)}function q4(){if(V4===null)throw Error(`the terminal has no machine`);return V4}function J4(e){return R4.add(e),()=>{R4.delete(e)}}function Y4(){return z4}function X4(e){z4={...z4,...e},z4={...z4,...k4(e=>I4.has(e))};for(let e of R4)e()}function Z4(){return Z().prefs.terminal}function Q4(){let e=jS()===null?Z().selection?.projectId:$4();return e===void 0?null:{view:e,tabs:e3(z4.layout,e),tabId:z4.layout.active[e]??null}}function $4(){return e3(z4.layout,z4.pageView).length>0?z4.pageView:va}function e3(e,t){return e.tabs.filter(e=>(e.projectId??`global`)===t)}function t3(e){return z4.layout.tabs.find(t=>t.id===e)}function n3(e){return(e.customName??z4.titles[e.id])||`Terminal`}function r3(e){e?PS({bottom:`terminal`}):LS(`overlay`,()=>PS({bottom:void 0}))}function i3(){let e=AS().bottom===`terminal`||jS()!==null;e!==z4.open&&X4({open:e})}function a3(e,t,n){if(t===`global`)c3(e,va);else{let n=Z().selection;(n?.machine!==e||n.projectId!==t)&&BS({machine:e,projectId:t,sessionId:null}),r3(!0)}s3(e,{type:`select`,view:t,tabId:n})}function o3(e){V4!==null&&s3(V4,e)}function s3(e,t){Ja(e)&&I(e,`terminal`,t).catch(e=>console.error(`terminal request failed`,e))}function c3(e,t){X4({pageView:t}),WS(e)}function l3(e,t){V4!==null&&Xa(V4,0,e,typeof t==`string`?F4.encode(t):t)}function u3(e,t){V4!==null&&Xa(V4,1,e,F4.encode(t))}function d3(e,t,n,r){b3(e).find(t,n,r)}function f3(e,t){return b3(e).onFindResults(t)}function p3(e){let t=b3(e);t.clearFind(),X4({finding:null}),t.focus()}function m3(){X4({ctrl:!z4.ctrl})}function h3(e){let t=I4.get(e.id);if(!t)return;let n=e.kind===3,r=n&&L4.delete(e.id);r&&t.reset(),t.write(e.data,n),r&&L4.size===0&&X4({status:`active`})}function g3(e){let t=e.type===`active`&&e.instance!==z4.instance;if(t&&_3([]),_3(e.layout.tabs),e.type===`active`){L4.clear(),I4.forEach((e,t)=>{L4.add(t),e.element.isConnected&&y3(t,e)}),X4({...t&&{instance:e.instance,...P4()},status:L4.size===0?`active`:`connecting`,layout:e.layout});return}for(let e of L4)I4.has(e)||L4.delete(e);let n=Z().selection?.projectId,r=n!==void 0&&e3(z4.layout,n).length>0&&e3(e.layout,n).length===0;X4({status:L4.size===0?`active`:`connecting`,layout:e.layout}),r&&z4.open&&r3(!1)}function _3(e){let t=new Set(e.map(e=>e.id));I4.forEach((e,n)=>{t.has(n)||(e.dispose(),I4.delete(n),A4(n))});for(let e of t)I4.has(e)||I4.set(e,M4(e))}function v3(e){return e.key.toLowerCase()===`f`?a?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey:!1}function y3(e,t){o3({type:`resize`,id:e,cols:t.cols,rows:t.rows})}function b3(e){let t=I4.get(e);if(!t)throw Error(`terminal ${e} does not exist`);return t}function x3(e,t){let n=b3(e);t.append(n.element),n.fit();for(let e of I4.values())e.presize(n.cols,n.rows);return B4=e,y3(e,n),n.focus(),()=>{n.element.remove(),B4===e&&(B4=null)}}async function S3(){if(await XL(Z4()),I4.size>0){let e=K4();for(let t of I4.values())t.setOptions(e)}X4({})}function C3(){let e=AS(),t=jS(),n=t??e.machine,r=t===null?e.project:va,i=e.terminal;if(n===void 0||r===void 0||i===void 0)return;PS({terminal:void 0});let a=J4(()=>{z4.status===`active`&&V4===n&&(a(),a3(n,r,Number(i)))})}var w3=null,T3=new Set,E3=new Set;function Vae(e){return E3.add(e),()=>{E3.delete(e)}}function Hae(){return w3}function Uae(){w3!==null&&D3({open:!1,closing:w3.closing})}function D3(e){w3=e;for(let e of E3)e()}function Wae(){return document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`)!==null}async function Gae(e){try{let t=await Promise.race([I(q4(),`terminal.busy`,{id:e}),new Promise((e,t)=>window.setTimeout(()=>t(Error(`timed out`)),5e3))]);return`error`in t?(console.error(`could not check whether tab ${e} is running a program`,t.error),{checked:!1}):{checked:!0,program:t.program}}catch(e){return console.error(`could not check whether a program is running`,e),{checked:!1}}}async function O3(e){if(!Z4().behavior.confirmCloseBusyTab){o3({type:`closeTab`,id:e});return}if(!t3(e)||T3.has(e))return;T3.add(e);let t=await Gae(e);if(T3.delete(e),t.checked&&t.program===null){o3({type:`closeTab`,id:e});return}let n=t3(e);n&&!Wae()&&D3({open:!0,closing:{id:e,name:n3(n),program:t.checked?t.program:null}})}var k3=a?`meta+t`:`ctrl+shift+t`,A3=a?`meta+w`:`ctrl+shift+w`,j3=`ctrl+tab`,M3=`ctrl+shift+tab`;function Kae(){let e=Q4()?.tabId??null;Y4().open&&e!==null&&b3(e).focus()}function qae(){return kg([k3,A3,j3,M3],(e,t)=>{e.preventDefault(),e.stopPropagation();let n=Q4();if(n===null)return;if(t.hotkey===k3){o3({type:`createTab`,projectId:n.view===`global`?null:n.view});return}if(n.tabId===null)return;if(t.hotkey===A3){O3(n.tabId);return}let r;if(t.hotkey===j3)r=1;else if(t.hotkey===M3)r=-1;else throw Error(`unknown terminal shortcut ${t.hotkey}`);let i=n.tabs,a=i[(i.findIndex(e=>e.id===n.tabId)+r+i.length)%i.length];a&&o3({type:`select`,view:n.view,tabId:a.id})},{enabled:()=>Z4().behavior.captureShortcuts,enableOnFormTags:!0,eventListenerOptions:{capture:!0}})}function Jae(e){let[t,n]=(0,P.useState)(e.name);return(0,F.jsx)(Xe,{open:!0,onOpenChange:t=>{t||e.onDone()},children:(0,F.jsx)(Je,{onCloseAutoFocus:N3,children:(0,F.jsxs)(`form`,{className:`grid gap-4`,onSubmit:n=>{n.preventDefault(),o3({type:`renameTab`,id:e.id,name:t.trim()}),e.onDone()},children:[(0,F.jsx)(Ke,{children:(0,F.jsx)(Ye,{children:`Rename tab`})}),(0,F.jsx)(cL,{"aria-label":`Name`,placeholder:`Use terminal title`,value:t,onChange:e=>n(e.target.value)}),(0,F.jsxs)(Fe,{children:[(0,F.jsx)(E,{type:`button`,variant:`outline`,onClick:e.onDone,children:`Cancel`}),(0,F.jsx)(E,{type:`submit`,children:`Rename`})]})]})})})}function Yae(){let e=(0,P.useSyncExternalStore)(Vae,Hae),t=(0,P.useRef)(null);if(e===null)return null;let n=e.closing;return(0,F.jsx)(kL,{open:e.open,onOpenChange:e=>{e||Uae()},children:(0,F.jsxs)(NL,{onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},onCloseAutoFocus:N3,children:[(0,F.jsxs)(PL,{children:[(0,F.jsxs)(IL,{children:[`Close “`,n.name,`”?`]}),(0,F.jsx)(LL,{children:n.program===null?`OffSite couldn’t check whether a program is still running.`:`${n.program} is still running.`})]}),(0,F.jsxs)(FL,{children:[(0,F.jsx)(zL,{children:`Cancel`}),(0,F.jsx)(RL,{ref:t,variant:`destructive`,onClick:()=>o3({type:`closeTab`,id:n.id}),children:`Close`})]})]})})}function N3(e){e.preventDefault();let t=document.querySelector(`[role="dialog"], [role="alertdialog"]`);t===null?Kae():t.focus()}function Xae(e){let t=(0,P.useRef)(null),[n,r]=(0,P.useState)(``),[i,a]=(0,P.useState)({resultIndex:-1,resultCount:0});(0,P.useEffect)(()=>f3(e.id,a),[e.id]),(0,P.useEffect)(()=>t.current?.focus(),[]);function o(t,n,i){r(t),d3(e.id,t,n,i)}return(0,F.jsxs)(`div`,{className:`bg-card absolute top-2 right-4 z-10 flex items-center gap-1 rounded-lg border p-1 shadow-lg`,children:[(0,F.jsx)(cL,{ref:t,"data-find":!0,className:`h-7 w-52`,placeholder:`Find`,value:n,onChange:e=>o(e.target.value,!1,!0),onKeyDown:t=>{t.key===`Escape`?(t.preventDefault(),p3(e.id)):t.key===`Enter`?(t.preventDefault(),o(n,t.shiftKey,!1)):v3(t.nativeEvent)&&(t.preventDefault(),t.currentTarget.select())}}),(0,F.jsx)(`span`,{className:`text-muted-foreground w-16 text-center text-xs tabular-nums`,children:n===``?``:i.resultCount===0?`No results`:`${i.resultIndex+1} of ${i.resultCount}`}),(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Previous match`,onClick:()=>o(n,!0,!1),children:(0,F.jsx)(k,{icon:Yte})}),(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Next match`,onClick:()=>o(n,!1,!1),children:(0,F.jsx)(k,{icon:gm})}),(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close find`,onClick:()=>p3(e.id),children:(0,F.jsx)(k,{icon:xm})})]})}var Zae=[{label:`Esc`,sequence:`\x1B`},{label:`Tab`,sequence:` `},{label:`↑`,sequence:`\x1B[A`},{label:`↓`,sequence:`\x1B[B`},{label:`←`,sequence:`\x1B[D`},{label:`→`,sequence:`\x1B[C`}];function P3(e){let t=(0,P.useSyncExternalStore)(J4,Y4),n=t.status===`active`,r=e3(t.layout,e.view),i=t.layout.active[e.view]??null,a=qae();(0,P.useEffect)(()=>{n&&o3({type:`select`,view:e.view,tabId:null})},[e.view,n]);function o(){o3({type:`createTab`,projectId:e.view===`global`?null:e.view})}return t.loaded?(0,F.jsxs)(`div`,{ref:a,className:`flex h-full flex-col text-sm`,children:[(0,F.jsxs)(`header`,{className:l(`flex h-9 flex-none select-none`,e.tabSize===`lg`&&`h-(--workspace-topbar-height)`,r.length===1?`bg-background`:`bg-sidebar`),children:[e.leading!==void 0&&(0,F.jsx)(`div`,{className:l(`flex flex-none items-center gap-2 px-1.5`,r.length>1&&`border-r border-b`),children:e.leading}),(0,F.jsx)(`div`,{className:`flex min-w-0 flex-1 [scrollbar-width:none] overflow-x-auto`,children:r.map(n=>(0,F.jsx)($ae,{tab:n,children:(0,F.jsxs)(`div`,{className:l(`group/tab text-muted-foreground hover:text-foreground relative flex min-w-28 flex-1 items-center justify-center border-r border-b px-7 text-xs transition-colors last:border-r-0`,e.tabSize===`lg`&&`text-[13px]`,n.id===i&&`bg-background text-foreground border-b-transparent`),onMouseDown:e=>e.preventDefault(),onClick:()=>o3({type:`select`,view:e.view,tabId:n.id}),children:[(0,F.jsx)(`span`,{className:`truncate`,children:n3(n)}),(0,F.jsx)(eoe,{id:n.id,className:`ml-1.5 size-1.5 flex-none rounded-full`}),(0,F.jsx)(toe,{progress:t.progress[n.id]}),(0,F.jsx)(`button`,{className:l(`text-muted-foreground hover:bg-accent hover:text-foreground absolute left-1.5 grid size-4.5 place-items-center rounded opacity-0 transition-opacity group-hover/tab:opacity-100`,n.id===i&&`pointer-coarse:opacity-100`),"aria-label":`Close tab`,onClick:e=>{e.stopPropagation(),O3(n.id)},children:(0,F.jsx)(k,{icon:xm,className:`size-3`})})]})},n.id))}),(0,F.jsx)(`button`,{className:l(`text-muted-foreground hover:text-foreground grid w-8 flex-none place-items-center transition-colors`,r.length>1&&`border-b border-l`),"aria-label":`New tab`,title:`New tab`,onClick:o,children:(0,F.jsx)(k,{icon:lm,className:`size-4`})})]}),(0,F.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[i!==null&&(0,F.jsx)(Qae,{id:i},`${t.instance}-${i}`),i!==null&&t.finding===i&&(0,F.jsx)(Xae,{id:i},i),n&&i===null&&(0,F.jsx)(`button`,{className:`text-muted-foreground hover:text-foreground grid size-full cursor-pointer place-items-center text-xs transition-colors`,onClick:o,children:`New terminal`}),!n&&(0,F.jsx)(`div`,{className:`bg-background/80 animate-in fade-in absolute inset-0 z-20 grid place-items-center p-6 text-center backdrop-blur-md duration-200`,children:(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,F.jsx)(`span`,{className:`border-foreground/15 border-t-foreground/70 size-6 animate-spin rounded-full border-[3px]`}),(0,F.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Connecting. Your terminals keep running while you wait.`})]})})]}),i!==null&&(0,F.jsxs)(`div`,{className:`bg-card hidden flex-none gap-1.5 overflow-x-auto border-t p-1.5 pointer-coarse:flex`,children:[Zae.map(e=>(0,F.jsx)(E,{variant:`secondary`,className:`min-w-11`,onPointerDown:e=>e.preventDefault(),onClick:()=>l3(i,e.sequence),children:e.label},e.label)),(0,F.jsx)(E,{variant:t.ctrl?`default`:`secondary`,className:`min-w-11`,onPointerDown:e=>e.preventDefault(),onClick:m3,children:`Ctrl`})]}),(0,F.jsx)(Yae,{})]}):(0,F.jsx)(`div`,{className:`text-muted-foreground grid h-full place-items-center p-4 text-xs whitespace-pre-wrap`,children:t.failure===null?`Starting the terminal…`:`The terminal could not start: ${t.failure}`})}function Qae(e){let t=(0,P.useRef)(null);return(0,P.useEffect)(()=>{if(!t.current)throw Error(`terminal container missing`);return x3(e.id,t.current)},[e.id]),(0,F.jsx)(`div`,{className:`bg-background absolute inset-0 pt-(--pad-top) pr-(--pad-right) pb-(--pad-bottom) pl-(--pad-left)`,ref:t})}function $ae(e){let[t,n]=(0,P.useState)(!1),r=Q(e=>e.projects).filter(e=>e.machine===q4()),i=e.tab;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(SZ,{children:[(0,F.jsx)(CZ,{asChild:!0,children:e.children}),(0,F.jsxs)(EZ,{children:[(0,F.jsxs)(DZ,{onSelect:()=>n(!0),children:[(0,F.jsx)(k,{icon:yh}),`Rename`]}),(0,F.jsxs)(wZ,{children:[(0,F.jsxs)(OZ,{children:[(0,F.jsx)(k,{icon:Fm}),`Move to`]}),(0,F.jsx)(kZ,{className:`max-h-80 overflow-y-auto`,children:(0,F.jsxs)(TZ,{value:i.projectId??``,onValueChange:e=>o3({type:`assignTab`,id:i.id,projectId:e===``?null:e}),children:[(0,F.jsx)(AZ,{value:``,children:`No project`}),r.length>0&&(0,F.jsx)(jZ,{}),r.map(e=>(0,F.jsx)(AZ,{value:e.id,children:(0,F.jsx)(`span`,{className:`max-w-60 truncate`,children:e.name})},e.id))]})})]}),(0,F.jsxs)(DZ,{variant:`destructive`,onSelect:()=>void O3(i.id),children:[(0,F.jsx)(k,{icon:Nm}),`Close tab`]})]})]}),t&&(0,F.jsx)(Jae,{id:i.id,name:i.customName??``,onDone:()=>n(!1)})]})}function eoe(e){return Y4().alerts.includes(e.id)?(0,F.jsx)(`span`,{className:l(`bg-primary`,e.className)}):null}function toe(e){let t=e.progress;return!t||t.state===0?null:t.state===3?(0,F.jsx)(`span`,{className:`bg-primary absolute inset-x-0 bottom-0 h-0.5 animate-pulse`}):(0,F.jsx)(`span`,{className:l(`absolute bottom-0 left-0 h-0.5 transition-[width]`,t.state===1&&`bg-primary`,t.state===2&&`bg-destructive`,t.state===4&&`bg-yellow-500`),style:{width:`${t.state!==1&&t.value===0?100:t.value}%`}})}function F3(e){let t=(0,P.useSyncExternalStore)(J4,Y4),n=Q(e=>e.machines),r=Q(e=>e.projects),i=n.filter(e=>e.status===`online`),a=$4(),o=n.flatMap(e=>{let t=e.status===`online`?e.terminals:[],n=[...new Set(t.flatMap(e=>e.projectId===null?[]:[e.projectId]))];return[{machine:e,view:va,name:e.name,count:t.filter(e=>e.projectId===null).length},...n.map(n=>({machine:e,view:n,name:r.find(t=>t.machine===e.id&&t.id===n)?.name??`Removed project`,count:t.filter(e=>e.projectId===n).length}))]}),s=o.find(t=>t.machine.id===e.machine&&t.view===a);(0,P.useEffect)(()=>{localStorage.setItem(`lastTerminal`,e.machine)},[e.machine]);function c(e,t){s3(e,{type:`createTab`,projectId:t}),c3(e,t??`global`)}function u(n){return n.machine.id===e.machine&&t.layout.tabs.some(e=>(e.projectId??`global`)===n.view&&t.alerts.includes(e.id))}let d=(0,F.jsxs)(mS,{children:[(0,F.jsx)(gS,{asChild:!0,disabled:i.length===0,children:(0,F.jsx)(`button`,{className:`text-muted-foreground enabled:hover:text-foreground grid size-7 flex-none place-items-center rounded-md transition-colors`,"aria-label":`New terminal`,title:`New terminal`,children:(0,F.jsx)(k,{icon:lm,className:`size-4`})})}),(0,F.jsx)(_S,{align:`start`,className:`w-auto min-w-56`,children:i.flatMap(e=>[(0,F.jsxs)(vS,{onSelect:()=>c(e.id,null),children:[(0,F.jsx)(k,{icon:Wg[e.icon]}),(0,F.jsx)(`span`,{className:`max-w-60 truncate`,children:e.name})]},e.id),...r.filter(t=>t.machine===e.id).map(t=>(0,F.jsxs)(vS,{className:`pl-7`,onSelect:()=>c(e.id,t.id),children:[(0,F.jsx)(Kg,{machine:e.id,projectId:t.id,className:`size-4`}),(0,F.jsx)(`span`,{className:`max-w-60 truncate`,children:t.name})]},`${e.id}:${t.id}`))])})]});return e.mobile?(0,F.jsx)(`main`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,F.jsx)(P3,{view:a,tabSize:`lg`,leading:(0,F.jsxs)(F.Fragment,{children:[e.leading,(0,F.jsxs)(mS,{children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsxs)(`button`,{className:`text-muted-foreground hover:text-foreground flex max-w-48 min-w-0 items-center gap-1.5 px-1 text-[13px]`,children:[s!==void 0&&(0,F.jsx)(I3,{group:s}),(0,F.jsx)(`span`,{className:`truncate`,children:s?.name}),(0,F.jsx)(k,{icon:Cm,className:`size-3 shrink-0`})]})}),(0,F.jsx)(_S,{align:`start`,className:`w-auto`,children:o.map(e=>(0,F.jsxs)(vS,{className:l(e.view!==`global`&&`pl-7`),onSelect:()=>c3(e.machine.id,e.view),children:[(0,F.jsx)(I3,{group:e}),(0,F.jsx)(`span`,{className:`max-w-60 truncate`,children:e.name}),(0,F.jsx)(L3,{count:e.count,alert:u(e)})]},`${e.machine.id}:${e.view}`))})]}),d]})})}):(0,F.jsxs)(`main`,{className:`bg-background flex min-w-0 flex-1 overflow-hidden`,children:[(0,F.jsxs)(`nav`,{className:`bg-sidebar flex w-56 flex-none flex-col border-r`,children:[(0,F.jsxs)(`div`,{className:`flex h-(--workspace-topbar-height) flex-none items-center gap-1 px-1.5`,children:[e.leading,(0,F.jsx)(`span`,{className:`text-muted-foreground min-w-0 flex-1 truncate px-1.5 text-[13px]`,children:`Terminals`}),d]}),(0,F.jsx)(`div`,{className:`flex flex-col gap-0.5 overflow-y-auto p-1.5`,children:o.map(e=>(0,F.jsxs)(`button`,{className:l(`text-muted-foreground hover:bg-accent/60 hover:text-foreground flex h-8 items-center gap-2 rounded-md px-2 text-left text-[13px] transition-colors`,e.view!==`global`&&`pl-7`,e===s&&`bg-accent text-foreground`),onClick:()=>c3(e.machine.id,e.view),children:[(0,F.jsx)(I3,{group:e}),(0,F.jsx)(`span`,{className:`truncate`,children:e.name}),(0,F.jsx)(L3,{count:e.count,alert:u(e)})]},`${e.machine.id}:${e.view}`))})]}),(0,F.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,F.jsx)(P3,{view:a,tabSize:`lg`})})]})}function I3(e){return e.group.view===`global`?(0,F.jsx)(k,{icon:Wg[e.group.machine.icon],className:`size-4 shrink-0`}):(0,F.jsx)(Kg,{machine:e.group.machine.id,projectId:e.group.view,className:`size-4 shrink-0`})}function L3(e){return e.count===0?null:(0,F.jsx)(`span`,{className:l(`ml-auto grid h-4 min-w-4 shrink-0 place-items-center rounded-full px-1 text-[10px] leading-none font-medium tabular-nums`,e.alert?`bg-primary text-primary-foreground`:`text-foreground bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))]`),children:e.count})}var R3={running:`Running`,completed:`Done`,failed:`Failed`,stopped:`Stopped`};function z3(e,t){return{agents:e.flatMap(e=>e.kind===`subagent`?[{item:e,agentId:e.agentId,status:V3(e.status,e.agentId,t)}]:[]),tasks:e.flatMap(e=>e.kind===`command`&&e.background!==null?[{item:e,taskId:e.background.taskId,path:e.background.outputPath,events:e.background.events,status:V3(e.status,e.background.taskId,t)}]:[])}}function B3(e){return e.description===``?e.command:e.description}function V3(e,t,n){let r=t===null?void 0:n?.tasks[t];return r===void 0?e===`running`?t===null&&n?.running===!0?`Running`:`Stopped`:R3[e]:R3[r]}function H3(e){return(0,F.jsx)(`span`,{className:l(e.active&&`text-shimmer`),children:e.text})}function noe(e){return(0,F.jsxs)(`span`,{className:l(`flex min-w-0 items-baseline overflow-hidden text-[13px] leading-4 tracking-[-0.04px]`,e.grouped?`gap-1.5`:`gap-2`),children:[(0,F.jsx)(`span`,{className:l(`text-foreground shrink-0`,e.grouped?`font-normal`:`font-medium`),children:(0,F.jsx)(H3,{text:e.title,active:e.pending})}),e.subtitle!==void 0&&e.subtitle!==``&&(0,F.jsx)(`span`,{className:l(`min-w-0 truncate tabular-nums`,e.grouped?`text-muted-foreground/70`:`text-muted-foreground`),children:e.subtitle}),e.args?.map(t=>(0,F.jsx)(`span`,{className:l(`min-w-0 truncate tabular-nums`,e.grouped?`text-muted-foreground/70`:`text-muted-foreground`),children:t},t))]})}function U3(e){return(0,F.jsx)(`span`,{"aria-hidden":!0,className:l(`text-muted-foreground/70 flex size-6 shrink-0 items-center justify-center transition-opacity`,e.open?`opacity-100`:`opacity-0 group-hover/tool:opacity-100`,e.className),children:(0,F.jsx)(k,{icon:gm,strokeWidth:2.5,className:l(`size-3.5 transition-transform`,!e.open&&`-rotate-90`)})})}function W3(e){let t=e.onToggle,n=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`flex max-w-[calc(100%-24px)] min-w-0 items-center`,children:(0,F.jsx)(noe,{title:e.title,subtitle:e.subtitle,args:e.args,pending:e.pending,grouped:e.grouped})}),t!==null&&(0,F.jsx)(U3,{open:e.open})]});return(0,F.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col`,children:[t===null?(0,F.jsx)(`div`,{className:l(`flex w-full items-center select-none`,e.grouped?`min-h-7`:`min-h-9`),children:n}):(0,F.jsx)(`button`,{type:`button`,"aria-expanded":e.open,onClick:t,className:l(`group/tool focus-visible:ring-ring/70 flex w-full cursor-pointer items-center rounded-md text-left select-none focus-visible:ring-2 focus-visible:outline-none`,e.grouped?`h-7`:`h-9`),children:n}),e.open&&e.children!==void 0&&(0,F.jsx)(`div`,{className:l(`min-w-0 pt-1`,e.rail!==!1&&`ps-3`),children:e.children})]})}var roe=new Map([[`build`,`text-blue-400`],[`explore`,`text-yellow-400`],[`plan`,`text-pink-400`],[`review`,`text-green-400`],[`writer`,`text-purple-400`]]),ioe=new Map([[`Running`,`Launched agent`],[`Done`,`Agent finished`],[`Failed`,`Agent failed`],[`Stopped`,`Agent stopped`]]),aoe=new Map([[`Running`,`Started in background`],[`Done`,`Background task finished`],[`Failed`,`Background task failed`],[`Stopped`,`Background task stopped`]]),G3=[`text-sky-400`,`text-amber-400`,`text-fuchsia-400`,`text-emerald-400`,`text-violet-400`,`text-cyan-400`,`text-orange-400`,`text-teal-400`,`text-rose-400`,`text-indigo-400`,`text-lime-400`,`text-red-400`];function K3(e){let t=e.agent,n=t.toLowerCase(),r=0;for(let e of n)r=r*31+e.charCodeAt(0)>>>0;return{name:t[0].toUpperCase()+t.slice(1),description:e.description,tone:roe.get(n)??G3[r%G3.length]}}function q3(e){return(0,F.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,className:l(`size-4 shrink-0`,e.className),children:[(0,F.jsx)(`path`,{d:`M4 4.5C4 4.22386 4.22386 4 4.5 4H11.5C11.7761 4 12 4.22386 12 4.5V11.5C12 11.7761 11.7761 12 11.5 12H4.5C4.22386 12 4 11.7761 4 11.5V4.5Z`,fill:`currentColor`}),(0,F.jsx)(`path`,{d:`M14.5 1C14.7761 1 15 1.22386 15 1.5V14.5C15 14.7761 14.7761 15 14.5 15H1.5C1.22386 15 1 14.7761 1 14.5V1.5C1 1.22386 1.22386 1 1.5 1H14.5ZM2 14H14V2H2V14Z`,fill:`currentColor`})]})}function J3(e){return(0,F.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":!0,className:l(`size-4 shrink-0`,e.className),children:Array.from({length:25},(e,t)=>(0,F.jsx)(`rect`,{x:1+t%5*3,y:1+Math.floor(t/5)*3,width:2,height:2,fill:`currentColor`,className:`agent-dot`,style:{animationDelay:`${(t%5+Math.floor(t/5))*90}ms`}},t))})}function ooe(e){let t=e.item;if(t.kind===`agent_message`){let n=t.target;return(0,F.jsx)(Y3,{label:`Messaged agent`,detail:t.summary,pending:e.sending,onOpen:n===null?null:()=>e.onOpen(n)})}if(t.kind===`command`){let n=e.tasks.find(e=>e.item.id===t.id);if(n===void 0)throw Error(`Task ${t.id} is missing from the thread`);return(0,F.jsx)(Y3,{label:aoe.get(n.status)??`Background task ${n.status.toLowerCase()}`,detail:B3(n.item),pending:n.status===`Running`,onOpen:()=>e.onOpen(t.id)})}let n=e.agents.find(e=>e.item.id===t.id);if(n===void 0)throw Error(`Agent ${t.id} is missing from the thread`);return(0,F.jsx)(Y3,{label:ioe.get(n.status)??`Agent ${n.status.toLowerCase()}`,detail:t.description,pending:n.status===`Running`,onOpen:()=>e.onOpen(t.id)})}function Y3(e){let t=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:(0,F.jsx)(H3,{text:e.detail===``?e.label:`${e.label}:`,active:e.pending})}),e.detail!==``&&(0,F.jsx)(`span`,{className:`text-foreground min-w-0 truncate`,children:e.detail})]});return e.onOpen===null?(0,F.jsx)(`div`,{className:`flex min-h-7 min-w-0 items-center gap-1 text-[13px] leading-4 tracking-[-0.04px] select-none`,children:t}):(0,F.jsxs)(`button`,{type:`button`,title:`Open in Tasks panel`,onClick:e.onOpen,className:`group/agent focus-visible:ring-ring/70 flex min-h-7 w-fit max-w-full cursor-pointer items-center gap-1 rounded-md text-left text-[13px] leading-4 tracking-[-0.04px] select-none focus-visible:ring-2 focus-visible:outline-none`,children:[t,(0,F.jsx)(`span`,{className:`text-muted-foreground/70 flex shrink-0 opacity-0 transition-opacity group-hover/agent:opacity-100 group-focus-visible/agent:opacity-100 pointer-coarse:opacity-100`,children:(0,F.jsx)(k,{icon:ym,className:`size-3.5`})})]})}function soe(e){let[t,n]=(0,P.useState)(!1),r=YP(),i=e.plan,a=X3(i),o=i.length>900||i.split(`
109
- `).length>20,s=o&&!t,c=`${i.trimEnd()}\n`;return(0,F.jsxs)(`div`,{className:`border-border/80 bg-card/70 rounded-3xl border p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`bg-secondary text-secondary-foreground relative inline-flex h-5.5 min-w-5.5 shrink-0 items-center justify-center gap-1 rounded-sm border border-transparent px-[calc(--spacing(1)-1px)] text-sm font-medium whitespace-nowrap sm:h-4.5 sm:min-w-4.5 sm:text-xs`,children:`Plan`}),(0,F.jsx)(`h3`,{className:`text-foreground truncate text-sm font-medium`,children:a??`Proposed plan`})]}),(0,F.jsxs)(mS,{children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(E,{"aria-label":`Plan actions`,size:`icon-xs`,variant:`outline`,children:(0,F.jsx)(k,{icon:fh,className:`size-4`})})}),(0,F.jsxs)(_S,{align:`end`,children:[(0,F.jsx)(vS,{onSelect:e=>{e.preventDefault(),r.copy(c)},children:r.copied?`Copied!`:`Copy to clipboard`}),(0,F.jsx)(vS,{onSelect:()=>{let e=URL.createObjectURL(new Blob([c],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=`${loe(a??`plan`)}.md`,t.click(),setTimeout(()=>URL.revokeObjectURL(e),0)},children:`Download as markdown`})]})]})]}),(0,F.jsxs)(`div`,{className:`mt-4`,children:[(0,F.jsxs)(`div`,{className:l(`relative`,s&&`max-h-104 overflow-hidden`),children:[(0,F.jsx)(TF,{text:s?coe(i):Z3(i)}),s&&(0,F.jsx)(`div`,{className:`from-card/95 via-card/80 pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t to-transparent`})]}),o&&(0,F.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,F.jsx)(E,{size:`sm`,variant:`outline`,onClick:()=>n(!t),children:t?`Collapse plan`:`Expand plan`})})]})]})}function X3(e){let t=/^\s{0,3}#{1,6}\s+(.+)$/m.exec(e)?.[1]?.trim();return t===void 0||t===``?null:t}function Z3(e){let t=e.trimEnd().split(/\r?\n/),n=/^\s{0,3}#{1,6}\s+/.test(t[0]??``)?t.slice(1):t;for(;n[0]?.trim()===``;)n.shift();if(/^\s{0,3}#{1,6}\s+(.+)$/.exec(n[0]??``)?.[1]?.trim().toLowerCase()===`summary`)for(n.shift();n[0]?.trim()===``;)n.shift();return n.join(`
110
- `)}function coe(e){let t=Z3(e).trimEnd().split(/\r?\n/).map(e=>e.trimEnd()),n=[],r=0,i=!1;for(let e of t){let t=e.trim()!==``;if(t&&r>=10){i=!0;break}n.push(e),t&&(r+=1)}for(;n.length>0&&n.at(-1)?.trim()===``;)n.pop();return n.length===0?X3(e)??`Plan preview unavailable.`:(i&&n.push(``,`...`),n.join(`
111
- `))}function loe(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return t===``?`plan`:t}function uoe(e){let t=e.item.answers;return(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 text-sm leading-6 select-text`,children:[e.item.questions.map(e=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`text-foreground font-medium`,children:e.question}),(0,F.jsx)(`ul`,{className:`text-secondary-label list-disc pl-5`,children:e.options.map(e=>(0,F.jsxs)(`li`,{children:[e.label,e.description!==``&&` — ${e.description}`]},e.label))}),t?.[e.question]!==void 0&&(0,F.jsxs)(`p`,{className:`text-foreground whitespace-pre-wrap`,children:[`Answer: `,t[e.question]]})]},e.question)),e.item.status===`failed`&&(0,F.jsx)(`p`,{className:`text-muted-foreground`,children:`Skipped`})]})}function Q3(e){return e.kind===`group`||e.kind===`agent`}function $3(e,t){let n=[],r=e.prompt?.id??`start`;e.prompt!==null&&n.push({kind:`user`,key:e.prompt.id,item:e.prompt,first:e.first});for(let r of e.items){let e=doe(r,t!==null),i=n.at(-1);e?.kind===`group`&&i?.kind===`group`?i.entries.push(...e.entries):e!==null&&n.push(e)}let i=n.at(-1);return t!==null&&t.partial===``&&i?.kind===`group`&&(n[n.length-1]={...i,live:!0}),t!==null&&t.partial!==``&&n.push({kind:`assistant`,key:`${r}:partial`,message:``,text:t.partial,time:null,streaming:!0,meta:!1}),t!==null&&t.partial===``&&n.push({kind:`working`,key:`${r}:working`}),t===null&&i?.kind===`assistant`&&(n[n.length-1]={...i,meta:!0}),n}function doe(e,t){switch(e.kind){case`assistant`:return{kind:`assistant`,key:e.id,message:e.message,text:e.text,time:e.time,streaming:!1,meta:!1};case`reasoning`:case`file_change`:case`web_search`:case`skill`:case`tool`:return{kind:`group`,key:`group:${e.id}`,entries:[e],live:!1};case`command`:return e.background===null?{kind:`group`,key:`group:${e.id}`,entries:[e],live:!1}:{kind:`agent`,key:e.id,item:e,live:t};case`subagent`:case`agent_message`:return{kind:`agent`,key:e.id,item:e,live:t};case`plan`:return{kind:`plan`,key:e.id,plan:e.plan};case`question`:return{kind:`question`,key:e.id,item:e};case`notice`:return{kind:`notice`,key:e.id,text:e.text};case`compaction`:return{kind:`notice`,key:e.id,text:`Conversation compacted`};case`error`:return{kind:`error`,key:e.id,text:e.text,time:e.time};case`user`:case`todo_list`:return null}}function e6(e,t,n){let r=[],i=!1;for(let t of e)t.parent===null&&(t.kind===`user`?r.push({prompt:t,first:!i,items:[]}):(t.kind!==`notice`&&t.kind!==`error`&&t.kind!==`compaction`&&(i=!0),r.length===0&&r.push({prompt:null,first:!0,items:[]}),r[r.length-1].items.push(t)));let a=r.flatMap((e,i)=>$3(e,t&&i===r.length-1?{partial:n}:null));return t&&r.length===0&&a.push({kind:`working`,key:`working`}),a}var t6={all:{label:`Restore code and chat`,description:`This will undo file changes made since this message and remove this message and everything after it from the chat.`,icon:Jte,code:!0,conversation:!0},chat:{label:`Restore chat`,description:`This will remove this message and everything after it from the chat. Files will not change.`,icon:$te,code:!1,conversation:!0},code:{label:`Restore code`,description:`This will undo file changes made since this message. The chat will not change.`,icon:Rh,code:!0,conversation:!1}};function foe(e){if(e===`claude`)return[`all`,`chat`,`code`];if(e===`opencode`)return[`all`,`chat`];if(e===`codex`)return[`chat`];throw Error(`unknown provider ${e}`)}function poe(e){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(null),f=e.target,p=f.messageId,m=Q(e=>e.selection),h=Q(e=>e.settings.provider),g=foe(h),_=Q(e=>e.prefs.rewind),v=g.includes(_)?_:`chat`,y=m?.machine??null,b=m?.sessionId??null,x=m?.projectId??``,S=Q(e=>y===null?``:E9(e,y,x)?.path??``);(0,P.useEffect)(()=>{if(i(null),o(null),!t||y===null||b===null)return;let e=!0;return I(y,`sessions.rewind`,{sessionId:b,projectId:x,messageId:p,settings:Z().settings,code:!0,conversation:!1,dryRun:!0}).then(t=>{e&&i(t)},t=>{e&&o(s(t))}),()=>{e=!1}},[t,p,y,b,x]);async function C(e){if(y===null||b===null)return;let{code:t,conversation:r}=t6[e];l(!0);try{let i=r?await Promise.all(f.images.map((e,t)=>e.data===null?I(y,`sessions.image`,{sessionId:b,itemId:f.messageId,index:t}):{mediaType:e.mediaType,data:e.data})):[],a=r&&(!f.first||h===`opencode`);(t||a)&&await I(y,`sessions.rewind`,{sessionId:b,projectId:x,messageId:f.messageId,settings:Z().settings,code:t,conversation:a,dryRun:!1}),r&&f.first&&h!==`opencode`&&BS({machine:y,projectId:x,sessionId:null}),r&&N9({text:f.text,images:i}),L9({...Z().prefs,rewind:e}),n(!1)}catch(e){R9(e)}finally{l(!1)}}let w=r!==null&&a===null;return(0,F.jsxs)(F.Fragment,{children:[g.length>1&&(0,F.jsxs)(mS,{open:t,onOpenChange:e=>{c||n(e)},children:[(0,F.jsx)(je,{label:`Restore options`,children:(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(E,{type:`button`,size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Restore options`,disabled:e.disabled,children:(0,F.jsx)(k,{icon:fh,className:`size-3.5`})})})}),(0,F.jsxs)(_S,{align:`end`,className:`w-72`,children:[(0,F.jsxs)(`div`,{className:`text-muted-foreground px-2 py-1.5 text-xs`,children:[a!==null&&`Code can't be restored: ${a}`,a===null&&r===null&&`Checking file changes…`,r!==null&&r.files.length===0&&`No file changes since this message.`,r!==null&&r.files.length>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{children:[`Restores `,r.files.length,` `,r.files.length===1?`file`:`files`,` (`,(0,F.jsxs)(`span`,{className:`text-diff-addition`,children:[`+`,r.insertions]}),` `,(0,F.jsxs)(`span`,{className:`text-diff-deletion`,children:[`−`,r.deletions]}),`)`]}),(0,F.jsx)(`ul`,{className:`mt-1 max-h-24 overflow-y-auto font-mono`,children:r.files.map(e=>(0,F.jsx)(`li`,{className:`truncate`,children:vI(e,S)},e))})]})]}),(0,F.jsx)(CS,{}),g.map(e=>(0,F.jsxs)(vS,{disabled:c||t6[e].code&&!w,onSelect:()=>d(e),children:[(0,F.jsx)(k,{icon:t6[e].icon}),t6[e].label]},e))]})]}),(0,F.jsx)(je,{label:t6[v].label,children:(0,F.jsx)(E,{type:`button`,size:`icon-xs`,variant:`ghost-muted`,"aria-label":t6[v].label,disabled:e.disabled||c,onClick:()=>d(v),children:(0,F.jsx)(k,{icon:t6[v].icon,className:`size-3.5`})})}),(0,F.jsx)(kL,{open:u!==null,onOpenChange:e=>{e||d(null)},children:u!==null&&(0,F.jsxs)(NL,{children:[(0,F.jsxs)(PL,{children:[(0,F.jsxs)(IL,{children:[t6[u].label,`?`]}),(0,F.jsxs)(LL,{children:[t6[u].description,` Do you really want to continue?`]})]}),(0,F.jsxs)(FL,{children:[(0,F.jsx)(zL,{children:`Cancel`}),(0,F.jsx)(RL,{variant:`destructive`,onClick:()=>void C(u),children:t6[u].label})]})]})})]})}var moe=20,n6=`linear-gradient(to bottom, black calc(100% - 1.75rem), transparent)`,r6=new Map;function hoe(e){let[t,n]=(0,P.useState)(!1),r=e.item,i=r.format===`text`||r.format===`command`?r.text:``,a=i.trim()!==``&&(i.length>600||i.split(`
112
- `).length>8),o=a&&!t;return(0,F.jsxs)(`div`,{className:`group flex flex-col items-end gap-1`,children:[(0,F.jsxs)(`div`,{className:`bg-message text-message-foreground relative max-w-[80%] rounded-2xl px-3 py-2`,children:[r.images.length>0&&(0,F.jsx)(`div`,{className:`mb-2 grid max-w-[210px] grid-cols-2 gap-2`,children:r.images.map((e,t)=>(0,F.jsx)(`div`,{className:`border-border/80 bg-background/70 aspect-[4/3] overflow-hidden rounded-lg border`,children:(0,F.jsx)(goe,{itemId:r.id,index:t,mediaType:e.mediaType,data:e.data})},t))}),r.text!==``&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:l(`relative`,o&&`max-h-44 overflow-hidden`),style:o?{WebkitMaskImage:n6,maskImage:n6}:void 0,children:[r.format===`command`&&(0,F.jsx)(`span`,{className:`font-mono text-sm`,children:r.text}),r.format===`output`&&(0,F.jsx)(`pre`,{className:`text-muted-foreground font-mono text-xs whitespace-pre-wrap`,children:r.text}),r.format===`text`&&(0,F.jsx)(TF,{text:r.text,className:`text-foreground`,lineBreaks:!0,rawHtml:!1})]}),a&&(0,F.jsx)(`div`,{className:`mt-1.5 flex items-center justify-end gap-2`,children:(0,F.jsx)(E,{type:`button`,size:`xs`,variant:`ghost-muted`,"aria-expanded":t,className:`-ml-1`,onClick:()=>n(!t),children:t?`Show less`:`Show full message`})})]})]}),(0,F.jsx)(`div`,{className:`flex w-full max-w-[80%] items-center justify-end pe-1 text-xs tabular-nums opacity-0 transition-opacity duration-200 group-hover:opacity-100 focus-within:opacity-100 has-aria-expanded:opacity-100 pointer-coarse:opacity-100`,children:(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r.time!==null&&(0,F.jsx)(je,{label:_C(r.time),children:(0,F.jsx)(`p`,{className:`text-muted-foreground text-xs tabular-nums`,children:gC(r.time)})}),i!==``&&(0,F.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[e.rewind&&(0,F.jsx)(poe,{target:{messageId:r.id,text:i,images:r.images,first:e.first},disabled:e.running}),(0,F.jsx)(i6,{text:i})]})]})})]})}function i6(e){let t=YP();return(0,F.jsx)(je,{label:`Copy message`,children:(0,F.jsx)(E,{type:`button`,size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Copy message`,disabled:t.copied,onClick:()=>void t.copy(e.text),children:(0,F.jsx)(k,{icon:t.copied?Sm:Mm,className:l(`size-3.5`,t.copied&&`text-primary`)})})})}function goe(e){let t=Q(e=>e.selection),n=t?.machine??null,r=t?.sessionId??null,[i,a]=(0,P.useState)(null);(0,P.useEffect)(()=>{if(e.data!==null||n===null||r===null)return;let t=!0,i=JSON.stringify([n,r,e.itemId,e.index]),o=r6.get(i);if(o===void 0){if(o=I(n,`sessions.image`,{sessionId:r,itemId:e.itemId,index:e.index}),r6.set(i,o),r6.size>moe){let[e]=r6.keys();r6.delete(e)}o.catch(()=>r6.delete(i))}return o.then(e=>{t&&a(e.data)}).catch(R9),()=>{t=!1}},[e.data,e.itemId,e.index,n,r]);let o=e.data??i;return o===null?null:(0,F.jsx)(iC,{src:`data:${e.mediaType};base64,${o}`,alt:``,name:`Image`,className:`block size-full`,imageClassName:`block size-full object-cover`})}function a6(e){switch(e.kind){case`command`:return`Shell`;case`file_change`:return`Edit`;case`web_search`:return e.url===null?`Web Search`:`Webfetch`;case`skill`:return`Skill`;case`tool`:return e.name}}function _oe(e){let t=e.item,n=e.live&&t.status===`running`;if(t.status===`failed`)return(0,F.jsx)(Soe,{title:a6(t),subtitle:s6(t,e.cwd),error:t.output});switch(t.kind){case`command`:return(0,F.jsx)(voe,{command:t.command,output:t.output,pending:n});case`file_change`:return(0,F.jsx)(o6,{items:[t],cwd:e.cwd,live:e.live});case`web_search`:{let e=t.url;return e===null?(0,F.jsx)(yoe,{query:t.query??``,links:t.results,pending:n}):(0,F.jsx)(W3,{title:`Webfetch`,subtitle:(0,F.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline hover:underline-offset-2`,children:e}),pending:n,grouped:!0,open:!1,onToggle:null})}case`skill`:return(0,F.jsxs)(`div`,{className:`flex min-h-7 items-center gap-1 text-[13px] leading-4 tracking-[-0.04px]`,children:[(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:`Loaded`}),(0,F.jsx)(`span`,{className:`text-foreground`,children:(0,F.jsx)(H3,{text:t.skill,active:n})}),(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:`skill`})]});case`tool`:{let r=t.input;switch(fI(t.name)){case`read`:return(0,F.jsx)(W3,{title:`Read`,subtitle:Coe(pI(r)),args:c6(r,[`offset`,`limit`]),pending:n,grouped:!0,open:!1,onToggle:null});case`search`:return(0,F.jsx)(W3,{title:t.name,subtitle:s6(t,e.cwd),args:[...c6(r,[`pattern`]),..._I(r.glob)===``?[]:[`include=${_I(r.glob)}`]],pending:n,grouped:!0,open:!1,onToggle:null});case`other`:return(0,F.jsx)(W3,{title:`Called ${t.name}`,subtitle:s6(t,e.cwd),args:c6(r,Object.keys(r).filter(e=>![`description`,`query`,`url`,`path`,`pattern`].includes(e))).slice(0,3),pending:n,grouped:!0,open:!1,onToggle:null})}}}}function voe(e){let[t,n]=(0,P.useState)(!1);return(0,F.jsx)(W3,{title:`Shell`,subtitle:t?void 0:e.command,pending:e.pending,grouped:!0,open:t,onToggle:()=>n(!t),rail:!1,children:(0,F.jsxs)(`div`,{dir:`ltr`,className:`group/output border-border relative w-full overflow-hidden rounded-md border`,children:[(0,F.jsx)(`div`,{className:`absolute top-1 right-1 opacity-0 transition-opacity group-hover/output:opacity-100 focus-within:opacity-100`,children:(0,F.jsx)(i6,{text:e.command})}),(0,F.jsx)(`div`,{className:`max-h-60 [scrollbar-width:none] overflow-x-hidden overflow-y-auto`,children:(0,F.jsx)(`pre`,{className:`m-0 font-mono text-[13px] leading-5 tracking-[-0.04px] [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:(0,F.jsxs)(`code`,{children:[(0,F.jsx)(`span`,{className:`text-foreground block p-3`,children:e.command}),e.output!==``&&(0,F.jsx)(`span`,{className:`border-border bg-muted text-muted-foreground block border-t p-3`,children:e.output})]})})})]})})}function yoe(e){let[t,n]=(0,P.useState)(!1),r=e.links;return(0,F.jsx)(W3,{title:`Web Search`,subtitle:e.query,pending:e.pending,grouped:!0,open:t,onToggle:r.length===0?null:()=>n(!t),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-1 text-[13px] leading-5`,children:[r.slice(0,10).map(e=>(0,F.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary truncate hover:underline hover:underline-offset-2`,children:e.title===``?e.url:e.title},e.url)),r.length>10&&(0,F.jsxs)(`span`,{className:`text-muted-foreground`,children:[`+`,r.length-10,` more`]})]})})}function boe(e){let[t,n]=(0,P.useState)(!1);return(0,F.jsx)(W3,{title:e.streaming?`Thinking`:`Thought`,subtitle:e.streaming?woe(e.text):void 0,pending:e.streaming,grouped:!0,open:t,onToggle:()=>n(!t),children:(0,F.jsx)(TF,{text:e.text,className:`text-muted-foreground text-[13px]`,lineBreaks:!0})})}function o6(e){let t=new Map;for(let n of e.items){let r=vI(n.path,e.cwd);t.set(r,[...t.get(r)??[],n])}return(0,F.jsx)(`div`,{className:`border-border overflow-hidden rounded-md border`,children:[...t].map(([t,n])=>(0,F.jsx)(xoe,{file:t,items:n,pending:e.live&&n.some(e=>e.status===`running`)},t))})}function xoe(e){let[t,n]=(0,P.useState)(!1),r=e.file.lastIndexOf(`/`),i=0,a=0;for(let t of e.items){let e=mI(t);i+=e.added,a+=e.removed}return(0,F.jsxs)(`div`,{className:`border-border border-b last:border-b-0`,children:[(0,F.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`group/tool flex h-9 w-full cursor-pointer items-center gap-2 ps-3 pe-1 text-left text-[13px] leading-4 tracking-[-0.04px] select-none`,children:[(0,F.jsx)(Le,{path:e.file,className:`size-4 shrink-0`}),(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline`,children:[r>=0&&(0,F.jsx)(`span`,{className:`text-muted-foreground truncate`,children:e.file.slice(0,r+1)}),(0,F.jsx)(`span`,{className:`text-foreground shrink-0`,children:(0,F.jsx)(H3,{text:e.file.slice(r+1),active:e.pending})})]}),(0,F.jsxs)(`span`,{role:`group`,"aria-label":`${i} additions, ${a} deletions`,className:`inline-flex items-center gap-1 align-middle font-mono text-xs tabular-nums`,children:[(0,F.jsxs)(`span`,{"aria-hidden":!0,className:`text-diff-addition`,children:[`+`,vC(i)]}),(0,F.jsxs)(`span`,{"aria-hidden":!0,className:`text-diff-deletion`,children:[`-`,vC(a)]})]}),(0,F.jsx)(U3,{open:t})]}),t&&(0,F.jsx)(`div`,{className:`border-border flex flex-col gap-2 border-t p-2`,children:e.items.map(e=>(0,F.jsx)(uI,{item:e},e.id))})]})}function Soe(e){let[t,n]=(0,P.useState)(!1),r=e.error.replace(/<\/?tool_use_error>/g,``).trim(),i=r.split(`: `)[0].trim();return(0,F.jsxs)(`div`,{className:`group/error flex w-full min-w-0 flex-col`,children:[(0,F.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`flex h-6 w-full cursor-pointer items-center text-left text-[13px] leading-4 tracking-[-0.04px] select-none`,children:[(0,F.jsxs)(`span`,{className:`flex max-w-[calc(100%-20px)] min-w-0 items-center gap-1.5`,children:[(0,F.jsx)(k,{icon:mm,className:`text-destructive size-4 shrink-0`}),(0,F.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:e.title}),e.subtitle!==``&&!t&&(0,F.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:e.subtitle}),!t&&(0,F.jsx)(`span`,{className:`text-destructive min-w-0 truncate`,children:i===``?`Failed`:i[0].toUpperCase()+i.slice(1)})]}),(0,F.jsx)(U3,{open:!0,className:`ms-1.5 size-3.5`})]}),t&&(0,F.jsxs)(`div`,{className:`relative ps-6 pe-10 select-text`,children:[(0,F.jsx)(`div`,{className:`absolute top-0 right-0 opacity-0 transition-opacity group-hover/error:opacity-100 focus-within:opacity-100`,children:(0,F.jsx)(i6,{text:r})}),(0,F.jsx)(`p`,{className:`text-destructive text-[13px] leading-5 tracking-[-0.04px] [overflow-wrap:anywhere] whitespace-pre-wrap`,children:r})]})]})}function s6(e,t){switch(e.kind){case`command`:return e.command;case`file_change`:return e.path;case`web_search`:return e.url??e.query??``;case`skill`:return e.skill;case`tool`:{let n=e.input;if(fI(e.name)===`search`){let e=_I(n.path);return e===``||e===t?``:vI(e,t)}return[`description`,`query`,`url`,`file_path`,`path`,`pattern`].map(e=>_I(n[e])).find(e=>e!==``)??``}}}function c6(e,t){return t.flatMap(t=>{let n=e[t];return typeof n==`string`||typeof n==`number`||typeof n==`boolean`?[`${t}=${n}`]:[]})}function Coe(e){return e.split(`/`).at(-1)??e}function woe(e){let t=[...e.matchAll(/^\s*(?:#{1,6}[ \t]+(.+?)|\*\*([^*\n]+)\*\*)\s*$/gm)].at(-1);return t===void 0?void 0:(t[1]??t[2]).trim()}var Toe=new Intl.ListFormat(`en`,{style:`long`,type:`conjunction`});function Eoe(e){let t=e.entries.flatMap(e=>e.kind===`reasoning`?[]:[e]),n=e.entries.length-t.length,r=Toe.format([...new Set(t.map(a6))]),i=r===``?n===1?`Thought`:`Thoughts`:r,a=t.length>0?t.length:n;return(0,F.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col`,children:[(0,F.jsxs)(`button`,{type:`button`,"aria-expanded":e.open,"aria-label":`Used ${a} ${i}`,onClick:e.onToggle,className:l(`group/tool focus-visible:ring-ring/70 flex h-7 w-full cursor-pointer items-center rounded-md text-left text-xs select-none focus-visible:ring-2 focus-visible:outline-none`,e.open&&`bg-background sticky top-0 z-20 box-content pb-2`),children:[(0,F.jsxs)(`span`,{className:`flex max-w-[calc(100%-24px)] min-w-0 items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Used`}),(0,F.jsx)(`span`,{className:`text-muted-foreground shrink-0 tabular-nums`,children:a}),(0,F.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:i})]}),(0,F.jsx)(U3,{open:e.open})]}),e.open&&(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:Ooe(e.entries).map(t=>(0,F.jsx)(`div`,{className:`flex min-h-7 min-w-0 flex-col justify-center`,children:(0,F.jsx)(Doe,{item:t,cwd:e.cwd,live:e.live})},t.key))})]})}function Doe(e){let t=e.item;switch(t.kind){case`thinking`:return(0,F.jsx)(boe,{text:t.text,streaming:e.live&&t.last});case`tool`:return(0,F.jsx)(_oe,{item:t.item,cwd:e.cwd,live:e.live});case`reads`:return(0,F.jsx)(W3,{title:`Read`,subtitle:(0,F.jsx)(`span`,{title:t.items.map(e=>pI(e.input)).join(`
113
- `),children:t.items.map((t,n)=>(0,F.jsxs)(`span`,{children:[n>0&&` `,(0,F.jsx)(H3,{text:pI(t.input).split(`/`).at(-1)??``,active:e.live&&t.status===`running`})]},t.id))}),pending:e.live&&t.items.some(e=>e.status===`running`),grouped:!0,open:!1,onToggle:null});case`files`:return(0,F.jsx)(o6,{items:t.items,cwd:e.cwd,live:e.live})}}function Ooe(e){let t=[];return e.forEach((n,r)=>{if(n.kind===`reasoning`){t.push({kind:`thinking`,key:n.id,text:n.text,last:r===e.length-1});return}let i=t.at(-1);n.status!==`failed`&&n.kind===`file_change`?i?.kind===`files`?i.items.push(n):t.push({kind:`files`,key:n.id,items:[n]}):n.status!==`failed`&&n.kind===`tool`&&fI(n.name)===`read`?i?.kind===`reads`?i.items.push(n):t.push({kind:`reads`,key:n.id,items:[n]}):t.push({kind:`tool`,key:n.id,item:n})}),t}var l6=30;function koe(e){let t=Q(e=>e.selection),n=Q(e=>e.loaded),r=Q(e=>e.items),i=Q(e=>e.earlier),a=Q(e=>e.before),o=Q(e=>e.partial),s=Q(e=>e.requests),c=Q(A9),u=(0,P.useRef)(null),d=(0,P.useRef)(null),f=(0,P.useRef)(!0),p=(0,P.useRef)(null),[m,h]=(0,P.useState)(!1),[g,_]=(0,P.useState)([]),[v,y]=(0,P.useState)(null),b=Q(e=>t===null?``:E9(e,t.machine,t.projectId)?.path??``),x=Q(j9),S=Q(e=>e.sentAt);(0,P.useLayoutEffect)(()=>{let e=u.current;e!==null&&S!==0&&(f.current=!0,e.scrollTop=e.scrollHeight)},[S]),(0,P.useEffect)(()=>{let e=u.current;if(e===null||d.current===null)throw Error(`transcript is not mounted`);let t=new ResizeObserver(()=>{f.current&&(e.scrollTop=e.scrollHeight)});return t.observe(e),t.observe(d.current),()=>t.disconnect()},[]),(0,P.useLayoutEffect)(()=>{let e=u.current;e!==null&&f.current&&(e.scrollTop=e.scrollHeight)},[r,o,s,x]);let C=(0,P.useMemo)(()=>z3([...i,...r],c),[i,r,c]),w=e6(i,!1,``),T=[...w,...e6(r,x,o)],D=T.findIndex(e=>e.key===v?.key),O=Math.max(0,D===-1?T.length-l6:D-(v?.above??0));(0,P.useLayoutEffect)(()=>{let e=u.current;e!==null&&p.current!==null&&(e.scrollTop=e.scrollHeight-p.current),p.current=null},[i,O]),(0,P.useLayoutEffect)(()=>{let e=u.current;e!==null&&T.length!==0&&(D===-1?y({key:T[O].key,above:0}):k(e))});function k(e){O===0||e.scrollTop>=e.clientHeight||(p.current=e.scrollHeight-e.scrollTop,y({key:T[O].key,above:l6}))}let A=(0,P.useCallback)(e=>{_(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]);return(0,F.jsx)(`div`,{ref:u,className:`topbar-scroll-fade relative min-h-0 flex-1 overflow-y-auto overscroll-y-contain pb-8`,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<40,k(t)},children:(0,F.jsx)(`div`,{ref:d,children:(0,F.jsxs)(kS,{width:`chat`,className:`pt-3`,children:[!n&&(0,F.jsx)(`p`,{className:`text-muted-foreground py-6 text-center text-xs`,children:`Loading…`}),a!==null&&O===0&&(0,F.jsx)(`div`,{className:`flex justify-center pb-4`,children:(0,F.jsx)(E,{type:`button`,size:`xs`,variant:`ghost-muted`,disabled:m,onClick:async()=>{let e=u.current;e!==null&&(p.current=e.scrollHeight-e.scrollTop),y({key:T[0].key,above:l6}),h(!0),await QS(),h(!1)},children:m?`Loading…`:`Load earlier conversation`})}),T.slice(O).map((t,n)=>{let r=O+n,i=T[r-1],a=r<w.length;return(0,F.jsx)(`div`,{className:l(i===void 0?void 0:t.kind===`user`?`pt-6`:t.kind===`working`?void 0:Q3(t)&&Q3(i)?`pt-2`:Q3(t)||Q3(i)?`pt-3`:`pt-4`,t.kind===`assistant`&&`group/assistant`),children:(0,F.jsx)(d6,{row:t,agents:C.agents,tasks:C.tasks,running:x,compacting:c?.compacting===!0,fork:!a,expanded:g.includes(t.key),onToggle:A,onOpenTask:e.onOpenTask,rewind:!a,cwd:b})},t.key)})]})})})}var u6=(0,P.memo)(koe);function Aoe(e){let t=e.row;switch(t.kind){case`user`:return(0,F.jsx)(hoe,{item:t.item,first:t.first,running:e.running,rewind:e.rewind});case`working`:return(0,F.jsx)(`div`,{className:`text-muted-foreground h-9 pt-3 text-[13px] leading-5 font-medium tracking-[-0.04px]`,children:(0,F.jsx)(H3,{text:e.compacting?`Compacting conversation`:`Working`,active:!0})});case`group`:return(0,F.jsx)(Eoe,{entries:t.entries,cwd:e.cwd,live:t.live,open:e.expanded,onToggle:()=>e.onToggle(t.key)});case`agent`:return(0,F.jsx)(ooe,{item:t.item,agents:e.agents,tasks:e.tasks,sending:t.live&&t.item.status===`running`,onOpen:e.onOpenTask});case`assistant`:return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(TF,{text:t.text===``&&!t.streaming?`(empty response)`:t.text,streaming:t.streaming}),t.meta&&(0,F.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-xs tabular-nums opacity-0 transition-opacity duration-200 group-hover/assistant:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100`,children:[(0,F.jsx)(i6,{text:t.text}),e.fork&&(0,F.jsx)(joe,{uuid:t.message}),t.time!==null&&(0,F.jsx)(je,{label:_C(t.time),children:(0,F.jsx)(`p`,{className:`text-muted-foreground text-xs tabular-nums`,children:gC(t.time)})})]})]});case`error`:return(0,F.jsxs)(`div`,{className:`text-destructive flex gap-1.5 text-[13px] leading-5 tracking-[-0.04px]`,children:[(0,F.jsx)(k,{icon:mm,className:`mt-0.5 size-4 shrink-0`}),(0,F.jsx)(`p`,{className:`min-w-0 [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:t.text})]});case`notice`:return(0,F.jsxs)(`div`,{className:`text-muted-foreground mx-auto flex w-full max-w-(--chat-content-max-width) items-center gap-3 py-1 text-xs`,children:[(0,F.jsx)(`span`,{className:`bg-border/70 h-px flex-1`}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t.text===`Conversation compacted`&&(0,F.jsx)(k,{icon:lh,className:`size-3`}),t.text]}),(0,F.jsx)(`span`,{className:`bg-border/70 h-px flex-1`})]});case`plan`:return(0,F.jsx)(`div`,{className:`min-w-0`,children:(0,F.jsx)(soe,{plan:t.plan})});case`question`:return(0,F.jsx)(uoe,{item:t.item})}}var d6=(0,P.memo)(Aoe,(e,t)=>t.row.kind===`agent`?ho(e,t):ho(lo(e,[`agents`,`tasks`]),lo(t,[`agents`,`tasks`])));function joe(e){let[t,n]=(0,P.useState)(!1);return(0,F.jsx)(je,{label:`Fork from this response`,children:(0,F.jsx)(E,{type:`button`,size:`icon-xs`,variant:`ghost-muted`,disabled:t,"aria-label":`Fork from this response`,onClick:()=>{n(!0),ZS(e.uuid).finally(()=>n(!1))},children:(0,F.jsx)(k,{icon:zm,className:l(`size-3.5`,t&&`animate-pulse`)})})})}var Moe=Dte(`event`,[Zp({offsite:nm(`browser`),event:nm(`location`),url:Vp(),proxied:Vp(),back:qp(),forward:qp()}),Zp({offsite:nm(`browser`),event:nm(`navigate`)})]);function Noe(e){let t=ea({from:`__root__`,select:e=>e.browse??null}),[n,r]=(0,P.useState)(null),[i,a]=(0,P.useState)(0),[o,c]=(0,P.useState)(0),[u,d]=(0,P.useState)(!1),[f,p]=(0,P.useState)(null),m=(0,P.useRef)(null),h=(0,P.useRef)(null),g=Q(t=>T9(t,e.machine).status===`online`);(0,P.useEffect)(()=>{if(t===null||!g)return;if(h.current===t){h.current=null;return}let n=!0;return Poe(e.machine,t).then(e=>{n&&(r({target:t,src:e,href:e,error:null}),c(e=>e+1),p(null),d(!0))},e=>{n&&(r({target:t,src:null,href:null,error:s(e)}),p(null),d(!1))}),()=>{n=!1}},[e.machine,t,i,g]),(0,P.useEffect)(()=>{function e(e){if(e.source===null||e.source!==m.current?.contentWindow)return;let i=Moe.safeParse(e.data);if(!i.success)return;if(i.data.event===`navigate`){p(null),d(!0);return}if(p({back:i.data.back,forward:i.data.forward,proxied:i.data.proxied}),t===null||n===null)throw Error(`a page reported its location outside the browser`);let a=i.data.url;a!==t&&(h.current=a,r({...n,target:a,href:i.data.proxied}),PS({browse:a}))}return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[t,n]);let _=t===null?null:n?.src??null,v=n?.target===t?n.href:null,y=n?.target===t?n.error:null,b=t!==null&&g&&(n?.target!==t||u);function x(e){if(f===null)throw Error(`no page is open to send a browser command to`);m.current?.contentWindow?.postMessage({offsite:`browser`,command:e},new URL(f.proxied).origin)}return(0,F.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,F.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-2 border-b pr-3 pl-3`,children:[(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,F.jsx)(k,{icon:Me,className:`size-3.5`})}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Back`,"aria-label":`Back`,disabled:f?.back!==!0,onClick:()=>x(`back`),children:(0,F.jsx)(k,{icon:vm,className:`size-3.5`})}),(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Forward`,"aria-label":`Forward`,disabled:f?.forward!==!0,onClick:()=>x(`forward`),children:(0,F.jsx)(k,{icon:ym,className:`size-3.5`})}),(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Reload`,"aria-label":`Reload`,onClick:()=>{f===null?a(i+1):x(`reload`)},children:(0,F.jsx)(k,{icon:Oh,className:l(`size-3.5`,b&&`animate-spin`)})})]}),(0,F.jsx)(`form`,{className:`min-w-0 flex-1`,onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`address`);if(typeof t!=`string`)throw Error(`the address field is missing`);let n=t.trim();n!==``&&IS(Foe(n))},children:(0,F.jsx)(cL,{name:`address`,className:`h-7 font-mono text-xs`,placeholder:`URL or file path`,"aria-label":`URL or file path`,defaultValue:t??``})},t),v!==null&&(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,asChild:!0,children:(0,F.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,title:`Open in a new tab`,"aria-label":`Open in a new tab`,children:(0,F.jsx)(k,{icon:th,className:`size-3.5`})})})]}),y!==null&&(0,F.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:y}),t===null&&(0,F.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:`Type a URL or a file path above. URLs load from this machine.`}),_!==null&&(0,F.jsx)(`iframe`,{ref:m,src:_,title:t??``,className:`min-h-0 w-full flex-1 bg-white`,onLoad:()=>d(!1)},o)]})}async function Poe(e,t){if(/^https?:\/\//i.test(t)){let n=new URL(t),r=new URL(Ya(e));return r.port=String(await I(e,`browser.proxy`,{origin:n.origin})),`${r.origin}${n.pathname}${n.search}${n.hash}`}let n=await I(e,`files.browse`,void 0);return`${Ya(e)}/api/browse/${n}${Ioe(t)}`}function Foe(e){return/^(https?:\/\/|file:)/i.test(e)||/^[/.]/.test(e)||/^[a-z]:[\\/]/i.test(e)?e:/^(localhost|\d+(\.\d+){3}|[\w.-]+:\d+)([:/?#]\S*)?$/i.test(e)?`http://${e}`:/^[\w-]+(\.[\w-]+)+([/?#]\S*)?$/.test(e)?`https://${e}`:`https://www.google.com/search?q=${encodeURIComponent(e)}`}function Ioe(e){let t=e.replaceAll(`\\`,`/`).split(`/`).map(encodeURIComponent).join(`/`);return t.startsWith(`/`)?t:`/${t}`}var f6=new Set,p6=null;function m6(e){f6.add(e),p6??=requestAnimationFrame(g6)}function h6(e){f6.delete(e)&&f6.size===0&&p6!=null&&(cancelAnimationFrame(p6),p6=null)}function g6(e){let t=new Set(f6);f6.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}p6=f6.size>0?requestAnimationFrame(g6):null}function _6(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function v6(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function y6(e,t){let n=e?.theme??rt,r=t?.theme??rt,i=b6(e),a=b6(t);return v6(n,r)&&_6(e,t,[`theme`,`parseDiffOptions`])&&_6(i,a)}function b6(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function x6(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function S6(e){return{type:`text`,value:e}}function X({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function C6({name:e,width:t=16,height:n=16,properties:r}){return X({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[X({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function w6(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function T6(e){return X({tagName:`div`,properties:{"data-gutter":``},children:e})}function E6(e,t,n,r={}){return X({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[X({tagName:`span`,properties:{"data-line-number-content":``},children:[S6(`${t}`)]})]})}function D6(e,t,n){return X({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function O6(){return X({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[C6({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Loe(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function k6(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var A6=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),h6(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||x6(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;(this.isSelectionDirty()||n||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;(this.isSelectionDirty()||r||i)&&(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&k6(e.composedPath())||(V6(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;(t!==`disabled`||o||n!=null||r!=null||i!=null||a!=null)&&(V6(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;V6(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null?V6(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`):(this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility())};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();V6(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);V6(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=P6(i)&&this.hoveredLine?.lineElement===i.lineElement;N6(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),N6(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),P6(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Boe(i)&&p!=null){p(i);break}if(zoe(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!P6(i))break;N6(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,V6(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),V6(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),V6(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();k6(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}else if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners()}else this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Loe(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=Mt(O6());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);M6(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){this.placeUtilityFromSelection()||(this.hoveredLine==null?this.hideUtility():this.showUtilityOnLine(this.hoveredLine))}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(I6(t));if(M6(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(M6(n)&&(!t||n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(M6(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&k6(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=I6(e);if(t&&k6(n))return;let r=Hoe(e);return r==null?this.pathFromAnnotationSlot(e):I6(r)}pathFromAnnotationSlot(e){let t=Uoe(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return I6(t);let n=Goe(Woe(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:I6(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=L6(t)?t:L6(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}x6(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,m6(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{h6(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!R6(this.renderedSelectedLinesState,n),i=!R6(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Voe(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=B6(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=B6(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e)}else if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:F6(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:F6(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:z6(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:z6(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function j6({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Roe({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Roe({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function M6(e){return e!=null&&`kind`in e&&e.kind===`line`}function N6(e){return e!=null&&`kind`in e&&e.kind===`token`}function P6(e){return M6(e)||N6(e)}function zoe(e){return`type`in e&&e.type===`line-info`}function Boe(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Voe(e){return e===`current`||e===`incoming`||e===`both`}function F6(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function I6(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Hoe(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Uoe(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function Woe(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Goe(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function L6(e){return e!=null&&typeof e.elementFromPoint==`function`}function Koe(e,t){return e===t||x6(e??void 0,t??void 0)}function R6(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Koe(e?.range??null,t.range)}function z6(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function B6(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function V6(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var H6=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),Yoe(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?Xoe(t):Zoe(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null)console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);else if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:qoe(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Joe(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;(i||a)&&(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&U6(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function qoe(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Joe(e){return Math.max(Math.ceil(e),0)}function Yoe(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?U6(e,{codeWidthChanged:!0,numberWidthChanged:!0}):W6(e))}function U6(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function W6(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function Xoe(e){e.codeElement.isConnected&&W6(e)}function Zoe(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function G6(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function K6(e){return X({tagName:`div`,children:[X({tagName:`div`,children:e.annotations?.map(e=>X({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function q6(e){switch(e){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 J6({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return X({tagName:`div`,children:[t===`custom`?X({tagName:`slot`,properties:{name:at}}):Qoe({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[$oe(r)]],properties:i})}function Qoe({name:e,prevName:t,iconType:n}){let r=[X({tagName:`slot`,properties:{name:xt}}),C6({name:q6(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(X({tagName:`div`,children:[X({tagName:`bdi`,children:[S6(t)]})],properties:{"data-prev-name":``}})),r.push(C6({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(X({tagName:`div`,children:[X({tagName:`bdi`,children:[S6(e)]})],properties:{"data-title":``}})),r.push(X({tagName:`slot`,properties:{name:zt}})),X({tagName:`div`,children:r,properties:{"data-header-content":``}})}function $oe(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(X({tagName:`span`,children:[S6(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(X({tagName:`span`,children:[S6(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(X({tagName:`slot`,properties:{name:it}})),X({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Y6(e){return X({tagName:`pre`,properties:X6(e)})}function X6({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var Z6=new Map,Q6={"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`,odin:`odin`,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`,BUCK:`python`,BUILD:`python`,PACKAGE:`python`,WORKSPACE:`python`,Tiltfile:`python`,bazel:`python`,bxl:`python`,bzl:`python`,bzlmod:`python`,star:`python`,sky:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function $6(e){let t=e8(e);if(t!=null)return t;let n=e.split(/[/\\]/).pop()??e;return n===e?`text`:e8(n)??`text`}function e8(e){if(Z6.has(e))return Z6.get(e)??`text`;if(Object.hasOwn(Q6,e))return Q6[e]??null;let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Z6.has(t[1]))return Z6.get(t[1])??`text`;if(Object.hasOwn(Q6,t[1]))return Q6[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Z6.has(n)?Z6.get(n)??`text`:Object.hasOwn(Q6,n)?Q6[n]??`text`:null}function t8(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:Array.isArray(e)?e:[e??`text`],themes:kt(t),preferredHighlighter:n}}function n8(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function r8(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function i8(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(S6(`
114
- `)),e}var a8=Symbol(`no-token`),o8=Symbol(`multiple-tokens`);function s8(e){let t=ese(e);if(t!=null)return t;let n=a8,r=[],i=[],a,o=()=>{if(i.length===0||a==null)i=[],a=void 0;else if(i.length===1){let e=i[0];if(e?.type===`element`){tse(e,a);for(let t of e.children)c8(t)}else c8(e);r.push(e),i=[],a=void 0}else{for(let e of i)c8(e);r.push(X({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0}},s=e=>{e!==a8&&(e===o8?n=o8:n===a8?n=e:n!==e&&(n=o8))};for(let t of e.children){let e=t.type===`element`?s8(t):a8;s(e),typeof e==`number`?(a!=null&&a!==e&&o(),a??=e,i.push(t)):(o(),r.push(t))}return o(),e.children=r,n}function ese(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function c8(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)c8(t)}}function tse(e,t){e.properties[`data-char`]=t}function nse(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+rse(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function rse(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>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 l8(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=w6(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&s8(a),i.push(i8(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(ise,u8),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:u8}}var u8=nse({classPrefix:`hl-`}),ise={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function d8(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var ase=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,ose=/^0(?:\.0+)?%?$/;function sse(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function cse(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function f8(e){if(e==null)return null;let t=cse(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function p8(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||ase.test(t))return!0;let n=sse(t);return n!=null&&ose.test(n)}function lse(e,t,n){if(t==null||n==null)return!1;let r=f8(e),i=f8(t),a=f8(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var m8=new WeakMap;function h8(e){let t=m8.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;g8(r,`editor.background`,i),g8(r,`editor.foreground`,a),g8(r,`sideBar.background`,o),g8(r,`sideBar.foreground`,s),g8(r,`input.background`,n[`input.background`]??o),g8(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),g8(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),g8(r,`gitDecoration.addedResourceForeground`,_8(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),g8(r,`gitDecoration.modifiedResourceForeground`,_8(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),g8(r,`gitDecoration.deletedResourceForeground`,_8(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(p8(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(p8(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(use(l,o)||lse(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return m8.set(e,u),u}function g8(e,t,n){n!=null&&n!==``&&(e[t]=n)}function _8(...e){for(let t of e)if(t!=null&&t!==``)return t}function use(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function v8({theme:e=rt,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=h8(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${d8(`global`)}fg:${a.fg};`,r+=`${d8(`global`)}bg:${a.bg};`,r+=y8(i,n)}else{let n=t.getTheme(e.dark),i=h8(n);r+=`${d8(`global`)}dark:${i.fg};`,r+=`${d8(`global`)}dark-bg:${i.bg};`,r+=y8(n,`dark`),n=t.getTheme(e.light),i=h8(n),r+=`${d8(`global`)}light:${i.fg};`,r+=`${d8(`global`)}light-bg:${i.bg};`,r+=y8(n,`light`)}return r}function y8(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${d8(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${d8(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${d8(`global`)}${t}modified-color:${a};`),n}function b8(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}function x8(e,t){for(let n of t)e.push(n)}function S8(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var dse=`-1,-1`;function fse(e){return e?.some(e=>e.lineNumber===0)??!1}function C8(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function w8(e){return e.startingLine===0&&e.totalLines>0}function pse(e,t){return e.endsWith(`\r
115
- `)?t+`\r
116
- `:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
117
- `)?t+`
118
- `:t}function mse(e,t){return X({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}var T8=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
119
- <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
120
- <path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
121
- </symbol>
122
- <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
123
- <path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
124
- </symbol>
125
- <symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
126
- <path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
127
- </symbol>
128
- <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
129
- <path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
130
- </symbol>
131
- <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
132
- <path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
133
- </symbol>
134
- <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
135
- <path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
136
- </symbol>
137
- <symbol id="diffs-icon-expand" viewBox="0 0 16 16">
138
- <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
139
- </symbol>
140
- <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
141
- <path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
142
- </symbol>
143
- <symbol id="diffs-icon-eye-slash" viewBox="0 0 16 16">
144
- <path d="m13.47 1.47-12 12 1.06 1.06 12-12zM8 14c-.92 0-1.802-.208-2.624-.547l1.173-1.174c.476.142.963.221 1.451.221 1.66 0 3.307-.949 4.626-2.196a10.4 10.4 0 0 0 1.494-1.751A5 5 0 0 0 14.443 8a5 5 0 0 0-.323-.553 10 10 0 0 0-1.238-1.5l1.061-1.062C15.222 6.173 16 7.511 16 8c0 1.05-3.582 6-8 6"/><path d="M8 11q-.084 0-.167-.005l3.162-3.162q.006.083.005.167a3 3 0 0 1-3 3M5.005 8.167l3.162-3.162a3 3 0 0 0-3.162 3.162"/><path d="M8 3.5c.485 0 .97.081 1.445.227l1.168-1.169C9.794 2.212 8.915 2 8 2 3.582 2 0 6.8 0 8c0 .555.766 1.88 2.027 3.144l1.06-1.06a9.5 9.5 0 0 1-1.203-1.461 4.3 4.3 0 0 1-.345-.617L1.536 8l.003-.006c.064-.149.176-.359.345-.617a9.8 9.8 0 0 1 1.482-1.73C4.675 4.427 6.326 3.5 8 3.5"/>
145
- </symbol>
146
- <symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
147
- <path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
148
- </symbol>
149
- <symbol id="diffs-icon-plus" viewBox="0 0 16 16">
150
- <path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
151
- </symbol>
152
- <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
153
- <path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
154
- </symbol>
155
- <symbol id="diffs-icon-symbol-added-duo" viewBox="0 0 16 16">
156
- <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/>
157
- </symbol>
158
- <symbol id="diffs-icon-symbol-added-fill" viewBox="0 0 16 16">
159
- <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 4a.75.75 0 0 0-.75.75v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5A.75.75 0 0 0 8 4" clip-rule="evenodd"/>
160
- </symbol>
161
- <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
162
- <path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
163
- </symbol>
164
- <symbol id="diffs-icon-symbol-deleted-duo" viewBox="0 0 16 16">
165
- <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/>
166
- </symbol>
167
- <symbol id="diffs-icon-symbol-deleted-fill" viewBox="0 0 16 16">
168
- <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M4.75 7.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
169
- </symbol>
170
- <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
171
- <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
172
- </symbol>
173
- <symbol id="diffs-icon-symbol-diffstat-duo" viewBox="0 0 16 16">
174
- <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
175
- </symbol>
176
- <symbol id="diffs-icon-symbol-diffstat-fill" viewBox="0 0 16 16">
177
- <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5zM8 3.546a.75.75 0 0 0-.75.75V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2V4.296a.75.75 0 0 0-.75-.75" clip-rule="evenodd"/>
178
- </symbol>
179
- <symbol id="diffs-icon-symbol-extracted" viewBox="0 0 16 16">
180
- <path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/><path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 1.5c-1.613 0-2.807.089-3.704.288-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288s2.807-.089 3.704-.288c.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5" clip-rule="evenodd"/>
181
- </symbol>
182
- <symbol id="diffs-icon-symbol-extracted-duo" viewBox="0 0 16 16">
183
- <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8" clip-rule="evenodd" opacity=".2"/><path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/>
184
- </symbol>
185
- <symbol id="diffs-icon-symbol-extracted-fill" viewBox="0 0 16 16">
186
- <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5 4.25a.75.75 0 0 0-.75.75v3.25a.75.75 0 0 0 1.5 0V6.81l3.302 3.302a1.5 1.5 0 1 0 1.06-1.06L6.811 5.75H8.25a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
187
- </symbol>
188
- <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
189
- <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
190
- </symbol>
191
- <symbol id="diffs-icon-symbol-ignored-duo" viewBox="0 0 16 16">
192
- <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11.53 4.47a.75.75 0 0 1 0 1.06l-6 6a.75.75 0 0 1-1.06-1.06l6-6a.75.75 0 0 1 1.06 0"/>
193
- </symbol>
194
- <symbol id="diffs-icon-symbol-ignored-fill" viewBox="0 0 16 16">
195
- <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m3.53 4.47a.75.75 0 0 0-1.06 0l-6 6a.75.75 0 1 0 1.06 1.06l6-6a.75.75 0 0 0 0-1.06" clip-rule="evenodd"/>
196
- </symbol>
197
- <symbol id="diffs-icon-symbol-inlined" viewBox="0 0 16 16">
198
- <path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/><path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8m0-1.5c1.613 0 2.807-.089 3.704-.288.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5s-2.807.089-3.704.288c-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288" clip-rule="evenodd"/>
199
- </symbol>
200
- <symbol id="diffs-icon-symbol-inlined-duo" viewBox="0 0 16 16">
201
- <path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8" clip-rule="evenodd" opacity=".2"/><path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/>
202
- </symbol>
203
- <symbol id="diffs-icon-symbol-inlined-fill" viewBox="0 0 16 16">
204
- <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.5 4a1.5 1.5 0 1 0 .388 2.948l3.301 3.302H7.75a.75.75 0 0 0 0 1.5H11a.75.75 0 0 0 .75-.75V7.75a.75.75 0 0 0-1.5 0v1.44L6.948 5.887A1.5 1.5 0 0 0 5.5 4" clip-rule="evenodd"/>
205
- </symbol>
206
- <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
207
- <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
208
- </symbol>
209
- <symbol id="diffs-icon-symbol-modified-duo" viewBox="0 0 16 16">
210
- <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0"/>
211
- </symbol>
212
- <symbol id="diffs-icon-symbol-modified-fill" viewBox="0 0 16 16">
213
- <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 5a3 3 0 1 0 0 6 3 3 0 0 0 0-6" clip-rule="evenodd"/>
214
- </symbol>
215
- <symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
216
- <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
217
- </symbol>
218
- <symbol id="diffs-icon-symbol-moved-duo" viewBox="0 0 16 16">
219
- <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M8.496 4.695a.75.75 0 0 0-.051 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.051 1.06L6.49 8.003 4.693 9.998a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
220
- </symbol>
221
- <symbol id="diffs-icon-symbol-moved-fill" viewBox="0 0 16 16">
222
- <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m1.555 4.745a.75.75 0 0 0-1.11 1.01L10.486 8l-2.04 2.245a.75.75 0 0 0 1.109 1.01l2.5-2.75a.75.75 0 0 0 0-1.01zm-4 0a.75.75 0 0 0-1.11 1.01l2.043 2.248-1.796 1.995a.75.75 0 0 0 1.116 1.004l2.25-2.5a.75.75 0 0 0-.003-1.007z" clip-rule="evenodd"/>
223
- </symbol>
224
- <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
225
- <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
226
- </symbol>
227
- </svg>`;function E8(e,t){return e==null||t==null?e===t:hse(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var D8={};function hse(e=D8,t=D8){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function O8(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function k8(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function A8(){let e=document.createElement(`style`);return e.setAttribute(ct,``),e}var gse=`@layer base,theme,rendered,unsafe;@layer base{:host{--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(#000,#fff);--diffs-gap-fallback:8px;--diffs-scrollbar-gutter-fallback:6px;--diffs-scrollbar-gutter:var(--diffs-scrollbar-gutter-override,var(--diffs-scrollbar-gutter-measured,var(--diffs-scrollbar-gutter-fallback)));--diffs-added-light:#0dbe4e;--diffs-added-dark:#5ecc71;--diffs-modified-light:#009fff;--diffs-modified-dark:#69b1ff;--diffs-deleted-light:#ff2e3f;--diffs-deleted-dark:#ff6762;--diffs-warning-light:#d5a910;--diffs-warning-dark:#ffd452;color-scheme:light dark;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);--diffs-bg:light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000));--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-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-gutter:var(--diffs-bg-context-gutter-override,light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)),color-mix(in lab, var(--diffs-bg-context) 45%, 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,#000),var(--diffs-dark,#fff));--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-fg-conflict-marker:var(--diffs-fg-conflict-marker-override,var(--diffs-fg-number));--diffs-deletion-base:var(--diffs-deletion-color-override,light-dark(var(--diffs-light-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-light))),var(--diffs-dark-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-dark)))));--diffs-addition-base:var(--diffs-addition-color-override,light-dark(var(--diffs-light-addition-color,var(--diffs-addition-color,var(--diffs-added-light))),var(--diffs-dark-addition-color,var(--diffs-addition-color,var(--diffs-added-dark)))));--diffs-modified-base:var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark)))));--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-emphasis:var(--diffs-bg-deletion-emphasis-override,light-dark(rgb(from var(--diffs-deletion-base) r g b / .15),rgb(from var(--diffs-deletion-base) r g b / .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-emphasis:var(--diffs-bg-addition-emphasis-override,light-dark(rgb(from var(--diffs-addition-base) r g b / .15),rgb(from var(--diffs-addition-base) r g b / .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)));background-color:var(--diffs-bg);color:var(--diffs-fg);display:block}pre,code,[data-error-wrapper]{isolation:isolate;font-family:var(--diffs-font-family,var(--diffs-font-fallback));outline:none;margin:0;padding:0;display:block}pre,code{background-color:var(--diffs-bg)}code{contain:content}input,button{font-family:inherit;font-size:inherit;line-height:inherit}*,:before,:after{box-sizing:border-box}[data-icon-sprite]{display:none}[data-diffs-header],[data-separator]{font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback))}[data-diffs-header][data-sticky]{z-index:1;background-color:var(--diffs-bg);position:sticky;top:0}[data-file-info]{color:var(--fg);background-color:color-mix(in lab, var(--bg) 98%, var(--fg));border-block:1px solid color-mix(in lab, var(--bg) 95%, var(--fg));padding:10px;font-weight:700}[data-diff],[data-file]{--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)}&:hover [data-code]::-webkit-scrollbar-thumb{background-color:var(--diffs-bg-context)}}@supports (-webkit-touch-callout:none){:host{--diffs-scrollbar-gutter-fallback:0px}}[data-line] span,[data-edit-prediction-suffix] span{color:light-dark(var(--diffs-token-light,var(--diffs-light)),var(--diffs-token-dark,var(--diffs-dark)));background-color:light-dark(var(--diffs-token-light-bg,inherit),var(--diffs-token-dark-bg,inherit));font-weight:light-dark(var(--diffs-token-light-font-weight,inherit),var(--diffs-token-dark-font-weight,inherit));font-style:light-dark(var(--diffs-token-light-font-style,inherit),var(--diffs-token-dark-font-style,inherit));text-decoration:light-dark(var(--diffs-token-light-text-decoration,inherit),var(--diffs-token-dark-text-decoration,inherit))}[data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions],[data-editor-overlay]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-computed-editor-active-line-bg:var(--diffs-computed-selected-line-bg);--diffs-computed-hovered-line-bg:var(--diffs-computed-editor-active-line-bg);--diffs-hover-mix-target:var(--diffs-bg-hover-override,var(--diffs-mixer));--diffs-line-bg:var(--diffs-computed-hovered-line-bg);color:var(--diffs-fg);background-color:var(--diffs-line-bg,var(--diffs-bg))}[data-line],[data-no-newline]{&[data-decoration-bg]{--mix-deco-light:92%;--mix-deco-dark:85%;&[data-decoration-bg-depth="2"]{--mix-deco-light:88%;--mix-deco-dark:80%}&[data-decoration-bg-depth="3"]{--mix-deco-light:85%;--mix-deco-dark:78%}--diffs-hover-mix-target:var(--diffs-decoration-bg);--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) var(--mix-deco-light), var(--diffs-decoration-bg)),color-mix(in lab, var(--diffs-bg) var(--mix-deco-dark), var(--diffs-decoration-bg)))}}[data-line-annotation],[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context);--diffs-computed-decoration-bg:var(--diffs-annotation-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-merge-conflict-actions],[data-gutter-buffer=merge-conflict-action],[data-gutter-buffer=merge-conflict-marker-base],[data-gutter-buffer=merge-conflict-marker-separator],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator]{--diffs-computed-decoration-bg:var(--diffs-bg-context);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-start],[data-merge-conflict=marker-start]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-end],[data-merge-conflict=marker-end]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-has-merge-conflict] [data-line-annotation],[data-has-merge-conflict] [data-gutter-buffer=annotation]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}:where([data-background]){& [data-gutter-buffer],& [data-column-number]{--mix-light:91%;--mix-dark:85%}& [data-line],& [data-no-newline]{--mix-light:88%;--mix-dark:80%}& [data-gutter-buffer],& [data-column-number],& [data-line],& [data-no-newline]{--diffs-diff-line-mix-target:var(--diffs-bg);&[data-line-type=change-deletion]{--diffs-diff-line-mix-target:var(--diffs-bg-deletion-override,var(--diffs-deletion-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-deletion-override,var(--diffs-deletion-base));--diffs-diff-line-mix-target:var(--diffs-bg-deletion-number-override,var(--diffs-deletion-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-line-type=change-addition]{--diffs-diff-line-mix-target:var(--diffs-bg-addition-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--diffs-bg-addition-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=current]{--diffs-diff-line-mix-target:var(--conflict-bg-current-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--conflict-bg-current-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=incoming]{--diffs-diff-line-mix-target:var(--conflict-bg-incoming-override,var(--diffs-modified-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-modified-base);--diffs-diff-line-mix-target:var(--conflict-bg-incoming-number-override,var(--diffs-modified-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}}}[data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline],[data-editor-overlay]{--diffs-selection-mix-target:var(--diffs-bg-selection-override,var(--diffs-selection-base));--diffs-selection-emphasis-mix-target:var(--diffs-selection-mix-target);&:where([data-editor-overlay]),&:where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline])[data-selected-line]{--mix-selection-light:82%;--mix-selection-dark:75%;--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line])){--mix-selection-light:75%;--mix-selection-dark:60%;--diffs-selection-mix-target:var(--diffs-bg-selection-number-override,var(--diffs-selection-base));--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-line][data-selected-line]):is([data-line-type=change-addition],[data-line-type=change-deletion]){--diffs-selection-emphasis-mix-target:light-dark(color-mix(in lab, var(--diffs-diff-line-mix-target,var(--diffs-selection-mix-target)) var(--mix-selection-light), var(--diffs-selection-mix-target)),var(--diffs-selection-mix-target))}&:where([data-editor-overlay]),&[data-selected-line]{--diffs-computed-selected-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-light), var(--diffs-selection-mix-target)),color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), var(--diffs-selection-mix-target)))}}[data-line][data-editor-active-line],[data-column-number][data-editor-active-line]{--diffs-computed-editor-active-line-bg:color-mix(in lab, var(--diffs-computed-selected-line-bg) var(--diffs-editor-active-line-source-mix,100%), var(--diffs-selection-emphasis-mix-target))}@media (pointer:fine){[data-line][data-hovered],[data-gutter-buffer][data-hovered],[data-column-number][data-hovered],[data-line-annotation][data-hovered],[data-no-newline][data-hovered],[data-merge-conflict][data-hovered],[data-merge-conflict-actions][data-hovered],[data-editor-overlay][data-hovered]{--diffs-computed-hovered-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 97%, var(--diffs-hover-mix-target)),color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 91%, var(--diffs-hover-mix-target)))}}[data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line]){color:var(--diffs-selection-number-fg)}[data-no-newline]{user-select:none;& span{opacity:.6}}[data-diff-type=split][data-overflow=scroll]{grid-template-columns:1fr 1fr;display:grid;& [data-additions]{border-left:1px solid var(--diffs-bg)}& [data-deletions]{border-right:1px solid var(--diffs-bg)}}[data-code]{grid-auto-flow:dense;grid-template-columns:var(--diffs-code-grid);overflow:var(--diffs-overflow-override,scroll) clip;overscroll-behavior-x:none;tab-size:var(--diffs-tab-size,2);padding-top:var(--diffs-gap-block,var(--diffs-gap-fallback));padding-bottom:max(0px, calc(var(--diffs-gap-block,var(--diffs-gap-fallback)) - var(--diffs-scrollbar-gutter)));scrollbar-gutter:stable;align-self:flex-start;display:grid}[data-diffs-scrollbar-measure]{opacity:0;pointer-events:none;scrollbar-gutter:auto;grid-template-columns:none;width:100px;height:100px;padding:0;position:absolute;top:-200px;left:-200px}[data-container-size]{container-type:inline-size}[data-code]::-webkit-scrollbar{width:0;height:var(--diffs-scrollbar-gutter)}[data-code]::-webkit-scrollbar-track{background:0 0}[data-code]::-webkit-scrollbar-thumb{background-color:#0000;background-clip:content-box;border:1px solid #0000;border-radius:3px}[data-code]::-webkit-scrollbar-corner{background-color:#0000}@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],&[data-dehydrated][data-diff-type=split][data-overflow=scroll]{padding-top:0}}[data-gutter]{grid-template-rows:subgrid;grid-template-columns:subgrid;z-index:3;background-color:var(--diffs-bg);grid-column:1;display:grid;position:relative;& [data-gutter-buffer],& [data-column-number]{border-right:var(--diffs-gap-style,2px solid var(--diffs-bg))}}[data-content]{grid-template-rows:subgrid;grid-template-columns:subgrid;background-color:var(--diffs-bg);grid-column:2;min-width:0;display:grid}[data-diff-type=split][data-overflow=wrap],[data-dehydrated][data-diff-type=split][data-overflow=scroll]{grid-auto-flow:dense;grid-template-columns:repeat(2, var(--diffs-code-grid));padding-block:var(--diffs-gap-block,var(--diffs-gap-fallback));display:grid;& [data-code]{display:contents}& [data-deletions]{& [data-gutter]{grid-column:1}& [data-content]{border-right:1px solid var(--diffs-bg);grid-column:2}}& [data-additions]{& [data-gutter]{border-left:1px solid var(--diffs-bg);grid-column:3}& [data-content]{grid-column:4}}}[data-dehydrated][data-diff-type=split][data-overflow=scroll] [data-content]{overflow:clip}[data-overflow=scroll] [data-gutter]{position:sticky;left:0}[data-interactive-lines] [data-line]{cursor:pointer}[data-interactive-line-numbers] [data-column-number]{cursor:pointer;touch-action:none}[data-content-buffer],[data-gutter-buffer]{user-select:none;min-height:1lh;position:relative}[data-gutter-buffer]{padding-left:2ch;padding-right:1ch;&:before{content:"";min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));display:block}}[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context-gutter);min-height:0}[data-gutter-buffer=buffer]{--diffs-line-bg:var(--diffs-bg-context-gutter)}[data-content-buffer]{background-position:5px 0;background-size:8px 8px;background-origin:border-box;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));grid-column:1}[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]{user-select:none;fill:currentColor;background-color:var(--diffs-bg);align-items:center;height:100%;display:flex;position:absolute;inset-inline:0}[data-content] [data-separator-wrapper]{display:none}[data-separator=metadata] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;color:var(--diffs-fg-number);white-space:nowrap;text-overflow:ellipsis;min-width:min-content;padding-inline:1ch;inset-inline:100% auto;overflow:hidden}[data-separator=line-info]{margin-block:var(--diffs-gap-block,var(--diffs-gap-fallback));& [data-separator-wrapper]{min-width:16px}}[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]{grid-template-columns:32px auto;display:grid}[data-expand-index] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:32px 32px auto}[data-expand-button],[data-separator-content]{background-color:var(--diffs-bg-separator);flex:none;align-items:center;display:flex}[data-expand-index] [data-separator-content]:hover{cursor:pointer;text-decoration:underline}[data-expand-button]{cursor:pointer;min-width:32px;color:var(--diffs-fg-number);border-right:2px solid var(--diffs-bg);flex-shrink:0;justify-content:center;align-self:stretch;&:hover{color:var(--diffs-fg)}&[data-expand-all-button]{display:none}}[data-expand-down] [data-icon]{transform:scaleY(-1)}[data-separator-content]{height:100%;color:var(--diffs-fg-number);flex:auto;justify-content:flex-start;padding:0 1ch;overflow:hidden}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-content]{user-select:none;height:100%;overflow:clip}}[data-unmodified-lines]{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;display:block;overflow:hidden}@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]{background-color:var(--diffs-bg-separator);border-top-right-radius:6px;border-bottom-right-radius:6px;height:100%;display:block;& [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);height:100%;margin-right:var(--diffs-gap-inline,var(--diffs-gap-fallback));border-top-right-radius:6px;border-bottom-right-radius:6px;display:block;& [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]{grid-template-rows:50% 50%;display:grid;& [data-separator-content]{grid-area:1/2/-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]{min-height:var(--diffs-annotation-min-height,0);z-index:2}[data-merge-conflict-actions]{z-index:2}[data-separator=custom]{grid-template-columns:subgrid;display:grid}[data-line],[data-column-number],[data-no-newline]{padding-inline:1ch;position:relative}[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{user-select:none;width:1ch;height:1lh;display:inline-block;position:absolute;top:0;left:0}}}& [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:"";user-select:none;contain:strict;width:4px;height:100%;display:block;position:absolute;top:0;left:0}}}& [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]{white-space:pre-wrap;word-break:break-word}& [data-annotation-content]{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;user-select:none;color:var(--diffs-fg-number);padding-left:2ch}[data-line-number-content]{min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));z-index:1;display:inline-block;position:relative}[data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{min-width:4px;padding:0;&:before{min-width:0}}& [data-line-number-content]{display:none}& [data-gutter-utility-slot]{right:unset;justify-content:flex-start;left:0}&[data-indicators=bars] [data-gutter-utility-slot]{left:6px}}[data-file][data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{border-right:0;min-width:0}}[data-diff-span]{box-decoration-break:clone;border-radius:3px}[data-line-type=change-addition] [data-diff-span]{background-color:var(--diffs-bg-addition-emphasis)}[data-line-type=change-deletion] [data-diff-span]{background-color:var(--diffs-bg-deletion-emphasis)}[data-merge-conflict=marker-start],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator],[data-merge-conflict=marker-end]{color:var(--diffs-fg);padding-left:1ch}[data-merge-conflict=marker-start],[data-merge-conflict=marker-end]{align-items:center;display:flex;&:after{color:var(--diffs-fg-conflict-marker);font-size:.75rem;font-style:normal;line-height:1.25rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));padding-left:1ch}}[data-merge-conflict=marker-start]:after{content:"(Current Change)"}[data-merge-conflict=marker-end]:after{content:"(Incoming Change)"}[data-merge-conflict-actions-content]{min-height:1.75rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));color:var(--diffs-fg);align-items:center;gap:.25rem;padding-inline:.5rem;font-size:.75rem;line-height:1.2;display:flex}[data-merge-conflict-action]{appearance:none;color:var(--diffs-fg-number);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;font-style:normal}[data-merge-conflict-action]:hover{color:var(--diffs-fg)}[data-merge-conflict-action=current]:hover{color:var(--diffs-addition-base)}[data-merge-conflict-action=incoming]:hover{color:var(--diffs-modified-base)}[data-merge-conflict-action-separator]{color:var(--diffs-fg-number);opacity:.6;user-select:none}[data-diffs-header=default]{background-color:var(--diffs-bg);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));z-index:2;flex-direction:row;padding-inline:16px;display:flex;position:relative;top:0}[data-header-content]{align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));white-space:nowrap;flex-direction:row;min-width:0;display:flex}[data-header-content] [data-prev-name],[data-header-content] [data-title]{text-overflow:ellipsis;white-space:nowrap;direction:rtl;min-width:0;overflow:hidden}[data-prev-name]{opacity:.7}[data-rename-icon]{fill:currentColor;flex-grow:0;flex-shrink:0}[data-diffs-header=default] [data-metadata]{white-space:nowrap;align-items:center;gap:1ch;display:flex}[data-diffs-header=default] [data-additions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-addition-base)}[data-diffs-header=default] [data-deletions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-deletion-base)}[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:.6}[data-annotation-content]{z-index:2;isolation:isolate;white-space:normal;align-self:flex-start;min-width:0;display:flow-root;position:relative}[data-overflow=scroll] [data-annotation-content],[data-overflow=scroll] [data-merge-conflict-actions-content]{width:var(--diffs-column-content-width,auto);left:var(--diffs-column-number-width,0);position:sticky}[data-annotation-slot]{text-wrap-mode:wrap;word-break:normal;white-space-collapse:collapse}[data-gutter-utility-slot]{touch-action:none;justify-content:flex-end;display:flex;position:absolute;top:0;bottom:0;right:0}[data-utility-button]{appearance:none;cursor:pointer;width:1lh;height:1lh;font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);background-color:var(--diffs-modified-base);color:var(--diffs-bg);fill:currentColor;z-index:4;touch-action:none;border:none;border-radius:4px;justify-content:center;align-items:center;margin-right:calc(-1lh + 1ch);padding:0;display:flex;position:relative;&:before{content:"";display:block;position:absolute;inset:0 0 0 -4px}}[data-decoration-bar-stack]{pointer-events:none;isolation:isolate;z-index:1;background-color:var(--diffs-decoration-bar-color,transparent);box-sizing:content-box;border-left:2px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg);width:6px;position:absolute;top:0;bottom:0;right:-2px;[data-decoration-bar-depth="1"] &{background-color:color-mix(in lab, var(--diffs-bg) 20%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="2"] &{background-color:color-mix(in lab, var(--diffs-bg) 45%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="3"] &{background-color:color-mix(in lab, var(--diffs-bg) 65%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-start] &{border-top-left-radius:5px;border-top-right-radius:5px}[data-decoration-bar-end] &{z-index:3;border-bottom-right-radius:5px;border-bottom-left-radius:5px}}[data-placeholder]{contain:strict}[data-error-wrapper]{padding:var(--diffs-gap-block,var(--diffs-gap-fallback)) var(--diffs-gap-inline,var(--diffs-gap-fallback));scrollbar-width:none;max-height:400px;overflow:auto;& [data-error-message]{color:var(--diffs-deletion-base);font-size:18px;font-weight:700}& [data-error-stack]{color:var(--diffs-fg-number)}}}@layer theme,rendered,unsafe;
228
- `,j8;function M8(e){if(j8!=null)return j8;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(_t,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),j8=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),j8}function N8(e){let t=e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`;return`${ht}: ${t};`}var P8=`@layer base, theme, rendered, unsafe;`,_se=RegExp(`${vse(ht)}\\s*:\\s*[^;]+;`);function F8(e){return`${P8}
229
- @layer unsafe {
230
- ${e}
231
- }`}function I8(e,t=`system`,n){return`${P8}
232
- @layer rendered {
233
- :host {${t===`system`?``:`
234
- color-scheme: ${t};`}
235
- ${N8(n)}
236
- ${e}
237
- }
238
- }`}function L8(e,t){let n=N8(t);return e.replace(_se,n)}function vse(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var yse=new WeakMap;function R8(e){return yse.get(e)??e}function z8({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function B8(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function V8(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function H8(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}var bse=void 0;function xse(){return bse??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function U8(e,t,n){let r=new Map;for(let i of e){let e=R8(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function Sse(e,t,n){for(let r of t){let t=R8(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function Cse(e,t,n){if(e==null)return n(t);let r=R8(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function wse(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function W8(e,t){let n=e?.offsetHeight??0;if(e==null||n===0)t();else{e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}}function Tse({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``)t?.remove();else return t??=Ese(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Ese(){let e=document.createElement(`style`);return e.setAttribute(St,``),e}var Dse=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`),this.name=`WorkerPoolTerminatedError`}},Ose=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`),this.name=`WorkerPoolTaskCanceledError`}},kse=class extends Error{constructor(e,t){super(e,t),this.name=`WorkerPoolWorkerError`}},Ase=new WeakSet;function jse(e){return e instanceof Dse||e instanceof Ose}function Mse(e){return jse(e)||e instanceof kse&&Ase.has(e)}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(gse)),t.adoptedStyleSheets=[e]}connectedCallback(){M8(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(st,t)}function G8(e){return{...mt,...e}}function K8(e,t){return q8(e,t)+Nse(e,t)}function q8(e,t){return t?0:e.diffHeaderHeight}function Nse(e,t){return e.paddingTop??(t?e.spacing:0)}function J8(e){return e.paddingBottom??e.spacing}function Pse(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function Y8(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function X8(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Z8(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function Q8(e){return{...e,hunks:Z8(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function $8(e,t){return e-(t===0?0:1)}function e5(e,t){return $8(e,t)+t}var Fse=1;function t5(e,...t){return`ck${Fse}:${JSON.stringify([e,...t])}`}function n5(e){return e===``?[]:e.split(bt)}function r5(e,t,n){let r=e===`clone`?Q8(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Ise(r,Rse(r,n),i5(r,n));case`rename-pure`:{let e=i5(r,n);zse(r,n);let t=n5(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,a5(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Ise(e,t,n){let r=n5(t.contents),i=n5(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=Lse(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,a5(e,t,n),e}function Lse(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent)e.type===`context`?(p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines):(p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions);let m=Math.max($8(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=e5(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=e5(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function Rse(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function i5(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function zse(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function Bse(e,t,n){return e.cacheKey==null?Vse(t,n):`${e.cacheKey}:hydrated`}function a5(e,t,n){let r=Bse(e,t,n);r==null?delete e.cacheKey:e.cacheKey=r}function Vse(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?t5(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}function o5(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Hse=new TextEncoder,Use=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Wse=/[\uD800-\uDFFF]/,s5=1024,c5=new Uint8Array(s5);function l5(){c5.length!==s5&&(c5=new Uint8Array(s5))}function u5(e){if(e.length===0)return e;if(Wse.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;c5.length<t&&(c5=new Uint8Array(t));let{written:n}=Hse.encodeInto(e,c5);return Use.decode(c5.subarray(0,n))}var Gse=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Kse={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
239
- `,v:`\v`,f:`\f`,r:`\r`};function qse(e){if(e[0]!==`"`)return;let t=``,n=1;for(;n<e.length;){let r=e[n];if(r===`"`)return{fileName:t,rawLength:n+1};if(r!==`\\`){t+=r,n++;continue}let i=Kse[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=Jse(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=Gse.decode(new Uint8Array(a))}}function Jse(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48,i=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&r>=0&&r<=7&&i>=0&&i<=7)return n*64+r*8+i}var Yse=4096,Xse=.5;function Zse(e){for(let t of e.hunks)for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=$se(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function Qse(e,t,n){let{hunkContent:r}=e;for(let e=1;e<r.length;e++){let i=r[e],a=r[e-1];if(i.type!==`change`||i.additions>0&&i.deletions>0||a.type!==`context`)continue;let o=i.additions>0,s=o?t.additionLines:t.deletionLines,c=o?i.additionLineIndex:i.deletionLineIndex,l=o?i.additions:i.deletions,u=s[c]??``;if(u.trim()!==``)continue;let d=!0;for(let e=1;e<l;e++)if(s[c+e]!==u){d=!1;break}if(!d)continue;let f=0;for(;f<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-f]===u;)f++;if(f===0||e===1&&f===a.lines||n!=null&&(f=n(i,f),f===0))continue;i.additionLineIndex-=f,i.deletionLineIndex-=f;let p=i.additionLineIndex+i.additions,m=i.deletionLineIndex+i.deletions,h=r[e+1];h?.type===`context`?(h.lines+=f,h.additionLineIndex=p,h.deletionLineIndex=m):r.splice(e+1,0,{type:`context`,lines:f,additionLineIndex:p,deletionLineIndex:m}),a.lines-=f,a.lines===0&&(r.splice(e-1,1),e--)}}function $se(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>Yse)return null;let c=[];for(let t=0;t<n;t++)c.push(d5(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(d5(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=tce(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*Xse:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var ece=/\s+/g;function d5(e){return e.replace(ece,``)}function tce(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}var nce=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function rce(e,t,n=!1,r){let i=dce(e),a=i?ace(e):oce(e),o,s=[];for(let e of a){if(i&&!yt.test(e)||!i&&!sce(e)){if(o==null)o=u5(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=p5(e,{cacheKey:t==null?void 0:r==null?t5(`patch-file`,t,String(s.length)):t5(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function f5(e,t){try{return p5(e,t)}finally{l5()}}function p5(e,{cacheKey:t,isGitDiff:n=yt.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=C5(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=_5(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=x5(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?g5(i.contents):[],deletionLines:!l&&r!=null&&i!=null?g5(r.contents):[],cacheKey:T5(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(nce);if(t==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=h5(t[1],!0),r=h5(t[2],!0);c.name=u5(r),n!==r&&(c.prevName=u5(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(pt):null;if(t!=null){let[,e,r]=t,i=h5(r,n);if(e===`---`&&i!==`/dev/null`){let e=u5(i);c.prevName=e,c.name=e}else e===`+++`&&i!==`/dev/null`&&(c.name=u5(i))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=u5(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=u5(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=u5(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=u5(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(lt)??[];t!=null&&(c.prevObjectId=u5(t)),n!=null&&(c.newObjectId=u5(n)),r!=null&&(c.mode=u5(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(c.prevName=u5(h5(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(c.name=u5(h5(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
240
- `||s[s.length-1]===`\r`||s[s.length-1]===`\r
241
- `||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:T5(p.hunkContext),hunkSpecs:u5(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!cce(t)||lce(t))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=fce(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=E5(t);(g==null||g.type!==`change`)&&(g=D5(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=E5(t);(g==null||g.type!==`change`)&&(g=D5(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=E5(t);(g==null||g.type!==`context`)&&(g=D5(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=o5(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=o5(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=$8(b.additionStart,b.additionCount)+(x===0?0:1),t=$8(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max($8(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=e5(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=e5(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),Zse(c),c}}function m5(e,t,n=!1){let r=[],i=ice(e)?e.split(ot):[e];for(let e of i)try{r.push(rce(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{l5()}return r}function h5(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?qse(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function ice(e){return e.startsWith(`From `)||e.includes(`
242
- From `)}function g5(e){let t=_5(e);for(let e=0;e<t.length;e++)t[e]=u5(t[e]);return t}function _5(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
243
- `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function ace(e){return C5(e,`diff --git`)}function oce(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=b5(e,r);if(i<=0&&a<=0){if(v5(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=b5(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=x5(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];c===`\\`||(c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0))),r=s}return t.push(e.slice(n)),t}function sce(e){return v5(e,0)}function v5(e,t){let n=b5(e,t);return y5(e,t,`---`)&&y5(e,n,`+++`)}function y5(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
244
- `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function b5(e,t){let n=e.indexOf(`
245
- `,t);return n===-1?e.length:n+1}function cce(e){let t=e[0];return t===`+`||t===`-`||t===` `}function lce(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
246
- `&&n!==`\r`)return!1}return!0}function x5(e){if(!e.startsWith(`@@ -`))return;let t=4,n=S5(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=S5(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=S5(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=S5(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=uce(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function S5(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function uce(e){return e.endsWith(`\r
247
- `)?e.slice(0,-2):e.endsWith(`
248
- `)?e.slice(0,-1):e}function dce(e){return e.startsWith(`diff --git`)||e.includes(`
249
- diff --git`)}function C5(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:w5(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=w5(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function w5(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function T5(e){return e==null?e:u5(e)}function fce(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function E5(e){let t=e.slice(1);return u5(t===``?`
250
- `:t)}function D5(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var pce=`/dev/null`;function O5(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??k5(),a=t??k5(),o=f5(cI(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?t5(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function k5(){return{name:pce,contents:``}}var A5=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,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));n==null||t==null?this.cleanUp():(this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.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 j5(e,t){return v6(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function M5(e){return X({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function N5(e){return X({tagName:`div`,children:[X({tagName:`span`,children:[S6(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function P5(e){return X({tagName:`div`,children:[C6({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function F5({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(X({tagName:`div`,children:[S6(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(P5(`up`)),s++),o||(e.push(P5(`down`)),s++)):(e.push(P5(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(X({tagName:`div`,children:[X({tagName:`span`,children:[S6(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(X({tagName:`div`,children:[S6(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(X({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(X({tagName:`slot`,properties:{name:i}})),X({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function I5(e,t){return`hunk-separator-${e}-${t}`}function L5(e){let t=e.at(-1);return t==null?0:Math.max(e5(t.additionStart,t.additionCount),e5(t.deletionStart,t.deletionCount))}function R5({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function z5({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;r===o||r&&e.value.length===1&&!o?a[1]+=e.value:t.push([+!r,e.value])}function B5(e){return[$8(e.additionStart,e.additionCount)+1,e5(e.additionStart,e.additionCount)+1]}function V5({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function mce(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-e5(t.additionStart,t.additionCount),r=e.deletionLines.length-e5(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function H5({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-e5(n.additionStart,n.additionCount),i=e.deletionLines.length-e5(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function U5({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=H5({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function W5({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=B5(a);if(t<o){let s=V5({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=U5({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=B5(a);return t<o+i.fromStart||t>=o+i.rangeSize}function hce({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=B5(n),l=V5({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=U5({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t)}else for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function G5({type:e,metrics:t}){return t.hunkSeparatorHeight??Pse(e)}function K5({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function gce({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function _ce(e){return e!==`simple`&&e!==`metadata`}function q5({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!gce({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=G5({type:e,metrics:t}),a=K5({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function J5({type:e,metrics:t}){if(!_ce(e))return;let n=G5({type:e,metrics:t}),r=K5({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Y5({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=vce({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=$8(r.deletionStart,r.deletionCount),s=$8(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=V5({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?U5({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(Z5(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,Z5(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(Z5(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=bce(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(xce({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(Z5(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function vce({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=X5({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function X5({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=V5({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?U5({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function yce(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function Z5(e,t,n,r,i,a){let[o,s]=yce(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function bce(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function xce({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var Sce={forcePlainText:!1};function Q5(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=Sce){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=v8({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??Tce();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}Y5({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&wce({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=Ece({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m)f.deletionLines=s,f.additionLines=c;else{if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else x8(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else x8(f.additionLines,c)}}return{code:f,themeStyles:u,baseThemeType:l}}function Cce(e,{deletionLineIndex:t,additionLineIndex:n,deletionDecorations:r,additionDecorations:i}){let a=0,o=0,s=-1,c=0,l=-1,u=0;for(let{value:t,added:n,removed:r}of e)r?(s===-1&&(s=a),a+=t.length,c=a):n?(l===-1&&(l=o),o+=t.length,u=o):(a+=t.length,o+=t.length);s!==-1&&r.push(R5({line:t,spanStart:s,spanLength:c-s})),l!==-1&&i.push(R5({line:n,spanStart:l,spanLength:u-l}))}function wce({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=o5(e),t=o5(t),e.length>s||t.length>s))return;let c=o===`char`?PF(e,t):ZF(e,t);if(o===`word-line`){Cce(c,{deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a});return}let l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(z5({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),z5({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?z5({item:e,arr:l,enableJoin:d,isLastItem:t}):z5({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(R5({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(R5({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Tce(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Ece({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??$6(e.name),d=s??$6(t.name),{state:f,transformers:p}=l8(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:d8(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:d8(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,b8(i.codeToHast(o5(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,b8(i.codeToHast(o5(t.contents),m)))}}function $5(e,t){let n=O5({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Dce(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function Oce(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function e7(e,t){return t.length>0&&t.length<e.deletionLines.length&&Oce(t)}function t7(e,t,n){let r=e.deletionLines.join(``),i=Dce(t.length,r),a=O5({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function n7(e,t){return t7(e,[``],t)}function r7(e,t){if(e.additionLines.length===0)return n7(e,t);if(e7(e,e.additionLines))return t7(e,e.additionLines,t);let n=e.additionLines,r=$5(e,t);return i7(r,n),r}function kce(e){return e.length>1&&e.at(-1)===``}function i7(e,t){if(!kce(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&e5(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,l7(e);return}}}function Ace(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return a7(e,$5(e,n));let r=Array.from(t);if(r.length===0)return a7(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||o5(r)===o5(i))return a7(e,$5(e,n))}let i=jce(e,r);if(i.size===0)return a7(e,$5(e,n));for(let t of i)if(!Nce(e,t,n))return a7(e,$5(e,n));return l7(e),mce(e)?a7(e,$5(e,n)):a7(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function a7(e,t){return Object.assign(e,t),t}function jce(e,t){let n=new Set;for(let r of t){let t=Mce(e,r);if(t==null)return new Set;n.add(t)}return n}function Mce(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function Nce(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=O5({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(Pce(r,s),o7(e,t),!0)}function o7(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
251
- `),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
252
- `)}function Pce(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>s7(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,c7(e)}function s7(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function c7(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function l7(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max($8(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,c7(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=e5(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-e5(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var u7=new WeakMap;function Fce(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function Ice(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function d7(e,t,n){let r=e.hunks,i=e.additionLines,a=Fce(i),o=a===i?e:{...e,additionLines:a},s=Kce(r,Wce(o,t,n),e.deletionLines.length),c=Yce(o,s);if(e.additionLines=a,e.hunks=c,e.editSessionDirty=!0,$ce(e),i7(e,i),Zce(r,e.hunks))return{regions:s.map(e=>e.previousSpan)}}function Lce(e,t,n,r){let i=new Set(t),a=Array.from(i).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(a.length===0)return;let o=t=>i.has(t)?r?.get(t):e.additionLines[t],{hunks:s}=e,c,l=0;for(let t of a){for(;l<s.length;){let e=s[l];if(t<h7(e)+e.additionCount)break;l++}let r=s[l],i=r==null?void 0:h7(r);if(i==null||t<i||c!=null&&c!==l)return d7(e,n,o);c=l}if(c!=null){if(Rce(e,a,c,r,n))e.editSessionDirty=!0;else return d7(e,n,o)}}function Rce(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=zce(e),o=e.hunks[n];if(o.hunkContent.some(Bce))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function zce(e){let t=u7.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return u7.set(e,{lines:e.deletionLines,set:n}),n}function Bce(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Vce(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function Hce(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=V5({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=g7(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=U5({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=g7(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function Uce(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=g7(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,g7(i)+i.deletionCount,e.deletionLines.length),n}function f7(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?$5(e,t):r7(e,t)),!0)}function Wce(e,t,n){if(Ice(e.deletionLines,e.additionLines)==null)return[];let r=O5({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),i,a=(t,a)=>{i??=Gce(e.hunks);for(let e=0;e<=a;e++){let o=i.get(t.deletionLineIndex-e);if(o!=null&&o.additions===t.additions&&o.deletions===t.deletions){if(t.additions>0&&n!=null){for(let e=0;e<t.additions;e++)if(n(o.additionLineIndex+e)!==r.additionLines[t.additionLineIndex+e])return a}return e}}return a},o=[],s=0,c=0;for(let e of r.hunks){Qse(e,r,a);let t=e.additionCount>0?e.additionLineIndex-s:e.deletionLineIndex-c;s+=t,c+=t;for(let t of e.hunkContent){if(t.type===`context`){s+=t.lines,c+=t.lines;continue}let e=s7(t,0,0);e.additions===0&&(e.additionLineIndex=s),e.deletions===0&&(e.deletionLineIndex=c),o.push(e),s+=e.additions,c+=e.deletions}}return o}function Gce(e){let t=new Map;for(let n of e)for(let e of n.hunkContent)e.type===`change`&&(e.additions===0||e.deletions===0)&&t.set(e.deletionLineIndex,e);return t}function Kce(e,t,n){let r=e.map((e,t)=>{let n=g7(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&qce(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=Jce(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function qce(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function Jce(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function Yce(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);p7(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);p7(s,c,i,r),r+=c,i+=c,n.push(Xce(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function Xce(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:_7(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:v7(t.additionStart,r),deletionStart:_7(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:v7(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${_7(t.deletionStart,i)},${i} +${_7(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return c7(s),s}function p7(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Zce(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(g7(r)!==g7(i)||r.deletionCount!==i.deletionCount||h7(r)!==h7(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Qce(r,i))return!0}return!1}function Qce(e,t){let n=m7(e),r=m7(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*m7(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function h7(e){return $8(e.additionStart,e.additionCount)}function g7(e){return $8(e.deletionStart,e.deletionCount)}function _7(e,t){return t===0?e:e+1}function v7(e,t){return t===0?e-1:e}function $ce(e){l7(e);for(let t=0;t<e.hunks.length;t++)o7(e,t)}function y7(e){let t=e.lang??$6(e.name),n=e.lang??(e.prevName==null?`text`:$6(e.prevName));return t===`text`&&n===`text`}var ele=-1,b7=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++ele}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:rt},t=n8,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=Ft(e.theme??rt)?It():void 0)}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.editSessionActive?(this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0):this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(e,t){let{editSessionActive:n}=this;this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,n&&this.renderCache!=null&&this.renderCache.diff!==e&&this.clearRenderCache();let{renderCache:r}=this;if(!e.isPartial&&e.additionLines.length===0){Object.assign(e,n7(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&Y8(r.diff,t),{result:s}=r;!r.highlighted||s==null||!j5(r.options,i)||!a&&!o?this.clearRenderCache():a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff??this.clearRenderCache()}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!Y8(t.diff,e)||y7(e)||k7(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!Y8(n,e)||!Y8(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);j5(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??gt}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1,r,i){this.pendingStructuralRows=void 0;let{renderCache:a}=this;if(a==null)return!1;let{result:o,diff:s}=a;if(o==null)return!1;if(s.isPartial)throw Error(`Could not update render cache for partial diff`);let c=o.code.additionLines,l=this.pendingStructuralRows=n?new Map:void 0,u=[],d=new Map;if(l==null&&r!=null){let t=s.additionLines.length,n=ile(s.additionLines,i);for(let[i,a]of r){if(i<0||i>t||i===t&&(a===``||!n))continue;let r=s.additionLines[i]??``;r!==a&&(s.additionLines[i]=a,u.push(i),d.set(i,r),e.has(i)||(c[i]=D7(i,o5(a))))}}for(let[t,n]of e){let e=c[t]?.properties??{},i=n.map(e=>e[2]).join(``),a=t<s.additionLines.length,o=a?s.additionLines[t]??``:``,f=o5(o);l==null&&a&&r?.has(t)!==!0&&(s.additionLines[t]=pse(o,i),f!==i&&(u.push(t),d.set(t,o)));let p={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};l==null?c[t]=p:l.set(t,p)}let f=!1;if(u.length>0){if(this.editSessionActive){if(s.additionLines.length<=1&&s.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(s,n7(s,this.options.parseDiffOptions)),f=!0;else if(e7(s,s.additionLines))this.applyRecomputePreservingSessionType(s,t7(s,s.additionLines,this.options.parseDiffOptions)),f=!0;else{let e=Lce(s,u,this.options.parseDiffOptions,d);this.applyExpansionRemap(e),f=e!=null}}else Object.assign(s,Ace(s,u,this.options.parseDiffOptions))}return o.baseThemeType=t,a.isDirty=!0,f}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Vce(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;this.pendingStructuralRows=void 0;let r=this.diff??n?.diff;if(r==null)return;let i=n?.result;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=ale(e),i!=null&&(i.code.additionLines=rle(a,r.additionLines,i.code.additionLines,e)),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,n7(r,this.options.parseDiffOptions)),i!=null&&(i.code.additionLines[0]=D7(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(r,a):Object.assign(r,r7(r,this.options.parseDiffOptions)),t!=null&&i!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n!=null&&(n.isDirty=!0)}applySessionDocumentChange(e,t){let{parseDiffOptions:n}=this.options,r=e.additionLines;e7(e,r)?this.applyRecomputePreservingSessionType(e,t7(e,r,n)):this.applyExpansionRemap(d7(e,n,e=>t[e]))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>K6(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=rt,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=Dt,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await At(t8(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=k7(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!j5(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!y7(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLangs=O7(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??rt}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!Y8(e,n.diff)||!j5(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(Y8(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||y7(e)||k7(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||Y8(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&Ft(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&Ft(t.theme)}renderDiff(e=this.diff,t=Ot){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||y7(e)||k7(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!Y8(e,this.renderCache.diff),d=!G6(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&r8(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,r8(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=O7(e),this.highlighter??=It();let t=this.highlighter!=null&&Ft(i.theme),n=this.highlighter!=null&&Rt(this.computedLangs),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Ot){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return Y6({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=k7(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:O7(e);let n=this.highlighter!=null&&Ft(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&Rt(this.computedLangs);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=Q5(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(Y5({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=D7(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i!=null&&a!=null&&Y8(i,e)&&j5(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&j5(a.options,n)&&Y8(a.diff,i)||(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&j5(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&Y8(n.diff,e)&&j5(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Y8(e,n.diff)&&j5(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=ole(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:T6(),deletionsGutterAST:T6(),additionsGutterAST:T6(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=H5({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){a!==`unified`&&(this.size<=0||this.side==null?(this.side=void 0,this.size=0):(this.side===`additions`?(x.pushToGutter(`additions`,D6(void 0,`buffer`,this.size)),h?.push(M5(this.size))):(x.pushToGutter(`deletions`,D6(void 0,`buffer`,this.size)),g?.push(M5(this.size))),this.size=0,this.side=void 0))}},w=(e,t,n,r,i)=>{x.pushToGutter(e,E6(t,n,r,i))};function T(e){C.flush(),a===`unified`?w7(`unified`,e,x):(w7(`deletions`,e,x),w7(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Y5({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&x7(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=T7(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=T7(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),C7({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&x7(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&S7(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=T7(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=T7(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}C7({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&S7(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(N5(e)),x.pushToGutter(`unified`,D6(e,`metadata`,1))):(x.deletionsContentAST.push(N5(e)),x.pushToGutter(`deletions`,D6(e,`metadata`,1)),k||(x.pushToGutter(`additions`,D6(void 0,`buffer`,1)),x.additionsContentAST.push(M5(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(N5(e)),x.pushToGutter(`unified`,D6(e,`metadata`,1))):(x.additionsContentAST.push(N5(e)),x.pushToGutter(`additions`,D6(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,D6(void 0,`buffer`,1)),x.deletionsContentAST.push(M5(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(L5(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,A=x.rowCount>0||D;h=O&&A?h:void 0,g=k&&A?g:void 0,_=f&&A?_:void 0;let j=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&A?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&A?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&A?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:j,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=T6(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,mse(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(X({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(X({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(X({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Mt(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Mt(t==null?e:X({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!w8(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(C8(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(C8(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;C7(t===`unified`?{diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r}:{diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return J6({fileOrDiff:e,mode:t,stickyHeader:n})}},tle=new Intl.PluralRules(`en-US`);function nle(e){return`${e} unmodified line${tle.select(e)===`one`?``:`s`}`}function x7(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function S7(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function C7({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,D6(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,D6(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,D6(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function w7(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,F5({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(F5({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,F5({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(F5({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=I5(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?nle(n):`More unchanged context may be available`;c.pushToGutter(e,F5({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(F5({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function T7(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function E7(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function rle(e,t,n,r){let i=E7(e),a=E7(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=D7(e,r.getLineText(e));return l}function ile(e,t){return t===e.length+1&&e.at(-1)?.endsWith(`
253
- `)===!0}function D7(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function ale(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function O7(e){if(e.lang!=null)return[e.lang];let t=$6(e.prevName??e.name),n=$6(e.name);return t===n?[n]:[t,n]}function k7(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function ole(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function A7(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function j7(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function M7(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function N7({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function sle(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:wse(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,parseDiffOptions:e?.parseDiffOptions,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function P7(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function cle(e){let t={...e};return delete t.cacheKey,t}function F7(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??$6(e.name),r=t.lang??$6(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function lle(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function ule(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&lle(n.lines,t.deletionLines)}var dle=-1,I7=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++dle}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:rt},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new H6,this.scrollSyncManager=new A5,this.interactionManager=new A6(`diff`,j6(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??rt}getHunksRendererOptions(e){return sle(e)}createHunksRenderer(e){return new b7(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=$8(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}}else{for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(j6(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!v6(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Cse(this.editSession?.annotations,e,n8);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;t==null?this.lineAnnotations=e:this.isNewAnnotations(e)&&(this.lineAnnotations=e,Sse(t,e,n8))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;h6(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=N7(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||hle(this.pre,ple({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||gle(this.headerElement,mle({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),B8(e,t);for(let t of e.shadowRoot?.children??[])if(t instanceof SVGElement)this.spriteSVG=t;else if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)e instanceof HTMLElement&&e.tagName.toLowerCase()===`code`&&(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e))}else`diffsHeader`in t.dataset?this.headerElement=t:t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)?this.themeCSSStyle=t:t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent)}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?O5(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,n),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||!P7(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw Error(`FileDiff: loadDiffFiles is required to load full files for a partial diff`);let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}__canAttachEditor(){return this.fileDiff!=null&&!this.fileDiff.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;let e=this.__prepareForEditing();if(e==null)throw this.fileDiff?.isPartial===!0&&!P7(this.fileDiff)?Error(`FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff`):Error(`FileDiff.prepareForEditing: a partial diff requires loadDiffFiles`);if(await e,!this.__canAttachEditor())throw Error(`FileDiff.prepareForEditing: the diff did not finish loading`)}__prepareForEditing(){if(!this.__canAttachEditor()){if(this.fileDiff?.isPartial===!0&&!P7(this.fileDiff))throw Error(`FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit`);return this.loadFilesIfNecessary(),this.pendingFiles?.promise}}async loadFilesForDiff(e,t){try{let n=await t(e);if(this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){this.fileDiff===e&&e.isPartial&&(r5(`merge`,e,t),this.setHydratedState(t),this.installHydratedSessionDiff(e)?this.rerender():(await M7(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender()))}installHydratedSessionDiff(e){if(e.isPartial)throw Error(`FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing`);return this.fileDiff===e&&this.editSession?.outgoingDiff!=null&&(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(Y8(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=U8(t,n8,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:n5(t.contents),a=n!=null&&ule(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=cle(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,l7(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??U8(this.lineAnnotations,n8),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=N7(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!L7(u,this.deletionFile)||!L7(d,this.additionFile)),y=e!=null&&!Y8(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&G6(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=O5(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(f7(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,ut);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!Y8(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,{fileDiff:s}=this,c=o!=null&&s!=null&&o!==i,l=c&&o!=null&&s!=null?F7(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??$6(i.name),c=It({theme:o,lang:s});c==null?At({themes:kt(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||r8(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Y5({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&F7(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?Z8(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);if(!this.__canAttachEditor())throw Error(`FileDiff.__attachEditor: a complete diff is required before editing`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(fle(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=Q8(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=Hce(e,this.hunksRenderer.getExpandedHunksMap(),t);return f7(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(Uce(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(e,t){this.applyDocumentChange(e,t),this.hunksRenderer.clearRenderCache()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;this.hunksRenderer.updateRenderCache(e,t,a,n.changedDocumentLines,n.documentLineCount)?(this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender()):i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return W5({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return hce({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=B5(o);if(e<s){let c=V5({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=U5({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=B5(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){m6(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||y7(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{Mse(e)||console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!j7(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!A7(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:O8(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=k8();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:H8(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):H8(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=T8;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.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,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a}}=this,o=(n!==this.editSession?.diff&&Y8(r,n)?i:void 0)??Mt(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,at,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,xt,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,zt,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,it,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;t!=null&&(e==null||e===``?(this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0):(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=A8(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=F8(e),this.appliedUnsafeCSS=e))}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=M8(i);this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c?this.appliedThemeCSS.theme=s:this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i?(this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}):(this.themeCSSStyle=Tse({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:I8(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c})}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=L8(this.themeCSSStyle.textContent??``,M8(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&xse()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?W8(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=R7(t[0]),a=R7(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=Mt(i),r.content.innerHTML=Mt(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=z8({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=z8({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=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=z8({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=R7(r?.[0]),a=R7(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=R7(r?.[0]),a=R7(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=Mt(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?W8(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=R7(t[0]),i=R7(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset))e.remove(),u.remove(),i++;else if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset)(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;else if(`separator`in e.dataset&&`separator`in u.dataset)(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);else if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset)(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);else if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);else if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a}else throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){t==null||this.shouldDisableVirtualizationBuffers()?(this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)):(t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0))}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};E8(u,this.appliedPreAttributes)||(V8(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function fle(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function L7(e,t){return e==null||t==null?e==null&&t==null:X8(e,t)}function ple({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function mle({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function hle(e,t,n=!1){return!n&&e==null&&t}function gle(e,t,n=!1){return e==null&&t&&!n}function R7(e){if(e!=null&&e.type===`element`)return e.children??[]}function _le({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=K8(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=V5({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=q5({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=vle(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?U5({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=J5({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=J5({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=J8(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function vle(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return yle(e,t)}function yle(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var z7=3e3,B7=new Map,ble=-1,V7=class extends I7{__id=`little-virtualized-file-diff:${++ble}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:B7,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=G8(n)}setMetrics(e,t=!1){let n=G8(e);(t||!_6(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return fse(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!y6(t,e),r=n&&Ele(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Dle(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=B7,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},metrics:{lineHeight:n}}=this,r=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||r==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(r,this.editor?.__getGhostTextRows()??B7);let{ghostTextRowsByIndex:i}=this.cache,a=t!==`scroll`||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!a&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&w8(this.renderRange)){let t=xle(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}for(let t of s){if(t==null)continue;let r=t.children[1];if(!(r instanceof HTMLElement))continue;let s=o===`split`&&t===this.codeDeletions;for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let c=kle(r,o),l=i.get(c)??0;if(s&&l>0)continue;let u=this.cache.heightDeltas.get(c)??0;if(!a&&u===l*n)continue;let d=t.getBoundingClientRect().height+l*n,f=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(f=!0),d+=t.nextElementSibling.getBoundingClientRect().height);let p=this.getEstimatedLineHeight(f),m=d-p;m!==u&&(e=!0,this.cache.measuredHeightDeltaTotal+=m-u,m===0?this.cache.heightDeltas.delete(c):this.cache.heightDeltas.set(c,m))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.installHydratedSessionDiff(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=G8(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=K8(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:q8(this.metrics,i),height:0};let m;return Y5({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=q5({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=J5({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??K8(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Y5({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=q5({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=J5({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!Y8(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.loadFilesIfNecessary(),this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=r5(`clone`,e,t);if(await M7(()=>this.primeHighlightCache(n)),this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(r5(`merge`,e,t),this.setHydratedState(t),!this.installHydratedSessionDiff(e)&&(await M7(()=>this.primeHighlightCache(e)),this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return W5({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),this.enabled&&this.fileDiff!=null&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!Y8(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??B7);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options;a?(this.height+=q8(this.metrics,i),this.layoutDirty=!1):(this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1)}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=_le({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:W7(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=N7(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!G7(s,this.deletionFile)||!G7(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=O5(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!Y8(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(u,r);if(g&&this.resetLayoutCache({includeEstimatedHeights:!0}),f)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(!Y8(this.getRenderedDiff(),this.pendingRender?.diff))throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!Y8(a,o),renderedDiffChanged:!Y8(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Ole(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=W7(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=Sle(this.cache.heightDeltas),u=K8(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=Cle(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+wle(i,e)*this.metrics.lineHeight+H7(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=z7}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+H7(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=V5({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?q5({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?U5({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?J5({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:Tle({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=V5({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=U5({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=W7(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=K8(this.metrics,i),h=e.hunks.length>0?J8(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,N;if(Y5({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?q5({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=J5({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null){if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}M??=j;let ee=Math.round(M-w/2),te=Math.max(0,Math.ceil(p/s)-w),ne=Math.max(0,Math.min(ee,te)),re=ne*s,ie=ee<0?C+ee*s:C,ae=E[ne]??0,oe=re===0?0:g+ae,se=ne+ie/s,ce=se<E.length?v-E[se]:v-(k-t-_);return{startingLine:re,totalLines:ie,bufferBefore:oe,bufferAfter:Math.max(0,ce)}}};function xle(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===dse&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Sle(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function H7({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=U7(e,n);return(t[U7(e,r)]??0)-(t[i]??0)}function U7(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function Cle(e){return Math.ceil(e/z7)*z7}function wle(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Tle({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function Ele(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Dle(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function W7(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Ole(e){return typeof e==`function`?`custom`:e??`line-info`}function G7(e,t){return e==null||t==null?e==null&&t==null:X8(e,t)}function kle(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Ale({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function jle(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Mle(n,e.startContentIndex)}}function Mle(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function K7(e){let t=(0,P.useRef)(e);return(0,P.useInsertionEffect)(()=>void(t.current=e)),(0,P.useCallback)((...e)=>t.current(...e),[])}var Nle=(0,P.createContext)(void 0);function Ple(){return(0,P.useContext)(Nle)}var Fle={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Ile={display:`contents`};function q7(){return null}function Lle({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=n8}){let p=n?.(e),m=r?.(e),h=i?.(e),g=a?.(e);return(0,F.jsxs)(F.Fragment,{children:[p==null?(0,F.jsxs)(F.Fragment,{children:[m!=null&&(0,F.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,F.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),g!=null&&(0,F.jsx)(`div`,{slot:`header-metadata`,children:g})]}):(0,F.jsx)(`div`,{slot:at,children:p}),o!=null&&l?.map((e,t)=>(0,F.jsx)(`div`,{slot:f(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=Rle(t,e);return(0,F.jsx)(`div`,{slot:n,style:Ile,children:c(t,d)},n)}),s!=null&&(0,F.jsx)(`div`,{slot:`gutter-utility-slot`,style:Fle,children:s(u)})]})}function Rle(e,t){let n=jle(e,t);return n==null?void 0:Ale({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var zle=(0,P.createContext)(void 0);function Ble(e,t){return typeof window>`u`&&t!=null?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,F.jsx)(F.Fragment,{children:e})}var Vle=(0,P.createContext)(void 0);function Hle(){return(0,P.useContext)(Vle)}var Ule=typeof window>`u`?P.useEffect:P.useLayoutEffect;function Wle({fileDiff:e,oldFile:t,newFile:n,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:c,metrics:l,hasGutterRenderUtility:u,hasCustomHeader:d,disableWorkerPool:f,edit:p,onEditChange:m,onEditComplete:h}){let g=Hle(),_=s!==void 0,v=(0,P.useContext)(zle),y=Ple(),[b,x]=(0,P.useState)(),S=K7(e=>m?.(e)),C=m==null?void 0:S,w=(0,P.useRef)(null),T=K7(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(w.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),E=h==null?void 0:T,D=Gle({acceptedCache:w,fileDiff:e,newFile:n,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),O=(0,P.useRef)(null),k=(0,P.useRef)(null),A=(0,P.useRef)(null),j=K7(()=>{if(y==null)throw Error(`FileDiff: EditContext is not attached`);return y(`file-diff`,i??{},a)}),M=K7(e=>{if(e!=null){if(O.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?O.current=new I7(Y7({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:C,onEditComplete:E,options:r}),f?void 0:v,!0):O.current=new V7(Y7({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:C,onEditComplete:E,options:r}),g,l,f?void 0:v,!0),O.current.hydrate({fileDiff:D,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(O.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);A.current=null,O.current.cleanUp(),O.current=null,k.current=null}});Ule(()=>{let{current:e}=O;if(e==null)return;let t=Y7({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:C,onEditComplete:E,options:r}),n=t!==void 0&&!y6(e.options,t);if(e.setOptions(t),!p&&(A.current=null,k.current!=null)){let{current:e}=k;k.current=null,e()}let i=Kle(D,o,w);if(e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),!p||k.current!=null)return;if(y==null)throw Error(`FileDiff: EditContext is not attached`);let a=()=>{O.current===e&&k.current==null&&e.__canAttachEditor()&&(k.current=qle(e,j))};if(e.__canAttachEditor()){A.current=null,a();return}let c=e.__prepareForEditing();if(c==null){A.current=null;return}if(A.current?.promise===c)return;let l={promise:c};A.current=l,c.then(()=>{A.current===l&&(a(),A.current=null)}).catch(e=>{A.current===l&&(A.current=null,x(e))})});let N=(0,P.useCallback)(()=>O.current?.getHoveredLine(),[]),ee=(0,P.useCallback)(e=>O.current?.getAnnotationSlotName(e)??n8(e),[]);if(b!=null)throw b;return{fileDiff:D,ref:M,getHoveredLine:N,getAnnotationSlotName:ee}}function Gle({acceptedCache:e,fileDiff:t,newFile:n,oldFile:r,parseDiffOptions:i}){return(0,P.useMemo)(()=>{if(t!=null)return t;let{current:a}=e,o=a?.filePair;if(a!=null&&o!=null){if(J7(r,n,o.stale)||J7(r,n,o.installed))return o.fileDiff;a.filePair=null}return O5(r??null,n??null,i)},[e,t,r,n,i])}function J7(e,t,n){return S8(e??void 0,n.oldFile??void 0)&&S8(t??void 0,n.newFile??void 0)}function Kle(e,t,n){let{current:r}=n;if(r==null)return{fileDiff:e,lineAnnotations:t};let{fileDiff:i,annotations:a}=r,o=e;i!=null&&(Y8(e,i.stale)?o=i.installed:r.fileDiff=null);let s=t;return a!=null&&(t===a.stale?s=a.installed:r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null),{fileDiff:o,lineAnnotations:s}}function Y7({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return t||r||n||i!=null||a!=null?{...e,controlledSelection:t,renderCustomHeader:n?q7:e?.renderCustomHeader,renderGutterUtility:r?q7:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function qle(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function Jle({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S}=Wle({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),C=Lle({fileDiff:e,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,renderGutterUtility:h,lineAnnotations:a,getHoveredLine:x,getAnnotationSlotName:S});return(0,F.jsx)(st,{ref:b,className:s,style:c,children:Ble(C,l)})}var Yle=3e3,Xle=`text-foreground hover:bg-accent aria-pressed:bg-accent inline-flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-lg px-1.5 [&_svg]:opacity-80`,X7=`text-muted-foreground hover:text-foreground aria-pressed:bg-background aria-pressed:text-foreground dark:aria-pressed:bg-input/72 inline-flex h-6 cursor-pointer items-center justify-center rounded-md px-2.5 aria-pressed:shadow-xs`;function Zle(e){let[t,n]=(0,P.useState)(null),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(0),c=(0,P.useRef)({patch:null,count:0}),l=Q(e=>e.prefs.diff),u=KP(),[d,f]=Fg(`diffFlipped`,[]);function p(e){L9({...Z().prefs,diff:{...l,...e}})}(0,P.useEffect)(()=>{let t=!0,r=!1;async function a(){if(!r){r=!0;try{let r=await I(e.machine,`git.diff`,{projectId:e.projectId});if(!t||(i(null),r===c.current.patch))return;c.current={patch:r,count:c.current.count+1},n(r.trim()===``?[]:m5(r,`${e.projectId}:${c.current.count}`).flatMap(e=>e.files))}catch(e){t&&i(s(e))}finally{r=!1}}}function o(){document.hidden||a()}a();let l=window.setInterval(o,Yle);return window.addEventListener(`focus`,o),()=>{t=!1,window.clearInterval(l),window.removeEventListener(`focus`,o)}},[e.machine,e.projectId,e.running,a]);let m=t??[],h=so(m,e=>so(e.hunks,e=>e.additionLines)),g=so(m,e=>so(e.hunks,e=>e.deletionLines));return(0,F.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,F.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center justify-between gap-2 border-b pr-3 pl-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,F.jsx)(k,{icon:Me,className:`size-3.5`})}),(0,F.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Uncommitted changes`})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[m.length>0&&(0,F.jsxs)(`span`,{className:`text-2xs mr-1 inline-flex items-center gap-1 font-mono tabular-nums`,children:[(0,F.jsxs)(`span`,{className:`text-diff-addition`,children:[`+`,h]}),(0,F.jsxs)(`span`,{className:`text-diff-deletion`,children:[`-`,g]})]}),(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Refresh diff`,"aria-label":`Refresh diff`,onClick:()=>o(a+1),children:(0,F.jsx)(k,{icon:Oh,className:`size-3.5`})}),m.length>0&&(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:l.collapsed?`Expand all files`:`Collapse all files`,onClick:()=>{f([]),p({collapsed:!l.collapsed})},children:(0,F.jsx)(k,{icon:l.collapsed?Jh:Tm,className:`size-3.5`})}),(0,F.jsxs)(`div`,{className:`bg-input/40 flex shrink-0 items-center rounded-lg p-0.5`,children:[(0,F.jsx)(`button`,{className:X7,"aria-pressed":!l.split,"aria-label":`Stacked diff view`,onClick:()=>p({split:!1}),children:(0,F.jsx)(k,{icon:kh,className:`size-3.5`})}),(0,F.jsx)(`button`,{className:X7,"aria-pressed":l.split,"aria-label":`Split diff view`,onClick:()=>p({split:!0}),children:(0,F.jsx)(k,{icon:Qm,className:`size-3.5`})})]}),(0,F.jsx)(`button`,{className:Xle,"aria-pressed":l.wrap,title:l.wrap?`Disable line wrapping`:`Enable line wrapping`,onClick:()=>p({wrap:!l.wrap}),children:(0,F.jsx)(k,{icon:Wh,className:`size-3.5`})})]})]}),(0,F.jsxs)(`div`,{className:`diff-render-surface min-h-0 flex-1 overflow-y-auto [--code-background:var(--background)]`,children:[r!==null&&(0,F.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:r}),r===null&&t===null&&(0,F.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:`Loading…`}),r===null&&t?.length===0&&(0,F.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,F.jsx)(k,{icon:lne,className:`text-muted-foreground/40 size-8`}),(0,F.jsxs)(`div`,{className:`grid gap-1`,children:[(0,F.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No uncommitted changes`}),(0,F.jsx)(`p`,{className:`text-muted-foreground/50 text-xs italic`,children:`If it works, don’t touch it.`})]})]}),r===null&&m.map(e=>{let t=l.collapsed!==d.includes(e.name);function n(){f(d.includes(e.name)?d.filter(t=>t!==e.name):[...d,e.name])}return(0,F.jsx)(`div`,{onClick:e=>{e.nativeEvent.composedPath().some(e=>e instanceof Element&&e.hasAttribute(`data-title`))&&n()},children:(0,F.jsx)(Jle,{fileDiff:e,options:{theme:u,themeType:`dark`,unsafeCSS:`:host,
254
- [data-diffs-header],
255
- [data-diff],
256
- [data-file],
257
- [data-error-wrapper],
258
- [data-virtualizer-buffer] {
259
- --diffs-header-font-family: var(--font-sans) !important;
260
- --diffs-font-family: var(--font-mono) !important;
261
- --diffs-bg: var(--code-background) !important;
262
- --diffs-light-bg: var(--code-background) !important;
263
- --diffs-dark-bg: var(--code-background) !important;
264
- --diffs-token-light-bg: transparent;
265
- --diffs-token-dark-bg: transparent;
266
-
267
- --diffs-bg-context-override: color-mix(
268
- in srgb,
269
- var(--code-background) 97%,
270
- var(--code-foreground)
271
- );
272
- --diffs-bg-hover-override: color-mix(
273
- in srgb,
274
- var(--code-background) 94%,
275
- var(--code-foreground)
276
- );
277
- --diffs-bg-separator-override: color-mix(
278
- in srgb,
279
- var(--code-background) 95%,
280
- var(--code-foreground)
281
- );
282
- --diffs-bg-buffer-override: color-mix(
283
- in srgb,
284
- var(--code-background) 90%,
285
- var(--code-foreground)
286
- );
287
-
288
- --diffs-bg-context-gutter-override: var(--code-background);
289
- --diffs-addition-color-override: var(--diff-addition);
290
- --diffs-deletion-color-override: var(--diff-deletion);
291
- --diffs-bg-addition-hover-override: color-mix(
292
- in srgb,
293
- var(--code-background) 85%,
294
- var(--diff-addition)
295
- );
296
- --diffs-bg-addition-emphasis-override: color-mix(
297
- in srgb,
298
- var(--code-background) 65%,
299
- var(--diff-addition)
300
- );
301
-
302
- --diffs-bg-deletion-hover-override: color-mix(
303
- in srgb,
304
- var(--code-background) 85%,
305
- var(--diff-deletion)
306
- );
307
- --diffs-bg-deletion-emphasis-override: color-mix(
308
- in srgb,
309
- var(--code-background) 65%,
310
- var(--diff-deletion)
311
- );
312
-
313
- background-color: var(--diffs-bg) !important;
314
- color: var(--code-foreground) !important;
315
- }
316
-
317
- :is(
318
- [data-line],
319
- [data-line-annotation],
320
- [data-merge-conflict],
321
- [data-merge-conflict-actions],
322
- [data-no-newline]
323
- )[data-selected-line] {
324
- --diffs-line-bg: light-dark(
325
- color-mix(
326
- in lab,
327
- var(--code-background) 88%,
328
- color-mix(in srgb, var(--code-background) 50%, var(--diffs-modified-base))
329
- ),
330
- color-mix(
331
- in lab,
332
- var(--code-background) 80%,
333
- color-mix(in srgb, var(--code-background) 70%, var(--diffs-modified-base))
334
- )
335
- ) !important;
336
- }
337
-
338
- :is([data-gutter-buffer], [data-column-number])[data-selected-line] {
339
- --diffs-line-bg: light-dark(
340
- color-mix(
341
- in lab,
342
- var(--code-background) 91%,
343
- color-mix(in srgb, var(--code-background) 35%, var(--diffs-modified-base))
344
- ),
345
- color-mix(
346
- in lab,
347
- var(--code-background) 85%,
348
- color-mix(in srgb, var(--code-background) 60%, var(--diffs-modified-base))
349
- )
350
- ) !important;
351
- }
352
-
353
- [data-indicators='bars']
354
- :is(
355
- [data-column-number],
356
- [data-gutter-buffer='annotation']
357
- )[data-selected-line] {
358
- position: relative;
359
- }
360
-
361
- [data-indicators='bars']
362
- :is(
363
- [data-column-number],
364
- [data-gutter-buffer='annotation']
365
- )[data-selected-line]::before {
366
- position: absolute !important;
367
- inset-block: 0 !important;
368
- inset-inline-start: 0 !important;
369
- display: block !important;
370
- width: 4px !important;
371
- min-width: 4px !important;
372
- max-width: 4px !important;
373
- height: auto !important;
374
- padding: 0 !important;
375
- content: '' !important;
376
- background-color: var(--diffs-modified-base) !important;
377
- background-image: none !important;
378
- }
379
-
380
- [data-file-info] {
381
- background-color: var(--code-background) !important;
382
- border-block-color: transparent !important;
383
- color: var(--code-foreground) !important;
384
- }
385
-
386
- [data-diffs-header] {
387
- position: sticky !important;
388
- top: 0;
389
- z-index: 4;
390
- background-color: var(--code-background) !important;
391
- border-bottom-color: transparent !important;
392
- align-items: center !important;
393
- font-family: var(--font-sans) !important;
394
- font-size: 12px !important;
395
- line-height: 1 !important;
396
- min-height: 32px !important;
397
- padding-block: 6px !important;
398
- padding-inline: 8px 12px !important;
399
- }
400
-
401
- [data-diffs-header]:hover {
402
- background-color: var(--code-background) !important;
403
- box-shadow: inset 3px 0
404
- color-mix(in srgb, var(--code-foreground) 24%, transparent);
405
- }
406
-
407
- :is([data-separator='line-info'], [data-separator='line-info-basic']) {
408
- height: 24px !important;
409
- margin-block: 0 !important;
410
- --diffs-bg-separator: color-mix(
411
- in srgb,
412
- var(--code-background) 97%,
413
- var(--code-foreground)
414
- );
415
- }
416
-
417
- :is([data-separator='line-info'], [data-separator='line-info-basic'])
418
- [data-separator-content] {
419
- color: color-mix(
420
- in srgb,
421
- var(--code-foreground) 50%,
422
- var(--code-background)
423
- ) !important;
424
- font-family: var(--font-sans) !important;
425
- font-size: 11px !important;
426
- text-decoration: none !important;
427
- }
428
-
429
- :is([data-separator='line-info'], [data-separator='line-info-basic'])
430
- [data-expand-button] {
431
- color: color-mix(
432
- in srgb,
433
- var(--code-foreground) 50%,
434
- var(--code-background)
435
- ) !important;
436
- }
437
-
438
- :is(
439
- [data-separator='line-info'],
440
- [data-separator='line-info-basic']
441
- )[data-expand-index]
442
- :is([data-separator-content], [data-expand-button]):hover {
443
- color: var(--code-foreground) !important;
444
- background-color: color-mix(
445
- in srgb,
446
- var(--code-background) 92%,
447
- var(--code-foreground)
448
- ) !important;
449
- }
450
-
451
- [data-diffs-header] [data-header-content] {
452
- align-items: center !important;
453
- line-height: 1 !important;
454
- }
455
-
456
- [data-diffs-header] :is([data-title], [data-prev-name]) {
457
- line-height: 16px !important;
458
- }
459
-
460
- [data-diffs-header] [data-metadata] {
461
- align-items: center !important;
462
- line-height: 1 !important;
463
- font-variant-numeric: tabular-nums;
464
- }
465
-
466
- [data-diffs-header] [data-additions-count],
467
- [data-diffs-header] [data-deletions-count] {
468
- font-family: var(--font-mono) !important;
469
- font-size: 11px !important;
470
- font-variant-numeric: tabular-nums;
471
- line-height: 1 !important;
472
- }
473
-
474
- [data-diffs-header] [data-change-icon],
475
- [data-diffs-header] [data-rename-icon] {
476
- display: block;
477
- flex-shrink: 0;
478
- }
479
-
480
- [data-title] {
481
- cursor: pointer;
482
- transition: color 120ms ease;
483
- font-family: var(--font-sans) !important;
484
- }
485
-
486
- [data-title]:hover {
487
- color: color-mix(
488
- in srgb,
489
- var(--code-foreground) 84%,
490
- var(--primary)
491
- ) !important;
492
- }
493
-
494
- [data-diff],
495
- [data-file] {
496
- transition: opacity 200ms ease-out;
497
- }
498
-
499
- @starting-style {
500
- [data-diff],
501
- [data-file] {
502
- opacity: 0;
503
- }
504
- }
505
-
506
- @media (prefers-reduced-motion: reduce) {
507
- [data-diff],
508
- [data-file] {
509
- transition: none;
510
- }
511
- }
512
- `,collapsed:t,lineDiffType:`word-alt`,overflow:l.wrap?`wrap`:`scroll`,diffStyle:l.split?`split`:`unified`},renderHeaderPrefix:()=>(0,F.jsx)(`button`,{className:`text-muted-foreground hover:text-foreground flex size-5 cursor-pointer items-center justify-center`,"aria-label":t?`Expand file`:`Collapse file`,onClick:n,children:(0,F.jsx)(k,{icon:t?wm:Cm,className:`size-3.5`})})})},e.name)})]})]})}function Qle(e){let t=Q(e=>e.items),n=Q(e=>e.earlier),r=Q(t=>k9(t.machines,e.machine,e.sessionId)),i=[...n,...t],a=z3(i,r),o=a.agents.find(t=>t.item.id===e.selected),s=a.tasks.find(t=>t.item.id===e.selected),c=o===void 0?null:K3(o.item);return(0,F.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,F.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-1 border-b pr-3 pl-3`,children:[(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,F.jsx)(k,{icon:Me,className:`size-3.5`})}),o===void 0&&s===void 0&&(0,F.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Tasks`}),(o!==void 0||s!==void 0)&&(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Back to tasks`,"aria-label":`Back to tasks`,onClick:()=>e.onSelect(null),children:(0,F.jsx)(k,{icon:vm,className:`size-3.5`})}),o!==void 0&&c!==null&&(0,F.jsxs)(F.Fragment,{children:[o.status===`Running`?(0,F.jsx)(J3,{className:c.tone}):(0,F.jsx)(q3,{className:c.tone}),(0,F.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:c.name}),c.description!==``&&(0,F.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:c.description}),o.status===`Running`&&o.agentId!==null&&e.sessionId!==null&&(0,F.jsx)(Z7,{machine:e.machine,sessionId:e.sessionId,taskId:o.agentId})]}),s!==void 0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(k,{icon:Am,className:`text-muted-foreground size-4 shrink-0`}),(0,F.jsx)(`span`,{className:`text-foreground min-w-0 truncate font-medium`,children:B3(s.item)}),(0,F.jsx)(`span`,{className:l(`text-muted-foreground shrink-0`,s.status===`Failed`&&`text-destructive`),children:s.status}),s.status===`Running`&&s.taskId!==null&&e.sessionId!==null&&(0,F.jsx)(Z7,{machine:e.machine,sessionId:e.sessionId,taskId:s.taskId})]})]})]}),o===void 0&&s===void 0&&(0,F.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[(0,F.jsx)(`h2`,{className:`text-muted-foreground px-1 pb-1.5 text-xs font-medium`,children:`Agents`}),a.agents.length===0&&(0,F.jsx)(`p`,{className:`text-muted-foreground px-1 py-1 text-xs`,children:`No agents in this thread.`}),(0,F.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[...a.agents.filter(e=>e.status===`Running`),...a.agents.filter(e=>e.status!==`Running`)].map(t=>{let n=K3(t.item);return(0,F.jsxs)(`button`,{type:`button`,"aria-label":`Open ${n.name} agent: ${n.description}`,className:`bg-secondary hover:bg-accent focus-visible:ring-ring/70 flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-left text-[13px] leading-5 tracking-[-0.04px] select-none focus-visible:ring-2 focus-visible:outline-none`,onClick:()=>e.onSelect(t.item.id),children:[t.status===`Running`?(0,F.jsx)(J3,{className:n.tone}):(0,F.jsx)(q3,{className:n.tone}),(0,F.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:n.name}),(0,F.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate`,children:n.description}),(0,F.jsx)(`span`,{className:l(`text-muted-foreground shrink-0 text-xs`,t.status===`Failed`&&`text-destructive`),children:t.status})]},t.item.id)})}),(0,F.jsx)(`h2`,{className:`text-muted-foreground px-1 pt-5 pb-1.5 text-xs font-medium`,children:`Tasks`}),a.tasks.length===0&&(0,F.jsx)(`p`,{className:`text-muted-foreground px-1 py-1 text-xs`,children:`No background tasks in this thread.`}),(0,F.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[...a.tasks.filter(e=>e.status===`Running`),...a.tasks.filter(e=>e.status!==`Running`)].map(t=>(0,F.jsxs)(`button`,{type:`button`,"aria-label":`Open task: ${B3(t.item)}`,className:`bg-secondary hover:bg-accent focus-visible:ring-ring/70 flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-left text-[13px] leading-5 tracking-[-0.04px] select-none focus-visible:ring-2 focus-visible:outline-none`,onClick:()=>e.onSelect(t.item.id),children:[(0,F.jsx)(k,{icon:Am,className:l(`size-4 shrink-0`,t.status===`Running`?`text-foreground animate-pulse`:`text-muted-foreground`)}),(0,F.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate`,children:B3(t.item)}),(0,F.jsx)(`span`,{className:l(`text-muted-foreground shrink-0 text-xs`,t.status===`Failed`&&`text-destructive`),children:t.status})]},t.item.id))})]}),o!==void 0&&(0,F.jsx)(eue,{item:o.item,agentId:o.agentId,running:o.status===`Running`,items:i,found:a,cwd:e.cwd,onSelect:e.onSelect},o.item.id),s!==void 0&&e.sessionId!==null&&(0,F.jsx)($le,{machine:e.machine,sessionId:e.sessionId,command:s.item.command,path:s.path,events:s.events,running:s.status===`Running`},s.item.id)]})}function Z7(e){return(0,F.jsx)(E,{size:`xs`,variant:`outline`,className:`shrink-0`,onClick:()=>YS(e.machine,e.sessionId,e.taskId),children:`Stop`})}function $le(e){let[t,n]=(0,P.useState)(void 0),[r,i]=(0,P.useState)(null),a=(0,P.useRef)(null),o=(0,P.useRef)(!0);(0,P.useEffect)(()=>{let t=e.path;if(t===null)return;let r=!0;async function a(t){try{let a=await I(e.machine,`tasks.output`,{sessionId:e.sessionId,path:t});if(!r)return;n(a),i(null)}catch(e){r&&i(s(e))}}a(t);let o=e.running?window.setInterval(()=>void a(t),2e3):null;return()=>{r=!1,o!==null&&window.clearInterval(o)}},[e.machine,e.sessionId,e.path,e.running]),(0,P.useLayoutEffect)(()=>{let e=a.current;e!==null&&o.current&&(e.scrollTop=e.scrollHeight)},[t,e.events]);let c=e.path===null?e.events.join(`
513
- `):t?.text??``;return(0,F.jsxs)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain p-3`,onScroll:e=>{let t=e.currentTarget;o.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[e.command!==``&&(0,F.jsxs)(`p`,{className:`text-muted-foreground pb-2 font-mono text-xs [overflow-wrap:anywhere] whitespace-pre-wrap`,children:[`$ `,e.command]}),r!==null&&(0,F.jsx)(`p`,{className:`text-destructive text-xs`,children:r}),r===null&&e.path!==null&&t===void 0&&(0,F.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Loading…`}),r===null&&e.path!==null&&t===null&&(0,F.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The output file no longer exists.`}),t?.truncated===!0&&(0,F.jsx)(`p`,{className:`text-muted-foreground pb-2 text-xs`,children:`Showing the end of the output.`}),e.path===null&&e.events.length===0&&(0,F.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No events yet.`}),t?.text===``&&(0,F.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.running?`No output yet.`:`No output.`}),c!==``&&(0,F.jsx)(`pre`,{className:`bg-secondary text-foreground rounded-lg p-3 font-mono text-xs leading-5 [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:c})]})}function eue(e){let t=(0,P.useRef)(null),n=(0,P.useRef)(!0),[r,i]=(0,P.useState)([]);(0,P.useLayoutEffect)(()=>{let e=t.current;e!==null&&n.current&&(e.scrollTop=e.scrollHeight)},[e.items,e.running]);function a(e){i(r.includes(e)?r.filter(t=>t!==e):[...r,e])}let o=e.items.filter(t=>t.parent===e.item.id),s=o.length===0;(0,P.useEffect)(()=>{s&&e.agentId!==null&&$S(e.item.id,e.agentId)},[s,e.item.id,e.agentId]);let c=o.at(0),u=c?.kind===`user`?c:null,d=$3({prompt:null,first:!1,items:u===null?o:o.slice(1)},e.running?{partial:``}:null);return(0,F.jsxs)(`div`,{ref:t,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-4 pt-1 pb-8`,onScroll:e=>{let t=e.currentTarget;n.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[u!==null&&(0,F.jsx)(W3,{title:`Prompt`,pending:!1,grouped:!0,open:r.includes(`prompt`),onToggle:()=>a(`prompt`),children:(0,F.jsx)(TF,{text:u.text,className:`text-muted-foreground text-[13px]`})}),d.map((t,n)=>{let i=d[n-1];return(0,F.jsx)(`div`,{className:l(i===void 0?`pt-2`:t.kind===`working`?void 0:Q3(t)&&Q3(i)?`pt-2`:`pt-4`,t.kind===`assistant`&&`group/assistant`),children:(0,F.jsx)(d6,{row:t,agents:e.found.agents,tasks:e.found.tasks,running:e.running,compacting:!1,fork:!1,expanded:r.includes(t.key),onToggle:a,onOpenTask:e.onSelect,rewind:!1,cwd:e.cwd})},t.key)})]})}var Q7=(0,P.lazy)(async()=>({default:(await tt(async()=>{let{EditorDialog:e}=await import(`./editor-dialog-Dam_lnif.js`);return{EditorDialog:e}},__vite__mapDeps([38,2,1,4,5,6,8,11,10,39,40,41]))).EditorDialog})),$7=`text-foreground hover:bg-accent data-[pressed=true]:bg-accent relative grid h-7 min-w-7 cursor-pointer place-items-center rounded-lg border border-transparent [&_svg]:size-4 [&_svg]:opacity-80`;function tue(e){let[t,n]=(0,P.useState)(!1),r=e9(e,()=>n(!0));return(0,F.jsxs)(F.Fragment,{children:[r.map(e=>(0,F.jsxs)(`button`,{className:$7,"data-pressed":e.pressed,"aria-label":e.label,title:e.title,onClick:e.onSelect,children:[(0,F.jsx)(k,{icon:e.icon}),e.badge]},e.id)),t&&(0,F.jsx)(P.Suspense,{children:(0,F.jsx)(Q7,{machine:e.selection.machine,projectId:e.selection.projectId,onClose:()=>n(!1)})})]})}function nue(e){let[t,n]=(0,P.useState)(!1),r=e9(e,()=>n(!0));return(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,F.jsxs)(mS,{open:e.open,onOpenChange:e.onOpenChange,children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsxs)(`button`,{className:l($7,`data-[state=open]:bg-accent`),"aria-label":`More`,title:`More`,children:[(0,F.jsx)(k,{icon:ph}),r.some(e=>e.attention)&&(0,F.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`})]})}),(0,F.jsxs)(_S,{className:`w-56`,align:`end`,children:[r.map(e=>(0,F.jsxs)(vS,{onSelect:e.onSelect,children:[(0,F.jsx)(k,{icon:e.icon}),(0,F.jsx)(`span`,{className:`flex-1`,children:e.label}),e.detail]},e.id)),e.children]})]}),t&&(0,F.jsx)(P.Suspense,{children:(0,F.jsx)(Q7,{machine:e.selection.machine,projectId:e.selection.projectId,onClose:()=>n(!1)})})]})}function e9(e,t){let n=(0,P.useSyncExternalStore)(J4,()=>Y4().alerts.length>0),i=(0,P.useSyncExternalStore)(J4,()=>Y4().layout.tabs.filter(t=>t.projectId===e.selection.projectId).length),a=Q(e=>{if(e.selection?.sessionId===null)return 0;let t=z3([...e.earlier,...e.items],A9(e));return[...t.agents,...t.tasks].filter(e=>e.status===`Running`).length});return[{id:`diff`,label:`Diff`,title:`Diff`,icon:Rm,pressed:e.panel===`diff`,attention:e.changed,badge:e.changed&&(0,F.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`}),detail:e.changed&&(0,F.jsx)(`span`,{className:`bg-muted-foreground size-1.5 rounded-full`}),onSelect:()=>e.onPanel(e.panel===`diff`?null:`diff`)},{id:`terminal`,label:`Terminal`,title:`Terminal (${r}+\`)`,icon:Hh,pressed:e.terminal,attention:n,badge:i>0&&(0,F.jsx)(`span`,{className:l(`absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full px-0.5 text-[8px] leading-none font-medium tabular-nums`,n?`bg-primary text-primary-foreground`:`text-foreground bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))]`),children:i}),detail:i>0&&(0,F.jsx)(`span`,{className:l(`text-xs tabular-nums`,n?`text-primary`:`text-muted-foreground`),children:i}),onSelect:()=>e.onTerminal(!e.terminal)},{id:`tasks`,label:`Tasks`,title:`Tasks`,icon:Uh,pressed:e.panel===`tasks`,attention:a>0,badge:a>0&&(0,F.jsx)(`span`,{className:`text-foreground absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))] px-0.5 text-[8px] leading-none font-medium tabular-nums`,children:a}),detail:a>0&&(0,F.jsx)(`span`,{className:`text-muted-foreground text-xs tabular-nums`,children:a}),onSelect:()=>e.onPanel(e.panel===`tasks`?null:`tasks`)},{id:`browser`,label:`Browser`,title:`Browser`,icon:Qte,pressed:e.panel===`browser`,attention:!1,badge:null,detail:null,onSelect:()=>e.onPanel(e.panel===`browser`?null:`browser`)},{id:`editor`,label:`Editor`,title:`Editor`,icon:$h,pressed:!1,attention:!1,badge:null,detail:null,onSelect:t}]}function t9(e){return(0,F.jsxs)(F.Fragment,{children:[e.panel===`browser`&&(0,F.jsx)(Noe,{machine:e.selection.machine,onClose:()=>e.onPanel(null)}),e.panel===`diff`&&(0,F.jsx)(Zle,{machine:e.selection.machine,projectId:e.selection.projectId,running:e.running,onClose:()=>e.onPanel(null)},`${e.selection.machine} ${e.selection.projectId}`),e.panel===`tasks`&&(0,F.jsx)(Qle,{machine:e.selection.machine,cwd:e.cwd,sessionId:e.selection.sessionId,selected:e.selectedTask,onSelect:e.onSelectTask,onClose:()=>e.onPanel(null)})]})}function rue(){let e=Q(e=>e.selection),t=Q(e=>e.machines.length>0),n=MS();return n===null?e===null?t?(0,F.jsx)(`div`,{className:`bg-sidebar relative flex min-w-0 flex-1 pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,F.jsx)(JQ,{className:`min-w-0 flex-1 border-r-0`,mobile:!0})}):(0,F.jsx)(`main`,{className:`bg-background flex flex-1 overflow-y-auto pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,F.jsx)(hZ,{})}):(0,F.jsx)(iue,{selection:e}):(0,F.jsx)(F3,{machine:n,mobile:!0,leading:(0,F.jsx)(E,{variant:`ghost`,size:`icon-xs`,"aria-label":`Back`,title:`Back`,onClick:()=>LS(`chat`,()=>void s9.navigate({to:`/`,search:{},replace:!0})),children:(0,F.jsx)(k,{icon:vm})})})}function iue(e){let t=Q(t=>T9(t,e.selection.machine)),n=Q(t=>t.sessions.find(t=>t.machine===e.selection.machine&&t.id===e.selection.sessionId)),r=Q(t=>E9(t,e.selection.machine,e.selection.projectId)?.path??``),i=zg(e.selection.machine,e.selection.projectId),a=Q(j9),o=wL(e.selection.machine,t.status===`online`?e.selection.projectId:null,a),s=TL({machine:e.selection.machine,projectId:e.selection.projectId,repos:o.repos,onRefresh:o.refresh}),c=(0,P.useSyncExternalStore)(J4,()=>Y4().open),l=ea({from:`__root__`,select:e=>e.panel??null}),[u,d]=(0,P.useState)(null),f=o.repos.some(e=>e.changed>0),p=l!==null||c,m=(0,P.useCallback)(e=>{p?PS(e):FS(e,`overlay`)},[p]),h=(0,P.useCallback)(e=>{d(null),e===null?n9():m({panel:e,bottom:void 0})},[m]),g=(0,P.useCallback)(e=>{h(`tasks`),d(e)},[h]);function _(e){e?m({panel:void 0,bottom:`terminal`}):n9()}return(0,F.jsxs)(`main`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,F.jsxs)(`header`,{className:`flex h-(--workspace-topbar-height) shrink-0 items-center gap-1.5 px-2`,children:[(0,F.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":`Back`,onClick:()=>LS(`chat`,HS),children:(0,F.jsx)(k,{icon:vm,className:`text-foreground size-5`,strokeWidth:2})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-foreground truncate font-medium`,children:n?.title??`New thread`}),t.status===`online`&&(0,F.jsxs)(`div`,{className:`text-muted-foreground truncate text-xs`,children:[t.name,` / `,i]}),t.status!==`online`&&(0,F.jsxs)(`div`,{className:`text-warning-foreground truncate text-xs`,children:[t.status===`connecting`&&`Connecting to ${t.name}…`,t.status===`offline`&&`${t.name} is offline, reconnecting…`,t.status===`unpaired`&&`${t.name} needs pairing`]})]}),(0,F.jsx)(nue,{selection:e.selection,panel:l,terminal:c,changed:f,open:s.menuOpen,onOpenChange:s.setMenuOpen,onPanel:h,onTerminal:_,children:o.repos.length>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(CS,{}),(0,F.jsx)(EL,{git:s,collapsed:!0})]})}),(0,F.jsx)(DL,{git:s})]}),(0,F.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(u6,{onOpenTask:g}),(0,F.jsx)(HI,{})]},`${e.selection.machine} ${e.selection.sessionId??e.selection.projectId}`)}),(0,F.jsx)(Re,{open:p,onOpenChange:()=>h(null),children:(0,F.jsx)(Be,{children:(0,F.jsxs)(qe,{"aria-describedby":void 0,className:`bg-background data-open:animate-in data-open:slide-in-from-right fixed inset-0 z-40 flex flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] text-sm duration-200 outline-none [--workspace-topbar-height:44px] motion-reduce:animate-none`,children:[(0,F.jsxs)(Pe,{className:`sr-only`,children:[l===`diff`&&`Diff`,l===`tasks`&&`Tasks`,l===`browser`&&`Browser`,l===null&&`Terminal`]}),(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[l!==null&&(0,F.jsx)(t9,{panel:l,selection:e.selection,cwd:r,running:a,selectedTask:u,onSelectTask:d,onPanel:h}),l===null&&c&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`border-border/60 flex h-(--workspace-topbar-height) shrink-0 items-center gap-1 border-b px-3`,children:[(0,F.jsx)(E,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:()=>_(!1),children:(0,F.jsx)(k,{icon:Me,className:`size-3.5`})}),(0,F.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Terminal`})]}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,F.jsx)(P3,{view:e.selection.projectId})})]})]})]})})})]})}function n9(){LS(`overlay`,()=>PS({panel:void 0,bottom:void 0}))}var r9=window.matchMedia(`(min-width: 768px)`),aue=800;function oue(e){return r9.addEventListener(`change`,e),()=>r9.removeEventListener(`change`,e)}function sue(){let e=(0,P.useSyncExternalStore)(oue,()=>r9.matches);return kg(`mod+k`,()=>P9(!Z().paletteOpen),{enableOnFormTags:!0,preventDefault:!0}),(0,F.jsxs)(`div`,{className:`flex h-dvh text-sm`,children:[e?(0,F.jsx)(cue,{}):(0,F.jsx)(rue,{}),(0,F.jsx)(gZ,{}),e?(0,F.jsx)(lZ,{}):(0,F.jsx)(mZ,{}),(0,F.jsxs)(`div`,{className:l(`fixed z-50 flex flex-col gap-2`,e?`right-4 bottom-4 items-end`:`inset-x-4 top-[calc(env(safe-area-inset-top)+0.5rem)] items-center`),children:[(0,F.jsx)(sL,{}),(0,F.jsx)(xo,{})]})]})}function i9(e){PS({panel:e??void 0})}function cue(){let e=Q(e=>e.selection),t=Q(e=>e.sessions),n=MS(),i=Q(e=>e.selection===null?``:E9(e,e.selection.machine,e.selection.projectId)?.path??``),a=Q(e=>{let t=D9(e);return t===null?null:T9(e,t)}),[s,c]=(0,P.useState)(!0),u=(0,P.useRef)(null),[d,f]=(0,P.useState)(!1),p=ea({from:`__root__`,select:e=>e.panel??null}),m=(0,P.useRef)(`diff`),[h,g]=(0,P.useState)(null),_=(0,P.useCallback)(e=>{g(e),i9(`tasks`)},[]),[v,y]=Fg(`panelWidth`,540),[b,x]=(0,P.useState)(280),S=(0,P.useSyncExternalStore)(J4,()=>Y4().open),C=Q(j9),w=wL(e?.machine??``,a?.status===`online`?e?.projectId??null:null,C),T=TL({machine:e?.machine??``,projectId:e?.projectId??``,repos:w.repos,onRefresh:w.refresh}),D=t.find(t=>t.machine===e?.machine&&t.id===e.sessionId),O=zg(e?.machine??``,e?.projectId??``);return kg([`meta+backquote`,`ctrl+backquote`],e=>{e.stopPropagation(),r3(!Y4().open)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),kg(`mod+j`,e=>{e.stopPropagation(),i9(AS().panel===void 0?m.current:null)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),(0,P.useEffect)(()=>{p!==null&&(m.current=p)},[p]),kg(`mod+b`,()=>c(e=>!e),{enableOnFormTags:!0,preventDefault:!0}),(0,P.useEffect)(()=>{if(n!==null)return;let e=u.current;if(e===null)throw Error(`header is not mounted`);let t=new ResizeObserver(e=>f(e[0].contentRect.width<aue));return t.observe(e),()=>t.disconnect()},[n]),n===null?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(JQ,{className:l(`relative`,!s&&`hidden`),mobile:!1,onHide:()=>c(!1)}),!s&&(0,F.jsx)(`div`,{className:`fixed top-0 left-3 z-50 flex h-(--workspace-topbar-height) items-center`,children:(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Show sidebar`,title:`Show sidebar (${r}+B)`,onClick:()=>c(!0),children:(0,F.jsx)(k,{icon:_h})})}),(0,F.jsxs)(`main`,{className:`bg-background relative flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,F.jsxs)(`header`,{ref:u,className:l(`bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-3 pr-3 pl-[3.25rem]`,s&&`pl-5`),children:[e!==null&&a!==null&&(0,F.jsx)(`nav`,{className:`min-w-0 flex-1`,children:(0,F.jsxs)(`ol`,{className:`flex min-w-0 items-center gap-3 text-sm`,children:[(0,F.jsxs)(`li`,{className:`text-icon-muted flex shrink-0 items-center gap-1.5`,children:[(0,F.jsx)(k,{icon:Wg[a.icon],className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`max-w-40 truncate`,children:a.name})]}),(0,F.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,F.jsxs)(`li`,{className:`text-muted-foreground flex min-w-0 shrink items-center gap-1.5 font-medium`,title:`${a.name}:${i}`,children:[(0,F.jsx)(Kg,{machine:e.machine,projectId:e.projectId,className:`size-3.5`}),(0,F.jsx)(`span`,{className:`max-w-40 truncate`,children:O})]}),(0,F.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,F.jsx)(`li`,{className:l(`text-foreground min-w-10 truncate font-medium`,s&&`flex-1`),children:D?.title??`New thread`}),!s&&(0,F.jsx)(`li`,{className:`shrink-0`,children:(0,F.jsx)(UQ,{hideDone:!0})})]})}),e===null&&!s&&(0,F.jsx)(UQ,{hideDone:!0}),e===null&&(0,F.jsx)(`span`,{className:`flex-1`}),a!==null&&a.status!==`online`&&(0,F.jsxs)(`span`,{className:`text-warning-foreground shrink-0 text-xs`,children:[a.status===`connecting`&&`Connecting to ${a.name}…`,a.status===`offline`&&`${a.name} is offline, reconnecting…`,a.status===`unpaired`&&`${a.name} needs pairing`]}),e!==null&&(0,F.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[!d&&w.repos.length>0&&(0,F.jsx)(OL,{machine:e.machine,projectId:e.projectId,repos:w.repos,onRefresh:w.refresh}),d&&w.repos.length>0&&(0,F.jsxs)(mS,{open:T.menuOpen,onOpenChange:T.setMenuOpen,children:[(0,F.jsx)(gS,{asChild:!0,children:(0,F.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Git actions`,title:`Git actions`,children:(0,F.jsx)(k,{icon:ph})})}),(0,F.jsx)(_S,{className:`w-56`,align:`end`,children:(0,F.jsx)(EL,{git:T,collapsed:!0})})]}),(0,F.jsx)(`span`,{className:`bg-foreground/15 mr-1 ml-2.5 h-4 w-px`}),(0,F.jsx)(tue,{selection:e,panel:p,terminal:S,changed:w.repos.some(e=>e.changed>0),onPanel:e=>{g(null),i9(e)},onTerminal:r3})]})]}),(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden`,children:[(0,F.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[a===null&&(0,F.jsx)(hZ,{}),e===null&&a!==null&&(0,F.jsx)(`div`,{className:`grid flex-1 place-items-center p-6 text-center`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-foreground text-3xl font-normal tracking-tight`,children:`Pick a thread, or start one`}),(0,F.jsx)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:`Open a project from the sidebar to talk to Claude.`})]})}),e!==null&&(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(u6,{onOpenTask:_}),(0,F.jsx)(HI,{})]},`${e.machine} ${e.sessionId??e.projectId}`)]}),e!==null&&S&&(0,F.jsxs)(`aside`,{className:`border-border/80 bg-background relative shrink-0 overflow-hidden border-t`,style:{height:b},children:[(0,F.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,className:`group absolute inset-x-0 top-0 z-30 h-1.5 cursor-row-resize touch-none select-none`,onPointerDown:e=>o(e,e=>{let t=Math.max(120,Math.floor(window.innerHeight*.8));x(Math.min(t,Math.max(120,window.innerHeight-e.clientY)))}),children:(0,F.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-x-0 top-0 h-px transition-colors`})}),(0,F.jsx)(P3,{view:e.projectId})]})]}),e!==null&&p!==null&&(0,F.jsxs)(`div`,{className:`relative flex shrink-0`,style:{width:v},children:[(0,F.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:`group absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize select-none`,onPointerDown:e=>o(e,e=>{let t=Math.max(360,Math.floor(window.innerWidth*.7)),n=Math.min(t,Math.max(360,window.innerWidth-e.clientX));y(n)}),children:(0,F.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`})}),(0,F.jsx)(`div`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden rounded-tl-lg border-t border-l`,children:(0,F.jsx)(t9,{panel:p,selection:e,cwd:i,running:C,selectedTask:h,onSelectTask:g,onPanel:i9})})]})]})]}),(0,F.jsx)(DL,{git:T})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(JQ,{className:l(`relative`,!s&&`hidden`),mobile:!1,onHide:()=>c(!1)}),(0,F.jsx)(F3,{machine:n,mobile:!1,leading:!s&&(0,F.jsx)(E,{variant:`ghost`,size:`icon-xs`,"aria-label":`Show sidebar`,title:`Show sidebar (${r}+B)`,onClick:()=>c(!0),children:(0,F.jsx)(k,{icon:_h})})})]})}var a9=Zp({machine:Vp().optional().catch(void 0),project:Vp().optional().catch(void 0),session:Vp().optional().catch(void 0),panel:tm([`diff`,`tasks`,`browser`]).optional().catch(void 0),browse:Vp().optional().catch(void 0),bottom:nm(`terminal`).optional().catch(void 0),terminal:Vp().optional().catch(void 0)}),o9=ma({validateSearch:a9,component:sue}),lue=fa({getParentRoute:()=>o9,path:`/`}),uue=fa({getParentRoute:()=>o9,path:`/terminal`,beforeLoad:()=>{let e=US();throw Pn(e===null?{to:`/`,search:{},replace:!0}:{to:`/terminal/$machine`,params:{machine:e},search:{},replace:!0})}}),due=fa({getParentRoute:()=>o9,path:`/terminal/$machine`}),s9=ga({routeTree:o9.addChildren([lue,uue,due]),disableGlobalCatchBoundary:!0,parseSearch:e=>a9.parse(Object.fromEntries(new URLSearchParams(e))),stringifySearch:e=>{let t=new URLSearchParams;for(let n of Object.entries(e))n[1]!==void 0&&t.set(n[0],String(n[1]));let n=t.toString();return n===``?``:`?${n}`}}),c9=`machines`,l9=document.querySelector(`meta[name="offsite-connect"]`)?.getAttribute(`content`)?.split(` `)??null;function u9(){let e=localStorage.getItem(c9);return e===null?[]:JSON.parse(e)}function fue(e){localStorage.setItem(c9,JSON.stringify(e))}async function pue(e){if(!(`caches`in window))return;let t=e.map(e=>({id:e.id,addresses:e.addresses}));await(await caches.open(`offsite-worker`)).put(`/machines`,new Response(JSON.stringify(t)))}function mue(){if(location.pathname!==`/pair`)return null;let e=new URLSearchParams(location.hash.slice(1));s9.navigate({to:`/`,replace:!0});let t=e.get(`machine`);if(t===null)throw Error(`the pairing link has no machine`);return{address:d9(t).address,code:e.get(`code`)}}function d9(e){let t=e.trim(),n=new URL(/^[a-z]+:\/\//i.test(t)?t:`http://${t}`);if(n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`Use an http:// or https:// address`);let r=new URLSearchParams(n.hash.slice(1)),i=r.get(`machine`);return{address:i===null?n.origin:d9(i).address,code:r.get(`code`)}}function f9(e,t){return`${e} ${t}`}function p9(e){return{id:e.id,addresses:e.addresses,via:null,status:`connecting`,name:e.label??e.name,hostname:e.name,label:e.label,icon:e.icon,pairedAt:e.pairedAt??null,config:null,composer:null,configError:null,system:null,claudeAccounts:[],codexAccounts:[],openCode:{available:!1},notifier:!1,activity:{},providers:[],terminals:[]}}function m9(e){return e.projects.map(t=>({...t,machine:e.id}))}function hue(){let e=u9(),t=Z().machines;for(let n of t)e.some(e=>e.id===n.id)||x9(n.id);for(let n of e){let e=t.find(e=>e.id===n.id);if(e===void 0){let e=Z();$({machines:[...e.machines,p9(n)],projects:[...e.projects,...m9(n)]}),Ga(n.id,n.addresses)}else O9(n.id,{label:n.label,icon:n.icon,name:n.label??e.hostname}),(n.addresses.join(` `)!==e.addresses.join(` `)||n.pairedAt!==e.pairedAt)&&(O9(n.id,{addresses:n.addresses,pairedAt:n.pairedAt}),b9(n.id))}let n=e.map(e=>e.id);$({machines:[...Z().machines].sort((e,t)=>n.indexOf(e.id)-n.indexOf(t.id))})}async function h9(e,t){let n=Z().machines.find(t=>t.addresses.some(t=>e.includes(t)));if(n!==void 0)return t!==null&&await g9(n.id,t),n.id;let r=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);return t!==null&&await Aa(r,await _9(e,t)),$({machines:[...Z().machines,p9({id:r,addresses:e,name:new URL(e[0]).hostname,label:null,icon:`computer`,pairedAt:t===null?null:Date.now(),projects:[]})]}),S9(),Ga(r,e),r}async function g9(e,t){await Aa(e,await _9(T9(Z(),e).addresses,t)),O9(e,{pairedAt:Date.now()}),S9(),b9(e)}async function _9(e,t){let n;for(let r of e){let e=await fetch(`${r}/api/pair`,{method:`POST`,headers:{authorization:`Bearer ${t}`}}).catch(e=>(n??=e,null));if(e!==null){if(!e.ok)throw Error(await e.text());return(await e.json()).token}}throw Error(`Could not reach the machine to pair: ${String(n)}`)}function v9(e,t){let n=T9(Z(),e),r={...n,...t};O9(e,{...t,name:r.label??r.hostname}),S9(),r.addresses.join(` `)!==n.addresses.join(` `)&&b9(e)}function gue(e){$({machines:[...Z().machines].sort((t,n)=>e.indexOf(t.id)-e.indexOf(n.id))}),S9()}function y9(e){pue(e).catch(e=>console.error(`could not share the machines with the service worker`,e))}function b9(e){Ka(e),O9(e,{status:`connecting`,via:null}),Ga(e,T9(Z(),e).addresses)}function _ue(e){x9(e),S9(),ja(e).catch(e=>console.error(`could not remove the device token`,e))}function x9(e){Ka(e);let t=Z(),n=t.machines.filter(t=>t.id!==e);$({machines:n,projects:t.projects.filter(t=>t.machine!==e),sessions:t.sessions.filter(t=>t.machine!==e),inactive:t.inactive.filter(t=>t.machine!==e),unseen:t.unseen.filter(t=>!t.startsWith(`${e} `)),...t.settingsMachine===e&&{settingsMachine:n.at(0)?.id??null},...t.selection?.machine===e&&{selection:null}}),RS()}function S9(){let e=Z(),t=e.machines.map(t=>({id:t.id,addresses:t.addresses,name:t.hostname,label:t.label,icon:t.icon,pairedAt:t.pairedAt,projects:e.projects.filter(e=>e.machine===t.id).map(e=>({id:e.id,path:e.path,name:e.name,logo:e.logo}))}));fue(t),y9(t)}var C9={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`},w9;function vue(e){w9=Co()(()=>e)}function yue(e){return w9.subscribe(e)}function Z(){return w9.getState()}function Q(e){return To(w9,e)}function $(e){w9.setState(e)}function T9(e,t){let n=e.machines.find(e=>e.id===t);if(n===void 0)throw Error(`unknown machine ${t}`);return n}function E9(e,t,n){return e.projects.find(e=>e.machine===t&&e.id===n)}function D9(e){return e.selection?.machine??e.machines.at(0)?.id??null}function O9(e,t){$({machines:Z().machines.map(n=>n.id===e?{...n,...t}:n)})}function k9(e,t,n){if(n!==null)return e.find(e=>e.id===t)?.activity[n]}function A9(e){let t=e.selection;if(t!==null)return k9(e.machines,t.machine,t.sessionId)}function j9(e){return A9(e)?.running===!0}function M9(e){return e.sessionId===null?`new`:f9(e.machine,e.sessionId)}function N9(e){$({draft:e})}function P9(e){$({paletteOpen:e})}function F9(e){$({settingsOpen:e,paletteOpen:!1,...e&&{settingsMachine:D9(Z()),settingsAccount:null,settingsEditedMachine:null,settingsListing:!0}})}function I9(e){$({settingsOpen:!0,settingsPage:e,settingsAccount:null,settingsEditedMachine:null,settingsListing:!1,paletteOpen:!1,...!Z().settingsOpen&&{settingsMachine:D9(Z())}})}function L9(e){$({prefs:e}),GL(e),qP()}function R9(e){$({errors:[...Z().errors,s(e)]})}function z9(){$({errors:[]})}function B9(e){let t=new Map;function n(t,n){Z().machines.some(e=>e.id===t)&&e.apply(t,n)}async function r(r,a){let o=await e.save(r,a),s=t.get(r);s!==void 0&&(--s.writes,!(s.writes>0)&&(o===null?await i(r):n(r,o)))}async function i(r){let i=t.get(r)?.version;try{let a=await e.load(r),o=t.get(r);o!==void 0&&o.writes===0&&o.version===i&&n(r,a)}catch(e){R9(e)}}return{update(n,i){e.set(n,i);let a=t.get(n)??{writes:0,version:0,timer:void 0};t.set(n,a),a.timer===void 0&&(a.writes+=1),a.version+=1,window.clearTimeout(a.timer),a.timer=window.setTimeout(()=>{a.timer=void 0,r(n,i)},300)},receive(e,r){(t.get(e)?.writes??0)===0&&n(e,r)}}}var V9=B9({set:W9,save:async(e,t)=>{try{let n=await I(e,`config.save`,t);return O9(e,{configError:null}),n}catch(t){return O9(e,{configError:s(t)}),null}},load:async e=>(await I(e,`config.get`,void 0)).config,apply:W9}),H9=B9({set:(e,t)=>O9(e,{composer:t}),save:async(e,t)=>{try{return await I(e,`composer.save`,t)}catch(e){return R9(e),null}},load:e=>I(e,`composer.get`,void 0),apply:Cue}),U9=V9.update,bue=V9.receive,xue=H9.update,Sue=H9.receive;function W9(e,t){let n=T9(Z(),e).config;O9(e,{config:t}),(n===null||!ho(n.newThreads,t.newThreads))&&Z9(e)}function Cue(e,t){let n=T9(Z(),e).composer;O9(e,{composer:t});let r=Z().selection;if(r===null||r.machine!==e)return;if(r.sessionId===null){n===null&&Z9(e);return}if(k9(Z().machines,e,r.sessionId)!==void 0)return;let i=Wo(M9(r))??q9(t,Z().settings.provider),a=i.provider!==Z().settings.provider||i.accountId!==Z().settings.accountId;$({settings:i}),a&&$9()}var G9=null,K9={provider:`claude`,accountId:null,model:null,effort:null,mode:null,plan:!1};function q9(e,t){return e===null?{...K9,provider:t}:{provider:t,...e[t]}}function J9(e){if(e.config===null)return K9;let t=e.config.newThreads;return{...q9(e.composer,t.provider),accountId:t.accountId,model:t.models[t.provider],effort:null}}function Y9(e){let t={...Z().settings,...e};$({settings:t});let n=Z().selection;if(n===null)return;n.sessionId!==null&&Go(M9(n),t);let r=T9(Z(),n.machine).composer;r!==null&&xue(n.machine,{...r,provider:t.provider,[t.provider]:{accountId:t.accountId,model:t.model,effort:t.effort,mode:t.mode,plan:t.plan}}),e.accountId!==void 0&&$9(),n.sessionId!==null&&k9(Z().machines,n.machine,n.sessionId)!==void 0&&e.accountId===void 0&&I(n.machine,`sessions.configure`,{sessionId:n.sessionId,settings:t}).catch(R9)}function X9(e,t){if(O9(e,{claudeAccounts:t.claudeAccounts,codexAccounts:t.codexAccounts,openCode:t.openCode}),Z().selection?.machine!==e)return;let n=Z().settings,r=[...[...t.claudeAccounts,...t.codexAccounts].filter(e=>e.valid).map(e=>({provider:e.provider,accountId:e.id})),...t.openCode.available?[{provider:`opencode`,accountId:null}]:[]];if(r.some(e=>e.provider===n.provider&&e.accountId===n.accountId))return;let i=r.find(e=>e.provider===n.provider),a=Z().selection?.sessionId===null?r.at(0):void 0;if(i!==void 0)Y9({accountId:i.accountId});else if(a!==void 0){let t=T9(Z(),e);Y9({...q9(t.composer,a.provider),accountId:a.accountId,model:t.config===null?null:t.config.newThreads.models[a.provider],effort:null})}else n.accountId!==null&&Y9({accountId:null})}function Z9(e){let t=Z().selection;t?.machine===e&&t.sessionId===null&&($({settings:J9(T9(Z(),e))}),Q9(e))}function Q9(e){let t=T9(Z(),e);(t.claudeAccounts.length>0||t.codexAccounts.length>0||t.openCode.available)&&X9(e,{claudeAccounts:t.claudeAccounts,codexAccounts:t.codexAccounts,openCode:t.openCode}),$9()}async function wue(e){try{X9(e,await I(e,`accounts.list`,void 0))}catch(e){R9(e)}}async function $9(){let e=Z().selection;if(e===null)return;let{provider:t,accountId:n}=Z().settings;if(t!==`opencode`&&n===null)$({capabilities:null});else try{let r=JSON.stringify([e.machine,t,n,e.projectId]);if(G9?.key!==r){let i=I(e.machine,`capabilities`,{provider:t,accountId:n,projectId:e.projectId});function a(){G9?.result===i&&(G9=null)}i.then(a,a),G9={key:r,result:i}}let i=await G9.result;if(Z().selection?.machine!==e.machine||Z().selection?.projectId!==e.projectId||Z().settings.provider!==t||Z().settings.accountId!==n)return;$({capabilities:i});let a=Z().settings;if(a.model!==null){let e=i.models.find(e=>e.value===a.model)?.effort;a.provider!==`opencode`&&a.effort===null&&e!=null&&Y9({effort:e});return}let o=i.models.find(e=>!e.hidden&&e.value===i.defaultModel)??i.models.find(e=>!e.hidden);if(o===void 0)return;Y9({model:o.value,...o.effort===null?{}:{effort:o.effort}})}catch(e){R9(e)}}export{Z8 as $,ho as $n,yX as $t,V7 as A,wS as An,H6 as At,F5 as B,km as Bn,w6 as Bt,S9 as C,mS as Cn,$6 as Ct,y9 as D,bS as Dn,q6 as Dt,m9 as E,vS as En,J6 as Et,Q5 as F,Oh as Fn,E6 as Ft,O5 as G,bm as Gn,h6 as Gt,M5 as H,Tm as Hn,y6 as Ht,R5 as I,_h as In,T6 as It,u5 as J,pm as Jn,SZ as Jt,m5 as K,_m as Kn,m6 as Kt,z5 as L,fh as Ln,X as Lt,j7 as M,TS as Mn,j6 as Mt,A7 as N,gS as Nn,O6 as Nt,s9 as O,xS as On,K6 as Ot,b7 as P,zh as Pn,D6 as Pt,Q8 as Q,yo as Qn,CZ as Qt,L5 as R,Im as Rn,C6 as Rt,mue as S,RS as Sn,Q6 as St,p9 as T,_S as Tn,X6 as Tt,j5 as U,wm as Un,v6 as Ut,N5 as V,Om as Vn,x6 as Vt,A5 as W,Sm as Wn,_6 as Wt,o5 as X,Lo as Xn,DZ as Xt,l5 as Y,Wo as Yn,EZ as Yt,r5 as Z,Go as Zn,jZ as Zt,Q as _,HS as _n,l8 as _t,X9 as a,RL as an,ki as ar,R8 as at,u9 as b,IS as bn,n8 as bt,vue as c,LL as cn,Sr as cr,F8 as ct,Z as d,IL as dn,sn as dr,O8 as dt,mX as en,I as er,X8 as et,T9 as f,qI as fn,Ut as fr,E8 as ft,$ as g,KP as gn,d8 as gt,R9 as h,GP as hn,v8 as ht,$9 as i,kL as in,Ji as ir,z8 as it,I7 as j,ES as jn,A6 as jt,z7 as k,CS as kn,G6 as kt,z9 as l,FL as ln,Nn as lr,A8 as lt,O9 as m,qP as mn,b8 as mt,q9 as n,EX as nn,qa as nr,V8 as nt,Sue as o,zL as on,Di as or,L8 as ot,E9 as p,YP as pn,T8 as pt,f5 as q,gm as qn,U4 as qt,wue as r,WL as rn,Ua as rr,B8 as rt,bue as s,NL as sn,Ei as sr,I8 as st,K9 as t,hX as tn,Ga as tr,Y8 as tt,M9 as u,PL as un,hn as ur,k8 as ut,h9 as v,VS as vn,i8 as vt,hue as w,yS as wn,Y6 as wt,f9 as x,NS as xn,t8 as xt,l9 as y,BS as yn,r8 as yt,I5 as z,Fm as zn,S6 as zt};