rari 0.14.0 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/cli.mjs +1 -1
  2. package/dist/client.d.mts +5 -6
  3. package/dist/client.mjs +1 -1
  4. package/dist/{get-client-component-DOUGb2xc.mjs → get-client-component-B4Y2T40R.mjs} +1 -1
  5. package/dist/headers.d.mts +1 -1
  6. package/dist/image/index.mjs +1 -1
  7. package/dist/index.d.mts +3 -3
  8. package/dist/mdx.mjs +1 -1
  9. package/dist/{preload-modules-C1zd75Lc.mjs → preload-modules-xvnJ_8eh.mjs} +2 -2
  10. package/dist/proxy/RariRequest.d.mts +1 -1
  11. package/dist/proxy/RariResponse.d.mts +1 -1
  12. package/dist/{railway-BQNsu-l4.mjs → railway-bxKRJ0Cg.mjs} +1 -1
  13. package/dist/regex-constants-B4P386OY.mjs +1 -0
  14. package/dist/{render-DHDWCmpf.mjs → render-CXNCiz-E.mjs} +1 -1
  15. package/dist/router.d.mts +1 -3
  16. package/dist/router.mjs +1 -1
  17. package/dist/runtime/AppRouterProvider.d.mts +1 -2
  18. package/dist/runtime/AppRouterProvider.mjs +3 -3
  19. package/dist/runtime/ErrorBoundaryWrapper.mjs +1 -1
  20. package/dist/runtime/entry-client.mjs +2 -2
  21. package/dist/runtime/react-server-dom-shim.mjs +1 -1
  22. package/dist/runtime/rsc-client-runtime.d.mts +1 -1
  23. package/dist/runtime/rsc-client-runtime.mjs +2 -2
  24. package/dist/runtime/vendor/react-flight-client/ReactFlightClient.d.mts +1 -1
  25. package/dist/runtime/vendor/react-flight-client/ReactFlightClientConfig.d.mts +1 -1
  26. package/dist/runtime/vendor/react-flight-client/ReactFlightClientConfig.mjs +1 -1
  27. package/dist/{sitemap-generator-DXQL4RtJ.mjs → sitemap-generator-BTG9lURQ.mjs} +1 -1
  28. package/dist/{types-CC9LMWMo.d.mts → types-m74grfbN.d.mts} +1 -0
  29. package/dist/vite.d.mts +4 -4
  30. package/dist/vite.mjs +118 -17
  31. package/package.json +10 -10
  32. package/dist/regex-constants-CmOAY1_W.mjs +0 -1
  33. package/dist/rolldown-runtime-DR3Ue2cl.mjs +0 -1
  34. package/dist/routes-C8Txll7p.mjs +0 -1
  35. package/dist/server-build-JfPg3Cjl.mjs +0 -166
  36. /package/dist/{ReactFlightClientConfig-DdCyeIZx.d.mts → ReactFlightClientConfig-C_nD8rsi.d.mts} +0 -0
  37. /package/dist/{alias-resolver-D1GHg-4o.mjs → alias-resolver-BintHkb_.mjs} +0 -0
  38. /package/dist/{constants-B68HGlJT.mjs → constants-De7aSsCq.mjs} +0 -0
  39. /package/dist/{metadata-route-D0xSj7FK.d.mts → metadata-route-85WvBQcW.d.mts} +0 -0
  40. /package/dist/{navigate-hfIqe3MK.mjs → navigate-DuyUa6qD.mjs} +0 -0
  41. /package/dist/{robots-generator-Byiwomr5.mjs → robots-generator-l2O5neuR.mjs} +0 -0
  42. /package/dist/{runtime-client-CbbckLpl.mjs → runtime-client-DHeO6y_7.mjs} +0 -0
  43. /package/dist/{server-config-CGmxgSPb.d.mts → server-config-CwWYmtA0.d.mts} +0 -0
  44. /package/dist/{timer-utils-DnyOf3e6.mjs → timer-utils-Duul5JHq.mjs} +0 -0
  45. /package/dist/{types-DOgYNbON.d.mts → types-3dq9RGI5.d.mts} +0 -0
  46. /package/dist/{types-R2tg78dF.d.mts → types-zPQ3RHgH.d.mts} +0 -0
  47. /package/dist/{utils-BK4N0qFr-BCy19luN.mjs → utils-BK4N0qFr-QFbF96eD.mjs} +0 -0
