@runcontext/ui 0.5.11 → 0.6.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.
package/static/app.js ADDED
@@ -0,0 +1,16 @@
1
+ (function(){"use strict";var Re,_,Ut,Gt,Y,jt,Wt,Ft,qt,ht,vt,pt,Ht,Me={},Oe=[],si=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,be=Array.isArray;function W(t,e){for(var i in e)t[i]=e[i];return t}function ft(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function _t(t,e,i){var r,a,l,s={};for(l in e)l=="key"?r=e[l]:l=="ref"?a=e[l]:s[l]=e[l];if(arguments.length>2&&(s.children=arguments.length>3?Re.call(arguments,2):i),typeof t=="function"&&t.defaultProps!=null)for(l in t.defaultProps)s[l]===void 0&&(s[l]=t.defaultProps[l]);return Le(t,s,r,a,null)}function Le(t,e,i,r,a){var l={type:t,props:e,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++Ut,__i:-1,__u:0};return a==null&&_.vnode!=null&&_.vnode(l),l}function z(t){return t.children}function U(t,e){this.props=t,this.context=e}function se(t,e){if(e==null)return t.__?se(t.__,t.__i+1):null;for(var i;e<t.__k.length;e++)if((i=t.__k[e])!=null&&i.__e!=null)return i.__e;return typeof t.type=="function"?se(t):null}function oi(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,r=[],a=[],l=W({},e);l.__v=e.__v+1,_.vnode&&_.vnode(l),gt(t.__P,l,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,r,i??se(e),!!(32&e.__u),a),l.__v=e.__v,l.__.__k[l.__i]=l,Zt(r,l,a),e.__e=e.__=null,l.__e!=i&&Vt(l)}}function Vt(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),Vt(t)}function mt(t){(!t.__d&&(t.__d=!0)&&Y.push(t)&&!ze.__r++||jt!=_.debounceRendering)&&((jt=_.debounceRendering)||Wt)(ze)}function ze(){try{for(var t,e=1;Y.length;)Y.length>e&&Y.sort(Ft),t=Y.shift(),e=Y.length,oi(t)}finally{Y.length=ze.__r=0}}function Yt(t,e,i,r,a,l,s,c,u,o,h){var d,f,v,x,B,$,g,m=r&&r.__k||Oe,w=e.length;for(u=ci(i,e,m,u,w),d=0;d<w;d++)(v=i.__k[d])!=null&&(f=v.__i!=-1&&m[v.__i]||Me,v.__i=d,$=gt(t,v,f,a,l,s,c,u,o,h),x=v.__e,v.ref&&f.ref!=v.ref&&(f.ref&&bt(f.ref,null,v),h.push(v.ref,v.__c||x,v)),B==null&&x!=null&&(B=x),(g=!!(4&v.__u))||f.__k===v.__k?u=Jt(v,u,t,g):typeof v.type=="function"&&$!==void 0?u=$:x&&(u=x.nextSibling),v.__u&=-7);return i.__e=B,u}function ci(t,e,i,r,a){var l,s,c,u,o,h=i.length,d=h,f=0;for(t.__k=new Array(a),l=0;l<a;l++)(s=e[l])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=t.__k[l]=Le(null,s,null,null,null):be(s)?s=t.__k[l]=Le(z,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=t.__k[l]=Le(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):t.__k[l]=s,u=l+f,s.__=t,s.__b=t.__b+1,c=null,(o=s.__i=di(s,i,u,d))!=-1&&(d--,(c=i[o])&&(c.__u|=2)),c==null||c.__v==null?(o==-1&&(a>h?f--:a<h&&f++),typeof s.type!="function"&&(s.__u|=4)):o!=u&&(o==u-1?f--:o==u+1?f++:(o>u?f--:f++,s.__u|=4))):t.__k[l]=null;if(d)for(l=0;l<h;l++)(c=i[l])!=null&&(2&c.__u)==0&&(c.__e==r&&(r=se(c)),en(c,c));return r}function Jt(t,e,i,r){var a,l;if(typeof t.type=="function"){for(a=t.__k,l=0;a&&l<a.length;l++)a[l]&&(a[l].__=t,e=Jt(a[l],e,i,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=se(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function De(t,e){return e=e||[],t==null||typeof t=="boolean"||(be(t)?t.some(function(i){De(i,e)}):e.push(t)),e}function di(t,e,i,r){var a,l,s,c=t.key,u=t.type,o=e[i],h=o!=null&&(2&o.__u)==0;if(o===null&&c==null||h&&c==o.key&&u==o.type)return i;if(r>(h?1:0)){for(a=i-1,l=i+1;a>=0||l<e.length;)if((o=e[s=a>=0?a--:l++])!=null&&(2&o.__u)==0&&c==o.key&&u==o.type)return s}return-1}function Kt(t,e,i){e[0]=="-"?t.setProperty(e,i??""):t[e]=i==null?"":typeof i!="number"||si.test(e)?i:i+"px"}function Ue(t,e,i,r,a){var l,s;e:if(e=="style")if(typeof i=="string")t.style.cssText=i;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)i&&e in i||Kt(t.style,e,"");if(i)for(e in i)r&&i[e]==r[e]||Kt(t.style,e,i[e])}else if(e[0]=="o"&&e[1]=="n")l=e!=(e=e.replace(qt,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+l]=i,i?r?i.u=r.u:(i.u=ht,t.addEventListener(e,l?pt:vt,l)):t.removeEventListener(e,l?pt:vt,l);else{if(a=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=i??"";break e}catch{}typeof i=="function"||(i==null||i===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&i==1?"":i))}}function Qt(t){return function(e){if(this.l){var i=this.l[e.type+t];if(e.t==null)e.t=ht++;else if(e.t<i.u)return;return i(_.event?_.event(e):e)}}}function gt(t,e,i,r,a,l,s,c,u,o){var h,d,f,v,x,B,$,g,m,w,T,N,O,D,Dt,j=e.type;if(e.constructor!==void 0)return null;128&i.__u&&(u=!!(32&i.__u),l=[c=e.__e=i.__e]),(h=_.__b)&&h(e);e:if(typeof j=="function")try{if(g=e.props,m=j.prototype&&j.prototype.render,w=(h=j.contextType)&&r[h.__c],T=h?w?w.props.value:h.__:r,i.__c?$=(d=e.__c=i.__c).__=d.__E:(m?e.__c=d=new j(g,T):(e.__c=d=new U(g,T),d.constructor=j,d.render=hi),w&&w.sub(d),d.state||(d.state={}),d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),m&&d.__s==null&&(d.__s=d.state),m&&j.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=W({},d.__s)),W(d.__s,j.getDerivedStateFromProps(g,d.__s))),v=d.props,x=d.state,d.__v=e,f)m&&j.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),m&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(m&&j.getDerivedStateFromProps==null&&g!==v&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(g,T),e.__v==i.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(g,d.__s,T)===!1){e.__v!=i.__v&&(d.props=g,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(ye){ye&&(ye.__=e)}),Oe.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(g,d.__s,T),m&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(v,x,B)})}if(d.context=T,d.props=g,d.__P=t,d.__e=!1,N=_.__r,O=0,m)d.state=d.__s,d.__d=!1,N&&N(e),h=d.render(d.props,d.state,d.context),Oe.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,N&&N(e),h=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++O<25);d.state=d.__s,d.getChildContext!=null&&(r=W(W({},r),d.getChildContext())),m&&!f&&d.getSnapshotBeforeUpdate!=null&&(B=d.getSnapshotBeforeUpdate(v,x)),D=h!=null&&h.type===z&&h.key==null?Xt(h.props.children):h,c=Yt(t,be(D)?D:[D],e,i,r,a,l,s,c,u,o),d.base=e.__e,e.__u&=-161,d.__h.length&&s.push(d),$&&(d.__E=d.__=null)}catch(ye){if(e.__v=null,u||l!=null)if(ye.then){for(e.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;l[l.indexOf(c)]=null,e.__e=c}else{for(Dt=l.length;Dt--;)ft(l[Dt]);yt(e)}else e.__e=i.__e,e.__k=i.__k,ye.then||yt(e);_.__e(ye,e,i)}else l==null&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):c=e.__e=ui(i.__e,e,i,r,a,l,s,u,o);return(h=_.diffed)&&h(e),128&e.__u?void 0:c}function yt(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(yt))}function Zt(t,e,i){for(var r=0;r<i.length;r++)bt(i[r],i[++r],i[++r]);_.__c&&_.__c(e,t),t.some(function(a){try{t=a.__h,a.__h=[],t.some(function(l){l.call(a)})}catch(l){_.__e(l,a.__v)}})}function Xt(t){return typeof t!="object"||t==null||t.__b>0?t:be(t)?t.map(Xt):W({},t)}function ui(t,e,i,r,a,l,s,c,u){var o,h,d,f,v,x,B,$=i.props||Me,g=e.props,m=e.type;if(m=="svg"?a="http://www.w3.org/2000/svg":m=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),l!=null){for(o=0;o<l.length;o++)if((v=l[o])&&"setAttribute"in v==!!m&&(m?v.localName==m:v.nodeType==3)){t=v,l[o]=null;break}}if(t==null){if(m==null)return document.createTextNode(g);t=document.createElementNS(a,m,g.is&&g),c&&(_.__m&&_.__m(e,l),c=!1),l=null}if(m==null)$===g||c&&t.data==g||(t.data=g);else{if(l=l&&Re.call(t.childNodes),!c&&l!=null)for($={},o=0;o<t.attributes.length;o++)$[(v=t.attributes[o]).name]=v.value;for(o in $)v=$[o],o=="dangerouslySetInnerHTML"?d=v:o=="children"||o in g||o=="value"&&"defaultValue"in g||o=="checked"&&"defaultChecked"in g||Ue(t,o,null,v,a);for(o in g)v=g[o],o=="children"?f=v:o=="dangerouslySetInnerHTML"?h=v:o=="value"?x=v:o=="checked"?B=v:c&&typeof v!="function"||$[o]===v||Ue(t,o,v,$[o],a);if(h)c||d&&(h.__html==d.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(d&&(t.innerHTML=""),Yt(e.type=="template"?t.content:t,be(f)?f:[f],e,i,r,m=="foreignObject"?"http://www.w3.org/1999/xhtml":a,l,s,l?l[0]:i.__k&&se(i,0),c,u),l!=null)for(o=l.length;o--;)ft(l[o]);c||(o="value",m=="progress"&&x==null?t.removeAttribute("value"):x!=null&&(x!==t[o]||m=="progress"&&!x||m=="option"&&x!=$[o])&&Ue(t,o,x,$[o],a),o="checked",B!=null&&B!=t[o]&&Ue(t,o,B,$[o],a))}return t}function bt(t,e,i){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(a){_.__e(a,i)}}function en(t,e,i){var r,a;if(_.unmount&&_.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||bt(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(l){_.__e(l,e)}r.base=r.__P=null}if(r=t.__k)for(a=0;a<r.length;a++)r[a]&&en(r[a],e,i||typeof t.type!="function");i||ft(t.__e),t.__c=t.__=t.__e=void 0}function hi(t,e,i){return this.constructor(t,i)}function wt(t,e,i){var r,a,l,s;e==document&&(e=document.documentElement),_.__&&_.__(t,e),a=(r=!1)?null:e.__k,l=[],s=[],gt(e,t=e.__k=_t(z,null,[t]),a||Me,Me,e.namespaceURI,a?null:e.firstChild?Re.call(e.childNodes):null,l,a?a.__e:e.firstChild,r,s),Zt(l,t,s)}function vi(t){function e(i){var r,a;return this.getChildContext||(r=new Set,(a={})[e.__c]=this,this.getChildContext=function(){return a},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(l){this.props.value!=l.value&&r.forEach(function(s){s.__e=!0,mt(s)})},this.sub=function(l){r.add(l);var s=l.componentWillUnmount;l.componentWillUnmount=function(){r&&r.delete(l),s&&s.call(l)}}),i.children}return e.__c="__cC"+Ht++,e.__=t,e.Provider=e.__l=(e.Consumer=function(i,r){return i.children(r)}).contextType=e,e}Re=Oe.slice,_={__e:function(t,e,i,r){for(var a,l,s;e=e.__;)if((a=e.__c)&&!a.__)try{if((l=a.constructor)&&l.getDerivedStateFromError!=null&&(a.setState(l.getDerivedStateFromError(t)),s=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(t,r||{}),s=a.__d),s)return a.__E=a}catch(c){t=c}throw t}},Ut=0,Gt=function(t){return t!=null&&t.constructor===void 0},U.prototype.setState=function(t,e){var i;i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=W({},this.state),typeof t=="function"&&(t=t(W({},i),this.props)),t&&W(i,t),t!=null&&this.__v&&(e&&this._sb.push(e),mt(this))},U.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),mt(this))},U.prototype.render=z,Y=[],Wt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ft=function(t,e){return t.__v.__b-e.__v.__b},ze.__r=0,qt=/(PointerCapture)$|Capture$/i,ht=0,vt=Qt(!1),pt=Qt(!0),Ht=0;var pi=0;function n(t,e,i,r,a,l){e||(e={});var s,c,u=e;if("ref"in u)for(c in u={},e)c=="ref"?s=e[c]:u[c]=e[c];var o={type:t,props:u,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--pi,__i:-1,__u:0,__source:a,__self:l};if(typeof t=="function"&&(s=t.defaultProps))for(c in s)u[c]===void 0&&(u[c]=s[c]);return _.vnode&&_.vnode(o),o}var ee,C,Ct,tn,we=0,nn=[],I=_,rn=I.__b,an=I.__r,ln=I.diffed,sn=I.__c,on=I.unmount,cn=I.__;function Ce(t,e){I.__h&&I.__h(C,t,we||e),we=0;var i=C.__H||(C.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function te(t){return we=1,fi(hn,t)}function fi(t,e,i){var r=Ce(ee++,2);if(r.t=t,!r.__c&&(r.__=[i?i(e):hn(void 0,e),function(c){var u=r.__N?r.__N[0]:r.__[0],o=r.t(u,c);u!==o&&(r.__N=[o,r.__[1]],r.__c.setState({}))}],r.__c=C,!C.__f)){var a=function(c,u,o){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(f){return f.__c});if(h.every(function(f){return!f.__N}))return!l||l.call(this,c,u,o);var d=r.__c.props!==c;return h.some(function(f){if(f.__N){var v=f.__[0];f.__=f.__N,f.__N=void 0,v!==f.__[0]&&(d=!0)}}),l&&l.call(this,c,u,o)||d};C.__f=!0;var l=C.shouldComponentUpdate,s=C.componentWillUpdate;C.componentWillUpdate=function(c,u,o){if(this.__e){var h=l;l=void 0,a(c,u,o),l=h}s&&s.call(this,c,u,o)},C.shouldComponentUpdate=a}return r.__N||r.__}function Ge(t,e){var i=Ce(ee++,3);!I.__s&&un(i.__H,e)&&(i.__=t,i.u=e,C.__H.__h.push(i))}function oe(t){return we=5,je(function(){return{current:t}},[])}function je(t,e){var i=Ce(ee++,7);return un(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function ce(t,e){return we=8,je(function(){return t},e)}function _i(t){var e=C.context[t.__c],i=Ce(ee++,9);return i.c=t,e?(i.__==null&&(i.__=!0,e.sub(C)),e.props.value):t.__}function mi(){var t=Ce(ee++,11);if(!t.__){for(var e=C.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var i=e.__m||(e.__m=[0,0]);t.__="P"+i[0]+"-"+i[1]++}return t.__}function gi(){for(var t;t=nn.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(We),e.__h.some(kt),e.__h=[]}catch(i){e.__h=[],I.__e(i,t.__v)}}}I.__b=function(t){C=null,rn&&rn(t)},I.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),cn&&cn(t,e)},I.__r=function(t){an&&an(t),ee=0;var e=(C=t.__c).__H;e&&(Ct===C?(e.__h=[],C.__h=[],e.__.some(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(e.__h.some(We),e.__h.some(kt),e.__h=[],ee=0)),Ct=C},I.diffed=function(t){ln&&ln(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(nn.push(e)!==1&&tn===I.requestAnimationFrame||((tn=I.requestAnimationFrame)||yi)(gi)),e.__H.__.some(function(i){i.u&&(i.__H=i.u),i.u=void 0})),Ct=C=null},I.__c=function(t,e){e.some(function(i){try{i.__h.some(We),i.__h=i.__h.filter(function(r){return!r.__||kt(r)})}catch(r){e.some(function(a){a.__h&&(a.__h=[])}),e=[],I.__e(r,i.__v)}}),sn&&sn(t,e)},I.unmount=function(t){on&&on(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(r){try{We(r)}catch(a){e=a}}),i.__H=void 0,e&&I.__e(e,i.__v))};var dn=typeof requestAnimationFrame=="function";function yi(t){var e,i=function(){clearTimeout(r),dn&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(i,35);dn&&(e=requestAnimationFrame(i))}function We(t){var e=C,i=t.__c;typeof i=="function"&&(t.__c=void 0,i()),C=e}function kt(t){var e=C;t.__c=t.__(),C=e}function un(t,e){return!t||t.length!==e.length||e.some(function(i,r){return i!==t[r]})}function hn(t,e){return typeof e=="function"?e(t):e}function bi(t,e){for(var i in e)t[i]=e[i];return t}function vn(t,e){for(var i in t)if(i!=="__source"&&!(i in e))return!0;for(var r in e)if(r!=="__source"&&t[r]!==e[r])return!0;return!1}function pn(t,e){this.props=t,this.context=e}(pn.prototype=new U).isPureReactComponent=!0,pn.prototype.shouldComponentUpdate=function(t,e){return vn(this.props,t)||vn(this.state,e)};var fn=_.__b;_.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),fn&&fn(t)};var wi=_.__e;_.__e=function(t,e,i,r){if(t.then){for(var a,l=e;l=l.__;)if((a=l.__c)&&a.__c)return e.__e==null&&(e.__e=i.__e,e.__k=i.__k),a.__c(t,e)}wi(t,e,i,r)};var _n=_.unmount;function mn(t,e,i){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),t.__c.__H=null),(t=bi({},t)).__c!=null&&(t.__c.__P===i&&(t.__c.__P=e),t.__c.__e=!0,t.__c=null),t.__k=t.__k&&t.__k.map(function(r){return mn(r,e,i)})),t}function gn(t,e,i){return t&&i&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(r){return gn(r,e,i)}),t.__c&&t.__c.__P===e&&(t.__e&&i.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=i)),t}function xt(){this.__u=0,this.o=null,this.__b=null}function yn(t){var e=t.__&&t.__.__c;return e&&e.__a&&e.__a(t)}function Fe(){this.i=null,this.l=null}_.unmount=function(t){var e=t.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),_n&&_n(t)},(xt.prototype=new U).__c=function(t,e){var i=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(i);var a=yn(r.__v),l=!1,s=function(){l||r.__z||(l=!0,i.__R=null,a?a(u):u())};i.__R=s;var c=i.__P;i.__P=null;var u=function(){if(!--r.__u){if(r.state.__a){var o=r.state.__a;r.__v.__k[0]=gn(o,o.__c.__P,o.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.__P=c,h.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(s,s)},xt.prototype.componentWillUnmount=function(){this.o=[]},xt.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var i=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=mn(this.__b,i,r.__O=r.__P)}this.__b=null}var a=e.__a&&_t(z,null,t.fallback);return a&&(a.__u&=-33),[_t(z,null,e.__a?null:t.children),a]};var bn=function(t,e,i){if(++i[1]===i[0]&&t.l.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(i=t.i;i;){for(;i.length>3;)i.pop()();if(i[1]<i[0])break;t.i=i=i[2]}};(Fe.prototype=new U).__a=function(t){var e=this,i=yn(e.__v),r=e.l.get(t);return r[0]++,function(a){var l=function(){e.props.revealOrder?(r.push(a),bn(e,t,r)):a()};i?i(l):l()}},Fe.prototype.render=function(t){this.i=null,this.l=new Map;var e=De(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var i=e.length;i--;)this.l.set(e[i],this.i=[1,0,this.i]);return t.children},Fe.prototype.componentDidUpdate=Fe.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,i){bn(t,i,e)})};var Ci=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ki=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,xi=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Si=/[A-Z0-9]/g,Ti=typeof document<"u",Pi=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};U.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(U.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var wn=_.event;_.event=function(t){return wn&&(t=wn(t)),t.persist=function(){},t.isPropagationStopped=function(){return this.cancelBubble},t.isDefaultPrevented=function(){return this.defaultPrevented},t.nativeEvent=t};var $i={configurable:!0,get:function(){return this.class}},Cn=_.vnode;_.vnode=function(t){typeof t.type=="string"&&(function(e){var i=e.props,r=e.type,a={},l=r.indexOf("-")==-1;for(var s in i){var c=i[s];if(!(s==="value"&&"defaultValue"in i&&c==null||Ti&&s==="children"&&r==="noscript"||s==="class"||s==="className")){var u=s.toLowerCase();s==="defaultValue"&&"value"in i&&i.value==null?s="value":s==="download"&&c===!0?c="":u==="translate"&&c==="no"?c=!1:u[0]==="o"&&u[1]==="n"?u==="ondoubleclick"?s="ondblclick":u!=="onchange"||r!=="input"&&r!=="textarea"||Pi(i.type)?u==="onfocus"?s="onfocusin":u==="onblur"?s="onfocusout":xi.test(s)&&(s=u):u=s="oninput":l&&ki.test(s)?s=s.replace(Si,"-$&").toLowerCase():c===null&&(c=void 0),u==="oninput"&&a[s=u]&&(s="oninputCapture"),a[s]=c}}r=="select"&&(a.multiple&&Array.isArray(a.value)&&(a.value=De(i.children).forEach(function(o){o.props.selected=a.value.indexOf(o.props.value)!=-1})),a.defaultValue!=null&&(a.value=De(i.children).forEach(function(o){o.props.selected=a.multiple?a.defaultValue.indexOf(o.props.value)!=-1:a.defaultValue==o.props.value}))),i.class&&!i.className?(a.class=i.class,Object.defineProperty(a,"className",$i)):i.className&&(a.class=a.className=i.className),e.props=a})(t),t.$$typeof=Ci,Cn&&Cn(t)};var kn=_.__r;_.__r=function(t){kn&&kn(t),t.__c};var xn=_.diffed;_.diffed=function(t){xn&&xn(t);var e=t.props,i=t.__e;i!=null&&t.type==="textarea"&&"value"in e&&e.value!==i.value&&(i.value=e.value==null?"":e.value)};function b({variant:t="primary",size:e="md",className:i,children:r,...a}){const l=["rc-btn",`rc-btn--${t}`,`rc-btn--${e}`,i].filter(Boolean).join(" ");return n("button",{className:l,...a,children:r})}function A({interactive:t=!1,className:e,children:i,...r}){const a=["rc-card",t&&"rc-card--interactive",e].filter(Boolean).join(" ");return n("div",{className:a,...r,children:i})}function qe({label:t,value:e,icon:i,className:r,...a}){const l=["rc-stat-card",r].filter(Boolean).join(" ");return n("div",{className:l,...a,children:[n("div",{className:"rc-stat-card__header",children:[n("span",{className:"rc-stat-card__label",children:t}),i&&n("span",{className:"rc-stat-card__icon",children:i})]}),n("div",{className:"rc-stat-card__value",children:e})]})}function G({variant:t,className:e,children:i,...r}){const a=["rc-badge",`rc-badge--${t}`,e].filter(Boolean).join(" ");return n("span",{className:a,...r,children:i})}var Ii={gold:"Gold",silver:"Silver",bronze:"Bronze"};function He({tier:t,...e}){return n(G,{variant:t,...e,children:Ii[t]})}function de({error:t=!1,className:e,...i}){const r=["rc-input",t&&"rc-input--error",e].filter(Boolean).join(" ");return n("input",{className:r,...i})}function Ni({error:t=!1,className:e,...i}){const r=["rc-textarea",t&&"rc-textarea--error",e].filter(Boolean).join(" ");return n("textarea",{className:r,...i})}function Ei({error:t=!1,className:e,children:i,...r}){const a=["rc-select",t&&"rc-select--error",e].filter(Boolean).join(" ");return n("select",{className:a,...r,children:i})}function Ai({icon:t,message:e,action:i,className:r,...a}){const l=["rc-empty",r].filter(Boolean).join(" ");return n("div",{className:l,...a,children:[t&&n("div",{className:"rc-empty__icon",children:t}),n("p",{className:"rc-empty__message",children:e}),i]})}function Bi({message:t,action:e,className:i,...r}){const a=["rc-error-card",i].filter(Boolean).join(" ");return n("div",{className:a,...r,children:[n("p",{className:"rc-error-card__message",children:t}),e]})}function ue({code:t,className:e,...i}){const r=["rc-code",e].filter(Boolean).join(" ");return n("pre",{className:r,...i,children:n("code",{children:t})})}var Sn=vi(null);function J(){const t=_i(Sn);if(!t)throw new Error("useToast must be used within a ToastProvider");return t}var Ri={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},Mi={success:4e3,error:0,warning:4e3,info:4e3};function Oi({toast:t,onDismiss:e}){const[i,r]=te(!1),a=oe(null),l=ce(()=>{r(!0),setTimeout(()=>e(t.id),150)},[t.id,e]);return Ge(()=>{const s=t.duration??Mi[t.variant];return s>0&&(a.current=setTimeout(l,s)),()=>{a.current&&clearTimeout(a.current)}},[t,l]),n("div",{className:`rc-toast rc-toast--${t.variant}${i?" rc-toast--exiting":""}`,role:"alert",children:[n("span",{className:"rc-toast__icon","aria-hidden":"true",children:Ri[t.variant]}),n("span",{className:"rc-toast__content",children:t.message}),n("button",{className:"rc-toast__dismiss",onClick:l,"aria-label":"Dismiss notification",children:"✕"})]})}var Li=0;function Tn({children:t}){const[e,i]=te([]),r=ce((l,s,c)=>{const u=`toast-${++Li}`;i(o=>[...o,{id:u,variant:l,message:s,duration:c}])},[]),a=ce(l=>{i(s=>s.filter(c=>c.id!==l))},[]);return n(Sn.Provider,{value:{toast:r},children:[t,n("div",{className:"rc-toast-container","aria-live":"polite",children:e.map(l=>n(Oi,{toast:l,onDismiss:a},l.id))})]})}var he=8;function Pn({content:t,placement:e="top",variant:i="default",children:r,className:a,...l}){const[s,c]=te(!1),[u,o]=te(null),[h,d]=te(e),f=oe(null),v=oe(null),x=oe(null),B=ce(()=>{f.current=setTimeout(()=>c(!0),200)},[]),$=ce(()=>{f.current&&clearTimeout(f.current),c(!1),o(null)},[]);Ge(()=>{if(!s||!v.current||!x.current)return;const w=v.current.getBoundingClientRect(),T=x.current.getBoundingClientRect();let N=0,O=0,D=e;D==="top"?(N=w.top-T.height-he,O=w.left+w.width/2-T.width/2,N<4&&(D="bottom",N=w.bottom+he)):D==="bottom"?(N=w.bottom+he,O=w.left+w.width/2-T.width/2,N+T.height>window.innerHeight-4&&(D="top",N=w.top-T.height-he)):D==="left"?(N=w.top+w.height/2-T.height/2,O=w.left-T.width-he):(N=w.top+w.height/2-T.height/2,O=w.right+he),O=Math.max(4,Math.min(O,window.innerWidth-T.width-4)),N=Math.max(4,Math.min(N,window.innerHeight-T.height-4)),o({top:N,left:O}),d(D)},[s,e]);const g=["rc-tooltip-wrapper",a].filter(Boolean).join(" "),m=["rc-tooltip",i==="info"&&"rc-tooltip--info"].filter(Boolean).join(" ");return n("span",{ref:v,className:g,onMouseEnter:B,onMouseLeave:$,onFocus:B,onBlur:$,...l,children:[r,s&&n("span",{ref:x,className:m,role:"tooltip",style:u?{top:`${u.top}px`,left:`${u.left}px`}:{visibility:"hidden"},children:t})]})}function zi(t){if(typeof window>"u")return!1;try{return localStorage.getItem(`rc-info-dismissed:${t}`)==="1"}catch{return!1}}function Di(t){try{localStorage.setItem(`rc-info-dismissed:${t}`,"1")}catch{}}function K({title:t,children:e,storageKey:i,icon:r,className:a,...l}){const[s,c]=te(!0);if(Ge(()=>{c(zi(i))},[i]),s)return null;const u=()=>{Di(i),c(!0)},o=["rc-info-card",a].filter(Boolean).join(" ");return n("div",{className:o,role:"note",...l,children:[r&&n("span",{className:"rc-info-card__icon","aria-hidden":"true",children:r}),n("div",{className:"rc-info-card__content",children:[n("p",{className:"rc-info-card__title",children:t}),n("p",{className:"rc-info-card__body",children:e})]}),n("button",{className:"rc-info-card__dismiss",onClick:u,"aria-label":"Dismiss tip",children:"✕"})]})}function R({variant:t="text",width:e,height:i,className:r,style:a,...l}){const s={...a};e&&(s.width=typeof e=="number"?`${e}px`:e),i&&(s.height=typeof i=="number"?`${i}px`:i);const c=["rc-skeleton",`rc-skeleton--${t}`,r].filter(Boolean).join(" ");return n("div",{className:c,style:s,"aria-hidden":"true",...l})}function Ui({open:t,title:e,description:i,confirmLabel:r="Confirm",cancelLabel:a="Cancel",variant:l="default",requireTyping:s,onConfirm:c,onCancel:u}){const[o,h]=te(""),d=oe(null),f=oe(null),v=mi(),x=s?o===s:!0;Ge(()=>{if(!t){h("");return}document.body.style.overflow="hidden";const g=m=>{if(m.key==="Escape"&&u(),m.key==="Tab"){const w=d.current?.querySelector(".rc-modal");if(!w)return;const T=w.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(T.length===0)return;const N=T[0],O=T[T.length-1];m.shiftKey&&document.activeElement===N?(m.preventDefault(),O.focus()):!m.shiftKey&&document.activeElement===O&&(m.preventDefault(),N.focus())}};return document.addEventListener("keydown",g),s||f.current?.focus(),()=>{document.removeEventListener("keydown",g),document.body.style.overflow=""}},[t,u,s]);const B=ce(g=>{g.target===d.current&&u()},[u]);return t?n("div",{className:"rc-modal-overlay",ref:d,onClick:B,children:n("div",{className:"rc-modal",role:"dialog","aria-modal":"true","aria-labelledby":v,children:[n("h2",{className:"rc-modal__title",id:v,children:e}),n("div",{className:"rc-modal__description",children:i}),s&&n("div",{children:[n("p",{className:"rc-modal__typing-label",children:["Type ",n("strong",{children:s})," to confirm:"]}),n("input",{className:"rc-input",value:o,onChange:g=>h(g.target.value),autoFocus:!0,spellCheck:!1})]}),n("div",{className:"rc-modal__actions",children:[n("button",{className:"rc-btn rc-btn--secondary",onClick:u,ref:f,children:a}),n("button",{className:l==="danger"?"rc-btn rc-btn--danger":"rc-btn rc-btn--primary",onClick:c,disabled:!x,children:r})]})]})}):null}function L({term:t,definition:e,children:i,className:r,...a}){const l=["rc-concept-term",r].filter(Boolean).join(" ");return n(Pn,{content:e,variant:"info",placement:"top",children:n("span",{className:l,...a,children:[i??t,n("svg",{className:"rc-concept-term__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n("circle",{cx:"12",cy:"12",r:"10"}),n("path",{d:"M12 16v-4"}),n("path",{d:"M12 8h.01"})]})]})})}var Gi=Symbol.for("preact-signals");function Ve(){if(F>1)F--;else{var t,e=!1;for((function(){var a=Je;for(Je=void 0;a!==void 0;)a.S.v===a.v&&(a.S.i=a.i),a=a.o})();ke!==void 0;){var i=ke;for(ke=void 0,Ye++;i!==void 0;){var r=i.u;if(i.u=void 0,i.f&=-3,!(8&i.f)&&Nn(i))try{i.c()}catch(a){e||(t=a,e=!0)}i=r}}if(Ye=0,F--,e)throw t}}function ji(t){if(F>0)return t();St=++Wi,F++;try{return t()}finally{Ve()}}var y=void 0;function $n(t){var e=y;y=void 0;try{return t()}finally{y=e}}var ke=void 0,F=0,Ye=0,Wi=0,St=0,Je=void 0,Ke=0;function In(t){if(y!==void 0){var e=t.n;if(e===void 0||e.t!==y)return e={i:0,S:t,p:y.s,n:void 0,t:y,e:void 0,x:void 0,r:e},y.s!==void 0&&(y.s.n=e),y.s=e,t.n=e,32&y.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=y.s,e.n=void 0,y.s.n=e,y.s=e),e}}function E(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}E.prototype.brand=Gi,E.prototype.h=function(){return!0},E.prototype.S=function(t){var e=this,i=this.t;i!==t&&t.e===void 0&&(t.x=i,this.t=t,i!==void 0?i.e=t:$n(function(){var r;(r=e.W)==null||r.call(e)}))},E.prototype.U=function(t){var e=this;if(this.t!==void 0){var i=t.e,r=t.x;i!==void 0&&(i.x=r,t.e=void 0),r!==void 0&&(r.e=i,t.x=void 0),t===this.t&&(this.t=r,r===void 0&&$n(function(){var a;(a=e.Z)==null||a.call(e)}))}},E.prototype.subscribe=function(t){var e=this;return pe(function(){var i=e.value,r=y;y=void 0;try{t(i)}finally{y=r}},{name:"sub"})},E.prototype.valueOf=function(){return this.value},E.prototype.toString=function(){return this.value+""},E.prototype.toJSON=function(){return this.value},E.prototype.peek=function(){var t=y;y=void 0;try{return this.value}finally{y=t}},Object.defineProperty(E.prototype,"value",{get:function(){var t=In(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Ye>100)throw new Error("Cycle detected");(function(i){F!==0&&Ye===0&&i.l!==St&&(i.l=St,Je={S:i,v:i.v,i:i.i,o:Je})})(this),this.v=t,this.i++,Ke++,F++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Ve()}}}});function p(t,e){return new E(t,e)}function Nn(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function En(t){for(var e=t.s;e!==void 0;e=e.n){var i=e.S.n;if(i!==void 0&&(e.r=i),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function An(t){for(var e=t.s,i=void 0;e!==void 0;){var r=e.p;e.i===-1?(e.S.U(e),r!==void 0&&(r.n=e.n),e.n!==void 0&&(e.n.p=r)):i=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=r}t.s=i}function ne(t,e){E.call(this,void 0),this.x=t,this.s=void 0,this.g=Ke-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}ne.prototype=new E,ne.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ke))return!0;if(this.g=Ke,this.f|=1,this.i>0&&!Nn(this))return this.f&=-2,!0;var t=y;try{En(this),y=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(i){this.v=i,this.f|=16,this.i++}return y=t,An(this),this.f&=-2,!0},ne.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}E.prototype.S.call(this,t)},ne.prototype.U=function(t){if(this.t!==void 0&&(E.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}},ne.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}},Object.defineProperty(ne.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=In(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Bn(t,e){return new ne(t,e)}function Rn(t){var e=t.m;if(t.m=void 0,typeof e=="function"){F++;var i=y;y=void 0;try{e()}catch(r){throw t.f&=-2,t.f|=8,Tt(t),r}finally{y=i,Ve()}}}function Tt(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Rn(t)}function Fi(t){if(y!==this)throw new Error("Out-of-order effect");An(this),y=t,this.f&=-2,8&this.f&&Tt(this),Ve()}function ve(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name}ve.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.m=e)}finally{t()}},ve.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Rn(this),En(this),F++;var t=y;return y=this,Fi.bind(this,t)},ve.prototype.N=function(){2&this.f||(this.f|=2,this.u=ke,ke=this)},ve.prototype.d=function(){this.f|=8,1&this.f||Tt(this)},ve.prototype.dispose=function(){this.d()};function pe(t,e){var i=new ve(t,e);try{i.c()}catch(a){throw i.d(),a}var r=i.d.bind(i);return r[Symbol.dispose]=r,r}var Mn,Qe,qi=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,On=[];pe(function(){Mn=this.N})();function fe(t,e){_[t]=e.bind(null,_[t]||function(){})}function Ze(t){if(Qe){var e=Qe;Qe=void 0,e()}Qe=t&&t.S()}function Ln(t){var e=this,i=t.data,r=Vi(i);r.value=i;var a=je(function(){for(var c=e,u=e.__v;u=u.__;)if(u.__c){u.__c.__$f|=4;break}var o=Bn(function(){var v=r.value.value;return v===0?0:v===!0?"":v||""}),h=Bn(function(){return!Array.isArray(o.value)&&!Gt(o.value)}),d=pe(function(){if(this.N=zn,h.value){var v=o.value;c.__v&&c.__v.__e&&c.__v.__e.nodeType===3&&(c.__v.__e.data=v)}}),f=e.__$u.d;return e.__$u.d=function(){d(),f.call(this)},[h,o]},[]),l=a[0],s=a[1];return l.value?s.peek():s.value}Ln.displayName="ReactiveTextNode",Object.defineProperties(E.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ln},props:{configurable:!0,get:function(){var t=this;return{data:{get value(){return t.value}}}}},__b:{configurable:!0,value:1}}),fe("__b",function(t,e){if(typeof e.type=="string"){var i,r=e.props;for(var a in r)if(a!=="children"){var l=r[a];l instanceof E&&(i||(e.__np=i={}),i[a]=l,r[a]=l.peek())}}t(e)}),fe("__r",function(t,e){if(t(e),e.type!==z){Ze();var i,r=e.__c;r&&(r.__$f&=-2,(i=r.__$u)===void 0&&(r.__$u=i=(function(a,l){var s;return pe(function(){s=this},{name:l}),s.c=a,s})(function(){var a;qi&&((a=i.y)==null||a.call(i)),r.__$f|=1,r.setState({})},typeof e.type=="function"?e.type.displayName||e.type.name:""))),Ze(i)}}),fe("__e",function(t,e,i,r){Ze(),t(e,i,r)}),fe("diffed",function(t,e){Ze();var i;if(typeof e.type=="string"&&(i=e.__e)){var r=e.__np,a=e.props;if(r){var l=i.U;if(l)for(var s in l){var c=l[s];c!==void 0&&!(s in r)&&(c.d(),l[s]=void 0)}else l={},i.U=l;for(var u in r){var o=l[u],h=r[u];o===void 0?(o=Hi(i,u,h),l[u]=o):o.o(h,a)}for(var d in r)a[d]=r[d]}}t(e)});function Hi(t,e,i,r){var a=e in t&&t.ownerSVGElement===void 0,l=p(i),s=i.peek();return{o:function(c,u){l.value=c,s=c.peek()},d:pe(function(){this.N=zn;var c=l.value.value;s!==c?(s=void 0,a?t[e]=c:c!=null&&(c!==!1||e[4]==="-")?t.setAttribute(e,c):t.removeAttribute(e)):s=void 0})}}fe("unmount",function(t,e){if(typeof e.type=="string"){var i=e.__e;if(i){var r=i.U;if(r){i.U=void 0;for(var a in r){var l=r[a];l&&l.d()}}}e.__np=void 0}else{var s=e.__c;if(s){var c=s.__$u;c&&(s.__$u=void 0,c.d())}}t(e)}),fe("__h",function(t,e,i,r){(r<3||r===9)&&(e.__$f|=2),t(e,i,r)}),U.prototype.shouldComponentUpdate=function(t,e){if(this.__R)return!0;var i=this.__$u,r=i&&i.s!==void 0;for(var a in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var l=2&this.__$f;if(!(r||l||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var c in this.props)if(!(c in t))return!0;return!1};function Vi(t,e){return je(function(){return p(t,e)},[])}var Yi=function(t){queueMicrotask(function(){queueMicrotask(t)})};function Ji(){ji(function(){for(var t;t=On.shift();)Mn.call(t)})}function zn(){On.push(this)===1&&(_.requestAnimationFrame||Yi)(Ji)}const Dn="runcontext_wizard_state",Un=["Connect","Define","Scaffold","Checkpoint","Curate","Serve"],P=p(1),q=p({product_name:"",description:"",owner:{name:"",team:"",email:""},sensitivity:"internal",docs:[]}),M=p([]),Q=p(null),Pt=p(null),_e=p({}),Gn=p({}),jn=p([]);function Ki(){try{const t=sessionStorage.getItem(Dn);if(!t)return;const e=JSON.parse(t);e.step&&(P.value=e.step),e.brief&&(q.value=e.brief),e.sources&&(M.value=e.sources),e.pipelineId&&(Q.value=e.pipelineId)}catch{}}Ki(),pe(()=>{const t={step:P.value,brief:q.value,sources:M.value,pipelineId:Q.value};try{sessionStorage.setItem(Dn,JSON.stringify(t))}catch{}});const k={contextLayer:{label:"Context Layer",definition:"Your organization's complete semantic knowledge base — what your data means, who owns it, and how it should be used."},semanticPlane:{label:"Semantic Plane",definition:'A domain-scoped context package (e.g., "Sales," "Finance"). The primary unit of your context layer.'},mcpEndpoint:{label:"MCP Endpoint",definition:"The API that serves your context layer to AI agents, tools, and applications via the Model Context Protocol."},bronzeTier:{label:"Bronze Tier",definition:"Schema metadata only — table names, column names, types, and row counts. The starting point."},silverTier:{label:"Silver Tier",definition:"Column descriptions, sample values, and trust tags. Adds human-readable context to raw schema."},goldTier:{label:"Gold Tier",definition:"Join rules, grain statements, semantic roles, golden queries, and guardrail filters. Full context for AI agents."}};function Qi(){return n(A,{className:"checkpoint-card",children:[n(K,{title:"What's Next?",storageKey:"checkpoint-info",children:"You can start your MCP server now with Bronze context, or continue to Gold for full AI comprehension including join rules, business descriptions, and query patterns."}),n("h2",{children:"Bronze Tier Achieved"}),n("div",{class:"tier-scorecard",children:[n("div",{class:"tier-row achieved",children:[n(He,{tier:"bronze"}),n(L,{term:"bronzeTier",definition:k.bronzeTier.definition,children:k.bronzeTier.label}),n("span",{class:"tier-desc",children:"Schema metadata, table/column names, types, row counts"})]}),n("div",{class:"tier-row",children:[n(L,{term:"silverTier",definition:k.silverTier.definition,children:k.silverTier.label}),n("span",{class:"tier-desc",children:"Column descriptions, sample values, trust tags"})]}),n("div",{class:"tier-row",children:[n(L,{term:"goldTier",definition:k.goldTier.definition,children:k.goldTier.label}),n("span",{class:"tier-desc",children:"Join rules, grain statements, semantic roles, golden queries, guardrail filters"})]})]}),n("p",{class:"checkpoint-explain",children:["Your ",n(L,{term:"semanticPlane",definition:k.semanticPlane.definition,children:k.semanticPlane.label})," has basic schema metadata. AI tools can use this now, but with Gold tier they will understand join relationships, business descriptions, and query patterns."]}),n("div",{class:"checkpoint-ctas",children:[n(b,{variant:"secondary",onClick:()=>{P.value=6},children:["Start ",n(L,{term:"mcpEndpoint",definition:k.mcpEndpoint.definition,children:k.mcpEndpoint.label})," Server"]}),n(b,{onClick:()=>{P.value=5},children:"Continue to Gold"})]})]})}async function S(t,e,i){const r={method:t,headers:{}};i&&!(i instanceof FormData)?(r.headers["Content-Type"]="application/json",r.body=JSON.stringify(i)):i&&(r.body=i);const a=await fetch(e,r);if(!a.ok){const s=await a.text();throw new Error(s||a.statusText)}return(a.headers.get("content-type")||"").includes("json")?a.json():a.text()}const Wn={postgres:"neon",mysql:"planetscale",duckdb:null,sqlite:null,snowflake:"snowflake",bigquery:"gcp",clickhouse:"clickhouse",databricks:"databricks",mssql:"azure-sql",mongodb:"mongodb"};function Zi(t,e){if(!t)return e?Wn[e]??null:null;const i=t.toLowerCase();return i.includes("neon")?"neon":i.includes("supabase")?"supabase":i.includes("planetscale")?"planetscale":i.includes("snowflake")?"snowflake":i.includes("bigquery")||i.includes("gcp")?"gcp":i.includes("clickhouse")?"clickhouse":i.includes("databricks")?"databricks":i.includes("azure")?"azure-sql":i.includes("mongodb")||i.includes("atlas")?"mongodb":e?Wn[e]??null:null}function Xi(t){return t?t.replace(/^aws-/,"").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}const $t=p([]),Fn=p([]),qn=p(new Set),xe=p([]),me=p(null),H=p(!1),V=p(null),Se=p(""),Te=p(!1),Pe=p(null),Hn=p(!1),Xe=p(!0);function It(t){const e=document.getElementById("db-status-dot"),i=document.getElementById("db-status-text");e&&(e.classList.remove("error"),e.classList.add("success")),i&&(i.textContent=(t.name||t.adapter||"database")+" connected")}async function er(){try{const t=await S("GET","/api/auth/providers");$t.value=t}catch{}finally{Xe.value=!1}}async function tr(){try{const e=(await S("GET","/api/sources")).sources||[];Fn.value=e;const i=new Set;for(const r of e){const a=Zi(r.origin,r.adapter);a&&i.add(a)}qn.value=i}catch{}finally{Xe.value=!1}}async function Vn(t,e){H.value=!0,V.value=null,me.value=t;try{const i=await S("POST","/api/auth/start",{provider:t});i.databases&&(xe.value=i.databases)}catch(i){V.value=i.message||"OAuth failed",e("error",i.message||"OAuth failed")}finally{H.value=!1}}async function nr(t,e){H.value=!0,V.value=null;try{if((await S("POST","/api/auth/select-db",{provider:me.value,database:t})).ok){const r={name:t.name||t.database,adapter:t.adapter,host:t.host,database:t.database||t.name,metadata:t.metadata};M.value=[r,...M.value],It(r),xe.value=[],me.value=null,e("success",`Connected to ${r.name||r.database||"database"}`),P.value=2}}catch(i){V.value=i.message||"Failed to select database",e("error",i.message||"Failed to select database")}finally{H.value=!1}}async function ir(t,e){const i={name:t.name,adapter:t.adapter,host:t.host,database:t.database||t.name,metadata:t.metadata};M.value=[i,...M.value],It(i),e("success",`Connected to ${i.name||i.database||"database"}`),P.value=2}async function rr(t){const e=Se.value.trim();if(e){Te.value=!0,Pe.value=null;try{const i=await S("POST","/api/sources",{connection:e});i.source&&(M.value=[i.source,...M.value],It(i.source),Se.value="",t("success",`Connected to ${i.source.name||i.source.database||"database"}`),P.value=2)}catch(i){Pe.value=i.message||"Connection failed",t("error",i.message||"Connection failed")}finally{Te.value=!1}}}function ar(){xe.value=[],me.value=null,V.value=null}function lr(){const{toast:t}=J();if(Hn.value||(Hn.value=!0,er(),tr()),xe.value.length>0)return n("div",{children:[n("div",{class:"oauth-result-header",children:[n("h2",{class:"connect-heading",children:"Select a database"}),n("a",{href:"#",class:"muted",onClick:l=>{l.preventDefault(),ar()},children:"← Back to providers"})]}),V.value&&n("p",{class:"field-error",children:V.value}),n("div",{class:"source-cards",children:xe.value.map(l=>{const s=l.project||l.metadata?.project||"",c=l.metadata?.branch||"",u=l.metadata?.org||"",o=l.region||l.metadata?.region||"",h=s||l.name||l.database||"Database",d=l.name||l.database||"",f=Xi(o);return n(A,{interactive:!0,children:n("div",{class:"source-card db-card-rich",children:[n("div",{class:"db-card-header",children:[n("div",{class:"db-card-title",children:h}),u&&u!=="Personal"&&n("span",{class:"db-card-org",children:u})]}),n("div",{class:"db-card-details",children:[d&&d!==s&&n("span",{class:"db-card-detail",children:[n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",children:[n("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),n("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"}),n("path",{d:"M3 12c0 1.66 4 3 9 3s9-1.34 9-3"})]}),d]}),c&&n("span",{class:"db-card-detail",children:[n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",children:[n("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),n("circle",{cx:"18",cy:"6",r:"3"}),n("circle",{cx:"6",cy:"18",r:"3"}),n("path",{d:"M18 9a9 9 0 01-9 9"})]}),c]}),f&&n("span",{class:"db-card-detail",children:[n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",children:[n("circle",{cx:"12",cy:"12",r:"10"}),n("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),n("path",{d:"M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"})]}),f]})]}),n("div",{class:"db-card-host",children:l.host}),n(b,{size:"sm",disabled:H.value,onClick:()=>nr(l,t),children:"Use This"})]})},l.id||l.name)})})]});const e=qn.value,i=Fn.value.filter(l=>l.adapter==="duckdb"||l.adapter==="sqlite"),r=$t.value.filter(l=>e.has(l.id)),a=$t.value.filter(l=>!e.has(l.id));return n("div",{children:[H.value&&n("div",{class:"connect-loading-overlay",children:n("div",{class:"connect-loading-card",children:[n("div",{class:"connect-loading-spinner"}),n("h3",{children:["Authenticating with ",me.value||"provider","..."]}),n("p",{class:"muted",children:"Complete sign-in in the browser tab that just opened, then return here."})]})}),n(K,{title:"Connect Your Data Source",storageKey:"connect-step-info",children:["RunContext builds a ",n(L,{term:"contextLayer",definition:k.contextLayer.definition,children:k.contextLayer.label})," by reading your database schema. Your data stays local — we only extract metadata, never the data itself."]}),n("div",{class:"trust-signal",children:[n("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--rc-color-status-success)","stroke-width":"2",children:n("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),n("span",{class:"trust-signal-text",children:"Read-only access — your data never leaves this machine"})]}),n("h2",{class:"connect-heading",children:"Connect a database"}),n("p",{class:"connect-subheading",children:"Choose a cloud provider, use a local file, or paste a connection string."}),V.value&&n("p",{class:"field-error",children:V.value}),e.size>0&&n("p",{class:"detected-hint",children:"We detected database configurations in your project."}),Xe.value&&n("div",{class:"source-cards",children:[n(R,{height:80}),n(R,{height:80}),n(R,{height:80})]}),!Xe.value&&n(z,{children:[i.length>0&&n("div",{class:"source-cards",children:i.map(l=>n(A,{interactive:!0,children:n("div",{class:"source-card source-card-local",children:[n("span",{class:"source-card-badge",children:l.adapter}),n("div",{class:"source-card-name",children:l.name||l.database}),l.host&&n("div",{class:"source-card-host",children:l.host}),n(b,{size:"sm",onClick:()=>ir(l,t),children:"Use This"})]})},l.name||l.database))}),r.length>0&&n("div",{class:"source-cards",children:r.map(l=>n(A,{interactive:!0,children:n("div",{class:"source-card source-card-detected",children:[n("span",{class:"source-card-badge",children:"detected"}),n("div",{class:"source-card-name",children:l.displayName||l.display_name||l.id}),n(b,{size:"sm",disabled:H.value,onClick:()=>Vn(l.id,t),children:H.value&&me.value===l.id?"Connecting...":"Connect"})]})},l.id))}),(i.length>0||r.length>0)&&a.length>0&&n("div",{class:"section-divider"}),a.length>0&&n("div",{class:"platform-grid",children:a.map(l=>n("button",{class:"platform-btn",disabled:H.value,onClick:()=>Vn(l.id,t),children:l.displayName||l.display_name||l.id},l.id))})]}),n("div",{class:"manual-connect",children:[n("label",{class:"label-uppercase",children:"Or paste a connection string"}),n("div",{class:"manual-connect-row",children:[n(de,{placeholder:"postgres://user:pass@host:5432/dbname",value:Se.value,onInput:l=>{Se.value=l.target.value},error:!!Pe.value,disabled:Te.value}),n(b,{variant:"secondary",disabled:Te.value||!Se.value.trim(),onClick:()=>rr(t),children:Te.value?"Connecting...":"Connect"})]}),Pe.value&&n("p",{class:"field-error",children:Pe.value})]})]})}const et=p(!1),tt=p(""),Yn=p({}),nt=p(!1);function sr(){const{toast:t}=J(),e=q.value;function i(l,s){if(l.startsWith("owner.")){const c=l.split(".")[1];q.value={...e,owner:{...e.owner,[c]:s}}}else q.value={...e,[l]:s}}async function r(){const l={};if(e.product_name.trim()?/^[a-zA-Z0-9_-]+$/.test(e.product_name.trim())||(l.product_name="Only letters, numbers, hyphens, and underscores allowed."):l.product_name="Product name is required.",e.description.trim()||(l.description="Description is required."),Yn.value=l,!(Object.keys(l).length>0)){et.value=!0,tt.value="";try{await S("POST","/api/brief",e),t("success","Semantic plane definition saved"),P.value=3}catch(s){tt.value=s.message||"Failed to save. Please try again.",t("error",s.message||"Failed to save")}finally{et.value=!1}}}!nt.value&&!e.product_name&&!e.description&&!e.owner.name&&M.value.length>0&&(nt.value=!0,S("POST","/api/suggest-brief",{source:M.value[0]}).then(l=>{const s=q.value;q.value={product_name:s.product_name||l.product_name||"",description:s.description||l.description||"",owner:{name:s.owner.name||l.owner?.name||"",team:s.owner.team||l.owner?.team||"",email:s.owner.email||l.owner?.email||""},sensitivity:s.sensitivity||l.sensitivity||"internal",docs:s.docs},t("info","Auto-filled from your database schema")}).catch(()=>{}).finally(()=>{nt.value=!1}));const a=Yn.value;return n("div",{children:[n(K,{title:"Define Your Semantic Plane",storageKey:"define-step-info",children:["This metadata becomes part of your ",n(L,{term:"semanticPlane",definition:k.semanticPlane.definition,children:k.semanticPlane.label}),". It helps AI agents understand what your data represents and who is responsible for it."]}),n("h2",{children:"Define Your Semantic Plane"}),n("p",{class:"muted",children:"Tell us about your semantic plane. This metadata helps AI agents understand what they are working with."}),nt.value&&n("div",{class:"define-form-skeleton",children:[n(R,{variant:"text",width:"100%",height:"36px"}),n(R,{variant:"text",width:"100%",height:"80px"}),n(R,{variant:"text",width:"60%",height:"36px"}),n(R,{variant:"text",width:"60%",height:"36px"})]}),n("div",{class:"define-form",children:[n("div",{class:"field full-width",children:[n("label",{for:"product_name",children:"Product Name *"}),n(de,{id:"product_name",value:e.product_name,onInput:l=>i("product_name",l.currentTarget.value),placeholder:"my-semantic-plane",error:!!a.product_name}),a.product_name&&n("p",{class:"field-error",children:a.product_name}),n("p",{class:"hint",children:"Alphanumeric, hyphens, and underscores only."})]}),n("div",{class:"field full-width",children:[n("label",{for:"description",children:"Description *"}),n(Ni,{id:"description",value:e.description,onInput:l=>i("description",l.currentTarget.value),placeholder:"What does this data product provide?",error:!!a.description}),a.description&&n("p",{class:"field-error",children:a.description})]}),n("div",{class:"field",children:[n("label",{for:"owner_name",children:"Owner Name"}),n(de,{id:"owner_name",value:e.owner.name,onInput:l=>i("owner.name",l.currentTarget.value),placeholder:"Jane Doe"})]}),n("div",{class:"field",children:[n("label",{for:"owner_team",children:"Team"}),n(de,{id:"owner_team",value:e.owner.team,onInput:l=>i("owner.team",l.currentTarget.value),placeholder:"Data Engineering"})]}),n("div",{class:"field",children:[n("label",{for:"owner_email",children:"Email"}),n(de,{id:"owner_email",value:e.owner.email,onInput:l=>i("owner.email",l.currentTarget.value),placeholder:"jane@example.com"})]}),n("div",{class:"field",children:[n("label",{for:"sensitivity",children:"Sensitivity"}),n(Ei,{id:"sensitivity",value:e.sensitivity,onChange:l=>i("sensitivity",l.currentTarget.value),children:[n("option",{value:"public",children:"Public"}),n("option",{value:"internal",children:"Internal"}),n("option",{value:"confidential",children:"Confidential"}),n("option",{value:"restricted",children:"Restricted"})]})]}),n("div",{class:"define-actions",children:[n(b,{variant:"secondary",onClick:()=>{P.value=1},children:"Back"}),n(b,{onClick:r,disabled:et.value,children:et.value?"Saving...":"Continue"})]}),tt.value&&n("p",{class:"field-error",children:tt.value})]})]})}const $e=p(null),ge=p(""),it=p(null),rt=p(null),Jn=p(!1),Nt=p(!1),Kn=`I have a RunContext semantic plane at Bronze tier. Please help me curate it to Gold.
2
+
3
+ Start by running \`context_tier\` to see the current scorecard, then work through each failing check:
4
+ 1. Run small sample queries (LIMIT 10-25) to understand the actual data — never bulk export
5
+ 2. Write meaningful descriptions, golden queries, guardrails, etc.
6
+ 3. Re-run \`context_tier\` and iterate until Gold
7
+
8
+ Follow the agent instructions in AGENT_INSTRUCTIONS.md — never fabricate metadata, always query first. Never put PII in sample_values.`;function or(){const{toast:t}=J();Jn.value||(Jn.value=!0,S("GET","/api/tier").then(o=>{ge.value=o.tier,$e.value=o.output}).catch(()=>{}),S("GET","/api/mcp-config").then(o=>{it.value=JSON.stringify(o,null,2)}).catch(()=>{}));async function e(){try{const o=await S("GET","/api/agent-instructions");rt.value=o.instructions,Nt.value=!0}catch{t("error","Failed to load agent instructions")}}async function i(){$e.value=null;try{const o=await S("GET","/api/tier");ge.value=o.tier,$e.value=o.output,t("success",`Current tier: ${o.tier.toUpperCase()}`)}catch{t("error","Failed to check tier")}}function r(){navigator.clipboard.writeText(Kn),t("success","Curation prompt copied — paste it in your IDE")}const a=ge.value==="gold"?"gold":ge.value==="silver"?"silver":"bronze",l=($e.value||"").split(`
9
+ `),s=[];for(const o of l){const h=o.trim();h.startsWith("+ ")?s.push({label:h.slice(2),pass:!0}):h.startsWith("- ")&&s.push({label:h.slice(2),pass:!1})}const c=s.filter(o=>!o.pass),u=s.filter(o=>o.pass);return n("div",{children:[n(K,{title:"Curate to Gold",storageKey:"curate-step-info",children:["Your Bronze ",n(L,{term:"semanticPlane",definition:k.semanticPlane.definition,children:k.semanticPlane.label})," is scaffolded. To reach Gold, have your AI agent in Claude Code, Cursor, or Copilot curate the metadata using real data. The agent connects via MCP, queries your database, and writes meaningful descriptions, rules, and queries."]}),n("h2",{class:"connect-heading",children:"Agent-Driven Curation"}),n("p",{class:"muted",style:{marginBottom:"20px"},children:"Your AI agent does the heavy lifting — it queries your data and writes Gold-quality metadata."}),n("div",{class:"curate-workflow",children:[n("div",{class:"curate-step",children:[n("div",{class:"curate-step-num",children:"1"}),n("div",{class:"curate-step-content",children:[n("h4",{children:"Add MCP Config to Your IDE"}),n("p",{class:"muted",children:"Copy this into your IDE's MCP settings (Claude Desktop, Cursor, etc.)"}),it.value&&n("div",{style:{marginTop:"8px"},children:[n(ue,{code:it.value}),n(b,{variant:"secondary",size:"sm",onClick:()=>{navigator.clipboard.writeText(it.value||""),t("success","Copied MCP config")},style:{marginTop:"8px"},children:"Copy Config"})]})]})]}),n("div",{class:"curate-step",children:[n("div",{class:"curate-step-num",children:"2"}),n("div",{class:"curate-step-content",children:[n("h4",{children:"Start a Curation Session"}),n("p",{class:"muted",children:"Paste this prompt in your IDE chat to start curating to Gold:"}),n("div",{class:"curate-prompt-block",children:[n("div",{class:"curate-prompt-text",children:Kn}),n(b,{variant:"primary",size:"sm",onClick:r,style:{marginTop:"8px"},children:"Copy Curation Prompt"})]})]})]}),n("div",{class:"curate-step",children:[n("div",{class:"curate-step-num",children:"3"}),n("div",{class:"curate-step-content",children:[n("h4",{children:"Check Your Progress"}),n("p",{class:"muted",children:["After your agent works, check the tier scorecard here or via ",n("code",{children:"context tier"}),"."]}),n(b,{variant:"secondary",size:"sm",onClick:i,style:{marginTop:"8px"},children:"Refresh Tier Score"})]})]})]}),$e.value&&n("div",{class:"curate-scorecard",children:[n("div",{class:"curate-scorecard-header",children:[n("h3",{children:"Tier Scorecard"}),n(G,{variant:a,children:ge.value.toUpperCase()})]}),c.length>0&&n("div",{class:"curate-checks-section",children:[n("div",{class:"curate-checks-label",children:["Failing (",c.length,")"]}),c.map((o,h)=>n("div",{class:"curate-check fail",children:[n("span",{class:"curate-check-icon",children:"✗"}),n("span",{children:o.label})]},h))]}),u.length>0&&n("details",{class:"curate-checks-section",children:[n("summary",{class:"curate-checks-label",children:["Passing (",u.length,")"]}),u.map((o,h)=>n("div",{class:"curate-check pass",children:[n("span",{class:"curate-check-icon",children:"✓"}),n("span",{children:o.label})]},h))]})]}),n("div",{style:{marginTop:"20px"},children:[!Nt.value&&n(b,{variant:"secondary",size:"sm",onClick:e,children:"View Full Agent Instructions"}),Nt.value&&rt.value&&n("details",{open:!0,class:"curate-instructions",children:[n("summary",{children:"Agent Instructions"}),n("div",{class:"curate-instructions-content",children:n("pre",{children:rt.value})}),n(b,{variant:"secondary",size:"sm",onClick:()=>{navigator.clipboard.writeText(rt.value||""),t("success","Agent instructions copied")},style:{marginTop:"8px"},children:"Copy Instructions"})]})]}),n("div",{class:"step-actions",children:[n(b,{variant:"secondary",onClick:()=>{P.value=P.value-1},children:"Back"}),n(b,{onClick:()=>{P.value=6},children:ge.value==="gold"?"Continue to Serve":"Skip to Serve"})]})]})}function cr({stageKey:t,label:e,status:i,summary:r,error:a}){const l=["stage-dot",i==="running"?"running":i==="done"?"done":i==="error"?"error":""].filter(Boolean).join(" ");return n("div",{class:"stage-row","data-stage":t,children:[n("span",{class:l}),n("span",{class:"stage-name",children:e}),r&&n("span",{class:"stage-summary",children:r}),a&&n("span",{class:"stage-error",children:a})]})}let at=null;const Qn=[{key:"introspect",label:"Extracting schema from database..."},{key:"scaffold",label:"Building semantic plane files..."},{key:"verify",label:"Validating semantic plane..."},{key:"autofix",label:"Fixing any issues..."},{key:"agent-instructions",label:"Generating agent instructions..."}],ie=p(!1),Z=p("");let Ie=null;function lt(){Ie&&(clearInterval(Ie),Ie=null)}async function Zn(){ie.value=!0,Z.value="",_e.value={};const t={productName:q.value.product_name,targetTier:"bronze"};if(M.value[0]){const e=M.value[0];t.dataSource=(typeof e=="string"?e:e.name||e.database||"").replace(/[^a-zA-Z0-9_-]/g,"_")}at?.("info","Building your semantic plane...");try{const e=await S("POST","/api/pipeline/start",t);Q.value=e.id,Xn()}catch(e){ie.value=!1,Z.value=e.message||"Failed to start build."}}function Xn(){lt();async function t(){if(Q.value)try{const e=await S("GET","/api/pipeline/status/"+Q.value),i=e.stages||[],r={};let a=!1,l=!0;for(const s of Qn){const c=i.find(u=>u.stage===s.key||u.name===s.key);!c||c.status==="pending"?(l=!1,r[s.key]={status:"pending"}):(r[s.key]={status:c.status,summary:c.summary,error:c.error},c.status==="running"&&(l=!1),c.status==="error"&&(a=!0,l=!1))}_e.value=r,a?(lt(),ie.value=!1,Z.value=e.error||"A pipeline stage failed.",at?.("error",e.error||"Build failed")):l&&i.length>0&&(lt(),ie.value=!1,at?.("success","Semantic plane built successfully!"),P.value=4)}catch{}}t(),Ie=setInterval(t,2e3)}function dr(){Q.value=null,_e.value={},Z.value="",Zn()}function ur(){const{toast:t}=J();at=t,Q.value&&!Ie&&!Z.value&&(ie.value=!0,Xn());const e=_e.value;return n("div",{children:[n(K,{title:"Building Your Context Layer",storageKey:"scaffold-step-info",children:["RunContext connects to your database read-only to extract schema metadata. No data leaves your machine — only structure and types are captured to build your ",n(L,{term:"semanticPlane",definition:k.semanticPlane.definition,children:k.semanticPlane.label}),"."]}),n("div",{class:"trust-signal",children:[n("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--rc-color-status-success)","stroke-width":"2",children:n("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),n("span",{class:"trust-signal-text",children:"Read-only access — your data never leaves this machine"})]}),n("h2",{children:"Building Your Semantic Plane"}),n("p",{class:"muted",children:"Connecting to your database and extracting schema metadata. This creates a Bronze-tier semantic plane."}),n("div",{class:"scaffold-stages",children:Qn.map(i=>n(cr,{stageKey:i.key,label:i.label,status:e[i.key]?.status,summary:e[i.key]?.summary,error:e[i.key]?.error},i.key))}),Z.value&&n(Bi,{message:Z.value,action:n(b,{onClick:dr,children:"Retry"})}),n("div",{class:"step-actions",children:[n(b,{variant:"secondary",onClick:()=>{lt(),P.value=2},children:"Back"}),!ie.value&&!Q.value&&!Z.value&&n(b,{onClick:Zn,children:"Start Build"}),ie.value&&n("span",{class:"muted",children:"Build in progress..."})]})]})}const st=p("bronze"),Ne=p(null),re=p(!1),ei=p(!1),ti=p(!1);function Et(t){const e=document.getElementById("mcp-server-dot"),i=document.getElementById("mcp-server-text"),r=document.getElementById("mcp-status-dot"),a=document.getElementById("mcp-status-text");e&&(e.classList.toggle("success",t),e.classList.toggle("error",!t)),i&&(i.textContent=t?"MCP running":"MCP stopped"),r&&r.classList.toggle("success",t),a&&(a.textContent=t?"connected":"offline")}function hr(){const{toast:t}=J();ti.value||(ti.value=!0,S("GET","/api/tier").then(a=>{(a.tier==="gold"||a.tier==="silver"||a.tier==="bronze")&&(st.value=a.tier)}).catch(()=>{}),S("GET","/api/mcp/status").then(a=>{re.value=a.running,Et(a.running)}).catch(()=>{}));async function e(){ei.value=!0;try{re.value?(await S("POST","/api/mcp/stop"),re.value=!1,Et(!1),t("info","MCP server stopped")):(await S("POST","/api/mcp/start"),re.value=!0,Et(!0),t("success","MCP server started"))}catch{t("error","Failed to toggle MCP server")}finally{ei.value=!1}}async function i(){try{const a=await S("GET","/api/mcp-config");Ne.value=JSON.stringify(a,null,2)}catch{t("error","Failed to load MCP configuration")}}function r(){window.location.href="/setup"}return n("div",{children:[n("div",{class:"serve-done-hero",children:[n("div",{class:"serve-done-icon",children:"✓"}),n("h2",{class:"serve-done-title",children:[q.value.product_name||"Semantic Plane"," Created"]}),n("div",{class:"serve-tier-row",children:n(He,{tier:st.value})})]}),n("h3",{class:"serve-section-heading",children:"What's Next"}),n("div",{class:"serve-next-grid",children:[st.value!=="gold"&&n("div",{class:"serve-next-card",onClick:()=>{P.value=5},children:[n("div",{class:"serve-next-icon",children:"⬆"}),n("div",{children:[n("h4",{children:["Curate to ",st.value==="bronze"?"Silver":"Gold"]}),n("p",{class:"muted",children:"Have your AI agent enrich metadata using real data"})]})]}),n("div",{class:"serve-next-card",onClick:e,children:[n("div",{class:"serve-next-icon",children:re.value?"⏹":"▶"}),n("div",{children:[n("h4",{children:re.value?"Stop MCP Server":"Start MCP Server"}),n("p",{class:"muted",children:re.value?"AI agents are connected":"Let AI agents query your semantic plane"})]})]}),n("div",{class:"serve-next-card",onClick:()=>{window.location.href="/planes"},children:[n("div",{class:"serve-next-icon",children:"📊"}),n("div",{children:[n("h4",{children:"View Semantic Planes"}),n("p",{class:"muted",children:"Browse tables, rules, and YAML blueprints"})]})]}),n("div",{class:"serve-next-card",onClick:r,children:[n("div",{class:"serve-next-icon",children:"+"}),n("div",{children:[n("h4",{children:"New Semantic Plane"}),n("p",{class:"muted",children:"Connect another database and scaffold a new plane"})]})]})]}),n("details",{class:"serve-extras",children:[n("summary",{children:"IDE Config & CLI Commands"}),n("div",{class:"serve-extras-body",children:[n("div",{class:"serve-extras-section",children:[n("h4",{children:"MCP Config for Your IDE"}),n("p",{class:"muted",children:"Add to Claude Desktop, Cursor, etc."}),!Ne.value&&n(b,{variant:"secondary",size:"sm",onClick:i,children:"Show Config"}),Ne.value&&n("div",{children:[n(ue,{code:Ne.value}),n(b,{variant:"secondary",size:"sm",onClick:()=>{navigator.clipboard.writeText(Ne.value||""),t("success","Copied to clipboard")},style:{marginTop:"8px"},children:"Copy"})]})]}),n("div",{class:"serve-extras-section",children:[n("h4",{children:"CLI Commands"}),n("div",{class:"serve-cli-grid",children:[["context serve","Start the MCP server"],["context tier","Check current tier"],["context verify","Validate semantic plane"]].map(([a,l])=>n("div",{class:"serve-cmd-row",children:[n("code",{class:"serve-cmd",children:a}),n("span",{class:"serve-cmd-desc",children:l})]},a))})]})]})]}),n("div",{class:"step-actions",children:n(b,{variant:"secondary",onClick:()=>{P.value=P.value-1},children:"Back"})})]})}function vr(){switch(P.value){case 1:return n(lr,{});case 2:return n(sr,{});case 3:return n(ur,{});case 4:return n(Qi,{});case 5:return n(or,{});case 6:return n(hr,{});default:return null}}function pr(){return n(Tn,{children:n("div",{class:"step-fade-in",children:n(vr,{})},P.value)})}const fr={Connect:"Connect to your database or data source",Define:"Define your semantic plane metadata",Scaffold:"Build the Bronze-tier context layer",Checkpoint:"Review your progress and choose next steps",Curate:"Have your AI agent curate to Gold tier",Serve:"Start your MCP endpoint for AI agents"};function _r(){const t=P.value;return n(z,{children:Un.map((e,i)=>{const r=i+1,a=r<t?"step-completed":r===t?"step-active":"step-future";return n(z,{children:[n(Pn,{content:fr[e],placement:"bottom",children:n("span",{class:a,onClick:r<t?()=>{P.value=r}:void 0,style:r<t?{cursor:"pointer"}:void 0,children:e})}),r<Un.length&&n("span",{class:"step-separator",children:">"})]},e)})})}const ae=p([]),Ee=p(!0),ot=p(null),ni=p(!1),Ae=p(null),At=p(null),ct=p(!1),Bt=p("overview"),Rt=p(null),Mt=p(!1),Be=p(null),ii=`I have a RunContext semantic plane at Bronze tier. Please help me curate it to Gold.
10
+
11
+ Start by running \`context_tier\` to see the current scorecard, then work through each failing check:
12
+ 1. Run small sample queries (LIMIT 10-25) to understand the actual data — never bulk export
13
+ 2. Write meaningful descriptions, golden queries, guardrails, etc.
14
+ 3. Re-run \`context_tier\` and iterate until Gold
15
+
16
+ Follow the agent instructions in AGENT_INSTRUCTIONS.md — never fabricate metadata, always query first. Never put PII in sample_values.`;async function ri(){if(Mt.value=!0,!Be.value)try{const t=await S("GET","/api/mcp-config");Be.value=JSON.stringify(t,null,2)}catch{}}async function mr(){Ee.value=!0,ot.value=null;try{const t=await S("GET","/api/products");ae.value=t}catch(t){ot.value=t.message||"Failed to load semantic planes"}finally{Ee.value=!1}}async function gr(t){if(Ae.value===t){Ae.value=null;return}Ae.value=t,Bt.value="overview",Rt.value=null,ct.value=!0;try{const e=await S("GET",`/api/products/${encodeURIComponent(t)}/detail`);At.value=e}catch{At.value=null}finally{ct.value=!1}}function yr({plane:t,d:e}){const i=e.tables.filter(a=>a.fields.some(l=>l.description&&!l.description.startsWith("TODO"))).length,r=e.tables.filter(a=>a.fields.some(l=>l.sampleValues.length>0)).length;return e.tables.filter(a=>a.fields.some(l=>l.semanticRole)).length,n("div",{children:[n("div",{class:"plane-overview-grid",children:[n("div",{class:"plane-stat-card",children:[n("div",{class:"plane-stat-value",children:e.tables.length}),n("div",{class:"plane-stat-label",children:"Tables"})]}),n("div",{class:"plane-stat-card",children:[n("div",{class:"plane-stat-value",children:e.tables.reduce((a,l)=>a+l.fields.length,0)}),n("div",{class:"plane-stat-label",children:"Columns"})]}),n("div",{class:"plane-stat-card",children:[n("div",{class:"plane-stat-value",children:i}),n("div",{class:"plane-stat-label",children:"Tables Described"})]}),n("div",{class:"plane-stat-card",children:[n("div",{class:"plane-stat-value",children:r}),n("div",{class:"plane-stat-label",children:"With Samples"})]})]}),n("div",{class:"plane-overview-sections",children:[e.rules.joinRules.length>0&&n("div",{class:"plane-overview-section",children:[n("h4",{children:["Join Rules ",n(G,{variant:"info",children:e.rules.joinRules.length})]}),e.rules.joinRules.slice(0,5).map((a,l)=>n("div",{class:"plane-rule-item",children:[n("code",{children:a.left||a.from})," → ",n("code",{children:a.right||a.to}),a.on&&n("span",{class:"muted",children:[" on ",typeof a.on=="string"?a.on:JSON.stringify(a.on)]})]},l)),e.rules.joinRules.length>5&&n("p",{class:"muted",children:["+ ",e.rules.joinRules.length-5," more"]})]}),e.rules.goldenQueries.length>0&&n("div",{class:"plane-overview-section",children:[n("h4",{children:["Golden Queries ",n(G,{variant:"gold",children:e.rules.goldenQueries.length})]}),e.rules.goldenQueries.map((a,l)=>n("div",{class:"plane-rule-item",children:[n("div",{class:"plane-query-q",children:a.question||a.name||`Query ${l+1}`}),a.sql&&n("code",{class:"plane-query-sql",children:a.sql})]},l))]}),e.rules.guardrails.length>0&&n("div",{class:"plane-overview-section",children:[n("h4",{children:["Guardrails ",n(G,{variant:"warning",children:e.rules.guardrails.length})]}),e.rules.guardrails.map((a,l)=>n("div",{class:"plane-rule-item",children:[n("strong",{children:a.name||`Filter ${l+1}`}),a.description&&n("span",{class:"muted",children:[" — ",a.description]})]},l))]}),e.glossary.length>0&&n("div",{class:"plane-overview-section",children:[n("h4",{children:["Glossary ",n(G,{variant:"info",children:e.glossary.length})]}),e.glossary.map((a,l)=>n("div",{class:"plane-rule-item",children:[n("strong",{children:a.term||a.name}),a.definition&&n("span",{class:"muted",children:[" — ",a.definition]})]},l))]}),e.owners.length>0&&n("div",{class:"plane-overview-section",children:[n("h4",{children:"Owners"}),e.owners.map((a,l)=>n("div",{class:"plane-rule-item",children:[n("strong",{children:a.name||a.team}),a.email&&n("span",{class:"muted",children:[" — ",a.email]})]},l))]})]})]})}function br({d:t}){const e=Rt.value;return n("div",{class:"plane-tables-list",children:[n("div",{class:"plane-table-row plane-table-header-row",children:[n("span",{class:"plane-table-name",children:"Table"}),n("span",{class:"plane-table-cols",children:"Columns"})]}),t.tables.map(i=>n("div",{children:[n("div",{class:`plane-table-row plane-table-clickable${e===i.name?" expanded":""}`,onClick:()=>{Rt.value=e===i.name?null:i.name},children:[n("span",{class:"plane-table-name",children:n("code",{children:i.name})}),n("span",{class:"plane-table-cols",children:i.fields.length})]}),e===i.name&&n("div",{class:"plane-fields-panel",children:i.fields.map(r=>n("div",{class:"plane-field-row",children:[n("div",{class:"plane-field-header",children:[n("code",{class:"plane-field-name",children:r.name}),n("span",{class:"plane-field-type",children:r.type}),r.semanticRole&&n(G,{variant:"gold",children:r.semanticRole})]}),r.description&&n("div",{class:"plane-field-desc",children:r.description}),r.sampleValues.length>0&&n("div",{class:"plane-field-samples",children:r.sampleValues.slice(0,5).map((a,l)=>n("span",{class:"plane-sample-chip",children:String(a)},l))})]},r.name))})]},i.name))]})}function wr({d:t}){return n("div",{class:"plane-rules-tab",children:[t.rules.joinRules.length>0&&n("div",{class:"plane-overview-section",children:[n("h4",{children:"Join Rules"}),t.rules.joinRules.map((e,i)=>n("div",{class:"plane-rule-card",children:[n("code",{children:e.left||e.from}),n("span",{class:"plane-join-arrow",children:"→"}),n("code",{children:e.right||e.to}),e.on&&n("div",{class:"plane-join-on",children:["ON ",typeof e.on=="string"?e.on:JSON.stringify(e.on)]}),e.type&&n(G,{variant:"info",children:e.type})]},i))]}),t.rules.grainStatements.length>0&&n("div",{class:"plane-overview-section",children:[n("h4",{children:"Grain Statements"}),t.rules.grainStatements.map((e,i)=>n("div",{class:"plane-rule-item",children:[n("strong",{children:e.table||e.name}),": ",e.grain||e.statement||JSON.stringify(e)]},i))]}),t.rules.goldenQueries.length>0&&n("div",{class:"plane-overview-section",children:[n("h4",{children:"Golden Queries"}),t.rules.goldenQueries.map((e,i)=>n(A,{children:n("div",{style:{padding:"4px 0"},children:[n("div",{style:{fontWeight:600,marginBottom:"6px"},children:e.question||e.name||`Query ${i+1}`}),e.sql&&n(ue,{code:e.sql})]})},i))]}),t.rules.guardrails.length>0&&n("div",{class:"plane-overview-section",children:[n("h4",{children:"Guardrail Filters"}),t.rules.guardrails.map((e,i)=>n(A,{children:n("div",{style:{padding:"4px 0"},children:[n("div",{style:{fontWeight:600,marginBottom:"4px"},children:e.name||`Filter ${i+1}`}),e.description&&n("div",{class:"muted",style:{marginBottom:"6px"},children:e.description}),e.sql&&n(ue,{code:e.sql})]})},i))]}),t.rules.joinRules.length===0&&t.rules.goldenQueries.length===0&&t.rules.guardrails.length===0&&t.rules.grainStatements.length===0&&n("p",{class:"muted",children:"No rules defined yet. Run enrichment to generate rules."})]})}function Cr({d:t}){const e=p("model"),i=e.value,r=i==="model"?t.yaml.model:i==="rules"?t.yaml.rules:t.yaml.governance;return n("div",{children:[n("div",{class:"plane-yaml-tabs",children:["model","rules","governance"].map(a=>n("button",{class:`plane-yaml-tab${i===a?" active":""}`,onClick:()=>{e.value=a},children:a.charAt(0).toUpperCase()+a.slice(1)},a))}),r?n("div",{class:"plane-yaml-block",children:n(ue,{code:r})}):n("p",{class:"muted",children:["No ",i," YAML file found."]})]})}function kr({tier:t}){const{toast:e}=J();if(t==="gold")return null;const i=t==="bronze"?"Silver":"Gold";return n("div",{class:"curate-callout",children:n("div",{class:"curate-callout-content",children:[n("h4",{children:["Curate to ",i]}),n("p",{class:"muted",children:t==="bronze"?"Your plane is at Bronze — scaffolded but not yet enriched with real data context. Have your AI agent curate it using your actual database.":"Your plane is at Silver — sample values are present. Add golden queries, guardrails, and rich descriptions to reach Gold."}),n(b,{variant:"primary",size:"sm",onClick:ri,children:["Curate to ",i," →"]})]})})}function xr(){const{toast:t}=J();return Mt.value?n("div",{class:"curate-overlay",children:n("div",{class:"curate-panel",children:[n("div",{class:"curate-panel-header",children:[n("h3",{children:"Agent-Driven Curation"}),n("button",{class:"curate-panel-close",onClick:()=>{Mt.value=!1},children:"✕"})]}),n("div",{class:"curate-panel-body",children:[n("div",{class:"curate-panel-step",children:[n("div",{class:"curate-step-num",children:"1"}),n("div",{children:[n("h4",{children:"Add MCP Config to Your IDE"}),n("p",{class:"muted",children:"Copy this into your IDE's MCP settings (Claude Code, Cursor, etc.)"}),Be.value&&n("div",{style:{marginTop:"8px"},children:[n(ue,{code:Be.value}),n(b,{variant:"secondary",size:"sm",onClick:()=>{navigator.clipboard.writeText(Be.value||""),t("success","Copied MCP config")},style:{marginTop:"8px"},children:"Copy Config"})]})]})]}),n("div",{class:"curate-panel-step",children:[n("div",{class:"curate-step-num",children:"2"}),n("div",{children:[n("h4",{children:"Paste This Prompt in Your IDE"}),n("p",{class:"muted",children:"Your AI agent will query your database and curate the metadata to Gold."}),n("div",{class:"curate-prompt-block",style:{marginTop:"8px"},children:[n("div",{class:"curate-prompt-text",children:ii}),n(b,{variant:"primary",size:"sm",onClick:()=>{navigator.clipboard.writeText(ii),t("success","Curation prompt copied — paste it in your IDE")},style:{marginTop:"8px"},children:"Copy Curation Prompt"})]})]})]}),n("div",{class:"curate-panel-step",children:[n("div",{class:"curate-step-num",children:"3"}),n("div",{children:[n("h4",{children:"Refresh to See Progress"}),n("p",{class:"muted",children:["After your agent curates, refresh the Semantic Planes page or run ",n("code",{children:"context tier"})," to check your tier."]})]})]})]})]})}):null}function Sr(){ni.value||(ni.value=!0,mr());const t=Ae.value,e=t?ae.value.find(a=>a.name===t):null,i=At.value,r=Bt.value;return n("div",{class:"planes-page",children:[n(K,{title:"Your Semantic Planes",storageKey:"planes-page-info",children:[n(L,{term:"semanticPlane",definition:k.semanticPlane.definition,children:k.semanticPlane.label})," organize your data context by domain. Each plane contains models, governance rules, guardrails, and a glossary. Build more planes by returning to ",n("a",{href:"/setup",children:"Setup"}),"."]}),Ee.value&&n("div",{class:"planes-grid",children:[n(R,{variant:"card",width:"100%",height:"160px"}),n(R,{variant:"card",width:"100%",height:"160px"})]}),!Ee.value&&ae.value.length===0&&n(Ai,{message:"No semantic planes yet. Connect a database and run the setup wizard to create your first semantic plane.",action:n("a",{href:"/setup",class:"rc-btn rc-btn--primary",children:"Go to Setup"})}),!Ee.value&&ae.value.length>0&&!t&&n(z,{children:[n("div",{class:"planes-grid",children:ae.value.map(a=>n(A,{interactive:!0,children:n("div",{class:"plane-card",onClick:()=>gr(a.name),children:[n("div",{class:"plane-card-header",children:[n("h3",{class:"plane-card-name",children:a.name}),a.tier&&n(He,{tier:a.tier})]}),a.description&&n("p",{class:"plane-card-desc",children:a.description}),n("div",{class:"plane-card-stats",children:[a.tables!==void 0&&n(G,{variant:"info",children:[a.tables," tables"]}),a.columns!==void 0&&n(G,{variant:"info",children:[a.columns," columns"]})]}),a.tier&&a.tier!=="gold"&&n("div",{class:"plane-card-cta",children:["Curate to ",a.tier==="bronze"?"Silver":"Gold"," →"]})]})},a.name))}),ae.value.some(a=>a.tier&&a.tier!=="gold")&&n(kr,{tier:ae.value[0]?.tier||"bronze"})]}),t&&e&&n("div",{class:"plane-detail",children:[n("div",{class:"plane-detail-header",children:n("a",{class:"plane-detail-back",onClick:()=>{Ae.value=null},children:"← All Planes"})}),n("div",{class:"plane-detail-hero",children:[n("div",{children:[n("h2",{class:"plane-detail-name",children:e.name}),e.description&&n("p",{class:"plane-detail-desc",children:e.description})]}),n("div",{class:"plane-detail-tier-actions",children:[e.tier&&n(He,{tier:e.tier}),e.tier&&e.tier!=="gold"&&n(b,{variant:"primary",size:"sm",onClick:ri,children:["Curate to ",e.tier==="bronze"?"Silver":"Gold"]})]})]}),n("div",{class:"plane-tabs",children:["overview","tables","rules","yaml"].map(a=>n("button",{class:`plane-tab${r===a?" active":""}`,onClick:()=>{Bt.value=a},children:a==="yaml"?"YAML Blueprint":a.charAt(0).toUpperCase()+a.slice(1)},a))}),ct.value&&n("div",{style:{marginTop:"16px"},children:n(R,{variant:"text",width:"100%",height:"200px"})}),!ct.value&&i&&n("div",{class:"plane-tab-content",children:[r==="overview"&&n(yr,{plane:e,d:i}),r==="tables"&&n(br,{d:i}),r==="rules"&&n(wr,{d:i}),r==="yaml"&&n(Cr,{d:i})]})]}),ot.value&&n("p",{class:"field-error",children:ot.value}),!t&&n("div",{class:"cloud-upsell",children:n(A,{children:n("div",{class:"upsell-content",children:[n("h3",{children:"Want team collaboration?"}),n("p",{class:"muted",children:"RunContext Cloud lets your team collaborate on semantic planes, share MCP endpoints, and track analytics."}),n("a",{href:"https://runcontext.dev/pricing",target:"_blank",rel:"noopener",class:"rc-btn rc-btn--primary",children:"Try RunContext Cloud →"})]})})}),n(xr,{})]})}const le=p(null),Ot=p(!0),ai=p(!1);async function Tr(){Ot.value=!0;try{const t=await S("GET","/api/products");let e=0,i=0,r="none";for(const a of t)e+=a.tables||0,i+=a.columns||0,a.tier==="gold"?r="gold":a.tier==="silver"&&r!=="gold"?r="silver":a.tier==="bronze"&&r==="none"&&(r="bronze");le.value={planes:t.length,tables:e,columns:i,tier:r}}catch{}finally{Ot.value=!1}}function Pr(){return ai.value||(ai.value=!0,Tr()),n("div",{class:"analytics-page",children:[n(K,{title:"Context Layer Analytics",storageKey:"analytics-page-info",children:["View metrics about your local ",n(L,{term:"contextLayer",definition:k.contextLayer.definition,children:k.contextLayer.label}),". For API usage analytics, team activity, and query insights, upgrade to RunContext Cloud."]}),Ot.value?n("div",{class:"stats-grid",children:[n(R,{variant:"stat"}),n(R,{variant:"stat"}),n(R,{variant:"stat"}),n(R,{variant:"stat"})]}):le.value?n("div",{class:"stats-grid",children:[n(qe,{label:"Semantic Planes",value:String(le.value.planes)}),n(qe,{label:"Tables",value:String(le.value.tables)}),n(qe,{label:"Columns",value:String(le.value.columns)}),n(qe,{label:"Best Tier",value:le.value.tier.charAt(0).toUpperCase()+le.value.tier.slice(1)})]}):n("p",{class:"muted",children:"No data available. Complete the setup wizard first."}),n("div",{class:"gated-section",children:[n("h3",{class:"gated-title",children:"Cloud Analytics"}),n("div",{class:"gated-features",children:[n(A,{children:n("div",{class:"gated-feature",children:[n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--rc-color-text-secondary)","stroke-width":"2",children:[n("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n("path",{d:"M7 11V7a5 5 0 0110 0v4"})]}),n("h4",{children:"API Usage"}),n("p",{class:"muted",children:"Track MCP endpoint calls, latency, and error rates."})]})}),n(A,{children:n("div",{class:"gated-feature",children:[n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--rc-color-text-secondary)","stroke-width":"2",children:[n("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n("path",{d:"M7 11V7a5 5 0 0110 0v4"})]}),n("h4",{children:"Team Activity"}),n("p",{class:"muted",children:"See who's editing planes and when changes were made."})]})}),n(A,{children:n("div",{class:"gated-feature",children:[n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--rc-color-text-secondary)","stroke-width":"2",children:[n("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n("path",{d:"M7 11V7a5 5 0 0110 0v4"})]}),n("h4",{children:"Query Insights"}),n("p",{class:"muted",children:"Understand how AI agents use your context layer."})]})})]}),n("div",{class:"gated-cta",children:n("a",{href:"https://runcontext.dev/pricing",target:"_blank",rel:"noopener",class:"rc-btn rc-btn--primary",children:"Unlock Cloud Analytics →"})})]})]})}const dt=p(!1);function $r(){const{toast:t}=J();function e(){sessionStorage.removeItem("runcontext_wizard_state");for(let r=localStorage.length-1;r>=0;r--){const a=localStorage.key(r);a&&a.startsWith("rc-info-dismissed:")&&localStorage.removeItem(a)}t("success","Wizard state cleared"),dt.value=!1,window.location.href="/setup"}function i(){for(let r=localStorage.length-1;r>=0;r--){const a=localStorage.key(r);a&&a.startsWith("rc-info-dismissed:")&&localStorage.removeItem(a)}t("success","All info cards re-enabled")}return n("div",{class:"settings-page",children:[n(K,{title:"Settings",storageKey:"settings-page-info",children:"Configure your local RunContext instance. For team settings, API keys, and billing, use RunContext Cloud."}),n(A,{children:[n("h3",{children:"Local Configuration"}),n("div",{class:"settings-section",children:[n("div",{class:"setting-row",children:[n("div",{class:"setting-info",children:[n("label",{children:"MCP Server Port"}),n("p",{class:"muted",children:["The port your ",n(L,{term:"mcpEndpoint",definition:k.mcpEndpoint.definition,children:k.mcpEndpoint.label})," runs on."]})]}),n("div",{class:"setting-value",children:[n(de,{value:"3333",disabled:!0}),n("p",{class:"hint",children:["Configure via CLI: ",n("code",{children:"context serve --port 8080"})]})]})]}),n("div",{class:"setting-row",children:[n("div",{class:"setting-info",children:[n("label",{children:"Show Tips"}),n("p",{class:"muted",children:"Re-enable all dismissed info cards and tooltips."})]}),n("div",{class:"setting-value",children:n(b,{variant:"secondary",size:"sm",onClick:i,children:"Show All Tips"})})]})]})]}),n(A,{children:[n("h3",{class:"danger-heading",children:"Danger Zone"}),n("div",{class:"settings-section",children:n("div",{class:"setting-row",children:[n("div",{class:"setting-info",children:[n("label",{children:"Reset Wizard"}),n("p",{class:"muted",children:"Clear all wizard progress and start over. Your semantic plane files on disk are not affected."})]}),n("div",{class:"setting-value",children:n(b,{variant:"danger",size:"sm",onClick:()=>{dt.value=!0},children:"Reset Wizard"})})]})})]}),n("div",{class:"gated-section",children:[n("h3",{class:"gated-title",children:"Cloud Settings"}),n("div",{class:"gated-features",children:[n(A,{children:n("div",{class:"gated-feature",children:[n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--rc-color-text-secondary)","stroke-width":"2",children:[n("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n("path",{d:"M7 11V7a5 5 0 0110 0v4"})]}),n("h4",{children:"API Keys"}),n("p",{class:"muted",children:"Create and manage API keys for programmatic access."})]})}),n(A,{children:n("div",{class:"gated-feature",children:[n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--rc-color-text-secondary)","stroke-width":"2",children:[n("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n("path",{d:"M7 11V7a5 5 0 0110 0v4"})]}),n("h4",{children:"Team Management"}),n("p",{class:"muted",children:"Invite team members, assign roles, and manage access."})]})}),n(A,{children:n("div",{class:"gated-feature",children:[n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--rc-color-text-secondary)","stroke-width":"2",children:[n("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n("path",{d:"M7 11V7a5 5 0 0110 0v4"})]}),n("h4",{children:"Billing"}),n("p",{class:"muted",children:"Manage your subscription and view usage."})]})})]}),n("div",{class:"gated-cta",children:n("a",{href:"https://runcontext.dev/pricing",target:"_blank",rel:"noopener",class:"rc-btn rc-btn--primary",children:"Get RunContext Cloud →"})})]}),n(Ui,{open:dt.value,title:"Reset Wizard",description:"This will clear all wizard progress including your database connection, brief, and pipeline state. Your semantic plane files on disk are not affected.",confirmLabel:"Reset",variant:"danger",onConfirm:e,onCancel:()=>{dt.value=!1}})]})}let X=null;function Lt(t){Pt.value=t,X&&(X.onclose=null,X.close(),X=null);const e=location.protocol==="https:"?"wss:":"ws:";X=new WebSocket(`${e}//${location.host}/ws?session=${encodeURIComponent(t)}&role=wizard`),X.onmessage=i=>{try{const r=JSON.parse(i.data);Ir(r)}catch{}},X.onclose=()=>{setTimeout(()=>{Pt.value&&Lt(Pt.value)},2e3)},X.onerror=()=>{}}function Ir(t){const e=t.payload||{};switch(t.type){case"setup:step":e.step&&(P.value=e.step);break;case"setup:field":{const i=document.getElementById(e.fieldId);i&&(i.value=e.value||"",i.dispatchEvent(new Event("input")));break}case"pipeline:stage":_e.value={..._e.value,[e.stage]:{status:e.status,summary:e.summary,error:e.error}};break;case"enrich:progress":Gn.value={...Gn.value,[e.requirement]:{status:e.status,progress:e.progress}};break;case"enrich:log":jn.value=[...jn.value,{message:e.message,timestamp:e.timestamp||new Date().toISOString()}];break}}const zt=document.body.dataset.page||"setup";if(zt==="setup"){const t=document.getElementById("wizard-content");t&&wt(n(pr,{}),t);const e=document.getElementById("stepper");e&&wt(n(_r,{}),e)}else{const t=document.getElementById("page-content");if(t){const e={planes:Sr,analytics:Pr,settings:$r}[zt];e&&wt(n(Tn,{children:n("div",{class:"step-fade-in",children:n(e,{})})}),t)}}let li=!1;function ut(t){li=t;const e=document.getElementById("mcp-status-dot"),i=document.getElementById("mcp-status-text"),r=document.getElementById("mcp-server-dot"),a=document.getElementById("mcp-server-text");t?(e&&(e.classList.remove("error"),e.classList.add("success")),i&&(i.textContent="connected"),r&&(r.classList.remove("error"),r.classList.add("success")),a&&(a.textContent="MCP running")):(e&&e.classList.remove("success"),i&&(i.textContent="offline"),r&&r.classList.remove("success"),a&&(a.textContent="MCP stopped"))}function Nr(){async function t(){try{const i=await(await fetch("/api/mcp/status")).json();ut(i.running===!0)}catch{ut(!1)}}t(),setInterval(t,5e3)}async function Er(){const t=document.getElementById("mcp-server-text");t&&(t.textContent="Working...");try{li?(await fetch("/api/mcp/stop",{method:"POST"}),ut(!1)):(await fetch("/api/mcp/start",{method:"POST"}),ut(!0))}catch{}}function Ar(){document.querySelectorAll(".mcp-toggle").forEach(t=>{t.addEventListener("click",e=>{e.preventDefault(),Er()})})}function Br(){if(M.value.length>0){const t=M.value[0],e=document.getElementById("db-status-dot"),i=document.getElementById("db-status-text");e&&i&&(e.classList.remove("error"),e.classList.add("success"),i.textContent=(t.name||t.adapter)+" connected")}}function Rr(){if(Nr(),Ar(),Br(),zt==="setup"){const t=document.getElementById("locked-tooltip");t&&(document.querySelectorAll(".nav-item.locked").forEach(r=>{r.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();const l=r.getBoundingClientRect();t.style.display="block",t.style.left=l.left+"px",t.style.top=l.bottom+6+"px"})}),document.addEventListener("click",r=>{if(t.style.display!=="none"){let a=!1;document.querySelectorAll(".nav-item.locked").forEach(l=>{l.contains(r.target)&&(a=!0)}),a||(t.style.display="none")}}));const i=new URLSearchParams(window.location.search).get("session");i?Lt(i):S("POST","/api/session").then(r=>{if(r.sessionId){Lt(r.sessionId);const a=window.location.pathname+"?session="+encodeURIComponent(r.sessionId);window.history.replaceState({},"",a)}}).catch(()=>{})}}document.addEventListener("DOMContentLoaded",Rr)})();