stashes 0.1.58 → 0.1.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -545,6 +545,31 @@ class PersistenceService {
545
545
  // ../core/dist/ai-process.js
546
546
  var {spawn } = globalThis.Bun;
547
547
  var CLAUDE_BIN = "/opt/homebrew/bin/claude";
548
+ var OVERHEAD_TOOLS = [
549
+ "Agent",
550
+ "TodoWrite",
551
+ "TaskCreate",
552
+ "TaskUpdate",
553
+ "TaskList",
554
+ "TaskGet",
555
+ "Skill",
556
+ "ToolSearch",
557
+ "EnterPlanMode",
558
+ "ExitPlanMode",
559
+ "WebSearch",
560
+ "WebFetch",
561
+ "NotebookEdit",
562
+ "LSP",
563
+ "Read",
564
+ "Write",
565
+ "Edit",
566
+ "Glob",
567
+ "Grep",
568
+ "mcp__UseAI__*",
569
+ "mcp__stashes__*",
570
+ "mcp__plugin_drills*",
571
+ "mcp__plugin_coverit*"
572
+ ];
548
573
  var processes = new Map;
549
574
  function startAiProcess(idOrOpts, prompt, cwd, resumeSessionId, model) {
550
575
  const opts = typeof idOrOpts === "string" ? { id: idOrOpts, prompt, cwd, resumeSessionId, model } : idOrOpts;
@@ -557,6 +582,9 @@ function startAiProcess(idOrOpts, prompt, cwd, resumeSessionId, model) {
557
582
  model: opts.model
558
583
  });
559
584
  const cmd = [CLAUDE_BIN, "-p", opts.prompt, "--output-format=stream-json", "--verbose", "--dangerously-skip-permissions"];
585
+ if (opts.disableOverheadTools) {
586
+ cmd.push("--disallowedTools", OVERHEAD_TOOLS.join(","));
587
+ }
560
588
  if (opts.resumeSessionId) {
561
589
  cmd.push("--resume", opts.resumeSessionId);
562
590
  }
@@ -874,7 +902,8 @@ async function captureSmartScreenshots(opts) {
874
902
  id: processId,
875
903
  prompt,
876
904
  cwd: worktreePath,
877
- model: modelFlag
905
+ model: modelFlag,
906
+ disableOverheadTools: true
878
907
  });
879
908
  let textOutput = "";
880
909
  let timedOut = false;
@@ -2180,7 +2209,8 @@ ${sourceCode.substring(0, 3000)}
2180
2209
  type: "stash:status",
2181
2210
  stashId: stash.id,
2182
2211
  status: stash.status,
2183
- number: stash.number
2212
+ number: stash.number,
2213
+ prompt: stash.prompt
2184
2214
  });
