@nextclaw/ui 0.12.35-beta.7 → 0.12.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +419 -0
  2. package/dist/assets/{channels-list-page-D-tv11dc.js → channels-list-page-DXH1qYLs.js} +1 -1
  3. package/dist/assets/{chat-page-MyXEZI8R.js → chat-page-Cpo0AFHb.js} +1 -1
  4. package/dist/assets/{desktop-update-config-oZpIKKtS.js → desktop-update-config-Be8x1jNy.js} +1 -1
  5. package/dist/assets/doc-browser-BI7HSaMK.js +3 -0
  6. package/dist/assets/doc-browser-yTfN7UBH.js +1 -0
  7. package/dist/assets/{index-D2H2CKYR.js → index-GVTiCf1s.js} +4 -4
  8. package/dist/assets/{mcp-marketplace-page-CegP14Hl.js → mcp-marketplace-page-DDjeHd1I.js} +1 -1
  9. package/dist/assets/mcp-marketplace-page-WUkc7n94.js +1 -0
  10. package/dist/assets/{model-config-fIE_Asps.js → model-config-BjXMpU9U.js} +1 -1
  11. package/dist/assets/{provider-scoped-model-input-D4zRsGZ6.js → provider-scoped-model-input-t1tCP5y5.js} +1 -1
  12. package/dist/assets/{providers-list-CqsOk2hr.js → providers-list-C1D5p9kK.js} +1 -1
  13. package/dist/assets/remote-BHeENKxL.js +1 -0
  14. package/dist/assets/{runtime-config-page-BJ86cC8a.js → runtime-config-page--O0Wq01S.js} +1 -1
  15. package/dist/assets/{search-config-TbCPlRE7.js → search-config-Dzpizo-_.js} +1 -1
  16. package/dist/assets/{secrets-config-DBIEKP_V.js → secrets-config-D1AUSEXX.js} +1 -1
  17. package/dist/index.html +2 -2
  18. package/package.json +8 -8
  19. package/src/features/panel-apps/managers/panel-app-bridge.manager.test.ts +68 -0
  20. package/src/features/panel-apps/managers/panel-app-bridge.manager.ts +3 -3
  21. package/src/shared/components/doc-browser/doc-browser-panel-parts.tsx +3 -7
  22. package/src/shared/components/doc-browser/doc-browser-renderer.types.ts +1 -0
  23. package/src/shared/components/doc-browser/doc-browser.tsx +4 -4
  24. package/dist/assets/doc-browser-B2OFjScU.js +0 -3
  25. package/dist/assets/doc-browser-BrUQEZ1j.js +0 -1
  26. package/dist/assets/mcp-marketplace-page-MjpFEEkY.js +0 -1
  27. package/dist/assets/remote-BMWQUPDW.js +0 -1
@@ -17,16 +17,14 @@ type DocBrowserDocsToolbarProps = {
17
17
  };
18
18
 
19
19
  type DocBrowserFrameContentProps = {
20
- activeTabId: string;
21
20
  currentTab?: DocBrowserTab;
22
21
  currentUrl: string;
23
22
  customContent: ReactNode;
24
23
  iframeRef: Ref<HTMLIFrameElement>;
25
- iframeReloadVersion: number;
24
+ iframeInstanceId: string;
26
25
  iframeSandbox: string;
27
26
  isDragging: boolean;
28
27
  isResizing: boolean;
29
- navVersion: number;
30
28
  };
31
29
 
