@flowe-ai/cli 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,5 +5,5 @@ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),t.put(n,13)}};Dn.exp
5
5
  The chosen QR Code version cannot contain this amount of data.
6
6
  Minimum version required to store current data is: `+i+`.
7
7
  `);let s=xr(e,n,r),l=Oe.getSymbolSize(e),c=new hr(l);return br(c,e),kr(c),Cr(c,e),vt(c,n,0),e>=7&&Er(c,e),Mr(c,s),isNaN(o)&&(o=bt.getBestMask(c,vt.bind(null,c,n))),bt.applyMask(o,c),vt(c,n,o),{modules:c,version:e,errorCorrectionLevel:n,maskPattern:o,segments:r}}Jn.create=function(e,n){if(typeof e>"u"||e==="")throw new Error("No input text");let o=yt.M,r,i;return typeof n<"u"&&(o=yt.from(n.errorCorrectionLevel,yt.M),r=qe.from(n.version),i=bt.from(n.maskPattern),n.toSJISFunc&&Oe.setToSJISFunction(n.toSJISFunc)),Sr(e,r,o,i)}});var Ct=P(oe=>{function Yn(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(o){return[o,o]}))),e.length===6&&e.push("F","F");let n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+e.slice(0,6).join("")}}oe.getOptions=function(e){e||(e={}),e.color||(e.color={});let n=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,o=e.width&&e.width>=21?e.width:void 0,r=e.scale||4;return{width:o,scale:o?4:r,margin:n,color:{dark:Yn(e.color.dark||"#000000ff"),light:Yn(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};oe.getScale=function(e,n){return n.width&&n.width>=e+n.margin*2?n.width/(e+n.margin*2):n.scale};oe.getImageWidth=function(e,n){let o=oe.getScale(e,n);return Math.floor((e+n.margin*2)*o)};oe.qrToImageData=function(e,n,o){let r=n.modules.size,i=n.modules.data,s=oe.getScale(r,o),l=Math.floor((r+o.margin*2)*s),c=o.margin*s,f=[o.color.light,o.color.dark];for(let d=0;d<l;d++)for(let g=0;g<l;g++){let _=(d*l+g)*4,u=o.color.light;if(d>=c&&g>=c&&d<l-c&&g<l-c){let h=Math.floor((d-c)/s),C=Math.floor((g-c)/s);u=f[i[h*r+C]?1:0]}e[_++]=u.r,e[_++]=u.g,e[_++]=u.b,e[_]=u.a}}});var Gn=P(ze=>{var Et=Ct();function Tr(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}function Ar(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}ze.render=function(e,n,o){let r=o,i=n;typeof r>"u"&&(!n||!n.getContext)&&(r=n,n=void 0),n||(i=Ar()),r=Et.getOptions(r);let s=Et.getImageWidth(e.modules.size,r),l=i.getContext("2d"),c=l.createImageData(s,s);return Et.qrToImageData(c.data,e,r),Tr(l,i,s),l.putImageData(c,0,0),i};ze.renderToDataURL=function(e,n,o){let r=o;typeof r>"u"&&(!n||!n.getContext)&&(r=n,n=void 0),r||(r={});let i=ze.render(e,n,r),s=r.type||"image/png",l=r.rendererOpts||{};return i.toDataURL(s,l.quality)}});var eo=P(Zn=>{var Br=Ct();function Xn(t,e){let n=t.a/255,o=e+'="'+t.hex+'"';return n<1?o+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':o}function Mt(t,e,n){let o=t+e;return typeof n<"u"&&(o+=" "+n),o}function Ir(t,e,n){let o="",r=0,i=!1,s=0;for(let l=0;l<t.length;l++){let c=Math.floor(l%e),f=Math.floor(l/e);!c&&!i&&(i=!0),t[l]?(s++,l>0&&c>0&&t[l-1]||(o+=i?Mt("M",c+n,.5+f+n):Mt("m",r,0),r=0,i=!1),c+1<e&&t[l+1]||(o+=Mt("h",s),s=0)):r++}return o}Zn.render=function(e,n,o){let r=Br.getOptions(n),i=e.modules.size,s=e.modules.data,l=i+r.margin*2,c=r.color.light.a?"<path "+Xn(r.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",f="<path "+Xn(r.color.dark,"stroke")+' d="'+Ir(s,i,r.margin)+'"/>',d='viewBox="0 0 '+l+" "+l+'"',_='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+d+' shape-rendering="crispEdges">'+c+f+`</svg>
