visual-remote 0.3.0 → 0.3.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.
- package/README.md +63 -8
- package/apps/cli/dist/direct-exec-mcp.js +976 -0
- package/apps/cli/dist/index.js +1353 -254
- package/apps/cli/dist/next.js +3616 -2683
- package/apps/cli/dist/vite.js +5115 -4187
- package/package.json +7 -3
- package/packages/overlay/dist/client.js +115 -7
- package/packages/overlay/dist/viewer.js +4 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visual-remote",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Visual bridge from a running web UI to
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"description": "Visual bridge from a running web UI to a coding agent in its Git worktree",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"apps/cli/dist/index.js",
|
|
16
|
+
"apps/cli/dist/direct-exec-mcp.js",
|
|
16
17
|
"apps/cli/dist/vite.js",
|
|
17
18
|
"apps/cli/dist/next.js",
|
|
18
19
|
"apps/cli/dist/next-client.js",
|
|
@@ -70,6 +71,9 @@
|
|
|
70
71
|
"@types/node": "^26.1.2",
|
|
71
72
|
"@types/ws": "^8.18.1",
|
|
72
73
|
"esbuild": "^0.28.1",
|
|
74
|
+
"next": "15.5.16",
|
|
75
|
+
"react": "19.1.0",
|
|
76
|
+
"react-dom": "19.1.0",
|
|
73
77
|
"tsx": "^4.23.1",
|
|
74
78
|
"typescript": "^7.0.2",
|
|
75
79
|
"vite": "^8.1.5",
|
|
@@ -86,7 +90,7 @@
|
|
|
86
90
|
"build:server": "corepack pnpm --filter @visual-remote/cli build",
|
|
87
91
|
"dev": "corepack pnpm run build:overlay && tsx apps/cli/src/index.ts",
|
|
88
92
|
"test": "vitest run",
|
|
89
|
-
"test:e2e": "corepack pnpm
|
|
93
|
+
"test:e2e": "corepack pnpm build && corepack pnpm exec playwright test --config tests/e2e/playwright.config.ts",
|
|
90
94
|
"test:watch": "vitest",
|
|
91
95
|
"typecheck": "corepack pnpm -r --if-present typecheck && tsc --noEmit -p tsconfig.tests.json"
|
|
92
96
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var Fe,C,Pt,Kn,oe,Tt,Lt,It,Ye,Re,ve,At,Je,Ge,Xe,Wn,Ie={},Ae=[],Vn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Me=Array.isArray;function ee(e,t){for(var n in t)e[n]=t[n];return e}function Qe(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Yn(e,t,n){var o,r,i,s={};for(i in t)i=="key"?o=t[i]:i=="ref"?r=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?Fe.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return Pe(e,s,o,r,null)}function Pe(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Pt,__i:-1,__u:0};return r==null&&C.vnode!=null&&C.vnode(i),i}function te(e){return e.children}function Le(e,t){this.props=e,this.context=t}function ue(e,t){if(t==null)return e.__?ue(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?ue(e):null}function Gn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=ee({},t);i.__v=t.__v+1,C.vnode&&C.vnode(i),Ze(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??ue(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,Ht(o,i,r),t.__e=t.__=null,i.__e!=n&&qt(i)}}function qt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),qt(e)}function Et(e){(!e.__d&&(e.__d=!0)&&oe.push(e)&&!qe.__r++||Tt!=C.debounceRendering)&&((Tt=C.debounceRendering)||Lt)(qe)}function qe(){try{for(var e,t=1;oe.length;)oe.length>t&&oe.sort(It),e=oe.shift(),t=oe.length,Gn(e)}finally{oe.length=qe.__r=0}}function Ft(e,t,n,o,r,i,s,l,f,c,m){var h,a,g,k,x,E,b,w=o&&o.__k||Ae,P=t.length;for(f=Xn(n,t,w,f,P),h=0;h<P;h++)(g=n.__k[h])!=null&&(a=g.__i!=-1&&w[g.__i]||Ie,g.__i=h,E=Ze(e,g,a,r,i,s,l,f,c,m),k=g.__e,g.ref&&a.ref!=g.ref&&(a.ref&&et(a.ref,null,g),m.push(g.ref,g.__c||k,g)),x==null&&k!=null&&(x=k),(b=!!(4&g.__u))||a.__k===g.__k?(f=Mt(g,f,e,b),b&&a.__e&&(a.__e=null)):typeof g.type=="function"&&E!==void 0?f=E:k&&(f=k.nextSibling),g.__u&=-7);return n.__e=x,f}function Xn(e,t,n,o,r){var i,s,l,f,c,m=n.length,h=m,a=0;for(e.__k=new Array(r),i=0;i<r;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[i]=Pe(null,s,null,null,null):Me(s)?s=e.__k[i]=Pe(te,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[i]=Pe(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,f=i+a,s.__=e,s.__b=e.__b+1,l=null,(c=s.__i=Jn(s,n,f,h))!=-1&&(h--,(l=n[c])&&(l.__u|=2)),l==null||l.__v==null?(c==-1&&(r>m?a--:r<m&&a++),typeof s.type!="function"&&(s.__u|=4)):c!=f&&(c==f-1?a--:c==f+1?a++:(c>f?a--:a++,s.__u|=4))):e.__k[i]=null;if(h)for(i=0;i<m;i++)(l=n[i])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=ue(l)),Bt(l,l));return o}function Mt(e,t,n,o){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=Mt(r[i],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=ue(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Jn(e,t,n,o){var r,i,s,l=e.key,f=e.type,c=t[n],m=c!=null&&(2&c.__u)==0;if(c===null&&l==null||m&&l==c.key&&f==c.type)return n;if(o>(m?1:0)){for(r=n-1,i=n+1;r>=0||i<t.length;)if((c=t[s=r>=0?r--:i++])!=null&&(2&c.__u)==0&&l==c.key&&f==c.type)return s}return-1}function Ct(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Vn.test(t)?n:n+"px"}function Ce(e,t,n,o,r){var i,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Ct(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Ct(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(At,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[ve]=o[ve]:(n[ve]=Je,e.addEventListener(t,i?Xe:Ge,i)):e.removeEventListener(t,i?Xe:Ge,i);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Rt(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Re]==null)t[Re]=Je++;else if(t[Re]<n[ve])return;return n(C.event?C.event(t):t)}}}function Ze(e,t,n,o,r,i,s,l,f,c){var m,h,a,g,k,x,E,b,w,P,U,z,Y,j,L,A,B=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(f=!!(32&n.__u),i=[l=t.__e=n.__e]),(m=C.__b)&&m(t);e:if(typeof B=="function"){h=s.length;try{if(w=t.props,P=B.prototype&&B.prototype.render,U=(m=B.contextType)&&o[m.__c],z=m?U?U.props.value:m.__:o,n.__c?b=(a=t.__c=n.__c).__=a.__E:(P?t.__c=a=new B(w,z):(t.__c=a=new Le(w,z),a.constructor=B,a.render=Zn),U&&U.sub(a),a.state||(a.state={}),a.__n=o,g=a.__d=!0,a.__h=[],a._sb=[]),P&&a.__s==null&&(a.__s=a.state),P&&B.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=ee({},a.__s)),ee(a.__s,B.getDerivedStateFromProps(w,a.__s))),k=a.props,x=a.state,a.__v=t,g)P&&B.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),P&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(P&&B.getDerivedStateFromProps==null&&w!==k&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(w,z),t.__v==n.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(w,a.__s,z)===!1){t.__v!=n.__v&&(a.props=w,a.state=a.__s,a.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(J){J&&(J.__=t)}),Ae.push.apply(a.__h,a._sb),a._sb=[],a.__h.length&&s.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(w,a.__s,z),P&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(k,x,E)})}if(a.context=z,a.props=w,a.__P=e,a.__e=!1,Y=C.__r,j=0,P)a.state=a.__s,a.__d=!1,Y&&Y(t),m=a.render(a.props,a.state,a.context),Ae.push.apply(a.__h,a._sb),a._sb=[];else do a.__d=!1,Y&&Y(t),m=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++j<25);a.state=a.__s,a.getChildContext!=null&&(o=ee(ee({},o),a.getChildContext())),P&&!g&&a.getSnapshotBeforeUpdate!=null&&(E=a.getSnapshotBeforeUpdate(k,x)),L=m!=null&&m.type===te&&m.key==null?$t(m.props.children):m,l=Ft(e,Me(L)?L:[L],t,n,o,r,i,s,l,f,c),a.base=t.__e,t.__u&=-161,a.__h.length&&s.push(a),b&&(a.__E=a.__=null)}catch(J){if(s.length=h,t.__v=null,f||i!=null){if(J.then){for(t.__u|=f?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i!=null&&(i[i.indexOf(l)]=null),t.__e=l}else if(i!=null)for(A=i.length;A--;)Qe(i[A])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),J.then||Nt(t),C.__e(J,t,n)}}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=Qn(n.__e,t,n,o,r,i,s,f,c);return(m=C.diffed)&&m(t),128&t.__u?void 0:l}function Nt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Nt))}function Ht(e,t,n){for(var o=0;o<n.length;o++)et(n[o],n[++o],n[++o]);C.__c&&C.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){C.__e(i,r.__v)}})}function $t(e){return typeof e!="object"||e==null||e.__b>0?e:Me(e)?e.map($t):e.constructor!==void 0?null:ee({},e)}function Qn(e,t,n,o,r,i,s,l,f){var c,m,h,a,g,k,x,E=n.props||Ie,b=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((g=i[c])&&"setAttribute"in g==!!w&&(w?g.localName==w:g.nodeType==3)){e=g,i[c]=null;break}}if(e==null){if(w==null)return document.createTextNode(b);e=document.createElementNS(r,w,b.is&&b),l&&(C.__m&&C.__m(t,i),l=!1),i=null}if(w==null)E===b||l&&e.data==b||(e.data=b);else{if(i=w=="textarea"&&b.defaultValue!=null?null:i&&Fe.call(e.childNodes),!l&&i!=null)for(E={},c=0;c<e.attributes.length;c++)E[(g=e.attributes[c]).name]=g.value;for(c in E)g=E[c],c=="dangerouslySetInnerHTML"?h=g:c=="children"||c in b||c=="value"&&"defaultValue"in b||c=="checked"&&"defaultChecked"in b||Ce(e,c,null,g,r);for(c in b)g=b[c],c=="children"?a=g:c=="dangerouslySetInnerHTML"?m=g:c=="value"?k=g:c=="checked"?x=g:l&&typeof g!="function"||E[c]===g||Ce(e,c,g,E[c],r);if(m)l||h&&(m.__html==h.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(h&&(e.innerHTML=""),Ft(t.type=="template"?e.content:e,Me(a)?a:[a],t,n,o,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,i,s,i?i[0]:n.__k&&ue(n,0),l,f),i!=null)for(c=i.length;c--;)Qe(i[c]);l&&w!="textarea"||(c="value",w=="progress"&&k==null?e.removeAttribute("value"):k!=null&&(k!==e[c]||w=="progress"&&!k||w=="option"&&k!=E[c])&&Ce(e,c,k,E[c],r),c="checked",x!=null&&x!=e[c]&&Ce(e,c,x,E[c],r))}return e}function et(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){C.__e(r,n)}}function Bt(e,t,n){var o,r;if(C.unmount&&C.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||et(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){C.__e(i,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Bt(o[r],t,n||typeof e.type!="function");n||Qe(e.__e),e.__c=e.__=e.__e=void 0}function Zn(e,t,n){return this.constructor(e,n)}function Ut(e,t,n){var o,r,i,s;t==document&&(t=document.documentElement),C.__&&C.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],s=[],Ze(t,e=(!o&&n||t).__k=Yn(te,null,[e]),r||Ie,Ie,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?Fe.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,s),Ht(i,e,s),e.props.children=null}Fe=Ae.slice,C={__e:function(e,t,n,o){for(var r,i,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(l){e=l}throw e}},Pt=0,Kn=function(e){return e!=null&&e.constructor===void 0},Le.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ee({},this.state),typeof e=="function"&&(e=e(ee({},n),this.props)),e&&ee(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Et(this))},Le.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Et(this))},Le.prototype.render=te,oe=[],Lt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,It=function(e,t){return e.__v.__b-t.__v.__b},qe.__r=0,Ye=Math.random().toString(8),Re="__d"+Ye,ve="__a"+Ye,At=/(PointerCapture)$|Capture$/i,Je=0,Ge=Rt(!1),Xe=Rt(!0),Wn=0;var de,q,tt,jt,ye=0,Gt=[],M=C,Ot=M.__b,Dt=M.__r,zt=M.diffed,Kt=M.__c,Wt=M.unmount,Vt=M.__;function He(e,t){M.__h&&M.__h(q,e,ye||t),ye=0;var n=q.__H||(q.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function N(e){return ye=1,eo(Jt,e)}function eo(e,t,n){var o=He(de++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Jt(void 0,t),function(l){var f=o.__N?o.__N[0]:o.__[0],c=o.t(f,l);f!==c&&(o.__N=[c,o.__[1]],o.__c.setState({}))}],o.__c=q,!q.__f)){var r=function(l,f,c){if(!o.__c.__H)return!0;var m=!1,h=o.__c.props!==l;if(o.__c.__H.__.some(function(g){if(g.__N){m=!0;var k=g.__[0];g.__=g.__N,g.__N=void 0,k!==g.__[0]&&(h=!0)}}),i){var a=i.call(this,l,f,c);return m?a||h:a}return!m||h};q.__f=!0;var i=q.shouldComponentUpdate,s=q.componentWillUpdate;q.componentWillUpdate=function(l,f,c){if(this.__e){var m=i;i=void 0,r(l,f,c),i=m}s&&s.call(this,l,f,c)},q.shouldComponentUpdate=r}return o.__N||o.__}function W(e,t){var n=He(de++,3);!M.__s&&ot(n.__H,t)&&(n.__=e,n.u=t,q.__H.__h.push(n))}function Xt(e,t){var n=He(de++,4);!M.__s&&ot(n.__H,t)&&(n.__=e,n.u=t,q.__h.push(n))}function V(e){return ye=5,se(function(){return{current:e}},[])}function se(e,t){var n=He(de++,7);return ot(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Q(e,t){return ye=8,se(function(){return e},t)}function to(){for(var e;e=Gt.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ne),t.__h.some(nt),t.__h=[]}catch(n){t.__h=[],M.__e(n,e.__v)}}}M.__b=function(e){q=null,Ot&&Ot(e)},M.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Vt&&Vt(e,t)},M.__r=function(e){Dt&&Dt(e),de=0;var t=(q=e.__c).__H;t&&(tt===q?(t.__h=[],q.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Ne),t.__h.some(nt),t.__h=[],de=0)),tt=q},M.diffed=function(e){zt&&zt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Gt.push(t)!==1&&jt===M.requestAnimationFrame||((jt=M.requestAnimationFrame)||no)(to)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),tt=q=null},M.__c=function(e,t){t.some(function(n){try{n.__h.some(Ne),n.__h=n.__h.filter(function(o){return!o.__||nt(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],M.__e(o,n.__v)}}),Kt&&Kt(e,t)},M.unmount=function(e){Wt&&Wt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Ne(o)}catch(r){t=r}}),n.__H=void 0,t&&M.__e(t,n.__v))};var Yt=typeof requestAnimationFrame=="function";function no(e){var t,n=function(){clearTimeout(o),Yt&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Yt&&(t=requestAnimationFrame(n))}function Ne(e){var t=q,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),q=t}function nt(e){var t=q;e.__c=e.__(),q=t}function ot(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Jt(e,t){return typeof t=="function"?t(e):t}function Qt(e,t,n){return n<t?t:Math.min(Math.max(e,t),n)}function rt(e,t){let n=Math.min(e.x,t.x),o=Math.min(e.y,t.y);return{x:n,y:o,width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}function oo(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return n*o}function it(e,t){let n=e.width*e.height;return n>0?oo(e,t)/n:0}function Zt(e,t,n,o=12,r=10,i=o){let s=Math.max(o,i),l=n.height-(e.y+e.height)-o,f=e.y-s,c=n.width-(e.x+e.width)-o,m=e.x-o,h;l>=t.height+r?h="below":f>=t.height+r?h="above":c>=t.width+r?h="right":m>=t.width+r?h="left":h=l>=f?"below":"above";let a=h==="right"?e.x+e.width+r:h==="left"?e.x-t.width-r:e.x,g=h==="below"?e.y+e.height+r:h==="above"?e.y-t.height-r:e.y;return{left:Qt(a,o,n.width-t.width-o),top:Qt(g,s,n.height-t.height-o),placement:h}}function ro(e,t){let n=e.startsWith("#")?e.slice(1):e;if(!n.includes(`${t}=`))return{token:null,remainingHash:e};let o=new URLSearchParams(n),r=o.get(t);o.delete(t);let i=o.toString();return{token:r?.trim()||null,remainingHash:i?`#${i}`:""}}function $e(e){return ro(e,"visual-pair")}function st(e,t){return e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&!t}function I(e,t){let n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}\u2026`}var io="visual-bridge:pairing-token";var en="visual-bridge:browser-session",on="visual-bridge:last-sequence",so="visual-bridge:viewer-last-sequence",ao=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying","review","accepted","reverted","failed","canceled","unsafe"]);function rn(e){try{return sessionStorage.getItem(e)}catch{return null}}function sn(e,t){try{sessionStorage.setItem(e,t)}catch{}}function tn(e){try{sessionStorage.removeItem(e)}catch{}}function an(e){try{return JSON.parse(e)}catch{return e}}function D(e){return typeof e=="object"&&e!==null?e:null}function cn(){let e=$e(location.hash);if(tn(io),tn(on),e.token){let t=`${location.pathname}${location.search}${e.remainingHash}`;history.replaceState(history.state,"",t)}return""}function ln(){let e=rn(en);if(e)return e;let t=crypto.randomUUID();return sn(en,t),t}function co(e){let t=rn(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)&&n>=0?n:null}function lo(){let e=new URL("/_visual/ws",location.href);return e.protocol=location.protocol==="https:"?"wss:":"ws:",e.href}var Be=class{browserSessionId;token;mode;getPageState;sequenceStorageKey;onSnapshot;onEvent;onSequenceGap;socket=null;heartbeatTimer;reconnectTimer;reconnectAttempt=0;manuallyClosed=!1;state="connecting";projectId;lastSequence;hasReplaySequence;constructor(t){this.token=t.token,this.browserSessionId=t.browserSessionId,this.mode=t.mode??"control",this.getPageState=t.getPageState??(()=>({})),this.sequenceStorageKey=this.mode==="viewer"?so:on;let n=co(this.sequenceStorageKey);this.lastSequence=n??0,this.hasReplaySequence=n!==null||this.mode==="control",this.onSnapshot=t.onSnapshot,this.onEvent=t.onEvent,this.onSequenceGap=t.onSequenceGap??(()=>{})}connect(){this.manuallyClosed=!1,this.openSocket()}close(){this.manuallyClosed=!0,this.clearTimers(),this.socket?.close(),this.socket=null}send(t,n){if(this.socket?.readyState!==WebSocket.OPEN)return!1;let o={id:crypto.randomUUID(),type:t,browserSessionId:this.browserSessionId,payload:n};return this.socket.send(JSON.stringify(o)),!0}emitSnapshot(){this.onSnapshot({state:this.state,...this.projectId?{projectId:this.projectId}:{},lastSequence:this.lastSequence})}openSocket(){this.clearTimers(),this.state=this.reconnectAttempt>0?"reconnecting":"connecting",this.emitSnapshot();let t;try{t=new WebSocket(lo())}catch{this.scheduleReconnect();return}this.socket=t,t.addEventListener("open",()=>{this.reconnectAttempt=0,this.send("auth",{token:this.token})}),t.addEventListener("message",n=>{this.handleMessage(String(n.data))}),t.addEventListener("close",n=>{if(this.socket=null,n.code===4001||n.code===4401){this.state="unauthorized",this.emitSnapshot();return}this.manuallyClosed||this.scheduleReconnect()}),t.addEventListener("error",()=>{this.state==="connecting"&&(this.state="offline",this.emitSnapshot())})}handleMessage(t){let n=D(an(t));if(!(!n||typeof n.type!="string")){if(n.type==="auth.ok"){this.projectId=typeof n.projectId=="string"?n.projectId:this.projectId,this.state="connected",this.emitSnapshot(),this.send("browser.hello",{...this.hasReplaySequence?{lastSeq:this.lastSequence}:{},...this.mode==="control"?this.getPageState():{}}),this.mode==="control"&&(this.heartbeatTimer=window.setInterval(()=>{this.send("browser.heartbeat",{lastSeq:this.lastSequence,...this.getPageState()})},15e3));return}if(n.type==="auth.error"||n.type==="error.unauthorized"){this.state="unauthorized",this.emitSnapshot(),this.socket?.close(4401,"Pairing rejected");return}if(typeof n.seq=="number"){if(n.seq<=this.lastSequence&&this.hasReplaySequence)return;this.hasReplaySequence&&n.seq>this.lastSequence+1&&this.onSequenceGap({expectedSequence:this.lastSequence+1,receivedSequence:n.seq}),this.lastSequence=n.seq,this.hasReplaySequence=!0,sn(this.sequenceStorageKey,String(this.lastSequence)),this.emitSnapshot()}typeof n.projectId=="string"&&(this.projectId=n.projectId),this.onEvent(n)}}scheduleReconnect(){if(this.clearTimers(),this.manuallyClosed)return;this.reconnectAttempt+=1,this.state="reconnecting",this.emitSnapshot();let t=Math.min(1e4,500*2**(this.reconnectAttempt-1));this.reconnectTimer=window.setTimeout(()=>this.openSocket(),t)}clearTimers(){this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)}};async function ae(e,t,n){let o=new Headers(n?.headers);e&&o.set("Authorization",`Bearer ${e}`),n?.body&&!o.has("Content-Type")&&o.set("Content-Type","application/json");let r=await fetch(t,{...n,headers:o});if(!r.ok){let i=I(await r.text(),180);throw new Error(i||`Bridge request failed (${r.status} ${r.statusText})`)}return r}async function ce(e){let t=await e.text();return t?an(t):null}async function un(e){let t=await ce(await ae(e,"/_visual/api/viewer-session")),n=D(t)?.viewerUrl;if(typeof n!="string"||!n.startsWith("/_visual/viewer#visual-view="))throw new Error("Bridge returned an invalid viewer session URL");return n}async function dn(e){let t=await ce(await ae(e,"/_visual/api/project")),n=D(t),o=D(n?.project);return typeof n?.id=="string"?n.id:typeof n?.projectId=="string"?n.projectId:typeof o?.id=="string"?o.id:void 0}async function uo(e,t={}){let n=new URLSearchParams;t.limit!==void 0&&n.set("limit",String(t.limit)),t.cursor!==void 0&&(n.set("before",t.cursor.createdAt),n.set("beforeId",t.cursor.id));let o=n.toString(),r=o?`?${o}`:"",i=await ce(await ae(e,`/_visual/api/tasks${r}`)),s=D(i);return(Array.isArray(i)?i:Array.isArray(s?.tasks)?s.tasks:[]).filter(f=>{let c=D(f);return typeof c?.id=="string"&&typeof c.projectId=="string"&&typeof c.status=="string"&&ao.has(c.status)&&typeof c.requestText=="string"&&(c.scope==="instance"||c.scope==="component"||c.scope==="page"||c.scope==="project")&&typeof c.originBrowserSessionId=="string"&&Array.isArray(c.changedFiles)&&c.changedFiles.every(m=>typeof m=="string")&&typeof c.createdAt=="string"})}async function pn(e,t){let n=await uo(e);for(let o of n)if(o.originBrowserSessionId===t)return o}function nn(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function fn(e){let t=nn(e);if(t.length>0||Array.isArray(e))return t;let n=D(e);return nn(n?.files??n?.changedFiles??n?.data)}function po(e){if(typeof e=="string")return e;let t=D(e),n=t?.diff??t?.content??t?.data;return typeof n=="string"?n:""}function gn(e){if(typeof e=="string")return I(e,500);let t=D(e);if(!t)return null;let n=D(t.event)??t,o=typeof n.type=="string"?n.type:void 0;if(o==="tool_start"&&typeof n.name=="string")return I(`\uB3C4\uAD6C \uC2DC\uC791 \xB7 ${n.name}${typeof n.summary=="string"?` \xB7 ${n.summary}`:""}`,500);if(o==="tool_end"&&typeof n.name=="string")return I(`\uB3C4\uAD6C ${n.ok===!1?"\uC2E4\uD328":"\uC644\uB8CC"} \xB7 ${n.name}`,500);if(o==="phase"&&typeof n.name=="string")return I(`\uB2E8\uACC4 \xB7 ${n.name}`,500);if(o==="file_hint"&&typeof n.path=="string")return I(`\uD30C\uC77C \xB7 ${n.path}`,500);let r=n.message??n.text??n.summary??n.command??n.error??t.message;return typeof r=="string"?I(r,500):null}async function mn(e,t,n){let o=`/_visual/api/tasks/${encodeURIComponent(t)}`,r=n===void 0?void 0:{signal:n},[i,s,l]=await Promise.allSettled([ae(e,`${o}/files`,r).then(ce),ae(e,`${o}/diff`,r).then(ce),ae(e,`${o}/logs`,r).then(ce)]),f=[i,s,l].find(E=>E.status==="rejected"&&E.reason instanceof DOMException&&E.reason.name==="AbortError");if(f!==void 0)throw f.reason;let c=i.status==="fulfilled"?fn(i.value):[],m=s.status==="fulfilled"?po(s.value):"",h=l.status==="fulfilled"?l.value:[],a=D(h),g=Array.isArray(h)?h:Array.isArray(a?.logs)?a.logs:[],k=Array.isArray(g)?g.map(gn).filter(E=>!!E).slice(-40):[],x=[];return i.status==="rejected"&&x.push("files"),s.status==="rejected"&&x.push("diff"),l.status==="rejected"&&x.push("logs"),{changedFiles:c,diff:m,logs:k,unavailable:x}}async function hn(e,t,n){return ce(await ae(e,`/_visual/api/tasks/${encodeURIComponent(t)}/${n}`,{method:"POST"}))}function Ue(e){let t=D(e.payload),o=D(t?.task)??t;return o&&typeof o.id=="string"?o:void 0}function _n(e,t,n){let o=Ue(e),r=e.taskId??o?.id;return r?e.type==="task.queued"?o?.originBrowserSessionId===t?{accept:!0,bind:!0,taskId:r}:{accept:!1,bind:!1,taskId:r}:{accept:n===r,bind:!1,taskId:r}:{accept:!1,bind:!1}}function bn(e){let t=Ue(e);if(t?.status)return t.status;let n=D(e.payload),o=n?.phase??n?.status;return typeof o=="string"?o:void 0}function vn(e){let t=D(e.payload);return gn(t?.event??t)}function yn(e){let t=D(e.payload);return fn(t?.changedFiles??t?.files??[])}var le="__visual_bridge_root",fo=new Set(["SCRIPT","STYLE","META","LINK","NOSCRIPT","TEMPLATE"]),go=new Set(["alt","aria-label","aria-labelledby","aria-describedby","role","title","type","placeholder","data-testid","data-test-id","data-component","data-component-name","data-source","data-source-file","data-source-line","data-source-column","data-react-source"]),xn=/(?:auth|cookie|credential|csrf|jwt|key|password|secret|session|token|value)/i,Tn=[["display","display"],["position","position"],["width","width"],["height","height"],["margin","margin"],["padding","padding"],["gap","gap"],["borderRadius","border-radius"],["fontSize","font-size"],["fontWeight","font-weight"],["lineHeight","line-height"],["color","color"],["backgroundColor","background-color"],["flexDirection","flex-direction"],["alignItems","align-items"],["justifyContent","justify-content"],["gridTemplateColumns","grid-template-columns"],["zIndex","z-index"]],mo={a:"link",button:"button",footer:"contentinfo",form:"form",header:"banner",img:"img",main:"main",nav:"navigation",select:"combobox",textarea:"textbox"};function xe(e){return typeof e=="object"&&e!==null?e:null}function $(e){let t=e?.trim();return t||void 0}function pe(e){let t=typeof e=="number"?e:Number.parseInt(String(e),10);return Number.isInteger(t)&&t>0?t:void 0}function En(e,t){let n=$(typeof e.fileName=="string"?e.fileName:typeof e.filePath=="string"?e.filePath:typeof e.file=="string"?e.file:void 0);if(!n)return;let o=pe(e.lineNumber??e.line),r=pe(e.columnNumber??e.column),i=$(typeof e.componentName=="string"?e.componentName:t);return{filePath:n,...o?{lineNumber:o}:{},...r?{columnNumber:r}:{},...i?{componentName:i}:{}}}function ho(e,t){let n=e.trim();if(!n)return;if(n.startsWith("{"))try{let l=xe(JSON.parse(n));return l?En(l,t):void 0}catch{return}let o=/^(.*):(\d+)(?::(\d+))?$/.exec(n),r=$(o?.[1]??n);if(!r)return;let i=pe(o?.[2]),s=pe(o?.[3]);return{filePath:r,...i?{lineNumber:i}:{},...s?{columnNumber:s}:{},...t?{componentName:t}:{}}}function _o(e){let t=$(e.getAttribute("data-component-name"))??$(e.getAttribute("data-component")),n=e.getAttribute("data-react-source")??e.getAttribute("data-source");if(n){let s=ho(n,t);if(s)return s}let o=$(e.getAttribute("data-source-file")??e.getAttribute("data-file")??void 0);if(!o)return;let r=pe(e.getAttribute("data-source-line")),i=pe(e.getAttribute("data-source-column"));return{filePath:o,...r?{lineNumber:r}:{},...i?{columnNumber:i}:{},...t?{componentName:t}:{}}}function bo(e){let t=e.type;if(typeof t=="function"){let o=t;return $(typeof o.displayName=="string"?o.displayName:typeof o.name=="string"?o.name:void 0)}let n=xe(t);return $(typeof n?.displayName=="string"?n.displayName:typeof n?.name=="string"?n.name:void 0)}function vo(e,t){let n=typeof e=="string"?e:e instanceof Error?e.stack:void 0;if(!n)return[];let o=[];for(let r of n.split(`
|
|
2
|
-
`)){let i=/(?:\(|\s)([^()\s]+):(\d+):(\d+)\)?$/.exec(r.trim());if(!(!i?.[1]||i[1].includes("node_modules"))&&(o.push({filePath:i[1],lineNumber:Number(i[2]),columnNumber:Number(i[3]),...t?{componentName:t}:{}}),o.length===8))break}return o}function
|
|
1
|
+
var Me,C,Mt,Vn,oe,At,Nt,$t,Ge,Pe,xe,Ht,Qe,Xe,Je,Yn,Ie={},qe=[],Gn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ne=Array.isArray;function ee(e,t){for(var n in t)e[n]=t[n];return e}function Ze(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Xn(e,t,n){var o,r,i,a={};for(i in t)i=="key"?o=t[i]:i=="ref"?r=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Me.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return Le(e,a,o,r,null)}function Le(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Mt,__i:-1,__u:0};return r==null&&C.vnode!=null&&C.vnode(i),i}function te(e){return e.children}function Ae(e,t){this.props=e,this.context=t}function de(e,t){if(t==null)return e.__?de(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?de(e):null}function Jn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=ee({},t);i.__v=t.__v+1,C.vnode&&C.vnode(i),et(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??de(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,Dt(o,i,r),t.__e=t.__=null,i.__e!=n&&Bt(i)}}function Bt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Bt(e)}function It(e){(!e.__d&&(e.__d=!0)&&oe.push(e)&&!Fe.__r++||At!=C.debounceRendering)&&((At=C.debounceRendering)||Nt)(Fe)}function Fe(){try{for(var e,t=1;oe.length;)oe.length>t&&oe.sort($t),e=oe.shift(),t=oe.length,Jn(e)}finally{oe.length=Fe.__r=0}}function Ut(e,t,n,o,r,i,a,l,f,c,h){var _,s,m,T,y,E,b,w=o&&o.__k||qe,L=t.length;for(f=Qn(n,t,w,f,L),_=0;_<L;_++)(m=n.__k[_])!=null&&(s=m.__i!=-1&&w[m.__i]||Ie,m.__i=_,E=et(e,m,s,r,i,a,l,f,c,h),T=m.__e,m.ref&&s.ref!=m.ref&&(s.ref&&tt(s.ref,null,m),h.push(m.ref,m.__c||T,m)),y==null&&T!=null&&(y=T),(b=!!(4&m.__u))||s.__k===m.__k?(f=jt(m,f,e,b),b&&s.__e&&(s.__e=null)):typeof m.type=="function"&&E!==void 0?f=E:T&&(f=T.nextSibling),m.__u&=-7);return n.__e=y,f}function Qn(e,t,n,o,r){var i,a,l,f,c,h=n.length,_=h,s=0;for(e.__k=new Array(r),i=0;i<r;i++)(a=t[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[i]=Le(null,a,null,null,null):Ne(a)?a=e.__k[i]=Le(te,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=Le(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,f=i+s,a.__=e,a.__b=e.__b+1,l=null,(c=a.__i=Zn(a,n,f,_))!=-1&&(_--,(l=n[c])&&(l.__u|=2)),l==null||l.__v==null?(c==-1&&(r>h?s--:r<h&&s++),typeof a.type!="function"&&(a.__u|=4)):c!=f&&(c==f-1?s--:c==f+1?s++:(c>f?s--:s++,a.__u|=4))):e.__k[i]=null;if(_)for(i=0;i<h;i++)(l=n[i])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=de(l)),Wt(l,l));return o}function jt(e,t,n,o){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=jt(r[i],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=de(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Zn(e,t,n,o){var r,i,a,l=e.key,f=e.type,c=t[n],h=c!=null&&(2&c.__u)==0;if(c===null&&l==null||h&&l==c.key&&f==c.type)return n;if(o>(h?1:0)){for(r=n-1,i=n+1;r>=0||i<t.length;)if((c=t[a=r>=0?r--:i++])!=null&&(2&c.__u)==0&&l==c.key&&f==c.type)return a}return-1}function qt(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Gn.test(t)?n:n+"px"}function Re(e,t,n,o,r){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||qt(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||qt(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Ht,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[xe]=o[xe]:(n[xe]=Qe,e.addEventListener(t,i?Je:Xe,i)):e.removeEventListener(t,i?Je:Xe,i);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ft(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Pe]==null)t[Pe]=Qe++;else if(t[Pe]<n[xe])return;return n(C.event?C.event(t):t)}}}function et(e,t,n,o,r,i,a,l,f,c){var h,_,s,m,T,y,E,b,w,L,j,z,Y,O,A,q,B=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(f=!!(32&n.__u),i=[l=t.__e=n.__e]),(h=C.__b)&&h(t);e:if(typeof B=="function"){_=a.length;try{if(w=t.props,L=B.prototype&&B.prototype.render,j=(h=B.contextType)&&o[h.__c],z=h?j?j.props.value:h.__:o,n.__c?b=(s=t.__c=n.__c).__=s.__E:(L?t.__c=s=new B(w,z):(t.__c=s=new Ae(w,z),s.constructor=B,s.render=to),j&&j.sub(s),s.state||(s.state={}),s.__n=o,m=s.__d=!0,s.__h=[],s._sb=[]),L&&s.__s==null&&(s.__s=s.state),L&&B.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=ee({},s.__s)),ee(s.__s,B.getDerivedStateFromProps(w,s.__s))),T=s.props,y=s.state,s.__v=t,m)L&&B.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),L&&s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(L&&B.getDerivedStateFromProps==null&&w!==T&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(w,z),t.__v==n.__v||!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(w,s.__s,z)===!1){t.__v!=n.__v&&(s.props=w,s.state=s.__s,s.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(J){J&&(J.__=t)}),qe.push.apply(s.__h,s._sb),s._sb=[],s.__h.length&&a.push(s);break e}s.componentWillUpdate!=null&&s.componentWillUpdate(w,s.__s,z),L&&s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate(T,y,E)})}if(s.context=z,s.props=w,s.__P=e,s.__e=!1,Y=C.__r,O=0,L)s.state=s.__s,s.__d=!1,Y&&Y(t),h=s.render(s.props,s.state,s.context),qe.push.apply(s.__h,s._sb),s._sb=[];else do s.__d=!1,Y&&Y(t),h=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++O<25);s.state=s.__s,s.getChildContext!=null&&(o=ee(ee({},o),s.getChildContext())),L&&!m&&s.getSnapshotBeforeUpdate!=null&&(E=s.getSnapshotBeforeUpdate(T,y)),A=h!=null&&h.type===te&&h.key==null?zt(h.props.children):h,l=Ut(e,Ne(A)?A:[A],t,n,o,r,i,a,l,f,c),s.base=t.__e,t.__u&=-161,s.__h.length&&a.push(s),b&&(s.__E=s.__=null)}catch(J){if(a.length=_,t.__v=null,f||i!=null){if(J.then){for(t.__u|=f?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i!=null&&(i[i.indexOf(l)]=null),t.__e=l}else if(i!=null)for(q=i.length;q--;)Ze(i[q])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),J.then||Ot(t),C.__e(J,t,n)}}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=eo(n.__e,t,n,o,r,i,a,f,c);return(h=C.diffed)&&h(t),128&t.__u?void 0:l}function Ot(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ot))}function Dt(e,t,n){for(var o=0;o<n.length;o++)tt(n[o],n[++o],n[++o]);C.__c&&C.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){C.__e(i,r.__v)}})}function zt(e){return typeof e!="object"||e==null||e.__b>0?e:Ne(e)?e.map(zt):e.constructor!==void 0?null:ee({},e)}function eo(e,t,n,o,r,i,a,l,f){var c,h,_,s,m,T,y,E=n.props||Ie,b=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((m=i[c])&&"setAttribute"in m==!!w&&(w?m.localName==w:m.nodeType==3)){e=m,i[c]=null;break}}if(e==null){if(w==null)return document.createTextNode(b);e=document.createElementNS(r,w,b.is&&b),l&&(C.__m&&C.__m(t,i),l=!1),i=null}if(w==null)E===b||l&&e.data==b||(e.data=b);else{if(i=w=="textarea"&&b.defaultValue!=null?null:i&&Me.call(e.childNodes),!l&&i!=null)for(E={},c=0;c<e.attributes.length;c++)E[(m=e.attributes[c]).name]=m.value;for(c in E)m=E[c],c=="dangerouslySetInnerHTML"?_=m:c=="children"||c in b||c=="value"&&"defaultValue"in b||c=="checked"&&"defaultChecked"in b||Re(e,c,null,m,r);for(c in b)m=b[c],c=="children"?s=m:c=="dangerouslySetInnerHTML"?h=m:c=="value"?T=m:c=="checked"?y=m:l&&typeof m!="function"||E[c]===m||Re(e,c,m,E[c],r);if(h)l||_&&(h.__html==_.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(_&&(e.innerHTML=""),Ut(t.type=="template"?e.content:e,Ne(s)?s:[s],t,n,o,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,i,a,i?i[0]:n.__k&&de(n,0),l,f),i!=null)for(c=i.length;c--;)Ze(i[c]);l&&w!="textarea"||(c="value",w=="progress"&&T==null?e.removeAttribute("value"):T!=null&&(T!==e[c]||w=="progress"&&!T||w=="option"&&T!=E[c])&&Re(e,c,T,E[c],r),c="checked",y!=null&&y!=e[c]&&Re(e,c,y,E[c],r))}return e}function tt(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){C.__e(r,n)}}function Wt(e,t,n){var o,r;if(C.unmount&&C.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||tt(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){C.__e(i,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Wt(o[r],t,n||typeof e.type!="function");n||Ze(e.__e),e.__c=e.__=e.__e=void 0}function to(e,t,n){return this.constructor(e,n)}function Kt(e,t,n){var o,r,i,a;t==document&&(t=document.documentElement),C.__&&C.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],a=[],et(t,e=(!o&&n||t).__k=Xn(te,null,[e]),r||Ie,Ie,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?Me.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,a),Dt(i,e,a),e.props.children=null}Me=qe.slice,C={__e:function(e,t,n,o){for(var r,i,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),a=r.__d),a)return r.__E=r}catch(l){e=l}throw e}},Mt=0,Vn=function(e){return e!=null&&e.constructor===void 0},Ae.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ee({},this.state),typeof e=="function"&&(e=e(ee({},n),this.props)),e&&ee(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),It(this))},Ae.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),It(this))},Ae.prototype.render=te,oe=[],Nt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$t=function(e,t){return e.__v.__b-t.__v.__b},Fe.__r=0,Ge=Math.random().toString(8),Pe="__d"+Ge,xe="__a"+Ge,Ht=/(PointerCapture)$|Capture$/i,Qe=0,Xe=Ft(!1),Je=Ft(!0),Yn=0;var pe,F,nt,Vt,ye=0,tn=[],N=C,Yt=N.__b,Gt=N.__r,Xt=N.diffed,Jt=N.__c,Qt=N.unmount,Zt=N.__;function He(e,t){N.__h&&N.__h(F,e,ye||t),ye=0;var n=F.__H||(F.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return ye=1,no(on,e)}function no(e,t,n){var o=He(pe++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):on(void 0,t),function(l){var f=o.__N?o.__N[0]:o.__[0],c=o.t(f,l);f!==c&&(o.__N=[c,o.__[1]],o.__c.setState({}))}],o.__c=F,!F.__f)){var r=function(l,f,c){if(!o.__c.__H)return!0;var h=!1,_=o.__c.props!==l;if(o.__c.__H.__.some(function(m){if(m.__N){h=!0;var T=m.__[0];m.__=m.__N,m.__N=void 0,T!==m.__[0]&&(_=!0)}}),i){var s=i.call(this,l,f,c);return h?s||_:s}return!h||_};F.__f=!0;var i=F.shouldComponentUpdate,a=F.componentWillUpdate;F.componentWillUpdate=function(l,f,c){if(this.__e){var h=i;i=void 0,r(l,f,c),i=h}a&&a.call(this,l,f,c)},F.shouldComponentUpdate=r}return o.__N||o.__}function K(e,t){var n=He(pe++,3);!N.__s&&rt(n.__H,t)&&(n.__=e,n.u=t,F.__H.__h.push(n))}function nn(e,t){var n=He(pe++,4);!N.__s&&rt(n.__H,t)&&(n.__=e,n.u=t,F.__h.push(n))}function V(e){return ye=5,ie(function(){return{current:e}},[])}function ie(e,t){var n=He(pe++,7);return rt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Z(e,t){return ye=8,ie(function(){return e},t)}function oo(){for(var e;e=tn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some($e),t.__h.some(ot),t.__h=[]}catch(n){t.__h=[],N.__e(n,e.__v)}}}N.__b=function(e){F=null,Yt&&Yt(e)},N.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Zt&&Zt(e,t)},N.__r=function(e){Gt&&Gt(e),pe=0;var t=(F=e.__c).__H;t&&(nt===F?(t.__h=[],F.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some($e),t.__h.some(ot),t.__h=[],pe=0)),nt=F},N.diffed=function(e){Xt&&Xt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(tn.push(t)!==1&&Vt===N.requestAnimationFrame||((Vt=N.requestAnimationFrame)||ro)(oo)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),nt=F=null},N.__c=function(e,t){t.some(function(n){try{n.__h.some($e),n.__h=n.__h.filter(function(o){return!o.__||ot(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],N.__e(o,n.__v)}}),Jt&&Jt(e,t)},N.unmount=function(e){Qt&&Qt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{$e(o)}catch(r){t=r}}),n.__H=void 0,t&&N.__e(t,n.__v))};var en=typeof requestAnimationFrame=="function";function ro(e){var t,n=function(){clearTimeout(o),en&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);en&&(t=requestAnimationFrame(n))}function $e(e){var t=F,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),F=t}function ot(e){var t=F;e.__c=e.__(),F=t}function rt(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function on(e,t){return typeof t=="function"?t(e):t}function rn(e,t,n){return n<t?t:Math.min(Math.max(e,t),n)}function it(e,t){let n=Math.min(e.x,t.x),o=Math.min(e.y,t.y);return{x:n,y:o,width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}function io(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return n*o}function at(e,t){let n=e.width*e.height;return n>0?io(e,t)/n:0}function an(e,t,n,o=12,r=10,i=o){let a=Math.max(o,i),l=n.height-(e.y+e.height)-o,f=e.y-a,c=n.width-(e.x+e.width)-o,h=e.x-o,_;l>=t.height+r?_="below":f>=t.height+r?_="above":c>=t.width+r?_="right":h>=t.width+r?_="left":_=l>=f?"below":"above";let s=_==="right"?e.x+e.width+r:_==="left"?e.x-t.width-r:e.x,m=_==="below"?e.y+e.height+r:_==="above"?e.y-t.height-r:e.y;return{left:rn(s,o,n.width-t.width-o),top:rn(m,a,n.height-t.height-o),placement:_}}function ao(e,t){let n=e.startsWith("#")?e.slice(1):e;if(!n.includes(`${t}=`))return{token:null,remainingHash:e};let o=new URLSearchParams(n),r=o.get(t);o.delete(t);let i=o.toString();return{token:r?.trim()||null,remainingHash:i?`#${i}`:""}}function Be(e){return ao(e,"visual-pair")}function st(e,t){return e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&!t}function P(e,t){let n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}\u2026`}var ct="visual-bridge:pairing-token";var sn="visual-bridge:browser-session",ln="visual-bridge:last-sequence",so="visual-bridge:viewer-last-sequence",co=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying","review","accepted","reverted","failed","canceled","unsafe"]);function Ue(e){try{return sessionStorage.getItem(e)}catch{return null}}function lt(e,t){try{sessionStorage.setItem(e,t)}catch{}}function lo(e){try{sessionStorage.removeItem(e)}catch{}}function un(e){try{return JSON.parse(e)}catch{return e}}function D(e){return typeof e=="object"&&e!==null?e:null}function dn(){let e=Be(location.hash);if(e.token){Ue(ct)!==e.token&&lo(ln),lt(ct,e.token);let t=`${location.pathname}${location.search}${e.remainingHash}`;return history.replaceState(history.state,"",t),e.token}return Ue(ct)??""}function pn(){let e=Ue(sn);if(e)return e;let t=crypto.randomUUID();return lt(sn,t),t}function uo(e){let t=Ue(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)&&n>=0?n:null}function po(){let e=new URL("/_visual/ws",location.href);return e.protocol=location.protocol==="https:"?"wss:":"ws:",e.href}var je=class{browserSessionId;token;mode;getPageState;sequenceStorageKey;onSnapshot;onEvent;onSequenceGap;socket=null;heartbeatTimer;reconnectTimer;reconnectAttempt=0;manuallyClosed=!1;state="connecting";projectId;lastSequence;hasReplaySequence;constructor(t){this.token=t.token,this.browserSessionId=t.browserSessionId,this.mode=t.mode??"control",this.getPageState=t.getPageState??(()=>({})),this.sequenceStorageKey=this.mode==="viewer"?so:ln;let n=uo(this.sequenceStorageKey);this.lastSequence=n??0,this.hasReplaySequence=n!==null||this.mode==="control",this.onSnapshot=t.onSnapshot,this.onEvent=t.onEvent,this.onSequenceGap=t.onSequenceGap??(()=>{})}connect(){this.manuallyClosed=!1,this.openSocket()}close(){this.manuallyClosed=!0,this.clearTimers(),this.socket?.close(),this.socket=null}send(t,n){if(this.socket?.readyState!==WebSocket.OPEN)return!1;let o={id:crypto.randomUUID(),type:t,browserSessionId:this.browserSessionId,payload:n};return this.socket.send(JSON.stringify(o)),!0}emitSnapshot(){this.onSnapshot({state:this.state,...this.projectId?{projectId:this.projectId}:{},lastSequence:this.lastSequence})}openSocket(){this.clearTimers(),this.state=this.reconnectAttempt>0?"reconnecting":"connecting",this.emitSnapshot();let t;try{t=new WebSocket(po())}catch{this.scheduleReconnect();return}this.socket=t,t.addEventListener("open",()=>{this.reconnectAttempt=0,this.send("auth",{token:this.token})}),t.addEventListener("message",n=>{this.handleMessage(String(n.data))}),t.addEventListener("close",n=>{if(this.socket=null,n.code===4001||n.code===4401){this.state="unauthorized",this.emitSnapshot();return}this.manuallyClosed||this.scheduleReconnect()}),t.addEventListener("error",()=>{this.state==="connecting"&&(this.state="offline",this.emitSnapshot())})}handleMessage(t){let n=D(un(t));if(!(!n||typeof n.type!="string")){if(n.type==="auth.ok"){this.projectId=typeof n.projectId=="string"?n.projectId:this.projectId,this.state="connected",this.emitSnapshot(),this.send("browser.hello",{...this.hasReplaySequence?{lastSeq:this.lastSequence}:{},...this.mode==="control"?this.getPageState():{}}),this.mode==="control"&&(this.heartbeatTimer=window.setInterval(()=>{this.send("browser.heartbeat",{lastSeq:this.lastSequence,...this.getPageState()})},15e3));return}if(n.type==="auth.error"||n.type==="error.unauthorized"){this.state="unauthorized",this.emitSnapshot(),this.socket?.close(4401,"Pairing rejected");return}if(typeof n.seq=="number"){if(n.seq<=this.lastSequence&&this.hasReplaySequence)return;this.hasReplaySequence&&n.seq>this.lastSequence+1&&this.onSequenceGap({expectedSequence:this.lastSequence+1,receivedSequence:n.seq}),this.lastSequence=n.seq,this.hasReplaySequence=!0,lt(this.sequenceStorageKey,String(this.lastSequence)),this.emitSnapshot()}typeof n.projectId=="string"&&(this.projectId=n.projectId),this.onEvent(n)}}scheduleReconnect(){if(this.clearTimers(),this.manuallyClosed)return;this.reconnectAttempt+=1,this.state="reconnecting",this.emitSnapshot();let t=Math.min(1e4,500*2**(this.reconnectAttempt-1));this.reconnectTimer=window.setTimeout(()=>this.openSocket(),t)}clearTimers(){this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)}};async function ae(e,t,n){let o=new Headers(n?.headers);e&&o.set("Authorization",`Bearer ${e}`),n?.body&&!o.has("Content-Type")&&o.set("Content-Type","application/json");let r=await fetch(t,{...n,headers:o});if(!r.ok){let i=P(await r.text(),180);throw new Error(i||`Bridge request failed (${r.status} ${r.statusText})`)}return r}async function se(e){let t=await e.text();return t?un(t):null}async function fn(e){let t=await se(await ae(e,"/_visual/api/viewer-session")),n=D(t)?.viewerUrl;if(typeof n!="string"||!n.startsWith("/_visual/viewer#visual-view="))throw new Error("Bridge returned an invalid viewer session URL");return n}async function mn(e){let t=await se(await ae(e,"/_visual/api/project")),n=D(t),o=D(n?.project);return typeof n?.id=="string"?n.id:typeof n?.projectId=="string"?n.projectId:typeof o?.id=="string"?o.id:void 0}async function fo(e,t={}){let n=new URLSearchParams;t.limit!==void 0&&n.set("limit",String(t.limit)),t.cursor!==void 0&&(n.set("before",t.cursor.createdAt),n.set("beforeId",t.cursor.id));let o=n.toString(),r=o?`?${o}`:"",i=await se(await ae(e,`/_visual/api/tasks${r}`)),a=D(i);return(Array.isArray(i)?i:Array.isArray(a?.tasks)?a.tasks:[]).filter(f=>{let c=D(f);return typeof c?.id=="string"&&typeof c.projectId=="string"&&typeof c.status=="string"&&co.has(c.status)&&typeof c.requestText=="string"&&(c.scope==="instance"||c.scope==="component"||c.scope==="page"||c.scope==="project")&&typeof c.originBrowserSessionId=="string"&&Array.isArray(c.changedFiles)&&c.changedFiles.every(h=>typeof h=="string")&&typeof c.createdAt=="string"})}async function gn(e,t){let n=await fo(e);for(let o of n)if(o.originBrowserSessionId===t)return o}function cn(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function hn(e){let t=cn(e);if(t.length>0||Array.isArray(e))return t;let n=D(e);return cn(n?.files??n?.changedFiles??n?.data)}function mo(e){if(typeof e=="string")return e;let t=D(e),n=t?.diff??t?.content??t?.data;return typeof n=="string"?n:""}function go(e){let t=/^(?:\/usr)?\/bin\/(?:bash|sh|zsh)\s+-lc\s+([\s\S]+)$/u.exec(e.trim());if(!t?.[1])return e;let n=t[1].trim();return n.length>=2&&(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))?n.slice(1,-1):n}function ho(e){if(typeof e.command!="string")return null;let t=go(e.command),n=e.usedRtk===!0||/^rtk(?:\s|$)/u.test(t)?"RTK":"\uBA85\uB839",r=[typeof e.cwd=="string"?e.cwd.split(/[\\/]/u).filter(Boolean).at(-1):void 0,typeof e.durationMs=="number"?`${e.durationMs}ms`:void 0,e.timedOut===!0?"\uC2DC\uAC04 \uCD08\uACFC":void 0,e.truncated===!0?"\uCD9C\uB825 \uCD95\uC57D":void 0].filter(i=>!!i);return P(`${n} \xB7 ${t}${r.length>0?` \xB7 ${r.join(" \xB7 ")}`:""}`,500)}function _n(e){if(typeof e=="string")return P(e,500);let t=D(e);if(!t)return null;let n=D(t.event)??t,o=typeof n.type=="string"?n.type:void 0;if(o==="command")return ho(n);if(o==="tool_start"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:P(`\uB3C4\uAD6C \uC2DC\uC791 \xB7 ${n.name}${typeof n.summary=="string"?` \xB7 ${n.summary}`:""}`,500);if(o==="tool_end"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:P(`\uB3C4\uAD6C ${n.ok===!1?"\uC2E4\uD328":"\uC644\uB8CC"} \xB7 ${n.name}`,500);if(o==="phase"&&typeof n.name=="string")return P(`\uB2E8\uACC4 \xB7 ${n.name}`,500);if(o==="file_hint"&&typeof n.path=="string")return P(`\uD30C\uC77C \xB7 ${n.path}`,500);if(o==="usage"&&typeof n.inputTokens=="number"&&typeof n.outputTokens=="number")return P(`\uD1A0\uD070 \xB7 \uC785\uB825 ${n.inputTokens.toLocaleString("en-US")}${typeof n.cachedInputTokens=="number"?` \xB7 \uCE90\uC2DC ${n.cachedInputTokens.toLocaleString("en-US")}`:""} \xB7 \uCD9C\uB825 ${n.outputTokens.toLocaleString("en-US")}`,500);let r=n.message??n.text??n.summary??n.command??n.error??t.message;return typeof r=="string"?P(r,500):null}async function bn(e,t,n){let o=`/_visual/api/tasks/${encodeURIComponent(t)}`,r=n===void 0?void 0:{signal:n},[i,a,l]=await Promise.allSettled([ae(e,`${o}/files`,r).then(se),ae(e,`${o}/diff`,r).then(se),ae(e,`${o}/logs`,r).then(se)]),f=[i,a,l].find(E=>E.status==="rejected"&&E.reason instanceof DOMException&&E.reason.name==="AbortError");if(f!==void 0)throw f.reason;let c=i.status==="fulfilled"?hn(i.value):[],h=a.status==="fulfilled"?mo(a.value):"",_=l.status==="fulfilled"?l.value:[],s=D(_),m=Array.isArray(_)?_:Array.isArray(s?.logs)?s.logs:[],T=Array.isArray(m)?m.map(_n).filter(E=>!!E).slice(-40):[],y=[];return i.status==="rejected"&&y.push("files"),a.status==="rejected"&&y.push("diff"),l.status==="rejected"&&y.push("logs"),{changedFiles:c,diff:h,logs:T,unavailable:y}}async function vn(e,t,n){return se(await ae(e,`/_visual/api/tasks/${encodeURIComponent(t)}/${n}`,{method:"POST"}))}function Oe(e){let t=D(e.payload),o=D(t?.task)??t;return o&&typeof o.id=="string"?o:void 0}function xn(e,t,n){let o=Oe(e),r=e.taskId??o?.id;return r?e.type==="task.queued"?o?.originBrowserSessionId===t?{accept:!0,bind:!0,taskId:r}:{accept:!1,bind:!1,taskId:r}:{accept:n===r,bind:!1,taskId:r}:{accept:!1,bind:!1}}function yn(e){let t=Oe(e);if(t?.status)return t.status;let n=D(e.payload),o=n?.phase??n?.status;return typeof o=="string"?o:void 0}function wn(e){let t=D(e.payload);return _n(t?.event??t)}function kn(e){let t=D(e.payload);return hn(t?.changedFiles??t?.files??[])}var ce="__visual_bridge_root",_o=new Set(["SCRIPT","STYLE","META","LINK","NOSCRIPT","TEMPLATE"]),bo=new Set(["alt","aria-label","aria-labelledby","aria-describedby","role","title","type","placeholder","data-testid","data-test-id","data-component","data-component-name","data-source","data-source-file","data-source-line","data-source-column","data-react-source"]),Sn=/(?:auth|cookie|credential|csrf|jwt|key|password|secret|session|token|value)/i,Rn=[["display","display"],["position","position"],["width","width"],["height","height"],["margin","margin"],["padding","padding"],["gap","gap"],["borderRadius","border-radius"],["fontSize","font-size"],["fontWeight","font-weight"],["lineHeight","line-height"],["color","color"],["backgroundColor","background-color"],["flexDirection","flex-direction"],["alignItems","align-items"],["justifyContent","justify-content"],["gridTemplateColumns","grid-template-columns"],["zIndex","z-index"]],vo={a:"link",button:"button",footer:"contentinfo",form:"form",header:"banner",img:"img",main:"main",nav:"navigation",select:"combobox",textarea:"textbox"};function we(e){return typeof e=="object"&&e!==null?e:null}function H(e){let t=e?.trim();return t||void 0}function fe(e){let t=typeof e=="number"?e:Number.parseInt(String(e),10);return Number.isInteger(t)&&t>0?t:void 0}function Pn(e,t){let n=H(typeof e.fileName=="string"?e.fileName:typeof e.filePath=="string"?e.filePath:typeof e.file=="string"?e.file:void 0);if(!n)return;let o=fe(e.lineNumber??e.line),r=fe(e.columnNumber??e.column),i=H(typeof e.componentName=="string"?e.componentName:t);return{filePath:n,...o?{lineNumber:o}:{},...r?{columnNumber:r}:{},...i?{componentName:i}:{}}}function xo(e,t){let n=e.trim();if(!n)return;if(n.startsWith("{"))try{let l=we(JSON.parse(n));return l?Pn(l,t):void 0}catch{return}let o=/^(.*):(\d+)(?::(\d+))?$/.exec(n),r=H(o?.[1]??n);if(!r)return;let i=fe(o?.[2]),a=fe(o?.[3]);return{filePath:r,...i?{lineNumber:i}:{},...a?{columnNumber:a}:{},...t?{componentName:t}:{}}}function yo(e){let t=H(e.getAttribute("data-component-name"))??H(e.getAttribute("data-component")),n=e.getAttribute("data-react-source")??e.getAttribute("data-source");if(n){let a=xo(n,t);if(a)return a}let o=H(e.getAttribute("data-source-file")??e.getAttribute("data-file")??void 0);if(!o)return;let r=fe(e.getAttribute("data-source-line")),i=fe(e.getAttribute("data-source-column"));return{filePath:o,...r?{lineNumber:r}:{},...i?{columnNumber:i}:{},...t?{componentName:t}:{}}}function wo(e){let t=e.type;if(typeof t=="function"){let o=t;return H(typeof o.displayName=="string"?o.displayName:typeof o.name=="string"?o.name:void 0)}let n=we(t);return H(typeof n?.displayName=="string"?n.displayName:typeof n?.name=="string"?n.name:void 0)}function ko(e,t){let n=typeof e=="string"?e:e instanceof Error?e.stack:void 0;if(!n)return[];let o=[];for(let r of n.split(`
|
|
2
|
+
`)){let i=/(?:\(|\s)([^()\s]+):(\d+):(\d+)\)?$/.exec(r.trim());if(!(!i?.[1]||i[1].includes("node_modules"))&&(o.push({filePath:i[1],lineNumber:Number(i[2]),columnNumber:Number(i[3]),...t?{componentName:t}:{}}),o.length===8))break}return o}function Tn(e){let t=e,n=Object.keys(t).find(a=>a.startsWith("__reactFiber$")||a.startsWith("__reactInternalInstance$")),o=n?we(t[n]):null,r=[],i=new Set;for(let a=0;o&&a<20&&r.length<8;a+=1){let l=wo(o),f=we(o._debugSource),c=f?Pn(f,l):void 0,h=c?[c]:ko(o._debugStack,l);for(let _ of h){let s=`${_.filePath}:${_.lineNumber??0}:${_.columnNumber??0}`;if(i.has(s)||(r.push(_),i.add(s)),r.length===8)break}o=we(o.return)}return r}function So(e){let t=e;for(let o=0;t&&o<5;o+=1){let r=yo(t);if(r){let i=Tn(e);return{primary:r,stack:[r,...i].filter((a,l,f)=>f.findIndex(c=>c.filePath===a.filePath&&c.lineNumber===a.lineNumber&&c.columnNumber===a.columnNumber)===l).slice(0,8),confidence:o===0?"exact":"probable"}}t=t.parentElement}let n=Tn(e);return n.length>0?{primary:n[0],stack:n,confidence:"probable"}:{stack:[],confidence:"unknown"}}function To(e){if(e.id===ce||e.closest(`#${ce}`))return!0;let t=e.getRootNode();return t instanceof ShadowRoot&&t.host.id===ce}function me(e){if(!(e instanceof HTMLElement)||_o.has(e.tagName)||To(e))return!1;let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return n.display!=="none"&&n.visibility!=="hidden"&&Number.parseFloat(n.opacity||"1")>0}function dt(e,t){for(let n of document.elementsFromPoint(e,t))if(me(n))return n;return null}function Eo(e){let t={};for(let n of e.attributes){let o=n.name.toLowerCase(),r=o.startsWith("data-")&&!Sn.test(o)&&/(?:component|source|test|qa|variant)/i.test(o);(bo.has(o)||r)&&!Sn.test(o)&&(t[o]=P(n.value,200))}return t}function De(e){return H(e.getAttribute("role"))??vo[e.tagName.toLowerCase()]??(e instanceof HTMLInputElement?"textbox":void 0)}function pt(e){let t=H(e.getAttribute("aria-label"));if(t)return P(t,200);if(e instanceof HTMLImageElement)return H(e.alt);if(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement){let o=e.labels?.[0],r=H(o?.innerText);return r?P(r,200):H(e.getAttribute("placeholder"))}let n=H(e.innerText);return n?P(n,200):H(e.title)}function En(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,t=>`\\${t}`)}function Co(e){let t=e.getAttribute("data-testid")??e.getAttribute("data-test-id");if(t)return`[data-testid="${En(t)}"]`;if(e.id)return`#${En(e.id)}`;let n=[],o=e;for(;o&&o!==document.body&&n.length<5;){let r=o.parentElement,i=o.tagName.toLowerCase(),a=o.tagName;if(!r){n.unshift(i);break}let l=Array.from(r.children).filter(c=>c.tagName===a),f=l.length>1?`:nth-of-type(${l.indexOf(o)+1})`:"";n.unshift(`${i}${f}`),o=r}return n.join(" > ")}function Ro(e){let t=[],n=e.getAttribute("data-testid")??e.getAttribute("data-test-id");n&&t.push({type:"testid",value:n,confidence:1}),e.id&&t.push({type:"id",value:e.id,confidence:.98});let o=De(e),r=pt(e);o&&t.push({type:"role",value:r?`${o}:${r}`:o,confidence:r?.9:.72});let i=Co(e);i&&(t.push({type:"css",value:i,confidence:.68}),t.push({type:"dom-path",value:i,confidence:.5}));let a=H(e.innerText);return a&&!(e instanceof HTMLInputElement)&&t.push({type:"text",value:P(a,100),confidence:.45}),t}var Cn={testid:0,id:1,role:2,css:3,"dom-path":4,text:5},Po=new Map(Rn);function ut(e,t){let n=0;for(let o of e){if(n+=1,n>2500)break;if(me(o)&&t(o))return o}return null}function Lo(e,t){try{let n=e.querySelector(t);return n&&me(n)?n:null}catch{return null}}function Ao(e,t,n){if(n.type==="testid")return ut(e.querySelectorAll("[data-testid], [data-test-id]"),r=>r.getAttribute("data-testid")===n.value||r.getAttribute("data-test-id")===n.value);if(n.type==="id"){let r=e.getElementById(n.value);return r&&me(r)?r:null}if(n.type==="role"){let r=n.value.indexOf(":"),i=t.dom.role??(r<0?n.value:n.value.slice(0,r)),a=t.dom.accessibleName??(r<0?void 0:n.value.slice(r+1));return ut(e.querySelectorAll("[role], a[href], button, footer, form, header, img, input, main, nav, select, textarea"),l=>De(l)===i&&(a===void 0||pt(l)===a))}if(n.type==="css"||n.type==="dom-path")return Lo(e,n.value);let o=P(n.value,100);return ut(e.querySelectorAll("*"),r=>r.tagName.toLowerCase()!==t.dom.tagName?!1:P(r.innerText??"",100)===o)}function Io(e,t){let n=[...e.dom.locatorCandidates].sort((o,r)=>Cn[o.type]-Cn[r.type]||r.confidence-o.confidence);for(let o of n){let r=Ao(t,e,o);if(r)return r}return null}function qo(e,t){if(e.dom.text!==void 0&&P(t.innerText??"",500)!==e.dom.text)return!0;let n=getComputedStyle(t);return Object.entries(e.styles).some(([o,r])=>{let i=Po.get(o);return i!==void 0&&n.getPropertyValue(i)!==r})}function Ln(e,t=document){if(e.length===0)return{state:"unverified",targetCount:0,foundCount:0,changedCount:0};let n=0,o=0;for(let r of e){let i=Io(r,t);i&&(n+=1,qo(r,i)&&(o+=1))}return{state:n!==e.length?"not-found":o>0?"found-and-changed":"found-no-visible-change",targetCount:e.length,foundCount:n,changedCount:o}}function Fo(e){let t=[],n=e.parentElement;for(;n&&n!==document.body&&t.length<8;){let o=n.parentElement?Array.from(n.parentElement.children).indexOf(n):void 0,r=H(n.id);t.unshift({tagName:n.tagName.toLowerCase(),...r?{id:r}:{},classNames:Array.from(n.classList).slice(0,20),...o!==void 0&&o>=0?{siblingIndex:o}:{}}),n=n.parentElement}return t}function le(e){let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}}async function ge(e,t){await Promise.resolve();let n=getComputedStyle(e),o=Array.from(e.classList).slice(0,100);for(;o.join(" ").length>2e3;)o.pop();let r={};for(let[h,_]of Rn){let s=n.getPropertyValue(_);s&&(r[h]=P(s,160))}let i=H(e.id),a=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?void 0:H(e.innerText),l=De(e),f=pt(e),c=So(e);return{targetId:crypto.randomUUID(),order:t,dom:{tagName:e.tagName.toLowerCase(),...i?{id:i}:{},classNames:o,...a?{text:P(a,500)}:{},...l?{role:l}:{},...f?{accessibleName:P(f,200)}:{},attributes:Eo(e),rect:le(e),locatorCandidates:Ro(e),parentPath:Fo(e)},styles:r,source:c}}function An(e){let t=[],n=Math.max(e.width*e.height,1),o=document.body?.querySelectorAll("*")??[],r=0;for(let i of o){if(r+=1,r>4e3)break;if(!me(i))continue;let a=le(i),l=at(a,e);if(l<=0)continue;let c=!!De(i)||/^(A|BUTTON|INPUT|SELECT|TEXTAREA|SUMMARY)$/.test(i.tagName),h=a.width*a.height/n,_=i.children.length<=2;!c&&!_&&h>.88||!c&&l<.12||t.push({element:i,score:l+(c?1.5:0)+(_?.35:0),index:r})}return t.sort((i,a)=>a.score-i.score||i.index-a.index).slice(0,20).sort((i,a)=>i.index-a.index).map(({element:i})=>i)}function ze(){let e=["main","header","nav","aside","footer","[role='main']","[role='navigation']","h1","h2","button","a[href]","input","select","textarea","[role='button']"],t=[],n=new Set;for(let o of document.querySelectorAll(e.join(",")))if(!(n.has(o)||!me(o)||at(le(o),{x:0,y:0,width:innerWidth,height:innerHeight})<=0)&&(t.push(o),n.add(o),t.length===20))break;return t}function ft(e){let t=e.targets.map((o,r)=>({...o,order:r})),n=e.mode==="element"?{mode:"element",targets:t.slice(0,1)}:e.mode==="multi"?{mode:"multi",targets:t.slice(0,8)}:e.mode==="region"?{mode:"region",region:e.region??{x:0,y:0,width:0,height:0},targets:t.slice(0,20)}:{mode:"page",targets:t.slice(0,20)};return{version:1,projectId:e.projectId||"current",browserSessionId:e.browserSessionId,page:{url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},devicePixelRatio:devicePixelRatio||1,scroll:{x:scrollX,y:scrollY},renderRevision:e.renderRevision},selection:n,request:{text:e.requestText.trim(),scope:e.scope}}}var In=String.raw`
|
|
3
3
|
--graphite: #20211f;
|
|
4
4
|
--graphite-2: #30312e;
|
|
5
5
|
--strip: #f4efe3;
|
|
@@ -11,7 +11,7 @@ var Fe,C,Pt,Kn,oe,Tt,Lt,It,Ye,Re,ve,At,Je,Ge,Xe,Wn,Ie={},Ae=[],Vn=/acit|ex(?:s|g
|
|
|
11
11
|
--dispatch-dark: #9f3108;
|
|
12
12
|
--verified: #087f8c;
|
|
13
13
|
--danger: #a72920;
|
|
14
|
-
`;var
|
|
14
|
+
`;var qn=String.raw`
|
|
15
15
|
:host {
|
|
16
16
|
all: initial;
|
|
17
17
|
position: fixed;
|
|
@@ -35,7 +35,7 @@ var Fe,C,Pt,Kn,oe,Tt,Lt,It,Ye,Re,ve,At,Je,Ge,Xe,Wn,Ie={},Ae=[],Vn=/acit|ex(?:s|g
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.visual-shell {
|
|
38
|
-
${
|
|
38
|
+
${In}
|
|
39
39
|
position: fixed;
|
|
40
40
|
inset: 0;
|
|
41
41
|
color: var(--ink);
|
|
@@ -48,11 +48,15 @@ var Fe,C,Pt,Kn,oe,Tt,Lt,It,Ye,Re,ve,At,Je,Ge,Xe,Wn,Ie={},Ae=[],Vn=/acit|ex(?:s|g
|
|
|
48
48
|
|
|
49
49
|
.visual-shell[data-open="false"] {
|
|
50
50
|
pointer-events: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.visual-shell[data-open="false"] > :not(.task-compact):not(.visually-hidden) {
|
|
51
54
|
visibility: hidden;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
.visual-shell[data-open="true"] .toolbar,
|
|
55
|
-
.visual-shell[data-open="true"] .strip
|
|
58
|
+
.visual-shell[data-open="true"] .strip,
|
|
59
|
+
.task-compact {
|
|
56
60
|
pointer-events: auto;
|
|
57
61
|
}
|
|
58
62
|
|
|
@@ -159,6 +163,103 @@ var Fe,C,Pt,Kn,oe,Tt,Lt,It,Ye,Re,ve,At,Je,Ge,Xe,Wn,Ie={},Ae=[],Vn=/acit|ex(?:s|g
|
|
|
159
163
|
display: none;
|
|
160
164
|
}
|
|
161
165
|
|
|
166
|
+
.task-compact {
|
|
167
|
+
position: fixed;
|
|
168
|
+
top: max(62px, calc(env(safe-area-inset-top) + 50px));
|
|
169
|
+
right: 12px;
|
|
170
|
+
z-index: 4;
|
|
171
|
+
display: flex;
|
|
172
|
+
width: min(360px, calc(100vw - 24px));
|
|
173
|
+
min-height: 48px;
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
background: var(--strip);
|
|
176
|
+
border: 1px solid #272821;
|
|
177
|
+
border-radius: 4px 4px 11px 4px;
|
|
178
|
+
box-shadow: 0 5px 18px rgb(0 0 0 / 28%);
|
|
179
|
+
color: var(--ink);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.task-compact::after {
|
|
183
|
+
position: absolute;
|
|
184
|
+
right: 0;
|
|
185
|
+
bottom: 0;
|
|
186
|
+
left: 0;
|
|
187
|
+
height: 2px;
|
|
188
|
+
content: "";
|
|
189
|
+
background: var(--verified);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.task-compact[data-active="true"]::after {
|
|
193
|
+
width: 36%;
|
|
194
|
+
background: var(--dispatch);
|
|
195
|
+
animation: task-route 1.25s cubic-bezier(.16, 1, .3, 1) infinite;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.task-compact[data-error="true"]::after {
|
|
199
|
+
width: 100%;
|
|
200
|
+
background: var(--danger);
|
|
201
|
+
animation: none;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.task-compact-main {
|
|
205
|
+
display: grid;
|
|
206
|
+
flex: 1;
|
|
207
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
208
|
+
align-items: center;
|
|
209
|
+
gap: 8px;
|
|
210
|
+
min-width: 0;
|
|
211
|
+
min-height: 48px;
|
|
212
|
+
padding: 6px 9px 7px 10px;
|
|
213
|
+
border: 0;
|
|
214
|
+
background: transparent;
|
|
215
|
+
color: var(--ink);
|
|
216
|
+
cursor: pointer;
|
|
217
|
+
text-align: left;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.task-compact-main:hover {
|
|
221
|
+
background: var(--strip-strong);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.task-compact-copy {
|
|
225
|
+
display: grid;
|
|
226
|
+
gap: 1px;
|
|
227
|
+
min-width: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.task-compact-copy strong,
|
|
231
|
+
.task-compact-request {
|
|
232
|
+
overflow: hidden;
|
|
233
|
+
text-overflow: ellipsis;
|
|
234
|
+
white-space: nowrap;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.task-compact-copy strong {
|
|
238
|
+
font-size: 12px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.task-compact-request {
|
|
242
|
+
color: var(--muted);
|
|
243
|
+
font-size: 12px;
|
|
244
|
+
line-height: 1.35;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.task-compact-cancel {
|
|
248
|
+
align-self: stretch;
|
|
249
|
+
min-width: 52px;
|
|
250
|
+
padding: 0 9px;
|
|
251
|
+
border: 0;
|
|
252
|
+
border-left: 1px solid var(--rule);
|
|
253
|
+
background: transparent;
|
|
254
|
+
color: var(--danger);
|
|
255
|
+
cursor: pointer;
|
|
256
|
+
font-weight: 650;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.task-compact-cancel:hover {
|
|
260
|
+
background: #f7dfdb;
|
|
261
|
+
}
|
|
262
|
+
|
|
162
263
|
.state-dot {
|
|
163
264
|
width: 7px;
|
|
164
265
|
height: 7px;
|
|
@@ -723,7 +824,14 @@ var Fe,C,Pt,Kn,oe,Tt,Lt,It,Ye,Re,ve,At,Je,Ge,Xe,Wn,Ie={},Ae=[],Vn=/acit|ex(?:s|g
|
|
|
723
824
|
.toolbar button,
|
|
724
825
|
.toolbar a {
|
|
725
826
|
min-width: 46px;
|
|
726
|
-
min-height:
|
|
827
|
+
min-height: 44px;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
.task-compact {
|
|
831
|
+
top: max(66px, calc(env(safe-area-inset-top) + 58px));
|
|
832
|
+
right: 8px;
|
|
833
|
+
left: 8px;
|
|
834
|
+
width: auto;
|
|
727
835
|
}
|
|
728
836
|
|
|
729
837
|
.connection {
|
|
@@ -772,4 +880,4 @@ var Fe,C,Pt,Kn,oe,Tt,Lt,It,Ye,Re,ve,At,Je,Ge,Xe,Wn,Ie={},Ae=[],Vn=/acit|ex(?:s|g
|
|
|
772
880
|
animation: none !important;
|
|
773
881
|
}
|
|
774
882
|
}
|
|
775
|
-
`;var Io=0;function p(e,t,n,o,r,i){t||(t={});var s,l,f=t;if("ref"in f)for(l in f={},t)l=="ref"?s=t[l]:f[l]=t[l];var c={type:e,props:f,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Io,__i:-1,__u:0,__source:r,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)f[l]===void 0&&(f[l]=s[l]);return C.vnode&&C.vnode(c),c}var qn={queued:"\uB300\uAE30 \uC911",preparing:"\uC791\uC5C5 \uC900\uBE44",snapshotting_before:"\uBCC0\uACBD \uC804 \uC2A4\uB0C5\uC0F7",resolving_context:"\uC18C\uC2A4 \uD655\uC778",running_agent:"\uC5D0\uC774\uC804\uD2B8 \uC218\uC815 \uC911",snapshotting_after:"\uBCC0\uACBD \uD6C4 \uC2A4\uB0C5\uC0F7",diffing:"\uBCC0\uACBD \uBC94\uC704 \uACC4\uC0B0",waiting_hmr:"\uD654\uBA74 \uBC18\uC601 \uB300\uAE30",verifying:"\uAC80\uC99D \uC911",review:"\uAC80\uD1A0 \uB300\uAE30",accepted:"\uBCC0\uACBD \uC720\uC9C0",reverted:"\uB418\uB3CC\uB9AC\uAE30 \uC644\uB8CC",failed:"\uC791\uC5C5 \uC2E4\uD328",canceled:"\uC791\uC5C5 \uCDE8\uC18C",unsafe:"\uC548\uC804 \uD655\uC778 \uD544\uC694"},Fn={unpaired:"\uD398\uC5B4\uB9C1 \uD544\uC694",connecting:"\uC5F0\uACB0 \uC911",connected:"Bridge \uC5F0\uACB0\uB428",reconnecting:"\uC7AC\uC5F0\uACB0 \uC911",offline:"Bridge \uC751\uB2F5 \uC5C6\uC74C",unauthorized:"\uD398\uC5B4\uB9C1 \uAC70\uBD80\uB428"},Ao={unpaired:"\uD398\uC5B4\uB9C1",connecting:"\uC5F0\uACB0 \uC911",connected:"\uC5F0\uACB0\uB428",reconnecting:"\uC7AC\uC5F0\uACB0",offline:"\uC751\uB2F5 \uC5C6\uC74C",unauthorized:"\uAC70\uBD80\uB428"},Se=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying"]),qo=new Set(["failed","unsafe"]);function we(e){return e.composedPath().some(t=>t instanceof HTMLElement&&t.id===le)}function Fo(e){if(!e)return"\uD604\uC7AC \uD398\uC774\uC9C0";if(!e.context)return"\uC18C\uC2A4 \uC704\uCE58 \uD655\uC778 \uC911\u2026";let t=e.context.source.primary;if(t){let r=t.lineNumber?`:${t.lineNumber}`:"";return`${t.componentName?`${t.componentName} \xB7 `:""}${t.filePath}${r}`}let n=e.context.dom,o=n.id?`#${n.id}`:n.classNames[0]?`.${n.classNames[0]}`:"";return`${n.tagName}${o} \xB7 source unknown`}function Mo(e){switch(e){case"passed":return"\uAC80\uC99D \uD1B5\uACFC";case"partial":return"\uBD80\uBD84 \uAC80\uC99D";case"failed":return"\uAC80\uC99D \uC2E4\uD328";default:return"\uBBF8\uAC80\uC99D"}}function No(e){if(e instanceof Error)return e.stack??e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function In({rect:e,kind:t,label:n}){return p("div",{class:"reticle","data-kind":t,style:{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`},"aria-hidden":"true",children:n?p("span",{class:"reticle-label",children:n}):null})}function Ho({panelRef:e,position:t,selection:n,mode:o,connectionState:r,requestText:i,scope:s,composingRef:l,onRequestText:f,onScope:c,onSubmit:m}){let h=V(null),a=n[0],g=n.filter(x=>!x.context).length;W(()=>{h.current?.focus()},[]);let k=x=>{st({key:x.key,shiftKey:x.shiftKey,isComposing:x.isComposing},!!l.current)&&(x.preventDefault(),m())};return p("section",{ref:e,class:"strip",style:{left:`${t.left}px`,top:`${t.top}px`},"aria-label":o==="region"?"\uC601\uC5ED \uC218\uC815 \uC694\uCCAD \uC791\uC131":"\uC218\uC815 \uC694\uCCAD \uC791\uC131",children:[p("header",{class:"strip-head",children:[p("span",{class:"strip-title",children:o==="region"?"\uB4DC\uB798\uADF8\uD55C \uD654\uBA74 \uC601\uC5ED":Fo(a)}),p("span",{class:"strip-code machine",children:o==="element"?"TARGET 1":o==="multi"?`TARGETS ${n.length}/8`:o==="region"?"REGION":"PAGE"})]}),p("div",{class:"strip-body",children:[p("div",{class:"selection-readout",children:[p("strong",{children:o==="page"?"\uD604\uC7AC \uD398\uC774\uC9C0 \uCEE8\uD14D\uC2A4\uD2B8":o==="region"?"\uC601\uC5ED \uC120\uD0DD\uB428":`${n.length}\uAC1C \uB300\uC0C1 \uC120\uD0DD`}),p("span",{children:g>0?o==="region"?`\uBC94\uC704 \uC548 \uC694\uC18C ${g}\uAC1C \uD655\uC778 \uC911`:`\uC18C\uC2A4 ${g}\uAC1C \uD655\uC778 \uC911`:o==="region"?`\uBC94\uC704 \uC548 \uC694\uC18C ${n.length}\uAC1C \uD3EC\uD568`:"\uCEE8\uD14D\uC2A4\uD2B8 \uC900\uBE44\uB428"})]}),p("label",{class:"visually-hidden",for:"visual-request",children:"\uC218\uC815 \uC694\uCCAD"}),p("textarea",{ref:h,id:"visual-request",class:"request-field",value:i,maxLength:1e4,placeholder:"\uC120\uD0DD\uD55C \uD654\uBA74\uC744 \uC5B4\uB5BB\uAC8C \uBC14\uAFC0\uAE4C\uC694?",onInput:x=>f(x.currentTarget.value),onCompositionStart:()=>{l.current=!0},onCompositionEnd:()=>{l.current=!1},onKeyDown:k}),p("p",{class:"input-note",children:"Enter\uB85C \uBCF4\uB0B4\uAE30 \xB7 Shift+Enter\uB85C \uC904\uBC14\uAFC8"}),p("div",{class:"request-meta",children:[p("label",{class:"field-label",children:["\uC801\uC6A9 \uBC94\uC704",p("select",{value:s,onChange:x=>c(x.currentTarget.value),children:[p("option",{value:"instance",children:"\uC120\uD0DD\uD55C \uC778\uC2A4\uD134\uC2A4"}),p("option",{value:"component",children:"\uACF5\uC6A9 \uCEF4\uD3EC\uB10C\uD2B8"}),p("option",{value:"page",children:"\uD604\uC7AC \uD398\uC774\uC9C0"}),p("option",{value:"project",children:"\uD504\uB85C\uC81D\uD2B8 \uC804\uCCB4"})]})]}),p("button",{type:"button",class:"primary",disabled:!i.trim()||g>0||r!=="connected",onClick:m,children:"\uC694\uCCAD \uBCF4\uB0B4\uAE30"})]}),r!=="connected"?p("div",{class:"error-banner",role:"status",children:["\uC5F0\uACB0 \uC0C1\uD0DC: ",Fn[r],". Bridge \uC5F0\uACB0 \uD6C4 \uC694\uCCAD\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."]}):null]})]})}function $o({panelRef:e,position:t,task:n,followUpOpen:o,followUpText:r,composingRef:i,busyAction:s,onCancel:l,onAccept:f,onRevert:c,onToggleFollowUp:m,onFollowUpText:h,onFollowUp:a,onNewRequest:g,onDismiss:k}){let x=Se.has(n.status),E=n.changedFiles.length>0||!!n.diff,b=n.status==="review"||(n.status==="failed"||n.status==="canceled")&&E,w=n.status==="review"||n.status==="accepted"||n.status==="reverted",P=n.status==="accepted"||n.status==="reverted"||(n.status==="failed"||n.status==="canceled")&&!E,U=qo.has(n.status)||n.verification==="failed",z=U?"error":n.status==="canceled"?"canceled":w?"complete":"active",Y=n.logs.slice(-4),j=L=>{st({key:L.key,shiftKey:L.shiftKey,isComposing:L.isComposing},!!i.current)&&(L.preventDefault(),a())};return p("section",{id:"visual-task-strip",ref:e,class:"strip",style:{left:`${t.left}px`,top:`${t.top}px`},"aria-label":"\uC791\uC5C5 \uC9C4\uD589\uACFC \uAC80\uD1A0",children:[p("header",{class:"strip-head",children:[p("span",{class:"strip-title",children:I(n.requestText,72)}),p("span",{class:"strip-code machine",children:n.id?`TASK ${n.id.slice(0,8)}`:"DISPATCH"})]}),p("div",{class:"strip-body",children:[p("div",{class:"status-row",role:"status","aria-live":"polite",children:[p("span",{class:"phase-mark","data-state":n.status,"data-terminal":w?"true":"false","data-error":U?"true":"false","aria-hidden":"true"}),p("span",{class:"phase-copy",children:[p("strong",{children:qn[n.status]}),p("span",{children:n.logs.at(-1)??"Bridge\uC5D0\uC11C \uC791\uC5C5 \uC0C1\uD0DC\uB97C \uAE30\uB2E4\uB9AC\uB294 \uC911\uC785\uB2C8\uB2E4."})]}),p("span",{class:"phase-count machine",children:[n.changedFiles.length," files"]})]}),p("div",{class:"progress-track","data-active":x?"true":"false","data-outcome":z,children:p("span",{})}),Y.length>0?p("ul",{class:"log-summary","aria-label":"\uCD5C\uADFC \uC791\uC5C5 \uB85C\uADF8",children:Y.map((L,A)=>p("li",{children:L},`${A}-${L}`))}):p("p",{class:"empty-line",children:"\uC544\uC9C1 \uD45C\uC2DC\uD560 \uC791\uC5C5 \uB85C\uADF8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."}),n.error?p("div",{class:"error-banner",role:"alert",children:["\uC624\uB958: ",n.error]}):null,n.status==="unsafe"?p("div",{class:"error-banner",role:"alert",children:"\uD5C8\uC6A9 \uBC94\uC704 \uBC16\uC758 \uD30C\uC77C \uB610\uB294 Git \uC0C1\uD0DC\uAC00 \uC791\uC5C5 \uC911 \uBC14\uB00C\uC5B4 \uC790\uB3D9 \uC720\uC9C0\xB7\uB418\uB3CC\uB9AC\uAE30\uB97C \uC7A0\uAC14\uC2B5\uB2C8\uB2E4. \uC544\uB798 diff\uC5D0\uB294 \uD5C8\uC6A9\uB41C \uACBD\uB85C\uB9CC \uD45C\uC2DC\uB429\uB2C8\uB2E4. \uC791\uC5C5 \uC624\uB958\uC640 Git \uC0C1\uD0DC\uB97C \uD655\uC778\uD55C \uB4A4 Git\uC5D0\uC11C \uBCC0\uACBD\uC744 \uC9C1\uC811 \uC720\uC9C0\uD558\uAC70\uB098 \uB418\uB3CC\uB9AC\uC138\uC694."}):null,n.changedFiles.length>0||b||w||n.status==="unsafe"?p(te,{children:[p("div",{class:"review-summary",children:[n.changedFiles.length>0?p("ul",{class:"file-list","aria-label":"\uBCC0\uACBD \uD30C\uC77C",children:n.changedFiles.map(L=>p("li",{children:["\u0394\xA0 ",L]},L))}):p("p",{class:"empty-line",children:"\uBCC0\uACBD \uD30C\uC77C\uC774 \uBCF4\uACE0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4."}),p("div",{class:"verification","data-status":n.verification??"unverified",children:[p("strong",{children:"\uAC80\uC99D"}),p("span",{children:Mo(n.verification)})]})]}),p("details",{class:"diff",children:[p("summary",{children:"Unified diff \uBCF4\uAE30"}),p("pre",{class:"diff-code",children:n.diff||"Diff\uB97C \uC544\uC9C1 \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."})]})]}):null,p("div",{class:"actions",children:[x?p("button",{type:"button",class:"quiet",disabled:!n.id||s,onClick:l,children:"\uC791\uC5C5 \uCDE8\uC18C"}):null,b?p(te,{children:[p("button",{type:"button",class:"primary",disabled:!n.id||s,onClick:f,children:"\uBCC0\uACBD \uC720\uC9C0"}),p("button",{type:"button",class:"secondary",disabled:!n.id||s,onClick:m,children:"\uD6C4\uC18D \uC218\uC815"}),p("button",{type:"button",class:"danger",disabled:!n.id||s,onClick:c,children:"\uB418\uB3CC\uB9AC\uAE30"})]}):null,P?p("button",{type:"button",class:"secondary",onClick:g,children:"\uC0C8 \uC694\uCCAD"}):null,x?null:p("button",{type:"button",class:"quiet",title:"\uC791\uC5C5 \uB0B4\uC5ED\uC740 \uC791\uC5C5 \uBCF4\uB4DC\uC5D0 \uB0A8\uAE30\uACE0 \uC774 \uD328\uB110\uB9CC \uB2EB\uAE30",onClick:k,children:"\uB2EB\uAE30"})]}),o&&b?p("div",{class:"follow-up",children:[p("label",{class:"field-label",for:"visual-follow-up",children:"\uD6C4\uC18D \uC218\uC815 \uB0B4\uC6A9"}),p("textarea",{id:"visual-follow-up",class:"request-field",value:r,maxLength:1e4,placeholder:"\uD604\uC7AC \uBCC0\uACBD\uC744 \uAE30\uC900\uC73C\uB85C \uCD94\uAC00\uD560 \uB0B4\uC6A9\uC744 \uC785\uB825\uD558\uC138\uC694.",onInput:L=>h(L.currentTarget.value),onCompositionStart:()=>{i.current=!0},onCompositionEnd:()=>{i.current=!1},onKeyDown:j}),p("button",{type:"button",class:"primary",disabled:!r.trim()||s,onClick:a,children:"\uD6C4\uC18D \uC694\uCCAD \uBCF4\uB0B4\uAE30"})]}):null]})]})}function Bo({host:e}){let t=se(()=>$e(location.hash).token!==null,[]),n=se(cn,[]),o=se(ln,[]),r=V(null),i=V([]),s=V(""),l=V(void 0),f=V(null),c=V(null),m=V(!1),h=V(1),a=V(null),g=V(null),k=V(null),[x,E]=N(t),[b,w]=N("element"),[P,U]=N([]),[z,Y]=N(null),[j,L]=N(null),[A,B]=N(!1),[J,dt]=N(""),[me,De]=N("instance"),[G,Mn]=N(1),[pt,ft]=N(0),[ne,Nn]=N({state:"connecting",lastSequence:0}),[ke,ze]=N("current"),[gt,mt]=N(null),[Hn,ht]=N(!1),[_,K]=N(null),[O,Z]=N(!1),[_t,Ke]=N(!1),[he,bt]=N(""),[$n,vt]=N(!1),[yt,Bn]=N({left:12,top:64,placement:"below"});i.current=P,s.current=J,h.current=G,l.current=_?.id;let Te=Q(()=>({url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},renderRevision:h.current}),[]),Ee=Q(async u=>{let d=await mn(n,u);K(v=>v?.id===u?{...v,changedFiles:d.changedFiles.length>0?d.changedFiles:v.changedFiles,diff:d.diff||v.diff,logs:d.logs.length>0?d.logs:v.logs}:v)},[n]),xt=Q(u=>{let d=Ue(u),v=u.taskId??d?.id,R=bn(u),y=vn(u),T=yn(u);if(u.type==="project.state"){let S=u.payload;typeof S?.projectId=="string"&&ze(S.projectId)}if(u.type==="command.error"){let S=u.payload;typeof S?.message=="string"&&K(F=>F&&{...F,status:F.status==="queued"&&!F.id?"failed":F.status,error:S.message});return}let H=_n(u,o,l.current);if(!(!H.accept||!H.taskId)){if(H.bind&&(l.current=H.taskId),d?.scope&&De(d.scope),u.type==="task.verification_result"){let S=u.payload,F=S.verificationStatus??S.status;typeof F=="string"&&K(X=>X&&{...X,verification:F})}(v||R||y||T.length>0||d)&&K(S=>{let F=S&&(!S.id||S.id===v)?S:{status:R??d?.status??"queued",requestText:d?.requestText??s.current,changedFiles:[],logs:[],diff:""},X=d?.error?.message??u.payload?.error?.message;return{...F,...v?{id:v}:{},status:R??d?.status??F.status,requestText:d?.requestText??F.requestText,changedFiles:T.length>0?T:d?.changedFiles?.length?d.changedFiles:F.changedFiles,logs:y?[...F.logs,y].slice(-40):F.logs,...d?.verificationStatus?{verification:d.verificationStatus}:{},...typeof X=="string"?{error:X}:{}}}),v&&(u.type==="task.diff_ready"||u.type==="task.completed"||u.type==="task.failed")&&Ee(v)}},[o,Ee]);W(()=>{let u=new Be({token:n,browserSessionId:o,getPageState:Te,onSnapshot:d=>{Nn(d),d.projectId&&ze(d.projectId)},onEvent:xt});return r.current=u,u.connect(),dn(n).then(d=>{d&&ze(d)}).catch(()=>{}),pn(n,o).then(d=>{d&&(K(v=>v||(l.current=d.id,{id:d.id,status:d.status,requestText:d.requestText,changedFiles:d.changedFiles,logs:[],diff:"",...d.verificationStatus?{verification:d.verificationStatus}:{},...d.error?.message?{error:d.error.message}:{}})),Ee(d.id))}).catch(()=>{}),()=>{u.close(),r.current=null}},[o,xt,Ee,Te,n]),W(()=>{let u=!0;return ht(!1),un(n).then(d=>{u&&mt(d)}).catch(()=>{u&&(mt(null),ht(!0))}),()=>{u=!1}},[n]),W(()=>{e.dataset.active=x?"true":"false",x&&requestAnimationFrame(()=>{k.current?.querySelector('button[aria-pressed="true"]')?.focus()})},[e,x]),W(()=>{let u,d=new MutationObserver(()=>{u!==void 0&&clearTimeout(u),u=window.setTimeout(()=>{Mn(v=>v+1)},250)});return document.body&&d.observe(document.body,{childList:!0,subtree:!0}),()=>{d.disconnect(),u!==void 0&&clearTimeout(u)}},[]),W(()=>{r.current?.send("browser.page_state",Te())},[Te,G]),W(()=>{if(ne.state!=="connected"||!_?.id||_.verification==="passed"||_.verification==="partial"||_.verification==="failed"||!Se.has(_.status)&&_.status!=="review")return;let u=f.current;if(!u){let T=`${_.id}:page-reloaded`;if(a.current===T)return;r.current?.send("verification.target_state",{taskId:_.id,state:"page-reloaded",renderRevision:G,targetCount:0,foundCount:0,changedCount:0})&&(a.current=T);return}let d=u.selection.targets;if(u.selection.mode==="page"||d.length===0||G<=u.page.renderRevision)return;let v=`${_.id}:${G}`;if(a.current===v)return;let R;try{R=Cn(d)}catch{R={state:"unverified",targetCount:d.length,foundCount:0,changedCount:0}}r.current?.send("verification.target_state",{taskId:_.id,renderRevision:G,...R})&&(a.current=v)},[ne.state,G,_?.id,_?.status,_?.verification]),W(()=>{let u=(S,F)=>{let X=I(F.map(No).join(" "),2e3);X&&r.current?.send("verification.console_events",{events:[{level:S,message:X,createdAt:new Date().toISOString()}]})},d=console.error,v=console.warn,R=(...S)=>{d.apply(console,S),u("error",S)},y=(...S)=>{v.apply(console,S),u("warning",S)},T=S=>{u("error",[S.error instanceof Error?S.error:S.message])},H=S=>{u("unhandled",[S.reason])};return console.error=R,console.warn=y,window.addEventListener("error",T),window.addEventListener("unhandledrejection",H),()=>{console.error===R&&(console.error=d),console.warn===y&&(console.warn=v),window.removeEventListener("error",T),window.removeEventListener("unhandledrejection",H)}},[]);let ie=Q(()=>{U([]),Y(null),L(null),B(!1),dt(""),Ke(!1),c.current=null},[]),_e=Q(u=>{let d=u.map(v=>({id:crypto.randomUUID(),element:v,context:null}));U(d);for(let[v,R]of d.entries())ge(R.element,v).then(y=>{U(T=>T.map(H=>H.id===R.id?{...H,context:y}:H))})},[]),Un=Q(u=>{ie(),Z(!!_),w(u),De(u==="page"?"page":"instance"),u==="page"&&(_e(Oe()),B(!0))},[_e,ie,_]);W(()=>{let u=d=>{if(d.key.toLowerCase()==="g"&&d.shiftKey&&(d.metaKey||d.ctrlKey)){d.preventDefault(),d.stopPropagation(),E(v=>!v);return}x&&(d.key==="Escape"?A?ie():E(!1):d.key==="Enter"&&b==="multi"&&i.current.length>0&&!A&&(!_||O)&&!we(d)&&(d.preventDefault(),B(!0)))};return window.addEventListener("keydown",u,!0),()=>window.removeEventListener("keydown",u,!0)},[b,x,A,ie,_,O]),W(()=>{if(!x||A||_&&Se.has(_.status)&&!O){Y(null);return}let u=y=>{if(b==="region"&&c.current){L(rt(c.current,{x:y.clientX,y:y.clientY}));return}if(b==="page"||we(y))return;let T=ct(y.clientX,y.clientY);Y(H=>H===T?H:T)},d=y=>{y.button!==0||we(y)||b==="page"||(y.preventDefault(),y.stopImmediatePropagation(),b==="region"&&(c.current={x:y.clientX,y:y.clientY},L({x:y.clientX,y:y.clientY,width:0,height:0}),U([])))},v=y=>{if(y.button!==0||we(y)||b==="page"||(y.preventDefault(),y.stopImmediatePropagation(),b!=="region"||!c.current))return;let T=rt(c.current,{x:y.clientX,y:y.clientY});if(c.current=null,T.width<5||T.height<5){L(null);return}L(T),_e(Rn(T)),B(!0)},R=y=>{if(b==="region"||b==="page"||y.button!==0||we(y))return;let T=ct(y.clientX,y.clientY);if(!T)return;if(y.preventDefault(),y.stopImmediatePropagation(),Z(!!_),!(b==="multi"||y.shiftKey)){_e([T]),B(!0);return}b!=="multi"&&w("multi");let S=i.current,F=S.find(be=>be.element===T);if(F){U(S.filter(be=>be.id!==F.id));return}if(S.length>=8)return;let X={id:crypto.randomUUID(),element:T,context:null};U([...S,X]),ge(T,S.length).then(be=>{U(zn=>zn.map(Ve=>Ve.id===X.id?{...Ve,context:be}:Ve))})};return document.addEventListener("pointermove",u,!0),document.addEventListener("pointerdown",d,!0),document.addEventListener("pointerup",v,!0),document.addEventListener("click",R,!0),()=>{document.removeEventListener("pointermove",u,!0),document.removeEventListener("pointerdown",d,!0),document.removeEventListener("pointerup",v,!0),document.removeEventListener("click",R,!0)}},[_e,b,x,A,_,O]),W(()=>{let u=0,d=()=>{cancelAnimationFrame(u),u=requestAnimationFrame(()=>ft(v=>v+1))};return window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),()=>{cancelAnimationFrame(u),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[]),W(()=>{if(!A&&!_)return;let u=g.current;if(!u)return;let d=0,v=new ResizeObserver(()=>{cancelAnimationFrame(d),d=requestAnimationFrame(()=>ft(R=>R+1))});return v.observe(u),()=>{cancelAnimationFrame(d),v.disconnect()}},[A,_?.id]);let wt=se(()=>{if(j)return j;let u=P.at(-1);return u?.element.isConnected?re(u.element):{x:12,y:52,width:1,height:1}},[pt,j,P]);Xt(()=>{if(!A&&!_)return;let u=g.current;if(!u)return;let d=k.current?.getBoundingClientRect().bottom??52;Bn(Zt(wt,{width:u.offsetWidth||408,height:u.offsetHeight||300},{width:innerWidth,height:innerHeight},12,10,d+10))},[wt,_t,A,_?.changedFiles.length,_?.diff,_?.logs.length,_?.status]);let jn=Q(async()=>{let u=J.trim();if(!u||ne.state!=="connected")return;let d=await Promise.all(i.current.map(async(y,T)=>y.context??ge(y.element,T)));if(b==="element"&&d.length===0)return;if(b==="page"&&d.length===0){let y=Oe();d=await Promise.all(y.map((T,H)=>ge(T,H)))}let v=ut({projectId:ke,browserSessionId:o,mode:b,targets:d,...j?{region:j}:{},requestText:u,scope:me,renderRevision:G});if(f.current=v,!r.current?.send("task.create",v)){Z(!1),K({status:"failed",requestText:u,changedFiles:[],logs:[],diff:"",error:"Bridge \uC5F0\uACB0\uC774 \uB04A\uC5B4\uC838 \uC694\uCCAD\uC744 \uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uC7AC\uC5F0\uACB0 \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694."});return}K({status:"queued",requestText:u,changedFiles:[],logs:["\uC694\uCCAD\uC744 Bridge writer queue\uC5D0 \uC804\uB2EC\uD588\uC2B5\uB2C8\uB2E4."],diff:""}),Z(!1),B(!1)},[o,ne.state,b,ke,j,G,J,me]),We=Q(async u=>{if(_?.id){vt(!0);try{await hn(n,_.id,u),K(d=>d&&{...d,status:u==="accept"?"accepted":u==="revert"?"reverted":"canceled",logs:[...d.logs,u==="accept"?"\uD604\uC7AC working tree \uBCC0\uACBD\uC744 \uC720\uC9C0\uD588\uC2B5\uB2C8\uB2E4.":u==="revert"?"\uCD5C\uC2E0 task \uBCC0\uACBD\uC744 \uB418\uB3CC\uB838\uC2B5\uB2C8\uB2E4.":"\uC791\uC5C5 \uCDE8\uC18C\uB97C \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4."]})}catch(d){K(v=>v&&{...v,error:d instanceof Error?d.message:"\uC791\uC5C5 \uBA85\uB839\uC744 \uC644\uB8CC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."})}finally{vt(!1)}}},[_?.id,n]),On=Q(async()=>{if(!_?.id||!he.trim())return;let u=f.current;if(!u){let R=Oe(),y=await Promise.all(R.map((T,H)=>ge(T,H)));u=ut({projectId:ke,browserSessionId:o,mode:"page",targets:y,requestText:_.requestText,scope:"page",renderRevision:G})}let d={...u,page:{...u.page,url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},devicePixelRatio:devicePixelRatio||1,scroll:{x:scrollX,y:scrollY},renderRevision:G},request:{text:he.trim(),scope:me}};if(!r.current?.send("task.follow_up",{taskId:_.id,parentTaskId:_.id,contextBundle:d})){K(R=>R&&{...R,error:"Bridge\uAC00 \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC544 \uD6C4\uC18D \uC694\uCCAD\uC744 \uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."});return}K({status:"queued",requestText:he.trim(),changedFiles:[],logs:[`${_.id.slice(0,8)} task\uB97C \uAE30\uC900\uC73C\uB85C \uD6C4\uC18D \uC694\uCCAD\uC744 \uBCF4\uB0C8\uC2B5\uB2C8\uB2E4.`],diff:""}),Z(!1),bt(""),Ke(!1),f.current=d},[o,he,ke,G,me,_?.id,_?.requestText]),Dn=P.filter(u=>u.element.isConnected).map(u=>({item:u,rect:re(u.element)})),St=z?.isConnected&&!P.some(u=>u.element===z)?re(z):null,kt=b==="element"?"\uC694\uC18C\uB97C \uD074\uB9AD\uD558\uC138\uC694 \xB7 Shift+Click\uC740 \uC5EC\uB7EC \uC694\uC18C":b==="multi"?`\uC694\uC18C\uB97C \uC120\uD0DD\uD558\uC138\uC694 (${P.length}/8) \xB7 Enter\uB85C \uC694\uCCAD \uC791\uC131`:b==="region"?"\uC694\uCCAD\uD560 \uC601\uC5ED\uC744 \uB4DC\uB798\uADF8\uD558\uC138\uC694":"\uD604\uC7AC \uD398\uC774\uC9C0\uC758 \uC8FC\uC694 \uCEE8\uD14D\uC2A4\uD2B8\uB97C \uC218\uC9D1\uD588\uC2B5\uB2C8\uB2E4";return p("div",{class:"visual-shell","data-open":x?"true":"false",children:[p("nav",{ref:k,class:"toolbar","aria-label":"Visual Bridge \uB3C4\uAD6C",children:[p("span",{class:"brand-mark",children:"Visual Bridge"}),p("div",{class:"mode-tabs",children:[["element","\uC694\uC18C"],["multi","\uC5EC\uB7EC \uC694\uC18C"],["region","\uC601\uC5ED"],["page","\uD398\uC774\uC9C0"]].map(([u,d])=>p("button",{type:"button","aria-pressed":b===u?"true":"false",disabled:!!(_&&Se.has(_.status)&&!O),onClick:()=>Un(u),children:d},u))}),b==="multi"&&P.length>0&&!A&&(!_||O)?p("button",{type:"button",class:"primary",onClick:()=>B(!0),children:"\uC694\uCCAD \uC791\uC131"}):null,_&&!A?p("button",{type:"button",class:"task-toggle","aria-controls":"visual-task-strip","aria-expanded":O?"false":"true",title:O?"\uC228\uAE34 \uC791\uC5C5 \uD328\uB110 \uC5F4\uAE30":"\uC791\uC5C5\uC740 \uACC4\uC18D \uC9C4\uD589\uD558\uACE0 \uD328\uB110\uB9CC \uC228\uAE30\uAE30",onClick:()=>{if(O){Z(!1);return}ie(),Z(!0)},children:O?"\uC791\uC5C5 \uBCF4\uAE30":"\uC791\uC5C5 \uC228\uAE30\uAE30"}):null,gt?p("a",{class:"viewer-link",href:gt,target:"_blank",rel:"noopener","aria-label":"\uC804\uCCB4\uD654\uBA74 \uC791\uC5C5 \uBCF4\uB4DC\uB97C \uC0C8 \uD0ED\uC5D0\uC11C \uC5F4\uAE30",title:"\uC804\uCCB4\uD654\uBA74 \uC791\uC5C5 \uBCF4\uB4DC \uC5F4\uAE30",children:"\uC791\uC5C5 \uBCF4\uB4DC \u2197"}):p("button",{type:"button",class:"viewer-link",disabled:!0,title:Hn?"\uC791\uC5C5 \uBCF4\uB4DC \uC5F0\uACB0\uC744 \uC900\uBE44\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4":"\uC791\uC5C5 \uBCF4\uB4DC \uC900\uBE44 \uC911",children:"\uC791\uC5C5 \uBCF4\uB4DC"}),p("span",{class:"connection",role:"status",children:[p("span",{class:"state-dot","data-state":ne.state,"aria-hidden":"true"}),p("span",{class:"connection-label connection-label-full",children:Fn[ne.state]}),p("span",{class:"connection-label connection-label-compact",children:Ao[ne.state]})]})]}),!A&&(!_||O||!Se.has(_.status))&&St?p(In,{rect:St,kind:"hover"}):null,b!=="page"&&b!=="region"&&(!_||!O||A)?Dn.map(({item:u,rect:d},v)=>p(In,{rect:d,kind:"selected",...b==="multi"?{label:String(v+1)}:{}},u.id)):null,j&&(!_||!O||A)?p("div",{class:"region-box",style:{left:`${j.x}px`,top:`${j.y}px`,width:`${j.width}px`,height:`${j.height}px`},"aria-hidden":"true",children:p("span",{class:"region-box-label machine",children:"\uC601\uC5ED"})}):null,A&&(!_||O)?p(Ho,{panelRef:g,position:yt,selection:P,mode:b,connectionState:ne.state,requestText:J,scope:me,composingRef:m,onRequestText:dt,onScope:De,onSubmit:()=>{jn()}}):null,_&&!O?p($o,{panelRef:g,position:yt,task:_,followUpOpen:_t,followUpText:he,composingRef:m,busyAction:$n,onCancel:()=>{We("cancel")},onAccept:()=>{We("accept")},onRevert:()=>{We("revert")},onToggleFollowUp:()=>Ke(u=>!u),onFollowUpText:bt,onFollowUp:()=>{On()},onNewRequest:()=>{K(null),Z(!1),ie()},onDismiss:()=>{l.current=void 0,K(null),Z(!1),ie()}}):null,!A&&(!_||O)?p("div",{class:"selection-hint",children:kt}):null,p("div",{class:"visually-hidden","aria-live":"polite",children:_?`${qn[_.status]}. ${_.logs.at(-1)??""}`:kt}),p("span",{class:"visually-hidden",children:"Overlay \uC5F4\uAE30 \uB610\uB294 \uB2EB\uAE30: Command \uB610\uB294 Control + Shift + G"})]})}function An(){if(document.getElementById(le)||!document.body)return;let e=document.createElement("div");e.id=le,e.dataset.visualBridgeIgnore="true",e.dataset.active="false";let t=e.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=Ln;let o=document.createElement("div");o.dataset.visualBridgeIgnore="true",t.append(n,o),document.body.append(e),Ut(p(Bo,{host:e}),o)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",An,{once:!0}):An();
|
|
883
|
+
`;var Mo=0;function p(e,t,n,o,r,i){t||(t={});var a,l,f=t;if("ref"in f)for(l in f={},t)l=="ref"?a=t[l]:f[l]=t[l];var c={type:e,props:f,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Mo,__i:-1,__u:0,__source:r,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(l in a)f[l]===void 0&&(f[l]=a[l]);return C.vnode&&C.vnode(c),c}var mt={queued:"\uB300\uAE30 \uC911",preparing:"\uC791\uC5C5 \uC900\uBE44",snapshotting_before:"\uBCC0\uACBD \uC804 \uC2A4\uB0C5\uC0F7",resolving_context:"\uC18C\uC2A4 \uD655\uC778",running_agent:"\uC5D0\uC774\uC804\uD2B8 \uC218\uC815 \uC911",snapshotting_after:"\uBCC0\uACBD \uD6C4 \uC2A4\uB0C5\uC0F7",diffing:"\uBCC0\uACBD \uBC94\uC704 \uACC4\uC0B0",waiting_hmr:"\uD654\uBA74 \uBC18\uC601 \uB300\uAE30",verifying:"\uAC80\uC99D \uC911",review:"\uAC80\uD1A0 \uB300\uAE30",accepted:"\uBCC0\uACBD \uC720\uC9C0",reverted:"\uB418\uB3CC\uB9AC\uAE30 \uC644\uB8CC",failed:"\uC791\uC5C5 \uC2E4\uD328",canceled:"\uC791\uC5C5 \uCDE8\uC18C",unsafe:"\uC548\uC804 \uD655\uC778 \uD544\uC694"},Nn={unpaired:"\uD398\uC5B4\uB9C1 \uD544\uC694",connecting:"\uC5F0\uACB0 \uC911",connected:"Bridge \uC5F0\uACB0\uB428",reconnecting:"\uC7AC\uC5F0\uACB0 \uC911",offline:"Bridge \uC751\uB2F5 \uC5C6\uC74C",unauthorized:"\uD398\uC5B4\uB9C1 \uAC70\uBD80\uB428"},No={unpaired:"\uD398\uC5B4\uB9C1",connecting:"\uC5F0\uACB0 \uC911",connected:"\uC5F0\uACB0\uB428",reconnecting:"\uC7AC\uC5F0\uACB0",offline:"\uC751\uB2F5 \uC5C6\uC74C",unauthorized:"\uAC70\uBD80\uB428"},ue=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying"]),$n=new Set(["failed","unsafe"]);function ke(e){return e.composedPath().some(t=>t instanceof HTMLElement&&t.id===ce)}function $o(e){if(!e)return"\uD604\uC7AC \uD398\uC774\uC9C0";if(!e.context)return"\uC18C\uC2A4 \uC704\uCE58 \uD655\uC778 \uC911\u2026";let t=e.context.source.primary;if(t){let r=t.lineNumber?`:${t.lineNumber}`:"";return`${t.componentName?`${t.componentName} \xB7 `:""}${t.filePath}${r}`}let n=e.context.dom,o=n.id?`#${n.id}`:n.classNames[0]?`.${n.classNames[0]}`:"";return`${n.tagName}${o} \xB7 source unknown`}function Ho(e){switch(e){case"passed":return"\uAC80\uC99D \uD1B5\uACFC";case"partial":return"\uBD80\uBD84 \uAC80\uC99D";case"failed":return"\uAC80\uC99D \uC2E4\uD328";default:return"\uBBF8\uAC80\uC99D"}}function Bo(e){if(e instanceof Error)return e.stack??e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Fn({rect:e,kind:t,label:n}){return p("div",{class:"reticle","data-kind":t,style:{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`},"aria-hidden":"true",children:n?p("span",{class:"reticle-label",children:n}):null})}function Uo({panelRef:e,position:t,selection:n,mode:o,connectionState:r,requestText:i,scope:a,composingRef:l,onRequestText:f,onScope:c,onSubmit:h}){let _=V(null),s=n[0],m=n.filter(y=>!y.context).length;K(()=>{_.current?.focus()},[]);let T=y=>{st({key:y.key,shiftKey:y.shiftKey,isComposing:y.isComposing},!!l.current)&&(y.preventDefault(),h())};return p("section",{ref:e,class:"strip",style:{left:`${t.left}px`,top:`${t.top}px`},"aria-label":o==="region"?"\uC601\uC5ED \uC218\uC815 \uC694\uCCAD \uC791\uC131":"\uC218\uC815 \uC694\uCCAD \uC791\uC131",children:[p("header",{class:"strip-head",children:[p("span",{class:"strip-title",children:o==="region"?"\uB4DC\uB798\uADF8\uD55C \uD654\uBA74 \uC601\uC5ED":$o(s)}),p("span",{class:"strip-code machine",children:o==="element"?"TARGET 1":o==="multi"?`TARGETS ${n.length}/8`:o==="region"?"REGION":"PAGE"})]}),p("div",{class:"strip-body",children:[p("div",{class:"selection-readout",children:[p("strong",{children:o==="page"?"\uD604\uC7AC \uD398\uC774\uC9C0 \uCEE8\uD14D\uC2A4\uD2B8":o==="region"?"\uC601\uC5ED \uC120\uD0DD\uB428":`${n.length}\uAC1C \uB300\uC0C1 \uC120\uD0DD`}),p("span",{children:m>0?o==="region"?`\uBC94\uC704 \uC548 \uC694\uC18C ${m}\uAC1C \uD655\uC778 \uC911`:`\uC18C\uC2A4 ${m}\uAC1C \uD655\uC778 \uC911`:o==="region"?`\uBC94\uC704 \uC548 \uC694\uC18C ${n.length}\uAC1C \uD3EC\uD568`:"\uCEE8\uD14D\uC2A4\uD2B8 \uC900\uBE44\uB428"})]}),p("label",{class:"visually-hidden",for:"visual-request",children:"\uC218\uC815 \uC694\uCCAD"}),p("textarea",{ref:_,id:"visual-request",class:"request-field",value:i,maxLength:1e4,placeholder:"\uC120\uD0DD\uD55C \uD654\uBA74\uC744 \uC5B4\uB5BB\uAC8C \uBC14\uAFC0\uAE4C\uC694?",onInput:y=>f(y.currentTarget.value),onCompositionStart:()=>{l.current=!0},onCompositionEnd:()=>{l.current=!1},onKeyDown:T}),p("p",{class:"input-note",children:"Enter\uB85C \uBCF4\uB0B4\uAE30 \xB7 Shift+Enter\uB85C \uC904\uBC14\uAFC8"}),p("div",{class:"request-meta",children:[p("label",{class:"field-label",children:["\uC801\uC6A9 \uBC94\uC704",p("select",{value:a,onChange:y=>c(y.currentTarget.value),children:[p("option",{value:"instance",children:"\uC120\uD0DD\uD55C \uC778\uC2A4\uD134\uC2A4"}),p("option",{value:"component",children:"\uACF5\uC6A9 \uCEF4\uD3EC\uB10C\uD2B8"}),p("option",{value:"page",children:"\uD604\uC7AC \uD398\uC774\uC9C0"}),p("option",{value:"project",children:"\uD504\uB85C\uC81D\uD2B8 \uC804\uCCB4"})]})]}),p("button",{type:"button",class:"primary",disabled:!i.trim()||m>0||r!=="connected",onClick:h,children:"\uC694\uCCAD \uBCF4\uB0B4\uAE30"})]}),r!=="connected"?p("div",{class:"error-banner",role:"status",children:["\uC5F0\uACB0 \uC0C1\uD0DC: ",Nn[r],". Bridge \uC5F0\uACB0 \uD6C4 \uC694\uCCAD\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."]}):null]})]})}function jo({panelRef:e,position:t,task:n,followUpOpen:o,followUpText:r,composingRef:i,busyAction:a,onCancel:l,onAccept:f,onRevert:c,onToggleFollowUp:h,onFollowUpText:_,onFollowUp:s,onNewRequest:m,onDismiss:T}){let y=ue.has(n.status),E=n.changedFiles.length>0||!!n.diff,b=n.status==="review"||(n.status==="failed"||n.status==="canceled")&&E,w=n.status==="review"||n.status==="accepted"||n.status==="reverted",L=n.status==="accepted"||n.status==="reverted"||(n.status==="failed"||n.status==="canceled")&&!E,j=$n.has(n.status)||n.verification==="failed",z=j?"error":n.status==="canceled"?"canceled":w?"complete":"active",Y=n.logs.slice(-4),O=A=>{st({key:A.key,shiftKey:A.shiftKey,isComposing:A.isComposing},!!i.current)&&(A.preventDefault(),s())};return p("section",{id:"visual-task-strip",ref:e,class:"strip",style:{left:`${t.left}px`,top:`${t.top}px`},"aria-label":"\uC791\uC5C5 \uC9C4\uD589\uACFC \uAC80\uD1A0",children:[p("header",{class:"strip-head",children:[p("span",{class:"strip-title",children:P(n.requestText,72)}),p("span",{class:"strip-code machine",children:n.id?`TASK ${n.id.slice(0,8)}`:"DISPATCH"})]}),p("div",{class:"strip-body",children:[p("div",{class:"status-row",role:"status",children:[p("span",{class:"phase-mark","data-state":n.status,"data-terminal":w?"true":"false","data-error":j?"true":"false","aria-hidden":"true"}),p("span",{class:"phase-copy",children:[p("strong",{children:mt[n.status]}),p("span",{children:n.logs.at(-1)??"Bridge\uC5D0\uC11C \uC791\uC5C5 \uC0C1\uD0DC\uB97C \uAE30\uB2E4\uB9AC\uB294 \uC911\uC785\uB2C8\uB2E4."})]}),p("span",{class:"phase-count machine",children:[n.changedFiles.length," files"]})]}),p("div",{class:"progress-track","data-active":y?"true":"false","data-outcome":z,children:p("span",{})}),Y.length>0?p("ul",{class:"log-summary","aria-label":"\uCD5C\uADFC \uC791\uC5C5 \uB85C\uADF8",children:Y.map((A,q)=>p("li",{children:A},`${q}-${A}`))}):p("p",{class:"empty-line",children:"\uC544\uC9C1 \uD45C\uC2DC\uD560 \uC791\uC5C5 \uB85C\uADF8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."}),n.error?p("div",{class:"error-banner",role:"alert",children:["\uC624\uB958: ",n.error]}):null,n.unavailableArtifacts&&n.unavailableArtifacts.length>0?p("div",{class:"error-banner",role:"status",children:["\uC77C\uBD80 \uC791\uC5C5 \uC815\uBCF4\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ",n.unavailableArtifacts.join(", "),". \uC791\uC5C5 \uBCF4\uB4DC\uC5D0\uC11C \uB2E4\uC2DC \uD655\uC778\uD574 \uC8FC\uC138\uC694."]}):null,n.status==="unsafe"?p("div",{class:"error-banner",role:"alert",children:"\uD5C8\uC6A9 \uBC94\uC704 \uBC16\uC758 \uD30C\uC77C \uB610\uB294 Git \uC0C1\uD0DC\uAC00 \uC791\uC5C5 \uC911 \uBC14\uB00C\uC5B4 \uC790\uB3D9 \uC720\uC9C0\xB7\uB418\uB3CC\uB9AC\uAE30\uB97C \uC7A0\uAC14\uC2B5\uB2C8\uB2E4. \uC544\uB798 diff\uC5D0\uB294 \uD5C8\uC6A9\uB41C \uACBD\uB85C\uB9CC \uD45C\uC2DC\uB429\uB2C8\uB2E4. \uC791\uC5C5 \uC624\uB958\uC640 Git \uC0C1\uD0DC\uB97C \uD655\uC778\uD55C \uB4A4 Git\uC5D0\uC11C \uBCC0\uACBD\uC744 \uC9C1\uC811 \uC720\uC9C0\uD558\uAC70\uB098 \uB418\uB3CC\uB9AC\uC138\uC694."}):null,n.changedFiles.length>0||b||w||n.status==="unsafe"?p(te,{children:[p("div",{class:"review-summary",children:[n.changedFiles.length>0?p("ul",{class:"file-list","aria-label":"\uBCC0\uACBD \uD30C\uC77C",children:n.changedFiles.map(A=>p("li",{children:["\u0394\xA0 ",A]},A))}):p("p",{class:"empty-line",children:"\uBCC0\uACBD \uD30C\uC77C\uC774 \uBCF4\uACE0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4."}),p("div",{class:"verification","data-status":n.verification??"unverified",children:[p("strong",{children:"\uAC80\uC99D"}),p("span",{children:Ho(n.verification)})]})]}),p("details",{class:"diff",children:[p("summary",{children:"Unified diff \uBCF4\uAE30"}),p("pre",{class:"diff-code",children:n.diff||"Diff\uB97C \uC544\uC9C1 \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."})]})]}):null,p("div",{class:"actions",children:[y?p("button",{type:"button",class:"quiet",disabled:!n.id||a,onClick:l,children:"\uC791\uC5C5 \uCDE8\uC18C"}):null,b?p(te,{children:[p("button",{type:"button",class:"primary",disabled:!n.id||a,onClick:f,children:"\uBCC0\uACBD \uC720\uC9C0"}),p("button",{type:"button",class:"secondary",disabled:!n.id||a,onClick:h,children:"\uD6C4\uC18D \uC218\uC815"}),p("button",{type:"button",class:"danger",disabled:!n.id||a,onClick:c,children:"\uB418\uB3CC\uB9AC\uAE30"})]}):null,L?p("button",{type:"button",class:"secondary",onClick:m,children:"\uC0C8 \uC694\uCCAD"}):null,y?null:p("button",{type:"button",class:"quiet",title:"\uC791\uC5C5 \uB0B4\uC5ED\uC740 \uC791\uC5C5 \uBCF4\uB4DC\uC5D0 \uB0A8\uAE30\uACE0 \uC774 \uD328\uB110\uB9CC \uB2EB\uAE30",onClick:T,children:"\uB2EB\uAE30"})]}),o&&b?p("div",{class:"follow-up",children:[p("label",{class:"field-label",for:"visual-follow-up",children:"\uD6C4\uC18D \uC218\uC815 \uB0B4\uC6A9"}),p("textarea",{id:"visual-follow-up",class:"request-field",value:r,maxLength:1e4,placeholder:"\uD604\uC7AC \uBCC0\uACBD\uC744 \uAE30\uC900\uC73C\uB85C \uCD94\uAC00\uD560 \uB0B4\uC6A9\uC744 \uC785\uB825\uD558\uC138\uC694.",onInput:A=>_(A.currentTarget.value),onCompositionStart:()=>{i.current=!0},onCompositionEnd:()=>{i.current=!1},onKeyDown:O}),p("button",{type:"button",class:"primary",disabled:!r.trim()||a,onClick:s,children:"\uD6C4\uC18D \uC694\uCCAD \uBCF4\uB0B4\uAE30"})]}):null]})]})}function Oo({task:e,busyAction:t,onExpand:n,onCancel:o}){let r=ue.has(e.status),i=["review","accepted","reverted"].includes(e.status),a=$n.has(e.status)||e.verification==="failed",l="visual-task-compact-phase",f="visual-task-compact-request",c="visual-task-compact-action";return p("section",{class:"task-compact","data-active":r?"true":"false","data-error":a?"true":"false","aria-label":"\uCD5C\uC18C\uD654\uB41C \uC791\uC5C5 \uC0C1\uD0DC",children:[p("button",{type:"button",class:"task-compact-main","aria-labelledby":`${l} ${f} ${c}`,onClick:n,children:[p("span",{class:"phase-mark","data-state":e.status,"data-terminal":i?"true":"false","data-error":a?"true":"false","aria-hidden":"true"}),p("span",{class:"task-compact-copy",children:[p("strong",{id:l,children:mt[e.status]}),p("span",{id:f,class:"task-compact-request",children:e.requestText}),p("span",{id:c,class:"visually-hidden",children:"\uC791\uC5C5 \uC0C1\uC138 \uD3BC\uCE58\uAE30"})]})]}),r?p("button",{type:"button",class:"task-compact-cancel",disabled:!e.id||t,onClick:o,children:"\uCDE8\uC18C"}):null]})}function Do({host:e}){let t=ie(()=>Be(location.hash).token!==null,[]),n=ie(dn,[]),o=ie(pn,[]),r=V(null),i=V([]),a=V(""),l=V(void 0),f=V(null),c=V(null),h=V(!1),_=V(1),s=V(null),m=V(null),T=V(null),[y,E]=$(t),[b,w]=$("element"),[L,j]=$([]),[z,Y]=$(null),[O,A]=$(null),[q,B]=$(!1),[J,gt]=$(""),[he,We]=$("instance"),[G,Hn]=$(1),[ht,_t]=$(0),[ne,Bn]=$({state:"connecting",lastSequence:0}),[Se,Ke]=$("current"),[bt,vt]=$(null),[Un,xt]=$(!1),[g,W]=$(null),[U,Q]=$(!1),[yt,Ve]=$(!1),[_e,wt]=$(""),[kt,St]=$(!1),[Tt,jn]=$({left:12,top:64,placement:"below"});i.current=L,a.current=J,_.current=G,l.current=g?.id;let Et=!!(g&&(ue.has(g.status)||g.status==="review"&&!["passed","partial","failed"].includes(g.verification??""))),Te=Z(()=>({url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},renderRevision:_.current}),[]),Ee=Z(async d=>{let u=await bn(n,d);W(x=>x?.id===d?{...x,changedFiles:u.changedFiles.length>0?u.changedFiles:x.changedFiles,diff:u.diff||x.diff,logs:u.logs.length>0?u.logs:x.logs,unavailableArtifacts:u.unavailable}:x)},[n]),Ct=Z(d=>{let u=Oe(d),x=d.taskId??u?.id,R=yn(d),v=wn(d),S=kn(d);if(d.type==="project.state"){let k=d.payload;typeof k?.projectId=="string"&&Ke(k.projectId)}if(d.type==="command.error"){let k=d.payload;typeof k?.message=="string"&&W(M=>M&&{...M,status:M.status==="queued"&&!M.id?"failed":M.status,error:k.message});return}let I=xn(d,o,l.current);if(!(!I.accept||!I.taskId)){if(I.bind&&(l.current=I.taskId),u?.scope&&We(u.scope),d.type==="task.verification_result"){let k=d.payload,M=k.verificationStatus??k.status;typeof M=="string"&&W(X=>X&&{...X,verification:M})}(x||R||v||S.length>0||u)&&W(k=>{let M=k&&(!k.id||k.id===x)?k:{status:R??u?.status??"queued",requestText:u?.requestText??a.current,changedFiles:[],logs:[],diff:""},X=u?.error?.message??d.payload?.error?.message;return{...M,...x?{id:x}:{},status:R??u?.status??M.status,requestText:u?.requestText??M.requestText,changedFiles:S.length>0?S:u?.changedFiles?.length?u.changedFiles:M.changedFiles,logs:v?[...M.logs,v].slice(-40):M.logs,...u?.verificationStatus?{verification:u.verificationStatus}:{},...typeof X=="string"?{error:X}:{}}}),x&&(d.type==="task.diff_ready"||d.type==="task.completed"||d.type==="task.failed")&&Ee(x)}},[o,Ee]);K(()=>{let d=new je({token:n,browserSessionId:o,getPageState:Te,onSnapshot:u=>{Bn(u),u.projectId&&Ke(u.projectId)},onEvent:Ct});return r.current=d,d.connect(),mn(n).then(u=>{u&&Ke(u)}).catch(()=>{}),gn(n,o).then(u=>{u&&(W(x=>x||(l.current=u.id,{id:u.id,status:u.status,requestText:u.requestText,changedFiles:u.changedFiles,logs:[],diff:"",...u.verificationStatus?{verification:u.verificationStatus}:{},...u.error?.message?{error:u.error.message}:{}})),Ee(u.id))}).catch(()=>{}),()=>{d.close(),r.current=null}},[o,Ct,Ee,Te,n]),K(()=>{let d=!0;return xt(!1),fn(n).then(u=>{d&&vt(u)}).catch(()=>{d&&(vt(null),xt(!0))}),()=>{d=!1}},[n]),K(()=>{e.dataset.active=y?"true":"false",y&&requestAnimationFrame(()=>{T.current?.querySelector('button[aria-pressed="true"]')?.focus()})},[e,y]),K(()=>{if(!Et)return;let d,u,x=()=>{d!==void 0&&(clearTimeout(d),d=void 0),u!==void 0&&(clearTimeout(u),u=void 0),Hn(v=>v+1)},R=new MutationObserver(v=>{v.some(({target:I})=>I!==e&&!e.contains(I))&&(d!==void 0&&clearTimeout(d),d=window.setTimeout(x,150),u===void 0&&(u=window.setTimeout(x,1e3)))});return R.observe(document.documentElement,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),()=>{R.disconnect(),d!==void 0&&clearTimeout(d),u!==void 0&&clearTimeout(u)}},[e,Et]),K(()=>{r.current?.send("browser.page_state",Te())},[Te,G]),K(()=>{if(ne.state!=="connected"||!g?.id||g.verification==="passed"||g.verification==="partial"||g.verification==="failed"||!ue.has(g.status)&&g.status!=="review")return;let d=f.current;if(!d){let S=`${g.id}:page-reloaded`;if(s.current===S)return;r.current?.send("verification.target_state",{taskId:g.id,state:"page-reloaded",renderRevision:G,targetCount:0,foundCount:0,changedCount:0})&&(s.current=S);return}let u=d.selection.targets;if(d.selection.mode==="page"||u.length===0||G<=d.page.renderRevision)return;let x=`${g.id}:${G}`;if(s.current===x)return;let R;try{R=Ln(u)}catch{R={state:"unverified",targetCount:u.length,foundCount:0,changedCount:0}}r.current?.send("verification.target_state",{taskId:g.id,renderRevision:G,...R})&&(s.current=x)},[ne.state,G,g?.id,g?.status,g?.verification]),K(()=>{let d=(k,M)=>{let X=P(M.map(Bo).join(" "),2e3);X&&r.current?.send("verification.console_events",{events:[{level:k,message:X,createdAt:new Date().toISOString()}]})},u=console.error,x=console.warn,R=(...k)=>{u.apply(console,k),d("error",k)},v=(...k)=>{x.apply(console,k),d("warning",k)},S=k=>{d("error",[k.error instanceof Error?k.error:k.message])},I=k=>{d("unhandled",[k.reason])};return console.error=R,console.warn=v,window.addEventListener("error",S),window.addEventListener("unhandledrejection",I),()=>{console.error===R&&(console.error=u),console.warn===v&&(console.warn=x),window.removeEventListener("error",S),window.removeEventListener("unhandledrejection",I)}},[]);let re=Z(()=>{j([]),Y(null),A(null),B(!1),gt(""),Ve(!1),c.current=null},[]),be=Z(d=>{let u=d.map(x=>({id:crypto.randomUUID(),element:x,context:null}));j(u);for(let[x,R]of u.entries())ge(R.element,x).then(v=>{j(S=>S.map(I=>I.id===R.id?{...I,context:v}:I))})},[]),On=Z(d=>{re(),Q(!!g),w(d),We(d==="page"?"page":"instance"),d==="page"&&(be(ze()),B(!0))},[be,re,g]);K(()=>{let d=u=>{if(u.key.toLowerCase()==="g"&&u.shiftKey&&(u.metaKey||u.ctrlKey)){u.preventDefault(),u.stopPropagation(),E(x=>!x);return}y&&(u.key==="Escape"?q?re():E(!1):u.key==="Enter"&&b==="multi"&&i.current.length>0&&!q&&(!g||U)&&!ke(u)&&(u.preventDefault(),B(!0)))};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[b,y,q,re,g,U]),K(()=>{if(!y||q||g&&ue.has(g.status)&&!U){Y(null);return}let d=v=>{if(b==="region"&&c.current){A(it(c.current,{x:v.clientX,y:v.clientY}));return}if(b==="page"||ke(v))return;let S=dt(v.clientX,v.clientY);Y(I=>I===S?I:S)},u=v=>{v.button!==0||ke(v)||b==="page"||(v.preventDefault(),v.stopImmediatePropagation(),b==="region"&&(c.current={x:v.clientX,y:v.clientY},A({x:v.clientX,y:v.clientY,width:0,height:0}),j([])))},x=v=>{if(v.button!==0||ke(v)||b==="page"||(v.preventDefault(),v.stopImmediatePropagation(),b!=="region"||!c.current))return;let S=it(c.current,{x:v.clientX,y:v.clientY});if(c.current=null,S.width<5||S.height<5){A(null);return}A(S),be(An(S)),B(!0)},R=v=>{if(b==="region"||b==="page"||v.button!==0||ke(v))return;let S=dt(v.clientX,v.clientY);if(!S)return;if(v.preventDefault(),v.stopImmediatePropagation(),Q(!!g),!(b==="multi"||v.shiftKey)){be([S]),B(!0);return}b!=="multi"&&w("multi");let k=i.current,M=k.find(ve=>ve.element===S);if(M){j(k.filter(ve=>ve.id!==M.id));return}if(k.length>=8)return;let X={id:crypto.randomUUID(),element:S,context:null};j([...k,X]),ge(S,k.length).then(ve=>{j(Kn=>Kn.map(Ye=>Ye.id===X.id?{...Ye,context:ve}:Ye))})};return document.addEventListener("pointermove",d,!0),document.addEventListener("pointerdown",u,!0),document.addEventListener("pointerup",x,!0),document.addEventListener("click",R,!0),()=>{document.removeEventListener("pointermove",d,!0),document.removeEventListener("pointerdown",u,!0),document.removeEventListener("pointerup",x,!0),document.removeEventListener("click",R,!0)}},[be,b,y,q,g,U]),K(()=>{let d=0,u=()=>{cancelAnimationFrame(d),d=requestAnimationFrame(()=>_t(x=>x+1))};return window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{cancelAnimationFrame(d),window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[]),K(()=>{if(!q&&!g)return;let d=m.current;if(!d)return;let u=0,x=new ResizeObserver(()=>{cancelAnimationFrame(u),u=requestAnimationFrame(()=>_t(R=>R+1))});return x.observe(d),()=>{cancelAnimationFrame(u),x.disconnect()}},[q,g?.id]);let Rt=ie(()=>{if(O)return O;let d=L.at(-1);return d?.element.isConnected?le(d.element):{x:12,y:52,width:1,height:1}},[ht,O,L]);nn(()=>{if(!q&&!g)return;let d=m.current;if(!d)return;let u=T.current?.getBoundingClientRect().bottom??52;jn(an(Rt,{width:d.offsetWidth||408,height:d.offsetHeight||300},{width:innerWidth,height:innerHeight},12,10,u+10))},[Rt,yt,q,g?.changedFiles.length,g?.diff,g?.logs.length,g?.status]);let Dn=Z(async()=>{let d=J.trim();if(!d||ne.state!=="connected")return;let u=await Promise.all(i.current.map(async(v,S)=>v.context??ge(v.element,S)));if(b==="element"&&u.length===0)return;if(b==="page"&&u.length===0){let v=ze();u=await Promise.all(v.map((S,I)=>ge(S,I)))}let x=ft({projectId:Se,browserSessionId:o,mode:b,targets:u,...O?{region:O}:{},requestText:d,scope:he,renderRevision:G});if(f.current=x,!r.current?.send("task.create",x)){Q(!1),W({status:"failed",requestText:d,changedFiles:[],logs:[],diff:"",error:"Bridge \uC5F0\uACB0\uC774 \uB04A\uC5B4\uC838 \uC694\uCCAD\uC744 \uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uC7AC\uC5F0\uACB0 \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694."});return}W({status:"queued",requestText:d,changedFiles:[],logs:["\uC694\uCCAD\uC744 Bridge writer queue\uC5D0 \uC804\uB2EC\uD588\uC2B5\uB2C8\uB2E4."],diff:""}),Q(!1),B(!1)},[o,ne.state,b,Se,O,G,J,he]),Ce=Z(async d=>{if(g?.id){St(!0);try{await vn(n,g.id,d),W(u=>u&&{...u,status:d==="accept"?"accepted":d==="revert"?"reverted":"canceled",logs:[...u.logs,d==="accept"?"\uD604\uC7AC working tree \uBCC0\uACBD\uC744 \uC720\uC9C0\uD588\uC2B5\uB2C8\uB2E4.":d==="revert"?"\uCD5C\uC2E0 task \uBCC0\uACBD\uC744 \uB418\uB3CC\uB838\uC2B5\uB2C8\uB2E4.":"\uC791\uC5C5 \uCDE8\uC18C\uB97C \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4."]})}catch(u){W(x=>x&&{...x,error:u instanceof Error?u.message:"\uC791\uC5C5 \uBA85\uB839\uC744 \uC644\uB8CC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."})}finally{St(!1)}}},[g?.id,n]),zn=Z(async()=>{if(!g?.id||!_e.trim())return;let d=f.current;if(!d){let R=ze(),v=await Promise.all(R.map((S,I)=>ge(S,I)));d=ft({projectId:Se,browserSessionId:o,mode:"page",targets:v,requestText:g.requestText,scope:"page",renderRevision:G})}let u={...d,page:{...d.page,url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},devicePixelRatio:devicePixelRatio||1,scroll:{x:scrollX,y:scrollY},renderRevision:G},request:{text:_e.trim(),scope:he}};if(!r.current?.send("task.follow_up",{taskId:g.id,parentTaskId:g.id,contextBundle:u})){W(R=>R&&{...R,error:"Bridge\uAC00 \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC544 \uD6C4\uC18D \uC694\uCCAD\uC744 \uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."});return}W({status:"queued",requestText:_e.trim(),changedFiles:[],logs:[`${g.id.slice(0,8)} task\uB97C \uAE30\uC900\uC73C\uB85C \uD6C4\uC18D \uC694\uCCAD\uC744 \uBCF4\uB0C8\uC2B5\uB2C8\uB2E4.`],diff:""}),Q(!1),wt(""),Ve(!1),f.current=u},[o,_e,Se,G,he,g?.id,g?.requestText]),Wn=L.filter(d=>d.element.isConnected).map(d=>({item:d,rect:le(d.element)})),Pt=z?.isConnected&&!L.some(d=>d.element===z)?le(z):null,Lt=b==="element"?"\uC694\uC18C\uB97C \uD074\uB9AD\uD558\uC138\uC694 \xB7 Shift+Click\uC740 \uC5EC\uB7EC \uC694\uC18C":b==="multi"?`\uC694\uC18C\uB97C \uC120\uD0DD\uD558\uC138\uC694 (${L.length}/8) \xB7 Enter\uB85C \uC694\uCCAD \uC791\uC131`:b==="region"?"\uC694\uCCAD\uD560 \uC601\uC5ED\uC744 \uB4DC\uB798\uADF8\uD558\uC138\uC694":"\uD604\uC7AC \uD398\uC774\uC9C0\uC758 \uC8FC\uC694 \uCEE8\uD14D\uC2A4\uD2B8\uB97C \uC218\uC9D1\uD588\uC2B5\uB2C8\uB2E4";return p("div",{class:"visual-shell","data-open":y?"true":"false",children:[p("nav",{ref:T,class:"toolbar","aria-label":"Visual Bridge \uB3C4\uAD6C",children:[p("span",{class:"brand-mark",children:"Visual Bridge"}),p("div",{class:"mode-tabs",children:[["element","\uC694\uC18C"],["multi","\uC5EC\uB7EC \uC694\uC18C"],["region","\uC601\uC5ED"],["page","\uD398\uC774\uC9C0"]].map(([d,u])=>p("button",{type:"button","aria-pressed":b===d?"true":"false",disabled:!!(g&&ue.has(g.status)&&!U),onClick:()=>On(d),children:u},d))}),b==="multi"&&L.length>0&&!q&&(!g||U)?p("button",{type:"button",class:"primary",onClick:()=>B(!0),children:"\uC694\uCCAD \uC791\uC131"}):null,g&&!q?p("button",{type:"button",class:"task-toggle","aria-controls":"visual-task-strip","aria-expanded":U?"false":"true",title:U?"\uCD5C\uC18C\uD654\uB41C \uC791\uC5C5 \uC0C1\uC138 \uD3BC\uCE58\uAE30":"\uC791\uC5C5 \uC0C1\uD0DC\uB97C \uB0A8\uAE30\uACE0 \uD328\uB110 \uCD5C\uC18C\uD654",onClick:()=>{if(U){Q(!1);return}re(),Q(!0)},children:U?"\uC791\uC5C5 \uD3BC\uCE58\uAE30":"\uC791\uC5C5 \uCD5C\uC18C\uD654"}):null,bt?p("a",{class:"viewer-link",href:bt,target:"_blank",rel:"noopener","aria-label":"\uC804\uCCB4\uD654\uBA74 \uC791\uC5C5 \uBCF4\uB4DC\uB97C \uC0C8 \uD0ED\uC5D0\uC11C \uC5F4\uAE30",title:"\uC804\uCCB4\uD654\uBA74 \uC791\uC5C5 \uBCF4\uB4DC \uC5F4\uAE30",children:"\uC791\uC5C5 \uBCF4\uB4DC \u2197"}):p("button",{type:"button",class:"viewer-link",disabled:!0,title:Un?"\uC791\uC5C5 \uBCF4\uB4DC \uC5F0\uACB0\uC744 \uC900\uBE44\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4":"\uC791\uC5C5 \uBCF4\uB4DC \uC900\uBE44 \uC911",children:"\uC791\uC5C5 \uBCF4\uB4DC"}),p("span",{class:"connection",role:"status",children:[p("span",{class:"state-dot","data-state":ne.state,"aria-hidden":"true"}),p("span",{class:"connection-label connection-label-full",children:Nn[ne.state]}),p("span",{class:"connection-label connection-label-compact",children:No[ne.state]})]})]}),g&&U?p(Oo,{task:g,busyAction:kt,onExpand:()=>Q(!1),onCancel:()=>{Ce("cancel")}}):null,!q&&(!g||U||!ue.has(g.status))&&Pt?p(Fn,{rect:Pt,kind:"hover"}):null,b!=="page"&&b!=="region"&&(!g||!U||q)?Wn.map(({item:d,rect:u},x)=>p(Fn,{rect:u,kind:"selected",...b==="multi"?{label:String(x+1)}:{}},d.id)):null,O&&(!g||!U||q)?p("div",{class:"region-box",style:{left:`${O.x}px`,top:`${O.y}px`,width:`${O.width}px`,height:`${O.height}px`},"aria-hidden":"true",children:p("span",{class:"region-box-label machine",children:"\uC601\uC5ED"})}):null,q&&(!g||U)?p(Uo,{panelRef:m,position:Tt,selection:L,mode:b,connectionState:ne.state,requestText:J,scope:he,composingRef:h,onRequestText:gt,onScope:We,onSubmit:()=>{Dn()}}):null,g&&!U?p(jo,{panelRef:m,position:Tt,task:g,followUpOpen:yt,followUpText:_e,composingRef:h,busyAction:kt,onCancel:()=>{Ce("cancel")},onAccept:()=>{Ce("accept")},onRevert:()=>{Ce("revert")},onToggleFollowUp:()=>Ve(d=>!d),onFollowUpText:wt,onFollowUp:()=>{zn()},onNewRequest:()=>{W(null),Q(!1),re()},onDismiss:()=>{l.current=void 0,W(null),Q(!1),re()}}):null,!q&&(!g||U)?p("div",{class:"selection-hint",children:Lt}):null,p("div",{class:"visually-hidden","aria-live":"polite",children:g?`${mt[g.status]}. ${g.logs.at(-1)??""}`:Lt}),p("span",{class:"visually-hidden",children:"Overlay \uC5F4\uAE30 \uB610\uB294 \uB2EB\uAE30: Command \uB610\uB294 Control + Shift + G"})]})}function Mn(){if(document.getElementById(ce)||!document.body)return;let e=document.createElement("div");e.id=ce,e.dataset.visualBridgeIgnore="true",e.dataset.active="false";let t=e.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=qn;let o=document.createElement("div");o.dataset.visualBridgeIgnore="true",t.append(n,o),document.body.append(e),Kt(p(Do,{host:e}),o)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Mn,{once:!0}):Mn();
|