32
30
  export function DocBrowserDocsToolbar({
@@ -56,16 +54,14 @@ export function DocBrowserDocsToolbar({
56
54
  }
57
55
 
58
56
  export function DocBrowserFrameContent({
59
- activeTabId,
60
57
  currentTab,
61
58
  currentUrl,
62
59
  customContent,
63
60
  iframeRef,
64
- iframeReloadVersion,
61
+ iframeInstanceId,
65
62
  iframeSandbox,
66
63
  isDragging,
67
64
  isResizing,
68
- navVersion,
69
65
  }: DocBrowserFrameContentProps) {
70
66
  return (
71
67
  <div className="flex-1 relative overflow-hidden">
@@ -74,7 +70,7 @@ export function DocBrowserFrameContent({
74
70
  ) : (
75
71
  <iframe
76
72
  ref={iframeRef}
77
- key={`${activeTabId}:${navVersion}:${iframeReloadVersion}`}
73
+ key={iframeInstanceId}
78
74
  src={currentUrl}
79
75
  className="absolute inset-0 w-full h-full border-0"
80
76
  title={currentTab?.title || 'NextClaw Docs'}
@@ -11,6 +11,7 @@ export type DocBrowserCustomTabRenderParams = {
11
11
  export type DocBrowserIframeMessageParams = {
12
12
  event: MessageEvent;
13
13
  iframe: HTMLIFrameElement | null;
14
+ iframeInstanceId: string;
14
15
  tab: DocBrowserTab;
15
16
  };
16
17
 
@@ -80,6 +80,7 @@ export function DocBrowser({
80
80
  const iframeRef = useRef<HTMLIFrameElement>(null);
81
81
  const currentUrl = currentTab?.currentUrl ?? DOCS_DEFAULT_BASE_URL;
82
82
  const navVersion = currentTab?.navVersion ?? 0;
83
+ const iframeInstanceId = `${activeTabId}:${navVersion}:${iframeReloadVersion}`;
83
84
  const pendingParentDocsUrlRef = useRef<string | null>(null);
84
85
  const prevNavVersionRef = useRef(navVersion);
85
86
  const isDocsTab = currentTab?.kind === 'docs';
@@ -151,12 +152,13 @@ export function DocBrowser({
151
152
  customRenderer.onIframeMessage?.({
152
153
  event,
153
154
  iframe: iframeRef.current,
155
+ iframeInstanceId,
154
156
  tab: currentTab,
155
157
  });
156
158
  };
157
159
  window.addEventListener('message', handler);
158
160
  return () => window.removeEventListener('message', handler);
159
- }, [currentTab, customRenderer]);
161
+ }, [currentTab, customRenderer, iframeInstanceId]);
160
162
 
161
163
  const startFloatDrag = useCallback((event: React.PointerEvent<HTMLElement>) => {
162
164
  event.preventDefault();
@@ -293,16 +295,14 @@ export function DocBrowser({
293
295
  {customToolbar}
294
296
 
295
297
  <DocBrowserFrameContent
296
- activeTabId={activeTabId}
297
298
  currentTab={currentTab}
298
299
  currentUrl={currentUrl}
299
300
  customContent={customContent}
300
301
  iframeRef={iframeRef}
301
- iframeReloadVersion={iframeReloadVersion}
302
+ iframeInstanceId={iframeInstanceId}
302
303
  iframeSandbox={iframeSandbox}
303
304
  isDragging={floatInteraction?.kind === 'drag'}
304
305
  isResizing={floatInteraction?.kind === 'resize'}
305
- navVersion={navVersion}
306
306
  />
307
307
 
308
308
  <DocBrowserExternalLink currentUrl={currentUrl} isDocsTab={isDocsTab} />
@@ -1,3 +0,0 @@
1
- import{d as e,h as t,i as n,m as r,v as i}from"./react-B2X_ph0a.js";import{t as a}from"./createLucideIcon-Br1EFMEr.js";import{n as o,t as s}from"./search-CdhgFNwf.js";import{t as c}from"./book-open-cPX0Za7Z.js";import{n as l,t as u}from"./wrench-qVIwShTF.js";import{t as d}from"./external-link-C3usm3se.js";import{t as f}from"./plus-BcIC8dG1.js";import{t as p}from"./x-Chb07O-Y.js";import{a as m,i as h,l as g,o as _,u as v}from"./doc-browser-route-registry.utils-x5ijvk0u.js";import{n as ee}from"./doc-browser-context-DB6TTHeE.js";var y=`modulepreload`,b=function(e){return`/`+e},x={},S=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=b(t,n),t in x)return;x[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:y,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},C=i(t(),1),w=`popstate`;function T(e={}){let{initialEntries:t=[`/`],initialIndex:n,v5Compat:r=!1}=e,i;i=t.map((e,t)=>u(e,typeof e==`string`?null:e.state,t===0?`default`:void 0));let a=c(n??i.length-1),o=`POP`,s=null;function c(e){return Math.min(Math.max(e,0),i.length-1)}function l(){return i[a]}function u(e,t=null,n){let r=k(i?l().pathname:`/`,e,t,n);return D(r.pathname.charAt(0)===`/`,`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),r}function d(e){return typeof e==`string`?e:A(e)}return{get index(){return a},get action(){return o},get location(){return l()},createHref:d,createURL(e){return new URL(d(e),`http://localhost`)},encodeLocation(e){let t=typeof e==`string`?j(e):e;return{pathname:t.pathname||``,search:t.search||``,hash:t.hash||``}},push(e,t){o=`PUSH`;let n=u(e,t);a+=1,i.splice(a,i.length,n),r&&s&&s({action:o,location:n,delta:1})},replace(e,t){o=`REPLACE`;let n=u(e,t);i[a]=n,r&&s&&s({action:o,location:n,delta:0})},go(e){o=`POP`;let t=c(a+e),n=i[t];a=t,s&&s({action:o,location:n,delta:e})},listen(e){return s=e,()=>{s=null}}}}function te(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return k(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:A(t)}return M(t,n,null,e)}function E(e,t){if(e===!1||e==null)throw Error(t)}function D(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ne(){return Math.random().toString(36).substring(2,10)}function O(e,t){return{usr:e.state,key:e.key,idx:t}}function k(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?j(t):t,state:n,key:t&&t.key||r||ne()}}function A({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function j(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function M(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=k(h.location,e,t);n&&n(r,e),l=u()+1;let d=O(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=k(h.location,e,t);n&&n(r,e),l=u();let i=O(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return N(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(w,d),c=e,()=>{i.removeEventListener(w,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function N(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),E(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:A(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function re(e,t,n=`/`){return P(e,t,n,!1)}function P(e,t,n,r){let i=B((typeof t==`string`?j(t):t).pathname||`/`,n);if(i==null)return null;let a=ae(e);F(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=he(i);o=pe(a[e],t,r)}return o}function ie(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ae(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;E(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=V([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(E(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ae(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:de(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of oe(e.path))a(e,t,!0,n)}),t}function oe(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=oe(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function F(e){e.sort((e,t)=>e.score===t.score?fe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var se=/^:[\w-]+$/,I=3,ce=2,le=1,ue=10,L=-2,R=e=>e===`*`;function de(e,t){let n=e.split(`/`),r=n.length;return n.some(R)&&(r+=L),t&&(r+=ce),n.filter(e=>!R(e)).reduce((e,t)=>e+(se.test(t)?I:t===``?le:ue),r)}function fe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function pe(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:V([a,u.pathname]),pathnameBase:Ce(V([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=V([a,u.pathnameBase]))}return o}function z(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=me(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function me(e,t=!1,n=!0){D(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 r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function he(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return D(!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 (${t}).`),e}}function B(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var ge=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function _e(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?j(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?ve(n.substring(1),`/`):ve(n,t)):a=t,{pathname:a,search:we(r),hash:Te(i)}}function ve(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ye(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function be(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function xe(e){let t=be(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Se(e,t,n,r=!1){let i;typeof e==`string`?i=j(e):(i={...e},E(!i.pathname||!i.pathname.includes(`?`),ye(`?`,`pathname`,`search`,i)),E(!i.pathname||!i.pathname.includes(`#`),ye(`#`,`pathname`,`hash`,i)),E(!i.search||!i.search.includes(`#`),ye(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=_e(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var V=e=>e.join(`/`).replace(/\/\/+/g,`/`),Ce=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),we=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Te=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ee=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function De(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Oe(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var ke=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ae(e,t){let n=e;if(typeof n!=`string`||!ge.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ke)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=B(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{D(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var je=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(je);var Me=[`GET`,...je];new Set(Me);var H=C.createContext(null);H.displayName=`DataRouter`;var U=C.createContext(null);U.displayName=`DataRouterState`;var Ne=C.createContext(!1),Pe=C.createContext({isTransitioning:!1});Pe.displayName=`ViewTransition`;var Fe=C.createContext(new Map);Fe.displayName=`Fetchers`;var Ie=C.createContext(null);Ie.displayName=`Await`;var W=C.createContext(null);W.displayName=`Navigation`;var G=C.createContext(null);G.displayName=`Location`;var K=C.createContext({outlet:null,matches:[],isDataRoute:!1});K.displayName=`Route`;var Le=C.createContext(null);Le.displayName=`RouteError`;var Re=`REACT_ROUTER_ERROR`,ze=`REDIRECT`,Be=`ROUTE_ERROR_RESPONSE`;function Ve(e){if(e.startsWith(`${Re}:${ze}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function He(e){if(e.startsWith(`${Re}:${Be}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ee(t.status,t.statusText,t.data)}catch{}}function Ue(e,{relative:t}={}){E(q(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=C.useContext(W),{hash:i,pathname:a,search:o}=Y(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:V([n,a])),r.createHref({pathname:s,search:o,hash:i})}function q(){return C.useContext(G)!=null}function J(){return E(q(),`useLocation() may be used only in the context of a <Router> component.`),C.useContext(G).location}var We=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ge(e){C.useContext(W).static||C.useLayoutEffect(e)}function Ke(){let{isDataRoute:e}=C.useContext(K);return e?pt():qe()}function qe(){E(q(),`useNavigate() may be used only in the context of a <Router> component.`);let e=C.useContext(H),{basename:t,navigator:n}=C.useContext(W),{matches:r}=C.useContext(K),{pathname:i}=J(),a=JSON.stringify(xe(r)),o=C.useRef(!1);return Ge(()=>{o.current=!0}),C.useCallback((r,s={})=>{if(D(o.current,We),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Se(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:V([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}C.createContext(null);function Je(){let{matches:e}=C.useContext(K),t=e[e.length-1];return t?t.params:{}}function Y(e,{relative:t}={}){let{matches:n}=C.useContext(K),{pathname:r}=J(),i=JSON.stringify(xe(n));return C.useMemo(()=>Se(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ye(e,t){return Xe(e,t)}function Xe(e,t,n,r,i){E(q(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=C.useContext(W),{matches:o}=C.useContext(K),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:`/`,u=s?s.pathnameBase:`/`,d=s&&s.route;{let e=d&&d.path||``;ht(l,!d||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${e}">) 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.
2
-
3
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let f=J(),p;if(t){let e=typeof t==`string`?j(t):t;E(u===`/`||e.pathname?.startsWith(u),`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 "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),p=e}else p=f;let m=p.pathname||`/`,h=m;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);h=`/`+m.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let g=re(e,{pathname:h});D(d||g!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),D(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.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 _=rt(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:V([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:V([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&_?C.createElement(G.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...p},navigationType:`POP`}},_):_}function Ze(){let e=ft(),t=De(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=C.createElement(C.Fragment,null,C.createElement(`p`,null,`💿 Hey developer 👋`),C.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,C.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,C.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),C.createElement(C.Fragment,null,C.createElement(`h2`,null,`Unexpected Application Error!`),C.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?C.createElement(`pre`,{style:i},n):null,o)}var Qe=C.createElement(Ze,null),$e=class extends C.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,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):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`){let t=He(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:C.createElement(K.Provider,{value:this.props.routeContext},C.createElement(Le.Provider,{value:e,children:this.props.component}));return this.context?C.createElement(tt,{error:e},t):t}};$e.contextType=Ne;var et=new WeakMap;function tt({children:e,error:t}){let{basename:n}=C.useContext(W);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ve(t.digest);if(e){let r=et.get(t);if(r)throw r;let i=Ae(e.location,n);if(ke&&!et.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw et.set(t,n),n}return C.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function nt({routeContext:e,match:t,children:n}){let r=C.useContext(H);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),C.createElement(K.Provider,{value:e},n)}function rt(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);E(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}let l=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Oe(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let u,d=!1,f=null,p=null;n&&(u=o&&r.route.id?o[r.route.id]:void 0,f=r.route.errorElement||Qe,s&&(c<0&&i===0?(ht(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):c===i&&(d=!0,p=r.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,i+1)),h=()=>{let t;return t=u?f:d?p:r.route.Component?C.createElement(r.route.Component,null):r.route.element?r.route.element:e,C.createElement(nt,{match:r,routeContext:{outlet:e,matches:m,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?C.createElement($e,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function it(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function at(e){let t=C.useContext(H);return E(t,it(e)),t}function ot(e){let t=C.useContext(U);return E(t,it(e)),t}function st(e){let t=C.useContext(K);return E(t,it(e)),t}function ct(e){let t=st(e),n=t.matches[t.matches.length-1];return E(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function lt(){return ct(`useRouteId`)}function ut(){return ot(`useNavigation`).navigation}function dt(){let{matches:e,loaderData:t}=ot(`useMatches`);return C.useMemo(()=>e.map(e=>ie(e,t)),[e,t])}function ft(){let e=C.useContext(Le),t=ot(`useRouteError`),n=ct(`useRouteError`);return e===void 0?t.errors?.[n]:e}function pt(){let{router:e}=at(`useNavigate`),t=ct(`useNavigate`),n=C.useRef(!1);return Ge(()=>{n.current=!0}),C.useCallback(async(r,i={})=>{D(n.current,We),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var mt={};function ht(e,t,n){!t&&!mt[e]&&(mt[e]=!0,D(!1,n))}C.useOptimistic,C.memo(gt);function gt({routes:e,future:t,state:n,onError:r}){return Xe(e,void 0,n,r,t)}function _t({basename:e,children:t,initialEntries:n,initialIndex:r,unstable_useTransitions:i}){let a=C.useRef();a.current??=T({initialEntries:n,initialIndex:r,v5Compat:!0});let o=a.current,[s,c]=C.useState({action:o.action,location:o.location}),l=C.useCallback(e=>{i===!1?c(e):C.startTransition(()=>c(e))},[i]);return C.useLayoutEffect(()=>o.listen(l),[o,l]),C.createElement(bt,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,unstable_useTransitions:i})}function vt({to:e,replace:t,state:n,relative:r}){E(q(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=C.useContext(W);D(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=C.useContext(K),{pathname:o}=J(),s=Ke(),c=Se(e,xe(a),o,r===`path`),l=JSON.stringify(c);return C.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function yt(e){E(!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 bt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){E(!q(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=C.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=j(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`}=n,m=C.useMemo(()=>{let e=B(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p},navigationType:r}},[s,l,u,d,f,p,r]);return D(m!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:C.createElement(W.Provider,{value:c},C.createElement(G.Provider,{children:t,value:m}))}function xt({children:e,location:t}){return Ye(St(e),t)}C.Component;function St(e,t=[]){let n=[];return C.Children.forEach(e,(e,r)=>{if(!C.isValidElement(e))return;let i=[...t,r];if(e.type===C.Fragment){n.push.apply(n,St(e.props.children,i));return}E(e.type===yt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),E(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=St(e.props.children,i)),n.push(a)}),n}var Ct=`get`,wt=`application/x-www-form-urlencoded`;function Tt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Et(e){return Tt(e)&&e.tagName.toLowerCase()===`button`}function Dt(e){return Tt(e)&&e.tagName.toLowerCase()===`form`}function Ot(e){return Tt(e)&&e.tagName.toLowerCase()===`input`}function kt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function At(e,t){return e.button===0&&(!t||t===`_self`)&&!kt(e)}var jt=null;function Mt(){if(jt===null)try{new FormData(document.createElement(`form`),0),jt=!1}catch{jt=!0}return jt}var Nt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Pt(e){return e!=null&&!Nt.has(e)?(D(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wt}"`),null):e}function Ft(e,t){let n,r,i,a,o;if(Dt(e)){let o=e.getAttribute(`action`);r=o?B(o,t):null,n=e.getAttribute(`method`)||Ct,i=Pt(e.getAttribute(`enctype`))||wt,a=new FormData(e)}else if(Et(e)||Ot(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?B(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Ct,i=Pt(e.getAttribute(`formenctype`))||Pt(o.getAttribute(`enctype`))||wt,a=new FormData(o,e),!Mt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Tt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Ct,r=null,i=wt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var It={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Lt=/[&><\u2028\u2029]/g;function Rt(e){return e.replace(Lt,e=>It[e])}function zt(e,t){if(e===!1||e==null)throw Error(t)}function Bt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&B(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function Vt(e,t){if(e.id in t)return t[e.id];try{let n=await S(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ht(e){return e!=null&&typeof e.page==`string`}function Ut(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 Wt(e,t,n){return Yt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Vt(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ut).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Gt(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Kt(e,t,{includeHydrateFallback:n}={}){return qt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function qt(e){return[...new Set(e)]}function Jt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Yt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Ht(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Jt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Xt(){let e=C.useContext(H);return zt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Zt(){let e=C.useContext(U);return zt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Qt=C.createContext(void 0);Qt.displayName=`FrameworkContext`;function $t(){let e=C.useContext(Qt);return zt(e,`You must render this element inside a <HydratedRouter> element`),e}function en(e,t){let n=C.useContext(Qt),[r,i]=C.useState(!1),[a,o]=C.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=C.useRef(null);C.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),C.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:X(s,p),onBlur:X(c,m),onMouseEnter:X(l,p),onMouseLeave:X(u,m),onTouchStart:X(d,p)}]:[a,f,{}]:[!1,f,{}]}function X(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function tn({page:e,...t}){let{router:n}=Xt(),r=C.useMemo(()=>re(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?C.createElement(rn,{page:e,matches:r,...t}):null}function nn(e){let{manifest:t,routeModules:n}=$t(),[r,i]=C.useState([]);return C.useEffect(()=>{let r=!1;return Wt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function rn({page:e,matches:t,...n}){let r=J(),{future:i,manifest:a,routeModules:o}=$t(),{basename:s}=Xt(),{loaderData:c,matches:l}=Zt(),u=C.useMemo(()=>Gt(e,t,l,a,r,`data`),[e,t,l,a,r]),d=C.useMemo(()=>Gt(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=C.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Bt(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=C.useMemo(()=>Kt(d,a),[d,a]),m=nn(d);return C.createElement(C.Fragment,null,f.map(e=>C.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>C.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>C.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function an(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}C.Component;var on=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{on&&(window.__reactRouterVersion=`7.13.0`)}catch{}function sn({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=C.useRef();i.current??=te({window:r,v5Compat:!0});let a=i.current,[o,s]=C.useState({action:a.action,location:a.location}),c=C.useCallback(e=>{n===!1?s(e):C.startTransition(()=>s(e))},[n]);return C.useLayoutEffect(()=>a.listen(c),[a,c]),C.createElement(bt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function cn({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=C.useState({action:n.action,location:n.location}),o=C.useCallback(e=>{r===!1?a(e):C.startTransition(()=>a(e))},[r]);return C.useLayoutEffect(()=>n.listen(o),[n,o]),C.createElement(bt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}cn.displayName=`unstable_HistoryRouter`;var ln=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,un=C.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u,unstable_defaultShouldRevalidate:d,...f},p){let{basename:m,unstable_useTransitions:h}=C.useContext(W),g=typeof c==`string`&&ln.test(c),_=Ae(c,m);c=_.to;let v=Ue(c,{relative:r}),[ee,y,b]=en(n,f),x=_n(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:h});function S(t){e&&e(t),t.defaultPrevented||x(t)}let w=C.createElement(`a`,{...f,...b,href:_.absoluteURL||v,onClick:_.isExternal||i?e:S,ref:an(p,y),target:s,"data-discover":!g&&t===`render`?`true`:void 0});return ee&&!g?C.createElement(C.Fragment,null,w,C.createElement(tn,{page:v})):w});un.displayName=`Link`;var dn=C.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Y(a,{relative:c.relative}),d=J(),f=C.useContext(U),{navigator:p,basename:m}=C.useContext(W),h=f!=null&&Dn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=B(v,m)||v);let ee=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,y=_===g||!r&&_.startsWith(g)&&_.charAt(ee)===`/`,b=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),x={isActive:y,isPending:b,isTransitioning:h},S=y?e:void 0,w;w=typeof n==`function`?n(x):[n,y?`active`:null,b?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(x):i;return C.createElement(un,{...c,"aria-current":S,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(x):s)});dn.displayName=`NavLink`;var fn=C.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Ct,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=C.useContext(W),g=bn(),_=xn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,ee=typeof s==`string`&&ln.test(s);return C.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?C.startTransition(()=>p()):p()},...p,"data-discover":!ee&&e===`render`?`true`:void 0})});fn.displayName=`Form`;function pn({getKey:e,storageKey:t,...n}){let r=C.useContext(Qt),{basename:i}=C.useContext(W),a=J(),o=dt();Tn({getKey:e,storageKey:t});let s=C.useMemo(()=>{if(!r||!e)return null;let t=wn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return C.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Rt(JSON.stringify(t||Sn))}, ${Rt(JSON.stringify(s))})`}})}pn.displayName=`ScrollRestoration`;function mn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hn(e){let t=C.useContext(H);return E(t,mn(e)),t}function gn(e){let t=C.useContext(U);return E(t,mn(e)),t}function _n(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s,unstable_useTransitions:c}={}){let l=Ke(),u=J(),d=Y(e,{relative:a});return C.useCallback(f=>{if(At(f,t)){f.preventDefault();let t=n===void 0?A(u)===A(d):n,p=()=>l(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s});c?C.startTransition(()=>p()):p()}},[u,l,d,n,r,t,e,i,a,o,s,c])}var vn=0,yn=()=>`__${String(++vn)}__`;function bn(){let{router:e}=hn(`useSubmit`),{basename:t}=C.useContext(W),n=lt(),r=e.fetch,i=e.navigate;return C.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ft(e,t);a.navigate===!1?await r(a.fetcherKey||yn(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function xn(e,{relative:t}={}){let{basename:n}=C.useContext(W),r=C.useContext(K);E(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Y(e||`.`,{relative:t})},o=J();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:V([n,a.pathname])),A(a)}var Sn=`react-router-scroll-positions`,Cn={};function wn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:B(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Tn({getKey:e,storageKey:t}={}){let{router:n}=hn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=gn(`useScrollRestoration`),{basename:a}=C.useContext(W),o=J(),s=dt(),c=ut();C.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),En(C.useCallback(()=>{if(c.state===`idle`){let t=wn(o,s,a,e);Cn[t]=window.scrollY}try{sessionStorage.setItem(t||Sn,JSON.stringify(Cn))}catch(e){D(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(C.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Sn);e&&(Cn=JSON.parse(e))}catch{}},[t]),C.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Cn,()=>window.scrollY,e?(t,n)=>wn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),C.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{D(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function En(e,t){let{capture:n}=t||{};C.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Dn(e,{relative:t}={}){let n=C.useContext(Pe);E(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=hn(`useViewTransitionState`),i=Y(e,{relative:t});if(!n.isTransitioning)return!1;let a=B(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=B(n.nextLocation.pathname,r)||n.nextLocation.pathname;return z(i.pathname,o)!=null||z(i.pathname,a)!=null}var On=a(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),kn=a(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),An=a(`Grid3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),jn=a(`GripVertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Mn=a(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Nn=a(`PanelRightOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Z=r(),Pn={apps:{accentClassName:`bg-emerald-50 text-emerald-700 border-emerald-100`,icon:(0,Z.jsx)(l,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700 border-sky-100`,icon:(0,Z.jsx)(An,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700 border-amber-100`,icon:(0,Z.jsx)(c,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700 border-rose-100`,icon:(0,Z.jsx)(kn,{className:`h-5 w-5`})},"mcp-marketplace":{accentClassName:`bg-indigo-50 text-indigo-700 border-indigo-100`,icon:(0,Z.jsx)(u,{className:`h-5 w-5`})}};function Fn(e){return Pn[e.id]??{accentClassName:`bg-gray-50 text-gray-700 border-gray-100`,icon:(0,Z.jsx)(l,{className:`h-5 w-5`})}}function In({open:t}){let n=Ke(),r=h.getHomeNavigationItems(),i=e=>{if(e.type===`app-route`){n(e.path);return}t(e.url,e.options)};return(0,Z.jsx)(`div`,{className:`h-full overflow-auto bg-[#fbfaf7] px-5 py-6`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[640px]`,children:(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(88px,1fr))] gap-x-3 gap-y-5`,children:r.map(t=>{let n=Fn(t);return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(t.target),className:`group flex min-h-[82px] flex-col items-center gap-2 rounded-lg px-2 py-2 text-center transition-colors hover:bg-white/80`,children:[(0,Z.jsx)(`span`,{className:e(`flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl border shadow-[0_1px_2px_rgba(30,20,10,0.04)] transition-transform group-hover:scale-[1.03]`,n.accentClassName),children:n.icon}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-full`,children:(0,Z.jsx)(`span`,{className:`line-clamp-2 block text-xs font-medium leading-snug text-gray-800`,children:t.label})})]},t.id)})})})})}function Ln({isDocsTab:e,onSubmit:t,onUrlInputChange:r,urlInput:i}){return e?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0`,children:(0,Z.jsxs)(`form`,{onSubmit:t,className:`flex-1 relative`,children:[(0,Z.jsx)(s,{className:`w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400`}),(0,Z.jsx)(`input`,{type:`text`,value:i,onChange:e=>r(e.target.value),placeholder:n(`docBrowserSearchPlaceholder`),className:`w-full h-8 pl-8 pr-3 rounded-lg bg-gray-50 border border-gray-200 text-xs text-gray-700 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors placeholder:text-gray-400`})]})}):null}function Rn({activeTabId:e,currentTab:t,currentUrl:n,customContent:r,iframeRef:i,iframeReloadVersion:a,iframeSandbox:o,isDragging:s,isResizing:c,navVersion:l}){return(0,Z.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[r||(0,Z.jsx)(`iframe`,{ref:i,src:n,className:`absolute inset-0 w-full h-full border-0`,title:t?.title||`NextClaw Docs`,sandbox:o,allow:`clipboard-read; clipboard-write`},`${e}:${l}:${a}`),(c||s)&&(0,Z.jsx)(`div`,{className:`absolute inset-0 z-10`})]})}function zn({currentUrl:e,isDocsTab:t}){return!t||!g(e)?null:(0,Z.jsx)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0`,children:(0,Z.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"data-doc-external":!0,className:`flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover font-medium transition-colors`,children:[n(`docBrowserOpenExternal`),(0,Z.jsx)(d,{className:`w-3 h-3`})]})})}function Bn({tabs:t,activeTabId:r,canGoBack:i,canGoForward:a,isDocked:s,isFullscreen:c,onGoBack:l,onGoForward:u,onOpenNewTab:d,onSetActiveTab:m,onCloseTab:h,onClose:g,onDragStart:_,onToggleMode:v}){return(0,Z.jsxs)(`div`,{"data-testid":`doc-browser-tab-strip`,className:e(`flex h-11 items-stretch gap-2 px-2.5 bg-background border-b border-[#f1e7d4] shrink-0 select-none`,c&&`h-[calc(env(safe-area-inset-top,0px)+2.75rem)] pt-[env(safe-area-inset-top,0px)]`),onPointerDown:!s&&!c?_:void 0,children:[(0,Z.jsx)(`div`,{className:`doc-browser-tab-scrollbar flex h-full min-w-0 flex-1 items-center gap-1.5 overflow-x-auto`,onPointerDown:e=>e.stopPropagation(),children:t.map(t=>(0,Z.jsxs)(`div`,{className:e(`inline-flex items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors`,t.id===r?`bg-amber-50/80 border-amber-200 text-amber-900 shadow-[0_1px_2px_rgba(30,20,10,0.04)]`:`bg-[#f9f8f5] border-[#eee3d1] text-[#78644d] hover:bg-[#fff7ea] hover:text-[#2f2212]`),children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>m(t.id),className:`truncate text-left px-1`,title:t.title,children:t.title||n(`docBrowserTabUntitled`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(t.id)},className:`rounded p-0.5 hover:bg-black/10`,"aria-label":n(`docBrowserCloseTab`),children:(0,Z.jsx)(p,{className:`w-3 h-3`})})]},t.id))}),(0,Z.jsxs)(`div`,{className:`flex h-full items-center gap-1 shrink-0`,"data-testid":`doc-browser-tab-actions`,onPointerDown:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{type:`button`,onClick:l,disabled:!i,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent disabled:hover:text-gray-300`,title:n(`docBrowserBack`),children:(0,Z.jsx)(o,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:u,disabled:!a,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent disabled:hover:text-gray-300`,title:n(`docBrowserForward`),children:(0,Z.jsx)(On,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:d,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(`docBrowserNewTab`),children:(0,Z.jsx)(f,{className:`w-3.5 h-3.5`})}),c?null:(0,Z.jsx)(`button`,{type:`button`,onClick:v,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(s?`docBrowserFloatMode`:`docBrowserDockMode`),children:s?(0,Z.jsx)(Mn,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(Nn,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:g,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(`docBrowserClose`),children:(0,Z.jsx)(p,{className:`w-3.5 h-3.5`})})]})]})}function Vn({children:t,className:n,style:r,defaultWidth:i=420,minWidth:a=320,maxWidth:o=860,overlay:s=!1,...c}){let l=(0,C.useRef)(null),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(i),m=e=>{if(s)return;e.preventDefault(),e.stopPropagation(),d(!0),l.current={startX:e.clientX,startWidth:f};let t=e=>{let t=l.current;if(!t)return;let n=t.startWidth+t.startX-e.clientX;p(Math.max(a,Math.min(o,n)))},n=()=>{d(!1),l.current=null,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)};return(0,Z.jsxs)(`aside`,{...c,className:e(`relative flex h-full min-h-0 shrink-0 overflow-hidden bg-white`,s?`fixed inset-0 z-40`:`border-l border-gray-200`,n),style:s?r:{...r,width:f},children:[s?null:(0,Z.jsx)(`div`,{className:`absolute left-0 top-0 z-20 h-full w-1.5 cursor-ew-resize transition-colors hover:bg-primary/10`,"data-testid":`resizable-right-panel-handle`,onMouseDown:m}),(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 w-full flex-col overflow-hidden`,children:t}),u?(0,Z.jsx)(`div`,{className:`absolute inset-0 z-10`}):null]})}var Q=40,Hn=360,Un=400;function $(e,t,n){return Math.min(n,Math.max(t,e))}function Wn(){return{x:Math.max(Q,window.innerWidth-520),y:80,w:480,h:600}}function Gn({customTabRenderers:t={},displayMode:n=`desktop`}){let{isOpen:r,mode:i,tabs:a,activeTabId:o,activeHistory:s,activeHistoryIndex:c,currentTab:l,open:u,openNewTab:d,close:f,toggleMode:p,goBack:h,goForward:g,navigate:y,syncUrl:b,setActiveTab:x,closeTab:S}=ee(),[w,T]=(0,C.useState)(``),[te,E]=(0,C.useState)(0),[D,ne]=(0,C.useState)(Wn),[O,k]=(0,C.useState)(null),A=(0,C.useRef)(null),j=l?.currentUrl??m,M=l?.navVersion??0,N=(0,C.useRef)(null),re=(0,C.useRef)(M),P=l?.kind===`docs`,ie=l?.kind===_,ae=c>0,oe=c<s.length-1,F=l?t[l.kind]:void 0;(0,C.useEffect)(()=>{if(!P){T(``);return}try{T(new URL(j).pathname)}catch{T(j)}},[j,o,P]),(0,C.useEffect)(()=>{if(!P){N.current=null;return}if(M!==re.current){re.current=M,N.current=v(j);return}if(A.current?.contentWindow)try{let e=new URL(j).pathname;N.current=v(j),A.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}},[j,M,P]),(0,C.useEffect)(()=>{let e=e=>{if(P&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`){let t=v(e.data.url);if(N.current&&t!==N.current)return;N.current=null,b(e.data.url)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[j,b,P]),(0,C.useEffect)(()=>{if(!l||!F?.onIframeMessage)return;let e=e=>{F.onIframeMessage?.({event:e,iframe:A.current,tab:l})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[l,F]);let se=(0,C.useCallback)(e=>{e.preventDefault(),k({kind:`drag`,startX:e.clientX,startY:e.clientY,startRect:D})},[D]),I=(0,C.useCallback)(e=>t=>{t.preventDefault(),t.stopPropagation(),k({kind:`resize`,edge:e,startX:t.clientX,startY:t.clientY,startRect:D})},[D]);(0,C.useEffect)(()=>{if(!O)return;let e=e=>{let{startRect:t,startX:n,startY:r}=O,i=e.clientX-n,a=e.clientY-r;if(O.kind===`drag`){ne({...t,x:$(t.x+i,Q,window.innerWidth-Q-t.w),y:$(t.y+a,Q,window.innerHeight-Q-t.h)});return}if(O.edge===`left`||O.edge===`top`){let e=O.edge===`left`,n=e?t.x+t.w:t.y+t.h,r=$(e?t.x+i:t.y+a,Q,n-(e?Hn:Un));ne(e?{...t,x:r,w:n-r}:{...t,y:r,h:n-r});return}let o=$(t.x+t.w+i,t.x+Hn,window.innerWidth-Q),s=$(t.y+t.h+a,t.y+Un,window.innerHeight-Q);ne({...t,w:O.edge===`bottom`?t.w:o-t.x,h:O.edge===`right`?t.h:s-t.y})},t=()=>k(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[O]);let ce=(0,C.useCallback)(e=>{if(e.preventDefault(),!P)return;let t=w.trim();t&&(t.startsWith(`/`)?y(`${m}${t}`):t.startsWith(`http`)?y(t):y(`${m}/${t}`))},[w,y,P]),le=(0,C.useCallback)(()=>{E(e=>e+1)},[]);if(!r)return null;let ue=i===`docked`,L=n===`fullscreen`,R=l?{currentUrl:j,open:u,refreshIframe:le,tab:l}:void 0,de=R?F?.renderToolbar?.(R):null,fe=R?F?.renderContent?.(R)??(ie?(0,Z.jsx)(In,{open:u}):null):null,pe=l?F?.getIframeSandbox?.(l)??`allow-same-origin allow-scripts allow-popups allow-forms`:`allow-same-origin allow-scripts allow-popups allow-forms`,z=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Bn,{tabs:a,activeTabId:o,canGoBack:ae,canGoForward:oe,isDocked:ue,isFullscreen:L,onGoBack:h,onGoForward:g,onOpenNewTab:d,onSetActiveTab:x,onCloseTab:S,onClose:f,onDragStart:se,onToggleMode:p}),(0,Z.jsx)(Ln,{isDocsTab:P,onSubmit:ce,onUrlInputChange:T,urlInput:w}),de,(0,Z.jsx)(Rn,{activeTabId:o,currentTab:l,currentUrl:j,customContent:fe,iframeRef:A,iframeReloadVersion:te,iframeSandbox:pe,isDragging:O?.kind===`drag`,isResizing:O?.kind===`resize`,navVersion:M}),(0,Z.jsx)(zn,{currentUrl:j,isDocsTab:P})]});return ue&&!L?(0,Z.jsx)(Vn,{"data-testid":`doc-browser-panel`,defaultWidth:420,minWidth:320,maxWidth:860,children:z}):(0,Z.jsxs)(`div`,{"data-testid":`doc-browser-panel`,className:e(`flex flex-col bg-white overflow-hidden relative`,L?`fixed inset-0 z-[9999] h-[100dvh] w-screen rounded-none border-0 shadow-2xl`:`rounded-2xl shadow-2xl border border-gray-200`),style:L?void 0:{position:`fixed`,left:D.x,top:D.y,width:D.w,height:D.h,zIndex:9999},children:[z,!ue&&!L&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`absolute top-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top`,onPointerDown:I(`top`)}),(0,Z.jsx)(`div`,{className:`absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-left`,onPointerDown:I(`left`)}),(0,Z.jsx)(`div`,{className:`absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-right`,onPointerDown:I(`right`)}),(0,Z.jsx)(`div`,{className:`absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-bottom`,onPointerDown:I(`bottom`)}),(0,Z.jsx)(`div`,{className:`absolute bottom-0 right-0 w-4 h-4 cursor-se-resize z-30 flex items-center justify-center text-gray-300 hover:text-gray-500 transition-colors`,"data-testid":`doc-browser-resize-bottom-right`,onPointerDown:I(`bottom-right`),children:(0,Z.jsx)(jn,{className:`w-3 h-3 rotate-[-45deg]`})})]})]})}export{un as a,vt as c,J as d,Ke as f,sn as i,yt as l,S as m,Vn as n,_t as o,Je as p,kn as r,dn as s,Gn as t,xt as u};
@@ -1 +0,0 @@
1
- import{t as e}from"./doc-browser-B2OFjScU.js";export{e as DocBrowser};
@@ -1 +0,0 @@
1
- import{t as e}from"./mcp-marketplace-page-CegP14Hl.js";export{e as McpMarketplacePage};
@@ -1 +0,0 @@
1
- import{Ut as e}from"./index-D2H2CKYR.js";export{e as RemoteAccessPage};