@@ -1,2 +1,2 @@
1
- import{f as e,g as t,h as n,m as r,n as i,p as a,u as o,v as s}from"../regex-constants-CmOAY1_W.mjs";import{t as c}from"../get-client-component-DOUGb2xc.mjs";import{createFromFetch as l,createFromReadableStream as u}from"./vendor/react-flight-client/index.mjs";import*as d from"react";import{Suspense as f,cloneElement as p,createElement as m,isValidElement as h,use as g,useEffect as _,useState as v}from"react";import*as y from"react-dom/client";function b(){return import.meta.env?.RARI_SERVER_URL?import.meta.env.RARI_SERVER_URL:typeof window<`u`?window.location.origin:`http://localhost:3000`}globalThis[`~rari`]===void 0&&(globalThis[`~rari`]={}),globalThis[`~rari`].isDevelopment=process.env.NODE_ENV!==`production`,globalThis[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={}),globalThis[`~clientComponentNames`]===void 0&&(globalThis[`~clientComponentNames`]={}),globalThis[`~clientComponentPaths`]===void 0&&(globalThis[`~clientComponentPaths`]={}),typeof window<`u`&&(window[`~rari`]||(window[`~rari`]=globalThis[`~rari`]),window[`~rari`].streaming||(window[`~rari`].streaming={bufferedRows:[],bufferedEvents:[]}),window[`~rari`].streaming.bufferedEvents||(window[`~rari`].streaming.bufferedEvents=[]),window[`~rari`].boundaryModules||(window[`~rari`].boundaryModules=new Map),window[`~rari`].pendingBoundaryHydrations||(window[`~rari`].pendingBoundaryHydrations=new Map));function x(e){if(!e.startsWith(`I{`))return null;try{let t=JSON.parse(e.substring(1));if(typeof t==`object`&&t&&!Array.isArray(t)){if(typeof t.id!=`string`)return console.error(`[rari] Invalid import data: id must be a string:`,t),null;let e;if(typeof t.chunks==`string`)e=[t.chunks];else if(Array.isArray(t.chunks))e=t.chunks.filter(e=>typeof e==`string`);else return console.error(`[rari] Invalid import data: chunks must be a string or array:`,t),null;return e.length===0?(console.error(`[rari] Invalid import data: chunks array is empty:`,t),null):{id:t.id,chunks:e,name:t.name||`default`}}console.error(`[rari] Invalid import data format, expected object:`,t)}catch(t){console.error(`[rari] Failed to parse import row:`,e,t)}return null}if(typeof window<`u`){globalThis[`~rari`].processBoundaryUpdate=function(o,s,c){let l=document.querySelector(`[data-boundary-id="${o}"]`);if(l)try{let u=s.indexOf(`:`);if(u===-1){console.warn(`[rari] Invalid RSC row format (no colon):`,s);return}let d=s.substring(0,u),f=s.substring(u+1),p=x(f);if(p){let e=`$L${d}`;window[`~rari`].boundaryModules?.set(e,p);return}let m;try{m=JSON.parse(f)}catch(e){console.error(`[rari] Failed to parse RSC content:`,f,e);return}function h(e){if(!e)return!1;if(typeof e==`string`)return e.startsWith(`$L`);if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t]=e;if(typeof t==`string`&&t.startsWith(`$L`))return!0;let n=e[3];if(n&&n.children)return h(n.children)}return e.some(e=>h(e))}return!1}if(h(m)){if(window[`~rari`].pendingBoundaryHydrations?.set(o,{content:m,element:l,rowId:c}),globalThis[`~rari`].hydrateClientComponents){let e=globalThis[`~rari`].hydrateClientComponents;e(o,m,l)}return}function g(o){let s=i=>i.replace(e,`&amp;`).replace(n,`&lt;`).replace(r,`&gt;`).replace(t,`&quot;`).replace(a,`&#39;`),c=new Set(`div.span.p.ul.ol.li.a.img.section.article.header.footer.nav.main.aside.strong.em.b.i.button.input.label.form.select.option.textarea.h1.h2.h3.h4.h5.h6.table.thead.tbody.tr.td.th.code.pre.blockquote.hr.br.small.mark.del.ins.sub.sup.abbr.time.figure.figcaption.details.summary.dialog.menu.menuitem.canvas.svg.path.circle.rect.line.polygon.polyline.ellipse.text.g.defs.use.symbol.clippath.mask.pattern.lineargradient.radialgradient.stop.image.video.audio.source.track.picture.dl.dt.dd.fieldset.legend`.split(`.`));if(!o)return``;if(typeof o==`string`||typeof o==`number`)return s(String(o));if(Array.isArray(o)){if(o.length>=4&&o[0]===`$`){let[,e,,t]=o,n=typeof e==`string`&&c.has(e.toLowerCase())?e.toLowerCase():`div`,r=null,a=``,l=``;if(t){for(let[e,n]of Object.entries(t))if(e===`dangerouslySetInnerHTML`&&n&&typeof n==`object`&&`__html`in n)r=n.__html;else if(e!==`children`&&e!==`~boundaryId`){let t=e===`className`?`class`:e;if(e===`style`&&typeof n==`object`&&n){let e=Object.entries(n).map(([e,t])=>`${e.replace(i,`$1-$2`).toLowerCase()}:${String(t)}`).join(`;`);l+=` style="${s(e)}"`}else typeof n==`string`||typeof n==`number`?l+=` ${t}="${s(String(n))}"`:typeof n==`boolean`&&n&&(l+=` ${t}`)}r===null&&t.children&&(a=g(t.children))}return`<${n}${l}>${r===null?a:r}</${n}>`}return o.map(g).join(``)}return``}let _=g(m);if(_){let e=document.contains(l);e&&(l.innerHTML=_,l.classList.add(`rari-boundary-resolved`)),window.dispatchEvent(new CustomEvent(`rari:boundary-resolved`,{detail:{boundaryId:o,rscRow:s,rowId:c,element:l,wasAttached:e}}))}}catch(e){console.error(`[rari] Error processing boundary update:`,e)}};let o=window,s=globalThis;o[`~rari`].streaming?.bufferedEvents&&o[`~rari`].streaming.bufferedEvents.length>0&&(o[`~rari`].streaming.bufferedEvents.forEach(e=>{let{boundaryId:t,rscRow:n,rowId:r}=e;s[`~rari`].processBoundaryUpdate?.(t,n,r)}),o[`~rari`].streaming.bufferedEvents=[]),window.addEventListener(`rari:boundary-update`,e=>{let{boundaryId:t,rscRow:n,rowId:r}=e.detail;s[`~rari`].processBoundaryUpdate&&s[`~rari`].processBoundaryUpdate(t,n,r)})}function S(e,t,n){let r=n===`default`?e.name||t.split(`/`).pop()?.replace(o,``)||`DefaultComponent`:n,i=r,a={id:i,path:t,type:`client`,component:e,registered:!0};globalThis[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={});let s=`${t}#${n}`;globalThis[`~clientComponents`][i]=a,globalThis[`~clientComponents`][t]=a,globalThis[`~clientComponents`][s]=a,globalThis[`~clientComponentPaths`][t]=i,globalThis[`~clientComponentNames`][r]=i,e&&(e[`~isClientComponent`]=!0,e[`~clientComponentId`]=i),typeof window<`u`&&fetch(`/_rari/register-client`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:i,file_path:t,export_name:n})}).catch(e=>{console.error(`[rari] Failed to register client component with server:`,e)})}function C(e){return c(e)}function w(){let e={};for(let[t,n]of Object.entries(globalThis[`~clientComponents`]))e[t]={id:t,chunks:[n.path],name:t,async:!1,default:n.component};return e}let T=l,E=u,D=null;async function O(){return D||(D=(async()=>{try{return T=l,E=u,typeof E!=`function`&&(E=null),typeof T!=`function`&&(T=null),y}catch(e){return console.error(`Failed to load react-dom/client RSC functions:`,e),T=null,E=null,null}})(),D)}const k=new Map,A=new class{componentCache;moduleCache;inflightRequests;config;constructor(){this.componentCache=new Map,this.moduleCache=new Map,this.inflightRequests=new Map,this.config={maxRetries:5,retryDelay:500,timeout:1e4}}configure(e){this.config={...this.config,...e}}clearCache(){this.componentCache.clear(),this.moduleCache.clear(),k.clear()}async fetchServerComponent(e,t={}){let n=typeof window<`u`&&window[`~rari`]?.hmr?.refreshCounters?.[e]||0,r=`${e}:${JSON.stringify(t)}:hmr:${n}`;if(this.componentCache.has(r))return this.componentCache.get(r);if(this.inflightRequests.has(r))return this.inflightRequests.get(r);let i=this.fetchServerComponentStream(e,t);this.inflightRequests.set(r,i);try{let e=await i;return this.componentCache.set(r,e),e}finally{this.inflightRequests.delete(r)}}async fetchServerComponentStream(e,t={}){await O();let n=(()=>{let e=[`/_rari/stream`];try{if(typeof window<`u`&&(window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`)){let t=b();t&&e.push(`${t}/_rari/stream`)}}catch{}return e})(),r=null,i=null,a=async()=>{for(let r of n)try{let n=await this.fetchWithTimeout(r,{method:`POST`,headers:{"Content-Type":`application/json`,...this.buildRequestHeaders()},body:JSON.stringify({component_id:e,props:t})});if(n.ok)return n;i=Error(`HTTP ${n.status}: ${await n.text()}`)}catch(e){i=e}return null};if(r=await a(),r||=(await new Promise(e=>setTimeout(e,this.config.retryDelay)),await a()),!r)throw i||Error(`Failed to reach stream endpoint`);if(!r.ok){let e=await r.text();throw Error(`Server responded with ${r.status}: ${e}`)}let o=r.body;if(!o)throw Error(`No ReadableStream from stream response`);let s=o.getReader(),c=new TextDecoder,l=new Map,u=new Map,d=e=>{if(!m)return console.error(`React not available for RSC conversion`),null;if(!e)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t,n,r]=e;if(t===`react.suspense`||t===`suspense`)return m(f,{fallback:d(r?.fallback)||null},r?.children?d(r.children):null);let i=r?{...r}:{};if(r?.children){let e=d(r.children);Array.isArray(e)?i.children=e.map((e,t)=>h(e)&&e.key==null?p(e,{key:t}):e):i.children=e}if(typeof t==`string`){if(t.startsWith(`$L`)){let e=l.get(t);if(e){let t=C(`${e.id}#${e.name||`default`}`);if(t)return m(t,n?{...i,key:n}:i)}return i&&i.children?i.children:null}if(t.includes(`.tsx#`)||t.includes(`.jsx#`)){let e=C(t);return e?m(e,n?{...i,key:n}:i):(console.error(`Failed to resolve client component:`,t),null)}else return i&&Object.hasOwn(i,`~boundaryId`)&&(i={...i},delete i[`~boundaryId`]),m(t,n?{...i,key:n}:i)}else console.error(`Unknown RSC element type:`,t)}return e.map(e=>d(e))}return typeof e==`object`?(console.error(`Unexpected object in RSC conversion:`,e),null):e},g=null,y=new Map,S=``,w=null,T=async()=>{try{for(;;){let{value:e,done:t}=await s.read();if(t)break;let n=c.decode(e,{stream:!0});S+=n;let r=S.split(`
2
- `),i=r.slice(0,-1);S=r.at(-1)||``;for(let e of i)if(e.trim())try{let t=e.indexOf(`:`);if(t===-1)continue;let n=e.substring(0,t),r=e.substring(t+1),i=x(r);if(i)l.set(`$L${n}`,i);else if(r.startsWith(`E{`))try{let e=JSON.parse(r.substring(1));console.error(`RSC stream error:`,e)}catch(e){console.error(`Failed to parse error row:`,r,e)}else if(r.startsWith(`Symbol.for(`))continue;else if(r.startsWith(`[`)){let e=JSON.parse(r);if(Array.isArray(e)&&e.length>=4){let[t,r,i]=e,a=i?.[`~boundaryId`];if(t===`$`&&(r===`react.suspense`||r===`suspense`)&&i&&a&&u.set(`$L${n}`,a),t===`$`&&i&&Object.hasOwn(i,`children`)&&typeof r==`string`&&r.startsWith(`$L`)){let e=u.get(r)||null;if(e){let t=d(i.children);y.set(e,t),w&&w.updateBoundary(e,t);continue}}}if(!g){let t=!0;if(Array.isArray(e)&&e.length>=4&&e[0]===`$`){let n=e[1],r=e[3],i=r?.[`~boundaryId`];typeof n==`string`&&(n===`react.suspense`||n===`suspense`)&&r&&i&&(t=!1)}t&&(g=d(e),w&&typeof w.updateRoot==`function`&&w.updateRoot())}}}catch(t){console.error(`Failed to parse stream line:`,e,t)}}}catch(e){console.error(`Error processing stream:`,e)}},E=()=>{let[,e]=v(0);_(()=>(w={updateBoundary:(t,n)=>{y.set(t,n),e(e=>e+1)},updateRoot:()=>{e(e=>e+1)}},()=>{w=null}),[e]);let t=e=>{if(!e)return null;if(h(e)){let n=e.props,r=n?.[`~boundaryId`];if(n&&r){let e=y.get(r);if(e)return e}if(n&&n.children){let r=t(n.children);if(r!==n.children){let t={...n};return e.key!==null&&e.key!==void 0&&(t.key=e.key),m(e.type,t,r)}}return e}return Array.isArray(e)?e.map(e=>t(e)):e};return t(g)};T();let D=Promise.resolve(m(E));return{"~isRscResponse":!0,"~rscPromise":D,readRoot(){return D}}}buildRequestHeaders(){return{Accept:`text/x-component`,"Cache-Control":`no-cache, no-transform`}}async fetchWithTimeout(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),this.config.timeout);try{let i=await fetch(e,{...t,signal:n.signal});return clearTimeout(r),i}catch(e){throw clearTimeout(r),e}}async processRscResponse(e){if(await O(),T)try{let t=T(Promise.resolve(e));return{"~isRscResponse":!0,"~rscPromise":t,readRoot(){return t}}}catch{throw Error(`React Server DOM client not available`)}else throw Error(`React Server DOM client not available`)}async processRscResponseManually(e){let t=await e.text();return this.parseRscResponse(t)}parseRscResponse(e){let t=e.trim().split(s),n=new Map,r=new Map,i=[];for(let e of t){let t=e.indexOf(`:`);if(t===-1)continue;let a=e.substring(0,t),o=e.substring(t+1);if(o)try{let t=x(o);if(t)n.set(`$L${a}`,t);else if(o.startsWith(`E{`)){let e=o.substring(1),t=JSON.parse(e);i.push(t),console.error(`RSC: Server error`,t)}else if(o.startsWith(`[`)){let e=JSON.parse(o);r.set(a,e)}else if(o.startsWith(`Symbol.for(`))continue;else console.error(`Unknown RSC row format:`,e)}catch(t){console.error(`Failed to parse RSC row:`,e,t)}}if(i.length>0)throw Error(`RSC Server Error: ${i.map(e=>e.message||e).join(`, `)}`);let a=null,o=Array.from(r.keys()).sort((e,t)=>Number.parseInt(e,16)-Number.parseInt(t,16));for(let e of o){let t=r.get(e);if(Array.isArray(t)&&t.length>=2&&t[0]===`$`){let[,e,,n]=t,r=n?.[`~boundaryId`];if(e===`react.suspense`&&n&&r)continue;a=t;break}}return a?this.reconstructElementFromRscData(a,n):(console.error(`No valid root element found in RSC payload`,{elements:r,modules:n}),null)}reconstructElementFromRscData(e,t){if(e==null)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e))if(e.length>=4&&e[0]===`$`){let[,n,r,i]=e,a=n;if(typeof n==`string`&&n.includes(`#`))a=C(n)||(({children:e,...t})=>m(`div`,{...t,"data-client-component":n,style:{border:`2px dashed #f00`,padding:`8px`,margin:`4px`,backgroundColor:`#fff0f0`}},m(`small`,{style:{color:`#c00`}},`Missing Client Component: ${n}`),e));else if(typeof n==`string`&&n.startsWith(`$L`)&&t.has(n)){let e=t.get(n);e&&(a=C(`${e.id}#${e.name}`)||(({children:t,...r})=>m(`div`,{...r,"data-client-component":n,style:{border:`2px dashed #f00`,padding:`8px`,margin:`4px`,backgroundColor:`#fff0f0`}},m(`small`,{style:{color:`#c00`}},`Missing Client Component: ${e.name} (${e.id})`),t)))}let o=i?this.processPropsRecursively(i,t):{};return m(a,{key:r,...o})}else return e.map(e=>this.reconstructElementFromRscData(e,t));return typeof e==`object`?null:e}processPropsRecursively(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))if(r===`children`)if(Array.isArray(i))if(i.length>=2&&i[0]===`$`)n[r]=this.reconstructElementFromRscData(i,t);else{let e=i.map(e=>this.reconstructElementFromRscData(e,t)).filter(e=>e!=null);e.length===0?n[r]=null:e.length===1?n[r]=e[0]:n[r]=e}else n[r]=this.reconstructElementFromRscData(i,t);else r===`dangerouslySetInnerHTML`?n[r]=i:n[r]=this.reconstructElementFromRscData(i,t);return n}};function j({error:e,details:t}){return m(`div`,{className:`rsc-error`,style:{padding:`16px`,backgroundColor:`#fee`,border:`1px solid #fcc`,borderRadius:`4px`,margin:`8px 0`,fontFamily:`monospace`}},m(`h3`,{style:{margin:`0 0 8px 0`,color:`#c00`}},`RSC Error`),m(`p`,{style:{margin:`0 0 8px 0`}},e),t&&m(`details`,{style:{marginTop:`8px`}},m(`summary`,{style:{cursor:`pointer`}},`Error Details`),m(`pre`,{style:{fontSize:`12px`,overflow:`auto`,backgroundColor:`#f5f5f5`,padding:`8px`}},JSON.stringify(t,null,2))))}function M({rootPromise:e}){return g(e)}function N({componentId:e,props:t,fallback:n}){let r=typeof window<`u`&&window[`~rari`]?.hmr?.refreshCounters?.[e]||0,i=`${e}:${JSON.stringify(t)}:hmr:${r}`;if(!k.has(i)){let n=A.fetchServerComponent(e,t).catch(e=>{throw k.delete(i),e});k.set(i,n)}let a=g(k.get(i));if(a?.[`~isRscResponse`]){let e=a.readRoot();return m(f,{fallback:n??null},m(M,{rootPromise:e}))}return a??null}var P=class extends d.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidUpdate(e){e.mountKey!==this.props.mountKey&&this.state.hasError&&this.setState({hasError:!1,error:null})}componentDidCatch(e,t){console.error(`[rari] ServerComponentErrorBoundary: Error in component ${this.props.componentId}:`,e,t)}render(){return this.state.hasError?m(j,{error:this.state.error?.message||`Unknown error`,details:{componentId:this.props.componentId}}):this.props.children}};function F(e){let t=0;if(typeof window<`u`){let n=window;n[`~rari`].hmr||(n[`~rari`].hmr={refreshCounters:{}}),n[`~rari`].hmr.refreshCounters[e]===void 0&&(n[`~rari`].hmr.refreshCounters[e]=0),t=n[`~rari`].hmr.refreshCounters[e]}let n=n=>{let[r,i]=v(t);return _(()=>{let t=t=>{let n=t.detail;if(n&&n.filePath&&L(n.filePath)&&(A.clearCache(),typeof window<`u`)){let t=window;t[`~rari`].hmr||(t[`~rari`].hmr={refreshCounters:{}}),t[`~rari`].hmr.refreshCounters[e]=(t[`~rari`].hmr.refreshCounters[e]||0)+1,i(t[`~rari`].hmr.refreshCounters[e])}};return typeof window<`u`&&window.addEventListener(`rari:rsc-invalidate`,t),()=>{typeof window<`u`&&window.removeEventListener(`rari:rsc-invalidate`,t)}},[]),m(f,{fallback:null},m(P,{componentId:e,mountKey:r},m(N,{key:`${e}-${r}`,componentId:e,props:n,fallback:null})))};return n.displayName=`ServerComponent(${e})`,function(e){return m(n,e)}}function I(e,t){return A.fetchServerComponent(e,t)}function L(e){if(!e)return!1;try{return typeof globalThis<`u`&&globalThis[`~rari`].serverComponents?globalThis[`~rari`].serverComponents.has(e):!1}catch(e){return console.error(`Error checking if file is server component:`,e),!1}}if(import.meta.hot){let e=!1,t=[],n=new Map;function r(r,i){n.set(r,i),import.meta.hot.on(r,async n=>{if(!e){t.push({event:r,data:n});return}try{await i(n)}catch(e){console.error(`[rari] HMR: Error in handler for '${r}':`,e)}})}r(`rari:register-server-component`,e=>{e?.filePath&&typeof globalThis<`u`&&(globalThis[`~rari`].serverComponents=globalThis[`~rari`].serverComponents||new Set,globalThis[`~rari`].serverComponents.add(e.filePath))}),r(`rari:server-components-registry`,e=>{e?.serverComponents&&Array.isArray(e.serverComponents)&&typeof globalThis<`u`&&(globalThis[`~rari`].serverComponents=globalThis[`~rari`].serverComponents||new Set,e.serverComponents.forEach(e=>{globalThis[`~rari`].serverComponents?.add(e)}))}),r(`vite:beforeFullReload`,async e=>{e?.path&&L(e.path)&&await u({filePath:e.path,forceReload:!0})}),r(`rari:server-component-updated`,async e=>{let t=e?.id||e?.componentId,n=e?.t||e?.timestamp;if(t){if(typeof window<`u`){let r=new CustomEvent(`rari:rsc-invalidate`,{detail:{componentId:t,filePath:e.filePath||e.file,type:`server-component`,timestamp:n}});window.dispatchEvent(r)}}else e?.path&&L(e.path)&&await u({filePath:e.path,forceReload:!1})}),r(`rari:app-router-updated`,async e=>{try{if(!e||!e.routePath&&(!e.affectedRoutes||e.affectedRoutes.length===0))return;await i(e)}catch(e){console.error(`[rari] HMR: App router update failed:`,e)}}),r(`rari:server-action-updated`,async e=>{if(e?.filePath&&(A.clearCache(),typeof window<`u`)){let t=new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.filePath,type:`server-action`}});window.dispatchEvent(t)}});async function i(e){let t=e.fileType,n=e.filePath,r=e.routePath,i=e.affectedRoutes,o=e.manifestUpdated,u=e.metadata;e.metadataChanged&&u&&a(u);try{let e=`${b()}/_rari/hmr`,t=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`register`,file_path:n})});if(!t.ok){let e=await t.text(),n=`Component reload failed with status ${t.status}: ${e}`;throw console.error(`[rari] HMR:`,n),Error(n)}let r=await t.json();if(typeof r!=`object`||!r){let e=`Invalid reload response: null or non-object`;throw console.error(`[rari] HMR:`,e,r),Error(e)}if(r.success!==!0&&r.reloaded!==!0){let e=`Component reload unsuccessful: ${r.error||`unknown error`}`;throw console.error(`[rari] HMR:`,e,r),Error(e)}}catch(e){console.error(`[rari] HMR: Failed to reload component:`,e);return}let d=[r];switch(t){case`page`:d=[r];break;case`layout`:case`loading`:case`error`:case`not-found`:d=i;break;default:break}await s({routes:d,fileType:t,filePath:n,componentId:r}),o&&await l(),await c({routePath:r,affectedRoutes:i})}function a(e){if(!(typeof document>`u`)&&(e.title&&(document.title=e.title),e.description)){let t=document.querySelector(`meta[name="description"]`);t||(t=document.createElement(`meta`),t.setAttribute(`name`,`description`),document.head.appendChild(t)),t.setAttribute(`content`,e.description)}}function o(e){if(!e||e.length===0){A.clearCache();return}let t=[];for(let n of A.componentCache.keys())for(let r of e){if(n.includes(`route:${r}:`)||n.startsWith(`${r}:`)){t.push(n);break}if(r!==`/`&&n.includes(`route:${r}/`)){t.push(n);break}}for(let e of t)A.componentCache.delete(e),k.delete(e);let n=[];for(let t of k.keys())for(let r of e){if(t.includes(`route:${r}:`)||t.startsWith(`${r}:`)){n.push(t);break}if(r!==`/`&&t.includes(`route:${r}/`)){n.push(t);break}}for(let e of n)k.delete(e)}async function s(e){let t=e.routes||[],n=e.fileType,r=e.filePath,i=e.componentId;if(i||r)try{let e=`${b()}/_rari/hmr`,t=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`invalidate`,componentId:i||r,filePath:r})}),n=await t.text();t.ok||console.error(`[rari] HMR: Server cache invalidation failed:`,t.status,n)}catch(e){console.error(`[rari] HMR: Failed to call server invalidation endpoint:`,e)}if(o(t),typeof window<`u`){let e=new CustomEvent(`rari:rsc-invalidate`,{detail:{routes:t,fileType:n}});window.dispatchEvent(e)}}async function c(e){let t=e.routePath,n=e.affectedRoutes||[t];if(!(typeof window>`u`))try{let e=window.location.pathname,r=new CustomEvent(`rari:app-router-rerender`,{detail:{routePath:t,affectedRoutes:n,currentPath:e,preserveParams:!0}});window.dispatchEvent(r)}catch(e){throw console.error(`[rari] HMR: Failed to trigger re-render:`,e),e}}async function l(){typeof window<`u`&&window[`~rari`]?.routeInfoCache&&window[`~rari`].routeInfoCache.clear()}async function u(e){let t=e?.filePath||e;if(A.clearCache(),typeof window<`u`){let e=new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:t}});window.dispatchEvent(e)}}t.length>0?(async()=>{try{for(;t.length>0;){let e=[...t];t.length=0;for(let{event:t,data:r}of e){let e=n.get(t);if(e)try{await e(r)}catch(e){console.error(`[rari] HMR: Error replaying buffered event '${t}':`,e)}}}}catch(e){console.error(`[rari] HMR: Error during event replay:`,e)}finally{e=!0}})():e=!0}var R=class{overlay;currentError;escapeKeyHandler;constructor(){this.overlay=null,this.currentError=null,this.escapeKeyHandler=null}show(e){this.currentError=e,this.overlay?this.updateOverlay(e):this.createOverlay(e)}hide(){this.overlay&&(this.overlay.remove(),this.overlay=null,this.currentError=null),this.escapeKeyHandler&&=(document.removeEventListener(`keydown`,this.escapeKeyHandler),null)}isVisible(){return this.overlay!==null}createOverlay(e){this.overlay=document.createElement(`div`),this.overlay.id=`rari-hmr-error-overlay`,this.updateOverlay(e),document.body.appendChild(this.overlay),this.escapeKeyHandler=e=>{e.key===`Escape`&&this.hide()},document.addEventListener(`keydown`,this.escapeKeyHandler)}updateOverlay(e){if(!this.overlay)return;this.overlay.replaceChildren();let t=document.createElement(`div`);t.style.cssText=`position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.85); z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 2rem; backdrop-filter: blur(4px);`;let n=document.createElement(`div`);n.style.cssText=`background: #1e1e1e; color: #e0e0e0; border-radius: 0.5rem; padding: 2rem; max-width: 50rem; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4); border: 1px solid #ef4444;`;let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;`;let i=document.createElement(`div`);i.style.cssText=`display: flex; align-items: center; gap: 0.75rem;`;let a=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);a.style.cssText=`width: 2rem; height: 2rem; color: #ef4444;`,a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,`currentColor`),a.setAttribute(`viewBox`,`0 0 24 24`);let o=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);o.setAttribute(`stroke-linecap`,`round`),o.setAttribute(`stroke-linejoin`,`round`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`d`,`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`),a.appendChild(o);let s=document.createElement(`h1`);s.style.cssText=`margin: 0; font-size: 1.5rem; font-weight: 700; color: #ef4444;`,s.textContent=`Build Error`,i.appendChild(a),i.appendChild(s);let c=document.createElement(`button`);if(c.style.cssText=`background: transparent; border: none; color: #9ca3af; cursor: pointer; padding: 0.5rem; border-radius: 0.25rem; transition: all 0.2s; font-size: 1.5rem; line-height: 1; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;`,c.textContent=`×`,c.setAttribute(`aria-label`,`Close overlay`),c.onclick=()=>this.hide(),c.onmouseover=()=>{c.style.background=`rgba(255,255,255,0.1)`,c.style.color=`#e0e0e0`},c.onmouseout=()=>{c.style.background=`transparent`,c.style.color=`#9ca3af`},c.onfocus=()=>{c.style.background=`rgba(255,255,255,0.1)`,c.style.color=`#e0e0e0`},c.onblur=()=>{c.style.background=`transparent`,c.style.color=`#9ca3af`},r.appendChild(i),r.appendChild(c),n.appendChild(r),e.filePath){let t=document.createElement(`div`);t.style.cssText=`margin-bottom: 1rem; padding: 0.75rem; background: rgba(0, 0, 0, 0.2); border-radius: 0.375rem; font-family: monospace; font-size: 0.875rem;`;let r=document.createElement(`strong`);r.textContent=`File: `,t.appendChild(r),t.appendChild(document.createTextNode(e.filePath)),n.appendChild(t)}let l=document.createElement(`div`);l.style.cssText=`margin-bottom: 1.5rem;`;let u=document.createElement(`h2`);u.style.cssText=`margin: 0 0 0.75rem 0; font-size: 1rem; font-weight: 600; color: #fca5a5;`,u.textContent=`Error Message:`;let d=document.createElement(`pre`);if(d.style.cssText=`margin: 0; padding: 1rem; background: rgba(239, 68, 68, 0.1); border-left: 4px solid #ef4444; border-radius: 0.375rem; overflow-x: auto; font-family: monospace; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #fca5a5;`,d.textContent=e.message??`An error occurred`,l.appendChild(u),l.appendChild(d),n.appendChild(l),e.stack){let t=document.createElement(`details`);t.style.cssText=`margin-top: 1rem; cursor: pointer;`;let r=document.createElement(`summary`);r.style.cssText=`font-weight: 600; margin-bottom: 0.5rem; user-select: none;`,r.textContent=`Stack Trace`;let i=document.createElement(`pre`);i.style.cssText=`margin: 0; padding: 0.75rem; background: rgba(0, 0, 0, 0.2); border-radius: 0.375rem; overflow-x: auto; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;`,i.textContent=e.stack,t.appendChild(r),t.appendChild(i),n.appendChild(t)}let f=document.createElement(`div`);f.style.cssText=`margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #374151; display: flex; gap: 0.75rem; align-items: center;`;let p=document.createElement(`button`);p.style.cssText=`padding: 0.625rem 1.25rem; background: #ef4444; color: white; border: none; border-radius: 0.375rem; cursor: pointer; font-weight: 600; font-size: 0.875rem; transition: all 0.2s;`,p.textContent=`Reload Page`,p.onclick=()=>window.location.reload(),p.onmouseover=()=>{p.style.background=`#dc2626`},p.onmouseout=()=>{p.style.background=`#ef4444`},p.onfocus=()=>{p.style.background=`#dc2626`},p.onblur=()=>{p.style.background=`#ef4444`};let m=document.createElement(`button`);m.style.cssText=`padding: 0.625rem 1.25rem; background: #374151; color: #e0e0e0; border: none; border-radius: 0.375rem; cursor: pointer; font-weight: 600; font-size: 0.875rem; transition: all 0.2s;`,m.textContent=`Dismiss`,m.onclick=()=>this.hide(),m.onmouseover=()=>{m.style.background=`#4b5563`},m.onmouseout=()=>{m.style.background=`#374151`},m.onfocus=()=>{m.style.background=`#4b5563`},m.onblur=()=>{m.style.background=`#374151`};let h=document.createElement(`span`);h.style.cssText=`margin-left: auto; font-size: 0.75rem; color: #9ca3af;`;let g=new Date(e.timestamp);h.textContent=Number.isNaN(g.valueOf())?``:g.toLocaleTimeString(),f.appendChild(p),f.appendChild(m),f.appendChild(h),n.appendChild(f),t.appendChild(n),this.overlay.appendChild(t)}};let z=null;function B(){return z||=new R,z}if(import.meta.hot){let e=B();import.meta.hot.on(`rari:hmr-error`,t=>{let n=t.msg||t.message,r=t.file||t.filePath,i=t.t||t.timestamp,a=t.count||t.errorCount,o=t.max||t.maxErrors;console.error(`[rari] HMR: Build error:`,n),r&&console.error(`[rari] HMR: File:`,r),t.stack&&console.error(`[rari] HMR: Stack:`,t.stack),e.show({message:n,stack:t.stack,filePath:r,timestamp:i}),a&&o&&(a>=o?console.error(`[rari] HMR: Maximum error count (${o}) reached. Consider restarting the dev server if issues persist.`):a>=o-2&&console.warn(`[rari] HMR: Error count: ${a}/${o}. Approaching maximum error threshold.`))}),import.meta.hot.on(`rari:hmr-error-cleared`,()=>{e.hide()}),import.meta.hot.on(`vite:error`,t=>{e.show({message:t.err?.message||`Unknown Vite error`,stack:t.err?.stack,filePath:t.err?.file,timestamp:Date.now()})})}export{j as RscErrorComponent,w as createClientModuleMap,F as createServerComponentWrapper,I as fetchServerComponent,C as getClientComponent,S as registerClientComponent,A as rscClient};
1
+ import{a as e,c as t,d as n,l as r,n as i,p as a,s as o,u as s}from"../regex-constants-B4P386OY.mjs";import{t as c}from"../get-client-component-B4Y2T40R.mjs";import{createFromFetch as l,createFromReadableStream as u}from"./vendor/react-flight-client/index.mjs";import*as d from"react";import{Suspense as f,cloneElement as p,createElement as m,isValidElement as h,use as g,useEffect as _,useState as v}from"react";import*as y from"react-dom/client";function b(){return import.meta.env?.RARI_SERVER_URL?import.meta.env.RARI_SERVER_URL:typeof window<`u`?window.location.origin:`http://localhost:3000`}globalThis[`~rari`]===void 0&&(globalThis[`~rari`]={}),globalThis[`~rari`].isDevelopment=process.env.NODE_ENV!==`production`,globalThis[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={}),globalThis[`~clientComponentNames`]===void 0&&(globalThis[`~clientComponentNames`]={}),globalThis[`~clientComponentPaths`]===void 0&&(globalThis[`~clientComponentPaths`]={}),typeof window<`u`&&(window[`~rari`]||(window[`~rari`]=globalThis[`~rari`]),window[`~rari`].streaming||(window[`~rari`].streaming={bufferedRows:[],bufferedEvents:[]}),window[`~rari`].streaming.bufferedEvents||(window[`~rari`].streaming.bufferedEvents=[]),window[`~rari`].boundaryModules||(window[`~rari`].boundaryModules=new Map),window[`~rari`].pendingBoundaryHydrations||(window[`~rari`].pendingBoundaryHydrations=new Map));function x(e){if(!e.startsWith(`I{`))return null;try{let t=JSON.parse(e.substring(1));if(typeof t==`object`&&t&&!Array.isArray(t)){if(typeof t.id!=`string`)return console.error(`[rari] Invalid import data: id must be a string:`,t),null;let e;if(typeof t.chunks==`string`)e=[t.chunks];else if(Array.isArray(t.chunks))e=t.chunks.filter(e=>typeof e==`string`);else return console.error(`[rari] Invalid import data: chunks must be a string or array:`,t),null;return e.length===0?(console.error(`[rari] Invalid import data: chunks array is empty:`,t),null):{id:t.id,chunks:e,name:t.name||`default`}}console.error(`[rari] Invalid import data format, expected object:`,t)}catch(t){console.error(`[rari] Failed to parse import row:`,e,t)}return null}if(typeof window<`u`){globalThis[`~rari`].processBoundaryUpdate=function(e,a,c){let l=document.querySelector(`[data-boundary-id="${e}"]`);if(l)try{let u=a.indexOf(`:`);if(u===-1){console.warn(`[rari] Invalid RSC row format (no colon):`,a);return}let d=a.substring(0,u),f=a.substring(u+1),p=x(f);if(p){let e=`$L${d}`;window[`~rari`].boundaryModules?.set(e,p);return}let m;try{m=JSON.parse(f)}catch(e){console.error(`[rari] Failed to parse RSC content:`,f,e);return}function h(e){if(!e)return!1;if(typeof e==`string`)return e.startsWith(`$L`);if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t]=e;if(typeof t==`string`&&t.startsWith(`$L`))return!0;let n=e[3];if(n&&n.children)return h(n.children)}return e.some(e=>h(e))}return!1}if(h(m)){if(window[`~rari`].pendingBoundaryHydrations?.set(e,{content:m,element:l,rowId:c}),globalThis[`~rari`].hydrateClientComponents){let t=globalThis[`~rari`].hydrateClientComponents;t(e,m,l)}return}function g(e){let a=e=>e.replace(o,`&amp;`).replace(s,`&lt;`).replace(r,`&gt;`).replace(n,`&quot;`).replace(t,`&#39;`),c=new Set(`div.span.p.ul.ol.li.a.img.section.article.header.footer.nav.main.aside.strong.em.b.i.button.input.label.form.select.option.textarea.h1.h2.h3.h4.h5.h6.table.thead.tbody.tr.td.th.code.pre.blockquote.hr.br.small.mark.del.ins.sub.sup.abbr.time.figure.figcaption.details.summary.dialog.menu.menuitem.canvas.svg.path.circle.rect.line.polygon.polyline.ellipse.text.g.defs.use.symbol.clippath.mask.pattern.lineargradient.radialgradient.stop.image.video.audio.source.track.picture.dl.dt.dd.fieldset.legend`.split(`.`));if(!e)return``;if(typeof e==`string`||typeof e==`number`)return a(String(e));if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t,,n]=e,r=typeof t==`string`&&c.has(t.toLowerCase())?t.toLowerCase():`div`,o=null,s=``,l=``;if(n){for(let[e,t]of Object.entries(n))if(e===`dangerouslySetInnerHTML`&&t&&typeof t==`object`&&`__html`in t)o=t.__html;else if(e!==`children`&&e!==`~boundaryId`){let n=e===`className`?`class`:e;if(e===`style`&&typeof t==`object`&&t){let e=Object.entries(t).map(([e,t])=>`${e.replace(i,`$1-$2`).toLowerCase()}:${String(t)}`).join(`;`);l+=` style="${a(e)}"`}else typeof t==`string`||typeof t==`number`?l+=` ${n}="${a(String(t))}"`:typeof t==`boolean`&&t&&(l+=` ${n}`)}o===null&&n.children&&(s=g(n.children))}return`<${r}${l}>${o===null?s:o}</${r}>`}return e.map(g).join(``)}return``}let _=g(m);if(_){let t=document.contains(l);t&&(l.innerHTML=_,l.classList.add(`rari-boundary-resolved`)),window.dispatchEvent(new CustomEvent(`rari:boundary-resolved`,{detail:{boundaryId:e,rscRow:a,rowId:c,element:l,wasAttached:t}}))}}catch(e){console.error(`[rari] Error processing boundary update:`,e)}};let e=window,a=globalThis;e[`~rari`].streaming?.bufferedEvents&&e[`~rari`].streaming.bufferedEvents.length>0&&(e[`~rari`].streaming.bufferedEvents.forEach(e=>{let{boundaryId:t,rscRow:n,rowId:r}=e;a[`~rari`].processBoundaryUpdate?.(t,n,r)}),e[`~rari`].streaming.bufferedEvents=[]),window.addEventListener(`rari:boundary-update`,e=>{let{boundaryId:t,rscRow:n,rowId:r}=e.detail;a[`~rari`].processBoundaryUpdate&&a[`~rari`].processBoundaryUpdate(t,n,r)})}function S(t,n,r){let i=r==="default"?t.name||n.split(`/`).pop()?.replace(e,``)||`DefaultComponent`:r,a=i,o={id:a,path:n,type:`client`,component:t,registered:!0};globalThis[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={});let s=`${n}#${r}`;globalThis[`~clientComponents`][a]=o,globalThis[`~clientComponents`][n]=o,globalThis[`~clientComponents`][s]=o,globalThis[`~clientComponentPaths`][n]=a,globalThis[`~clientComponentNames`][i]=a,t&&(t[`~isClientComponent`]=!0,t[`~clientComponentId`]=a),typeof window<`u`&&fetch(`/_rari/register-client`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:a,file_path:n,export_name:r})}).catch(e=>{console.error(`[rari] Failed to register client component with server:`,e)})}function C(e){return c(e)}function w(){let e={};for(let[t,n]of Object.entries(globalThis[`~clientComponents`]))e[t]={id:t,chunks:[n.path],name:t,async:!1,default:n.component};return e}let T=l,E=u,D=null;async function O(){return D||(D=(async()=>{try{return T=l,E=u,typeof E!=`function`&&(E=null),typeof T!=`function`&&(T=null),y}catch(e){return console.error(`Failed to load react-dom/client RSC functions:`,e),T=null,E=null,null}})(),D)}const k=new Map,A=new class{componentCache;moduleCache;inflightRequests;config;constructor(){this.componentCache=new Map,this.moduleCache=new Map,this.inflightRequests=new Map,this.config={maxRetries:5,retryDelay:500,timeout:1e4}}configure(e){this.config={...this.config,...e}}clearCache(){this.componentCache.clear(),this.moduleCache.clear(),k.clear()}async fetchServerComponent(e,t={}){let n=typeof window<`u`&&window[`~rari`]?.hmr?.refreshCounters?.[e]||0,r=`${e}:${JSON.stringify(t)}:hmr:${n}`;if(this.componentCache.has(r))return this.componentCache.get(r);if(this.inflightRequests.has(r))return this.inflightRequests.get(r);let i=this.fetchServerComponentStream(e,t);this.inflightRequests.set(r,i);try{let e=await i;return this.componentCache.set(r,e),e}finally{this.inflightRequests.delete(r)}}async fetchServerComponentStream(e,t={}){await O();let n=(()=>{let e=[`/_rari/stream`];try{if(typeof window<`u`&&(window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`)){let t=b();t&&e.push(`${t}/_rari/stream`)}}catch{}return e})(),r=null,i=null,a=async()=>{for(let r of n)try{let n=await this.fetchWithTimeout(r,{method:`POST`,headers:{"Content-Type":`application/json`,...this.buildRequestHeaders()},body:JSON.stringify({component_id:e,props:t})});if(n.ok)return n;i=Error(`HTTP ${n.status}: ${await n.text()}`)}catch(e){i=e}return null};if(r=await a(),r||=(await new Promise(e=>setTimeout(e,this.config.retryDelay)),await a()),!r)throw i||Error(`Failed to reach stream endpoint`);if(!r.ok){let e=await r.text();throw Error(`Server responded with ${r.status}: ${e}`)}let o=r.body;if(!o)throw Error(`No ReadableStream from stream response`);let s=o.getReader(),c=new TextDecoder,l=new Map,u=new Map,d=e=>{if(!m)return console.error(`React not available for RSC conversion`),null;if(!e)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t,n,r]=e;if(t===`react.suspense`||t===`suspense`)return m(f,{fallback:d(r?.fallback)||null},r?.children?d(r.children):null);let i=r?{...r}:{};if(r?.children){let e=d(r.children);Array.isArray(e)?i.children=e.map((e,t)=>h(e)&&e.key==null?p(e,{key:t}):e):i.children=e}if(typeof t==`string`){if(t.startsWith(`$L`)){let e=l.get(t);if(e){let t=C(`${e.id}#${e.name||`default`}`);if(t)return m(t,n?{...i,key:n}:i)}return i&&i.children?i.children:null}if(t.includes(`.tsx#`)||t.includes(`.jsx#`)){let e=C(t);return e?m(e,n?{...i,key:n}:i):(console.error(`Failed to resolve client component:`,t),null)}else return i&&Object.hasOwn(i,`~boundaryId`)&&(i={...i},delete i[`~boundaryId`]),m(t,n?{...i,key:n}:i)}else console.error(`Unknown RSC element type:`,t)}return e.map(e=>d(e))}return typeof e==`object`?(console.error(`Unexpected object in RSC conversion:`,e),null):e},g=null,y=new Map,S=``,w=null,T=async()=>{try{for(;;){let{value:e,done:t}=await s.read();if(t)break;let n=c.decode(e,{stream:!0});S+=n;let r=S.split(`
2
+ `),i=r.slice(0,-1);S=r.at(-1)||``;for(let e of i)if(e.trim())try{let t=e.indexOf(`:`);if(t===-1)continue;let n=e.substring(0,t),r=e.substring(t+1),i=x(r);if(i)l.set(`$L${n}`,i);else if(r.startsWith(`E{`))try{let e=JSON.parse(r.substring(1));console.error(`RSC stream error:`,e)}catch(e){console.error(`Failed to parse error row:`,r,e)}else if(r.startsWith(`Symbol.for(`))continue;else if(r.startsWith(`[`)){let e=JSON.parse(r);if(Array.isArray(e)&&e.length>=4){let[t,r,i]=e,a=i?.[`~boundaryId`];if(t===`$`&&(r===`react.suspense`||r===`suspense`)&&i&&a&&u.set(`$L${n}`,a),t===`$`&&i&&Object.hasOwn(i,`children`)&&typeof r==`string`&&r.startsWith(`$L`)){let e=u.get(r)||null;if(e){let t=d(i.children);y.set(e,t),w&&w.updateBoundary(e,t);continue}}}if(!g){let t=!0;if(Array.isArray(e)&&e.length>=4&&e[0]===`$`){let n=e[1],r=e[3],i=r?.[`~boundaryId`];typeof n==`string`&&(n===`react.suspense`||n===`suspense`)&&r&&i&&(t=!1)}t&&(g=d(e),w&&typeof w.updateRoot==`function`&&w.updateRoot())}}}catch(t){console.error(`Failed to parse stream line:`,e,t)}}}catch(e){console.error(`Error processing stream:`,e)}},E=()=>{let[,e]=v(0);_(()=>(w={updateBoundary:(t,n)=>{y.set(t,n),e(e=>e+1)},updateRoot:()=>{e(e=>e+1)}},()=>{w=null}),[e]);let t=e=>{if(!e)return null;if(h(e)){let n=e.props,r=n?.[`~boundaryId`];if(n&&r){let e=y.get(r);if(e)return e}if(n&&n.children){let r=t(n.children);if(r!==n.children){let t={...n};return e.key!==null&&e.key!==void 0&&(t.key=e.key),m(e.type,t,r)}}return e}return Array.isArray(e)?e.map(e=>t(e)):e};return t(g)};T();let D=Promise.resolve(m(E));return{"~isRscResponse":!0,"~rscPromise":D,readRoot(){return D}}}buildRequestHeaders(){return{Accept:`text/x-component`,"Cache-Control":`no-cache, no-transform`}}async fetchWithTimeout(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),this.config.timeout);try{let i=await fetch(e,{...t,signal:n.signal});return clearTimeout(r),i}catch(e){throw clearTimeout(r),e}}async processRscResponse(e){if(await O(),T)try{let t=T(Promise.resolve(e));return{"~isRscResponse":!0,"~rscPromise":t,readRoot(){return t}}}catch{throw Error(`React Server DOM client not available`)}else throw Error(`React Server DOM client not available`)}async processRscResponseManually(e){let t=await e.text();return this.parseRscResponse(t)}parseRscResponse(e){let t=e.trim().split(a),n=new Map,r=new Map,i=[];for(let e of t){let t=e.indexOf(`:`);if(t===-1)continue;let a=e.substring(0,t),o=e.substring(t+1);if(o)try{let t=x(o);if(t)n.set(`$L${a}`,t);else if(o.startsWith(`E{`)){let e=o.substring(1),t=JSON.parse(e);i.push(t),console.error(`RSC: Server error`,t)}else if(o.startsWith(`[`)){let e=JSON.parse(o);r.set(a,e)}else if(o.startsWith(`Symbol.for(`))continue;else console.error(`Unknown RSC row format:`,e)}catch(t){console.error(`Failed to parse RSC row:`,e,t)}}if(i.length>0)throw Error(`RSC Server Error: ${i.map(e=>e.message||e).join(`, `)}`);let o=null,s=Array.from(r.keys()).sort((e,t)=>Number.parseInt(e,16)-Number.parseInt(t,16));for(let e of s){let t=r.get(e);if(Array.isArray(t)&&t.length>=2&&t[0]===`$`){let[,e,,n]=t,r=n?.[`~boundaryId`];if(e===`react.suspense`&&n&&r)continue;o=t;break}}return o?this.reconstructElementFromRscData(o,n):(console.error(`No valid root element found in RSC payload`,{elements:r,modules:n}),null)}reconstructElementFromRscData(e,t){if(e==null)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e))if(e.length>=4&&e[0]===`$`){let[,n,r,i]=e,a=n;if(typeof n==`string`&&n.includes(`#`))a=C(n)||(({children:e,...t})=>m(`div`,{...t,"data-client-component":n,style:{border:`2px dashed #f00`,padding:`8px`,margin:`4px`,backgroundColor:`#fff0f0`}},m(`small`,{style:{color:`#c00`}},`Missing Client Component: ${n}`),e));else if(typeof n==`string`&&n.startsWith(`$L`)&&t.has(n)){let e=t.get(n);e&&(a=C(`${e.id}#${e.name}`)||(({children:t,...r})=>m(`div`,{...r,"data-client-component":n,style:{border:`2px dashed #f00`,padding:`8px`,margin:`4px`,backgroundColor:`#fff0f0`}},m(`small`,{style:{color:`#c00`}},`Missing Client Component: ${e.name} (${e.id})`),t)))}let o=i?this.processPropsRecursively(i,t):{};return m(a,{key:r,...o})}else return e.map(e=>this.reconstructElementFromRscData(e,t));return typeof e==`object`?null:e}processPropsRecursively(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))if(r===`children`)if(Array.isArray(i))if(i.length>=2&&i[0]===`$`)n[r]=this.reconstructElementFromRscData(i,t);else{let e=i.map(e=>this.reconstructElementFromRscData(e,t)).filter(e=>e!=null);e.length===0?n[r]=null:e.length===1?n[r]=e[0]:n[r]=e}else n[r]=this.reconstructElementFromRscData(i,t);else r===`dangerouslySetInnerHTML`?n[r]=i:n[r]=this.reconstructElementFromRscData(i,t);return n}};function j({error:e,details:t}){return m(`div`,{className:`rsc-error`,style:{padding:`16px`,backgroundColor:`#fee`,border:`1px solid #fcc`,borderRadius:`4px`,margin:`8px 0`,fontFamily:`monospace`}},m(`h3`,{style:{margin:`0 0 8px 0`,color:`#c00`}},`RSC Error`),m(`p`,{style:{margin:`0 0 8px 0`}},e),t&&m(`details`,{style:{marginTop:`8px`}},m(`summary`,{style:{cursor:`pointer`}},`Error Details`),m(`pre`,{style:{fontSize:`12px`,overflow:`auto`,backgroundColor:`#f5f5f5`,padding:`8px`}},JSON.stringify(t,null,2))))}function M({rootPromise:e}){return g(e)}function N({componentId:e,props:t,fallback:n}){let r=typeof window<`u`&&window[`~rari`]?.hmr?.refreshCounters?.[e]||0,i=`${e}:${JSON.stringify(t)}:hmr:${r}`;if(!k.has(i)){let n=A.fetchServerComponent(e,t).catch(e=>{throw k.delete(i),e});k.set(i,n)}let a=g(k.get(i));if(a?.[`~isRscResponse`]){let e=a.readRoot();return m(f,{fallback:n??null},m(M,{rootPromise:e}))}return a??null}var P=class extends d.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidUpdate(e){e.mountKey!==this.props.mountKey&&this.state.hasError&&this.setState({hasError:!1,error:null})}componentDidCatch(e,t){console.error(`[rari] ServerComponentErrorBoundary: Error in component ${this.props.componentId}:`,e,t)}render(){return this.state.hasError?m(j,{error:this.state.error?.message||`Unknown error`,details:{componentId:this.props.componentId}}):this.props.children}};function F(e){let t=0;if(typeof window<`u`){let n=window;n[`~rari`].hmr||(n[`~rari`].hmr={refreshCounters:{}}),n[`~rari`].hmr.refreshCounters[e]===void 0&&(n[`~rari`].hmr.refreshCounters[e]=0),t=n[`~rari`].hmr.refreshCounters[e]}let n=n=>{let[r,i]=v(t);return _(()=>{let t=t=>{let n=t.detail;if(n&&n.filePath&&L(n.filePath)&&(A.clearCache(),typeof window<`u`)){let t=window;t[`~rari`].hmr||(t[`~rari`].hmr={refreshCounters:{}}),t[`~rari`].hmr.refreshCounters[e]=(t[`~rari`].hmr.refreshCounters[e]||0)+1,i(t[`~rari`].hmr.refreshCounters[e])}};return typeof window<`u`&&window.addEventListener(`rari:rsc-invalidate`,t),()=>{typeof window<`u`&&window.removeEventListener(`rari:rsc-invalidate`,t)}},[]),m(f,{fallback:null},m(P,{componentId:e,mountKey:r},m(N,{key:`${e}-${r}`,componentId:e,props:n,fallback:null})))};return n.displayName=`ServerComponent(${e})`,function(e){return m(n,e)}}function I(e,t){return A.fetchServerComponent(e,t)}function L(e){if(!e)return!1;try{return typeof globalThis<`u`&&globalThis[`~rari`].serverComponents?globalThis[`~rari`].serverComponents.has(e):!1}catch(e){return console.error(`Error checking if file is server component:`,e),!1}}if(import.meta.hot){let e=!1,t=[],n=new Map;function r(r,i){n.set(r,i),import.meta.hot.on(r,async n=>{if(!e){t.push({event:r,data:n});return}try{await i(n)}catch(e){console.error(`[rari] HMR: Error in handler for '${r}':`,e)}})}r(`rari:register-server-component`,e=>{e?.filePath&&typeof globalThis<`u`&&(globalThis[`~rari`].serverComponents=globalThis[`~rari`].serverComponents||new Set,globalThis[`~rari`].serverComponents.add(e.filePath))}),r(`rari:server-components-registry`,e=>{e?.serverComponents&&Array.isArray(e.serverComponents)&&typeof globalThis<`u`&&(globalThis[`~rari`].serverComponents=globalThis[`~rari`].serverComponents||new Set,e.serverComponents.forEach(e=>{globalThis[`~rari`].serverComponents?.add(e)}))}),r(`vite:beforeFullReload`,async e=>{e?.path&&L(e.path)&&await u({filePath:e.path,forceReload:!0})}),r(`rari:server-component-updated`,async e=>{let t=e?.id||e?.componentId,n=e?.t||e?.timestamp;if(t){if(typeof window<`u`){let r=new CustomEvent(`rari:rsc-invalidate`,{detail:{componentId:t,filePath:e.filePath||e.file,type:`server-component`,timestamp:n}});window.dispatchEvent(r)}}else e?.path&&L(e.path)&&await u({filePath:e.path,forceReload:!1})}),r(`rari:app-router-updated`,async e=>{try{if(!e||!e.routePath&&(!e.affectedRoutes||e.affectedRoutes.length===0))return;await i(e)}catch(e){console.error(`[rari] HMR: App router update failed:`,e)}}),r(`rari:server-action-updated`,async e=>{if(e?.filePath&&(A.clearCache(),typeof window<`u`)){let t=new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.filePath,type:`server-action`}});window.dispatchEvent(t)}});async function i(e){let t=e.fileType,n=e.filePath,r=e.routePath,i=e.affectedRoutes,o=e.manifestUpdated,u=e.metadata;e.metadataChanged&&u&&a(u);try{let e=`${b()}/_rari/hmr`,t=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`register`,file_path:n})});if(!t.ok){let e=await t.text(),n=`Component reload failed with status ${t.status}: ${e}`;throw console.error(`[rari] HMR:`,n),Error(n)}let r=await t.json();if(typeof r!=`object`||!r){let e=`Invalid reload response: null or non-object`;throw console.error(`[rari] HMR:`,e,r),Error(e)}if(r.success!==!0&&r.reloaded!==!0){let e=`Component reload unsuccessful: ${r.error||`unknown error`}`;throw console.error(`[rari] HMR:`,e,r),Error(e)}}catch(e){console.error(`[rari] HMR: Failed to reload component:`,e);return}let d=[r];switch(t){case`page`:d=[r];break;case`layout`:case`loading`:case`error`:case`not-found`:d=i;break;default:break}await s({routes:d,fileType:t,filePath:n,componentId:r}),o&&await l(),await c({routePath:r,affectedRoutes:i})}function a(e){if(!(typeof document>`u`)&&(e.title&&(document.title=e.title),e.description)){let t=document.querySelector(`meta[name="description"]`);t||(t=document.createElement(`meta`),t.setAttribute(`name`,`description`),document.head.appendChild(t)),t.setAttribute(`content`,e.description)}}function o(e){if(!e||e.length===0){A.clearCache();return}let t=[];for(let n of A.componentCache.keys())for(let r of e){if(n.includes(`route:${r}:`)||n.startsWith(`${r}:`)){t.push(n);break}if(r!==`/`&&n.includes(`route:${r}/`)){t.push(n);break}}for(let e of t)A.componentCache.delete(e),k.delete(e);let n=[];for(let t of k.keys())for(let r of e){if(t.includes(`route:${r}:`)||t.startsWith(`${r}:`)){n.push(t);break}if(r!==`/`&&t.includes(`route:${r}/`)){n.push(t);break}}for(let e of n)k.delete(e)}async function s(e){let t=e.routes||[],n=e.fileType,r=e.filePath,i=e.componentId;if(i||r)try{let e=`${b()}/_rari/hmr`,t=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`invalidate`,componentId:i||r,filePath:r})}),n=await t.text();t.ok||console.error(`[rari] HMR: Server cache invalidation failed:`,t.status,n)}catch(e){console.error(`[rari] HMR: Failed to call server invalidation endpoint:`,e)}if(o(t),typeof window<`u`){let e=new CustomEvent(`rari:rsc-invalidate`,{detail:{routes:t,fileType:n}});window.dispatchEvent(e)}}async function c(e){let t=e.routePath,n=e.affectedRoutes||[t];if(!(typeof window>`u`))try{let e=window.location.pathname,r=new CustomEvent(`rari:app-router-rerender`,{detail:{routePath:t,affectedRoutes:n,currentPath:e,preserveParams:!0}});window.dispatchEvent(r)}catch(e){throw console.error(`[rari] HMR: Failed to trigger re-render:`,e),e}}async function l(){typeof window<`u`&&window[`~rari`]?.routeInfoCache&&window[`~rari`].routeInfoCache.clear()}async function u(e){let t=e?.filePath||e;if(A.clearCache(),typeof window<`u`){let e=new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:t}});window.dispatchEvent(e)}}t.length>0?(async()=>{try{for(;t.length>0;){let e=[...t];t.length=0;for(let{event:t,data:r}of e){let e=n.get(t);if(e)try{await e(r)}catch(e){console.error(`[rari] HMR: Error replaying buffered event '${t}':`,e)}}}}catch(e){console.error(`[rari] HMR: Error during event replay:`,e)}finally{e=!0}})():e=!0}var R=class{overlay;currentError;escapeKeyHandler;constructor(){this.overlay=null,this.currentError=null,this.escapeKeyHandler=null}show(e){this.currentError=e,this.overlay?this.updateOverlay(e):this.createOverlay(e)}hide(){this.overlay&&(this.overlay.remove(),this.overlay=null,this.currentError=null),this.escapeKeyHandler&&=(document.removeEventListener(`keydown`,this.escapeKeyHandler),null)}isVisible(){return this.overlay!==null}createOverlay(e){this.overlay=document.createElement(`div`),this.overlay.id=`rari-hmr-error-overlay`,this.updateOverlay(e),document.body.appendChild(this.overlay),this.escapeKeyHandler=e=>{e.key===`Escape`&&this.hide()},document.addEventListener(`keydown`,this.escapeKeyHandler)}updateOverlay(e){if(!this.overlay)return;this.overlay.replaceChildren();let t=document.createElement(`div`);t.style.cssText=`position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.85); z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 2rem; backdrop-filter: blur(4px);`;let n=document.createElement(`div`);n.style.cssText=`background: #1e1e1e; color: #e0e0e0; border-radius: 0.5rem; padding: 2rem; max-width: 50rem; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4); border: 1px solid #ef4444;`;let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;`;let i=document.createElement(`div`);i.style.cssText=`display: flex; align-items: center; gap: 0.75rem;`;let a=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);a.style.cssText=`width: 2rem; height: 2rem; color: #ef4444;`,a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,`currentColor`),a.setAttribute(`viewBox`,`0 0 24 24`);let o=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);o.setAttribute(`stroke-linecap`,`round`),o.setAttribute(`stroke-linejoin`,`round`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`d`,`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`),a.appendChild(o);let s=document.createElement(`h1`);s.style.cssText=`margin: 0; font-size: 1.5rem; font-weight: 700; color: #ef4444;`,s.textContent=`Build Error`,i.appendChild(a),i.appendChild(s);let c=document.createElement(`button`);if(c.style.cssText=`background: transparent; border: none; color: #9ca3af; cursor: pointer; padding: 0.5rem; border-radius: 0.25rem; transition: all 0.2s; font-size: 1.5rem; line-height: 1; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;`,c.textContent=`×`,c.setAttribute(`aria-label`,`Close overlay`),c.onclick=()=>this.hide(),c.onmouseover=()=>{c.style.background=`rgba(255,255,255,0.1)`,c.style.color=`#e0e0e0`},c.onmouseout=()=>{c.style.background=`transparent`,c.style.color=`#9ca3af`},c.onfocus=()=>{c.style.background=`rgba(255,255,255,0.1)`,c.style.color=`#e0e0e0`},c.onblur=()=>{c.style.background=`transparent`,c.style.color=`#9ca3af`},r.appendChild(i),r.appendChild(c),n.appendChild(r),e.filePath){let t=document.createElement(`div`);t.style.cssText=`margin-bottom: 1rem; padding: 0.75rem; background: rgba(0, 0, 0, 0.2); border-radius: 0.375rem; font-family: monospace; font-size: 0.875rem;`;let r=document.createElement(`strong`);r.textContent=`File: `,t.appendChild(r),t.appendChild(document.createTextNode(e.filePath)),n.appendChild(t)}let l=document.createElement(`div`);l.style.cssText=`margin-bottom: 1.5rem;`;let u=document.createElement(`h2`);u.style.cssText=`margin: 0 0 0.75rem 0; font-size: 1rem; font-weight: 600; color: #fca5a5;`,u.textContent=`Error Message:`;let d=document.createElement(`pre`);if(d.style.cssText=`margin: 0; padding: 1rem; background: rgba(239, 68, 68, 0.1); border-left: 4px solid #ef4444; border-radius: 0.375rem; overflow-x: auto; font-family: monospace; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #fca5a5;`,d.textContent=e.message??`An error occurred`,l.appendChild(u),l.appendChild(d),n.appendChild(l),e.stack){let t=document.createElement(`details`);t.style.cssText=`margin-top: 1rem; cursor: pointer;`;let r=document.createElement(`summary`);r.style.cssText=`font-weight: 600; margin-bottom: 0.5rem; user-select: none;`,r.textContent=`Stack Trace`;let i=document.createElement(`pre`);i.style.cssText=`margin: 0; padding: 0.75rem; background: rgba(0, 0, 0, 0.2); border-radius: 0.375rem; overflow-x: auto; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;`,i.textContent=e.stack,t.appendChild(r),t.appendChild(i),n.appendChild(t)}let f=document.createElement(`div`);f.style.cssText=`margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #374151; display: flex; gap: 0.75rem; align-items: center;`;let p=document.createElement(`button`);p.style.cssText=`padding: 0.625rem 1.25rem; background: #ef4444; color: white; border: none; border-radius: 0.375rem; cursor: pointer; font-weight: 600; font-size: 0.875rem; transition: all 0.2s;`,p.textContent=`Reload Page`,p.onclick=()=>window.location.reload(),p.onmouseover=()=>{p.style.background=`#dc2626`},p.onmouseout=()=>{p.style.background=`#ef4444`},p.onfocus=()=>{p.style.background=`#dc2626`},p.onblur=()=>{p.style.background=`#ef4444`};let m=document.createElement(`button`);m.style.cssText=`padding: 0.625rem 1.25rem; background: #374151; color: #e0e0e0; border: none; border-radius: 0.375rem; cursor: pointer; font-weight: 600; font-size: 0.875rem; transition: all 0.2s;`,m.textContent=`Dismiss`,m.onclick=()=>this.hide(),m.onmouseover=()=>{m.style.background=`#4b5563`},m.onmouseout=()=>{m.style.background=`#374151`},m.onfocus=()=>{m.style.background=`#4b5563`},m.onblur=()=>{m.style.background=`#374151`};let h=document.createElement(`span`);h.style.cssText=`margin-left: auto; font-size: 0.75rem; color: #9ca3af;`;let g=new Date(e.timestamp);h.textContent=Number.isNaN(g.valueOf())?``:g.toLocaleTimeString(),f.appendChild(p),f.appendChild(m),f.appendChild(h),n.appendChild(f),t.appendChild(n),this.overlay.appendChild(t)}};let z=null;function B(){return z||=new R,z}if(import.meta.hot){let e=B();import.meta.hot.on(`rari:hmr-error`,t=>{let n=t.msg||t.message,r=t.file||t.filePath,i=t.t||t.timestamp,a=t.count||t.errorCount,o=t.max||t.maxErrors;console.error(`[rari] HMR: Build error:`,n),r&&console.error(`[rari] HMR: File:`,r),t.stack&&console.error(`[rari] HMR: Stack:`,t.stack),e.show({message:n,stack:t.stack,filePath:r,timestamp:i}),a&&o&&(a>=o?console.error(`[rari] HMR: Maximum error count (${o}) reached. Consider restarting the dev server if issues persist.`):a>=o-2&&console.warn(`[rari] HMR: Error count: ${a}/${o}. Approaching maximum error threshold.`))}),import.meta.hot.on(`rari:hmr-error-cleared`,()=>{e.hide()}),import.meta.hot.on(`vite:error`,t=>{e.show({message:t.err?.message||`Unknown Vite error`,stack:t.err?.stack,filePath:t.err?.file,timestamp:Date.now()})})}export{j as RscErrorComponent,w as createClientModuleMap,F as createServerComponentWrapper,I as fetchServerComponent,C as getClientComponent,S as registerClientComponent,A as rscClient};
@@ -1,4 +1,4 @@
1
- import { i as StringDecoder, r as ServerConsumerModuleMap, t as ClientReference } from "../../../ReactFlightClientConfig-DdCyeIZx.mjs";
1
+ import { i as StringDecoder, r as ServerConsumerModuleMap, t as ClientReference } from "../../../ReactFlightClientConfig-C_nD8rsi.mjs";
2
2
 
3
3
  //#region src/runtime/vendor/react-flight-client/ReactFlightClient.d.ts
4
4
  interface Thenable<T> extends Promise<T> {
@@ -1,2 +1,2 @@
1
- import { a as createStringDecoder, c as readPartialStringChunk, i as StringDecoder, l as requireModule, n as ClientReferenceMetadata, o as preloadModule, r as ServerConsumerModuleMap, s as readFinalStringChunk, t as ClientReference, u as resolveClientReference } from "../../../ReactFlightClientConfig-DdCyeIZx.mjs";
1
+ import { a as createStringDecoder, c as readPartialStringChunk, i as StringDecoder, l as requireModule, n as ClientReferenceMetadata, o as preloadModule, r as ServerConsumerModuleMap, s as readFinalStringChunk, t as ClientReference, u as resolveClientReference } from "../../../ReactFlightClientConfig-C_nD8rsi.mjs";
2
2
  export { ClientReference, ClientReferenceMetadata, ServerConsumerModuleMap, StringDecoder, createStringDecoder, preloadModule, readFinalStringChunk, readPartialStringChunk, requireModule, resolveClientReference };
@@ -1 +1 @@
1
- function e(){return globalThis}function t(e){return{specifier:e.id,name:e.name||`default`}}function n(t){let n=e()[`~clientComponents`];if(!n)return null;let r=`${t.specifier}#${t.name}`,i=r.replace(/\\/g,`/`),a=t.specifier.replace(/\\/g,`/`),o=n[i]||n[r]||(t.name===`default`?n[a]||n[t.specifier]:void 0);return!o||o.component?null:o.loadPromise?o.loadPromise:o.loader?(o.loading=!0,o.loadPromise=o.loader().then(e=>(o.component=e,o.registered=!0,o.loading=!1,e)).catch(e=>{throw o.loading=!1,o.loadPromise=void 0,e}),o.loadPromise):null}function r(t){let n=e()[`~clientComponents`];if(!n)throw Error(`[rari] Client components registry not found`);let r=`${t.specifier}#${t.name}`,i=r.replace(/\\/g,`/`),a=t.specifier.replace(/\\/g,`/`),o=n[i]||n[r]||(t.name===`default`?n[a]||n[t.specifier]:void 0);if(!o)throw Error(`[rari] Component not registered: ${r}`);if(o.component){let e=o.component;return t.name===`default`?e.default??e:e[t.name]===void 0?e.default?.[t.name]===void 0?e:e.default[t.name]:e[t.name]}throw o.loadPromise?o.loadPromise:o.loader?(o.loading=!0,o.loadPromise=o.loader().then(e=>(o.component=e,o.registered=!0,o.loading=!1,e)).catch(e=>{throw o.loading=!1,o.loadPromise=void 0,e}),o.loadPromise):Error(`[rari] Module not found: ${r}`)}function i(e,t){return e.decode(t,{stream:!0})}function a(e,t){return e.decode(t)}function o(){return new TextDecoder}export{o as createStringDecoder,n as preloadModule,a as readFinalStringChunk,i as readPartialStringChunk,r as requireModule,t as resolveClientReference};
1
+ function e(){return globalThis}function t(e){return{specifier:e.id,name:e.name||`default`}}function n(t){let n=e()[`~clientComponents`];if(!n)return null;let r=`${t.specifier}#${t.name}`,i=r.replace(/\\/g,`/`),a=t.specifier.replace(/\\/g,`/`),o=n[i]||n[r]||(t.name==="default"?n[a]||n[t.specifier]:void 0);return!o||o.component?null:o.loadPromise?o.loadPromise:o.loader?(o.loading=!0,o.loadPromise=o.loader().then(e=>(o.component=e,o.registered=!0,o.loading=!1,e)).catch(e=>{throw o.loading=!1,o.loadPromise=void 0,e}),o.loadPromise):null}function r(t){let n=e()[`~clientComponents`];if(!n)throw Error(`[rari] Client components registry not found`);let r=`${t.specifier}#${t.name}`,i=r.replace(/\\/g,`/`),a=t.specifier.replace(/\\/g,`/`),o=n[i]||n[r]||(t.name==="default"?n[a]||n[t.specifier]:void 0);if(!o)throw Error(`[rari] Component not registered: ${r}`);if(o.component){let e=o.component;return t.name==="default"?e.default??e:e[t.name]===void 0?e.default?.[t.name]===void 0?e:e.default[t.name]:e[t.name]}throw o.loadPromise?o.loadPromise:o.loader?(o.loading=!0,o.loadPromise=o.loader().then(e=>(o.component=e,o.registered=!0,o.loading=!1,e)).catch(e=>{throw o.loading=!1,o.loadPromise=void 0,e}),o.loadPromise):Error(`[rari] Module not found: ${r}`)}function i(e,t){return e.decode(t,{stream:!0})}function a(e,t){return e.decode(t)}function o(){return new TextDecoder}export{o as createStringDecoder,n as preloadModule,a as readFinalStringChunk,i as readPartialStringChunk,r as requireModule,t as resolveClientReference};
@@ -1,4 +1,4 @@
1
- import{A as e,D as t,E as n,O as r,k as i}from"./regex-constants-CmOAY1_W.mjs";import{t as a}from"./alias-resolver-D1GHg-4o.mjs";import{Buffer as o}from"node:buffer";import{existsSync as s,promises as c}from"node:fs";import l from"node:path";const u=/[^\w-]/g,d=`\0virtual:sitemap`;function f(a){return a.replace(n,`&amp;`).replace(i,`&lt;`).replace(r,`&gt;`).replace(e,`&quot;`).replace(t,`&apos;`)}function p(e){return(typeof e==`string`?new Date(e):e).toISOString()}function m(e){return[` <image:image>`,` <image:loc>${f(e)}</image:loc>`,` </image:image>`].join(`
1
+ import{C as e,S as t,T as n,w as r,x as i}from"./regex-constants-B4P386OY.mjs";import{t as a}from"./alias-resolver-BintHkb_.mjs";import{Buffer as o}from"node:buffer";import{existsSync as s,promises as c}from"node:fs";import l from"node:path";const u=/[^\w-]/g,d=`\0virtual:sitemap`;function f(a){return a.replace(i,`&amp;`).replace(r,`&lt;`).replace(e,`&gt;`).replace(n,`&quot;`).replace(t,`&apos;`)}function p(e){return(typeof e==`string`?new Date(e):e).toISOString()}function m(e){return[` <image:image>`,` <image:loc>${f(e)}</image:loc>`,` </image:image>`].join(`
2
2
  `)}function h(e){let t=[` <image:image>`,` <image:loc>${f(e.loc)}</image:loc>`];return e.title&&t.push(` <image:title>${f(e.title)}</image:title>`),e.caption&&t.push(` <image:caption>${f(e.caption)}</image:caption>`),e.geoLocation&&t.push(` <image:geo_location>${f(e.geoLocation)}</image:geo_location>`),e.license&&t.push(` <image:license>${f(e.license)}</image:license>`),t.push(` </image:image>`),t.join(`
3
3
  `)}function g(e){let t=[];for(let n of e)typeof n==`string`?t.push(m(n)):t.push(h(n));return t.join(`
4
4
  `)}function _(e){let t=[];if(t.push(` <video:video>`),t.push(` <video:title>${f(e.title)}</video:title>`),t.push(` <video:thumbnail_loc>${f(e.thumbnail_loc)}</video:thumbnail_loc>`),t.push(` <video:description>${f(e.description)}</video:description>`),e.content_loc&&t.push(` <video:content_loc>${f(e.content_loc)}</video:content_loc>`),e.player_loc&&t.push(` <video:player_loc>${f(e.player_loc)}</video:player_loc>`),e.duration!==void 0&&t.push(` <video:duration>${e.duration}</video:duration>`),e.expiration_date&&t.push(` <video:expiration_date>${f(e.expiration_date)}</video:expiration_date>`),e.rating!==void 0&&t.push(` <video:rating>${e.rating}</video:rating>`),e.view_count!==void 0&&t.push(` <video:view_count>${e.view_count}</video:view_count>`),e.publication_date&&t.push(` <video:publication_date>${f(e.publication_date)}</video:publication_date>`),e.family_friendly!==void 0&&t.push(` <video:family_friendly>${e.family_friendly?`yes`:`no`}</video:family_friendly>`),e.requires_subscription!==void 0&&t.push(` <video:requires_subscription>${e.requires_subscription?`yes`:`no`}</video:requires_subscription>`),e.live!==void 0&&t.push(` <video:live>${e.live?`yes`:`no`}</video:live>`),e.restriction&&t.push(` <video:restriction relationship="${f(e.restriction.relationship)}">${f(e.restriction.content)}</video:restriction>`),e.platform&&t.push(` <video:platform relationship="${f(e.platform.relationship)}">${f(e.platform.content)}</video:platform>`),e.uploader){let n=e.uploader.info?` info="${f(e.uploader.info)}"`:``;t.push(` <video:uploader${n}>${f(e.uploader.name)}</video:uploader>`)}if(e.tag)for(let n of e.tag)t.push(` <video:tag>${f(n)}</video:tag>`);return t.push(` </video:video>`),t.join(`
@@ -14,6 +14,7 @@ interface AppRouteEntry {
14
14
  params: string[];
15
15
  isDynamic: boolean;
16
16
  metadata?: RouteMetadata;
17
+ staticParams?: Array<Record<string, string | string[]>>;
17
18
  }
18
19
  interface LayoutEntry {
19
20
  path: string;
package/dist/vite.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { C as hasServerSideDataFetching, S as extractStaticParams, _ as clearPropsCache, b as extractServerProps, f as createHttpRuntimeClient, g as StaticParamsResult, h as ServerSidePropsResult, m as MetadataResult, n as ServerCacheControlConfig, r as ServerConfig, s as HttpRuntimeClient, t as ServerCSPConfig, u as RuntimeClient, v as clearPropsCacheForComponent, x as extractServerPropsWithCache, y as extractMetadata } from "./server-config-CGmxgSPb.mjs";
2
- import { a as ErrorProps, c as LayoutEntry, d as Metadata, f as NotFoundEntry, h as RouteSegmentType, i as ErrorEntry, l as LayoutProps, m as RouteSegment, n as AppRouteManifest, o as GenerateMetadata, p as PageProps, r as AppRouteMatch, s as GenerateStaticParams, t as AppRouteEntry, u as LoadingEntry } from "./types-CC9LMWMo.mjs";
3
- import { a as SitemapImage, i as SitemapEntry, n as RobotsRule, o as SitemapVideo, r as Sitemap, t as Robots } from "./metadata-route-D0xSj7FK.mjs";
4
- import { a as ProxyModule, c as RariURL, i as ProxyMatcher, l as RequestCookies, n as ProxyConfig, o as ProxyResult, r as ProxyFunction, s as RariFetchEvent, t as CookieOptions, u as ResponseCookies } from "./types-DOgYNbON.mjs";
1
+ import { C as hasServerSideDataFetching, S as extractStaticParams, _ as clearPropsCache, b as extractServerProps, f as createHttpRuntimeClient, g as StaticParamsResult, h as ServerSidePropsResult, m as MetadataResult, n as ServerCacheControlConfig, r as ServerConfig, s as HttpRuntimeClient, t as ServerCSPConfig, u as RuntimeClient, v as clearPropsCacheForComponent, x as extractServerPropsWithCache, y as extractMetadata } from "./server-config-CwWYmtA0.mjs";
2
+ import { a as ErrorProps, c as LayoutEntry, d as Metadata, f as NotFoundEntry, h as RouteSegmentType, i as ErrorEntry, l as LayoutProps, m as RouteSegment, n as AppRouteManifest, o as GenerateMetadata, p as PageProps, r as AppRouteMatch, s as GenerateStaticParams, t as AppRouteEntry, u as LoadingEntry } from "./types-m74grfbN.mjs";
3
+ import { a as SitemapImage, i as SitemapEntry, n as RobotsRule, o as SitemapVideo, r as Sitemap, t as Robots } from "./metadata-route-85WvBQcW.mjs";
4
+ import { a as ProxyModule, c as RariURL, i as ProxyMatcher, l as RequestCookies, n as ProxyConfig, o as ProxyResult, r as ProxyFunction, s as RariFetchEvent, t as CookieOptions, u as ResponseCookies } from "./types-3dq9RGI5.mjs";
5
5
  import { RariRequest } from "./proxy/RariRequest.mjs";
6
6
  import { RariResponse } from "./proxy/RariResponse.mjs";
7
7
  import { Plugin, UserConfig } from "vite-plus";