2185
2215
  if (stash.screenshotUrl) {
2186
2216
  this.broadcast({
@@ -2212,7 +2242,8 @@ ${sourceCode.substring(0, 3000)}
2212
2242
  type: "stash:status",
2213
2243
  stashId: stash.id,
2214
2244
  status: stash.status,
2215
- number: stash.number
2245
+ number: stash.number,
2246
+ prompt: stash.prompt
2216
2247
  });
2217
2248
  if (stash.screenshotUrl && prev !== stash.status) {
2218
2249
  this.broadcast({
package/dist/mcp.js CHANGED
@@ -530,6 +530,31 @@ class PersistenceService {
530
530
  // ../core/dist/ai-process.js
531
531
  var {spawn } = globalThis.Bun;
532
532
  var CLAUDE_BIN = "/opt/homebrew/bin/claude";
533
+ var OVERHEAD_TOOLS = [
534
+ "Agent",
535
+ "TodoWrite",
536
+ "TaskCreate",
537
+ "TaskUpdate",
538
+ "TaskList",
539
+ "TaskGet",
540
+ "Skill",
541
+ "ToolSearch",
542
+ "EnterPlanMode",
543
+ "ExitPlanMode",
544
+ "WebSearch",
545
+ "WebFetch",
546
+ "NotebookEdit",
547
+ "LSP",
548
+ "Read",
549
+ "Write",
550
+ "Edit",
551
+ "Glob",
552
+ "Grep",
553
+ "mcp__UseAI__*",
554
+ "mcp__stashes__*",
555
+ "mcp__plugin_drills*",
556
+ "mcp__plugin_coverit*"
557
+ ];
533
558
  var processes = new Map;
534
559
  function startAiProcess(idOrOpts, prompt, cwd, resumeSessionId, model) {
535
560
  const opts = typeof idOrOpts === "string" ? { id: idOrOpts, prompt, cwd, resumeSessionId, model } : idOrOpts;
@@ -542,6 +567,9 @@ function startAiProcess(idOrOpts, prompt, cwd, resumeSessionId, model) {
542
567
  model: opts.model
543
568
  });
544
569
  const cmd = [CLAUDE_BIN, "-p", opts.prompt, "--output-format=stream-json", "--verbose", "--dangerously-skip-permissions"];
570
+ if (opts.disableOverheadTools) {
571
+ cmd.push("--disallowedTools", OVERHEAD_TOOLS.join(","));
572
+ }
545
573
  if (opts.resumeSessionId) {
546
574
  cmd.push("--resume", opts.resumeSessionId);
547
575
  }
@@ -859,7 +887,8 @@ async function captureSmartScreenshots(opts) {
859
887
  id: processId,
860
888
  prompt,
861
889
  cwd: worktreePath,
862
- model: modelFlag
890
+ model: modelFlag,
891
+ disableOverheadTools: true
863
892
  });
864
893
  let textOutput = "";
865
894
  let timedOut = false;
@@ -2404,7 +2433,8 @@ ${sourceCode.substring(0, 3000)}
2404
2433
  type: "stash:status",
2405
2434
  stashId: stash.id,
2406
2435
  status: stash.status,
2407
- number: stash.number
2436
+ number: stash.number,
2437
+ prompt: stash.prompt
2408
2438
  });
2409
2439
  if (stash.screenshotUrl) {
2410
2440
  this.broadcast({
@@ -2436,7 +2466,8 @@ ${sourceCode.substring(0, 3000)}
2436
2466
  type: "stash:status",
2437
2467
  stashId: stash.id,
2438
2468
  status: stash.status,
2439
- number: stash.number
2469
+ number: stash.number,
2470
+ prompt: stash.prompt
2440
2471
  });
2441
2472
  if (stash.screenshotUrl && prev !== stash.status) {
2442
2473
  this.broadcast({
@@ -57,7 +57,7 @@ Error generating stack: `+o.message+`
57
57
  * @license MIT
58
58
  */var nv="popstate";function av(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function vk(e={}){function a(l,s){var g;let u=(g=s.state)==null?void 0:g.masked,{pathname:c,search:d,hash:f}=u||l.location;return sd("",{pathname:c,search:d,hash:f},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:el(s)}return Tk(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 xk(){return Math.random().toString(36).substring(2,10)}function rv(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 sd(e,a,r=null,l,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof a=="string"?zr(a):a,state:r,key:a&&a.key||l||xk(),unstable_mask:s}}function el({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 zr(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 Tk(e,a,r,l={}){let{window:s=document.defaultView,v5Compat:u=!1}=l,c=s.history,d="POP",f=null,g=b();g==null&&(g=0,c.replaceState({...c.state,idx:g},""));function b(){return(c.state||{idx:null}).idx}function h(){d="POP";let A=b(),k=A==null?null:A-g;g=A,f&&f({action:d,location:w.location,delta:k})}function v(A,k){d="PUSH";let N=av(A)?A:sd(w.location,A,k);g=b()+1;let I=rv(N,g),j=w.createHref(N.unstable_mask||N);try{c.pushState(I,"",j)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;s.location.assign(j)}u&&f&&f({action:d,location:w.location,delta:1})}function E(A,k){d="REPLACE";let N=av(A)?A:sd(w.location,A,k);g=b();let I=rv(N,g),j=w.createHref(N.unstable_mask||N);c.replaceState(I,"",j),u&&f&&f({action:d,location:w.location,delta:0})}function x(A){return Ak(A)}let w={get action(){return d},get location(){return e(s,c)},listen(A){if(f)throw new Error("A history only accepts one active listener");return s.addEventListener(nv,h),f=A,()=>{s.removeEventListener(nv,h),f=null}},createHref(A){return a(s,A)},createURL:x,encodeLocation(A){let k=x(A);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:v,replace:E,go(A){return c.go(A)}};return w}function Ak(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:el(e);return l=l.replace(/ $/,"%20"),!a&&l.startsWith("//")&&(l=r+l),new URL(l,r)}function fx(e,a,r="/"){return wk(e,a,r,!1)}function wk(e,a,r,l){let s=typeof a=="string"?zr(a):a,u=qn(s.pathname||"/",r);if(u==null)return null;let c=gx(e);kk(c);let d=null;for(let f=0;d==null&&f<c.length;++f){let g=Bk(u);d=Mk(c[f],g,l)}return d}function gx(e,a=[],r=[],l="",s=!1){let u=(c,d,f=s,g)=>{let b={relativePath:g===void 0?c.path||"":g,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(l)&&f)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]),v=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}".`),gx(c.children,a,v,h,f)),!(c.path==null&&!c.index)&&a.push({path:h,score:Lk(h,c.index),routesMeta:v})};return e.forEach((c,d)=>{var f;if(c.path===""||!((f=c.path)!=null&&f.includes("?")))u(c,d);else for(let g of mx(c.path))u(c,d,!0,g)}),a}function mx(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=mx(l.join("/")),d=[];return d.push(...c.map(f=>f===""?u:[u,f].join("/"))),s&&d.push(...c),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function kk(e){e.sort((a,r)=>a.score!==r.score?r.score-a.score:Dk(a.routesMeta.map(l=>l.childrenIndex),r.routesMeta.map(l=>l.childrenIndex)))}var _k=/^:[\w-]+$/,Nk=3,Rk=2,Ck=1,Ik=10,Ok=-2,iv=e=>e==="*";function Lk(e,a){let r=e.split("/"),l=r.length;return r.some(iv)&&(l+=Ok),a&&(l+=Rk),r.filter(s=>!iv(s)).reduce((s,u)=>s+(_k.test(u)?Nk:u===""?Ck:Ik),l)}function Dk(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 Mk(e,a,r=!1){let{routesMeta:l}=e,s={},u="/",c=[];for(let d=0;d<l.length;++d){let f=l[d],g=d===l.length-1,b=u==="/"?a:a.slice(u.length)||"/",h=Qo({path:f.relativePath,caseSensitive:f.caseSensitive,end:g},b),v=f.route;if(!h&&g&&r&&!l[l.length-1].route.index&&(h=Qo({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},b)),!h)return null;Object.assign(s,h.params),c.push({params:s,pathname:Sn([u,h.pathname]),pathnameBase:Gk(Sn([u,h.pathnameBase])),route:v}),h.pathnameBase!=="/"&&(u=Sn([u,h.pathnameBase]))}return c}function Qo(e,a){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,l]=Uk(e.path,e.caseSensitive,e.end),s=a.match(r);if(!s)return null;let u=s[0],c=u.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:l.reduce((g,{paramName:b,isOptional:h},v)=>{if(b==="*"){let x=d[v]||"";c=u.slice(0,u.length-x.length).replace(/(.)\/+$/,"$1")}const E=d[v];return h&&!E?g[b]=void 0:g[b]=(E||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:c,pattern:e}}function Uk(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,d,f,g,b)=>{if(l.push({paramName:d,isOptional:f!=null}),f){let h=b.charAt(g+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 Bk(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 Fk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function zk(e,a="/"){let{pathname:r,search:l="",hash:s=""}=typeof e=="string"?zr(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=lv(r.substring(1),"/"):u=lv(r,a)):u=a,{pathname:u,search:$k(l),hash:Hk(s)}}function lv(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 Gc(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 jk(e){return e.filter((a,r)=>r===0||a.route.path&&a.route.path.length>0)}function hx(e){let a=jk(e);return a.map((r,l)=>l===a.length-1?r.pathname:r.pathnameBase)}function _d(e,a,r,l=!1){let s;typeof e=="string"?s=zr(e):(s={...e},Ke(!s.pathname||!s.pathname.includes("?"),Gc("?","pathname","search",s)),Ke(!s.pathname||!s.pathname.includes("#"),Gc("#","pathname","hash",s)),Ke(!s.search||!s.search.includes("#"),Gc("#","search","hash",s)));let u=e===""||s.pathname==="",c=u?"/":s.pathname,d;if(c==null)d=r;else{let h=a.length-1;if(!l&&c.startsWith("..")){let v=c.split("/");for(;v[0]==="..";)v.shift(),h-=1;s.pathname=v.join("/")}d=h>=0?a[h]:"/"}let f=zk(s,d),g=c&&c!=="/"&&c.endsWith("/"),b=(u||c===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(g||b)&&(f.pathname+="/"),f}var Sn=e=>e.join("/").replace(/\/\/+/g,"/"),Gk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),$k=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Hk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Pk=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 qk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Vk(e){return e.map(a=>a.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var bx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yx(e,a){let r=e;if(typeof r!="string"||!Fk.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let l=r,s=!1;if(bx)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),d=qn(c.pathname,a);c.origin===u.origin&&d!=null?r=d+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 Ex=["POST","PUT","PATCH","DELETE"];new Set(Ex);var Yk=["GET",...Ex];new Set(Yk);var jr=F.createContext(null);jr.displayName="DataRouter";var as=F.createContext(null);as.displayName="DataRouterState";var Wk=F.createContext(!1),Sx=F.createContext({isTransitioning:!1});Sx.displayName="ViewTransition";var Xk=F.createContext(new Map);Xk.displayName="Fetchers";var Zk=F.createContext(null);Zk.displayName="Await";var sn=F.createContext(null);sn.displayName="Navigation";var ll=F.createContext(null);ll.displayName="Location";var xn=F.createContext({outlet:null,matches:[],isDataRoute:!1});xn.displayName="Route";var Nd=F.createContext(null);Nd.displayName="RouteError";var vx="REACT_ROUTER_ERROR",Kk="REDIRECT",Qk="ROUTE_ERROR_RESPONSE";function Jk(e){if(e.startsWith(`${vx}:${Kk}:{`))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 e_(e){if(e.startsWith(`${vx}:${Qk}:{`))try{let a=JSON.parse(e.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new Pk(a.status,a.statusText,a.data)}catch{}}function t_(e,{relative:a}={}){Ke(ol(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:l}=F.useContext(sn),{hash:s,pathname:u,search:c}=ul(e,{relative:a}),d=u;return r!=="/"&&(d=u==="/"?r:Sn([r,u])),l.createHref({pathname:d,search:c,hash:s})}function ol(){return F.useContext(ll)!=null}function Sa(){return Ke(ol(),"useLocation() may be used only in the context of a <Router> component."),F.useContext(ll).location}var xx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Tx(e){F.useContext(sn).static||F.useLayoutEffect(e)}function sl(){let{isDataRoute:e}=F.useContext(xn);return e?m_():n_()}function n_(){Ke(ol(),"useNavigate() may be used only in the context of a <Router> component.");let e=F.useContext(jr),{basename:a,navigator:r}=F.useContext(sn),{matches:l}=F.useContext(xn),{pathname:s}=Sa(),u=JSON.stringify(hx(l)),c=F.useRef(!1);return Tx(()=>{c.current=!0}),F.useCallback((f,g={})=>{if(vn(c.current,xx),!c.current)return;if(typeof f=="number"){r.go(f);return}let b=_d(f,JSON.parse(u),s,g.relative==="path");e==null&&a!=="/"&&(b.pathname=b.pathname==="/"?a:Sn([a,b.pathname])),(g.replace?r.replace:r.push)(b,g.state,g)},[a,r,u,s,e])}F.createContext(null);function a_(){let{matches:e}=F.useContext(xn),a=e[e.length-1];return a?a.params:{}}function ul(e,{relative:a}={}){let{matches:r}=F.useContext(xn),{pathname:l}=Sa(),s=JSON.stringify(hx(r));return F.useMemo(()=>_d(e,JSON.parse(s),l,a==="path"),[e,s,l,a])}function r_(e,a){return Ax(e,a)}function Ax(e,a,r){var A;Ke(ol(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=F.useContext(sn),{matches:s}=F.useContext(xn),u=s[s.length-1],c=u?u.params:{},d=u?u.pathname:"/",f=u?u.pathnameBase:"/",g=u&&u.route;{let k=g&&g.path||"";kx(d,!g||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${k}">) 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="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let b=Sa(),h;if(a){let k=typeof a=="string"?zr(a):a;Ke(f==="/"||((A=k.pathname)==null?void 0:A.startsWith(f)),`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 "${f}" but pathname "${k.pathname}" was given in the \`location\` prop.`),h=k}else h=b;let v=h.pathname||"/",E=v;if(f!=="/"){let k=f.replace(/^\//,"").split("/");E="/"+v.replace(/^\//,"").split("/").slice(k.length).join("/")}let x=fx(e,{pathname:E});vn(g||x!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),vn(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.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 w=u_(x&&x.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:Sn([f,l.encodeLocation?l.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:Sn([f,l.encodeLocation?l.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,r);return a&&w?F.createElement(ll.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},w):w}function i_(){let e=g_(),a=qk(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=F.createElement(F.Fragment,null,F.createElement("p",null,"💿 Hey developer 👋"),F.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",F.createElement("code",{style:u},"ErrorBoundary")," or"," ",F.createElement("code",{style:u},"errorElement")," prop on your route.")),F.createElement(F.Fragment,null,F.createElement("h2",null,"Unexpected Application Error!"),F.createElement("h3",{style:{fontStyle:"italic"}},a),r?F.createElement("pre",{style:s},r):null,c)}var l_=F.createElement(i_,null),wx=class extends F.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=e_(e.digest);r&&(e=r)}let a=e!==void 0?F.createElement(xn.Provider,{value:this.props.routeContext},F.createElement(Nd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?F.createElement(o_,{error:e},a):a}};wx.contextType=Wk;var $c=new WeakMap;function o_({children:e,error:a}){let{basename:r}=F.useContext(sn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let l=Jk(a.digest);if(l){let s=$c.get(a);if(s)throw s;let u=yx(l.location,r);if(bx&&!$c.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 $c.set(a,c),c}return F.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function s_({routeContext:e,match:a,children:r}){let l=F.useContext(jr);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),F.createElement(xn.Provider,{value:e},r)}function u_(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,d=-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)&&(d=b),h.route.id){let{loaderData:v,errors:E}=l,x=h.route.loader&&!v.hasOwnProperty(h.route.id)&&(!E||E[h.route.id]===void 0);if(h.route.lazy||x){r.isStatic&&(c=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let f=r==null?void 0:r.onError,g=l&&f?(b,h)=>{var v,E;f(b,{location:l.location,params:((E=(v=l.matches)==null?void 0:v[0])==null?void 0:E.params)??{},unstable_pattern:Vk(l.matches),errorInfo:h})}:void 0;return s.reduceRight((b,h,v)=>{let E,x=!1,w=null,A=null;l&&(E=u&&h.route.id?u[h.route.id]:void 0,w=h.route.errorElement||l_,c&&(d<0&&v===0?(kx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,A=null):d===v&&(x=!0,A=h.route.hydrateFallbackElement||null)));let k=a.concat(s.slice(0,v+1)),N=()=>{let I;return E?I=w:x?I=A:h.route.Component?I=F.createElement(h.route.Component,null):h.route.element?I=h.route.element:I=b,F.createElement(s_,{match:h,routeContext:{outlet:b,matches:k,isDataRoute:l!=null},children:I})};return l&&(h.route.ErrorBoundary||h.route.errorElement||v===0)?F.createElement(wx,{location:l.location,revalidation:l.revalidation,component:w,error:E,children:N(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:g}):N()},null)}function Rd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function c_(e){let a=F.useContext(jr);return Ke(a,Rd(e)),a}function d_(e){let a=F.useContext(as);return Ke(a,Rd(e)),a}function p_(e){let a=F.useContext(xn);return Ke(a,Rd(e)),a}function Cd(e){let a=p_(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 f_(){return Cd("useRouteId")}function g_(){var l;let e=F.useContext(Nd),a=d_("useRouteError"),r=Cd("useRouteError");return e!==void 0?e:(l=a.errors)==null?void 0:l[r]}function m_(){let{router:e}=c_("useNavigate"),a=Cd("useNavigate"),r=F.useRef(!1);return Tx(()=>{r.current=!0}),F.useCallback(async(s,u={})=>{vn(r.current,xx),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:a,...u}))},[e,a])}var ov={};function kx(e,a,r){!a&&!ov[e]&&(ov[e]=!0,vn(!1,r))}F.memo(h_);function h_({routes:e,future:a,state:r,isStatic:l,onError:s}){return Ax(e,void 0,{state:r,isStatic:l,onError:s})}function Xi(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 b_({basename:e="/",children:a=null,location:r,navigationType:l="POP",navigator:s,static:u=!1,unstable_useTransitions:c}){Ke(!ol(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=F.useMemo(()=>({basename:d,navigator:s,static:u,unstable_useTransitions:c,future:{}}),[d,s,u,c]);typeof r=="string"&&(r=zr(r));let{pathname:g="/",search:b="",hash:h="",state:v=null,key:E="default",unstable_mask:x}=r,w=F.useMemo(()=>{let A=qn(g,d);return A==null?null:{location:{pathname:A,search:b,hash:h,state:v,key:E,unstable_mask:x},navigationType:l}},[d,g,b,h,v,E,l,x]);return vn(w!=null,`<Router basename="${d}"> is not able to match the URL "${g}${b}${h}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:F.createElement(sn.Provider,{value:f},F.createElement(ll.Provider,{children:a,value:w}))}function y_({children:e,location:a}){return r_(ud(e),a)}function ud(e,a=[]){let r=[];return F.Children.forEach(e,(l,s)=>{if(!F.isValidElement(l))return;let u=[...a,s];if(l.type===F.Fragment){r.push.apply(r,ud(l.props.children,u));return}Ke(l.type===Xi,`[${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=ud(l.props.children,u)),r.push(c)}),r}var Yo="get",Wo="application/x-www-form-urlencoded";function rs(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function E_(e){return rs(e)&&e.tagName.toLowerCase()==="button"}function S_(e){return rs(e)&&e.tagName.toLowerCase()==="form"}function v_(e){return rs(e)&&e.tagName.toLowerCase()==="input"}function x_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function T_(e,a){return e.button===0&&(!a||a==="_self")&&!x_(e)}var zo=null;function A_(){if(zo===null)try{new FormData(document.createElement("form"),0),zo=!1}catch{zo=!0}return zo}var w_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Hc(e){return e!=null&&!w_.has(e)?(vn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wo}"`),null):e}function k_(e,a){let r,l,s,u,c;if(S_(e)){let d=e.getAttribute("action");l=d?qn(d,a):null,r=e.getAttribute("method")||Yo,s=Hc(e.getAttribute("enctype"))||Wo,u=new FormData(e)}else if(E_(e)||v_(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||d.getAttribute("action");if(l=f?qn(f,a):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||Yo,s=Hc(e.getAttribute("formenctype"))||Hc(d.getAttribute("enctype"))||Wo,u=new FormData(d,e),!A_()){let{name:g,type:b,value:h}=e;if(b==="image"){let v=g?`${g}.`:"";u.append(`${v}x`,"0"),u.append(`${v}y`,"0")}else g&&u.append(g,h)}}else{if(rs(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Yo,l=null,s=Wo,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 Id(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function __(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 N_(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 R_(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 C_(e,a,r){let l=await Promise.all(e.map(async s=>{let u=a.routes[s.route.id];if(u){let c=await N_(u,r);return c.links?c.links():[]}return[]}));return D_(l.flat(1).filter(R_).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function sv(e,a,r,l,s,u){let c=(f,g)=>r[g]?f.route.id!==r[g].route.id:!0,d=(f,g)=>{var b;return r[g].pathname!==f.pathname||((b=r[g].route.path)==null?void 0:b.endsWith("*"))&&r[g].params["*"]!==f.params["*"]};return u==="assets"?a.filter((f,g)=>c(f,g)||d(f,g)):u==="data"?a.filter((f,g)=>{var h;let b=l.routes[f.route.id];if(!b||!b.hasLoader)return!1;if(c(f,g)||d(f,g))return!0;if(f.route.shouldRevalidate){let v=f.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:f.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function I_(e,a,{includeHydrateFallback:r}={}){return O_(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 O_(e){return[...new Set(e)]}function L_(e){let a={},r=Object.keys(e).sort();for(let l of r)a[l]=e[l];return a}function D_(e,a){let r=new Set;return new Set(a),e.reduce((l,s)=>{let u=JSON.stringify(L_(s));return r.has(u)||(r.add(u),l.push({key:u,link:s})),l},[])}function _x(){let e=F.useContext(jr);return Id(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function M_(){let e=F.useContext(as);return Id(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Od=F.createContext(void 0);Od.displayName="FrameworkContext";function Nx(){let e=F.useContext(Od);return Id(e,"You must render this element inside a <HydratedRouter> element"),e}function U_(e,a){let r=F.useContext(Od),[l,s]=F.useState(!1),[u,c]=F.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:g,onMouseLeave:b,onTouchStart:h}=a,v=F.useRef(null);F.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let w=k=>{k.forEach(N=>{c(N.isIntersecting)})},A=new IntersectionObserver(w,{threshold:.5});return v.current&&A.observe(v.current),()=>{A.disconnect()}}},[e]),F.useEffect(()=>{if(l){let w=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(w)}}},[l]);let E=()=>{s(!0)},x=()=>{s(!1),c(!1)};return r?e!=="intent"?[u,v,{}]:[u,v,{onFocus:Pi(d,E),onBlur:Pi(f,x),onMouseEnter:Pi(g,E),onMouseLeave:Pi(b,x),onTouchStart:Pi(h,E)}]:[!1,v,{}]}function Pi(e,a){return r=>{e&&e(r),r.defaultPrevented||a(r)}}function B_({page:e,...a}){let{router:r}=_x(),l=F.useMemo(()=>fx(r.routes,e,r.basename),[r.routes,e,r.basename]);return l?F.createElement(z_,{page:e,matches:l,...a}):null}function F_(e){let{manifest:a,routeModules:r}=Nx(),[l,s]=F.useState([]);return F.useEffect(()=>{let u=!1;return C_(e,a,r).then(c=>{u||s(c)}),()=>{u=!0}},[e,a,r]),l}function z_({page:e,matches:a,...r}){let l=Sa(),{future:s,manifest:u,routeModules:c}=Nx(),{basename:d}=_x(),{loaderData:f,matches:g}=M_(),b=F.useMemo(()=>sv(e,a,g,u,l,"data"),[e,a,g,u,l]),h=F.useMemo(()=>sv(e,a,g,u,l,"assets"),[e,a,g,u,l]),v=F.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let w=new Set,A=!1;if(a.forEach(N=>{var j;let I=u.routes[N.route.id];!I||!I.hasLoader||(!b.some(H=>H.route.id===N.route.id)&&N.route.id in f&&((j=c[N.route.id])!=null&&j.shouldRevalidate)||I.hasClientLoader?A=!0:w.add(N.route.id))}),w.size===0)return[];let k=__(e,d,s.unstable_trailingSlashAwareDataRequests,"data");return A&&w.size>0&&k.searchParams.set("_routes",a.filter(N=>w.has(N.route.id)).map(N=>N.route.id).join(",")),[k.pathname+k.search]},[d,s.unstable_trailingSlashAwareDataRequests,f,l,u,b,a,e,c]),E=F.useMemo(()=>I_(h,u),[h,u]),x=F_(h);return F.createElement(F.Fragment,null,v.map(w=>F.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),E.map(w=>F.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),x.map(({key:w,link:A})=>F.createElement("link",{key:w,nonce:r.nonce,...A,crossOrigin:A.crossOrigin??r.crossOrigin})))}function j_(...e){return a=>{e.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}var G_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{G_&&(window.__reactRouterVersion="7.13.2")}catch{}function $_({basename:e,children:a,unstable_useTransitions:r,window:l}){let s=F.useRef();s.current==null&&(s.current=vk({window:l,v5Compat:!0}));let u=s.current,[c,d]=F.useState({action:u.action,location:u.location}),f=F.useCallback(g=>{r===!1?d(g):F.startTransition(()=>d(g))},[r]);return F.useLayoutEffect(()=>u.listen(f),[u,f]),F.createElement(b_,{basename:e,children:a,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var Rx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Br=F.forwardRef(function({onClick:a,discover:r="render",prefetch:l="none",relative:s,reloadDocument:u,replace:c,unstable_mask:d,state:f,target:g,to:b,preventScrollReset:h,viewTransition:v,unstable_defaultShouldRevalidate:E,...x},w){let{basename:A,navigator:k,unstable_useTransitions:N}=F.useContext(sn),I=typeof b=="string"&&Rx.test(b),j=yx(b,A);b=j.to;let H=t_(b,{relative:s}),M=Sa(),W=null;if(d){let q=_d(d,[],M.unstable_mask?M.unstable_mask.pathname:"/",!0);A!=="/"&&(q.pathname=q.pathname==="/"?A:Sn([A,q.pathname])),W=k.createHref(q)}let[re,le,B]=U_(l,x),V=V_(b,{replace:c,unstable_mask:d,state:f,target:g,preventScrollReset:h,relative:s,viewTransition:v,unstable_defaultShouldRevalidate:E,unstable_useTransitions:N});function K(q){a&&a(q),q.defaultPrevented||V(q)}let ne=!(j.isExternal||u),ae=F.createElement("a",{...x,...B,href:(ne?W:void 0)||j.absoluteURL||H,onClick:ne?K:a,ref:j_(w,le),target:g,"data-discover":!I&&r==="render"?"true":void 0});return re&&!I?F.createElement(F.Fragment,null,ae,F.createElement(B_,{page:H})):ae});Br.displayName="Link";var H_=F.forwardRef(function({"aria-current":a="page",caseSensitive:r=!1,className:l="",end:s=!1,style:u,to:c,viewTransition:d,children:f,...g},b){let h=ul(c,{relative:g.relative}),v=Sa(),E=F.useContext(as),{navigator:x,basename:w}=F.useContext(sn),A=E!=null&&K_(h)&&d===!0,k=x.encodeLocation?x.encodeLocation(h).pathname:h.pathname,N=v.pathname,I=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;r||(N=N.toLowerCase(),I=I?I.toLowerCase():null,k=k.toLowerCase()),I&&w&&(I=qn(I,w)||I);const j=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let H=N===k||!s&&N.startsWith(k)&&N.charAt(j)==="/",M=I!=null&&(I===k||!s&&I.startsWith(k)&&I.charAt(k.length)==="/"),W={isActive:H,isPending:M,isTransitioning:A},re=H?a:void 0,le;typeof l=="function"?le=l(W):le=[l,H?"active":null,M?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let B=typeof u=="function"?u(W):u;return F.createElement(Br,{...g,"aria-current":re,className:le,ref:b,style:B,to:c,viewTransition:d},typeof f=="function"?f(W):f)});H_.displayName="NavLink";var P_=F.forwardRef(({discover:e="render",fetcherKey:a,navigate:r,reloadDocument:l,replace:s,state:u,method:c=Yo,action:d,onSubmit:f,relative:g,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:v,...E},x)=>{let{unstable_useTransitions:w}=F.useContext(sn),A=X_(),k=Z_(d,{relative:g}),N=c.toLowerCase()==="get"?"get":"post",I=typeof d=="string"&&Rx.test(d),j=H=>{if(f&&f(H),H.defaultPrevented)return;H.preventDefault();let M=H.nativeEvent.submitter,W=(M==null?void 0:M.getAttribute("formmethod"))||c,re=()=>A(M||H.currentTarget,{fetcherKey:a,method:W,navigate:r,replace:s,state:u,relative:g,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:v});w&&r!==!1?F.startTransition(()=>re()):re()};return F.createElement("form",{ref:x,method:N,action:k,onSubmit:l?f:j,...E,"data-discover":!I&&e==="render"?"true":void 0})});P_.displayName="Form";function q_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Cx(e){let a=F.useContext(jr);return Ke(a,q_(e)),a}function V_(e,{target:a,replace:r,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:g}={}){let b=sl(),h=Sa(),v=ul(e,{relative:c});return F.useCallback(E=>{if(T_(E,a)){E.preventDefault();let x=r!==void 0?r:el(h)===el(v),w=()=>b(e,{replace:x,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:f});g?F.startTransition(()=>w()):w()}},[h,b,v,r,l,s,a,e,u,c,d,f,g])}var Y_=0,W_=()=>`__${String(++Y_)}__`;function X_(){let{router:e}=Cx("useSubmit"),{basename:a}=F.useContext(sn),r=f_(),l=e.fetch,s=e.navigate;return F.useCallback(async(u,c={})=>{let{action:d,method:f,encType:g,formData:b,body:h}=k_(u,a);if(c.navigate===!1){let v=c.fetcherKey||W_();await l(v,r,c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||f,formEncType:c.encType||g,flushSync:c.flushSync})}else await s(c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||f,formEncType:c.encType||g,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[l,s,a,r])}function Z_(e,{relative:a}={}){let{basename:r}=F.useContext(sn),l=F.useContext(xn);Ke(l,"useFormAction must be used inside a RouteContext");let[s]=l.matches.slice(-1),u={...ul(e||".",{relative:a})},c=Sa();if(e==null){u.search=c.search;let d=new URLSearchParams(u.search),f=d.getAll("index");if(f.some(b=>b==="")){d.delete("index"),f.filter(h=>h).forEach(h=>d.append("index",h));let b=d.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])),el(u)}function K_(e,{relative:a}={}){let r=F.useContext(Sx);Ke(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=Cx("useViewTransitionState"),s=ul(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 Qo(s.pathname,c)!=null||Qo(s.pathname,u)!=null}const uv=e=>{let a;const r=new Set,l=(g,b)=>{const h=typeof g=="function"?g(a):g;if(!Object.is(h,a)){const v=a;a=b??(typeof h!="object"||h===null)?h:Object.assign({},a,h),r.forEach(E=>E(a,v))}},s=()=>a,d={setState:l,getState:s,getInitialState:()=>f,subscribe:g=>(r.add(g),()=>r.delete(g))},f=a=e(l,s,d);return d},Q_=(e=>e?uv(e):uv),J_=e=>e;function eN(e,a=J_){const r=on.useSyncExternalStore(e.subscribe,on.useCallback(()=>a(e.getState()),[e,a]),on.useCallback(()=>a(e.getInitialState()),[e,a]));return on.useDebugValue(r),r}const cv=e=>{const a=Q_(e),r=l=>eN(a,l);return Object.assign(r,a),r},tN=(e=>e?cv(e):cv),ut=tN((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,referencedStashIds:new Set,activeStashId:null,stashServerReady:!1,previewPort:null,previewPorts:new Map,stashActivity:new Map,activityDrawerStashId:null,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}),setTimeout(async()=>{for(const[,c]of a().stashes)if(c.status==="generating")try{const d=await fetch(`/api/stash-activity/${c.id}`);if(d.ok){const{data:f}=await d.json();(f==null?void 0:f.length)>0&&e(g=>{const b=new Map(g.stashActivity);return b.set(c.id,f),{stashActivity:b}})}}catch{}},100);break;case"processing":u.chatId===a().currentChatId&&e({isProcessing:!0});break;case"stash:status":e(c=>{const d=new Map(c.stashes),f=d.get(u.stashId);f?d.set(u.stashId,{...f,status:u.status,originChatId:f.originChatId||c.currentChatId||void 0}):d.set(u.stashId,{id:u.stashId,number:u.number??d.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 g=c.viewMode==="preview"?"grid":c.viewMode;if(u.status==="ready"||u.status==="error"){const b=new Map(c.stashActivity);b.delete(u.stashId);const h=c.activityDrawerStashId===u.stashId?null:c.activityDrawerStashId;return{stashes:d,viewMode:g,stashActivity:b,activityDrawerStashId:h}}return{stashes:d,viewMode:g}});break;case"stash:screenshot":e(c=>{const d=new Map(c.stashes),f=d.get(u.stashId);return f&&d.set(u.stashId,{...f,screenshotUrl:u.url,screenshots:"screenshots"in u&&u.screenshots?u.screenshots:f.screenshots}),{stashes:d}});break;case"stash:port":e(c=>{const d=new Map(c.previewPorts);d.set(u.stashId,u.port);const f=c.activeStashId===u.stashId;return{previewPorts:d,previewPort:f?u.port:c.previewPort,...f?{stashServerReady:!0}:{}}});break;case"stash:preview_stopped":e(c=>{const d=new Map(c.previewPorts);return d.delete(u.stashId),{previewPorts:d}});break;case"stash:error":e(c=>{const d=new Map(c.stashes),f=d.get(u.stashId);return f&&d.set(u.stashId,{...f,status:"error",error:u.error}),{stashes:d}});break;case"stash:activity":e(c=>{const d=new Map(c.stashActivity),f=d.get(u.stashId)??[];return d.set(u.stashId,[...f,u.event]),{stashActivity:d}});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"component:resolved":{const c=a().selectedComponent;c&&e({selectedComponent:{...c,filePath:u.filePath}});break}case"message:saved":{e(c=>{const d=[...c.messages];for(let f=d.length-1;f>=0;f--){const g=d[f];if(g.role==="user"&&g.content===u.content){d[f]={...g,id:u.messageId};break}}return{messages:d}});break}case"message:updated":{e(c=>({messages:c.messages.map(d=>d.id===u.messageId?{...d,componentContext:u.componentContext}:d)}));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){var c;const l=a().selectedComponent,s=l&&l.domSelector===r.domSelector;e({selectedComponent:r,pickerEnabled:!1});const u=document.querySelector('iframe[title="App Preview"], iframe[title="Stash Preview"]');(c=u==null?void 0:u.contentWindow)==null||c.postMessage({type:"stashes:toggle_picker",enabled:!1},"*"),s||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,currentChatId:null,messages:[],isProcessing:!1,activityDrawerStashId:null,stashActivity:new Map})}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 g of c)u.set(g.id,g);const d=c.length>0,f=a().currentChatId===r;e({currentChatId:r,messages:s.messages??[],stashes:u,viewMode:f?a().viewMode:d?"grid":"preview",selectedStashIds:f?a().selectedStashIds:new Set,referencedStashIds:f?a().referencedStashIds:new Set(s.referencedStashIds??[]),activeStashId:f?a().activeStashId:null,isProcessing:f?a().isProcessing:!1,activityDrawerStashId:f?a().activityDrawerStashId:null,stashActivity:f?a().stashActivity:new Map})}catch{}},async newChat(r){const l=await fetch("/api/chats",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({referencedStashIds:r})}),{data:s}=await l.json();return e(u=>({chats:[s,...u.chats],currentChatId:s.id,messages:[],viewMode:"preview",selectedStashIds:new Set,referencedStashIds:new Set(r??[]),activeStashId:null,isProcessing:!1,activityDrawerStashId:null,stashActivity:new Map})),s.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,d=c?{name:c.name,filePath:c.filePath&&c.filePath!=="auto-detect"?c.filePath:void 0,sourceStashId:void 0}:void 0;e({isProcessing:!0}),a().addMessage({role:"user",content:r,type:"text",referenceStashIds:u.length>0?u:void 0,componentContext:d}),a().send({type:"message",projectId:l,chatId:s,message:r,...u.length>0?{referenceStashIds:u}:{},...d?{componentContext:d}:{}}),c&&e({selectedComponent:null})},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})},addReferencedStashIds(r){const l=a().currentChatId;e(s=>{const u=new Set(s.referencedStashIds);for(const c of r)u.add(c);return l&&fetch(`/api/chats/${l}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({referencedStashIds:[...u]})}),{referencedStashIds:u}})},interactStash(r){const l=a().previewPorts.get(r),s=a().currentChatId,u=a().selectedStashIds,c=a().referencedStashIds,d=[...a().stashes.values()].filter(f=>f.originChatId===s||u.has(f.id)||c.has(f.id)).sort((f,g)=>f.createdAt.localeCompare(g.createdAt)).map(f=>f.id);e({activeStashId:r,viewMode:"interact",stashServerReady:!!l,previewPort:l??null}),a().send({type:"interact",stashId:r,sortedStashIds:d})},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}})},openActivityDrawer(r){e({activityDrawerStashId:r})},closeActivityDrawer(){e({activityDrawerStashId:null})}}));function Ix({stash:e,index:a,isSelected:r,onSelect:l,onClick:s,onDelete:u}){const[c,d]=F.useState(!1),f=F.useRef(null);F.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);function g(E){E.stopPropagation(),d(!0),f.current=setTimeout(()=>d(!1),5e3)}function b(E){E.stopPropagation(),f.current&&clearTimeout(f.current),d(!1),u(e.id)}function h(E){E.stopPropagation(),f.current&&clearTimeout(f.current),d(!1)}function v(E){E.target.closest("button")||s(e)}return S.jsxs("div",{onClick:v,className:`bg-[var(--stashes-surface)] border-2 rounded-xl overflow-hidden cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group ${r?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${a*40}ms`},children:[S.jsxs("div",{className:"aspect-video bg-[var(--stashes-bg)] relative overflow-hidden",children:[e.screenshotUrl?S.jsx("img",{src:e.screenshotUrl,alt:"",className:"w-full h-full object-cover object-top transition-transform duration-300 group-hover:scale-[1.02]"}):S.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-[var(--stashes-text-muted)]",children:"No preview"}),S.jsx("div",{className:`absolute top-2.5 left-2.5 z-10 transition-opacity duration-200 ${r?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:S.jsx("button",{onClick:E=>{E.stopPropagation(),l(e.id)},className:`w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all ${r?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"bg-black/40 border-white/60 hover:border-white backdrop-blur-sm"}`,children:r&&S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),S.jsx("div",{className:`absolute top-2.5 right-2.5 z-10 flex items-center gap-1 transition-opacity duration-200 ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:c?S.jsxs(S.Fragment,{children:[S.jsx("button",{onClick:b,className:"w-6 h-6 rounded-full bg-red-500/80 backdrop-blur-sm border border-red-400/60 flex items-center justify-center hover:bg-red-500 transition-all",title:"Confirm delete",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),S.jsx("button",{onClick:h,className:"w-6 h-6 rounded-full bg-black/40 backdrop-blur-sm border border-white/20 flex items-center justify-center hover:bg-white/20 transition-all",title:"Cancel",children:S.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:S.jsx("path",{d:"M2 2L8 8M8 2L2 8",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):S.jsx("button",{onClick:g,className:"w-6 h-6 rounded-full bg-black/40 backdrop-blur-sm border border-white/20 flex items-center justify-center hover:bg-red-500/80 hover:border-red-400/60 transition-all",title:"Delete stash",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:S.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:"white",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),S.jsx("div",{className:"p-2.5",children:S.jsxs("p",{className:"text-[11px] text-[var(--stashes-text-muted)] line-clamp-2 leading-relaxed",children:[S.jsxs("span",{className:"font-semibold text-[var(--stashes-text)]",children:["#",e.number]})," ",e.prompt]})})]})}function Ox({onDelete:e,className:a=""}){const[r,l]=F.useState(!1),s=F.useRef(null);F.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);function u(f){f.stopPropagation(),l(!0),s.current=setTimeout(()=>l(!1),5e3)}function c(f){f.stopPropagation(),s.current&&clearTimeout(s.current),l(!1),e()}function d(f){f.stopPropagation(),s.current&&clearTimeout(s.current),l(!1)}return r?S.jsxs("div",{className:`flex items-center gap-1 ${a}`,children:[S.jsx("button",{onClick:c,className:"text-red-400 hover:text-red-300 transition-colors p-1 rounded",title:"Confirm delete",children:S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),S.jsx("button",{onClick:d,className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors p-1 rounded",title:"Cancel",children:S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 10 10",fill:"none",children:S.jsx("path",{d:"M2 2L8 8M8 2L2 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):S.jsx("button",{onClick:u,className:`text-[var(--stashes-text-muted)] hover:text-red-400 transition-all p-1 rounded ${a}`,title:"Delete",children:S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:S.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"})})})}const dv=8,pv=5;function nN(){const e=sl(),{chats:a,stashes:r,projectName:l,loadChats:s,newChat:u,deleteChat:c,deleteStash:d}=ut(),[f,g]=F.useState(new Set),[b,h]=F.useState(new Set),[v,E]=F.useState(!1),x=[...r.values()].filter(V=>V.status==="ready").sort((V,K)=>new Date(K.createdAt).getTime()-new Date(V.createdAt).getTime()),w=x.slice(0,dv),A=a.slice(0,pv),k=f.size>0||b.size>0;F.useEffect(()=>{s()},[s]);const N=F.useCallback(V=>{g(K=>{const ne=new Set(K);return ne.has(V)?ne.delete(V):ne.add(V),ne})},[]),I=F.useCallback(V=>{h(K=>{const ne=new Set(K);return ne.has(V)?ne.delete(V):ne.add(V),ne})},[]);function j(){g(new Set),h(new Set),E(!1)}async function H(){const V=await u();e(`/chat/${V}`)}async function M(V){const K=await u([V.id]),ne=ut.getState();ne.toggleStashSelection(V.id),ne.interactStash(V.id),e(`/chat/${K}`)}async function W(){const V=[...f],K=await u(V),ne=ut.getState();for(const ae of V)ne.toggleStashSelection(ae);j(),e(`/chat/${K}`)}function re(){for(const V of f)d(V);for(const V of b)c(V);j()}function le(V){const K=new Date(V),ae=new Date().getTime()-K.getTime(),q=Math.floor(ae/6e4);if(q<1)return"just now";if(q<60)return`${q}m ago`;const U=Math.floor(q/60);if(U<24)return`${U}h ago`;const J=Math.floor(U/24);return J<7?`${J}d ago`:K.toLocaleDateString()}function B(){const V=[];return f.size>0&&V.push(`${f.size} stash${f.size!==1?"es":""}`),b.size>0&&V.push(`${b.size} chat${b.size!==1?"s":""}`),V.join(", ")+" selected"}return S.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[S.jsxs("div",{className:"max-w-5xl mx-auto",children:[S.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[S.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:l??"Stashes"}),S.jsx("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:"Design explorations for your app"})]}),S.jsx("div",{onClick:H,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:S.jsxs("div",{className:"flex items-center gap-2",children:[S.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:S.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),S.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),x.length>0&&S.jsxs("div",{className:"mb-10",style:{animation:"fadeIn 0.5s ease-out 0.1s both"},children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider",children:["Stashes (",x.length,")"]}),x.length>dv&&S.jsx(Br,{to:"/stashes",className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-primary)] transition-colors",children:"View all →"})]}),S.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:w.map((V,K)=>S.jsx(Ix,{stash:V,index:K,isSelected:f.has(V.id),onSelect:N,onClick:M,onDelete:ne=>{d(ne),g(ae=>{const q=new Set(ae);return q.delete(ne),q})}},V.id))})]}),a.length>0&&S.jsxs("div",{style:{animation:"fadeIn 0.5s ease-out 0.2s both"},children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider",children:["Conversations (",a.length,")"]}),a.length>pv&&S.jsx(Br,{to:"/chats",className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-primary)] transition-colors",children:"View all →"})]}),S.jsx("div",{className:"space-y-2",children:A.map((V,K)=>{const ne=b.has(V.id);return S.jsxs("div",{onClick:()=>e(`/chat/${V.id}`),className:`bg-[var(--stashes-surface)] border-2 rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group flex items-center justify-between ${ne?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${K*40}ms`},children:[S.jsx("div",{className:`flex-shrink-0 mr-3 transition-opacity duration-200 ${ne?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:S.jsx("button",{onClick:ae=>{ae.stopPropagation(),I(V.id)},className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all ${ne?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"border-[var(--stashes-border-hover)] hover:border-[var(--stashes-text-muted)]"}`,children:ne&&S.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),S.jsx("div",{className:"min-w-0 flex-1",children:S.jsx("div",{className:"font-semibold text-sm truncate",children:V.title})}),S.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[S.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:le(V.updatedAt)}),S.jsx(Ox,{onDelete:()=>c(V.id),className:"opacity-0 group-hover:opacity-100 focus-within:opacity-100"})]})]},V.id)})})]})]}),k&&S.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:S.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[S.jsx("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:B()}),S.jsx("button",{onClick:j,className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),f.size>0&&b.size===0&&S.jsx("button",{onClick:W,className:"bg-[var(--stashes-primary)] hover:brightness-110 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Start chat"}),v?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:re,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),S.jsx("button",{onClick:()=>E(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):S.jsx("button",{onClick:()=>E(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function aN(){const e=sl(),{stashes:a,projectName:r,loadChats:l,newChat:s,deleteStash:u}=ut(),[c,d]=F.useState(new Set),[f,g]=F.useState(!1),b=[...a.values()].filter(w=>w.status==="ready").sort((w,A)=>new Date(A.createdAt).getTime()-new Date(w.createdAt).getTime());F.useEffect(()=>{l()},[l]);const h=F.useCallback(w=>{d(A=>{const k=new Set(A);return k.has(w)?k.delete(w):k.add(w),k})},[]);async function v(w){const A=await s([w.id]),k=ut.getState();k.toggleStashSelection(w.id),k.interactStash(w.id),e(`/chat/${A}`)}async function E(){const w=[...c],A=await s(w),k=ut.getState();for(const N of w)k.toggleStashSelection(N);d(new Set),e(`/chat/${A}`)}function x(){for(const w of c)u(w);d(new Set),g(!1)}return S.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[S.jsxs("div",{className:"max-w-5xl mx-auto",children:[S.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[S.jsxs(Br,{to:"/",className:"text-sm text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors mb-3 inline-flex items-center gap-1.5",children:[S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:S.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),r??"Home"]}),S.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"All Stashes"}),S.jsxs("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:[b.length," design exploration",b.length!==1?"s":""]})]}),b.length>0?S.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:b.map((w,A)=>S.jsx(Ix,{stash:w,index:A,isSelected:c.has(w.id),onSelect:h,onClick:v,onDelete:k=>{u(k),d(N=>{const I=new Set(N);return I.delete(k),I})}},w.id))}):S.jsx("div",{className:"text-center py-16 text-[var(--stashes-text-muted)] text-sm",children:"No stashes yet. Start a conversation to generate design explorations."})]}),c.size>0&&S.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:S.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[S.jsxs("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:[c.size," stash",c.size!==1?"es":""," selected"]}),S.jsx("button",{onClick:()=>{d(new Set),g(!1)},className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),S.jsx("button",{onClick:E,className:"bg-[var(--stashes-primary)] hover:brightness-110 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Start chat"}),f?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:x,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),S.jsx("button",{onClick:()=>g(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):S.jsx("button",{onClick:()=>g(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function rN(e){const a=new Date(e),l=new Date().getTime()-a.getTime(),s=Math.floor(l/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const u=Math.floor(s/60);if(u<24)return`${u}h ago`;const c=Math.floor(u/24);return c<7?`${c}d ago`:a.toLocaleDateString()}function iN(){const e=sl(),{chats:a,projectName:r,loadChats:l,newChat:s,deleteChat:u}=ut(),[c,d]=F.useState(new Set),[f,g]=F.useState(!1);F.useEffect(()=>{l()},[l]);const b=F.useCallback(x=>{d(w=>{const A=new Set(w);return A.has(x)?A.delete(x):A.add(x),A})},[]);function h(){d(new Set),g(!1)}function v(){for(const x of c)u(x);h()}async function E(){const x=await s();e(`/chat/${x}`)}return S.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[S.jsxs("div",{className:"max-w-5xl mx-auto",children:[S.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[S.jsxs(Br,{to:"/",className:"text-sm text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors mb-3 inline-flex items-center gap-1.5",children:[S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:S.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),r??"Home"]}),S.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"All Conversations"}),S.jsxs("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:[a.length," conversation",a.length!==1?"s":""]})]}),S.jsx("div",{onClick:E,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:S.jsxs("div",{className:"flex items-center gap-2",children:[S.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:S.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),S.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),a.length>0?S.jsx("div",{className:"space-y-2",children:a.map((x,w)=>{const A=c.has(x.id);return S.jsxs("div",{onClick:()=>e(`/chat/${x.id}`),className:`bg-[var(--stashes-surface)] border-2 rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group flex items-center justify-between ${A?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${w*40}ms`},children:[S.jsx("div",{className:`flex-shrink-0 mr-3 transition-opacity duration-200 ${A?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:S.jsx("button",{onClick:k=>{k.stopPropagation(),b(x.id)},className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all ${A?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"border-[var(--stashes-border-hover)] hover:border-[var(--stashes-text-muted)]"}`,children:A&&S.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),S.jsx("div",{className:"min-w-0 flex-1",children:S.jsx("div",{className:"font-semibold text-sm truncate",children:x.title})}),S.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[S.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:rN(x.updatedAt)}),S.jsx(Ox,{onDelete:()=>u(x.id),className:"opacity-0 group-hover:opacity-100 focus-within:opacity-100"})]})]},x.id)})}):S.jsx("div",{className:"text-center py-16 text-[var(--stashes-text-muted)] text-sm",children:"No conversations yet. Start one to begin designing."})]}),c.size>0&&S.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:S.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[S.jsxs("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:[c.size," chat",c.size!==1?"s":""," selected"]}),S.jsx("button",{onClick:h,className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),f?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:v,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),S.jsx("button",{onClick:()=>g(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):S.jsx("button",{onClick:()=>g(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function fv(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 lN(e,a){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const oN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uN={};function gv(e,a){return(uN.jsx?sN:oN).test(e)}const cN=/[ \t\n\f\r]/g;function dN(e){return typeof e=="object"?e.type==="text"?mv(e.value):!1:mv(e)}function mv(e){return e.replace(cN,"")===""}class cl{constructor(a,r,l){this.normal=r,this.property=a,l&&(this.space=l)}}cl.prototype.normal={};cl.prototype.property={};cl.prototype.space=void 0;function Lx(e,a){const r={},l={};for(const s of e)Object.assign(r,s.property),Object.assign(l,s.normal);return new cl(r,l,a)}function tl(e){return e.toLowerCase()}class Ft{constructor(a,r){this.attribute=r,this.property=a}}Ft.prototype.attribute="";Ft.prototype.booleanish=!1;Ft.prototype.boolean=!1;Ft.prototype.commaOrSpaceSeparated=!1;Ft.prototype.commaSeparated=!1;Ft.prototype.defined=!1;Ft.prototype.mustUseProperty=!1;Ft.prototype.number=!1;Ft.prototype.overloadedBoolean=!1;Ft.prototype.property="";Ft.prototype.spaceSeparated=!1;Ft.prototype.space=void 0;let pN=0;const xe=$a(),lt=$a(),cd=$a(),ie=$a(),Ye=$a(),Ur=$a(),Yt=$a();function $a(){return 2**++pN}const dd=Object.freeze(Object.defineProperty({__proto__:null,boolean:xe,booleanish:lt,commaOrSpaceSeparated:Yt,commaSeparated:Ur,number:ie,overloadedBoolean:cd,spaceSeparated:Ye},Symbol.toStringTag,{value:"Module"})),Pc=Object.keys(dd);class Ld extends Ft{constructor(a,r,l,s){let u=-1;if(super(a,r),hv(this,"space",s),typeof l=="number")for(;++u<Pc.length;){const c=Pc[u];hv(this,Pc[u],(l&dd[c])===dd[c])}}}Ld.prototype.defined=!0;function hv(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 Ld(l,e.transform(e.attributes||{},l),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),a[l]=u,r[tl(l)]=l,r[tl(u.attribute)]=l}return new cl(a,r,e.space)}const Dx=Gr({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,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:ie,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ye,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ye,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:lt,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(e,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function Mx(e,a){return a in e?e[a]:a}function Ux(e,a){return Mx(e,a.toLowerCase())}const fN=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:xe,allowPaymentRequest:xe,allowUserMedia:xe,alt:null,as:null,async:xe,autoCapitalize:null,autoComplete:Ye,autoFocus:xe,autoPlay:xe,blocking:Ye,capture:null,charSet:null,checked:xe,cite:null,className:Ye,cols:ie,colSpan:null,content:null,contentEditable:lt,controls:xe,controlsList:Ye,coords:ie|Ur,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xe,defer:xe,dir:null,dirName:null,disabled:xe,download:cd,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xe,formTarget:null,headers:Ye,height:ie,hidden:cd,high:ie,href:null,hrefLang:null,htmlFor:Ye,httpEquiv:Ye,id:null,imageSizes:null,imageSrcSet:null,inert:xe,inputMode:null,integrity:null,is:null,isMap:xe,itemId:null,itemProp:Ye,itemRef:Ye,itemScope:xe,itemType:Ye,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xe,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:xe,muted:xe,name:null,nonce:null,noModule:xe,noValidate:xe,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:xe,optimum:ie,pattern:null,ping:Ye,placeholder:null,playsInline:xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xe,referrerPolicy:null,rel:Ye,required:xe,reversed:xe,rows:ie,rowSpan:ie,sandbox:Ye,scope:null,scoped:xe,seamless:xe,selected:xe,shadowRootClonable:xe,shadowRootDelegatesFocus:xe,shadowRootMode:null,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:xe,useMap:null,value:lt,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ye,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xe,declare:xe,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:xe,noHref:xe,noShade:xe,noWrap:xe,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xe,disableRemotePlayback:xe,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:Ux}),gN=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:Yt,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,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:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,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:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:Yt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,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:ie,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:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ye,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yt,rev:Yt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yt,requiredFeatures:Yt,requiredFonts:Yt,requiredFormats:Yt,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:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:Yt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yt,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Mx}),Bx=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()}}),Fx=Gr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ux}),zx=Gr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,a){return"xml:"+a.slice(3).toLowerCase()}}),mN={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"},hN=/[A-Z]/g,bv=/-[a-z]/g,bN=/^data[-\w.:]+$/i;function jx(e,a){const r=tl(a);let l=a,s=Ft;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&bN.test(a)){if(a.charAt(4)==="-"){const u=a.slice(5).replace(bv,EN);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=a.slice(4);if(!bv.test(u)){let c=u.replace(hN,yN);c.charAt(0)!=="-"&&(c="-"+c),a="data"+c}}s=Ld}return new s(l,a)}function yN(e){return"-"+e.toLowerCase()}function EN(e){return e.charAt(1).toUpperCase()}const Gx=Lx([Dx,fN,Bx,Fx,zx],"html"),is=Lx([Dx,gN,Bx,Fx,zx],"svg");function yv(e){const a=String(e||"").trim();return a?a.split(/[ \t\n\r\f]+/g):[]}function SN(e){return e.join(" ").trim()}var Or={},qc,Ev;function vN(){if(Ev)return qc;Ev=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
60
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let b=Sa(),h;if(a){let k=typeof a=="string"?zr(a):a;Ke(f==="/"||((A=k.pathname)==null?void 0:A.startsWith(f)),`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 "${f}" but pathname "${k.pathname}" was given in the \`location\` prop.`),h=k}else h=b;let v=h.pathname||"/",E=v;if(f!=="/"){let k=f.replace(/^\//,"").split("/");E="/"+v.replace(/^\//,"").split("/").slice(k.length).join("/")}let x=fx(e,{pathname:E});vn(g||x!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),vn(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.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 w=u_(x&&x.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:Sn([f,l.encodeLocation?l.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:Sn([f,l.encodeLocation?l.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,r);return a&&w?F.createElement(ll.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},w):w}function i_(){let e=g_(),a=qk(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=F.createElement(F.Fragment,null,F.createElement("p",null,"💿 Hey developer 👋"),F.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",F.createElement("code",{style:u},"ErrorBoundary")," or"," ",F.createElement("code",{style:u},"errorElement")," prop on your route.")),F.createElement(F.Fragment,null,F.createElement("h2",null,"Unexpected Application Error!"),F.createElement("h3",{style:{fontStyle:"italic"}},a),r?F.createElement("pre",{style:s},r):null,c)}var l_=F.createElement(i_,null),wx=class extends F.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=e_(e.digest);r&&(e=r)}let a=e!==void 0?F.createElement(xn.Provider,{value:this.props.routeContext},F.createElement(Nd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?F.createElement(o_,{error:e},a):a}};wx.contextType=Wk;var $c=new WeakMap;function o_({children:e,error:a}){let{basename:r}=F.useContext(sn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let l=Jk(a.digest);if(l){let s=$c.get(a);if(s)throw s;let u=yx(l.location,r);if(bx&&!$c.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 $c.set(a,c),c}return F.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function s_({routeContext:e,match:a,children:r}){let l=F.useContext(jr);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),F.createElement(xn.Provider,{value:e},r)}function u_(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,d=-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)&&(d=b),h.route.id){let{loaderData:v,errors:E}=l,x=h.route.loader&&!v.hasOwnProperty(h.route.id)&&(!E||E[h.route.id]===void 0);if(h.route.lazy||x){r.isStatic&&(c=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let f=r==null?void 0:r.onError,g=l&&f?(b,h)=>{var v,E;f(b,{location:l.location,params:((E=(v=l.matches)==null?void 0:v[0])==null?void 0:E.params)??{},unstable_pattern:Vk(l.matches),errorInfo:h})}:void 0;return s.reduceRight((b,h,v)=>{let E,x=!1,w=null,A=null;l&&(E=u&&h.route.id?u[h.route.id]:void 0,w=h.route.errorElement||l_,c&&(d<0&&v===0?(kx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,A=null):d===v&&(x=!0,A=h.route.hydrateFallbackElement||null)));let k=a.concat(s.slice(0,v+1)),N=()=>{let I;return E?I=w:x?I=A:h.route.Component?I=F.createElement(h.route.Component,null):h.route.element?I=h.route.element:I=b,F.createElement(s_,{match:h,routeContext:{outlet:b,matches:k,isDataRoute:l!=null},children:I})};return l&&(h.route.ErrorBoundary||h.route.errorElement||v===0)?F.createElement(wx,{location:l.location,revalidation:l.revalidation,component:w,error:E,children:N(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:g}):N()},null)}function Rd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function c_(e){let a=F.useContext(jr);return Ke(a,Rd(e)),a}function d_(e){let a=F.useContext(as);return Ke(a,Rd(e)),a}function p_(e){let a=F.useContext(xn);return Ke(a,Rd(e)),a}function Cd(e){let a=p_(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 f_(){return Cd("useRouteId")}function g_(){var l;let e=F.useContext(Nd),a=d_("useRouteError"),r=Cd("useRouteError");return e!==void 0?e:(l=a.errors)==null?void 0:l[r]}function m_(){let{router:e}=c_("useNavigate"),a=Cd("useNavigate"),r=F.useRef(!1);return Tx(()=>{r.current=!0}),F.useCallback(async(s,u={})=>{vn(r.current,xx),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:a,...u}))},[e,a])}var ov={};function kx(e,a,r){!a&&!ov[e]&&(ov[e]=!0,vn(!1,r))}F.memo(h_);function h_({routes:e,future:a,state:r,isStatic:l,onError:s}){return Ax(e,void 0,{state:r,isStatic:l,onError:s})}function Xi(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 b_({basename:e="/",children:a=null,location:r,navigationType:l="POP",navigator:s,static:u=!1,unstable_useTransitions:c}){Ke(!ol(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=F.useMemo(()=>({basename:d,navigator:s,static:u,unstable_useTransitions:c,future:{}}),[d,s,u,c]);typeof r=="string"&&(r=zr(r));let{pathname:g="/",search:b="",hash:h="",state:v=null,key:E="default",unstable_mask:x}=r,w=F.useMemo(()=>{let A=qn(g,d);return A==null?null:{location:{pathname:A,search:b,hash:h,state:v,key:E,unstable_mask:x},navigationType:l}},[d,g,b,h,v,E,l,x]);return vn(w!=null,`<Router basename="${d}"> is not able to match the URL "${g}${b}${h}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:F.createElement(sn.Provider,{value:f},F.createElement(ll.Provider,{children:a,value:w}))}function y_({children:e,location:a}){return r_(ud(e),a)}function ud(e,a=[]){let r=[];return F.Children.forEach(e,(l,s)=>{if(!F.isValidElement(l))return;let u=[...a,s];if(l.type===F.Fragment){r.push.apply(r,ud(l.props.children,u));return}Ke(l.type===Xi,`[${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=ud(l.props.children,u)),r.push(c)}),r}var Yo="get",Wo="application/x-www-form-urlencoded";function rs(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function E_(e){return rs(e)&&e.tagName.toLowerCase()==="button"}function S_(e){return rs(e)&&e.tagName.toLowerCase()==="form"}function v_(e){return rs(e)&&e.tagName.toLowerCase()==="input"}function x_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function T_(e,a){return e.button===0&&(!a||a==="_self")&&!x_(e)}var zo=null;function A_(){if(zo===null)try{new FormData(document.createElement("form"),0),zo=!1}catch{zo=!0}return zo}var w_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Hc(e){return e!=null&&!w_.has(e)?(vn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wo}"`),null):e}function k_(e,a){let r,l,s,u,c;if(S_(e)){let d=e.getAttribute("action");l=d?qn(d,a):null,r=e.getAttribute("method")||Yo,s=Hc(e.getAttribute("enctype"))||Wo,u=new FormData(e)}else if(E_(e)||v_(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||d.getAttribute("action");if(l=f?qn(f,a):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||Yo,s=Hc(e.getAttribute("formenctype"))||Hc(d.getAttribute("enctype"))||Wo,u=new FormData(d,e),!A_()){let{name:g,type:b,value:h}=e;if(b==="image"){let v=g?`${g}.`:"";u.append(`${v}x`,"0"),u.append(`${v}y`,"0")}else g&&u.append(g,h)}}else{if(rs(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Yo,l=null,s=Wo,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 Id(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function __(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 N_(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 R_(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 C_(e,a,r){let l=await Promise.all(e.map(async s=>{let u=a.routes[s.route.id];if(u){let c=await N_(u,r);return c.links?c.links():[]}return[]}));return D_(l.flat(1).filter(R_).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function sv(e,a,r,l,s,u){let c=(f,g)=>r[g]?f.route.id!==r[g].route.id:!0,d=(f,g)=>{var b;return r[g].pathname!==f.pathname||((b=r[g].route.path)==null?void 0:b.endsWith("*"))&&r[g].params["*"]!==f.params["*"]};return u==="assets"?a.filter((f,g)=>c(f,g)||d(f,g)):u==="data"?a.filter((f,g)=>{var h;let b=l.routes[f.route.id];if(!b||!b.hasLoader)return!1;if(c(f,g)||d(f,g))return!0;if(f.route.shouldRevalidate){let v=f.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:f.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function I_(e,a,{includeHydrateFallback:r}={}){return O_(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 O_(e){return[...new Set(e)]}function L_(e){let a={},r=Object.keys(e).sort();for(let l of r)a[l]=e[l];return a}function D_(e,a){let r=new Set;return new Set(a),e.reduce((l,s)=>{let u=JSON.stringify(L_(s));return r.has(u)||(r.add(u),l.push({key:u,link:s})),l},[])}function _x(){let e=F.useContext(jr);return Id(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function M_(){let e=F.useContext(as);return Id(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Od=F.createContext(void 0);Od.displayName="FrameworkContext";function Nx(){let e=F.useContext(Od);return Id(e,"You must render this element inside a <HydratedRouter> element"),e}function U_(e,a){let r=F.useContext(Od),[l,s]=F.useState(!1),[u,c]=F.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:g,onMouseLeave:b,onTouchStart:h}=a,v=F.useRef(null);F.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let w=k=>{k.forEach(N=>{c(N.isIntersecting)})},A=new IntersectionObserver(w,{threshold:.5});return v.current&&A.observe(v.current),()=>{A.disconnect()}}},[e]),F.useEffect(()=>{if(l){let w=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(w)}}},[l]);let E=()=>{s(!0)},x=()=>{s(!1),c(!1)};return r?e!=="intent"?[u,v,{}]:[u,v,{onFocus:Pi(d,E),onBlur:Pi(f,x),onMouseEnter:Pi(g,E),onMouseLeave:Pi(b,x),onTouchStart:Pi(h,E)}]:[!1,v,{}]}function Pi(e,a){return r=>{e&&e(r),r.defaultPrevented||a(r)}}function B_({page:e,...a}){let{router:r}=_x(),l=F.useMemo(()=>fx(r.routes,e,r.basename),[r.routes,e,r.basename]);return l?F.createElement(z_,{page:e,matches:l,...a}):null}function F_(e){let{manifest:a,routeModules:r}=Nx(),[l,s]=F.useState([]);return F.useEffect(()=>{let u=!1;return C_(e,a,r).then(c=>{u||s(c)}),()=>{u=!0}},[e,a,r]),l}function z_({page:e,matches:a,...r}){let l=Sa(),{future:s,manifest:u,routeModules:c}=Nx(),{basename:d}=_x(),{loaderData:f,matches:g}=M_(),b=F.useMemo(()=>sv(e,a,g,u,l,"data"),[e,a,g,u,l]),h=F.useMemo(()=>sv(e,a,g,u,l,"assets"),[e,a,g,u,l]),v=F.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let w=new Set,A=!1;if(a.forEach(N=>{var j;let I=u.routes[N.route.id];!I||!I.hasLoader||(!b.some(H=>H.route.id===N.route.id)&&N.route.id in f&&((j=c[N.route.id])!=null&&j.shouldRevalidate)||I.hasClientLoader?A=!0:w.add(N.route.id))}),w.size===0)return[];let k=__(e,d,s.unstable_trailingSlashAwareDataRequests,"data");return A&&w.size>0&&k.searchParams.set("_routes",a.filter(N=>w.has(N.route.id)).map(N=>N.route.id).join(",")),[k.pathname+k.search]},[d,s.unstable_trailingSlashAwareDataRequests,f,l,u,b,a,e,c]),E=F.useMemo(()=>I_(h,u),[h,u]),x=F_(h);return F.createElement(F.Fragment,null,v.map(w=>F.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),E.map(w=>F.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),x.map(({key:w,link:A})=>F.createElement("link",{key:w,nonce:r.nonce,...A,crossOrigin:A.crossOrigin??r.crossOrigin})))}function j_(...e){return a=>{e.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}var G_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{G_&&(window.__reactRouterVersion="7.13.2")}catch{}function $_({basename:e,children:a,unstable_useTransitions:r,window:l}){let s=F.useRef();s.current==null&&(s.current=vk({window:l,v5Compat:!0}));let u=s.current,[c,d]=F.useState({action:u.action,location:u.location}),f=F.useCallback(g=>{r===!1?d(g):F.startTransition(()=>d(g))},[r]);return F.useLayoutEffect(()=>u.listen(f),[u,f]),F.createElement(b_,{basename:e,children:a,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var Rx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Br=F.forwardRef(function({onClick:a,discover:r="render",prefetch:l="none",relative:s,reloadDocument:u,replace:c,unstable_mask:d,state:f,target:g,to:b,preventScrollReset:h,viewTransition:v,unstable_defaultShouldRevalidate:E,...x},w){let{basename:A,navigator:k,unstable_useTransitions:N}=F.useContext(sn),I=typeof b=="string"&&Rx.test(b),j=yx(b,A);b=j.to;let H=t_(b,{relative:s}),M=Sa(),W=null;if(d){let q=_d(d,[],M.unstable_mask?M.unstable_mask.pathname:"/",!0);A!=="/"&&(q.pathname=q.pathname==="/"?A:Sn([A,q.pathname])),W=k.createHref(q)}let[re,le,B]=U_(l,x),V=V_(b,{replace:c,unstable_mask:d,state:f,target:g,preventScrollReset:h,relative:s,viewTransition:v,unstable_defaultShouldRevalidate:E,unstable_useTransitions:N});function K(q){a&&a(q),q.defaultPrevented||V(q)}let ne=!(j.isExternal||u),ae=F.createElement("a",{...x,...B,href:(ne?W:void 0)||j.absoluteURL||H,onClick:ne?K:a,ref:j_(w,le),target:g,"data-discover":!I&&r==="render"?"true":void 0});return re&&!I?F.createElement(F.Fragment,null,ae,F.createElement(B_,{page:H})):ae});Br.displayName="Link";var H_=F.forwardRef(function({"aria-current":a="page",caseSensitive:r=!1,className:l="",end:s=!1,style:u,to:c,viewTransition:d,children:f,...g},b){let h=ul(c,{relative:g.relative}),v=Sa(),E=F.useContext(as),{navigator:x,basename:w}=F.useContext(sn),A=E!=null&&K_(h)&&d===!0,k=x.encodeLocation?x.encodeLocation(h).pathname:h.pathname,N=v.pathname,I=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;r||(N=N.toLowerCase(),I=I?I.toLowerCase():null,k=k.toLowerCase()),I&&w&&(I=qn(I,w)||I);const j=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let H=N===k||!s&&N.startsWith(k)&&N.charAt(j)==="/",M=I!=null&&(I===k||!s&&I.startsWith(k)&&I.charAt(k.length)==="/"),W={isActive:H,isPending:M,isTransitioning:A},re=H?a:void 0,le;typeof l=="function"?le=l(W):le=[l,H?"active":null,M?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let B=typeof u=="function"?u(W):u;return F.createElement(Br,{...g,"aria-current":re,className:le,ref:b,style:B,to:c,viewTransition:d},typeof f=="function"?f(W):f)});H_.displayName="NavLink";var P_=F.forwardRef(({discover:e="render",fetcherKey:a,navigate:r,reloadDocument:l,replace:s,state:u,method:c=Yo,action:d,onSubmit:f,relative:g,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:v,...E},x)=>{let{unstable_useTransitions:w}=F.useContext(sn),A=X_(),k=Z_(d,{relative:g}),N=c.toLowerCase()==="get"?"get":"post",I=typeof d=="string"&&Rx.test(d),j=H=>{if(f&&f(H),H.defaultPrevented)return;H.preventDefault();let M=H.nativeEvent.submitter,W=(M==null?void 0:M.getAttribute("formmethod"))||c,re=()=>A(M||H.currentTarget,{fetcherKey:a,method:W,navigate:r,replace:s,state:u,relative:g,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:v});w&&r!==!1?F.startTransition(()=>re()):re()};return F.createElement("form",{ref:x,method:N,action:k,onSubmit:l?f:j,...E,"data-discover":!I&&e==="render"?"true":void 0})});P_.displayName="Form";function q_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Cx(e){let a=F.useContext(jr);return Ke(a,q_(e)),a}function V_(e,{target:a,replace:r,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:g}={}){let b=sl(),h=Sa(),v=ul(e,{relative:c});return F.useCallback(E=>{if(T_(E,a)){E.preventDefault();let x=r!==void 0?r:el(h)===el(v),w=()=>b(e,{replace:x,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:f});g?F.startTransition(()=>w()):w()}},[h,b,v,r,l,s,a,e,u,c,d,f,g])}var Y_=0,W_=()=>`__${String(++Y_)}__`;function X_(){let{router:e}=Cx("useSubmit"),{basename:a}=F.useContext(sn),r=f_(),l=e.fetch,s=e.navigate;return F.useCallback(async(u,c={})=>{let{action:d,method:f,encType:g,formData:b,body:h}=k_(u,a);if(c.navigate===!1){let v=c.fetcherKey||W_();await l(v,r,c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||f,formEncType:c.encType||g,flushSync:c.flushSync})}else await s(c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||f,formEncType:c.encType||g,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[l,s,a,r])}function Z_(e,{relative:a}={}){let{basename:r}=F.useContext(sn),l=F.useContext(xn);Ke(l,"useFormAction must be used inside a RouteContext");let[s]=l.matches.slice(-1),u={...ul(e||".",{relative:a})},c=Sa();if(e==null){u.search=c.search;let d=new URLSearchParams(u.search),f=d.getAll("index");if(f.some(b=>b==="")){d.delete("index"),f.filter(h=>h).forEach(h=>d.append("index",h));let b=d.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])),el(u)}function K_(e,{relative:a}={}){let r=F.useContext(Sx);Ke(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=Cx("useViewTransitionState"),s=ul(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 Qo(s.pathname,c)!=null||Qo(s.pathname,u)!=null}const uv=e=>{let a;const r=new Set,l=(g,b)=>{const h=typeof g=="function"?g(a):g;if(!Object.is(h,a)){const v=a;a=b??(typeof h!="object"||h===null)?h:Object.assign({},a,h),r.forEach(E=>E(a,v))}},s=()=>a,d={setState:l,getState:s,getInitialState:()=>f,subscribe:g=>(r.add(g),()=>r.delete(g))},f=a=e(l,s,d);return d},Q_=(e=>e?uv(e):uv),J_=e=>e;function eN(e,a=J_){const r=on.useSyncExternalStore(e.subscribe,on.useCallback(()=>a(e.getState()),[e,a]),on.useCallback(()=>a(e.getInitialState()),[e,a]));return on.useDebugValue(r),r}const cv=e=>{const a=Q_(e),r=l=>eN(a,l);return Object.assign(r,a),r},tN=(e=>e?cv(e):cv),ut=tN((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,referencedStashIds:new Set,activeStashId:null,stashServerReady:!1,previewPort:null,previewPorts:new Map,stashActivity:new Map,activityDrawerStashId:null,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}),setTimeout(async()=>{for(const[,c]of a().stashes)if(c.status==="generating")try{const d=await fetch(`/api/stash-activity/${c.id}`);if(d.ok){const{data:f}=await d.json();(f==null?void 0:f.length)>0&&e(g=>{const b=new Map(g.stashActivity);return b.set(c.id,f),{stashActivity:b}})}}catch{}},100);break;case"processing":u.chatId===a().currentChatId&&e({isProcessing:!0});break;case"stash:status":e(c=>{const d=new Map(c.stashes),f=d.get(u.stashId);f?d.set(u.stashId,{...f,status:u.status,prompt:f.prompt||u.prompt||"",originChatId:f.originChatId||c.currentChatId||void 0}):d.set(u.stashId,{id:u.stashId,number:u.number??d.size+1,projectId:c.projectId??"",originChatId:c.currentChatId??void 0,prompt:u.prompt??"",branch:"",worktreePath:"",port:null,screenshotUrl:null,screenshots:[],status:u.status,error:null,relatedTo:[],createdAt:new Date().toISOString()});const g=c.viewMode==="preview"?"grid":c.viewMode;if(u.status==="ready"||u.status==="error"){const b=new Map(c.stashActivity);b.delete(u.stashId);const h=c.activityDrawerStashId===u.stashId?null:c.activityDrawerStashId;return{stashes:d,viewMode:g,stashActivity:b,activityDrawerStashId:h}}return{stashes:d,viewMode:g}});break;case"stash:screenshot":e(c=>{const d=new Map(c.stashes),f=d.get(u.stashId);return f&&d.set(u.stashId,{...f,screenshotUrl:u.url,screenshots:"screenshots"in u&&u.screenshots?u.screenshots:f.screenshots}),{stashes:d}});break;case"stash:port":e(c=>{const d=new Map(c.previewPorts);d.set(u.stashId,u.port);const f=c.activeStashId===u.stashId;return{previewPorts:d,previewPort:f?u.port:c.previewPort,...f?{stashServerReady:!0}:{}}});break;case"stash:preview_stopped":e(c=>{const d=new Map(c.previewPorts);return d.delete(u.stashId),{previewPorts:d}});break;case"stash:error":e(c=>{const d=new Map(c.stashes),f=d.get(u.stashId);return f&&d.set(u.stashId,{...f,status:"error",error:u.error}),{stashes:d}});break;case"stash:activity":e(c=>{const d=new Map(c.stashActivity),f=d.get(u.stashId)??[];return d.set(u.stashId,[...f,u.event]),{stashActivity:d}});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"component:resolved":{const c=a().selectedComponent;c&&e({selectedComponent:{...c,filePath:u.filePath}});break}case"message:saved":{e(c=>{const d=[...c.messages];for(let f=d.length-1;f>=0;f--){const g=d[f];if(g.role==="user"&&g.content===u.content){d[f]={...g,id:u.messageId};break}}return{messages:d}});break}case"message:updated":{e(c=>({messages:c.messages.map(d=>d.id===u.messageId?{...d,componentContext:u.componentContext}:d)}));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){var c;const l=a().selectedComponent,s=l&&l.domSelector===r.domSelector;e({selectedComponent:r,pickerEnabled:!1});const u=document.querySelector('iframe[title="App Preview"], iframe[title="Stash Preview"]');(c=u==null?void 0:u.contentWindow)==null||c.postMessage({type:"stashes:toggle_picker",enabled:!1},"*"),s||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,currentChatId:null,messages:[],isProcessing:!1,activityDrawerStashId:null,stashActivity:new Map})}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 g of c)u.set(g.id,g);const d=c.length>0,f=a().currentChatId===r;e({currentChatId:r,messages:s.messages??[],stashes:u,viewMode:f?a().viewMode:d?"grid":"preview",selectedStashIds:f?a().selectedStashIds:new Set,referencedStashIds:f?a().referencedStashIds:new Set(s.referencedStashIds??[]),activeStashId:f?a().activeStashId:null,isProcessing:f?a().isProcessing:!1,activityDrawerStashId:f?a().activityDrawerStashId:null,stashActivity:f?a().stashActivity:new Map})}catch{}},async newChat(r){const l=await fetch("/api/chats",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({referencedStashIds:r})}),{data:s}=await l.json();return e(u=>({chats:[s,...u.chats],currentChatId:s.id,messages:[],viewMode:"preview",selectedStashIds:new Set,referencedStashIds:new Set(r??[]),activeStashId:null,isProcessing:!1,activityDrawerStashId:null,stashActivity:new Map})),s.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,d=c?{name:c.name,filePath:c.filePath&&c.filePath!=="auto-detect"?c.filePath:void 0,sourceStashId:void 0}:void 0;e({isProcessing:!0}),a().addMessage({role:"user",content:r,type:"text",referenceStashIds:u.length>0?u:void 0,componentContext:d}),a().send({type:"message",projectId:l,chatId:s,message:r,...u.length>0?{referenceStashIds:u}:{},...d?{componentContext:d}:{}}),c&&e({selectedComponent:null})},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})},addReferencedStashIds(r){const l=a().currentChatId;e(s=>{const u=new Set(s.referencedStashIds);for(const c of r)u.add(c);return l&&fetch(`/api/chats/${l}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({referencedStashIds:[...u]})}),{referencedStashIds:u}})},interactStash(r){const l=a().previewPorts.get(r),s=a().currentChatId,u=a().selectedStashIds,c=a().referencedStashIds,d=[...a().stashes.values()].filter(f=>f.originChatId===s||u.has(f.id)||c.has(f.id)).sort((f,g)=>f.createdAt.localeCompare(g.createdAt)).map(f=>f.id);e({activeStashId:r,viewMode:"interact",stashServerReady:!!l,previewPort:l??null}),a().send({type:"interact",stashId:r,sortedStashIds:d})},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}})},openActivityDrawer(r){e({activityDrawerStashId:r})},closeActivityDrawer(){e({activityDrawerStashId:null})}}));function Ix({stash:e,index:a,isSelected:r,onSelect:l,onClick:s,onDelete:u}){const[c,d]=F.useState(!1),f=F.useRef(null);F.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);function g(E){E.stopPropagation(),d(!0),f.current=setTimeout(()=>d(!1),5e3)}function b(E){E.stopPropagation(),f.current&&clearTimeout(f.current),d(!1),u(e.id)}function h(E){E.stopPropagation(),f.current&&clearTimeout(f.current),d(!1)}function v(E){E.target.closest("button")||s(e)}return S.jsxs("div",{onClick:v,className:`bg-[var(--stashes-surface)] border-2 rounded-xl overflow-hidden cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group ${r?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${a*40}ms`},children:[S.jsxs("div",{className:"aspect-video bg-[var(--stashes-bg)] relative overflow-hidden",children:[e.screenshotUrl?S.jsx("img",{src:e.screenshotUrl,alt:"",className:"w-full h-full object-cover object-top transition-transform duration-300 group-hover:scale-[1.02]"}):S.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-[var(--stashes-text-muted)]",children:"No preview"}),S.jsx("div",{className:`absolute top-2.5 left-2.5 z-10 transition-opacity duration-200 ${r?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:S.jsx("button",{onClick:E=>{E.stopPropagation(),l(e.id)},className:`w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all ${r?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"bg-black/40 border-white/60 hover:border-white backdrop-blur-sm"}`,children:r&&S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),S.jsx("div",{className:`absolute top-2.5 right-2.5 z-10 flex items-center gap-1 transition-opacity duration-200 ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:c?S.jsxs(S.Fragment,{children:[S.jsx("button",{onClick:b,className:"w-6 h-6 rounded-full bg-red-500/80 backdrop-blur-sm border border-red-400/60 flex items-center justify-center hover:bg-red-500 transition-all",title:"Confirm delete",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),S.jsx("button",{onClick:h,className:"w-6 h-6 rounded-full bg-black/40 backdrop-blur-sm border border-white/20 flex items-center justify-center hover:bg-white/20 transition-all",title:"Cancel",children:S.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:S.jsx("path",{d:"M2 2L8 8M8 2L2 8",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):S.jsx("button",{onClick:g,className:"w-6 h-6 rounded-full bg-black/40 backdrop-blur-sm border border-white/20 flex items-center justify-center hover:bg-red-500/80 hover:border-red-400/60 transition-all",title:"Delete stash",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:S.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:"white",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),S.jsx("div",{className:"p-2.5",children:S.jsxs("p",{className:"text-[11px] text-[var(--stashes-text-muted)] line-clamp-2 leading-relaxed",children:[S.jsxs("span",{className:"font-semibold text-[var(--stashes-text)]",children:["#",e.number]})," ",e.prompt]})})]})}function Ox({onDelete:e,className:a=""}){const[r,l]=F.useState(!1),s=F.useRef(null);F.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);function u(f){f.stopPropagation(),l(!0),s.current=setTimeout(()=>l(!1),5e3)}function c(f){f.stopPropagation(),s.current&&clearTimeout(s.current),l(!1),e()}function d(f){f.stopPropagation(),s.current&&clearTimeout(s.current),l(!1)}return r?S.jsxs("div",{className:`flex items-center gap-1 ${a}`,children:[S.jsx("button",{onClick:c,className:"text-red-400 hover:text-red-300 transition-colors p-1 rounded",title:"Confirm delete",children:S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),S.jsx("button",{onClick:d,className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors p-1 rounded",title:"Cancel",children:S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 10 10",fill:"none",children:S.jsx("path",{d:"M2 2L8 8M8 2L2 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):S.jsx("button",{onClick:u,className:`text-[var(--stashes-text-muted)] hover:text-red-400 transition-all p-1 rounded ${a}`,title:"Delete",children:S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:S.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"})})})}const dv=8,pv=5;function nN(){const e=sl(),{chats:a,stashes:r,projectName:l,loadChats:s,newChat:u,deleteChat:c,deleteStash:d}=ut(),[f,g]=F.useState(new Set),[b,h]=F.useState(new Set),[v,E]=F.useState(!1),x=[...r.values()].filter(V=>V.status==="ready").sort((V,K)=>new Date(K.createdAt).getTime()-new Date(V.createdAt).getTime()),w=x.slice(0,dv),A=a.slice(0,pv),k=f.size>0||b.size>0;F.useEffect(()=>{s()},[s]);const N=F.useCallback(V=>{g(K=>{const ne=new Set(K);return ne.has(V)?ne.delete(V):ne.add(V),ne})},[]),I=F.useCallback(V=>{h(K=>{const ne=new Set(K);return ne.has(V)?ne.delete(V):ne.add(V),ne})},[]);function j(){g(new Set),h(new Set),E(!1)}async function H(){const V=await u();e(`/chat/${V}`)}async function M(V){const K=await u([V.id]),ne=ut.getState();ne.toggleStashSelection(V.id),ne.interactStash(V.id),e(`/chat/${K}`)}async function W(){const V=[...f],K=await u(V),ne=ut.getState();for(const ae of V)ne.toggleStashSelection(ae);j(),e(`/chat/${K}`)}function re(){for(const V of f)d(V);for(const V of b)c(V);j()}function le(V){const K=new Date(V),ae=new Date().getTime()-K.getTime(),q=Math.floor(ae/6e4);if(q<1)return"just now";if(q<60)return`${q}m ago`;const U=Math.floor(q/60);if(U<24)return`${U}h ago`;const J=Math.floor(U/24);return J<7?`${J}d ago`:K.toLocaleDateString()}function B(){const V=[];return f.size>0&&V.push(`${f.size} stash${f.size!==1?"es":""}`),b.size>0&&V.push(`${b.size} chat${b.size!==1?"s":""}`),V.join(", ")+" selected"}return S.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[S.jsxs("div",{className:"max-w-5xl mx-auto",children:[S.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[S.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:l??"Stashes"}),S.jsx("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:"Design explorations for your app"})]}),S.jsx("div",{onClick:H,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:S.jsxs("div",{className:"flex items-center gap-2",children:[S.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:S.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),S.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),x.length>0&&S.jsxs("div",{className:"mb-10",style:{animation:"fadeIn 0.5s ease-out 0.1s both"},children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider",children:["Stashes (",x.length,")"]}),x.length>dv&&S.jsx(Br,{to:"/stashes",className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-primary)] transition-colors",children:"View all →"})]}),S.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:w.map((V,K)=>S.jsx(Ix,{stash:V,index:K,isSelected:f.has(V.id),onSelect:N,onClick:M,onDelete:ne=>{d(ne),g(ae=>{const q=new Set(ae);return q.delete(ne),q})}},V.id))})]}),a.length>0&&S.jsxs("div",{style:{animation:"fadeIn 0.5s ease-out 0.2s both"},children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider",children:["Conversations (",a.length,")"]}),a.length>pv&&S.jsx(Br,{to:"/chats",className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-primary)] transition-colors",children:"View all →"})]}),S.jsx("div",{className:"space-y-2",children:A.map((V,K)=>{const ne=b.has(V.id);return S.jsxs("div",{onClick:()=>e(`/chat/${V.id}`),className:`bg-[var(--stashes-surface)] border-2 rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group flex items-center justify-between ${ne?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${K*40}ms`},children:[S.jsx("div",{className:`flex-shrink-0 mr-3 transition-opacity duration-200 ${ne?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:S.jsx("button",{onClick:ae=>{ae.stopPropagation(),I(V.id)},className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all ${ne?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"border-[var(--stashes-border-hover)] hover:border-[var(--stashes-text-muted)]"}`,children:ne&&S.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),S.jsx("div",{className:"min-w-0 flex-1",children:S.jsx("div",{className:"font-semibold text-sm truncate",children:V.title})}),S.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[S.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:le(V.updatedAt)}),S.jsx(Ox,{onDelete:()=>c(V.id),className:"opacity-0 group-hover:opacity-100 focus-within:opacity-100"})]})]},V.id)})})]})]}),k&&S.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:S.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[S.jsx("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:B()}),S.jsx("button",{onClick:j,className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),f.size>0&&b.size===0&&S.jsx("button",{onClick:W,className:"bg-[var(--stashes-primary)] hover:brightness-110 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Start chat"}),v?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:re,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),S.jsx("button",{onClick:()=>E(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):S.jsx("button",{onClick:()=>E(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function aN(){const e=sl(),{stashes:a,projectName:r,loadChats:l,newChat:s,deleteStash:u}=ut(),[c,d]=F.useState(new Set),[f,g]=F.useState(!1),b=[...a.values()].filter(w=>w.status==="ready").sort((w,A)=>new Date(A.createdAt).getTime()-new Date(w.createdAt).getTime());F.useEffect(()=>{l()},[l]);const h=F.useCallback(w=>{d(A=>{const k=new Set(A);return k.has(w)?k.delete(w):k.add(w),k})},[]);async function v(w){const A=await s([w.id]),k=ut.getState();k.toggleStashSelection(w.id),k.interactStash(w.id),e(`/chat/${A}`)}async function E(){const w=[...c],A=await s(w),k=ut.getState();for(const N of w)k.toggleStashSelection(N);d(new Set),e(`/chat/${A}`)}function x(){for(const w of c)u(w);d(new Set),g(!1)}return S.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[S.jsxs("div",{className:"max-w-5xl mx-auto",children:[S.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[S.jsxs(Br,{to:"/",className:"text-sm text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors mb-3 inline-flex items-center gap-1.5",children:[S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:S.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),r??"Home"]}),S.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"All Stashes"}),S.jsxs("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:[b.length," design exploration",b.length!==1?"s":""]})]}),b.length>0?S.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:b.map((w,A)=>S.jsx(Ix,{stash:w,index:A,isSelected:c.has(w.id),onSelect:h,onClick:v,onDelete:k=>{u(k),d(N=>{const I=new Set(N);return I.delete(k),I})}},w.id))}):S.jsx("div",{className:"text-center py-16 text-[var(--stashes-text-muted)] text-sm",children:"No stashes yet. Start a conversation to generate design explorations."})]}),c.size>0&&S.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:S.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[S.jsxs("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:[c.size," stash",c.size!==1?"es":""," selected"]}),S.jsx("button",{onClick:()=>{d(new Set),g(!1)},className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),S.jsx("button",{onClick:E,className:"bg-[var(--stashes-primary)] hover:brightness-110 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Start chat"}),f?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:x,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),S.jsx("button",{onClick:()=>g(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):S.jsx("button",{onClick:()=>g(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function rN(e){const a=new Date(e),l=new Date().getTime()-a.getTime(),s=Math.floor(l/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const u=Math.floor(s/60);if(u<24)return`${u}h ago`;const c=Math.floor(u/24);return c<7?`${c}d ago`:a.toLocaleDateString()}function iN(){const e=sl(),{chats:a,projectName:r,loadChats:l,newChat:s,deleteChat:u}=ut(),[c,d]=F.useState(new Set),[f,g]=F.useState(!1);F.useEffect(()=>{l()},[l]);const b=F.useCallback(x=>{d(w=>{const A=new Set(w);return A.has(x)?A.delete(x):A.add(x),A})},[]);function h(){d(new Set),g(!1)}function v(){for(const x of c)u(x);h()}async function E(){const x=await s();e(`/chat/${x}`)}return S.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[S.jsxs("div",{className:"max-w-5xl mx-auto",children:[S.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[S.jsxs(Br,{to:"/",className:"text-sm text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors mb-3 inline-flex items-center gap-1.5",children:[S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:S.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),r??"Home"]}),S.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"All Conversations"}),S.jsxs("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:[a.length," conversation",a.length!==1?"s":""]})]}),S.jsx("div",{onClick:E,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:S.jsxs("div",{className:"flex items-center gap-2",children:[S.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:S.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),S.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),a.length>0?S.jsx("div",{className:"space-y-2",children:a.map((x,w)=>{const A=c.has(x.id);return S.jsxs("div",{onClick:()=>e(`/chat/${x.id}`),className:`bg-[var(--stashes-surface)] border-2 rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group flex items-center justify-between ${A?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${w*40}ms`},children:[S.jsx("div",{className:`flex-shrink-0 mr-3 transition-opacity duration-200 ${A?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:S.jsx("button",{onClick:k=>{k.stopPropagation(),b(x.id)},className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all ${A?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"border-[var(--stashes-border-hover)] hover:border-[var(--stashes-text-muted)]"}`,children:A&&S.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:S.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),S.jsx("div",{className:"min-w-0 flex-1",children:S.jsx("div",{className:"font-semibold text-sm truncate",children:x.title})}),S.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[S.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:rN(x.updatedAt)}),S.jsx(Ox,{onDelete:()=>u(x.id),className:"opacity-0 group-hover:opacity-100 focus-within:opacity-100"})]})]},x.id)})}):S.jsx("div",{className:"text-center py-16 text-[var(--stashes-text-muted)] text-sm",children:"No conversations yet. Start one to begin designing."})]}),c.size>0&&S.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:S.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[S.jsxs("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:[c.size," chat",c.size!==1?"s":""," selected"]}),S.jsx("button",{onClick:h,className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),f?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:v,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),S.jsx("button",{onClick:()=>g(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):S.jsx("button",{onClick:()=>g(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function fv(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 lN(e,a){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const oN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uN={};function gv(e,a){return(uN.jsx?sN:oN).test(e)}const cN=/[ \t\n\f\r]/g;function dN(e){return typeof e=="object"?e.type==="text"?mv(e.value):!1:mv(e)}function mv(e){return e.replace(cN,"")===""}class cl{constructor(a,r,l){this.normal=r,this.property=a,l&&(this.space=l)}}cl.prototype.normal={};cl.prototype.property={};cl.prototype.space=void 0;function Lx(e,a){const r={},l={};for(const s of e)Object.assign(r,s.property),Object.assign(l,s.normal);return new cl(r,l,a)}function tl(e){return e.toLowerCase()}class Ft{constructor(a,r){this.attribute=r,this.property=a}}Ft.prototype.attribute="";Ft.prototype.booleanish=!1;Ft.prototype.boolean=!1;Ft.prototype.commaOrSpaceSeparated=!1;Ft.prototype.commaSeparated=!1;Ft.prototype.defined=!1;Ft.prototype.mustUseProperty=!1;Ft.prototype.number=!1;Ft.prototype.overloadedBoolean=!1;Ft.prototype.property="";Ft.prototype.spaceSeparated=!1;Ft.prototype.space=void 0;let pN=0;const xe=$a(),lt=$a(),cd=$a(),ie=$a(),Ye=$a(),Ur=$a(),Yt=$a();function $a(){return 2**++pN}const dd=Object.freeze(Object.defineProperty({__proto__:null,boolean:xe,booleanish:lt,commaOrSpaceSeparated:Yt,commaSeparated:Ur,number:ie,overloadedBoolean:cd,spaceSeparated:Ye},Symbol.toStringTag,{value:"Module"})),Pc=Object.keys(dd);class Ld extends Ft{constructor(a,r,l,s){let u=-1;if(super(a,r),hv(this,"space",s),typeof l=="number")for(;++u<Pc.length;){const c=Pc[u];hv(this,Pc[u],(l&dd[c])===dd[c])}}}Ld.prototype.defined=!0;function hv(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 Ld(l,e.transform(e.attributes||{},l),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),a[l]=u,r[tl(l)]=l,r[tl(u.attribute)]=l}return new cl(a,r,e.space)}const Dx=Gr({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,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:ie,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ye,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ye,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:lt,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(e,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function Mx(e,a){return a in e?e[a]:a}function Ux(e,a){return Mx(e,a.toLowerCase())}const fN=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:xe,allowPaymentRequest:xe,allowUserMedia:xe,alt:null,as:null,async:xe,autoCapitalize:null,autoComplete:Ye,autoFocus:xe,autoPlay:xe,blocking:Ye,capture:null,charSet:null,checked:xe,cite:null,className:Ye,cols:ie,colSpan:null,content:null,contentEditable:lt,controls:xe,controlsList:Ye,coords:ie|Ur,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xe,defer:xe,dir:null,dirName:null,disabled:xe,download:cd,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xe,formTarget:null,headers:Ye,height:ie,hidden:cd,high:ie,href:null,hrefLang:null,htmlFor:Ye,httpEquiv:Ye,id:null,imageSizes:null,imageSrcSet:null,inert:xe,inputMode:null,integrity:null,is:null,isMap:xe,itemId:null,itemProp:Ye,itemRef:Ye,itemScope:xe,itemType:Ye,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xe,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:xe,muted:xe,name:null,nonce:null,noModule:xe,noValidate:xe,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:xe,optimum:ie,pattern:null,ping:Ye,placeholder:null,playsInline:xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xe,referrerPolicy:null,rel:Ye,required:xe,reversed:xe,rows:ie,rowSpan:ie,sandbox:Ye,scope:null,scoped:xe,seamless:xe,selected:xe,shadowRootClonable:xe,shadowRootDelegatesFocus:xe,shadowRootMode:null,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:xe,useMap:null,value:lt,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ye,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xe,declare:xe,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:xe,noHref:xe,noShade:xe,noWrap:xe,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xe,disableRemotePlayback:xe,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:Ux}),gN=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:Yt,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,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:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,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:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:Yt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,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:ie,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:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ye,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yt,rev:Yt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yt,requiredFeatures:Yt,requiredFonts:Yt,requiredFormats:Yt,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:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:Yt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yt,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Mx}),Bx=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()}}),Fx=Gr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ux}),zx=Gr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,a){return"xml:"+a.slice(3).toLowerCase()}}),mN={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"},hN=/[A-Z]/g,bv=/-[a-z]/g,bN=/^data[-\w.:]+$/i;function jx(e,a){const r=tl(a);let l=a,s=Ft;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&bN.test(a)){if(a.charAt(4)==="-"){const u=a.slice(5).replace(bv,EN);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=a.slice(4);if(!bv.test(u)){let c=u.replace(hN,yN);c.charAt(0)!=="-"&&(c="-"+c),a="data"+c}}s=Ld}return new s(l,a)}function yN(e){return"-"+e.toLowerCase()}function EN(e){return e.charAt(1).toUpperCase()}const Gx=Lx([Dx,fN,Bx,Fx,zx],"html"),is=Lx([Dx,gN,Bx,Fx,zx],"svg");function yv(e){const a=String(e||"").trim();return a?a.split(/[ \t\n\r\f]+/g):[]}function SN(e){return e.join(" ").trim()}var Or={},qc,Ev;function vN(){if(Ev)return qc;Ev=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
61
61
  `,g="/",b="*",h="",v="comment",E="declaration";function x(A,k){if(typeof A!="string")throw new TypeError("First argument must be a string");if(!A)return[];k=k||{};var N=1,I=1;function j(ae){var q=ae.match(a);q&&(N+=q.length);var U=ae.lastIndexOf(f);I=~U?ae.length-U:I+ae.length}function H(){var ae={line:N,column:I};return function(q){return q.position=new M(ae),le(),q}}function M(ae){this.start=ae,this.end={line:N,column:I},this.source=k.source}M.prototype.content=A;function W(ae){var q=new Error(k.source+":"+N+":"+I+": "+ae);if(q.reason=ae,q.filename=k.source,q.line=N,q.column=I,q.source=A,!k.silent)throw q}function re(ae){var q=ae.exec(A);if(q){var U=q[0];return j(U),A=A.slice(U.length),q}}function le(){re(r)}function B(ae){var q;for(ae=ae||[];q=V();)q!==!1&&ae.push(q);return ae}function V(){var ae=H();if(!(g!=A.charAt(0)||b!=A.charAt(1))){for(var q=2;h!=A.charAt(q)&&(b!=A.charAt(q)||g!=A.charAt(q+1));)++q;if(q+=2,h===A.charAt(q-1))return W("End of comment missing");var U=A.slice(2,q-2);return I+=2,j(U),A=A.slice(q),I+=2,ae({type:v,comment:U})}}function K(){var ae=H(),q=re(l);if(q){if(V(),!re(s))return W("property missing ':'");var U=re(u),J=ae({type:E,property:w(q[0].replace(e,h)),value:U?w(U[0].replace(e,h)):h});return re(c),J}}function ne(){var ae=[];B(ae);for(var q;q=K();)q!==!1&&(ae.push(q),B(ae));return ae}return le(),ne()}function w(A){return A?A.replace(d,h):h}return qc=x,qc}var Sv;function xN(){if(Sv)return Or;Sv=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(vN());function r(l,s){let u=null;if(!l||typeof l!="string")return u;const c=(0,a.default)(l),d=typeof s=="function";return c.forEach(f=>{if(f.type!=="declaration")return;const{property:g,value:b}=f;d?s(g,b,f):b&&(u=u||{},u[g]=b)}),u}return Or}var qi={},vv;function TN(){if(vv)return qi;vv=1,Object.defineProperty(qi,"__esModule",{value:!0}),qi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,a=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,u=function(g){return!g||r.test(g)||e.test(g)},c=function(g,b){return b.toUpperCase()},d=function(g,b){return"".concat(b,"-")},f=function(g,b){return b===void 0&&(b={}),u(g)?g:(g=g.toLowerCase(),b.reactCompat?g=g.replace(s,d):g=g.replace(l,d),g.replace(a,c))};return qi.camelCase=f,qi}var Vi,xv;function AN(){if(xv)return Vi;xv=1;var e=Vi&&Vi.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},a=e(xN()),r=TN();function l(s,u){var c={};return!s||typeof s!="string"||(0,a.default)(s,function(d,f){d&&f&&(c[(0,r.camelCase)(d,u)]=f)}),c}return l.default=l,Vi=l,Vi}var wN=AN();const kN=wd(wN),$x=Hx("end"),Dd=Hx("start");function Hx(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 _N(e){const a=Dd(e),r=$x(e);if(a&&r)return{start:a,end:r}}function Zi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Tv(e.position):"start"in e||"end"in e?Tv(e):"line"in e||"column"in e?pd(e):""}function pd(e){return Av(e&&e.line)+":"+Av(e&&e.column)}function Tv(e){return pd(e&&e.start)+"-"+pd(e&&e.end)}function Av(e){return e&&typeof e=="number"?e:1}class vt 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 f=l.indexOf(":");f===-1?u.ruleId=l:(u.source=l.slice(0,f),u.ruleId=l.slice(f+1))}if(!u.place&&u.ancestors&&u.ancestors){const f=u.ancestors[u.ancestors.length-1];f&&(u.place=f.position)}const d=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=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=Zi(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}}vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;const Md={}.hasOwnProperty,NN=new Map,RN=/[A-Z]/g,CN=new Set(["table","tbody","thead","tfoot","tr"]),IN=new Set(["td","th"]),Px="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ON(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=jN(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=zN(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"?is:Gx,stylePropertyNameCase:a.stylePropertyNameCase||"dom",tableCellAlignToStyle:a.tableCellAlignToStyle!==!1},u=qx(s,e,void 0);return u&&typeof u!="string"?u:s.create(e,s.Fragment,{children:u||void 0},void 0)}function qx(e,a,r){if(a.type==="element")return LN(e,a,r);if(a.type==="mdxFlowExpression"||a.type==="mdxTextExpression")return DN(e,a);if(a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement")return UN(e,a,r);if(a.type==="mdxjsEsm")return MN(e,a);if(a.type==="root")return BN(e,a,r);if(a.type==="text")return FN(e,a)}function LN(e,a,r){const l=e.schema;let s=l;a.tagName.toLowerCase()==="svg"&&l.space==="html"&&(s=is,e.schema=s),e.ancestors.push(a);const u=Yx(e,a.tagName,!1),c=GN(e,a);let d=Bd(e,a);return CN.has(a.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!dN(f):!0})),Vx(e,c,u,a),Ud(c,d),e.ancestors.pop(),e.schema=l,e.create(a,u,c,r)}function DN(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)}nl(e,a.position)}function MN(e,a){if(a.data&&a.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(a.data.estree);nl(e,a.position)}function UN(e,a,r){const l=e.schema;let s=l;a.name==="svg"&&l.space==="html"&&(s=is,e.schema=s),e.ancestors.push(a);const u=a.name===null?e.Fragment:Yx(e,a.name,!0),c=$N(e,a),d=Bd(e,a);return Vx(e,c,u,a),Ud(c,d),e.ancestors.pop(),e.schema=l,e.create(a,u,c,r)}function BN(e,a,r){const l={};return Ud(l,Bd(e,a)),e.create(a,e.Fragment,l,r)}function FN(e,a){return a.value}function Vx(e,a,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(a.node=l)}function Ud(e,a){if(a.length>0){const r=a.length>1?a:a[0];r&&(e.children=r)}}function zN(e,a,r){return l;function l(s,u,c,d){const g=Array.isArray(c.children)?r:a;return d?g(u,c,d):g(u,c)}}function jN(e,a){return r;function r(l,s,u,c){const d=Array.isArray(u.children),f=Dd(l);return a(s,u,c,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function GN(e,a){const r={};let l,s;for(s in a.properties)if(s!=="children"&&Md.call(a.properties,s)){const u=HN(e,s,a.properties[s]);if(u){const[c,d]=u;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&IN.has(a.tagName)?l=d:r[c]=d}}if(l){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function $N(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 d=c.properties[0];d.type,Object.assign(r,e.evaluater.evaluateExpression(d.argument))}else nl(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 d=l.value.data.estree.body[0];d.type,u=e.evaluater.evaluateExpression(d.expression)}else nl(e,a.position);else u=l.value===null?!0:l.value;r[s]=u}return r}function Bd(e,a){const r=[];let l=-1;const s=e.passKeys?new Map:NN;for(;++l<a.children.length;){const u=a.children[l];let c;if(e.passKeys){const f=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(f){const g=s.get(f)||0;c=f+"-"+g,s.set(f,g+1)}}const d=qx(e,u,c);d!==void 0&&r.push(d)}return r}function HN(e,a,r){const l=jx(e.schema,a);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=l.commaSeparated?lN(r):SN(r)),l.property==="style"){let s=typeof r=="object"?r:PN(e,String(r));return e.stylePropertyNameCase==="css"&&(s=qN(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&l.space?mN[l.property]||l.property:l.attribute,r]}}function PN(e,a){try{return kN(a,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const l=r,s=new vt("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=Px+"#cannot-parse-style-attribute",s}}function Yx(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 d=gv(s[u])?{type:"Identifier",name:s[u]}:{type:"Literal",value:s[u]};c=c?{type:"MemberExpression",object:c,property:d,computed:!!(u&&d.type==="Literal"),optional:!1}:d}l=c}else l=gv(a)&&!/^[a-z]/.test(a)?{type:"Identifier",name:a}:{type:"Literal",value:a};if(l.type==="Literal"){const s=l.value;return Md.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(l);nl(e)}function nl(e,a){const r=new vt("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=Px+"#cannot-handle-mdx-estrees-without-createevaluater",r}function qN(e){const a={};let r;for(r in e)Md.call(e,r)&&(a[VN(r)]=e[r]);return a}function VN(e){let a=e.replace(RN,YN);return a.slice(0,3)==="ms-"&&(a="-"+a),a}function YN(e){return"-"+e.toLowerCase()}const Vc={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"]},WN={};function Fd(e,a){const r=WN,l=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Wx(e,l,s)}function Wx(e,a,r){if(XN(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 wv(e.children,a,r)}return Array.isArray(e)?wv(e,a,r):""}function wv(e,a,r){const l=[];let s=-1;for(;++s<e.length;)l[s]=Wx(e[s],a,r);return l.join("")}function XN(e){return!!(e&&typeof e=="object")}const kv=document.createElement("i");function al(e){const a="&"+e+";";kv.innerHTML=a;const r=kv.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===a?!1:r}function Wt(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 ln(e,a){return e.length>0?(Wt(e,e.length,0,a),e):a}const _v={}.hasOwnProperty;function Xx(e){const a={};let r=-1;for(;++r<e.length;)ZN(a,e[r]);return a}function ZN(e,a){let r;for(r in a){const s=(_v.call(e,r)?e[r]:void 0)||(e[r]={}),u=a[r];let c;if(u)for(c in u){_v.call(s,c)||(s[c]=[]);const d=u[c];KN(s[c],Array.isArray(d)?d:d?[d]:[])}}}function KN(e,a){let r=-1;const l=[];for(;++r<a.length;)(a[r].add==="after"?e:l).push(a[r]);Wt(e,0,0,l)}function Zx(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 _t=va(/[A-Za-z]/),St=va(/[\dA-Za-z]/),QN=va(/[#-'*+\--9=?A-Z^-~]/);function Jo(e){return e!==null&&(e<32||e===127)}const fd=va(/\d/),JN=va(/[\dA-Fa-f]/),eR=va(/[!-/:-@[-`{-~]/);function me(e){return e!==null&&e<-2}function Ve(e){return e!==null&&(e<0||e===32)}function _e(e){return e===-2||e===-1||e===32}const ls=va(new RegExp("\\p{P}|\\p{S}","u")),Ga=va(/\s/);function va(e){return a;function a(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function $r(e){const a=[];let r=-1,l=0,s=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&St(e.charCodeAt(r+1))&&St(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 d=e.charCodeAt(r+1);u<56320&&d>56319&&d<57344?(c=String.fromCharCode(u,d),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(f){return _e(f)?(e.enter(r),d(f)):a(f)}function d(f){return _e(f)&&u++<s?(e.consume(f),d):(e.exit(r),a(f))}}const tR={tokenize:nR};function nR(e){const a=e.attempt(this.parser.constructs.contentInitial,l,s);let r;return a;function l(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Oe(e,a,"linePrefix")}function s(d){return e.enter("paragraph"),u(d)}function u(d){const f=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=f),r=f,c(d)}function c(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return me(d)?(e.consume(d),e.exit("chunkText"),u):(e.consume(d),c)}}const aR={tokenize:rR},Nv={tokenize:iR};function rR(e){const a=this,r=[];let l=0,s,u,c;return d;function d(I){if(l<r.length){const j=r[l];return a.containerState=j[1],e.attempt(j[0].continuation,f,g)(I)}return g(I)}function f(I){if(l++,a.containerState._closeFlow){a.containerState._closeFlow=void 0,s&&N();const j=a.events.length;let H=j,M;for(;H--;)if(a.events[H][0]==="exit"&&a.events[H][1].type==="chunkFlow"){M=a.events[H][1].end;break}k(l);let W=j;for(;W<a.events.length;)a.events[W][1].end={...M},W++;return Wt(a.events,H+1,0,a.events.slice(j)),a.events.length=W,g(I)}return d(I)}function g(I){if(l===r.length){if(!s)return v(I);if(s.currentConstruct&&s.currentConstruct.concrete)return x(I);a.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return a.containerState={},e.check(Nv,b,h)(I)}function b(I){return s&&N(),k(l),v(I)}function h(I){return a.parser.lazy[a.now().line]=l!==r.length,c=a.now().offset,x(I)}function v(I){return a.containerState={},e.attempt(Nv,E,x)(I)}function E(I){return l++,r.push([a.currentConstruct,a.containerState]),v(I)}function x(I){if(I===null){s&&N(),k(0),e.consume(I);return}return s=s||a.parser.flow(a.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:u}),w(I)}function w(I){if(I===null){A(e.exit("chunkFlow"),!0),k(0),e.consume(I);return}return me(I)?(e.consume(I),A(e.exit("chunkFlow")),l=0,a.interrupt=void 0,d):(e.consume(I),w)}function A(I,j){const H=a.sliceStream(I);if(j&&H.push(null),I.previous=u,u&&(u.next=I),u=I,s.defineSkip(I.start),s.write(H),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 re=W,le,B;for(;re--;)if(a.events[re][0]==="exit"&&a.events[re][1].type==="chunkFlow"){if(le){B=a.events[re][1].end;break}le=!0}for(k(l),M=W;M<a.events.length;)a.events[M][1].end={...B},M++;Wt(a.events,re+1,0,a.events.slice(W)),a.events.length=M}}function k(I){let j=r.length;for(;j-- >I;){const H=r[j];a.containerState=H[1],H[0].exit.call(a,e)}r.length=I}function N(){s.write([null]),u=void 0,s=void 0,a.containerState._closeFlow=void 0}}function iR(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 Fr(e){if(e===null||Ve(e)||Ga(e))return 1;if(ls(e))return 2}function os(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 gd={name:"attention",resolveAll:lR,tokenize:oR};function lR(e,a){let r=-1,l,s,u,c,d,f,g,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;f=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},v={...e[r][1].start};Rv(h,-f),Rv(v,f),c={type:f>1?"strongSequence":"emphasisSequence",start:h,end:{...e[l][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:v},u={type:f>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},s={type:f>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[l][1].end={...c.start},e[r][1].start={...d.end},g=[],e[l][1].end.offset-e[l][1].start.offset&&(g=ln(g,[["enter",e[l][1],a],["exit",e[l][1],a]])),g=ln(g,[["enter",s,a],["enter",c,a],["exit",c,a],["enter",u,a]]),g=ln(g,os(a.parser.constructs.insideSpan.null,e.slice(l+1,r),a)),g=ln(g,[["exit",u,a],["enter",d,a],["exit",d,a],["exit",s,a]]),e[r][1].end.offset-e[r][1].start.offset?(b=2,g=ln(g,[["enter",e[r][1],a],["exit",e[r][1],a]])):b=0,Wt(e,l-1,r-l+3,g),r=l+g.length-b-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function oR(e,a){const r=this.parser.constructs.attentionMarkers.null,l=this.previous,s=Fr(l);let u;return c;function c(f){return u=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===u)return e.consume(f),d;const g=e.exit("attentionSequence"),b=Fr(f),h=!b||b===2&&s||r.includes(f),v=!s||s===2&&b||r.includes(l);return g._open=!!(u===42?h:h&&(s||!v)),g._close=!!(u===42?v:v&&(b||!h)),a(f)}}function Rv(e,a){e.column+=a,e.offset+=a,e._bufferIndex+=a}const sR={name:"autolink",tokenize:uR};function uR(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 _t(E)?(e.consume(E),c):E===64?r(E):g(E)}function c(E){return E===43||E===45||E===46||St(E)?(l=1,d(E)):g(E)}function d(E){return E===58?(e.consume(E),l=0,f):(E===43||E===45||E===46||St(E))&&l++<32?(e.consume(E),d):(l=0,g(E))}function f(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||Jo(E)?r(E):(e.consume(E),f)}function g(E){return E===64?(e.consume(E),b):QN(E)?(e.consume(E),g):r(E)}function b(E){return St(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):v(E)}function v(E){if((E===45||St(E))&&l++<63){const x=E===45?v:h;return e.consume(E),x}return r(E)}}const dl={partial:!0,tokenize:cR};function cR(e,a,r){return l;function l(u){return _e(u)?Oe(e,s,"linePrefix")(u):s(u)}function s(u){return u===null||me(u)?a(u):r(u)}}const Kx={continuation:{tokenize:pR},exit:fR,name:"blockQuote",tokenize:dR};function dR(e,a,r){const l=this;return s;function s(c){if(c===62){const d=l.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return _e(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),a):(e.exit("blockQuotePrefix"),a(c))}}function pR(e,a,r){const l=this;return s;function s(c){return _e(c)?Oe(e,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(Kx,a,r)(c)}}function fR(e){e.exit("blockQuote")}const Qx={name:"characterEscape",tokenize:gR};function gR(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 eR(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),a):r(u)}}const Jx={name:"characterReference",tokenize:mR};function mR(e,a,r){const l=this;let s=0,u,c;return d;function d(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),f}function f(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),g):(e.enter("characterReferenceValue"),u=31,c=St,b(h))}function g(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=JN,b):(e.enter("characterReferenceValue"),u=7,c=fd,b(h))}function b(h){if(h===59&&s){const v=e.exit("characterReferenceValue");return c===St&&!al(l.sliceSerialize(v))?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 Cv={partial:!0,tokenize:bR},Iv={concrete:!0,name:"codeFenced",tokenize:hR};function hR(e,a,r){const l=this,s={partial:!0,tokenize:H};let u=0,c=0,d;return f;function f(M){return g(M)}function g(M){const W=l.events[l.events.length-1];return u=W&&W[1].type==="linePrefix"?W[2].sliceSerialize(W[1],!0).length:0,d=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(M)}function b(M){return M===d?(c++,e.consume(M),b):c<3?r(M):(e.exit("codeFencedFenceSequence"),_e(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(Cv,w,j)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(M))}function v(M){return M===null||me(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(M)):_e(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Oe(e,E,"whitespace")(M)):M===96&&M===d?r(M):(e.consume(M),v)}function E(M){return M===null||me(M)?h(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(M))}function x(M){return M===null||me(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(M)):M===96&&M===d?r(M):(e.consume(M),x)}function w(M){return e.attempt(s,j,A)(M)}function A(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),k}function k(M){return u>0&&_e(M)?Oe(e,N,"linePrefix",u+1)(M):N(M)}function N(M){return M===null||me(M)?e.check(Cv,w,j)(M):(e.enter("codeFlowValue"),I(M))}function I(M){return M===null||me(M)?(e.exit("codeFlowValue"),N(M)):(e.consume(M),I)}function j(M){return e.exit("codeFenced"),a(M)}function H(M,W,re){let le=0;return B;function B(q){return M.enter("lineEnding"),M.consume(q),M.exit("lineEnding"),V}function V(q){return M.enter("codeFencedFence"),_e(q)?Oe(M,K,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):K(q)}function K(q){return q===d?(M.enter("codeFencedFenceSequence"),ne(q)):re(q)}function ne(q){return q===d?(le++,M.consume(q),ne):le>=c?(M.exit("codeFencedFenceSequence"),_e(q)?Oe(M,ae,"whitespace")(q):ae(q)):re(q)}function ae(q){return q===null||me(q)?(M.exit("codeFencedFence"),W(q)):re(q)}}}function bR(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 Yc={name:"codeIndented",tokenize:ER},yR={partial:!0,tokenize:SR};function ER(e,a,r){const l=this;return s;function s(g){return e.enter("codeIndented"),Oe(e,u,"linePrefix",5)(g)}function u(g){const b=l.events[l.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?c(g):r(g)}function c(g){return g===null?f(g):me(g)?e.attempt(yR,c,f)(g):(e.enter("codeFlowValue"),d(g))}function d(g){return g===null||me(g)?(e.exit("codeFlowValue"),c(g)):(e.consume(g),d)}function f(g){return e.exit("codeIndented"),a(g)}}function SR(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 d=l.events[l.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(c):me(c)?s(c):r(c)}}const vR={name:"codeText",previous:TR,resolve:xR,tokenize:AR};function xR(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 TR(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function AR(e,a,r){let l=0,s,u;return c;function c(h){return e.enter("codeText"),e.enter("codeTextSequence"),d(h)}function d(h){return h===96?(e.consume(h),l++,d):(e.exit("codeTextSequence"),f(h))}function f(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),f):h===96?(u=e.enter("codeTextSequence"),s=0,b(h)):me(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),f):(e.enter("codeTextData"),g(h))}function g(h){return h===null||h===32||h===96||me(h)?(e.exit("codeTextData"),f(h)):(e.consume(h),g)}function b(h){return h===96?(e.consume(h),s++,b):s===l?(e.exit("codeTextSequence"),e.exit("codeText"),a(h)):(u.type="codeTextData",g(h))}}class wR{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&&Yi(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),Yi(this.left,a)}unshift(a){this.setCursor(0),this.right.push(a)}unshiftMany(a){this.setCursor(0),Yi(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);Yi(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-a,Number.POSITIVE_INFINITY);Yi(this.left,r.reverse())}}}function Yi(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 eT(e){const a={};let r=-1,l,s,u,c,d,f,g;const b=new wR(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"&&(f=l[1]._tokenizer.events,u=0,u<f.length&&f[u][1].type==="lineEndingBlank"&&(u+=2),u<f.length&&f[u][1].type==="content"))for(;++u<f.length&&f[u][1].type!=="content";)f[u][1].type==="chunkText"&&(f[u][1]._isInFirstContentOfListItem=!0,u++);if(l[0]==="enter")l[1].contentType&&(Object.assign(a,kR(b,r)),r=a[r],g=!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},d=b.slice(s,r),d.unshift(l),b.splice(s,r-s+1,d))}}return Wt(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!g}function kR(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 d=c.events,f=[],g={};let b,h,v=-1,E=r,x=0,w=0;const A=[w];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;++v<d.length;)d[v][0]==="exit"&&d[v-1][0]==="enter"&&d[v][1].type===d[v-1][1].type&&d[v][1].start.line!==d[v][1].end.line&&(w=v+1,A.push(w),E._tokenizer=void 0,E.previous=void 0,E=E.next);for(c.events=[],E?(E._tokenizer=void 0,E.previous=void 0):A.pop(),v=A.length;v--;){const k=d.slice(A[v],A[v+1]),N=u.pop();f.push([N,N+k.length-1]),e.splice(N,2,k)}for(f.reverse(),v=-1;++v<f.length;)g[x+f[v][0]]=x+f[v][1],x+=f[v][1]-f[v][0]-1;return g}const _R={resolve:RR,tokenize:CR},NR={partial:!0,tokenize:IR};function RR(e){return eT(e),e}function CR(e,a){let r;return l;function l(d){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(d)}function s(d){return d===null?u(d):me(d)?e.check(NR,c,u)(d):(e.consume(d),s)}function u(d){return e.exit("chunkContent"),e.exit("content"),a(d)}function c(d){return e.consume(d),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function IR(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 d=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(c):e.interrupt(l.parser.constructs.flow,r,a)(c)}}function tT(e,a,r,l,s,u,c,d,f){const g=f||Number.POSITIVE_INFINITY;let b=0;return h;function h(k){return k===60?(e.enter(l),e.enter(s),e.enter(u),e.consume(k),e.exit(u),v):k===null||k===32||k===41||Jo(k)?r(k):(e.enter(l),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),w(k))}function v(k){return k===62?(e.enter(u),e.consume(k),e.exit(u),e.exit(s),e.exit(l),a):(e.enter(d),e.enter("chunkString",{contentType:"string"}),E(k))}function E(k){return k===62?(e.exit("chunkString"),e.exit(d),v(k)):k===null||k===60||me(k)?r(k):(e.consume(k),k===92?x:E)}function x(k){return k===60||k===62||k===92?(e.consume(k),E):E(k)}function w(k){return!b&&(k===null||k===41||Ve(k))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(l),a(k)):b<g&&k===40?(e.consume(k),b++,w):k===41?(e.consume(k),b--,w):k===null||k===32||k===40||Jo(k)?r(k):(e.consume(k),k===92?A:w)}function A(k){return k===40||k===41||k===92?(e.consume(k),w):w(k)}}function nT(e,a,r,l,s,u){const c=this;let d=0,f;return g;function g(E){return e.enter(l),e.enter(s),e.consume(E),e.exit(s),e.enter(u),b}function b(E){return d>999||E===null||E===91||E===93&&!f||E===94&&!d&&"_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)||d++>999?(e.exit("chunkString"),b(E)):(e.consume(E),f||(f=!_e(E)),E===92?v:h)}function v(E){return E===91||E===92||E===93?(e.consume(E),d++,h):h(E)}}function aT(e,a,r,l,s,u){let c;return d;function d(v){return v===34||v===39||v===40?(e.enter(l),e.enter(s),e.consume(v),e.exit(s),c=v===40?41:v,f):r(v)}function f(v){return v===c?(e.enter(s),e.consume(v),e.exit(s),e.exit(l),a):(e.enter(u),g(v))}function g(v){return v===c?(e.exit(u),f(c)):v===null?r(v):me(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Oe(e,g,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(v))}function b(v){return v===c||v===null||me(v)?(e.exit("chunkString"),g(v)):(e.consume(v),v===92?h:b)}function h(v){return v===c||v===92?(e.consume(v),b):b(v)}}function Ki(e,a){let r;return l;function l(s){return me(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,l):_e(s)?Oe(e,l,r?"linePrefix":"lineSuffix")(s):a(s)}}const OR={name:"definition",tokenize:DR},LR={partial:!0,tokenize:MR};function DR(e,a,r){const l=this;let s;return u;function u(E){return e.enter("definition"),c(E)}function c(E){return nT.call(l,e,d,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(E)}function d(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"),f):r(E)}function f(E){return Ve(E)?Ki(e,g)(E):g(E)}function g(E){return tT(e,b,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(E)}function b(E){return e.attempt(LR,h,h)(E)}function h(E){return _e(E)?Oe(e,v,"whitespace")(E):v(E)}function v(E){return E===null||me(E)?(e.exit("definition"),l.parser.defined.push(s),a(E)):r(E)}}function MR(e,a,r){return l;function l(d){return Ve(d)?Ki(e,s)(d):r(d)}function s(d){return aT(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function u(d){return _e(d)?Oe(e,c,"whitespace")(d):c(d)}function c(d){return d===null||me(d)?a(d):r(d)}}const UR={name:"hardBreakEscape",tokenize:BR};function BR(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 FR={name:"headingAtx",resolve:zR,tokenize:jR};function zR(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"},Wt(e,l,r-l+1,[["enter",s,a],["enter",u,a],["exit",u,a],["exit",s,a]])),e}function jR(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"),d(b)):r(b)}function d(b){return b===35?(e.enter("atxHeadingSequence"),f(b)):b===null||me(b)?(e.exit("atxHeading"),a(b)):_e(b)?Oe(e,d,"whitespace")(b):(e.enter("atxHeadingText"),g(b))}function f(b){return b===35?(e.consume(b),f):(e.exit("atxHeadingSequence"),d(b))}function g(b){return b===null||b===35||Ve(b)?(e.exit("atxHeadingText"),d(b)):(e.consume(b),g)}}const GR=["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"],Ov=["pre","script","style","textarea"],$R={concrete:!0,name:"htmlFlow",resolveTo:qR,tokenize:VR},HR={partial:!0,tokenize:WR},PR={partial:!0,tokenize:YR};function qR(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 VR(e,a,r){const l=this;let s,u,c,d,f;return g;function g(R){return b(R)}function b(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),v):R===47?(e.consume(R),u=!0,w):R===63?(e.consume(R),s=3,l.interrupt?a:C):_t(R)?(e.consume(R),c=String.fromCharCode(R),A):r(R)}function v(R){return R===45?(e.consume(R),s=2,E):R===91?(e.consume(R),s=5,d=0,x):_t(R)?(e.consume(R),s=4,l.interrupt?a:C):r(R)}function E(R){return R===45?(e.consume(R),l.interrupt?a:C):r(R)}function x(R){const se="CDATA[";return R===se.charCodeAt(d++)?(e.consume(R),d===se.length?l.interrupt?a:K:x):r(R)}function w(R){return _t(R)?(e.consume(R),c=String.fromCharCode(R),A):r(R)}function A(R){if(R===null||R===47||R===62||Ve(R)){const se=R===47,ge=c.toLowerCase();return!se&&!u&&Ov.includes(ge)?(s=1,l.interrupt?a(R):K(R)):GR.includes(c.toLowerCase())?(s=6,se?(e.consume(R),k):l.interrupt?a(R):K(R)):(s=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(R):u?N(R):I(R))}return R===45||St(R)?(e.consume(R),c+=String.fromCharCode(R),A):r(R)}function k(R){return R===62?(e.consume(R),l.interrupt?a:K):r(R)}function N(R){return _e(R)?(e.consume(R),N):B(R)}function I(R){return R===47?(e.consume(R),B):R===58||R===95||_t(R)?(e.consume(R),j):_e(R)?(e.consume(R),I):B(R)}function j(R){return R===45||R===46||R===58||R===95||St(R)?(e.consume(R),j):H(R)}function H(R){return R===61?(e.consume(R),M):_e(R)?(e.consume(R),H):I(R)}function M(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),f=R,W):_e(R)?(e.consume(R),M):re(R)}function W(R){return R===f?(e.consume(R),f=null,le):R===null||me(R)?r(R):(e.consume(R),W)}function re(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Ve(R)?H(R):(e.consume(R),re)}function le(R){return R===47||R===62||_e(R)?I(R):r(R)}function B(R){return R===62?(e.consume(R),V):r(R)}function V(R){return R===null||me(R)?K(R):_e(R)?(e.consume(R),V):r(R)}function K(R){return R===45&&s===2?(e.consume(R),U):R===60&&s===1?(e.consume(R),J):R===62&&s===4?(e.consume(R),L):R===63&&s===3?(e.consume(R),C):R===93&&s===5?(e.consume(R),be):me(R)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(HR,X,ne)(R)):R===null||me(R)?(e.exit("htmlFlowData"),ne(R)):(e.consume(R),K)}function ne(R){return e.check(PR,ae,X)(R)}function ae(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),q}function q(R){return R===null||me(R)?ne(R):(e.enter("htmlFlowData"),K(R))}function U(R){return R===45?(e.consume(R),C):K(R)}function J(R){return R===47?(e.consume(R),c="",ue):K(R)}function ue(R){if(R===62){const se=c.toLowerCase();return Ov.includes(se)?(e.consume(R),L):K(R)}return _t(R)&&c.length<8?(e.consume(R),c+=String.fromCharCode(R),ue):K(R)}function be(R){return R===93?(e.consume(R),C):K(R)}function C(R){return R===62?(e.consume(R),L):R===45&&s===2?(e.consume(R),C):K(R)}function L(R){return R===null||me(R)?(e.exit("htmlFlowData"),X(R)):(e.consume(R),L)}function X(R){return e.exit("htmlFlow"),a(R)}}function YR(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 WR(e,a,r){return l;function l(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(dl,a,r)}}const XR={name:"htmlText",tokenize:ZR};function ZR(e,a,r){const l=this;let s,u,c;return d;function d(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),f}function f(C){return C===33?(e.consume(C),g):C===47?(e.consume(C),H):C===63?(e.consume(C),I):_t(C)?(e.consume(C),re):r(C)}function g(C){return C===45?(e.consume(C),b):C===91?(e.consume(C),u=0,x):_t(C)?(e.consume(C),N):r(C)}function b(C){return C===45?(e.consume(C),E):r(C)}function h(C){return C===null?r(C):C===45?(e.consume(C),v):me(C)?(c=h,J(C)):(e.consume(C),h)}function v(C){return C===45?(e.consume(C),E):h(C)}function E(C){return C===62?U(C):C===45?v(C):h(C)}function x(C){const L="CDATA[";return C===L.charCodeAt(u++)?(e.consume(C),u===L.length?w:x):r(C)}function w(C){return C===null?r(C):C===93?(e.consume(C),A):me(C)?(c=w,J(C)):(e.consume(C),w)}function A(C){return C===93?(e.consume(C),k):w(C)}function k(C){return C===62?U(C):C===93?(e.consume(C),k):w(C)}function N(C){return C===null||C===62?U(C):me(C)?(c=N,J(C)):(e.consume(C),N)}function I(C){return C===null?r(C):C===63?(e.consume(C),j):me(C)?(c=I,J(C)):(e.consume(C),I)}function j(C){return C===62?U(C):I(C)}function H(C){return _t(C)?(e.consume(C),M):r(C)}function M(C){return C===45||St(C)?(e.consume(C),M):W(C)}function W(C){return me(C)?(c=W,J(C)):_e(C)?(e.consume(C),W):U(C)}function re(C){return C===45||St(C)?(e.consume(C),re):C===47||C===62||Ve(C)?le(C):r(C)}function le(C){return C===47?(e.consume(C),U):C===58||C===95||_t(C)?(e.consume(C),B):me(C)?(c=le,J(C)):_e(C)?(e.consume(C),le):U(C)}function B(C){return C===45||C===46||C===58||C===95||St(C)?(e.consume(C),B):V(C)}function V(C){return C===61?(e.consume(C),K):me(C)?(c=V,J(C)):_e(C)?(e.consume(C),V):le(C)}function K(C){return C===null||C===60||C===61||C===62||C===96?r(C):C===34||C===39?(e.consume(C),s=C,ne):me(C)?(c=K,J(C)):_e(C)?(e.consume(C),K):(e.consume(C),ae)}function ne(C){return C===s?(e.consume(C),s=void 0,q):C===null?r(C):me(C)?(c=ne,J(C)):(e.consume(C),ne)}function ae(C){return C===null||C===34||C===39||C===60||C===61||C===96?r(C):C===47||C===62||Ve(C)?le(C):(e.consume(C),ae)}function q(C){return C===47||C===62||Ve(C)?le(C):r(C)}function U(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),a):r(C)}function J(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),ue}function ue(C){return _e(C)?Oe(e,be,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):be(C)}function be(C){return e.enter("htmlTextData"),c(C)}}const zd={name:"labelEnd",resolveAll:eC,resolveTo:tC,tokenize:nC},KR={tokenize:aC},QR={tokenize:rC},JR={tokenize:iC};function eC(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&&Wt(e,0,e.length,r),e}function tC(e,a){let r=e.length,l=0,s,u,c,d;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 f={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},g={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 d=[["enter",f,a],["enter",g,a]],d=ln(d,e.slice(u+1,u+l+3)),d=ln(d,[["enter",b,a]]),d=ln(d,os(a.parser.constructs.insideSpan.null,e.slice(u+l+4,c-3),a)),d=ln(d,[["exit",b,a],e[c-2],e[c-1],["exit",g,a]]),d=ln(d,e.slice(c+1)),d=ln(d,[["exit",f,a]]),Wt(e,u,e.length,d),e}function nC(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 d;function d(v){return u?u._inactive?h(v):(c=l.parser.defined.includes(gn(l.sliceSerialize({start:u.end,end:l.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),f):r(v)}function f(v){return v===40?e.attempt(KR,b,c?b:h)(v):v===91?e.attempt(QR,b,c?g:h)(v):c?b(v):h(v)}function g(v){return e.attempt(JR,b,h)(v)}function b(v){return a(v)}function h(v){return u._balanced=!0,r(v)}}function aC(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)?Ki(e,u)(h):u(h)}function u(h){return h===41?b(h):tT(e,c,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function c(h){return Ve(h)?Ki(e,f)(h):b(h)}function d(h){return r(h)}function f(h){return h===34||h===39||h===40?aT(e,g,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):b(h)}function g(h){return Ve(h)?Ki(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 rC(e,a,r){const l=this;return s;function s(d){return nT.call(l,e,u,c,"reference","referenceMarker","referenceString")(d)}function u(d){return l.parser.defined.includes(gn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?a(d):r(d)}function c(d){return r(d)}}function iC(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 lC={name:"labelStartImage",resolveAll:zd.resolveAll,tokenize:oC};function oC(e,a,r){const l=this;return s;function s(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),u}function u(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),c):r(d)}function c(d){return d===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(d):a(d)}}const sC={name:"labelStartLink",resolveAll:zd.resolveAll,tokenize:uC};function uC(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 Wc={name:"lineEnding",tokenize:cC};function cC(e,a){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Oe(e,a,"linePrefix")}}const Xo={name:"thematicBreak",tokenize:dC};function dC(e,a,r){let l=0,s;return u;function u(g){return e.enter("thematicBreak"),c(g)}function c(g){return s=g,d(g)}function d(g){return g===s?(e.enter("thematicBreakSequence"),f(g)):l>=3&&(g===null||me(g))?(e.exit("thematicBreak"),a(g)):r(g)}function f(g){return g===s?(e.consume(g),l++,f):(e.exit("thematicBreakSequence"),_e(g)?Oe(e,d,"whitespace")(g):d(g))}}const Bt={continuation:{tokenize:mC},exit:bC,name:"list",tokenize:gC},pC={partial:!0,tokenize:yC},fC={partial:!0,tokenize:hC};function gC(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 d;function d(E){const x=l.containerState.type||(E===42||E===43||E===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!l.containerState.marker||E===l.containerState.marker:fd(E)){if(l.containerState.type||(l.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),E===42||E===45?e.check(Xo,r,g)(E):g(E);if(!l.interrupt||E===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(E)}return r(E)}function f(E){return fd(E)&&++c<10?(e.consume(E),f):(!l.interrupt||c<2)&&(l.containerState.marker?E===l.containerState.marker:E===41||E===46)?(e.exit("listItemValue"),g(E)):r(E)}function g(E){return e.enter("listItemMarker"),e.consume(E),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||E,e.check(dl,l.interrupt?r:b,e.attempt(pC,v,h))}function b(E){return l.containerState.initialBlankLine=!0,u++,v(E)}function h(E){return _e(E)?(e.enter("listItemPrefixWhitespace"),e.consume(E),e.exit("listItemPrefixWhitespace"),v):r(E)}function v(E){return l.containerState.size=u+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,a(E)}}function mC(e,a,r){const l=this;return l.containerState._closeFlow=void 0,e.check(dl,s,u);function s(d){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Oe(e,a,"listItemIndent",l.containerState.size+1)(d)}function u(d){return l.containerState.furtherBlankLines||!_e(d)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,c(d)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(fC,a,c)(d))}function c(d){return l.containerState._closeFlow=!0,l.interrupt=void 0,Oe(e,e.attempt(Bt,a,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function hC(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 bC(e){e.exit(this.containerState.type)}function yC(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!_e(u)&&c&&c[1].type==="listItemPrefixWhitespace"?a(u):r(u)}}const Lv={name:"setextUnderline",resolveTo:EC,tokenize:SC};function EC(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 SC(e,a,r){const l=this;let s;return u;function u(g){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=g,c(g)):r(g)}function c(g){return e.enter("setextHeadingLineSequence"),d(g)}function d(g){return g===s?(e.consume(g),d):(e.exit("setextHeadingLineSequence"),_e(g)?Oe(e,f,"lineSuffix")(g):f(g))}function f(g){return g===null||me(g)?(e.exit("setextHeadingLine"),a(g)):r(g)}}const vC={tokenize:xC};function xC(e){const a=this,r=e.attempt(dl,l,e.attempt(this.parser.constructs.flowInitial,s,Oe(e,e.attempt(this.parser.constructs.flow,s,e.attempt(_R,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 TC={resolveAll:iT()},AC=rT("string"),wC=rT("text");function rT(e){return{resolveAll:iT(e==="text"?kC:void 0),tokenize:a};function a(r){const l=this,s=this.parser.constructs[e],u=r.attempt(s,c,d);return c;function c(b){return g(b)?u(b):d(b)}function d(b){if(b===null){r.consume(b);return}return r.enter("data"),r.consume(b),f}function f(b){return g(b)?(r.exit("data"),u(b)):(r.consume(b),f)}function g(b){if(b===null)return!0;const h=s[b];let v=-1;if(h)for(;++v<h.length;){const E=h[v];if(!E.previous||E.previous.call(l,l.previous))return!0}return!1}}}function iT(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 kC(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,d=0,f;for(;u--;){const g=s[u];if(typeof g=="string"){for(c=g.length;g.charCodeAt(c-1)===32;)d++,c--;if(c)break;c=-1}else if(g===-2)f=!0,d++;else if(g!==-1){u++;break}}if(a._contentTypeTextTrailing&&r===e.length&&(d=0),d){const g={type:r===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:l.start._bufferIndex+c,_index:l.start._index+u,line:l.end.line,column:l.end.column-d,offset:l.end.offset-d},end:{...l.end}};l.end={...g.start},l.start.offset===l.end.offset?Object.assign(l,g):(e.splice(r,0,["enter",g,a],["exit",g,a]),r+=2)}r++}return e}const _C={42:Bt,43:Bt,45:Bt,48:Bt,49:Bt,50:Bt,51:Bt,52:Bt,53:Bt,54:Bt,55:Bt,56:Bt,57:Bt,62:Kx},NC={91:OR},RC={[-2]:Yc,[-1]:Yc,32:Yc},CC={35:FR,42:Xo,45:[Lv,Xo],60:$R,61:Lv,95:Xo,96:Iv,126:Iv},IC={38:Jx,92:Qx},OC={[-5]:Wc,[-4]:Wc,[-3]:Wc,33:lC,38:Jx,42:gd,60:[sR,XR],91:sC,92:[UR,Qx],93:zd,95:gd,96:vR},LC={null:[gd,TC]},DC={null:[42,95]},MC={null:[]},UC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:DC,contentInitial:NC,disable:MC,document:_C,flow:CC,flowInitial:RC,insideSpan:LC,string:IC,text:OC},Symbol.toStringTag,{value:"Module"}));function BC(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=[],d=[];const f={attempt:W(H),check:W(M),consume:N,enter:I,exit:j,interrupt:W(M,{interrupt:!0})},g={code:null,containerState:{},defineSkip:w,events:[],now:x,parser:e,previous:null,sliceSerialize:v,sliceStream:E,write:h};let b=a.tokenize.call(g,f);return a.resolveAll&&u.push(a),g;function h(V){return c=ln(c,V),A(),c[c.length-1]!==null?[]:(re(a,0),g.events=os(u,g.events,g),g.events)}function v(V,K){return zC(E(V),K)}function E(V){return FC(c,V)}function x(){const{_bufferIndex:V,_index:K,line:ne,column:ae,offset:q}=l;return{_bufferIndex:V,_index:K,line:ne,column:ae,offset:q}}function w(V){s[V.line]=V.column,B()}function A(){let V;for(;l._index<c.length;){const K=c[l._index];if(typeof K=="string")for(V=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===V&&l._bufferIndex<K.length;)k(K.charCodeAt(l._bufferIndex));else k(K)}}function k(V){b=b(V)}function N(V){me(V)?(l.line++,l.column=1,l.offset+=V===-3?2:1,B()):V!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===c[l._index].length&&(l._bufferIndex=-1,l._index++)),g.previous=V}function I(V,K){const ne=K||{};return ne.type=V,ne.start=x(),g.events.push(["enter",ne,g]),d.push(ne),ne}function j(V){const K=d.pop();return K.end=x(),g.events.push(["exit",K,g]),K}function H(V,K){re(V,K.from)}function M(V,K){K.restore()}function W(V,K){return ne;function ne(ae,q,U){let J,ue,be,C;return Array.isArray(ae)?X(ae):"tokenize"in ae?X([ae]):L(ae);function L(pe){return Te;function Te(je){const Ue=je!==null&&pe[je],Nt=je!==null&&pe.null,un=[...Array.isArray(Ue)?Ue:Ue?[Ue]:[],...Array.isArray(Nt)?Nt:Nt?[Nt]:[]];return X(un)(je)}}function X(pe){return J=pe,ue=0,pe.length===0?U:R(pe[ue])}function R(pe){return Te;function Te(je){return C=le(),be=pe,pe.partial||(g.currentConstruct=pe),pe.name&&g.parser.constructs.disable.null.includes(pe.name)?ge():pe.tokenize.call(K?Object.assign(Object.create(g),K):g,f,se,ge)(je)}}function se(pe){return V(be,C),q}function ge(pe){return C.restore(),++ue<J.length?R(J[ue]):U}}}function re(V,K){V.resolveAll&&!u.includes(V)&&u.push(V),V.resolve&&Wt(g.events,K,g.events.length-K,V.resolve(g.events.slice(K),g)),V.resolveTo&&(g.events=V.resolveTo(g.events,g))}function le(){const V=x(),K=g.previous,ne=g.currentConstruct,ae=g.events.length,q=Array.from(d);return{from:ae,restore:U};function U(){l=V,g.previous=K,g.currentConstruct=ne,g.events.length=ae,d=q,B()}}function B(){l.line in s&&l.column<2&&(l.column=s[l.line],l.offset+=s[l.line]-1)}}function FC(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 d=c[0];typeof d=="string"?c[0]=d.slice(l):c.shift()}u>0&&c.push(e[s].slice(0,u))}return c}function zC(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 jC(e){const l={constructs:Xx([UC,...(e||{}).extensions||[]]),content:s(tR),defined:[],document:s(aR),flow:s(vC),lazy:{},string:s(AC),text:s(wC)};return l;function s(u){return c;function c(d){return BC(l,u,d)}}}function GC(e){for(;!eT(e););return e}const Dv=/[\0\t\n\r]/g;function $C(){let e=1,a="",r=!0,l;return s;function s(u,c,d){const f=[];let g,b,h,v,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(Dv.lastIndex=h,g=Dv.exec(u),v=g&&g.index!==void 0?g.index:u.length,E=u.charCodeAt(v),!g){a=u.slice(h);break}if(E===10&&h===v&&l)f.push(-3),l=void 0;else switch(l&&(f.push(-5),l=void 0),h<v&&(f.push(u.slice(h,v)),e+=v-h),E){case 0:{f.push(65533),e++;break}case 9:{for(b=Math.ceil(e/4)*4,f.push(-2);e++<b;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:l=!0,e=1}h=v+1}return d&&(l&&f.push(-5),a&&f.push(a),f.push(null)),f}}const HC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function PC(e){return e.replace(HC,qC)}function qC(e,a,r){if(a)return a;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),u=s===120||s===88;return Zx(r.slice(u?2:1),u?16:10)}return al(r)||e}const lT={}.hasOwnProperty;function VC(e,a,r){return a&&typeof a=="object"&&(r=a,a=void 0),YC(r)(GC(jC(r).document().write($C()(e,a,!0))))}function YC(e){const a={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Va),autolinkProtocol:le,autolinkEmail:le,atxHeading:u(Pa),blockQuote:u(Nt),characterEscape:le,characterReference:le,codeFenced:u(un),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(un,c),codeText:u(Xr,c),codeTextData:le,data:le,codeFlowValue:le,definition:u(El),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(wn),hardBreakEscape:u(qa),hardBreakTrailing:u(qa),htmlFlow:u(Sl,c),htmlFlowData:le,htmlText:u(Sl,c),htmlTextData:le,image:u(vl),label:c,link:u(Va),listItem:u(Zr),listItemValue:v,listOrdered:u(Ya,h),listUnordered:u(Ya),paragraph:u(Ss),reference:R,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(Pa),strong:u(vs),thematicBreak:u(xs)},exit:{atxHeading:f(),atxHeadingSequence:H,autolink:f(),autolinkEmail:Ue,autolinkProtocol:je,blockQuote:f(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:pe,characterReference:Te,codeFenced:f(A),codeFencedFence:w,codeFencedFenceInfo:E,codeFencedFenceMeta:x,codeFlowValue:B,codeIndented:f(k),codeText:f(q),codeTextData:B,data:B,definition:f(),definitionDestinationString:j,definitionLabelString:N,definitionTitleString:I,emphasis:f(),hardBreakEscape:f(K),hardBreakTrailing:f(K),htmlFlow:f(ne),htmlFlowData:B,htmlText:f(ae),htmlTextData:B,image:f(J),label:be,labelText:ue,lineEnding:V,link:f(U),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:se,resourceDestinationString:C,resourceTitleString:L,resource:X,setextHeading:f(re),setextHeadingLineSequence:W,setextHeadingText:M,strong:f(),thematicBreak:f()}};oT(a,(e||{}).mdastExtensions||[]);const r={};return l;function l(Q){let oe={type:"root",children:[]};const ye={stack:[oe],tokenStack:[],config:a,enter:d,exit:g,buffer:c,resume:b,data:r},Ae=[];let Be=-1;for(;++Be<Q.length;)if(Q[Be][1].type==="listOrdered"||Q[Be][1].type==="listUnordered")if(Q[Be][0]==="enter")Ae.push(Be);else{const zt=Ae.pop();Be=s(Q,zt,Be)}for(Be=-1;++Be<Q.length;){const zt=a[Q[Be][0]];lT.call(zt,Q[Be][1].type)&&zt[Q[Be][1].type].call(Object.assign({sliceSerialize:Q[Be][2].sliceSerialize},ye),Q[Be][1])}if(ye.tokenStack.length>0){const zt=ye.tokenStack[ye.tokenStack.length-1];(zt[1]||Mv).call(ye,void 0,zt[0])}for(oe.position={start:ya(Q.length>0?Q[0][1].start:{line:1,column:1,offset:0}),end:ya(Q.length>0?Q[Q.length-2][1].end:{line:1,column:1,offset:0})},Be=-1;++Be<a.transforms.length;)oe=a.transforms[Be](oe)||oe;return oe}function s(Q,oe,ye){let Ae=oe-1,Be=-1,zt=!1,kn,wt,ot,Rt;for(;++Ae<=ye;){const Pe=Q[Ae];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=Ae),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=Ae;for(wt=void 0;Yn--;){const cn=Q[Yn];if(cn[1].type==="lineEnding"||cn[1].type==="lineEndingBlank"){if(cn[0]==="exit")continue;wt&&(Q[wt][1].type="lineEndingBlank",zt=!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?Q[wt][1].start:Pe[1].end),Q.splice(wt||Ae,0,["exit",kn,Pe[2]]),Ae++,ye++}if(Pe[1].type==="listItemPrefix"){const Yn={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};kn=Yn,Q.splice(Ae,0,["enter",Yn,Pe[2]]),Ae++,ye++,ot=void 0,Rt=!0}}}return Q[oe][1]._spread=zt,ye}function u(Q,oe){return ye;function ye(Ae){d.call(this,Q(Ae),Ae),oe&&oe.call(this,Ae)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(Q,oe,ye){this.stack[this.stack.length-1].children.push(Q),this.stack.push(Q),this.tokenStack.push([oe,ye||void 0]),Q.position={start:ya(oe.start),end:void 0}}function f(Q){return oe;function oe(ye){Q&&Q.call(this,ye),g.call(this,ye)}}function g(Q,oe){const ye=this.stack.pop(),Ae=this.tokenStack.pop();if(Ae)Ae[0].type!==Q.type&&(oe?oe.call(this,Q,Ae[0]):(Ae[1]||Mv).call(this,Q,Ae[0]));else throw new Error("Cannot close `"+Q.type+"` ("+Zi({start:Q.start,end:Q.end})+"): it’s not open");ye.position.end=ya(Q.end)}function b(){return Fd(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function v(Q){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Q),10),this.data.expectingFirstListItemValue=void 0}}function E(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Q}function x(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Q}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function A(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Q.replace(/(\r?\n|\r)$/g,"")}function N(Q){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.label=oe,ye.identifier=gn(this.sliceSerialize(Q)).toLowerCase()}function I(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Q}function j(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Q}function H(Q){const oe=this.stack[this.stack.length-1];if(!oe.depth){const ye=this.sliceSerialize(Q).length;oe.depth=ye}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function W(Q){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Q).codePointAt(0)===61?1:2}function re(){this.data.setextHeadingSlurpLineEnding=void 0}function le(Q){const ye=this.stack[this.stack.length-1].children;let Ae=ye[ye.length-1];(!Ae||Ae.type!=="text")&&(Ae=At(),Ae.position={start:ya(Q.start),end:void 0},ye.push(Ae)),this.stack.push(Ae)}function B(Q){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Q),oe.position.end=ya(Q.end)}function V(Q){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ye=oe.children[oe.children.length-1];ye.position.end=ya(Q.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&a.canContainEols.includes(oe.type)&&(le.call(this,Q),B.call(this,Q))}function K(){this.data.atHardBreak=!0}function ne(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Q}function ae(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Q}function q(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Q}function U(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=oe,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function J(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=oe,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function ue(Q){const oe=this.sliceSerialize(Q),ye=this.stack[this.stack.length-2];ye.label=PC(oe),ye.identifier=gn(oe).toLowerCase()}function be(){const Q=this.stack[this.stack.length-1],oe=this.resume(),ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,ye.type==="link"){const Ae=Q.children;ye.children=Ae}else ye.alt=oe}function C(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Q}function L(){const Q=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Q}function X(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function se(Q){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.label=oe,ye.identifier=gn(this.sliceSerialize(Q)).toLowerCase(),this.data.referenceType="full"}function ge(Q){this.data.characterReferenceType=Q.type}function pe(Q){const oe=this.sliceSerialize(Q),ye=this.data.characterReferenceType;let Ae;ye?(Ae=Zx(oe,ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ae=al(oe);const Be=this.stack[this.stack.length-1];Be.value+=Ae}function Te(Q){const oe=this.stack.pop();oe.position.end=ya(Q.end)}function je(Q){B.call(this,Q);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Q)}function Ue(Q){B.call(this,Q);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Q)}function Nt(){return{type:"blockquote",children:[]}}function un(){return{type:"code",lang:null,meta:null,value:""}}function Xr(){return{type:"inlineCode",value:""}}function El(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function wn(){return{type:"emphasis",children:[]}}function Pa(){return{type:"heading",depth:0,children:[]}}function qa(){return{type:"break"}}function Sl(){return{type:"html",value:""}}function vl(){return{type:"image",title:null,url:"",alt:null}}function Va(){return{type:"link",title:null,url:"",children:[]}}function Ya(Q){return{type:"list",ordered:Q.type==="listOrdered",start:null,spread:Q._spread,children:[]}}function Zr(Q){return{type:"listItem",spread:Q._spread,checked:null,children:[]}}function Ss(){return{type:"paragraph",children:[]}}function vs(){return{type:"strong",children:[]}}function At(){return{type:"text",value:""}}function xs(){return{type:"thematicBreak"}}}function ya(e){return{line:e.line,column:e.column,offset:e.offset}}function oT(e,a){let r=-1;for(;++r<a.length;){const l=a[r];Array.isArray(l)?oT(e,l):WC(e,l)}}function WC(e,a){let r;for(r in a)if(lT.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 Mv(e,a){throw e?new Error("Cannot close `"+e.type+"` ("+Zi({start:e.start,end:e.end})+"): a different token (`"+a.type+"`, "+Zi({start:a.start,end:a.end})+") is open"):new Error("Cannot close document, a token (`"+a.type+"`, "+Zi({start:a.start,end:a.end})+") is still open")}function XC(e){const a=this;a.parser=r;function r(l){return VC(l,{...a.data("settings"),...e,extensions:a.data("micromarkExtensions")||[],mdastExtensions:a.data("fromMarkdownExtensions")||[]})}}function ZC(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 KC(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-WpgHkzXv.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-BMreOocV.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/index-K4mnpwDJ.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.58",
3
+ "version": "0.1.60",
4
4
  "type": "module",
5
5
  "description": "Generate AI-powered UI design explorations in your project",
6
6
  "keywords": [