8
- `;return typeof o=="function"&&o(null,_),_}});var no=P(ve=>{var Rr=on(),xt=Qn(),to=Gn(),Nr=eo();function Pt(t,e,n,o,r){let i=[].slice.call(arguments,1),s=i.length,l=typeof i[s-1]=="function";if(!l&&!Rr())throw new Error("Callback required as last argument");if(l){if(s<2)throw new Error("Too few arguments provided");s===2?(r=n,n=e,e=o=void 0):s===3&&(e.getContext&&typeof r>"u"?(r=o,o=void 0):(r=o,o=n,n=e,e=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(n=e,e=o=void 0):s===2&&!e.getContext&&(o=n,n=e,e=void 0),new Promise(function(c,f){try{let d=xt.create(n,o);c(t(d,e,o))}catch(d){f(d)}})}try{let c=xt.create(n,o);r(null,t(c,e,o))}catch(c){r(c)}}ve.create=xt.create;ve.toCanvas=Pt.bind(null,to.render);ve.toDataURL=Pt.bind(null,to.renderToDataURL);ve.toString=Pt.bind(null,function(t,e,n){return Nr.render(t,n)})});var x,Rt,go,j,Ve,xe,Nt,ke,Lt,Ke,je,mo,ue=Symbol.for("pv"),Pe={},Se=[],yo=/^m(i|n|o|s|text|space)$/,We=Array.isArray,Ft=Se.slice,Z=Object.assign;function X(t){t&&t.parentNode&&t.remove()}function Ce(t,e,n,o,r){var i={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:ue,__v:r||++Rt,__i:-1,__u:0};return!r&&x.vnode&&x.vnode(i),i}function U(t){return t.children}function Ee(t,e){this.props=t,this.context=e,this.__g=0}function K(t,e){if(e==null)return t.__&&K(t.__,t.__i+1);for(var n;e<t.__k.length;e++)if((n=t.__k[e])&&n.__e)return n.__e;return typeof t.type!="function"||t.props.__P?null:K(t)}function wo(t){var e,n=t.__v,o=n.__e,r=[],i=[],s=t.__P;s&&((e=Z({constructor:ue},n)).__v=n.__v+1,x.vnode&&x.vnode(e),Je(s,e,n,t.__n,s.namespaceURI,32&n.__u?[o]:null,r,o||K(n),32&n.__u,i),e.__v=n.__v,e.__.__k[e.__i]=e,Ht(r,e,i),n.__=n.__e=null,e.__e!=o&&Dt(e))}function Dt(t){if((t=t.__)&&t.__c&&!t.props.__P)return t.__e=null,t.__k.some(function(e){return e&&(t.__e=e.__e)}),Dt(t)}function Bt(t){(8&t.__g||(t.__g|=8,j.push(t),xe++))&&Ve==x.debounceRendering||((Ve=x.debounceRendering)||queueMicrotask)(Ut)}function Ut(){try{for(var t,e=1;j.length;)j.length>e&&j.sort(Nt),t=j.shift(),e=j.length,8&t.__g&&wo(t)}finally{(xe=j.length)&&(Ve||queueMicrotask)(Ut)}}function qt(t,e,n,o,r,i,s,l,c,f,d){var g,_,u,h,C,p,v=o.__k||Se,b=e.length;for(c=vo(n,e,v,c,b),g=0;g<b;g++)(u=n.__k[g])!=null&&(_=~u.__i&&v[u.__i]||Pe,u.__i=g,p=Je(t,u,_,r,i,s,l,c,f,d),h=u.__e,(_.ref!=u.ref||8&_.__u)&&(_.ref&&Qe(_.ref,null,u,_),u.ref&&d.push(u.ref,u.__c||h,u)),C=C||h,4&u.__u?(c=Ot(u,c,t,!_.__v),_.__e&&(_.__e=null)):typeof u.type=="function"&&p!==void 0?c=p:h&&(c=h.nextSibling),u.__u&=-21);return n.__e=C,c}function vo(t,e,n,o,r){var i,s,l,c,f,d,g,_,u,h=n.length,C=h,p=0,v=0,b=t.__k=Array(r);for(i=0;i<r;i++)(s=e[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s!="object"||s.constructor===String?s=b[i]=Ce(null,s):We(s)?s=b[i]=Ce(U,{children:s}):s.constructor===ue&&s.__b?s=b[i]=Ce(s.type,s.props,s.key,s.ref,s.__v):b[i]=s,c=i+p,s.__=t,s.__b=t.__b+1,l=null,~(f=s.__i=bo(s,n,c,C))&&(C--,(l=n[f])&&(l.__u|=2)),l&&l.__v?(s.__u|=16,f==c-1?p--:f==c+1?p++:f!=c&&(f>c?p--:p++,v=1)):(~f||(r>h?p--:r<h&&p++),typeof s.type!="function"&&(s.__u|=4))):b[i]=null;if(v){for(d=[],g=[],i=0;i<r;i++)if((s=b[i])&&16&s.__u){for(p=0,_=d.length;p<_;)d[u=p+_>>1]<s.__i?p=u+1:_=u;d[p]=s.__i,g[i]=p+1}for(p=d.length;i--;)g[i]&&(g[i]==p?p--:b[i].__u|=4)}if(C)for(i=0;i<h;i++)!(l=n[i])||2&l.__u||(l.__e==o&&(o=K(l)),Ye(l,l));return o}function Ot(t,e,n,o){var r,i,s,l;if(typeof t.type=="function"){if(t.props.__P)return e;if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&(r[i].__=t,e=Ot(r[i],e,n,!1));return e}for(e&&!e.parentNode&&(e=K(t))&&!e.parentNode&&(e=null),s=t.__e,l=e;l&&l.nodeType==8;)l=l.nextSibling;for(s!=l&&(!o&&n.moveBefore&&s.parentNode?n.moveBefore(s,e):n.insertBefore(s,e||null)),e=s;(e=e&&e.nextSibling)&&e.nodeType==8&&!e.data.startsWith("$s"););return e}function bo(t,e,n,o){var r,i=t.key,s=t.type,l=e[n],c=l&&!(2&l.__u);if(l===null&&i==null||c&&i==l.key&&s==l.type)return n;if(o>(c?1:0)){for(r=n-1;r>=0;r--)if((l=e[r])&&!(2&l.__u)&&i==l.key&&s==l.type)return r;for(r=n+1;r<e.length;r++)if((l=e[r])&&!(2&l.__u)&&i==l.key&&s==l.type)return r}return-1}function It(t,e,n){n==null&&(n=""),e[0]=="-"?t.setProperty(e,n):t[e]=n}function be(t,e,n,o,r){var i,s;if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||It(t.style,e);if(n)for(e in n)o&&n[e]==o[e]||It(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")typeof n!="function"&&(n=null),typeof o!="function"&&(o=null),(t.__e||(t.__e={}))[e]=n,n&&o||(s=je[e]||(je[e]=ko(e)),(t.__a||(t.__a={}))[e]=Ke,i=e!=(e=e.replace(Lt,"$1")),(e=e.slice(2))[0]<"a"&&(e=e.toLowerCase()),n?t.addEventListener(e,s,i):t.removeEventListener(e,s,i));else{if(r=="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{return void(t[e]=n??"")}catch{}if(typeof n=="function")return;n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n)}}function ko(t){return function(e){var n=this.__e;if(n){if(n=n[t],e[ke]==null)e[ke]=Ke++;else if(e[ke]<this.__a[t])return;return n(x.event?x.event(e):e)}}}function Je(t,e,n,o,r,i,s,l,c,f){var d,g,_,u,h,C,p,v,b,m,k,w,y,E,T,$,D,F,R=e.type;if(e.constructor!==ue)return null;128&n.__u&&(c=32&n.__u,d=n.__c.__z)&&(e.__u|=c,g=i=[],d.nodeType==8?l=Me(d,i):i.push(d),l=i[0]||l),(d=x.__b)&&d(e);e:if(typeof R=="function"){_=s.length;try{if(v=e.props,b=(d=R.prototype)&&d.render,m=(d=R.contextType)&&o[d.__c],k=d?m?m.props.value:d.__:o,(u=n.__c)?(e.__c=u,2&u.__g&&(u.__g|=1)):(b?e.__c=u=new R(v,k):(e.__c=u=new Ee(v,k),u.constructor=R,u.render=Eo),m&&m.sub(u),u.state||(u.state={}),u.__n=o,u.__g|=8,u.__h=[],u.__k=[]),b&&(u.__s||(u.__s=u.state),R.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=Z({},u.__s)),Z(u.__s,R.getDerivedStateFromProps(v,u.__s)))),h=u.props,C=u.state,u.__v=e,n.__c){if(v!==h&&b&&!R.getDerivedStateFromProps&&u.componentWillReceiveProps&&u.componentWillReceiveProps(v,k),e.__v==n.__v&&!(8&u.__g)||!(4&u.__g)&&u.shouldComponentUpdate&&u.shouldComponentUpdate(v,u.__s,k)===!1){e.__v!=n.__v&&(u.props=v,u.state=u.__s,u.__g&=-9),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(N){N&&(N.__=e)}),Se.push.apply(u.__h,u.__k),u.__k=[],u.__h.length&&s.push(u),l=K(n);break e}u.componentWillUpdate&&u.componentWillUpdate(v,u.__s,k),b&&u.componentDidUpdate&&u.__h.push(function(){u.componentDidUpdate(h,C,p)})}else b&&!R.getDerivedStateFromProps&&u.componentWillMount&&u.componentWillMount(),b&&u.componentDidMount&&u.__h.push(u.componentDidMount);u.context=k,u.props=v,u.__P=t,u.__g&=-5,w=x.__r,y=b?25:0;do u.__g&=-9,w&&w(e),d=u.render(u.props,u.state=u.__s,u.context);while(8&u.__g&&++y<25);b&&(Se.push.apply(u.__h,u.__k),u.__k=[]),u.state=u.__s,u.getChildContext&&(o=Z({},o,u.getChildContext())),b&&n.__c&&u.getSnapshotBeforeUpdate&&(p=u.getSnapshotBeforeUpdate(h,C)),E=d&&d.type===U&&d.key==null?d.props.children:d,v.__P&&(d=l,r=(t=v.__P).namespaceURI,c=i=null,n.props&&n.props.__P!=t&&(n.__k.some(function(N){N&&Ye(N,N)}),n.__k=null),l=n.__k?K(n,0):null),l=qt(t,We(E)?E:[E],e,n,o,r,i,s,l,c,f),v.__P&&(e.__e=null,l=d),e.__u&=-161,g&&g.some(X),u.__h.length&&s.push(u),1&u.__g&&(u.__g&=-4)}catch(N){if(s.length=_,e.__v=null,c||i)if(N&&N.then){if(e.__u|=128|c,i){for(~(D=i.indexOf(l||void 0))||(D=i.length);(F=i[D-1])&&F.nodeType==8;)D--;for(;D<i.length;D++)if(F=i[D])if(i[D]=null,T){if(F==$)break}else{if(F.nodeType!=8)break;F.data.startsWith("$s")&&($=Me(T=F))}}if(!T){for(;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;T=l}(d=Me(T=e.__c.__z||(e.__c.__z=T)))?(e.__e=T,l=d):e.__e=l,l=l&&l.nextSibling}else i&&i.some(X);else e.__e=n.__e;e.__k||(e.__k=n.__k||[]),N&&N.then||zt(e),x.__e(N,e,n)}}else l=e.__e=Co(n.__e,e,n,o,r,i,s,c,f,t);return(d=x.diffed)&&d(e),l}function Me(t,e){if(t&&t.nodeType==8&&t.data.startsWith("$s"))for(var n=1;t=t.nextSibling;){if(t.nodeType==8){if(t.data.startsWith("$s"))n++;else if(t.data.startsWith("/$s")&&!--n)return t}e&&e.push(t)}}function zt(t){t&&(t.__c&&(t.__c.__g|=4),t.__k&&t.__k.some(zt))}function Ht(t,e,n){for(var o=0;o<n.length;)Qe(n[o++],n[o++],n[o++]);x.__c&&x.__c(e,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(i){i.call(r)})}catch(i){x.__e(i,r.__v)}})}function Co(t,e,n,o,r,i,s,l,c,f){var d,g,_,u,h,C,p,v,b=n.props||Pe,m=e.props,k=e.type;if(k=="svg"?r="http://www.w3.org/2000/svg":k=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i){for(d=0;d<i.length;d++)if((h=i[d])&&(k?h.localName==k:h.nodeType==3)){t=h,i[d]=null;break}}if(!t){if(v=f.ownerDocument||document,!k)return v.createTextNode(m);t=v.createElementNS(r,k,m.is?m:f),l&&(x.__m&&x.__m(e,i),l=!1),i=null}if(k){if(f=k=="template"&&t.content||t,i=k=="textarea"&&m.defaultValue!=null?null:i&&Ft.call(f.childNodes),!l&&i)for(b={},d=0;d<t.attributes.length;d++)b[(h=t.attributes[d]).name]=h.value;for(d in b)h=b[d],d=="dangerouslySetInnerHTML"?_=h:d=="children"||d in m||d=="value"&&"defaultValue"in m||d=="checked"&&"defaultChecked"in m||be(t,d,null,h,r);for(d in m)h=m[d],d=="children"?u=h:d=="dangerouslySetInnerHTML"?g=h:d=="value"?C=h:d=="checked"?p=h:l&&typeof h!="function"||b[d]===h||be(t,d,h,b[d],r);g?(l||_&&(g.__html==_.__html||g.__html==t.innerHTML)||(t.innerHTML=g.__html),e.__k=[]):(_&&(t.textContent=""),(k=="foreignObject"||r=="http://www.w3.org/1998/Math/MathML"&&yo.test(k))&&(r="http://www.w3.org/1999/xhtml"),qt(f,We(u)?u:[u],e,n,o,r,i,s,i?i[0]:n.__k&&K(n,0),l,c),i&&i.some(X)),l&&k!="textarea"||(d="value",k=="progress"&&C==null?t.removeAttribute(d):C==null||C===t[d]&&(k!="progress"||C)||be(t,d,C,b[d],r),d="checked",p!=null&&p!=t[d]&&be(t,d,p,b[d],r))}else b===m||l&&t.data==m||(t.data=m);return t}function Qe(t,e,n,o){try{typeof t=="function"?e?e.__x=t(e)||1:o&&(o=o.__c||o.__e)&&(e=o.__x)&&(o.__x=null,typeof e=="function"?e():t(null)):t.current=e}catch(r){x.__e(r,n)}}function Ye(t,e,n){var o,r,i,s;if(x.unmount&&x.unmount(t),!(o=t.ref)||o.current&&o.current!=t.__e||Qe(o,null,e,t),o=t.__c){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(l){x.__e(l,e)}o.__P=o.__n=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&Ye(o[s],e,typeof t.type!="function"||n&&!t.props.__P);!n&&(o=t.__c)&&(o=o.__z)&&(r=Me(o,i=[]))&&(o==t.__e&&i.some(X),X(r),X(o)),n||X(t.__e),t.__e=t.__c=t.__=null}function Eo(t,e,n){return this.constructor(t,n)}function $t(t,e){var n,o,r,i;x.__&&x.__(t,e),e.nodeType==9&&(e=e.documentElement),o=(n=t&&32&t.__u)?null:e.__k,e.__k=Ce(U,{children:[t]}),r=[],i=[],Je(e,e.__k,o||Pe,Pe,e.namespaceURI,o?null:e.firstChild?Ft.call(e.childNodes):null,r,o?o.__e:e.firstChild,n,i),Ht(r,e.__k,i),e.__k.props.children=null}x={__e:function(t,e,n,o){for(var r,i,s;e=e.__;)if((r=e.__c)&&!(1&r.__g)){r.__g|=4;try{if((s=(i=r.constructor)&&i.getDerivedStateFromError)&&r.setState(i.getDerivedStateFromError(t)),r.componentDidCatch&&(r.componentDidCatch(t,o||{}),s=1),s&&8&r.__g)return void(r.__g|=2)}catch(l){t=l}}throw xe=0,t}},Rt=0,go=function(t){return t!=null&&t.constructor===ue},Ee.prototype.setState=function(t,e){var n=this.__s;n&&n!=this.state||(n=this.__s=Z({},this.state)),typeof t=="function"&&(t=t(Z({},n),this.props)),t&&(Z(n,t),this.__v&&(e&&this.__k.push(e),Bt(this)))},Ee.prototype.forceUpdate=function(t){this.__v&&(this.__g|=4,t&&this.__h.push(t),Bt(this))},Ee.prototype.render=U,j=[],xe=0,Nt=function(t,e){return t.__v.__b-e.__v.__b},ke=Symbol(),Lt=/(PointerCapture)$|Capture$/i,Ke=0,je={},mo=0;var fe,I,Ge,Vt,Xe=Object.is,Te=0,Zt=[],Ze=[],A=x,jt=A.__b,Kt=A.__r,Wt=A.diffed,Jt=A.__c,Qt=A.unmount,Yt=A.__;function tt(t,e){A.__h&&A.__h(I,t,Te||e),Te=0;var n=I.__H||(I.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function L(t){return Te=1,Mo(tn,t)}function Mo(t,e,n){var o=tt(fe++,2);if(o.t=t,!o.__c&&(o.__=[n?n(e):tn(void 0,e),function(i){var s=(o.__N||o.__)[0],l=o.t(s,i);Xe(s,l)||(o.__N=[l,o.__[1]],o.__c.setState({}))}],o.__c=I,!I.__f)){I.__f=!0;var r=I.shouldComponentUpdate;I.shouldComponentUpdate=function(i,s,l){var c=this.__H;if(!c)return!0;var f=!1,d=this.props!=i;if(c.__.some(function(_){_.__N&&(f=!0,Xe(_.__[0],_.__N[0])||(d=!0))}),r){var g=r.call(this,i,s,l);return f?g||d:g}return!f||d}}return o.__}function re(t,e){var n=tt(fe++,3);!A.__s&&en(n.__H,e)&&(n.__P=!0,n.__=t,n.u=e,I.__H.__h.push(n))}function Ae(t){return Te=5,xo(function(){return{current:t}},[])}function xo(t,e){var n=tt(fe++,7);return en(n.__H,e)&&(n.__=t(),n.__H=e),n.__}function Po(){var t;do{for(;t=Ze.shift();)try{de(t)}catch(n){A.__e(n,{__:(t=t.__P)&&t.__v})}for(;t=Zt.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(de),e.__h.some(et),e.__h=[]}catch(n){e.__h=[],A.__e(n,t.__v)}}}while(Ze.length)}A.__b=function(t){I=null,jt&&jt(t)},A.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Yt&&Yt(t,e)},A.__r=function(t){Kt&&Kt(t),fe=0;var e=(I=t.__c).__H;e&&(Ge==I?I.__h=[]:(e.__h.some(de),e.__h.some(et),fe=0),e.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),Ge=I},A.diffed=function(t){Wt&&Wt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&Xt(Zt.push(e)),e.__H.__.some(function(n){n.u&&(n.__H=n.u)})),Ge=I=null},A.__c=function(t,e){e.some(function(n){try{n.__h.some(de),n.__h=n.__h.filter(function(o){return!o.__||et(o)})}catch(o){n.__h=[function(){throw o}]}}),Jt&&Jt(t,e)},A.unmount=function(t){Qt&&Qt(t);var e,n,o=t.__c;o&&o.__H&&(o.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=t.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}r.__P=n,Xt(Ze.push(r))}else de(r)}catch(i){e=i}}),o.__H=void 0,e&&A.__e(e,o.__v))};var Gt=typeof requestAnimationFrame=="function";function So(t){var e,n=function(){clearTimeout(o),Gt&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(n,35);Gt&&(e=requestAnimationFrame(n))}function Xt(t){t!=1&&Vt==A.requestAnimationFrame||((Vt=A.requestAnimationFrame)||So)(Po)}function de(t){var e=I,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),I=e}function et(t){var e=I;t.__c=t.__(),I=e}function en(t,e){return!t||t.length!=e.length||e.some(function(n,o){return!Xe(n,t[o])})}function tn(t,e){return typeof e=="function"?e(t):e}var To=Symbol.for("pv"),Ao=0;function a(t,e,n,o,r,i){e||(e={});var s,l,c=e;if("ref"in c&&typeof t!="function")for(l in c={},e)l=="ref"?s=e[l]:c[l]=e[l];var f={type:t,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:To,__v:--Ao,__i:-1,__u:0};return(r||i)&&(f.__source=r,f.__self=i),x.vnode&&x.vnode(f),f}var z={body:"var(--fl-peek-body, #8b7ba4)",grey:"var(--fl-peek-grey, #6b645c)",muzzle:"var(--fl-peek-muzzle, #f1eaf6)",ink:"var(--fl-peek-ink, #2b2338)",blush:"var(--fl-peek-blush, #e9a99a)",moon:"var(--fl-peek-moon, #dccfe9)"},Bo="M38.5 117 C36 104 37 90 40 78 C45 55 61 40 80 40 C99 40 115 55 120 78 C123 90 124 104 121.5 117 Z",Io="M52 58 Q60 47 72 44",Ro="M74 89 Q80 86 86 89 Q83.5 95 80 95 Q76.5 95 74 89 Z",No="M80 95 v3 M74.2 100 q2.9 2.8 5.8 0 q2.9 2.8 5.8 0",Lo=[[64,95],[62.5,101],[68.5,102.5],[96,95],[97.5,101],[91.5,102.5]],Fo="M 18 116 A 62 15 0 0 1 142 116",Do="M 142 116 A 62 15 0 0 1 30.2 124.8",Uo="M 146 131 A 76 18 0 0 1 40 142",qo="M 44 116 A 60 60 0 1 1 116 116 Z",nt=[[61,72],[99,72]],Oo={resting:7e3,listening:3600,awake:2400,thinking:3e3},ot={transformBox:"fill-box",transformOrigin:"center"},O=t=>Math.round(t*100)/100;function zo({state:t,small:e}){if(t==="awake"||t==="listening"||t==="thinking"){let[r,i]=t==="listening"?[5.4,7.2]:[5,6.6];e&&([r,i]=[r*1.35,i*1.25]);let[s,l]=t==="thinking"?[3.8,-4.8]:[0,0];return a(U,{children:nt.map(([c,f])=>a("g",{children:[a("ellipse",{cx:O(c+s),cy:O(f+l),rx:O(r),ry:O(i),style:{fill:z.ink}}),e?null:a("circle",{cx:O(c+s+r*.34),cy:O(f+l-i*.4),r:1.8,fill:"#ffffff"})]},c))})}if(t==="glad")return a(U,{children:nt.map(([r,i])=>a("path",{d:`M${O(r-6.3)} ${O(i+2.4)} q6.3 -8.6 12.6 0`,fill:"none",strokeWidth:e?6.2:4.4,strokeLinecap:"round",style:{stroke:z.ink}},r))});let[n,o]=e?[7.2,6.6]:[6.8,4.6];return a(U,{children:nt.map(([r,i])=>a("path",{d:`M${O(r-n)} ${O(i-1.4)} q${n} 6.8 ${O(2*n)} 0`,fill:"none",strokeWidth:o,strokeLinecap:"round",style:{stroke:z.ink}},r))})}function H({state:t="resting",size:e=32,live:n,pro:o=!1,label:r}){let i=e<=32,s=t==="grey"?z.grey:z.body,l=n??(t==="listening"||t==="thinking")?Oo[t]:void 0,c=l?{animationDuration:`${l}ms`}:void 0;return a("svg",{viewBox:"0 0 160 160",width:e,height:e,role:r?"img":void 0,"aria-label":r,"aria-hidden":r?void 0:!0,style:{display:"block",flexShrink:0,overflow:"visible"},children:[o?a("path",{d:qo,style:{fill:z.moon}}):null,t==="listening"?a("ellipse",{cx:80,cy:116,rx:74,ry:18,fill:"none",strokeWidth:3.5,opacity:.32,style:{stroke:s}}):null,l&&t!=="thinking"?[0,l/2].map(f=>a("ellipse",{cx:80,cy:116,rx:62,ry:15,fill:"none",strokeWidth:i?6:3.5,opacity:0,class:"peek-anim-ripple",style:{...ot,...c,animationDelay:`${f}ms`,stroke:s}},f)):null,a("path",{d:Fo,fill:"none",strokeWidth:i?7:5,strokeLinecap:"round",opacity:.5,style:{stroke:s}}),a("g",{class:l?"peek-anim-bob":void 0,style:c,children:[a("path",{d:Bo,style:{fill:s}}),i?null:a("path",{d:Io,fill:"none",stroke:"#ffffff",strokeWidth:4,strokeLinecap:"round",opacity:.3}),a("ellipse",{cx:80,cy:96,rx:25,ry:15,style:{fill:z.muzzle}}),a("path",{d:Ro,style:{fill:z.ink}}),i?null:a(U,{children:[a("path",{d:No,fill:"none",strokeWidth:2.1,strokeLinecap:"round",style:{stroke:z.ink}}),Lo.map(([f,d])=>a("circle",{cx:f,cy:d,r:1.6,opacity:.4,style:{fill:z.ink}},`${f}-${d}`))]}),a("g",{style:ot,children:[a("g",{class:!l||t==="resting"?void 0:t==="thinking"?"peek-anim-look":"peek-anim-blink",style:ot,children:a(zo,{state:t,small:i})}),t==="glad"?[54.5,105.5].map(f=>a("ellipse",{cx:f,cy:82.5,rx:6.2,ry:3.6,opacity:.85,style:{fill:z.blush}},f)):null]},t)]}),a("path",{d:Do,fill:"none",strokeWidth:i?8:6,strokeLinecap:"round",opacity:.8,style:{stroke:s}}),i?null:a("path",{d:Uo,fill:"none",strokeWidth:3,strokeLinecap:"round",opacity:.3,style:{stroke:s}})]})}function rt({size:t=132,stroke:e=3.5,fraction:n,breathScale:o,label:r,children:i}){let s=50-e/2,l=2*Math.PI*s,c=Math.min(1,Math.max(0,n));return a("div",{class:"fl-ring-wrap",style:{width:`${t}px`,height:`${t}px`},role:r?"timer":void 0,"aria-label":r,children:[typeof o=="number"?a("div",{class:"fl-breath-halo",style:{transform:`scale(${o.toFixed(3)})`},"aria-hidden":"true"}):null,a("svg",{viewBox:"0 0 100 100",width:t,height:t,"aria-hidden":"true",children:[a("circle",{cx:"50",cy:"50",r:s,fill:"none","stroke-width":e,style:{stroke:"var(--fl-track-strong)"}}),a("circle",{cx:"50",cy:"50",r:s,fill:"none","stroke-width":e,"stroke-linecap":"round","stroke-dasharray":l,"stroke-dashoffset":l*(1-c),transform:"rotate(-90 50 50)",style:{stroke:"var(--fl-accent)",transition:"stroke-dashoffset 220ms linear"}})]}),i?a("div",{class:"fl-ring-center",children:i}):null]})}var oo=ho(no(),1);function ro({value:t,size:e=96}){let n="",o=21;try{let r=oo.default.create(t,{errorCorrectionLevel:"M"});o=r.modules.size;let i=r.modules.data,s=[];for(let l=0;l<o;l++)for(let c=0;c<o;c++)i[l*o+c]&&s.push(`M${c},${l}h1v1h-1z`);n=s.join("")}catch{n=""}return a("div",{class:"fl-qr-tile","aria-label":`QR code for ${t}`,children:a("svg",{viewBox:`0 0 ${o} ${o}`,width:e,height:e,shapeRendering:"crispEdges",role:"img","aria-label":"Scan to open in Flowe",children:[a("rect",{width:o,height:o,fill:"#ffffff"}),a("path",{d:n,fill:"#1a1611"})]})})}var Lr="2026-01-26";function He(t){let e=t==="dark"||!t&&window.matchMedia?.("(prefers-color-scheme: dark)").matches;document.documentElement.dataset.theme=e?"dark":"light"}function io(t){if(t.structuredContent&&typeof t.structuredContent=="object")return t.structuredContent;let e=t.content?.find(n=>n.type==="text"&&typeof n.text=="string");if(e?.text)try{let n=JSON.parse(e.text);if(n&&typeof n=="object")return n}catch{return{message:e.text}}return null}function so(t,e){He(void 0);let n=window.matchMedia?.("(prefers-color-scheme: dark)"),o,r=()=>{o||He(void 0)};n?.addEventListener?.("change",r);let i=null,s=e??null,l=1,c=new Map,f=w=>{s=w,i?.(w)},d=typeof window<"u"&&window.parent&&window.parent!==window;function g(w){d&&window.parent.postMessage(w,"*")}function _(w,y,E=15e3){if(!d)return Promise.reject(new Error("MCP host not connected"));let T=l++;return new Promise(($,D)=>{let F=window.setTimeout(()=>{c.delete(T),D(new Error(`MCP host timeout (${w})`))},E);c.set(T,{resolve:R=>{clearTimeout(F),$(R)},reject:R=>{clearTimeout(F),D(R)}}),g({jsonrpc:"2.0",id:T,method:w,params:y})})}function u(w,y={}){g({jsonrpc:"2.0",method:w,params:y})}let h=w=>{let y=w.data;if(!(!y||typeof y!="object"||y.jsonrpc!=="2.0")){if(typeof y.id=="number"&&!y.method&&c.has(y.id)){let E=c.get(y.id);c.delete(y.id),y.error?E.reject(new Error(y.error.message||"MCP host error")):E.resolve(y.result??{});return}if(y.method==="ui/resource-teardown"&&y.id!==void 0){g({jsonrpc:"2.0",id:y.id,result:{}});return}if(y.method==="ui/notifications/host-context-changed"){let E=y.params?.theme;E&&(o=E,He(E));return}if(y.method==="ui/notifications/tool-result"&&y.params){let E=io(y.params);E&&f(E)}}};window.addEventListener("message",h);let C=null,p=0,v=0;function b(){let w=document.documentElement,y=Math.ceil(w.scrollWidth),E=Math.ceil(document.body.scrollHeight||w.scrollHeight);E>0&&(y!==p||E!==v)&&(p=y,v=E,u("ui/notifications/size-changed",{width:y,height:E}))}typeof ResizeObserver<"u"&&(C=new ResizeObserver(()=>b()),C.observe(document.body));let m=!1,k=d?_("ui/initialize",{protocolVersion:Lr,appInfo:{name:t,version:"0.3.1"},appCapabilities:{}},4e3).then(w=>{m=!0;let y=w.hostContext;y?.theme&&(o=y.theme,He(y.theme)),u("ui/notifications/initialized",{}),b()}).catch(()=>{}):Promise.resolve();return{callTool:async(w,y={})=>{if(await k,!m)throw new Error("MCP host not connected");let E=await _("tools/call",{name:w,arguments:y}),T=io(E);if(E.isError){let $=T?.message||(E.content?.[0]?.text??"Tool call failed");throw new Error($)}return T??{}},openLink:async w=>{if(await k,m)try{await _("ui/open-link",{url:w},4e3);return}catch{}window.open(w,"_blank","noopener,noreferrer")},updateContext:async w=>{if(await k,!!m)try{await _("ui/update-model-context",{content:[{type:"text",text:w}]},4e3)}catch{}},onPayload:w=>{i=w,s&&w(s)},destroy:()=>{window.removeEventListener("message",h),n?.removeEventListener?.("change",r),C?.disconnect()}}}var G=null;function St(t){try{let e=window.AudioContext||window.webkitAudioContext;if(!e)return;G||(G=new e),G.state==="suspended"&&G.resume();let n=G.currentTime,o=G.createOscillator(),r=G.createGain(),i=t==="inhale"?396:t==="exhale"?288:t==="done"?528:352;o.type="sine",o.frequency.setValueAtTime(i,n),r.gain.setValueAtTime(1e-4,n),r.gain.exponentialRampToValueAtTime(.06,n+.08),r.gain.exponentialRampToValueAtTime(1e-4,n+(t==="done"?1.1:.55)),o.connect(r),r.connect(G.destination),o.start(n),o.stop(n+(t==="done"?1.15:.6))}catch{}}var $e=[{label:"30s Sigh",duration:30,protocol:"physiological_sigh"},{label:"60s Box Breath",duration:60,protocol:"box_breath"},{label:"60s Palming",duration:60,protocol:"palming"},{label:"45s Neck",duration:45,protocol:"neck_rotation"}],Fr=[{id:"deploy_anxiety",label:"Calm Down \xB7 5m",mins:5},{id:"quick_reset",label:"Reset \xB7 10m",mins:10},{id:"logic_lock",label:"Unstuck \xB7 10m",mins:10},{id:"context_switch",label:"Clear \xB7 8m",mins:8}],Dr=[{id:"pomodoro",label:"Pomodoro",sub:"25 / 5"},{id:"dev",label:"Dev block",sub:"50 / 10"},{id:"ultradian",label:"Ultradian",sub:"90 / 15"}],Ur=[{id:"rain_window_soft",label:"Soft rain"},{id:"nature_spring_birds",label:"Spring birds"},{id:"tones_deep_brown_noise",label:"Brown noise"},{id:"interiors_quiet_cafe",label:"Quiet cafe"},{id:"none",label:"Silence"}];function qr(t){let e=t.toLowerCase().trim();if(e.includes("double inhale"))return"Double inhale through the nose";if(e.includes("inhale"))return"Inhale slowly";if(e.includes("long exhale"))return"Long, unhurried exhale";if(e.includes("exhale"))return"Exhale gently";if(e.includes("hold"))return"Hold softly";let n=e.replace(/^\d+\s+/,"");return n.charAt(0).toUpperCase()+n.slice(1)}function Tt(t){let e=Math.max(0,Math.ceil(t)),n=Math.floor(e/60),o=e%60;return`${n}:${String(o).padStart(2,"0")}`}function Or(t,e){if(!e.length||t<e[0].start_ms)return null;for(let n=0;n<e.length;n++)if(t<e[n].end_ms)return e[n];return e[e.length-1]}function zr(t){if(!t?.phase)return .94;switch(t.phase){case"inhale":return 1.12;case"hold_in":return 1.14;case"exhale":return .86;case"hold_out":return .84}}function Hr({payload:t,bridge:e,onTransition:n}){let o=$e.find(p=>p.protocol===t.recommended_protocol&&p.duration===t.recommended_duration)??$e.find(p=>p.duration===t.recommended_duration)??$e[0],[r,i]=L(o),[s,l]=L(!1),[c,f]=L(null),d=!!t.account?.is_pro,g=!!t.account?.authenticated;async function _(){l(!0),f(null);try{let p=await e.callTool("flowe_reset",{duration_seconds:r.duration,protocol:r.protocol,trigger:"harness_suggested"});n({...p,view:"micro_reset",account:t.account})}catch(p){f(p.message)}finally{l(!1)}}async function u(p){l(!0),f(null);try{let v=await e.callTool("flowe_quick_reset",{session_type:p});v.view==="auth"&&v.auth?n(v):v.message&&n({...v,view:"complete",account:t.account})}catch(v){f(v.message)}finally{l(!1)}}async function h(p){l(!0);try{await e.callTool("flowe_reset_control",{action:"snooze",snooze_minutes:p}),await e.updateContext(`User snoozed Flowe reset suggestions for ${p} minutes.`),n({view:"snoozed",snooze_minutes:p,account:t.account})}catch(v){f(v.message)}finally{l(!1)}}async function C(){l(!0),f(null);try{let p=await e.callTool("flowe_auth",{});n(p)}catch(p){f(p.message)}finally{l(!1)}}return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:"awake",size:32,pro:d,label:"Flowe"}),a("div",{children:[a("div",{class:"fl-mono",children:t.eyebrow||(t.session_minutes?`LONG SESSION \xB7 ${t.session_minutes} MIN`:"MOMENT TO RESET")}),a("h2",{class:"fl-title",children:t.headline||"Take a quick breath before the next step"})]})]}),d?a("span",{class:"fl-badge",children:"Flowe Pro"}):null]}),t.reason?a("p",{class:"fl-body",children:t.reason}):null,a("div",{class:"fl-stack",style:{gap:"8px"},children:[a("div",{class:"fl-mono",children:"INSTANT MICRO-RESET \xB7 NO ACCOUNT"}),a("div",{class:"fl-row",children:$e.map(p=>a("button",{type:"button",class:"fl-chip","data-selected":r.protocol===p.protocol&&r.duration===p.duration,onClick:()=>i(p),children:p.label},`${p.protocol}-${p.duration}`))})]}),a("div",{class:"fl-row",style:{justifyContent:"space-between"},children:[a("div",{class:"fl-row",children:[a("button",{type:"button",class:"fl-btn-primary",disabled:s,onClick:_,children:s?"Starting\u2026":`Start ${r.label}`}),a("button",{type:"button",class:"fl-btn-link",disabled:s,onClick:()=>h(25),children:"Snooze 25m"})]}),g?null:a("button",{type:"button",class:"fl-btn-link",disabled:s,onClick:C,children:"Sign in for live resets \u2192"})]}),g?a(U,{children:[a("div",{class:"fl-divider"}),a("div",{class:"fl-stack",style:{gap:"8px"},children:[a("div",{class:"fl-header",children:[a("span",{class:"fl-mono",children:"LIVE QUICK RESET \xB7 GUIDED VOICE"}),t.account?.quick_reset_quota&&t.account.quick_reset_quota.cap>0?a("span",{class:"fl-mono",children:[Math.max(0,t.account.quick_reset_quota.cap-t.account.quick_reset_quota.used)," ","free left this week"]}):null]}),a("div",{class:"fl-row",children:Fr.map(p=>a("button",{type:"button",class:"fl-chip",disabled:s,onClick:()=>u(p.id),children:p.label},p.id))})]})]}):null,c?a("p",{class:"fl-error",children:c}):null]})}function $r({payload:t,bridge:e,onDone:n}){let o=t.duration_seconds??60,r=o*1e3,i=Ae(t.started_at_unix?t.started_at_unix*1e3:Date.now()),[s,l]=L(()=>Math.max(0,Date.now()-i.current)),[c,f]=L(t.audio_mode==="chime"),[d,g]=L(!1),_=Ae(-1),u=Ae(!1),h=t.cues??[];re(()=>{let y=0,E=0,T=()=>{let D=Date.now(),F=Math.min(r,Math.max(0,D-i.current));if(l(F),c&&h.length>0){let R=h.findIndex(N=>F>=N.start_ms&&F<N.end_ms);if(R>=0&&R!==_.current){_.current=R;let N=h[R].phase;St(N==="inhale"?"inhale":N==="exhale"?"exhale":"hold")}}if(F>=r&&!u.current){u.current=!0,c&&St("done"),C();return}document.hidden?E=window.setTimeout(T,500):y=window.requestAnimationFrame(T)},$=()=>{document.hidden||T()};return document.addEventListener("visibilitychange",$),T(),()=>{document.removeEventListener("visibilitychange",$),cancelAnimationFrame(y),clearTimeout(E)}},[r,c]);async function C(){let y={};try{y=await e.callTool("flowe_reset_control",{action:"complete",session_id:t.session_id})}catch{}await e.updateContext(`User completed their ${o}s ${t.protocol_display_name??"reset"}.`),n({...t,...y,view:"complete"})}async function p(){g(!0),u.current=!0;try{await e.callTool("flowe_reset_control",{action:"stop",session_id:t.session_id})}catch{}n({view:"suggest",eyebrow:"RESET PAUSED",headline:"Whenever you want another moment",account:t.account})}let v=Math.max(0,(r-s)/1e3),b=r>0?s/r:1,m=Or(s,h),k=m?qr(m.label):"Settle in and listen",w=t.rounds&&t.rounds>0?Math.min(t.rounds,Math.floor(s/r*t.rounds)+1):null;return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:"resting",size:32,live:!0,pro:!!t.account?.is_pro,label:"Flowe resting"}),a("div",{children:[a("div",{class:"fl-mono",children:["MICRO-RESET \xB7 ",o,"S \xB7 ",(t.voice??"ellie").toUpperCase()]}),a("h2",{class:"fl-title",children:t.protocol_display_name||"Guided Reset"})]})]}),w?a("span",{class:"fl-badge",children:["Round ",w," / ",t.rounds]}):null]}),a("div",{class:"fl-runner-stage",children:[a(rt,{size:128,stroke:3.5,fraction:b,breathScale:zr(m),label:`${Math.ceil(v)} seconds remaining`,children:[a("span",{class:"fl-ring-time",children:Tt(v)}),a("span",{class:"fl-mono",style:{letterSpacing:"0.14em"},children:m?.phase?m.phase.replace("_"," "):"left"})]}),a("div",{class:"fl-stack",style:{gap:"8px",flex:1},children:[a("p",{class:"fl-cue-label","aria-live":"polite",children:k}),a("p",{class:"fl-body",children:"Stay right here while your agent works. Eyes soft, shoulders loose."}),a("div",{class:"fl-row",style:{marginTop:"4px"},children:[a("button",{type:"button",class:"fl-btn-secondary",disabled:d,onClick:p,children:d?"Stopping\u2026":"Stop"}),a("button",{type:"button",class:"fl-chip","data-selected":c,onClick:()=>f(y=>!y),children:c?"Chime on":"Soft chime"})]})]})]})]})}function Vr({payload:t,bridge:e,onUpdate:n}){let[o,r]=L(t.focus??null),[i,s]=L("pomodoro"),[l,c]=L("rain_window_soft"),[f,d]=L(!1),[g,_]=L(null);re(()=>{r(t.focus??null)},[t.focus]),re(()=>{if(!o||o.paused||o.status==="CYCLE_DONE")return;let m=window.setInterval(()=>{document.hidden||r(w=>w&&!w.paused?{...w,remainingSec:Math.max(0,w.remainingSec-1)}:w)},1e3),k=window.setInterval(async()=>{if(!document.hidden)try{let w=await e.callTool("flowe_focus_control",{action:"status"});r(w.focus??null)}catch{}},1e4);return()=>{clearInterval(m),clearInterval(k)}},[o?.status,o?.paused]);async function u(){d(!0),_(null);try{let m=await e.callTool("flowe_focus",{action:"start",preset:i,ambient:l});r(m.focus??null),n({...t,focus:m.focus??null})}catch(m){_(m.message)}finally{d(!1)}}async function h(m){d(!0),_(null);try{let k=await e.callTool("flowe_focus_control",{action:m});r(k.focus??null)}catch(k){_(k.message)}finally{d(!1)}}let C=!!t.account?.is_pro;if(!o)return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:a("div",{class:"fl-brand-row",children:[a(H,{state:"resting",size:32,pro:C,label:"Flowe focus"}),a("div",{children:[a("div",{class:"fl-mono",children:"FOCUS ROOM \xB7 DETACHED CYCLE"}),a("h2",{class:"fl-title",children:"Set a work and break rhythm"})]})]})}),a("div",{class:"fl-stack",style:{gap:"8px"},children:[a("div",{class:"fl-mono",children:"CADENCE"}),a("div",{class:"fl-row",children:Dr.map(m=>a("button",{type:"button",class:"fl-chip","data-selected":i===m.id,onClick:()=>s(m.id),children:[m.label," \xB7 ",m.sub]},m.id))})]}),a("div",{class:"fl-stack",style:{gap:"8px"},children:[a("div",{class:"fl-mono",children:"AMBIENCE"}),a("div",{class:"fl-row",children:Ur.map(m=>a("button",{type:"button",class:"fl-chip","data-selected":l===m.id,onClick:()=>c(m.id),children:m.label},m.id))})]}),a("div",{class:"fl-row",children:a("button",{type:"button",class:"fl-btn-primary",disabled:f,onClick:u,children:f?"Starting\u2026":`Start ${i} focus`})}),g?a("p",{class:"fl-error",children:g}):null]});let p=o.status==="FOCUS_BLOCK"?o.preset==="ultradian"?5400:o.preset==="dev"?3e3:1500:600,v=Math.max(0,Math.min(1,1-o.remainingSec/Math.max(1,p))),b=o.status==="BREAK"||o.status==="LONG_BREAK";return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:o.paused?"grey":b?"awake":"resting",size:32,live:!o.paused,pro:C}),a("div",{children:[a("div",{class:"fl-mono",children:[o.preset.toUpperCase()," \xB7 BLOCK ",o.blockIndex," OF ",o.blocks]}),a("h2",{class:"fl-title",children:o.paused?"Focus paused":b?"Break window":"Deep focus block"})]})]}),o.ambient?a("span",{class:"fl-badge",children:o.ambient.replace(/_/g," ")}):null]}),a("div",{class:"fl-runner-stage",children:[a(rt,{size:116,stroke:3.5,fraction:v,label:`${Tt(o.remainingSec)} left`,children:[a("span",{class:"fl-ring-time",children:Tt(o.remainingSec)}),a("span",{class:"fl-mono",children:o.paused?"paused":b?"break":"focus"})]}),a("div",{class:"fl-stack",style:{gap:"10px",flex:1},children:[a("div",{class:"fl-pips","aria-label":`Block ${o.blockIndex} of ${o.blocks}`,children:Array.from({length:o.blocks}).map((m,k)=>a("span",{class:"fl-pip","data-state":k+1<o.blockIndex?"done":k+1===o.blockIndex?"active":"todo"},k))}),a("div",{class:"fl-row",children:[a("button",{type:"button",class:"fl-btn-primary",disabled:f,onClick:()=>h(o.paused?"resume":"pause"),children:o.paused?"Resume":"Pause"}),a("button",{type:"button",class:"fl-btn-secondary",disabled:f,onClick:()=>h("skip"),children:"Skip phase"}),a("button",{type:"button",class:"fl-btn-link",disabled:f,onClick:()=>h("quit"),children:"End cycle"})]})]})]}),g?a("p",{class:"fl-error",children:g}):null]})}function jr({payload:t,bridge:e,onSignedIn:n}){let o=t.auth,[r,i]=L("pending"),[s,l]=L(!1),[c,f]=L(t.account??null);return re(()=>{if(!o||r!=="pending")return;let d=Math.max(2e3,(o.interval||3)*1e3),g=!1,_=window.setInterval(async()=>{if(!g)try{let u=await e.callTool("flowe_auth_poll",{device_code:o.device_code});if(u.status==="authorized"){g=!0,clearInterval(_),i("authorized");let h=u.account??{authenticated:!0,is_pro:!1,plan_type:"free"};f(h),await e.updateContext(`User signed in to Flowe${h.first_name?` as ${h.first_name}`:""}. ${h.is_pro?"Quick Resets and Deep Resets are open.":"Five free Quick Resets a week are open. Deep Resets need Flowe Pro."}`),n(h)}else u.status==="expired"&&(g=!0,clearInterval(_),i("expired"))}catch{}},d);return()=>{g=!0,clearInterval(_)}},[o?.device_code,r]),r==="authorized"?a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:"glad",size:36,pro:!!c?.is_pro,label:"Signed in"}),a("div",{children:[a("div",{class:"fl-mono",children:"FLOWE CONNECTED"}),a("h2",{class:"fl-title",children:["Welcome",c?.first_name?`, ${c.first_name}`:"","."]})]})]}),c?.is_pro?a("span",{class:"fl-badge",children:"Flowe Pro"}):a("span",{class:"fl-badge fl-badge-ok",children:"Signed in"})]}),a("p",{class:"fl-body",children:c?.is_pro?"Your Flowe account is linked. Ask for a Quick Reset (5\u201315 min) or a Deep Reset (30\u201350 min) at any time.":"Your Flowe account is linked. Ask for a Quick Reset (5\u201315 min). You get five a week on the free plan."})]}):a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:a("div",{class:"fl-brand-row",children:[a(H,{state:"awake",size:34,label:"Sign in to Flowe"}),a("div",{children:[a("div",{class:"fl-mono",children:"FLOWE ACCOUNT \xB7 DEVICE SIGN-IN"}),a("h2",{class:"fl-title",children:"Sign in for live Quick & Deep Resets"})]})]})}),a("p",{class:"fl-body",children:"Connect your Flowe account to run real AI-guided Quick Resets and interactive Deep Resets synced with your Journey."}),o?a("div",{class:"fl-runner-stage",style:{alignItems:"center"},children:[a(ro,{value:o.verification_uri_complete,size:96}),a("div",{class:"fl-stack",style:{gap:"10px",flex:1},children:[a("div",{class:"fl-row",children:[a("span",{class:"fl-code-box",children:o.user_code}),a("button",{type:"button",class:"fl-btn-link",onClick:()=>{navigator.clipboard?.writeText(o.user_code),l(!0),setTimeout(()=>l(!1),1800)},children:s?"Copied":"Copy code"})]}),a("div",{class:"fl-row",children:[a("button",{type:"button",class:"fl-btn-primary",onClick:()=>e.openLink(o.verification_uri_complete),children:"Continue in browser"}),a("span",{class:"fl-mono",children:r==="expired"?"CODE EXPIRED":"WAITING FOR APPROVAL\u2026"})]})]})]}):a("p",{class:"fl-body",children:"Preparing sign-in link\u2026"})]})}function Kr({payload:t,bridge:e,onRestart:n}){let[o,r]=L(!1);async function i(){r(!0);try{let s=await e.callTool("flowe_reset",{duration_seconds:t.duration_seconds??60,protocol:t.protocol?.replace(/_\d+$/,""),trigger:"user_requested"});n({...s,view:"micro_reset",account:t.account})}finally{r(!1)}}return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:"glad",size:38,pro:!!t.account?.is_pro,label:"Reset complete"}),a("div",{children:[a("div",{class:"fl-mono",children:"RESET COMPLETE"}),a("h2",{class:"fl-title",children:"Back to it."})]})]}),a("div",{class:"fl-row",children:[typeof t.sessions_today=="number"?a("span",{class:"fl-badge fl-badge-ok",children:["Today \xB7 ",t.sessions_today]}):null,typeof t.streak_days=="number"&&t.streak_days>0?a("span",{class:"fl-badge",children:["Streak \xB7 ",t.streak_days,"d"]}):null]})]}),a("p",{class:"fl-body",children:t.protocol_display_name?`${t.duration_seconds??60}s ${t.protocol_display_name} complete.`:t.message||"Your reset is complete."}),a("div",{class:"fl-row",children:[a("button",{type:"button",class:"fl-btn-secondary",disabled:o,onClick:i,children:"Repeat"}),a("button",{type:"button",class:"fl-btn-link",onClick:()=>n({view:"focus",focus:null,account:t.account}),children:"Start focus cycle \u2192"})]})]})}function Wr({bridge:t}){let[e,n]=L(null);if(re(()=>(t.onPayload(r=>n(r)),()=>t.destroy()),[t]),!e)return a("div",{class:"fl-shell",children:a("div",{class:"fl-brand-row",children:[a(H,{state:"thinking",size:32,live:!0}),a("div",{children:[a("div",{class:"fl-mono",children:"FLOWE"}),a("p",{class:"fl-body",children:"Preparing your reset\u2026"})]})]})});let o=e.view??(e.cues?"micro_reset":e.auth?"auth":"suggest");return a("div",{class:"fl-shell",children:o==="micro_reset"?a($r,{payload:e,bridge:t,onDone:n}):o==="focus"?a(Vr,{payload:e,bridge:t,onUpdate:n}):o==="auth"?a(jr,{payload:e,bridge:t,onSignedIn:r=>n(i=>({...i,account:r}))}):o==="complete"?a(Kr,{payload:e,bridge:t,onRestart:n}):o==="snoozed"?a("div",{class:"fl-brand-row",children:[a(H,{state:"resting",size:30,pro:!!e.account?.is_pro}),a("div",{children:[a("div",{class:"fl-mono",children:["SNOOZED \xB7 ",e.snooze_minutes??25," MIN"]}),a("p",{class:"fl-body",children:"Got it \u2014 Flowe will stay quiet while you work."})]})]}):a(Hr,{payload:e,bridge:t,onTransition:n})})}var Jr=so("flowe-micro"),lo=document.getElementById("app");lo&&$t(a(Wr,{bridge:Jr}),lo);
8
+ `;return typeof o=="function"&&o(null,_),_}});var no=P(ve=>{var Rr=on(),xt=Qn(),to=Gn(),Nr=eo();function Pt(t,e,n,o,r){let i=[].slice.call(arguments,1),s=i.length,l=typeof i[s-1]=="function";if(!l&&!Rr())throw new Error("Callback required as last argument");if(l){if(s<2)throw new Error("Too few arguments provided");s===2?(r=n,n=e,e=o=void 0):s===3&&(e.getContext&&typeof r>"u"?(r=o,o=void 0):(r=o,o=n,n=e,e=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(n=e,e=o=void 0):s===2&&!e.getContext&&(o=n,n=e,e=void 0),new Promise(function(c,f){try{let d=xt.create(n,o);c(t(d,e,o))}catch(d){f(d)}})}try{let c=xt.create(n,o);r(null,t(c,e,o))}catch(c){r(c)}}ve.create=xt.create;ve.toCanvas=Pt.bind(null,to.render);ve.toDataURL=Pt.bind(null,to.renderToDataURL);ve.toString=Pt.bind(null,function(t,e,n){return Nr.render(t,n)})});var x,Rt,go,j,Ve,xe,Nt,ke,Lt,Ke,je,mo,ue=Symbol.for("pv"),Pe={},Se=[],yo=/^m(i|n|o|s|text|space)$/,We=Array.isArray,Ft=Se.slice,Z=Object.assign;function X(t){t&&t.parentNode&&t.remove()}function Ce(t,e,n,o,r){var i={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:ue,__v:r||++Rt,__i:-1,__u:0};return!r&&x.vnode&&x.vnode(i),i}function U(t){return t.children}function Ee(t,e){this.props=t,this.context=e,this.__g=0}function K(t,e){if(e==null)return t.__&&K(t.__,t.__i+1);for(var n;e<t.__k.length;e++)if((n=t.__k[e])&&n.__e)return n.__e;return typeof t.type!="function"||t.props.__P?null:K(t)}function wo(t){var e,n=t.__v,o=n.__e,r=[],i=[],s=t.__P;s&&((e=Z({constructor:ue},n)).__v=n.__v+1,x.vnode&&x.vnode(e),Je(s,e,n,t.__n,s.namespaceURI,32&n.__u?[o]:null,r,o||K(n),32&n.__u,i),e.__v=n.__v,e.__.__k[e.__i]=e,Ht(r,e,i),n.__=n.__e=null,e.__e!=o&&Dt(e))}function Dt(t){if((t=t.__)&&t.__c&&!t.props.__P)return t.__e=null,t.__k.some(function(e){return e&&(t.__e=e.__e)}),Dt(t)}function Bt(t){(8&t.__g||(t.__g|=8,j.push(t),xe++))&&Ve==x.debounceRendering||((Ve=x.debounceRendering)||queueMicrotask)(Ut)}function Ut(){try{for(var t,e=1;j.length;)j.length>e&&j.sort(Nt),t=j.shift(),e=j.length,8&t.__g&&wo(t)}finally{(xe=j.length)&&(Ve||queueMicrotask)(Ut)}}function qt(t,e,n,o,r,i,s,l,c,f,d){var g,_,u,h,C,p,v=o.__k||Se,b=e.length;for(c=vo(n,e,v,c,b),g=0;g<b;g++)(u=n.__k[g])!=null&&(_=~u.__i&&v[u.__i]||Pe,u.__i=g,p=Je(t,u,_,r,i,s,l,c,f,d),h=u.__e,(_.ref!=u.ref||8&_.__u)&&(_.ref&&Qe(_.ref,null,u,_),u.ref&&d.push(u.ref,u.__c||h,u)),C=C||h,4&u.__u?(c=Ot(u,c,t,!_.__v),_.__e&&(_.__e=null)):typeof u.type=="function"&&p!==void 0?c=p:h&&(c=h.nextSibling),u.__u&=-21);return n.__e=C,c}function vo(t,e,n,o,r){var i,s,l,c,f,d,g,_,u,h=n.length,C=h,p=0,v=0,b=t.__k=Array(r);for(i=0;i<r;i++)(s=e[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s!="object"||s.constructor===String?s=b[i]=Ce(null,s):We(s)?s=b[i]=Ce(U,{children:s}):s.constructor===ue&&s.__b?s=b[i]=Ce(s.type,s.props,s.key,s.ref,s.__v):b[i]=s,c=i+p,s.__=t,s.__b=t.__b+1,l=null,~(f=s.__i=bo(s,n,c,C))&&(C--,(l=n[f])&&(l.__u|=2)),l&&l.__v?(s.__u|=16,f==c-1?p--:f==c+1?p++:f!=c&&(f>c?p--:p++,v=1)):(~f||(r>h?p--:r<h&&p++),typeof s.type!="function"&&(s.__u|=4))):b[i]=null;if(v){for(d=[],g=[],i=0;i<r;i++)if((s=b[i])&&16&s.__u){for(p=0,_=d.length;p<_;)d[u=p+_>>1]<s.__i?p=u+1:_=u;d[p]=s.__i,g[i]=p+1}for(p=d.length;i--;)g[i]&&(g[i]==p?p--:b[i].__u|=4)}if(C)for(i=0;i<h;i++)!(l=n[i])||2&l.__u||(l.__e==o&&(o=K(l)),Ye(l,l));return o}function Ot(t,e,n,o){var r,i,s,l;if(typeof t.type=="function"){if(t.props.__P)return e;if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&(r[i].__=t,e=Ot(r[i],e,n,!1));return e}for(e&&!e.parentNode&&(e=K(t))&&!e.parentNode&&(e=null),s=t.__e,l=e;l&&l.nodeType==8;)l=l.nextSibling;for(s!=l&&(!o&&n.moveBefore&&s.parentNode?n.moveBefore(s,e):n.insertBefore(s,e||null)),e=s;(e=e&&e.nextSibling)&&e.nodeType==8&&!e.data.startsWith("$s"););return e}function bo(t,e,n,o){var r,i=t.key,s=t.type,l=e[n],c=l&&!(2&l.__u);if(l===null&&i==null||c&&i==l.key&&s==l.type)return n;if(o>(c?1:0)){for(r=n-1;r>=0;r--)if((l=e[r])&&!(2&l.__u)&&i==l.key&&s==l.type)return r;for(r=n+1;r<e.length;r++)if((l=e[r])&&!(2&l.__u)&&i==l.key&&s==l.type)return r}return-1}function It(t,e,n){n==null&&(n=""),e[0]=="-"?t.setProperty(e,n):t[e]=n}function be(t,e,n,o,r){var i,s;if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||It(t.style,e);if(n)for(e in n)o&&n[e]==o[e]||It(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")typeof n!="function"&&(n=null),typeof o!="function"&&(o=null),(t.__e||(t.__e={}))[e]=n,n&&o||(s=je[e]||(je[e]=ko(e)),(t.__a||(t.__a={}))[e]=Ke,i=e!=(e=e.replace(Lt,"$1")),(e=e.slice(2))[0]<"a"&&(e=e.toLowerCase()),n?t.addEventListener(e,s,i):t.removeEventListener(e,s,i));else{if(r=="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{return void(t[e]=n??"")}catch{}if(typeof n=="function")return;n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n)}}function ko(t){return function(e){var n=this.__e;if(n){if(n=n[t],e[ke]==null)e[ke]=Ke++;else if(e[ke]<this.__a[t])return;return n(x.event?x.event(e):e)}}}function Je(t,e,n,o,r,i,s,l,c,f){var d,g,_,u,h,C,p,v,b,m,k,w,y,E,T,$,D,F,R=e.type;if(e.constructor!==ue)return null;128&n.__u&&(c=32&n.__u,d=n.__c.__z)&&(e.__u|=c,g=i=[],d.nodeType==8?l=Me(d,i):i.push(d),l=i[0]||l),(d=x.__b)&&d(e);e:if(typeof R=="function"){_=s.length;try{if(v=e.props,b=(d=R.prototype)&&d.render,m=(d=R.contextType)&&o[d.__c],k=d?m?m.props.value:d.__:o,(u=n.__c)?(e.__c=u,2&u.__g&&(u.__g|=1)):(b?e.__c=u=new R(v,k):(e.__c=u=new Ee(v,k),u.constructor=R,u.render=Eo),m&&m.sub(u),u.state||(u.state={}),u.__n=o,u.__g|=8,u.__h=[],u.__k=[]),b&&(u.__s||(u.__s=u.state),R.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=Z({},u.__s)),Z(u.__s,R.getDerivedStateFromProps(v,u.__s)))),h=u.props,C=u.state,u.__v=e,n.__c){if(v!==h&&b&&!R.getDerivedStateFromProps&&u.componentWillReceiveProps&&u.componentWillReceiveProps(v,k),e.__v==n.__v&&!(8&u.__g)||!(4&u.__g)&&u.shouldComponentUpdate&&u.shouldComponentUpdate(v,u.__s,k)===!1){e.__v!=n.__v&&(u.props=v,u.state=u.__s,u.__g&=-9),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(N){N&&(N.__=e)}),Se.push.apply(u.__h,u.__k),u.__k=[],u.__h.length&&s.push(u),l=K(n);break e}u.componentWillUpdate&&u.componentWillUpdate(v,u.__s,k),b&&u.componentDidUpdate&&u.__h.push(function(){u.componentDidUpdate(h,C,p)})}else b&&!R.getDerivedStateFromProps&&u.componentWillMount&&u.componentWillMount(),b&&u.componentDidMount&&u.__h.push(u.componentDidMount);u.context=k,u.props=v,u.__P=t,u.__g&=-5,w=x.__r,y=b?25:0;do u.__g&=-9,w&&w(e),d=u.render(u.props,u.state=u.__s,u.context);while(8&u.__g&&++y<25);b&&(Se.push.apply(u.__h,u.__k),u.__k=[]),u.state=u.__s,u.getChildContext&&(o=Z({},o,u.getChildContext())),b&&n.__c&&u.getSnapshotBeforeUpdate&&(p=u.getSnapshotBeforeUpdate(h,C)),E=d&&d.type===U&&d.key==null?d.props.children:d,v.__P&&(d=l,r=(t=v.__P).namespaceURI,c=i=null,n.props&&n.props.__P!=t&&(n.__k.some(function(N){N&&Ye(N,N)}),n.__k=null),l=n.__k?K(n,0):null),l=qt(t,We(E)?E:[E],e,n,o,r,i,s,l,c,f),v.__P&&(e.__e=null,l=d),e.__u&=-161,g&&g.some(X),u.__h.length&&s.push(u),1&u.__g&&(u.__g&=-4)}catch(N){if(s.length=_,e.__v=null,c||i)if(N&&N.then){if(e.__u|=128|c,i){for(~(D=i.indexOf(l||void 0))||(D=i.length);(F=i[D-1])&&F.nodeType==8;)D--;for(;D<i.length;D++)if(F=i[D])if(i[D]=null,T){if(F==$)break}else{if(F.nodeType!=8)break;F.data.startsWith("$s")&&($=Me(T=F))}}if(!T){for(;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;T=l}(d=Me(T=e.__c.__z||(e.__c.__z=T)))?(e.__e=T,l=d):e.__e=l,l=l&&l.nextSibling}else i&&i.some(X);else e.__e=n.__e;e.__k||(e.__k=n.__k||[]),N&&N.then||zt(e),x.__e(N,e,n)}}else l=e.__e=Co(n.__e,e,n,o,r,i,s,c,f,t);return(d=x.diffed)&&d(e),l}function Me(t,e){if(t&&t.nodeType==8&&t.data.startsWith("$s"))for(var n=1;t=t.nextSibling;){if(t.nodeType==8){if(t.data.startsWith("$s"))n++;else if(t.data.startsWith("/$s")&&!--n)return t}e&&e.push(t)}}function zt(t){t&&(t.__c&&(t.__c.__g|=4),t.__k&&t.__k.some(zt))}function Ht(t,e,n){for(var o=0;o<n.length;)Qe(n[o++],n[o++],n[o++]);x.__c&&x.__c(e,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(i){i.call(r)})}catch(i){x.__e(i,r.__v)}})}function Co(t,e,n,o,r,i,s,l,c,f){var d,g,_,u,h,C,p,v,b=n.props||Pe,m=e.props,k=e.type;if(k=="svg"?r="http://www.w3.org/2000/svg":k=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i){for(d=0;d<i.length;d++)if((h=i[d])&&(k?h.localName==k:h.nodeType==3)){t=h,i[d]=null;break}}if(!t){if(v=f.ownerDocument||document,!k)return v.createTextNode(m);t=v.createElementNS(r,k,m.is?m:f),l&&(x.__m&&x.__m(e,i),l=!1),i=null}if(k){if(f=k=="template"&&t.content||t,i=k=="textarea"&&m.defaultValue!=null?null:i&&Ft.call(f.childNodes),!l&&i)for(b={},d=0;d<t.attributes.length;d++)b[(h=t.attributes[d]).name]=h.value;for(d in b)h=b[d],d=="dangerouslySetInnerHTML"?_=h:d=="children"||d in m||d=="value"&&"defaultValue"in m||d=="checked"&&"defaultChecked"in m||be(t,d,null,h,r);for(d in m)h=m[d],d=="children"?u=h:d=="dangerouslySetInnerHTML"?g=h:d=="value"?C=h:d=="checked"?p=h:l&&typeof h!="function"||b[d]===h||be(t,d,h,b[d],r);g?(l||_&&(g.__html==_.__html||g.__html==t.innerHTML)||(t.innerHTML=g.__html),e.__k=[]):(_&&(t.textContent=""),(k=="foreignObject"||r=="http://www.w3.org/1998/Math/MathML"&&yo.test(k))&&(r="http://www.w3.org/1999/xhtml"),qt(f,We(u)?u:[u],e,n,o,r,i,s,i?i[0]:n.__k&&K(n,0),l,c),i&&i.some(X)),l&&k!="textarea"||(d="value",k=="progress"&&C==null?t.removeAttribute(d):C==null||C===t[d]&&(k!="progress"||C)||be(t,d,C,b[d],r),d="checked",p!=null&&p!=t[d]&&be(t,d,p,b[d],r))}else b===m||l&&t.data==m||(t.data=m);return t}function Qe(t,e,n,o){try{typeof t=="function"?e?e.__x=t(e)||1:o&&(o=o.__c||o.__e)&&(e=o.__x)&&(o.__x=null,typeof e=="function"?e():t(null)):t.current=e}catch(r){x.__e(r,n)}}function Ye(t,e,n){var o,r,i,s;if(x.unmount&&x.unmount(t),!(o=t.ref)||o.current&&o.current!=t.__e||Qe(o,null,e,t),o=t.__c){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(l){x.__e(l,e)}o.__P=o.__n=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&Ye(o[s],e,typeof t.type!="function"||n&&!t.props.__P);!n&&(o=t.__c)&&(o=o.__z)&&(r=Me(o,i=[]))&&(o==t.__e&&i.some(X),X(r),X(o)),n||X(t.__e),t.__e=t.__c=t.__=null}function Eo(t,e,n){return this.constructor(t,n)}function $t(t,e){var n,o,r,i;x.__&&x.__(t,e),e.nodeType==9&&(e=e.documentElement),o=(n=t&&32&t.__u)?null:e.__k,e.__k=Ce(U,{children:[t]}),r=[],i=[],Je(e,e.__k,o||Pe,Pe,e.namespaceURI,o?null:e.firstChild?Ft.call(e.childNodes):null,r,o?o.__e:e.firstChild,n,i),Ht(r,e.__k,i),e.__k.props.children=null}x={__e:function(t,e,n,o){for(var r,i,s;e=e.__;)if((r=e.__c)&&!(1&r.__g)){r.__g|=4;try{if((s=(i=r.constructor)&&i.getDerivedStateFromError)&&r.setState(i.getDerivedStateFromError(t)),r.componentDidCatch&&(r.componentDidCatch(t,o||{}),s=1),s&&8&r.__g)return void(r.__g|=2)}catch(l){t=l}}throw xe=0,t}},Rt=0,go=function(t){return t!=null&&t.constructor===ue},Ee.prototype.setState=function(t,e){var n=this.__s;n&&n!=this.state||(n=this.__s=Z({},this.state)),typeof t=="function"&&(t=t(Z({},n),this.props)),t&&(Z(n,t),this.__v&&(e&&this.__k.push(e),Bt(this)))},Ee.prototype.forceUpdate=function(t){this.__v&&(this.__g|=4,t&&this.__h.push(t),Bt(this))},Ee.prototype.render=U,j=[],xe=0,Nt=function(t,e){return t.__v.__b-e.__v.__b},ke=Symbol(),Lt=/(PointerCapture)$|Capture$/i,Ke=0,je={},mo=0;var fe,I,Ge,Vt,Xe=Object.is,Te=0,Zt=[],Ze=[],A=x,jt=A.__b,Kt=A.__r,Wt=A.diffed,Jt=A.__c,Qt=A.unmount,Yt=A.__;function tt(t,e){A.__h&&A.__h(I,t,Te||e),Te=0;var n=I.__H||(I.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function L(t){return Te=1,Mo(tn,t)}function Mo(t,e,n){var o=tt(fe++,2);if(o.t=t,!o.__c&&(o.__=[n?n(e):tn(void 0,e),function(i){var s=(o.__N||o.__)[0],l=o.t(s,i);Xe(s,l)||(o.__N=[l,o.__[1]],o.__c.setState({}))}],o.__c=I,!I.__f)){I.__f=!0;var r=I.shouldComponentUpdate;I.shouldComponentUpdate=function(i,s,l){var c=this.__H;if(!c)return!0;var f=!1,d=this.props!=i;if(c.__.some(function(_){_.__N&&(f=!0,Xe(_.__[0],_.__N[0])||(d=!0))}),r){var g=r.call(this,i,s,l);return f?g||d:g}return!f||d}}return o.__}function re(t,e){var n=tt(fe++,3);!A.__s&&en(n.__H,e)&&(n.__P=!0,n.__=t,n.u=e,I.__H.__h.push(n))}function Ae(t){return Te=5,xo(function(){return{current:t}},[])}function xo(t,e){var n=tt(fe++,7);return en(n.__H,e)&&(n.__=t(),n.__H=e),n.__}function Po(){var t;do{for(;t=Ze.shift();)try{de(t)}catch(n){A.__e(n,{__:(t=t.__P)&&t.__v})}for(;t=Zt.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(de),e.__h.some(et),e.__h=[]}catch(n){e.__h=[],A.__e(n,t.__v)}}}while(Ze.length)}A.__b=function(t){I=null,jt&&jt(t)},A.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Yt&&Yt(t,e)},A.__r=function(t){Kt&&Kt(t),fe=0;var e=(I=t.__c).__H;e&&(Ge==I?I.__h=[]:(e.__h.some(de),e.__h.some(et),fe=0),e.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),Ge=I},A.diffed=function(t){Wt&&Wt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&Xt(Zt.push(e)),e.__H.__.some(function(n){n.u&&(n.__H=n.u)})),Ge=I=null},A.__c=function(t,e){e.some(function(n){try{n.__h.some(de),n.__h=n.__h.filter(function(o){return!o.__||et(o)})}catch(o){n.__h=[function(){throw o}]}}),Jt&&Jt(t,e)},A.unmount=function(t){Qt&&Qt(t);var e,n,o=t.__c;o&&o.__H&&(o.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=t.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}r.__P=n,Xt(Ze.push(r))}else de(r)}catch(i){e=i}}),o.__H=void 0,e&&A.__e(e,o.__v))};var Gt=typeof requestAnimationFrame=="function";function So(t){var e,n=function(){clearTimeout(o),Gt&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(n,35);Gt&&(e=requestAnimationFrame(n))}function Xt(t){t!=1&&Vt==A.requestAnimationFrame||((Vt=A.requestAnimationFrame)||So)(Po)}function de(t){var e=I,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),I=e}function et(t){var e=I;t.__c=t.__(),I=e}function en(t,e){return!t||t.length!=e.length||e.some(function(n,o){return!Xe(n,t[o])})}function tn(t,e){return typeof e=="function"?e(t):e}var To=Symbol.for("pv"),Ao=0;function a(t,e,n,o,r,i){e||(e={});var s,l,c=e;if("ref"in c&&typeof t!="function")for(l in c={},e)l=="ref"?s=e[l]:c[l]=e[l];var f={type:t,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:To,__v:--Ao,__i:-1,__u:0};return(r||i)&&(f.__source=r,f.__self=i),x.vnode&&x.vnode(f),f}var z={body:"var(--fl-peek-body, #8b7ba4)",grey:"var(--fl-peek-grey, #6b645c)",muzzle:"var(--fl-peek-muzzle, #f1eaf6)",ink:"var(--fl-peek-ink, #2b2338)",blush:"var(--fl-peek-blush, #e9a99a)",moon:"var(--fl-peek-moon, #dccfe9)"},Bo="M38.5 117 C36 104 37 90 40 78 C45 55 61 40 80 40 C99 40 115 55 120 78 C123 90 124 104 121.5 117 Z",Io="M52 58 Q60 47 72 44",Ro="M74 89 Q80 86 86 89 Q83.5 95 80 95 Q76.5 95 74 89 Z",No="M80 95 v3 M74.2 100 q2.9 2.8 5.8 0 q2.9 2.8 5.8 0",Lo=[[64,95],[62.5,101],[68.5,102.5],[96,95],[97.5,101],[91.5,102.5]],Fo="M 18 116 A 62 15 0 0 1 142 116",Do="M 142 116 A 62 15 0 0 1 30.2 124.8",Uo="M 146 131 A 76 18 0 0 1 40 142",qo="M 44 116 A 60 60 0 1 1 116 116 Z",nt=[[61,72],[99,72]],Oo={resting:7e3,listening:3600,awake:2400,thinking:3e3},ot={transformBox:"fill-box",transformOrigin:"center"},O=t=>Math.round(t*100)/100;function zo({state:t,small:e}){if(t==="awake"||t==="listening"||t==="thinking"){let[r,i]=t==="listening"?[5.4,7.2]:[5,6.6];e&&([r,i]=[r*1.35,i*1.25]);let[s,l]=t==="thinking"?[3.8,-4.8]:[0,0];return a(U,{children:nt.map(([c,f])=>a("g",{children:[a("ellipse",{cx:O(c+s),cy:O(f+l),rx:O(r),ry:O(i),style:{fill:z.ink}}),e?null:a("circle",{cx:O(c+s+r*.34),cy:O(f+l-i*.4),r:1.8,fill:"#ffffff"})]},c))})}if(t==="glad")return a(U,{children:nt.map(([r,i])=>a("path",{d:`M${O(r-6.3)} ${O(i+2.4)} q6.3 -8.6 12.6 0`,fill:"none",strokeWidth:e?6.2:4.4,strokeLinecap:"round",style:{stroke:z.ink}},r))});let[n,o]=e?[7.2,6.6]:[6.8,4.6];return a(U,{children:nt.map(([r,i])=>a("path",{d:`M${O(r-n)} ${O(i-1.4)} q${n} 6.8 ${O(2*n)} 0`,fill:"none",strokeWidth:o,strokeLinecap:"round",style:{stroke:z.ink}},r))})}function H({state:t="resting",size:e=32,live:n,pro:o=!1,label:r}){let i=e<=32,s=t==="grey"?z.grey:z.body,l=n??(t==="listening"||t==="thinking")?Oo[t]:void 0,c=l?{animationDuration:`${l}ms`}:void 0;return a("svg",{viewBox:"0 0 160 160",width:e,height:e,role:r?"img":void 0,"aria-label":r,"aria-hidden":r?void 0:!0,style:{display:"block",flexShrink:0,overflow:"visible"},children:[o?a("path",{d:qo,style:{fill:z.moon}}):null,t==="listening"?a("ellipse",{cx:80,cy:116,rx:74,ry:18,fill:"none",strokeWidth:3.5,opacity:.32,style:{stroke:s}}):null,l&&t!=="thinking"?[0,l/2].map(f=>a("ellipse",{cx:80,cy:116,rx:62,ry:15,fill:"none",strokeWidth:i?6:3.5,opacity:0,class:"peek-anim-ripple",style:{...ot,...c,animationDelay:`${f}ms`,stroke:s}},f)):null,a("path",{d:Fo,fill:"none",strokeWidth:i?7:5,strokeLinecap:"round",opacity:.5,style:{stroke:s}}),a("g",{class:l?"peek-anim-bob":void 0,style:c,children:[a("path",{d:Bo,style:{fill:s}}),i?null:a("path",{d:Io,fill:"none",stroke:"#ffffff",strokeWidth:4,strokeLinecap:"round",opacity:.3}),a("ellipse",{cx:80,cy:96,rx:25,ry:15,style:{fill:z.muzzle}}),a("path",{d:Ro,style:{fill:z.ink}}),i?null:a(U,{children:[a("path",{d:No,fill:"none",strokeWidth:2.1,strokeLinecap:"round",style:{stroke:z.ink}}),Lo.map(([f,d])=>a("circle",{cx:f,cy:d,r:1.6,opacity:.4,style:{fill:z.ink}},`${f}-${d}`))]}),a("g",{style:ot,children:[a("g",{class:!l||t==="resting"?void 0:t==="thinking"?"peek-anim-look":"peek-anim-blink",style:ot,children:a(zo,{state:t,small:i})}),t==="glad"?[54.5,105.5].map(f=>a("ellipse",{cx:f,cy:82.5,rx:6.2,ry:3.6,opacity:.85,style:{fill:z.blush}},f)):null]},t)]}),a("path",{d:Do,fill:"none",strokeWidth:i?8:6,strokeLinecap:"round",opacity:.8,style:{stroke:s}}),i?null:a("path",{d:Uo,fill:"none",strokeWidth:3,strokeLinecap:"round",opacity:.3,style:{stroke:s}})]})}function rt({size:t=132,stroke:e=3.5,fraction:n,breathScale:o,label:r,children:i}){let s=50-e/2,l=2*Math.PI*s,c=Math.min(1,Math.max(0,n));return a("div",{class:"fl-ring-wrap",style:{width:`${t}px`,height:`${t}px`},role:r?"timer":void 0,"aria-label":r,children:[typeof o=="number"?a("div",{class:"fl-breath-halo",style:{transform:`scale(${o.toFixed(3)})`},"aria-hidden":"true"}):null,a("svg",{viewBox:"0 0 100 100",width:t,height:t,"aria-hidden":"true",children:[a("circle",{cx:"50",cy:"50",r:s,fill:"none","stroke-width":e,style:{stroke:"var(--fl-track-strong)"}}),a("circle",{cx:"50",cy:"50",r:s,fill:"none","stroke-width":e,"stroke-linecap":"round","stroke-dasharray":l,"stroke-dashoffset":l*(1-c),transform:"rotate(-90 50 50)",style:{stroke:"var(--fl-accent)",transition:"stroke-dashoffset 220ms linear"}})]}),i?a("div",{class:"fl-ring-center",children:i}):null]})}var oo=ho(no(),1);function ro({value:t,size:e=96}){let n="",o=21;try{let r=oo.default.create(t,{errorCorrectionLevel:"M"});o=r.modules.size;let i=r.modules.data,s=[];for(let l=0;l<o;l++)for(let c=0;c<o;c++)i[l*o+c]&&s.push(`M${c},${l}h1v1h-1z`);n=s.join("")}catch{n=""}return a("div",{class:"fl-qr-tile","aria-label":`QR code for ${t}`,children:a("svg",{viewBox:`0 0 ${o} ${o}`,width:e,height:e,shapeRendering:"crispEdges",role:"img","aria-label":"Scan to open in Flowe",children:[a("rect",{width:o,height:o,fill:"#ffffff"}),a("path",{d:n,fill:"#1a1611"})]})})}var Lr="2026-01-26";function He(t){let e=t==="dark"||!t&&window.matchMedia?.("(prefers-color-scheme: dark)").matches;document.documentElement.dataset.theme=e?"dark":"light"}function io(t){if(t.structuredContent&&typeof t.structuredContent=="object")return t.structuredContent;let e=t.content?.find(n=>n.type==="text"&&typeof n.text=="string");if(e?.text)try{let n=JSON.parse(e.text);if(n&&typeof n=="object")return n}catch{return{message:e.text}}return null}function so(t,e){He(void 0);let n=window.matchMedia?.("(prefers-color-scheme: dark)"),o,r=()=>{o||He(void 0)};n?.addEventListener?.("change",r);let i=null,s=e??null,l=1,c=new Map,f=w=>{s=w,i?.(w)},d=typeof window<"u"&&window.parent&&window.parent!==window;function g(w){d&&window.parent.postMessage(w,"*")}function _(w,y,E=15e3){if(!d)return Promise.reject(new Error("MCP host not connected"));let T=l++;return new Promise(($,D)=>{let F=window.setTimeout(()=>{c.delete(T),D(new Error(`MCP host timeout (${w})`))},E);c.set(T,{resolve:R=>{clearTimeout(F),$(R)},reject:R=>{clearTimeout(F),D(R)}}),g({jsonrpc:"2.0",id:T,method:w,params:y})})}function u(w,y={}){g({jsonrpc:"2.0",method:w,params:y})}let h=w=>{let y=w.data;if(!(!y||typeof y!="object"||y.jsonrpc!=="2.0")){if(typeof y.id=="number"&&!y.method&&c.has(y.id)){let E=c.get(y.id);c.delete(y.id),y.error?E.reject(new Error(y.error.message||"MCP host error")):E.resolve(y.result??{});return}if(y.method==="ui/resource-teardown"&&y.id!==void 0){g({jsonrpc:"2.0",id:y.id,result:{}});return}if(y.method==="ui/notifications/host-context-changed"){let E=y.params?.theme;E&&(o=E,He(E));return}if(y.method==="ui/notifications/tool-result"&&y.params){let E=io(y.params);E&&f(E)}}};window.addEventListener("message",h);let C=null,p=0,v=0;function b(){let w=document.documentElement,y=Math.ceil(w.scrollWidth),E=Math.ceil(document.body.scrollHeight||w.scrollHeight);E>0&&(y!==p||E!==v)&&(p=y,v=E,u("ui/notifications/size-changed",{width:y,height:E}))}typeof ResizeObserver<"u"&&(C=new ResizeObserver(()=>b()),C.observe(document.body));let m=!1,k=d?_("ui/initialize",{protocolVersion:Lr,appInfo:{name:t,version:"0.3.2"},appCapabilities:{}},4e3).then(w=>{m=!0;let y=w.hostContext;y?.theme&&(o=y.theme,He(y.theme)),u("ui/notifications/initialized",{}),b()}).catch(()=>{}):Promise.resolve();return{callTool:async(w,y={})=>{if(await k,!m)throw new Error("MCP host not connected");let E=await _("tools/call",{name:w,arguments:y}),T=io(E);if(E.isError){let $=T?.message||(E.content?.[0]?.text??"Tool call failed");throw new Error($)}return T??{}},openLink:async w=>{if(await k,m)try{await _("ui/open-link",{url:w},4e3);return}catch{}window.open(w,"_blank","noopener,noreferrer")},updateContext:async w=>{if(await k,!!m)try{await _("ui/update-model-context",{content:[{type:"text",text:w}]},4e3)}catch{}},onPayload:w=>{i=w,s&&w(s)},destroy:()=>{window.removeEventListener("message",h),n?.removeEventListener?.("change",r),C?.disconnect()}}}var G=null;function St(t){try{let e=window.AudioContext||window.webkitAudioContext;if(!e)return;G||(G=new e),G.state==="suspended"&&G.resume();let n=G.currentTime,o=G.createOscillator(),r=G.createGain(),i=t==="inhale"?396:t==="exhale"?288:t==="done"?528:352;o.type="sine",o.frequency.setValueAtTime(i,n),r.gain.setValueAtTime(1e-4,n),r.gain.exponentialRampToValueAtTime(.06,n+.08),r.gain.exponentialRampToValueAtTime(1e-4,n+(t==="done"?1.1:.55)),o.connect(r),r.connect(G.destination),o.start(n),o.stop(n+(t==="done"?1.15:.6))}catch{}}var $e=[{label:"30s Sigh",duration:30,protocol:"physiological_sigh"},{label:"60s Box Breath",duration:60,protocol:"box_breath"},{label:"60s Palming",duration:60,protocol:"palming"},{label:"45s Neck",duration:45,protocol:"neck_rotation"}],Fr=[{id:"deploy_anxiety",label:"Calm Down \xB7 5m",mins:5},{id:"quick_reset",label:"Reset \xB7 10m",mins:10},{id:"logic_lock",label:"Unstuck \xB7 10m",mins:10},{id:"context_switch",label:"Clear \xB7 8m",mins:8}],Dr=[{id:"pomodoro",label:"Pomodoro",sub:"25 / 5"},{id:"dev",label:"Dev block",sub:"50 / 10"},{id:"ultradian",label:"Ultradian",sub:"90 / 15"}],Ur=[{id:"rain_window_soft",label:"Soft rain"},{id:"nature_spring_birds",label:"Spring birds"},{id:"tones_deep_brown_noise",label:"Brown noise"},{id:"interiors_quiet_cafe",label:"Quiet cafe"},{id:"none",label:"Silence"}];function qr(t){let e=t.toLowerCase().trim();if(e.includes("double inhale"))return"Double inhale through the nose";if(e.includes("inhale"))return"Inhale slowly";if(e.includes("long exhale"))return"Long, unhurried exhale";if(e.includes("exhale"))return"Exhale gently";if(e.includes("hold"))return"Hold softly";let n=e.replace(/^\d+\s+/,"");return n.charAt(0).toUpperCase()+n.slice(1)}function Tt(t){let e=Math.max(0,Math.ceil(t)),n=Math.floor(e/60),o=e%60;return`${n}:${String(o).padStart(2,"0")}`}function Or(t,e){if(!e.length||t<e[0].start_ms)return null;for(let n=0;n<e.length;n++)if(t<e[n].end_ms)return e[n];return e[e.length-1]}function zr(t){if(!t?.phase)return .94;switch(t.phase){case"inhale":return 1.12;case"hold_in":return 1.14;case"exhale":return .86;case"hold_out":return .84}}function Hr({payload:t,bridge:e,onTransition:n}){let o=$e.find(p=>p.protocol===t.recommended_protocol&&p.duration===t.recommended_duration)??$e.find(p=>p.duration===t.recommended_duration)??$e[0],[r,i]=L(o),[s,l]=L(!1),[c,f]=L(null),d=!!t.account?.is_pro,g=!!t.account?.authenticated;async function _(){l(!0),f(null);try{let p=await e.callTool("flowe_reset",{duration_seconds:r.duration,protocol:r.protocol,trigger:"harness_suggested"});n({...p,view:"micro_reset",account:t.account})}catch(p){f(p.message)}finally{l(!1)}}async function u(p){l(!0),f(null);try{let v=await e.callTool("flowe_quick_reset",{session_type:p});v.view==="auth"&&v.auth?n(v):v.message&&n({...v,view:"complete",account:t.account})}catch(v){f(v.message)}finally{l(!1)}}async function h(p){l(!0);try{await e.callTool("flowe_reset_control",{action:"snooze",snooze_minutes:p}),await e.updateContext(`User snoozed Flowe reset suggestions for ${p} minutes.`),n({view:"snoozed",snooze_minutes:p,account:t.account})}catch(v){f(v.message)}finally{l(!1)}}async function C(){l(!0),f(null);try{let p=await e.callTool("flowe_auth",{});n(p)}catch(p){f(p.message)}finally{l(!1)}}return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:"awake",size:32,pro:d,label:"Flowe"}),a("div",{children:[a("div",{class:"fl-mono",children:t.eyebrow||(t.session_minutes?`LONG SESSION \xB7 ${t.session_minutes} MIN`:"MOMENT TO RESET")}),a("h2",{class:"fl-title",children:t.headline||"Take a quick breath before the next step"})]})]}),d?a("span",{class:"fl-badge",children:"Flowe Pro"}):null]}),t.reason?a("p",{class:"fl-body",children:t.reason}):null,a("div",{class:"fl-stack",style:{gap:"8px"},children:[a("div",{class:"fl-mono",children:"INSTANT MICRO-RESET \xB7 NO ACCOUNT"}),a("div",{class:"fl-row",children:$e.map(p=>a("button",{type:"button",class:"fl-chip","data-selected":r.protocol===p.protocol&&r.duration===p.duration,onClick:()=>i(p),children:p.label},`${p.protocol}-${p.duration}`))})]}),a("div",{class:"fl-row",style:{justifyContent:"space-between"},children:[a("div",{class:"fl-row",children:[a("button",{type:"button",class:"fl-btn-primary",disabled:s,onClick:_,children:s?"Starting\u2026":`Start ${r.label}`}),a("button",{type:"button",class:"fl-btn-link",disabled:s,onClick:()=>h(25),children:"Snooze 25m"})]}),g?null:a("button",{type:"button",class:"fl-btn-link",disabled:s,onClick:C,children:"Sign in for live resets \u2192"})]}),g?a(U,{children:[a("div",{class:"fl-divider"}),a("div",{class:"fl-stack",style:{gap:"8px"},children:[a("div",{class:"fl-header",children:[a("span",{class:"fl-mono",children:"LIVE QUICK RESET \xB7 GUIDED VOICE"}),t.account?.quick_reset_quota&&t.account.quick_reset_quota.cap>0?a("span",{class:"fl-mono",children:[Math.max(0,t.account.quick_reset_quota.cap-t.account.quick_reset_quota.used)," ","free left this week"]}):null]}),a("div",{class:"fl-row",children:Fr.map(p=>a("button",{type:"button",class:"fl-chip",disabled:s,onClick:()=>u(p.id),children:p.label},p.id))})]})]}):null,c?a("p",{class:"fl-error",children:c}):null]})}function $r({payload:t,bridge:e,onDone:n}){let o=t.duration_seconds??60,r=o*1e3,i=Ae(t.started_at_unix?t.started_at_unix*1e3:Date.now()),[s,l]=L(()=>Math.max(0,Date.now()-i.current)),[c,f]=L(t.audio_mode==="chime"),[d,g]=L(!1),_=Ae(-1),u=Ae(!1),h=t.cues??[];re(()=>{let y=0,E=0,T=()=>{let D=Date.now(),F=Math.min(r,Math.max(0,D-i.current));if(l(F),c&&h.length>0){let R=h.findIndex(N=>F>=N.start_ms&&F<N.end_ms);if(R>=0&&R!==_.current){_.current=R;let N=h[R].phase;St(N==="inhale"?"inhale":N==="exhale"?"exhale":"hold")}}if(F>=r&&!u.current){u.current=!0,c&&St("done"),C();return}document.hidden?E=window.setTimeout(T,500):y=window.requestAnimationFrame(T)},$=()=>{document.hidden||T()};return document.addEventListener("visibilitychange",$),T(),()=>{document.removeEventListener("visibilitychange",$),cancelAnimationFrame(y),clearTimeout(E)}},[r,c]);async function C(){let y={};try{y=await e.callTool("flowe_reset_control",{action:"complete",session_id:t.session_id})}catch{}await e.updateContext(`User completed their ${o}s ${t.protocol_display_name??"reset"}.`),n({...t,...y,view:"complete"})}async function p(){g(!0),u.current=!0;try{await e.callTool("flowe_reset_control",{action:"stop",session_id:t.session_id})}catch{}n({view:"suggest",eyebrow:"RESET PAUSED",headline:"Whenever you want another moment",account:t.account})}let v=Math.max(0,(r-s)/1e3),b=r>0?s/r:1,m=Or(s,h),k=m?qr(m.label):"Settle in and listen",w=t.rounds&&t.rounds>0?Math.min(t.rounds,Math.floor(s/r*t.rounds)+1):null;return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:"resting",size:32,live:!0,pro:!!t.account?.is_pro,label:"Flowe resting"}),a("div",{children:[a("div",{class:"fl-mono",children:["MICRO-RESET \xB7 ",o,"S \xB7 ",(t.voice??"ellie").toUpperCase()]}),a("h2",{class:"fl-title",children:t.protocol_display_name||"Guided Reset"})]})]}),w?a("span",{class:"fl-badge",children:["Round ",w," / ",t.rounds]}):null]}),a("div",{class:"fl-runner-stage",children:[a(rt,{size:128,stroke:3.5,fraction:b,breathScale:zr(m),label:`${Math.ceil(v)} seconds remaining`,children:[a("span",{class:"fl-ring-time",children:Tt(v)}),a("span",{class:"fl-mono",style:{letterSpacing:"0.14em"},children:m?.phase?m.phase.replace("_"," "):"left"})]}),a("div",{class:"fl-stack",style:{gap:"8px",flex:1},children:[a("p",{class:"fl-cue-label","aria-live":"polite",children:k}),a("p",{class:"fl-body",children:"Stay right here while your agent works. Eyes soft, shoulders loose."}),a("div",{class:"fl-row",style:{marginTop:"4px"},children:[a("button",{type:"button",class:"fl-btn-secondary",disabled:d,onClick:p,children:d?"Stopping\u2026":"Stop"}),a("button",{type:"button",class:"fl-chip","data-selected":c,onClick:()=>f(y=>!y),children:c?"Chime on":"Soft chime"})]})]})]})]})}function Vr({payload:t,bridge:e,onUpdate:n}){let[o,r]=L(t.focus??null),[i,s]=L("pomodoro"),[l,c]=L("rain_window_soft"),[f,d]=L(!1),[g,_]=L(null);re(()=>{r(t.focus??null)},[t.focus]),re(()=>{if(!o||o.paused||o.status==="CYCLE_DONE")return;let m=window.setInterval(()=>{document.hidden||r(w=>w&&!w.paused?{...w,remainingSec:Math.max(0,w.remainingSec-1)}:w)},1e3),k=window.setInterval(async()=>{if(!document.hidden)try{let w=await e.callTool("flowe_focus_control",{action:"status"});r(w.focus??null)}catch{}},1e4);return()=>{clearInterval(m),clearInterval(k)}},[o?.status,o?.paused]);async function u(){d(!0),_(null);try{let m=await e.callTool("flowe_focus",{action:"start",preset:i,ambient:l});r(m.focus??null),n({...t,focus:m.focus??null})}catch(m){_(m.message)}finally{d(!1)}}async function h(m){d(!0),_(null);try{let k=await e.callTool("flowe_focus_control",{action:m});r(k.focus??null)}catch(k){_(k.message)}finally{d(!1)}}let C=!!t.account?.is_pro;if(!o)return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:a("div",{class:"fl-brand-row",children:[a(H,{state:"resting",size:32,pro:C,label:"Flowe focus"}),a("div",{children:[a("div",{class:"fl-mono",children:"FOCUS ROOM \xB7 DETACHED CYCLE"}),a("h2",{class:"fl-title",children:"Set a work and break rhythm"})]})]})}),a("div",{class:"fl-stack",style:{gap:"8px"},children:[a("div",{class:"fl-mono",children:"CADENCE"}),a("div",{class:"fl-row",children:Dr.map(m=>a("button",{type:"button",class:"fl-chip","data-selected":i===m.id,onClick:()=>s(m.id),children:[m.label," \xB7 ",m.sub]},m.id))})]}),a("div",{class:"fl-stack",style:{gap:"8px"},children:[a("div",{class:"fl-mono",children:"AMBIENCE"}),a("div",{class:"fl-row",children:Ur.map(m=>a("button",{type:"button",class:"fl-chip","data-selected":l===m.id,onClick:()=>c(m.id),children:m.label},m.id))})]}),a("div",{class:"fl-row",children:a("button",{type:"button",class:"fl-btn-primary",disabled:f,onClick:u,children:f?"Starting\u2026":`Start ${i} focus`})}),g?a("p",{class:"fl-error",children:g}):null]});let p=o.status==="FOCUS_BLOCK"?o.preset==="ultradian"?5400:o.preset==="dev"?3e3:1500:600,v=Math.max(0,Math.min(1,1-o.remainingSec/Math.max(1,p))),b=o.status==="BREAK"||o.status==="LONG_BREAK";return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:o.paused?"grey":b?"awake":"resting",size:32,live:!o.paused,pro:C}),a("div",{children:[a("div",{class:"fl-mono",children:[o.preset.toUpperCase()," \xB7 BLOCK ",o.blockIndex," OF ",o.blocks]}),a("h2",{class:"fl-title",children:o.paused?"Focus paused":b?"Break window":"Deep focus block"})]})]}),o.ambient?a("span",{class:"fl-badge",children:o.ambient.replace(/_/g," ")}):null]}),a("div",{class:"fl-runner-stage",children:[a(rt,{size:116,stroke:3.5,fraction:v,label:`${Tt(o.remainingSec)} left`,children:[a("span",{class:"fl-ring-time",children:Tt(o.remainingSec)}),a("span",{class:"fl-mono",children:o.paused?"paused":b?"break":"focus"})]}),a("div",{class:"fl-stack",style:{gap:"10px",flex:1},children:[a("div",{class:"fl-pips","aria-label":`Block ${o.blockIndex} of ${o.blocks}`,children:Array.from({length:o.blocks}).map((m,k)=>a("span",{class:"fl-pip","data-state":k+1<o.blockIndex?"done":k+1===o.blockIndex?"active":"todo"},k))}),a("div",{class:"fl-row",children:[a("button",{type:"button",class:"fl-btn-primary",disabled:f,onClick:()=>h(o.paused?"resume":"pause"),children:o.paused?"Resume":"Pause"}),a("button",{type:"button",class:"fl-btn-secondary",disabled:f,onClick:()=>h("skip"),children:"Skip phase"}),a("button",{type:"button",class:"fl-btn-link",disabled:f,onClick:()=>h("quit"),children:"End cycle"})]})]})]}),g?a("p",{class:"fl-error",children:g}):null]})}function jr({payload:t,bridge:e,onSignedIn:n}){let o=t.auth,[r,i]=L("pending"),[s,l]=L(!1),[c,f]=L(t.account??null);return re(()=>{if(!o||r!=="pending")return;let d=Math.max(2e3,(o.interval||3)*1e3),g=!1,_=window.setInterval(async()=>{if(!g)try{let u=await e.callTool("flowe_auth_poll",{device_code:o.device_code});if(u.status==="authorized"){g=!0,clearInterval(_),i("authorized");let h=u.account??{authenticated:!0,is_pro:!1,plan_type:"free"};f(h),await e.updateContext(`User signed in to Flowe${h.first_name?` as ${h.first_name}`:""}. ${h.is_pro?"Quick Resets and Deep Resets are open.":"Five free Quick Resets a week are open. Deep Resets need Flowe Pro."}`),n(h)}else u.status==="expired"&&(g=!0,clearInterval(_),i("expired"))}catch{}},d);return()=>{g=!0,clearInterval(_)}},[o?.device_code,r]),r==="authorized"?a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:"glad",size:36,pro:!!c?.is_pro,label:"Signed in"}),a("div",{children:[a("div",{class:"fl-mono",children:"FLOWE CONNECTED"}),a("h2",{class:"fl-title",children:["Welcome",c?.first_name?`, ${c.first_name}`:"","."]})]})]}),c?.is_pro?a("span",{class:"fl-badge",children:"Flowe Pro"}):a("span",{class:"fl-badge fl-badge-ok",children:"Signed in"})]}),a("p",{class:"fl-body",children:c?.is_pro?"Your Flowe account is linked. Ask for a Quick Reset (5\u201315 min) or a Deep Reset (30\u201350 min) at any time.":"Your Flowe account is linked. Ask for a Quick Reset (5\u201315 min). You get five a week on the free plan."})]}):a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:a("div",{class:"fl-brand-row",children:[a(H,{state:"awake",size:34,label:"Sign in to Flowe"}),a("div",{children:[a("div",{class:"fl-mono",children:"FLOWE ACCOUNT \xB7 DEVICE SIGN-IN"}),a("h2",{class:"fl-title",children:"Sign in for live Quick & Deep Resets"})]})]})}),a("p",{class:"fl-body",children:"Connect your Flowe account to run real AI-guided Quick Resets and interactive Deep Resets synced with your Journey."}),o?a("div",{class:"fl-runner-stage",style:{alignItems:"center"},children:[a(ro,{value:o.verification_uri_complete,size:96}),a("div",{class:"fl-stack",style:{gap:"10px",flex:1},children:[a("div",{class:"fl-row",children:[a("span",{class:"fl-code-box",children:o.user_code}),a("button",{type:"button",class:"fl-btn-link",onClick:()=>{navigator.clipboard?.writeText(o.user_code),l(!0),setTimeout(()=>l(!1),1800)},children:s?"Copied":"Copy code"})]}),a("div",{class:"fl-row",children:[a("button",{type:"button",class:"fl-btn-primary",onClick:()=>e.openLink(o.verification_uri_complete),children:"Continue in browser"}),a("span",{class:"fl-mono",children:r==="expired"?"CODE EXPIRED":"WAITING FOR APPROVAL\u2026"})]})]})]}):a("p",{class:"fl-body",children:"Preparing sign-in link\u2026"})]})}function Kr({payload:t,bridge:e,onRestart:n}){let[o,r]=L(!1);async function i(){r(!0);try{let s=await e.callTool("flowe_reset",{duration_seconds:t.duration_seconds??60,protocol:t.protocol?.replace(/_\d+$/,""),trigger:"user_requested"});n({...s,view:"micro_reset",account:t.account})}finally{r(!1)}}return a("div",{class:"fl-stack",children:[a("div",{class:"fl-header",children:[a("div",{class:"fl-brand-row",children:[a(H,{state:"glad",size:38,pro:!!t.account?.is_pro,label:"Reset complete"}),a("div",{children:[a("div",{class:"fl-mono",children:"RESET COMPLETE"}),a("h2",{class:"fl-title",children:"Back to it."})]})]}),a("div",{class:"fl-row",children:[typeof t.sessions_today=="number"?a("span",{class:"fl-badge fl-badge-ok",children:["Today \xB7 ",t.sessions_today]}):null,typeof t.streak_days=="number"&&t.streak_days>0?a("span",{class:"fl-badge",children:["Streak \xB7 ",t.streak_days,"d"]}):null]})]}),a("p",{class:"fl-body",children:t.protocol_display_name?`${t.duration_seconds??60}s ${t.protocol_display_name} complete.`:t.message||"Your reset is complete."}),a("div",{class:"fl-row",children:[a("button",{type:"button",class:"fl-btn-secondary",disabled:o,onClick:i,children:"Repeat"}),a("button",{type:"button",class:"fl-btn-link",onClick:()=>n({view:"focus",focus:null,account:t.account}),children:"Start focus cycle \u2192"})]})]})}function Wr({bridge:t}){let[e,n]=L(null);if(re(()=>(t.onPayload(r=>n(r)),()=>t.destroy()),[t]),!e)return a("div",{class:"fl-shell",children:a("div",{class:"fl-brand-row",children:[a(H,{state:"thinking",size:32,live:!0}),a("div",{children:[a("div",{class:"fl-mono",children:"FLOWE"}),a("p",{class:"fl-body",children:"Preparing your reset\u2026"})]})]})});let o=e.view??(e.cues?"micro_reset":e.auth?"auth":"suggest");return a("div",{class:"fl-shell",children:o==="micro_reset"?a($r,{payload:e,bridge:t,onDone:n}):o==="focus"?a(Vr,{payload:e,bridge:t,onUpdate:n}):o==="auth"?a(jr,{payload:e,bridge:t,onSignedIn:r=>n(i=>({...i,account:r}))}):o==="complete"?a(Kr,{payload:e,bridge:t,onRestart:n}):o==="snoozed"?a("div",{class:"fl-brand-row",children:[a(H,{state:"resting",size:30,pro:!!e.account?.is_pro}),a("div",{children:[a("div",{class:"fl-mono",children:["SNOOZED \xB7 ",e.snooze_minutes??25," MIN"]}),a("p",{class:"fl-body",children:"Got it \u2014 Flowe will stay quiet while you work."})]})]}):a(Hr,{payload:e,bridge:t,onTransition:n})})}var Jr=so("flowe-micro"),lo=document.getElementById("app");lo&&$t(a(Wr,{bridge:Jr}),lo);
9
9
  </script></body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowe-ai/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Neural resets, live AI-guided Quick & Deep Resets, and MCP Apps for AI coding workspaces.",
