tencil 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n,r,i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/^m(i|n|o|s|text|space)$/,v=Array.isArray,y=g.slice,b=Object.assign;function ee(e){e&&e.parentNode&&e.remove()}function te(e,t,n){var r,i,a,o={},s=arguments.length;for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return s>2&&(o.children=s>3?y.call(arguments,2):n),x(e,o,r,i,null)}function x(e,t,i,a,o){var s={type:e,props:t,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o||++r,__i:-1,__u:0};return!o&&n.vnode&&n.vnode(s),s}function S(e){return e.children}function C(e,t){this.props=e,this.context=t,this.__g=0}function ne(e,t){if(t==null)return e.__?ne(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:ne(e)}function w(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),w(e)}function T(e){(8&e.__g||!(e.__g|=8)||!a.push(e)||s++)&&o==n.debounceRendering||((o=n.debounceRendering)||queueMicrotask)(re)}function re(){var e,t,r,i,o,l,u,d,f;try{for(t=1;a.length;)a.length>t&&a.sort(c),e=a.shift(),t=a.length,8&e.__g&&(i=void 0,o=void 0,l=(o=(r=e).__v).__e,u=[],d=[],(f=r.__P)&&((i=b({constructor:void 0},o)).__v=o.__v+1,n.vnode&&n.vnode(i),E(f,i,o,r.__n,f.namespaceURI,32&o.__u?[l]:null,u,l||ne(o),32&o.__u,d),i.__v=o.__v,i.__.__k[i.__i]=i,fe(u,i,d),o.__=o.__e=null,i.__e!=l&&w(i)))}finally{a.length=s=0}}function ie(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y=r.__k||g,b=t.length;for(c=ae(n,t,y,c,b),d=0;d<b;d++)(p=n.__k[d])!=null&&(f=~p.__i&&y[p.__i]||h,p.__i=d,v=E(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&(f.ref!=p.ref||8&f.__u)&&(f.ref!=p.ref&&f.ref&&D(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_||=m,4&p.__u?(c=oe(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function ae(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m,h=n.length,g=h,_=0,y=!1,b=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor==String?o=b[a]=x(null,o):v(o)?o=b[a]=x(S,{children:o}):o.constructor===void 0&&o.__b?o=b[a]=x(o.type,o.props,o.key,o.ref,o.__v):b[a]=o,c=a+_,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=se(o,n,c,g))&&(g--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=2,l==c-1?_--:l==c+1?_++:l!=c&&(l>c?_--:_++,y=!0)):(~l||(i>h?_--:i<h&&_++),typeof o.type!=`function`&&(o.__u|=4))):b[a]=null;if(y){for(u=[],d=[],a=0;a<i;a++)if((o=b[a])&&2&o.__u){for(f=0,p=u.length;f<p;)u[m=f+p>>1]<o.__i?f=m+1:p=m;u[f]=o.__i,d[a]=f+1}for(_=u.length;a--;)d[a]&&(d[a]==_?_--:b[a].__u|=4)}if(g)for(a=0;a<h;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=ne(s)),me(s,s));return r}function oe(e,t,n,r){var i,a;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=oe(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=ne(e))&&!t.parentNode&&(t=null),e.__e!=t&&(!r&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t&&=t.nextSibling)&&t.nodeType==8;);return t}function se(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ce(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function le(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ce(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ce(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),(e.__e||={})[t+a]=n,n?r?n[u]=r[u]:(n[u]=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`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 n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ue(e){return function(t){if(this.__e){var r=this.__e[t.type+e];if(t[l]==null)t[l]=f++;else if(t[l]<r[u])return;return r(n.event?n.event(t):t)}}}function E(e,t,r,i,a,o,s,c,l,u){var d,f,p,m,h,_,y,te,x,w,T,re,ae,oe,se,ce,le,ue,E,fe,D=t.type;if(t.constructor!==void 0)return null;if(128&r.__u&&(l=32&r.__u,d=r.__c.__z)){if(t.__u|=l,f=o=[],d.nodeType==8)for(p=1,m=d.nextSibling;m;m=m.nextSibling){if(m.nodeType==8){if(m.data.startsWith(`$s`))p++;else if(m.data.startsWith(`/$s`)&&!--p)break}o.push(m)}else o.push(d);c=o[0]}(d=n.__b)&&d(t);n:if(typeof D==`function`){h=s.length;try{if(w=t.props,T=(d=D.prototype)&&d.render,re=(d=D.contextType)&&i[d.__c],ae=d?re?re.props.value:d.__:i,r.__c?2&(_=t.__c=r.__c).__g&&(_.__g|=1):(T?t.__c=_=new D(w,ae):(t.__c=_=new C(w,ae),_.constructor=D,_.render=he),re&&re.sub(_),_.state||(_.state={}),_.__n=i,_.__g|=8,_.__h=[],_.__k=[]),T&&(_.__s||(_.__s=_.state),D.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=b({},_.__s)),b(_.__s,D.getDerivedStateFromProps(w,_.__s)))),y=_.props,te=_.state,_.__v=t,r.__c){if(T&&!D.getDerivedStateFromProps&&w!==y&&_.componentWillReceiveProps&&_.componentWillReceiveProps(w,ae),t.__v==r.__v&&!(8&_.__g)||!(4&_.__g)&&_.shouldComponentUpdate&&!1===_.shouldComponentUpdate(w,_.__s,ae)){t.__v!=r.__v&&(_.props=w,_.state=_.__s,_.__g&=-9),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(_.__h,_.__k),_.__k=[],_.__h.length&&s.push(_),c=ne(r);break n}_.componentWillUpdate&&_.componentWillUpdate(w,_.__s,ae),T&&_.componentDidUpdate&&_.__h.push(function(){_.componentDidUpdate(y,te,x)})}else T&&!D.getDerivedStateFromProps&&_.componentWillMount&&_.componentWillMount(),T&&_.componentDidMount&&_.__h.push(_.componentDidMount);if(_.context=ae,_.props=w,_.__P=e,_.__g&=-5,oe=n.__r,se=0,T)_.state=_.__s,_.__g&=-9,oe&&oe(t),d=_.render(_.props,_.state,_.context),g.push.apply(_.__h,_.__k),_.__k=[];else do _.__g&=-9,oe&&oe(t),d=_.render(_.props,_.state,_.context),_.state=_.__s;while(8&_.__g&&++se<25);_.state=_.__s,_.getChildContext&&(i=b({},i,_.getChildContext())),T&&r.__c&&_.getSnapshotBeforeUpdate&&(x=_.getSnapshotBeforeUpdate(y,te)),ce=d&&d.type===S&&d.key==null?d.props.children:d,w.__P&&(d=c,a=(e=w.__P).namespaceURI,l=o=null,r.props&&r.props.__P!=e&&(r.__k.some(function(e){e&&me(e,e)}),r.__k=null),c=r.__k?ne(r,0):null),c=ie(e,v(ce)?ce:[ce],t,r,i,a,o,s,c,l,u),w.__P&&(t.__e=null,c=d),t.__u&=-161,128&r.__u&&(_.__z=null),f&&f.some(ee),_.__h.length&&s.push(_),1&_.__g&&(_.__g&=-4)}catch(e){if(s.length=h,t.__v=null,l||o){if(e.then){if(le=0,t.__u|=l?160:128,o){for(E=0;E<o.length;E++)if(fe=o[E]){if(fe.nodeType==8){if(o[E]=null,fe.data.startsWith(`$s`))le++||(ue=fe);else if(fe.data.startsWith(`/$s`)&&!--le){c=fe;break}}else le&&(o[E]=null)}}if(!ue){for(;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o&&(o[o.indexOf(c)]=null),ue=c}t.__c.__z||(t.__c.__z=ue),t.__e=c}else o&&o.some(ee)}else t.__e=r.__e;t.__k||=r.__k||[],e.then||de(t),n.__e(e,t,r)}}else c=t.__e=pe(r.__e,t,r,i,a,o,s,l,u,e);return(d=n.diffed)&&d(t),128&t.__u?void 0:c}function de(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(de))}function fe(e,t,r){for(var i=0;i<r.length;)D(r[i++],r[i++],r[i++]);n.__c&&n.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n.__e(e,t.__v)}})}function pe(e,t,r,i,a,o,s,c,l,u){var d,f,p,m,g,b,te,x,S,C=r.props||h,w=t.props,T=t.type;if(T==`svg`?a=`http://www.w3.org/2000/svg`:T==`math`?a=`http://www.w3.org/1998/Math/MathML`:a||=`http://www.w3.org/1999/xhtml`,o){for(d=0;d<o.length;d++)if((g=o[d])&&(T?g.localName==T:g.nodeType==3)){e=g,o[d]=null;break}}if(!e){if(x=u.ownerDocument||document,!T)return x.createTextNode(w);e=x.createElementNS(a,T,w.is&&w),c&&=(n.__m&&n.__m(t,o),!1),o=null}if(T){if(u=T==`template`?e.content:e,o=T==`textarea`&&w.defaultValue!=null?null:o&&y.call(u.childNodes),!c&&o)for(C={},d=0;d<e.attributes.length;d++)C[(g=e.attributes[d]).name]=g.value;for(d in C)g=C[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in w||d==`value`&&`defaultValue`in w||d==`checked`&&`defaultChecked`in w||le(e,d,null,g,a);for(d in S=1&r.__u,w)g=w[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?b=g:d==`checked`?te=g:c&&typeof g!=`function`||!(C[d]!==g||S&&g!=null)||le(e,d,g,C[d],a);f?(c||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[]):(p&&(e.textContent=``),(T==`foreignObject`||a==`http://www.w3.org/1998/Math/MathML`&&_.test(T))&&(a=`http://www.w3.org/1999/xhtml`),ie(u,v(m)?m:[m],t,r,i,a,o,s,o?o[0]:r.__k&&ne(r,0),c,l),o&&o.some(ee)),c&&T!=`textarea`||(d=`value`,T==`progress`&&b==null?e.removeAttribute(d):b==null||b===e[d]&&(T!=`progress`||b)||le(e,d,b,C[d],a),d=`checked`,te!=null&&te!=e[d]&&le(e,d,te,C[d],a))}else C===w||c&&e.data==w||(e.data=w);return e}function D(e,t,r){try{typeof e==`function`?(typeof e.__u==`function`&&e.__u(),(typeof e.__u!=`function`||t)&&(e.__u=e(t))):e.current=t}catch(e){n.__e(e,r)}}function me(e,t,r){var i,a;if(n.unmount&&n.unmount(e),!(i=e.ref)||i.current&&i.current!=e.__e||D(i,null,t),i=e.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.__e(e,t)}i.__P=i.__n=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&me(i[a],t,typeof e.type!=`function`||r&&!e.props.__P);(i=e.__e)&&(r||ee(i),i.__e&&(i.__e=null)),e.__e=e.__c=e.__=null}function he(e,t,n){return this.constructor(e,n)}function ge(e,t){var r,i,a,o;n.__&&n.__(e,t),t.nodeType==9&&(t=t.documentElement),i=(r=e&&32&e.__u)?null:t.__k,t.__k=x(S,{children:[e]}),a=[],o=[],E(t,t.__k,i||h,h,t.namespaceURI,i?null:t.firstChild?y.call(t.childNodes):null,a,i?i.__e:t.firstChild,r,o),fe(a,t.__k,o),t.__k.props.children=null}n={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t,o=0}}throw s=0,e}},r=0,i=function(e){return e!=null&&e.constructor===void 0},C.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=b({},this.state)),typeof e==`function`&&(e=e(b({},n),this.props)),e&&(b(n,e),this.__v&&(t&&this.__k.push(t),T(this)))},C.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),T(this))},C.prototype.render=S,a=[],s=0,c=function(e,t){return e.__v.__b-t.__v.__b},l=Symbol(),u=Symbol(),d=/(PointerCapture)$|Capture$/i,f=0,p=ue(!1),m=ue(!0);var _e,O,ve,ye,be=Object.is,xe=0,Se=[],Ce=[],k=n,we=k.__b,Te=k.__r,Ee=k.diffed,De=k.__c,Oe=k.unmount,ke=k.__;function Ae(e,t){k.__h&&k.__h(O,e,xe||t),xe=0;var n=O.__H||(O.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function A(e){return xe=1,je(He,e)}function je(e,t,n){var r=Ae(_e++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):He(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);be(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=O,!O.__f)){O.__f=!0;var i=O.shouldComponentUpdate;O.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,be(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function Me(e,t){var n=Ae(_e++,3);!k.__s&&Ve(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,O.__H.__h.push(n))}function Ne(e,t){var n=Ae(_e++,4);!k.__s&&Ve(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,O.__h.push(n))}function j(e){return xe=5,Pe(function(){return{current:e}},[])}function Pe(e,t){var n=Ae(_e++,7);return Ve(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function Fe(){var e;do{for(;e=Ce.shift();)try{ze(e)}catch(t){k.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Se.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ze),t.__h.some(Be),t.__h=[]}catch(n){t.__h=[],k.__e(n,e.__v)}}}while(Ce.length)}k.__b=function(e){O=null,we&&we(e)},k.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ke&&ke(e,t)},k.__r=function(e){Te&&Te(e),_e=0;var t=(O=e.__c).__H;t&&(ve==O?O.__h=[]:(t.__h.some(ze),t.__h.some(Be),_e=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),ve=O},k.diffed=function(e){Ee&&Ee(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Re(Se.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),ve=O=null},k.__c=function(e,t){t.some(function(e){try{e.__h.some(ze),e.__h=e.__h.filter(function(e){return!e.__||Be(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],k.__e(n,e.__v)}}),De&&De(e,t)},k.unmount=function(e){Oe&&Oe(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,Re(Ce.push(r))}else ze(r)}catch(e){t=e}}),r.__H=void 0,t&&k.__e(t,r.__v))};var Ie=typeof requestAnimationFrame==`function`;function Le(e){var t,n=function(){clearTimeout(r),Ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ie&&(t=requestAnimationFrame(n))}function Re(e){e!=1&&ye==k.requestAnimationFrame||((ye=k.requestAnimationFrame)||Le)(Fe)}function ze(e){var t=O,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),O=t}function Be(e){var t=O;e.__c=e.__(),O=t}function Ve(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!be(t,e[n])})}function He(e,t){return typeof t==`function`?t(e):t}var Ue=Symbol.for(`preact-signals`);function We(){if(Ye>1)Ye--;else{var e,t=!1;for((function(){var e=$e;for($e=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();Je!==void 0;){var n=Je;for(Je=void 0,Xe++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&nt(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Xe=0,Ye--,t)throw e}}function Ge(e){if(Ye>0)return e();Qe=++Ze,Ye++;try{return e()}finally{We()}}var Ke,M=void 0;function qe(e){var t=M,n=Ke;M=void 0,Ke=void 0;try{return e()}finally{M=t,Ke=n}}var Je=void 0,Ye=0,Xe=0,Ze=0,Qe=0,$e=void 0,et=0;function tt(e){if(M!==void 0){var t=e.n;if(t===void 0||t.t!==M)return t={i:0,S:e,p:M.s,n:void 0,t:M,e:void 0,x:void 0,r:t},M.s!==void 0&&(M.s.n=t),M.s=t,e.n=t,32&M.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=M.s,t.n=void 0,M.s.n=t,M.s=t),t}}function N(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}N.prototype.brand=Ue,N.prototype.h=function(){return!0},N.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?qe(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},N.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&qe(function(){var e;(e=t.Z)==null||e.call(t)}))}},N.prototype.subscribe=function(e){var t=this;return ut(function(){var n=t.value;qe(function(){return e(n)})},{name:`sub`})},N.prototype.valueOf=function(){return this.value},N.prototype.toString=function(){return this.value+``},N.prototype.toJSON=function(){return this.value},N.prototype.peek=function(){var e=this;return qe(function(){return e.value})},Object.defineProperty(N.prototype,"value",{get:function(){var e=tt(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Xe>100)throw Error(`Cycle detected`);(function(e){Ye!==0&&Xe===0&&e.l!==Qe&&(e.l=Qe,$e={S:e,v:e.v,i:e.i,o:$e})})(this),this.v=e,this.i++,et++,Ye++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{We()}}}});function P(e,t){return new N(e,t)}function nt(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function rt(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function it(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function at(e,t){N.call(this,void 0,t),this.x=e,this.s=void 0,this.g=et-1,this.f=4}at.prototype=new N,at.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===et))return!0;if(this.g=et,this.f|=1,this.i>0&&!nt(this))return this.f&=-2,!0;var e=M;try{rt(this),M=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return M=e,it(this),this.f&=-2,!0},at.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}N.prototype.S.call(this,e)},at.prototype.U=function(e){if(this.t!==void 0&&(N.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},at.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(at.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=tt(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function F(e,t){return new at(e,t)}function ot(e){var t=e.m;if(e.m=void 0,typeof t==`function`){Ye++;var n=M;M=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,st(e),t}finally{M=n,We()}}}function st(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ot(e)}function ct(e){if(M!==this)throw Error(`Out-of-order effect`);it(this),M=e,this.f&=-2,8&this.f&&st(this),We()}function lt(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Ke&&Ke.push(this)}lt.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},lt.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,ot(this),rt(this),Ye++;var e=M;return M=this,ct.bind(this,e)},lt.prototype.N=function(){2&this.f||(this.f|=2,this.u=Je,Je=this)},lt.prototype.d=function(){this.f|=8,1&this.f||st(this)},lt.prototype.dispose=function(){this.d()};function ut(e,t){var n=new lt(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var dt,ft,pt=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,mt=[];ut(function(){dt=this.N})();function ht(e,t){n[e]=t.bind(null,n[e]||function(){})}function gt(e){if(ft){var t=ft;ft=void 0,t()}ft=e&&e.S()}function _t(e){var t=this,n=e.data,r=yt(n);r.name=`ReactiveDom`,r.value=n;var a=Pe(function(){for(var e=t,n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}var a=F(function(){var e=r.value.value;return e===0?0:!0===e?``:e||``}),o=F(function(){return!Array.isArray(a.value)&&!i(a.value)}),s=ut(function(){if(this.N=St,o.value){var t=a.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),c=t.__$u.d;return t.__$u.d=function(){s(),c.call(this)},[o,a]},[]),o=a[0],s=a[1];return o.value?s.peek():s.value}_t.displayName=`ReactiveTextNode`,Object.defineProperties(N.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:_t},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),ht(`__b`,function(e,t){if(gt(),typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof N&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),ht(`__r`,function(e,t){if(e(t),t.type!==S){gt();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return ut(function(){n=this},{name:t}),n.c=e,n}(function(e){return function(){var t;pt&&((t=this.y)==null||t.call(this)),e.__$f|=1,e.setState({})}}(r),typeof t.type==`function`?t.type.displayName||t.type.name:``))),gt(n)}}),ht(`__e`,function(e,t,n,r){gt(),e(t,n,r)}),ht(`diffed`,function(e,t){gt();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=vt(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function vt(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=P(n);return{o:function(e,t){a.value=e,r=t},d:ut(function(){this.N=St;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}ht(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){l.__$f|=8;var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),ht(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),C.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function yt(e,t){return Pe(function(){return P(e,t)},[])}var bt=function(e){queueMicrotask(function(){queueMicrotask(e)})};function xt(){Ge(function(){for(var e;e=mt.shift();)dt.call(e)})}function St(){mt.push(this)===1&&(n.requestAnimationFrame||bt)(xt)}let Ct=P(null),I=P(null),wt=P(!1),Tt=F(()=>Ct.value?`Sign in to Tencil Cloud to pin`:I.value?.access===`read`?`View only: you need write access to the repository to pin`:null),Et=6e4;function Dt(e){return`tencil-cloud-token:${new URL(e).host}`}function Ot(e,t=Date.now()){try{let n=localStorage.getItem(Dt(e));if(!n)return;let r=JSON.parse(n);if(typeof r.token==`string`&&r.expiresAt-Et>t)return r.token;localStorage.removeItem(Dt(e))}catch{}return kt?.bridgeUrl===e&&kt.expiresAt-Et>t?kt.token:void 0}let kt;function At(e,t){kt={...t,bridgeUrl:e};try{localStorage.setItem(Dt(e),JSON.stringify(t))}catch{}}function jt(e){kt=void 0;try{localStorage.removeItem(Dt(e))}catch{}}async function Mt(e,t){let n=window.open(`about:blank`,`tencil-sign-in`,`popup,width=520,height=680`);if(!n)throw Error(`The sign-in window was blocked. Allow popups for this page.`);let r=Ft(64),i=`${Ft(32)}.${It(new TextEncoder().encode(location.origin))}`,a=new URL(t.authorizeUrl);a.search=new URLSearchParams({response_type:`code`,client_id:t.clientId,redirect_uri:t.redirectUri,code_challenge:await Pt(r),code_challenge_method:`S256`,state:i,...t.scope?{scope:t.scope}:{}}).toString(),n.location.href=a.toString(),wt.value=!0;try{let a=await Nt(n,new URL(t.redirectUri).origin,i),o=await fetch(t.tokenUrl,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,client_id:t.clientId,redirect_uri:t.redirectUri,code_verifier:r,code:a})});if(!o.ok)throw Error(`Tencil Cloud refused the sign-in (${o.status})`);let s=await o.json();if(!s.access_token)throw Error(`Tencil Cloud sent no token`);At(e,{token:s.access_token,expiresAt:Date.now()+(s.expires_in??3600)*1e3})}finally{wt.value=!1}}function Nt(e,t,n){return new Promise((r,i)=>{let a=setInterval(()=>{e.closed&&(s(),i(/* @__PURE__ */ Error(`Sign-in was cancelled`)))},500),o=a=>{if(a.origin!==t||a.source!==e)return;let o=a.data;o?.type===`tencil:oauth`&&o.state===n&&(s(),e.close(),o.code?r(o.code):i(Error(o.error??`Sign-in failed`)))},s=()=>{clearInterval(a),window.removeEventListener(`message`,o)};window.addEventListener(`message`,o)})}async function Pt(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return It(new Uint8Array(t))}function Ft(e){return It(crypto.getRandomValues(new Uint8Array(e)))}function It(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function Lt(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));e[6]=(e[6]??0)&15|64,e[8]=(e[8]??0)&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}let L=P(`connecting`),R=P(null),z=P(null),Rt=P(null),zt=P(null),Bt=P(null),Vt=P(null),B=P(/* @__PURE__ */ new Map),Ht=P(null),Ut=P(null),Wt=P(null),Gt=P(null),Kt=P(void 0),qt=P(null),V,Jt=500,Yt=``,Xt,Zt;function Qt(e,t,n){Yt=e,Xt=t,Zt=n,on()}function $t(){return Xt!==void 0}function en(){return Yt}function tn(){let e=V;V=void 0,e?.close(),Jt=500,on()}let nn;function rn(){try{return new URL(Yt).host}catch{return Yt}}function H(e){return V?.readyState===WebSocket.OPEN?(V.send(JSON.stringify(e)),!0):(qt.value={message:`Not connected to the Tencil bridge`,at:Date.now()},!1)}function an(e){let t=new Map(B.value);t.set(e.id,e),B.value=t}function on(){let e=new URL(`/ws`,Yt);e.protocol=e.protocol===`https:`?`wss:`:`ws:`,L.value=`connecting`;let t=new WebSocket(e);V=t,nn=Xt?Ot(Yt):void 0,t.addEventListener(`open`,()=>{Jt=500,t.send(JSON.stringify({type:`hello`,protocol:1,pageUrl:location.href,...Zt&&{root:Zt},...Xt&&{build:Xt},...nn&&{token:nn}}))}),t.addEventListener(`message`,e=>{try{sn(JSON.parse(String(e.data)))}catch(e){console.warn(`[tencil] bad message`,e)}}),t.addEventListener(`close`,()=>{if(V!==t)return;L.value=`closed`;let e=Bt.value?.state===`restarting`;setTimeout(on,e?500:Jt),e||(Jt=Math.min(Jt*2,1e4))})}function sn(e){switch(e.type){case`ready`:Ge(()=>{L.value=`open`,Ct.value=null,I.value=e.viewer??null,Gt.value=null,R.value=e.provider,z.value=e.settings,Rt.value=e.project,Bt.value?.state===`restarting`&&(Vt.value=zt.value),zt.value=e.version,Bt.value=e.update??null,B.value=new Map(e.threads.map(e=>[e.id,e]))});return;case`project.unknown`:Ge(()=>{L.value=`open`,Gt.value=e.choices,Kt.value=e.emptyHint});return;case`auth.required`:nn&&jt(Yt),Ge(()=>{L.value=`open`,I.value=null,Ct.value={signIn:e.signIn,reason:e.reason}});return;case`provider.status`:R.value=e.provider;return;case`update`:Bt.value=e.update;return;case`settings`:Ge(()=>{let t=z.value?.provider!==e.settings.provider;z.value=e.settings,t&&(Ht.value=null,Ut.value=null,Wt.value=null)});return;case`thread.upsert`:an(e.thread);return;case`thread.removed`:{let t=new Map(B.value);t.delete(e.threadId),B.value=t;return}case`provider.models`:Wt.value={provider:e.provider,models:e.models,defaultModel:e.defaultModel};return;case`provider.threads`:Ge(()=>{Ht.value=e.threads,Ut.value=e.project});return;case`error`:qt.value={message:e.message,threadId:e.threadId,at:Date.now()};return}}function cn(e){return z.value?.providers.find(t=>t.id===e)?.label??e}function ln(){V?.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:`provider.threads`}))}function un(){V?.readyState===WebSocket.OPEN&&V.send(JSON.stringify({type:`provider.models`}))}function dn(e){for(let t of B.value.values())if(t.provider.threadId===e.id&&!t.anchor)return t.id;let t=Lt();return H({type:`thread.open`,id:t,providerThreadId:e.id,title:e.title})?t:null}let U=P(`idle`),fn=P(null),W=P(!1),G=P(null),K=P(null),q=P(null),J=P(!1),pn=P(!1),mn=P(!1),hn=P(!1),gn=F(()=>z.value?.batch??!1),_n=P(!1),vn=F(()=>gn.value&&_n.value);function yn(e){let t=z.value;t&&H({type:`settings.update`,batch:e})&&(z.value={...t,batch:e})}let bn=`tencil:ruler`,xn=F(()=>{let e=z.value;return e!==null&&e.ruler!==!1}),Sn=P(En()),Cn=F(()=>xn.value&&Sn.value);function wn(e){let t=z.value;t&&H({type:`settings.update`,ruler:e})&&(z.value={...t,ruler:e})}function Tn(){Sn.value=!Sn.value,G.value=null;try{localStorage.setItem(bn,Sn.value?`on`:`off`)}catch{}}function En(){try{return localStorage.getItem(bn)===`on`}catch{return!1}}let Dn=P(null),On=P(0),kn=P(An(location.href));function An(e){try{let t=new URL(e);return`${t.origin}${t.pathname.replace(/\/$/,``)||`/`}`}catch{return e}}let jn=F(()=>[...B.value.values()].sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),Mn=F(()=>jn.value.filter(e=>e.anchor&&e.pageUrl&&An(e.pageUrl)===kn.value).filter(e=>mn.value||!e.resolved).reverse()),Nn=F(()=>jn.value.filter(e=>!e.resolved).length),Pn=F(()=>[...jn.value].reverse().filter(e=>e.status===`draft`)),Fn=F(()=>jn.value.filter(e=>e.status===`working`||e.status===`starting`).length);function In(){Tt.value||(K.value=null,G.value=null,q.value=null,U.value=`picking`)}function Ln(){U.value=`idle`,fn.value=null}
1
+ (function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n,r,i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/^m(i|n|o|s|text|space)$/,v=Array.isArray,y=g.slice,b=Object.assign;function ee(e){e&&e.parentNode&&e.remove()}function te(e,t,n){var r,i,a,o={},s=arguments.length;for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return s>2&&(o.children=s>3?y.call(arguments,2):n),x(e,o,r,i,null)}function x(e,t,i,a,o){var s={type:e,props:t,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o||++r,__i:-1,__u:0};return!o&&n.vnode&&n.vnode(s),s}function S(e){return e.children}function C(e,t){this.props=e,this.context=t,this.__g=0}function ne(e,t){if(t==null)return e.__?ne(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:ne(e)}function w(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),w(e)}function T(e){(8&e.__g||!(e.__g|=8)||!a.push(e)||s++)&&o==n.debounceRendering||((o=n.debounceRendering)||queueMicrotask)(re)}function re(){var e,t,r,i,o,l,u,d,f;try{for(t=1;a.length;)a.length>t&&a.sort(c),e=a.shift(),t=a.length,8&e.__g&&(i=void 0,o=void 0,l=(o=(r=e).__v).__e,u=[],d=[],(f=r.__P)&&((i=b({constructor:void 0},o)).__v=o.__v+1,n.vnode&&n.vnode(i),de(f,i,o,r.__n,f.namespaceURI,32&o.__u?[l]:null,u,l||ne(o),32&o.__u,d),i.__v=o.__v,i.__.__k[i.__i]=i,pe(u,i,d),o.__=o.__e=null,i.__e!=l&&w(i)))}finally{a.length=s=0}}function ie(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y=r.__k||g,b=t.length;for(c=ae(n,t,y,c,b),d=0;d<b;d++)(p=n.__k[d])!=null&&(f=~p.__i&&y[p.__i]||h,p.__i=d,v=de(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&(f.ref!=p.ref||8&f.__u)&&(f.ref!=p.ref&&f.ref&&E(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_||=m,4&p.__u?(c=oe(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function ae(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m,h=n.length,g=h,_=0,y=!1,b=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor==String?o=b[a]=x(null,o):v(o)?o=b[a]=x(S,{children:o}):o.constructor===void 0&&o.__b?o=b[a]=x(o.type,o.props,o.key,o.ref,o.__v):b[a]=o,c=a+_,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=se(o,n,c,g))&&(g--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=2,l==c-1?_--:l==c+1?_++:l!=c&&(l>c?_--:_++,y=!0)):(~l||(i>h?_--:i<h&&_++),typeof o.type!=`function`&&(o.__u|=4))):b[a]=null;if(y){for(u=[],d=[],a=0;a<i;a++)if((o=b[a])&&2&o.__u){for(f=0,p=u.length;f<p;)u[m=f+p>>1]<o.__i?f=m+1:p=m;u[f]=o.__i,d[a]=f+1}for(_=u.length;a--;)d[a]&&(d[a]==_?_--:b[a].__u|=4)}if(g)for(a=0;a<h;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=ne(s)),he(s,s));return r}function oe(e,t,n,r){var i,a;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=oe(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=ne(e))&&!t.parentNode&&(t=null),e.__e!=t&&(!r&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t&&=t.nextSibling)&&t.nodeType==8;);return t}function se(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ce(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function le(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ce(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ce(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),(e.__e||={})[t+a]=n,n?r?n[u]=r[u]:(n[u]=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`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 n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ue(e){return function(t){if(this.__e){var r=this.__e[t.type+e];if(t[l]==null)t[l]=f++;else if(t[l]<r[u])return;return r(n.event?n.event(t):t)}}}function de(e,t,r,i,a,o,s,c,l,u){var d,f,p,m,h,_,y,te,x,w,T,re,ae,oe,se,ce,le,ue,de,pe,E=t.type;if(t.constructor!==void 0)return null;if(128&r.__u&&(l=32&r.__u,d=r.__c.__z)){if(t.__u|=l,f=o=[],d.nodeType==8)for(p=1,m=d.nextSibling;m;m=m.nextSibling){if(m.nodeType==8){if(m.data.startsWith(`$s`))p++;else if(m.data.startsWith(`/$s`)&&!--p)break}o.push(m)}else o.push(d);c=o[0]}(d=n.__b)&&d(t);n:if(typeof E==`function`){h=s.length;try{if(w=t.props,T=(d=E.prototype)&&d.render,re=(d=E.contextType)&&i[d.__c],ae=d?re?re.props.value:d.__:i,r.__c?2&(_=t.__c=r.__c).__g&&(_.__g|=1):(T?t.__c=_=new E(w,ae):(t.__c=_=new C(w,ae),_.constructor=E,_.render=ge),re&&re.sub(_),_.state||(_.state={}),_.__n=i,_.__g|=8,_.__h=[],_.__k=[]),T&&(_.__s||(_.__s=_.state),E.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=b({},_.__s)),b(_.__s,E.getDerivedStateFromProps(w,_.__s)))),y=_.props,te=_.state,_.__v=t,r.__c){if(T&&!E.getDerivedStateFromProps&&w!==y&&_.componentWillReceiveProps&&_.componentWillReceiveProps(w,ae),t.__v==r.__v&&!(8&_.__g)||!(4&_.__g)&&_.shouldComponentUpdate&&!1===_.shouldComponentUpdate(w,_.__s,ae)){t.__v!=r.__v&&(_.props=w,_.state=_.__s,_.__g&=-9),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(_.__h,_.__k),_.__k=[],_.__h.length&&s.push(_),c=ne(r);break n}_.componentWillUpdate&&_.componentWillUpdate(w,_.__s,ae),T&&_.componentDidUpdate&&_.__h.push(function(){_.componentDidUpdate(y,te,x)})}else T&&!E.getDerivedStateFromProps&&_.componentWillMount&&_.componentWillMount(),T&&_.componentDidMount&&_.__h.push(_.componentDidMount);if(_.context=ae,_.props=w,_.__P=e,_.__g&=-5,oe=n.__r,se=0,T)_.state=_.__s,_.__g&=-9,oe&&oe(t),d=_.render(_.props,_.state,_.context),g.push.apply(_.__h,_.__k),_.__k=[];else do _.__g&=-9,oe&&oe(t),d=_.render(_.props,_.state,_.context),_.state=_.__s;while(8&_.__g&&++se<25);_.state=_.__s,_.getChildContext&&(i=b({},i,_.getChildContext())),T&&r.__c&&_.getSnapshotBeforeUpdate&&(x=_.getSnapshotBeforeUpdate(y,te)),ce=d&&d.type===S&&d.key==null?d.props.children:d,w.__P&&(d=c,a=(e=w.__P).namespaceURI,l=o=null,r.props&&r.props.__P!=e&&(r.__k.some(function(e){e&&he(e,e)}),r.__k=null),c=r.__k?ne(r,0):null),c=ie(e,v(ce)?ce:[ce],t,r,i,a,o,s,c,l,u),w.__P&&(t.__e=null,c=d),t.__u&=-161,128&r.__u&&(_.__z=null),f&&f.some(ee),_.__h.length&&s.push(_),1&_.__g&&(_.__g&=-4)}catch(e){if(s.length=h,t.__v=null,l||o){if(e.then){if(le=0,t.__u|=l?160:128,o){for(de=0;de<o.length;de++)if(pe=o[de]){if(pe.nodeType==8){if(o[de]=null,pe.data.startsWith(`$s`))le++||(ue=pe);else if(pe.data.startsWith(`/$s`)&&!--le){c=pe;break}}else le&&(o[de]=null)}}if(!ue){for(;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o&&(o[o.indexOf(c)]=null),ue=c}t.__c.__z||(t.__c.__z=ue),t.__e=c}else o&&o.some(ee)}else t.__e=r.__e;t.__k||=r.__k||[],e.then||fe(t),n.__e(e,t,r)}}else c=t.__e=me(r.__e,t,r,i,a,o,s,l,u,e);return(d=n.diffed)&&d(t),128&t.__u?void 0:c}function fe(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(fe))}function pe(e,t,r){for(var i=0;i<r.length;)E(r[i++],r[i++],r[i++]);n.__c&&n.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n.__e(e,t.__v)}})}function me(e,t,r,i,a,o,s,c,l,u){var d,f,p,m,g,b,te,x,S,C=r.props||h,w=t.props,T=t.type;if(T==`svg`?a=`http://www.w3.org/2000/svg`:T==`math`?a=`http://www.w3.org/1998/Math/MathML`:a||=`http://www.w3.org/1999/xhtml`,o){for(d=0;d<o.length;d++)if((g=o[d])&&(T?g.localName==T:g.nodeType==3)){e=g,o[d]=null;break}}if(!e){if(x=u.ownerDocument||document,!T)return x.createTextNode(w);e=x.createElementNS(a,T,w.is&&w),c&&=(n.__m&&n.__m(t,o),!1),o=null}if(T){if(u=T==`template`?e.content:e,o=T==`textarea`&&w.defaultValue!=null?null:o&&y.call(u.childNodes),!c&&o)for(C={},d=0;d<e.attributes.length;d++)C[(g=e.attributes[d]).name]=g.value;for(d in C)g=C[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in w||d==`value`&&`defaultValue`in w||d==`checked`&&`defaultChecked`in w||le(e,d,null,g,a);for(d in S=1&r.__u,w)g=w[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?b=g:d==`checked`?te=g:c&&typeof g!=`function`||!(C[d]!==g||S&&g!=null)||le(e,d,g,C[d],a);f?(c||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[]):(p&&(e.textContent=``),(T==`foreignObject`||a==`http://www.w3.org/1998/Math/MathML`&&_.test(T))&&(a=`http://www.w3.org/1999/xhtml`),ie(u,v(m)?m:[m],t,r,i,a,o,s,o?o[0]:r.__k&&ne(r,0),c,l),o&&o.some(ee)),c&&T!=`textarea`||(d=`value`,T==`progress`&&b==null?e.removeAttribute(d):b==null||b===e[d]&&(T!=`progress`||b)||le(e,d,b,C[d],a),d=`checked`,te!=null&&te!=e[d]&&le(e,d,te,C[d],a))}else C===w||c&&e.data==w||(e.data=w);return e}function E(e,t,r){try{typeof e==`function`?(typeof e.__u==`function`&&e.__u(),(typeof e.__u!=`function`||t)&&(e.__u=e(t))):e.current=t}catch(e){n.__e(e,r)}}function he(e,t,r){var i,a;if(n.unmount&&n.unmount(e),!(i=e.ref)||i.current&&i.current!=e.__e||E(i,null,t),i=e.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.__e(e,t)}i.__P=i.__n=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&he(i[a],t,typeof e.type!=`function`||r&&!e.props.__P);(i=e.__e)&&(r||ee(i),i.__e&&(i.__e=null)),e.__e=e.__c=e.__=null}function ge(e,t,n){return this.constructor(e,n)}function _e(e,t){var r,i,a,o;n.__&&n.__(e,t),t.nodeType==9&&(t=t.documentElement),i=(r=e&&32&e.__u)?null:t.__k,t.__k=x(S,{children:[e]}),a=[],o=[],de(t,t.__k,i||h,h,t.namespaceURI,i?null:t.firstChild?y.call(t.childNodes):null,a,i?i.__e:t.firstChild,r,o),pe(a,t.__k,o),t.__k.props.children=null}n={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t,o=0}}throw s=0,e}},r=0,i=function(e){return e!=null&&e.constructor===void 0},C.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=b({},this.state)),typeof e==`function`&&(e=e(b({},n),this.props)),e&&(b(n,e),this.__v&&(t&&this.__k.push(t),T(this)))},C.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),T(this))},C.prototype.render=S,a=[],s=0,c=function(e,t){return e.__v.__b-t.__v.__b},l=Symbol(),u=Symbol(),d=/(PointerCapture)$|Capture$/i,f=0,p=ue(!1),m=ue(!0);var ve,D,ye,be,xe=Object.is,Se=0,Ce=[],we=[],O=n,Te=O.__b,Ee=O.__r,De=O.diffed,Oe=O.__c,ke=O.unmount,Ae=O.__;function je(e,t){O.__h&&O.__h(D,e,Se||t),Se=0;var n=D.__H||(D.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return Se=1,Me(He,e)}function Me(e,t,n){var r=je(ve++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):He(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);xe(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=D,!D.__f)){D.__f=!0;var i=D.shouldComponentUpdate;D.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,xe(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function A(e,t){var n=je(ve++,3);!O.__s&&Ve(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,D.__H.__h.push(n))}function Ne(e,t){var n=je(ve++,4);!O.__s&&Ve(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,D.__h.push(n))}function j(e){return Se=5,Pe(function(){return{current:e}},[])}function Pe(e,t){var n=je(ve++,7);return Ve(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function Fe(){var e;do{for(;e=we.shift();)try{ze(e)}catch(t){O.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Ce.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ze),t.__h.some(Be),t.__h=[]}catch(n){t.__h=[],O.__e(n,e.__v)}}}while(we.length)}O.__b=function(e){D=null,Te&&Te(e)},O.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ae&&Ae(e,t)},O.__r=function(e){Ee&&Ee(e),ve=0;var t=(D=e.__c).__H;t&&(ye==D?D.__h=[]:(t.__h.some(ze),t.__h.some(Be),ve=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),ye=D},O.diffed=function(e){De&&De(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Re(Ce.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),ye=D=null},O.__c=function(e,t){t.some(function(e){try{e.__h.some(ze),e.__h=e.__h.filter(function(e){return!e.__||Be(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],O.__e(n,e.__v)}}),Oe&&Oe(e,t)},O.unmount=function(e){ke&&ke(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,Re(we.push(r))}else ze(r)}catch(e){t=e}}),r.__H=void 0,t&&O.__e(t,r.__v))};var Ie=typeof requestAnimationFrame==`function`;function Le(e){var t,n=function(){clearTimeout(r),Ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ie&&(t=requestAnimationFrame(n))}function Re(e){e!=1&&be==O.requestAnimationFrame||((be=O.requestAnimationFrame)||Le)(Fe)}function ze(e){var t=D,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),D=t}function Be(e){var t=D;e.__c=e.__(),D=t}function Ve(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!xe(t,e[n])})}function He(e,t){return typeof t==`function`?t(e):t}var Ue=Symbol.for(`preact-signals`);function We(){if(Ye>1)Ye--;else{var e,t=!1;for((function(){var e=$e;for($e=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();Je!==void 0;){var n=Je;for(Je=void 0,Xe++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&nt(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Xe=0,Ye--,t)throw e}}function Ge(e){if(Ye>0)return e();Qe=++Ze,Ye++;try{return e()}finally{We()}}var Ke,M=void 0;function qe(e){var t=M,n=Ke;M=void 0,Ke=void 0;try{return e()}finally{M=t,Ke=n}}var Je=void 0,Ye=0,Xe=0,Ze=0,Qe=0,$e=void 0,et=0;function tt(e){if(M!==void 0){var t=e.n;if(t===void 0||t.t!==M)return t={i:0,S:e,p:M.s,n:void 0,t:M,e:void 0,x:void 0,r:t},M.s!==void 0&&(M.s.n=t),M.s=t,e.n=t,32&M.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=M.s,t.n=void 0,M.s.n=t,M.s=t),t}}function N(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}N.prototype.brand=Ue,N.prototype.h=function(){return!0},N.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?qe(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},N.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&qe(function(){var e;(e=t.Z)==null||e.call(t)}))}},N.prototype.subscribe=function(e){var t=this;return ut(function(){var n=t.value;qe(function(){return e(n)})},{name:`sub`})},N.prototype.valueOf=function(){return this.value},N.prototype.toString=function(){return this.value+``},N.prototype.toJSON=function(){return this.value},N.prototype.peek=function(){var e=this;return qe(function(){return e.value})},Object.defineProperty(N.prototype,"value",{get:function(){var e=tt(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Xe>100)throw Error(`Cycle detected`);(function(e){Ye!==0&&Xe===0&&e.l!==Qe&&(e.l=Qe,$e={S:e,v:e.v,i:e.i,o:$e})})(this),this.v=e,this.i++,et++,Ye++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{We()}}}});function P(e,t){return new N(e,t)}function nt(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function rt(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function it(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function at(e,t){N.call(this,void 0,t),this.x=e,this.s=void 0,this.g=et-1,this.f=4}at.prototype=new N,at.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===et))return!0;if(this.g=et,this.f|=1,this.i>0&&!nt(this))return this.f&=-2,!0;var e=M;try{rt(this),M=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return M=e,it(this),this.f&=-2,!0},at.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}N.prototype.S.call(this,e)},at.prototype.U=function(e){if(this.t!==void 0&&(N.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},at.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(at.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=tt(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function F(e,t){return new at(e,t)}function ot(e){var t=e.m;if(e.m=void 0,typeof t==`function`){Ye++;var n=M;M=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,st(e),t}finally{M=n,We()}}}function st(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ot(e)}function ct(e){if(M!==this)throw Error(`Out-of-order effect`);it(this),M=e,this.f&=-2,8&this.f&&st(this),We()}function lt(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Ke&&Ke.push(this)}lt.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},lt.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,ot(this),rt(this),Ye++;var e=M;return M=this,ct.bind(this,e)},lt.prototype.N=function(){2&this.f||(this.f|=2,this.u=Je,Je=this)},lt.prototype.d=function(){this.f|=8,1&this.f||st(this)},lt.prototype.dispose=function(){this.d()};function ut(e,t){var n=new lt(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var dt,ft,pt=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,mt=[];ut(function(){dt=this.N})();function ht(e,t){n[e]=t.bind(null,n[e]||function(){})}function gt(e){if(ft){var t=ft;ft=void 0,t()}ft=e&&e.S()}function _t(e){var t=this,n=e.data,r=yt(n);r.name=`ReactiveDom`,r.value=n;var a=Pe(function(){for(var e=t,n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}var a=F(function(){var e=r.value.value;return e===0?0:!0===e?``:e||``}),o=F(function(){return!Array.isArray(a.value)&&!i(a.value)}),s=ut(function(){if(this.N=St,o.value){var t=a.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),c=t.__$u.d;return t.__$u.d=function(){s(),c.call(this)},[o,a]},[]),o=a[0],s=a[1];return o.value?s.peek():s.value}_t.displayName=`ReactiveTextNode`,Object.defineProperties(N.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:_t},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),ht(`__b`,function(e,t){if(gt(),typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof N&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),ht(`__r`,function(e,t){if(e(t),t.type!==S){gt();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return ut(function(){n=this},{name:t}),n.c=e,n}(function(e){return function(){var t;pt&&((t=this.y)==null||t.call(this)),e.__$f|=1,e.setState({})}}(r),typeof t.type==`function`?t.type.displayName||t.type.name:``))),gt(n)}}),ht(`__e`,function(e,t,n,r){gt(),e(t,n,r)}),ht(`diffed`,function(e,t){gt();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=vt(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function vt(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=P(n);return{o:function(e,t){a.value=e,r=t},d:ut(function(){this.N=St;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}ht(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){l.__$f|=8;var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),ht(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),C.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function yt(e,t){return Pe(function(){return P(e,t)},[])}var bt=function(e){queueMicrotask(function(){queueMicrotask(e)})};function xt(){Ge(function(){for(var e;e=mt.shift();)dt.call(e)})}function St(){mt.push(this)===1&&(n.requestAnimationFrame||bt)(xt)}let Ct=P(null),wt=P(null),Tt=P(!1),Et=F(()=>Ct.value?`Sign in to Tencil Cloud to pin`:wt.value?.access===`read`?`View only: you need write access to the repository to pin`:null),Dt=6e4;function Ot(e){return`tencil-cloud-token:${new URL(e).host}`}function kt(e,t=Date.now()){try{let n=localStorage.getItem(Ot(e));if(!n)return;let r=JSON.parse(n);if(typeof r.token==`string`&&r.expiresAt-Dt>t)return r.token;localStorage.removeItem(Ot(e))}catch{}return At?.bridgeUrl===e&&At.expiresAt-Dt>t?At.token:void 0}let At;function jt(e,t){At={...t,bridgeUrl:e};try{localStorage.setItem(Ot(e),JSON.stringify(t))}catch{}}function Mt(e){At=void 0;try{localStorage.removeItem(Ot(e))}catch{}}async function Nt(e,t){let n=window.open(`about:blank`,`tencil-sign-in`,`popup,width=520,height=680`);if(!n)throw Error(`The sign-in window was blocked. Allow popups for this page.`);let r=It(64),i=`${It(32)}.${Lt(new TextEncoder().encode(location.origin))}`,a=new URL(t.authorizeUrl);a.search=new URLSearchParams({response_type:`code`,client_id:t.clientId,redirect_uri:t.redirectUri,code_challenge:await Ft(r),code_challenge_method:`S256`,state:i,...t.scope?{scope:t.scope}:{}}).toString(),n.location.href=a.toString(),Tt.value=!0;try{let a=await Pt(n,new URL(t.redirectUri).origin,i),o=await fetch(t.tokenUrl,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,client_id:t.clientId,redirect_uri:t.redirectUri,code_verifier:r,code:a})});if(!o.ok)throw Error(`Tencil Cloud refused the sign-in (${o.status})`);let s=await o.json();if(!s.access_token)throw Error(`Tencil Cloud sent no token`);jt(e,{token:s.access_token,expiresAt:Date.now()+(s.expires_in??3600)*1e3})}finally{Tt.value=!1}}function Pt(e,t,n){return new Promise((r,i)=>{let a=setInterval(()=>{e.closed&&(s(),i(/* @__PURE__ */ Error(`Sign-in was cancelled`)))},500),o=a=>{if(a.origin!==t||a.source!==e)return;let o=a.data;o?.type===`tencil:oauth`&&o.state===n&&(s(),e.close(),o.code?r(o.code):i(Error(o.error??`Sign-in failed`)))},s=()=>{clearInterval(a),window.removeEventListener(`message`,o)};window.addEventListener(`message`,o)})}async function Ft(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Lt(new Uint8Array(t))}function It(e){return Lt(crypto.getRandomValues(new Uint8Array(e)))}function Lt(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function Rt(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));e[6]=(e[6]??0)&15|64,e[8]=(e[8]??0)&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}let I=P(`connecting`),L=P(null),R=P(null),zt=P(null),Bt=P(null),Vt=P(null),Ht=P(null),Ut=P(null),Wt=P(null),Gt=P(null),z=P(/* @__PURE__ */ new Map),Kt=P(null),qt=P(null),Jt=P(null),Yt=P(null),Xt=P(void 0),Zt=P(null),B,Qt=500,$t=``,en,tn;function nn(e,t,n){$t=e,en=t,tn=n,un()}function rn(){return en!==void 0}function an(){return $t}function on(){let e=B;B=void 0,e?.close(),Qt=500,un()}let sn;function cn(){try{return new URL($t).host}catch{return $t}}function V(e){return B?.readyState===WebSocket.OPEN?(B.send(JSON.stringify(e)),!0):(Zt.value={message:`Not connected to the Tencil bridge`,at:Date.now()},!1)}function ln(e){let t=new Map(z.value);t.set(e.id,e),z.value=t}function un(){let e=new URL(`/ws`,$t);e.protocol=e.protocol===`https:`?`wss:`:`ws:`,I.value=`connecting`;let t=new WebSocket(e);B=t,sn=en?kt($t):void 0,t.addEventListener(`open`,()=>{Qt=500,t.send(JSON.stringify({type:`hello`,protocol:1,pageUrl:location.href,...tn&&{root:tn},...en&&{build:en},...sn&&{token:sn}}))}),t.addEventListener(`message`,e=>{try{dn(JSON.parse(String(e.data)))}catch(e){console.warn(`[tencil] bad message`,e)}}),t.addEventListener(`close`,()=>{if(B!==t)return;I.value=`closed`;let e=Ut.value?.state===`restarting`;setTimeout(un,e?500:Qt),e||(Qt=Math.min(Qt*2,1e4))})}function dn(e){switch(e.type){case`ready`:Ge(()=>{I.value=`open`,Ct.value=null,wt.value=e.viewer??null,Yt.value=null,L.value=e.provider,R.value=e.settings,zt.value=e.project,Ut.value?.state===`restarting`&&(Gt.value=Ht.value),Ht.value=e.version,Ut.value=e.update??null,z.value=new Map(e.threads.map(e=>[e.id,e]))});return;case`project.unknown`:Ge(()=>{I.value=`open`,Yt.value=e.choices,Xt.value=e.emptyHint});return;case`auth.required`:sn&&Mt($t),Ge(()=>{I.value=`open`,wt.value=null,Ct.value={signIn:e.signIn,reason:e.reason}});return;case`provider.status`:L.value=e.provider;return;case`project.choices`:Bt.value=e.choices;return;case`project.source`:Vt.value=e.source;return;case`preferences`:Wt.value=e.preferences;return;case`update`:Ut.value=e.update;return;case`settings`:Ge(()=>{let t=R.value?.provider!==e.settings.provider;R.value=e.settings,t&&(Kt.value=null,qt.value=null,Jt.value=null)});return;case`thread.upsert`:ln(e.thread);return;case`thread.removed`:{let t=new Map(z.value);t.delete(e.threadId),z.value=t;return}case`provider.models`:Jt.value={provider:e.provider,models:e.models,defaultModel:e.defaultModel};return;case`provider.threads`:Ge(()=>{Kt.value=e.threads,qt.value=e.project});return;case`error`:Zt.value={message:e.message,threadId:e.threadId,at:Date.now()};return}}function fn(e){return R.value?.providers.find(t=>t.id===e)?.label??e}function pn(){B?.readyState===WebSocket.OPEN&&B.send(JSON.stringify({type:`provider.threads`}))}function mn(){B?.readyState===WebSocket.OPEN&&B.send(JSON.stringify({type:`provider.models`}))}function hn(e){for(let t of z.value.values())if(t.provider.threadId===e.id&&!t.anchor)return t.id;let t=Rt();return V({type:`thread.open`,id:t,providerThreadId:e.id,title:e.title})?t:null}let gn=`tencil:shortcuts`,_n=[`Alt`,`Control`,`Meta`,`Shift`],vn=/* @__PURE__ */ new Set([`KeyC`,`KeyV`,`KeyX`,`KeyA`,`KeyZ`,`KeyR`,`KeyL`,`KeyT`,`KeyW`]),yn=(e,t,n={})=>({code:e,key:t,alt:!1,ctrl:!1,meta:!1,shift:!1,...n}),bn={comment:yn(`KeyC`,`C`),ruler:yn(`KeyR`,`R`),hidePins:null,hideDock:yn(`KeyT`,`T`,{alt:!0}),measure:`Alt`},xn=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),H=P(Ln()),Sn=P(!1);function Cn(e){Tn(e),V({type:`preferences.update`,preferences:{shortcuts:e}})}function wn(){Cn(bn)}ut(()=>{let e=Wt.value;e&&(e.shortcuts?In(e.shortcuts,H.peek())||Tn(e.shortcuts):En()!==null&&V({type:`preferences.update`,preferences:{shortcuts:H.peek()}}))});function Tn(e){H.value=e;try{localStorage.setItem(gn,JSON.stringify(e))}catch{}}function En(){try{return localStorage.getItem(gn)}catch{return null}}function Dn(e,t){return e!==null&&t.code===e.code&&t.altKey===e.alt&&t.ctrlKey===e.ctrl&&t.metaKey===e.meta&&t.shiftKey===e.shift}function On(e,t){switch(e){case`Alt`:return t.altKey;case`Control`:return t.ctrlKey;case`Meta`:return t.metaKey;case`Shift`:return t.shiftKey;default:return!1}}function kn(e){return _n.includes(e)}function An(e,t=xn){return t?`${e.ctrl?`⌃`:``}${e.alt?`⌥`:``}${e.shift?`⇧`:``}${e.meta?`⌘`:``}${e.key}`:[e.ctrl&&`Ctrl`,e.alt&&`Alt`,e.shift&&`Shift`,e.meta&&`Win`,e.key].filter(Boolean).join(`+`)}function jn(e,t=xn){return t?{Alt:`⌥ Option`,Control:`⌃ Control`,Meta:`⌘ Command`,Shift:`⇧ Shift`}[e]:{Alt:`Alt`,Control:`Ctrl`,Meta:`Win`,Shift:`Shift`}[e]}let Mn=F(()=>{let e=H.value,t=e=>e?An(e):null;return{comment:t(e.comment),ruler:t(e.ruler),hidePins:t(e.hidePins),hideDock:An(e.hideDock),measure:e.measure?jn(e.measure):null}});function Nn(e){let{key:t=``,code:n=``}=e;return kn(t)?null:t===`Escape`||t===`Tab`||t===`Enter`?{error:`${t} is kept for leaving fields and dialogs.`}:(e.ctrlKey||e.metaKey)&&vn.has(n)?{error:`The browser or the page already uses that one.`}:{code:n,key:Pn(t,n,e.altKey),alt:e.altKey,ctrl:e.ctrlKey,meta:e.metaKey,shift:e.shiftKey}}function Pn(e,t,n){return e.length===1&&e!==` `&&!n?e.toUpperCase():t.startsWith(`Key`)?t.slice(3):t.startsWith(`Digit`)?t.slice(5):t===`Space`?`Space`:e.length===1?e.toUpperCase():e}function Fn(e,t){return e!==null&&t!==null&&e.code===t.code&&e.alt===t.alt&&e.ctrl===t.ctrl&&e.meta===t.meta&&e.shift===t.shift}function In(e,t){let n=(e,t)=>e===t||Fn(e,t)&&e?.key===t?.key;return e.measure===t.measure&&n(e.comment,t.comment)&&n(e.ruler,t.ruler)&&n(e.hidePins,t.hidePins)&&n(e.hideDock,t.hideDock)}function Ln(){try{let e=JSON.parse(localStorage.getItem(gn)??`null`);if(!e||typeof e!=`object`)return bn;let t=e=>e===null||typeof e==`object`&&typeof e.code==`string`&&typeof e.key==`string`;return{comment:t(e.comment)?e.comment:bn.comment,ruler:t(e.ruler)?e.ruler:bn.ruler,hidePins:t(e.hidePins)?e.hidePins:bn.hidePins,hideDock:e.hideDock&&t(e.hideDock)?e.hideDock:bn.hideDock,measure:e.measure===null||kn(e.measure??void 0)?e.measure??null:bn.measure}}catch{return bn}}let U=P(`idle`),Rn=P(null),zn=P(!1),W=P(null),G=P(null),K=P(null),q=P(!1),Bn=P(!1),Vn=P(`overview`),Hn=P(!1),J=P(!1),Un=F(()=>R.value?.batch??!1),Wn=P(!1),Gn=F(()=>Un.value&&Wn.value);function Kn(e){let t=R.value;t&&V({type:`settings.update`,batch:e})&&(R.value={...t,batch:e})}let qn=`tencil:ruler`,Jn=`tencil:dock-hidden`,Yn=P(rr(Jn)),Xn=P(0);function Zn(e){Yn.value=e,Xn.value=e?Date.now():0,ir(Jn,e),e&&(hr(),G.value=null,W.value=null,K.value=null,q.value=!1,Bn.value=!1)}let Qn=F(()=>{let e=R.value;return e!==null&&e.ruler!==!1}),$n=P(rr(qn)),er=F(()=>Qn.value&&$n.value&&!Yn.value);function tr(e){let t=R.value;t&&V({type:`settings.update`,ruler:e})&&(R.value={...t,ruler:e})}function nr(){$n.value=!$n.value,W.value=null,ir(qn,$n.value)}function rr(e){try{return localStorage.getItem(e)===`on`}catch{return!1}}function ir(e,t){try{localStorage.setItem(e,t?`on`:`off`)}catch{}}let ar=P(null),or=P(0),sr=P(cr(location.href));function cr(e){try{let t=new URL(e);return`${t.origin}${t.pathname.replace(/\/$/,``)||`/`}`}catch{return e}}let lr=F(()=>[...z.value.values()].sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),ur=F(()=>lr.value.filter(e=>e.anchor&&e.pageUrl&&cr(e.pageUrl)===sr.value).filter(e=>Hn.value||!e.resolved).reverse()),dr=F(()=>lr.value.filter(e=>!e.resolved).length),fr=F(()=>[...lr.value].reverse().filter(e=>e.status===`draft`)),pr=F(()=>lr.value.filter(e=>e.status===`working`||e.status===`starting`).length);function mr(){Et.value||(G.value=null,W.value=null,K.value=null,U.value=`picking`)}function hr(){U.value=`idle`,Rn.value=null}function gr(e){let{key:t,storageKey:n,fallback:r,parse:i,serialize:a=String}=e,o=()=>{try{return localStorage.getItem(n)}catch{return null}},s=o(),c=P((s===null?void 0:i(s))??r),l=e=>{c.value=e;try{localStorage.setItem(n,a(e))}catch{}},u=e=>V({type:`preferences.update`,preferences:{[t]:e}});return ut(()=>{let e=Wt.value;if(!e)return;let n=e[t];n===void 0?o()!==null&&u(c.peek()):n!==c.peek()&&l(n)}),[c,e=>{l(e),u(e)}]}let _r=[`dark`,`light`,`system`],[vr,yr]=gr({key:`theme`,storageKey:`tencil:theme`,fallback:`dark`,parse:e=>_r.includes(e)?e:void 0}),br=typeof matchMedia==`function`?matchMedia(`(prefers-color-scheme: dark)`):void 0,xr=P(br?.matches??!0);br?.addEventListener(`change`,e=>{xr.value=e.matches});let Sr=F(()=>vr.value===`system`?xr.value:vr.value===`dark`),Cr=`bippy-0.7.3`,wr=Object.defineProperty,Tr=()=>{
2
2
  /**
3
3
  * @license bippy
4
4
  *
@@ -7,7 +7,7 @@
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- let Rn=`bippy-0.7.3`,zn=Object.defineProperty,Bn=()=>{},Vn=e=>e.__REACT_DEVTOOLS_GLOBAL_HOOK__,Hn=e=>Object.assign(e,{[Symbol.dispose]:e}),Un=e=>{let t=e.current.memoizedState;return t===null||t!==void 0&&(t.element===null||t.element===void 0)},Wn=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://react.dev/link/perf-use-production-build`)})}catch{}},Gn=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e&&e._isBippyHook!==!0),Kn=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>{if(!e||typeof e.inject!=`function`||Gn(e))return!1;try{return Function.prototype.toString.call(e.inject).includes(`(injected)`)}catch{return!1}},qn=/* @__PURE__ */ new Set,Jn=/* @__PURE__ */ new Set,Yn=/* @__PURE__ */ new WeakMap,Xn=/* @__PURE__ */ new Set,Zn=/* @__PURE__ */ new Set,Qn=/* @__PURE__ */ new WeakMap,$n=(e,t)=>{qn.add(e);let n=Yn.get(e)??/* @__PURE__ */ new Set;n.add(t),Yn.set(e,n)},er=e=>{for(let t of qn)Yn.get(t)?.has(e)&&t()},tr=(e,t)=>{for(let n of Xn)n.target===e&&n.listener(t)},nr=(e,t)=>{for(let n of Zn)n(e,t)},rr=e=>(Zn.add(e),Hn(()=>{Zn.delete(e)})),ir=e=>Object.prototype.toString.call(e)===`[object Map]`,ar=e=>(ir(e.renderers)||(e.renderers=/* @__PURE__ */ new Map),e.renderers),or=(e,t,n,r,i)=>{n.set(r,i),Jn.add(i),e._instrumentationIsActive||(e._instrumentationIsActive=!0,er(t));let a=Qn.get(t)??/* @__PURE__ */ new WeakSet;Qn.set(t,a),!a.has(i)&&(a.add(i),tr(t,i))},sr=(e,t=globalThis)=>{e&&$n(e,t);let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=e=>{let t=r.get(e)??/* @__PURE__ */ new Set;return r.set(e,t),t},a=0,o={_instrumentationIsActive:!1,_instrumentationSource:Rn,_isBippyHook:!0,checkDCE:Wn,getFiberRoots:i,hasUnsupportedRendererAttached:!1,inject:e=>{let r=++a;return or(o,t,n,r,e),r},on:Bn,onCommitFiberRoot:(e,t)=>{let n=i(e);Un(t)?n.delete(t):n.add(t)},onCommitFiberUnmount:Bn,onPostCommitFiberRoot:Bn,renderers:n,supportsFiber:!0,supportsFlight:!0};try{if(zn(t,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get:()=>o,set:n=>{if(n&&typeof n==`object`){let r=o.renderers;o=n;let i=ar(o);r.forEach((e,t)=>{Jn.add(e),i.set(t,e)}),(r.size>0||Zn.size>0)&&cr(e,t),nr(o,t)}}}),t===globalThis&&typeof window<`u`){let e=window.hasOwnProperty.bind(window),t=Object.getOwnPropertyDescriptor(window,`hasOwnProperty`),n=!1,r=()=>{t?zn(window,`hasOwnProperty`,t):Reflect.deleteProperty(window,`hasOwnProperty`)};zn(window,`hasOwnProperty`,{configurable:!0,value:t=>!n&&t===`__REACT_DEVTOOLS_GLOBAL_HOOK__`?(n=!0,r(),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,!1):e(t),writable:!0})}}catch{cr(e,t)}return o},cr=(e,t=globalThis)=>{e&&$n(e,t);let n=!1,r=Vn(t);if(!r)return;let i=ar(r);if(!r._instrumentationSource){r.checkDCE=Wn,r.supportsFiber=!0,r.supportsFlight=!0,r.hasUnsupportedRendererAttached=!1,r._instrumentationSource=Rn,r._instrumentationIsActive=!1;let e=Gn(r);e||(r.on=Bn),i.size?(i.forEach(e=>Jn.add(e)),r._instrumentationIsActive=!0,er(t),n=!0):!e&&Kn(r)&&(r._instrumentationIsActive=!0,er(t),n=!0);let a=r.inject;r.inject=e=>{let n=a.call(r,e);return or(r,t,i,n,e),n}}!n&&(i.size||r._instrumentationIsActive)&&e?.()},lr=(e=globalThis)=>Object.hasOwn(e,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),ur=(e,t=globalThis)=>lr(t)?(cr(e,t),Vn(t)??sr(e,t)):sr(e,t);
10
+ },Er=e=>e.__REACT_DEVTOOLS_GLOBAL_HOOK__,Dr=e=>Object.assign(e,{[Symbol.dispose]:e}),Or=e=>{let t=e.current.memoizedState;return t===null||t!==void 0&&(t.element===null||t.element===void 0)},kr=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://react.dev/link/perf-use-production-build`)})}catch{}},Ar=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e&&e._isBippyHook!==!0),jr=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>{if(!e||typeof e.inject!=`function`||Ar(e))return!1;try{return Function.prototype.toString.call(e.inject).includes(`(injected)`)}catch{return!1}},Mr=/* @__PURE__ */ new Set,Nr=/* @__PURE__ */ new Set,Pr=/* @__PURE__ */ new WeakMap,Fr=/* @__PURE__ */ new Set,Ir=/* @__PURE__ */ new Set,Lr=/* @__PURE__ */ new WeakMap,Rr=(e,t)=>{Mr.add(e);let n=Pr.get(e)??/* @__PURE__ */ new Set;n.add(t),Pr.set(e,n)},zr=e=>{for(let t of Mr)Pr.get(t)?.has(e)&&t()},Br=(e,t)=>{for(let n of Fr)n.target===e&&n.listener(t)},Vr=(e,t)=>{for(let n of Ir)n(e,t)},Hr=e=>(Ir.add(e),Dr(()=>{Ir.delete(e)})),Ur=e=>Object.prototype.toString.call(e)===`[object Map]`,Wr=e=>(Ur(e.renderers)||(e.renderers=/* @__PURE__ */ new Map),e.renderers),Gr=(e,t,n,r,i)=>{n.set(r,i),Nr.add(i),e._instrumentationIsActive||(e._instrumentationIsActive=!0,zr(t));let a=Lr.get(t)??/* @__PURE__ */ new WeakSet;Lr.set(t,a),!a.has(i)&&(a.add(i),Br(t,i))},Kr=(e,t=globalThis)=>{e&&Rr(e,t);let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=e=>{let t=r.get(e)??/* @__PURE__ */ new Set;return r.set(e,t),t},a=0,o={_instrumentationIsActive:!1,_instrumentationSource:Cr,_isBippyHook:!0,checkDCE:kr,getFiberRoots:i,hasUnsupportedRendererAttached:!1,inject:e=>{let r=++a;return Gr(o,t,n,r,e),r},on:Tr,onCommitFiberRoot:(e,t)=>{let n=i(e);Or(t)?n.delete(t):n.add(t)},onCommitFiberUnmount:Tr,onPostCommitFiberRoot:Tr,renderers:n,supportsFiber:!0,supportsFlight:!0};try{if(wr(t,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get:()=>o,set:n=>{if(n&&typeof n==`object`){let r=o.renderers;o=n;let i=Wr(o);r.forEach((e,t)=>{Nr.add(e),i.set(t,e)}),(r.size>0||Ir.size>0)&&qr(e,t),Vr(o,t)}}}),t===globalThis&&typeof window<`u`){let e=window.hasOwnProperty.bind(window),t=Object.getOwnPropertyDescriptor(window,`hasOwnProperty`),n=!1,r=()=>{t?wr(window,`hasOwnProperty`,t):Reflect.deleteProperty(window,`hasOwnProperty`)};wr(window,`hasOwnProperty`,{configurable:!0,value:t=>!n&&t===`__REACT_DEVTOOLS_GLOBAL_HOOK__`?(n=!0,r(),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,!1):e(t),writable:!0})}}catch{qr(e,t)}return o},qr=(e,t=globalThis)=>{e&&Rr(e,t);let n=!1,r=Er(t);if(!r)return;let i=Wr(r);if(!r._instrumentationSource){r.checkDCE=kr,r.supportsFiber=!0,r.supportsFlight=!0,r.hasUnsupportedRendererAttached=!1,r._instrumentationSource=Cr,r._instrumentationIsActive=!1;let e=Ar(r);e||(r.on=Tr),i.size?(i.forEach(e=>Nr.add(e)),r._instrumentationIsActive=!0,zr(t),n=!0):!e&&jr(r)&&(r._instrumentationIsActive=!0,zr(t),n=!0);let a=r.inject;r.inject=e=>{let n=a.call(r,e);return Gr(r,t,i,n,e),n}}!n&&(i.size||r._instrumentationIsActive)&&e?.()},Jr=(e=globalThis)=>Object.hasOwn(e,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),Yr=(e,t=globalThis)=>Jr(t)?(qr(e,t),Er(t)??Kr(e,t)):Kr(e,t);
11
11
  /**
12
12
  * @license bippy
13
13
  *
@@ -16,7 +16,7 @@ let Rn=`bippy-0.7.3`,zn=Object.defineProperty,Bn=()=>{},Vn=e=>e.__REACT_DEVTOOLS
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
18
  */
19
- try{ur()}catch{}
19
+ try{Yr()}catch{}
20
20
  /**
21
21
  * @license bippy
22
22
  *
@@ -25,7 +25,7 @@ try{ur()}catch{}
25
25
  * This source code is licensed under the MIT license found in the
26
26
  * LICENSE file in the root directory of this source tree.
27
27
  */
28
- let dr=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,fr=/^\d+$/,pr=e=>mr(e)!==null,mr=e=>{let t=dr.exec(e);if(!t)return null;let n=t[4]?.split(`.`)??[];return n.some(e=>fr.test(e)&&e.length>1&&e.startsWith(`0`))?null:{major:t[1],minor:t[2],patch:t[3],prerelease:n}},hr=(e,t)=>e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1,gr=(e,t)=>{let n=fr.test(e),r=fr.test(t);return n&&r?hr(e,t):n===r?e===t?0:e<t?-1:1:n?-1:1},_r=(e,t)=>{if(e.length===0||t.length===0)return e.length===t.length?0:e.length===0?1:-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===void 0||i===void 0)return n===void 0?-1:1;let a=gr(n,i);if(a!==0)return a}return 0},vr=(e,t)=>{let n=mr(e),r=mr(t);if(!n||!r)return null;let i=hr(n.major,r.major);if(i!==0)return i;let a=hr(n.minor,r.minor);if(a!==0)return a;let o=hr(n.patch,r.patch);return o===0?_r(n.prerelease,r.prerelease):o},yr={ChildDeletion:16,Cloned:8,ContentReset:32,Hydrating:4096,PerformedWork:1,Placement:2,Snapshot:1024,Update:4,Visibility:8192},br=(e=>e)({"16.0.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:12,ContextProvider:13,CoroutineComponent:7,CoroutineHandlerPhase:8,DehydratedSuspenseComponent:-1,ForwardRef:14,Fragment:10,FunctionComponent:1,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:0,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:11,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:9},"16.4.3-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:11,ContextProvider:12,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:-1,ForwardRef:13,Fragment:9,FunctionComponent:0,HostComponent:7,HostHoistable:-1,HostPortal:6,HostRoot:5,HostSingleton:-1,HostText:8,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:4,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:10,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"16.6.0-beta.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:-1,MemoComponent:14,Mode:8,OffscreenComponent:-1,Profiler:12,ScopeComponent:-1,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.0-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:24,MemoComponent:14,Mode:8,OffscreenComponent:23,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.2":{ActivityComponent:31,CacheComponent:24,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:26,HostPortal:4,HostRoot:3,HostSingleton:27,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:28,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:23,MemoComponent:14,Mode:8,OffscreenComponent:22,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:29,TracingMarkerComponent:25,ViewTransitionComponent:30,YieldComponent:-1}}),xr=[{isMinimumExcluded:!0,minimumVersion:`17.0.1`,workTags:br[`17.0.2`]},{isMinimumExcluded:!1,minimumVersion:`17.0.0-alpha`,workTags:br[`17.0.0-alpha`]},{isMinimumExcluded:!1,minimumVersion:`16.6.0-beta.0`,workTags:br[`16.6.0-beta.0`]},{isMinimumExcluded:!1,minimumVersion:`16.4.3-alpha`,workTags:br[`16.4.3-alpha`]}],Sr=br[`17.0.2`],Cr=e=>{if(e===void 0)return Sr;for(let t of xr){let n=vr(e,t.minimumVersion);if(n===null)return Sr;if(n===1||n===0&&!t.isMinimumExcluded)return t.workTags}return br[`16.0.0`]},wr=Cr(),Tr=/* @__PURE__ */ new WeakMap,Er=e=>e.startsWith(`0.0.0-`)?wr:Cr(e),Dr=e=>{let t=e?.reconcilerVersion;return t&&pr(t)?Er(t):e?.version?Er(e.version):wr},Or=(e,t)=>{let n=Dr(t);Tr.set(e,n),e.alternate&&Tr.set(e.alternate,n)},kr=e=>{let t=Tr.get(e);if(t)return t;let n=[e],r=e;for(;r.return;)r=r.return,n.push(r);let i=Tr.get(r)??wr;for(let e of n)Tr.set(e,i),e.alternate&&Tr.set(e.alternate,i);return i};yr.Placement|yr.Update|yr.ChildDeletion|yr.ContentReset|yr.Hydrating|yr.Visibility|yr.Snapshot;var Ar=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`BippyError`}},jr=class extends Ar{constructor(e,t){super(e,t),this.name=`BippyHookInspectionError`}},Mr=class extends jr{constructor(e,t){super(e,t),this.name=`BippyUnsupportedHookError`}},Nr=class extends Ar{constructor(e,t){super(e,t),this.name=`BippySourceMapError`}};let Pr=e=>typeof e==`function`,Fr=e=>{let t=`displayName`in e?e.displayName:null;if(typeof t==`string`&&t)return t;let n=`name`in e?e.name:null;return typeof n==`string`&&n?n:null},Ir=e=>typeof e==`object`&&!!e&&`tag`in e&&`stateNode`in e&&`return`in e&&`child`in e&&`sibling`in e&&`flags`in e,Lr=e=>{let t=kr(e);switch(e.tag){case t.HostComponent:case t.HostText:case t.HostHoistable:case t.HostSingleton:return!0;default:return!1}},Rr=e=>{let t=kr(e);switch(e.tag){case t.ClassComponent:case t.ForwardRef:case t.FunctionComponent:case t.MemoComponent:case t.SimpleMemoComponent:return!0;default:return!1}};function zr(e,t,n=!1){if(!e)return null;let r=t(e);return Br(r)?Promise.resolve(r).then(r=>r===!0?e:Vr(e,t,n)):r===!0?e:Vr(e,t,n)}let Br=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,Vr=(e,t,n)=>{let r=n?e.return:e.child;return Hr(r,t,n)},Hr=(e,t,n)=>{if(!e)return null;let r=n?null:e.sibling,i=zr(e,t,n);return Br(i)?Promise.resolve(i).then(e=>e??Hr(r,t,n)):i??Hr(r,t,n)},Ur=e=>Pr(e)?e:typeof e!=`object`||!e?null:Ur(Reflect.get(e,`type`)??Reflect.get(e,`render`)),Wr=e=>{if(typeof e==`string`)return e;if(typeof e!=`function`&&typeof e!=`object`||e===null)return null;let t=Fr(e);if(t)return t;let n=Ur(e);return n?Fr(n):null},Gr=/* @__PURE__ */ new Set,Kr=/* @__PURE__ */ new WeakMap,qr=/* @__PURE__ */ new WeakMap,Jr=/* @__PURE__ */ new WeakMap,Yr=/* @__PURE__ */ new Map;typeof FinalizationRegistry==`function`&&new FinalizationRegistry(e=>{Yr.get(e)?.deref()||Yr.delete(e)});let Xr=e=>{let t=e.alternate?[e,e.alternate]:[e],n=/* @__PURE__ */ new Set;for(let e of t){let t=Jr.get(e);t!==void 0&&n.add(t),Jr.delete(e)}for(let e of n){let n=Yr.get(e)?.deref();(!n||t.includes(n))&&Yr.delete(e)}},Zr=/* @__PURE__ */ new Set,Qr=/* @__PURE__ */ new WeakMap,$r=/* @__PURE__ */ new WeakMap,ei=!1,ti=e=>{let t=Qr.get(e)??{};if(Qr.set(e,t),!t.onCommitFiberRoot||e.onCommitFiberRoot!==t.onCommitFiberRoot){let n=e.onCommitFiberRoot,r=(t,i,a,o)=>{if(n&&n.call(e,t,i,a,o),Qr.get(e)?.onCommitFiberRoot===r){Or(i.current,e.renderers.get(t)),Un(i)?(Gr.delete(i),Kr.delete(i),qr.delete(i)):(Gr.add(i),Kr.set(i,t),qr.set(i,e));for(let{options:n,target:r}of Zr)r===$r.get(e)&&n.onCommitFiberRoot&&n.onCommitFiberRoot(t,i,a,o)}};t.onCommitFiberRoot=r,e.onCommitFiberRoot=r}if(!t.onCommitFiberUnmount||e.onCommitFiberUnmount!==t.onCommitFiberUnmount){let n=e.onCommitFiberUnmount,r=(t,i)=>{if(Or(i,e.renderers.get(t)),n&&n.call(e,t,i),Qr.get(e)?.onCommitFiberUnmount===r)try{for(let{options:n,target:r}of Zr)r===$r.get(e)&&n.onCommitFiberUnmount&&n.onCommitFiberUnmount(t,i)}finally{Xr(i)}};t.onCommitFiberUnmount=r,e.onCommitFiberUnmount=r}if(!t.onPostCommitFiberRoot||e.onPostCommitFiberRoot!==t.onPostCommitFiberRoot){let n=e.onPostCommitFiberRoot,r=(t,i)=>{if(n&&n.call(e,t,i),Qr.get(e)?.onPostCommitFiberRoot===r)for(let{options:n,target:r}of Zr)r===$r.get(e)&&n.onPostCommitFiberRoot&&n.onPostCommitFiberRoot(t,i)};t.onPostCommitFiberRoot=r,e.onPostCommitFiberRoot=r}if(!t.onScheduleFiberRoot||e.onScheduleFiberRoot!==t.onScheduleFiberRoot){let n=e.onScheduleFiberRoot,r=(t,i,a)=>{if(n&&n.call(e,t,i,a),Qr.get(e)?.onScheduleFiberRoot===r)for(let{options:n,target:r}of Zr)r===$r.get(e)&&n.onScheduleFiberRoot&&n.onScheduleFiberRoot(t,i,a)};t.onScheduleFiberRoot=r,e.onScheduleFiberRoot=r}},ni=(e,t)=>{$r.set(e,t),ti(e)},ri=(e,t=globalThis)=>{ei||=(rr(ni),!0),$r.set(e,t),ti(e)};try{lr()&&ri(ur())}catch{}let ii=/* @__PURE__ */ new Set,ai=e=>e.startsWith(`__reactContainer$`)||e.startsWith(`__reactInternalInstance$`)||e.startsWith(`__reactFiber`),oi=e=>{let t=Reflect.get(e,`_reactRootContainer`);if(typeof t!=`object`||!t)return null;let n=Reflect.get(t,`_internalRoot`);if(typeof n!=`object`||!n)return null;let r=Reflect.get(n,`current`);if(typeof r!=`object`||!r)return null;let i=Reflect.get(r,`child`);return Ir(i)?i:null},si=e=>{let t=Reflect.get(e,`__internalInstanceHandle`)??Reflect.get(e,`_internalInstanceHandle`);return Ir(t)?t:null},ci=e=>{if(typeof e!=`object`||!e)return e;let t=Reflect.get(e,`canonical`);if(typeof t==`object`&&t){let e=Reflect.get(t,`publicInstance`);if(typeof e==`object`&&e)return e}let n=Reflect.get(e,`_nativeTag`);return typeof n==`number`?n:e},li=(e,t=globalThis)=>{let n=t.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n)for(let t of n.renderers.values())try{let n=t.findFiberByHostInstance?.(e);if(n)return n}catch{}if(typeof e==`object`&&e){let t=oi(e);if(t)return t;let n=si(e);if(n)return n;for(let t of ii){let n=Reflect.get(e,t);if(Ir(n))return n}for(let t of Object.keys(e))if(ai(t)){ii.add(t);let n=Reflect.get(e,t);if(Ir(n))return n}}if(e!=null&&(typeof e==`object`||typeof e==`number`)){let t=/* @__PURE__ */ new Set;if(n?.getFiberRoots)for(let e of n.renderers.keys())for(let r of n.getFiberRoots(e))t.add(r);for(let e of Gr)qr.get(e)===n&&t.add(e);for(let n of t){let t=zr(n.current,t=>Lr(t)&&ci(t.stateNode)===e);if(t)return t}}return null};Reflect.get(/* @__PURE__ */ t({useEffect:()=>void 0,useReducer:()=>void 0,useRef:()=>void 0}),`useSyncExternalStore`);
28
+ let Xr=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,Zr=/^\d+$/,Qr=e=>$r(e)!==null,$r=e=>{let t=Xr.exec(e);if(!t)return null;let n=t[4]?.split(`.`)??[];return n.some(e=>Zr.test(e)&&e.length>1&&e.startsWith(`0`))?null:{major:t[1],minor:t[2],patch:t[3],prerelease:n}},ei=(e,t)=>e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1,ti=(e,t)=>{let n=Zr.test(e),r=Zr.test(t);return n&&r?ei(e,t):n===r?e===t?0:e<t?-1:1:n?-1:1},ni=(e,t)=>{if(e.length===0||t.length===0)return e.length===t.length?0:e.length===0?1:-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===void 0||i===void 0)return n===void 0?-1:1;let a=ti(n,i);if(a!==0)return a}return 0},ri=(e,t)=>{let n=$r(e),r=$r(t);if(!n||!r)return null;let i=ei(n.major,r.major);if(i!==0)return i;let a=ei(n.minor,r.minor);if(a!==0)return a;let o=ei(n.patch,r.patch);return o===0?ni(n.prerelease,r.prerelease):o},ii={ChildDeletion:16,Cloned:8,ContentReset:32,Hydrating:4096,PerformedWork:1,Placement:2,Snapshot:1024,Update:4,Visibility:8192},ai=(e=>e)({"16.0.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:12,ContextProvider:13,CoroutineComponent:7,CoroutineHandlerPhase:8,DehydratedSuspenseComponent:-1,ForwardRef:14,Fragment:10,FunctionComponent:1,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:0,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:11,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:9},"16.4.3-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:11,ContextProvider:12,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:-1,ForwardRef:13,Fragment:9,FunctionComponent:0,HostComponent:7,HostHoistable:-1,HostPortal:6,HostRoot:5,HostSingleton:-1,HostText:8,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:4,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:10,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"16.6.0-beta.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:-1,MemoComponent:14,Mode:8,OffscreenComponent:-1,Profiler:12,ScopeComponent:-1,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.0-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:24,MemoComponent:14,Mode:8,OffscreenComponent:23,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.2":{ActivityComponent:31,CacheComponent:24,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:26,HostPortal:4,HostRoot:3,HostSingleton:27,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:28,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:23,MemoComponent:14,Mode:8,OffscreenComponent:22,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:29,TracingMarkerComponent:25,ViewTransitionComponent:30,YieldComponent:-1}}),oi=[{isMinimumExcluded:!0,minimumVersion:`17.0.1`,workTags:ai[`17.0.2`]},{isMinimumExcluded:!1,minimumVersion:`17.0.0-alpha`,workTags:ai[`17.0.0-alpha`]},{isMinimumExcluded:!1,minimumVersion:`16.6.0-beta.0`,workTags:ai[`16.6.0-beta.0`]},{isMinimumExcluded:!1,minimumVersion:`16.4.3-alpha`,workTags:ai[`16.4.3-alpha`]}],si=ai[`17.0.2`],ci=e=>{if(e===void 0)return si;for(let t of oi){let n=ri(e,t.minimumVersion);if(n===null)return si;if(n===1||n===0&&!t.isMinimumExcluded)return t.workTags}return ai[`16.0.0`]},li=ci(),ui=/* @__PURE__ */ new WeakMap,di=e=>e.startsWith(`0.0.0-`)?li:ci(e),fi=e=>{let t=e?.reconcilerVersion;return t&&Qr(t)?di(t):e?.version?di(e.version):li},pi=(e,t)=>{let n=fi(t);ui.set(e,n),e.alternate&&ui.set(e.alternate,n)},mi=e=>{let t=ui.get(e);if(t)return t;let n=[e],r=e;for(;r.return;)r=r.return,n.push(r);let i=ui.get(r)??li;for(let e of n)ui.set(e,i),e.alternate&&ui.set(e.alternate,i);return i};ii.Placement|ii.Update|ii.ChildDeletion|ii.ContentReset|ii.Hydrating|ii.Visibility|ii.Snapshot;var hi=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`BippyError`}},gi=class extends hi{constructor(e,t){super(e,t),this.name=`BippyHookInspectionError`}},_i=class extends gi{constructor(e,t){super(e,t),this.name=`BippyUnsupportedHookError`}},vi=class extends hi{constructor(e,t){super(e,t),this.name=`BippySourceMapError`}};let yi=e=>typeof e==`function`,bi=e=>{let t=`displayName`in e?e.displayName:null;if(typeof t==`string`&&t)return t;let n=`name`in e?e.name:null;return typeof n==`string`&&n?n:null},xi=e=>typeof e==`object`&&!!e&&`tag`in e&&`stateNode`in e&&`return`in e&&`child`in e&&`sibling`in e&&`flags`in e,Si=e=>{let t=mi(e);switch(e.tag){case t.HostComponent:case t.HostText:case t.HostHoistable:case t.HostSingleton:return!0;default:return!1}},Ci=e=>{let t=mi(e);switch(e.tag){case t.ClassComponent:case t.ForwardRef:case t.FunctionComponent:case t.MemoComponent:case t.SimpleMemoComponent:return!0;default:return!1}};function wi(e,t,n=!1){if(!e)return null;let r=t(e);return Ti(r)?Promise.resolve(r).then(r=>r===!0?e:Ei(e,t,n)):r===!0?e:Ei(e,t,n)}let Ti=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,Ei=(e,t,n)=>{let r=n?e.return:e.child;return Di(r,t,n)},Di=(e,t,n)=>{if(!e)return null;let r=n?null:e.sibling,i=wi(e,t,n);return Ti(i)?Promise.resolve(i).then(e=>e??Di(r,t,n)):i??Di(r,t,n)},Oi=e=>yi(e)?e:typeof e!=`object`||!e?null:Oi(Reflect.get(e,`type`)??Reflect.get(e,`render`)),ki=e=>{if(typeof e==`string`)return e;if(typeof e!=`function`&&typeof e!=`object`||e===null)return null;let t=bi(e);if(t)return t;let n=Oi(e);return n?bi(n):null},Ai=/* @__PURE__ */ new Set,ji=/* @__PURE__ */ new WeakMap,Mi=/* @__PURE__ */ new WeakMap,Ni=/* @__PURE__ */ new WeakMap,Pi=/* @__PURE__ */ new Map;typeof FinalizationRegistry==`function`&&new FinalizationRegistry(e=>{Pi.get(e)?.deref()||Pi.delete(e)});let Fi=e=>{let t=e.alternate?[e,e.alternate]:[e],n=/* @__PURE__ */ new Set;for(let e of t){let t=Ni.get(e);t!==void 0&&n.add(t),Ni.delete(e)}for(let e of n){let n=Pi.get(e)?.deref();(!n||t.includes(n))&&Pi.delete(e)}},Ii=/* @__PURE__ */ new Set,Li=/* @__PURE__ */ new WeakMap,Ri=/* @__PURE__ */ new WeakMap,zi=!1,Bi=e=>{let t=Li.get(e)??{};if(Li.set(e,t),!t.onCommitFiberRoot||e.onCommitFiberRoot!==t.onCommitFiberRoot){let n=e.onCommitFiberRoot,r=(t,i,a,o)=>{if(n&&n.call(e,t,i,a,o),Li.get(e)?.onCommitFiberRoot===r){pi(i.current,e.renderers.get(t)),Or(i)?(Ai.delete(i),ji.delete(i),Mi.delete(i)):(Ai.add(i),ji.set(i,t),Mi.set(i,e));for(let{options:n,target:r}of Ii)r===Ri.get(e)&&n.onCommitFiberRoot&&n.onCommitFiberRoot(t,i,a,o)}};t.onCommitFiberRoot=r,e.onCommitFiberRoot=r}if(!t.onCommitFiberUnmount||e.onCommitFiberUnmount!==t.onCommitFiberUnmount){let n=e.onCommitFiberUnmount,r=(t,i)=>{if(pi(i,e.renderers.get(t)),n&&n.call(e,t,i),Li.get(e)?.onCommitFiberUnmount===r)try{for(let{options:n,target:r}of Ii)r===Ri.get(e)&&n.onCommitFiberUnmount&&n.onCommitFiberUnmount(t,i)}finally{Fi(i)}};t.onCommitFiberUnmount=r,e.onCommitFiberUnmount=r}if(!t.onPostCommitFiberRoot||e.onPostCommitFiberRoot!==t.onPostCommitFiberRoot){let n=e.onPostCommitFiberRoot,r=(t,i)=>{if(n&&n.call(e,t,i),Li.get(e)?.onPostCommitFiberRoot===r)for(let{options:n,target:r}of Ii)r===Ri.get(e)&&n.onPostCommitFiberRoot&&n.onPostCommitFiberRoot(t,i)};t.onPostCommitFiberRoot=r,e.onPostCommitFiberRoot=r}if(!t.onScheduleFiberRoot||e.onScheduleFiberRoot!==t.onScheduleFiberRoot){let n=e.onScheduleFiberRoot,r=(t,i,a)=>{if(n&&n.call(e,t,i,a),Li.get(e)?.onScheduleFiberRoot===r)for(let{options:n,target:r}of Ii)r===Ri.get(e)&&n.onScheduleFiberRoot&&n.onScheduleFiberRoot(t,i,a)};t.onScheduleFiberRoot=r,e.onScheduleFiberRoot=r}},Vi=(e,t)=>{Ri.set(e,t),Bi(e)},Hi=(e,t=globalThis)=>{zi||=(Hr(Vi),!0),Ri.set(e,t),Bi(e)};try{Jr()&&Hi(Yr())}catch{}let Ui=/* @__PURE__ */ new Set,Wi=e=>e.startsWith(`__reactContainer$`)||e.startsWith(`__reactInternalInstance$`)||e.startsWith(`__reactFiber`),Gi=e=>{let t=Reflect.get(e,`_reactRootContainer`);if(typeof t!=`object`||!t)return null;let n=Reflect.get(t,`_internalRoot`);if(typeof n!=`object`||!n)return null;let r=Reflect.get(n,`current`);if(typeof r!=`object`||!r)return null;let i=Reflect.get(r,`child`);return xi(i)?i:null},Ki=e=>{let t=Reflect.get(e,`__internalInstanceHandle`)??Reflect.get(e,`_internalInstanceHandle`);return xi(t)?t:null},qi=e=>{if(typeof e!=`object`||!e)return e;let t=Reflect.get(e,`canonical`);if(typeof t==`object`&&t){let e=Reflect.get(t,`publicInstance`);if(typeof e==`object`&&e)return e}let n=Reflect.get(e,`_nativeTag`);return typeof n==`number`?n:e},Ji=(e,t=globalThis)=>{let n=t.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n)for(let t of n.renderers.values())try{let n=t.findFiberByHostInstance?.(e);if(n)return n}catch{}if(typeof e==`object`&&e){let t=Gi(e);if(t)return t;let n=Ki(e);if(n)return n;for(let t of Ui){let n=Reflect.get(e,t);if(xi(n))return n}for(let t of Object.keys(e))if(Wi(t)){Ui.add(t);let n=Reflect.get(e,t);if(xi(n))return n}}if(e!=null&&(typeof e==`object`||typeof e==`number`)){let t=/* @__PURE__ */ new Set;if(n?.getFiberRoots)for(let e of n.renderers.keys())for(let r of n.getFiberRoots(e))t.add(r);for(let e of Ai)Mi.get(e)===n&&t.add(e);for(let n of t){let t=wi(n.current,t=>Si(t)&&qi(t.stateNode)===e);if(t)return t}}return null};Reflect.get(/* @__PURE__ */ t({useEffect:()=>void 0,useReducer:()=>void 0,useRef:()=>void 0}),`useSyncExternalStore`);
29
29
  /**
30
30
  * @license bippy
31
31
  *
@@ -42,35 +42,36 @@ let dr=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za
42
42
  * This source code is licensed under the MIT license found in the
43
43
  * LICENSE file in the root directory of this source tree.
44
44
  */
45
- let ui=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,di=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],fi=[`rsc://`,`about://React/`],pi=[`<anonymous>`,`eval`,``],mi=/\.(cjs|cts|js|jsx|mdx|mjs|mts|ts|tsx)$/,hi=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,gi=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,_i=/\[[^\]]+\]$/,vi=[`react_stack_bottom_frame`,`react-stack-bottom-frame`],yi=Error,bi=()=>yi.prepareStackTrace,xi=e=>{yi.prepareStackTrace=e},Si=/(^|@)\S+:\d+/,Ci=/^\s*at .*(\S+:\d+|\(native\))/m,wi=/^(eval@)?(\[native code\])?$/,Ti=(e,t)=>{if(t?.includeInElement!==!1){let t=e.split(`
46
- `),n=[];for(let e of t)if(/^\s*at\s+/.test(e)){let t=Di(e)[0];t&&n.push(t)}else if(/^\s*in\s+/.test(e)){let t=e.replace(/^\s*in\s+/,``).replace(/\s*(?:\(at .*\)|\[[^\]]+\])$/,``);n.push({functionName:t,source:e})}else if(e.match(Si)){let t=Oi(e)[0];t&&n.push(t)}return n}return e.match(Ci)?Di(e):Oi(e)},Ei=e=>{if(!e.includes(`:`))return[e,void 0,void 0];let t=e.startsWith(`(`)&&/:\d+\)$/.test(e)?e.slice(1,-1):e,n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t);return n?[n[1],n[2]||void 0,n[3]||void 0]:[t,void 0,void 0]},Di=e=>e.split(`
47
- `).filter(e=>!!e.match(Ci)).map(e=>{let t=e;t.includes(`(eval `)&&(t=t.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let n=t.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],``):n;let i=Ei(r?r[1]:n);return{functionName:r&&n||void 0,fileName:[`eval`,`<anonymous>`,`(native)`].includes(i[0])?void 0:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}),Oi=e=>e.split(`
48
- `).filter(e=>!e.match(wi)).map(e=>{let t=e;if(t.includes(` > eval`)&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),!t.includes(`@`)&&!t.includes(`:`))return{functionName:t};{let e=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=t.match(e),r=n&&n[1]?n[1]:void 0,i=Ei(t.replace(e,``));return{functionName:r,fileName:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}}),ki=/* @__PURE__ */ new WeakMap,Ai=e=>vi.some(t=>e.includes(t)),ji=e=>{let t=e.getFunctionName?.()??``;if(t)return t;let n=e.getTypeName?.()??``,r=e.getMethodName?.()??``;return n&&r?`${n}.${r}`:r},Mi=e=>{let t=[];for(let n=1;n<e.length;n++){let r=e[n],i=ji(r);if(Ai(i))return{frames:t,isTrusted:!0};if(r.isNative?.()){t.push({functionName:i||void 0});continue}let a=r.getScriptNameOrSourceURL?.()??``;!a&&r.isEval?.()&&(a=r.getEvalOrigin?.()??``),t.push({functionName:i&&i!==`<anonymous>`?i:void 0,fileName:a&&a!==`<anonymous>`?a:void 0,lineNumber:r.getLineNumber?.()??void 0,columnNumber:r.getColumnNumber?.()??void 0,enclosingLineNumber:r.getEnclosingLineNumber?.()??void 0,enclosingColumnNumber:r.getEnclosingColumnNumber?.()??void 0,source:` at ${r.toString()}`})}return{frames:t,isTrusted:!1}},Ni=e=>{let t=-1;for(let n of vi)if(t=e.indexOf(n),t!==-1)break;let n=t===-1?e:e.slice(0,e.lastIndexOf(`
49
- `,t));return{frames:Ti(n).slice(1),isTrusted:t!==-1}},Pi=e=>{let t=ki.get(e);if(t)return t;let n=null,r=(e,t)=>{n=Mi(t);let r=`${e.name||`Error`}: ${e.message||``}`;for(let e of t)r+=`\n at ${e.toString()}`;return r},i=bi();xi(r);let a;try{a=String(e.stack)}finally{xi(i)}let o=n??Ni(a);return ki.set(e,o),o},Fi=(e=globalThis)=>{let t=ur(void 0,e),n=ir(t.renderers)?t.renderers.values():[],r=e===globalThis?/* @__PURE__ */ new Set([...Jn,...n]):new Set(n),i=[],a=/* @__PURE__ */ new Set;for(let e of r){let t=e.currentDispatcherRef;!t||a.has(t)||(a.add(t),i.push(t))}return i},Ii=e=>`H`in e?e.H:e.current,Li=(e,t)=>{`H`in e?e.H=t:e.current=t};var Ri=44,zi=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Bi=/* @__PURE__ */ new Uint8Array(64),Vi=/* @__PURE__ */ new Uint8Array(128);for(let e=0;e<zi.length;e++){let t=zi.charCodeAt(e);Bi[e]=t,Vi[t]=e}function Hi(e,t){let n=0,r=0,i=0;do i=Vi[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function Ui(e,t){return e.pos>=t?!1:e.peek()!==Ri}var Wi=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function Gi(e){let{length:t}=e,n=new Wi(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=Hi(n,i),i<u&&(l=!1),u=i,Ui(n,e)?(a=Hi(n,a),o=Hi(n,o),s=Hi(n,s),Ui(n,e)?(c=Hi(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||Ki(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function Ki(e){e.sort(qi)}function qi(e,t){return e[0]-t[0]}let Ji=/^data:application\/json(?:;[^,]*)?,/i,Yi=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,Xi=/* @__PURE__ */ new Map,Zi=/* @__PURE__ */ new WeakMap;var Qi=class extends Error{};let $i=/* @__PURE__ */ new Map,ea=/* @__PURE__ */ new WeakMap,ta=/* @__PURE__ */ new Set([`chrome-extension:`,`moz-extension:`,`safari-web-extension:`]),na=/* @__PURE__ */ new Set([`http:`,`https:`,...ta]),ra=(e,t,n,r)=>{let[,i,a,o,s]=e;if(i===void 0||a===void 0||o===void 0)return null;let c=t[i];return c?{columnNumber:o,fileName:c,functionName:s===void 0?void 0:r?.[s]||void 0,isIgnoreListed:n?.has(i)??!1,lineNumber:a+1}:null},ia=(e,t,n,r,i,a)=>{if(n<0||n>=e.length)return null;let o=e[n];if(!o||o.length===0)return null;let s=null,c=0,l=o.length-1;for(;c<=l;){let e=c+l>>1;o[e][0]<=r?(s=o[e],c=e+1):l=e-1}return!s||s.length<4?null:ra(s,t,i,a)},aa=(e,t,n)=>{if(e.sections){let r=t-1,i=null;for(let t of e.sections)if(r>t.offset.line||r===t.offset.line&&n>=t.offset.column)i=t;else break;if(!i)return null;let a=r-i.offset.line,o=r===i.offset.line?n-i.offset.column:n;return ia(i.map.mappings,i.map.sources,a,o,i.map.ignoredSourceIndices,i.map.names)}return ia(e.mappings,e.sources,t-1,n,e.ignoredSourceIndices,e.names)},oa=(e,t)=>{if(Ji.test(e))return e;try{return new URL(e,t).toString()}catch{try{return new URL(e).toString()}catch{try{let n=new URL(e,new URL(t,`https://bippy.invalid/`));return`${n.pathname}${n.search}${n.hash}`}catch{return null}}}},sa=e=>{try{let t=new URL(e),n=t.pathname.lastIndexOf(`.bundle`);if(n===-1)return null;let r=t.pathname.slice(n+7);if(r&&!r.startsWith(`//&`))return null;if(t.pathname=`${t.pathname.slice(0,n)}.map`,r){let e=new URLSearchParams(r.slice(3));for(let[n,r]of e)t.searchParams.set(n,r)}return t.hash=``,t.toString()}catch{return null}},ca=(e,t,n)=>{let r=n.headers.get(`sourcemap`)??n.headers.get(`x-sourcemap`);if(r)return oa(r.trim(),e);let i,a=t.length;for(;a>0&&!i;){let e=t.lastIndexOf(`
50
- `,a-1)+1,n=t.slice(e,a).match(Yi);n&&(i=n[1]||n[2]),a=e-1}return i?oa(i,e):sa(e)},la=e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`version`),n=Reflect.get(e,`mappings`),r=Reflect.get(e,`file`),i=Reflect.get(e,`names`),a=Reflect.get(e,`sourceRoot`),o=Reflect.get(e,`sources`),s=Reflect.get(e,`sourcesContent`),c=Reflect.get(e,`ignoreList`),l=Reflect.get(e,`x_google_ignoreList`);if(t!==3||typeof n!=`string`||r!==void 0&&typeof r!=`string`||i!==void 0&&(!Array.isArray(i)||i.some(e=>typeof e!=`string`))||a!==void 0&&typeof a!=`string`||s!==void 0&&(!Array.isArray(s)||s.some(e=>typeof e!=`string`&&e!==null))||c!==void 0&&(!Array.isArray(c)||c.some(e=>!Number.isInteger(e)||e<0))||l!==void 0&&(!Array.isArray(l)||l.some(e=>!Number.isInteger(e)||e<0))||!Array.isArray(o)||o.some(e=>typeof e!=`string`)||s&&s.length!==o.length)return!1;let u=o.length;return[...c??[],...l??[]].every(e=>e<u)},ua=e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`version`),n=Reflect.get(e,`sections`);return t!==3||!Array.isArray(n)?!1:n.every(e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`map`),n=Reflect.get(e,`url`),r=Reflect.get(e,`offset`);if(typeof r!=`object`||!r)return!1;let i=Reflect.get(r,`column`),a=Reflect.get(r,`line`);return la(t)!==(typeof n==`string`&&n.length>0)&&typeof i==`number`&&Number.isInteger(i)&&i>=0&&typeof a==`number`&&Number.isInteger(a)&&a>=0})},da=e=>{let t=e.ignoreList??e.x_google_ignoreList;return t?.length?new Set(t):void 0},fa=(e,t,n)=>{if(!e||ui.test(t)||t.startsWith(`/`))return t;let r=e.endsWith(`/`)?e:`${e}/`,i=t.replace(/^\.\//,``);try{let e=ui.test(r)?r:new URL(r,n).toString();return new URL(i,e).toString()}catch{let e=`${r}${i}`.split(`/`),t=[];for(let n of e)n===`..`?t.pop():n!==`.`&&t.push(n);return t.join(`/`)}},pa=(e,t)=>e.sources.map(n=>fa(e.sourceRoot,n,t)),ma=e=>Ji.test(e)?void 0:e,ha=(e,t)=>{try{return{file:e.file,ignoredSourceIndices:da(e),mappings:Gi(e.mappings),names:e.names,sourceMapUrl:ma(t),sourceRoot:e.sourceRoot,sources:pa(e,t),sourcesContent:e.sourcesContent,version:3}}catch{return null}},ga=async(e,t,n)=>{let r=[],i=-1,a=-1;for(let o of e.sections){if(o.offset.line<i||o.offset.line===i&&o.offset.column<=a)return null;i=o.offset.line,a=o.offset.column;let e=o.url?oa(o.url,t):null,s=o.map??(e?await n(e):null);if(!s)return null;let c=e??t;try{r.push({map:{...s,ignoredSourceIndices:da(s),mappings:Gi(s.mappings),sources:pa(s,c)},offset:o.offset})}catch{return null}}let o=/* @__PURE__ */ new Set;for(let e of r)for(let t of e.map.sources)o.add(t);return{file:e.file,mappings:[],names:[],sections:r,sourceMapUrl:ma(t),sourceRoot:void 0,sources:Array.from(o),sourcesContent:void 0,version:3}},_a=(e,t=!1)=>{if(!e)return!1;let n=e.trim();if(!n)return!1;let r=n.match(ui);if(!r)return!0;let i=r[0].toLowerCase();return t||na.has(i)},va=()=>typeof window>`u`&&typeof process<`u`&&typeof process.versions?.node==`string`,ya=e=>{try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&!t.username&&!t.password}catch{return!1}},ba=e=>{try{return new URL(e).protocol}catch{return null}},xa=e=>{let t=ba(e);return t!==null&&ta.has(t)},Sa=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.protocol===r.protocol&&n.host===r.host}catch{return!1}},Ca=(e,t,n,r)=>{if(Ji.test(t))return!0;if(!_a(t,r))return!1;let i=ba(e),a=ba(t),o=i!==null&&!na.has(i)||a!==null&&!na.has(a);return!(n||o||xa(e)||xa(t))||Sa(e,t)},wa=e=>e===408||e===425||e===429||e>=500,Ta=e=>{if(e.ok)return!0;if(wa(e.status))throw new Qi;return!1},Ea=(e,t,n)=>!n||t.url.length===0||Sa(e,t.url),Da=e=>{if(e.timeoutMs===void 0||e.timeoutMs<0)return{cleanup:()=>{},signal:e.signal};let t=new AbortController,n=()=>t.abort(e.signal?.reason);e.signal?.aborted?n():e.signal?.addEventListener(`abort`,n,{once:!0});let r=setTimeout(()=>t.abort(new Nr(`Source map request timed out`)),e.timeoutMs);return{cleanup:()=>{clearTimeout(r),e.signal?.removeEventListener(`abort`,n)},signal:t.signal}},Oa=async(e,t)=>{let n=Number(e.headers.get(`content-length`));if(Number.isFinite(n)&&n>t)return null;if(!e.body){let n=await e.text();return new TextEncoder().encode(n).byteLength>t?null:n}let r=e.body.getReader(),i=new TextDecoder,a=[],o=0;try{for(;;){let{done:e,value:n}=await r.read();if(e)break;if(o+=n.byteLength,o>t)return await r.cancel(),null;a.push(i.decode(n,{stream:!0}))}return a.push(i.decode()),a.join(``)}finally{r.releaseLock()}},ka=e=>{try{if(typeof globalThis.atob==`function`)return new TextDecoder().decode(Uint8Array.from(globalThis.atob(e),e=>e.charCodeAt(0)))}catch{return null}let t=e.replace(/\s/g,``).replace(/=+$/,``),n=[],r=0,i=0;for(let e of t){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.indexOf(e);if(t===-1)return null;r=r*64+t,i+=6,i>=8&&(i-=8,n.push(Math.floor(r/2**i)&255),r%=2**i)}return new TextDecoder().decode(Uint8Array.from(n))},Aa=(e,t)=>{let n=e.indexOf(`,`);if(n===-1)return null;let r=e.slice(0,n),i=e.slice(n+1);if(i.length>t*2)return null;try{let e=r.toLowerCase().includes(`;base64`)?ka(i):decodeURIComponent(i);return e===null||new TextEncoder().encode(e).byteLength>t?null:JSON.parse(e)}catch{return null}},ja=async(e,t,n,r,i)=>{if(Ji.test(e))return Aa(e,r);let a=await t(e,{redirect:i?`error`:`follow`,signal:n});if(!Ta(a)||!Ea(e,a,i))return null;let o=await Oa(a,r);if(o===null)return null;try{return JSON.parse(o)}catch{return null}},Ma=async(e,t,n={})=>{let r=t!==void 0;if(!_a(e,r))return null;let i=va(),a=(i||xa(e))&&!n.allowCrossOriginSourceMap;if(i&&!t&&(!n.allowUnsafeServerFetch||!ya(e)))return null;let o=t??(typeof globalThis.fetch==`function`?globalThis.fetch.bind(globalThis):void 0);if(!o)return null;let s=n.maxBundleSizeBytes??26214400,c=n.maxSourceMapSizeBytes??104857600;if(s<0||c<0)return null;let l=Da(n);try{let t=await o(e,{redirect:a?`error`:`follow`,signal:l.signal});if(!Ta(t)||!Ea(e,t,a))return null;let n=await Oa(t,s);if(n===null)return null;let i=ca(e,n,t);if(!i||!Ca(e,i,a,r))return null;let u=await ja(i,o,l.signal,c,a);return la(u)?ha(u,i):ua(u)?ga(u,i,async t=>{if(!Ca(e,t,a,r))return null;let n=await ja(t,o,l.signal,c,a);return la(n)?n:null}):null}finally{l.cleanup()}},Na=(e,t,n)=>{if(!n)return t;let r=e.get(n);return r||(r=/* @__PURE__ */ new Map,e.set(n,r)),r},Pa=e=>Na(Zi,Xi,e),Fa=e=>Na(ea,$i,e),Ia=(e,t)=>t.allowCrossOriginSourceMap===void 0&&t.allowUnsafeServerFetch===void 0&&t.maxBundleSizeBytes===void 0&&t.maxSourceMapSizeBytes===void 0&&t.timeoutMs===void 0?e:`${e}\0${t.allowCrossOriginSourceMap??``}\0${t.allowUnsafeServerFetch??``}\0${t.maxBundleSizeBytes??``}\0${t.maxSourceMapSizeBytes??``}\0${t.timeoutMs??``}`,La=async(e,t=!0,n,r={})=>{let i=t&&r.signal===void 0,a=Pa(n),o=Fa(n),s=Ia(e,r);if(i&&a.has(s))return a.get(s)??null;let c=i?o.get(s):void 0;if(c)return(await c).sourceMap;let l=Ma(e,n,r).then(e=>({sourceMap:e,isTransientFailure:!1}),()=>({sourceMap:null,isTransientFailure:!0}));i&&o.set(s,l);let{sourceMap:u,isTransientFailure:d}=await l;return i&&(o.delete(s),d||a.set(s,u)),u},Ra=async(e,t=!0,n,r={})=>Promise.all(e.map(async e=>{if(!e.fileName)return e;let i=await La(e.fileName,t,n,r);if(!i||typeof e.lineNumber!=`number`||typeof e.columnNumber!=`number`)return e;let a=aa(i,e.lineNumber,e.columnNumber);return a?{...e,source:a.fileName&&e.source?e.source.replace(e.fileName,a.fileName):e.source,fileName:a.fileName,functionName:a.functionName??e.functionName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,isIgnoreListed:a.isIgnoreListed,isSymbolicated:!0}:e})),za=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack==`string`,Ba=e=>`tag`in e&&typeof e.tag==`number`,Va=e=>{let t=null;if(zr(e,n=>{if(n===e)return!1;let r=n._debugOwner;return(r===e||e.alternate!==null&&r===e.alternate)&&n._debugStack instanceof Error&&(t=n._debugStack,!0)}),!t)return null;let{frames:n,isTrusted:r}=Pi(t);if(!r)return null;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t.fileName)return{...t,lineNumber:t.enclosingLineNumber||t.lineNumber,columnNumber:t.enclosingColumnNumber||t.columnNumber}}return null},Ha=()=>{let e=[];for(let t of Fi())e.push({currentDispatcherRef:t,value:Ii(t)}),Li(t,null);return e},Ua=e=>{for(let{currentDispatcherRef:t,value:n}of e)Li(t,n)},Wa=e=>`\n in ${e}`,Ga=(e,t,n)=>{if(n){let t=Za(n.stack??``),r=t.lastIndexOf(`
51
- `),i=r===-1?t:t.slice(r+1);if(i.includes(e))return`\n${i}`}return Wa(`${e}${t?` [${t}]`:``}`)},Ka=!1,qa=/* @__PURE__ */ new WeakMap,Ja=(e,t)=>{if(!e||Ka)return``;let n=qa.get(e);if(n!==void 0)return n;let r=bi();xi(void 0),Ka=!0;let i=Ha(),a=console.error,o=console.warn;console.error=()=>{},console.warn=()=>{};try{let n={DetermineComponentFrameRoot(){let n;try{if(t){let t=function(){throw Error()};Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}});try{Reflect.construct(t,[])}catch(e){n=e}Reflect.construct(e,[],t)}else{try{throw Error()}catch(e){n=e}let t=Function.prototype.apply.call(e,void 0,[]);typeof t==`object`&&t&&`catch`in t&&typeof t.catch==`function`&&t.catch(()=>void 0)}}catch(e){if(e instanceof Error&&n instanceof Error&&typeof e.stack==`string`)return[e.stack,n.stack]}return[null,null]}};Object.defineProperty(n.DetermineComponentFrameRoot,"displayName",{value:`DetermineComponentFrameRoot`}),Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,`name`)?.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});let[r,i]=n.DetermineComponentFrameRoot();if(r&&i){let t=r.split(`
45
+ let Yi=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,Xi=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],Zi=[`rsc://`,`about://React/`],Qi=[`<anonymous>`,`eval`,``],$i=/\.(cjs|cts|js|jsx|mdx|mjs|mts|ts|tsx)$/,ea=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,ta=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,na=/\[[^\]]+\]$/,ra=[`react_stack_bottom_frame`,`react-stack-bottom-frame`],ia=Error,aa=()=>ia.prepareStackTrace,oa=e=>{ia.prepareStackTrace=e},sa=/(^|@)\S+:\d+/,ca=/^\s*at .*(\S+:\d+|\(native\))/m,la=/^(eval@)?(\[native code\])?$/,ua=(e,t)=>{if(t?.includeInElement!==!1){let t=e.split(`
46
+ `),n=[];for(let e of t)if(/^\s*at\s+/.test(e)){let t=fa(e)[0];t&&n.push(t)}else if(/^\s*in\s+/.test(e)){let t=e.replace(/^\s*in\s+/,``).replace(/\s*(?:\(at .*\)|\[[^\]]+\])$/,``);n.push({functionName:t,source:e})}else if(e.match(sa)){let t=pa(e)[0];t&&n.push(t)}return n}return e.match(ca)?fa(e):pa(e)},da=e=>{if(!e.includes(`:`))return[e,void 0,void 0];let t=e.startsWith(`(`)&&/:\d+\)$/.test(e)?e.slice(1,-1):e,n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t);return n?[n[1],n[2]||void 0,n[3]||void 0]:[t,void 0,void 0]},fa=e=>e.split(`
47
+ `).filter(e=>!!e.match(ca)).map(e=>{let t=e;t.includes(`(eval `)&&(t=t.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let n=t.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],``):n;let i=da(r?r[1]:n);return{functionName:r&&n||void 0,fileName:[`eval`,`<anonymous>`,`(native)`].includes(i[0])?void 0:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}),pa=e=>e.split(`
48
+ `).filter(e=>!e.match(la)).map(e=>{let t=e;if(t.includes(` > eval`)&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),!t.includes(`@`)&&!t.includes(`:`))return{functionName:t};{let e=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=t.match(e),r=n&&n[1]?n[1]:void 0,i=da(t.replace(e,``));return{functionName:r,fileName:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}}),ma=/* @__PURE__ */ new WeakMap,ha=e=>ra.some(t=>e.includes(t)),ga=e=>{let t=e.getFunctionName?.()??``;if(t)return t;let n=e.getTypeName?.()??``,r=e.getMethodName?.()??``;return n&&r?`${n}.${r}`:r},_a=e=>{let t=[];for(let n=1;n<e.length;n++){let r=e[n],i=ga(r);if(ha(i))return{frames:t,isTrusted:!0};if(r.isNative?.()){t.push({functionName:i||void 0});continue}let a=r.getScriptNameOrSourceURL?.()??``;!a&&r.isEval?.()&&(a=r.getEvalOrigin?.()??``),t.push({functionName:i&&i!==`<anonymous>`?i:void 0,fileName:a&&a!==`<anonymous>`?a:void 0,lineNumber:r.getLineNumber?.()??void 0,columnNumber:r.getColumnNumber?.()??void 0,enclosingLineNumber:r.getEnclosingLineNumber?.()??void 0,enclosingColumnNumber:r.getEnclosingColumnNumber?.()??void 0,source:` at ${r.toString()}`})}return{frames:t,isTrusted:!1}},va=e=>{let t=-1;for(let n of ra)if(t=e.indexOf(n),t!==-1)break;let n=t===-1?e:e.slice(0,e.lastIndexOf(`
49
+ `,t));return{frames:ua(n).slice(1),isTrusted:t!==-1}},ya=e=>{let t=ma.get(e);if(t)return t;let n=null,r=(e,t)=>{n=_a(t);let r=`${e.name||`Error`}: ${e.message||``}`;for(let e of t)r+=`\n at ${e.toString()}`;return r},i=aa();oa(r);let a;try{a=String(e.stack)}finally{oa(i)}let o=n??va(a);return ma.set(e,o),o},ba=(e=globalThis)=>{let t=Yr(void 0,e),n=Ur(t.renderers)?t.renderers.values():[],r=e===globalThis?/* @__PURE__ */ new Set([...Nr,...n]):new Set(n),i=[],a=/* @__PURE__ */ new Set;for(let e of r){let t=e.currentDispatcherRef;!t||a.has(t)||(a.add(t),i.push(t))}return i},xa=e=>`H`in e?e.H:e.current,Sa=(e,t)=>{`H`in e?e.H=t:e.current=t};var Ca=44,wa=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ta=/* @__PURE__ */ new Uint8Array(64),Ea=/* @__PURE__ */ new Uint8Array(128);for(let e=0;e<wa.length;e++){let t=wa.charCodeAt(e);Ta[e]=t,Ea[t]=e}function Da(e,t){let n=0,r=0,i=0;do i=Ea[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function Oa(e,t){return e.pos>=t?!1:e.peek()!==Ca}var ka=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function Aa(e){let{length:t}=e,n=new ka(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=Da(n,i),i<u&&(l=!1),u=i,Oa(n,e)?(a=Da(n,a),o=Da(n,o),s=Da(n,s),Oa(n,e)?(c=Da(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||ja(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function ja(e){e.sort(Ma)}function Ma(e,t){return e[0]-t[0]}let Na=/^data:application\/json(?:;[^,]*)?,/i,Pa=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,Fa=/* @__PURE__ */ new Map,Ia=/* @__PURE__ */ new WeakMap;var La=class extends Error{};let Ra=/* @__PURE__ */ new Map,za=/* @__PURE__ */ new WeakMap,Ba=/* @__PURE__ */ new Set([`chrome-extension:`,`moz-extension:`,`safari-web-extension:`]),Va=/* @__PURE__ */ new Set([`http:`,`https:`,...Ba]),Ha=(e,t,n,r)=>{let[,i,a,o,s]=e;if(i===void 0||a===void 0||o===void 0)return null;let c=t[i];return c?{columnNumber:o,fileName:c,functionName:s===void 0?void 0:r?.[s]||void 0,isIgnoreListed:n?.has(i)??!1,lineNumber:a+1}:null},Ua=(e,t,n,r,i,a)=>{if(n<0||n>=e.length)return null;let o=e[n];if(!o||o.length===0)return null;let s=null,c=0,l=o.length-1;for(;c<=l;){let e=c+l>>1;o[e][0]<=r?(s=o[e],c=e+1):l=e-1}return!s||s.length<4?null:Ha(s,t,i,a)},Wa=(e,t,n)=>{if(e.sections){let r=t-1,i=null;for(let t of e.sections)if(r>t.offset.line||r===t.offset.line&&n>=t.offset.column)i=t;else break;if(!i)return null;let a=r-i.offset.line,o=r===i.offset.line?n-i.offset.column:n;return Ua(i.map.mappings,i.map.sources,a,o,i.map.ignoredSourceIndices,i.map.names)}return Ua(e.mappings,e.sources,t-1,n,e.ignoredSourceIndices,e.names)},Ga=(e,t)=>{if(Na.test(e))return e;try{return new URL(e,t).toString()}catch{try{return new URL(e).toString()}catch{try{let n=new URL(e,new URL(t,`https://bippy.invalid/`));return`${n.pathname}${n.search}${n.hash}`}catch{return null}}}},Ka=e=>{try{let t=new URL(e),n=t.pathname.lastIndexOf(`.bundle`);if(n===-1)return null;let r=t.pathname.slice(n+7);if(r&&!r.startsWith(`//&`))return null;if(t.pathname=`${t.pathname.slice(0,n)}.map`,r){let e=new URLSearchParams(r.slice(3));for(let[n,r]of e)t.searchParams.set(n,r)}return t.hash=``,t.toString()}catch{return null}},qa=(e,t,n)=>{let r=n.headers.get(`sourcemap`)??n.headers.get(`x-sourcemap`);if(r)return Ga(r.trim(),e);let i,a=t.length;for(;a>0&&!i;){let e=t.lastIndexOf(`
50
+ `,a-1)+1,n=t.slice(e,a).match(Pa);n&&(i=n[1]||n[2]),a=e-1}return i?Ga(i,e):Ka(e)},Ja=e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`version`),n=Reflect.get(e,`mappings`),r=Reflect.get(e,`file`),i=Reflect.get(e,`names`),a=Reflect.get(e,`sourceRoot`),o=Reflect.get(e,`sources`),s=Reflect.get(e,`sourcesContent`),c=Reflect.get(e,`ignoreList`),l=Reflect.get(e,`x_google_ignoreList`);if(t!==3||typeof n!=`string`||r!==void 0&&typeof r!=`string`||i!==void 0&&(!Array.isArray(i)||i.some(e=>typeof e!=`string`))||a!==void 0&&typeof a!=`string`||s!==void 0&&(!Array.isArray(s)||s.some(e=>typeof e!=`string`&&e!==null))||c!==void 0&&(!Array.isArray(c)||c.some(e=>!Number.isInteger(e)||e<0))||l!==void 0&&(!Array.isArray(l)||l.some(e=>!Number.isInteger(e)||e<0))||!Array.isArray(o)||o.some(e=>typeof e!=`string`)||s&&s.length!==o.length)return!1;let u=o.length;return[...c??[],...l??[]].every(e=>e<u)},Ya=e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`version`),n=Reflect.get(e,`sections`);return t!==3||!Array.isArray(n)?!1:n.every(e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`map`),n=Reflect.get(e,`url`),r=Reflect.get(e,`offset`);if(typeof r!=`object`||!r)return!1;let i=Reflect.get(r,`column`),a=Reflect.get(r,`line`);return Ja(t)!==(typeof n==`string`&&n.length>0)&&typeof i==`number`&&Number.isInteger(i)&&i>=0&&typeof a==`number`&&Number.isInteger(a)&&a>=0})},Xa=e=>{let t=e.ignoreList??e.x_google_ignoreList;return t?.length?new Set(t):void 0},Za=(e,t,n)=>{if(!e||Yi.test(t)||t.startsWith(`/`))return t;let r=e.endsWith(`/`)?e:`${e}/`,i=t.replace(/^\.\//,``);try{let e=Yi.test(r)?r:new URL(r,n).toString();return new URL(i,e).toString()}catch{let e=`${r}${i}`.split(`/`),t=[];for(let n of e)n===`..`?t.pop():n!==`.`&&t.push(n);return t.join(`/`)}},Qa=(e,t)=>e.sources.map(n=>Za(e.sourceRoot,n,t)),$a=e=>Na.test(e)?void 0:e,eo=(e,t)=>{try{return{file:e.file,ignoredSourceIndices:Xa(e),mappings:Aa(e.mappings),names:e.names,sourceMapUrl:$a(t),sourceRoot:e.sourceRoot,sources:Qa(e,t),sourcesContent:e.sourcesContent,version:3}}catch{return null}},to=async(e,t,n)=>{let r=[],i=-1,a=-1;for(let o of e.sections){if(o.offset.line<i||o.offset.line===i&&o.offset.column<=a)return null;i=o.offset.line,a=o.offset.column;let e=o.url?Ga(o.url,t):null,s=o.map??(e?await n(e):null);if(!s)return null;let c=e??t;try{r.push({map:{...s,ignoredSourceIndices:Xa(s),mappings:Aa(s.mappings),sources:Qa(s,c)},offset:o.offset})}catch{return null}}let o=/* @__PURE__ */ new Set;for(let e of r)for(let t of e.map.sources)o.add(t);return{file:e.file,mappings:[],names:[],sections:r,sourceMapUrl:$a(t),sourceRoot:void 0,sources:Array.from(o),sourcesContent:void 0,version:3}},no=(e,t=!1)=>{if(!e)return!1;let n=e.trim();if(!n)return!1;let r=n.match(Yi);if(!r)return!0;let i=r[0].toLowerCase();return t||Va.has(i)},ro=()=>typeof window>`u`&&typeof process<`u`&&typeof process.versions?.node==`string`,io=e=>{try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&!t.username&&!t.password}catch{return!1}},ao=e=>{try{return new URL(e).protocol}catch{return null}},oo=e=>{let t=ao(e);return t!==null&&Ba.has(t)},so=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.protocol===r.protocol&&n.host===r.host}catch{return!1}},co=(e,t,n,r)=>{if(Na.test(t))return!0;if(!no(t,r))return!1;let i=ao(e),a=ao(t),o=i!==null&&!Va.has(i)||a!==null&&!Va.has(a);return!(n||o||oo(e)||oo(t))||so(e,t)},lo=e=>e===408||e===425||e===429||e>=500,uo=e=>{if(e.ok)return!0;if(lo(e.status))throw new La;return!1},fo=(e,t,n)=>!n||t.url.length===0||so(e,t.url),po=e=>{if(e.timeoutMs===void 0||e.timeoutMs<0)return{cleanup:()=>{},signal:e.signal};let t=new AbortController,n=()=>t.abort(e.signal?.reason);e.signal?.aborted?n():e.signal?.addEventListener(`abort`,n,{once:!0});let r=setTimeout(()=>t.abort(new vi(`Source map request timed out`)),e.timeoutMs);return{cleanup:()=>{clearTimeout(r),e.signal?.removeEventListener(`abort`,n)},signal:t.signal}},mo=async(e,t)=>{let n=Number(e.headers.get(`content-length`));if(Number.isFinite(n)&&n>t)return null;if(!e.body){let n=await e.text();return new TextEncoder().encode(n).byteLength>t?null:n}let r=e.body.getReader(),i=new TextDecoder,a=[],o=0;try{for(;;){let{done:e,value:n}=await r.read();if(e)break;if(o+=n.byteLength,o>t)return await r.cancel(),null;a.push(i.decode(n,{stream:!0}))}return a.push(i.decode()),a.join(``)}finally{r.releaseLock()}},ho=e=>{try{if(typeof globalThis.atob==`function`)return new TextDecoder().decode(Uint8Array.from(globalThis.atob(e),e=>e.charCodeAt(0)))}catch{return null}let t=e.replace(/\s/g,``).replace(/=+$/,``),n=[],r=0,i=0;for(let e of t){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.indexOf(e);if(t===-1)return null;r=r*64+t,i+=6,i>=8&&(i-=8,n.push(Math.floor(r/2**i)&255),r%=2**i)}return new TextDecoder().decode(Uint8Array.from(n))},go=(e,t)=>{let n=e.indexOf(`,`);if(n===-1)return null;let r=e.slice(0,n),i=e.slice(n+1);if(i.length>t*2)return null;try{let e=r.toLowerCase().includes(`;base64`)?ho(i):decodeURIComponent(i);return e===null||new TextEncoder().encode(e).byteLength>t?null:JSON.parse(e)}catch{return null}},_o=async(e,t,n,r,i)=>{if(Na.test(e))return go(e,r);let a=await t(e,{redirect:i?`error`:`follow`,signal:n});if(!uo(a)||!fo(e,a,i))return null;let o=await mo(a,r);if(o===null)return null;try{return JSON.parse(o)}catch{return null}},vo=async(e,t,n={})=>{let r=t!==void 0;if(!no(e,r))return null;let i=ro(),a=(i||oo(e))&&!n.allowCrossOriginSourceMap;if(i&&!t&&(!n.allowUnsafeServerFetch||!io(e)))return null;let o=t??(typeof globalThis.fetch==`function`?globalThis.fetch.bind(globalThis):void 0);if(!o)return null;let s=n.maxBundleSizeBytes??26214400,c=n.maxSourceMapSizeBytes??104857600;if(s<0||c<0)return null;let l=po(n);try{let t=await o(e,{redirect:a?`error`:`follow`,signal:l.signal});if(!uo(t)||!fo(e,t,a))return null;let n=await mo(t,s);if(n===null)return null;let i=qa(e,n,t);if(!i||!co(e,i,a,r))return null;let u=await _o(i,o,l.signal,c,a);return Ja(u)?eo(u,i):Ya(u)?to(u,i,async t=>{if(!co(e,t,a,r))return null;let n=await _o(t,o,l.signal,c,a);return Ja(n)?n:null}):null}finally{l.cleanup()}},yo=(e,t,n)=>{if(!n)return t;let r=e.get(n);return r||(r=/* @__PURE__ */ new Map,e.set(n,r)),r},bo=e=>yo(Ia,Fa,e),xo=e=>yo(za,Ra,e),So=(e,t)=>t.allowCrossOriginSourceMap===void 0&&t.allowUnsafeServerFetch===void 0&&t.maxBundleSizeBytes===void 0&&t.maxSourceMapSizeBytes===void 0&&t.timeoutMs===void 0?e:`${e}\0${t.allowCrossOriginSourceMap??``}\0${t.allowUnsafeServerFetch??``}\0${t.maxBundleSizeBytes??``}\0${t.maxSourceMapSizeBytes??``}\0${t.timeoutMs??``}`,Co=async(e,t=!0,n,r={})=>{let i=t&&r.signal===void 0,a=bo(n),o=xo(n),s=So(e,r);if(i&&a.has(s))return a.get(s)??null;let c=i?o.get(s):void 0;if(c)return(await c).sourceMap;let l=vo(e,n,r).then(e=>({sourceMap:e,isTransientFailure:!1}),()=>({sourceMap:null,isTransientFailure:!0}));i&&o.set(s,l);let{sourceMap:u,isTransientFailure:d}=await l;return i&&(o.delete(s),d||a.set(s,u)),u},wo=async(e,t=!0,n,r={})=>Promise.all(e.map(async e=>{if(!e.fileName)return e;let i=await Co(e.fileName,t,n,r);if(!i||typeof e.lineNumber!=`number`||typeof e.columnNumber!=`number`)return e;let a=Wa(i,e.lineNumber,e.columnNumber);return a?{...e,source:a.fileName&&e.source?e.source.replace(e.fileName,a.fileName):e.source,fileName:a.fileName,functionName:a.functionName??e.functionName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,isIgnoreListed:a.isIgnoreListed,isSymbolicated:!0}:e})),To=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack==`string`,Eo=e=>`tag`in e&&typeof e.tag==`number`,Do=e=>{let t=null;if(wi(e,n=>{if(n===e)return!1;let r=n._debugOwner;return(r===e||e.alternate!==null&&r===e.alternate)&&n._debugStack instanceof Error&&(t=n._debugStack,!0)}),!t)return null;let{frames:n,isTrusted:r}=ya(t);if(!r)return null;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t.fileName)return{...t,lineNumber:t.enclosingLineNumber||t.lineNumber,columnNumber:t.enclosingColumnNumber||t.columnNumber}}return null},Oo=()=>{let e=[];for(let t of ba())e.push({currentDispatcherRef:t,value:xa(t)}),Sa(t,null);return e},ko=e=>{for(let{currentDispatcherRef:t,value:n}of e)Sa(t,n)},Ao=e=>`\n in ${e}`,jo=(e,t,n)=>{if(n){let t=Lo(n.stack??``),r=t.lastIndexOf(`
51
+ `),i=r===-1?t:t.slice(r+1);if(i.includes(e))return`\n${i}`}return Ao(`${e}${t?` [${t}]`:``}`)},Mo=!1,No=/* @__PURE__ */ new WeakMap,Po=(e,t)=>{if(!e||Mo)return``;let n=No.get(e);if(n!==void 0)return n;let r=aa();oa(void 0),Mo=!0;let i=Oo(),a=console.error,o=console.warn;console.error=()=>{},console.warn=()=>{};try{let n={DetermineComponentFrameRoot(){let n;try{if(t){let t=function(){throw Error()};Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}});try{Reflect.construct(t,[])}catch(e){n=e}Reflect.construct(e,[],t)}else{try{throw Error()}catch(e){n=e}let t=Function.prototype.apply.call(e,void 0,[]);typeof t==`object`&&t&&`catch`in t&&typeof t.catch==`function`&&t.catch(()=>void 0)}}catch(e){if(e instanceof Error&&n instanceof Error&&typeof e.stack==`string`)return[e.stack,n.stack]}return[null,null]}};Object.defineProperty(n.DetermineComponentFrameRoot,"displayName",{value:`DetermineComponentFrameRoot`}),Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,`name`)?.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});let[r,i]=n.DetermineComponentFrameRoot();if(r&&i){let t=r.split(`
52
52
  `),n=i.split(`
53
- `),a=0,o=0;for(;a<t.length&&!t[a].includes(`DetermineComponentFrameRoot`);)a++;for(;o<n.length&&!n[o].includes(`DetermineComponentFrameRoot`);)o++;if(a===t.length||o===n.length)for(a=t.length-1,o=n.length-1;a>=1&&o>=0&&t[a]!==n[o];)o--;for(;a>=1&&o>=0;a--,o--)if(t[a]!==n[o]){if(a!==1||o!==1)do if(a--,o--,o<0||t[a]!==n[o]){let n=`\n${t[a].replace(` at new `,` at `)}`,[r]=Ti(n);if(!r?.fileName)break;let i=Wr(e);return i&&n.includes(`<anonymous>`)&&(n=n.replace(`<anonymous>`,i)),qa.set(e,n),n}while(a>=1&&o>=0);break}}}finally{Ka=!1,xi(r),Ua(i),console.error=a,console.warn=o}let s=Wr(e),c=s?Wa(s):``;return qa.set(e,c),c},Ya=(e,t)=>{let n=``,r=kr(e);switch(e.tag){case r.ActivityComponent:n=Wa(`Activity`);break;case r.ClassComponent:n=Ja(e.type,!0);break;case r.ForwardRef:n=Ja(Ur(e.type)??e.type,!1);break;case r.FunctionComponent:case r.SimpleMemoComponent:n=Ja(Ur(e.type)??e.type,!1);break;case r.HostComponent:case r.HostHoistable:case r.HostSingleton:typeof e.type==`string`&&(n=Wa(e.type));break;case r.LazyComponent:n=Wa(`Lazy`);break;case r.SuspenseComponent:n=e.child!==t&&t!==null?Wa(`Suspense Fallback`):Wa(`Suspense`);break;case r.SuspenseListComponent:n=Wa(`SuspenseList`);break;case r.ViewTransitionComponent:n=Wa(`ViewTransition`);break;default:return``}return n},Xa=e=>{try{let t=``,n=e,r=null;do{t+=Ya(n,r);let e=n._debugInfo;if(e&&Array.isArray(e))for(let n=e.length-1;n>=0;n--){let r=e[n];typeof r.name==`string`&&(t+=Ga(r.name,r.env,r.debugLocation))}r=n,n=n.return}while(n);return t}catch(e){return e instanceof Error?`\nBippy couldn’t generate the stack: ${e.message}\n${e.stack}`:``}},Za=e=>{let t=e;if(!t)return``;t.startsWith(`Error: react-stack-top-frame
53
+ `),a=0,o=0;for(;a<t.length&&!t[a].includes(`DetermineComponentFrameRoot`);)a++;for(;o<n.length&&!n[o].includes(`DetermineComponentFrameRoot`);)o++;if(a===t.length||o===n.length)for(a=t.length-1,o=n.length-1;a>=1&&o>=0&&t[a]!==n[o];)o--;for(;a>=1&&o>=0;a--,o--)if(t[a]!==n[o]){if(a!==1||o!==1)do if(a--,o--,o<0||t[a]!==n[o]){let n=`\n${t[a].replace(` at new `,` at `)}`,[r]=ua(n);if(!r?.fileName)break;let i=ki(e);return i&&n.includes(`<anonymous>`)&&(n=n.replace(`<anonymous>`,i)),No.set(e,n),n}while(a>=1&&o>=0);break}}}finally{Mo=!1,oa(r),ko(i),console.error=a,console.warn=o}let s=ki(e),c=s?Ao(s):``;return No.set(e,c),c},Fo=(e,t)=>{let n=``,r=mi(e);switch(e.tag){case r.ActivityComponent:n=Ao(`Activity`);break;case r.ClassComponent:n=Po(e.type,!0);break;case r.ForwardRef:n=Po(Oi(e.type)??e.type,!1);break;case r.FunctionComponent:case r.SimpleMemoComponent:n=Po(Oi(e.type)??e.type,!1);break;case r.HostComponent:case r.HostHoistable:case r.HostSingleton:typeof e.type==`string`&&(n=Ao(e.type));break;case r.LazyComponent:n=Ao(`Lazy`);break;case r.SuspenseComponent:n=e.child!==t&&t!==null?Ao(`Suspense Fallback`):Ao(`Suspense`);break;case r.SuspenseListComponent:n=Ao(`SuspenseList`);break;case r.ViewTransitionComponent:n=Ao(`ViewTransition`);break;default:return``}return n},Io=e=>{try{let t=``,n=e,r=null;do{t+=Fo(n,r);let e=n._debugInfo;if(e&&Array.isArray(e))for(let n=e.length-1;n>=0;n--){let r=e[n];typeof r.name==`string`&&(t+=jo(r.name,r.env,r.debugLocation))}r=n,n=n.return}while(n);return t}catch(e){return e instanceof Error?`\nBippy couldn’t generate the stack: ${e.message}\n${e.stack}`:``}},Lo=e=>{let t=e;if(!t)return``;t.startsWith(`Error: react-stack-top-frame
54
54
  `)&&(t=t.slice(29));let n=t.indexOf(`
55
- `);n!==-1&&(t=t.slice(n+1));let r=Math.max(...vi.map(e=>t.indexOf(e)));if(r!==-1&&(r=t.lastIndexOf(`
56
- `,r)),r!==-1)t=t.slice(0,r);else return``;return t},Qa=e=>!!(e.functionName&&e.fileName&&no(e.fileName)),$a=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,eo=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){if(!Qa(n))continue;let e=n.functionName,r=t.get(e)??[];r.some(e=>$a(e,n))||(r.push(n),t.set(e,r))}return t},to=(e,t,n)=>{if(!e.functionName)return{...e,isServer:!0};let r=t.get(e.functionName);if(!r||r.length===0)return{...e,isServer:!0};let i=n.get(e.functionName)??0,a=r[i%r.length];return n.set(e.functionName,i+1),{...e,isServer:!0,fileName:a.fileName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,source:e.source?.replace(_i,`(${a.fileName}:${a.lineNumber}:${a.columnNumber})`)}},no=e=>fi.some(t=>e.startsWith(t)),ro=e=>!e.isServer&&e.fileName&&no(e.fileName)?{...e,isServer:!0}:e,io=e=>{let t=[],n=e;for(;n;)if(Ba(n)){let e=n;if(n=e._debugOwner,n&&za(e)){let{frames:n,isTrusted:r}=Pi(e._debugStack);if(r)for(let e of n)t.push(ro(e))}}else{let e=n;if(n=e.owner,n&&e.debugStack instanceof Error)for(let n of Pi(e.debugStack).frames)t.push({...n,isServer:!0})}return t},ao=e=>{let t=[];return zr(e,e=>{if(!za(e))return;let{frames:n,isTrusted:r}=Pi(e._debugStack);r&&t.push(...n)},!0),t},oo=e=>{let t=ao(e),n=Ti(Xa(e)),r=eo(t),i=/* @__PURE__ */ new Map;return n.map(e=>e.source!==void 0&&_i.test(e.source)?to(e,r,i):e).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return e.functionName!==r.functionName})},so=async(e,t=!0,n,r={})=>Ra(oo(e),t,n,r),co=e=>!!e.fileName&&!e.isIgnoreListed,lo=async(e,t=!0,n,r={})=>{let i=io(e);if(i.length>0){let a=Va(e)??{};a.functionName=Wr(e.type)??a.functionName;let o=await Ra([a,...i],t,n,r);if(o.some((e,t)=>t>0&&co(e)))return o}return so(e,t,n,r)},uo=e=>e.split(`/`).filter(Boolean).length,fo=e=>{let t=e.indexOf(`/`,1);if(t===-1)return e;let n=e.slice(0,t);if(uo(n)!==1)return e;let r=e.slice(t);if(!mi.test(r))return e;let i=r.split(`/`).filter(Boolean);if(i.length<2)return e;let a=i[0];return a.startsWith(`@`)||a.length>4?e:r},po=e=>{if(!e||pi.some(t=>t===e))return``;let t=e,n=/^[a-zA-Z]:[\\/]/.test(t);if(t.startsWith(`http://`)||t.startsWith(`https://`)){try{t=new URL(t).pathname}catch{}t=fo(t)}if(t.startsWith(`about://React/`)){let e=t.slice(14),n=e.indexOf(`/`),r=e.indexOf(`:`);t=n!==-1&&(r===-1||n<r)?e.slice(n+1):e}let r=!0;for(;r;){r=!1;for(let e of di)if(t.startsWith(e)){t=t.slice(e.length),e===`file:///`&&(t=`/${t.replace(/^\/+/,``)}`),r=!0;break}}if(!n){let e=t.match(ui);e&&(t=t.slice(e[0].length))}if(t.startsWith(`//`)){let e=t.indexOf(`/`,2);t=e===-1?``:t.slice(e)}let i=t.indexOf(`?`);if(i!==-1){let e=t.slice(i);gi.test(e)&&(t=t.slice(0,i))}return t},mo=e=>{let t=po(e);return!(!t||!mi.test(t)||hi.test(t))},ho=Symbol.for(`react.context`),go=Symbol.for(`react.recoverable`),_o=[],vo=null,yo=Error("Suspense interrupted this render. This error is an internal implementation detail of `use`."),Y=()=>{let e=vo;return e!==null&&(vo=e.next),e},bo=e=>typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`,xo=e=>typeof e==`object`&&!!e&&`current`in e,So=e=>typeof e==`object`&&!!e&&`_currentValue`in e,Co=e=>e._currentValue,X=(e,t,n,r=null,i=null)=>{_o.push({displayName:r,primitive:e,stackError:Error(),value:t,debugInfo:i,dispatcherHookName:n})},wo=e=>{if(typeof e==`object`&&e){if(bo(e)){let t=e,n=bo(t)?t:e;switch(n.status){case`fulfilled`:return X(`Promise`,n.value,`Use`,null,n._debugInfo??null),n.value;case`rejected`:throw n.reason}throw X(`Unresolved`,n,`Use`,null,n._debugInfo??null),yo}if(`$$typeof`in e&&e.$$typeof===go){X(`Recoverable`,void 0,`Use`);return}if(`$$typeof`in e&&e.$$typeof===ho&&So(e)){let t={_currentValue:e._currentValue,displayName:typeof e.displayName==`string`?e.displayName:void 0},n=Co(t);return X(`Context (use)`,n,`Use`,t.displayName||`Context`),n}}throw new jr(`use() received an unsupported value: `+String(e))},To=e=>{let t=Co(e);return X(`Context`,t,`Context`,e.displayName||null),t},Eo=e=>{let t=Y(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return X(`State`,n,`State`),[n,()=>{}]},Do=(e,t,n)=>{let r=Y(),i=r===null?n===void 0?t:n(t):r.memoizedState;return X(`Reducer`,i,`Reducer`),[i,()=>{}]},Oo=e=>{let t=Y(),n=xo(t?.memoizedState)?t.memoizedState:{current:e};return X(`Ref`,n.current,`Ref`),n},ko=()=>{let e=Y();return X(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},Ao=e=>{Y(),X(`LayoutEffect`,e,`LayoutEffect`)},jo=e=>{Y(),X(`InsertionEffect`,e,`InsertionEffect`)},Mo=e=>{Y(),X(`Effect`,e,`Effect`)},No=e=>{Y();let t=xo(e)?e.current:void 0;X(`ImperativeHandle`,t,`ImperativeHandle`)},Po=(e,t)=>{X(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},Fo=e=>{let t=Y();return X(`Callback`,Array.isArray(t?.memoizedState)?t.memoizedState[0]:e,`Callback`),e},Io=e=>{let t=Y(),n=Array.isArray(t?.memoizedState)?t.memoizedState[0]:e();return X(`Memo`,n,`Memo`),n},Lo=(e,t)=>{let n=Y();Y();let r=n===null?t():n.memoizedState;return X(`SyncExternalStore`,r,`SyncExternalStore`),r},Ro=()=>{let e=Y();Y();let t=e?.memoizedState===!0;return X(`Transition`,t,`Transition`),[t,()=>{}]},zo=e=>{let t=Y(),n=t===null?e:t.memoizedState;return X(`DeferredValue`,n,`DeferredValue`),n},Bo=()=>{let e=Y(),t=typeof e?.memoizedState==`string`?e.memoizedState:``;return X(`Id`,t,`Id`),t},Vo=e=>[],Ho=e=>{let t=Y(),n=t===null?e:t.memoizedState;return X(`Optimistic`,n,`Optimistic`),[n,()=>{}]},Uo=(e,t)=>{let n,r=null,i=null;if(e!==null){let t=e.memoizedState;if(bo(t))switch(t.status){case`fulfilled`:n=t.value,r=t._debugInfo??null;break;case`rejected`:i=t.reason;break;default:i=yo,n=t,r=t._debugInfo??null}else n=t}else n=t;return{value:n,debugInfo:r,error:i}},Wo=e=>(t,n)=>{let r=Y();Y(),Y();let{value:i,debugInfo:a,error:o}=Uo(r,n);if(X(e,i,e,null,a),o!==null)throw o;return[i,()=>{},!1]},Go=Wo(`ActionState`),Ko={readContext:Co,use:wo,useCallback:Fo,useContext:To,useEffect:Mo,useImperativeHandle:No,useLayoutEffect:Ao,useInsertionEffect:jo,useMemo:Io,useReducer:Do,useRef:Oo,useState:Eo,useDebugValue:Po,useDeferredValue:zo,useTransition:Ro,useSyncExternalStore:Lo,useId:Bo,useHostTransitionStatus:()=>{let e=Co({_currentValue:null});return X(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:Wo(`FormState`),useActionState:Go,useOptimistic:Ho,useMemoCache:Vo,useCacheRefresh:ko,useEffectEvent:e=>(Y(),X(`EffectEvent`,e,`EffectEvent`),e)};new Proxy(Ko,{get(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);throw new Mr(`The React dispatcher is missing method `+t)}});let qo=e=>{if(!e)return``;let t=e.lastIndexOf(`[as `);if(t!==-1)return qo(e.slice(t+4,-1));if(t=e.lastIndexOf(`.`),t=t===-1?0:t+1,e.slice(t).startsWith(`unstable_`)&&(t+=9),e.slice(t).startsWith(`experimental_`)&&(t+=13),e.slice(t,t+3)===`use`){if(e.length-t===3)return`Use`;t+=3}return e.slice(t)};new Set([X,...Object.values(Ko)].map(e=>qo(e.name)));let Jo=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?`⌥ Option`:`Alt`,Yo=[`top`,`right`,`bottom`,`left`];function Xo(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Zo(e){return Math.round(e*10)/10}function Qo(e,t){let n=t.right<=e.left||t.left>=e.right,r=t.bottom<=e.top||t.top>=e.bottom,i=ns(e.left,e.right,t.left,t.right),a=ns(e.top,e.bottom,t.top,t.bottom),o=[];if(n||r)return t.bottom<=e.top?o.push(es(`top`,i,t.bottom,e.top,t)):t.top>=e.bottom&&o.push(es(`bottom`,i,e.bottom,t.top,t)),t.right<=e.left?o.push(ts(`left`,a,t.right,e.left,t)):t.left>=e.right&&o.push(ts(`right`,a,e.right,t.left,t)),o;let s=[[`top`,e.top,t.top],[`right`,e.right,t.right],[`bottom`,e.bottom,t.bottom],[`left`,e.left,t.left]];for(let[e,t,n]of s){let r=Zo(Math.abs(t-n));if(r===0)continue;let[s,c]=t<n?[t,n]:[n,t];o.push(e===`top`||e===`bottom`?{side:e,value:r,from:{x:i,y:s},to:{x:i,y:c}}:{side:e,value:r,from:{x:s,y:a},to:{x:c,y:a}})}return o}function $o(e,t){let n={...t};for(let t of e)n[t.side]=t.value;return n}function es(e,t,n,r,i){let a={side:e,value:Zo(r-n),from:{x:t,y:n},to:{x:t,y:r}};if(t<i.left||t>i.right){let n=e===`top`?i.bottom:i.top;a.extension={from:{x:t<i.left?i.left:i.right,y:n},to:{x:t,y:n}}}return a}function ts(e,t,n,r,i){let a={side:e,value:Zo(r-n),from:{x:n,y:t},to:{x:r,y:t}};if(t<i.top||t>i.bottom){let n=e===`left`?i.right:i.left;a.extension={from:{x:n,y:t<i.top?i.top:i.bottom},to:{x:n,y:t}}}return a}function ns(e,t,n,r){let i=Math.max(e,n),a=Math.min(t,r);return i<=a?(i+a)/2:(e+t)/2}function rs(e){let t=getComputedStyle(e),n=e=>Yo.map(n=>Zo(as(t.getPropertyValue(e(n))))),r={margin:n(e=>`margin-${e}`),padding:n(e=>`padding-${e}`),border:n(e=>`border-${e}-width`)};if(/flex|grid/.test(t.display)){let e=Zo(as(t.rowGap)),n=Zo(as(t.columnGap));(e>0||n>0)&&(r.gap={row:e,column:n})}return r}function is(e,t,n){let r=[...e.children].slice(0,100).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0),i=[];for(let e=1;e<r.length;e++){let a=r[e-1],o=r[e];t.column>0&&o.left>=a.right-.5&&o.top<a.bottom?i.push({axis:`column`,left:a.right,right:o.left,top:Math.max(a.top,o.top),bottom:Math.min(a.bottom,o.bottom)}):t.row>0&&o.top>=a.bottom-.5&&i.push({axis:`row`,left:n.left,right:n.right,top:a.bottom,bottom:o.top})}return i.filter(e=>e.right-e.left>.5&&e.bottom-e.top>.5)}function as(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}let os={top:`t`,right:`r`,bottom:`b`,left:`l`},ss={top:`y`,right:`x`,bottom:`y`,left:`x`};function cs(e,t,n,r){let i=new Set(e.classList),a=t===`gap`?[`gap-${n===`row`?`y`:`x`}`,`gap`]:[`${t[0]}${os[n]}`,`${t[0]}${ss[n]}`,t[0]];for(let e of a){let t=[...i].find(t=>t.startsWith(`${e}-`));if(!t)continue;let n=ls(t.slice(e.length+1));return n!==void 0&&Math.abs(n-r)<.5?t:void 0}}function ls(e){if(e===`px`)return 1;let t=e.match(/^\[(-?[\d.]+)(px|rem)\]$/);if(t)return Number(t[1])*(t[2]===`rem`?us():1);if(/^\d+(?:\.\d+)?$/.test(e))return Number(e)*.25*us()}function us(){return as(getComputedStyle(document.documentElement).fontSize)||16}async function ds(e){let t=e.getBoundingClientRect(),n=window.getSelection()?.toString().trim(),r=rs(e);return{tagName:e.tagName.toLowerCase(),selector:ps(e),html:vs(e),text:bs(e),components:await xs(e),box:r,rect:{x:t.x,y:t.y,width:t.width,height:t.height},viewport:{width:window.innerWidth,height:window.innerHeight,dpr:Math.round(window.devicePixelRatio*100)/100},...n&&e.contains(window.getSelection()?.anchorNode??null)?{selection:n}:{}}}function fs(e){let t=e.tagName.toLowerCase(),n=Ds(e);if(!n)return t;let r=null;return zr(n,e=>Rr(e)?(r=Wr(e.type),!(!r||Os(r))):!1,!0),r?`${r} · ${t}`:t}function ps(e){let t=[],n=e;for(;n&&n!==document.documentElement;){let r=ms(n);if(r){t.unshift(r);let n=t.join(` > `);if(gs(n,e))return n}else{t.unshift(hs(n));let r=t.join(` > `);if(t.length>=2&&gs(r,e))return r}n=n.parentElement}return t.join(` > `)}function ms(e){for(let t of[`data-testid`,`data-test`,`data-cy`,`data-tencil-id`]){let n=e.getAttribute(t);if(n)return`${e.tagName.toLowerCase()}[${t}="${CSS.escape(n)}"]`}let t=e.id;return t&&!/[:«»]|\d{3,}/.test(t)?`#${CSS.escape(t)}`:null}function hs(e){let t=e.tagName.toLowerCase(),n=e.parentElement;if(!n)return t;let r=[...n.children].filter(t=>t.tagName===e.tagName);return r.length===1?t:`${t}:nth-of-type(${r.indexOf(e)+1})`}function gs(e,t){try{let n=document.querySelectorAll(e);return n.length===1&&n[0]===t}catch{return!1}}let _s=[`id`,`class`,`href`,`src`,`alt`,`type`,`name`,`role`,`aria-label`];function vs(e){let t=e.tagName.toLowerCase(),n=`<${[t,...[...e.attributes].filter(e=>!e.name.startsWith(`data-tencil`)).sort((e,t)=>ys(e.name)-ys(t.name)).slice(0,8).map(e=>{let t=e.name===`class`?80:120;return e.value?`${e.name}="${Ms(e.value,t)}"`:e.name})].join(` `)}>`,r=e.children.length;return`${n}${r>0?`…${r} element${r===1?``:`s`}…`:Ms(e.textContent?.trim()??``,100)}</${t}>`}function ys(e){let t=_s.indexOf(e);return t===-1?_s.length:t}function bs(e){let t=e.innerText?.replace(/\s+/g,` `).trim();return t?Ms(t,200):void 0}async function xs(e){let t=Ss(e);if(t.length>0)return t;let n=Ds(e);if(!n)return[];try{let e=await Ns(lo(n),1500),t=ws(n),r=e.filter(e=>e.functionName&&!/^[a-z]/.test(e.functionName)&&!Os(e.functionName)).slice(0,6).map(e=>Ts(e,t.get(e.functionName)));if(r.length>0)return r}catch{}return Es(n)}function Ss(e){let t=[],n;for(let r=e;r&&t.length<6;r=r.parentElement){let e=r.getAttribute(`data-tencil-src`)?.match(/^(.+):(\d+):(\d+)$/);if(!e)continue;let[,i=``,a,o]=e,s=r.getAttribute(`data-tencil-component`)??Cs(i);s!==n&&(n=s,t.push({name:s,source:{file:i,line:Number(a),column:Number(o)}}))}return t}function Cs(e){return e.slice(e.lastIndexOf(`/`)+1)}function ws(e){let t=/* @__PURE__ */ new Map;try{for(let n of io(e))n.functionName&&n.fileName&&!t.has(n.functionName)&&t.set(n.functionName,As(n.fileName))}catch{}return t}function Ts(e,t){let n=e.functionName??`Anonymous`;if(!e.fileName)return{name:n};let r=js(e.fileName);return r?{name:n,library:r}:mo(e.fileName)?{name:n,source:{file:ks(As(e.fileName),t),...e.lineNumber==null?{}:{line:e.lineNumber},...e.columnNumber==null?{}:{column:e.columnNumber}}}:{name:n}}function Es(e){let t=[];return zr(e,e=>{if(Rr(e)){let n=Wr(e.type);n&&!Os(n)&&t.push({name:n})}return t.length>=6},!0),t}function Ds(e){try{return li(e)}catch{return null}}function Os(e){return/^(?:Anonymous|Fragment|Suspense|StrictMode|Profiler|Provider|Consumer|ErrorBoundary|InnerLayoutRouter|OuterLayoutRouter|RedirectBoundary|NotFoundBoundary|LoadingBoundary|HotReload|Router|AppRouter|ServerRoot|ScrollAndFocusHandler|RenderFromTemplateContext)$/.test(e)||/(?:Provider|Context|Boundary)$/.test(e)}function ks(e,t){return e.includes(`/`)||!t?e:t.endsWith(`/${e}`)?t:e}function As(e){let t=e;if(/^https?:\/\//.test(e))try{t=decodeURIComponent(new URL(e).pathname)}catch{}return t.replace(/[?#].*$/,``).replace(/^\/@fs/,``).replace(/^(?:webpack-internal:\/\/\/|webpack:\/\/[^/]*\/|turbopack:\/\/\/|rsc:\/\/React\/[^/]+\/|file:\/\/)/,``).replace(/^\/?\((?:app-pages-browser|ssr|rsc)\)\//,``).replace(/^\.\//,``).replace(/^\/(?=(?:src|app|pages|components|lib)\/)/,``)}function js(e){return e.match(/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?((?:@[^/]+\/)?[^/]+)/)?.[1]}function Ms(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function Ns(e,t){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(/* @__PURE__ */ Error(`timeout`)),t))])}let Ps;function Fs(e){Ps=e}function Is(){if(!Ps)throw Error(`Tencil overlay is not mounted`);return Ps}let Ls=/* @__PURE__ */ new Map;function Rs(e,t){let n=t??Bs(e.selector);if(!n?.isConnected)return null;let r=n.getBoundingClientRect();return r.width===0&&r.height===0?null:{x:r.left+r.width*e.offsetX,y:r.top+r.height*e.offsetY}}function zs(e,t){let n=e.getBoundingClientRect(),r=(e,t)=>t>0?Hs(e/t,0,1):.5;return{offsetX:r(t.x-n.left,n.width),offsetY:r(t.y-n.top,n.height)}}function Bs(e){if(!e)return null;let t=Ls.get(e)?.deref();if(t?.isConnected&&t.matches(e))return t;try{let t=document.querySelector(e);return t&&Ls.set(e,new WeakRef(t)),t}catch{return null}}function Vs(e,t,n=16){let r=window.innerWidth,i=window.innerHeight,a=e.x+n;a+t.width>r-12&&(a=e.x-n-t.width),a=Hs(a,12,r-t.width-12);let o=Hs(e.y-24,12,i-t.height-12),s=`${Hs(e.x-a,0,t.width)}px ${Hs(e.y-o,0,t.height)}px`;return{left:a,top:o,origin:s}}function Hs(e,t,n){return Math.max(t,Math.min(n,e))}function Us(e,t){return e[13]=1,e[14]=t>>8,e[15]=t&255,e[16]=t>>8,e[17]=t&255,e}let Ws;function Gs(){let e=/* @__PURE__ */ new Int32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e}function Ks(e){let t=-1;Ws||=Gs();for(let n=0;n<e.length;n++)t=Ws[(t^e[n])&255]^t>>>8;return t^-1}function qs(e){let t=e.length-1;for(let n=t;n>=4;n--)if(e[n-4]===9&&e[n-3]===112&&e[n-2]===72&&e[n-1]===89&&e[n]===115)return n-3;return 0}function Js(e,t,n=!1){let r=/* @__PURE__ */ new Uint8Array(13);t*=39.3701,r[0]=112,r[1]=72,r[2]=89,r[3]=115,r[4]=t>>>24,r[5]=t>>>16,r[6]=t>>>8,r[7]=t&255,r[8]=r[4],r[9]=r[5],r[10]=r[6],r[11]=r[7],r[12]=1;let i=Ks(r),a=/* @__PURE__ */ new Uint8Array(4);if(a[0]=i>>>24,a[1]=i>>>16,a[2]=i>>>8,a[3]=i&255,n){let t=qs(e);return e.set(r,t),e.set(a,t+13),e}{let t=/* @__PURE__ */ new Uint8Array(4);t[0]=0,t[1]=0,t[2]=0,t[3]=9;let n=/* @__PURE__ */ new Uint8Array(54);return n.set(e,0),n.set(t,33),n.set(r,37),n.set(a,50),n}}function Ys(e){let t=e.indexOf(`AAlwSFlz`);return t===-1&&(t=e.indexOf(`AAAJcEhZ`)),t===-1&&(t=e.indexOf(`AAAACXBI`)),t}let Xs=`[modern-screenshot]`,Zs=typeof window<`u`,Qs=Zs&&`Worker`in window,$s=Zs&&`atob`in window,ec=Zs&&`btoa`in window,tc=Zs?window.navigator?.userAgent:``,nc=tc.includes(`Chrome`),rc=tc.includes(`AppleWebKit`)&&!nc,ic=tc.includes(`Firefox`),ac=e=>e&&`__CONTEXT__`in e,oc=e=>e.constructor.name===`CSSFontFaceRule`,sc=e=>e.constructor.name===`CSSImportRule`,cc=e=>e.constructor.name===`CSSLayerBlockRule`,Z=e=>e.nodeType===1,lc=e=>typeof e.className==`object`,uc=e=>e.tagName===`image`,dc=e=>e.tagName===`use`,fc=e=>Z(e)&&e.style!==void 0&&!lc(e),pc=e=>e.nodeType===8,mc=e=>e.nodeType===3,hc=e=>e.tagName===`IMG`,gc=e=>e.tagName===`VIDEO`,_c=e=>e.tagName===`CANVAS`,vc=e=>e.tagName===`TEXTAREA`,yc=e=>e.tagName===`INPUT`,bc=e=>e.tagName===`STYLE`,xc=e=>e.tagName===`SCRIPT`,Sc=e=>e.tagName===`SELECT`,Cc=e=>e.tagName===`SLOT`,wc=e=>e.tagName===`IFRAME`,Tc=(...e)=>console.warn(Xs,...e);function Ec(e){let t=e?.createElement?.(`canvas`);return t&&(t.height=t.width=1),!!t&&`toDataURL`in t&&!!t.toDataURL(`image/webp`).includes(`image/webp`)}let Dc=e=>e.startsWith(`data:`);function Oc(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(Zs&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!Zs)return e;let n=kc().implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function kc(e){return(e&&Z(e)?e?.ownerDocument:e)??window.document}let Ac=`http://www.w3.org/2000/svg`;function jc(e,t,n){let r=kc(n).createElementNS(Ac,`svg`);return r.setAttributeNS(null,`width`,e.toString()),r.setAttributeNS(null,`height`,t.toString()),r.setAttributeNS(null,`viewBox`,`0 0 ${e} ${t}`),r}function Mc(e,t){let n=new XMLSerializer().serializeToString(e);return t&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,``)),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function Nc(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(/* @__PURE__ */ Error(`Failed read blob to ${t}`)),t===`dataUrl`?i.readAsDataURL(e):t===`arrayBuffer`&&i.readAsArrayBuffer(e)})}let Pc=e=>Nc(e,`dataUrl`);function Fc(e,t){let n=kc(t).createElement(`img`);return n.decoding=`sync`,n.loading=`eager`,n.src=e,n}function Ic(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:a,onWarn:o}=t??{},s=typeof e==`string`?Fc(e,kc(i)):e,c=null,l=null;function u(){n(s),c&&clearTimeout(c),l?.()}if(r&&(c=setTimeout(u,r)),gc(s)){let e=s.currentSrc||s.src;if(!e)return s.poster?Ic(s.poster,t).then(n):u();if(s.readyState>=2)return u();let r=u,i=t=>{o?.(`Failed video load`,e,t),a?.(t),u()};l=()=>{s.removeEventListener(`loadeddata`,r),s.removeEventListener(`error`,i)},s.addEventListener(`loadeddata`,r,{once:!0}),s.addEventListener(`error`,i,{once:!0})}else{let e=uc(s)?s.href.baseVal:s.currentSrc||s.src;if(!e)return u();let t=async()=>{if(hc(s)&&`decode`in s)try{await s.decode()}catch(t){o?.(`Failed to decode image, trying to render anyway`,s.dataset.originalSrc||e,t)}u()},n=t=>{o?.(`Failed image load`,s.dataset.originalSrc||e,t),u()};if(hc(s)&&s.complete)return t();l=()=>{s.removeEventListener(`load`,t),s.removeEventListener(`error`,n)},s.addEventListener(`load`,t,{once:!0}),s.addEventListener(`error`,n,{once:!0})}})}async function Lc(e,t){fc(e)&&(hc(e)||gc(e)?await Ic(e,t):await Promise.all([`img`,`video`].flatMap(n=>Array.from(e.querySelectorAll(n)).map(e=>Ic(e,t)))))}let Rc=/* @__PURE__ */ function(){let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)}();function zc(e){return e?.split(`,`).map(e=>e.trim().replace(/"|'/g,``).toLowerCase()).filter(Boolean)}let Bc=0;function Vc(e){let t=`${Xs}[#${Bc}]`;return Bc++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...t)=>e&&Tc(...t)}}function Hc(e){return{cache:e?`no-cache`:`force-cache`}}async function Uc(e,t){return ac(e)?e:Wc(e,{...t,autoDestruct:!0})}async function Wc(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},a=!!t?.debug,o=t?.features??!0,s=e.ownerDocument??(Zs?window.document:void 0),c=e.ownerDocument?.defaultView??(Zs?window:void 0),l=/* @__PURE__ */ new Map,u={width:0,height:0,quality:1,type:`image/png`,scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:a,fetch:{requestInit:Hc(t?.fetch?.bypassingCache),placeholderImage:`data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,bypassingCache:!1,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...t,__CONTEXT__:!0,log:Vc(a),node:e,ownerDocument:s,ownerWindow:c,dpi:n===1?null:96*n,svgStyleElement:Gc(s),svgDefsElement:s?.createElementNS(Ac,`defs`),svgStyles:/* @__PURE__ */ new Map,defaultComputedStyles:/* @__PURE__ */ new Map,workers:[...Array.from({length:Qs&&r&&i?i:0})].map(()=>{try{let e=new Worker(r);return e.onmessage=async e=>{let{url:t,result:n}=e.data;n?l.get(t)?.resolve?.(n):l.get(t)?.reject?.(/* @__PURE__ */ Error(`Error receiving message from worker: ${t}`))},e.onmessageerror=e=>{let{url:t}=e.data;l.get(t)?.reject?.(/* @__PURE__ */ Error(`Error receiving message from worker: ${t}`))},e}catch(e){return u.log.warn(`Failed to new Worker`,e),null}}).filter(Boolean),fontFamilies:/* @__PURE__ */ new Map,fontCssTexts:/* @__PURE__ */ new Map,acceptOfImage:`${[Ec(s)&&`image/webp`,`image/svg+xml`,`image/*`,`*/*`].filter(Boolean).join(`,`)};q=0.8`,requests:l,drawImageCount:0,tasks:[],features:o,isEnable:e=>e===`restoreScrollPosition`?typeof o==`boolean`?!1:o[e]??!1:typeof o==`boolean`?o:o[e]??!0,shadowRoots:[]};u.log.time(`wait until load`),await Lc(e,{timeout:u.timeout,onWarn:u.log.warn}),u.log.timeEnd(`wait until load`);let{width:d,height:f}=Kc(e,u);return u.width=d,u.height=f,u}function Gc(e){if(!e)return;let t=e.createElement(`style`),n=t.ownerDocument.createTextNode(`
55
+ `);n!==-1&&(t=t.slice(n+1));let r=Math.max(...ra.map(e=>t.indexOf(e)));if(r!==-1&&(r=t.lastIndexOf(`
56
+ `,r)),r!==-1)t=t.slice(0,r);else return``;return t},Ro=e=>!!(e.functionName&&e.fileName&&Ho(e.fileName)),zo=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,Bo=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){if(!Ro(n))continue;let e=n.functionName,r=t.get(e)??[];r.some(e=>zo(e,n))||(r.push(n),t.set(e,r))}return t},Vo=(e,t,n)=>{if(!e.functionName)return{...e,isServer:!0};let r=t.get(e.functionName);if(!r||r.length===0)return{...e,isServer:!0};let i=n.get(e.functionName)??0,a=r[i%r.length];return n.set(e.functionName,i+1),{...e,isServer:!0,fileName:a.fileName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,source:e.source?.replace(na,`(${a.fileName}:${a.lineNumber}:${a.columnNumber})`)}},Ho=e=>Zi.some(t=>e.startsWith(t)),Uo=e=>!e.isServer&&e.fileName&&Ho(e.fileName)?{...e,isServer:!0}:e,Wo=e=>{let t=[],n=e;for(;n;)if(Eo(n)){let e=n;if(n=e._debugOwner,n&&To(e)){let{frames:n,isTrusted:r}=ya(e._debugStack);if(r)for(let e of n)t.push(Uo(e))}}else{let e=n;if(n=e.owner,n&&e.debugStack instanceof Error)for(let n of ya(e.debugStack).frames)t.push({...n,isServer:!0})}return t},Go=e=>{let t=[];return wi(e,e=>{if(!To(e))return;let{frames:n,isTrusted:r}=ya(e._debugStack);r&&t.push(...n)},!0),t},Ko=e=>{let t=Go(e),n=ua(Io(e)),r=Bo(t),i=/* @__PURE__ */ new Map;return n.map(e=>e.source!==void 0&&na.test(e.source)?Vo(e,r,i):e).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return e.functionName!==r.functionName})},qo=async(e,t=!0,n,r={})=>wo(Ko(e),t,n,r),Jo=e=>!!e.fileName&&!e.isIgnoreListed,Yo=async(e,t=!0,n,r={})=>{let i=Wo(e);if(i.length>0){let a=Do(e)??{};a.functionName=ki(e.type)??a.functionName;let o=await wo([a,...i],t,n,r);if(o.some((e,t)=>t>0&&Jo(e)))return o}return qo(e,t,n,r)},Xo=e=>e.split(`/`).filter(Boolean).length,Zo=e=>{let t=e.indexOf(`/`,1);if(t===-1)return e;let n=e.slice(0,t);if(Xo(n)!==1)return e;let r=e.slice(t);if(!$i.test(r))return e;let i=r.split(`/`).filter(Boolean);if(i.length<2)return e;let a=i[0];return a.startsWith(`@`)||a.length>4?e:r},Qo=e=>{if(!e||Qi.some(t=>t===e))return``;let t=e,n=/^[a-zA-Z]:[\\/]/.test(t);if(t.startsWith(`http://`)||t.startsWith(`https://`)){try{t=new URL(t).pathname}catch{}t=Zo(t)}if(t.startsWith(`about://React/`)){let e=t.slice(14),n=e.indexOf(`/`),r=e.indexOf(`:`);t=n!==-1&&(r===-1||n<r)?e.slice(n+1):e}let r=!0;for(;r;){r=!1;for(let e of Xi)if(t.startsWith(e)){t=t.slice(e.length),e===`file:///`&&(t=`/${t.replace(/^\/+/,``)}`),r=!0;break}}if(!n){let e=t.match(Yi);e&&(t=t.slice(e[0].length))}if(t.startsWith(`//`)){let e=t.indexOf(`/`,2);t=e===-1?``:t.slice(e)}let i=t.indexOf(`?`);if(i!==-1){let e=t.slice(i);ta.test(e)&&(t=t.slice(0,i))}return t},$o=e=>{let t=Qo(e);return!(!t||!$i.test(t)||ea.test(t))},es=Symbol.for(`react.context`),ts=Symbol.for(`react.recoverable`),ns=[],rs=null,is=Error("Suspense interrupted this render. This error is an internal implementation detail of `use`."),Y=()=>{let e=rs;return e!==null&&(rs=e.next),e},as=e=>typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`,os=e=>typeof e==`object`&&!!e&&`current`in e,ss=e=>typeof e==`object`&&!!e&&`_currentValue`in e,cs=e=>e._currentValue,X=(e,t,n,r=null,i=null)=>{ns.push({displayName:r,primitive:e,stackError:Error(),value:t,debugInfo:i,dispatcherHookName:n})},ls=e=>{if(typeof e==`object`&&e){if(as(e)){let t=e,n=as(t)?t:e;switch(n.status){case`fulfilled`:return X(`Promise`,n.value,`Use`,null,n._debugInfo??null),n.value;case`rejected`:throw n.reason}throw X(`Unresolved`,n,`Use`,null,n._debugInfo??null),is}if(`$$typeof`in e&&e.$$typeof===ts){X(`Recoverable`,void 0,`Use`);return}if(`$$typeof`in e&&e.$$typeof===es&&ss(e)){let t={_currentValue:e._currentValue,displayName:typeof e.displayName==`string`?e.displayName:void 0},n=cs(t);return X(`Context (use)`,n,`Use`,t.displayName||`Context`),n}}throw new gi(`use() received an unsupported value: `+String(e))},us=e=>{let t=cs(e);return X(`Context`,t,`Context`,e.displayName||null),t},ds=e=>{let t=Y(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return X(`State`,n,`State`),[n,()=>{}]},fs=(e,t,n)=>{let r=Y(),i=r===null?n===void 0?t:n(t):r.memoizedState;return X(`Reducer`,i,`Reducer`),[i,()=>{}]},ps=e=>{let t=Y(),n=os(t?.memoizedState)?t.memoizedState:{current:e};return X(`Ref`,n.current,`Ref`),n},ms=()=>{let e=Y();return X(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},hs=e=>{Y(),X(`LayoutEffect`,e,`LayoutEffect`)},gs=e=>{Y(),X(`InsertionEffect`,e,`InsertionEffect`)},_s=e=>{Y(),X(`Effect`,e,`Effect`)},vs=e=>{Y();let t=os(e)?e.current:void 0;X(`ImperativeHandle`,t,`ImperativeHandle`)},ys=(e,t)=>{X(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},bs=e=>{let t=Y();return X(`Callback`,Array.isArray(t?.memoizedState)?t.memoizedState[0]:e,`Callback`),e},xs=e=>{let t=Y(),n=Array.isArray(t?.memoizedState)?t.memoizedState[0]:e();return X(`Memo`,n,`Memo`),n},Ss=(e,t)=>{let n=Y();Y();let r=n===null?t():n.memoizedState;return X(`SyncExternalStore`,r,`SyncExternalStore`),r},Cs=()=>{let e=Y();Y();let t=e?.memoizedState===!0;return X(`Transition`,t,`Transition`),[t,()=>{}]},ws=e=>{let t=Y(),n=t===null?e:t.memoizedState;return X(`DeferredValue`,n,`DeferredValue`),n},Ts=()=>{let e=Y(),t=typeof e?.memoizedState==`string`?e.memoizedState:``;return X(`Id`,t,`Id`),t},Es=e=>[],Ds=e=>{let t=Y(),n=t===null?e:t.memoizedState;return X(`Optimistic`,n,`Optimistic`),[n,()=>{}]},Os=(e,t)=>{let n,r=null,i=null;if(e!==null){let t=e.memoizedState;if(as(t))switch(t.status){case`fulfilled`:n=t.value,r=t._debugInfo??null;break;case`rejected`:i=t.reason;break;default:i=is,n=t,r=t._debugInfo??null}else n=t}else n=t;return{value:n,debugInfo:r,error:i}},ks=e=>(t,n)=>{let r=Y();Y(),Y();let{value:i,debugInfo:a,error:o}=Os(r,n);if(X(e,i,e,null,a),o!==null)throw o;return[i,()=>{},!1]},As=ks(`ActionState`),js={readContext:cs,use:ls,useCallback:bs,useContext:us,useEffect:_s,useImperativeHandle:vs,useLayoutEffect:hs,useInsertionEffect:gs,useMemo:xs,useReducer:fs,useRef:ps,useState:ds,useDebugValue:ys,useDeferredValue:ws,useTransition:Cs,useSyncExternalStore:Ss,useId:Ts,useHostTransitionStatus:()=>{let e=cs({_currentValue:null});return X(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:ks(`FormState`),useActionState:As,useOptimistic:Ds,useMemoCache:Es,useCacheRefresh:ms,useEffectEvent:e=>(Y(),X(`EffectEvent`,e,`EffectEvent`),e)};new Proxy(js,{get(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);throw new _i(`The React dispatcher is missing method `+t)}});let Ms=e=>{if(!e)return``;let t=e.lastIndexOf(`[as `);if(t!==-1)return Ms(e.slice(t+4,-1));if(t=e.lastIndexOf(`.`),t=t===-1?0:t+1,e.slice(t).startsWith(`unstable_`)&&(t+=9),e.slice(t).startsWith(`experimental_`)&&(t+=13),e.slice(t,t+3)===`use`){if(e.length-t===3)return`Use`;t+=3}return e.slice(t)};new Set([X,...Object.values(js)].map(e=>Ms(e.name)));let Ns=[`top`,`right`,`bottom`,`left`];function Ps(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Fs(e){return Math.round(e*10)/10}function Is(e,t){let n=t.right<=e.left||t.left>=e.right,r=t.bottom<=e.top||t.top>=e.bottom,i=Bs(e.left,e.right,t.left,t.right),a=Bs(e.top,e.bottom,t.top,t.bottom),o=[];if(n||r)return t.bottom<=e.top?o.push(Rs(`top`,i,t.bottom,e.top,t)):t.top>=e.bottom&&o.push(Rs(`bottom`,i,e.bottom,t.top,t)),t.right<=e.left?o.push(zs(`left`,a,t.right,e.left,t)):t.left>=e.right&&o.push(zs(`right`,a,e.right,t.left,t)),o;let s=[[`top`,e.top,t.top],[`right`,e.right,t.right],[`bottom`,e.bottom,t.bottom],[`left`,e.left,t.left]];for(let[e,t,n]of s){let r=Fs(Math.abs(t-n));if(r===0)continue;let[s,c]=t<n?[t,n]:[n,t];o.push(e===`top`||e===`bottom`?{side:e,value:r,from:{x:i,y:s},to:{x:i,y:c}}:{side:e,value:r,from:{x:s,y:a},to:{x:c,y:a}})}return o}function Ls(e,t){let n={...t};for(let t of e)n[t.side]=t.value;return n}function Rs(e,t,n,r,i){let a={side:e,value:Fs(r-n),from:{x:t,y:n},to:{x:t,y:r}};if(t<i.left||t>i.right){let n=e===`top`?i.bottom:i.top;a.extension={from:{x:t<i.left?i.left:i.right,y:n},to:{x:t,y:n}}}return a}function zs(e,t,n,r,i){let a={side:e,value:Fs(r-n),from:{x:n,y:t},to:{x:r,y:t}};if(t<i.top||t>i.bottom){let n=e===`left`?i.right:i.left;a.extension={from:{x:n,y:t<i.top?i.top:i.bottom},to:{x:n,y:t}}}return a}function Bs(e,t,n,r){let i=Math.max(e,n),a=Math.min(t,r);return i<=a?(i+a)/2:(e+t)/2}function Vs(e){let t=getComputedStyle(e),n=e=>Ns.map(n=>Fs(Us(t.getPropertyValue(e(n))))),r={margin:n(e=>`margin-${e}`),padding:n(e=>`padding-${e}`),border:n(e=>`border-${e}-width`)};if(/flex|grid/.test(t.display)){let e=Fs(Us(t.rowGap)),n=Fs(Us(t.columnGap));(e>0||n>0)&&(r.gap={row:e,column:n})}return r}function Hs(e,t,n){let r=[...e.children].slice(0,100).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0),i=[];for(let e=1;e<r.length;e++){let a=r[e-1],o=r[e];t.column>0&&o.left>=a.right-.5&&o.top<a.bottom?i.push({axis:`column`,left:a.right,right:o.left,top:Math.max(a.top,o.top),bottom:Math.min(a.bottom,o.bottom)}):t.row>0&&o.top>=a.bottom-.5&&i.push({axis:`row`,left:n.left,right:n.right,top:a.bottom,bottom:o.top})}return i.filter(e=>e.right-e.left>.5&&e.bottom-e.top>.5)}function Us(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}let Ws={top:`t`,right:`r`,bottom:`b`,left:`l`},Gs={top:`y`,right:`x`,bottom:`y`,left:`x`};function Ks(e,t,n,r){let i=new Set(e.classList),a=t===`gap`?[`gap-${n===`row`?`y`:`x`}`,`gap`]:[`${t[0]}${Ws[n]}`,`${t[0]}${Gs[n]}`,t[0]];for(let e of a){let t=[...i].find(t=>t.startsWith(`${e}-`));if(!t)continue;let n=qs(t.slice(e.length+1));return n!==void 0&&Math.abs(n-r)<.5?t:void 0}}function qs(e){if(e===`px`)return 1;let t=e.match(/^\[(-?[\d.]+)(px|rem)\]$/);if(t)return Number(t[1])*(t[2]===`rem`?Js():1);if(/^\d+(?:\.\d+)?$/.test(e))return Number(e)*.25*Js()}function Js(){return Us(getComputedStyle(document.documentElement).fontSize)||16}async function Ys(e){let t=e.getBoundingClientRect(),n=window.getSelection()?.toString().trim(),r=Vs(e);return{tagName:e.tagName.toLowerCase(),selector:Zs(e),html:nc(e),text:ic(e),components:await ac(e),box:r,rect:{x:t.x,y:t.y,width:t.width,height:t.height},viewport:{width:window.innerWidth,height:window.innerHeight,dpr:Math.round(window.devicePixelRatio*100)/100},...n&&e.contains(window.getSelection()?.anchorNode??null)?{selection:n}:{}}}function Xs(e){let t=e.tagName.toLowerCase(),n=dc(e);if(!n)return t;let r=null;return wi(n,e=>Ci(e)?(r=ki(e.type),!(!r||fc(r))):!1,!0),r?`${r} · ${t}`:t}function Zs(e){let t=[],n=e;for(;n&&n!==document.documentElement;){let r=Qs(n);if(r){t.unshift(r);let n=t.join(` > `);if(ec(n,e))return n}else{t.unshift($s(n));let r=t.join(` > `);if(t.length>=2&&ec(r,e))return r}n=n.parentElement}return t.join(` > `)}function Qs(e){for(let t of[`data-testid`,`data-test`,`data-cy`,`data-tencil-id`]){let n=e.getAttribute(t);if(n)return`${e.tagName.toLowerCase()}[${t}="${CSS.escape(n)}"]`}let t=e.id;return t&&!/[:«»]|\d{3,}/.test(t)?`#${CSS.escape(t)}`:null}function $s(e){let t=e.tagName.toLowerCase(),n=e.parentElement;if(!n)return t;let r=[...n.children].filter(t=>t.tagName===e.tagName);return r.length===1?t:`${t}:nth-of-type(${r.indexOf(e)+1})`}function ec(e,t){try{let n=document.querySelectorAll(e);return n.length===1&&n[0]===t}catch{return!1}}let tc=[`id`,`class`,`href`,`src`,`alt`,`type`,`name`,`role`,`aria-label`];function nc(e){let t=e.tagName.toLowerCase(),n=`<${[t,...[...e.attributes].filter(e=>!e.name.startsWith(`data-tencil`)).sort((e,t)=>rc(e.name)-rc(t.name)).slice(0,8).map(e=>{let t=e.name===`class`?80:120;return e.value?`${e.name}="${gc(e.value,t)}"`:e.name})].join(` `)}>`,r=e.children.length;return`${n}${r>0?`…${r} element${r===1?``:`s`}…`:gc(e.textContent?.trim()??``,100)}</${t}>`}function rc(e){let t=tc.indexOf(e);return t===-1?tc.length:t}function ic(e){let t=e.innerText?.replace(/\s+/g,` `).trim();return t?gc(t,200):void 0}async function ac(e){let t=oc(e);if(t.length>0)return t;let n=dc(e);if(!n)return[];try{let e=await _c(Yo(n),1500),t=cc(n),r=e.filter(e=>e.functionName&&!/^[a-z]/.test(e.functionName)&&!fc(e.functionName)).slice(0,6).map(e=>lc(e,t.get(e.functionName)));if(r.length>0)return r}catch{}return uc(n)}function oc(e){let t=[],n;for(let r=e;r&&t.length<6;r=r.parentElement){let e=r.getAttribute(`data-tencil-src`)?.match(/^(.+):(\d+):(\d+)$/);if(!e)continue;let[,i=``,a,o]=e,s=r.getAttribute(`data-tencil-component`)??sc(i);s!==n&&(n=s,t.push({name:s,source:{file:i,line:Number(a),column:Number(o)}}))}return t}function sc(e){return e.slice(e.lastIndexOf(`/`)+1)}function cc(e){let t=/* @__PURE__ */ new Map;try{for(let n of Wo(e))n.functionName&&n.fileName&&!t.has(n.functionName)&&t.set(n.functionName,mc(n.fileName))}catch{}return t}function lc(e,t){let n=e.functionName??`Anonymous`;if(!e.fileName)return{name:n};let r=hc(e.fileName);return r?{name:n,library:r}:$o(e.fileName)?{name:n,source:{file:pc(mc(e.fileName),t),...e.lineNumber==null?{}:{line:e.lineNumber},...e.columnNumber==null?{}:{column:e.columnNumber}}}:{name:n}}function uc(e){let t=[];return wi(e,e=>{if(Ci(e)){let n=ki(e.type);n&&!fc(n)&&t.push({name:n})}return t.length>=6},!0),t}function dc(e){try{return Ji(e)}catch{return null}}function fc(e){return/^(?:Anonymous|Fragment|Suspense|StrictMode|Profiler|Provider|Consumer|ErrorBoundary|InnerLayoutRouter|OuterLayoutRouter|RedirectBoundary|NotFoundBoundary|LoadingBoundary|HotReload|Router|AppRouter|ServerRoot|ScrollAndFocusHandler|RenderFromTemplateContext)$/.test(e)||/(?:Provider|Context|Boundary)$/.test(e)}function pc(e,t){return e.includes(`/`)||!t?e:t.endsWith(`/${e}`)?t:e}function mc(e){let t=e;if(/^https?:\/\//.test(e))try{t=decodeURIComponent(new URL(e).pathname)}catch{}return t.replace(/[?#].*$/,``).replace(/^\/@fs/,``).replace(/^(?:webpack-internal:\/\/\/|webpack:\/\/[^/]*\/|turbopack:\/\/\/|rsc:\/\/React\/[^/]+\/|file:\/\/)/,``).replace(/^\/?\((?:app-pages-browser|ssr|rsc)\)\//,``).replace(/^\.\//,``).replace(/^\/(?=(?:src|app|pages|components|lib)\/)/,``)}function hc(e){return e.match(/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?((?:@[^/]+\/)?[^/]+)/)?.[1]}function gc(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function _c(e,t){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(/* @__PURE__ */ Error(`timeout`)),t))])}let vc;function yc(e){vc=e}function bc(){if(!vc)throw Error(`Tencil overlay is not mounted`);return vc}let xc=/* @__PURE__ */ new Map;function Sc(e,t){let n=t??wc(e.selector);if(!n?.isConnected)return null;let r=n.getBoundingClientRect();return r.width===0&&r.height===0?null:{x:r.left+r.width*e.offsetX,y:r.top+r.height*e.offsetY}}function Cc(e,t){let n=e.getBoundingClientRect(),r=(e,t)=>t>0?Ec(e/t,0,1):.5;return{offsetX:r(t.x-n.left,n.width),offsetY:r(t.y-n.top,n.height)}}function wc(e){if(!e)return null;let t=xc.get(e)?.deref();if(t?.isConnected&&t.matches(e))return t;try{let t=document.querySelector(e);return t&&xc.set(e,new WeakRef(t)),t}catch{return null}}function Tc(e,t,n=16){let r=window.innerWidth,i=window.innerHeight,a=e.x+n;a+t.width>r-12&&(a=e.x-n-t.width),a=Ec(a,12,r-t.width-12);let o=Ec(e.y-24,12,i-t.height-12),s=`${Ec(e.x-a,0,t.width)}px ${Ec(e.y-o,0,t.height)}px`;return{left:a,top:o,origin:s}}function Ec(e,t,n){return Math.max(t,Math.min(n,e))}function Dc(e,t){return e[13]=1,e[14]=t>>8,e[15]=t&255,e[16]=t>>8,e[17]=t&255,e}let Oc;function kc(){let e=/* @__PURE__ */ new Int32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e}function Ac(e){let t=-1;Oc||=kc();for(let n=0;n<e.length;n++)t=Oc[(t^e[n])&255]^t>>>8;return t^-1}function jc(e){let t=e.length-1;for(let n=t;n>=4;n--)if(e[n-4]===9&&e[n-3]===112&&e[n-2]===72&&e[n-1]===89&&e[n]===115)return n-3;return 0}function Mc(e,t,n=!1){let r=/* @__PURE__ */ new Uint8Array(13);t*=39.3701,r[0]=112,r[1]=72,r[2]=89,r[3]=115,r[4]=t>>>24,r[5]=t>>>16,r[6]=t>>>8,r[7]=t&255,r[8]=r[4],r[9]=r[5],r[10]=r[6],r[11]=r[7],r[12]=1;let i=Ac(r),a=/* @__PURE__ */ new Uint8Array(4);if(a[0]=i>>>24,a[1]=i>>>16,a[2]=i>>>8,a[3]=i&255,n){let t=jc(e);return e.set(r,t),e.set(a,t+13),e}{let t=/* @__PURE__ */ new Uint8Array(4);t[0]=0,t[1]=0,t[2]=0,t[3]=9;let n=/* @__PURE__ */ new Uint8Array(54);return n.set(e,0),n.set(t,33),n.set(r,37),n.set(a,50),n}}function Nc(e){let t=e.indexOf(`AAlwSFlz`);return t===-1&&(t=e.indexOf(`AAAJcEhZ`)),t===-1&&(t=e.indexOf(`AAAACXBI`)),t}let Pc=`[modern-screenshot]`,Fc=typeof window<`u`,Ic=Fc&&`Worker`in window,Lc=Fc&&`atob`in window,Rc=Fc&&`btoa`in window,zc=Fc?window.navigator?.userAgent:``,Bc=zc.includes(`Chrome`),Vc=zc.includes(`AppleWebKit`)&&!Bc,Hc=zc.includes(`Firefox`),Uc=e=>e&&`__CONTEXT__`in e,Wc=e=>e.constructor.name===`CSSFontFaceRule`,Gc=e=>e.constructor.name===`CSSImportRule`,Kc=e=>e.constructor.name===`CSSLayerBlockRule`,Z=e=>e.nodeType===1,qc=e=>typeof e.className==`object`,Jc=e=>e.tagName===`image`,Yc=e=>e.tagName===`use`,Xc=e=>Z(e)&&e.style!==void 0&&!qc(e),Zc=e=>e.nodeType===8,Qc=e=>e.nodeType===3,$c=e=>e.tagName===`IMG`,el=e=>e.tagName===`VIDEO`,tl=e=>e.tagName===`CANVAS`,nl=e=>e.tagName===`TEXTAREA`,rl=e=>e.tagName===`INPUT`,il=e=>e.tagName===`STYLE`,al=e=>e.tagName===`SCRIPT`,ol=e=>e.tagName===`SELECT`,sl=e=>e.tagName===`SLOT`,cl=e=>e.tagName===`IFRAME`,ll=(...e)=>console.warn(Pc,...e);function ul(e){let t=e?.createElement?.(`canvas`);return t&&(t.height=t.width=1),!!t&&`toDataURL`in t&&!!t.toDataURL(`image/webp`).includes(`image/webp`)}let dl=e=>e.startsWith(`data:`);function fl(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(Fc&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!Fc)return e;let n=pl().implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function pl(e){return(e&&Z(e)?e?.ownerDocument:e)??window.document}let ml=`http://www.w3.org/2000/svg`;function hl(e,t,n){let r=pl(n).createElementNS(ml,`svg`);return r.setAttributeNS(null,`width`,e.toString()),r.setAttributeNS(null,`height`,t.toString()),r.setAttributeNS(null,`viewBox`,`0 0 ${e} ${t}`),r}function gl(e,t){let n=new XMLSerializer().serializeToString(e);return t&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,``)),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function _l(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(/* @__PURE__ */ Error(`Failed read blob to ${t}`)),t===`dataUrl`?i.readAsDataURL(e):t===`arrayBuffer`&&i.readAsArrayBuffer(e)})}let vl=e=>_l(e,`dataUrl`);function yl(e,t){let n=pl(t).createElement(`img`);return n.decoding=`sync`,n.loading=`eager`,n.src=e,n}function bl(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:a,onWarn:o}=t??{},s=typeof e==`string`?yl(e,pl(i)):e,c=null,l=null;function u(){n(s),c&&clearTimeout(c),l?.()}if(r&&(c=setTimeout(u,r)),el(s)){let e=s.currentSrc||s.src;if(!e)return s.poster?bl(s.poster,t).then(n):u();if(s.readyState>=2)return u();let r=u,i=t=>{o?.(`Failed video load`,e,t),a?.(t),u()};l=()=>{s.removeEventListener(`loadeddata`,r),s.removeEventListener(`error`,i)},s.addEventListener(`loadeddata`,r,{once:!0}),s.addEventListener(`error`,i,{once:!0})}else{let e=Jc(s)?s.href.baseVal:s.currentSrc||s.src;if(!e)return u();let t=async()=>{if($c(s)&&`decode`in s)try{await s.decode()}catch(t){o?.(`Failed to decode image, trying to render anyway`,s.dataset.originalSrc||e,t)}u()},n=t=>{o?.(`Failed image load`,s.dataset.originalSrc||e,t),u()};if($c(s)&&s.complete)return t();l=()=>{s.removeEventListener(`load`,t),s.removeEventListener(`error`,n)},s.addEventListener(`load`,t,{once:!0}),s.addEventListener(`error`,n,{once:!0})}})}async function xl(e,t){Xc(e)&&($c(e)||el(e)?await bl(e,t):await Promise.all([`img`,`video`].flatMap(n=>Array.from(e.querySelectorAll(n)).map(e=>bl(e,t)))))}let Sl=/* @__PURE__ */ function(){let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)}();function Cl(e){return e?.split(`,`).map(e=>e.trim().replace(/"|'/g,``).toLowerCase()).filter(Boolean)}let wl=0;function Tl(e){let t=`${Pc}[#${wl}]`;return wl++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...t)=>e&&ll(...t)}}function El(e){return{cache:e?`no-cache`:`force-cache`}}async function Dl(e,t){return Uc(e)?e:Ol(e,{...t,autoDestruct:!0})}async function Ol(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},a=!!t?.debug,o=t?.features??!0,s=e.ownerDocument??(Fc?window.document:void 0),c=e.ownerDocument?.defaultView??(Fc?window:void 0),l=/* @__PURE__ */ new Map,u={width:0,height:0,quality:1,type:`image/png`,scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:a,fetch:{requestInit:El(t?.fetch?.bypassingCache),placeholderImage:`data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,bypassingCache:!1,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...t,__CONTEXT__:!0,log:Tl(a),node:e,ownerDocument:s,ownerWindow:c,dpi:n===1?null:96*n,svgStyleElement:kl(s),svgDefsElement:s?.createElementNS(ml,`defs`),svgStyles:/* @__PURE__ */ new Map,defaultComputedStyles:/* @__PURE__ */ new Map,workers:[...Array.from({length:Ic&&r&&i?i:0})].map(()=>{try{let e=new Worker(r);return e.onmessage=async e=>{let{url:t,result:n}=e.data;n?l.get(t)?.resolve?.(n):l.get(t)?.reject?.(/* @__PURE__ */ Error(`Error receiving message from worker: ${t}`))},e.onmessageerror=e=>{let{url:t}=e.data;l.get(t)?.reject?.(/* @__PURE__ */ Error(`Error receiving message from worker: ${t}`))},e}catch(e){return u.log.warn(`Failed to new Worker`,e),null}}).filter(Boolean),fontFamilies:/* @__PURE__ */ new Map,fontCssTexts:/* @__PURE__ */ new Map,acceptOfImage:`${[ul(s)&&`image/webp`,`image/svg+xml`,`image/*`,`*/*`].filter(Boolean).join(`,`)};q=0.8`,requests:l,drawImageCount:0,tasks:[],features:o,isEnable:e=>e===`restoreScrollPosition`?typeof o==`boolean`?!1:o[e]??!1:typeof o==`boolean`?o:o[e]??!0,shadowRoots:[]};u.log.time(`wait until load`),await xl(e,{timeout:u.timeout,onWarn:u.log.warn}),u.log.timeEnd(`wait until load`);let{width:d,height:f}=Al(e,u);return u.width=d,u.height=f,u}function kl(e){if(!e)return;let t=e.createElement(`style`),n=t.ownerDocument.createTextNode(`
57
57
  .______background-clip--text {
58
58
  background-clip: text;
59
59
  -webkit-background-clip: text;
60
60
  }
61
- `);return t.appendChild(n),t}function Kc(e,t){let{width:n,height:r}=t;if(Z(e)&&(!n||!r)){let t=e.getBoundingClientRect();n=n||t.width||Number(e.getAttribute(`width`))||0,r=r||t.height||Number(e.getAttribute(`height`))||0}return{width:n,height:r}}async function qc(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:a}=t;n.time(`image to canvas`);let o=await Ic(e,{timeout:r,onWarn:t.log.warn}),{canvas:s,context2d:c}=Jc(e.ownerDocument,t),l=()=>{try{c?.drawImage(o,0,0,s.width,s.height)}catch(e){t.log.warn(`Failed to drawImage`,e)}};if(l(),t.isEnable(`fixSvgXmlDecode`))for(let e=0;e<i;e++)await new Promise(t=>{setTimeout(()=>{c?.clearRect(0,0,s.width,s.height),l(),t()},e+a)});return t.drawImageCount=0,n.timeEnd(`image to canvas`),s}function Jc(e,t){let{width:n,height:r,scale:i,backgroundColor:a,maximumCanvasSize:o}=t,s=e.createElement(`canvas`);s.width=Math.floor(n*i),s.height=Math.floor(r*i),s.style.width=`${n}px`,s.style.height=`${r}px`,o&&(s.width>o||s.height>o)&&(s.width>o&&s.height>o?s.width>s.height?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o):s.width>o?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o));let c=s.getContext(`2d`);return c&&a&&(c.fillStyle=a,c.fillRect(0,0,s.width,s.height)),{canvas:s,context2d:c}}function Yc(e,t){if(e.ownerDocument)try{let t=e.toDataURL();if(t!==`data:,`)return Fc(t,e.ownerDocument)}catch(e){t.log.warn(`Failed to clone canvas`,e)}let n=e.cloneNode(!1),r=e.getContext(`2d`),i=n.getContext(`2d`);try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(e){t.log.warn(`Failed to clone canvas`,e)}return n}function Xc(e,t){try{if(e?.contentDocument?.documentElement)return gl(e.contentDocument.documentElement,t)}catch(e){t.log.warn(`Failed to clone iframe`,e)}return e.cloneNode(!1)}function Zc(e){let t=e.cloneNode(!1);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`),t}async function Qc(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return Fc(e.poster,e.ownerDocument);let n=e.cloneNode(!1);n.crossOrigin=`anonymous`,e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=!0;if(await Ic(n,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return e.poster?Fc(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(e=>{n.addEventListener(`seeked`,e,{once:!0})});let a=r.createElement(`canvas`);a.width=e.offsetWidth,a.height=e.offsetHeight;try{let e=a.getContext(`2d`);e&&e.drawImage(n,0,0,a.width,a.height)}catch(r){return t.log.warn(`Failed to clone video`,r),e.poster?Fc(e.poster,e.ownerDocument):n}return Yc(a,t)}return n}function $c(e,t){return _c(e)?Yc(e,t):wc(e)?Xc(e,t):hc(e)?Zc(e):gc(e)?Qc(e,t):e.cloneNode(!1)}function el(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement(`iframe`),t.id=`__SANDBOX__${Rc()}`,t.width=`0`,t.height=`0`,t.style.visibility=`hidden`,t.style.position=`fixed`,n.body.appendChild(t),t.srcdoc=`<!DOCTYPE html><meta charset="UTF-8"><title></title><body>`,e.sandbox=t)}catch(t){e.log.warn(`Failed to getSandBox`,t)}}return t}let tl=[`width`,`height`,`-webkit-text-fill-color`],nl=[`stroke`,`fill`];function rl(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),a=lc(e)&&i!==`svg`,o=a?nl.map(t=>[t,e.getAttribute(t)]).filter(([,e])=>e!==null):[],s=[a&&`svg`,i,o.map((e,t)=>`${e}=${t}`).join(`,`),t].filter(Boolean).join(`:`);if(r.has(s))return r.get(s);let c=el(n)?.contentWindow;if(!c)return/* @__PURE__ */ new Map;let l=c?.document,u,d;a?(u=l.createElementNS(Ac,`svg`),d=u.ownerDocument.createElementNS(u.namespaceURI,i),o.forEach(([e,t])=>{d.setAttributeNS(null,e,t)}),u.appendChild(d)):u=d=l.createElement(i),d.textContent=` `,l.body.appendChild(u);let f=c.getComputedStyle(d,t),p=/* @__PURE__ */ new Map;for(let e=f.length,t=0;t<e;t++){let e=f.item(t);tl.includes(e)||p.set(e,f.getPropertyValue(e))}return l.body.removeChild(u),r.set(s,p),p}function il(e,t,n){let r=/* @__PURE__ */ new Map,i=[],a=/* @__PURE__ */ new Map;if(n)for(let e of n)o(e);else for(let t=e.length,n=0;n<t;n++)o(e.item(n));for(let e=i.length,t=0;t<e;t++)a.get(i[t])?.forEach((e,t)=>r.set(t,e));function o(n){let o=e.getPropertyValue(n),s=e.getPropertyPriority(n),c=n.lastIndexOf(`-`),l=c>-1?n.substring(0,c):void 0;if(l){let e=a.get(l);e||(e=/* @__PURE__ */ new Map,a.set(l,e)),e.set(n,[o,s])}(t.get(n)!==o||s)&&(l?i.push(l):r.set(n,[o,s]))}return r}function al(e,t,n,r){let{ownerWindow:i,includeStyleProperties:a,currentParentNodeStyle:o}=r,s=t.style,c=i.getComputedStyle(e),l=rl(e,null,r);o?.forEach((e,t)=>{l.delete(t)});let u=il(c,l,a);u.delete(`transition-property`),u.delete(`all`),u.delete(`d`),u.delete(`content`),n&&(u.delete(`position`),u.delete(`margin-top`),u.delete(`margin-right`),u.delete(`margin-bottom`),u.delete(`margin-left`),u.delete(`margin-block-start`),u.delete(`margin-block-end`),u.delete(`margin-inline-start`),u.delete(`margin-inline-end`),u.set(`box-sizing`,[`border-box`,``])),u.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`),nc&&(u.has(`font-kerning`)||u.set(`font-kerning`,[`normal`,``]),(u.get(`overflow-x`)?.[0]===`hidden`||u.get(`overflow-y`)?.[0]===`hidden`)&&u.get(`text-overflow`)?.[0]===`ellipsis`&&e.scrollWidth===e.clientWidth&&u.set(`text-overflow`,[`clip`,``]));for(let e=s.length,t=0;t<e;t++)s.removeProperty(s.item(t));return u.forEach(([e,t],n)=>{s.setProperty(n,e,t)}),u}function ol(e,t){(vc(e)||yc(e)||Sc(e))&&t.setAttribute(`value`,e.value)}let sl=[`::before`,`::after`],cl=[`::-webkit-scrollbar`,`::-webkit-scrollbar-button`,`::-webkit-scrollbar-thumb`,`::-webkit-scrollbar-track`,`::-webkit-scrollbar-track-piece`,`::-webkit-scrollbar-corner`,`::-webkit-resizer`];function ll(e,t,n,r,i){let{ownerWindow:a,svgStyleElement:o,svgStyles:s,currentNodeStyle:c}=r;if(!o||!a)return;function l(n){let o=a.getComputedStyle(e,n),l=o.getPropertyValue(`content`);if(!l||l===`none`)return;i?.(l),l=l.replace(/(')|(")|(counter\(.+\))/g,``);let u=[Rc()],d=rl(e,n,r);c?.forEach((e,t)=>{d.delete(t)});let f=il(o,d,r.includeStyleProperties);f.delete(`content`),f.delete(`-webkit-locale`),f.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`);let p=[`content: '${l}';`];if(f.forEach(([e,t],n)=>{p.push(`${n}: ${e}${t?` !important`:``};`)}),p.length===1)return;try{t.className=[t.className,...u].join(` `)}catch(e){r.log.warn(`Failed to copyPseudoClass`,e);return}let m=p.join(`
62
- `),h=s.get(m);h||(h=[],s.set(m,h)),h.push(`.${u[0]}${n}`)}sl.forEach(l),n&&cl.forEach(l)}let ul=/* @__PURE__ */ new Set([`symbol`]);async function dl(e,t,n,r,i){if(Z(n)&&(bc(n)||xc(n))||r.filter&&!r.filter(n))return;r.currentParentNodeStyle=ul.has(t.nodeName)||ul.has(n.nodeName)?void 0:r.currentNodeStyle;let a=await gl(n,r,!1,i);r.isEnable(`restoreScrollPosition`)&&pl(e,a),t.appendChild(a)}async function fl(e,t,n,r){let i=e.firstChild;Z(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let a=i;a;a=a.nextSibling)if(!pc(a)){if(Z(a)&&Cc(a)&&typeof a.assignedNodes==`function`){let i=a.assignedNodes();for(let a=0;a<i.length;a++)await dl(e,t,i[a],n,r)}else await dl(e,t,a,n,r)}}function pl(e,t){if(!fc(e)||!fc(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,a=new DOMMatrix(i),{a:o,b:s,c,d:l}=a;a.a=1,a.b=0,a.c=0,a.d=1,a.translateSelf(-r,-n),a.a=o,a.b=s,a.c=c,a.d=l,t.style.transform=a.toString()}function ml(e,t){let{backgroundColor:n,width:r,height:i,style:a}=t,o=e.style;if(n&&o.setProperty(`background-color`,n,`important`),r&&o.setProperty(`width`,`${r}px`,`important`),i&&o.setProperty(`height`,`${i}px`,`important`),a)for(let e in a)o[e]=a[e]}let hl=/^[\w-:]+$/;async function gl(e,t,n=!1,r){let{ownerDocument:i,ownerWindow:a,fontFamilies:o,onCloneEachNode:s}=t;if(i&&mc(e))return r&&/\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&a&&Z(e)&&(fc(e)||lc(e))){let r=await $c(e,t);if(t.isEnable(`removeAbnormalAttributes`)){let e=r.getAttributeNames();for(let t=e.length,n=0;n<t;n++){let t=e[n];hl.test(t)||r.removeAttribute(t)}}let i=t.currentNodeStyle=al(e,r,n,t);n&&ml(r,t);let a=!1;if(t.isEnable(`copyScrollbar`)){let t=[i.get(`overflow-x`)?.[0],i.get(`overflow-y`)?.[0]];a=t.includes(`scroll`)||(t.includes(`auto`)||t.includes(`overlay`))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)}let c=i.get(`text-transform`)?.[0],l=zc(i.get(`font-family`)?.[0]),u=l?e=>{c===`uppercase`?e=e.toUpperCase():c===`lowercase`?e=e.toLowerCase():c===`capitalize`&&(e=e[0].toUpperCase()+e.substring(1)),l.forEach(t=>{let n=o.get(t);n||o.set(t,n=/* @__PURE__ */ new Set),e.split(``).forEach(e=>n.add(e))})}:void 0;return ll(e,r,a,t,u),ol(e,r),gc(e)||await fl(e,r,t,u),await s?.(r),r}let c=e.cloneNode(!1);return await fl(e,c,t),await s?.(c),c}function _l(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove()}catch(t){e.log.warn(`Failed to destroyContext`,t)}e.sandbox=void 0}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[]}function vl(e){let{url:t,timeout:n,responseType:r,...i}=e,a=new AbortController,o=n?setTimeout(()=>a.abort(),n):void 0;return fetch(t,{signal:a.signal,...i}).then(e=>{if(!e.ok)throw Error(`Failed fetch, not 2xx response`,{cause:e});switch(r){case`arrayBuffer`:return e.arrayBuffer();case`dataUrl`:return e.blob().then(Pc);default:return e.text()}}).finally(()=>clearTimeout(o))}function yl(e,t){let{url:n,requestType:r=`text`,responseType:i=`text`,imageDom:a}=t,o=n,{timeout:s,acceptOfImage:c,requests:l,fetchFn:u,fetch:{requestInit:d,bypassingCache:f,placeholderImage:p},font:m,workers:h,fontFamilies:g}=e;r===`image`&&(rc||ic)&&e.drawImageCount++;let _=l.get(n);if(!_){f&&f instanceof RegExp&&f.test(o)&&(o+=(/\?/.test(o)?`&`:`?`)+(/* @__PURE__ */ new Date()).getTime());let t=r.startsWith(`font`)&&m&&m.minify,v=/* @__PURE__ */ new Set;t&&r.split(`;`)[1].split(`,`).forEach(e=>{g.has(e)&&g.get(e).forEach(e=>v.add(e))});let y=t&&v.size,b={url:o,timeout:s,responseType:y?`arrayBuffer`:i,headers:r===`image`?{accept:c}:void 0,...d};_={type:r,resolve:void 0,reject:void 0,response:null},_.response=(async()=>{if(u&&r===`image`){let e=await u(n);if(e)return e}return!rc&&n.startsWith(`http`)&&h.length?new Promise((e,t)=>{h[l.size&h.length-1].postMessage({rawUrl:n,...b}),_.resolve=e,_.reject=t}):vl(b)})().catch(t=>{if(l.delete(n),r===`image`&&p)return e.log.warn(`Failed to fetch image base64, trying to use placeholder image`,o),typeof p==`string`?p:p(a);throw t}),l.set(n,_)}return _.response}async function bl(e,t,n,r){if(!xl(e))return e;for(let[i,a]of Cl(e,t))try{let t=await yl(n,{url:a,requestType:r?`image`:`text`,responseType:`dataUrl`});e=e.replace(wl(i),`$1${t}$3`)}catch(e){n.log.warn(`Failed to fetch css data url`,i,e)}return e}function xl(e){return/url\((['"]?)([^'"]+?)\1\)/.test(e)}let Sl=/url\((['"]?)([^'"]+?)\1\)/g;function Cl(e,t){let n=[];return e.replace(Sl,(e,r,i)=>(n.push([i,Oc(i,t)]),e)),n.filter(([e])=>!Dc(e))}function wl(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}let Tl=[`background-image`,`border-image-source`,`-webkit-border-image`,`-webkit-mask-image`,`list-style-image`];function El(e,t){return Tl.map(n=>{let r=e.getPropertyValue(n);return!r||r===`none`?null:((rc||ic)&&t.drawImageCount++,bl(r,null,t,!0).then(t=>{t&&r!==t&&e.setProperty(n,t,e.getPropertyPriority(n))}))}).filter(Boolean)}function Dl(e,t){if(hc(e)){let n=e.currentSrc||e.src;if(!Dc(n))return[yl(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.srcset=``,e.dataset.originalSrc=n,e.src=t||``)})];(rc||ic)&&t.drawImageCount++}else if(lc(e)&&!Dc(e.href.baseVal)){let n=e.href.baseVal;return[yl(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.dataset.originalSrc=n,e.href.baseVal=t||``)})]}return[]}function Ol(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute(`href`)??e.getAttribute(`xlink:href`);if(!i)return[];let[a,o]=i.split(`#`);if(o){let i=`#${o}`,s=t.shadowRoots.reduce((e,t)=>e??t.querySelector(`svg ${i}`),n?.querySelector(`svg ${i}`));if(a&&e.setAttribute(`href`,i),r?.querySelector(i))return[];if(s)return r?.appendChild(s.cloneNode(!0)),[];if(a)return[yl(t,{url:a,responseType:`text`}).then(e=>{r?.insertAdjacentHTML(`beforeend`,e)})]}return[]}function kl(e,t){let{tasks:n}=t;Z(e)&&((hc(e)||uc(e))&&n.push(...Dl(e,t)),dc(e)&&n.push(...Ol(e,t))),fc(e)&&n.push(...El(e.style,t)),e.childNodes.forEach(e=>{kl(e,t)})}async function Al(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:a,tasks:o,font:s}=t;if(n&&r&&i.size){if(s&&s.cssText){let e=Il(s.cssText,t);r.appendChild(n.createTextNode(`${e}
63
- `))}else{let e=Array.from(n.styleSheets).filter(e=>{try{return`cssRules`in e&&!!e.cssRules.length}catch(n){return t.log.warn(`Error while reading CSS rules from ${e.href}`,n),!1}}),s=n.implementation.createHTMLDocument(``),c=s.createElement(`style`);s.head.appendChild(c);let l=c.sheet;await Promise.all(e.flatMap(e=>Array.from(e.cssRules).map(async e=>{if(sc(e)){let n=e.href,r=``;try{r=await yl(t,{url:n,requestType:`text`,responseType:`text`})}catch(e){t.log.warn(`Error fetch remote css import from ${n}`,e)}let i=r.replace(Sl,(e,t,r)=>e.replace(r,Oc(r,n)));for(let e of Nl(i))try{l.insertRule(e,l.cssRules.length)}catch(n){t.log.warn(`Error inserting rule from remote css import`,{rule:e,error:n})}}}))),l.cssRules.length&&e.push(l);let u=[];e.forEach(e=>{Ll(e.cssRules,u)}),u.filter(e=>oc(e)&&xl(e.style.getPropertyValue(`src`))&&zc(e.style.getPropertyValue(`font-family`))?.some(e=>i.has(e))).forEach(e=>{let i=e,s=a.get(i.cssText);s?r.appendChild(n.createTextNode(`${s}
64
- `)):o.push(bl(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,t).then(e=>{e=Il(e,t),a.set(i.cssText,e),r.appendChild(n.createTextNode(`${e}
65
- `))}))})}}}let jl=/(\/\*[\s\S]*?\*\/)/g,Ml=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function Nl(e){if(e==null)return[];let t=[],n=e.replace(jl,``);for(;;){let e=Ml.exec(n);if(!e)break;t.push(e[0])}n=n.replace(Ml,``);let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=/* @__PURE__ */ RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=r.exec(n);if(e)i.lastIndex=r.lastIndex;else if(e=i.exec(n),e)r.lastIndex=i.lastIndex;else break;t.push(e[0])}return t}let Pl=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Fl=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Il(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(Fl,e=>{for(;;){let[t,,n]=Pl.exec(e)||[];if(!n)return``;if(n===r)return`src: ${t};`}}):e}function Ll(e,t=[]){for(let n of Array.from(e))cc(n)?t.push(...Ll(n.cssRules)):`cssRules`in n?Ll(n.cssRules,t):t.push(n);return t}let Rl=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function zl(e){return Rl.test(e.innerHTML)}async function Bl(e,t){let n=await Uc(e,t);if(Z(n.node)&&lc(n.node)&&!zl(n.node))return n.node;let{ownerDocument:r,log:i,tasks:a,svgStyleElement:o,svgDefsElement:s,svgStyles:c,font:l,progress:u,autoDestruct:d,onCloneNode:f,onEmbedNode:p,onCreateForeignObjectSvg:m}=n;i.time(`clone node`);let h=await gl(n.node,n,!0);if(o&&r){let e=``;c.forEach((t,n)=>{e+=`${t.join(`,
61
+ `);return t.appendChild(n),t}function Al(e,t){let{width:n,height:r}=t;if(Z(e)&&(!n||!r)){let t=e.getBoundingClientRect();n=n||t.width||Number(e.getAttribute(`width`))||0,r=r||t.height||Number(e.getAttribute(`height`))||0}return{width:n,height:r}}async function jl(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:a}=t;n.time(`image to canvas`);let o=await bl(e,{timeout:r,onWarn:t.log.warn}),{canvas:s,context2d:c}=Ml(e.ownerDocument,t),l=()=>{try{c?.drawImage(o,0,0,s.width,s.height)}catch(e){t.log.warn(`Failed to drawImage`,e)}};if(l(),t.isEnable(`fixSvgXmlDecode`))for(let e=0;e<i;e++)await new Promise(t=>{setTimeout(()=>{c?.clearRect(0,0,s.width,s.height),l(),t()},e+a)});return t.drawImageCount=0,n.timeEnd(`image to canvas`),s}function Ml(e,t){let{width:n,height:r,scale:i,backgroundColor:a,maximumCanvasSize:o}=t,s=e.createElement(`canvas`);s.width=Math.floor(n*i),s.height=Math.floor(r*i),s.style.width=`${n}px`,s.style.height=`${r}px`,o&&(s.width>o||s.height>o)&&(s.width>o&&s.height>o?s.width>s.height?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o):s.width>o?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o));let c=s.getContext(`2d`);return c&&a&&(c.fillStyle=a,c.fillRect(0,0,s.width,s.height)),{canvas:s,context2d:c}}function Nl(e,t){if(e.ownerDocument)try{let t=e.toDataURL();if(t!==`data:,`)return yl(t,e.ownerDocument)}catch(e){t.log.warn(`Failed to clone canvas`,e)}let n=e.cloneNode(!1),r=e.getContext(`2d`),i=n.getContext(`2d`);try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(e){t.log.warn(`Failed to clone canvas`,e)}return n}function Pl(e,t){try{if(e?.contentDocument?.documentElement)return eu(e.contentDocument.documentElement,t)}catch(e){t.log.warn(`Failed to clone iframe`,e)}return e.cloneNode(!1)}function Fl(e){let t=e.cloneNode(!1);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`),t}async function Il(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return yl(e.poster,e.ownerDocument);let n=e.cloneNode(!1);n.crossOrigin=`anonymous`,e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=!0;if(await bl(n,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return e.poster?yl(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(e=>{n.addEventListener(`seeked`,e,{once:!0})});let a=r.createElement(`canvas`);a.width=e.offsetWidth,a.height=e.offsetHeight;try{let e=a.getContext(`2d`);e&&e.drawImage(n,0,0,a.width,a.height)}catch(r){return t.log.warn(`Failed to clone video`,r),e.poster?yl(e.poster,e.ownerDocument):n}return Nl(a,t)}return n}function Ll(e,t){return tl(e)?Nl(e,t):cl(e)?Pl(e,t):$c(e)?Fl(e):el(e)?Il(e,t):e.cloneNode(!1)}function Rl(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement(`iframe`),t.id=`__SANDBOX__${Sl()}`,t.width=`0`,t.height=`0`,t.style.visibility=`hidden`,t.style.position=`fixed`,n.body.appendChild(t),t.srcdoc=`<!DOCTYPE html><meta charset="UTF-8"><title></title><body>`,e.sandbox=t)}catch(t){e.log.warn(`Failed to getSandBox`,t)}}return t}let zl=[`width`,`height`,`-webkit-text-fill-color`],Bl=[`stroke`,`fill`];function Vl(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),a=qc(e)&&i!==`svg`,o=a?Bl.map(t=>[t,e.getAttribute(t)]).filter(([,e])=>e!==null):[],s=[a&&`svg`,i,o.map((e,t)=>`${e}=${t}`).join(`,`),t].filter(Boolean).join(`:`);if(r.has(s))return r.get(s);let c=Rl(n)?.contentWindow;if(!c)return/* @__PURE__ */ new Map;let l=c?.document,u,d;a?(u=l.createElementNS(ml,`svg`),d=u.ownerDocument.createElementNS(u.namespaceURI,i),o.forEach(([e,t])=>{d.setAttributeNS(null,e,t)}),u.appendChild(d)):u=d=l.createElement(i),d.textContent=` `,l.body.appendChild(u);let f=c.getComputedStyle(d,t),p=/* @__PURE__ */ new Map;for(let e=f.length,t=0;t<e;t++){let e=f.item(t);zl.includes(e)||p.set(e,f.getPropertyValue(e))}return l.body.removeChild(u),r.set(s,p),p}function Hl(e,t,n){let r=/* @__PURE__ */ new Map,i=[],a=/* @__PURE__ */ new Map;if(n)for(let e of n)o(e);else for(let t=e.length,n=0;n<t;n++)o(e.item(n));for(let e=i.length,t=0;t<e;t++)a.get(i[t])?.forEach((e,t)=>r.set(t,e));function o(n){let o=e.getPropertyValue(n),s=e.getPropertyPriority(n),c=n.lastIndexOf(`-`),l=c>-1?n.substring(0,c):void 0;if(l){let e=a.get(l);e||(e=/* @__PURE__ */ new Map,a.set(l,e)),e.set(n,[o,s])}(t.get(n)!==o||s)&&(l?i.push(l):r.set(n,[o,s]))}return r}function Ul(e,t,n,r){let{ownerWindow:i,includeStyleProperties:a,currentParentNodeStyle:o}=r,s=t.style,c=i.getComputedStyle(e),l=Vl(e,null,r);o?.forEach((e,t)=>{l.delete(t)});let u=Hl(c,l,a);u.delete(`transition-property`),u.delete(`all`),u.delete(`d`),u.delete(`content`),n&&(u.delete(`position`),u.delete(`margin-top`),u.delete(`margin-right`),u.delete(`margin-bottom`),u.delete(`margin-left`),u.delete(`margin-block-start`),u.delete(`margin-block-end`),u.delete(`margin-inline-start`),u.delete(`margin-inline-end`),u.set(`box-sizing`,[`border-box`,``])),u.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`),Bc&&(u.has(`font-kerning`)||u.set(`font-kerning`,[`normal`,``]),(u.get(`overflow-x`)?.[0]===`hidden`||u.get(`overflow-y`)?.[0]===`hidden`)&&u.get(`text-overflow`)?.[0]===`ellipsis`&&e.scrollWidth===e.clientWidth&&u.set(`text-overflow`,[`clip`,``]));for(let e=s.length,t=0;t<e;t++)s.removeProperty(s.item(t));return u.forEach(([e,t],n)=>{s.setProperty(n,e,t)}),u}function Wl(e,t){(nl(e)||rl(e)||ol(e))&&t.setAttribute(`value`,e.value)}let Gl=[`::before`,`::after`],Kl=[`::-webkit-scrollbar`,`::-webkit-scrollbar-button`,`::-webkit-scrollbar-thumb`,`::-webkit-scrollbar-track`,`::-webkit-scrollbar-track-piece`,`::-webkit-scrollbar-corner`,`::-webkit-resizer`];function ql(e,t,n,r,i){let{ownerWindow:a,svgStyleElement:o,svgStyles:s,currentNodeStyle:c}=r;if(!o||!a)return;function l(n){let o=a.getComputedStyle(e,n),l=o.getPropertyValue(`content`);if(!l||l===`none`)return;i?.(l),l=l.replace(/(')|(")|(counter\(.+\))/g,``);let u=[Sl()],d=Vl(e,n,r);c?.forEach((e,t)=>{d.delete(t)});let f=Hl(o,d,r.includeStyleProperties);f.delete(`content`),f.delete(`-webkit-locale`),f.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`);let p=[`content: '${l}';`];if(f.forEach(([e,t],n)=>{p.push(`${n}: ${e}${t?` !important`:``};`)}),p.length===1)return;try{t.className=[t.className,...u].join(` `)}catch(e){r.log.warn(`Failed to copyPseudoClass`,e);return}let m=p.join(`
62
+ `),h=s.get(m);h||(h=[],s.set(m,h)),h.push(`.${u[0]}${n}`)}Gl.forEach(l),n&&Kl.forEach(l)}let Jl=/* @__PURE__ */ new Set([`symbol`]);async function Yl(e,t,n,r,i){if(Z(n)&&(il(n)||al(n))||r.filter&&!r.filter(n))return;r.currentParentNodeStyle=Jl.has(t.nodeName)||Jl.has(n.nodeName)?void 0:r.currentNodeStyle;let a=await eu(n,r,!1,i);r.isEnable(`restoreScrollPosition`)&&Zl(e,a),t.appendChild(a)}async function Xl(e,t,n,r){let i=e.firstChild;Z(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let a=i;a;a=a.nextSibling)if(!Zc(a)){if(Z(a)&&sl(a)&&typeof a.assignedNodes==`function`){let i=a.assignedNodes();for(let a=0;a<i.length;a++)await Yl(e,t,i[a],n,r)}else await Yl(e,t,a,n,r)}}function Zl(e,t){if(!Xc(e)||!Xc(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,a=new DOMMatrix(i),{a:o,b:s,c,d:l}=a;a.a=1,a.b=0,a.c=0,a.d=1,a.translateSelf(-r,-n),a.a=o,a.b=s,a.c=c,a.d=l,t.style.transform=a.toString()}function Ql(e,t){let{backgroundColor:n,width:r,height:i,style:a}=t,o=e.style;if(n&&o.setProperty(`background-color`,n,`important`),r&&o.setProperty(`width`,`${r}px`,`important`),i&&o.setProperty(`height`,`${i}px`,`important`),a)for(let e in a)o[e]=a[e]}let $l=/^[\w-:]+$/;async function eu(e,t,n=!1,r){let{ownerDocument:i,ownerWindow:a,fontFamilies:o,onCloneEachNode:s}=t;if(i&&Qc(e))return r&&/\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&a&&Z(e)&&(Xc(e)||qc(e))){let r=await Ll(e,t);if(t.isEnable(`removeAbnormalAttributes`)){let e=r.getAttributeNames();for(let t=e.length,n=0;n<t;n++){let t=e[n];$l.test(t)||r.removeAttribute(t)}}let i=t.currentNodeStyle=Ul(e,r,n,t);n&&Ql(r,t);let a=!1;if(t.isEnable(`copyScrollbar`)){let t=[i.get(`overflow-x`)?.[0],i.get(`overflow-y`)?.[0]];a=t.includes(`scroll`)||(t.includes(`auto`)||t.includes(`overlay`))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)}let c=i.get(`text-transform`)?.[0],l=Cl(i.get(`font-family`)?.[0]),u=l?e=>{c===`uppercase`?e=e.toUpperCase():c===`lowercase`?e=e.toLowerCase():c===`capitalize`&&(e=e[0].toUpperCase()+e.substring(1)),l.forEach(t=>{let n=o.get(t);n||o.set(t,n=/* @__PURE__ */ new Set),e.split(``).forEach(e=>n.add(e))})}:void 0;return ql(e,r,a,t,u),Wl(e,r),el(e)||await Xl(e,r,t,u),await s?.(r),r}let c=e.cloneNode(!1);return await Xl(e,c,t),await s?.(c),c}function tu(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove()}catch(t){e.log.warn(`Failed to destroyContext`,t)}e.sandbox=void 0}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[]}function nu(e){let{url:t,timeout:n,responseType:r,...i}=e,a=new AbortController,o=n?setTimeout(()=>a.abort(),n):void 0;return fetch(t,{signal:a.signal,...i}).then(e=>{if(!e.ok)throw Error(`Failed fetch, not 2xx response`,{cause:e});switch(r){case`arrayBuffer`:return e.arrayBuffer();case`dataUrl`:return e.blob().then(vl);default:return e.text()}}).finally(()=>clearTimeout(o))}function ru(e,t){let{url:n,requestType:r=`text`,responseType:i=`text`,imageDom:a}=t,o=n,{timeout:s,acceptOfImage:c,requests:l,fetchFn:u,fetch:{requestInit:d,bypassingCache:f,placeholderImage:p},font:m,workers:h,fontFamilies:g}=e;r===`image`&&(Vc||Hc)&&e.drawImageCount++;let _=l.get(n);if(!_){f&&f instanceof RegExp&&f.test(o)&&(o+=(/\?/.test(o)?`&`:`?`)+(/* @__PURE__ */ new Date()).getTime());let t=r.startsWith(`font`)&&m&&m.minify,v=/* @__PURE__ */ new Set;t&&r.split(`;`)[1].split(`,`).forEach(e=>{g.has(e)&&g.get(e).forEach(e=>v.add(e))});let y=t&&v.size,b={url:o,timeout:s,responseType:y?`arrayBuffer`:i,headers:r===`image`?{accept:c}:void 0,...d};_={type:r,resolve:void 0,reject:void 0,response:null},_.response=(async()=>{if(u&&r===`image`){let e=await u(n);if(e)return e}return!Vc&&n.startsWith(`http`)&&h.length?new Promise((e,t)=>{h[l.size&h.length-1].postMessage({rawUrl:n,...b}),_.resolve=e,_.reject=t}):nu(b)})().catch(t=>{if(l.delete(n),r===`image`&&p)return e.log.warn(`Failed to fetch image base64, trying to use placeholder image`,o),typeof p==`string`?p:p(a);throw t}),l.set(n,_)}return _.response}async function iu(e,t,n,r){if(!au(e))return e;for(let[i,a]of su(e,t))try{let t=await ru(n,{url:a,requestType:r?`image`:`text`,responseType:`dataUrl`});e=e.replace(cu(i),`$1${t}$3`)}catch(e){n.log.warn(`Failed to fetch css data url`,i,e)}return e}function au(e){return/url\((['"]?)([^'"]+?)\1\)/.test(e)}let ou=/url\((['"]?)([^'"]+?)\1\)/g;function su(e,t){let n=[];return e.replace(ou,(e,r,i)=>(n.push([i,fl(i,t)]),e)),n.filter(([e])=>!dl(e))}function cu(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}let lu=[`background-image`,`border-image-source`,`-webkit-border-image`,`-webkit-mask-image`,`list-style-image`];function uu(e,t){return lu.map(n=>{let r=e.getPropertyValue(n);return!r||r===`none`?null:((Vc||Hc)&&t.drawImageCount++,iu(r,null,t,!0).then(t=>{t&&r!==t&&e.setProperty(n,t,e.getPropertyPriority(n))}))}).filter(Boolean)}function du(e,t){if($c(e)){let n=e.currentSrc||e.src;if(!dl(n))return[ru(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.srcset=``,e.dataset.originalSrc=n,e.src=t||``)})];(Vc||Hc)&&t.drawImageCount++}else if(qc(e)&&!dl(e.href.baseVal)){let n=e.href.baseVal;return[ru(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.dataset.originalSrc=n,e.href.baseVal=t||``)})]}return[]}function fu(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute(`href`)??e.getAttribute(`xlink:href`);if(!i)return[];let[a,o]=i.split(`#`);if(o){let i=`#${o}`,s=t.shadowRoots.reduce((e,t)=>e??t.querySelector(`svg ${i}`),n?.querySelector(`svg ${i}`));if(a&&e.setAttribute(`href`,i),r?.querySelector(i))return[];if(s)return r?.appendChild(s.cloneNode(!0)),[];if(a)return[ru(t,{url:a,responseType:`text`}).then(e=>{r?.insertAdjacentHTML(`beforeend`,e)})]}return[]}function pu(e,t){let{tasks:n}=t;Z(e)&&(($c(e)||Jc(e))&&n.push(...du(e,t)),Yc(e)&&n.push(...fu(e,t))),Xc(e)&&n.push(...uu(e.style,t)),e.childNodes.forEach(e=>{pu(e,t)})}async function mu(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:a,tasks:o,font:s}=t;if(n&&r&&i.size){if(s&&s.cssText){let e=bu(s.cssText,t);r.appendChild(n.createTextNode(`${e}
63
+ `))}else{let e=Array.from(n.styleSheets).filter(e=>{try{return`cssRules`in e&&!!e.cssRules.length}catch(n){return t.log.warn(`Error while reading CSS rules from ${e.href}`,n),!1}}),s=n.implementation.createHTMLDocument(``),c=s.createElement(`style`);s.head.appendChild(c);let l=c.sheet;await Promise.all(e.flatMap(e=>Array.from(e.cssRules).map(async e=>{if(Gc(e)){let n=e.href,r=``;try{r=await ru(t,{url:n,requestType:`text`,responseType:`text`})}catch(e){t.log.warn(`Error fetch remote css import from ${n}`,e)}let i=r.replace(ou,(e,t,r)=>e.replace(r,fl(r,n)));for(let e of _u(i))try{l.insertRule(e,l.cssRules.length)}catch(n){t.log.warn(`Error inserting rule from remote css import`,{rule:e,error:n})}}}))),l.cssRules.length&&e.push(l);let u=[];e.forEach(e=>{xu(e.cssRules,u)}),u.filter(e=>Wc(e)&&au(e.style.getPropertyValue(`src`))&&Cl(e.style.getPropertyValue(`font-family`))?.some(e=>i.has(e))).forEach(e=>{let i=e,s=a.get(i.cssText);s?r.appendChild(n.createTextNode(`${s}
64
+ `)):o.push(iu(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,t).then(e=>{e=bu(e,t),a.set(i.cssText,e),r.appendChild(n.createTextNode(`${e}
65
+ `))}))})}}}let hu=/(\/\*[\s\S]*?\*\/)/g,gu=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function _u(e){if(e==null)return[];let t=[],n=e.replace(hu,``);for(;;){let e=gu.exec(n);if(!e)break;t.push(e[0])}n=n.replace(gu,``);let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=/* @__PURE__ */ RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=r.exec(n);if(e)i.lastIndex=r.lastIndex;else if(e=i.exec(n),e)r.lastIndex=i.lastIndex;else break;t.push(e[0])}return t}let vu=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,yu=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function bu(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(yu,e=>{for(;;){let[t,,n]=vu.exec(e)||[];if(!n)return``;if(n===r)return`src: ${t};`}}):e}function xu(e,t=[]){for(let n of Array.from(e))Kc(n)?t.push(...xu(n.cssRules)):`cssRules`in n?xu(n.cssRules,t):t.push(n);return t}let Su=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function Cu(e){return Su.test(e.innerHTML)}async function wu(e,t){let n=await Dl(e,t);if(Z(n.node)&&qc(n.node)&&!Cu(n.node))return n.node;let{ownerDocument:r,log:i,tasks:a,svgStyleElement:o,svgDefsElement:s,svgStyles:c,font:l,progress:u,autoDestruct:d,onCloneNode:f,onEmbedNode:p,onCreateForeignObjectSvg:m}=n;i.time(`clone node`);let h=await eu(n.node,n,!0);if(o&&r){let e=``;c.forEach((t,n)=>{e+=`${t.join(`,
66
66
  `)} {
67
67
  ${n}
68
68
  }
69
- `}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&Z(h)&&(i.time(`embed web font`),await Al(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),kl(h,n);let g=a.length,_=0,v=async()=>{for(;;){let e=a.pop();if(!e)break;try{await e}catch(e){n.log.warn(`Failed to run task`,e)}u?.(++_,g)}};u?.(_,g),await Promise.all([...Array.from({length:4})].map(v)),i.timeEnd(`embed node`),await p?.(h);let y=Vl(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&_l(n),await m?.(y),y}function Vl(e,t){let{width:n,height:r}=t,i=jc(n,r,e.ownerDocument),a=i.ownerDocument.createElementNS(i.namespaceURI,`foreignObject`);return a.setAttributeNS(null,`x`,`0%`),a.setAttributeNS(null,`y`,`0%`),a.setAttributeNS(null,`width`,`100%`),a.setAttributeNS(null,`height`,`100%`),a.append(e),i.appendChild(a),i}async function Hl(e,t){let n=await Uc(e,t),r=await Bl(n),i=Mc(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=Gc(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(Ac,`defs`),n.svgStyles.clear()),await qc(Fc(i,r.ownerDocument),n)}async function Ul(e,t){let n=await Uc(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Hl(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&$s&&ec){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=Ys(t);e>=0?(n=Math.ceil((e+28)/3)*4,r=!0):n=44}else a===`image/jpeg`&&(n=24);let i=t.substring(0,n),s=t.substring(n),l=window.atob(i),u=new Uint8Array(l.length);for(let e=0;e<u.length;e++)u[e]=l.charCodeAt(e);let d=a===`image/png`?Js(u,o,r):Us(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function Wl(e,t){return Ul(await Uc(e,{...t,type:`image/jpeg`}))}async function Gl(e,t){let n=e.getBoundingClientRect(),r=n.width*n.height<4800&&e.parentElement?e.parentElement:e,i=r.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,1600/Math.max(i.width+48,i.height+48,1));try{let e=await Wl(r,{scale:a,quality:.85,backgroundColor:Kl(r),filter:e=>e!==t,timeout:4e3});return e.startsWith(`data:image/jpeg`)?{name:`tencil-element.jpg`,mimeType:`image/jpeg`,dataUrl:e}:null}catch(e){return console.warn(`[tencil] screenshot failed`,e),null}}function Kl(e){let t=e;for(;t;){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`transparent`&&!/rgba\(.*,\s*0\)$/.test(e))return e;t=t.parentElement}return`#ffffff`}var ql=0;Array.isArray;function Q(e,t,r,i,a,o){t||={};var s,c,l=t;if(`ref`in l&&typeof e!=`function`)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ql,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),n.vnode&&n.vnode(u),u}let Jl={t3code:{viewBox:`15.5309 37 94.3941 56.96`,path:`M33.4509 93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253 93.96C82.832 93.96 78.9653 93.4533 75.1253 92.44C71.2853 91.3733 68.032 89.88 65.3653 87.96L70.4053 78.04C72.5386 79.5867 75.0186 80.8133 77.8453 81.72C80.672 82.6267 83.5253 83.08 86.4053 83.08C89.6586 83.08 92.2186 82.44 94.0853 81.16C95.952 79.88 96.8853 78.12 96.8853 75.88C96.8853 73.7467 96.0586 72.0667 94.4053 70.84C92.752 69.6133 90.0853 69 86.4053 69H80.4853V60.44L96.0853 42.76L97.5253 47.4H68.1653V37H107.365V45.4L91.8453 63.08L85.2853 59.32H89.0453C95.9253 59.32 101.125 60.8667 104.645 63.96C108.165 67.0533 109.925 71.0267 109.925 75.88C109.925 79.0267 109.099 81.9867 107.445 84.76C105.792 87.48 103.259 89.6933 99.8453 91.4C96.432 93.1067 92.0586 93.96 86.7253 93.96Z`,className:`agent-mono`,label:`T3 Code`},codex:{viewBox:`0 0 256 260`,path:`M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z`,className:`agent-mono`,label:`Codex`},claudeAgent:{viewBox:`0 0 256 257`,path:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`,className:`agent-claude`,label:`Claude`},cursor:{viewBox:`0 0 466.73 532.09`,path:`M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z`,className:`agent-mono`,label:`Cursor`},ensemble:{viewBox:`2 2 16 16`,path:[{x:2.5,y:3.25,height:13.5,opacity:.6},{x:6.5,y:2,height:16,opacity:1},{x:10.5,y:2.75,height:14.5,opacity:.8},{x:14.5,y:4.25,height:11.5,opacity:.5}],className:`agent-mono`,label:`Ensemble`}};function Yl(e){if(Jl[e])return Jl[e];let t=e.toLowerCase();if(t.includes(`claude`))return Jl.claudeAgent;if(t.includes(`codex`)||t.includes(`openai`))return Jl.codex;if(t.includes(`cursor`))return Jl.cursor;if(t.includes(`ensemble`))return Jl.ensemble}function Xl({agent:e,size:t=13,decorative:n=!1}){if(!e)return null;let r=Yl(e);return r?/* @__PURE__ */ Q(`svg`,{class:`agent-icon ${r.className}`,width:t,height:t,viewBox:r.viewBox,role:n?void 0:`img`,"aria-label":n?void 0:r.label,"aria-hidden":n?`true`:void 0,children:typeof r.path==`string`?/* @__PURE__ */ Q(`path`,{d:r.path}):r.path.map(e=>/* @__PURE__ */ Q(`rect`,{x:e.x,y:e.y,width:`3`,height:e.height,rx:`0.15`,"fill-opacity":e.opacity},e.x))}):null}function $({children:e,size:t=16}){return/* @__PURE__ */ Q(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:e})}let Zl=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`}),/* @__PURE__ */ Q(`path`,{d:`M12 8v8M8 12h8`})]}),Ql=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M22 12h-6l-2 3h-4l-2-3H2`}),/* @__PURE__ */ Q(`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`})]}),$l=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M10.7 5.1A10.8 10.8 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.7 2.7`}),/* @__PURE__ */ Q(`path`,{d:`M6.6 6.6A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.4-1.6`}),/* @__PURE__ */ Q(`path`,{d:`M9.9 9.9a3 3 0 1 0 4.2 4.2M2 2l20 20`})]}),eu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),tu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`m5 12 7-7 7 7M12 19V5`})}),nu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`,fill:`currentColor`})}),ru=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M20 6 9 17l-5-5`})}),iu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M9 14 4 9l5-5`}),/* @__PURE__ */ Q(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),au=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})}),ou=()=>/* @__PURE__ */ Q($,{size:14,children:/* @__PURE__ */ Q(`path`,{d:`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})}),su=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M18 6 6 18M6 6l12 12`})}),cu=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`13`,r:`3`})]}),lu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m16 18 6-6-6-6M8 6l-6 6 6 6`})}),uu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),du=({size:e=16})=>/* @__PURE__ */ Q(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,class:`tencil-logo`,children:[/* @__PURE__ */ Q(`path`,{d:`M3 21V9a6 6 0 0 1 6-6h6a6 6 0 0 1 6 6v6a6 6 0 0 1-6 6Z`,fill:`#3b8dff`}),/* @__PURE__ */ Q(`path`,{d:`M9.25 7.5 16.5 12.6l-3.55.75-1.75 3.4Z`,fill:`#fff`,stroke:`#fff`,"stroke-linejoin":`round`})]}),fu=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`m12 2 10 5-10 5L2 7Z`}),/* @__PURE__ */ Q(`path`,{d:`m2 17 10 5 10-5M2 12l10 5 10-5`})]}),pu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4`})]}),mu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4M3 3l18 18`})]}),hu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m6 9 6 6 6-6`})}),gu=F(()=>{let e=/* @__PURE__ */ new Map,t=[...jn.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function _u(){let e=Pn.value.flatMap(e=>{let t=gu.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&H({type:`drafts.send`,drafts:e})&&(q.value=e[0]?.threadId??null)}function vu(){let e=yu();if(hn.value)return null;let t=K.value;return/* @__PURE__ */ Q(S,{children:[Mn.value.map(e=>/* @__PURE__ */ Q(xu,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ Q(bu,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ Q(Ou,{})]})}function yu(){let e=Mn.value,t=kn.value,n=j({page:t,pins:[]}),[r,i]=A([]);return Ne(()=>{let r=n.current;n.current={page:t,pins:e.map(e=>({thread:e,number:gu.value.get(e.id),variant:ku(e),resolved:!1}))};let a=new Set(e.map(e=>e.id)),o=r.page===t?r.pins.filter(e=>!a.has(e.thread.id)).map(e=>({...e,resolved:B.value.get(e.thread.id)?.resolved===!0})):[];i(e=>{let t=e.filter(e=>!a.has(e.thread.id)&&!o.some(t=>t.thread.id===e.thread.id));return t.length===e.length&&o.length===0?e:[...t,...o]});for(let e of o)setTimeout(()=>i(t=>t.filter(t=>t!==e)),1e3)},[e,t]),r}function bu({pin:e}){On.value;let t=e.thread.anchor?Rs(e.thread.anchor):null;return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-${e.variant} pin-leaving${e.resolved?` pin-resolving`:``}`,style:{transform:`translate(${t.x}px, ${t.y}px)`},"aria-hidden":`true`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph`,children:e.number??`•`}),e.resolved&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph pin-check`,children:/* @__PURE__ */ Q(ru,{})}),/* @__PURE__ */ Q(`span`,{class:`pin-shine`})]})]})}):null}function xu({thread:e}){if(On.value,!e.anchor)return null;let t=Dn.value,n=t?.threadId===e.id,r=n?t.point:Rs(e.anchor);if(!r)return null;let i=q.value===e.id;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`pin pin-${ku(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>Cu(t,e,r),onClick:()=>{if(Su===e.id){Su=null;return}K.value=null,q.value=i?null:e.id},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:gu.value.get(e.id)??`•`})})}let Su=null;function Cu(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}Su=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!Dn.value&&Math.hypot(r,o)<4||(Dn.value={threadId:t.id,point:wu({x:n.x+r,y:n.y+o})})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,Tu,!0);let n=Dn.value;n&&(Dn.value=null,Su=t.id,e.type===`pointerup`&&Eu(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,Tu,!0)}function wu(e){let{clientWidth:t,clientHeight:n}=document.documentElement;return{x:Math.max(0,Math.min(e.x,t-1)),y:Math.max(0,Math.min(e.y,n-1))}}function Tu(e){e.preventDefault()}function Eu(e,t){let n=Du(t);if(!n)return;let r={selector:ps(n),...zs(n,t)};H({type:`thread.move`,threadId:e.id,anchor:r})&&an({...e,anchor:r})}function Du(e){let t=Is();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function Ou(){On.value;let e=K.value,t=Rs(e.anchor,e.element);return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:`+`})}):null}function ku(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let Au=`tencil:open`;function ju(){let[e,t]=A(`page`),n=R.value?.label??`Agent`,r=L.value===`open`&&R.value?.state===`ready`,i=R.value?.id;return Me(()=>{r&&J.value&&e===`provider`&&ln()},[e,J.value,r,i]),J.value?/* @__PURE__ */ Q(`aside`,{class:`inbox`,children:[/* @__PURE__ */ Q(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ Q(`div`,{class:`segmented`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{J.value=!1},children:/* @__PURE__ */ Q(su,{})})]}),e===`provider`?/* @__PURE__ */ Q(Nu,{label:n}):/* @__PURE__ */ Q(Mu,{scope:e})]}):null}function Mu({scope:e}){let t=jn.value.filter(e=>mn.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&An(t.pageUrl)===kn.value);return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ Q(`span`,{class:`checkbox`,children:[/* @__PURE__ */ Q(`input`,{type:`checkbox`,class:`checkbox-input`,checked:mn.value,onChange:e=>{mn.value=e.target.checked}}),/* @__PURE__ */ Q(ru,{})]}),`Show resolved`]}),/* @__PURE__ */ Q(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`No pins yet. Press `,/* @__PURE__ */ Q(`kbd`,{children:`C`}),` and click anything on the page.`]}):t.map(e=>/* @__PURE__ */ Q(Iu,{thread:e},e.id))})]})}function Nu({label:e}){let t=Ht.value;return t?t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ Q(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ Q(Pu,{summary:e},e.id))}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function Pu({summary:e}){let t=Ut.value,n=[...B.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=dn(e);t&&(q.value=t)},children:[/* @__PURE__ */ Q(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ Q(Fu,{project:t}),/* @__PURE__ */ Q(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-${e.status}`,children:zu(e.status)}):e.background===`monitoring`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ Q(`span`,{class:`provider-item-time`,children:Bu(e.updatedAt)})]}),/* @__PURE__ */ Q(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ Q(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ Q(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ Q(Xl,{agent:e.agent})]})]})}function Fu({project:e}){return e.emoji?/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ Q(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function Iu({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||An(e.pageUrl)===kn.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item${q.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem(Au,e.id),location.href=e.pageUrl;return}q.value=e.id,Lu(e)},children:[t?/* @__PURE__ */ Q(`span`,{class:`pin pin-static pin-${ku(e)}`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:gu.value.get(e.id)})}):/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ Q(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ Q(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ Q(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),Ru(e),` · `,Bu(e.updatedAt)]}),r&&/* @__PURE__ */ Q(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function Lu(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function Ru(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function zu(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function Bu(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Vu({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=A(t),u=j(null);Me(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),Me(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ Q(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ Q(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ Q(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ Q(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ Q(`span`,{class:`spinner`}):/* @__PURE__ */ Q(tu,{})})]})]})}let Hu=P(null);function Uu(){On.value;let e=K.value,t=j(null),[n,r]=A(140),[i,a]=A(!1),[o,s]=A(!1),[c,l]=A(null),u=R.value?.state===`ready`,d=R.value?.id;if(Me(()=>{e&&u&&(ln(),un())},[e,u,d]),Me(()=>{Hu.value=null},[d]),Ne(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=Rs(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Vs(f,{width:340,height:n}),g=R.value,_=g?.state===`ready`,v=vn.value,y=v?null:Hu.value,b=y?void 0:Ju(g?.id);return/* @__PURE__ */ Q(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ Q(`div`,{class:`composer-target`,children:[/* @__PURE__ */ Q(`span`,{class:`chip`,children:[/* @__PURE__ */ Q(lu,{}),e.label]}),g&&v&&/* @__PURE__ */ Q(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,Pn.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ Q(hu,{})]})]}),e.measuredTo&&Cn.value&&/* @__PURE__ */ Q(Gu,{pending:e}),c===`target`&&!v&&/* @__PURE__ */ Q(Xu,{onPick:e=>{Hu.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ Q(Yu,{choices:b,onPick:e=>{H({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ Q(Vu,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=qu(await e.context,e),r=[];if(i){let t=await Gl(e.element,Is());t&&r.push(t)}let a=Lt(),o={...e.anchor,selector:n.selector};if(!H({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();an({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),K.value=null,v?In():q.value=a}finally{s(!1)}},onCancel:()=>{K.value=null},children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ Q(cu,{})}),gn.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{_n.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ Q(fu,{})}),b&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ Q(Xl,{agent:b.current?.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ Q(hu,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ Q(`p`,{class:`hint`,children:g.detail})]})}let Wu={top:`above`,right:`right`,bottom:`below`,left:`left`};function Gu({pending:e}){let t=e.measuredTo,n=Ku(e),r=[`top`,`right`,`bottom`,`left`].filter(e=>n?.[e]!==void 0).map(e=>`${n[e]} ${Wu[e]}`);return/* @__PURE__ */ Q(`div`,{class:`composer-measure`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-measure-label`,title:`Spacing to ${t.label}: ${r.join(`, `)||`none`}`,children:[`↔ `,t.parent?`Parent `:``,/* @__PURE__ */ Q(`span`,{class:`composer-measure-target`,children:t.label}),r.length>0&&` · ${r.join(`, `)}`]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Don't send the spacing`,"aria-label":`Remove spacing`,onClick:()=>{K.value&&={...K.value,measuredTo:void 0}},children:/* @__PURE__ */ Q(su,{})})]})}function Ku(e){let t=e.measuredTo;return!t||!Cn.value||!e.element.isConnected||!t.element.isConnected?void 0:$o(Qo(Xo(e.element.getBoundingClientRect()),Xo(t.element.getBoundingClientRect())),{to:t.label,selector:ps(t.element),...t.parent?{parent:!0}:{}})}function qu(e,t){let n=Ku(t);return n?{...e,spacing:n}:e}function Ju(e){let t=Wt.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(z.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function Yu({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`p`,{class:`menu-group`,children:[/* @__PURE__ */ Q(Xl,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function Xu({onPick:e}){let t=Ht.value,n=Hu.value?.id??null;return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ Q(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ Q(Xl,{agent:t.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Bu(t.updatedAt)})]},t.id))]})}function Zu(){On.value;let e=fn.value;if(!e)return null;let t=U.value===`picking`,n=!t&&!K.value&&Cn.value&&W.value&&!G.value;if(!t&&!n)return null;let r=Xo(e.getBoundingClientRect());return/* @__PURE__ */ Q(S,{children:[Cn.value&&(n||!W.value)&&/* @__PURE__ */ Q($u,{element:e,box:r}),/* @__PURE__ */ Q(`div`,{class:`highlight`,style:id(r)}),/* @__PURE__ */ Q(Qu,{element:e,box:r})]})}function Qu({element:e,box:t}){let n=t.top<28;return/* @__PURE__ */ Q(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[fs(e),/* @__PURE__ */ Q(`span`,{class:`highlight-size`,children:[Zo(t.right-t.left),`×`,Zo(t.bottom-t.top)]})]})}function $u({element:e,box:t}){let n=rs(e),r=[...ed(e,t,n),...td(e,t,n),...rd(e,t,n)];return/* @__PURE__ */ Q(S,{children:[r.map((e,t)=>/* @__PURE__ */ Q(`div`,{class:`band band-${e.kind}`,style:id(e.box)},`band-${t}`)),r.filter(e=>e.labelled).map((e,t)=>/* @__PURE__ */ Q(`span`,{class:`band-value band-value-${e.kind}`,style:{transform:ad(e.box)},children:[e.value,e.utility&&/* @__PURE__ */ Q(`span`,{class:`band-utility`,children:e.utility})]},`value-${t}`))]})}function ed(e,t,{margin:n}){let[r,i,a,o]=n.map(e=>Math.max(0,e)),s={left:t.left-o,top:t.top-r,right:t.right+i,bottom:t.bottom+a};return nd(e,`margin`,[[`top`,r,{...s,bottom:t.top}],[`right`,i,{left:t.right,right:s.right,top:t.top,bottom:t.bottom}],[`bottom`,a,{...s,top:t.bottom}],[`left`,o,{left:s.left,right:t.left,top:t.top,bottom:t.bottom}]])}function td(e,t,{padding:n,border:r}){let[i,a,o,s]=n,c={left:t.left+r[3],top:t.top+r[0],right:t.right-r[1],bottom:t.bottom-r[2]},l={top:c.top+i,bottom:c.bottom-o};return nd(e,`padding`,[[`top`,i,{...c,bottom:l.top}],[`right`,a,{...l,left:c.right-a,right:c.right}],[`bottom`,o,{...c,top:l.bottom}],[`left`,s,{...l,left:c.left,right:c.left+s}]])}function nd(e,t,n){return n.filter(([,e,t])=>e>0&&t.right>t.left&&t.bottom>t.top).map(([n,r,i])=>({kind:t,box:i,value:r,labelled:!0,utility:cs(e,t,n,r)}))}function rd(e,t,{gap:n,padding:r,border:i}){if(!n)return[];let a={left:t.left+i[3]+r[3],top:t.top+i[0]+r[0],right:t.right-i[1]-r[1],bottom:t.bottom-i[2]-r[2]},o=/* @__PURE__ */ new Set;return is(e,n,a).map(t=>{let{axis:r,...i}=t,a=!o.has(r);return o.add(r),{kind:`gap`,box:i,value:n[r],labelled:a,utility:a?cs(e,`gap`,r,n[r]):void 0}})}function id(e){return{transform:`translate(${e.left}px, ${e.top}px)`,width:`${e.right-e.left}px`,height:`${e.bottom-e.top}px`}}function ad(e){return`translate(${(e.left+e.right)/2}px, ${(e.top+e.bottom)/2}px) translate(-50%, -50%)`}function od(){if(On.value,!Cn.value)return null;let e=U.value===`idle`&&!K.value?G.value?.element:void 0,t=cd(e),n=e?.isConnected?Xo(e.getBoundingClientRect()):null;return/* @__PURE__ */ Q(S,{children:[e&&n&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:id(n)}),/* @__PURE__ */ Q(Qu,{element:e,box:n})]}),t&&/* @__PURE__ */ Q(sd,{pair:t})]})}function sd({pair:[e,t]}){if(!e.isConnected||!t.isConnected)return null;let n=Xo(e.getBoundingClientRect()),r=Xo(t.getBoundingClientRect()),i=K.value;return/* @__PURE__ */ Q(S,{children:[i?.element===e&&/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:id(n)}),/* @__PURE__ */ Q(`div`,{class:`measure-target`,style:id(r)}),Qo(n,r).map(e=>/* @__PURE__ */ Q(ld,{guide:e},e.side))]})}function cd(e){let t=fn.value,n=K.value;if(U.value===`picking`||!n&&!e){let e=t?.parentElement;return!W.value||!t||!e||e===document.documentElement?null:[t,e]}return e?W.value&&t&&t!==e?[e,t]:null:n?W.value&&t&&t!==n.element?[n.element,t]:n.measuredTo?[n.element,n.measuredTo.element]:null:null}function ld({guide:e}){return/* @__PURE__ */ Q(S,{children:[e.extension&&/* @__PURE__ */ Q(`div`,{class:`guide guide-extension`,style:ud(e.extension)}),/* @__PURE__ */ Q(`div`,{class:`guide`,style:ud(e)}),/* @__PURE__ */ Q(`span`,{class:`guide-value`,style:{transform:ad(dd(e))},children:e.value})]})}function ud(e){let t=dd(e);return id(t.left===t.right?{...t,left:t.left-.5,right:t.left+.5}:{...t,top:t.top-.5,bottom:t.top+.5})}function dd({from:e,to:t}){return{left:Math.min(e.x,t.x),right:Math.max(e.x,t.x),top:Math.min(e.y,t.y),bottom:Math.max(e.y,t.y)}}function fd({text:e,animate:t=!1}){let n=t?_d(e):0;return/* @__PURE__ */ Q(`div`,{class:`md`,children:pd(e,{index:0,animateFrom:t?n-48:1/0})})}function pd(e,t){let n=[],r=e.replace(/\r\n/g,`
69
+ `}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&Z(h)&&(i.time(`embed web font`),await mu(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),pu(h,n);let g=a.length,_=0,v=async()=>{for(;;){let e=a.pop();if(!e)break;try{await e}catch(e){n.log.warn(`Failed to run task`,e)}u?.(++_,g)}};u?.(_,g),await Promise.all([...Array.from({length:4})].map(v)),i.timeEnd(`embed node`),await p?.(h);let y=Tu(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&tu(n),await m?.(y),y}function Tu(e,t){let{width:n,height:r}=t,i=hl(n,r,e.ownerDocument),a=i.ownerDocument.createElementNS(i.namespaceURI,`foreignObject`);return a.setAttributeNS(null,`x`,`0%`),a.setAttributeNS(null,`y`,`0%`),a.setAttributeNS(null,`width`,`100%`),a.setAttributeNS(null,`height`,`100%`),a.append(e),i.appendChild(a),i}async function Eu(e,t){let n=await Dl(e,t),r=await wu(n),i=gl(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=kl(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(ml,`defs`),n.svgStyles.clear()),await jl(yl(i,r.ownerDocument),n)}async function Du(e,t){let n=await Dl(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Eu(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&Lc&&Rc){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=Nc(t);e>=0?(n=Math.ceil((e+28)/3)*4,r=!0):n=44}else a===`image/jpeg`&&(n=24);let i=t.substring(0,n),s=t.substring(n),l=window.atob(i),u=new Uint8Array(l.length);for(let e=0;e<u.length;e++)u[e]=l.charCodeAt(e);let d=a===`image/png`?Mc(u,o,r):Dc(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function Ou(e,t){return Du(await Dl(e,{...t,type:`image/jpeg`}))}async function ku(e,t){let n=e.getBoundingClientRect(),r=n.width*n.height<4800&&e.parentElement?e.parentElement:e,i=r.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,1600/Math.max(i.width+48,i.height+48,1));try{let e=await Ou(r,{scale:a,quality:.85,backgroundColor:Au(r),filter:e=>e!==t,timeout:4e3});return e.startsWith(`data:image/jpeg`)?{name:`tencil-element.jpg`,mimeType:`image/jpeg`,dataUrl:e}:null}catch(e){return console.warn(`[tencil] screenshot failed`,e),null}}function Au(e){let t=e;for(;t;){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`transparent`&&!/rgba\(.*,\s*0\)$/.test(e))return e;t=t.parentElement}return`#ffffff`}var ju=0;Array.isArray;function Q(e,t,r,i,a,o){t||={};var s,c,l=t;if(`ref`in l&&typeof e!=`function`)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ju,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),n.vnode&&n.vnode(u),u}let Mu={t3code:{viewBox:`15.5309 37 94.3941 56.96`,path:`M33.4509 93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253 93.96C82.832 93.96 78.9653 93.4533 75.1253 92.44C71.2853 91.3733 68.032 89.88 65.3653 87.96L70.4053 78.04C72.5386 79.5867 75.0186 80.8133 77.8453 81.72C80.672 82.6267 83.5253 83.08 86.4053 83.08C89.6586 83.08 92.2186 82.44 94.0853 81.16C95.952 79.88 96.8853 78.12 96.8853 75.88C96.8853 73.7467 96.0586 72.0667 94.4053 70.84C92.752 69.6133 90.0853 69 86.4053 69H80.4853V60.44L96.0853 42.76L97.5253 47.4H68.1653V37H107.365V45.4L91.8453 63.08L85.2853 59.32H89.0453C95.9253 59.32 101.125 60.8667 104.645 63.96C108.165 67.0533 109.925 71.0267 109.925 75.88C109.925 79.0267 109.099 81.9867 107.445 84.76C105.792 87.48 103.259 89.6933 99.8453 91.4C96.432 93.1067 92.0586 93.96 86.7253 93.96Z`,className:`agent-mono`,label:`T3 Code`},codex:{viewBox:`0 0 256 260`,path:`M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z`,className:`agent-mono`,label:`Codex`},claudeAgent:{viewBox:`0 0 256 257`,path:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`,className:`agent-claude`,label:`Claude`},cursor:{viewBox:`0 0 466.73 532.09`,path:`M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z`,className:`agent-mono`,label:`Cursor`},ensemble:{viewBox:`2 2 16 16`,path:[{x:2.5,y:3.25,height:13.5,opacity:.6},{x:6.5,y:2,height:16,opacity:1},{x:10.5,y:2.75,height:14.5,opacity:.8},{x:14.5,y:4.25,height:11.5,opacity:.5}],className:`agent-mono`,label:`Ensemble`}};function Nu(e){if(Mu[e])return Mu[e];let t=e.toLowerCase();if(t.includes(`claude`))return Mu.claudeAgent;if(t.includes(`codex`)||t.includes(`openai`))return Mu.codex;if(t.includes(`cursor`))return Mu.cursor;if(t.includes(`ensemble`))return Mu.ensemble}function Pu({agent:e,size:t=13,decorative:n=!1}){if(!e)return null;let r=Nu(e);return r?/* @__PURE__ */ Q(`svg`,{class:`agent-icon ${r.className}`,width:t,height:t,viewBox:r.viewBox,role:n?void 0:`img`,"aria-label":n?void 0:r.label,"aria-hidden":n?`true`:void 0,children:typeof r.path==`string`?/* @__PURE__ */ Q(`path`,{d:r.path}):r.path.map(e=>/* @__PURE__ */ Q(`rect`,{x:e.x,y:e.y,width:`3`,height:e.height,rx:`0.15`,"fill-opacity":e.opacity},e.x))}):null}function $({children:e,size:t=16}){return/* @__PURE__ */ Q(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:e})}let Fu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`}),/* @__PURE__ */ Q(`path`,{d:`M12 8v8M8 12h8`})]}),Iu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M22 12h-6l-2 3h-4l-2-3H2`}),/* @__PURE__ */ Q(`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`})]}),Lu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M10.7 5.1A10.8 10.8 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.7 2.7`}),/* @__PURE__ */ Q(`path`,{d:`M6.6 6.6A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.4-1.6`}),/* @__PURE__ */ Q(`path`,{d:`M9.9 9.9a3 3 0 1 0 4.2 4.2M2 2l20 20`})]}),Ru=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),zu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`m5 12 7-7 7 7M12 19V5`})}),Bu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`,fill:`currentColor`})}),Vu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M20 6 9 17l-5-5`})}),Hu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M9 14 4 9l5-5`}),/* @__PURE__ */ Q(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),Uu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})}),Wu=()=>/* @__PURE__ */ Q($,{size:14,children:/* @__PURE__ */ Q(`path`,{d:`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})}),Gu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M18 6 6 18M6 6l12 12`})}),Ku=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`13`,r:`3`})]}),qu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m16 18 6-6-6-6M8 6l-6 6 6 6`})}),Ju=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),Yu=({size:e=16})=>/* @__PURE__ */ Q(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,class:`tencil-logo`,children:[/* @__PURE__ */ Q(`path`,{d:`M3 21V9a6 6 0 0 1 6-6h6a6 6 0 0 1 6 6v6a6 6 0 0 1-6 6Z`,fill:`#3b8dff`}),/* @__PURE__ */ Q(`path`,{d:`M9.25 7.5 16.5 12.6l-3.55.75-1.75 3.4Z`,fill:`#fff`,stroke:`#fff`,"stroke-linejoin":`round`})]}),Xu=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`m12 2 10 5-10 5L2 7Z`}),/* @__PURE__ */ Q(`path`,{d:`m2 17 10 5 10-5M2 12l10 5 10-5`})]}),Zu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4`})]}),Qu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4M3 3l18 18`})]}),$u=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m6 9 6 6 6-6`})}),ed=()=>/* @__PURE__ */ Q($,{size:14,children:/* @__PURE__ */ Q(`path`,{d:`M11.5 2.8a.6.6 0 0 1 1 0l2.6 5.3 5.8.8a.6.6 0 0 1 .3 1l-4.2 4.1 1 5.8a.6.6 0 0 1-.8.6L12 17.7l-5.2 2.7a.6.6 0 0 1-.8-.6l1-5.8-4.2-4.1a.6.6 0 0 1 .3-1l5.8-.8Z`})}),td=()=>/* @__PURE__ */ Q(`svg`,{width:14,height:14,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:/* @__PURE__ */ Q(`path`,{d:`M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 0-.8.4-1.3.7-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.2.5-2.3 1.3-3.1-.2-.4-.6-1.6 0-3.2 0 0 1-.3 3.4 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.6.2 2.8.1 3.2.8.8 1.3 1.9 1.3 3.2 0 4.6-2.8 5.6-5.5 5.9.5.4.9 1.1.9 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3`})}),nd=F(()=>{let e=/* @__PURE__ */ new Map,t=[...lr.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function rd(){let e=fr.value.flatMap(e=>{let t=nd.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&V({type:`drafts.send`,drafts:e})&&(K.value=e[0]?.threadId??null)}function id(){let e=ad();if(J.value)return null;let t=G.value;return/* @__PURE__ */ Q(S,{children:[ur.value.map(e=>/* @__PURE__ */ Q(sd,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ Q(od,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ Q(md,{})]})}function ad(){let e=ur.value,t=sr.value,n=j({page:t,pins:[]}),[r,i]=k([]);return Ne(()=>{let r=n.current;n.current={page:t,pins:e.map(e=>({thread:e,number:nd.value.get(e.id),variant:hd(e),resolved:!1}))};let a=new Set(e.map(e=>e.id)),o=r.page===t?r.pins.filter(e=>!a.has(e.thread.id)).map(e=>({...e,resolved:z.value.get(e.thread.id)?.resolved===!0})):[];i(e=>{let t=e.filter(e=>!a.has(e.thread.id)&&!o.some(t=>t.thread.id===e.thread.id));return t.length===e.length&&o.length===0?e:[...t,...o]});for(let e of o)setTimeout(()=>i(t=>t.filter(t=>t!==e)),1e3)},[e,t]),r}function od({pin:e}){or.value;let t=e.thread.anchor?Sc(e.thread.anchor):null;return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-${e.variant} pin-leaving${e.resolved?` pin-resolving`:``}`,style:{transform:`translate(${t.x}px, ${t.y}px)`},"aria-hidden":`true`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph`,children:e.number??`•`}),e.resolved&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph pin-check`,children:/* @__PURE__ */ Q(Vu,{})}),/* @__PURE__ */ Q(`span`,{class:`pin-shine`})]})]})}):null}function sd({thread:e}){if(or.value,!e.anchor)return null;let t=ar.value,n=t?.threadId===e.id,r=n?t.point:Sc(e.anchor);if(!r)return null;let i=K.value===e.id;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`pin pin-${hd(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>ld(t,e,r),onClick:()=>{if(cd===e.id){cd=null;return}G.value=null,K.value=i?null:e.id},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:nd.value.get(e.id)??`•`})})}let cd=null;function ld(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}cd=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!ar.value&&Math.hypot(r,o)<4||(ar.value={threadId:t.id,point:ud({x:n.x+r,y:n.y+o})})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,dd,!0);let n=ar.value;n&&(ar.value=null,cd=t.id,e.type===`pointerup`&&fd(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,dd,!0)}function ud(e){let{clientWidth:t,clientHeight:n}=document.documentElement;return{x:Math.max(0,Math.min(e.x,t-1)),y:Math.max(0,Math.min(e.y,n-1))}}function dd(e){e.preventDefault()}function fd(e,t){let n=pd(t);if(!n)return;let r={selector:Zs(n),...Cc(n,t)};V({type:`thread.move`,threadId:e.id,anchor:r})&&ln({...e,anchor:r})}function pd(e){let t=bc();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function md(){or.value;let e=G.value,t=Sc(e.anchor,e.element);return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:`+`})}):null}function hd(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let gd=`tencil:open`;function _d(){let[e,t]=k(`page`),n=L.value?.label??`Agent`,r=I.value===`open`&&L.value?.state===`ready`,i=L.value?.id;return A(()=>{r&&q.value&&e===`provider`&&pn()},[e,q.value,r,i]),q.value?/* @__PURE__ */ Q(`aside`,{class:`inbox`,children:[/* @__PURE__ */ Q(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ Q(`div`,{class:`segmented`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{q.value=!1},children:/* @__PURE__ */ Q(Gu,{})})]}),e===`provider`?/* @__PURE__ */ Q(yd,{label:n}):/* @__PURE__ */ Q(vd,{scope:e})]}):null}function vd({scope:e}){let t=lr.value.filter(e=>Hn.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&cr(t.pageUrl)===sr.value);return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ Q(`span`,{class:`checkbox`,children:[/* @__PURE__ */ Q(`input`,{type:`checkbox`,class:`checkbox-input`,checked:Hn.value,onChange:e=>{Hn.value=e.target.checked}}),/* @__PURE__ */ Q(Vu,{})]}),`Show resolved`]}),/* @__PURE__ */ Q(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:Mn.value.comment?/* @__PURE__ */ Q(S,{children:[`No pins yet. Press `,/* @__PURE__ */ Q(`kbd`,{children:Mn.value.comment}),` and click anything on the page.`]}):`No pins yet. Click Comment, then anything on the page.`}):t.map(e=>/* @__PURE__ */ Q(Sd,{thread:e},e.id))})]})}function yd({label:e}){let t=Kt.value;return t?t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ Q(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ Q(bd,{summary:e},e.id))}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function bd({summary:e}){let t=qt.value,n=[...z.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=hn(e);t&&(K.value=t)},children:[/* @__PURE__ */ Q(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ Q(xd,{project:t}),/* @__PURE__ */ Q(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-${e.status}`,children:Td(e.status)}):e.background===`monitoring`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ Q(`span`,{class:`provider-item-time`,children:Ed(e.updatedAt)})]}),/* @__PURE__ */ Q(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ Q(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ Q(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ Q(Pu,{agent:e.agent})]})]})}function xd({project:e}){return e.emoji?/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ Q(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function Sd({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||cr(e.pageUrl)===sr.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item${K.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem(gd,e.id),location.href=e.pageUrl;return}K.value=e.id,Cd(e)},children:[t?/* @__PURE__ */ Q(`span`,{class:`pin pin-static pin-${hd(e)}`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:nd.value.get(e.id)})}):/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ Q(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ Q(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ Q(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),wd(e),` · `,Ed(e.updatedAt)]}),r&&/* @__PURE__ */ Q(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function Cd(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function wd(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function Td(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function Ed(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Dd({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=k(t),u=j(null);A(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),A(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ Q(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ Q(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ Q(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ Q(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ Q(`span`,{class:`spinner`}):/* @__PURE__ */ Q(zu,{})})]})]})}let Od=P(null);function kd(){or.value;let e=G.value,t=j(null),[n,r]=k(140),[i,a]=k(!1),[o,s]=k(!1),[c,l]=k(null),u=L.value?.state===`ready`,d=L.value?.id;if(A(()=>{e&&u&&(pn(),mn())},[e,u,d]),A(()=>{Od.value=null},[d]),Ne(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=Sc(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Tc(f,{width:340,height:n}),g=L.value,_=g?.state===`ready`,v=Gn.value,y=v?null:Od.value,b=y?void 0:Pd(g?.id);return/* @__PURE__ */ Q(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ Q(`div`,{class:`composer-target`,children:[/* @__PURE__ */ Q(`span`,{class:`chip`,children:[/* @__PURE__ */ Q(qu,{}),e.label]}),g&&v&&/* @__PURE__ */ Q(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,fr.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ Q($u,{})]})]}),e.measuredTo&&er.value&&/* @__PURE__ */ Q(jd,{pending:e}),c===`target`&&!v&&/* @__PURE__ */ Q(Id,{onPick:e=>{Od.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ Q(Fd,{choices:b,onPick:e=>{V({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ Q(Dd,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=Nd(await e.context,e),r=[];if(i){let t=await ku(e.element,bc());t&&r.push(t)}let a=Rt(),o={...e.anchor,selector:n.selector};if(!V({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();ln({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),G.value=null,v?mr():K.value=a}finally{s(!1)}},onCancel:()=>{G.value=null},children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ Q(Ku,{})}),Un.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{Wn.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ Q(Xu,{})}),b&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ Q(Pu,{agent:b.current?.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ Q($u,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ Q(`p`,{class:`hint`,children:g.detail})]})}let Ad={top:`above`,right:`right`,bottom:`below`,left:`left`};function jd({pending:e}){let t=e.measuredTo,n=Md(e),r=[`top`,`right`,`bottom`,`left`].filter(e=>n?.[e]!==void 0).map(e=>`${n[e]} ${Ad[e]}`);return/* @__PURE__ */ Q(`div`,{class:`composer-measure`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-measure-label`,title:`Spacing to ${t.label}: ${r.join(`, `)||`none`}`,children:[`↔ `,t.parent?`Parent `:``,/* @__PURE__ */ Q(`span`,{class:`composer-measure-target`,children:t.label}),r.length>0&&` · ${r.join(`, `)}`]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Don't send the spacing`,"aria-label":`Remove spacing`,onClick:()=>{G.value&&={...G.value,measuredTo:void 0}},children:/* @__PURE__ */ Q(Gu,{})})]})}function Md(e){let t=e.measuredTo;return!t||!er.value||!e.element.isConnected||!t.element.isConnected?void 0:Ls(Is(Ps(e.element.getBoundingClientRect()),Ps(t.element.getBoundingClientRect())),{to:t.label,selector:Zs(t.element),...t.parent?{parent:!0}:{}})}function Nd(e,t){let n=Md(t);return n?{...e,spacing:n}:e}function Pd(e){let t=Jt.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(R.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function Fd({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`p`,{class:`menu-group`,children:[/* @__PURE__ */ Q(Pu,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function Id({onPick:e}){let t=Kt.value,n=Od.value?.id??null;return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ Q(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ Q(Pu,{agent:t.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Ed(t.updatedAt)})]},t.id))]})}function Ld(){or.value;let e=Rn.value;if(!e)return null;let t=U.value===`picking`,n=!t&&!G.value&&er.value&&zn.value&&!W.value;if(!t&&!n)return null;let r=Ps(e.getBoundingClientRect());return/* @__PURE__ */ Q(S,{children:[er.value&&(n||!zn.value)&&/* @__PURE__ */ Q(zd,{element:e,box:r}),/* @__PURE__ */ Q(`div`,{class:`highlight`,style:Wd(r)}),/* @__PURE__ */ Q(Rd,{element:e,box:r})]})}function Rd({element:e,box:t}){let n=t.top<28;return/* @__PURE__ */ Q(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[Xs(e),/* @__PURE__ */ Q(`span`,{class:`highlight-size`,children:[Fs(t.right-t.left),`×`,Fs(t.bottom-t.top)]})]})}function zd({element:e,box:t}){let n=Vs(e),r=[...Bd(e,t,n),...Vd(e,t,n),...Ud(e,t,n)];return/* @__PURE__ */ Q(S,{children:[r.map((e,t)=>/* @__PURE__ */ Q(`div`,{class:`band band-${e.kind}`,style:Wd(e.box)},`band-${t}`)),r.filter(e=>e.labelled).map((e,t)=>/* @__PURE__ */ Q(`span`,{class:`band-value band-value-${e.kind}`,style:{transform:Gd(e.box)},children:[e.value,e.utility&&/* @__PURE__ */ Q(`span`,{class:`band-utility`,children:e.utility})]},`value-${t}`))]})}function Bd(e,t,{margin:n}){let[r,i,a,o]=n.map(e=>Math.max(0,e)),s={left:t.left-o,top:t.top-r,right:t.right+i,bottom:t.bottom+a};return Hd(e,`margin`,[[`top`,r,{...s,bottom:t.top}],[`right`,i,{left:t.right,right:s.right,top:t.top,bottom:t.bottom}],[`bottom`,a,{...s,top:t.bottom}],[`left`,o,{left:s.left,right:t.left,top:t.top,bottom:t.bottom}]])}function Vd(e,t,{padding:n,border:r}){let[i,a,o,s]=n,c={left:t.left+r[3],top:t.top+r[0],right:t.right-r[1],bottom:t.bottom-r[2]},l={top:c.top+i,bottom:c.bottom-o};return Hd(e,`padding`,[[`top`,i,{...c,bottom:l.top}],[`right`,a,{...l,left:c.right-a,right:c.right}],[`bottom`,o,{...c,top:l.bottom}],[`left`,s,{...l,left:c.left,right:c.left+s}]])}function Hd(e,t,n){return n.filter(([,e,t])=>e>0&&t.right>t.left&&t.bottom>t.top).map(([n,r,i])=>({kind:t,box:i,value:r,labelled:!0,utility:Ks(e,t,n,r)}))}function Ud(e,t,{gap:n,padding:r,border:i}){if(!n)return[];let a={left:t.left+i[3]+r[3],top:t.top+i[0]+r[0],right:t.right-i[1]-r[1],bottom:t.bottom-i[2]-r[2]},o=/* @__PURE__ */ new Set;return Hs(e,n,a).map(t=>{let{axis:r,...i}=t,a=!o.has(r);return o.add(r),{kind:`gap`,box:i,value:n[r],labelled:a,utility:a?Ks(e,`gap`,r,n[r]):void 0}})}function Wd(e){return{transform:`translate(${e.left}px, ${e.top}px)`,width:`${e.right-e.left}px`,height:`${e.bottom-e.top}px`}}function Gd(e){return`translate(${(e.left+e.right)/2}px, ${(e.top+e.bottom)/2}px) translate(-50%, -50%)`}function Kd(){if(or.value,!er.value)return null;let e=U.value===`idle`&&!G.value?W.value?.element:void 0,t=Jd(e),n=e?.isConnected?Ps(e.getBoundingClientRect()):null;return/* @__PURE__ */ Q(S,{children:[e&&n&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:Wd(n)}),/* @__PURE__ */ Q(Rd,{element:e,box:n})]}),t&&/* @__PURE__ */ Q(qd,{pair:t})]})}function qd({pair:[e,t]}){if(!e.isConnected||!t.isConnected)return null;let n=Ps(e.getBoundingClientRect()),r=Ps(t.getBoundingClientRect()),i=G.value;return/* @__PURE__ */ Q(S,{children:[i?.element===e&&/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:Wd(n)}),/* @__PURE__ */ Q(`div`,{class:`measure-target`,style:Wd(r)}),Is(n,r).map(e=>/* @__PURE__ */ Q(Yd,{guide:e},e.side))]})}function Jd(e){let t=Rn.value,n=G.value;if(U.value===`picking`||!n&&!e){let e=t?.parentElement;return!zn.value||!t||!e||e===document.documentElement?null:[t,e]}return e?zn.value&&t&&t!==e?[e,t]:null:n?zn.value&&t&&t!==n.element?[n.element,t]:n.measuredTo?[n.element,n.measuredTo.element]:null:null}function Yd({guide:e}){return/* @__PURE__ */ Q(S,{children:[e.extension&&/* @__PURE__ */ Q(`div`,{class:`guide guide-extension`,style:Xd(e.extension)}),/* @__PURE__ */ Q(`div`,{class:`guide`,style:Xd(e)}),/* @__PURE__ */ Q(`span`,{class:`guide-value`,style:{transform:Gd(Zd(e))},children:e.value})]})}function Xd(e){let t=Zd(e);return Wd(t.left===t.right?{...t,left:t.left-.5,right:t.left+.5}:{...t,top:t.top-.5,bottom:t.top+.5})}function Zd({from:e,to:t}){return{left:Math.min(e.x,t.x),right:Math.max(e.x,t.x),top:Math.min(e.y,t.y),bottom:Math.max(e.y,t.y)}}function Qd({tone:e,label:t}){let[n,r]=k(!1),i=j(void 0);A(()=>()=>clearTimeout(i.current),[]);let a=e=>{clearTimeout(i.current),i.current=setTimeout(()=>r(!0),e)},o=()=>{clearTimeout(i.current),r(!1)};return/* @__PURE__ */ Q(`span`,{class:`status`,onPointerEnter:()=>a(250),onPointerLeave:o,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`status-button`,"aria-label":`Tencil status: ${t}`,"aria-expanded":n,"aria-describedby":n?`tencil-status-card`:void 0,onFocus:()=>a(0),onBlur:o,onClick:()=>n?o():a(0),children:/* @__PURE__ */ Q(`span`,{class:`status-dot status-${e}`,children:pr.value>0&&/* @__PURE__ */ Q(`span`,{class:`status-ping`})})}),n&&/* @__PURE__ */ Q($d,{tone:e})]})}function $d({tone:e}){return/* @__PURE__ */ Q(`div`,{class:`status-card`,role:`tooltip`,id:`tencil-status-card`,children:[/* @__PURE__ */ Q(`div`,{class:`status-card-head`,children:[/* @__PURE__ */ Q(Yu,{size:18}),/* @__PURE__ */ Q(`strong`,{children:`Tencil`}),Ht.value&&/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:[`v`,Ht.value]})]}),/* @__PURE__ */ Q(nf,{tone:e})]})}function ef(e=tf()){let t=L.value,n=I.value,r=fr.value.length,i=pr.value,a=wt.value,o=[{label:rn()?`Tencil Cloud`:`Daemon`,tone:n===`open`?`ok`:e,value:n===`open`?`Connected`:n===`connecting`?`Connecting…`:`Offline`},{label:`Address`,value:cn()},{label:`Project`,value:Yt.value?`Not picked yet`:zt.value?.name??`…`,title:zt.value?.root},t?{label:`Agent`,tone:t.state===`ready`?`ok`:e,value:t.label,note:Pf(t)}:{label:`Agent`,value:`…`}];return t?.target&&o.push({label:`Workspace`,value:t.target}),a&&o.push({label:`Signed in`,value:a.login?`@${a.login}`:a.name,note:a.access===`read`?`view only`:void 0}),(i>0||r>0)&&o.push({label:`Pins`,value:[i>0&&`${i} working`,r>0&&`${r} queued`].filter(Boolean).join(` · `)}),o}function tf(){return I.value===`open`?`warn`:`error`}function nf({tone:e}){let t=L.value;return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`dl`,{class:`status-card-rows`,children:ef(e).map(e=>/* @__PURE__ */ Q(`div`,{class:`status-card-row`,children:[/* @__PURE__ */ Q(`dt`,{children:e.label}),/* @__PURE__ */ Q(`dd`,{title:e.title,children:[e.tone&&/* @__PURE__ */ Q(`span`,{class:`status-card-tone tone-${e.tone}`}),e.value,e.note&&/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:e.note})]})]},e.label))}),t&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Q(`p`,{class:`status-card-detail`,children:t.detail})]})}let rf=`https://github.com/tencildev/tencil`,af=`${rf}/blob/master/packages/tencil/CHANGELOG.md`,of=`npx tencil@latest setup`,sf=F(()=>!rn()&&!!Ut.value?.latest&&Ut.value.state===`idle`),cf=P(!1),lf=P(!1);function uf(){let e=Ht.value;if(rn()||!e)return null;let t=Ut.value,n=t?.state===`installing`||t?.state===`waiting`||t?.state===`restarting`,r=Gt.value;return/* @__PURE__ */ Q(`section`,{class:`settings-section settings-about`,"aria-label":`About Tencil`,children:[/* @__PURE__ */ Q(`div`,{class:`settings-about-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,children:`Tencil`}),/* @__PURE__ */ Q(`span`,{class:`settings-version`,children:[`v`,e]})]}),r&&r!==e&&!t?.latest&&/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Updated from v`,r,`.`]}),t?.latest&&/* @__PURE__ */ Q(`div`,{class:`settings-update`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[/* @__PURE__ */ Q(`strong`,{children:[`Tencil `,t.latest,` is available.`]}),` `,/* @__PURE__ */ Q(`a`,{href:af,target:`_blank`,rel:`noreferrer`,children:`What's new`})]}),n&&/* @__PURE__ */ Q(`p`,{class:`settings-help settings-progress`,children:ff(t)}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action settings-update-button`,disabled:n,onClick:()=>V({type:`update.start`}),children:n?`Updating…`:t.state===`failed`?`Try again`:`Update`})]}),/* @__PURE__ */ Q(`div`,{class:`settings-links`,children:[/* @__PURE__ */ Q(`a`,{class:`settings-link`,href:rf,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ Q(td,{}),`tencildev/tencil`]}),/* @__PURE__ */ Q(`a`,{class:`settings-link`,href:af,target:`_blank`,rel:`noreferrer`,children:`Changelog`}),/* @__PURE__ */ Q(`a`,{class:`settings-link settings-star`,href:rf,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ Q(ed,{}),`Give us a star`]})]}),t?.state===`failed`&&/* @__PURE__ */ Q(`div`,{class:`settings-update-error`,role:`alert`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Couldn't update`,t.error?`: ${t.error}`:`.`,` Tencil `,e,` `,`is still running. Update from a terminal instead:`]}),/* @__PURE__ */ Q(`div`,{class:`settings-command`,children:[/* @__PURE__ */ Q(`code`,{children:of}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(of).then(()=>{cf.value=!0,setTimeout(()=>{cf.value=!1},1500)})},children:cf.value?`Copied`:`Copy`})]})]}),/* @__PURE__ */ Q(`details`,{class:`settings-debug`,children:[/* @__PURE__ */ Q(`summary`,{children:[/* @__PURE__ */ Q($u,{}),`Debug`]}),/* @__PURE__ */ Q(`div`,{class:`settings-debug-body`,children:[/* @__PURE__ */ Q(nf,{}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(df()).then(()=>{lf.value=!0,setTimeout(()=>{lf.value=!1},1500)})},children:lf.value?`Copied`:`Copy for a bug report`})]})]})]})}function df(){let e=L.value;return[`Tencil v${Ht.value??`?`}`,...ef().map(e=>`${e.label}: ${e.value}${e.note?` (${e.note})`:``}${e.title?` [${e.title}]`:``}`),...e&&e.state!==`ready`&&e.detail?[`Detail: ${e.detail}`]:[],`Page: ${location.origin}${location.pathname}`,`Browser: ${navigator.userAgent}`].join(`
70
+ `)}function ff(e){switch(e.state){case`installing`:return`Installing Tencil ${e.latest}…`;case`waiting`:{let t=e.running??1;return`Waiting for ${t} running ${t===1?`thread`:`threads`} to finish…`}default:return`Restarting on Tencil ${e.latest}…`}}function pf(){let e=Vt.value;return/* @__PURE__ */ Q(`div`,{class:`settings-section overview`,children:e&&!rn()?/* @__PURE__ */ Q(mf,{source:e}):/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Pins on this page go to this project.`})})}function mf({source:e}){let[t,n]=k(!1),[r,i]=k(``),a=j(null);A(()=>{t&&a.current?.focus()},[t]);let o=e.via===`picked`,s=Bt.value,c=r.trim().toLowerCase(),l=zt.value?.root,u=(s??[]).filter(e=>e.root!==l&&(!c||e.title.toLowerCase().includes(c)||e.root.toLowerCase().includes(c))),d=e=>{V({type:`project.select`,root:e}),n(!1),i(``)};return/* @__PURE__ */ Q(`div`,{class:`overview-block`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-label`,children:`Project detection`}),/* @__PURE__ */ Q(`div`,{class:`detection`,children:[/* @__PURE__ */ Q(`span`,{class:`detection-badge${o?` detection-picked`:``}`,children:o?`Picked`:`Automatic`}),/* @__PURE__ */ Q(`span`,{class:`settings-help detection-reason`,children:hf(e)}),/* @__PURE__ */ Q(`span`,{class:`detection-actions`,children:[e.detected&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`detection-button`,onClick:()=>e.detected&&d(e.detected.root),children:`Use automatic`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`detection-button`,"aria-expanded":t,onClick:()=>{t||(Bt.value=null,V({type:`project.choices`})),n(!t)},children:t?`Cancel`:`Change`})]})]}),t&&/* @__PURE__ */ Q(`div`,{class:`detection-picker`,children:[/* @__PURE__ */ Q(`input`,{class:`detection-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,ref:a,value:r,onInput:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u[0]&&d(u[0].root)}}),/* @__PURE__ */ Q(`div`,{class:`detection-list`,children:s===null?/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Looking for projects…`}):u.length===0?/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:c?`No project matches “${r.trim()}”.`:`No other projects found.`}):u.map(e=>/* @__PURE__ */ Q(`button`,{type:`button`,class:`detection-option`,title:e.root,onClick:()=>d(e.root),children:[/* @__PURE__ */ Q(`span`,{class:`detection-option-name`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`detection-option-root`,children:`‎`+e.root})]},e.root))}),/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Kept for this address while Tencil finds the same project here. When another app takes the port, detection decides again.`})]})]})}function hf(e){if(e.via===`picked`)return e.detected?`You picked it instead of ${e.detected.root.split(/[\\/]/).filter(Boolean).pop()??`the detected project`}.`:`You picked it for this address: Tencil couldn't tell from the page.`;switch(e.via){case`plugin`:return`The git repository the Vite or Next.js plugin passed along.`;case`port`:return`The dev server listening on port ${e.port}.`;case`docker`:return`The Docker Compose project publishing port ${e.port}.`;default:return`The Ensemble thread whose dev server runs on port ${e.port}.`}}let gf=[{action:`comment`,label:`Comment`},{action:`ruler`,label:`Ruler`},{action:`measure`,label:`Measure`,help:`Held while hovering, with the ruler on.`},{action:`hidePins`,label:`Hide pins`},{action:`hideDock`,label:`Hide the dock`,help:`Also brings a hidden dock back.`}],_f=[`comment`,`ruler`,`hidePins`,`hideDock`];function vf(){let[e,t]=k(null),[n,r]=k(null),[i,a]=k(null),o=H.value;A(()=>{Sn.value=e!==null},[e]),A(()=>()=>{Sn.value=!1},[]);let s=()=>t(null),c=e=>{Cn(e),r(null),s()},l=(e,t)=>{t.preventDefault(),t.stopPropagation();let n=!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(t.key===`Escape`&&n)return s();if((t.key===`Backspace`||t.key===`Delete`)&&n)return e===`hideDock`?(r({action:e,text:`Can't clear this one: it's how a hidden dock comes back.`}),s()):c({...o,[e]:null});if(e===`measure`){if(kn(t.key))return c({...o,measure:t.key});r({action:e,text:`Measure is held: press one key, ${xn?`⌥, ⇧, ⌃ or ⌘`:`Alt, Shift, Ctrl or Win`}.`});return}let i=Nn(t);if(!i)return;if(`error`in i){r({action:e,text:i.error});return}let l=_f.find(t=>t!==e&&Fn(o[t],i));if(l)return a({action:e,shortcut:i,other:l}),r(null),s();c({...o,[e]:i})},u=({action:e,shortcut:t,other:n})=>{let i=o[e];n===`hideDock`&&!i?r({action:e,text:`Give it a shortcut first: hide the dock needs one.`}):(Cn({...o,[e]:t,[n]:i}),r(null)),a(null)};return/* @__PURE__ */ Q(`div`,{class:`settings-section`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Click a shortcut and press the new keys. `,/* @__PURE__ */ Q(`kbd`,{children:`Esc`}),` cancels,`,` `,/* @__PURE__ */ Q(`kbd`,{children:xn?`⌫`:`Backspace`}),` clears it.`]}),/* @__PURE__ */ Q(`ul`,{class:`shortcut-list`,children:gf.map(({action:c,label:d,help:f})=>{let p=o[c],m=e===c,h=p===null?null:typeof p==`string`?jn(p):An(p);return/* @__PURE__ */ Q(`li`,{class:`shortcut-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,id:`tencil-shortcut-${c}`,children:d}),f&&/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:f})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-key${m?` recording`:``}`,"aria-labelledby":`tencil-shortcut-${c}`,"aria-describedby":`tencil-shortcut-${c}-value`,onClick:()=>{a(null),r(null),t(m?null:c)},onKeyDown:e=>{m&&l(c,e)},onBlur:()=>{m&&s()},children:/* @__PURE__ */ Q(`span`,{id:`tencil-shortcut-${c}-value`,children:m?`Press keys…`:h?/* @__PURE__ */ Q(`kbd`,{children:h}):/* @__PURE__ */ Q(`span`,{class:`shortcut-none`,children:`None`})})}),n?.action===c&&/* @__PURE__ */ Q(`p`,{class:`shortcut-message`,role:`alert`,children:n.text}),i?.action===c&&/* @__PURE__ */ Q(`p`,{class:`shortcut-message`,role:`alert`,children:[An(i.shortcut),` is already used for`,` `,gf.find(e=>e.action===i.other)?.label,`.`,/* @__PURE__ */ Q(`span`,{class:`shortcut-message-actions`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>u(i),children:`Swap`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-cancel`,onClick:()=>a(null),children:`Cancel`})]})]})]},c)})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-reset`,disabled:yf(o),onClick:()=>{s(),a(null),r(null),wn()},children:`Reset to defaults`})]})}function yf(e){return In(e,bn)}let bf={id:`agent`,label:`Agent`};function xf(){let e=j(null);Mf(e);let t=[{id:`overview`,label:`Project`},bf,{id:`tools`,label:`Tools`}],n=[{id:`appearance`,label:`Appearance`},{id:`shortcuts`,label:`Shortcuts`},{id:`dock`,label:`Dock`},...wt.value?[{id:`account`,label:`Account`}]:[]],r=rn()?[]:[{id:`about`,label:`About`}],i=[...t,...n,...r],a=i.find(e=>e.id===Vn.value)??bf,o=()=>{Bn.value=!1},s=e=>{Vn.value=e};return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`settings-scrim`,onClick:o}),/* @__PURE__ */ Q(`section`,{ref:e,class:`settings-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,onKeyDown:t=>{t.key===`Escape`?(t.stopPropagation(),o()):t.key===`Tab`&&e.current&&Nf(t,e.current)},children:[/* @__PURE__ */ Q(`nav`,{class:`settings-nav`,"aria-label":`Settings pages`,onKeyDown:t=>{let n=t.key===`ArrowDown`?1:t.key===`ArrowUp`?-1:0;if(!n)return;t.preventDefault();let r=i.indexOf(a),o=i[(r+n+i.length)%i.length];o&&(s(o.id),(e.current?.querySelector(`[data-page="${o.id}"]`))?.focus())},children:[/* @__PURE__ */ Q(`strong`,{class:`settings-title`,children:[/* @__PURE__ */ Q(Yu,{size:18}),`Settings`]}),/* @__PURE__ */ Q(Sf,{pages:t,current:a.id,onSelect:s}),/* @__PURE__ */ Q(Sf,{title:`You`,pages:n,current:a.id,onSelect:s}),r.length>0&&/* @__PURE__ */ Q(Sf,{title:`Tencil`,pages:r,current:a.id,onSelect:s})]}),/* @__PURE__ */ Q(`div`,{class:`settings-page`,children:[/* @__PURE__ */ Q(`header`,{class:`settings-header`,children:[/* @__PURE__ */ Q(`div`,{class:`settings-heading`,children:[/* @__PURE__ */ Q(`h2`,{children:a.id===`overview`?zt.value?.name??a.label:a.label}),/* @__PURE__ */ Q(`span`,{class:`settings-scope`,children:Cf(a.id)})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,"aria-label":`Close settings`,onClick:o,children:/* @__PURE__ */ Q(Gu,{})})]}),/* @__PURE__ */ Q(`div`,{class:`settings-body`,children:/* @__PURE__ */ Q(wf,{id:a.id})})]})]})]})}function Sf({title:e,pages:t,current:n,onSelect:r}){return/* @__PURE__ */ Q(`div`,{class:`settings-nav-group`,children:[e&&/* @__PURE__ */ Q(`p`,{class:`settings-nav-title`,children:e}),t.map(e=>{let t=e.id===`about`&&sf.value;return/* @__PURE__ */ Q(`button`,{type:`button`,"data-page":e.id,class:`settings-nav-item${e.id===n?` active`:``}${e.id===`overview`?` settings-nav-project`:``}`,"aria-current":e.id===n?`page`:void 0,"aria-label":t?`${e.label} (update available)`:void 0,tabIndex:e.id===n?0:-1,onClick:()=>r(e.id),children:[/* @__PURE__ */ Q(`span`,{class:`settings-nav-label`,children:e.label}),t&&/* @__PURE__ */ Q(`span`,{class:`settings-nav-dot`})]},e.id)})]})}function Cf(e){switch(e){case`overview`:return zt.value?.root??``;case`agent`:case`tools`:return zt.value?`Saved for ${zt.value.name}, for everyone using its pins`:`Saved for this project`;case`appearance`:case`shortcuts`:return rn()?`Saved in this browser`:`Saved on this computer, for all your projects`;case`dock`:return`Saved in this browser, for this site`;case`account`:return`Saved in this browser`;default:return`Runs on this machine, for all your projects`}}function wf({id:e}){switch(e){case`overview`:return/* @__PURE__ */ Q(pf,{});case`agent`:return/* @__PURE__ */ Q(Tf,{});case`tools`:return/* @__PURE__ */ Q(Ef,{});case`appearance`:return/* @__PURE__ */ Q(Of,{});case`shortcuts`:return/* @__PURE__ */ Q(vf,{});case`dock`:return/* @__PURE__ */ Q(kf,{});case`account`:return/* @__PURE__ */ Q(Af,{});default:return/* @__PURE__ */ Q(uf,{})}}function Tf(){let e=R.value,t=L.value;return e?/* @__PURE__ */ Q(`div`,{class:`settings-section`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-label`,id:`tencil-provider-label`,children:`Agent for new pins`}),/* @__PURE__ */ Q(`fieldset`,{class:`settings-options`,"aria-labelledby":`tencil-provider-label`,children:e.providers.map(n=>{let r=n.id===e.provider;return/* @__PURE__ */ Q(`label`,{class:`target-option${r?` selected`:``}`,children:[/* @__PURE__ */ Q(`input`,{type:`radio`,name:`tencil-provider`,class:`settings-radio`,checked:r,onChange:()=>V({type:`settings.update`,provider:n.id})}),/* @__PURE__ */ Q(Pu,{agent:n.id,size:14,decorative:!0}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label}),r&&t?.id===n.id&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Pf(t)})]},n.id)})}),t&&t.id===e.provider&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Q(`p`,{class:`settings-status`,children:t.detail}),/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Pins you already made keep their agent.`})]}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:`Connecting…`})}function Ef(){let e=R.value;return e?/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(jf,{label:`Batch mode`,checked:e.batch,onChange:Kn,help:/* @__PURE__ */ Q(S,{children:[`Adds `,/* @__PURE__ */ Q(Xu,{}),` to the comment box to queue comments and send them together.`]})}),/* @__PURE__ */ Q(jf,{label:`Ruler`,checked:e.ruler,onChange:tr,help:/* @__PURE__ */ Q(S,{children:[`Adds `,/* @__PURE__ */ Q(Zu,{}),` to the toolbar.`,Mn.value.measure&&` With it on, hold ${Mn.value.measure} to measure spacing on the page.`]})})]}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:`Connecting…`})}let Df=[{id:`dark`,label:`Dark`},{id:`light`,label:`Light`},{id:`system`,label:`System`}];function Of(){return/* @__PURE__ */ Q(`div`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,id:`tencil-theme-label`,children:`Theme`}),/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:`Panels and the comment box. System follows your computer's setting.`})]}),/* @__PURE__ */ Q(`fieldset`,{class:`segmented settings-segmented`,"aria-labelledby":`tencil-theme-label`,children:Df.map(e=>/* @__PURE__ */ Q(`label`,{class:vr.value===e.id?`active`:void 0,children:[/* @__PURE__ */ Q(`input`,{type:`radio`,name:`tencil-theme`,checked:vr.value===e.id,onChange:()=>yr(e.id)}),e.label]},e.id))})]})}function kf(){return/* @__PURE__ */ Q(jf,{label:`Hide the dock`,checked:Yn.value,onChange:Zn,help:/* @__PURE__ */ Q(S,{children:[`Hides the toolbar, pins and panels on this site. Press`,` `,/* @__PURE__ */ Q(`kbd`,{children:Mn.value.hideDock}),` anywhere on the page to bring them back, or to hide them again.`]})})}function Af(){let e=wt.value;return e?/* @__PURE__ */ Q(`div`,{class:`settings-section settings-account`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:[`Signed in to Tencil Cloud as`,` `,/* @__PURE__ */ Q(`strong`,{children:e.login?`@${e.login}`:e.name})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>{Mt(an()),on()},children:`Sign out`})]}):null}function jf({label:e,help:t,checked:n,onChange:r}){return/* @__PURE__ */ Q(`label`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,children:e}),/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:t})]}),/* @__PURE__ */ Q(`input`,{type:`checkbox`,role:`switch`,class:`settings-switch`,checked:n,"aria-checked":n,onChange:e=>r(e.currentTarget.checked)})]})}function Mf(e){A(()=>{let t=bc().shadowRoot?.activeElement;return e.current?.querySelector(`.settings-nav-item.active`)?.focus(),()=>{t instanceof HTMLElement&&t.isConnected&&t.focus()}},[])}function Nf(e,t){let n=[...t.querySelectorAll(`button:not([disabled]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])`)].filter(e=>e.tabIndex>=0),r=n[0],i=n[n.length-1],a=bc().shadowRoot?.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r?.focus())}function Pf(e){switch(e.state){case`ready`:return`Ready`;case`unauthorized`:return e.canPair?`Not paired`:`Not signed in`;case`unavailable`:return`Unavailable`;default:return`Connecting…`}}function Ff({text:e,animate:t=!1}){let n=t?Bf(e):0;return/* @__PURE__ */ Q(`div`,{class:`md`,children:If(e,{index:0,animateFrom:t?n-48:1/0})})}function If(e,t){let n=[],r=e.replace(/\r\n/g,`
70
71
  `).split(`
71
- `),i=0,a=0;for(;i<r.length;){let e=r[i];if(e.match(/^\s*```(\w*)/)){let e=[];for(i++;i<r.length&&!/^\s*```/.test(r[i]);)e.push(r[i++]);i++,t.index+=_d(e.join(`
72
+ `),i=0,a=0;for(;i<r.length;){let e=r[i];if(e.match(/^\s*```(\w*)/)){let e=[];for(i++;i<r.length&&!/^\s*```/.test(r[i]);)e.push(r[i++]);i++,t.index+=Bf(e.join(`
72
73
  `)),n.push(/* @__PURE__ */ Q(`pre`,{children:/* @__PURE__ */ Q(`code`,{children:e.join(`
73
- `)})},a++));continue}if(/^\s*([-*]|\d+\.)\s+/.test(e)){let o=/^\s*\d+\./.test(e),s=[];for(;i<r.length&&/^\s*([-*]|\d+\.)\s+/.test(r[i]);)s.push(r[i++].replace(/^\s*([-*]|\d+\.)\s+/,``));let c=s.map((e,n)=>/* @__PURE__ */ Q(`li`,{children:hd(e,t)},n));n.push(Q(o?`ol`:`ul`,{children:c},a++));continue}let o=e.match(/^#{1,6}\s+(.*)/);if(o){n.push(/* @__PURE__ */ Q(`p`,{class:`md-heading`,children:hd(o[1],t)},a++)),i++;continue}if(!e.trim()){i++;continue}let s=[];for(;i<r.length&&r[i].trim()&&!/^\s*(```|[-*]\s|\d+\.\s|#{1,6}\s)/.test(r[i]);)s.push(r[i++]);n.push(/* @__PURE__ */ Q(`p`,{children:hd(s.join(` `),t)},a++))}return n}let md=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\))/g;function hd(e,t){return e.split(md).map((e,n)=>{if(e.startsWith("`")&&e.endsWith("`")&&e.length>1)return t.index+=_d(e),/* @__PURE__ */ Q(`code`,{children:e.slice(1,-1)},n);if(e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>3)return/* @__PURE__ */ Q(`strong`,{children:gd(e.slice(2,-2),t)},n);let r=e.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);return r&&/^https?:\/\//.test(r[2])?/* @__PURE__ */ Q(`a`,{href:r[2],target:`_blank`,rel:`noreferrer`,children:gd(r[1],t)},n):gd(e,t)})}function gd(e,t){return t.animateFrom===1/0?(t.index+=_d(e),e):e.split(/(\s+)/).map(e=>{if(!e||/^\s+$/.test(e))return e;let n=t.index++;return n>=t.animateFrom?/* @__PURE__ */ Q(`span`,{class:`w`,children:e},`w${n}`):e})}function _d(e){let t=e.match(/\S+/g);return t?t.length:0}function vd(){On.value;let e=q.value,t=e?B.value.get(e):void 0,n=j(null),[r,i]=A(320);if(Ne(()=>{n.current&&i(n.current.offsetHeight)}),!t)return null;let a=Dn.value,o=a?.threadId===t.id?a.point:t.anchor?Rs(t.anchor):null,{left:s,top:c,origin:l}=o?Vs(o,{width:380,height:r}):{left:window.innerWidth-380-(J.value?372:16),top:16,origin:`top right`};return/* @__PURE__ */ Q(`div`,{ref:n,class:`popover thread${o?``:` thread-docked`}`,style:{left:`${s}px`,top:`${c}px`,width:`380px`,transformOrigin:l},children:[/* @__PURE__ */ Q(bd,{thread:t}),t.status===`draft`?/* @__PURE__ */ Q(yd,{thread:t}):/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(xd,{thread:t},t.id),/* @__PURE__ */ Q(wd,{thread:t},t.id),/* @__PURE__ */ Q(Vu,{placeholder:Tt.value??(t.provider.threadId?`Reply…`:`Waiting for the agent…`),disabled:!t.provider.threadId||Tt.value!==null,onSubmit:e=>{H({type:`thread.reply`,threadId:t.id,text:e})},onCancel:()=>{q.value=null}})]})]})}function yd({thread:e}){let t=e.messages[0]?.text??``,n=Pn.value.length;return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`status-line status-queued`,children:[e.statusDetail?/* @__PURE__ */ Q(`span`,{class:`status-error`,children:[`Couldn't send: `,e.statusDetail]}):`Queued with ${n===1?`no other comments`:`${n-1} other ${n===2?`comment`:`comments`}`}`,/* @__PURE__ */ Q(`button`,{type:`button`,class:`stop`,onClick:_u,children:[`Send `,n===1?`it`:`all ${n}`,` now`]})]}),/* @__PURE__ */ Q(Vu,{initialText:t,placeholder:`What should change here?`,onSubmit:n=>{n!==t&&H({type:`thread.edit`,threadId:e.id,prompt:n}),q.value=null},onCancel:()=>{q.value=null}},`${e.id}:${t}`)]})}function bd({thread:e}){let t=e.context,n=t?.components[0],r=n?.source;return/* @__PURE__ */ Q(`div`,{class:`thread-header`,children:[/* @__PURE__ */ Q(`div`,{class:`thread-heading`,children:t?/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`span`,{class:`thread-number`,children:[`#`,gu.value.get(e.id)]}),/* @__PURE__ */ Q(`span`,{class:`chip`,title:t.selector,children:[/* @__PURE__ */ Q(lu,{}),n?.name??`<${t.tagName}>`]}),r&&/* @__PURE__ */ Q(`span`,{class:`thread-source`,title:r.file,children:[r.file.split(`/`).pop(),r.line?`:${r.line}`:``]})]}):/* @__PURE__ */ Q(`span`,{class:`thread-title`,title:e.title,children:e.title})}),/* @__PURE__ */ Q(`div`,{class:`thread-tools`,children:[e.provider.url&&/* @__PURE__ */ Q(`a`,{class:`icon-button`,href:e.provider.url,target:`_blank`,rel:`noreferrer`,title:`Open in ${cn(e.provider.id)}`,children:/* @__PURE__ */ Q(ou,{})}),e.status!==`draft`&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:e.resolved?`Reopen`:`Resolve`,onClick:()=>{H({type:`thread.resolve`,threadId:e.id,resolved:!e.resolved}),e.resolved||(q.value=null)},children:e.resolved?/* @__PURE__ */ Q(iu,{}):/* @__PURE__ */ Q(ru,{})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Delete pin (keeps the agent thread)`,onClick:()=>{H({type:`thread.delete`,threadId:e.id}),q.value=null},children:/* @__PURE__ */ Q(au,{})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:()=>{q.value=null},children:/* @__PURE__ */ Q(su,{})})]})]})}function xd({thread:e}){let t=j(null),n=j(null),r=j(!0),[i,a]=A(!1),o=e.messages[e.messages.length-1];return Ne(()=>{o?.role===`user`&&(r.current=!0)},[o?.id]),Ne(()=>{let e=t.current,i=n.current;if(!e||!i)return;let a=()=>{r.current&&(e.scrollTop=e.scrollHeight)};a();let o=new ResizeObserver(a);return o.observe(e),o.observe(i),()=>o.disconnect()},[]),/* @__PURE__ */ Q(`div`,{ref:t,class:`messages`,"data-scrolled":i||void 0,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<24,a(t.scrollTop>4)},children:/* @__PURE__ */ Q(`div`,{ref:n,class:`messages-list`,children:e.messages.map(e=>e.role===`user`?/* @__PURE__ */ Q(`div`,{class:`message message-user`,children:e.text},e.id):/* @__PURE__ */ Q(Sd,{message:e},e.id))})})}function Sd({message:e}){let[t]=A(e.streaming);return/* @__PURE__ */ Q(`div`,{class:`message message-assistant`,children:/* @__PURE__ */ Q(fd,{text:e.text,animate:t})})}function Cd({text:e}){let t=[...e];return/* @__PURE__ */ Q(`span`,{class:`shimmer`,children:[/* @__PURE__ */ Q(`span`,{class:`sr-only`,children:e}),t.map((e,n)=>/* @__PURE__ */ Q(`span`,{"aria-hidden":`true`,style:{"--i":n,"--n":t.length},children:e},n))]})}function wd({thread:e}){let[t,n]=A(!1),r=e.steps??[],i=r.length>0?{open:t,onToggle:()=>n(!t)}:void 0,a=e.status===`working`;return/* @__PURE__ */ Q(S,{children:[t&&r.length>0&&/* @__PURE__ */ Q(Ed,{steps:r,follow:a}),/* @__PURE__ */ Q(jd,{thread:e,steps:i}),i&&!a&&/* @__PURE__ */ Q(`div`,{class:`status-line`,children:/* @__PURE__ */ Q(Td,{...i,children:[r.filter(e=>!e.parentId).length,` steps`,kd(r)?` · ${kd(r)}`:``]})}),e.delivery&&!a&&/* @__PURE__ */ Q(Md,{delivery:e.delivery})]})}function Td({open:e,onToggle:t,children:n}){return/* @__PURE__ */ Q(`button`,{type:`button`,class:`steps-toggle${e?` open`:``}`,"aria-expanded":e,title:e?`Hide steps`:`Show steps`,onClick:t,children:[n,/* @__PURE__ */ Q(hu,{})]})}function Ed({steps:e,follow:t}){let n=j(null),r=j(!0);return Ne(()=>{let e=n.current;e&&t&&r.current&&(e.scrollTop=e.scrollHeight)}),/* @__PURE__ */ Q(`ol`,{ref:n,class:`steps`,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<16},children:e.map(e=>/* @__PURE__ */ Q(`li`,{class:`step step-${e.status}${e.parentId?` step-child`:``}`,title:e.detail?`${e.label}\n${e.detail}`:e.label,children:[/* @__PURE__ */ Q(`span`,{class:`step-mark`,children:e.status===`running`?/* @__PURE__ */ Q(`span`,{class:`live-dot`}):e.status===`done`?/* @__PURE__ */ Q(ru,{}):e.status===`failed`?/* @__PURE__ */ Q(su,{}):`–`}),/* @__PURE__ */ Q(`span`,{class:`step-label`,children:[e.label,e.detail&&/* @__PURE__ */ Q(`span`,{class:`step-detail`,children:e.detail})]}),e.endedAt&&/* @__PURE__ */ Q(`span`,{class:`step-time`,children:Od(e)})]},e.id))})}function Dd(e){return e.findLast(e=>e.status===`running`)}function Od(e){return e.endedAt?Ad((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3):``}function kd(e){let t=e[0],n=e.map(e=>e.endedAt).filter(e=>!!e);if(!t||n.length===0)return``;let r=n.reduce((e,t)=>e>t?e:t);return Ad((Date.parse(r)-Date.parse(t.startedAt))/1e3)}function Ad(e){return!Number.isFinite(e)||e<1?``:e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${String(Math.round(e%60)).padStart(2,`0`)}s`}function jd({thread:e,steps:t}){return e.status===`starting`?/* @__PURE__ */ Q(`div`,{class:`status-line`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),/* @__PURE__ */ Q(Cd,{text:`Starting a thread in ${cn(e.provider.id)}…`})]}):e.status===`working`?/* @__PURE__ */ Q(`div`,{class:`status-line`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),t?/* @__PURE__ */ Q(Td,{...t,children:/* @__PURE__ */ Q(Cd,{text:`${Dd(e.steps??[])?.label??`Working`}…`})}):/* @__PURE__ */ Q(Cd,{text:`Working…`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`stop`,onClick:()=>H({type:`thread.interrupt`,threadId:e.id}),children:[/* @__PURE__ */ Q(nu,{}),` Stop`]})]}):e.status===`waiting`?/* @__PURE__ */ Q(`div`,{class:`status-line status-waiting`,children:[e.statusDetail??`Waiting for input`,e.provider.url&&/* @__PURE__ */ Q(`a`,{href:e.provider.url,target:`_blank`,rel:`noreferrer`,children:`Open`})]}):e.status===`error`?/* @__PURE__ */ Q(`div`,{class:`status-line status-error`,children:e.statusDetail??`Something went wrong`}):null}function Md({delivery:e}){let t=e.pullRequest,n=t&&/* @__PURE__ */ Q(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,children:t.opened?`Opened #${t.number}`:`#${t.number}`}),r=e.commit&&/* @__PURE__ */ Q(`a`,{class:`delivery-commit`,href:e.commit.url,target:`_blank`,rel:`noreferrer`,children:e.commit.sha.slice(0,7)});switch(e.status){case`queued`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),/* @__PURE__ */ Q(Cd,{text:e.queuePosition?`Waiting, ${e.queuePosition} ahead on this branch`:`Waiting for the branch…`})]});case`pushed`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Q(`span`,{children:[`Pushed `,r]}),n]});case`deploying`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),/* @__PURE__ */ Q(Cd,{text:`Deploying the preview…`}),n]});case`live`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery delivery-live`,children:[/* @__PURE__ */ Q(`span`,{children:[`Live `,r]}),e.previewUrl?/* @__PURE__ */ Q(`a`,{href:e.previewUrl,children:`Open the new preview`}):n]});case`deploy-failed`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ Q(`span`,{children:[`Preview deploy failed `,r]}),e.logsUrl?/* @__PURE__ */ Q(`a`,{href:e.logsUrl,target:`_blank`,rel:`noreferrer`,children:`Logs`}):n]});case`no-changes`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery`,children:`No changes needed, nothing pushed`});case`failed`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ Q(`span`,{class:`delivery-detail`,title:e.detail,children:[`Couldn't push`,e.detail?`: ${e.detail}`:``]}),n]})}}let Nd=`tencil:dock`,Pd=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],Fd,Id=P(Ld());function Ld(){try{let e=localStorage.getItem(Nd);return e&&Pd.includes(e)?e:`bottom-center`}catch{return`bottom-center`}}function Rd(e){Id.value=e;try{localStorage.setItem(Nd,e)}catch{}}function zd(e,t,n,r){let i=e<n/3?`left`:e>n*2/3?`right`:`center`;return`${t<r/2?`top`:`bottom`}-${i}`}function Bd(e,t){if(e.button!==0)return;e.preventDefault();let n=e.currentTarget;try{n.setPointerCapture(e.pointerId)}catch{}let[r,i]=Wd(t);Fd?.(),t.style.transition=`none`,t.style.translate=`${r}px ${i}px`;let a=e.clientX,o=e.clientY,s=r!==0||i!==0,c=[],l=e=>{let n=e.clientX-a,l=e.clientY-o;!s&&Math.hypot(n,l)<3||(s=!0,t.dataset.dragging=``,t.style.translate=`${r+n}px ${i+l}px`,c=[...c.filter(t=>e.timeStamp-t.t<80),{x:e.clientX,y:e.clientY,t:e.timeStamp}])},u=e=>{if(n.removeEventListener(`pointermove`,l),n.removeEventListener(`pointerup`,u),n.removeEventListener(`pointercancel`,u),n.removeEventListener(`lostpointercapture`,u),window.removeEventListener(`dragstart`,Vd,!0),delete t.dataset.dragging,!s){t.style.translate=``,t.style.transition=``;return}c=c.filter(t=>e.timeStamp-t.t<80);let r=c[0],i=c[c.length-1],a=r&&i?Math.max(1,i.t-r.t):1,o=e=>Math.max(-2.5,Math.min(2.5,e/a)),d=r&&i?o(i.x-r.x):0,f=r&&i?o(i.y-r.y):0,p=Gd(t);Ud(t,p,zd(p.left+p.width/2+d*120,p.top+p.height/2+f*120,window.innerWidth,window.innerHeight))};n.addEventListener(`pointermove`,l),n.addEventListener(`pointerup`,u),n.addEventListener(`pointercancel`,u),n.addEventListener(`lostpointercapture`,u),window.addEventListener(`dragstart`,Vd,!0)}function Vd(e){e.preventDefault()}function Hd(e,t){let[n,r]=Id.value.split(`-`),i=[`left`,`center`,`right`],a=i.indexOf(r),o;return e===`ArrowLeft`&&a>0&&(o=`${n}-${i[a-1]}`),e===`ArrowRight`&&a<2&&(o=`${n}-${i[a+1]}`),e===`ArrowUp`&&n===`bottom`&&(o=`top-${r}`),e===`ArrowDown`&&n===`top`&&(o=`bottom-${r}`),o?(Rd(o),t.style.translate=``,!0):!1}function Ud(e,t,n){Rd(n);let r=0,i,a=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),Fd=void 0,e.style.transition=``,e.style.translate=``},o=t=>{t.target===e&&t.propertyName===`translate`&&a()};Fd=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),Fd=void 0},r=requestAnimationFrame(()=>{e.style.translate=``;let n=Gd(e);if(e.style.translate=`${t.left-n.left}px ${t.top-n.top}px`,matchMedia(`(prefers-reduced-motion: reduce)`).matches){a();return}r=requestAnimationFrame(()=>{e.style.transition=`translate 340ms cubic-bezier(0.32, 0.72, 0, 1)`,e.style.translate=`0px 0px`,e.addEventListener(`transitionend`,o),i=setTimeout(a,440)})})}function Wd(e){let t=getComputedStyle(e).translate;if(!t||t===`none`)return[0,0];let[n=`0`,r=`0`]=t.split(` `);return[Number.parseFloat(n)||0,Number.parseFloat(r)||0]}function Gd(e){return(e.querySelector(`.toolbar`)??e).getBoundingClientRect()}let Kd=P(null);function qd(){let e=()=>{let e=Yd(),t=Kd.value;Xd(e,t)||(Kd.value=e)};e();let t=setInterval(e,500);return window.addEventListener(`resize`,e,{passive:!0}),()=>{clearInterval(t),window.removeEventListener(`resize`,e)}}function Jd(e,t){return!t||e.endsWith(`center`)||zd((t.left+t.right)/2,(t.top+t.bottom)/2,window.innerWidth,window.innerHeight)!==e?{}:e.endsWith(`left`)?{left:`${t.right+8}px`}:{right:`${window.innerWidth-t.left+8}px`}}function Yd(){for(let e of document.querySelectorAll(`nextjs-portal`)){let t=e.shadowRoot?.getElementById(`devtools-indicator`);if(!t)continue;let n=t.getBoundingClientRect();if(n.width!==0&&n.height!==0)return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}return null}function Xd(e,t){return!e||!t?e===t:Math.round(e.left)===Math.round(t.left)&&Math.round(e.top)===Math.round(t.top)&&Math.round(e.right)===Math.round(t.right)&&Math.round(e.bottom)===Math.round(t.bottom)}let Zd=`npx tencil@latest setup`,Qd=F(()=>!$t()&&!!Bt.value?.latest&&Bt.value.state===`idle`),$d=P(!1);function ef(){let e=zt.value;if($t()||!e)return null;let t=Bt.value,n=t?.state===`installing`||t?.state===`waiting`||t?.state===`restarting`,r=Vt.value;return/* @__PURE__ */ Q(`section`,{class:`settings-section settings-about`,"aria-label":`About Tencil`,children:[/* @__PURE__ */ Q(`div`,{class:`settings-about-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,children:`Tencil`}),/* @__PURE__ */ Q(`span`,{class:`settings-version`,children:[`v`,e]})]}),r&&r!==e&&!t?.latest&&/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Updated from v`,r,`.`]}),t?.latest&&/* @__PURE__ */ Q(`div`,{class:`settings-update`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[/* @__PURE__ */ Q(`strong`,{children:[`Tencil `,t.latest,` is available.`]}),` `,/* @__PURE__ */ Q(`a`,{href:`https://github.com/tencildev/tencil/blob/master/packages/tencil/CHANGELOG.md`,target:`_blank`,rel:`noreferrer`,children:`What's new`})]}),n&&/* @__PURE__ */ Q(`p`,{class:`settings-help settings-progress`,children:tf(t)}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action settings-update-button`,disabled:n,onClick:()=>H({type:`update.start`}),children:n?`Updating…`:t.state===`failed`?`Try again`:`Update`})]}),t?.state===`failed`&&/* @__PURE__ */ Q(`div`,{class:`settings-update-error`,role:`alert`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Couldn't update`,t.error?`: ${t.error}`:`.`,` Tencil `,e,` `,`is still running. Update from a terminal instead:`]}),/* @__PURE__ */ Q(`div`,{class:`settings-command`,children:[/* @__PURE__ */ Q(`code`,{children:Zd}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(Zd).then(()=>{$d.value=!0,setTimeout(()=>{$d.value=!1},1500)})},children:$d.value?`Copied`:`Copy`})]})]})]})}function tf(e){switch(e.state){case`installing`:return`Installing Tencil ${e.latest}…`;case`waiting`:{let t=e.running??1;return`Waiting for ${t} running ${t===1?`thread`:`threads`} to finish…`}default:return`Restarting on Tencil ${e.latest}…`}}function nf(){let[e,t]=A(``),n=Gt.value??[],r=e.trim().toLowerCase(),i=r?n.filter(e=>e.title.toLowerCase().includes(r)||e.root.toLowerCase().includes(r)):n,a=e=>H({type:`project.select`,root:e});return/* @__PURE__ */ Q(`div`,{class:`project-picker`,children:[/* @__PURE__ */ Q(`p`,{class:`project-picker-title`,children:`Which project is this page?`}),n.length===0?/* @__PURE__ */ Q(`p`,{class:`project-picker-empty`,children:Kt.value??`No projects found.`}):/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`input`,{class:`project-picker-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,autoFocus:!0,value:e,onInput:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i[0]&&a(i[0].root)}}),/* @__PURE__ */ Q(`div`,{class:`project-picker-list`,children:[i.length===0&&/* @__PURE__ */ Q(`p`,{class:`project-picker-empty`,children:[`No project matches “`,e.trim(),`”.`]}),i.map(e=>/* @__PURE__ */ Q(`button`,{type:`button`,class:`project-picker-option`,title:e.root,onClick:()=>a(e.root),children:[/* @__PURE__ */ Q(`span`,{class:`project-picker-name`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`project-picker-root`,children:e.root})]},e.root))]})]})]})}function rf(){if(!pn.value)return null;let e=z.value,t=R.value,n=()=>{pn.value=!1};return/* @__PURE__ */ Q(`section`,{class:`settings-panel`,role:`dialog`,"aria-label":`Project settings`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),n())},children:[/* @__PURE__ */ Q(`header`,{class:`settings-header`,children:[/* @__PURE__ */ Q(`div`,{class:`settings-heading`,children:[/* @__PURE__ */ Q(`strong`,{children:`Settings`}),Rt.value&&/* @__PURE__ */ Q(`span`,{class:`settings-project`,children:Rt.value.name})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:n,children:/* @__PURE__ */ Q(su,{})})]}),e?/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`settings-section`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-label`,id:`tencil-provider-label`,children:`Agent for new pins`}),/* @__PURE__ */ Q(`fieldset`,{class:`settings-options`,"aria-labelledby":`tencil-provider-label`,children:e.providers.map(n=>{let r=n.id===e.provider;return/* @__PURE__ */ Q(`label`,{class:`target-option${r?` selected`:``}`,children:[/* @__PURE__ */ Q(`input`,{type:`radio`,name:`tencil-provider`,class:`settings-radio`,checked:r,onChange:()=>H({type:`settings.update`,provider:n.id})}),/* @__PURE__ */ Q(Xl,{agent:n.id,size:14,decorative:!0}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label}),r&&t?.id===n.id&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:af(t)})]},n.id)})}),t&&t.id===e.provider&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Q(`p`,{class:`settings-status`,children:t.detail}),/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Pins you already made keep their agent.`})]}),/* @__PURE__ */ Q(`label`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,children:`Batch mode`}),/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:[`Adds `,/* @__PURE__ */ Q(fu,{}),` to the comment box to queue comments and send them together.`]})]}),/* @__PURE__ */ Q(`input`,{type:`checkbox`,role:`switch`,class:`settings-switch`,checked:e.batch,"aria-checked":e.batch,onChange:e=>yn(e.currentTarget.checked)})]}),/* @__PURE__ */ Q(`label`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,children:`Ruler`}),/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:[`Adds `,/* @__PURE__ */ Q(pu,{}),` to the toolbar. With it on, hold `,Jo,` to measure spacing on the page.`]})]}),/* @__PURE__ */ Q(`input`,{type:`checkbox`,role:`switch`,class:`settings-switch`,checked:e.ruler,"aria-checked":e.ruler,onChange:e=>wn(e.currentTarget.checked)})]})]}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:`Connecting…`}),/* @__PURE__ */ Q(ef,{}),I.value&&/* @__PURE__ */ Q(`div`,{class:`settings-section settings-account`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:[`Signed in to Tencil Cloud as`,` `,/* @__PURE__ */ Q(`strong`,{children:I.value.login?`@${I.value.login}`:I.value.name})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>{jt(en()),tn()},children:`Sign out`})]})]})}function af(e){switch(e.state){case`ready`:return`Ready`;case`unauthorized`:return e.canPair?`Not paired`:`Not signed in`;case`unavailable`:return`Unavailable`;default:return`Connecting…`}}function of({tone:e,label:t}){let[n,r]=A(!1),i=j(void 0);Me(()=>()=>clearTimeout(i.current),[]);let a=e=>{clearTimeout(i.current),i.current=setTimeout(()=>r(!0),e)},o=()=>{clearTimeout(i.current),r(!1)};return/* @__PURE__ */ Q(`span`,{class:`status`,onPointerEnter:()=>a(250),onPointerLeave:o,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`status-button`,"aria-label":`Tencil status: ${t}`,"aria-expanded":n,"aria-describedby":n?`tencil-status-card`:void 0,onFocus:()=>a(0),onBlur:o,onClick:()=>n?o():a(0),children:/* @__PURE__ */ Q(`span`,{class:`status-dot status-${e}`,children:Fn.value>0&&/* @__PURE__ */ Q(`span`,{class:`status-ping`})})}),n&&/* @__PURE__ */ Q(sf,{tone:e})]})}function sf({tone:e}){let t=R.value,n=L.value,r=Pn.value.length,i=Fn.value;return/* @__PURE__ */ Q(`div`,{class:`status-card`,role:`tooltip`,id:`tencil-status-card`,children:[/* @__PURE__ */ Q(`div`,{class:`status-card-head`,children:[/* @__PURE__ */ Q(du,{size:18}),/* @__PURE__ */ Q(`strong`,{children:`Tencil`}),zt.value&&/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:[`v`,zt.value]})]}),/* @__PURE__ */ Q(`dl`,{class:`status-card-rows`,children:[/* @__PURE__ */ Q(cf,{label:$t()?`Tencil Cloud`:`Daemon`,children:[/* @__PURE__ */ Q(`span`,{class:`status-card-tone tone-${n===`open`?`ok`:e}`}),n===`open`?`Connected`:n===`connecting`?`Connecting…`:`Offline`]}),/* @__PURE__ */ Q(cf,{label:`Address`,children:rn()}),/* @__PURE__ */ Q(cf,{label:`Project`,children:Gt.value?`Not picked yet`:Rt.value?/* @__PURE__ */ Q(`span`,{title:Rt.value.root,children:Rt.value.name}):`…`}),/* @__PURE__ */ Q(cf,{label:`Agent`,children:t?/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`span`,{class:`status-card-tone tone-${t.state===`ready`?`ok`:e}`}),t.label,/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:af(t)})]}):`…`}),t?.target&&/* @__PURE__ */ Q(cf,{label:`Workspace`,children:t.target}),I.value&&/* @__PURE__ */ Q(cf,{label:`Signed in`,children:[I.value.login?`@${I.value.login}`:I.value.name,I.value.access===`read`&&/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:`view only`})]}),(i>0||r>0)&&/* @__PURE__ */ Q(cf,{label:`Pins`,children:[i>0&&`${i} working`,r>0&&`${r} queued`].filter(Boolean).join(` · `)})]}),t&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Q(`p`,{class:`status-card-detail`,children:t.detail})]})}function cf({label:e,children:t}){return/* @__PURE__ */ Q(`div`,{class:`status-card-row`,children:[/* @__PURE__ */ Q(`dt`,{children:e}),/* @__PURE__ */ Q(`dd`,{children:t})]})}function lf(){let e=df(),t=U.value===`picking`,n=j(null);return/* @__PURE__ */ Q(`div`,{ref:n,class:`toolbar-wrap dock-${Id.value}`,style:Jd(Id.value,Kd.value),children:[t&&/* @__PURE__ */ Q(`div`,{class:`toolbar-hint`,children:[`Click any element to pin a prompt`,Cn.value&&` · ${Jo} to measure`,` · Esc to cancel`]}),!t&&/* @__PURE__ */ Q(rf,{}),!t&&Gt.value&&/* @__PURE__ */ Q(nf,{}),!t&&!Gt.value&&e.hint&&/* @__PURE__ */ Q(`div`,{class:`toolbar-hint hint-${e.tone}`,children:[e.hint,e.action&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:e.action.run,children:e.action.label})]}),!t&&!e.hint&&G.value&&!K.value&&/* @__PURE__ */ Q(`div`,{class:`toolbar-hint`,children:[`Hold `,Jo,` and hover to measure · C to comment · Esc to clear`]}),/* @__PURE__ */ Q(`div`,{class:`toolbar`,children:[/* @__PURE__ */ Q(of,{tone:e.tone,label:e.title}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`divider`,"aria-label":`Move toolbar (drag, or use arrow keys)`,title:`Drag to move`,onPointerDown:e=>n.current&&Bd(e,n.current),onKeyDown:e=>{n.current&&Hd(e.key,n.current)&&e.preventDefault()}}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${t?` tool-active`:``}`,title:Tt.value??`Comment (C)`,disabled:Tt.value!==null,onClick:()=>t?Ln():In(),children:[/* @__PURE__ */ Q(Zl,{}),/* @__PURE__ */ Q(`span`,{class:`tool-label`,children:`Comment`}),/* @__PURE__ */ Q(`kbd`,{children:`C`})]}),xn.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${Sn.value?``:` tool-off`}`,title:Sn.value?`Ruler on (R): hold ${Jo} to measure`:`Ruler off (R)`,"aria-label":`Ruler`,"aria-pressed":Sn.value,onClick:Tn,children:Sn.value?/* @__PURE__ */ Q(pu,{}):/* @__PURE__ */ Q(mu,{})}),Pn.value.length>0&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool tool-send`,title:`Send the queued comments to the agent as one thread`,disabled:R.value?.state!==`ready`,onClick:_u,children:[/* @__PURE__ */ Q(tu,{}),/* @__PURE__ */ Q(`span`,{class:`tool-label`,children:[`Send `,Pn.value.length]})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${J.value?` tool-active`:``}`,title:`Pins`,onClick:()=>{J.value=!J.value,pn.value=!1},children:[/* @__PURE__ */ Q(Ql,{}),Nn.value>0&&/* @__PURE__ */ Q(`span`,{class:`badge`,children:Nn.value})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool`,title:hn.value?`Show pins`:`Hide pins`,onClick:()=>{hn.value=!hn.value,hn.value&&Ln()},children:hn.value?/* @__PURE__ */ Q($l,{}):/* @__PURE__ */ Q(eu,{})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${pn.value?` tool-active`:``}`,title:`Project settings`,"aria-label":Qd.value?`Project settings (update available)`:void 0,disabled:!Rt.value,onClick:()=>{pn.value=!pn.value,J.value=!1},children:[/* @__PURE__ */ Q(uu,{}),Qd.value&&/* @__PURE__ */ Q(`span`,{class:`tool-dot`})]})]})]})}let uf={label:`Switch agent`,run:()=>{pn.value=!0,J.value=!1}};function df(){if(L.value!==`open`)return $t()?{tone:`error`,title:`Tencil Cloud unreachable`,hint:L.value===`connecting`?void 0:`Can't reach Tencil Cloud. Retrying…`}:{tone:`error`,title:`Tencil daemon offline`,hint:L.value===`connecting`?void 0:`The Tencil daemon stopped. Start it again with npx tencil start.`};let e=Ct.value;if(e)return{tone:`warn`,title:`Sign in to Tencil Cloud`,hint:e.reason??`Sign in with GitHub to pin on this preview`,action:wt.value?void 0:{label:`Sign in`,run:()=>ff(e.signIn)}};if(Gt.value)return{tone:`warn`,title:`Pick this page's project`};let t=R.value;if(!t)return{tone:`warn`,title:`Connecting…`};switch(t.state){case`ready`:return{tone:`ok`,title:`${t.label}${t.target?` · ${t.target}`:``}`};case`unauthorized`:return t.canPair?{tone:`warn`,title:`${t.label}: not paired`,hint:`Not paired with ${t.label}`,action:{label:`Pair`,run:()=>H({type:`provider.pair`})}}:{tone:`warn`,title:`${t.label}: not signed in`,hint:t.detail??`Sign in to ${t.label}`,action:uf};case`unavailable`:return{tone:`error`,title:t.detail??`${t.label} unavailable`,hint:t.detail??`${t.label} is unavailable`,action:uf};default:return{tone:`warn`,title:`Connecting to ${t.label}…`}}}function ff(e){Mt(en(),e).then(tn,e=>{qt.value={message:e instanceof Error?e.message:String(e),at:Date.now()}})}function pf(){return hf(),/* @__PURE__ */ Q(`div`,{class:`root${U.value===`picking`?` picking`:``}`,children:[/* @__PURE__ */ Q(Zu,{}),/* @__PURE__ */ Q(od,{}),/* @__PURE__ */ Q(vu,{}),/* @__PURE__ */ Q(Uu,{}),/* @__PURE__ */ Q(vd,{}),/* @__PURE__ */ Q(ju,{}),/* @__PURE__ */ Q(mf,{}),/* @__PURE__ */ Q(lf,{})]})}function mf(){let e=qt.value,[t,n]=A(!1);return Me(()=>{if(!e)return;n(!0);let t=setTimeout(()=>n(!1),5e3);return()=>clearTimeout(t)},[e?.at]),!e||!t?null:/* @__PURE__ */ Q(`div`,{class:`toast`,children:e.message})}function hf(){let e=B.value;Me(()=>{let t=sessionStorage.getItem(Au);if(!t)return;let n=e.get(t);n&&(sessionStorage.removeItem(Au),q.value=t,Lu(n))},[e])}let gf=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`dblclick`,`contextmenu`,`auxclick`];function _f(e){let t=t=>t.composedPath().includes(e),n=(t,n)=>{for(let r of document.elementsFromPoint(t,n)){if(r===e||e.contains(r))return null;if(r!==document.documentElement)return r}return null},r=()=>U.value===`picking`||W.value&&Cn.value,i=null,a=null,o=()=>{if(!r()){fn.value&&=null;return}fn.value=!i||i.ours?null:n(i.x,i.y);let e=G.value?.element;e&&fn.value&&fn.value!==e&&(a=fn.value)},s=(e,t,n)=>{Ln(),G.value=null,K.value={element:e,label:fs(e),anchor:{selector:``,...t},context:ds(e),...n?{measuredTo:{...n,label:fs(n.element)}}:{}}},c=e=>{i={x:e.clientX,y:e.clientY,ours:t(e)},W.value=e.altKey,o()},l=e=>{e.key===`Alt`&&(W.value=e.type===`keydown`,Cn.value&&e.preventDefault(),o())},u=()=>{W.value=!1,o()},d=e=>{if(!r()&&e.type===`pointerdown`&&!t(e)){pn.value=!1,(q.value?B.value.get(q.value):void 0)?.anchor&&(q.value=null);return}r()&&!t(e)&&(e.preventDefault(),e.stopImmediatePropagation())},f=i=>{if(!r()||t(i))return;i.preventDefault(),i.stopImmediatePropagation();let o=n(i.clientX,i.clientY);if(!o)return;let c=zs(o,{x:i.clientX,y:i.clientY});if(U.value!==`picking`){let t=K.value;if(t)K.value={...t,measuredTo:o===t.element?void 0:{element:o,label:fs(o),parent:!1}};else{let t=G.value?.element===o;G.value=t?null:{element:o,offsets:c},a=null;let n=e.shadowRoot?.activeElement;n instanceof HTMLElement&&n.blur()}return}let l=o.parentElement,u=i.altKey&&Cn.value&&l&&l!==document.documentElement;s(o,c,u?{element:l,parent:!0}:void 0)},p=e=>{if(t(e))return;if(e.key===`Escape`){if(U.value===`picking`)Ln();else if(K.value)K.value=null;else if(G.value)G.value=null;else if(q.value)q.value=null;else if(J.value)J.value=!1;else return;e.preventDefault();return}if(vf(e))return;let n=!e.metaKey&&!e.ctrlKey&&!e.altKey;if(e.key.toLowerCase()===`r`&&n&&xn.value){e.preventDefault(),Tn();return}if(e.key.toLowerCase()===`c`&&n){e.preventDefault(),hn.value=!1;let t=G.value;if(U.value===`picking`)Ln();else if(t?.element.isConnected&&!K.value){let e=a?.isConnected?a:null;s(t.element,t.offsets,e?{element:e,parent:!1}:void 0)}else In()}},m=0,h=()=>{m||=requestAnimationFrame(()=>{m=0,On.value++})},g=new MutationObserver(t=>{t.every(t=>e.contains(t.target)||t.target===e)||h()});g.observe(document.body,{childList:!0,subtree:!0,attributes:!0});let _=setInterval(()=>{let e=An(location.href);e!==kn.value&&(kn.value=e,K.value=null,G.value=null,q.value=null)},400);window.addEventListener(`pointermove`,c,{capture:!0,passive:!0});for(let e of gf)window.addEventListener(e,d,!0);return window.addEventListener(`click`,f,!0),window.addEventListener(`keydown`,p,!0),window.addEventListener(`keydown`,l,!0),window.addEventListener(`keyup`,l,!0),window.addEventListener(`blur`,u),window.addEventListener(`scroll`,h,{capture:!0,passive:!0}),window.addEventListener(`resize`,h,{passive:!0}),()=>{window.removeEventListener(`pointermove`,c,!0);for(let e of gf)window.removeEventListener(e,d,!0);window.removeEventListener(`click`,f,!0),window.removeEventListener(`keydown`,p,!0),window.removeEventListener(`keydown`,l,!0),window.removeEventListener(`keyup`,l,!0),window.removeEventListener(`blur`,u),window.removeEventListener(`scroll`,h,!0),window.removeEventListener(`resize`,h),g.disconnect(),clearInterval(_),cancelAnimationFrame(m)}}function vf(e){let t=e.composedPath()[0];return t instanceof HTMLElement?t.isContentEditable||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement:!1}function yf(){let e=document.currentScript;return e?.dataset.bridge?e.dataset.bridge:e?.src?new URL(e.src).origin:`http://localhost:4747`}function bf(){let e=document.currentScript;if(e?.src)return new URL(e.src).searchParams.get(`root`)??void 0}function xf(){let e=document.currentScript?.dataset;if(e?.tencilProject&&e.tencilRepo&&e.tencilBranch&&e.tencilSha)return{projectKey:e.tencilProject,repo:e.tencilRepo,branch:e.tencilBranch,sha:e.tencilSha}}function Sf(){try{CSS.registerProperty({name:`--tencil-rim`,syntax:`<angle>`,inherits:!1,initialValue:`0deg`})}catch{}}function Cf(e,t,n){Sf();let r=document.createElement(`tencil-overlay`);r.setAttribute(`data-tencil`,``),r.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483646;display:block;contain:layout style;`;let i=r.attachShadow({mode:`open`}),a=document.createElement(`style`);a.textContent=`
74
+ `)})},a++));continue}if(/^\s*([-*]|\d+\.)\s+/.test(e)){let o=/^\s*\d+\./.test(e),s=[];for(;i<r.length&&/^\s*([-*]|\d+\.)\s+/.test(r[i]);)s.push(r[i++].replace(/^\s*([-*]|\d+\.)\s+/,``));let c=s.map((e,n)=>/* @__PURE__ */ Q(`li`,{children:Rf(e,t)},n));n.push(Q(o?`ol`:`ul`,{children:c},a++));continue}let o=e.match(/^#{1,6}\s+(.*)/);if(o){n.push(/* @__PURE__ */ Q(`p`,{class:`md-heading`,children:Rf(o[1],t)},a++)),i++;continue}if(!e.trim()){i++;continue}let s=[];for(;i<r.length&&r[i].trim()&&!/^\s*(```|[-*]\s|\d+\.\s|#{1,6}\s)/.test(r[i]);)s.push(r[i++]);n.push(/* @__PURE__ */ Q(`p`,{children:Rf(s.join(` `),t)},a++))}return n}let Lf=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\))/g;function Rf(e,t){return e.split(Lf).map((e,n)=>{if(e.startsWith("`")&&e.endsWith("`")&&e.length>1)return t.index+=Bf(e),/* @__PURE__ */ Q(`code`,{children:e.slice(1,-1)},n);if(e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>3)return/* @__PURE__ */ Q(`strong`,{children:zf(e.slice(2,-2),t)},n);let r=e.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);return r&&/^https?:\/\//.test(r[2])?/* @__PURE__ */ Q(`a`,{href:r[2],target:`_blank`,rel:`noreferrer`,children:zf(r[1],t)},n):zf(e,t)})}function zf(e,t){return t.animateFrom===1/0?(t.index+=Bf(e),e):e.split(/(\s+)/).map(e=>{if(!e||/^\s+$/.test(e))return e;let n=t.index++;return n>=t.animateFrom?/* @__PURE__ */ Q(`span`,{class:`w`,children:e},`w${n}`):e})}function Bf(e){let t=e.match(/\S+/g);return t?t.length:0}function Vf(){or.value;let e=K.value,t=e?z.value.get(e):void 0,n=j(null),[r,i]=k(320);if(Ne(()=>{n.current&&i(n.current.offsetHeight)}),!t)return null;let a=ar.value,o=a?.threadId===t.id?a.point:t.anchor?Sc(t.anchor):null,{left:s,top:c,origin:l}=o?Tc(o,{width:380,height:r}):{left:window.innerWidth-380-(q.value?372:16),top:16,origin:`top right`};return/* @__PURE__ */ Q(`div`,{ref:n,class:`popover thread${o?``:` thread-docked`}`,style:{left:`${s}px`,top:`${c}px`,width:`380px`,transformOrigin:l},children:[/* @__PURE__ */ Q(Uf,{thread:t}),t.status===`draft`?/* @__PURE__ */ Q(Hf,{thread:t}):/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(Wf,{thread:t},t.id),/* @__PURE__ */ Q(qf,{thread:t},t.id),/* @__PURE__ */ Q(Dd,{placeholder:Et.value??(t.provider.threadId?`Reply…`:`Waiting for the agent…`),disabled:!t.provider.threadId||Et.value!==null,onSubmit:e=>{V({type:`thread.reply`,threadId:t.id,text:e})},onCancel:()=>{K.value=null}})]})]})}function Hf({thread:e}){let t=e.messages[0]?.text??``,n=fr.value.length;return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`status-line status-queued`,children:[e.statusDetail?/* @__PURE__ */ Q(`span`,{class:`status-error`,children:[`Couldn't send: `,e.statusDetail]}):`Queued with ${n===1?`no other comments`:`${n-1} other ${n===2?`comment`:`comments`}`}`,/* @__PURE__ */ Q(`button`,{type:`button`,class:`stop`,onClick:rd,children:[`Send `,n===1?`it`:`all ${n}`,` now`]})]}),/* @__PURE__ */ Q(Dd,{initialText:t,placeholder:`What should change here?`,onSubmit:n=>{n!==t&&V({type:`thread.edit`,threadId:e.id,prompt:n}),K.value=null},onCancel:()=>{K.value=null}},`${e.id}:${t}`)]})}function Uf({thread:e}){let t=e.context,n=t?.components[0],r=n?.source;return/* @__PURE__ */ Q(`div`,{class:`thread-header`,children:[/* @__PURE__ */ Q(`div`,{class:`thread-heading`,children:t?/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`span`,{class:`thread-number`,children:[`#`,nd.value.get(e.id)]}),/* @__PURE__ */ Q(`span`,{class:`chip`,title:t.selector,children:[/* @__PURE__ */ Q(qu,{}),n?.name??`<${t.tagName}>`]}),r&&/* @__PURE__ */ Q(`span`,{class:`thread-source`,title:r.file,children:[r.file.split(`/`).pop(),r.line?`:${r.line}`:``]})]}):/* @__PURE__ */ Q(`span`,{class:`thread-title`,title:e.title,children:e.title})}),/* @__PURE__ */ Q(`div`,{class:`thread-tools`,children:[e.provider.url&&/* @__PURE__ */ Q(`a`,{class:`icon-button`,href:e.provider.url,target:`_blank`,rel:`noreferrer`,title:`Open in ${fn(e.provider.id)}`,children:/* @__PURE__ */ Q(Wu,{})}),e.status!==`draft`&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:e.resolved?`Reopen`:`Resolve`,onClick:()=>{V({type:`thread.resolve`,threadId:e.id,resolved:!e.resolved}),e.resolved||(K.value=null)},children:e.resolved?/* @__PURE__ */ Q(Hu,{}):/* @__PURE__ */ Q(Vu,{})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Delete pin (keeps the agent thread)`,onClick:()=>{V({type:`thread.delete`,threadId:e.id}),K.value=null},children:/* @__PURE__ */ Q(Uu,{})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:()=>{K.value=null},children:/* @__PURE__ */ Q(Gu,{})})]})]})}function Wf({thread:e}){let t=j(null),n=j(null),r=j(!0),[i,a]=k(!1),o=e.messages[e.messages.length-1];return Ne(()=>{o?.role===`user`&&(r.current=!0)},[o?.id]),Ne(()=>{let e=t.current,i=n.current;if(!e||!i)return;let a=()=>{r.current&&(e.scrollTop=e.scrollHeight)};a();let o=new ResizeObserver(a);return o.observe(e),o.observe(i),()=>o.disconnect()},[]),/* @__PURE__ */ Q(`div`,{ref:t,class:`messages`,"data-scrolled":i||void 0,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<24,a(t.scrollTop>4)},children:/* @__PURE__ */ Q(`div`,{ref:n,class:`messages-list`,children:e.messages.map(e=>e.role===`user`?/* @__PURE__ */ Q(`div`,{class:`message message-user`,children:e.text},e.id):/* @__PURE__ */ Q(Gf,{message:e},e.id))})})}function Gf({message:e}){let[t]=k(e.streaming);return/* @__PURE__ */ Q(`div`,{class:`message message-assistant`,children:/* @__PURE__ */ Q(Ff,{text:e.text,animate:t})})}function Kf({text:e}){let t=[...e];return/* @__PURE__ */ Q(`span`,{class:`shimmer`,children:[/* @__PURE__ */ Q(`span`,{class:`sr-only`,children:e}),t.map((e,n)=>/* @__PURE__ */ Q(`span`,{"aria-hidden":`true`,style:{"--i":n,"--n":t.length},children:e},n))]})}function qf({thread:e}){let[t,n]=k(!1),r=e.steps??[],i=r.length>0?{open:t,onToggle:()=>n(!t)}:void 0,a=e.status===`working`;return/* @__PURE__ */ Q(S,{children:[t&&r.length>0&&/* @__PURE__ */ Q(Yf,{steps:r,follow:a}),/* @__PURE__ */ Q(ep,{thread:e,steps:i}),i&&!a&&/* @__PURE__ */ Q(`div`,{class:`status-line`,children:/* @__PURE__ */ Q(Jf,{...i,children:[r.filter(e=>!e.parentId).length,` steps`,Qf(r)?` · ${Qf(r)}`:``]})}),e.delivery&&!a&&/* @__PURE__ */ Q(tp,{delivery:e.delivery})]})}function Jf({open:e,onToggle:t,children:n}){return/* @__PURE__ */ Q(`button`,{type:`button`,class:`steps-toggle${e?` open`:``}`,"aria-expanded":e,title:e?`Hide steps`:`Show steps`,onClick:t,children:[n,/* @__PURE__ */ Q($u,{})]})}function Yf({steps:e,follow:t}){let n=j(null),r=j(!0);return Ne(()=>{let e=n.current;e&&t&&r.current&&(e.scrollTop=e.scrollHeight)}),/* @__PURE__ */ Q(`ol`,{ref:n,class:`steps`,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<16},children:e.map(e=>/* @__PURE__ */ Q(`li`,{class:`step step-${e.status}${e.parentId?` step-child`:``}`,title:e.detail?`${e.label}\n${e.detail}`:e.label,children:[/* @__PURE__ */ Q(`span`,{class:`step-mark`,children:e.status===`running`?/* @__PURE__ */ Q(`span`,{class:`live-dot`}):e.status===`done`?/* @__PURE__ */ Q(Vu,{}):e.status===`failed`?/* @__PURE__ */ Q(Gu,{}):`–`}),/* @__PURE__ */ Q(`span`,{class:`step-label`,children:[e.label,e.detail&&/* @__PURE__ */ Q(`span`,{class:`step-detail`,children:e.detail})]}),e.endedAt&&/* @__PURE__ */ Q(`span`,{class:`step-time`,children:Zf(e)})]},e.id))})}function Xf(e){return e.findLast(e=>e.status===`running`)}function Zf(e){return e.endedAt?$f((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3):``}function Qf(e){let t=e[0],n=e.map(e=>e.endedAt).filter(e=>!!e);if(!t||n.length===0)return``;let r=n.reduce((e,t)=>e>t?e:t);return $f((Date.parse(r)-Date.parse(t.startedAt))/1e3)}function $f(e){return!Number.isFinite(e)||e<1?``:e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${String(Math.round(e%60)).padStart(2,`0`)}s`}function ep({thread:e,steps:t}){return e.status===`starting`?/* @__PURE__ */ Q(`div`,{class:`status-line`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),/* @__PURE__ */ Q(Kf,{text:`Starting a thread in ${fn(e.provider.id)}…`})]}):e.status===`working`?/* @__PURE__ */ Q(`div`,{class:`status-line`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),t?/* @__PURE__ */ Q(Jf,{...t,children:/* @__PURE__ */ Q(Kf,{text:`${Xf(e.steps??[])?.label??`Working`}…`})}):/* @__PURE__ */ Q(Kf,{text:`Working…`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`stop`,onClick:()=>V({type:`thread.interrupt`,threadId:e.id}),children:[/* @__PURE__ */ Q(Bu,{}),` Stop`]})]}):e.status===`waiting`?/* @__PURE__ */ Q(`div`,{class:`status-line status-waiting`,children:[e.statusDetail??`Waiting for input`,e.provider.url&&/* @__PURE__ */ Q(`a`,{href:e.provider.url,target:`_blank`,rel:`noreferrer`,children:`Open`})]}):e.status===`error`?/* @__PURE__ */ Q(`div`,{class:`status-line status-error`,children:e.statusDetail??`Something went wrong`}):null}function tp({delivery:e}){let t=e.pullRequest,n=t&&/* @__PURE__ */ Q(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,children:t.opened?`Opened #${t.number}`:`#${t.number}`}),r=e.commit&&/* @__PURE__ */ Q(`a`,{class:`delivery-commit`,href:e.commit.url,target:`_blank`,rel:`noreferrer`,children:e.commit.sha.slice(0,7)});switch(e.status){case`queued`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),/* @__PURE__ */ Q(Kf,{text:e.queuePosition?`Waiting, ${e.queuePosition} ahead on this branch`:`Waiting for the branch…`})]});case`pushed`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Q(`span`,{children:[`Pushed `,r]}),n]});case`deploying`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),/* @__PURE__ */ Q(Kf,{text:`Deploying the preview…`}),n]});case`live`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery delivery-live`,children:[/* @__PURE__ */ Q(`span`,{children:[`Live `,r]}),e.previewUrl?/* @__PURE__ */ Q(`a`,{href:e.previewUrl,children:`Open the new preview`}):n]});case`deploy-failed`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ Q(`span`,{children:[`Preview deploy failed `,r]}),e.logsUrl?/* @__PURE__ */ Q(`a`,{href:e.logsUrl,target:`_blank`,rel:`noreferrer`,children:`Logs`}):n]});case`no-changes`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery`,children:`No changes needed, nothing pushed`});case`failed`:return/* @__PURE__ */ Q(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ Q(`span`,{class:`delivery-detail`,title:e.detail,children:[`Couldn't push`,e.detail?`: ${e.detail}`:``]}),n]})}}let np=`tencil:dock`,rp=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],ip,ap=P(op());function op(){try{let e=localStorage.getItem(np);return e&&rp.includes(e)?e:`bottom-center`}catch{return`bottom-center`}}function sp(e){ap.value=e;try{localStorage.setItem(np,e)}catch{}}function cp(e,t,n,r){let i=e<n/3?`left`:e>n*2/3?`right`:`center`;return`${t<r/2?`top`:`bottom`}-${i}`}function lp(e,t){if(e.button!==0)return;e.preventDefault();let n=e.currentTarget;try{n.setPointerCapture(e.pointerId)}catch{}let[r,i]=pp(t);ip?.(),t.style.transition=`none`,t.style.translate=`${r}px ${i}px`;let a=e.clientX,o=e.clientY,s=r!==0||i!==0,c=[],l=e=>{let n=e.clientX-a,l=e.clientY-o;!s&&Math.hypot(n,l)<3||(s=!0,t.dataset.dragging=``,t.style.translate=`${r+n}px ${i+l}px`,c=[...c.filter(t=>e.timeStamp-t.t<80),{x:e.clientX,y:e.clientY,t:e.timeStamp}])},u=e=>{if(n.removeEventListener(`pointermove`,l),n.removeEventListener(`pointerup`,u),n.removeEventListener(`pointercancel`,u),n.removeEventListener(`lostpointercapture`,u),window.removeEventListener(`dragstart`,up,!0),delete t.dataset.dragging,!s){t.style.translate=``,t.style.transition=``;return}c=c.filter(t=>e.timeStamp-t.t<80);let r=c[0],i=c[c.length-1],a=r&&i?Math.max(1,i.t-r.t):1,o=e=>Math.max(-2.5,Math.min(2.5,e/a)),d=r&&i?o(i.x-r.x):0,f=r&&i?o(i.y-r.y):0,p=mp(t);fp(t,p,cp(p.left+p.width/2+d*120,p.top+p.height/2+f*120,window.innerWidth,window.innerHeight))};n.addEventListener(`pointermove`,l),n.addEventListener(`pointerup`,u),n.addEventListener(`pointercancel`,u),n.addEventListener(`lostpointercapture`,u),window.addEventListener(`dragstart`,up,!0)}function up(e){e.preventDefault()}function dp(e,t){let[n,r]=ap.value.split(`-`),i=[`left`,`center`,`right`],a=i.indexOf(r),o;return e===`ArrowLeft`&&a>0&&(o=`${n}-${i[a-1]}`),e===`ArrowRight`&&a<2&&(o=`${n}-${i[a+1]}`),e===`ArrowUp`&&n===`bottom`&&(o=`top-${r}`),e===`ArrowDown`&&n===`top`&&(o=`bottom-${r}`),o?(sp(o),t.style.translate=``,!0):!1}function fp(e,t,n){sp(n);let r=0,i,a=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),ip=void 0,e.style.transition=``,e.style.translate=``},o=t=>{t.target===e&&t.propertyName===`translate`&&a()};ip=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),ip=void 0},r=requestAnimationFrame(()=>{e.style.translate=``;let n=mp(e);if(e.style.translate=`${t.left-n.left}px ${t.top-n.top}px`,matchMedia(`(prefers-reduced-motion: reduce)`).matches){a();return}r=requestAnimationFrame(()=>{e.style.transition=`translate 340ms cubic-bezier(0.32, 0.72, 0, 1)`,e.style.translate=`0px 0px`,e.addEventListener(`transitionend`,o),i=setTimeout(a,440)})})}function pp(e){let t=getComputedStyle(e).translate;if(!t||t===`none`)return[0,0];let[n=`0`,r=`0`]=t.split(` `);return[Number.parseFloat(n)||0,Number.parseFloat(r)||0]}function mp(e){return(e.querySelector(`.toolbar`)??e).getBoundingClientRect()}let hp=P(null);function gp(){let e=()=>{let e=vp(),t=hp.value;yp(e,t)||(hp.value=e)};e();let t=setInterval(e,500);return window.addEventListener(`resize`,e,{passive:!0}),()=>{clearInterval(t),window.removeEventListener(`resize`,e)}}function _p(e,t){return!t||e.endsWith(`center`)||cp((t.left+t.right)/2,(t.top+t.bottom)/2,window.innerWidth,window.innerHeight)!==e?{}:e.endsWith(`left`)?{left:`${t.right+8}px`}:{right:`${window.innerWidth-t.left+8}px`}}function vp(){for(let e of document.querySelectorAll(`nextjs-portal`)){let t=e.shadowRoot?.getElementById(`devtools-indicator`);if(!t)continue;let n=t.getBoundingClientRect();if(n.width!==0&&n.height!==0)return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}return null}function yp(e,t){return!e||!t?e===t:Math.round(e.left)===Math.round(t.left)&&Math.round(e.top)===Math.round(t.top)&&Math.round(e.right)===Math.round(t.right)&&Math.round(e.bottom)===Math.round(t.bottom)}function bp(){let[e,t]=k(``),n=Yt.value??[],r=e.trim().toLowerCase(),i=r?n.filter(e=>e.title.toLowerCase().includes(r)||e.root.toLowerCase().includes(r)):n,a=e=>V({type:`project.select`,root:e});return/* @__PURE__ */ Q(`div`,{class:`project-picker`,children:[/* @__PURE__ */ Q(`p`,{class:`project-picker-title`,children:`Which project is this page?`}),n.length===0?/* @__PURE__ */ Q(`p`,{class:`project-picker-empty`,children:Xt.value??`No projects found.`}):/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`input`,{class:`project-picker-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,autoFocus:!0,value:e,onInput:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i[0]&&a(i[0].root)}}),/* @__PURE__ */ Q(`div`,{class:`project-picker-list`,children:[i.length===0&&/* @__PURE__ */ Q(`p`,{class:`project-picker-empty`,children:[`No project matches “`,e.trim(),`”.`]}),i.map(e=>/* @__PURE__ */ Q(`button`,{type:`button`,class:`project-picker-option`,title:e.root,onClick:()=>a(e.root),children:[/* @__PURE__ */ Q(`span`,{class:`project-picker-name`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`project-picker-root`,children:`‎`+e.root})]},e.root))]})]})]})}function xp(){let e=wp(),t=Mn.value,n=U.value===`picking`,r=j(null);return/* @__PURE__ */ Q(`div`,{ref:r,class:`toolbar-wrap dock-${ap.value}`,style:_p(ap.value,hp.value),children:[n&&/* @__PURE__ */ Q(`div`,{class:`toolbar-hint`,children:[`Click any element to pin a prompt`,er.value&&t.measure&&` · ${t.measure} to measure`,` · Esc to cancel`]}),!n&&Yt.value&&/* @__PURE__ */ Q(bp,{}),!n&&!Yt.value&&e.hint&&/* @__PURE__ */ Q(`div`,{class:`toolbar-hint hint-${e.tone}`,children:[e.hint,e.action&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:e.action.run,children:e.action.label})]}),!n&&!e.hint&&W.value&&!G.value&&/* @__PURE__ */ Q(`div`,{class:`toolbar-hint`,children:[`Hold `,t.measure,` and hover to measure`,t.comment&&` · ${t.comment} to comment`,` · Esc to clear`]}),/* @__PURE__ */ Q(`div`,{class:`toolbar`,children:[/* @__PURE__ */ Q(Qd,{tone:e.tone,label:e.title}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`divider`,"aria-label":`Move toolbar (drag, or use arrow keys)`,title:`Drag to move`,onPointerDown:e=>r.current&&lp(e,r.current),onKeyDown:e=>{r.current&&dp(e.key,r.current)&&e.preventDefault()}}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${n?` tool-active`:``}`,title:Et.value??Sp(`Comment`,t.comment),disabled:Et.value!==null,onClick:()=>n?hr():mr(),children:[/* @__PURE__ */ Q(Fu,{}),/* @__PURE__ */ Q(`span`,{class:`tool-label`,children:`Comment`}),t.comment&&/* @__PURE__ */ Q(`kbd`,{children:t.comment})]}),Qn.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${$n.value?``:` tool-off`}`,title:$n.value?`${Sp(`Ruler on`,t.ruler)}${t.measure?`: hold ${t.measure} to measure`:``}`:Sp(`Ruler off`,t.ruler),"aria-label":`Ruler`,"aria-pressed":$n.value,onClick:nr,children:$n.value?/* @__PURE__ */ Q(Zu,{}):/* @__PURE__ */ Q(Qu,{})}),fr.value.length>0&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool tool-send`,title:`Send the queued comments to the agent as one thread`,disabled:L.value?.state!==`ready`,onClick:rd,children:[/* @__PURE__ */ Q(zu,{}),/* @__PURE__ */ Q(`span`,{class:`tool-label`,children:[`Send `,fr.value.length]})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${q.value?` tool-active`:``}`,title:`Pins`,onClick:()=>{q.value=!q.value,Bn.value=!1},children:[/* @__PURE__ */ Q(Iu,{}),dr.value>0&&/* @__PURE__ */ Q(`span`,{class:`badge`,children:dr.value})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool`,title:Sp(J.value?`Show pins`:`Hide pins`,t.hidePins),onClick:()=>{J.value=!J.value,J.value&&hr()},children:J.value?/* @__PURE__ */ Q(Lu,{}):/* @__PURE__ */ Q(Ru,{})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${Bn.value?` tool-active`:``}`,title:`Settings`,"aria-label":sf.value?`Settings (update available)`:void 0,disabled:!zt.value,onClick:()=>{Bn.value=!Bn.value,q.value=!1},children:[/* @__PURE__ */ Q(Ju,{}),sf.value&&/* @__PURE__ */ Q(`span`,{class:`tool-dot`})]})]})]})}function Sp(e,t){return t?`${e} (${t})`:e}let Cp={label:`Switch agent`,run:()=>{Vn.value=`agent`,Bn.value=!0,q.value=!1}};function wp(){if(I.value!==`open`)return rn()?{tone:`error`,title:`Tencil Cloud unreachable`,hint:I.value===`connecting`?void 0:`Can't reach Tencil Cloud. Retrying…`}:{tone:`error`,title:`Tencil daemon offline`,hint:I.value===`connecting`?void 0:`The Tencil daemon stopped. Start it again with npx tencil start.`};let e=Ct.value;if(e)return{tone:`warn`,title:`Sign in to Tencil Cloud`,hint:e.reason??`Sign in with GitHub to pin on this preview`,action:Tt.value?void 0:{label:`Sign in`,run:()=>Tp(e.signIn)}};if(Yt.value)return{tone:`warn`,title:`Pick this page's project`};let t=L.value;if(!t)return{tone:`warn`,title:`Connecting…`};switch(t.state){case`ready`:return{tone:`ok`,title:`${t.label}${t.target?` · ${t.target}`:``}`};case`unauthorized`:return t.canPair?{tone:`warn`,title:`${t.label}: not paired`,hint:`Not paired with ${t.label}`,action:{label:`Pair`,run:()=>V({type:`provider.pair`})}}:{tone:`warn`,title:`${t.label}: not signed in`,hint:t.detail??`Sign in to ${t.label}`,action:Cp};case`unavailable`:return{tone:`error`,title:t.detail??`${t.label} unavailable`,hint:t.detail??`${t.label} is unavailable`,action:Cp};default:return{tone:`warn`,title:`Connecting to ${t.label}…`}}}function Tp(e){Nt(an(),e).then(on,e=>{Zt.value={message:e instanceof Error?e.message:String(e),at:Date.now()}})}function Ep(){return kp(),Yn.value?/* @__PURE__ */ Q(`div`,{class:`root${Sr.value?` dark`:``}`,children:/* @__PURE__ */ Q(Op,{})}):/* @__PURE__ */ Q(`div`,{class:`root${U.value===`picking`?` picking`:``}${Sr.value?` dark`:``}`,children:[/* @__PURE__ */ Q(Ld,{}),/* @__PURE__ */ Q(Kd,{}),/* @__PURE__ */ Q(id,{}),/* @__PURE__ */ Q(kd,{}),/* @__PURE__ */ Q(Vf,{}),/* @__PURE__ */ Q(_d,{}),/* @__PURE__ */ Q(Dp,{}),/* @__PURE__ */ Q(xp,{}),Bn.value&&U.value!==`picking`&&/* @__PURE__ */ Q(xf,{})]})}function Dp(){let e=Zt.value,[t,n]=k(!1);return A(()=>{if(!e)return;n(!0);let t=setTimeout(()=>n(!1),5e3);return()=>clearTimeout(t)},[e?.at]),!e||!t?null:/* @__PURE__ */ Q(`div`,{class:`toast`,children:e.message})}function Op(){let e=Xn.value,[t,n]=k(!1);return A(()=>{if(!e)return;n(!0);let t=setTimeout(()=>n(!1),4e3);return()=>clearTimeout(t)},[e]),!e||!t?null:/* @__PURE__ */ Q(`div`,{class:`toast toast-info`,role:`status`,children:[`Tencil is hidden. Press `,/* @__PURE__ */ Q(`kbd`,{children:Mn.value.hideDock}),` to bring it back.`,/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>Zn(!1),children:`Undo`})]})}function kp(){let e=z.value;A(()=>{let t=sessionStorage.getItem(gd);if(!t)return;let n=e.get(t);n&&(sessionStorage.removeItem(gd),K.value=t,Cd(n))},[e])}let Ap=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`dblclick`,`contextmenu`,`auxclick`];function jp(e){let t=t=>t.composedPath().includes(e),n=(t,n)=>{for(let r of document.elementsFromPoint(t,n)){if(r===e||e.contains(r))return null;if(r!==document.documentElement)return r}return null},r=()=>U.value===`picking`||zn.value&&er.value,i=null,a=null,o=()=>{if(!r()){Rn.value&&=null;return}Rn.value=!i||i.ours?null:n(i.x,i.y);let e=W.value?.element;e&&Rn.value&&Rn.value!==e&&(a=Rn.value)},s=(e,t,n)=>{hr(),W.value=null,G.value={element:e,label:Xs(e),anchor:{selector:``,...t},context:Ys(e),...n?{measuredTo:{...n,label:Xs(n.element)}}:{}}},c=e=>{i={x:e.clientX,y:e.clientY,ours:t(e)},zn.value=On(H.value.measure,e),o()},l=e=>{Sn.value||e.key!==H.value.measure||(zn.value=e.type===`keydown`,er.value&&e.preventDefault(),o())},u=()=>{zn.value=!1,o()},d=e=>{if(!r()&&e.type===`pointerdown`&&!t(e)){Bn.value=!1,(K.value?z.value.get(K.value):void 0)?.anchor&&(K.value=null);return}r()&&!t(e)&&(e.preventDefault(),e.stopImmediatePropagation())},f=i=>{if(!r()||t(i))return;i.preventDefault(),i.stopImmediatePropagation();let o=n(i.clientX,i.clientY);if(!o)return;let c=Cc(o,{x:i.clientX,y:i.clientY});if(U.value!==`picking`){let t=G.value;if(t)G.value={...t,measuredTo:o===t.element?void 0:{element:o,label:Xs(o),parent:!1}};else{let t=W.value?.element===o;W.value=t?null:{element:o,offsets:c},a=null;let n=e.shadowRoot?.activeElement;n instanceof HTMLElement&&n.blur()}return}let l=o.parentElement,u=On(H.value.measure,i)&&er.value&&l&&l!==document.documentElement;s(o,c,u?{element:l,parent:!0}:void 0)},p=e=>{if(Sn.value)return;let n=H.value;if(Dn(n.hideDock,e)&&!Np(e)){e.preventDefault(),Zn(!Yn.value);return}if(!(t(e)&&!Mp(e)||Yn.value)){if(e.key===`Escape`){if(U.value===`picking`)hr();else if(G.value)G.value=null;else if(W.value)W.value=null;else if(K.value)K.value=null;else if(q.value)q.value=!1;else return;e.preventDefault();return}if(!Np(e)){if(Dn(n.ruler,e)&&Qn.value){e.preventDefault(),nr();return}if(Dn(n.hidePins,e)){e.preventDefault(),J.value=!J.value,J.value&&hr();return}if(Dn(n.comment,e)){e.preventDefault(),J.value=!1;let t=W.value;if(U.value===`picking`)hr();else if(t?.element.isConnected&&!G.value){let e=a?.isConnected?a:null;s(t.element,t.offsets,e?{element:e,parent:!1}:void 0)}else mr()}}}},m=0,h=()=>{m||=requestAnimationFrame(()=>{m=0,or.value++})},g=new MutationObserver(t=>{t.every(t=>e.contains(t.target)||t.target===e)||h()});g.observe(document.body,{childList:!0,subtree:!0,attributes:!0});let _=setInterval(()=>{let e=cr(location.href);e!==sr.value&&(sr.value=e,G.value=null,W.value=null,K.value=null)},400);window.addEventListener(`pointermove`,c,{capture:!0,passive:!0});for(let e of Ap)window.addEventListener(e,d,!0);return window.addEventListener(`click`,f,!0),window.addEventListener(`keydown`,p,!0),window.addEventListener(`keydown`,l,!0),window.addEventListener(`keyup`,l,!0),window.addEventListener(`blur`,u),window.addEventListener(`scroll`,h,{capture:!0,passive:!0}),window.addEventListener(`resize`,h,{passive:!0}),()=>{window.removeEventListener(`pointermove`,c,!0);for(let e of Ap)window.removeEventListener(e,d,!0);window.removeEventListener(`click`,f,!0),window.removeEventListener(`keydown`,p,!0),window.removeEventListener(`keydown`,l,!0),window.removeEventListener(`keyup`,l,!0),window.removeEventListener(`blur`,u),window.removeEventListener(`scroll`,h,!0),window.removeEventListener(`resize`,h),g.disconnect(),clearInterval(_),cancelAnimationFrame(m)}}function Mp(e){let t=e.composedPath()[0];return t instanceof Element&&t.closest(`.toolbar`)!==null}function Np(e){let t=e.composedPath()[0];return t instanceof HTMLElement?t.isContentEditable||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement:!1}function Pp(){let e=document.currentScript;return e?.dataset.bridge?e.dataset.bridge:e?.src?new URL(e.src).origin:`http://localhost:4747`}function Fp(){let e=document.currentScript;if(e?.src)return new URL(e.src).searchParams.get(`root`)??void 0}function Ip(){let e=document.currentScript?.dataset;if(e?.tencilProject&&e.tencilRepo&&e.tencilBranch&&e.tencilSha)return{projectKey:e.tencilProject,repo:e.tencilRepo,branch:e.tencilBranch,sha:e.tencilSha}}function Lp(){try{CSS.registerProperty({name:`--tencil-rim`,syntax:`<angle>`,inherits:!1,initialValue:`0deg`})}catch{}}function Rp(e,t,n){Lp();let r=document.createElement(`tencil-overlay`);r.setAttribute(`data-tencil`,``),r.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483646;display:block;contain:layout style;`;let i=r.attachShadow({mode:`open`}),a=document.createElement(`style`);a.textContent=`
74
75
  :host { all: initial; }
75
76
  * { box-sizing: border-box; }
76
77
 
@@ -86,6 +87,8 @@ let ui=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,di=[`rsc://`,`file:///`,`webpack-internal://`
86
87
  --n-900: hsl(90 2% 9%);
87
88
  --n-950: hsl(60 4% 5%);
88
89
  --surface: #fff;
90
+ /* Hairlines between and around settings; softer than --n-200 on light. */
91
+ --line: hsl(90 2% 89%);
89
92
 
90
93
  /* Pixelperfect primary scale. */
91
94
  --accent: hsl(214 67% 51%);
@@ -113,30 +116,30 @@ let ui=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,di=[`rsc://`,`file:///`,`webpack-internal://`
113
116
  color-scheme: light;
114
117
  -webkit-font-smoothing: antialiased;
115
118
  }
116
- @media (prefers-color-scheme: dark) {
117
- .root {
118
- --n-50: hsl(60 4% 7%);
119
- --n-100: hsl(90 2% 13%);
120
- --n-200: hsl(100 2% 21%);
121
- --n-400: hsl(100 2% 42%);
122
- --n-500: hsl(96 2% 52%);
123
- --n-600: hsl(105 2% 64%);
124
- --n-700: hsl(100 2% 76%);
125
- --n-900: hsl(120 2% 90%);
126
- --n-950: hsl(120 4% 96%);
127
- --surface: hsl(90 2% 10%);
128
- --accent-soft: hsl(214 67% 51% / 0.2);
129
- --accent-text: hsl(214 67% 69%);
130
- --primary: hsl(214 67% 69%);
131
- --user-bg: hsl(211 33% 14%);
132
- --user-text: hsl(215 82% 89%);
133
- --live: hsl(214 67% 60%);
134
- --done: #3dd6a4;
135
- --warn: #f5b84a;
136
- --error: #ff6369;
137
- --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 16px 40px -8px rgba(0, 0, 0, 0.6);
138
- color-scheme: dark;
139
- }
119
+ /* The Appearance setting picks dark, light or the system's (lib/theme.ts). */
120
+ .root.dark {
121
+ --n-50: hsl(60 4% 7%);
122
+ --n-100: hsl(90 2% 13%);
123
+ --n-200: hsl(100 2% 21%);
124
+ --n-400: hsl(100 2% 42%);
125
+ --n-500: hsl(96 2% 52%);
126
+ --n-600: hsl(105 2% 64%);
127
+ --n-700: hsl(100 2% 76%);
128
+ --n-900: hsl(120 2% 90%);
129
+ --n-950: hsl(120 4% 96%);
130
+ --surface: hsl(90 2% 10%);
131
+ --line: hsl(100 2% 21%);
132
+ --accent-soft: hsl(214 67% 51% / 0.2);
133
+ --accent-text: hsl(214 67% 69%);
134
+ --primary: hsl(214 67% 69%);
135
+ --user-bg: hsl(211 33% 14%);
136
+ --user-text: hsl(215 82% 89%);
137
+ --live: hsl(214 67% 60%);
138
+ --done: #3dd6a4;
139
+ --warn: #f5b84a;
140
+ --error: #ff6369;
141
+ --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 16px 40px -8px rgba(0, 0, 0, 0.6);
142
+ color-scheme: dark;
140
143
  }
141
144
 
142
145
  /* Thin, theme-aware scrollbars everywhere inside the overlay. */
@@ -647,26 +650,131 @@ kbd {
647
650
 
648
651
  /* -------------------------------- settings -------------------------------- */
649
652
  /* Opens from the toolbar, on its open side (above it, or below when docked at the top). */
653
+ .settings-scrim {
654
+ position: fixed; inset: 0; pointer-events: auto;
655
+ background: rgba(0, 0, 0, 0.16);
656
+ transition: opacity 180ms var(--ease-out);
657
+ @starting-style { opacity: 0; }
658
+ }
650
659
  .settings-panel {
651
- width: 300px; pointer-events: auto;
660
+ position: fixed; left: 50%; top: 50%; translate: -50% -50%;
661
+ width: min(640px, calc(100vw - 32px)); height: min(440px, calc(100vh - 32px));
662
+ display: grid; grid-template-columns: 176px 1fr; overflow: hidden; pointer-events: auto;
652
663
  background: var(--n-50); border-radius: var(--radius); box-shadow: var(--shadow);
653
- transform-origin: bottom center;
654
664
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
655
- @starting-style { opacity: 0; transform: translateY(6px) scale(0.98); }
665
+ @starting-style { opacity: 0; transform: scale(0.98); }
656
666
  }
657
- [class*="dock-top"] .settings-panel {
658
- transform-origin: top center;
659
- @starting-style { opacity: 0; transform: translateY(-6px) scale(0.98); }
667
+ .settings-nav {
668
+ display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: hidden auto;
669
+ padding: 14px 8px; background: var(--n-100); border-right: 1px solid var(--line);
660
670
  }
671
+ .settings-title { display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 14px; font-weight: 500; }
672
+ .settings-nav-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
673
+ .settings-nav-title {
674
+ display: grid; margin: 0 0 4px; padding: 0 8px;
675
+ color: var(--n-500); font-size: 11px; font-weight: 500;
676
+ }
677
+ .settings-nav-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
678
+ .settings-nav-project { font-weight: 500; }
679
+ .settings-nav-item {
680
+ display: flex; align-items: center; justify-content: space-between; gap: 8px;
681
+ padding: 5px 8px; border-radius: 8px; text-align: left; color: var(--n-700);
682
+ transition: background-color 150ms ease, color 150ms ease;
683
+ }
684
+ .settings-nav-item.active { background: var(--surface); color: var(--n-950); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
685
+ .settings-nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
686
+ /* Dark surfaces sit below the nav's grey: lift the selected page instead. */
687
+ .dark .settings-nav-item.active,
688
+ .dark .segmented .active,
689
+ .dark .settings-segmented label.active { background: var(--n-200); box-shadow: none; }
690
+ .settings-nav-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }
691
+ .settings-page { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
692
+ .settings-body { overflow-y: auto; }
661
693
  .settings-header {
662
- display: flex; align-items: center; justify-content: space-between; gap: 10px;
663
- padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--n-200);
694
+ display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
695
+ padding: 14px 10px 12px 16px; border-bottom: 1px solid var(--line);
696
+ }
697
+ .settings-heading { display: grid; gap: 1px; min-width: 0; }
698
+ .settings-heading h2 { margin: 0; font-size: 14px; font-weight: 500; }
699
+ .settings-scope { color: var(--n-600); font-size: 12px; overflow-wrap: anywhere; }
700
+ .overview { gap: 18px; }
701
+ .overview-block { display: grid; gap: 8px; }
702
+ .detection { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
703
+ .detection-badge {
704
+ flex: none; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 500;
705
+ background: var(--n-100); color: var(--n-600); box-shadow: inset 0 0 0 1px var(--line);
706
+ }
707
+ .detection-picked { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }
708
+ .detection-reason { flex: 1; min-width: 160px; }
709
+ /* On their own row, under the reason. */
710
+ .detection-actions { display: flex; flex-basis: 100%; justify-content: flex-end; gap: 6px; }
711
+ .detection-button {
712
+ padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--n-700);
713
+ background: var(--surface); box-shadow: 0 0 0 1px var(--line);
714
+ transition: background-color 150ms ease, transform 160ms var(--ease-out);
715
+ }
716
+ .detection-button:active { transform: var(--press); }
717
+ .detection-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
718
+ .detection-picker { display: grid; gap: 8px; }
719
+ .detection-search {
720
+ padding: 6px 10px; border: 0; border-radius: 8px; outline: none; font: inherit; font-size: 12px;
721
+ background: var(--surface); color: var(--n-950); box-shadow: 0 0 0 1px var(--line);
722
+ }
723
+ .detection-search:focus { box-shadow: 0 0 0 1.5px var(--accent); }
724
+ .detection-list {
725
+ display: grid; gap: 2px; max-height: 180px; overflow-y: auto; padding: 4px;
726
+ border-radius: 10px; background: var(--surface); box-shadow: 0 0 0 1px var(--line);
727
+ }
728
+ .detection-list .settings-help { margin: 6px 8px; }
729
+ .detection-option { display: grid; gap: 1px; padding: 6px 8px; border-radius: 8px; text-align: left; }
730
+ .detection-option:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
731
+ .detection-option-name { font-size: 12px; font-weight: 500; }
732
+ .detection-option-root {
733
+ font-size: 11px; color: var(--n-500); white-space: nowrap; overflow: hidden;
734
+ text-overflow: ellipsis; direction: rtl; text-align: left;
735
+ }
736
+ .settings-segmented { margin: 0; border: 0; min-width: 0; }
737
+ .settings-segmented label { padding: 3px 10px; border-radius: 7px; color: var(--n-600); font-size: 12px; cursor: pointer; }
738
+ .settings-segmented label.active { background: var(--surface); color: var(--n-950); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
739
+ .settings-segmented input { position: absolute; opacity: 0; pointer-events: none; }
740
+ .settings-segmented label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
741
+ .shortcut-list { display: grid; margin: 4px 0 0; padding: 0; list-style: none; }
742
+ .shortcut-row {
743
+ display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 16px;
744
+ padding: 8px 0; border-bottom: 1px solid var(--line);
745
+ }
746
+ .shortcut-key {
747
+ min-width: 72px; height: 26px; padding: 0 8px; border-radius: 8px;
748
+ display: inline-flex; align-items: center; justify-content: center;
749
+ background: var(--surface); box-shadow: 0 0 0 1px var(--line);
750
+ color: var(--n-600); font-size: 12px;
751
+ transition: box-shadow 150ms ease, background-color 150ms ease;
752
+ }
753
+ .shortcut-key kbd { background: var(--n-100); color: var(--n-900); }
754
+ .shortcut-key.recording { color: var(--accent-text); background: var(--accent-soft); box-shadow: 0 0 0 1.5px var(--accent); }
755
+ .shortcut-key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
756
+ .shortcut-none { color: var(--n-500); }
757
+ .shortcut-message {
758
+ grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
759
+ margin: 0; color: var(--warn); font-size: 12px;
760
+ }
761
+ .shortcut-message-actions { display: inline-flex; gap: 4px; }
762
+ .shortcut-cancel { padding: 2px 8px; border-radius: 999px; color: var(--n-700); font-size: 12px; }
763
+ .shortcut-reset {
764
+ justify-self: start; margin-top: 6px; padding: 4px 10px; border-radius: 8px;
765
+ font-size: 12px; font-weight: 500; color: var(--n-700);
766
+ background: var(--surface); box-shadow: 0 0 0 1px var(--line);
767
+ }
768
+ .shortcut-reset:disabled { opacity: 0.5; cursor: default; }
769
+ @media (max-width: 520px) {
770
+ .settings-panel { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
771
+ .settings-nav { flex-direction: row; align-items: flex-end; overflow: auto hidden; border-right: 0; border-bottom: 1px solid var(--line); }
772
+ .settings-nav-project { max-width: 160px; }
773
+ .settings-title, .settings-nav-title { display: none; }
774
+ .settings-nav-group { display: flex; }
664
775
  }
665
- .settings-heading { display: grid; min-width: 0; }
666
- .settings-heading strong { font-size: 14px; font-weight: 500; }
667
- .settings-project { color: var(--n-600); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
668
776
  .settings-section { display: grid; gap: 6px; padding: 14px 16px 16px; }
669
- .settings-section + .settings-section { border-top: 1px solid var(--n-200); }
777
+ .settings-section + .settings-section { border-top: 1px solid var(--line); }
670
778
  .settings-label { margin: 0; font-weight: 500; }
671
779
  .settings-help { margin: 0; color: var(--n-600); font-size: 12px; line-height: 1.4; }
672
780
  .settings-switch-row { grid-template-columns: 1fr auto; align-items: center; gap: 16px; cursor: pointer; }
@@ -689,7 +797,7 @@ kbd {
689
797
  .settings-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
690
798
  .settings-options {
691
799
  display: grid; gap: 2px; margin: 0; padding: 4px; border: 0; min-width: 0;
692
- background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px var(--n-200);
800
+ background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px var(--line);
693
801
  }
694
802
  .settings-options .target-option { cursor: pointer; }
695
803
  .settings-radio {
@@ -702,6 +810,33 @@ kbd {
702
810
  .settings-status { margin: 2px 2px 0; color: var(--n-600); font-size: 12px; }
703
811
  .settings-about-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
704
812
  .settings-version { color: var(--n-600); font-size: 12px; font-variant-numeric: tabular-nums; }
813
+ .settings-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
814
+ .settings-link {
815
+ display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px;
816
+ font-size: 12px; font-weight: 500; color: var(--n-700); text-decoration: none;
817
+ background: var(--surface); box-shadow: 0 0 0 1px var(--line);
818
+ transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out);
819
+ }
820
+ .settings-link:active { transform: var(--press); }
821
+ .settings-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
822
+ .settings-star svg { color: #e3a008; fill: currentColor; }
823
+ .settings-debug { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
824
+ .settings-debug summary {
825
+ display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none;
826
+ color: var(--n-600); font-size: 12px; font-weight: 500;
827
+ }
828
+ .settings-debug summary::-webkit-details-marker { display: none; }
829
+ .settings-debug summary svg { transform: rotate(-90deg); transition: transform 160ms var(--ease-out); }
830
+ .settings-debug[open] summary svg { transform: none; }
831
+ .settings-debug summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
832
+ .settings-debug-body {
833
+ display: grid; gap: 10px; justify-items: start; margin-top: 8px; padding: 10px 12px;
834
+ border-radius: 10px; background: var(--surface); box-shadow: 0 0 0 1px var(--line);
835
+ font-size: 12px; color: var(--n-900);
836
+ }
837
+ .settings-debug-body .status-card-rows { width: 100%; }
838
+ .settings-debug-body .status-card-row dt, .settings-debug-body .status-card-muted { color: var(--n-500); }
839
+ .settings-debug-body .status-card-detail { margin: 0; color: var(--n-600); }
705
840
  .settings-update { display: grid; gap: 8px; justify-items: start; }
706
841
  .settings-help a { color: var(--accent); text-decoration: none; }
707
842
  .settings-help a:hover { text-decoration: underline; }
@@ -715,7 +850,7 @@ kbd {
715
850
  .settings-command code { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
716
851
  .settings-copy {
717
852
  flex: none; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
718
- background: var(--surface); box-shadow: 0 0 0 1px var(--n-200);
853
+ background: var(--surface); box-shadow: 0 0 0 1px var(--line);
719
854
  }
720
855
 
721
856
  /* --------------------------------- toolbar -------------------------------- */
@@ -875,6 +1010,12 @@ kbd {
875
1010
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
876
1011
  @starting-style { opacity: 0; transform: translate(-50%, 6px); }
877
1012
  }
1013
+ /* No toolbar to stand above when the dock is hidden. */
1014
+ .toast-info {
1015
+ bottom: 20px; display: flex; align-items: center; gap: 8px; padding-right: 6px;
1016
+ color: var(--n-900); white-space: nowrap;
1017
+ }
1018
+ .toast-info kbd, .settings-help kbd { background: var(--n-100); color: var(--n-700); }
878
1019
 
879
1020
  /* --------------------------- feedback & motion --------------------------- */
880
1021
  .tool, .icon-button, .toggle, .stop, .segmented button, .inbox-item, .composer-provider, .target-option {
@@ -894,12 +1035,17 @@ kbd {
894
1035
  .inbox-item:hover { background: var(--n-100); }
895
1036
  .project-picker-option:hover { background: rgba(255, 255, 255, 0.08); }
896
1037
  .composer-provider:hover, .target-option:hover { background: var(--n-100); color: var(--n-950); }
1038
+ .settings-nav-item:not(.active):hover { background: var(--n-200); color: var(--n-950); }
1039
+ .dark .settings-nav-item:not(.active):hover { background: rgba(255, 255, 255, 0.04); }
1040
+ .settings-link:hover { background: var(--n-100); color: var(--n-950); }
1041
+ .detection-button:hover, .detection-option:hover { background: var(--n-100); }
1042
+ .shortcut-key:not(.recording):hover, .shortcut-reset:not(:disabled):hover, .shortcut-cancel:hover { background: var(--n-100); }
897
1043
  .md a:hover { opacity: 0.8; }
898
1044
  }
899
1045
 
900
1046
  /* Reduced motion keeps fades (they aid comprehension) but drops movement. */
901
1047
  @media (prefers-reduced-motion: reduce) {
902
- .popover, .inbox, .toast, .toolbar-hint, .message-user, .pin-body,
1048
+ .popover, .inbox, .toast, .toolbar-hint, .settings-panel, .message-user, .pin-body,
903
1049
  .tool, .icon-button, .toggle, .stop, .send, .segmented button, .inbox-item {
904
1050
  transition-property: opacity, background-color, color;
905
1051
  }
@@ -910,4 +1056,4 @@ kbd {
910
1056
  @keyframes pin-dissolve { to { opacity: 0; } }
911
1057
  .shimmer > span[aria-hidden], .status-ping, .live-dot { animation: none; }
912
1058
  }
913
- `;let o=document.querySelector(`script[nonce]`)?.nonce;o&&(a.nonce=o),i.append(a);let s=document.createElement(`div`);i.append(s),Fs(r),document.body.append(r);let c=new MutationObserver(()=>{r.isConnected||document.body.append(r)});c.observe(document.body,{childList:!0});let l=_f(r),u=qd();ge(te(pf,{}),s),Qt(e,t,n),window.__TENCIL__={version:1,bridgeUrl:e,destroy(){c.disconnect(),l(),u(),ge(null,s),r.remove(),window.__TENCIL__=void 0}}}if(typeof window<`u`&&!window.__TENCIL__){let e=yf(),t=xf(),n=bf();document.body?Cf(e,t,n):document.addEventListener(`DOMContentLoaded`,()=>Cf(e,t,n),{once:!0})}})();
1059
+ `;let o=document.querySelector(`script[nonce]`)?.nonce;o&&(a.nonce=o),i.append(a);let s=document.createElement(`div`);i.append(s),yc(r),document.body.append(r);let c=new MutationObserver(()=>{r.isConnected||document.body.append(r)});c.observe(document.body,{childList:!0});let l=jp(r),u=gp();_e(te(Ep,{}),s),nn(e,t,n),Yn.value&&console.info(`Tencil is hidden. Press ${Mn.value.hideDock} to show it.`),window.__TENCIL__={version:1,bridgeUrl:e,destroy(){c.disconnect(),l(),u(),_e(null,s),r.remove(),window.__TENCIL__=void 0}}}if(typeof window<`u`&&!window.__TENCIL__){let e=Pp(),t=Ip(),n=Fp();document.body?Rp(e,t,n):document.addEventListener(`DOMContentLoaded`,()=>Rp(e,t,n),{once:!0})}})();