tencil 0.12.0 → 0.13.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),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=()=>{
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(null),Zt=P(void 0),Qt=P(null),B,$t=500,en=``,tn,nn;function rn(e,t,n){en=e,tn=t,nn=n,window.addEventListener(`focus`,()=>{Xt.value&&sn()}),dn()}function an(){return tn!==void 0}function on(){return en}function sn(){let e=B;B=void 0,e?.close(),$t=500,dn()}let cn;function ln(){try{return new URL(en).host}catch{return en}}function V(e){return B?.readyState===WebSocket.OPEN?(B.send(JSON.stringify(e)),!0):(Qt.value={message:`Not connected to the Tencil bridge`,at:Date.now()},!1)}function un(e){let t=new Map(z.value);t.set(e.id,e),z.value=t}function dn(){let e=new URL(`/ws`,en);e.protocol=e.protocol===`https:`?`wss:`:`ws:`,I.value=`connecting`;let t=new WebSocket(e);B=t,cn=tn?kt(en):void 0,t.addEventListener(`open`,()=>{$t=500,t.send(JSON.stringify({type:`hello`,protocol:1,pageUrl:location.href,...nn&&{root:nn},...tn&&{build:tn},...cn&&{token:cn}}))}),t.addEventListener(`message`,e=>{try{fn(JSON.parse(String(e.data)))}catch(e){console.warn(`[tencil] bad message`,e)}}),t.addEventListener(`close`,()=>{if(B!==t||(I.value=`closed`,Xt.value))return;let e=Ut.value?.state===`restarting`;setTimeout(dn,e?500:$t),e||($t=Math.min($t*2,1e4))})}function fn(e){switch(e.type){case`ready`:Ge(()=>{I.value=`open`,Xt.value=null,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`origin.blocked`:Xt.value={origin:e.origin,approveUrl:e.approveUrl};return;case`project.unknown`:Ge(()=>{I.value=`open`,Xt.value=null,Yt.value=e.choices,Zt.value=e.emptyHint});return;case`auth.required`:cn&&Mt(en),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`:un(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`:Qt.value={message:e.message,threadId:e.threadId,at:Date.now()};return}}function pn(e){return R.value?.providers.find(t=>t.id===e)?.label??e}function mn(){B?.readyState===WebSocket.OPEN&&B.send(JSON.stringify({type:`provider.threads`}))}function hn(){B?.readyState===WebSocket.OPEN&&B.send(JSON.stringify({type:`provider.models`}))}function gn(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 _n=`tencil:shortcuts`,vn=[`Alt`,`Control`,`Meta`,`Shift`],yn=/* @__PURE__ */ new Set([`KeyC`,`KeyV`,`KeyX`,`KeyA`,`KeyZ`,`KeyR`,`KeyL`,`KeyT`,`KeyW`]),bn=(e,t,n={})=>({code:e,key:t,alt:!1,ctrl:!1,meta:!1,shift:!1,...n}),H={comment:bn(`KeyC`,`C`),ruler:bn(`KeyR`,`R`),hidePins:null,hideDock:bn(`KeyT`,`T`,{alt:!0}),measure:`Alt`},xn=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),Sn=P(Rn()),Cn=P(!1);function wn(e){En(e),V({type:`preferences.update`,preferences:{shortcuts:e}})}function Tn(){wn(H)}ut(()=>{let e=Wt.value;e&&(e.shortcuts?Ln(e.shortcuts,Sn.peek())||En(e.shortcuts):Dn()!==null&&V({type:`preferences.update`,preferences:{shortcuts:Sn.peek()}}))});function En(e){Sn.value=e;try{localStorage.setItem(_n,JSON.stringify(e))}catch{}}function Dn(){try{return localStorage.getItem(_n)}catch{return null}}function On(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 kn(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 An(e){return vn.includes(e)}function jn(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 Mn(e,t=xn){return t?{Alt:`⌥ Option`,Control:`⌃ Control`,Meta:`⌘ Command`,Shift:`⇧ Shift`}[e]:{Alt:`Alt`,Control:`Ctrl`,Meta:`Win`,Shift:`Shift`}[e]}let Nn=F(()=>{let e=Sn.value,t=e=>e?jn(e):null;return{comment:t(e.comment),ruler:t(e.ruler),hidePins:t(e.hidePins),hideDock:jn(e.hideDock),measure:e.measure?Mn(e.measure):null}});function Pn(e){let{key:t=``,code:n=``}=e;return An(t)?null:t===`Escape`||t===`Tab`||t===`Enter`?{error:`${t} is kept for leaving fields and dialogs.`}:(e.ctrlKey||e.metaKey)&&yn.has(n)?{error:`The browser or the page already uses that one.`}:{code:n,key:Fn(t,n,e.altKey),alt:e.altKey,ctrl:e.ctrlKey,meta:e.metaKey,shift:e.shiftKey}}function Fn(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 In(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 Ln(e,t){let n=(e,t)=>e===t||In(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 Rn(){try{let e=JSON.parse(localStorage.getItem(_n)??`null`);if(!e||typeof e!=`object`)return H;let t=e=>e===null||typeof e==`object`&&typeof e.code==`string`&&typeof e.key==`string`;return{comment:t(e.comment)?e.comment:H.comment,ruler:t(e.ruler)?e.ruler:H.ruler,hidePins:t(e.hidePins)?e.hidePins:H.hidePins,hideDock:e.hideDock&&t(e.hideDock)?e.hideDock:H.hideDock,measure:e.measure===null||An(e.measure??void 0)?e.measure??null:H.measure}}catch{return H}}let U=P(`idle`),zn=P(null),Bn=P(!1),W=P(null),G=P(null),K=P(null),q=P(!1),Vn=P(!1),Hn=P(`overview`),Un=P(!1),J=P(!1),Wn=F(()=>R.value?.batch??!1),Gn=P(!1),Kn=F(()=>Wn.value&&Gn.value);function qn(e){let t=R.value;t&&V({type:`settings.update`,batch:e})&&(R.value={...t,batch:e})}let Jn=`tencil:ruler`,Yn=`tencil:dock-hidden`,Xn=P(ir(Yn)),Zn=P(0);function Qn(e){Xn.value=e,Zn.value=e?Date.now():0,ar(Yn,e),e&&(gr(),G.value=null,W.value=null,K.value=null,q.value=!1,Vn.value=!1)}let $n=F(()=>{let e=R.value;return e!==null&&e.ruler!==!1}),er=P(ir(Jn)),tr=F(()=>$n.value&&er.value&&!Xn.value);function nr(e){let t=R.value;t&&V({type:`settings.update`,ruler:e})&&(R.value={...t,ruler:e})}function rr(){er.value=!er.value,W.value=null,ar(Jn,er.value)}function ir(e){try{return localStorage.getItem(e)===`on`}catch{return!1}}function ar(e,t){try{localStorage.setItem(e,t?`on`:`off`)}catch{}}let or=P(null),sr=P(0),cr=P(lr(location.href));function lr(e){try{let t=new URL(e);return`${t.origin}${t.pathname.replace(/\/$/,``)||`/`}`}catch{return e}}let ur=F(()=>[...z.value.values()].sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),dr=F(()=>ur.value.filter(e=>e.anchor&&e.pageUrl&&lr(e.pageUrl)===cr.value).filter(e=>Un.value||!e.resolved).reverse()),fr=F(()=>ur.value.filter(e=>!e.resolved).length),pr=F(()=>[...ur.value].reverse().filter(e=>e.status===`draft`)),mr=F(()=>ur.value.filter(e=>e.status===`working`||e.status===`starting`).length);function hr(){Et.value||(G.value=null,W.value=null,K.value=null,U.value=`picking`)}function gr(){U.value=`idle`,zn.value=null}function _r(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 vr=[`dark`,`light`,`system`],[yr,br]=_r({key:`theme`,storageKey:`tencil:theme`,fallback:`dark`,parse:e=>vr.includes(e)?e:void 0}),xr=typeof matchMedia==`function`?matchMedia(`(prefers-color-scheme: dark)`):void 0,Sr=P(xr?.matches??!0);xr?.addEventListener(`change`,e=>{Sr.value=e.matches});let Cr=F(()=>yr.value===`system`?Sr.value:yr.value===`dark`),wr=`bippy-0.7.3`,Tr=Object.defineProperty,Er=()=>{
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
- },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);
10
+ },Dr=e=>e.__REACT_DEVTOOLS_GLOBAL_HOOK__,Or=e=>Object.assign(e,{[Symbol.dispose]:e}),kr=e=>{let t=e.current.memoizedState;return t===null||t!==void 0&&(t.element===null||t.element===void 0)},Ar=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{}},jr=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e&&e._isBippyHook!==!0),Mr=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>{if(!e||typeof e.inject!=`function`||jr(e))return!1;try{return Function.prototype.toString.call(e.inject).includes(`(injected)`)}catch{return!1}},Nr=/* @__PURE__ */ new Set,Pr=/* @__PURE__ */ new Set,Fr=/* @__PURE__ */ new WeakMap,Ir=/* @__PURE__ */ new Set,Lr=/* @__PURE__ */ new Set,Rr=/* @__PURE__ */ new WeakMap,zr=(e,t)=>{Nr.add(e);let n=Fr.get(e)??/* @__PURE__ */ new Set;n.add(t),Fr.set(e,n)},Br=e=>{for(let t of Nr)Fr.get(t)?.has(e)&&t()},Vr=(e,t)=>{for(let n of Ir)n.target===e&&n.listener(t)},Hr=(e,t)=>{for(let n of Lr)n(e,t)},Ur=e=>(Lr.add(e),Or(()=>{Lr.delete(e)})),Wr=e=>Object.prototype.toString.call(e)===`[object Map]`,Gr=e=>(Wr(e.renderers)||(e.renderers=/* @__PURE__ */ new Map),e.renderers),Kr=(e,t,n,r,i)=>{n.set(r,i),Pr.add(i),e._instrumentationIsActive||(e._instrumentationIsActive=!0,Br(t));let a=Rr.get(t)??/* @__PURE__ */ new WeakSet;Rr.set(t,a),!a.has(i)&&(a.add(i),Vr(t,i))},qr=(e,t=globalThis)=>{e&&zr(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:wr,_isBippyHook:!0,checkDCE:Ar,getFiberRoots:i,hasUnsupportedRendererAttached:!1,inject:e=>{let r=++a;return Kr(o,t,n,r,e),r},on:Er,onCommitFiberRoot:(e,t)=>{let n=i(e);kr(t)?n.delete(t):n.add(t)},onCommitFiberUnmount:Er,onPostCommitFiberRoot:Er,renderers:n,supportsFiber:!0,supportsFlight:!0};try{if(Tr(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=Gr(o);r.forEach((e,t)=>{Pr.add(e),i.set(t,e)}),(r.size>0||Lr.size>0)&&Jr(e,t),Hr(o,t)}}}),t===globalThis&&typeof window<`u`){let e=window.hasOwnProperty.bind(window),t=Object.getOwnPropertyDescriptor(window,`hasOwnProperty`),n=!1,r=()=>{t?Tr(window,`hasOwnProperty`,t):Reflect.deleteProperty(window,`hasOwnProperty`)};Tr(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{Jr(e,t)}return o},Jr=(e,t=globalThis)=>{e&&zr(e,t);let n=!1,r=Dr(t);if(!r)return;let i=Gr(r);if(!r._instrumentationSource){r.checkDCE=Ar,r.supportsFiber=!0,r.supportsFlight=!0,r.hasUnsupportedRendererAttached=!1,r._instrumentationSource=wr,r._instrumentationIsActive=!1;let e=jr(r);e||(r.on=Er),i.size?(i.forEach(e=>Pr.add(e)),r._instrumentationIsActive=!0,Br(t),n=!0):!e&&Mr(r)&&(r._instrumentationIsActive=!0,Br(t),n=!0);let a=r.inject;r.inject=e=>{let n=a.call(r,e);return Kr(r,t,i,n,e),n}}!n&&(i.size||r._instrumentationIsActive)&&e?.()},Yr=(e=globalThis)=>Object.hasOwn(e,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),Xr=(e,t=globalThis)=>Yr(t)?(Jr(e,t),Dr(t)??qr(e,t)):qr(e,t);
11
11
  /**
12
12
  * @license bippy
13
13
  *
@@ -16,7 +16,7 @@
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{Yr()}catch{}
19
+ try{Xr()}catch{}
20
20
  /**
21
21
  * @license bippy
22
22
  *
@@ -25,7 +25,7 @@ try{Yr()}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 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`);
28
+ let Zr=/^(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-]+)*)?$/,Qr=/^\d+$/,$r=e=>ei(e)!==null,ei=e=>{let t=Zr.exec(e);if(!t)return null;let n=t[4]?.split(`.`)??[];return n.some(e=>Qr.test(e)&&e.length>1&&e.startsWith(`0`))?null:{major:t[1],minor:t[2],patch:t[3],prerelease:n}},ti=(e,t)=>e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1,ni=(e,t)=>{let n=Qr.test(e),r=Qr.test(t);return n&&r?ti(e,t):n===r?e===t?0:e<t?-1:1:n?-1:1},ri=(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=ni(n,i);if(a!==0)return a}return 0},ii=(e,t)=>{let n=ei(e),r=ei(t);if(!n||!r)return null;let i=ti(n.major,r.major);if(i!==0)return i;let a=ti(n.minor,r.minor);if(a!==0)return a;let o=ti(n.patch,r.patch);return o===0?ri(n.prerelease,r.prerelease):o},ai={ChildDeletion:16,Cloned:8,ContentReset:32,Hydrating:4096,PerformedWork:1,Placement:2,Snapshot:1024,Update:4,Visibility:8192},oi=(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}}),si=[{isMinimumExcluded:!0,minimumVersion:`17.0.1`,workTags:oi[`17.0.2`]},{isMinimumExcluded:!1,minimumVersion:`17.0.0-alpha`,workTags:oi[`17.0.0-alpha`]},{isMinimumExcluded:!1,minimumVersion:`16.6.0-beta.0`,workTags:oi[`16.6.0-beta.0`]},{isMinimumExcluded:!1,minimumVersion:`16.4.3-alpha`,workTags:oi[`16.4.3-alpha`]}],ci=oi[`17.0.2`],li=e=>{if(e===void 0)return ci;for(let t of si){let n=ii(e,t.minimumVersion);if(n===null)return ci;if(n===1||n===0&&!t.isMinimumExcluded)return t.workTags}return oi[`16.0.0`]},ui=li(),di=/* @__PURE__ */ new WeakMap,fi=e=>e.startsWith(`0.0.0-`)?ui:li(e),pi=e=>{let t=e?.reconcilerVersion;return t&&$r(t)?fi(t):e?.version?fi(e.version):ui},mi=(e,t)=>{let n=pi(t);di.set(e,n),e.alternate&&di.set(e.alternate,n)},hi=e=>{let t=di.get(e);if(t)return t;let n=[e],r=e;for(;r.return;)r=r.return,n.push(r);let i=di.get(r)??ui;for(let e of n)di.set(e,i),e.alternate&&di.set(e.alternate,i);return i};ai.Placement|ai.Update|ai.ChildDeletion|ai.ContentReset|ai.Hydrating|ai.Visibility|ai.Snapshot;var gi=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`BippyError`}},_i=class extends gi{constructor(e,t){super(e,t),this.name=`BippyHookInspectionError`}},vi=class extends _i{constructor(e,t){super(e,t),this.name=`BippyUnsupportedHookError`}},yi=class extends gi{constructor(e,t){super(e,t),this.name=`BippySourceMapError`}};let bi=e=>typeof e==`function`,xi=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},Si=e=>typeof e==`object`&&!!e&&`tag`in e&&`stateNode`in e&&`return`in e&&`child`in e&&`sibling`in e&&`flags`in e,Ci=e=>{let t=hi(e);switch(e.tag){case t.HostComponent:case t.HostText:case t.HostHoistable:case t.HostSingleton:return!0;default:return!1}},wi=e=>{let t=hi(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 Ti(e,t,n=!1){if(!e)return null;let r=t(e);return Ei(r)?Promise.resolve(r).then(r=>r===!0?e:Di(e,t,n)):r===!0?e:Di(e,t,n)}let Ei=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,Di=(e,t,n)=>{let r=n?e.return:e.child;return Oi(r,t,n)},Oi=(e,t,n)=>{if(!e)return null;let r=n?null:e.sibling,i=Ti(e,t,n);return Ei(i)?Promise.resolve(i).then(e=>e??Oi(r,t,n)):i??Oi(r,t,n)},ki=e=>bi(e)?e:typeof e!=`object`||!e?null:ki(Reflect.get(e,`type`)??Reflect.get(e,`render`)),Ai=e=>{if(typeof e==`string`)return e;if(typeof e!=`function`&&typeof e!=`object`||e===null)return null;let t=xi(e);if(t)return t;let n=ki(e);return n?xi(n):null},ji=/* @__PURE__ */ new Set,Mi=/* @__PURE__ */ new WeakMap,Ni=/* @__PURE__ */ new WeakMap,Pi=/* @__PURE__ */ new WeakMap,Fi=/* @__PURE__ */ new Map;typeof FinalizationRegistry==`function`&&new FinalizationRegistry(e=>{Fi.get(e)?.deref()||Fi.delete(e)});let Ii=e=>{let t=e.alternate?[e,e.alternate]:[e],n=/* @__PURE__ */ new Set;for(let e of t){let t=Pi.get(e);t!==void 0&&n.add(t),Pi.delete(e)}for(let e of n){let n=Fi.get(e)?.deref();(!n||t.includes(n))&&Fi.delete(e)}},Li=/* @__PURE__ */ new Set,Ri=/* @__PURE__ */ new WeakMap,zi=/* @__PURE__ */ new WeakMap,Bi=!1,Vi=e=>{let t=Ri.get(e)??{};if(Ri.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),Ri.get(e)?.onCommitFiberRoot===r){mi(i.current,e.renderers.get(t)),kr(i)?(ji.delete(i),Mi.delete(i),Ni.delete(i)):(ji.add(i),Mi.set(i,t),Ni.set(i,e));for(let{options:n,target:r}of Li)r===zi.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(mi(i,e.renderers.get(t)),n&&n.call(e,t,i),Ri.get(e)?.onCommitFiberUnmount===r)try{for(let{options:n,target:r}of Li)r===zi.get(e)&&n.onCommitFiberUnmount&&n.onCommitFiberUnmount(t,i)}finally{Ii(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),Ri.get(e)?.onPostCommitFiberRoot===r)for(let{options:n,target:r}of Li)r===zi.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),Ri.get(e)?.onScheduleFiberRoot===r)for(let{options:n,target:r}of Li)r===zi.get(e)&&n.onScheduleFiberRoot&&n.onScheduleFiberRoot(t,i,a)};t.onScheduleFiberRoot=r,e.onScheduleFiberRoot=r}},Hi=(e,t)=>{zi.set(e,t),Vi(e)},Ui=(e,t=globalThis)=>{Bi||=(Ur(Hi),!0),zi.set(e,t),Vi(e)};try{Yr()&&Ui(Xr())}catch{}let Wi=/* @__PURE__ */ new Set,Gi=e=>e.startsWith(`__reactContainer$`)||e.startsWith(`__reactInternalInstance$`)||e.startsWith(`__reactFiber`),Ki=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 Si(i)?i:null},qi=e=>{let t=Reflect.get(e,`__internalInstanceHandle`)??Reflect.get(e,`_internalInstanceHandle`);return Si(t)?t:null},Ji=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},Yi=(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=Ki(e);if(t)return t;let n=qi(e);if(n)return n;for(let t of Wi){let n=Reflect.get(e,t);if(Si(n))return n}for(let t of Object.keys(e))if(Gi(t)){Wi.add(t);let n=Reflect.get(e,t);if(Si(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 ji)Ni.get(e)===n&&t.add(e);for(let n of t){let t=Ti(n.current,t=>Ci(t)&&Ji(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,36 +42,36 @@ let Xr=/^(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 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(`
45
+ let Xi=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,Zi=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],Qi=[`rsc://`,`about://React/`],$i=[`<anonymous>`,`eval`,``],ea=/\.(cjs|cts|js|jsx|mdx|mjs|mts|ts|tsx)$/,ta=/(\.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,na=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,ra=/\[[^\]]+\]$/,ia=[`react_stack_bottom_frame`,`react-stack-bottom-frame`],aa=Error,oa=()=>aa.prepareStackTrace,sa=e=>{aa.prepareStackTrace=e},ca=/(^|@)\S+:\d+/,la=/^\s*at .*(\S+:\d+|\(native\))/m,ua=/^(eval@)?(\[native code\])?$/,da=(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=pa(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(ca)){let t=ma(e)[0];t&&n.push(t)}return n}return e.match(la)?pa(e):ma(e)},fa=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]},pa=e=>e.split(`
47
+ `).filter(e=>!!e.match(la)).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=fa(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}}),ma=e=>e.split(`
48
+ `).filter(e=>!e.match(ua)).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=fa(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}}}),ha=/* @__PURE__ */ new WeakMap,ga=e=>ia.some(t=>e.includes(t)),_a=e=>{let t=e.getFunctionName?.()??``;if(t)return t;let n=e.getTypeName?.()??``,r=e.getMethodName?.()??``;return n&&r?`${n}.${r}`:r},va=e=>{let t=[];for(let n=1;n<e.length;n++){let r=e[n],i=_a(r);if(ga(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}},ya=e=>{let t=-1;for(let n of ia)if(t=e.indexOf(n),t!==-1)break;let n=t===-1?e:e.slice(0,e.lastIndexOf(`
49
+ `,t));return{frames:da(n).slice(1),isTrusted:t!==-1}},ba=e=>{let t=ha.get(e);if(t)return t;let n=null,r=(e,t)=>{n=va(t);let r=`${e.name||`Error`}: ${e.message||``}`;for(let e of t)r+=`\n at ${e.toString()}`;return r},i=oa();sa(r);let a;try{a=String(e.stack)}finally{sa(i)}let o=n??ya(a);return ha.set(e,o),o},xa=(e=globalThis)=>{let t=Xr(void 0,e),n=Wr(t.renderers)?t.renderers.values():[],r=e===globalThis?/* @__PURE__ */ new Set([...Pr,...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},Sa=e=>`H`in e?e.H:e.current,Ca=(e,t)=>{`H`in e?e.H=t:e.current=t};var wa=44,Ta=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ea=/* @__PURE__ */ new Uint8Array(64),Da=/* @__PURE__ */ new Uint8Array(128);for(let e=0;e<Ta.length;e++){let t=Ta.charCodeAt(e);Ea[e]=t,Da[t]=e}function Oa(e,t){let n=0,r=0,i=0;do i=Da[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 ka(e,t){return e.pos>=t?!1:e.peek()!==wa}var Aa=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 ja(e){let{length:t}=e,n=new Aa(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=Oa(n,i),i<u&&(l=!1),u=i,ka(n,e)?(a=Oa(n,a),o=Oa(n,o),s=Oa(n,s),ka(n,e)?(c=Oa(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||Ma(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function Ma(e){e.sort(Na)}function Na(e,t){return e[0]-t[0]}let Pa=/^data:application\/json(?:;[^,]*)?,/i,Fa=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,Ia=/* @__PURE__ */ new Map,La=/* @__PURE__ */ new WeakMap;var Ra=class extends Error{};let za=/* @__PURE__ */ new Map,Ba=/* @__PURE__ */ new WeakMap,Va=/* @__PURE__ */ new Set([`chrome-extension:`,`moz-extension:`,`safari-web-extension:`]),Ha=/* @__PURE__ */ new Set([`http:`,`https:`,...Va]),Ua=(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},Wa=(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:Ua(s,t,i,a)},Ga=(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 Wa(i.map.mappings,i.map.sources,a,o,i.map.ignoredSourceIndices,i.map.names)}return Wa(e.mappings,e.sources,t-1,n,e.ignoredSourceIndices,e.names)},Ka=(e,t)=>{if(Pa.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}}}},qa=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}},Ja=(e,t,n)=>{let r=n.headers.get(`sourcemap`)??n.headers.get(`x-sourcemap`);if(r)return Ka(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(Fa);n&&(i=n[1]||n[2]),a=e-1}return i?Ka(i,e):qa(e)},Ya=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)},Xa=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 Ya(t)!==(typeof n==`string`&&n.length>0)&&typeof i==`number`&&Number.isInteger(i)&&i>=0&&typeof a==`number`&&Number.isInteger(a)&&a>=0})},Za=e=>{let t=e.ignoreList??e.x_google_ignoreList;return t?.length?new Set(t):void 0},Qa=(e,t,n)=>{if(!e||Xi.test(t)||t.startsWith(`/`))return t;let r=e.endsWith(`/`)?e:`${e}/`,i=t.replace(/^\.\//,``);try{let e=Xi.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(`/`)}},$a=(e,t)=>e.sources.map(n=>Qa(e.sourceRoot,n,t)),eo=e=>Pa.test(e)?void 0:e,to=(e,t)=>{try{return{file:e.file,ignoredSourceIndices:Za(e),mappings:ja(e.mappings),names:e.names,sourceMapUrl:eo(t),sourceRoot:e.sourceRoot,sources:$a(e,t),sourcesContent:e.sourcesContent,version:3}}catch{return null}},no=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?Ka(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:Za(s),mappings:ja(s.mappings),sources:$a(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:eo(t),sourceRoot:void 0,sources:Array.from(o),sourcesContent:void 0,version:3}},ro=(e,t=!1)=>{if(!e)return!1;let n=e.trim();if(!n)return!1;let r=n.match(Xi);if(!r)return!0;let i=r[0].toLowerCase();return t||Ha.has(i)},io=()=>typeof window>`u`&&typeof process<`u`&&typeof process.versions?.node==`string`,ao=e=>{try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&!t.username&&!t.password}catch{return!1}},oo=e=>{try{return new URL(e).protocol}catch{return null}},so=e=>{let t=oo(e);return t!==null&&Va.has(t)},co=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.protocol===r.protocol&&n.host===r.host}catch{return!1}},lo=(e,t,n,r)=>{if(Pa.test(t))return!0;if(!ro(t,r))return!1;let i=oo(e),a=oo(t),o=i!==null&&!Ha.has(i)||a!==null&&!Ha.has(a);return!(n||o||so(e)||so(t))||co(e,t)},uo=e=>e===408||e===425||e===429||e>=500,fo=e=>{if(e.ok)return!0;if(uo(e.status))throw new Ra;return!1},po=(e,t,n)=>!n||t.url.length===0||co(e,t.url),mo=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 yi(`Source map request timed out`)),e.timeoutMs);return{cleanup:()=>{clearTimeout(r),e.signal?.removeEventListener(`abort`,n)},signal:t.signal}},ho=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()}},go=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))},_o=(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`)?go(i):decodeURIComponent(i);return e===null||new TextEncoder().encode(e).byteLength>t?null:JSON.parse(e)}catch{return null}},vo=async(e,t,n,r,i)=>{if(Pa.test(e))return _o(e,r);let a=await t(e,{redirect:i?`error`:`follow`,signal:n});if(!fo(a)||!po(e,a,i))return null;let o=await ho(a,r);if(o===null)return null;try{return JSON.parse(o)}catch{return null}},yo=async(e,t,n={})=>{let r=t!==void 0;if(!ro(e,r))return null;let i=io(),a=(i||so(e))&&!n.allowCrossOriginSourceMap;if(i&&!t&&(!n.allowUnsafeServerFetch||!ao(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=mo(n);try{let t=await o(e,{redirect:a?`error`:`follow`,signal:l.signal});if(!fo(t)||!po(e,t,a))return null;let n=await ho(t,s);if(n===null)return null;let i=Ja(e,n,t);if(!i||!lo(e,i,a,r))return null;let u=await vo(i,o,l.signal,c,a);return Ya(u)?to(u,i):Xa(u)?no(u,i,async t=>{if(!lo(e,t,a,r))return null;let n=await vo(t,o,l.signal,c,a);return Ya(n)?n:null}):null}finally{l.cleanup()}},bo=(e,t,n)=>{if(!n)return t;let r=e.get(n);return r||(r=/* @__PURE__ */ new Map,e.set(n,r)),r},xo=e=>bo(La,Ia,e),So=e=>bo(Ba,za,e),Co=(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??``}`,wo=async(e,t=!0,n,r={})=>{let i=t&&r.signal===void 0,a=xo(n),o=So(n),s=Co(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=yo(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},To=async(e,t=!0,n,r={})=>Promise.all(e.map(async e=>{if(!e.fileName)return e;let i=await wo(e.fileName,t,n,r);if(!i||typeof e.lineNumber!=`number`||typeof e.columnNumber!=`number`)return e;let a=Ga(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})),Eo=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack==`string`,Do=e=>`tag`in e&&typeof e.tag==`number`,Oo=e=>{let t=null;if(Ti(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}=ba(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},ko=()=>{let e=[];for(let t of xa())e.push({currentDispatcherRef:t,value:Sa(t)}),Ca(t,null);return e},Ao=e=>{for(let{currentDispatcherRef:t,value:n}of e)Ca(t,n)},jo=e=>`\n in ${e}`,Mo=(e,t,n)=>{if(n){let t=Ro(n.stack??``),r=t.lastIndexOf(`
51
+ `),i=r===-1?t:t.slice(r+1);if(i.includes(e))return`\n${i}`}return jo(`${e}${t?` [${t}]`:``}`)},No=!1,Po=/* @__PURE__ */ new WeakMap,Fo=(e,t)=>{if(!e||No)return``;let n=Po.get(e);if(n!==void 0)return n;let r=oa();sa(void 0),No=!0;let i=ko(),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]=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
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]=da(n);if(!r?.fileName)break;let i=Ai(e);return i&&n.includes(`<anonymous>`)&&(n=n.replace(`<anonymous>`,i)),Po.set(e,n),n}while(a>=1&&o>=0);break}}}finally{No=!1,sa(r),Ao(i),console.error=a,console.warn=o}let s=Ai(e),c=s?jo(s):``;return Po.set(e,c),c},Io=(e,t)=>{let n=``,r=hi(e);switch(e.tag){case r.ActivityComponent:n=jo(`Activity`);break;case r.ClassComponent:n=Fo(e.type,!0);break;case r.ForwardRef:n=Fo(ki(e.type)??e.type,!1);break;case r.FunctionComponent:case r.SimpleMemoComponent:n=Fo(ki(e.type)??e.type,!1);break;case r.HostComponent:case r.HostHoistable:case r.HostSingleton:typeof e.type==`string`&&(n=jo(e.type));break;case r.LazyComponent:n=jo(`Lazy`);break;case r.SuspenseComponent:n=e.child!==t&&t!==null?jo(`Suspense Fallback`):jo(`Suspense`);break;case r.SuspenseListComponent:n=jo(`SuspenseList`);break;case r.ViewTransitionComponent:n=jo(`ViewTransition`);break;default:return``}return n},Lo=e=>{try{let t=``,n=e,r=null;do{t+=Io(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+=Mo(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}`:``}},Ro=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(...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(`
55
+ `);n!==-1&&(t=t.slice(n+1));let r=Math.max(...ia.map(e=>t.indexOf(e)));if(r!==-1&&(r=t.lastIndexOf(`
56
+ `,r)),r!==-1)t=t.slice(0,r);else return``;return t},zo=e=>!!(e.functionName&&e.fileName&&Uo(e.fileName)),Bo=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,Vo=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){if(!zo(n))continue;let e=n.functionName,r=t.get(e)??[];r.some(e=>Bo(e,n))||(r.push(n),t.set(e,r))}return t},Ho=(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(ra,`(${a.fileName}:${a.lineNumber}:${a.columnNumber})`)}},Uo=e=>Qi.some(t=>e.startsWith(t)),Wo=e=>!e.isServer&&e.fileName&&Uo(e.fileName)?{...e,isServer:!0}:e,Go=e=>{let t=[],n=e;for(;n;)if(Do(n)){let e=n;if(n=e._debugOwner,n&&Eo(e)){let{frames:n,isTrusted:r}=ba(e._debugStack);if(r)for(let e of n)t.push(Wo(e))}}else{let e=n;if(n=e.owner,n&&e.debugStack instanceof Error)for(let n of ba(e.debugStack).frames)t.push({...n,isServer:!0})}return t},Ko=e=>{let t=[];return Ti(e,e=>{if(!Eo(e))return;let{frames:n,isTrusted:r}=ba(e._debugStack);r&&t.push(...n)},!0),t},qo=e=>{let t=Ko(e),n=da(Lo(e)),r=Vo(t),i=/* @__PURE__ */ new Map;return n.map(e=>e.source!==void 0&&ra.test(e.source)?Ho(e,r,i):e).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return e.functionName!==r.functionName})},Jo=async(e,t=!0,n,r={})=>To(qo(e),t,n,r),Yo=e=>!!e.fileName&&!e.isIgnoreListed,Xo=async(e,t=!0,n,r={})=>{let i=Go(e);if(i.length>0){let a=Oo(e)??{};a.functionName=Ai(e.type)??a.functionName;let o=await To([a,...i],t,n,r);if(o.some((e,t)=>t>0&&Yo(e)))return o}return Jo(e,t,n,r)},Zo=e=>e.split(`/`).filter(Boolean).length,Qo=e=>{let t=e.indexOf(`/`,1);if(t===-1)return e;let n=e.slice(0,t);if(Zo(n)!==1)return e;let r=e.slice(t);if(!ea.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},$o=e=>{if(!e||$i.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=Qo(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 Zi)if(t.startsWith(e)){t=t.slice(e.length),e===`file:///`&&(t=`/${t.replace(/^\/+/,``)}`),r=!0;break}}if(!n){let e=t.match(Xi);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);na.test(e)&&(t=t.slice(0,i))}return t},es=e=>{let t=$o(e);return!(!t||!ea.test(t)||ta.test(t))},ts=Symbol.for(`react.context`),ns=Symbol.for(`react.recoverable`),rs=[],is=null,as=Error("Suspense interrupted this render. This error is an internal implementation detail of `use`."),Y=()=>{let e=is;return e!==null&&(is=e.next),e},os=e=>typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`,ss=e=>typeof e==`object`&&!!e&&`current`in e,cs=e=>typeof e==`object`&&!!e&&`_currentValue`in e,ls=e=>e._currentValue,X=(e,t,n,r=null,i=null)=>{rs.push({displayName:r,primitive:e,stackError:Error(),value:t,debugInfo:i,dispatcherHookName:n})},us=e=>{if(typeof e==`object`&&e){if(os(e)){let t=e,n=os(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),as}if(`$$typeof`in e&&e.$$typeof===ns){X(`Recoverable`,void 0,`Use`);return}if(`$$typeof`in e&&e.$$typeof===ts&&cs(e)){let t={_currentValue:e._currentValue,displayName:typeof e.displayName==`string`?e.displayName:void 0},n=ls(t);return X(`Context (use)`,n,`Use`,t.displayName||`Context`),n}}throw new _i(`use() received an unsupported value: `+String(e))},ds=e=>{let t=ls(e);return X(`Context`,t,`Context`,e.displayName||null),t},fs=e=>{let t=Y(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return X(`State`,n,`State`),[n,()=>{}]},ps=(e,t,n)=>{let r=Y(),i=r===null?n===void 0?t:n(t):r.memoizedState;return X(`Reducer`,i,`Reducer`),[i,()=>{}]},ms=e=>{let t=Y(),n=ss(t?.memoizedState)?t.memoizedState:{current:e};return X(`Ref`,n.current,`Ref`),n},hs=()=>{let e=Y();return X(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},gs=e=>{Y(),X(`LayoutEffect`,e,`LayoutEffect`)},_s=e=>{Y(),X(`InsertionEffect`,e,`InsertionEffect`)},vs=e=>{Y(),X(`Effect`,e,`Effect`)},ys=e=>{Y();let t=ss(e)?e.current:void 0;X(`ImperativeHandle`,t,`ImperativeHandle`)},bs=(e,t)=>{X(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},xs=e=>{let t=Y();return X(`Callback`,Array.isArray(t?.memoizedState)?t.memoizedState[0]:e,`Callback`),e},Ss=e=>{let t=Y(),n=Array.isArray(t?.memoizedState)?t.memoizedState[0]:e();return X(`Memo`,n,`Memo`),n},Cs=(e,t)=>{let n=Y();Y();let r=n===null?t():n.memoizedState;return X(`SyncExternalStore`,r,`SyncExternalStore`),r},ws=()=>{let e=Y();Y();let t=e?.memoizedState===!0;return X(`Transition`,t,`Transition`),[t,()=>{}]},Ts=e=>{let t=Y(),n=t===null?e:t.memoizedState;return X(`DeferredValue`,n,`DeferredValue`),n},Es=()=>{let e=Y(),t=typeof e?.memoizedState==`string`?e.memoizedState:``;return X(`Id`,t,`Id`),t},Ds=e=>[],Os=e=>{let t=Y(),n=t===null?e:t.memoizedState;return X(`Optimistic`,n,`Optimistic`),[n,()=>{}]},ks=(e,t)=>{let n,r=null,i=null;if(e!==null){let t=e.memoizedState;if(os(t))switch(t.status){case`fulfilled`:n=t.value,r=t._debugInfo??null;break;case`rejected`:i=t.reason;break;default:i=as,n=t,r=t._debugInfo??null}else n=t}else n=t;return{value:n,debugInfo:r,error:i}},As=e=>(t,n)=>{let r=Y();Y(),Y();let{value:i,debugInfo:a,error:o}=ks(r,n);if(X(e,i,e,null,a),o!==null)throw o;return[i,()=>{},!1]},js=As(`ActionState`),Ms={readContext:ls,use:us,useCallback:xs,useContext:ds,useEffect:vs,useImperativeHandle:ys,useLayoutEffect:gs,useInsertionEffect:_s,useMemo:Ss,useReducer:ps,useRef:ms,useState:fs,useDebugValue:bs,useDeferredValue:Ts,useTransition:ws,useSyncExternalStore:Cs,useId:Es,useHostTransitionStatus:()=>{let e=ls({_currentValue:null});return X(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:As(`FormState`),useActionState:js,useOptimistic:Os,useMemoCache:Ds,useCacheRefresh:hs,useEffectEvent:e=>(Y(),X(`EffectEvent`,e,`EffectEvent`),e)};new Proxy(Ms,{get(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);throw new vi(`The React dispatcher is missing method `+t)}});let Ns=e=>{if(!e)return``;let t=e.lastIndexOf(`[as `);if(t!==-1)return Ns(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(Ms)].map(e=>Ns(e.name)));let Ps=[`top`,`right`,`bottom`,`left`];function Fs(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Is(e){return Math.round(e*10)/10}function Ls(e,t){let n=t.right<=e.left||t.left>=e.right,r=t.bottom<=e.top||t.top>=e.bottom,i=Vs(e.left,e.right,t.left,t.right),a=Vs(e.top,e.bottom,t.top,t.bottom),o=[];if(n||r)return t.bottom<=e.top?o.push(zs(`top`,i,t.bottom,e.top,t)):t.top>=e.bottom&&o.push(zs(`bottom`,i,e.bottom,t.top,t)),t.right<=e.left?o.push(Bs(`left`,a,t.right,e.left,t)):t.left>=e.right&&o.push(Bs(`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=Is(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 Rs(e,t){let n={...t};for(let t of e)n[t.side]=t.value;return n}function zs(e,t,n,r,i){let a={side:e,value:Is(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 Bs(e,t,n,r,i){let a={side:e,value:Is(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 Vs(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 Hs(e){let t=getComputedStyle(e),n=e=>Ps.map(n=>Is(Ws(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=Is(Ws(t.rowGap)),n=Is(Ws(t.columnGap));(e>0||n>0)&&(r.gap={row:e,column:n})}return r}function Us(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 Ws(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}let Gs={top:`t`,right:`r`,bottom:`b`,left:`l`},Ks={top:`y`,right:`x`,bottom:`y`,left:`x`};function qs(e,t,n,r){let i=new Set(e.classList),a=t===`gap`?[`gap-${n===`row`?`y`:`x`}`,`gap`]:[`${t[0]}${Gs[n]}`,`${t[0]}${Ks[n]}`,t[0]];for(let e of a){let t=[...i].find(t=>t.startsWith(`${e}-`));if(!t)continue;let n=Js(t.slice(e.length+1));return n!==void 0&&Math.abs(n-r)<.5?t:void 0}}function Js(e){if(e===`px`)return 1;let t=e.match(/^\[(-?[\d.]+)(px|rem)\]$/);if(t)return Number(t[1])*(t[2]===`rem`?Ys():1);if(/^\d+(?:\.\d+)?$/.test(e))return Number(e)*.25*Ys()}function Ys(){return Ws(getComputedStyle(document.documentElement).fontSize)||16}async function Xs(e){let t=e.getBoundingClientRect(),n=window.getSelection()?.toString().trim(),r=Hs(e);return{tagName:e.tagName.toLowerCase(),selector:Qs(e),html:rc(e),text:ac(e),components:await oc(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 Zs(e){let t=e.tagName.toLowerCase(),n=fc(e);if(!n)return t;let r=null;return Ti(n,e=>wi(e)?(r=Ai(e.type),!(!r||pc(r))):!1,!0),r?`${r} · ${t}`:t}function Qs(e){let t=[],n=e;for(;n&&n!==document.documentElement;){let r=$s(n);if(r){t.unshift(r);let n=t.join(` > `);if(tc(n,e))return n}else{t.unshift(ec(n));let r=t.join(` > `);if(t.length>=2&&tc(r,e))return r}n=n.parentElement}return t.join(` > `)}function $s(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 ec(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 tc(e,t){try{let n=document.querySelectorAll(e);return n.length===1&&n[0]===t}catch{return!1}}let nc=[`id`,`class`,`href`,`src`,`alt`,`type`,`name`,`role`,`aria-label`];function rc(e){let t=e.tagName.toLowerCase(),n=`<${[t,...[...e.attributes].filter(e=>!e.name.startsWith(`data-tencil`)).sort((e,t)=>ic(e.name)-ic(t.name)).slice(0,8).map(e=>{let t=e.name===`class`?80:120;return e.value?`${e.name}="${_c(e.value,t)}"`:e.name})].join(` `)}>`,r=e.children.length;return`${n}${r>0?`…${r} element${r===1?``:`s`}…`:_c(e.textContent?.trim()??``,100)}</${t}>`}function ic(e){let t=nc.indexOf(e);return t===-1?nc.length:t}function ac(e){let t=e.innerText?.replace(/\s+/g,` `).trim();return t?_c(t,200):void 0}async function oc(e){let t=sc(e);if(t.length>0)return t;let n=fc(e);if(!n)return[];try{let e=await vc(Xo(n),1500),t=lc(n),r=e.filter(e=>e.functionName&&!/^[a-z]/.test(e.functionName)&&!pc(e.functionName)).slice(0,6).map(e=>uc(e,t.get(e.functionName)));if(r.length>0)return r}catch{}return dc(n)}function sc(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`)??cc(i);s!==n&&(n=s,t.push({name:s,source:{file:i,line:Number(a),column:Number(o)}}))}return t}function cc(e){return e.slice(e.lastIndexOf(`/`)+1)}function lc(e){let t=/* @__PURE__ */ new Map;try{for(let n of Go(e))n.functionName&&n.fileName&&!t.has(n.functionName)&&t.set(n.functionName,hc(n.fileName))}catch{}return t}function uc(e,t){let n=e.functionName??`Anonymous`;if(!e.fileName)return{name:n};let r=gc(e.fileName);return r?{name:n,library:r}:es(e.fileName)?{name:n,source:{file:mc(hc(e.fileName),t),...e.lineNumber==null?{}:{line:e.lineNumber},...e.columnNumber==null?{}:{column:e.columnNumber}}}:{name:n}}function dc(e){let t=[];return Ti(e,e=>{if(wi(e)){let n=Ai(e.type);n&&!pc(n)&&t.push({name:n})}return t.length>=6},!0),t}function fc(e){try{return Yi(e)}catch{return null}}function pc(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 mc(e,t){return e.includes(`/`)||!t?e:t.endsWith(`/${e}`)?t:e}function hc(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 gc(e){return e.match(/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?((?:@[^/]+\/)?[^/]+)/)?.[1]}function _c(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function vc(e,t){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(/* @__PURE__ */ Error(`timeout`)),t))])}let yc;function bc(e){yc=e}function xc(){if(!yc)throw Error(`Tencil overlay is not mounted`);return yc}let Sc=/* @__PURE__ */ new Map;function Cc(e,t){let n=t??Tc(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 wc(e,t){let n=e.getBoundingClientRect(),r=(e,t)=>t>0?Dc(e/t,0,1):.5;return{offsetX:r(t.x-n.left,n.width),offsetY:r(t.y-n.top,n.height)}}function Tc(e){if(!e)return null;let t=Sc.get(e)?.deref();if(t?.isConnected&&t.matches(e))return t;try{let t=document.querySelector(e);return t&&Sc.set(e,new WeakRef(t)),t}catch{return null}}function Ec(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=Dc(a,12,r-t.width-12);let o=Dc(e.y-24,12,i-t.height-12),s=`${Dc(e.x-a,0,t.width)}px ${Dc(e.y-o,0,t.height)}px`;return{left:a,top:o,origin:s}}function Dc(e,t,n){return Math.max(t,Math.min(n,e))}function Oc(e,t){return e[13]=1,e[14]=t>>8,e[15]=t&255,e[16]=t>>8,e[17]=t&255,e}let kc;function Ac(){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 jc(e){let t=-1;kc||=Ac();for(let n=0;n<e.length;n++)t=kc[(t^e[n])&255]^t>>>8;return t^-1}function Mc(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 Nc(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=jc(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=Mc(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 Pc(e){let t=e.indexOf(`AAlwSFlz`);return t===-1&&(t=e.indexOf(`AAAJcEhZ`)),t===-1&&(t=e.indexOf(`AAAACXBI`)),t}let Fc=`[modern-screenshot]`,Ic=typeof window<`u`,Lc=Ic&&`Worker`in window,Rc=Ic&&`atob`in window,zc=Ic&&`btoa`in window,Bc=Ic?window.navigator?.userAgent:``,Vc=Bc.includes(`Chrome`),Hc=Bc.includes(`AppleWebKit`)&&!Vc,Uc=Bc.includes(`Firefox`),Wc=e=>e&&`__CONTEXT__`in e,Gc=e=>e.constructor.name===`CSSFontFaceRule`,Kc=e=>e.constructor.name===`CSSImportRule`,qc=e=>e.constructor.name===`CSSLayerBlockRule`,Z=e=>e.nodeType===1,Jc=e=>typeof e.className==`object`,Yc=e=>e.tagName===`image`,Xc=e=>e.tagName===`use`,Zc=e=>Z(e)&&e.style!==void 0&&!Jc(e),Qc=e=>e.nodeType===8,$c=e=>e.nodeType===3,el=e=>e.tagName===`IMG`,tl=e=>e.tagName===`VIDEO`,nl=e=>e.tagName===`CANVAS`,rl=e=>e.tagName===`TEXTAREA`,il=e=>e.tagName===`INPUT`,al=e=>e.tagName===`STYLE`,ol=e=>e.tagName===`SCRIPT`,sl=e=>e.tagName===`SELECT`,cl=e=>e.tagName===`SLOT`,ll=e=>e.tagName===`IFRAME`,ul=(...e)=>console.warn(Fc,...e);function dl(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 fl=e=>e.startsWith(`data:`);function pl(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(Ic&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!Ic)return e;let n=ml().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 ml(e){return(e&&Z(e)?e?.ownerDocument:e)??window.document}let hl=`http://www.w3.org/2000/svg`;function gl(e,t,n){let r=ml(n).createElementNS(hl,`svg`);return r.setAttributeNS(null,`width`,e.toString()),r.setAttributeNS(null,`height`,t.toString()),r.setAttributeNS(null,`viewBox`,`0 0 ${e} ${t}`),r}function _l(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 vl(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 yl=e=>vl(e,`dataUrl`);function bl(e,t){let n=ml(t).createElement(`img`);return n.decoding=`sync`,n.loading=`eager`,n.src=e,n}function xl(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:a,onWarn:o}=t??{},s=typeof e==`string`?bl(e,ml(i)):e,c=null,l=null;function u(){n(s),c&&clearTimeout(c),l?.()}if(r&&(c=setTimeout(u,r)),tl(s)){let e=s.currentSrc||s.src;if(!e)return s.poster?xl(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=Yc(s)?s.href.baseVal:s.currentSrc||s.src;if(!e)return u();let t=async()=>{if(el(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(el(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 Sl(e,t){Zc(e)&&(el(e)||tl(e)?await xl(e,t):await Promise.all([`img`,`video`].flatMap(n=>Array.from(e.querySelectorAll(n)).map(e=>xl(e,t)))))}let Cl=/* @__PURE__ */ function(){let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)}();function wl(e){return e?.split(`,`).map(e=>e.trim().replace(/"|'/g,``).toLowerCase()).filter(Boolean)}let Tl=0;function El(e){let t=`${Fc}[#${Tl}]`;return Tl++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...t)=>e&&ul(...t)}}function Dl(e){return{cache:e?`no-cache`:`force-cache`}}async function Ol(e,t){return Wc(e)?e:kl(e,{...t,autoDestruct:!0})}async function kl(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},a=!!t?.debug,o=t?.features??!0,s=e.ownerDocument??(Ic?window.document:void 0),c=e.ownerDocument?.defaultView??(Ic?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:Dl(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:El(a),node:e,ownerDocument:s,ownerWindow:c,dpi:n===1?null:96*n,svgStyleElement:Al(s),svgDefsElement:s?.createElementNS(hl,`defs`),svgStyles:/* @__PURE__ */ new Map,defaultComputedStyles:/* @__PURE__ */ new Map,workers:[...Array.from({length:Lc&&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:`${[dl(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 Sl(e,{timeout:u.timeout,onWarn:u.log.warn}),u.log.timeEnd(`wait until load`);let{width:d,height:f}=jl(e,u);return u.width=d,u.height=f,u}function Al(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 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(`,
61
+ `);return t.appendChild(n),t}function jl(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 Ml(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:a}=t;n.time(`image to canvas`);let o=await xl(e,{timeout:r,onWarn:t.log.warn}),{canvas:s,context2d:c}=Nl(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 Nl(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 Pl(e,t){if(e.ownerDocument)try{let t=e.toDataURL();if(t!==`data:,`)return bl(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 Fl(e,t){try{if(e?.contentDocument?.documentElement)return tu(e.contentDocument.documentElement,t)}catch(e){t.log.warn(`Failed to clone iframe`,e)}return e.cloneNode(!1)}function Il(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 Ll(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return bl(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 xl(n,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return e.poster?bl(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?bl(e.poster,e.ownerDocument):n}return Pl(a,t)}return n}function Rl(e,t){return nl(e)?Pl(e,t):ll(e)?Fl(e,t):el(e)?Il(e):tl(e)?Ll(e,t):e.cloneNode(!1)}function zl(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement(`iframe`),t.id=`__SANDBOX__${Cl()}`,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 Bl=[`width`,`height`,`-webkit-text-fill-color`],Vl=[`stroke`,`fill`];function Hl(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),a=Jc(e)&&i!==`svg`,o=a?Vl.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=zl(n)?.contentWindow;if(!c)return/* @__PURE__ */ new Map;let l=c?.document,u,d;a?(u=l.createElementNS(hl,`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);Bl.includes(e)||p.set(e,f.getPropertyValue(e))}return l.body.removeChild(u),r.set(s,p),p}function Ul(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 Wl(e,t,n,r){let{ownerWindow:i,includeStyleProperties:a,currentParentNodeStyle:o}=r,s=t.style,c=i.getComputedStyle(e),l=Hl(e,null,r);o?.forEach((e,t)=>{l.delete(t)});let u=Ul(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`),Vc&&(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 Gl(e,t){(rl(e)||il(e)||sl(e))&&t.setAttribute(`value`,e.value)}let Kl=[`::before`,`::after`],ql=[`::-webkit-scrollbar`,`::-webkit-scrollbar-button`,`::-webkit-scrollbar-thumb`,`::-webkit-scrollbar-track`,`::-webkit-scrollbar-track-piece`,`::-webkit-scrollbar-corner`,`::-webkit-resizer`];function Jl(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=[Cl()],d=Hl(e,n,r);c?.forEach((e,t)=>{d.delete(t)});let f=Ul(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}`)}Kl.forEach(l),n&&ql.forEach(l)}let Yl=/* @__PURE__ */ new Set([`symbol`]);async function Xl(e,t,n,r,i){if(Z(n)&&(al(n)||ol(n))||r.filter&&!r.filter(n))return;r.currentParentNodeStyle=Yl.has(t.nodeName)||Yl.has(n.nodeName)?void 0:r.currentNodeStyle;let a=await tu(n,r,!1,i);r.isEnable(`restoreScrollPosition`)&&Ql(e,a),t.appendChild(a)}async function Zl(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(!Qc(a)){if(Z(a)&&cl(a)&&typeof a.assignedNodes==`function`){let i=a.assignedNodes();for(let a=0;a<i.length;a++)await Xl(e,t,i[a],n,r)}else await Xl(e,t,a,n,r)}}function Ql(e,t){if(!Zc(e)||!Zc(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 $l(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 eu=/^[\w-:]+$/;async function tu(e,t,n=!1,r){let{ownerDocument:i,ownerWindow:a,fontFamilies:o,onCloneEachNode:s}=t;if(i&&$c(e))return r&&/\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&a&&Z(e)&&(Zc(e)||Jc(e))){let r=await Rl(e,t);if(t.isEnable(`removeAbnormalAttributes`)){let e=r.getAttributeNames();for(let t=e.length,n=0;n<t;n++){let t=e[n];eu.test(t)||r.removeAttribute(t)}}let i=t.currentNodeStyle=Wl(e,r,n,t);n&&$l(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=wl(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 Jl(e,r,a,t,u),Gl(e,r),tl(e)||await Zl(e,r,t,u),await s?.(r),r}let c=e.cloneNode(!1);return await Zl(e,c,t),await s?.(c),c}function nu(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 ru(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(yl);default:return e.text()}}).finally(()=>clearTimeout(o))}function iu(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`&&(Hc||Uc)&&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!Hc&&n.startsWith(`http`)&&h.length?new Promise((e,t)=>{h[l.size&h.length-1].postMessage({rawUrl:n,...b}),_.resolve=e,_.reject=t}):ru(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 au(e,t,n,r){if(!ou(e))return e;for(let[i,a]of cu(e,t))try{let t=await iu(n,{url:a,requestType:r?`image`:`text`,responseType:`dataUrl`});e=e.replace(lu(i),`$1${t}$3`)}catch(e){n.log.warn(`Failed to fetch css data url`,i,e)}return e}function ou(e){return/url\((['"]?)([^'"]+?)\1\)/.test(e)}let su=/url\((['"]?)([^'"]+?)\1\)/g;function cu(e,t){let n=[];return e.replace(su,(e,r,i)=>(n.push([i,pl(i,t)]),e)),n.filter(([e])=>!fl(e))}function lu(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}let uu=[`background-image`,`border-image-source`,`-webkit-border-image`,`-webkit-mask-image`,`list-style-image`];function du(e,t){return uu.map(n=>{let r=e.getPropertyValue(n);return!r||r===`none`?null:((Hc||Uc)&&t.drawImageCount++,au(r,null,t,!0).then(t=>{t&&r!==t&&e.setProperty(n,t,e.getPropertyPriority(n))}))}).filter(Boolean)}function fu(e,t){if(el(e)){let n=e.currentSrc||e.src;if(!fl(n))return[iu(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.srcset=``,e.dataset.originalSrc=n,e.src=t||``)})];(Hc||Uc)&&t.drawImageCount++}else if(Jc(e)&&!fl(e.href.baseVal)){let n=e.href.baseVal;return[iu(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.dataset.originalSrc=n,e.href.baseVal=t||``)})]}return[]}function pu(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[iu(t,{url:a,responseType:`text`}).then(e=>{r?.insertAdjacentHTML(`beforeend`,e)})]}return[]}function mu(e,t){let{tasks:n}=t;Z(e)&&((el(e)||Yc(e))&&n.push(...fu(e,t)),Xc(e)&&n.push(...pu(e,t))),Zc(e)&&n.push(...du(e.style,t)),e.childNodes.forEach(e=>{mu(e,t)})}async function hu(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=xu(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(Kc(e)){let n=e.href,r=``;try{r=await iu(t,{url:n,requestType:`text`,responseType:`text`})}catch(e){t.log.warn(`Error fetch remote css import from ${n}`,e)}let i=r.replace(su,(e,t,r)=>e.replace(r,pl(r,n)));for(let e of vu(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=>{Su(e.cssRules,u)}),u.filter(e=>Gc(e)&&ou(e.style.getPropertyValue(`src`))&&wl(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(au(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,t).then(e=>{e=xu(e,t),a.set(i.cssText,e),r.appendChild(n.createTextNode(`${e}
65
+ `))}))})}}}let gu=/(\/\*[\s\S]*?\*\/)/g,_u=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function vu(e){if(e==null)return[];let t=[],n=e.replace(gu,``);for(;;){let e=_u.exec(n);if(!e)break;t.push(e[0])}n=n.replace(_u,``);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 yu=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,bu=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function xu(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(bu,e=>{for(;;){let[t,,n]=yu.exec(e)||[];if(!n)return``;if(n===r)return`src: ${t};`}}):e}function Su(e,t=[]){for(let n of Array.from(e))qc(n)?t.push(...Su(n.cssRules)):`cssRules`in n?Su(n.cssRules,t):t.push(n);return t}let Cu=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function wu(e){return Cu.test(e.innerHTML)}async function Tu(e,t){let n=await Ol(e,t);if(Z(n.node)&&Jc(n.node)&&!wu(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 tu(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 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),n=t.filter(e=>hd(e)===`done`);return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`inbox-toolbar`,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`]}),n.length>0&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-resolve`,onClick:()=>{for(let e of n)V({type:`thread.resolve`,threadId:e.id,resolved:!0});n.some(e=>e.id===K.value)&&(K.value=null)},children:[/* @__PURE__ */ Q(Vu,{}),`Resolve `,n.length,` done`]})]}),/* @__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,s=e=>{Sn.value=e!==null,t(e)};A(()=>()=>{Sn.value=!1},[]);let c=()=>s(null),l=e=>{Cn(e),r(null),c()},u=(e,t)=>{t.preventDefault(),t.stopPropagation();let n=!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(t.key===`Escape`&&n)return c();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.`}),c()):l({...o,[e]:null});if(e===`measure`){if(kn(t.key))return l({...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 s=_f.find(t=>t!==e&&Fn(o[t],i));if(s)return a({action:e,shortcut:i,other:s}),r(null),c();l({...o,[e]:i})},d=({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:t,label:l,help:f})=>{let p=o[t],m=e===t,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-${t}`,children:l}),f&&/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:f})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-key${m?` recording`:``}`,"aria-labelledby":`tencil-shortcut-${t}`,"aria-describedby":`tencil-shortcut-${t}-value`,onClick:()=>{a(null),r(null),s(m?null:t)},onKeyDown:e=>{m&&u(t,e)},onBlur:()=>{m&&c()},children:/* @__PURE__ */ Q(`span`,{id:`tencil-shortcut-${t}-value`,children:m?`Press keys…`:h?/* @__PURE__ */ Q(`kbd`,{children:h}):/* @__PURE__ */ Q(`span`,{class:`shortcut-none`,children:`None`})})}),n?.action===t&&/* @__PURE__ */ Q(`p`,{class:`shortcut-message`,role:`alert`,children:n.text}),i?.action===t&&/* @__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:()=>d(i),children:`Swap`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-cancel`,onClick:()=>a(null),children:`Cancel`})]})]})]},t)})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-reset`,disabled:yf(o),onClick:()=>{c(),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,`
69
+ `}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&Z(h)&&(i.time(`embed web font`),await hu(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),mu(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=Eu(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&nu(n),await m?.(y),y}function Eu(e,t){let{width:n,height:r}=t,i=gl(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 Du(e,t){let n=await Ol(e,t),r=await Tu(n),i=_l(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=Al(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(hl,`defs`),n.svgStyles.clear()),await Ml(bl(i,r.ownerDocument),n)}async function Ou(e,t){let n=await Ol(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Du(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&Rc&&zc){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=Pc(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`?Nc(u,o,r):Oc(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function ku(e,t){return Ou(await Ol(e,{...t,type:`image/jpeg`}))}async function Au(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 ku(r,{scale:a,quality:.85,backgroundColor:ju(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 ju(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 Mu=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:--Mu,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),n.vnode&&n.vnode(u),u}let Nu={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 Pu(e){if(Nu[e])return Nu[e];let t=e.toLowerCase();if(t.includes(`claude`))return Nu.claudeAgent;if(t.includes(`codex`)||t.includes(`openai`))return Nu.codex;if(t.includes(`cursor`))return Nu.cursor;if(t.includes(`ensemble`))return Nu.ensemble}function Fu({agent:e,size:t=13,decorative:n=!1}){if(!e)return null;let r=Pu(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 Iu=()=>/* @__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`})]}),Lu=()=>/* @__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`})]}),Ru=()=>/* @__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`})]}),zu=()=>/* @__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`})]}),Bu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`m5 12 7-7 7 7M12 19V5`})}),Vu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`,fill:`currentColor`})}),Hu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M20 6 9 17l-5-5`})}),Uu=()=>/* @__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`})]}),Wu=()=>/* @__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`})}),Gu=()=>/* @__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`})}),Ku=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M18 6 6 18M6 6l12 12`})}),qu=()=>/* @__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`})]}),Ju=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m16 18 6-6-6-6M8 6l-6 6 6 6`})}),Yu=()=>/* @__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`})]}),Xu=({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:`M80 0C106.51 0 128 21.4903 128 48V80C128 106.51 106.51 128 80 128H4C1.79086 128 0 126.209 0 124V48C0 21.4903 21.4903 0 48 0H80ZM102.06 31.19A4 4 0 0 0 96.81 25.94L17.67 59.86A4 4 0 0 0 17.98 67.33L48.1 77.37A4 4 0 0 1 50.63 79.9L60.67 110.02A4 4 0 0 0 68.14 110.33Z`,transform:`translate(3 3) scale(0.140625)`,fill:`#3b62ff`,"fill-rule":`evenodd`})}),Zu=()=>/* @__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`})]}),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 7v4`})]}),$u=()=>/* @__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`})]}),ed=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m6 9 6 6 6-6`})}),td=()=>/* @__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`})}),nd=()=>/* @__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`})}),rd=F(()=>{let e=/* @__PURE__ */ new Map,t=[...ur.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function id(){let e=pr.value.flatMap(e=>{let t=rd.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 ad(){let e=od();if(J.value)return null;let t=G.value;return/* @__PURE__ */ Q(S,{children:[dr.value.map(e=>/* @__PURE__ */ Q(cd,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ Q(sd,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ Q(hd,{})]})}function od(){let e=dr.value,t=cr.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:rd.value.get(e.id),variant:gd(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 sd({pin:e}){sr.value;let t=e.thread.anchor?Cc(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(Hu,{})}),/* @__PURE__ */ Q(`span`,{class:`pin-shine`})]})]})}):null}function cd({thread:e}){if(sr.value,!e.anchor)return null;let t=or.value,n=t?.threadId===e.id,r=n?t.point:Cc(e.anchor);if(!r)return null;let i=K.value===e.id;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`pin pin-${gd(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>ud(t,e,r),onClick:()=>{if(ld===e.id){ld=null;return}G.value=null,K.value=i?null:e.id},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:rd.value.get(e.id)??`•`})})}let ld=null;function ud(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}ld=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!or.value&&Math.hypot(r,o)<4||(or.value={threadId:t.id,point:dd({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`,fd,!0);let n=or.value;n&&(or.value=null,ld=t.id,e.type===`pointerup`&&pd(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,fd,!0)}function dd(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 fd(e){e.preventDefault()}function pd(e,t){let n=md(t);if(!n)return;let r={selector:Qs(n),...wc(n,t)};V({type:`thread.move`,threadId:e.id,anchor:r})&&un({...e,anchor:r})}function md(e){let t=xc();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function hd(){sr.value;let e=G.value,t=Cc(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 gd(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 _d=`tencil:open`;function vd(){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`&&mn()},[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(Ku,{})})]}),e===`provider`?/* @__PURE__ */ Q(bd,{label:n}):/* @__PURE__ */ Q(yd,{scope:e})]}):null}function yd({scope:e}){let t=ur.value.filter(e=>Un.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&lr(t.pageUrl)===cr.value),n=t.filter(e=>gd(e)===`done`);return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`inbox-toolbar`,children:[/* @__PURE__ */ Q(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ Q(`span`,{class:`checkbox`,children:[/* @__PURE__ */ Q(`input`,{type:`checkbox`,class:`checkbox-input`,checked:Un.value,onChange:e=>{Un.value=e.target.checked}}),/* @__PURE__ */ Q(Hu,{})]}),`Show resolved`]}),n.length>0&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-resolve`,onClick:()=>{for(let e of n)V({type:`thread.resolve`,threadId:e.id,resolved:!0});n.some(e=>e.id===K.value)&&(K.value=null)},children:[/* @__PURE__ */ Q(Hu,{}),`Resolve `,n.length,` done`]})]}),/* @__PURE__ */ Q(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:Nn.value.comment?/* @__PURE__ */ Q(S,{children:[`No pins yet. Press `,/* @__PURE__ */ Q(`kbd`,{children:Nn.value.comment}),` and click anything on the page.`]}):`No pins yet. Click Comment, then anything on the page.`}):t.map(e=>/* @__PURE__ */ Q(Cd,{thread:e},e.id))})]})}function bd({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(xd,{summary:e},e.id))}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function xd({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=gn(e);t&&(K.value=t)},children:[/* @__PURE__ */ Q(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ Q(Sd,{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:Ed(e.status)}):e.background===`monitoring`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ Q(`span`,{class:`provider-item-time`,children:Dd(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(Fu,{agent:e.agent})]})]})}function Sd({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 Cd({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||lr(e.pageUrl)===cr.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(_d,e.id),location.href=e.pageUrl;return}K.value=e.id,wd(e)},children:[t?/* @__PURE__ */ Q(`span`,{class:`pin pin-static pin-${gd(e)}`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:rd.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,` · `]}),Td(e),` · `,Dd(e.updatedAt)]}),r&&/* @__PURE__ */ Q(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function wd(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function Td(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 Ed(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function Dd(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 Od({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(Bu,{})})]})]})}let kd=P(null);function Ad(){sr.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&&(mn(),hn())},[e,u,d]),A(()=>{kd.value=null},[d]),Ne(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=Cc(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Ec(f,{width:340,height:n}),g=L.value,_=g?.state===`ready`,v=Kn.value,y=v?null:kd.value,b=y?void 0:Fd(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(Ju,{}),e.label]}),g&&v&&/* @__PURE__ */ Q(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,pr.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(ed,{})]})]}),e.measuredTo&&tr.value&&/* @__PURE__ */ Q(Md,{pending:e}),c===`target`&&!v&&/* @__PURE__ */ Q(Ld,{onPick:e=>{kd.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ Q(Id,{choices:b,onPick:e=>{V({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ Q(Od,{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=Pd(await e.context,e),r=[];if(i){let t=await Au(e.element,xc());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();un({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?hr():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(qu,{})}),Wn.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{Gn.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(Zu,{})}),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(Fu,{agent:b.current?.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ Q(ed,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ Q(`p`,{class:`hint`,children:g.detail})]})}let jd={top:`above`,right:`right`,bottom:`below`,left:`left`};function Md({pending:e}){let t=e.measuredTo,n=Nd(e),r=[`top`,`right`,`bottom`,`left`].filter(e=>n?.[e]!==void 0).map(e=>`${n[e]} ${jd[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(Ku,{})})]})}function Nd(e){let t=e.measuredTo;return!t||!tr.value||!e.element.isConnected||!t.element.isConnected?void 0:Rs(Ls(Fs(e.element.getBoundingClientRect()),Fs(t.element.getBoundingClientRect())),{to:t.label,selector:Qs(t.element),...t.parent?{parent:!0}:{}})}function Pd(e,t){let n=Nd(t);return n?{...e,spacing:n}:e}function Fd(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 Id({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(Fu,{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 Ld({onPick:e}){let t=Kt.value,n=kd.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(Fu,{agent:t.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Dd(t.updatedAt)})]},t.id))]})}function Rd(){sr.value;let e=zn.value;if(!e)return null;let t=U.value===`picking`,n=!t&&!G.value&&tr.value&&Bn.value&&!W.value;if(!t&&!n)return null;let r=Fs(e.getBoundingClientRect());return/* @__PURE__ */ Q(S,{children:[tr.value&&(n||!Bn.value)&&/* @__PURE__ */ Q(Bd,{element:e,box:r}),/* @__PURE__ */ Q(`div`,{class:`highlight`,style:Gd(r)}),/* @__PURE__ */ Q(zd,{element:e,box:r})]})}function zd({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:[Zs(e),/* @__PURE__ */ Q(`span`,{class:`highlight-size`,children:[Is(t.right-t.left),`×`,Is(t.bottom-t.top)]})]})}function Bd({element:e,box:t}){let n=Hs(e),r=[...Vd(e,t,n),...Hd(e,t,n),...Wd(e,t,n)];return/* @__PURE__ */ Q(S,{children:[r.map((e,t)=>/* @__PURE__ */ Q(`div`,{class:`band band-${e.kind}`,style:Gd(e.box)},`band-${t}`)),r.filter(e=>e.labelled).map((e,t)=>/* @__PURE__ */ Q(`span`,{class:`band-value band-value-${e.kind}`,style:{transform:Kd(e.box)},children:[e.value,e.utility&&/* @__PURE__ */ Q(`span`,{class:`band-utility`,children:e.utility})]},`value-${t}`))]})}function Vd(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 Ud(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 Hd(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 Ud(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 Ud(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:qs(e,t,n,r)}))}function Wd(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 Us(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?qs(e,`gap`,r,n[r]):void 0}})}function Gd(e){return{transform:`translate(${e.left}px, ${e.top}px)`,width:`${e.right-e.left}px`,height:`${e.bottom-e.top}px`}}function Kd(e){return`translate(${(e.left+e.right)/2}px, ${(e.top+e.bottom)/2}px) translate(-50%, -50%)`}function qd(){if(sr.value,!tr.value)return null;let e=U.value===`idle`&&!G.value?W.value?.element:void 0,t=Yd(e),n=e?.isConnected?Fs(e.getBoundingClientRect()):null;return/* @__PURE__ */ Q(S,{children:[e&&n&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:Gd(n)}),/* @__PURE__ */ Q(zd,{element:e,box:n})]}),t&&/* @__PURE__ */ Q(Jd,{pair:t})]})}function Jd({pair:[e,t]}){if(!e.isConnected||!t.isConnected)return null;let n=Fs(e.getBoundingClientRect()),r=Fs(t.getBoundingClientRect()),i=G.value;return/* @__PURE__ */ Q(S,{children:[i?.element===e&&/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:Gd(n)}),/* @__PURE__ */ Q(`div`,{class:`measure-target`,style:Gd(r)}),Ls(n,r).map(e=>/* @__PURE__ */ Q(Xd,{guide:e},e.side))]})}function Yd(e){let t=zn.value,n=G.value;if(U.value===`picking`||!n&&!e){let e=t?.parentElement;return!Bn.value||!t||!e||e===document.documentElement?null:[t,e]}return e?Bn.value&&t&&t!==e?[e,t]:null:n?Bn.value&&t&&t!==n.element?[n.element,t]:n.measuredTo?[n.element,n.measuredTo.element]:null:null}function Xd({guide:e}){return/* @__PURE__ */ Q(S,{children:[e.extension&&/* @__PURE__ */ Q(`div`,{class:`guide guide-extension`,style:Zd(e.extension)}),/* @__PURE__ */ Q(`div`,{class:`guide`,style:Zd(e)}),/* @__PURE__ */ Q(`span`,{class:`guide-value`,style:{transform:Kd(Qd(e))},children:e.value})]})}function Zd(e){let t=Qd(e);return Gd(t.left===t.right?{...t,left:t.left-.5,right:t.left+.5}:{...t,top:t.top-.5,bottom:t.top+.5})}function Qd({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)}}let $d=`https://tencil.dev/changelog`;function ef(e){return e&&/^\d+\.\d+\.\d+$/.test(e)?`${$d}/${e.replaceAll(`.`,`-`)}`:$d}function tf({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:mr.value>0&&/* @__PURE__ */ Q(`span`,{class:`status-ping`})})}),n&&/* @__PURE__ */ Q(nf,{tone:e})]})}function nf({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(Xu,{size:18}),/* @__PURE__ */ Q(`strong`,{children:`Tencil`}),Ht.value&&/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:[`v`,Ht.value]})]}),/* @__PURE__ */ Q(of,{tone:e})]})}function rf(e=af()){let t=L.value,n=I.value,r=pr.value.length,i=mr.value,a=wt.value,o=[{label:an()?`Tencil Cloud`:`Daemon`,tone:n===`open`?`ok`:e,value:n===`open`?`Connected`:Xt.value?`Site not allowed`:n===`connecting`?`Connecting…`:`Offline`},{label:`Address`,value:ln()},{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:If(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 af(){return I.value===`open`?`warn`:`error`}function of({tone:e}){let t=L.value;return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`dl`,{class:`status-card-rows`,children:rf(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 sf=`https://github.com/tencildev/tencil`,cf=`npx tencil@latest setup`,lf=F(()=>!an()&&!!Ut.value?.latest&&Ut.value.state===`idle`),uf=P(!1),df=P(!1);function ff(){let e=Ht.value;if(an()||!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:ef(t.latest),target:`_blank`,rel:`noreferrer`,children:`What's new`})]}),n&&/* @__PURE__ */ Q(`p`,{class:`settings-help settings-progress`,children:mf(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:sf,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ Q(nd,{}),`tencildev/tencil`]}),/* @__PURE__ */ Q(`a`,{class:`settings-link`,href:$d,target:`_blank`,rel:`noreferrer`,children:`Changelog`}),/* @__PURE__ */ Q(`a`,{class:`settings-link settings-star`,href:sf,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ Q(td,{}),`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:cf}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(cf).then(()=>{uf.value=!0,setTimeout(()=>{uf.value=!1},1500)})},children:uf.value?`Copied`:`Copy`})]})]}),/* @__PURE__ */ Q(`details`,{class:`settings-debug`,children:[/* @__PURE__ */ Q(`summary`,{children:[/* @__PURE__ */ Q(ed,{}),`Debug`]}),/* @__PURE__ */ Q(`div`,{class:`settings-debug-body`,children:[/* @__PURE__ */ Q(of,{}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(pf()).then(()=>{df.value=!0,setTimeout(()=>{df.value=!1},1500)})},children:df.value?`Copied`:`Copy for a bug report`})]})]})]})}function pf(){let e=L.value;return[`Tencil v${Ht.value??`?`}`,...rf().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 mf(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 hf(){let e=Vt.value;return/* @__PURE__ */ Q(`div`,{class:`settings-section overview`,children:e&&!an()?/* @__PURE__ */ Q(gf,{source:e}):/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Pins on this page go to this project.`})})}function gf({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:_f(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 _f(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 vf=[{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.`}],yf=[`comment`,`ruler`,`hidePins`,`hideDock`];function bf(){let[e,t]=k(null),[n,r]=k(null),[i,a]=k(null),o=Sn.value,s=e=>{Cn.value=e!==null,t(e)};A(()=>()=>{Cn.value=!1},[]);let c=()=>s(null),l=e=>{wn(e),r(null),c()},u=(e,t)=>{t.preventDefault(),t.stopPropagation();let n=!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(t.key===`Escape`&&n)return c();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.`}),c()):l({...o,[e]:null});if(e===`measure`){if(An(t.key))return l({...o,measure:t.key});r({action:e,text:`Measure is held: press one key, ${xn?`⌥, ⇧, ⌃ or ⌘`:`Alt, Shift, Ctrl or Win`}.`});return}let i=Pn(t);if(!i)return;if(`error`in i){r({action:e,text:i.error});return}let s=yf.find(t=>t!==e&&In(o[t],i));if(s)return a({action:e,shortcut:i,other:s}),r(null),c();l({...o,[e]:i})},d=({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.`}):(wn({...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:vf.map(({action:t,label:l,help:f})=>{let p=o[t],m=e===t,h=p===null?null:typeof p==`string`?Mn(p):jn(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-${t}`,children:l}),f&&/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:f})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-key${m?` recording`:``}`,"aria-labelledby":`tencil-shortcut-${t}`,"aria-describedby":`tencil-shortcut-${t}-value`,onClick:()=>{a(null),r(null),s(m?null:t)},onKeyDown:e=>{m&&u(t,e)},onBlur:()=>{m&&c()},children:/* @__PURE__ */ Q(`span`,{id:`tencil-shortcut-${t}-value`,children:m?`Press keys…`:h?/* @__PURE__ */ Q(`kbd`,{children:h}):/* @__PURE__ */ Q(`span`,{class:`shortcut-none`,children:`None`})})}),n?.action===t&&/* @__PURE__ */ Q(`p`,{class:`shortcut-message`,role:`alert`,children:n.text}),i?.action===t&&/* @__PURE__ */ Q(`p`,{class:`shortcut-message`,role:`alert`,children:[jn(i.shortcut),` is already used for`,` `,vf.find(e=>e.action===i.other)?.label,`.`,/* @__PURE__ */ Q(`span`,{class:`shortcut-message-actions`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>d(i),children:`Swap`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-cancel`,onClick:()=>a(null),children:`Cancel`})]})]})]},t)})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-reset`,disabled:xf(o),onClick:()=>{c(),a(null),r(null),Tn()},children:`Reset to defaults`})]})}function xf(e){return Ln(e,H)}let Sf={id:`agent`,label:`Agent`};function Cf(){let e=j(null);Pf(e);let t=[{id:`overview`,label:`Project`},Sf,{id:`tools`,label:`Tools`}],n=[{id:`appearance`,label:`Appearance`},{id:`shortcuts`,label:`Shortcuts`},{id:`dock`,label:`Dock`},...wt.value?[{id:`account`,label:`Account`}]:[]],r=an()?[]:[{id:`about`,label:`About`}],i=[...t,...n,...r],a=i.find(e=>e.id===Hn.value)??Sf,o=()=>{Vn.value=!1},s=e=>{Hn.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&&Ff(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(Xu,{size:18}),`Settings`]}),/* @__PURE__ */ Q(wf,{pages:t,current:a.id,onSelect:s}),/* @__PURE__ */ Q(wf,{title:`You`,pages:n,current:a.id,onSelect:s}),r.length>0&&/* @__PURE__ */ Q(wf,{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:Tf(a.id)})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,"aria-label":`Close settings`,onClick:o,children:/* @__PURE__ */ Q(Ku,{})})]}),/* @__PURE__ */ Q(`div`,{class:`settings-body`,children:/* @__PURE__ */ Q(Ef,{id:a.id})})]})]})]})}function wf({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`&&lf.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 Tf(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 an()?`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 Ef({id:e}){switch(e){case`overview`:return/* @__PURE__ */ Q(hf,{});case`agent`:return/* @__PURE__ */ Q(Df,{});case`tools`:return/* @__PURE__ */ Q(Of,{});case`appearance`:return/* @__PURE__ */ Q(Af,{});case`shortcuts`:return/* @__PURE__ */ Q(bf,{});case`dock`:return/* @__PURE__ */ Q(jf,{});case`account`:return/* @__PURE__ */ Q(Mf,{});default:return/* @__PURE__ */ Q(ff,{})}}function Df(){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(Fu,{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:If(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 Of(){let e=R.value;return e?/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(Nf,{label:`Batch mode`,checked:e.batch,onChange:qn,help:/* @__PURE__ */ Q(S,{children:[`Adds `,/* @__PURE__ */ Q(Zu,{}),` to the comment box to queue comments and send them together.`]})}),/* @__PURE__ */ Q(Nf,{label:`Ruler`,checked:e.ruler,onChange:nr,help:/* @__PURE__ */ Q(S,{children:[`Adds `,/* @__PURE__ */ Q(Qu,{}),` to the toolbar.`,Nn.value.measure&&` With it on, hold ${Nn.value.measure} to measure spacing on the page.`]})})]}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:`Connecting…`})}let kf=[{id:`dark`,label:`Dark`},{id:`light`,label:`Light`},{id:`system`,label:`System`}];function Af(){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:kf.map(e=>/* @__PURE__ */ Q(`label`,{class:yr.value===e.id?`active`:void 0,children:[/* @__PURE__ */ Q(`input`,{type:`radio`,name:`tencil-theme`,checked:yr.value===e.id,onChange:()=>br(e.id)}),e.label]},e.id))})]})}function jf(){return/* @__PURE__ */ Q(Nf,{label:`Hide the dock`,checked:Xn.value,onChange:Qn,help:/* @__PURE__ */ Q(S,{children:[`Hides the toolbar, pins and panels on this site. Press`,` `,/* @__PURE__ */ Q(`kbd`,{children:Nn.value.hideDock}),` anywhere on the page to bring them back, or to hide them again.`]})})}function Mf(){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(on()),sn()},children:`Sign out`})]}):null}function Nf({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 Pf(e){A(()=>{let t=xc().shadowRoot?.activeElement;return e.current?.querySelector(`.settings-nav-item.active`)?.focus(),()=>{t instanceof HTMLElement&&t.isConnected&&t.focus()}},[])}function Ff(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=xc().shadowRoot?.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r?.focus())}function If(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 Lf({text:e,animate:t=!1}){let n=t?Hf(e):0;return/* @__PURE__ */ Q(`div`,{class:`md`,children:Rf(e,{index:0,animateFrom:t?n-48:1/0})})}function Rf(e,t){let n=[],r=e.replace(/\r\n/g,`
71
71
  `).split(`
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
+ `),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+=Hf(e.join(`
73
73
  `)),n.push(/* @__PURE__ */ Q(`pre`,{children:/* @__PURE__ */ Q(`code`,{children:e.join(`
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
+ `)})},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:Bf(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:Bf(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:Bf(s.join(` `),t)},a++))}return n}let zf=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\))/g;function Bf(e,t){return e.split(zf).map((e,n)=>{if(e.startsWith("`")&&e.endsWith("`")&&e.length>1)return t.index+=Hf(e),/* @__PURE__ */ Q(`code`,{children:e.slice(1,-1)},n);if(e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>3)return/* @__PURE__ */ Q(`strong`,{children:Vf(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:Vf(r[1],t)},n):Vf(e,t)})}function Vf(e,t){return t.animateFrom===1/0?(t.index+=Hf(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 Hf(e){let t=e.match(/\S+/g);return t?t.length:0}function Uf(){sr.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=or.value,o=a?.threadId===t.id?a.point:t.anchor?Cc(t.anchor):null,{left:s,top:c,origin:l}=o?Ec(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(Gf,{thread:t}),t.status===`draft`?/* @__PURE__ */ Q(Wf,{thread:t}):/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(Kf,{thread:t},t.id),/* @__PURE__ */ Q(Yf,{thread:t},t.id),/* @__PURE__ */ Q(Od,{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 Wf({thread:e}){let t=e.messages[0]?.text??``,n=pr.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:id,children:[`Send `,n===1?`it`:`all ${n}`,` now`]})]}),/* @__PURE__ */ Q(Od,{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 Gf({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:[`#`,rd.value.get(e.id)]}),/* @__PURE__ */ Q(`span`,{class:`chip`,title:t.selector,children:[/* @__PURE__ */ Q(Ju,{}),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 ${pn(e.provider.id)}`,children:/* @__PURE__ */ Q(Gu,{})}),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(Uu,{}):/* @__PURE__ */ Q(Hu,{})}),/* @__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(Wu,{})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:()=>{K.value=null},children:/* @__PURE__ */ Q(Ku,{})})]})]})}function Kf({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(qf,{message:e},e.id))})})}function qf({message:e}){let[t]=k(e.streaming);return/* @__PURE__ */ Q(`div`,{class:`message message-assistant`,children:/* @__PURE__ */ Q(Lf,{text:e.text,animate:t})})}function Jf({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 Yf({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(Zf,{steps:r,follow:a}),/* @__PURE__ */ Q(np,{thread:e,steps:i}),i&&!a&&/* @__PURE__ */ Q(`div`,{class:`status-line`,children:/* @__PURE__ */ Q(Xf,{...i,children:[r.filter(e=>!e.parentId).length,` steps`,ep(r)?` · ${ep(r)}`:``]})}),e.delivery&&!a&&/* @__PURE__ */ Q(rp,{delivery:e.delivery})]})}function Xf({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(ed,{})]})}function Zf({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(Hu,{}):e.status===`failed`?/* @__PURE__ */ Q(Ku,{}):`–`}),/* @__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:$f(e)})]},e.id))})}function Qf(e){return e.findLast(e=>e.status===`running`)}function $f(e){return e.endedAt?tp((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3):``}function ep(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 tp((Date.parse(r)-Date.parse(t.startedAt))/1e3)}function tp(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 np({thread:e,steps:t}){return e.status===`starting`?/* @__PURE__ */ Q(`div`,{class:`status-line`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),/* @__PURE__ */ Q(Jf,{text:`Starting a thread in ${pn(e.provider.id)}…`})]}):e.status===`working`?/* @__PURE__ */ Q(`div`,{class:`status-line`,children:[/* @__PURE__ */ Q(`span`,{class:`live-dot`}),t?/* @__PURE__ */ Q(Xf,{...t,children:/* @__PURE__ */ Q(Jf,{text:`${Qf(e.steps??[])?.label??`Working`}…`})}):/* @__PURE__ */ Q(Jf,{text:`Working…`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`stop`,onClick:()=>V({type:`thread.interrupt`,threadId:e.id}),children:[/* @__PURE__ */ Q(Vu,{}),` 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 rp({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(Jf,{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(Jf,{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 ip=`tencil:dock`,ap=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],op,sp=P(cp());function cp(){try{let e=localStorage.getItem(ip);return e&&ap.includes(e)?e:`bottom-center`}catch{return`bottom-center`}}function lp(e){sp.value=e;try{localStorage.setItem(ip,e)}catch{}}function up(e,t,n,r){let i=e<n/3?`left`:e>n*2/3?`right`:`center`;return`${t<r/2?`top`:`bottom`}-${i}`}function dp(e,t){if(e.button!==0)return;e.preventDefault();let n=e.currentTarget;try{n.setPointerCapture(e.pointerId)}catch{}let[r,i]=hp(t);op?.(),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`,fp,!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=gp(t);mp(t,p,up(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`,fp,!0)}function fp(e){e.preventDefault()}function pp(e,t){let[n,r]=sp.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?(lp(o),t.style.translate=``,!0):!1}function mp(e,t,n){lp(n);let r=0,i,a=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),op=void 0,e.style.transition=``,e.style.translate=``},o=t=>{t.target===e&&t.propertyName===`translate`&&a()};op=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),op=void 0},r=requestAnimationFrame(()=>{e.style.translate=``;let n=gp(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 hp(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 gp(e){return(e.querySelector(`.toolbar`)??e).getBoundingClientRect()}let _p=P(null);function vp(){let e=()=>{let e=bp(),t=_p.value;xp(e,t)||(_p.value=e)};e();let t=setInterval(e,500);return window.addEventListener(`resize`,e,{passive:!0}),()=>{clearInterval(t),window.removeEventListener(`resize`,e)}}function yp(e,t){return!t||e.endsWith(`center`)||up((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 bp(){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 xp(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 Sp(){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:Zt.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 Cp(){let e=Ep(),t=Nn.value,n=U.value===`picking`,r=j(null);return/* @__PURE__ */ Q(`div`,{ref:r,class:`toolbar-wrap dock-${sp.value}`,style:yp(sp.value,_p.value),children:[n&&/* @__PURE__ */ Q(`div`,{class:`toolbar-hint`,children:[`Click any element to pin a prompt`,tr.value&&t.measure&&` · ${t.measure} to measure`,` · Esc to cancel`]}),!n&&Yt.value&&/* @__PURE__ */ Q(Sp,{}),!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(tf,{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&&dp(e,r.current),onKeyDown:e=>{r.current&&pp(e.key,r.current)&&e.preventDefault()}}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${n?` tool-active`:``}`,title:Et.value??wp(`Comment`,t.comment),disabled:Et.value!==null,onClick:()=>n?gr():hr(),children:[/* @__PURE__ */ Q(Iu,{}),/* @__PURE__ */ Q(`span`,{class:`tool-label`,children:`Comment`}),t.comment&&/* @__PURE__ */ Q(`kbd`,{children:t.comment})]}),$n.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${er.value?``:` tool-off`}`,title:er.value?`${wp(`Ruler on`,t.ruler)}${t.measure?`: hold ${t.measure} to measure`:``}`:wp(`Ruler off`,t.ruler),"aria-label":`Ruler`,"aria-pressed":er.value,onClick:rr,children:er.value?/* @__PURE__ */ Q(Qu,{}):/* @__PURE__ */ Q($u,{})}),pr.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:id,children:[/* @__PURE__ */ Q(Bu,{}),/* @__PURE__ */ Q(`span`,{class:`tool-label`,children:[`Send `,pr.value.length]})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${q.value?` tool-active`:``}`,title:`Pins`,onClick:()=>{q.value=!q.value,Vn.value=!1},children:[/* @__PURE__ */ Q(Lu,{}),fr.value>0&&/* @__PURE__ */ Q(`span`,{class:`badge`,children:fr.value})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool`,title:wp(J.value?`Show pins`:`Hide pins`,t.hidePins),onClick:()=>{J.value=!J.value,J.value&&gr()},children:J.value?/* @__PURE__ */ Q(Ru,{}):/* @__PURE__ */ Q(zu,{})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`tool${Vn.value?` tool-active`:``}`,title:`Settings`,"aria-label":lf.value?`Settings (update available)`:void 0,disabled:!zt.value,onClick:()=>{Vn.value=!Vn.value,q.value=!1},children:[/* @__PURE__ */ Q(Yu,{}),lf.value&&/* @__PURE__ */ Q(`span`,{class:`tool-dot`})]})]})]})}function wp(e,t){return t?`${e} (${t})`:e}let Tp={label:`Switch agent`,run:()=>{Hn.value=`agent`,Vn.value=!0,q.value=!1}};function Ep(){if(I.value!==`open`){if(an())return{tone:`error`,title:`Tencil Cloud unreachable`,hint:I.value===`connecting`?void 0:`Can't reach Tencil Cloud. Retrying…`};let e=Xt.value;return e?{tone:`warn`,title:`Site not allowed yet`,hint:`Tencil only talks to sites you allow. Allow ${new URL(e.origin).host}?`,action:{label:`Allow`,run:()=>window.open(e.approveUrl,`tencil-allow`)}}:{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:()=>Dp(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:Tp};case`unavailable`:return{tone:`error`,title:t.detail??`${t.label} unavailable`,hint:t.detail??`${t.label} is unavailable`,action:Tp};default:return{tone:`warn`,title:`Connecting to ${t.label}…`}}}function Dp(e){Nt(on(),e).then(sn,e=>{Qt.value={message:e instanceof Error?e.message:String(e),at:Date.now()}})}function Op(){return jp(),Xn.value?/* @__PURE__ */ Q(`div`,{class:`root${Cr.value?` dark`:``}`,children:/* @__PURE__ */ Q(Ap,{})}):/* @__PURE__ */ Q(`div`,{class:`root${U.value===`picking`?` picking`:``}${Cr.value?` dark`:``}`,children:[/* @__PURE__ */ Q(Rd,{}),/* @__PURE__ */ Q(qd,{}),/* @__PURE__ */ Q(ad,{}),/* @__PURE__ */ Q(Ad,{}),/* @__PURE__ */ Q(Uf,{}),/* @__PURE__ */ Q(vd,{}),/* @__PURE__ */ Q(kp,{}),/* @__PURE__ */ Q(Cp,{}),Vn.value&&U.value!==`picking`&&/* @__PURE__ */ Q(Cf,{})]})}function kp(){let e=Qt.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 Ap(){let e=Zn.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:Nn.value.hideDock}),` to bring it back.`,/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>Qn(!1),children:`Undo`})]})}function jp(){let e=z.value;A(()=>{let t=sessionStorage.getItem(_d);if(!t)return;let n=e.get(t);n&&(sessionStorage.removeItem(_d),K.value=t,wd(n))},[e])}let Mp=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`dblclick`,`contextmenu`,`auxclick`];function Np(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`||Bn.value&&tr.value,i=null,a=null,o=()=>{if(!r()){zn.value&&=null;return}zn.value=!i||i.ours?null:n(i.x,i.y);let e=W.value?.element;e&&zn.value&&zn.value!==e&&(a=zn.value)},s=(e,t,n)=>{gr(),W.value=null,G.value={element:e,label:Zs(e),anchor:{selector:``,...t},context:Xs(e),...n?{measuredTo:{...n,label:Zs(n.element)}}:{}}},c=e=>{i={x:e.clientX,y:e.clientY,ours:t(e)},Bn.value=kn(Sn.value.measure,e),o()},l=e=>{Cn.value||e.key!==Sn.value.measure||(Bn.value=e.type===`keydown`,tr.value&&e.preventDefault(),o())},u=()=>{Bn.value=!1,o()},d=e=>{if(!r()&&e.type===`pointerdown`&&!t(e)){Vn.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=wc(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:Zs(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=kn(Sn.value.measure,i)&&tr.value&&l&&l!==document.documentElement;s(o,c,u?{element:l,parent:!0}:void 0)},p=e=>{if(Cn.value)return;let n=Sn.value;if(On(n.hideDock,e)&&!Fp(e)){e.preventDefault(),Qn(!Xn.value);return}if(!(t(e)&&!Pp(e)||Xn.value)){if(e.key===`Escape`){if(U.value===`picking`)gr();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(!Fp(e)){if(On(n.ruler,e)&&$n.value){e.preventDefault(),rr();return}if(On(n.hidePins,e)){e.preventDefault(),J.value=!J.value,J.value&&gr();return}if(On(n.comment,e)){e.preventDefault(),J.value=!1;let t=W.value;if(U.value===`picking`)gr();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 hr()}}}},m=0,h=()=>{m||=requestAnimationFrame(()=>{m=0,sr.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=lr(location.href);e!==cr.value&&(cr.value=e,G.value=null,W.value=null,K.value=null)},400);window.addEventListener(`pointermove`,c,{capture:!0,passive:!0});for(let e of Mp)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 Mp)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 Pp(e){let t=e.composedPath()[0];return t instanceof Element&&t.closest(`.toolbar`)!==null}function Fp(e){let t=e.composedPath()[0];return t instanceof HTMLElement?t.isContentEditable||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement:!1}function Ip(){let e=document.currentScript;return e?.dataset.bridge?e.dataset.bridge:e?.src?new URL(e.src).origin:`http://localhost:4747`}function Lp(){let e=document.currentScript;if(e?.src)return new URL(e.src).searchParams.get(`root`)??void 0}function Rp(){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 zp(){try{CSS.registerProperty({name:`--tencil-rim`,syntax:`<angle>`,inherits:!1,initialValue:`0deg`})}catch{}}function Bp(e,t,n){zp();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=`
75
75
  :host { all: initial; }
76
76
  * { box-sizing: border-box; }
77
77
 
@@ -1065,4 +1065,4 @@ kbd {
1065
1065
  @keyframes pin-dissolve { to { opacity: 0; } }
1066
1066
  .shimmer > span[aria-hidden], .status-ping, .live-dot { animation: none; }
1067
1067
  }
1068
- `;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})}})();
1068
+ `;let o=document.querySelector(`script[nonce]`)?.nonce;o&&(a.nonce=o),i.append(a);let s=document.createElement(`div`);i.append(s),bc(r),document.body.append(r);let c=new MutationObserver(()=>{r.isConnected||document.body.append(r)});c.observe(document.body,{childList:!0});let l=Np(r),u=vp();_e(te(Op,{}),s),rn(e,t,n),Xn.value&&console.info(`Tencil is hidden. Press ${Nn.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=Ip(),t=Rp(),n=Lp();document.body?Bp(e,t,n):document.addEventListener(`DOMContentLoaded`,()=>Bp(e,t,n),{once:!0})}})();