stashes 0.1.34 → 0.1.35

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.
@@ -57,7 +57,7 @@ Error generating stack: `+o.message+`
57
57
  * @license MIT
58
58
  */var JS="popstate";function ev(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function hk(e={}){function a(l,s){var f;let u=(f=s.state)==null?void 0:f.masked,{pathname:c,search:p,hash:m}=u||l.location;return ad("",{pathname:c,search:p,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",u?{pathname:l.location.pathname,search:l.location.search,hash:l.location.hash}:void 0)}function r(l,s){return typeof s=="string"?s:Qi(s)}return yk(a,r,null,e)}function Ke(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function vn(e,a){if(!e){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function bk(){return Math.random().toString(36).substring(2,10)}function tv(e,a){return{usr:e.state,key:e.key,idx:a,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ad(e,a,r=null,l,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof a=="string"?Fr(a):a,state:r,key:a&&a.key||l||bk(),unstable_mask:s}}function Qi({pathname:e="/",search:a="",hash:r=""}){return a&&a!=="?"&&(e+=a.charAt(0)==="?"?a:"?"+a),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Fr(e){let a={};if(e){let r=e.indexOf("#");r>=0&&(a.hash=e.substring(r),e=e.substring(0,r));let l=e.indexOf("?");l>=0&&(a.search=e.substring(l),e=e.substring(0,l)),e&&(a.pathname=e)}return a}function yk(e,a,r,l={}){let{window:s=document.defaultView,v5Compat:u=!1}=l,c=s.history,p="POP",m=null,f=b();f==null&&(f=0,c.replaceState({...c.state,idx:f},""));function b(){return(c.state||{idx:null}).idx}function h(){p="POP";let _=b(),w=_==null?null:_-f;f=_,m&&m({action:p,location:x.location,delta:w})}function S(_,w){p="PUSH";let C=ev(_)?_:ad(x.location,_,w);f=b()+1;let I=tv(C,f),P=x.createHref(C.unstable_mask||C);try{c.pushState(I,"",P)}catch(V){if(V instanceof DOMException&&V.name==="DataCloneError")throw V;s.location.assign(P)}u&&m&&m({action:p,location:x.location,delta:1})}function E(_,w){p="REPLACE";let C=ev(_)?_:ad(x.location,_,w);f=b();let I=tv(C,f),P=x.createHref(C.unstable_mask||C);c.replaceState(I,"",P),u&&m&&m({action:p,location:x.location,delta:0})}function v(_){return Ek(_)}let x={get action(){return p},get location(){return e(s,c)},listen(_){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(JS,h),m=_,()=>{s.removeEventListener(JS,h),m=null}},createHref(_){return a(s,_)},createURL:v,encodeLocation(_){let w=v(_);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:S,replace:E,go(_){return c.go(_)}};return x}function Ek(e,a=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Ke(r,"No window.location.(origin|href) available to create URL");let l=typeof e=="string"?e:Qi(e);return l=l.replace(/ $/,"%20"),!a&&l.startsWith("//")&&(l=r+l),new URL(l,r)}function sT(e,a,r="/"){return Sk(e,a,r,!1)}function Sk(e,a,r,l){let s=typeof a=="string"?Fr(a):a,u=qn(s.pathname||"/",r);if(u==null)return null;let c=uT(e);vk(c);let p=null;for(let m=0;p==null&&m<c.length;++m){let f=Ok(u);p=Ck(c[m],f,l)}return p}function uT(e,a=[],r=[],l="",s=!1){let u=(c,p,m=s,f)=>{let b={relativePath:f===void 0?c.path||"":f,caseSensitive:c.caseSensitive===!0,childrenIndex:p,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(l)&&m)return;Ke(b.relativePath.startsWith(l),`Absolute route path "${b.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(l.length)}let h=Sn([l,b.relativePath]),S=r.concat(b);c.children&&c.children.length>0&&(Ke(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),uT(c.children,a,S,h,m)),!(c.path==null&&!c.index)&&a.push({path:h,score:Rk(h,c.index),routesMeta:S})};return e.forEach((c,p)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,p);else for(let f of cT(c.path))u(c,p,!0,f)}),a}function cT(e){let a=e.split("/");if(a.length===0)return[];let[r,...l]=a,s=r.endsWith("?"),u=r.replace(/\?$/,"");if(l.length===0)return s?[u,""]:[u];let c=cT(l.join("/")),p=[];return p.push(...c.map(m=>m===""?u:[u,m].join("/"))),s&&p.push(...c),p.map(m=>e.startsWith("/")&&m===""?"/":m)}function vk(e){e.sort((a,r)=>a.score!==r.score?r.score-a.score:Nk(a.routesMeta.map(l=>l.childrenIndex),r.routesMeta.map(l=>l.childrenIndex)))}var Tk=/^:[\w-]+$/,Ak=3,wk=2,_k=1,kk=10,xk=-2,nv=e=>e==="*";function Rk(e,a){let r=e.split("/"),l=r.length;return r.some(nv)&&(l+=xk),a&&(l+=wk),r.filter(s=>!nv(s)).reduce((s,u)=>s+(Tk.test(u)?Ak:u===""?_k:kk),l)}function Nk(e,a){return e.length===a.length&&e.slice(0,-1).every((l,s)=>l===a[s])?e[e.length-1]-a[a.length-1]:0}function Ck(e,a,r=!1){let{routesMeta:l}=e,s={},u="/",c=[];for(let p=0;p<l.length;++p){let m=l[p],f=p===l.length-1,b=u==="/"?a:a.slice(u.length)||"/",h=Yo({path:m.relativePath,caseSensitive:m.caseSensitive,end:f},b),S=m.route;if(!h&&f&&r&&!l[l.length-1].route.index&&(h=Yo({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},b)),!h)return null;Object.assign(s,h.params),c.push({params:s,pathname:Sn([u,h.pathname]),pathnameBase:Uk(Sn([u,h.pathnameBase])),route:S}),h.pathnameBase!=="/"&&(u=Sn([u,h.pathnameBase]))}return c}function Yo(e,a){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,l]=Ik(e.path,e.caseSensitive,e.end),s=a.match(r);if(!s)return null;let u=s[0],c=u.replace(/(.)\/+$/,"$1"),p=s.slice(1);return{params:l.reduce((f,{paramName:b,isOptional:h},S)=>{if(b==="*"){let v=p[S]||"";c=u.slice(0,u.length-v.length).replace(/(.)\/+$/,"$1")}const E=p[S];return h&&!E?f[b]=void 0:f[b]=(E||"").replace(/%2F/g,"/"),f},{}),pathname:u,pathnameBase:c,pattern:e}}function Ik(e,a=!1,r=!0){vn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let l=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,p,m,f,b)=>{if(l.push({paramName:p,isOptional:m!=null}),m){let h=b.charAt(f+c.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(l.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,a?void 0:"i"),l]}function Ok(e){try{return e.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return vn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),e}}function qn(e,a){if(a==="/")return e;if(!e.toLowerCase().startsWith(a.toLowerCase()))return null;let r=a.endsWith("/")?a.length-1:a.length,l=e.charAt(r);return l&&l!=="/"?null:e.slice(r)||"/"}var Lk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Dk(e,a="/"){let{pathname:r,search:l="",hash:s=""}=typeof e=="string"?Fr(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=av(r.substring(1),"/"):u=av(r,a)):u=a,{pathname:u,search:Bk(l),hash:Fk(s)}}function av(e,a){let r=a.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Uc(e,a,r,l){return`Cannot include a '${e}' character in a manually specified \`to.${a}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Mk(e){return e.filter((a,r)=>r===0||a.route.path&&a.route.path.length>0)}function dT(e){let a=Mk(e);return a.map((r,l)=>l===a.length-1?r.pathname:r.pathnameBase)}function Ad(e,a,r,l=!1){let s;typeof e=="string"?s=Fr(e):(s={...e},Ke(!s.pathname||!s.pathname.includes("?"),Uc("?","pathname","search",s)),Ke(!s.pathname||!s.pathname.includes("#"),Uc("#","pathname","hash",s)),Ke(!s.search||!s.search.includes("#"),Uc("#","search","hash",s)));let u=e===""||s.pathname==="",c=u?"/":s.pathname,p;if(c==null)p=r;else{let h=a.length-1;if(!l&&c.startsWith("..")){let S=c.split("/");for(;S[0]==="..";)S.shift(),h-=1;s.pathname=S.join("/")}p=h>=0?a[h]:"/"}let m=Dk(s,p),f=c&&c!=="/"&&c.endsWith("/"),b=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(f||b)&&(m.pathname+="/"),m}var Sn=e=>e.join("/").replace(/\/\/+/g,"/"),Uk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Bk=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Fk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,zk=class{constructor(e,a,r,l=!1){this.status=e,this.statusText=a||"",this.internal=l,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Gk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function jk(e){return e.map(a=>a.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var pT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fT(e,a){let r=e;if(typeof r!="string"||!Lk.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let l=r,s=!1;if(pT)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),p=qn(c.pathname,a);c.origin===u.origin&&p!=null?r=p+c.search+c.hash:s=!0}catch{vn(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var gT=["POST","PUT","PATCH","DELETE"];new Set(gT);var Hk=["GET",...gT];new Set(Hk);var zr=H.createContext(null);zr.displayName="DataRouter";var Qo=H.createContext(null);Qo.displayName="DataRouterState";var $k=H.createContext(!1),mT=H.createContext({isTransitioning:!1});mT.displayName="ViewTransition";var Pk=H.createContext(new Map);Pk.displayName="Fetchers";var qk=H.createContext(null);qk.displayName="Await";var sn=H.createContext(null);sn.displayName="Navigation";var rl=H.createContext(null);rl.displayName="Location";var Tn=H.createContext({outlet:null,matches:[],isDataRoute:!1});Tn.displayName="Route";var wd=H.createContext(null);wd.displayName="RouteError";var hT="REACT_ROUTER_ERROR",Vk="REDIRECT",Yk="ROUTE_ERROR_RESPONSE";function Wk(e){if(e.startsWith(`${hT}:${Vk}:{`))try{let a=JSON.parse(e.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function Xk(e){if(e.startsWith(`${hT}:${Yk}:{`))try{let a=JSON.parse(e.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new zk(a.status,a.statusText,a.data)}catch{}}function Zk(e,{relative:a}={}){Ke(il(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:l}=H.useContext(sn),{hash:s,pathname:u,search:c}=ll(e,{relative:a}),p=u;return r!=="/"&&(p=u==="/"?r:Sn([r,u])),l.createHref({pathname:p,search:c,hash:s})}function il(){return H.useContext(rl)!=null}function Sa(){return Ke(il(),"useLocation() may be used only in the context of a <Router> component."),H.useContext(rl).location}var bT="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function yT(e){H.useContext(sn).static||H.useLayoutEffect(e)}function _d(){let{isDataRoute:e}=H.useContext(Tn);return e?cx():Kk()}function Kk(){Ke(il(),"useNavigate() may be used only in the context of a <Router> component.");let e=H.useContext(zr),{basename:a,navigator:r}=H.useContext(sn),{matches:l}=H.useContext(Tn),{pathname:s}=Sa(),u=JSON.stringify(dT(l)),c=H.useRef(!1);return yT(()=>{c.current=!0}),H.useCallback((m,f={})=>{if(vn(c.current,bT),!c.current)return;if(typeof m=="number"){r.go(m);return}let b=Ad(m,JSON.parse(u),s,f.relative==="path");e==null&&a!=="/"&&(b.pathname=b.pathname==="/"?a:Sn([a,b.pathname])),(f.replace?r.replace:r.push)(b,f.state,f)},[a,r,u,s,e])}H.createContext(null);function Qk(){let{matches:e}=H.useContext(Tn),a=e[e.length-1];return a?a.params:{}}function ll(e,{relative:a}={}){let{matches:r}=H.useContext(Tn),{pathname:l}=Sa(),s=JSON.stringify(dT(r));return H.useMemo(()=>Ad(e,JSON.parse(s),l,a==="path"),[e,s,l,a])}function Jk(e,a){return ET(e,a)}function ET(e,a,r){var _;Ke(il(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=H.useContext(sn),{matches:s}=H.useContext(Tn),u=s[s.length-1],c=u?u.params:{},p=u?u.pathname:"/",m=u?u.pathnameBase:"/",f=u&&u.route;{let w=f&&f.path||"";vT(p,!f||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
59
 
60
- Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let b=Sa(),h;if(a){let w=typeof a=="string"?Fr(a):a;Ke(m==="/"||((_=w.pathname)==null?void 0:_.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${w.pathname}" was given in the \`location\` prop.`),h=w}else h=b;let S=h.pathname||"/",E=S;if(m!=="/"){let w=m.replace(/^\//,"").split("/");E="/"+S.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=sT(e,{pathname:E});vn(f||v!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),vn(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=rx(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:Sn([m,l.encodeLocation?l.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?m:Sn([m,l.encodeLocation?l.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),s,r);return a&&x?H.createElement(rl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},x):x}function ex(){let e=ux(),a=Gk(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,l="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=H.createElement(H.Fragment,null,H.createElement("p",null,"💿 Hey developer 👋"),H.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",H.createElement("code",{style:u},"ErrorBoundary")," or"," ",H.createElement("code",{style:u},"errorElement")," prop on your route.")),H.createElement(H.Fragment,null,H.createElement("h2",null,"Unexpected Application Error!"),H.createElement("h3",{style:{fontStyle:"italic"}},a),r?H.createElement("pre",{style:s},r):null,c)}var tx=H.createElement(ex,null),ST=class extends H.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,a){return a.location!==e.location||a.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){this.props.onError?this.props.onError(e,a):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=Xk(e.digest);r&&(e=r)}let a=e!==void 0?H.createElement(Tn.Provider,{value:this.props.routeContext},H.createElement(wd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?H.createElement(nx,{error:e},a):a}};ST.contextType=$k;var Bc=new WeakMap;function nx({children:e,error:a}){let{basename:r}=H.useContext(sn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let l=Wk(a.digest);if(l){let s=Bc.get(a);if(s)throw s;let u=fT(l.location,r);if(pT&&!Bc.get(a))if(u.isExternal||l.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:l.replace}));throw Bc.set(a,c),c}return H.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function ax({routeContext:e,match:a,children:r}){let l=H.useContext(zr);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),H.createElement(Tn.Provider,{value:e},r)}function rx(e,a=[],r){let l=r==null?void 0:r.state;if(e==null){if(!l)return null;if(l.errors)e=l.matches;else if(a.length===0&&!l.initialized&&l.matches.length>0)e=l.matches;else return null}let s=e,u=l==null?void 0:l.errors;if(u!=null){let b=s.findIndex(h=>h.route.id&&(u==null?void 0:u[h.route.id])!==void 0);Ke(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),s=s.slice(0,Math.min(s.length,b+1))}let c=!1,p=-1;if(r&&l){c=l.renderFallback;for(let b=0;b<s.length;b++){let h=s[b];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(p=b),h.route.id){let{loaderData:S,errors:E}=l,v=h.route.loader&&!S.hasOwnProperty(h.route.id)&&(!E||E[h.route.id]===void 0);if(h.route.lazy||v){r.isStatic&&(c=!0),p>=0?s=s.slice(0,p+1):s=[s[0]];break}}}}let m=r==null?void 0:r.onError,f=l&&m?(b,h)=>{var S,E;m(b,{location:l.location,params:((E=(S=l.matches)==null?void 0:S[0])==null?void 0:E.params)??{},unstable_pattern:jk(l.matches),errorInfo:h})}:void 0;return s.reduceRight((b,h,S)=>{let E,v=!1,x=null,_=null;l&&(E=u&&h.route.id?u[h.route.id]:void 0,x=h.route.errorElement||tx,c&&(p<0&&S===0?(vT("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,_=null):p===S&&(v=!0,_=h.route.hydrateFallbackElement||null)));let w=a.concat(s.slice(0,S+1)),C=()=>{let I;return E?I=x:v?I=_:h.route.Component?I=H.createElement(h.route.Component,null):h.route.element?I=h.route.element:I=b,H.createElement(ax,{match:h,routeContext:{outlet:b,matches:w,isDataRoute:l!=null},children:I})};return l&&(h.route.ErrorBoundary||h.route.errorElement||S===0)?H.createElement(ST,{location:l.location,revalidation:l.revalidation,component:x,error:E,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:f}):C()},null)}function kd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ix(e){let a=H.useContext(zr);return Ke(a,kd(e)),a}function lx(e){let a=H.useContext(Qo);return Ke(a,kd(e)),a}function ox(e){let a=H.useContext(Tn);return Ke(a,kd(e)),a}function xd(e){let a=ox(e),r=a.matches[a.matches.length-1];return Ke(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function sx(){return xd("useRouteId")}function ux(){var l;let e=H.useContext(wd),a=lx("useRouteError"),r=xd("useRouteError");return e!==void 0?e:(l=a.errors)==null?void 0:l[r]}function cx(){let{router:e}=ix("useNavigate"),a=xd("useNavigate"),r=H.useRef(!1);return yT(()=>{r.current=!0}),H.useCallback(async(s,u={})=>{vn(r.current,bT),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:a,...u}))},[e,a])}var rv={};function vT(e,a,r){!a&&!rv[e]&&(rv[e]=!0,vn(!1,r))}H.memo(dx);function dx({routes:e,future:a,state:r,isStatic:l,onError:s}){return ET(e,void 0,{state:r,isStatic:l,onError:s})}function rd(e){Ke(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function px({basename:e="/",children:a=null,location:r,navigationType:l="POP",navigator:s,static:u=!1,unstable_useTransitions:c}){Ke(!il(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=e.replace(/^\/*/,"/"),m=H.useMemo(()=>({basename:p,navigator:s,static:u,unstable_useTransitions:c,future:{}}),[p,s,u,c]);typeof r=="string"&&(r=Fr(r));let{pathname:f="/",search:b="",hash:h="",state:S=null,key:E="default",unstable_mask:v}=r,x=H.useMemo(()=>{let _=qn(f,p);return _==null?null:{location:{pathname:_,search:b,hash:h,state:S,key:E,unstable_mask:v},navigationType:l}},[p,f,b,h,S,E,l,v]);return vn(x!=null,`<Router basename="${p}"> is not able to match the URL "${f}${b}${h}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:H.createElement(sn.Provider,{value:m},H.createElement(rl.Provider,{children:a,value:x}))}function fx({children:e,location:a}){return Jk(id(e),a)}function id(e,a=[]){let r=[];return H.Children.forEach(e,(l,s)=>{if(!H.isValidElement(l))return;let u=[...a,s];if(l.type===H.Fragment){r.push.apply(r,id(l.props.children,u));return}Ke(l.type===rd,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ke(!l.props.index||!l.props.children,"An index route cannot have child routes.");let c={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(c.children=id(l.props.children,u)),r.push(c)}),r}var Ho="get",$o="application/x-www-form-urlencoded";function Jo(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function gx(e){return Jo(e)&&e.tagName.toLowerCase()==="button"}function mx(e){return Jo(e)&&e.tagName.toLowerCase()==="form"}function hx(e){return Jo(e)&&e.tagName.toLowerCase()==="input"}function bx(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yx(e,a){return e.button===0&&(!a||a==="_self")&&!bx(e)}var Uo=null;function Ex(){if(Uo===null)try{new FormData(document.createElement("form"),0),Uo=!1}catch{Uo=!0}return Uo}var Sx=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Fc(e){return e!=null&&!Sx.has(e)?(vn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${$o}"`),null):e}function vx(e,a){let r,l,s,u,c;if(mx(e)){let p=e.getAttribute("action");l=p?qn(p,a):null,r=e.getAttribute("method")||Ho,s=Fc(e.getAttribute("enctype"))||$o,u=new FormData(e)}else if(gx(e)||hx(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||p.getAttribute("action");if(l=m?qn(m,a):null,r=e.getAttribute("formmethod")||p.getAttribute("method")||Ho,s=Fc(e.getAttribute("formenctype"))||Fc(p.getAttribute("enctype"))||$o,u=new FormData(p,e),!Ex()){let{name:f,type:b,value:h}=e;if(b==="image"){let S=f?`${f}.`:"";u.append(`${S}x`,"0"),u.append(`${S}y`,"0")}else f&&u.append(f,h)}}else{if(Jo(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Ho,l=null,s=$o,c=e}return u&&s==="text/plain"&&(c=u,u=void 0),{action:l,method:r.toLowerCase(),encType:s,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rd(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function Tx(e,a,r,l){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${l}`:s.pathname=`${s.pathname}.${l}`:s.pathname==="/"?s.pathname=`_root.${l}`:a&&qn(s.pathname,a)==="/"?s.pathname=`${a.replace(/\/$/,"")}/_root.${l}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${l}`,s}async function Ax(e,a){if(e.id in a)return a[e.id];try{let r=await import(e.module);return a[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function wx(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function _x(e,a,r){let l=await Promise.all(e.map(async s=>{let u=a.routes[s.route.id];if(u){let c=await Ax(u,r);return c.links?c.links():[]}return[]}));return Nx(l.flat(1).filter(wx).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function iv(e,a,r,l,s,u){let c=(m,f)=>r[f]?m.route.id!==r[f].route.id:!0,p=(m,f)=>{var b;return r[f].pathname!==m.pathname||((b=r[f].route.path)==null?void 0:b.endsWith("*"))&&r[f].params["*"]!==m.params["*"]};return u==="assets"?a.filter((m,f)=>c(m,f)||p(m,f)):u==="data"?a.filter((m,f)=>{var h;let b=l.routes[m.route.id];if(!b||!b.hasLoader)return!1;if(c(m,f)||p(m,f))return!0;if(m.route.shouldRevalidate){let S=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=r[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof S=="boolean")return S}return!0}):[]}function kx(e,a,{includeHydrateFallback:r}={}){return xx(e.map(l=>{let s=a.routes[l.route.id];if(!s)return[];let u=[s.module];return s.clientActionModule&&(u=u.concat(s.clientActionModule)),s.clientLoaderModule&&(u=u.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(u=u.concat(s.hydrateFallbackModule)),s.imports&&(u=u.concat(s.imports)),u}).flat(1))}function xx(e){return[...new Set(e)]}function Rx(e){let a={},r=Object.keys(e).sort();for(let l of r)a[l]=e[l];return a}function Nx(e,a){let r=new Set;return new Set(a),e.reduce((l,s)=>{let u=JSON.stringify(Rx(s));return r.has(u)||(r.add(u),l.push({key:u,link:s})),l},[])}function TT(){let e=H.useContext(zr);return Rd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Cx(){let e=H.useContext(Qo);return Rd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Nd=H.createContext(void 0);Nd.displayName="FrameworkContext";function AT(){let e=H.useContext(Nd);return Rd(e,"You must render this element inside a <HydratedRouter> element"),e}function Ix(e,a){let r=H.useContext(Nd),[l,s]=H.useState(!1),[u,c]=H.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:f,onMouseLeave:b,onTouchStart:h}=a,S=H.useRef(null);H.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let x=w=>{w.forEach(C=>{c(C.isIntersecting)})},_=new IntersectionObserver(x,{threshold:.5});return S.current&&_.observe(S.current),()=>{_.disconnect()}}},[e]),H.useEffect(()=>{if(l){let x=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(x)}}},[l]);let E=()=>{s(!0)},v=()=>{s(!1),c(!1)};return r?e!=="intent"?[u,S,{}]:[u,S,{onFocus:$i(p,E),onBlur:$i(m,v),onMouseEnter:$i(f,E),onMouseLeave:$i(b,v),onTouchStart:$i(h,E)}]:[!1,S,{}]}function $i(e,a){return r=>{e&&e(r),r.defaultPrevented||a(r)}}function Ox({page:e,...a}){let{router:r}=TT(),l=H.useMemo(()=>sT(r.routes,e,r.basename),[r.routes,e,r.basename]);return l?H.createElement(Dx,{page:e,matches:l,...a}):null}function Lx(e){let{manifest:a,routeModules:r}=AT(),[l,s]=H.useState([]);return H.useEffect(()=>{let u=!1;return _x(e,a,r).then(c=>{u||s(c)}),()=>{u=!0}},[e,a,r]),l}function Dx({page:e,matches:a,...r}){let l=Sa(),{future:s,manifest:u,routeModules:c}=AT(),{basename:p}=TT(),{loaderData:m,matches:f}=Cx(),b=H.useMemo(()=>iv(e,a,f,u,l,"data"),[e,a,f,u,l]),h=H.useMemo(()=>iv(e,a,f,u,l,"assets"),[e,a,f,u,l]),S=H.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let x=new Set,_=!1;if(a.forEach(C=>{var P;let I=u.routes[C.route.id];!I||!I.hasLoader||(!b.some(V=>V.route.id===C.route.id)&&C.route.id in m&&((P=c[C.route.id])!=null&&P.shouldRevalidate)||I.hasClientLoader?_=!0:x.add(C.route.id))}),x.size===0)return[];let w=Tx(e,p,s.unstable_trailingSlashAwareDataRequests,"data");return _&&x.size>0&&w.searchParams.set("_routes",a.filter(C=>x.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[p,s.unstable_trailingSlashAwareDataRequests,m,l,u,b,a,e,c]),E=H.useMemo(()=>kx(h,u),[h,u]),v=Lx(h);return H.createElement(H.Fragment,null,S.map(x=>H.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...r})),E.map(x=>H.createElement("link",{key:x,rel:"modulepreload",href:x,...r})),v.map(({key:x,link:_})=>H.createElement("link",{key:x,nonce:r.nonce,..._,crossOrigin:_.crossOrigin??r.crossOrigin})))}function Mx(...e){return a=>{e.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}var Ux=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ux&&(window.__reactRouterVersion="7.13.2")}catch{}function Bx({basename:e,children:a,unstable_useTransitions:r,window:l}){let s=H.useRef();s.current==null&&(s.current=hk({window:l,v5Compat:!0}));let u=s.current,[c,p]=H.useState({action:u.action,location:u.location}),m=H.useCallback(f=>{r===!1?p(f):H.startTransition(()=>p(f))},[r]);return H.useLayoutEffect(()=>u.listen(m),[u,m]),H.createElement(px,{basename:e,children:a,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var wT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_T=H.forwardRef(function({onClick:a,discover:r="render",prefetch:l="none",relative:s,reloadDocument:u,replace:c,unstable_mask:p,state:m,target:f,to:b,preventScrollReset:h,viewTransition:S,unstable_defaultShouldRevalidate:E,...v},x){let{basename:_,navigator:w,unstable_useTransitions:C}=H.useContext(sn),I=typeof b=="string"&&wT.test(b),P=fT(b,_);b=P.to;let V=Zk(b,{relative:s}),M=Sa(),W=null;if(p){let J=Ad(p,[],M.unstable_mask?M.unstable_mask.pathname:"/",!0);_!=="/"&&(J.pathname=J.pathname==="/"?_:Sn([_,J.pathname])),W=w.createHref(J)}let[ae,oe,B]=Ix(l,v),te=jx(b,{replace:c,unstable_mask:p,state:m,target:f,preventScrollReset:h,relative:s,viewTransition:S,unstable_defaultShouldRevalidate:E,unstable_useTransitions:C});function ee(J){a&&a(J),J.defaultPrevented||te(J)}let ie=!(P.isExternal||u),re=H.createElement("a",{...v,...B,href:(ie?W:void 0)||P.absoluteURL||V,onClick:ie?ee:a,ref:Mx(x,oe),target:f,"data-discover":!I&&r==="render"?"true":void 0});return ae&&!I?H.createElement(H.Fragment,null,re,H.createElement(Ox,{page:V})):re});_T.displayName="Link";var Fx=H.forwardRef(function({"aria-current":a="page",caseSensitive:r=!1,className:l="",end:s=!1,style:u,to:c,viewTransition:p,children:m,...f},b){let h=ll(c,{relative:f.relative}),S=Sa(),E=H.useContext(Qo),{navigator:v,basename:x}=H.useContext(sn),_=E!=null&&Vx(h)&&p===!0,w=v.encodeLocation?v.encodeLocation(h).pathname:h.pathname,C=S.pathname,I=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;r||(C=C.toLowerCase(),I=I?I.toLowerCase():null,w=w.toLowerCase()),I&&x&&(I=qn(I,x)||I);const P=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let V=C===w||!s&&C.startsWith(w)&&C.charAt(P)==="/",M=I!=null&&(I===w||!s&&I.startsWith(w)&&I.charAt(w.length)==="/"),W={isActive:V,isPending:M,isTransitioning:_},ae=V?a:void 0,oe;typeof l=="function"?oe=l(W):oe=[l,V?"active":null,M?"pending":null,_?"transitioning":null].filter(Boolean).join(" ");let B=typeof u=="function"?u(W):u;return H.createElement(_T,{...f,"aria-current":ae,className:oe,ref:b,style:B,to:c,viewTransition:p},typeof m=="function"?m(W):m)});Fx.displayName="NavLink";var zx=H.forwardRef(({discover:e="render",fetcherKey:a,navigate:r,reloadDocument:l,replace:s,state:u,method:c=Ho,action:p,onSubmit:m,relative:f,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:S,...E},v)=>{let{unstable_useTransitions:x}=H.useContext(sn),_=Px(),w=qx(p,{relative:f}),C=c.toLowerCase()==="get"?"get":"post",I=typeof p=="string"&&wT.test(p),P=V=>{if(m&&m(V),V.defaultPrevented)return;V.preventDefault();let M=V.nativeEvent.submitter,W=(M==null?void 0:M.getAttribute("formmethod"))||c,ae=()=>_(M||V.currentTarget,{fetcherKey:a,method:W,navigate:r,replace:s,state:u,relative:f,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:S});x&&r!==!1?H.startTransition(()=>ae()):ae()};return H.createElement("form",{ref:v,method:C,action:w,onSubmit:l?m:P,...E,"data-discover":!I&&e==="render"?"true":void 0})});zx.displayName="Form";function Gx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kT(e){let a=H.useContext(zr);return Ke(a,Gx(e)),a}function jx(e,{target:a,replace:r,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:f}={}){let b=_d(),h=Sa(),S=ll(e,{relative:c});return H.useCallback(E=>{if(yx(E,a)){E.preventDefault();let v=r!==void 0?r:Qi(h)===Qi(S),x=()=>b(e,{replace:v,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:p,unstable_defaultShouldRevalidate:m});f?H.startTransition(()=>x()):x()}},[h,b,S,r,l,s,a,e,u,c,p,m,f])}var Hx=0,$x=()=>`__${String(++Hx)}__`;function Px(){let{router:e}=kT("useSubmit"),{basename:a}=H.useContext(sn),r=sx(),l=e.fetch,s=e.navigate;return H.useCallback(async(u,c={})=>{let{action:p,method:m,encType:f,formData:b,body:h}=vx(u,a);if(c.navigate===!1){let S=c.fetcherKey||$x();await l(S,r,c.action||p,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||m,formEncType:c.encType||f,flushSync:c.flushSync})}else await s(c.action||p,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||m,formEncType:c.encType||f,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[l,s,a,r])}function qx(e,{relative:a}={}){let{basename:r}=H.useContext(sn),l=H.useContext(Tn);Ke(l,"useFormAction must be used inside a RouteContext");let[s]=l.matches.slice(-1),u={...ll(e||".",{relative:a})},c=Sa();if(e==null){u.search=c.search;let p=new URLSearchParams(u.search),m=p.getAll("index");if(m.some(b=>b==="")){p.delete("index"),m.filter(h=>h).forEach(h=>p.append("index",h));let b=p.toString();u.search=b?`?${b}`:""}}return(!e||e===".")&&s.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:Sn([r,u.pathname])),Qi(u)}function Vx(e,{relative:a}={}){let r=H.useContext(mT);Ke(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=kT("useViewTransitionState"),s=ll(e,{relative:a});if(!r.isTransitioning)return!1;let u=qn(r.currentLocation.pathname,l)||r.currentLocation.pathname,c=qn(r.nextLocation.pathname,l)||r.nextLocation.pathname;return Yo(s.pathname,c)!=null||Yo(s.pathname,u)!=null}const lv=e=>{let a;const r=new Set,l=(f,b)=>{const h=typeof f=="function"?f(a):f;if(!Object.is(h,a)){const S=a;a=b??(typeof h!="object"||h===null)?h:Object.assign({},a,h),r.forEach(E=>E(a,S))}},s=()=>a,p={setState:l,getState:s,getInitialState:()=>m,subscribe:f=>(r.add(f),()=>r.delete(f))},m=a=e(l,s,p);return p},Yx=(e=>e?lv(e):lv),Wx=e=>e;function Xx(e,a=Wx){const r=ln.useSyncExternalStore(e.subscribe,ln.useCallback(()=>a(e.getState()),[e,a]),ln.useCallback(()=>a(e.getInitialState()),[e,a]));return ln.useDebugValue(r),r}const ov=e=>{const a=Yx(e),r=l=>Xx(a,l);return Object.assign(r,a),r},Zx=(e=>e?ov(e):ov),on=Zx((e,a)=>({ws:null,connected:!1,viewMode:"preview",pickerEnabled:!1,selectedComponent:null,userDevPort:null,appProxyPort:null,iframeUrl:"/",messages:[],isProcessing:!1,chatCollapsed:!1,rightPanelCollapsed:!1,stashes:new Map,selectedStashIds:new Set,activeStashId:null,stashServerReady:!1,previewPort:null,previewPorts:new Map,projectId:null,projectName:null,chats:[],currentChatId:null,connect(){const r=`ws://${window.location.host}`,l=new WebSocket(r);l.onopen=()=>e({connected:!0}),l.onclose=()=>e({connected:!1,ws:null}),l.onmessage=s=>{const u=JSON.parse(s.data);switch(u.type){case"server_ready":e({userDevPort:u.port,appProxyPort:u.appProxyPort,projectId:u.projectId,projectName:u.projectName});break;case"processing":u.chatId===a().currentChatId&&e({isProcessing:!0});break;case"stash:status":e(c=>{const p=new Map(c.stashes),m=p.get(u.stashId);m?p.set(u.stashId,{...m,status:u.status,originChatId:m.originChatId||c.currentChatId||void 0}):p.set(u.stashId,{id:u.stashId,number:u.number??p.size+1,projectId:c.projectId??"",originChatId:c.currentChatId??void 0,prompt:"",branch:"",worktreePath:"",port:null,screenshotUrl:null,screenshots:[],status:u.status,error:null,relatedTo:[],createdAt:new Date().toISOString()});const f=c.viewMode==="preview"?"grid":c.viewMode;return{stashes:p,viewMode:f}});break;case"stash:screenshot":e(c=>{const p=new Map(c.stashes),m=p.get(u.stashId);return m&&p.set(u.stashId,{...m,screenshotUrl:u.url,screenshots:"screenshots"in u&&u.screenshots?u.screenshots:m.screenshots}),{stashes:p}});break;case"stash:port":e(c=>{const p=new Map(c.previewPorts);p.set(u.stashId,u.port);const m=c.activeStashId===u.stashId;return{previewPorts:p,previewPort:m?u.port:c.previewPort,...m?{stashServerReady:!0}:{}}});break;case"stash:preview_stopped":e(c=>{const p=new Map(c.previewPorts);return p.delete(u.stashId),{previewPorts:p}});break;case"stash:error":e(c=>{const p=new Map(c.stashes),m=p.get(u.stashId);return m&&p.set(u.stashId,{...m,status:"error",error:u.error}),{stashes:p}});break;case"ai_stream":u.source==="chat"&&e({isProcessing:!1}),a().addMessage({role:u.source==="system"?"system":"assistant",content:u.content,type:u.streamType,toolName:u.toolName,toolParams:u.toolParams,toolStatus:u.toolStatus,toolResult:u.toolResult});break;case"stash:applied":a().addMessage({role:"system",content:"Stash applied and merged into your project. Refresh your app to see changes.",type:"text"}),e({viewMode:"preview",stashes:new Map,selectedStashIds:new Set,activeStashId:null,previewPorts:new Map,previewPort:null,stashServerReady:!1});break}},e({ws:l})},disconnect(){var r;(r=a().ws)==null||r.close(),e({ws:null,connected:!1})},send(r){var l;(l=a().ws)==null||l.send(JSON.stringify(r))},selectComponent(r){const l=a().selectedComponent;l&&l.domSelector===r.domSelector||(e({selectedComponent:r}),a().send({type:"select_component",component:r}))},clearComponent(){e({selectedComponent:null})},setViewMode(r){e({viewMode:r})},togglePicker(){var s;const r=!a().pickerEnabled;e({pickerEnabled:r});const l=document.querySelector('iframe[title="App Preview"], iframe[title="Stash Preview"]');(s=l==null?void 0:l.contentWindow)==null||s.postMessage({type:"stashes:toggle_picker",enabled:r},"*")},setIframeUrl(r){e({iframeUrl:r})},addMessage(r){e(l=>({messages:[...l.messages,{...r,id:crypto.randomUUID(),createdAt:new Date().toISOString()}]}))},async loadChats(){try{const r=await fetch("/api/chats"),{data:l}=await r.json(),s=new Map;for(const u of l.stashes??[])s.set(u.id,u);e({projectId:l.project.id,projectName:l.project.name,chats:l.chats??[],stashes:s})}catch{}},async loadChat(r){try{const l=await fetch(`/api/chats/${r}`),{data:s}=await l.json(),u=new Map(a().stashes),c=s.stashes??[];for(const m of c)u.set(m.id,m);const p=c.length>0;e({currentChatId:r,messages:s.messages??[],stashes:u,viewMode:p?"grid":"preview",selectedStashIds:new Set,activeStashId:null})}catch{}},async newChat(){const r=await fetch("/api/chats",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({})}),{data:l}=await r.json();return e(s=>({chats:[l,...s.chats],currentChatId:l.id,messages:[],viewMode:"preview",selectedStashIds:new Set,activeStashId:null})),l.id},async deleteChat(r){try{await fetch(`/api/chats/${r}`,{method:"DELETE"}),e(l=>({chats:l.chats.filter(s=>s.id!==r),stashes:new Map([...l.stashes].filter(([,s])=>s.originChatId!==r))}))}catch{}},sendMessage(r){const l=a().projectId,s=a().currentChatId;if(!l||!s)return;const u=[...a().selectedStashIds],c=a().selectedComponent,p=c?{name:c.name,sourceStashId:void 0}:void 0;e({isProcessing:!0}),a().addMessage({role:"user",content:r,type:"text",referenceStashIds:u.length>0?u:void 0,componentContext:p}),a().send({type:"message",projectId:l,chatId:s,message:r,...u.length>0?{referenceStashIds:u}:{},...p?{componentContext:p}:{}})},toggleChatCollapsed(){e(r=>({chatCollapsed:!r.chatCollapsed}))},toggleRightPanelCollapsed(){e(r=>({rightPanelCollapsed:!r.rightPanelCollapsed}))},toggleStashSelection(r){e(l=>{const s=new Set(l.selectedStashIds);return s.has(r)?s.delete(r):s.add(r),{selectedStashIds:s}})},clearStashSelection(){e({selectedStashIds:new Set})},interactStash(r){const l=a().previewPorts.get(r),s=[...a().stashes.values()].sort((u,c)=>u.createdAt.localeCompare(c.createdAt)).map(u=>u.id);e({activeStashId:r,viewMode:"interact",stashServerReady:!!l,previewPort:l??null}),a().send({type:"interact",stashId:r,sortedStashIds:s})},applyStash(r){a().send({type:"apply_stash",stashId:r})},deleteStash(r){a().send({type:"delete_stash",stashId:r}),e(l=>{const s=new Map(l.stashes);s.delete(r);const u=new Set(l.selectedStashIds);return u.delete(r),{stashes:s,selectedStashIds:u}})}}));function xT({title:e,message:a,confirmLabel:r="Delete",onConfirm:l,onCancel:s}){return N.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onClick:s,children:[N.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),N.jsxs("div",{className:"relative bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl p-5 max-w-sm w-full mx-4 shadow-xl",onClick:u=>u.stopPropagation(),style:{animation:"fadeIn 0.15s ease-out"},children:[N.jsx("h3",{className:"text-sm font-semibold mb-1.5",children:e}),N.jsx("p",{className:"text-xs text-[var(--stashes-text-muted)] mb-4 leading-relaxed",children:a}),N.jsxs("div",{className:"flex gap-2 justify-end",children:[N.jsx("button",{onClick:s,className:"px-3 py-1.5 text-xs font-medium text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] bg-[var(--stashes-bg)] border border-[var(--stashes-border)] rounded-lg transition-colors",children:"Cancel"}),N.jsx("button",{onClick:l,className:"px-3 py-1.5 text-xs font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors",children:r})]})]})]})}function Kx(){const e=_d(),{chats:a,stashes:r,projectName:l,loadChats:s,newChat:u,deleteChat:c}=on(),[p,m]=H.useState(null),f=[...r.values()].filter(E=>E.status==="ready");H.useEffect(()=>{s()},[s]);async function b(){const E=await u();e(`/chat/${E}`)}async function h(E){const v=await u(),x=on.getState();x.toggleStashSelection(E.id),x.interactStash(E.id),e(`/chat/${v}`)}function S(E){const v=new Date(E),_=new Date().getTime()-v.getTime(),w=Math.floor(_/6e4);if(w<1)return"just now";if(w<60)return`${w}m ago`;const C=Math.floor(w/60);if(C<24)return`${C}h ago`;const I=Math.floor(C/24);return I<7?`${I}d ago`:v.toLocaleDateString()}return N.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[N.jsxs("div",{className:"max-w-5xl mx-auto",children:[N.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[N.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:l??"Stashes"}),N.jsx("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:"Design explorations for your app"})]}),N.jsx("div",{onClick:b,className:"mb-8 border-2 border-dashed border-[var(--stashes-border)] rounded-xl cursor-pointer hover:border-[var(--stashes-primary)] hover:bg-[var(--stashes-primary-dim)] transition-all duration-200 flex items-center justify-center py-5 group",style:{animation:"slideUp 0.4s ease-out both"},children:N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx("span",{className:"w-6 h-6 rounded-full border-2 border-[var(--stashes-border)] group-hover:border-[var(--stashes-primary)] flex items-center justify-center transition-colors",children:N.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),N.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),f.length>0&&N.jsxs("div",{className:"mb-10",style:{animation:"fadeIn 0.5s ease-out 0.1s both"},children:[N.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider mb-4",children:["Stashes (",f.length,")"]}),N.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:f.map((E,v)=>N.jsxs("div",{onClick:()=>h(E),className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl overflow-hidden cursor-pointer transition-all duration-200 hover:border-[var(--stashes-border-hover)] hover:-translate-y-0.5 stash-shadow group",style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${v*40}ms`},children:[N.jsx("div",{className:"aspect-video bg-[var(--stashes-bg)] relative overflow-hidden",children:E.screenshotUrl?N.jsx("img",{src:E.screenshotUrl,alt:"",className:"w-full h-full object-cover object-top transition-transform duration-300 group-hover:scale-[1.02]"}):N.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-[var(--stashes-text-muted)]",children:"No preview"})}),N.jsx("div",{className:"p-2.5",children:N.jsxs("p",{className:"text-[11px] text-[var(--stashes-text-muted)] line-clamp-2 leading-relaxed",children:[N.jsxs("span",{className:"font-semibold text-[var(--stashes-text)]",children:["#",E.number]})," ",E.prompt]})})]},E.id))})]}),a.length>0&&N.jsxs("div",{style:{animation:"fadeIn 0.5s ease-out 0.2s both"},children:[N.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider mb-4",children:["Conversations (",a.length,")"]}),N.jsx("div",{className:"space-y-2",children:a.map((E,v)=>N.jsxs("div",{onClick:()=>e(`/chat/${E.id}`),className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:border-[var(--stashes-border-hover)] hover:-translate-y-0.5 stash-shadow group flex items-center justify-between",style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${v*40}ms`},children:[N.jsx("div",{className:"min-w-0 flex-1",children:N.jsx("div",{className:"font-semibold text-sm truncate",children:E.title})}),N.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[N.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:S(E.updatedAt)}),N.jsx("button",{onClick:x=>{x.stopPropagation(),m(E.id)},className:"opacity-0 group-hover:opacity-100 text-[var(--stashes-text-muted)] hover:text-red-400 transition-all p-1 rounded",title:"Delete chat",children:N.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:N.jsx("path",{d:"M2 3H10M4 3V2H8V3M5 5V9M7 5V9M3 3V10.5C3 10.776 3.224 11 3.5 11H8.5C8.776 11 9 10.776 9 10.5V3",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]},E.id))})]})]}),p&&N.jsx(xT,{title:"Delete conversation",message:"This will permanently delete this conversation and its messages. Stashes created in this conversation will remain.",onConfirm:()=>{c(p),m(null)},onCancel:()=>m(null)})]})}function sv(e){const a=[],r=String(e||"");let l=r.indexOf(","),s=0,u=!1;for(;!u;){l===-1&&(l=r.length,u=!0);const c=r.slice(s,l).trim();(c||!u)&&a.push(c),s=l+1,l=r.indexOf(",",s)}return a}function Qx(e,a){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Jx=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tR={};function uv(e,a){return(tR.jsx?eR:Jx).test(e)}const nR=/[ \t\n\f\r]/g;function aR(e){return typeof e=="object"?e.type==="text"?cv(e.value):!1:cv(e)}function cv(e){return e.replace(nR,"")===""}class ol{constructor(a,r,l){this.normal=r,this.property=a,l&&(this.space=l)}}ol.prototype.normal={};ol.prototype.property={};ol.prototype.space=void 0;function RT(e,a){const r={},l={};for(const s of e)Object.assign(r,s.property),Object.assign(l,s.normal);return new ol(r,l,a)}function Ji(e){return e.toLowerCase()}class Bt{constructor(a,r){this.attribute=r,this.property=a}}Bt.prototype.attribute="";Bt.prototype.booleanish=!1;Bt.prototype.boolean=!1;Bt.prototype.commaOrSpaceSeparated=!1;Bt.prototype.commaSeparated=!1;Bt.prototype.defined=!1;Bt.prototype.mustUseProperty=!1;Bt.prototype.number=!1;Bt.prototype.overloadedBoolean=!1;Bt.prototype.property="";Bt.prototype.spaceSeparated=!1;Bt.prototype.space=void 0;let rR=0;const Te=Ha(),lt=Ha(),ld=Ha(),ne=Ha(),Ye=Ha(),Ur=Ha(),Vt=Ha();function Ha(){return 2**++rR}const od=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:lt,commaOrSpaceSeparated:Vt,commaSeparated:Ur,number:ne,overloadedBoolean:ld,spaceSeparated:Ye},Symbol.toStringTag,{value:"Module"})),zc=Object.keys(od);class Cd extends Bt{constructor(a,r,l,s){let u=-1;if(super(a,r),dv(this,"space",s),typeof l=="number")for(;++u<zc.length;){const c=zc[u];dv(this,zc[u],(l&od[c])===od[c])}}}Cd.prototype.defined=!0;function dv(e,a,r){r&&(e[a]=r)}function Gr(e){const a={},r={};for(const[l,s]of Object.entries(e.properties)){const u=new Cd(l,e.transform(e.attributes||{},l),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),a[l]=u,r[Ji(l)]=l,r[Ji(u.attribute)]=l}return new ol(a,r,e.space)}const NT=Gr({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:ne,ariaColIndex:ne,ariaColSpan:ne,ariaControls:Ye,ariaCurrent:null,ariaDescribedBy:Ye,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ye,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ye,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ye,ariaLevel:ne,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ye,ariaPlaceholder:null,ariaPosInSet:ne,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ye,ariaRowCount:ne,ariaRowIndex:ne,ariaRowSpan:ne,ariaSelected:lt,ariaSetSize:ne,ariaSort:null,ariaValueMax:ne,ariaValueMin:ne,ariaValueNow:ne,ariaValueText:null,role:null},transform(e,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function CT(e,a){return a in e?e[a]:a}function IT(e,a){return CT(e,a.toLowerCase())}const iR=Gr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ur,acceptCharset:Ye,accessKey:Ye,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:Ye,autoFocus:Te,autoPlay:Te,blocking:Ye,capture:null,charSet:null,checked:Te,cite:null,className:Ye,cols:ne,colSpan:null,content:null,contentEditable:lt,controls:Te,controlsList:Ye,coords:ne|Ur,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:ld,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:Ye,height:ne,hidden:ld,high:ne,href:null,hrefLang:null,htmlFor:Ye,httpEquiv:Ye,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:Ye,itemRef:Ye,itemScope:Te,itemType:Ye,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:ne,manifest:null,max:null,maxLength:ne,media:null,method:null,min:null,minLength:ne,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Te,optimum:ne,pattern:null,ping:Ye,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:Ye,required:Te,reversed:Te,rows:ne,rowSpan:ne,sandbox:Ye,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shape:null,size:ne,sizes:null,slot:null,span:ne,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ne,step:null,style:null,tabIndex:ne,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:lt,width:ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ye,axis:null,background:null,bgColor:null,border:ne,borderColor:null,bottomMargin:ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:ne,leftMargin:ne,link:null,longDesc:null,lowSrc:null,marginHeight:ne,marginWidth:ne,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:ne,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Te,disableRemotePlayback:Te,prefix:null,property:null,results:ne,security:null,unselectable:null},space:"html",transform:IT}),lR=Gr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vt,accentHeight:ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ne,amplitude:ne,arabicForm:null,ascent:ne,attributeName:null,attributeType:null,azimuth:ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ne,by:null,calcMode:null,capHeight:ne,className:Ye,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ne,diffuseConstant:ne,direction:null,display:null,dur:null,divisor:ne,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:ne,enableBackground:null,end:null,event:null,exponent:ne,externalResourcesRequired:null,fill:null,fillOpacity:ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ur,g2:Ur,glyphName:Ur,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ne,horizOriginX:ne,horizOriginY:ne,id:null,ideographic:ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ne,k:ne,k1:ne,k2:ne,k3:ne,k4:ne,kernelMatrix:Vt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ne,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ne,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ne,overlineThickness:ne,paintOrder:null,panose1:null,path:null,pathLength:ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ye,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ne,pointsAtY:ne,pointsAtZ:ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vt,rev:Vt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vt,requiredFeatures:Vt,requiredFonts:Vt,requiredFormats:Vt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ne,specularExponent:ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ne,strikethroughThickness:ne,string:null,stroke:null,strokeDashArray:Vt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ne,strokeOpacity:ne,strokeWidth:null,style:null,surfaceScale:ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vt,tabIndex:ne,tableValues:null,target:null,targetX:ne,targetY:ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ne,underlineThickness:ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ne,values:null,vAlphabetic:ne,vMathematical:ne,vectorEffect:null,vHanging:ne,vIdeographic:ne,version:null,vertAdvY:ne,vertOriginX:ne,vertOriginY:ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:CT}),OT=Gr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,a){return"xlink:"+a.slice(5).toLowerCase()}}),LT=Gr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:IT}),DT=Gr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,a){return"xml:"+a.slice(3).toLowerCase()}}),oR={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"},sR=/[A-Z]/g,pv=/-[a-z]/g,uR=/^data[-\w.:]+$/i;function MT(e,a){const r=Ji(a);let l=a,s=Bt;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&uR.test(a)){if(a.charAt(4)==="-"){const u=a.slice(5).replace(pv,dR);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=a.slice(4);if(!pv.test(u)){let c=u.replace(sR,cR);c.charAt(0)!=="-"&&(c="-"+c),a="data"+c}}s=Cd}return new s(l,a)}function cR(e){return"-"+e.toLowerCase()}function dR(e){return e.charAt(1).toUpperCase()}const UT=RT([NT,iR,OT,LT,DT],"html"),es=RT([NT,lR,OT,LT,DT],"svg");function fv(e){const a=String(e||"").trim();return a?a.split(/[ \t\n\r\f]+/g):[]}function pR(e){return e.join(" ").trim()}var Or={},Gc,gv;function fR(){if(gv)return Gc;gv=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,p=/^\s+|\s+$/g,m=`
60
+ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let b=Sa(),h;if(a){let w=typeof a=="string"?Fr(a):a;Ke(m==="/"||((_=w.pathname)==null?void 0:_.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${w.pathname}" was given in the \`location\` prop.`),h=w}else h=b;let S=h.pathname||"/",E=S;if(m!=="/"){let w=m.replace(/^\//,"").split("/");E="/"+S.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=sT(e,{pathname:E});vn(f||v!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),vn(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=rx(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:Sn([m,l.encodeLocation?l.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?m:Sn([m,l.encodeLocation?l.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),s,r);return a&&x?H.createElement(rl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},x):x}function ex(){let e=ux(),a=Gk(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,l="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=H.createElement(H.Fragment,null,H.createElement("p",null,"💿 Hey developer 👋"),H.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",H.createElement("code",{style:u},"ErrorBoundary")," or"," ",H.createElement("code",{style:u},"errorElement")," prop on your route.")),H.createElement(H.Fragment,null,H.createElement("h2",null,"Unexpected Application Error!"),H.createElement("h3",{style:{fontStyle:"italic"}},a),r?H.createElement("pre",{style:s},r):null,c)}var tx=H.createElement(ex,null),ST=class extends H.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,a){return a.location!==e.location||a.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){this.props.onError?this.props.onError(e,a):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=Xk(e.digest);r&&(e=r)}let a=e!==void 0?H.createElement(Tn.Provider,{value:this.props.routeContext},H.createElement(wd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?H.createElement(nx,{error:e},a):a}};ST.contextType=$k;var Bc=new WeakMap;function nx({children:e,error:a}){let{basename:r}=H.useContext(sn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let l=Wk(a.digest);if(l){let s=Bc.get(a);if(s)throw s;let u=fT(l.location,r);if(pT&&!Bc.get(a))if(u.isExternal||l.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:l.replace}));throw Bc.set(a,c),c}return H.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function ax({routeContext:e,match:a,children:r}){let l=H.useContext(zr);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),H.createElement(Tn.Provider,{value:e},r)}function rx(e,a=[],r){let l=r==null?void 0:r.state;if(e==null){if(!l)return null;if(l.errors)e=l.matches;else if(a.length===0&&!l.initialized&&l.matches.length>0)e=l.matches;else return null}let s=e,u=l==null?void 0:l.errors;if(u!=null){let b=s.findIndex(h=>h.route.id&&(u==null?void 0:u[h.route.id])!==void 0);Ke(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),s=s.slice(0,Math.min(s.length,b+1))}let c=!1,p=-1;if(r&&l){c=l.renderFallback;for(let b=0;b<s.length;b++){let h=s[b];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(p=b),h.route.id){let{loaderData:S,errors:E}=l,v=h.route.loader&&!S.hasOwnProperty(h.route.id)&&(!E||E[h.route.id]===void 0);if(h.route.lazy||v){r.isStatic&&(c=!0),p>=0?s=s.slice(0,p+1):s=[s[0]];break}}}}let m=r==null?void 0:r.onError,f=l&&m?(b,h)=>{var S,E;m(b,{location:l.location,params:((E=(S=l.matches)==null?void 0:S[0])==null?void 0:E.params)??{},unstable_pattern:jk(l.matches),errorInfo:h})}:void 0;return s.reduceRight((b,h,S)=>{let E,v=!1,x=null,_=null;l&&(E=u&&h.route.id?u[h.route.id]:void 0,x=h.route.errorElement||tx,c&&(p<0&&S===0?(vT("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,_=null):p===S&&(v=!0,_=h.route.hydrateFallbackElement||null)));let w=a.concat(s.slice(0,S+1)),C=()=>{let I;return E?I=x:v?I=_:h.route.Component?I=H.createElement(h.route.Component,null):h.route.element?I=h.route.element:I=b,H.createElement(ax,{match:h,routeContext:{outlet:b,matches:w,isDataRoute:l!=null},children:I})};return l&&(h.route.ErrorBoundary||h.route.errorElement||S===0)?H.createElement(ST,{location:l.location,revalidation:l.revalidation,component:x,error:E,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:f}):C()},null)}function kd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ix(e){let a=H.useContext(zr);return Ke(a,kd(e)),a}function lx(e){let a=H.useContext(Qo);return Ke(a,kd(e)),a}function ox(e){let a=H.useContext(Tn);return Ke(a,kd(e)),a}function xd(e){let a=ox(e),r=a.matches[a.matches.length-1];return Ke(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function sx(){return xd("useRouteId")}function ux(){var l;let e=H.useContext(wd),a=lx("useRouteError"),r=xd("useRouteError");return e!==void 0?e:(l=a.errors)==null?void 0:l[r]}function cx(){let{router:e}=ix("useNavigate"),a=xd("useNavigate"),r=H.useRef(!1);return yT(()=>{r.current=!0}),H.useCallback(async(s,u={})=>{vn(r.current,bT),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:a,...u}))},[e,a])}var rv={};function vT(e,a,r){!a&&!rv[e]&&(rv[e]=!0,vn(!1,r))}H.memo(dx);function dx({routes:e,future:a,state:r,isStatic:l,onError:s}){return ET(e,void 0,{state:r,isStatic:l,onError:s})}function rd(e){Ke(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function px({basename:e="/",children:a=null,location:r,navigationType:l="POP",navigator:s,static:u=!1,unstable_useTransitions:c}){Ke(!il(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=e.replace(/^\/*/,"/"),m=H.useMemo(()=>({basename:p,navigator:s,static:u,unstable_useTransitions:c,future:{}}),[p,s,u,c]);typeof r=="string"&&(r=Fr(r));let{pathname:f="/",search:b="",hash:h="",state:S=null,key:E="default",unstable_mask:v}=r,x=H.useMemo(()=>{let _=qn(f,p);return _==null?null:{location:{pathname:_,search:b,hash:h,state:S,key:E,unstable_mask:v},navigationType:l}},[p,f,b,h,S,E,l,v]);return vn(x!=null,`<Router basename="${p}"> is not able to match the URL "${f}${b}${h}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:H.createElement(sn.Provider,{value:m},H.createElement(rl.Provider,{children:a,value:x}))}function fx({children:e,location:a}){return Jk(id(e),a)}function id(e,a=[]){let r=[];return H.Children.forEach(e,(l,s)=>{if(!H.isValidElement(l))return;let u=[...a,s];if(l.type===H.Fragment){r.push.apply(r,id(l.props.children,u));return}Ke(l.type===rd,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ke(!l.props.index||!l.props.children,"An index route cannot have child routes.");let c={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(c.children=id(l.props.children,u)),r.push(c)}),r}var Ho="get",$o="application/x-www-form-urlencoded";function Jo(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function gx(e){return Jo(e)&&e.tagName.toLowerCase()==="button"}function mx(e){return Jo(e)&&e.tagName.toLowerCase()==="form"}function hx(e){return Jo(e)&&e.tagName.toLowerCase()==="input"}function bx(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yx(e,a){return e.button===0&&(!a||a==="_self")&&!bx(e)}var Uo=null;function Ex(){if(Uo===null)try{new FormData(document.createElement("form"),0),Uo=!1}catch{Uo=!0}return Uo}var Sx=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Fc(e){return e!=null&&!Sx.has(e)?(vn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${$o}"`),null):e}function vx(e,a){let r,l,s,u,c;if(mx(e)){let p=e.getAttribute("action");l=p?qn(p,a):null,r=e.getAttribute("method")||Ho,s=Fc(e.getAttribute("enctype"))||$o,u=new FormData(e)}else if(gx(e)||hx(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||p.getAttribute("action");if(l=m?qn(m,a):null,r=e.getAttribute("formmethod")||p.getAttribute("method")||Ho,s=Fc(e.getAttribute("formenctype"))||Fc(p.getAttribute("enctype"))||$o,u=new FormData(p,e),!Ex()){let{name:f,type:b,value:h}=e;if(b==="image"){let S=f?`${f}.`:"";u.append(`${S}x`,"0"),u.append(`${S}y`,"0")}else f&&u.append(f,h)}}else{if(Jo(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Ho,l=null,s=$o,c=e}return u&&s==="text/plain"&&(c=u,u=void 0),{action:l,method:r.toLowerCase(),encType:s,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rd(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function Tx(e,a,r,l){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${l}`:s.pathname=`${s.pathname}.${l}`:s.pathname==="/"?s.pathname=`_root.${l}`:a&&qn(s.pathname,a)==="/"?s.pathname=`${a.replace(/\/$/,"")}/_root.${l}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${l}`,s}async function Ax(e,a){if(e.id in a)return a[e.id];try{let r=await import(e.module);return a[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function wx(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function _x(e,a,r){let l=await Promise.all(e.map(async s=>{let u=a.routes[s.route.id];if(u){let c=await Ax(u,r);return c.links?c.links():[]}return[]}));return Nx(l.flat(1).filter(wx).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function iv(e,a,r,l,s,u){let c=(m,f)=>r[f]?m.route.id!==r[f].route.id:!0,p=(m,f)=>{var b;return r[f].pathname!==m.pathname||((b=r[f].route.path)==null?void 0:b.endsWith("*"))&&r[f].params["*"]!==m.params["*"]};return u==="assets"?a.filter((m,f)=>c(m,f)||p(m,f)):u==="data"?a.filter((m,f)=>{var h;let b=l.routes[m.route.id];if(!b||!b.hasLoader)return!1;if(c(m,f)||p(m,f))return!0;if(m.route.shouldRevalidate){let S=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=r[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof S=="boolean")return S}return!0}):[]}function kx(e,a,{includeHydrateFallback:r}={}){return xx(e.map(l=>{let s=a.routes[l.route.id];if(!s)return[];let u=[s.module];return s.clientActionModule&&(u=u.concat(s.clientActionModule)),s.clientLoaderModule&&(u=u.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(u=u.concat(s.hydrateFallbackModule)),s.imports&&(u=u.concat(s.imports)),u}).flat(1))}function xx(e){return[...new Set(e)]}function Rx(e){let a={},r=Object.keys(e).sort();for(let l of r)a[l]=e[l];return a}function Nx(e,a){let r=new Set;return new Set(a),e.reduce((l,s)=>{let u=JSON.stringify(Rx(s));return r.has(u)||(r.add(u),l.push({key:u,link:s})),l},[])}function TT(){let e=H.useContext(zr);return Rd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Cx(){let e=H.useContext(Qo);return Rd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Nd=H.createContext(void 0);Nd.displayName="FrameworkContext";function AT(){let e=H.useContext(Nd);return Rd(e,"You must render this element inside a <HydratedRouter> element"),e}function Ix(e,a){let r=H.useContext(Nd),[l,s]=H.useState(!1),[u,c]=H.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:f,onMouseLeave:b,onTouchStart:h}=a,S=H.useRef(null);H.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let x=w=>{w.forEach(C=>{c(C.isIntersecting)})},_=new IntersectionObserver(x,{threshold:.5});return S.current&&_.observe(S.current),()=>{_.disconnect()}}},[e]),H.useEffect(()=>{if(l){let x=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(x)}}},[l]);let E=()=>{s(!0)},v=()=>{s(!1),c(!1)};return r?e!=="intent"?[u,S,{}]:[u,S,{onFocus:$i(p,E),onBlur:$i(m,v),onMouseEnter:$i(f,E),onMouseLeave:$i(b,v),onTouchStart:$i(h,E)}]:[!1,S,{}]}function $i(e,a){return r=>{e&&e(r),r.defaultPrevented||a(r)}}function Ox({page:e,...a}){let{router:r}=TT(),l=H.useMemo(()=>sT(r.routes,e,r.basename),[r.routes,e,r.basename]);return l?H.createElement(Dx,{page:e,matches:l,...a}):null}function Lx(e){let{manifest:a,routeModules:r}=AT(),[l,s]=H.useState([]);return H.useEffect(()=>{let u=!1;return _x(e,a,r).then(c=>{u||s(c)}),()=>{u=!0}},[e,a,r]),l}function Dx({page:e,matches:a,...r}){let l=Sa(),{future:s,manifest:u,routeModules:c}=AT(),{basename:p}=TT(),{loaderData:m,matches:f}=Cx(),b=H.useMemo(()=>iv(e,a,f,u,l,"data"),[e,a,f,u,l]),h=H.useMemo(()=>iv(e,a,f,u,l,"assets"),[e,a,f,u,l]),S=H.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let x=new Set,_=!1;if(a.forEach(C=>{var P;let I=u.routes[C.route.id];!I||!I.hasLoader||(!b.some(V=>V.route.id===C.route.id)&&C.route.id in m&&((P=c[C.route.id])!=null&&P.shouldRevalidate)||I.hasClientLoader?_=!0:x.add(C.route.id))}),x.size===0)return[];let w=Tx(e,p,s.unstable_trailingSlashAwareDataRequests,"data");return _&&x.size>0&&w.searchParams.set("_routes",a.filter(C=>x.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[p,s.unstable_trailingSlashAwareDataRequests,m,l,u,b,a,e,c]),E=H.useMemo(()=>kx(h,u),[h,u]),v=Lx(h);return H.createElement(H.Fragment,null,S.map(x=>H.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...r})),E.map(x=>H.createElement("link",{key:x,rel:"modulepreload",href:x,...r})),v.map(({key:x,link:_})=>H.createElement("link",{key:x,nonce:r.nonce,..._,crossOrigin:_.crossOrigin??r.crossOrigin})))}function Mx(...e){return a=>{e.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}var Ux=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ux&&(window.__reactRouterVersion="7.13.2")}catch{}function Bx({basename:e,children:a,unstable_useTransitions:r,window:l}){let s=H.useRef();s.current==null&&(s.current=hk({window:l,v5Compat:!0}));let u=s.current,[c,p]=H.useState({action:u.action,location:u.location}),m=H.useCallback(f=>{r===!1?p(f):H.startTransition(()=>p(f))},[r]);return H.useLayoutEffect(()=>u.listen(m),[u,m]),H.createElement(px,{basename:e,children:a,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var wT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_T=H.forwardRef(function({onClick:a,discover:r="render",prefetch:l="none",relative:s,reloadDocument:u,replace:c,unstable_mask:p,state:m,target:f,to:b,preventScrollReset:h,viewTransition:S,unstable_defaultShouldRevalidate:E,...v},x){let{basename:_,navigator:w,unstable_useTransitions:C}=H.useContext(sn),I=typeof b=="string"&&wT.test(b),P=fT(b,_);b=P.to;let V=Zk(b,{relative:s}),M=Sa(),W=null;if(p){let J=Ad(p,[],M.unstable_mask?M.unstable_mask.pathname:"/",!0);_!=="/"&&(J.pathname=J.pathname==="/"?_:Sn([_,J.pathname])),W=w.createHref(J)}let[ae,oe,B]=Ix(l,v),te=jx(b,{replace:c,unstable_mask:p,state:m,target:f,preventScrollReset:h,relative:s,viewTransition:S,unstable_defaultShouldRevalidate:E,unstable_useTransitions:C});function ee(J){a&&a(J),J.defaultPrevented||te(J)}let ie=!(P.isExternal||u),re=H.createElement("a",{...v,...B,href:(ie?W:void 0)||P.absoluteURL||V,onClick:ie?ee:a,ref:Mx(x,oe),target:f,"data-discover":!I&&r==="render"?"true":void 0});return ae&&!I?H.createElement(H.Fragment,null,re,H.createElement(Ox,{page:V})):re});_T.displayName="Link";var Fx=H.forwardRef(function({"aria-current":a="page",caseSensitive:r=!1,className:l="",end:s=!1,style:u,to:c,viewTransition:p,children:m,...f},b){let h=ll(c,{relative:f.relative}),S=Sa(),E=H.useContext(Qo),{navigator:v,basename:x}=H.useContext(sn),_=E!=null&&Vx(h)&&p===!0,w=v.encodeLocation?v.encodeLocation(h).pathname:h.pathname,C=S.pathname,I=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;r||(C=C.toLowerCase(),I=I?I.toLowerCase():null,w=w.toLowerCase()),I&&x&&(I=qn(I,x)||I);const P=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let V=C===w||!s&&C.startsWith(w)&&C.charAt(P)==="/",M=I!=null&&(I===w||!s&&I.startsWith(w)&&I.charAt(w.length)==="/"),W={isActive:V,isPending:M,isTransitioning:_},ae=V?a:void 0,oe;typeof l=="function"?oe=l(W):oe=[l,V?"active":null,M?"pending":null,_?"transitioning":null].filter(Boolean).join(" ");let B=typeof u=="function"?u(W):u;return H.createElement(_T,{...f,"aria-current":ae,className:oe,ref:b,style:B,to:c,viewTransition:p},typeof m=="function"?m(W):m)});Fx.displayName="NavLink";var zx=H.forwardRef(({discover:e="render",fetcherKey:a,navigate:r,reloadDocument:l,replace:s,state:u,method:c=Ho,action:p,onSubmit:m,relative:f,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:S,...E},v)=>{let{unstable_useTransitions:x}=H.useContext(sn),_=Px(),w=qx(p,{relative:f}),C=c.toLowerCase()==="get"?"get":"post",I=typeof p=="string"&&wT.test(p),P=V=>{if(m&&m(V),V.defaultPrevented)return;V.preventDefault();let M=V.nativeEvent.submitter,W=(M==null?void 0:M.getAttribute("formmethod"))||c,ae=()=>_(M||V.currentTarget,{fetcherKey:a,method:W,navigate:r,replace:s,state:u,relative:f,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:S});x&&r!==!1?H.startTransition(()=>ae()):ae()};return H.createElement("form",{ref:v,method:C,action:w,onSubmit:l?m:P,...E,"data-discover":!I&&e==="render"?"true":void 0})});zx.displayName="Form";function Gx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kT(e){let a=H.useContext(zr);return Ke(a,Gx(e)),a}function jx(e,{target:a,replace:r,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:f}={}){let b=_d(),h=Sa(),S=ll(e,{relative:c});return H.useCallback(E=>{if(yx(E,a)){E.preventDefault();let v=r!==void 0?r:Qi(h)===Qi(S),x=()=>b(e,{replace:v,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:p,unstable_defaultShouldRevalidate:m});f?H.startTransition(()=>x()):x()}},[h,b,S,r,l,s,a,e,u,c,p,m,f])}var Hx=0,$x=()=>`__${String(++Hx)}__`;function Px(){let{router:e}=kT("useSubmit"),{basename:a}=H.useContext(sn),r=sx(),l=e.fetch,s=e.navigate;return H.useCallback(async(u,c={})=>{let{action:p,method:m,encType:f,formData:b,body:h}=vx(u,a);if(c.navigate===!1){let S=c.fetcherKey||$x();await l(S,r,c.action||p,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||m,formEncType:c.encType||f,flushSync:c.flushSync})}else await s(c.action||p,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||m,formEncType:c.encType||f,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[l,s,a,r])}function qx(e,{relative:a}={}){let{basename:r}=H.useContext(sn),l=H.useContext(Tn);Ke(l,"useFormAction must be used inside a RouteContext");let[s]=l.matches.slice(-1),u={...ll(e||".",{relative:a})},c=Sa();if(e==null){u.search=c.search;let p=new URLSearchParams(u.search),m=p.getAll("index");if(m.some(b=>b==="")){p.delete("index"),m.filter(h=>h).forEach(h=>p.append("index",h));let b=p.toString();u.search=b?`?${b}`:""}}return(!e||e===".")&&s.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:Sn([r,u.pathname])),Qi(u)}function Vx(e,{relative:a}={}){let r=H.useContext(mT);Ke(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=kT("useViewTransitionState"),s=ll(e,{relative:a});if(!r.isTransitioning)return!1;let u=qn(r.currentLocation.pathname,l)||r.currentLocation.pathname,c=qn(r.nextLocation.pathname,l)||r.nextLocation.pathname;return Yo(s.pathname,c)!=null||Yo(s.pathname,u)!=null}const lv=e=>{let a;const r=new Set,l=(f,b)=>{const h=typeof f=="function"?f(a):f;if(!Object.is(h,a)){const S=a;a=b??(typeof h!="object"||h===null)?h:Object.assign({},a,h),r.forEach(E=>E(a,S))}},s=()=>a,p={setState:l,getState:s,getInitialState:()=>m,subscribe:f=>(r.add(f),()=>r.delete(f))},m=a=e(l,s,p);return p},Yx=(e=>e?lv(e):lv),Wx=e=>e;function Xx(e,a=Wx){const r=ln.useSyncExternalStore(e.subscribe,ln.useCallback(()=>a(e.getState()),[e,a]),ln.useCallback(()=>a(e.getInitialState()),[e,a]));return ln.useDebugValue(r),r}const ov=e=>{const a=Yx(e),r=l=>Xx(a,l);return Object.assign(r,a),r},Zx=(e=>e?ov(e):ov),on=Zx((e,a)=>({ws:null,connected:!1,viewMode:"preview",pickerEnabled:!1,selectedComponent:null,userDevPort:null,appProxyPort:null,iframeUrl:"/",messages:[],isProcessing:!1,chatCollapsed:!1,rightPanelCollapsed:!1,stashes:new Map,selectedStashIds:new Set,activeStashId:null,stashServerReady:!1,previewPort:null,previewPorts:new Map,projectId:null,projectName:null,chats:[],currentChatId:null,connect(){const r=`ws://${window.location.host}`,l=new WebSocket(r);l.onopen=()=>e({connected:!0}),l.onclose=()=>e({connected:!1,ws:null}),l.onmessage=s=>{const u=JSON.parse(s.data);switch(u.type){case"server_ready":e({userDevPort:u.port,appProxyPort:u.appProxyPort,projectId:u.projectId,projectName:u.projectName});break;case"processing":u.chatId===a().currentChatId&&e({isProcessing:!0});break;case"stash:status":e(c=>{const p=new Map(c.stashes),m=p.get(u.stashId);m?p.set(u.stashId,{...m,status:u.status,originChatId:m.originChatId||c.currentChatId||void 0}):p.set(u.stashId,{id:u.stashId,number:u.number??p.size+1,projectId:c.projectId??"",originChatId:c.currentChatId??void 0,prompt:"",branch:"",worktreePath:"",port:null,screenshotUrl:null,screenshots:[],status:u.status,error:null,relatedTo:[],createdAt:new Date().toISOString()});const f=c.viewMode==="preview"?"grid":c.viewMode;return{stashes:p,viewMode:f}});break;case"stash:screenshot":e(c=>{const p=new Map(c.stashes),m=p.get(u.stashId);return m&&p.set(u.stashId,{...m,screenshotUrl:u.url,screenshots:"screenshots"in u&&u.screenshots?u.screenshots:m.screenshots}),{stashes:p}});break;case"stash:port":e(c=>{const p=new Map(c.previewPorts);p.set(u.stashId,u.port);const m=c.activeStashId===u.stashId;return{previewPorts:p,previewPort:m?u.port:c.previewPort,...m?{stashServerReady:!0}:{}}});break;case"stash:preview_stopped":e(c=>{const p=new Map(c.previewPorts);return p.delete(u.stashId),{previewPorts:p}});break;case"stash:error":e(c=>{const p=new Map(c.stashes),m=p.get(u.stashId);return m&&p.set(u.stashId,{...m,status:"error",error:u.error}),{stashes:p}});break;case"ai_stream":u.source==="chat"&&e({isProcessing:!1}),a().addMessage({role:u.source==="system"?"system":"assistant",content:u.content,type:u.streamType,toolName:u.toolName,toolParams:u.toolParams,toolStatus:u.toolStatus,toolResult:u.toolResult});break;case"stash:applied":a().addMessage({role:"system",content:"Stash applied and merged into your project. Refresh your app to see changes.",type:"text"}),e({viewMode:"preview",stashes:new Map,selectedStashIds:new Set,activeStashId:null,previewPorts:new Map,previewPort:null,stashServerReady:!1});break}},e({ws:l})},disconnect(){var r;(r=a().ws)==null||r.close(),e({ws:null,connected:!1})},send(r){var l;(l=a().ws)==null||l.send(JSON.stringify(r))},selectComponent(r){const l=a().selectedComponent;l&&l.domSelector===r.domSelector||(e({selectedComponent:r}),a().send({type:"select_component",component:r}))},clearComponent(){e({selectedComponent:null})},setViewMode(r){e({viewMode:r})},togglePicker(){var s;const r=!a().pickerEnabled;e({pickerEnabled:r});const l=document.querySelector('iframe[title="App Preview"], iframe[title="Stash Preview"]');(s=l==null?void 0:l.contentWindow)==null||s.postMessage({type:"stashes:toggle_picker",enabled:r},"*")},setIframeUrl(r){e({iframeUrl:r})},addMessage(r){e(l=>({messages:[...l.messages,{...r,id:crypto.randomUUID(),createdAt:new Date().toISOString()}]}))},async loadChats(){try{const r=await fetch("/api/chats"),{data:l}=await r.json(),s=new Map;for(const u of l.stashes??[])s.set(u.id,u);e({projectId:l.project.id,projectName:l.project.name,chats:l.chats??[],stashes:s})}catch{}},async loadChat(r){try{const l=await fetch(`/api/chats/${r}`),{data:s}=await l.json(),u=new Map(a().stashes),c=s.stashes??[];for(const f of c)u.set(f.id,f);const p=c.length>0,m=a().currentChatId===r;e({currentChatId:r,messages:s.messages??[],stashes:u,viewMode:m?a().viewMode:p?"grid":"preview",selectedStashIds:m?a().selectedStashIds:new Set,activeStashId:m?a().activeStashId:null})}catch{}},async newChat(){const r=await fetch("/api/chats",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({})}),{data:l}=await r.json();return e(s=>({chats:[l,...s.chats],currentChatId:l.id,messages:[],viewMode:"preview",selectedStashIds:new Set,activeStashId:null})),l.id},async deleteChat(r){try{await fetch(`/api/chats/${r}`,{method:"DELETE"}),e(l=>({chats:l.chats.filter(s=>s.id!==r),stashes:new Map([...l.stashes].filter(([,s])=>s.originChatId!==r))}))}catch{}},sendMessage(r){const l=a().projectId,s=a().currentChatId;if(!l||!s)return;const u=[...a().selectedStashIds],c=a().selectedComponent,p=c?{name:c.name,sourceStashId:void 0}:void 0;e({isProcessing:!0}),a().addMessage({role:"user",content:r,type:"text",referenceStashIds:u.length>0?u:void 0,componentContext:p}),a().send({type:"message",projectId:l,chatId:s,message:r,...u.length>0?{referenceStashIds:u}:{},...p?{componentContext:p}:{}})},toggleChatCollapsed(){e(r=>({chatCollapsed:!r.chatCollapsed}))},toggleRightPanelCollapsed(){e(r=>({rightPanelCollapsed:!r.rightPanelCollapsed}))},toggleStashSelection(r){e(l=>{const s=new Set(l.selectedStashIds);return s.has(r)?s.delete(r):s.add(r),{selectedStashIds:s}})},clearStashSelection(){e({selectedStashIds:new Set})},interactStash(r){const l=a().previewPorts.get(r),s=[...a().stashes.values()].sort((u,c)=>u.createdAt.localeCompare(c.createdAt)).map(u=>u.id);e({activeStashId:r,viewMode:"interact",stashServerReady:!!l,previewPort:l??null}),a().send({type:"interact",stashId:r,sortedStashIds:s})},applyStash(r){a().send({type:"apply_stash",stashId:r})},deleteStash(r){a().send({type:"delete_stash",stashId:r}),e(l=>{const s=new Map(l.stashes);s.delete(r);const u=new Set(l.selectedStashIds);return u.delete(r),{stashes:s,selectedStashIds:u}})}}));function xT({title:e,message:a,confirmLabel:r="Delete",onConfirm:l,onCancel:s}){return N.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onClick:s,children:[N.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),N.jsxs("div",{className:"relative bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl p-5 max-w-sm w-full mx-4 shadow-xl",onClick:u=>u.stopPropagation(),style:{animation:"fadeIn 0.15s ease-out"},children:[N.jsx("h3",{className:"text-sm font-semibold mb-1.5",children:e}),N.jsx("p",{className:"text-xs text-[var(--stashes-text-muted)] mb-4 leading-relaxed",children:a}),N.jsxs("div",{className:"flex gap-2 justify-end",children:[N.jsx("button",{onClick:s,className:"px-3 py-1.5 text-xs font-medium text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] bg-[var(--stashes-bg)] border border-[var(--stashes-border)] rounded-lg transition-colors",children:"Cancel"}),N.jsx("button",{onClick:l,className:"px-3 py-1.5 text-xs font-medium text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors",children:r})]})]})]})}function Kx(){const e=_d(),{chats:a,stashes:r,projectName:l,loadChats:s,newChat:u,deleteChat:c}=on(),[p,m]=H.useState(null),f=[...r.values()].filter(E=>E.status==="ready");H.useEffect(()=>{s()},[s]);async function b(){const E=await u();e(`/chat/${E}`)}async function h(E){const v=await u(),x=on.getState();x.toggleStashSelection(E.id),x.interactStash(E.id),e(`/chat/${v}`)}function S(E){const v=new Date(E),_=new Date().getTime()-v.getTime(),w=Math.floor(_/6e4);if(w<1)return"just now";if(w<60)return`${w}m ago`;const C=Math.floor(w/60);if(C<24)return`${C}h ago`;const I=Math.floor(C/24);return I<7?`${I}d ago`:v.toLocaleDateString()}return N.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[N.jsxs("div",{className:"max-w-5xl mx-auto",children:[N.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[N.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:l??"Stashes"}),N.jsx("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:"Design explorations for your app"})]}),N.jsx("div",{onClick:b,className:"mb-8 border-2 border-dashed border-[var(--stashes-border)] rounded-xl cursor-pointer hover:border-[var(--stashes-primary)] hover:bg-[var(--stashes-primary-dim)] transition-all duration-200 flex items-center justify-center py-5 group",style:{animation:"slideUp 0.4s ease-out both"},children:N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx("span",{className:"w-6 h-6 rounded-full border-2 border-[var(--stashes-border)] group-hover:border-[var(--stashes-primary)] flex items-center justify-center transition-colors",children:N.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),N.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),f.length>0&&N.jsxs("div",{className:"mb-10",style:{animation:"fadeIn 0.5s ease-out 0.1s both"},children:[N.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider mb-4",children:["Stashes (",f.length,")"]}),N.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:f.map((E,v)=>N.jsxs("div",{onClick:()=>h(E),className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl overflow-hidden cursor-pointer transition-all duration-200 hover:border-[var(--stashes-border-hover)] hover:-translate-y-0.5 stash-shadow group",style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${v*40}ms`},children:[N.jsx("div",{className:"aspect-video bg-[var(--stashes-bg)] relative overflow-hidden",children:E.screenshotUrl?N.jsx("img",{src:E.screenshotUrl,alt:"",className:"w-full h-full object-cover object-top transition-transform duration-300 group-hover:scale-[1.02]"}):N.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-[var(--stashes-text-muted)]",children:"No preview"})}),N.jsx("div",{className:"p-2.5",children:N.jsxs("p",{className:"text-[11px] text-[var(--stashes-text-muted)] line-clamp-2 leading-relaxed",children:[N.jsxs("span",{className:"font-semibold text-[var(--stashes-text)]",children:["#",E.number]})," ",E.prompt]})})]},E.id))})]}),a.length>0&&N.jsxs("div",{style:{animation:"fadeIn 0.5s ease-out 0.2s both"},children:[N.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider mb-4",children:["Conversations (",a.length,")"]}),N.jsx("div",{className:"space-y-2",children:a.map((E,v)=>N.jsxs("div",{onClick:()=>e(`/chat/${E.id}`),className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:border-[var(--stashes-border-hover)] hover:-translate-y-0.5 stash-shadow group flex items-center justify-between",style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${v*40}ms`},children:[N.jsx("div",{className:"min-w-0 flex-1",children:N.jsx("div",{className:"font-semibold text-sm truncate",children:E.title})}),N.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[N.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:S(E.updatedAt)}),N.jsx("button",{onClick:x=>{x.stopPropagation(),m(E.id)},className:"opacity-0 group-hover:opacity-100 text-[var(--stashes-text-muted)] hover:text-red-400 transition-all p-1 rounded",title:"Delete chat",children:N.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:N.jsx("path",{d:"M2 3H10M4 3V2H8V3M5 5V9M7 5V9M3 3V10.5C3 10.776 3.224 11 3.5 11H8.5C8.776 11 9 10.776 9 10.5V3",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]},E.id))})]})]}),p&&N.jsx(xT,{title:"Delete conversation",message:"This will permanently delete this conversation and its messages. Stashes created in this conversation will remain.",onConfirm:()=>{c(p),m(null)},onCancel:()=>m(null)})]})}function sv(e){const a=[],r=String(e||"");let l=r.indexOf(","),s=0,u=!1;for(;!u;){l===-1&&(l=r.length,u=!0);const c=r.slice(s,l).trim();(c||!u)&&a.push(c),s=l+1,l=r.indexOf(",",s)}return a}function Qx(e,a){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Jx=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tR={};function uv(e,a){return(tR.jsx?eR:Jx).test(e)}const nR=/[ \t\n\f\r]/g;function aR(e){return typeof e=="object"?e.type==="text"?cv(e.value):!1:cv(e)}function cv(e){return e.replace(nR,"")===""}class ol{constructor(a,r,l){this.normal=r,this.property=a,l&&(this.space=l)}}ol.prototype.normal={};ol.prototype.property={};ol.prototype.space=void 0;function RT(e,a){const r={},l={};for(const s of e)Object.assign(r,s.property),Object.assign(l,s.normal);return new ol(r,l,a)}function Ji(e){return e.toLowerCase()}class Bt{constructor(a,r){this.attribute=r,this.property=a}}Bt.prototype.attribute="";Bt.prototype.booleanish=!1;Bt.prototype.boolean=!1;Bt.prototype.commaOrSpaceSeparated=!1;Bt.prototype.commaSeparated=!1;Bt.prototype.defined=!1;Bt.prototype.mustUseProperty=!1;Bt.prototype.number=!1;Bt.prototype.overloadedBoolean=!1;Bt.prototype.property="";Bt.prototype.spaceSeparated=!1;Bt.prototype.space=void 0;let rR=0;const Te=Ha(),lt=Ha(),ld=Ha(),ne=Ha(),Ye=Ha(),Ur=Ha(),Vt=Ha();function Ha(){return 2**++rR}const od=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:lt,commaOrSpaceSeparated:Vt,commaSeparated:Ur,number:ne,overloadedBoolean:ld,spaceSeparated:Ye},Symbol.toStringTag,{value:"Module"})),zc=Object.keys(od);class Cd extends Bt{constructor(a,r,l,s){let u=-1;if(super(a,r),dv(this,"space",s),typeof l=="number")for(;++u<zc.length;){const c=zc[u];dv(this,zc[u],(l&od[c])===od[c])}}}Cd.prototype.defined=!0;function dv(e,a,r){r&&(e[a]=r)}function Gr(e){const a={},r={};for(const[l,s]of Object.entries(e.properties)){const u=new Cd(l,e.transform(e.attributes||{},l),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),a[l]=u,r[Ji(l)]=l,r[Ji(u.attribute)]=l}return new ol(a,r,e.space)}const NT=Gr({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:ne,ariaColIndex:ne,ariaColSpan:ne,ariaControls:Ye,ariaCurrent:null,ariaDescribedBy:Ye,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ye,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ye,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ye,ariaLevel:ne,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ye,ariaPlaceholder:null,ariaPosInSet:ne,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ye,ariaRowCount:ne,ariaRowIndex:ne,ariaRowSpan:ne,ariaSelected:lt,ariaSetSize:ne,ariaSort:null,ariaValueMax:ne,ariaValueMin:ne,ariaValueNow:ne,ariaValueText:null,role:null},transform(e,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function CT(e,a){return a in e?e[a]:a}function IT(e,a){return CT(e,a.toLowerCase())}const iR=Gr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ur,acceptCharset:Ye,accessKey:Ye,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:Ye,autoFocus:Te,autoPlay:Te,blocking:Ye,capture:null,charSet:null,checked:Te,cite:null,className:Ye,cols:ne,colSpan:null,content:null,contentEditable:lt,controls:Te,controlsList:Ye,coords:ne|Ur,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:ld,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:Ye,height:ne,hidden:ld,high:ne,href:null,hrefLang:null,htmlFor:Ye,httpEquiv:Ye,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:Ye,itemRef:Ye,itemScope:Te,itemType:Ye,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:ne,manifest:null,max:null,maxLength:ne,media:null,method:null,min:null,minLength:ne,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Te,optimum:ne,pattern:null,ping:Ye,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:Ye,required:Te,reversed:Te,rows:ne,rowSpan:ne,sandbox:Ye,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shape:null,size:ne,sizes:null,slot:null,span:ne,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ne,step:null,style:null,tabIndex:ne,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:lt,width:ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ye,axis:null,background:null,bgColor:null,border:ne,borderColor:null,bottomMargin:ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:ne,leftMargin:ne,link:null,longDesc:null,lowSrc:null,marginHeight:ne,marginWidth:ne,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:ne,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Te,disableRemotePlayback:Te,prefix:null,property:null,results:ne,security:null,unselectable:null},space:"html",transform:IT}),lR=Gr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vt,accentHeight:ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ne,amplitude:ne,arabicForm:null,ascent:ne,attributeName:null,attributeType:null,azimuth:ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ne,by:null,calcMode:null,capHeight:ne,className:Ye,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ne,diffuseConstant:ne,direction:null,display:null,dur:null,divisor:ne,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:ne,enableBackground:null,end:null,event:null,exponent:ne,externalResourcesRequired:null,fill:null,fillOpacity:ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ur,g2:Ur,glyphName:Ur,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ne,horizOriginX:ne,horizOriginY:ne,id:null,ideographic:ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ne,k:ne,k1:ne,k2:ne,k3:ne,k4:ne,kernelMatrix:Vt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ne,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ne,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ne,overlineThickness:ne,paintOrder:null,panose1:null,path:null,pathLength:ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ye,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ne,pointsAtY:ne,pointsAtZ:ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vt,rev:Vt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vt,requiredFeatures:Vt,requiredFonts:Vt,requiredFormats:Vt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ne,specularExponent:ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ne,strikethroughThickness:ne,string:null,stroke:null,strokeDashArray:Vt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ne,strokeOpacity:ne,strokeWidth:null,style:null,surfaceScale:ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vt,tabIndex:ne,tableValues:null,target:null,targetX:ne,targetY:ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ne,underlineThickness:ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ne,values:null,vAlphabetic:ne,vMathematical:ne,vectorEffect:null,vHanging:ne,vIdeographic:ne,version:null,vertAdvY:ne,vertOriginX:ne,vertOriginY:ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:CT}),OT=Gr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,a){return"xlink:"+a.slice(5).toLowerCase()}}),LT=Gr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:IT}),DT=Gr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,a){return"xml:"+a.slice(3).toLowerCase()}}),oR={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"},sR=/[A-Z]/g,pv=/-[a-z]/g,uR=/^data[-\w.:]+$/i;function MT(e,a){const r=Ji(a);let l=a,s=Bt;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&uR.test(a)){if(a.charAt(4)==="-"){const u=a.slice(5).replace(pv,dR);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=a.slice(4);if(!pv.test(u)){let c=u.replace(sR,cR);c.charAt(0)!=="-"&&(c="-"+c),a="data"+c}}s=Cd}return new s(l,a)}function cR(e){return"-"+e.toLowerCase()}function dR(e){return e.charAt(1).toUpperCase()}const UT=RT([NT,iR,OT,LT,DT],"html"),es=RT([NT,lR,OT,LT,DT],"svg");function fv(e){const a=String(e||"").trim();return a?a.split(/[ \t\n\r\f]+/g):[]}function pR(e){return e.join(" ").trim()}var Or={},Gc,gv;function fR(){if(gv)return Gc;gv=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,p=/^\s+|\s+$/g,m=`
61
61
  `,f="/",b="*",h="",S="comment",E="declaration";function v(_,w){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];w=w||{};var C=1,I=1;function P(re){var J=re.match(a);J&&(C+=J.length);var F=re.lastIndexOf(m);I=~F?re.length-F:I+re.length}function V(){var re={line:C,column:I};return function(J){return J.position=new M(re),oe(),J}}function M(re){this.start=re,this.end={line:C,column:I},this.source=w.source}M.prototype.content=_;function W(re){var J=new Error(w.source+":"+C+":"+I+": "+re);if(J.reason=re,J.filename=w.source,J.line=C,J.column=I,J.source=_,!w.silent)throw J}function ae(re){var J=re.exec(_);if(J){var F=J[0];return P(F),_=_.slice(F.length),J}}function oe(){ae(r)}function B(re){var J;for(re=re||[];J=te();)J!==!1&&re.push(J);return re}function te(){var re=V();if(!(f!=_.charAt(0)||b!=_.charAt(1))){for(var J=2;h!=_.charAt(J)&&(b!=_.charAt(J)||f!=_.charAt(J+1));)++J;if(J+=2,h===_.charAt(J-1))return W("End of comment missing");var F=_.slice(2,J-2);return I+=2,P(F),_=_.slice(J),I+=2,re({type:S,comment:F})}}function ee(){var re=V(),J=ae(l);if(J){if(te(),!ae(s))return W("property missing ':'");var F=ae(u),Q=re({type:E,property:x(J[0].replace(e,h)),value:F?x(F[0].replace(e,h)):h});return ae(c),Q}}function ie(){var re=[];B(re);for(var J;J=ee();)J!==!1&&(re.push(J),B(re));return re}return oe(),ie()}function x(_){return _?_.replace(p,h):h}return Gc=v,Gc}var mv;function gR(){if(mv)return Or;mv=1;var e=Or&&Or.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Or,"__esModule",{value:!0}),Or.default=r;const a=e(fR());function r(l,s){let u=null;if(!l||typeof l!="string")return u;const c=(0,a.default)(l),p=typeof s=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:f,value:b}=m;p?s(f,b,m):b&&(u=u||{},u[f]=b)}),u}return Or}var Pi={},hv;function mR(){if(hv)return Pi;hv=1,Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,a=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,u=function(f){return!f||r.test(f)||e.test(f)},c=function(f,b){return b.toUpperCase()},p=function(f,b){return"".concat(b,"-")},m=function(f,b){return b===void 0&&(b={}),u(f)?f:(f=f.toLowerCase(),b.reactCompat?f=f.replace(s,p):f=f.replace(l,p),f.replace(a,c))};return Pi.camelCase=m,Pi}var qi,bv;function hR(){if(bv)return qi;bv=1;var e=qi&&qi.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},a=e(gR()),r=mR();function l(s,u){var c={};return!s||typeof s!="string"||(0,a.default)(s,function(p,m){p&&m&&(c[(0,r.camelCase)(p,u)]=m)}),c}return l.default=l,qi=l,qi}var bR=hR();const yR=vd(bR),BT=FT("end"),Id=FT("start");function FT(e){return a;function a(r){const l=r&&r.position&&r.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function ER(e){const a=Id(e),r=BT(e);if(a&&r)return{start:a,end:r}}function Wi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yv(e.position):"start"in e||"end"in e?yv(e):"line"in e||"column"in e?sd(e):""}function sd(e){return Ev(e&&e.line)+":"+Ev(e&&e.column)}function yv(e){return sd(e&&e.start)+"-"+sd(e&&e.end)}function Ev(e){return e&&typeof e=="number"?e:1}class St extends Error{constructor(a,r,l){super(),typeof r=="string"&&(l=r,r=void 0);let s="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof a=="string"?s=a:!u.cause&&a&&(c=!0,s=a.message,u.cause=a),!u.ruleId&&!u.source&&typeof l=="string"){const m=l.indexOf(":");m===-1?u.ruleId=l:(u.source=l.slice(0,m),u.ruleId=l.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const p=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=p?p.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=p?p.line:void 0,this.name=Wi(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}St.prototype.file="";St.prototype.name="";St.prototype.reason="";St.prototype.message="";St.prototype.stack="";St.prototype.column=void 0;St.prototype.line=void 0;St.prototype.ancestors=void 0;St.prototype.cause=void 0;St.prototype.fatal=void 0;St.prototype.place=void 0;St.prototype.ruleId=void 0;St.prototype.source=void 0;const Od={}.hasOwnProperty,SR=new Map,vR=/[A-Z]/g,TR=new Set(["table","tbody","thead","tfoot","tr"]),AR=new Set(["td","th"]),zT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wR(e,a){if(!a||a.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=a.filePath||void 0;let l;if(a.development){if(typeof a.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=OR(r,a.jsxDEV)}else{if(typeof a.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof a.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=IR(r,a.jsx,a.jsxs)}const s={Fragment:a.Fragment,ancestors:[],components:a.components||{},create:l,elementAttributeNameCase:a.elementAttributeNameCase||"react",evaluater:a.createEvaluater?a.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:a.ignoreInvalidStyle||!1,passKeys:a.passKeys!==!1,passNode:a.passNode||!1,schema:a.space==="svg"?es:UT,stylePropertyNameCase:a.stylePropertyNameCase||"dom",tableCellAlignToStyle:a.tableCellAlignToStyle!==!1},u=GT(s,e,void 0);return u&&typeof u!="string"?u:s.create(e,s.Fragment,{children:u||void 0},void 0)}function GT(e,a,r){if(a.type==="element")return _R(e,a,r);if(a.type==="mdxFlowExpression"||a.type==="mdxTextExpression")return kR(e,a);if(a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement")return RR(e,a,r);if(a.type==="mdxjsEsm")return xR(e,a);if(a.type==="root")return NR(e,a,r);if(a.type==="text")return CR(e,a)}function _R(e,a,r){const l=e.schema;let s=l;a.tagName.toLowerCase()==="svg"&&l.space==="html"&&(s=es,e.schema=s),e.ancestors.push(a);const u=HT(e,a.tagName,!1),c=LR(e,a);let p=Dd(e,a);return TR.has(a.tagName)&&(p=p.filter(function(m){return typeof m=="string"?!aR(m):!0})),jT(e,c,u,a),Ld(c,p),e.ancestors.pop(),e.schema=l,e.create(a,u,c,r)}function kR(e,a){if(a.data&&a.data.estree&&e.evaluater){const l=a.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}el(e,a.position)}function xR(e,a){if(a.data&&a.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(a.data.estree);el(e,a.position)}function RR(e,a,r){const l=e.schema;let s=l;a.name==="svg"&&l.space==="html"&&(s=es,e.schema=s),e.ancestors.push(a);const u=a.name===null?e.Fragment:HT(e,a.name,!0),c=DR(e,a),p=Dd(e,a);return jT(e,c,u,a),Ld(c,p),e.ancestors.pop(),e.schema=l,e.create(a,u,c,r)}function NR(e,a,r){const l={};return Ld(l,Dd(e,a)),e.create(a,e.Fragment,l,r)}function CR(e,a){return a.value}function jT(e,a,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(a.node=l)}function Ld(e,a){if(a.length>0){const r=a.length>1?a:a[0];r&&(e.children=r)}}function IR(e,a,r){return l;function l(s,u,c,p){const f=Array.isArray(c.children)?r:a;return p?f(u,c,p):f(u,c)}}function OR(e,a){return r;function r(l,s,u,c){const p=Array.isArray(u.children),m=Id(l);return a(s,u,c,p,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function LR(e,a){const r={};let l,s;for(s in a.properties)if(s!=="children"&&Od.call(a.properties,s)){const u=MR(e,s,a.properties[s]);if(u){const[c,p]=u;e.tableCellAlignToStyle&&c==="align"&&typeof p=="string"&&AR.has(a.tagName)?l=p:r[c]=p}}if(l){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function DR(e,a){const r={};for(const l of a.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const u=l.data.estree.body[0];u.type;const c=u.expression;c.type;const p=c.properties[0];p.type,Object.assign(r,e.evaluater.evaluateExpression(p.argument))}else el(e,a.position);else{const s=l.name;let u;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const p=l.value.data.estree.body[0];p.type,u=e.evaluater.evaluateExpression(p.expression)}else el(e,a.position);else u=l.value===null?!0:l.value;r[s]=u}return r}function Dd(e,a){const r=[];let l=-1;const s=e.passKeys?new Map:SR;for(;++l<a.children.length;){const u=a.children[l];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const f=s.get(m)||0;c=m+"-"+f,s.set(m,f+1)}}const p=GT(e,u,c);p!==void 0&&r.push(p)}return r}function MR(e,a,r){const l=MT(e.schema,a);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=l.commaSeparated?Qx(r):pR(r)),l.property==="style"){let s=typeof r=="object"?r:UR(e,String(r));return e.stylePropertyNameCase==="css"&&(s=BR(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&l.space?oR[l.property]||l.property:l.attribute,r]}}function UR(e,a){try{return yR(a,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const l=r,s=new St("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=zT+"#cannot-parse-style-attribute",s}}function HT(e,a,r){let l;if(!r)l={type:"Literal",value:a};else if(a.includes(".")){const s=a.split(".");let u=-1,c;for(;++u<s.length;){const p=uv(s[u])?{type:"Identifier",name:s[u]}:{type:"Literal",value:s[u]};c=c?{type:"MemberExpression",object:c,property:p,computed:!!(u&&p.type==="Literal"),optional:!1}:p}l=c}else l=uv(a)&&!/^[a-z]/.test(a)?{type:"Identifier",name:a}:{type:"Literal",value:a};if(l.type==="Literal"){const s=l.value;return Od.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(l);el(e)}function el(e,a){const r=new St("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:a,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=zT+"#cannot-handle-mdx-estrees-without-createevaluater",r}function BR(e){const a={};let r;for(r in e)Od.call(e,r)&&(a[FR(r)]=e[r]);return a}function FR(e){let a=e.replace(vR,zR);return a.slice(0,3)==="ms-"&&(a="-"+a),a}function zR(e){return"-"+e.toLowerCase()}const jc={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"]},GR={};function Md(e,a){const r=GR,l=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return $T(e,l,s)}function $T(e,a,r){if(jR(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(a&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Sv(e.children,a,r)}return Array.isArray(e)?Sv(e,a,r):""}function Sv(e,a,r){const l=[];let s=-1;for(;++s<e.length;)l[s]=$T(e[s],a,r);return l.join("")}function jR(e){return!!(e&&typeof e=="object")}const vv=document.createElement("i");function tl(e){const a="&"+e+";";vv.innerHTML=a;const r=vv.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===a?!1:r}function Yt(e,a,r,l){const s=e.length;let u=0,c;if(a<0?a=-a>s?0:s+a:a=a>s?s:a,r=r>0?r:0,l.length<1e4)c=Array.from(l),c.unshift(a,r),e.splice(...c);else for(r&&e.splice(a,r);u<l.length;)c=l.slice(u,u+1e4),c.unshift(a,0),e.splice(...c),u+=1e4,a+=1e4}function rn(e,a){return e.length>0?(Yt(e,e.length,0,a),e):a}const Tv={}.hasOwnProperty;function PT(e){const a={};let r=-1;for(;++r<e.length;)HR(a,e[r]);return a}function HR(e,a){let r;for(r in a){const s=(Tv.call(e,r)?e[r]:void 0)||(e[r]={}),u=a[r];let c;if(u)for(c in u){Tv.call(s,c)||(s[c]=[]);const p=u[c];$R(s[c],Array.isArray(p)?p:p?[p]:[])}}}function $R(e,a){let r=-1;const l=[];for(;++r<a.length;)(a[r].add==="after"?e:l).push(a[r]);Yt(e,0,0,l)}function qT(e,a){const r=Number.parseInt(e,a);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function gn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const kt=va(/[A-Za-z]/),Et=va(/[\dA-Za-z]/),PR=va(/[#-'*+\--9=?A-Z^-~]/);function Wo(e){return e!==null&&(e<32||e===127)}const ud=va(/\d/),qR=va(/[\dA-Fa-f]/),VR=va(/[!-/:-@[-`{-~]/);function me(e){return e!==null&&e<-2}function Ve(e){return e!==null&&(e<0||e===32)}function xe(e){return e===-2||e===-1||e===32}const ts=va(new RegExp("\\p{P}|\\p{S}","u")),ja=va(/\s/);function va(e){return a;function a(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function jr(e){const a=[];let r=-1,l=0,s=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&Et(e.charCodeAt(r+1))&&Et(e.charCodeAt(r+2)))s=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const p=e.charCodeAt(r+1);u<56320&&p>56319&&p<57344?(c=String.fromCharCode(u,p),s=1):c="�"}else c=String.fromCharCode(u);c&&(a.push(e.slice(l,r),encodeURIComponent(c)),l=r+s+1,c=""),s&&(r+=s,s=0)}return a.join("")+e.slice(l)}function Oe(e,a,r,l){const s=l?l-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return xe(m)?(e.enter(r),p(m)):a(m)}function p(m){return xe(m)&&u++<s?(e.consume(m),p):(e.exit(r),a(m))}}const YR={tokenize:WR};function WR(e){const a=e.attempt(this.parser.constructs.contentInitial,l,s);let r;return a;function l(p){if(p===null){e.consume(p);return}return e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Oe(e,a,"linePrefix")}function s(p){return e.enter("paragraph"),u(p)}function u(p){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,c(p)}function c(p){if(p===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(p);return}return me(p)?(e.consume(p),e.exit("chunkText"),u):(e.consume(p),c)}}const XR={tokenize:ZR},Av={tokenize:KR};function ZR(e){const a=this,r=[];let l=0,s,u,c;return p;function p(I){if(l<r.length){const P=r[l];return a.containerState=P[1],e.attempt(P[0].continuation,m,f)(I)}return f(I)}function m(I){if(l++,a.containerState._closeFlow){a.containerState._closeFlow=void 0,s&&C();const P=a.events.length;let V=P,M;for(;V--;)if(a.events[V][0]==="exit"&&a.events[V][1].type==="chunkFlow"){M=a.events[V][1].end;break}w(l);let W=P;for(;W<a.events.length;)a.events[W][1].end={...M},W++;return Yt(a.events,V+1,0,a.events.slice(P)),a.events.length=W,f(I)}return p(I)}function f(I){if(l===r.length){if(!s)return S(I);if(s.currentConstruct&&s.currentConstruct.concrete)return v(I);a.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return a.containerState={},e.check(Av,b,h)(I)}function b(I){return s&&C(),w(l),S(I)}function h(I){return a.parser.lazy[a.now().line]=l!==r.length,c=a.now().offset,v(I)}function S(I){return a.containerState={},e.attempt(Av,E,v)(I)}function E(I){return l++,r.push([a.currentConstruct,a.containerState]),S(I)}function v(I){if(I===null){s&&C(),w(0),e.consume(I);return}return s=s||a.parser.flow(a.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:u}),x(I)}function x(I){if(I===null){_(e.exit("chunkFlow"),!0),w(0),e.consume(I);return}return me(I)?(e.consume(I),_(e.exit("chunkFlow")),l=0,a.interrupt=void 0,p):(e.consume(I),x)}function _(I,P){const V=a.sliceStream(I);if(P&&V.push(null),I.previous=u,u&&(u.next=I),u=I,s.defineSkip(I.start),s.write(V),a.parser.lazy[I.start.line]){let M=s.events.length;for(;M--;)if(s.events[M][1].start.offset<c&&(!s.events[M][1].end||s.events[M][1].end.offset>c))return;const W=a.events.length;let ae=W,oe,B;for(;ae--;)if(a.events[ae][0]==="exit"&&a.events[ae][1].type==="chunkFlow"){if(oe){B=a.events[ae][1].end;break}oe=!0}for(w(l),M=W;M<a.events.length;)a.events[M][1].end={...B},M++;Yt(a.events,ae+1,0,a.events.slice(W)),a.events.length=M}}function w(I){let P=r.length;for(;P-- >I;){const V=r[P];a.containerState=V[1],V[0].exit.call(a,e)}r.length=I}function C(){s.write([null]),u=void 0,s=void 0,a.containerState._closeFlow=void 0}}function KR(e,a,r){return Oe(e,e.attempt(this.parser.constructs.document,a,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Br(e){if(e===null||Ve(e)||ja(e))return 1;if(ts(e))return 2}function ns(e,a,r){const l=[];let s=-1;for(;++s<e.length;){const u=e[s].resolveAll;u&&!l.includes(u)&&(a=u(a,r),l.push(u))}return a}const cd={name:"attention",resolveAll:QR,tokenize:JR};function QR(e,a){let r=-1,l,s,u,c,p,m,f,b;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(l=r;l--;)if(e[l][0]==="exit"&&e[l][1].type==="attentionSequence"&&e[l][1]._open&&a.sliceSerialize(e[l][1]).charCodeAt(0)===a.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[l][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[l][1].end.offset-e[l][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[l][1].end.offset-e[l][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const h={...e[l][1].end},S={...e[r][1].start};wv(h,-m),wv(S,m),c={type:m>1?"strongSequence":"emphasisSequence",start:h,end:{...e[l][1].end}},p={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:S},u={type:m>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},s={type:m>1?"strong":"emphasis",start:{...c.start},end:{...p.end}},e[l][1].end={...c.start},e[r][1].start={...p.end},f=[],e[l][1].end.offset-e[l][1].start.offset&&(f=rn(f,[["enter",e[l][1],a],["exit",e[l][1],a]])),f=rn(f,[["enter",s,a],["enter",c,a],["exit",c,a],["enter",u,a]]),f=rn(f,ns(a.parser.constructs.insideSpan.null,e.slice(l+1,r),a)),f=rn(f,[["exit",u,a],["enter",p,a],["exit",p,a],["exit",s,a]]),e[r][1].end.offset-e[r][1].start.offset?(b=2,f=rn(f,[["enter",e[r][1],a],["exit",e[r][1],a]])):b=0,Yt(e,l-1,r-l+3,f),r=l+f.length-b-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function JR(e,a){const r=this.parser.constructs.attentionMarkers.null,l=this.previous,s=Br(l);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),p(m)}function p(m){if(m===u)return e.consume(m),p;const f=e.exit("attentionSequence"),b=Br(m),h=!b||b===2&&s||r.includes(m),S=!s||s===2&&b||r.includes(l);return f._open=!!(u===42?h:h&&(s||!S)),f._close=!!(u===42?S:S&&(b||!h)),a(m)}}function wv(e,a){e.column+=a,e.offset+=a,e._bufferIndex+=a}const eN={name:"autolink",tokenize:tN};function tN(e,a,r){let l=0;return s;function s(E){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(E),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(E){return kt(E)?(e.consume(E),c):E===64?r(E):f(E)}function c(E){return E===43||E===45||E===46||Et(E)?(l=1,p(E)):f(E)}function p(E){return E===58?(e.consume(E),l=0,m):(E===43||E===45||E===46||Et(E))&&l++<32?(e.consume(E),p):(l=0,f(E))}function m(E){return E===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(E),e.exit("autolinkMarker"),e.exit("autolink"),a):E===null||E===32||E===60||Wo(E)?r(E):(e.consume(E),m)}function f(E){return E===64?(e.consume(E),b):PR(E)?(e.consume(E),f):r(E)}function b(E){return Et(E)?h(E):r(E)}function h(E){return E===46?(e.consume(E),l=0,b):E===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(E),e.exit("autolinkMarker"),e.exit("autolink"),a):S(E)}function S(E){if((E===45||Et(E))&&l++<63){const v=E===45?S:h;return e.consume(E),v}return r(E)}}const sl={partial:!0,tokenize:nN};function nN(e,a,r){return l;function l(u){return xe(u)?Oe(e,s,"linePrefix")(u):s(u)}function s(u){return u===null||me(u)?a(u):r(u)}}const VT={continuation:{tokenize:rN},exit:iN,name:"blockQuote",tokenize:aN};function aN(e,a,r){const l=this;return s;function s(c){if(c===62){const p=l.containerState;return p.open||(e.enter("blockQuote",{_container:!0}),p.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return xe(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),a):(e.exit("blockQuotePrefix"),a(c))}}function rN(e,a,r){const l=this;return s;function s(c){return xe(c)?Oe(e,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(VT,a,r)(c)}}function iN(e){e.exit("blockQuote")}const YT={name:"characterEscape",tokenize:lN};function lN(e,a,r){return l;function l(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),s}function s(u){return VR(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),a):r(u)}}const WT={name:"characterReference",tokenize:oN};function oN(e,a,r){const l=this;let s=0,u,c;return p;function p(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),m}function m(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),u=31,c=Et,b(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=qR,b):(e.enter("characterReferenceValue"),u=7,c=ud,b(h))}function b(h){if(h===59&&s){const S=e.exit("characterReferenceValue");return c===Et&&!tl(l.sliceSerialize(S))?r(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),a)}return c(h)&&s++<u?(e.consume(h),b):r(h)}}const _v={partial:!0,tokenize:uN},kv={concrete:!0,name:"codeFenced",tokenize:sN};function sN(e,a,r){const l=this,s={partial:!0,tokenize:V};let u=0,c=0,p;return m;function m(M){return f(M)}function f(M){const W=l.events[l.events.length-1];return u=W&&W[1].type==="linePrefix"?W[2].sliceSerialize(W[1],!0).length:0,p=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(M)}function b(M){return M===p?(c++,e.consume(M),b):c<3?r(M):(e.exit("codeFencedFenceSequence"),xe(M)?Oe(e,h,"whitespace")(M):h(M))}function h(M){return M===null||me(M)?(e.exit("codeFencedFence"),l.interrupt?a(M):e.check(_v,x,P)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),S(M))}function S(M){return M===null||me(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(M)):xe(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Oe(e,E,"whitespace")(M)):M===96&&M===p?r(M):(e.consume(M),S)}function E(M){return M===null||me(M)?h(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(M))}function v(M){return M===null||me(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(M)):M===96&&M===p?r(M):(e.consume(M),v)}function x(M){return e.attempt(s,P,_)(M)}function _(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),w}function w(M){return u>0&&xe(M)?Oe(e,C,"linePrefix",u+1)(M):C(M)}function C(M){return M===null||me(M)?e.check(_v,x,P)(M):(e.enter("codeFlowValue"),I(M))}function I(M){return M===null||me(M)?(e.exit("codeFlowValue"),C(M)):(e.consume(M),I)}function P(M){return e.exit("codeFenced"),a(M)}function V(M,W,ae){let oe=0;return B;function B(J){return M.enter("lineEnding"),M.consume(J),M.exit("lineEnding"),te}function te(J){return M.enter("codeFencedFence"),xe(J)?Oe(M,ee,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):ee(J)}function ee(J){return J===p?(M.enter("codeFencedFenceSequence"),ie(J)):ae(J)}function ie(J){return J===p?(oe++,M.consume(J),ie):oe>=c?(M.exit("codeFencedFenceSequence"),xe(J)?Oe(M,re,"whitespace")(J):re(J)):ae(J)}function re(J){return J===null||me(J)?(M.exit("codeFencedFence"),W(J)):ae(J)}}}function uN(e,a,r){const l=this;return s;function s(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return l.parser.lazy[l.now().line]?r(c):a(c)}}const Hc={name:"codeIndented",tokenize:dN},cN={partial:!0,tokenize:pN};function dN(e,a,r){const l=this;return s;function s(f){return e.enter("codeIndented"),Oe(e,u,"linePrefix",5)(f)}function u(f){const b=l.events[l.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?c(f):r(f)}function c(f){return f===null?m(f):me(f)?e.attempt(cN,c,m)(f):(e.enter("codeFlowValue"),p(f))}function p(f){return f===null||me(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),p)}function m(f){return e.exit("codeIndented"),a(f)}}function pN(e,a,r){const l=this;return s;function s(c){return l.parser.lazy[l.now().line]?r(c):me(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):Oe(e,u,"linePrefix",5)(c)}function u(c){const p=l.events[l.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(c):me(c)?s(c):r(c)}}const fN={name:"codeText",previous:mN,resolve:gN,tokenize:hN};function gN(e){let a=e.length-4,r=3,l,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[a][1].type==="lineEnding"||e[a][1].type==="space")){for(l=r;++l<a;)if(e[l][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[a][1].type="codeTextPadding",r+=2,a-=2;break}}for(l=r-1,a++;++l<=a;)s===void 0?l!==a&&e[l][1].type!=="lineEnding"&&(s=l):(l===a||e[l][1].type==="lineEnding")&&(e[s][1].type="codeTextData",l!==s+2&&(e[s][1].end=e[l-1][1].end,e.splice(s+2,l-s-2),a-=l-s-2,l=s+2),s=void 0);return e}function mN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hN(e,a,r){let l=0,s,u;return c;function c(h){return e.enter("codeText"),e.enter("codeTextSequence"),p(h)}function p(h){return h===96?(e.consume(h),l++,p):(e.exit("codeTextSequence"),m(h))}function m(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),m):h===96?(u=e.enter("codeTextSequence"),s=0,b(h)):me(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),m):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||me(h)?(e.exit("codeTextData"),m(h)):(e.consume(h),f)}function b(h){return h===96?(e.consume(h),s++,b):s===l?(e.exit("codeTextSequence"),e.exit("codeText"),a(h)):(u.type="codeTextData",f(h))}}class bN{constructor(a){this.left=a?[...a]:[],this.right=[]}get(a){if(a<0||a>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+a+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return a<this.left.length?this.left[a]:this.right[this.right.length-a+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(a,r){const l=r??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(a,l):a>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-a+this.left.length).reverse():this.left.slice(a).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(a,r,l){const s=r||0;this.setCursor(Math.trunc(a));const u=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return l&&Vi(this.left,l),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(a){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(a)}pushMany(a){this.setCursor(Number.POSITIVE_INFINITY),Vi(this.left,a)}unshift(a){this.setCursor(0),this.right.push(a)}unshiftMany(a){this.setCursor(0),Vi(this.right,a.reverse())}setCursor(a){if(!(a===this.left.length||a>this.left.length&&this.right.length===0||a<0&&this.left.length===0))if(a<this.left.length){const r=this.left.splice(a,Number.POSITIVE_INFINITY);Vi(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-a,Number.POSITIVE_INFINITY);Vi(this.left,r.reverse())}}}function Vi(e,a){let r=0;if(a.length<1e4)e.push(...a);else for(;r<a.length;)e.push(...a.slice(r,r+1e4)),r+=1e4}function XT(e){const a={};let r=-1,l,s,u,c,p,m,f;const b=new bN(e);for(;++r<b.length;){for(;r in a;)r=a[r];if(l=b.get(r),r&&l[1].type==="chunkFlow"&&b.get(r-1)[1].type==="listItemPrefix"&&(m=l[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(l[0]==="enter")l[1].contentType&&(Object.assign(a,yN(b,r)),r=a[r],f=!0);else if(l[1]._container){for(u=r,s=void 0;u--;)if(c=b.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(b.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;s&&(l[1].end={...b.get(s)[1].start},p=b.slice(s,r),p.unshift(l),b.splice(s,r-s+1,p))}}return Yt(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!f}function yN(e,a){const r=e.get(a)[1],l=e.get(a)[2];let s=a-1;const u=[];let c=r._tokenizer;c||(c=l.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const p=c.events,m=[],f={};let b,h,S=-1,E=r,v=0,x=0;const _=[x];for(;E;){for(;e.get(++s)[1]!==E;);u.push(s),E._tokenizer||(b=l.sliceStream(E),E.next||b.push(null),h&&c.defineSkip(E.start),E._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(b),E._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),h=E,E=E.next}for(E=r;++S<p.length;)p[S][0]==="exit"&&p[S-1][0]==="enter"&&p[S][1].type===p[S-1][1].type&&p[S][1].start.line!==p[S][1].end.line&&(x=S+1,_.push(x),E._tokenizer=void 0,E.previous=void 0,E=E.next);for(c.events=[],E?(E._tokenizer=void 0,E.previous=void 0):_.pop(),S=_.length;S--;){const w=p.slice(_[S],_[S+1]),C=u.pop();m.push([C,C+w.length-1]),e.splice(C,2,w)}for(m.reverse(),S=-1;++S<m.length;)f[v+m[S][0]]=v+m[S][1],v+=m[S][1]-m[S][0]-1;return f}const EN={resolve:vN,tokenize:TN},SN={partial:!0,tokenize:AN};function vN(e){return XT(e),e}function TN(e,a){let r;return l;function l(p){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(p)}function s(p){return p===null?u(p):me(p)?e.check(SN,c,u)(p):(e.consume(p),s)}function u(p){return e.exit("chunkContent"),e.exit("content"),a(p)}function c(p){return e.consume(p),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function AN(e,a,r){const l=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Oe(e,u,"linePrefix")}function u(c){if(c===null||me(c))return r(c);const p=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(c):e.interrupt(l.parser.constructs.flow,r,a)(c)}}function ZT(e,a,r,l,s,u,c,p,m){const f=m||Number.POSITIVE_INFINITY;let b=0;return h;function h(w){return w===60?(e.enter(l),e.enter(s),e.enter(u),e.consume(w),e.exit(u),S):w===null||w===32||w===41||Wo(w)?r(w):(e.enter(l),e.enter(c),e.enter(p),e.enter("chunkString",{contentType:"string"}),x(w))}function S(w){return w===62?(e.enter(u),e.consume(w),e.exit(u),e.exit(s),e.exit(l),a):(e.enter(p),e.enter("chunkString",{contentType:"string"}),E(w))}function E(w){return w===62?(e.exit("chunkString"),e.exit(p),S(w)):w===null||w===60||me(w)?r(w):(e.consume(w),w===92?v:E)}function v(w){return w===60||w===62||w===92?(e.consume(w),E):E(w)}function x(w){return!b&&(w===null||w===41||Ve(w))?(e.exit("chunkString"),e.exit(p),e.exit(c),e.exit(l),a(w)):b<f&&w===40?(e.consume(w),b++,x):w===41?(e.consume(w),b--,x):w===null||w===32||w===40||Wo(w)?r(w):(e.consume(w),w===92?_:x)}function _(w){return w===40||w===41||w===92?(e.consume(w),x):x(w)}}function KT(e,a,r,l,s,u){const c=this;let p=0,m;return f;function f(E){return e.enter(l),e.enter(s),e.consume(E),e.exit(s),e.enter(u),b}function b(E){return p>999||E===null||E===91||E===93&&!m||E===94&&!p&&"_hiddenFootnoteSupport"in c.parser.constructs?r(E):E===93?(e.exit(u),e.enter(s),e.consume(E),e.exit(s),e.exit(l),a):me(E)?(e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),b):(e.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===null||E===91||E===93||me(E)||p++>999?(e.exit("chunkString"),b(E)):(e.consume(E),m||(m=!xe(E)),E===92?S:h)}function S(E){return E===91||E===92||E===93?(e.consume(E),p++,h):h(E)}}function QT(e,a,r,l,s,u){let c;return p;function p(S){return S===34||S===39||S===40?(e.enter(l),e.enter(s),e.consume(S),e.exit(s),c=S===40?41:S,m):r(S)}function m(S){return S===c?(e.enter(s),e.consume(S),e.exit(s),e.exit(l),a):(e.enter(u),f(S))}function f(S){return S===c?(e.exit(u),m(c)):S===null?r(S):me(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),Oe(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(S))}function b(S){return S===c||S===null||me(S)?(e.exit("chunkString"),f(S)):(e.consume(S),S===92?h:b)}function h(S){return S===c||S===92?(e.consume(S),b):b(S)}}function Xi(e,a){let r;return l;function l(s){return me(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,l):xe(s)?Oe(e,l,r?"linePrefix":"lineSuffix")(s):a(s)}}const wN={name:"definition",tokenize:kN},_N={partial:!0,tokenize:xN};function kN(e,a,r){const l=this;let s;return u;function u(E){return e.enter("definition"),c(E)}function c(E){return KT.call(l,e,p,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(E)}function p(E){return s=gn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),m):r(E)}function m(E){return Ve(E)?Xi(e,f)(E):f(E)}function f(E){return ZT(e,b,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(E)}function b(E){return e.attempt(_N,h,h)(E)}function h(E){return xe(E)?Oe(e,S,"whitespace")(E):S(E)}function S(E){return E===null||me(E)?(e.exit("definition"),l.parser.defined.push(s),a(E)):r(E)}}function xN(e,a,r){return l;function l(p){return Ve(p)?Xi(e,s)(p):r(p)}function s(p){return QT(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(p)}function u(p){return xe(p)?Oe(e,c,"whitespace")(p):c(p)}function c(p){return p===null||me(p)?a(p):r(p)}}const RN={name:"hardBreakEscape",tokenize:NN};function NN(e,a,r){return l;function l(u){return e.enter("hardBreakEscape"),e.consume(u),s}function s(u){return me(u)?(e.exit("hardBreakEscape"),a(u)):r(u)}}const CN={name:"headingAtx",resolve:IN,tokenize:ON};function IN(e,a){let r=e.length-2,l=3,s,u;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(s={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},u={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},Yt(e,l,r-l+1,[["enter",s,a],["enter",u,a],["exit",u,a],["exit",s,a]])),e}function ON(e,a,r){let l=0;return s;function s(b){return e.enter("atxHeading"),u(b)}function u(b){return e.enter("atxHeadingSequence"),c(b)}function c(b){return b===35&&l++<6?(e.consume(b),c):b===null||Ve(b)?(e.exit("atxHeadingSequence"),p(b)):r(b)}function p(b){return b===35?(e.enter("atxHeadingSequence"),m(b)):b===null||me(b)?(e.exit("atxHeading"),a(b)):xe(b)?Oe(e,p,"whitespace")(b):(e.enter("atxHeadingText"),f(b))}function m(b){return b===35?(e.consume(b),m):(e.exit("atxHeadingSequence"),p(b))}function f(b){return b===null||b===35||Ve(b)?(e.exit("atxHeadingText"),p(b)):(e.consume(b),f)}}const LN=["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"],xv=["pre","script","style","textarea"],DN={concrete:!0,name:"htmlFlow",resolveTo:BN,tokenize:FN},MN={partial:!0,tokenize:GN},UN={partial:!0,tokenize:zN};function BN(e){let a=e.length;for(;a--&&!(e[a][0]==="enter"&&e[a][1].type==="htmlFlow"););return a>1&&e[a-2][1].type==="linePrefix"&&(e[a][1].start=e[a-2][1].start,e[a+1][1].start=e[a-2][1].start,e.splice(a-2,2)),e}function FN(e,a,r){const l=this;let s,u,c,p,m;return f;function f(k){return b(k)}function b(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),h}function h(k){return k===33?(e.consume(k),S):k===47?(e.consume(k),u=!0,x):k===63?(e.consume(k),s=3,l.interrupt?a:R):kt(k)?(e.consume(k),c=String.fromCharCode(k),_):r(k)}function S(k){return k===45?(e.consume(k),s=2,E):k===91?(e.consume(k),s=5,p=0,v):kt(k)?(e.consume(k),s=4,l.interrupt?a:R):r(k)}function E(k){return k===45?(e.consume(k),l.interrupt?a:R):r(k)}function v(k){const se="CDATA[";return k===se.charCodeAt(p++)?(e.consume(k),p===se.length?l.interrupt?a:ee:v):r(k)}function x(k){return kt(k)?(e.consume(k),c=String.fromCharCode(k),_):r(k)}function _(k){if(k===null||k===47||k===62||Ve(k)){const se=k===47,ge=c.toLowerCase();return!se&&!u&&xv.includes(ge)?(s=1,l.interrupt?a(k):ee(k)):LN.includes(c.toLowerCase())?(s=6,se?(e.consume(k),w):l.interrupt?a(k):ee(k)):(s=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(k):u?C(k):I(k))}return k===45||Et(k)?(e.consume(k),c+=String.fromCharCode(k),_):r(k)}function w(k){return k===62?(e.consume(k),l.interrupt?a:ee):r(k)}function C(k){return xe(k)?(e.consume(k),C):B(k)}function I(k){return k===47?(e.consume(k),B):k===58||k===95||kt(k)?(e.consume(k),P):xe(k)?(e.consume(k),I):B(k)}function P(k){return k===45||k===46||k===58||k===95||Et(k)?(e.consume(k),P):V(k)}function V(k){return k===61?(e.consume(k),M):xe(k)?(e.consume(k),V):I(k)}function M(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),m=k,W):xe(k)?(e.consume(k),M):ae(k)}function W(k){return k===m?(e.consume(k),m=null,oe):k===null||me(k)?r(k):(e.consume(k),W)}function ae(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Ve(k)?V(k):(e.consume(k),ae)}function oe(k){return k===47||k===62||xe(k)?I(k):r(k)}function B(k){return k===62?(e.consume(k),te):r(k)}function te(k){return k===null||me(k)?ee(k):xe(k)?(e.consume(k),te):r(k)}function ee(k){return k===45&&s===2?(e.consume(k),F):k===60&&s===1?(e.consume(k),Q):k===62&&s===4?(e.consume(k),L):k===63&&s===3?(e.consume(k),R):k===93&&s===5?(e.consume(k),be):me(k)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(MN,q,ie)(k)):k===null||me(k)?(e.exit("htmlFlowData"),ie(k)):(e.consume(k),ee)}function ie(k){return e.check(UN,re,q)(k)}function re(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),J}function J(k){return k===null||me(k)?ie(k):(e.enter("htmlFlowData"),ee(k))}function F(k){return k===45?(e.consume(k),R):ee(k)}function Q(k){return k===47?(e.consume(k),c="",ue):ee(k)}function ue(k){if(k===62){const se=c.toLowerCase();return xv.includes(se)?(e.consume(k),L):ee(k)}return kt(k)&&c.length<8?(e.consume(k),c+=String.fromCharCode(k),ue):ee(k)}function be(k){return k===93?(e.consume(k),R):ee(k)}function R(k){return k===62?(e.consume(k),L):k===45&&s===2?(e.consume(k),R):ee(k)}function L(k){return k===null||me(k)?(e.exit("htmlFlowData"),q(k)):(e.consume(k),L)}function q(k){return e.exit("htmlFlow"),a(k)}}function zN(e,a,r){const l=this;return s;function s(c){return me(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return l.parser.lazy[l.now().line]?r(c):a(c)}}function GN(e,a,r){return l;function l(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(sl,a,r)}}const jN={name:"htmlText",tokenize:HN};function HN(e,a,r){const l=this;let s,u,c;return p;function p(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),m}function m(R){return R===33?(e.consume(R),f):R===47?(e.consume(R),V):R===63?(e.consume(R),I):kt(R)?(e.consume(R),ae):r(R)}function f(R){return R===45?(e.consume(R),b):R===91?(e.consume(R),u=0,v):kt(R)?(e.consume(R),C):r(R)}function b(R){return R===45?(e.consume(R),E):r(R)}function h(R){return R===null?r(R):R===45?(e.consume(R),S):me(R)?(c=h,Q(R)):(e.consume(R),h)}function S(R){return R===45?(e.consume(R),E):h(R)}function E(R){return R===62?F(R):R===45?S(R):h(R)}function v(R){const L="CDATA[";return R===L.charCodeAt(u++)?(e.consume(R),u===L.length?x:v):r(R)}function x(R){return R===null?r(R):R===93?(e.consume(R),_):me(R)?(c=x,Q(R)):(e.consume(R),x)}function _(R){return R===93?(e.consume(R),w):x(R)}function w(R){return R===62?F(R):R===93?(e.consume(R),w):x(R)}function C(R){return R===null||R===62?F(R):me(R)?(c=C,Q(R)):(e.consume(R),C)}function I(R){return R===null?r(R):R===63?(e.consume(R),P):me(R)?(c=I,Q(R)):(e.consume(R),I)}function P(R){return R===62?F(R):I(R)}function V(R){return kt(R)?(e.consume(R),M):r(R)}function M(R){return R===45||Et(R)?(e.consume(R),M):W(R)}function W(R){return me(R)?(c=W,Q(R)):xe(R)?(e.consume(R),W):F(R)}function ae(R){return R===45||Et(R)?(e.consume(R),ae):R===47||R===62||Ve(R)?oe(R):r(R)}function oe(R){return R===47?(e.consume(R),F):R===58||R===95||kt(R)?(e.consume(R),B):me(R)?(c=oe,Q(R)):xe(R)?(e.consume(R),oe):F(R)}function B(R){return R===45||R===46||R===58||R===95||Et(R)?(e.consume(R),B):te(R)}function te(R){return R===61?(e.consume(R),ee):me(R)?(c=te,Q(R)):xe(R)?(e.consume(R),te):oe(R)}function ee(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),s=R,ie):me(R)?(c=ee,Q(R)):xe(R)?(e.consume(R),ee):(e.consume(R),re)}function ie(R){return R===s?(e.consume(R),s=void 0,J):R===null?r(R):me(R)?(c=ie,Q(R)):(e.consume(R),ie)}function re(R){return R===null||R===34||R===39||R===60||R===61||R===96?r(R):R===47||R===62||Ve(R)?oe(R):(e.consume(R),re)}function J(R){return R===47||R===62||Ve(R)?oe(R):r(R)}function F(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),a):r(R)}function Q(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ue}function ue(R){return xe(R)?Oe(e,be,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):be(R)}function be(R){return e.enter("htmlTextData"),c(R)}}const Ud={name:"labelEnd",resolveAll:VN,resolveTo:YN,tokenize:WN},$N={tokenize:XN},PN={tokenize:ZN},qN={tokenize:KN};function VN(e){let a=-1;const r=[];for(;++a<e.length;){const l=e[a][1];if(r.push(e[a]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const s=l.type==="labelImage"?4:2;l.type="data",a+=s}}return e.length!==r.length&&Yt(e,0,e.length,r),e}function YN(e,a){let r=e.length,l=0,s,u,c,p;for(;r--;)if(s=e[r][1],u){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(u=r,s.type!=="labelLink")){l=2;break}}else s.type==="labelEnd"&&(c=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},b={type:"labelText",start:{...e[u+l+2][1].end},end:{...e[c-2][1].start}};return p=[["enter",m,a],["enter",f,a]],p=rn(p,e.slice(u+1,u+l+3)),p=rn(p,[["enter",b,a]]),p=rn(p,ns(a.parser.constructs.insideSpan.null,e.slice(u+l+4,c-3),a)),p=rn(p,[["exit",b,a],e[c-2],e[c-1],["exit",f,a]]),p=rn(p,e.slice(c+1)),p=rn(p,[["exit",m,a]]),Yt(e,u,e.length,p),e}function WN(e,a,r){const l=this;let s=l.events.length,u,c;for(;s--;)if((l.events[s][1].type==="labelImage"||l.events[s][1].type==="labelLink")&&!l.events[s][1]._balanced){u=l.events[s][1];break}return p;function p(S){return u?u._inactive?h(S):(c=l.parser.defined.includes(gn(l.sliceSerialize({start:u.end,end:l.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(S),e.exit("labelMarker"),e.exit("labelEnd"),m):r(S)}function m(S){return S===40?e.attempt($N,b,c?b:h)(S):S===91?e.attempt(PN,b,c?f:h)(S):c?b(S):h(S)}function f(S){return e.attempt(qN,b,h)(S)}function b(S){return a(S)}function h(S){return u._balanced=!0,r(S)}}function XN(e,a,r){return l;function l(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),s}function s(h){return Ve(h)?Xi(e,u)(h):u(h)}function u(h){return h===41?b(h):ZT(e,c,p,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function c(h){return Ve(h)?Xi(e,m)(h):b(h)}function p(h){return r(h)}function m(h){return h===34||h===39||h===40?QT(e,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):b(h)}function f(h){return Ve(h)?Xi(e,b)(h):b(h)}function b(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),a):r(h)}}function ZN(e,a,r){const l=this;return s;function s(p){return KT.call(l,e,u,c,"reference","referenceMarker","referenceString")(p)}function u(p){return l.parser.defined.includes(gn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?a(p):r(p)}function c(p){return r(p)}}function KN(e,a,r){return l;function l(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),s}function s(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),a):r(u)}}const QN={name:"labelStartImage",resolveAll:Ud.resolveAll,tokenize:JN};function JN(e,a,r){const l=this;return s;function s(p){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(p),e.exit("labelImageMarker"),u}function u(p){return p===91?(e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelImage"),c):r(p)}function c(p){return p===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(p):a(p)}}const eC={name:"labelStartLink",resolveAll:Ud.resolveAll,tokenize:tC};function tC(e,a,r){const l=this;return s;function s(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(c):a(c)}}const $c={name:"lineEnding",tokenize:nC};function nC(e,a){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Oe(e,a,"linePrefix")}}const Po={name:"thematicBreak",tokenize:aC};function aC(e,a,r){let l=0,s;return u;function u(f){return e.enter("thematicBreak"),c(f)}function c(f){return s=f,p(f)}function p(f){return f===s?(e.enter("thematicBreakSequence"),m(f)):l>=3&&(f===null||me(f))?(e.exit("thematicBreak"),a(f)):r(f)}function m(f){return f===s?(e.consume(f),l++,m):(e.exit("thematicBreakSequence"),xe(f)?Oe(e,p,"whitespace")(f):p(f))}}const Ut={continuation:{tokenize:oC},exit:uC,name:"list",tokenize:lC},rC={partial:!0,tokenize:cC},iC={partial:!0,tokenize:sC};function lC(e,a,r){const l=this,s=l.events[l.events.length-1];let u=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return p;function p(E){const v=l.containerState.type||(E===42||E===43||E===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!l.containerState.marker||E===l.containerState.marker:ud(E)){if(l.containerState.type||(l.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),E===42||E===45?e.check(Po,r,f)(E):f(E);if(!l.interrupt||E===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(E)}return r(E)}function m(E){return ud(E)&&++c<10?(e.consume(E),m):(!l.interrupt||c<2)&&(l.containerState.marker?E===l.containerState.marker:E===41||E===46)?(e.exit("listItemValue"),f(E)):r(E)}function f(E){return e.enter("listItemMarker"),e.consume(E),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||E,e.check(sl,l.interrupt?r:b,e.attempt(rC,S,h))}function b(E){return l.containerState.initialBlankLine=!0,u++,S(E)}function h(E){return xe(E)?(e.enter("listItemPrefixWhitespace"),e.consume(E),e.exit("listItemPrefixWhitespace"),S):r(E)}function S(E){return l.containerState.size=u+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,a(E)}}function oC(e,a,r){const l=this;return l.containerState._closeFlow=void 0,e.check(sl,s,u);function s(p){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Oe(e,a,"listItemIndent",l.containerState.size+1)(p)}function u(p){return l.containerState.furtherBlankLines||!xe(p)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,c(p)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(iC,a,c)(p))}function c(p){return l.containerState._closeFlow=!0,l.interrupt=void 0,Oe(e,e.attempt(Ut,a,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p)}}function sC(e,a,r){const l=this;return Oe(e,s,"listItemIndent",l.containerState.size+1);function s(u){const c=l.events[l.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===l.containerState.size?a(u):r(u)}}function uC(e){e.exit(this.containerState.type)}function cC(e,a,r){const l=this;return Oe(e,s,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(u){const c=l.events[l.events.length-1];return!xe(u)&&c&&c[1].type==="listItemPrefixWhitespace"?a(u):r(u)}}const Rv={name:"setextUnderline",resolveTo:dC,tokenize:pC};function dC(e,a){let r=e.length,l,s,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",u?(e.splice(s,0,["enter",c,a]),e.splice(u+1,0,["exit",e[l][1],a]),e[l][1].end={...e[u][1].end}):e[l][1]=c,e.push(["exit",c,a]),e}function pC(e,a,r){const l=this;let s;return u;function u(f){let b=l.events.length,h;for(;b--;)if(l.events[b][1].type!=="lineEnding"&&l.events[b][1].type!=="linePrefix"&&l.events[b][1].type!=="content"){h=l.events[b][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||h)?(e.enter("setextHeadingLine"),s=f,c(f)):r(f)}function c(f){return e.enter("setextHeadingLineSequence"),p(f)}function p(f){return f===s?(e.consume(f),p):(e.exit("setextHeadingLineSequence"),xe(f)?Oe(e,m,"lineSuffix")(f):m(f))}function m(f){return f===null||me(f)?(e.exit("setextHeadingLine"),a(f)):r(f)}}const fC={tokenize:gC};function gC(e){const a=this,r=e.attempt(sl,l,e.attempt(this.parser.constructs.flowInitial,s,Oe(e,e.attempt(this.parser.constructs.flow,s,e.attempt(EN,s)),"linePrefix")));return r;function l(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),a.currentConstruct=void 0,r}function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a.currentConstruct=void 0,r}}const mC={resolveAll:eA()},hC=JT("string"),bC=JT("text");function JT(e){return{resolveAll:eA(e==="text"?yC:void 0),tokenize:a};function a(r){const l=this,s=this.parser.constructs[e],u=r.attempt(s,c,p);return c;function c(b){return f(b)?u(b):p(b)}function p(b){if(b===null){r.consume(b);return}return r.enter("data"),r.consume(b),m}function m(b){return f(b)?(r.exit("data"),u(b)):(r.consume(b),m)}function f(b){if(b===null)return!0;const h=s[b];let S=-1;if(h)for(;++S<h.length;){const E=h[S];if(!E.previous||E.previous.call(l,l.previous))return!0}return!1}}}function eA(e){return a;function a(r,l){let s=-1,u;for(;++s<=r.length;)u===void 0?r[s]&&r[s][1].type==="data"&&(u=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==u+2&&(r[u][1].end=r[s-1][1].end,r.splice(u+2,s-u-2),s=u+2),u=void 0);return e?e(r,l):r}}function yC(e,a){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const l=e[r-1][1],s=a.sliceStream(l);let u=s.length,c=-1,p=0,m;for(;u--;){const f=s[u];if(typeof f=="string"){for(c=f.length;f.charCodeAt(c-1)===32;)p++,c--;if(c)break;c=-1}else if(f===-2)m=!0,p++;else if(f!==-1){u++;break}}if(a._contentTypeTextTrailing&&r===e.length&&(p=0),p){const f={type:r===e.length||m||p<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:l.start._bufferIndex+c,_index:l.start._index+u,line:l.end.line,column:l.end.column-p,offset:l.end.offset-p},end:{...l.end}};l.end={...f.start},l.start.offset===l.end.offset?Object.assign(l,f):(e.splice(r,0,["enter",f,a],["exit",f,a]),r+=2)}r++}return e}const EC={42:Ut,43:Ut,45:Ut,48:Ut,49:Ut,50:Ut,51:Ut,52:Ut,53:Ut,54:Ut,55:Ut,56:Ut,57:Ut,62:VT},SC={91:wN},vC={[-2]:Hc,[-1]:Hc,32:Hc},TC={35:CN,42:Po,45:[Rv,Po],60:DN,61:Rv,95:Po,96:kv,126:kv},AC={38:WT,92:YT},wC={[-5]:$c,[-4]:$c,[-3]:$c,33:QN,38:WT,42:cd,60:[eN,jN],91:eC,92:[RN,YT],93:Ud,95:cd,96:fN},_C={null:[cd,mC]},kC={null:[42,95]},xC={null:[]},RC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kC,contentInitial:SC,disable:xC,document:EC,flow:TC,flowInitial:vC,insideSpan:_C,string:AC,text:wC},Symbol.toStringTag,{value:"Module"}));function NC(e,a,r){let l={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},u=[];let c=[],p=[];const m={attempt:W(V),check:W(M),consume:C,enter:I,exit:P,interrupt:W(M,{interrupt:!0})},f={code:null,containerState:{},defineSkip:x,events:[],now:v,parser:e,previous:null,sliceSerialize:S,sliceStream:E,write:h};let b=a.tokenize.call(f,m);return a.resolveAll&&u.push(a),f;function h(te){return c=rn(c,te),_(),c[c.length-1]!==null?[]:(ae(a,0),f.events=ns(u,f.events,f),f.events)}function S(te,ee){return IC(E(te),ee)}function E(te){return CC(c,te)}function v(){const{_bufferIndex:te,_index:ee,line:ie,column:re,offset:J}=l;return{_bufferIndex:te,_index:ee,line:ie,column:re,offset:J}}function x(te){s[te.line]=te.column,B()}function _(){let te;for(;l._index<c.length;){const ee=c[l._index];if(typeof ee=="string")for(te=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===te&&l._bufferIndex<ee.length;)w(ee.charCodeAt(l._bufferIndex));else w(ee)}}function w(te){b=b(te)}function C(te){me(te)?(l.line++,l.column=1,l.offset+=te===-3?2:1,B()):te!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===c[l._index].length&&(l._bufferIndex=-1,l._index++)),f.previous=te}function I(te,ee){const ie=ee||{};return ie.type=te,ie.start=v(),f.events.push(["enter",ie,f]),p.push(ie),ie}function P(te){const ee=p.pop();return ee.end=v(),f.events.push(["exit",ee,f]),ee}function V(te,ee){ae(te,ee.from)}function M(te,ee){ee.restore()}function W(te,ee){return ie;function ie(re,J,F){let Q,ue,be,R;return Array.isArray(re)?q(re):"tokenize"in re?q([re]):L(re);function L(pe){return Ae;function Ae(Ge){const Ue=Ge!==null&&pe[Ge],xt=Ge!==null&&pe.null,un=[...Array.isArray(Ue)?Ue:Ue?[Ue]:[],...Array.isArray(xt)?xt:xt?[xt]:[]];return q(un)(Ge)}}function q(pe){return Q=pe,ue=0,pe.length===0?F:k(pe[ue])}function k(pe){return Ae;function Ae(Ge){return R=oe(),be=pe,pe.partial||(f.currentConstruct=pe),pe.name&&f.parser.constructs.disable.null.includes(pe.name)?ge():pe.tokenize.call(ee?Object.assign(Object.create(f),ee):f,m,se,ge)(Ge)}}function se(pe){return te(be,R),J}function ge(pe){return R.restore(),++ue<Q.length?k(Q[ue]):F}}}function ae(te,ee){te.resolveAll&&!u.includes(te)&&u.push(te),te.resolve&&Yt(f.events,ee,f.events.length-ee,te.resolve(f.events.slice(ee),f)),te.resolveTo&&(f.events=te.resolveTo(f.events,f))}function oe(){const te=v(),ee=f.previous,ie=f.currentConstruct,re=f.events.length,J=Array.from(p);return{from:re,restore:F};function F(){l=te,f.previous=ee,f.currentConstruct=ie,f.events.length=re,p=J,B()}}function B(){l.line in s&&l.column<2&&(l.column=s[l.line],l.offset+=s[l.line]-1)}}function CC(e,a){const r=a.start._index,l=a.start._bufferIndex,s=a.end._index,u=a.end._bufferIndex;let c;if(r===s)c=[e[r].slice(l,u)];else{if(c=e.slice(r,s),l>-1){const p=c[0];typeof p=="string"?c[0]=p.slice(l):c.shift()}u>0&&c.push(e[s].slice(0,u))}return c}function IC(e,a){let r=-1;const l=[];let s;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
62
62
  `;break}case-3:{c=`\r
63
63
  `;break}case-2:{c=a?" ":" ";break}case-1:{if(!a&&s)continue;c=" ";break}default:c=String.fromCharCode(u)}s=u===-2,l.push(c)}return l.join("")}function OC(e){const l={constructs:PT([RC,...(e||{}).extensions||[]]),content:s(YR),defined:[],document:s(XR),flow:s(fC),lazy:{},string:s(hC),text:s(bC)};return l;function s(u){return c;function c(p){return NC(l,u,p)}}}function LC(e){for(;!XT(e););return e}const Nv=/[\0\t\n\r]/g;function DC(){let e=1,a="",r=!0,l;return s;function s(u,c,p){const m=[];let f,b,h,S,E;for(u=a+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),h=0,a="",r&&(u.charCodeAt(0)===65279&&h++,r=void 0);h<u.length;){if(Nv.lastIndex=h,f=Nv.exec(u),S=f&&f.index!==void 0?f.index:u.length,E=u.charCodeAt(S),!f){a=u.slice(h);break}if(E===10&&h===S&&l)m.push(-3),l=void 0;else switch(l&&(m.push(-5),l=void 0),h<S&&(m.push(u.slice(h,S)),e+=S-h),E){case 0:{m.push(65533),e++;break}case 9:{for(b=Math.ceil(e/4)*4,m.push(-2);e++<b;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:l=!0,e=1}h=S+1}return p&&(l&&m.push(-5),a&&m.push(a),m.push(null)),m}}const MC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function UC(e){return e.replace(MC,BC)}function BC(e,a,r){if(a)return a;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),u=s===120||s===88;return qT(r.slice(u?2:1),u?16:10)}return tl(r)||e}const tA={}.hasOwnProperty;function FC(e,a,r){return a&&typeof a=="object"&&(r=a,a=void 0),zC(r)(LC(OC(r).document().write(DC()(e,a,!0))))}function zC(e){const a={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Va),autolinkProtocol:oe,autolinkEmail:oe,atxHeading:u(Pa),blockQuote:u(xt),characterEscape:oe,characterReference:oe,codeFenced:u(un),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(un,c),codeText:u(Wr,c),codeTextData:oe,data:oe,codeFlowValue:oe,definition:u(hl),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(_n),hardBreakEscape:u(qa),hardBreakTrailing:u(qa),htmlFlow:u(bl,c),htmlFlowData:oe,htmlText:u(bl,c),htmlTextData:oe,image:u(yl),label:c,link:u(Va),listItem:u(Xr),listItemValue:S,listOrdered:u(Ya,h),listUnordered:u(Ya),paragraph:u(ms),reference:k,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(Pa),strong:u(hs),thematicBreak:u(bs)},exit:{atxHeading:m(),atxHeadingSequence:V,autolink:m(),autolinkEmail:Ue,autolinkProtocol:Ge,blockQuote:m(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:pe,characterReference:Ae,codeFenced:m(_),codeFencedFence:x,codeFencedFenceInfo:E,codeFencedFenceMeta:v,codeFlowValue:B,codeIndented:m(w),codeText:m(J),codeTextData:B,data:B,definition:m(),definitionDestinationString:P,definitionLabelString:C,definitionTitleString:I,emphasis:m(),hardBreakEscape:m(ee),hardBreakTrailing:m(ee),htmlFlow:m(ie),htmlFlowData:B,htmlText:m(re),htmlTextData:B,image:m(Q),label:be,labelText:ue,lineEnding:te,link:m(F),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:se,resourceDestinationString:R,resourceTitleString:L,resource:q,setextHeading:m(ae),setextHeadingLineSequence:W,setextHeadingText:M,strong:m(),thematicBreak:m()}};nA(a,(e||{}).mdastExtensions||[]);const r={};return l;function l(X){let le={type:"root",children:[]};const ye={stack:[le],tokenStack:[],config:a,enter:p,exit:f,buffer:c,resume:b,data:r},we=[];let Be=-1;for(;++Be<X.length;)if(X[Be][1].type==="listOrdered"||X[Be][1].type==="listUnordered")if(X[Be][0]==="enter")we.push(Be);else{const Ft=we.pop();Be=s(X,Ft,Be)}for(Be=-1;++Be<X.length;){const Ft=a[X[Be][0]];tA.call(Ft,X[Be][1].type)&&Ft[X[Be][1].type].call(Object.assign({sliceSerialize:X[Be][2].sliceSerialize},ye),X[Be][1])}if(ye.tokenStack.length>0){const Ft=ye.tokenStack[ye.tokenStack.length-1];(Ft[1]||Cv).call(ye,void 0,Ft[0])}for(le.position={start:ya(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:ya(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},Be=-1;++Be<a.transforms.length;)le=a.transforms[Be](le)||le;return le}function s(X,le,ye){let we=le-1,Be=-1,Ft=!1,kn,wt,ot,Rt;for(;++we<=ye;){const Pe=X[we];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?Be++:Be--,Rt=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(kn&&!Rt&&!Be&&!ot&&(ot=we),Rt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Rt=void 0}if(!Be&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||Be===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(kn){let Yn=we;for(wt=void 0;Yn--;){const cn=X[Yn];if(cn[1].type==="lineEnding"||cn[1].type==="lineEndingBlank"){if(cn[0]==="exit")continue;wt&&(X[wt][1].type="lineEndingBlank",Ft=!0),cn[1].type="lineEnding",wt=Yn}else if(!(cn[1].type==="linePrefix"||cn[1].type==="blockQuotePrefix"||cn[1].type==="blockQuotePrefixWhitespace"||cn[1].type==="blockQuoteMarker"||cn[1].type==="listItemIndent"))break}ot&&(!wt||ot<wt)&&(kn._spread=!0),kn.end=Object.assign({},wt?X[wt][1].start:Pe[1].end),X.splice(wt||we,0,["exit",kn,Pe[2]]),we++,ye++}if(Pe[1].type==="listItemPrefix"){const Yn={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};kn=Yn,X.splice(we,0,["enter",Yn,Pe[2]]),we++,ye++,ot=void 0,Rt=!0}}}return X[le][1]._spread=Ft,ye}function u(X,le){return ye;function ye(we){p.call(this,X(we),we),le&&le.call(this,we)}}function c(){this.stack.push({type:"fragment",children:[]})}function p(X,le,ye){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([le,ye||void 0]),X.position={start:ya(le.start),end:void 0}}function m(X){return le;function le(ye){X&&X.call(this,ye),f.call(this,ye)}}function f(X,le){const ye=this.stack.pop(),we=this.tokenStack.pop();if(we)we[0].type!==X.type&&(le?le.call(this,X,we[0]):(we[1]||Cv).call(this,X,we[0]));else throw new Error("Cannot close `"+X.type+"` ("+Wi({start:X.start,end:X.end})+"): it’s not open");ye.position.end=ya(X.end)}function b(){return Md(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function S(X){if(this.data.expectingFirstListItemValue){const le=this.stack[this.stack.length-2];le.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function E(){const X=this.resume(),le=this.stack[this.stack.length-1];le.lang=X}function v(){const X=this.resume(),le=this.stack[this.stack.length-1];le.meta=X}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const X=this.resume(),le=this.stack[this.stack.length-1];le.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const X=this.resume(),le=this.stack[this.stack.length-1];le.value=X.replace(/(\r?\n|\r)$/g,"")}function C(X){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.label=le,ye.identifier=gn(this.sliceSerialize(X)).toLowerCase()}function I(){const X=this.resume(),le=this.stack[this.stack.length-1];le.title=X}function P(){const X=this.resume(),le=this.stack[this.stack.length-1];le.url=X}function V(X){const le=this.stack[this.stack.length-1];if(!le.depth){const ye=this.sliceSerialize(X).length;le.depth=ye}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function W(X){const le=this.stack[this.stack.length-1];le.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function ae(){this.data.setextHeadingSlurpLineEnding=void 0}function oe(X){const ye=this.stack[this.stack.length-1].children;let we=ye[ye.length-1];(!we||we.type!=="text")&&(we=At(),we.position={start:ya(X.start),end:void 0},ye.push(we)),this.stack.push(we)}function B(X){const le=this.stack.pop();le.value+=this.sliceSerialize(X),le.position.end=ya(X.end)}function te(X){const le=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ye=le.children[le.children.length-1];ye.position.end=ya(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&a.canContainEols.includes(le.type)&&(oe.call(this,X),B.call(this,X))}function ee(){this.data.atHardBreak=!0}function ie(){const X=this.resume(),le=this.stack[this.stack.length-1];le.value=X}function re(){const X=this.resume(),le=this.stack[this.stack.length-1];le.value=X}function J(){const X=this.resume(),le=this.stack[this.stack.length-1];le.value=X}function F(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=le,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function Q(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=le,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function ue(X){const le=this.sliceSerialize(X),ye=this.stack[this.stack.length-2];ye.label=UC(le),ye.identifier=gn(le).toLowerCase()}function be(){const X=this.stack[this.stack.length-1],le=this.resume(),ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,ye.type==="link"){const we=X.children;ye.children=we}else ye.alt=le}function R(){const X=this.resume(),le=this.stack[this.stack.length-1];le.url=X}function L(){const X=this.resume(),le=this.stack[this.stack.length-1];le.title=X}function q(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function se(X){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.label=le,ye.identifier=gn(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function ge(X){this.data.characterReferenceType=X.type}function pe(X){const le=this.sliceSerialize(X),ye=this.data.characterReferenceType;let we;ye?(we=qT(le,ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=tl(le);const Be=this.stack[this.stack.length-1];Be.value+=we}function Ae(X){const le=this.stack.pop();le.position.end=ya(X.end)}function Ge(X){B.call(this,X);const le=this.stack[this.stack.length-1];le.url=this.sliceSerialize(X)}function Ue(X){B.call(this,X);const le=this.stack[this.stack.length-1];le.url="mailto:"+this.sliceSerialize(X)}function xt(){return{type:"blockquote",children:[]}}function un(){return{type:"code",lang:null,meta:null,value:""}}function Wr(){return{type:"inlineCode",value:""}}function hl(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _n(){return{type:"emphasis",children:[]}}function Pa(){return{type:"heading",depth:0,children:[]}}function qa(){return{type:"break"}}function bl(){return{type:"html",value:""}}function yl(){return{type:"image",title:null,url:"",alt:null}}function Va(){return{type:"link",title:null,url:"",children:[]}}function Ya(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function Xr(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function ms(){return{type:"paragraph",children:[]}}function hs(){return{type:"strong",children:[]}}function At(){return{type:"text",value:""}}function bs(){return{type:"thematicBreak"}}}function ya(e){return{line:e.line,column:e.column,offset:e.offset}}function nA(e,a){let r=-1;for(;++r<a.length;){const l=a[r];Array.isArray(l)?nA(e,l):GC(e,l)}}function GC(e,a){let r;for(r in a)if(tA.call(a,r))switch(r){case"canContainEols":{const l=a[r];l&&e[r].push(...l);break}case"transforms":{const l=a[r];l&&e[r].push(...l);break}case"enter":case"exit":{const l=a[r];l&&Object.assign(e[r],l);break}}}function Cv(e,a){throw e?new Error("Cannot close `"+e.type+"` ("+Wi({start:e.start,end:e.end})+"): a different token (`"+a.type+"`, "+Wi({start:a.start,end:a.end})+") is open"):new Error("Cannot close document, a token (`"+a.type+"`, "+Wi({start:a.start,end:a.end})+") is still open")}function jC(e){const a=this;a.parser=r;function r(l){return FC(l,{...a.data("settings"),...e,extensions:a.data("micromarkExtensions")||[],mdastExtensions:a.data("fromMarkdownExtensions")||[]})}}function HC(e,a){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(a),!0)};return e.patch(a,r),e.applyData(a,r)}function $C(e,a){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(a,r),[e.applyData(a,r),{type:"text",value:`
@@ -7,7 +7,7 @@
7
7
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
8
8
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300..700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
9
9
  <title>Stashes</title>
10
- <script type="module" crossorigin src="/assets/index-B_zUoAAw.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-UA2jC93u.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/index-CxWNsyTv.css">
12
12
  </head>
13
13
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stashes",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "type": "module",
5
5
  "description": "Generate AI-powered UI design explorations in your project",
6
6
  "keywords": [