create-opentray 0.23.0 → 0.24.0

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 (56) hide show
  1. package/assets/create-openspec-template-iOS-Dark-1024@1x.png +0 -0
  2. package/assets/create-openspec-template-iOS-Default-1024@1x.png +0 -0
  3. package/assets/inter-glyph.OFL.txt +93 -0
  4. package/assets/inter-glyph.ttf +0 -0
  5. package/dist/{bin-DDNgskyb.mjs → bin-BQb2Bjcu.mjs} +276 -2764
  6. package/dist/bin-BQb2Bjcu.mjs.map +1 -0
  7. package/dist/bin.mjs +1 -1
  8. package/dist/{decode-ico-D3SL2BXi.mjs → decode-ico-BHd2POHf.mjs} +2 -2
  9. package/dist/{decode-ico-D3SL2BXi.mjs.map → decode-ico-BHd2POHf.mjs.map} +1 -1
  10. package/dist/index.d.mts +17 -2
  11. package/dist/index.d.mts.map +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/{raster-BQ07mKLu.mjs → raster-DeMbA2zI.mjs} +15 -16
  14. package/dist/{raster-BQ07mKLu.mjs.map → raster-DeMbA2zI.mjs.map} +1 -1
  15. package/dist/shell/assets/browse.js +1 -1
  16. package/dist/shell/assets/index.css +1 -1
  17. package/dist/shell/assets/index.js +9 -9
  18. package/dist/shell/assets/input.js +1 -1
  19. package/dist/shell/assets/main.js +19 -19
  20. package/dist/shell/assets/terminal-pane.js +1 -1
  21. package/dist/shell/assets/terminal.js +1 -1
  22. package/dist/shell/browse.html +1 -1
  23. package/dist/shell/index.html +1 -1
  24. package/dist/shell/terminal.html +1 -1
  25. package/dist/webui/assets/browse.js +1 -1
  26. package/dist/webui/assets/index.css +1 -1
  27. package/dist/webui/assets/index.js +9 -9
  28. package/dist/webui/assets/input.js +1 -1
  29. package/dist/webui/assets/main.js +19 -19
  30. package/dist/webui/assets/terminal-pane.js +1 -1
  31. package/dist/webui/assets/terminal.js +1 -1
  32. package/dist/webui/browse.html +1 -1
  33. package/dist/webui/index.html +1 -1
  34. package/dist/webui/terminal.html +1 -1
  35. package/package.json +15 -6
  36. package/dist/avif-DCXcyYJR.mjs +0 -2
  37. package/dist/bin-DDNgskyb.mjs.map +0 -1
  38. package/dist/decode-C4b5NXc_.mjs +0 -1236
  39. package/dist/decode-C4b5NXc_.mjs.map +0 -1
  40. package/dist/decode-Dsj9J0OD.mjs +0 -1214
  41. package/dist/decode-Dsj9J0OD.mjs.map +0 -1
  42. package/dist/decode-FysWS28R.mjs +0 -254
  43. package/dist/decode-FysWS28R.mjs.map +0 -1
  44. package/dist/decode-Xr7mARKr.mjs +0 -1262
  45. package/dist/decode-Xr7mARKr.mjs.map +0 -1
  46. package/dist/full.umd-oM1VUBRH.mjs +0 -3055
  47. package/dist/full.umd-oM1VUBRH.mjs.map +0 -1
  48. package/dist/jpeg-B4tsxG5f.mjs +0 -2
  49. package/dist/png-rD0XEazj.mjs +0 -35
  50. package/dist/png-rD0XEazj.mjs.map +0 -1
  51. package/dist/resize-B47sgoOb.mjs +0 -489
  52. package/dist/resize-B47sgoOb.mjs.map +0 -1
  53. package/dist/resvg-wasm-fcJTLpJs.mjs +0 -522
  54. package/dist/resvg-wasm-fcJTLpJs.mjs.map +0 -1
  55. package/dist/rolldown-runtime-JspESFgx.mjs +0 -35
  56. package/dist/webp-CcbaCrQ7.mjs +0 -2
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ghostty-web.js","assets/index.js","assets/index.css"])))=>i.map(i=>d[i]);
2
- import{c as p,e as b,m as y,k as w,l as x}from"./index.js";const k=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],L=p("terminal",k);function E(n){return b(n.defaultTagName??"div",n,n)}const S=x("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function N({className:n,variant:i="default",render:t,...c}){return E({defaultTagName:"span",props:y({className:w(S({variant:i}),n)},c),render:t,state:{slot:"badge",variant:i}})}const P="modulepreload",R=function(n){return"/"+n},v={},_=function(i,t,c){let u=Promise.resolve();if(t&&t.length>0){let f=function(e){return Promise.all(e.map(r=>Promise.resolve(r).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=s?.nonce||s?.getAttribute("nonce");u=f(t.map(e=>{if(e=R(e),e in v)return;v[e]=!0;const r=e.endsWith(".css"),d=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${d}`))return;const a=document.createElement("link");if(a.rel=r?"stylesheet":P,r||(a.as="script"),a.crossOrigin="",a.href=e,o&&a.setAttribute("nonce",o),document.head.appendChild(a),r)return new Promise((m,h)=>{a.addEventListener("load",m),a.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${e}`)))})}))}function l(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return u.then(s=>{for(const o of s||[])o.status==="rejected"&&l(o.reason);return i().catch(l)})};let g;const T=()=>{g??=(async()=>{const n=await _(()=>import("./ghostty-web.js"),__vite__mapDeps([0,1,2]));return await n.init(),n})()};async function A(n){let i;try{T(),i=await g}catch{return}const t=new i.Terminal({fontSize:13,theme:{background:"#05070b",foreground:"#b7c3d8",cursor:"#3d8bff",selectionBackground:"#2a3550"}});t.open(n);const c=new i.FitAddon;t.loadAddon(c),c.fit();const u=new Set,l=new Set,s=t.onData(e=>{for(const r of u)r(e)}),o=t.onResize(({cols:e,rows:r})=>{for(const d of l)d({cols:e,rows:r})}),f=new ResizeObserver(()=>{try{c.fit()}catch{}});return f.observe(n),{write:e=>t.write(e),reset:()=>t.reset(),fit:()=>c.fit(),focus:()=>n.querySelector("canvas")?.dispatchEvent(new Event("focus")),readState:()=>{const e=t.buffer.active,r=t.getSelectionPosition();return{cols:t.cols,rows:t.rows,cursorX:e.cursorX,cursorY:e.cursorY,...r===void 0?{}:{selection:{start:{x:r.start.x,y:r.start.y},end:{x:r.end.x,y:r.end.y}}}}},onData(e){return u.add(e),()=>u.delete(e)},onResize(e){return l.add(e),()=>l.delete(e)},dispose(){f.disconnect(),s.dispose(),o.dispose(),t.dispose()}}}export{N as B,L as T,_,A as c,T as p,E as u};
2
+ import{d as h,i as b,o as y,n as w,p as x}from"./index.js";const k=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],L=h("terminal",k);function E(n){return b(n.defaultTagName??"div",n,n)}const S=x("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function N({className:n,variant:i="default",render:t,...c}){return E({defaultTagName:"span",props:y({className:w(S({variant:i}),n)},c),render:t,state:{slot:"badge",variant:i}})}const P="modulepreload",R=function(n){return"/"+n},v={},_=function(i,t,c){let u=Promise.resolve();if(t&&t.length>0){let f=function(e){return Promise.all(e.map(r=>Promise.resolve(r).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=s?.nonce||s?.getAttribute("nonce");u=f(t.map(e=>{if(e=R(e),e in v)return;v[e]=!0;const r=e.endsWith(".css"),d=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${d}`))return;const a=document.createElement("link");if(a.rel=r?"stylesheet":P,r||(a.as="script"),a.crossOrigin="",a.href=e,o&&a.setAttribute("nonce",o),document.head.appendChild(a),r)return new Promise((m,p)=>{a.addEventListener("load",m),a.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${e}`)))})}))}function l(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return u.then(s=>{for(const o of s||[])o.status==="rejected"&&l(o.reason);return i().catch(l)})};let g;const T=()=>{g??=(async()=>{const n=await _(()=>import("./ghostty-web.js"),__vite__mapDeps([0,1,2]));return await n.init(),n})()};async function A(n){let i;try{T(),i=await g}catch{return}const t=new i.Terminal({fontSize:13,theme:{background:"#05070b",foreground:"#b7c3d8",cursor:"#3d8bff",selectionBackground:"#2a3550"}});t.open(n);const c=new i.FitAddon;t.loadAddon(c),c.fit();const u=new Set,l=new Set,s=t.onData(e=>{for(const r of u)r(e)}),o=t.onResize(({cols:e,rows:r})=>{for(const d of l)d({cols:e,rows:r})}),f=new ResizeObserver(()=>{try{c.fit()}catch{}});return f.observe(n),{write:e=>t.write(e),reset:()=>t.reset(),fit:()=>c.fit(),focus:()=>n.querySelector("canvas")?.dispatchEvent(new Event("focus")),readState:()=>{const e=t.buffer.active,r=t.getSelectionPosition();return{cols:t.cols,rows:t.rows,cursorX:e.cursorX,cursorY:e.cursorY,...r===void 0?{}:{selection:{start:{x:r.start.x,y:r.start.y},end:{x:r.end.x,y:r.end.y}}}}},onData(e){return u.add(e),()=>u.delete(e)},onResize(e){return l.add(e),()=>l.delete(e)},dispose(){f.disconnect(),s.dispose(),o.dispose(),t.dispose()}}}export{N as B,L as T,_,A as c,T as p,E as u};
@@ -1 +1 @@
1
- import{r as s,j as t,R as j,a as b}from"./index.js";import{p as N,c as R,T as y,B as S}from"./terminal-pane.js";function E(){const[h,x]=s.useState(""),[v,w]=s.useState(!1),[u,f]=s.useState([]),[o,g]=s.useState({cursorX:0,cursorY:0,cols:0,rows:0}),m=s.useRef(null),c=s.useRef(void 0),i=s.useRef([]),p=s.useRef(!1);return s.useEffect(()=>{N()},[]),s.useEffect(()=>{let r=!1;return(async()=>{const a=m.current;if(a===null)return;const n=await R(a);if(r||n===void 0)return;c.current=n,n.onData(l=>{p.current&&fetch("/api/terminal-input",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({data:l})}).catch(()=>{})});const e=i.current;i.current=[];for(const l of e)n.write(l);const d=window.setInterval(()=>{try{g(n.readState())}catch{}},300);return()=>window.clearInterval(d)})(),()=>{r=!0,c.current?.dispose(),c.current=void 0}},[]),s.useEffect(()=>{const r=n=>{const e=c.current;e!==void 0?e.write(n):i.current.push(n)},a=new EventSource("/api/events");return a.onmessage=n=>{const e=JSON.parse(n.data);if(e.type==="state"){x(e.command),p.current=e.interactive,w(e.interactive),f(e.services);for(const d of e.output)r(d)}else e.type==="log"?r(e.chunk):f(e.services)},()=>a.close()},[]),t.jsxs("div",{className:"flex h-screen flex-col overflow-hidden",children:[t.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border bg-card px-3",children:[t.jsx(y,{className:"size-4 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:h||"…"}),v?null:t.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-amber-400",children:"非交互"})]}),t.jsx("div",{ref:m,className:"min-h-0 flex-1 bg-[#05070b] px-1"}),t.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-3 overflow-x-auto border-t border-border bg-card px-3 text-[11px] text-muted-foreground",children:[t.jsxs("span",{className:"font-mono whitespace-nowrap",children:["光标 ",o.cursorY,":",o.cursorX]}),t.jsxs("span",{className:"font-mono whitespace-nowrap",children:[o.cols,"×",o.rows]}),t.jsx("span",{className:"h-3 w-px bg-border"}),u.length===0?t.jsx("span",{children:"监听端口嗅探中…"}):u.map(r=>t.jsxs(S,{variant:r.detached?"destructive":"secondary",className:"font-mono whitespace-nowrap",children:[":",r.port,r.detached?" · detached":""]},r.port))]})]})}j.createRoot(document.getElementById("root")).render(t.jsx(b.StrictMode,{children:t.jsx(E,{})}));
1
+ import{u as y,r as s,j as e,G as N,a as R,b as S,R as E,c as P,P as k}from"./index.js";import{p as I,c as T,T as O,B}from"./terminal-pane.js";function D(){const{messages:d}=y(),[v,w]=s.useState(""),[g,b]=s.useState(!1),[m,p]=s.useState([]),[o,j]=s.useState({cursorX:0,cursorY:0,cols:0,rows:0}),h=s.useRef(null),c=s.useRef(void 0),l=s.useRef([]),x=s.useRef(!1);return s.useEffect(()=>{I()},[]),s.useEffect(()=>{let r=!1;return(async()=>{const a=h.current;if(a===null)return;const n=await T(a);if(r||n===void 0)return;c.current=n,n.onData(f=>{x.current&&fetch("/api/terminal-input",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({data:f})}).catch(()=>{})});const t=l.current;l.current=[];for(const f of t)n.write(f);const u=window.setInterval(()=>{try{j(n.readState())}catch{}},300);return()=>window.clearInterval(u)})(),()=>{r=!0,c.current?.dispose(),c.current=void 0}},[]),s.useEffect(()=>{const r=n=>{const t=c.current;t!==void 0?t.write(n):l.current.push(n)},a=new EventSource("/api/events");return a.onmessage=n=>{const t=JSON.parse(n.data);if(t.type==="state"){w(t.command),x.current=t.interactive,b(t.interactive),p(t.services);for(const u of t.output)r(u)}else t.type==="log"?r(t.chunk):p(t.services)},()=>a.close()},[]),e.jsxs("div",{className:"flex h-screen flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border bg-card px-3",children:[e.jsx(O,{className:"size-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:v||"…"}),g?null:e.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-amber-400",children:d.tabs.nonInteractive})]}),e.jsx("div",{ref:h,className:"min-h-0 flex-1 bg-[#05070b] px-1"}),e.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-3 overflow-x-auto border-t border-border bg-card px-3 text-[11px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono whitespace-nowrap",children:N(d.tabs.cursor,{y:o.cursorY,x:o.cursorX})}),e.jsxs("span",{className:"font-mono whitespace-nowrap",children:[o.cols,"×",o.rows]}),e.jsx("span",{className:"h-3 w-px bg-border"}),m.length===0?e.jsx("span",{children:d.tabs.portsSniffing}):m.map(r=>e.jsxs(B,{variant:r.detached?"destructive":"secondary",className:"font-mono whitespace-nowrap",children:[":",r.port,r.detached?" · detached":""]},r.port))]})]})}const i=R();S(i.locale,i.theme);E.createRoot(document.getElementById("root")).render(e.jsx(P.StrictMode,{children:e.jsx(k,{initialLocale:i.locale,initialTheme:i.theme,children:e.jsx(D,{})})}));
@@ -1,5 +1,5 @@
1
1
  <!doctype html>
2
- <html lang="zh-CN">
2
+ <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -1,5 +1,5 @@
1
1
  <!doctype html>
2
- <html lang="zh-CN">
2
+ <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -1,5 +1,5 @@
1
1
  <!doctype html>
2
- <html lang="zh-CN">
2
+ <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -1 +1 @@
1
- import{r as t,j as n,R as S,a as B}from"./index.js";import{B as v,A as I,a as N,R as U,G as z,I as A}from"./input.js";const K=()=>typeof window<"u"&&"navigation"in window?window.navigation:void 0,p=c=>{const i=c.trim();if(i.length!==0)try{return new URL(/^https?:\/\//iu.test(i)?i:`http://${i}`).href}catch{return}},T=c=>`${location.pathname}?url=${encodeURIComponent(c)}`,F=()=>{const c=new URLSearchParams(location.search).get("url");return p(c??"")??"about:blank"};function P(){const c=t.useRef(F()),[i,k]=t.useState(c.current),[m,E]=t.useState(c.current),u=t.useRef([c.current]),s=t.useRef(0),l=t.useRef(K()),w=t.useRef(null),f=t.useRef(null),[$,j]=t.useState(0),d=t.useCallback(e=>{E(e),k(e)},[]);t.useEffect(()=>{const e=l.current;if(e===void 0)return;const r=o=>{!o.canIntercept||o.hashChange||o.intercept({handler:()=>{const b=new URLSearchParams(new URL(o.destination.url).search).get("url");if(b===null)return;const R=p(b);R!==void 0&&d(R)}})},a=()=>j(o=>o+1);return e.addEventListener("navigate",r),e.addEventListener("currententrychange",a),()=>{e.removeEventListener("navigate",r),e.removeEventListener("currententrychange",a)}},[]);const L=e=>{const r=l.current;if(r!==void 0)try{r.navigate(T(e));return}catch{}u.current=[...u.current.slice(0,s.current+1),e],s.current=u.current.length-1,d(e)},h=l.current?.currentEntry??null,C=h!==null?h.index>0:s.current>0,D=h!==null?h.index<(l.current?.entries().length??1)-1:s.current<u.current.length-1,x=t.useCallback(()=>{const e=l.current;if(e!==void 0&&e.currentEntry!==null&&e.currentEntry.index>0){const r=e.entries()[e.currentEntry.index-1];if(r!==void 0)try{e.traverseTo(r.key);return}catch{}}s.current>0&&(s.current-=1,d(u.current[s.current]))},[d]),y=t.useCallback(()=>{const e=l.current;if(e!==void 0&&e.currentEntry!==null){const a=e.entries()[e.currentEntry.index+1];if(a!==void 0)try{e.traverseTo(a.key);return}catch{}}s.current<u.current.length-1&&(s.current+=1,d(u.current[s.current]))},[d]),g=t.useCallback(()=>{w.current!==null&&(w.current.src=m)},[m]);return t.useEffect(()=>{const e=r=>{const a=r.metaKey||r.ctrlKey,o=document.activeElement===f.current;if(r.key==="F5"||a&&r.key.toLowerCase()==="r"){r.preventDefault(),g();return}if(!o){if(a&&r.key==="ArrowLeft"||a&&r.key==="["){r.preventDefault(),x();return}if(a&&r.key==="ArrowRight"||a&&r.key==="]"){r.preventDefault(),y();return}a&&r.key.toLowerCase()==="l"&&(r.preventDefault(),f.current?.focus(),f.current?.select())}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,y,g]),n.jsxs("div",{className:"flex h-screen flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-2 border-b border-border bg-card px-3",children:[n.jsx(v,{variant:"ghost",size:"icon-sm",disabled:!C,onClick:x,"aria-label":"后退",children:n.jsx(I,{})}),n.jsx(v,{variant:"ghost",size:"icon-sm",disabled:!D,onClick:y,"aria-label":"前进",children:n.jsx(N,{})}),n.jsx(v,{variant:"ghost",size:"icon-sm",onClick:g,"aria-label":"重新加载",children:n.jsx(U,{})}),n.jsx(z,{className:"size-4 shrink-0 text-muted-foreground"}),n.jsx(A,{ref:f,className:"h-7 font-mono text-xs",value:i,placeholder:"输入 URL 跳转",onChange:e=>k(e.target.value),onKeyDown:e=>{if(e.key!=="Enter")return;const r=p(i);r!==void 0&&L(r)}})]}),n.jsx("iframe",{ref:w,title:"service",src:m,className:"min-h-0 flex-1 border-0 bg-white",sandbox:"allow-same-origin allow-scripts allow-forms"})]})}S.createRoot(document.getElementById("root")).render(n.jsx(B.StrictMode,{children:n.jsx(P,{})}));
1
+ import{u as S,r as n,j as t,a as B,b as N,R as z,c as A,P as U}from"./index.js";import{B as p,A as T,a as K,R as F,G as $,I as G}from"./input.js";const M=()=>typeof window<"u"&&"navigation"in window?window.navigation:void 0,b=c=>{const s=c.trim();if(s.length!==0)try{return new URL(/^https?:\/\//iu.test(s)?s:`http://${s}`).href}catch{return}},V=c=>`${location.pathname}?url=${encodeURIComponent(c)}`,H=()=>{const c=new URLSearchParams(location.search).get("url");return b(c??"")??"about:blank"};function O(){const{messages:c}=S(),s=n.useRef(H()),[k,R]=n.useState(s.current),[w,L]=n.useState(s.current),l=n.useRef([s.current]),o=n.useRef(0),u=n.useRef(M()),x=n.useRef(null),f=n.useRef(null),[q,C]=n.useState(0),d=n.useCallback(e=>{L(e),R(e)},[]);n.useEffect(()=>{const e=u.current;if(e===void 0)return;const r=i=>{!i.canIntercept||i.hashChange||i.intercept({handler:()=>{const E=new URLSearchParams(new URL(i.destination.url).search).get("url");if(E===null)return;const j=b(E);j!==void 0&&d(j)}})},a=()=>C(i=>i+1);return e.addEventListener("navigate",r),e.addEventListener("currententrychange",a),()=>{e.removeEventListener("navigate",r),e.removeEventListener("currententrychange",a)}},[]);const D=e=>{const r=u.current;if(r!==void 0)try{r.navigate(V(e));return}catch{}l.current=[...l.current.slice(0,o.current+1),e],o.current=l.current.length-1,d(e)},m=u.current?.currentEntry??null,P=m!==null?m.index>0:o.current>0,I=m!==null?m.index<(u.current?.entries().length??1)-1:o.current<l.current.length-1,y=n.useCallback(()=>{const e=u.current;if(e!==void 0&&e.currentEntry!==null&&e.currentEntry.index>0){const r=e.entries()[e.currentEntry.index-1];if(r!==void 0)try{e.traverseTo(r.key);return}catch{}}o.current>0&&(o.current-=1,d(l.current[o.current]))},[d]),g=n.useCallback(()=>{const e=u.current;if(e!==void 0&&e.currentEntry!==null){const a=e.entries()[e.currentEntry.index+1];if(a!==void 0)try{e.traverseTo(a.key);return}catch{}}o.current<l.current.length-1&&(o.current+=1,d(l.current[o.current]))},[d]),v=n.useCallback(()=>{x.current!==null&&(x.current.src=w)},[w]);return n.useEffect(()=>{const e=r=>{const a=r.metaKey||r.ctrlKey,i=document.activeElement===f.current;if(r.key==="F5"||a&&r.key.toLowerCase()==="r"){r.preventDefault(),v();return}if(!i){if(a&&r.key==="ArrowLeft"||a&&r.key==="["){r.preventDefault(),y();return}if(a&&r.key==="ArrowRight"||a&&r.key==="]"){r.preventDefault(),g();return}a&&r.key.toLowerCase()==="l"&&(r.preventDefault(),f.current?.focus(),f.current?.select())}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y,g,v]),t.jsxs("div",{className:"flex h-screen flex-col overflow-hidden",children:[t.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-2 border-b border-border bg-card px-3",children:[t.jsx(p,{variant:"ghost",size:"icon-sm",disabled:!P,onClick:y,"aria-label":c.common.back,children:t.jsx(T,{})}),t.jsx(p,{variant:"ghost",size:"icon-sm",disabled:!I,onClick:g,"aria-label":c.common.forward,children:t.jsx(K,{})}),t.jsx(p,{variant:"ghost",size:"icon-sm",onClick:v,"aria-label":c.common.reload,children:t.jsx(F,{})}),t.jsx($,{className:"size-4 shrink-0 text-muted-foreground"}),t.jsx(G,{ref:f,className:"h-7 font-mono text-xs",value:k,placeholder:c.tabs.urlPlaceholder,onChange:e=>R(e.target.value),onKeyDown:e=>{if(e.key!=="Enter")return;const r=b(k);r!==void 0&&D(r)}})]}),t.jsx("iframe",{ref:x,title:"service",src:w,className:"min-h-0 flex-1 border-0 bg-white",sandbox:"allow-same-origin allow-scripts allow-forms"})]})}const h=B();N(h.locale,h.theme);z.createRoot(document.getElementById("root")).render(t.jsx(A.StrictMode,{children:t.jsx(U,{initialLocale:h.locale,initialTheme:h.theme,children:t.jsx(O,{})})}));