5
5
  "license": "MIT",
6
6
  "author": "flowe.ai",
@@ -1 +0,0 @@
1
- import{readFileSync as x,writeFileSync as A,mkdirSync as E,existsSync as h}from"fs";import{homedir as T,platform as P}from"os";import{join as d}from"path";import{nanoid as D}from"nanoid";var v="https://www.flowe.ai",O=90,b=["sage","ada","ellie"];function V(t){return typeof t=="string"&&b.includes(t)?t:"ellie"}function S(){let t=T();return P()==="win32"?d(t,"AppData","Roaming","flowe"):d(t,".config","flowe")}function k(){return d(S(),"config.json")}function w(){return{version:2,voice:"ellie",anonymous_id:`anon_${D(12)}`,telemetry:"on",backend_url:process.env.FLOWE_BACKEND_URL||v,session_dates:[]}}function N(t){let e=typeof t.version=="number"?t.version:1,n=t.voice,r=V(n),o={version:2,voice:r,anonymous_id:t.anonymous_id??`anon_${D(12)}`,telemetry:t.telemetry??"on",backend_url:t.backend_url??v,session_dates:Array.isArray(t.session_dates)?t.session_dates:[]};return typeof t.first_reset_at=="string"&&(o.first_reset_at=t.first_reset_at),typeof t.user_first_name=="string"&&(o.user_first_name=t.user_first_name),(e<2||n!==r)&&s(o),o}function i(){let t=k();if(!h(t)){let e=w();return s(e),e}try{let e=x(t,"utf-8"),n=JSON.parse(e),r=N(n);return process.env.FLOWE_BACKEND_URL&&(r.backend_url=process.env.FLOWE_BACKEND_URL),r}catch{let e=w();return s(e),e}}function s(t){let e=S();h(e)||E(e,{recursive:!0}),A(k(),JSON.stringify(t,null,2),"utf-8")}function Q(t){let e=i();e.voice=t,s(e)}function X(){let t=i();t.first_reset_at||(t.first_reset_at=new Date().toISOString(),s(t))}function Z(t){let e=i();t&&t.trim().length>0?e.user_first_name=t.trim():delete e.user_first_name,s(e)}function u(t=new Date){let e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${r}`}function R(t,e){let n=new Date(e);n.setDate(n.getDate()-O);let r=u(n);return t.filter(o=>o>=r)}function tt(t=new Date){let e=i(),n=u(t),r=R([...e.session_dates,n],t);e.session_dates=r,s(e)}function et(t=new Date){let e=i(),n=u(t);return e.session_dates.filter(r=>r===n).length}function nt(t=new Date){let e=i(),n=new Set(e.session_dates),r=new Date(t);r.setHours(0,0,0,0);let o=new Date(r);n.has(u(o))||o.setDate(o.getDate()-1);let _=0;for(;n.has(u(o));)_+=1,o.setDate(o.getDate()-1);return _}function rt(){return i().session_dates.length}import{execFileSync as g}from"child_process";import{existsSync as m,mkdirSync as K,readFileSync as L,rmSync as U,writeFileSync as I}from"fs";import{homedir as $,platform as l}from"os";import{join as f}from"path";var c="flowe-cli",a="clerk-token";function p(){let t=$(),e=l()==="win32"?f(t,"AppData","Roaming","flowe"):f(t,".config","flowe");return f(e,".token")}function j(){if(l()!=="darwin")return null;try{let t=g("security",["find-generic-password","-s",c,"-a",a,"-w"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();return t.length>0?t:null}catch{return null}}function B(t){if(l()!=="darwin")return!1;try{return g("security",["add-generic-password","-U","-s",c,"-a",a,"-w",t],{stdio:"ignore"}),!0}catch{return!1}}function M(){if(l()!=="darwin")return!1;try{return g("security",["delete-generic-password","-s",c,"-a",a],{stdio:"ignore"}),!0}catch{return!1}}function W(){try{let t=p();if(!m(t))return null;let e=L(t,"utf-8").trim();return e.length>0?e:null}catch{return null}}function H(t){let e=p(),n=f(e,"..");m(n)||K(n,{recursive:!0}),I(e,t,{encoding:"utf-8",mode:384})}function J(){try{let t=p();m(t)&&U(t,{force:!0})}catch{}}async function y(){try{let e=(await import("keytar")).default;return e&&typeof e.getPassword=="function"?e:null}catch{return null}}async function ft(){let t=process.env.FLOWE_AUTH_TOKEN?.trim();if(t)return t;let e=await y();if(e)try{let n=await e.getPassword(c,a);return n||null}catch{return null}return j()??W()}async function lt(t){let e=await y();if(e)try{await e.setPassword(c,a,t);return}catch{}B(t)||H(t)}async function dt(){let t=await y();if(t)try{await t.deletePassword(c,a)}catch{}M(),J()}export{i as a,Q as b,X as c,Z as d,tt as e,et as f,nt as g,rt as h,ft as i,lt as j,dt as k};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-3HG2U5YK.js";import"./chunk-EC5WRPZP.js";export{a as fetchMe,b as refreshUserFirstName};