@flowe-ai/cli 0.2.1 → 0.3.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.
@@ -0,0 +1,9 @@
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><title>Flowe</title><style>:root{--fl-sans:'Flowe Sans',-apple-system,BlinkMacSystemFont,'SF Pro Text','Segoe UI',Roboto,sans-serif;--fl-mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--fl-bg:#fff4e8;--fl-card:rgba(255,252,247,0.78);--fl-card-solid:#fffaf2;--fl-card-edge:rgba(43,38,34,0.11);--fl-well:rgba(43,38,34,0.055);--fl-sel:rgba(110,97,137,0.14);--fl-fg:#1a1611;--fl-body:#4f4842;--fl-label:#6b645c;--fl-line:rgba(43,38,34,0.11);--fl-track:rgba(43,38,34,0.1);--fl-track-strong:rgba(43,38,34,0.13);--fl-chip:rgba(255,255,255,0.62);--fl-chip-edge:rgba(43,38,34,0.12);--fl-accent:#6e6189;--fl-accent-deep:#5a4e75;--fl-on-accent:#ffffff;--fl-accent-ink:#6e6189;--fl-accent-soft:rgba(110,97,137,0.12);--fl-accent-edge:rgba(110,97,137,0.34);--fl-accent-shadow:rgba(110,97,137,0.2);--fl-ok-soft:rgba(95,138,121,0.15);--fl-ok-ink:#3f6b5a;--fl-sage:#5f8a79;--fl-sand-soft:rgba(196,149,106,0.18);--fl-sand-ink:#7a4f24;--fl-danger:#a3361f;--fl-peek-body:#8b7ba4;--fl-peek-muzzle:#f1eaf6;--fl-peek-ink:#2b2338;--fl-peek-blush:#e9a99a;--fl-peek-grey:#6b645c;--fl-peek-moon:#dccfe9;--fl-atmos:radial-gradient(62% 52% at 92% 0%,rgba(139,123,164,0.22) 0%,rgba(139,123,164,0) 70%),radial-gradient(56% 48% at 0% 100%,rgba(196,149,106,0.16) 0%,rgba(196,149,106,0) 70%);--fl-grain-opacity:0.11;--fl-grain-blend:multiply;}:root[data-theme='dark']{--fl-bg:#15120f;--fl-card:rgba(36,30,25,0.72);--fl-card-solid:#1e1813;--fl-card-edge:rgba(255,244,232,0.11);--fl-well:rgba(255,244,232,0.075);--fl-sel:rgba(185,163,204,0.2);--fl-fg:#fff5e3;--fl-body:#d4c8ba;--fl-label:#bfb2a3;--fl-line:rgba(255,244,232,0.11);--fl-track:rgba(255,244,232,0.08);--fl-track-strong:rgba(255,244,232,0.14);--fl-chip:rgba(255,244,232,0.06);--fl-chip-edge:rgba(255,244,232,0.12);--fl-accent:#b9a3cc;--fl-accent-deep:#d3c3e2;--fl-on-accent:#15120f;--fl-accent-ink:#c3b0d6;--fl-accent-soft:rgba(185,163,204,0.16);--fl-accent-edge:rgba(185,163,204,0.36);--fl-accent-shadow:rgba(0,0,0,0.32);--fl-ok-soft:rgba(143,181,165,0.16);--fl-ok-ink:#a8cbbb;--fl-sage:#8fb5a5;--fl-sand-soft:rgba(215,166,118,0.16);--fl-sand-ink:#e8c39b;--fl-danger:#f0a58c;--fl-peek-body:#b9a3cc;--fl-peek-muzzle:#f1eaf6;--fl-peek-ink:#2b2338;--fl-peek-blush:#e7a493;--fl-peek-grey:#bfb2a3;--fl-peek-moon:#4d4263;--fl-atmos:radial-gradient(62% 52% at 92% 0%,rgba(185,163,204,0.16) 0%,rgba(185,163,204,0) 70%),radial-gradient(56% 48% at 0% 100%,rgba(196,149,106,0.12) 0%,rgba(196,149,106,0) 70%);--fl-grain-opacity:0.15;--fl-grain-blend:overlay;}*,*::before,*::after{box-sizing:border-box;}html,body{margin:0;padding:0;background:transparent;color:var(--fl-fg);font-family:var(--fl-sans);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;}.fl-shell{position:relative;isolation:isolate;overflow:hidden;border-radius:22px;background-color:var(--fl-bg);background-image:var(--fl-atmos);border:1px solid var(--fl-card-edge);padding:18px 20px;color:var(--fl-fg);animation:fl-enter 0.36s cubic-bezier(0.2,0.7,0.2,1) both;}.fl-shell::after{content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none;z-index:2;opacity:var(--fl-grain-opacity);mix-blend-mode:var(--fl-grain-blend);background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");}.fl-shell>*{position:relative;z-index:1;}@keyframes fl-enter{from{transform:translateY(8px) scale(0.992);}to{transform:none;}}.fl-mono{font-family:var(--fl-mono);font-size:10.5px;font-weight:500;letter-spacing:0.18em;text-transform:uppercase;color:var(--fl-label);}.fl-title{margin:0;font-size:18px;font-weight:600;letter-spacing:-0.02em;line-height:1.25;color:var(--fl-fg);}.fl-body{margin:0;font-size:14px;line-height:1.5;color:var(--fl-body);}.fl-tabular{font-variant-numeric:tabular-nums;}.fl-header{display:flex;align-items:center;justify-content:space-between;gap:12px;}.fl-brand-row{display:flex;align-items:center;gap:10px;min-width:0;}.fl-row{display:flex;align-items:center;flex-wrap:wrap;gap:8px;}.fl-stack{display:flex;flex-direction:column;gap:14px;}.fl-divider{height:1px;background:var(--fl-line);margin:2px 0;}.fl-btn-primary{appearance:none;border:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px;padding:0 20px;border-radius:999px;background:var(--fl-accent);color:var(--fl-on-accent);font-family:var(--fl-sans);font-size:14px;font-weight:600;box-shadow:0 8px 20px var(--fl-accent-shadow);transition:opacity 150ms ease,transform 150ms ease;}.fl-btn-primary:hover:not(:disabled){opacity:0.92;}.fl-btn-primary:active:not(:disabled){transform:scale(0.985);}.fl-btn-primary:disabled{opacity:0.5;cursor:not-allowed;}.fl-btn-secondary{appearance:none;border:1px solid var(--fl-chip-edge);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:0 14px;border-radius:999px;background:var(--fl-well);color:var(--fl-fg);font-family:var(--fl-sans);font-size:13px;font-weight:500;transition:background 150ms ease;}.fl-btn-secondary:hover:not(:disabled){background:var(--fl-sel);}.fl-btn-link{appearance:none;border:0;background:transparent;cursor:pointer;display:inline-flex;align-items:center;gap:5px;min-height:34px;padding:0 6px;border-radius:8px;color:var(--fl-label);font-family:var(--fl-sans);font-size:13px;font-weight:500;transition:color 140ms ease;}.fl-btn-link:hover{color:var(--fl-fg);}.fl-chip{appearance:none;cursor:pointer;display:inline-flex;align-items:center;gap:6px;min-height:32px;padding:0 12px;border-radius:999px;border:1px solid var(--fl-chip-edge);background:var(--fl-chip);color:var(--fl-body);font-family:var(--fl-sans);font-size:12.5px;font-weight:500;transition:background 140ms ease,border-color 140ms ease,color 140ms ease;}.fl-chip:hover{border-color:var(--fl-accent-edge);color:var(--fl-fg);}.fl-chip[data-selected='true']{background:var(--fl-accent-soft);border-color:var(--fl-accent-edge);color:var(--fl-accent-ink);font-weight:600;}.fl-badge{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;border-radius:999px;background:var(--fl-accent-soft);color:var(--fl-accent-ink);font-family:var(--fl-mono);font-size:10px;font-weight:600;letter-spacing:0.12em;text-transform:uppercase;}.fl-badge-ok{background:var(--fl-ok-soft);color:var(--fl-ok-ink);}.fl-badge-sand{background:var(--fl-sand-soft);color:var(--fl-sand-ink);}.fl-btn-primary:focus-visible,.fl-btn-secondary:focus-visible,.fl-btn-link:focus-visible,.fl-chip:focus-visible{outline:2px solid var(--fl-accent);outline-offset:2px;}.fl-runner-stage{display:flex;align-items:center;gap:20px;padding:4px 0;}@media (max-width:420px){.fl-runner-stage{flex-direction:column;text-align:center;}}.fl-ring-wrap{position:relative;flex-shrink:0;display:grid;place-items:center;}.fl-ring-center{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;}.fl-ring-time{font-size:26px;font-weight:600;letter-spacing:-0.02em;line-height:1;font-variant-numeric:tabular-nums;color:var(--fl-fg);}.fl-cue-label{font-size:20px;font-weight:600;letter-spacing:-0.02em;color:var(--fl-fg);margin:0;}.fl-breath-halo{position:absolute;inset:14px;border-radius:50%;background:radial-gradient(circle,var(--fl-accent-soft) 0%,transparent 72%);pointer-events:none;transition:transform 900ms cubic-bezier(0.35,0,0.25,1);}.fl-pips{display:flex;align-items:center;gap:6px;}.fl-pip{height:5px;width:22px;border-radius:999px;background:var(--fl-track-strong);transition:background 240ms ease;}.fl-pip[data-state='done']{background:var(--fl-accent);opacity:0.55;}.fl-pip[data-state='active']{background:var(--fl-accent);}.fl-code-box{display:inline-flex;align-items:center;gap:10px;padding:8px 14px;border-radius:12px;background:var(--fl-card-solid);border:1px solid var(--fl-line);font-family:var(--fl-mono);font-size:16px;font-weight:600;letter-spacing:0.16em;color:var(--fl-fg);}.fl-qr-tile{width:112px;height:112px;padding:8px;border-radius:14px;background:#ffffff;border:1px solid var(--fl-line);flex-shrink:0;display:grid;place-items:center;}.fl-panel{border-radius:14px;background:var(--fl-card);border:1px solid var(--fl-line);padding:12px 14px;}.fl-error{font-size:13px;color:var(--fl-danger);margin:0;}@keyframes peek-face{from{opacity:0;transform:scaleY(0.3);}to{opacity:1;transform:none;}}@keyframes peek-bob{0%,100%{transform:translateY(0);}50%{transform:translateY(-2.5px);}}@keyframes peek-ripple{0%{opacity:0;transform:scale(0.94);}18%{opacity:0.42;}100%{opacity:0;transform:scale(1.3);}}@keyframes peek-blink{0%,93%,100%{transform:scaleY(1);}96.5%{transform:scaleY(0.08);}}@keyframes peek-look{0%,100%{transform:translateX(-2px);}50%{transform:translateX(2.5px);}}.peek-anim-bob{animation:peek-bob 3.6s ease-in-out infinite;}.peek-anim-ripple{animation:peek-ripple 3.6s ease-out infinite;}.peek-anim-blink{animation:peek-blink 5.2s linear infinite;}.peek-anim-look{animation:peek-look 3s ease-in-out infinite;}.peek-anim-face{animation:peek-face 320ms cubic-bezier(0.22,1,0.36,1) both;}@media (prefers-reduced-motion:reduce){.fl-shell,.peek-anim-bob,.peek-anim-ripple,.peek-anim-blink,.peek-anim-look,.peek-anim-face{animation:none !important;}.fl-breath-halo{transition:none !important;}}@media (prefers-reduced-transparency:reduce){.fl-shell::after{display:none;}.fl-shell{background-image:none;}}</style></head><body><div id="app"></div><script type="module">var ao=Object.create;var At=Object.defineProperty;var co=Object.getOwnPropertyDescriptor;var uo=Object.getOwnPropertyNames;var fo=Object.getPrototypeOf,_o=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}};var ho=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of uo(e))!_o.call(t,r)&&r!==n&&At(t,r,{get:()=>e[r],enumerable:!(o=co(e,r))||o.enumerable});return t};var po=(t,e,n)=>(n=t!=null?ao(fo(t)):{},ho(e||!t||!t.__esModule?At(n,"default",{value:t,enumerable:!0}):n,t));var on=P((si,nn)=>{nn.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var W=P(ee=>{var it,Ho=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];ee.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};ee.getSymbolTotalCodewords=function(e){return Ho[e]};ee.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};ee.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');it=e};ee.isKanjiModeEnabled=function(){return typeof it<"u"};ee.toSJIS=function(e){return it(e)}});var Be=P(q=>{q.L={bit:1};q.M={bit:0};q.Q={bit:3};q.H={bit:2};function $o(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return q.L;case"m":case"medium":return q.M;case"q":case"quartile":return q.Q;case"h":case"high":return q.H;default:throw new Error("Unknown EC Level: "+t)}}q.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};q.from=function(e,n){if(q.isValid(e))return e;try{return $o(e)}catch{return n}}});var ln=P((ci,sn)=>{function rn(){this.buffer=[],this.length=0}rn.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let n=0;n<e;n++)this.putBit((t>>>e-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};sn.exports=rn});var cn=P((ui,an)=>{function _e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}_e.prototype.set=function(t,e,n,o){let r=t*this.size+e;this.data[r]=n,o&&(this.reservedBit[r]=!0)};_e.prototype.get=function(t,e){return this.data[t*this.size+e]};_e.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n};_e.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};an.exports=_e});var un=P(Ie=>{var Vo=W().getSymbolSize;Ie.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,o=Vo(e),r=o===145?26:Math.ceil((o-13)/(2*n-2))*2,i=[o-7];for(let s=1;s<n-1;s++)i[s]=i[s-1]-r;return i.push(6),i.reverse()};Ie.getPositions=function(e){let n=[],o=Ie.getRowColCoords(e),r=o.length;for(let i=0;i<r;i++)for(let s=0;s<r;s++)i===0&&s===0||i===0&&s===r-1||i===r-1&&s===0||n.push([o[i],o[s]]);return n}});var _n=P(fn=>{var jo=W().getSymbolSize,dn=7;fn.getPositions=function(e){let n=jo(e);return[[0,0],[n-dn,0],[0,n-dn]]}});var hn=P(S=>{S.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var te={N1:3,N2:3,N3:40,N4:10};S.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};S.from=function(e){return S.isValid(e)?parseInt(e,10):void 0};S.getPenaltyN1=function(e){let n=e.size,o=0,r=0,i=0,s=null,l=null;for(let c=0;c<n;c++){r=i=0,s=l=null;for(let f=0;f<n;f++){let d=e.get(c,f);d===s?r++:(r>=5&&(o+=te.N1+(r-5)),s=d,r=1),d=e.get(f,c),d===l?i++:(i>=5&&(o+=te.N1+(i-5)),l=d,i=1)}r>=5&&(o+=te.N1+(r-5)),i>=5&&(o+=te.N1+(i-5))}return o};S.getPenaltyN2=function(e){let n=e.size,o=0;for(let r=0;r<n-1;r++)for(let i=0;i<n-1;i++){let s=e.get(r,i)+e.get(r,i+1)+e.get(r+1,i)+e.get(r+1,i+1);(s===4||s===0)&&o++}return o*te.N2};S.getPenaltyN3=function(e){let n=e.size,o=0,r=0,i=0;for(let s=0;s<n;s++){r=i=0;for(let l=0;l<n;l++)r=r<<1&2047|e.get(s,l),l>=10&&(r===1488||r===93)&&o++,i=i<<1&2047|e.get(l,s),l>=10&&(i===1488||i===93)&&o++}return o*te.N3};S.getPenaltyN4=function(e){let n=0,o=e.data.length;for(let i=0;i<o;i++)n+=e.data[i];return Math.abs(Math.ceil(n*100/o/5)-10)*te.N4};function Ko(t,e,n){switch(t){case S.Patterns.PATTERN000:return(e+n)%2===0;case S.Patterns.PATTERN001:return e%2===0;case S.Patterns.PATTERN010:return n%3===0;case S.Patterns.PATTERN011:return(e+n)%3===0;case S.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(n/3))%2===0;case S.Patterns.PATTERN101:return e*n%2+e*n%3===0;case S.Patterns.PATTERN110:return(e*n%2+e*n%3)%2===0;case S.Patterns.PATTERN111:return(e*n%3+(e+n)%2)%2===0;default:throw new Error("bad maskPattern:"+t)}}S.applyMask=function(e,n){let o=n.size;for(let r=0;r<o;r++)for(let i=0;i<o;i++)n.isReserved(i,r)||n.xor(i,r,Ko(e,i,r))};S.getBestMask=function(e,n){let o=Object.keys(S.Patterns).length,r=0,i=1/0;for(let s=0;s<o;s++){n(s),S.applyMask(s,e);let l=S.getPenaltyN1(e)+S.getPenaltyN2(e)+S.getPenaltyN3(e)+S.getPenaltyN4(e);S.applyMask(s,e),l<i&&(i=l,r=s)}return r}});var lt=P(st=>{var J=Be(),Re=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ne=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];st.getBlocksCount=function(e,n){switch(n){case J.L:return Re[(e-1)*4+0];case J.M:return Re[(e-1)*4+1];case J.Q:return Re[(e-1)*4+2];case J.H:return Re[(e-1)*4+3];default:return}};st.getTotalCodewordsCount=function(e,n){switch(n){case J.L:return Ne[(e-1)*4+0];case J.M:return Ne[(e-1)*4+1];case J.Q:return Ne[(e-1)*4+2];case J.H:return Ne[(e-1)*4+3];default:return}}});var pn=P(Fe=>{var he=new Uint8Array(512),Le=new Uint8Array(256);(function(){let e=1;for(let n=0;n<255;n++)he[n]=e,Le[e]=n,e<<=1,e&256&&(e^=285);for(let n=255;n<512;n++)he[n]=he[n-255]})();Fe.log=function(e){if(e<1)throw new Error("log("+e+")");return Le[e]};Fe.exp=function(e){return he[e]};Fe.mul=function(e,n){return e===0||n===0?0:he[Le[e]+Le[n]]}});var gn=P(pe=>{var at=pn();pe.mul=function(e,n){let o=new Uint8Array(e.length+n.length-1);for(let r=0;r<e.length;r++)for(let i=0;i<n.length;i++)o[r+i]^=at.mul(e[r],n[i]);return o};pe.mod=function(e,n){let o=new Uint8Array(e);for(;o.length-n.length>=0;){let r=o[0];for(let s=0;s<n.length;s++)o[s]^=at.mul(n[s],r);let i=0;for(;i<o.length&&o[i]===0;)i++;o=o.slice(i)}return o};pe.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let o=0;o<e;o++)n=pe.mul(n,new Uint8Array([1,at.exp(o)]));return n}});var wn=P((mi,yn)=>{var mn=gn();function ct(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}ct.prototype.initialize=function(e){this.degree=e,this.genPoly=mn.generateECPolynomial(this.degree)};ct.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let n=new Uint8Array(e.length+this.degree);n.set(e);let o=mn.mod(n,this.genPoly),r=this.degree-o.length;if(r>0){let i=new Uint8Array(this.degree);return i.set(o,r),i}return o};yn.exports=ct});var ut=P(vn=>{vn.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var dt=P(V=>{var bn="[0-9]+",Wo="[A-Z $%*+\\-./:]+",ge="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ge=ge.replace(/u/g,"\\u");var Jo="(?:(?![A-Z0-9 $%*+\\-./:]|"+ge+`)(?:.|[\r
2
+ ]))+`;V.KANJI=new RegExp(ge,"g");V.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");V.BYTE=new RegExp(Jo,"g");V.NUMERIC=new RegExp(bn,"g");V.ALPHANUMERIC=new RegExp(Wo,"g");var Qo=new RegExp("^"+ge+"$"),Go=new RegExp("^"+bn+"$"),Yo=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");V.testKanji=function(e){return Qo.test(e)};V.testNumeric=function(e){return Go.test(e)};V.testAlphanumeric=function(e){return Yo.test(e)}});var Q=P(B=>{var Xo=ut(),ft=dt();B.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};B.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};B.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};B.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};B.MIXED={bit:-1};B.getCharCountIndicator=function(e,n){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Xo.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]};B.getBestModeForData=function(e){return ft.testNumeric(e)?B.NUMERIC:ft.testAlphanumeric(e)?B.ALPHANUMERIC:ft.testKanji(e)?B.KANJI:B.BYTE};B.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};B.isValid=function(e){return e&&e.bit&&e.ccBits};function Zo(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return B.NUMERIC;case"alphanumeric":return B.ALPHANUMERIC;case"kanji":return B.KANJI;case"byte":return B.BYTE;default:throw new Error("Unknown mode: "+t)}}B.from=function(e,n){if(B.isValid(e))return e;try{return Zo(e)}catch{return n}}});var xn=P(ne=>{var De=W(),er=lt(),kn=Be(),G=Q(),_t=ut(),En=7973,Cn=De.getBCHDigit(En);function tr(t,e,n){for(let o=1;o<=40;o++)if(e<=ne.getCapacity(o,n,t))return o}function Mn(t,e){return G.getCharCountIndicator(t,e)+4}function nr(t,e){let n=0;return t.forEach(function(o){let r=Mn(o.mode,e);n+=r+o.getBitsLength()}),n}function or(t,e){for(let n=1;n<=40;n++)if(nr(t,n)<=ne.getCapacity(n,e,G.MIXED))return n}ne.from=function(e,n){return _t.isValid(e)?parseInt(e,10):n};ne.getCapacity=function(e,n,o){if(!_t.isValid(e))throw new Error("Invalid QR Code version");typeof o>"u"&&(o=G.BYTE);let r=De.getSymbolTotalCodewords(e),i=er.getTotalCodewordsCount(e,n),s=(r-i)*8;if(o===G.MIXED)return s;let l=s-Mn(o,e);switch(o){case G.NUMERIC:return Math.floor(l/10*3);case G.ALPHANUMERIC:return Math.floor(l/11*2);case G.KANJI:return Math.floor(l/13);case G.BYTE:default:return Math.floor(l/8)}};ne.getBestVersionForData=function(e,n){let o,r=kn.from(n,kn.M);if(Array.isArray(e)){if(e.length>1)return or(e,r);if(e.length===0)return 1;o=e[0]}else o=e;return tr(o.mode,o.getLength(),r)};ne.getEncodedBits=function(e){if(!_t.isValid(e)||e<7)throw new Error("Invalid QR Code version");let n=e<<12;for(;De.getBCHDigit(n)-Cn>=0;)n^=En<<De.getBCHDigit(n)-Cn;return e<<12|n}});var An=P(Tn=>{var ht=W(),Sn=1335,rr=21522,Pn=ht.getBCHDigit(Sn);Tn.getEncodedBits=function(e,n){let o=e.bit<<3|n,r=o<<10;for(;ht.getBCHDigit(r)-Pn>=0;)r^=Sn<<ht.getBCHDigit(r)-Pn;return(o<<10|r)^rr}});var In=P((Ci,Bn)=>{var ir=Q();function ie(t){this.mode=ir.NUMERIC,this.data=t.toString()}ie.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};ie.prototype.getLength=function(){return this.data.length};ie.prototype.getBitsLength=function(){return ie.getBitsLength(this.data.length)};ie.prototype.write=function(e){let n,o,r;for(n=0;n+3<=this.data.length;n+=3)o=this.data.substr(n,3),r=parseInt(o,10),e.put(r,10);let i=this.data.length-n;i>0&&(o=this.data.substr(n),r=parseInt(o,10),e.put(r,i*3+1))};Bn.exports=ie});var Nn=P((Ei,Rn)=>{var sr=Q(),pt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function se(t){this.mode=sr.ALPHANUMERIC,this.data=t}se.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};se.prototype.getLength=function(){return this.data.length};se.prototype.getBitsLength=function(){return se.getBitsLength(this.data.length)};se.prototype.write=function(e){let n;for(n=0;n+2<=this.data.length;n+=2){let o=pt.indexOf(this.data[n])*45;o+=pt.indexOf(this.data[n+1]),e.put(o,11)}this.data.length%2&&e.put(pt.indexOf(this.data[n]),6)};Rn.exports=se});var Fn=P((Mi,Ln)=>{var lr=Q();function le(t){this.mode=lr.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}le.getBitsLength=function(e){return e*8};le.prototype.getLength=function(){return this.data.length};le.prototype.getBitsLength=function(){return le.getBitsLength(this.data.length)};le.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)};Ln.exports=le});var Un=P((xi,Dn)=>{var ar=Q(),cr=W();function ae(t){this.mode=ar.KANJI,this.data=t}ae.getBitsLength=function(e){return e*13};ae.prototype.getLength=function(){return this.data.length};ae.prototype.getBitsLength=function(){return ae.getBitsLength(this.data.length)};ae.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=cr.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
3
+ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),t.put(n,13)}};Dn.exports=ae});var qn=P((Pi,gt)=>{"use strict";var me={single_source_shortest_paths:function(t,e,n){var o={},r={};r[e]=0;var i=me.PriorityQueue.make();i.push(e,0);for(var s,l,c,f,d,g,_,u,p;!i.empty();){s=i.pop(),l=s.value,f=s.cost,d=t[l]||{};for(c in d)d.hasOwnProperty(c)&&(g=d[c],_=f+g,u=r[c],p=typeof r[c]>"u",(p||u>_)&&(r[c]=_,i.push(c,_),o[c]=l))}if(typeof n<"u"&&typeof r[n]>"u"){var C=["Could not find a path from ",e," to ",n,"."].join("");throw new Error(C)}return o},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],o=e,r;o;)n.push(o),r=t[o],o=t[o];return n.reverse(),n},find_path:function(t,e,n){var o=me.single_source_shortest_paths(t,e,n);return me.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var e=me.PriorityQueue,n={},o;t=t||{};for(o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);return n.queue=[],n.sorter=t.sorter||e.default_sorter,n},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof gt<"u"&&(gt.exports=me)});var Wn=P(ce=>{var M=Q(),Hn=In(),$n=Nn(),Vn=Fn(),jn=Un(),ye=dt(),Ue=W(),ur=qn();function On(t){return unescape(encodeURIComponent(t)).length}function we(t,e,n){let o=[],r;for(;(r=t.exec(n))!==null;)o.push({data:r[0],index:r.index,mode:e,length:r[0].length});return o}function Kn(t){let e=we(ye.NUMERIC,M.NUMERIC,t),n=we(ye.ALPHANUMERIC,M.ALPHANUMERIC,t),o,r;return Ue.isKanjiModeEnabled()?(o=we(ye.BYTE,M.BYTE,t),r=we(ye.KANJI,M.KANJI,t)):(o=we(ye.BYTE_KANJI,M.BYTE,t),r=[]),e.concat(n,o,r).sort(function(s,l){return s.index-l.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function mt(t,e){switch(e){case M.NUMERIC:return Hn.getBitsLength(t);case M.ALPHANUMERIC:return $n.getBitsLength(t);case M.KANJI:return jn.getBitsLength(t);case M.BYTE:return Vn.getBitsLength(t)}}function dr(t){return t.reduce(function(e,n){let o=e.length-1>=0?e[e.length-1]:null;return o&&o.mode===n.mode?(e[e.length-1].data+=n.data,e):(e.push(n),e)},[])}function fr(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n];switch(o.mode){case M.NUMERIC:e.push([o,{data:o.data,mode:M.ALPHANUMERIC,length:o.length},{data:o.data,mode:M.BYTE,length:o.length}]);break;case M.ALPHANUMERIC:e.push([o,{data:o.data,mode:M.BYTE,length:o.length}]);break;case M.KANJI:e.push([o,{data:o.data,mode:M.BYTE,length:On(o.data)}]);break;case M.BYTE:e.push([{data:o.data,mode:M.BYTE,length:On(o.data)}])}}return e}function _r(t,e){let n={},o={start:{}},r=["start"];for(let i=0;i<t.length;i++){let s=t[i],l=[];for(let c=0;c<s.length;c++){let f=s[c],d=""+i+c;l.push(d),n[d]={node:f,lastCount:0},o[d]={};for(let g=0;g<r.length;g++){let _=r[g];n[_]&&n[_].node.mode===f.mode?(o[_][d]=mt(n[_].lastCount+f.length,f.mode)-mt(n[_].lastCount,f.mode),n[_].lastCount+=f.length):(n[_]&&(n[_].lastCount=f.length),o[_][d]=mt(f.length,f.mode)+4+M.getCharCountIndicator(f.mode,e))}}r=l}for(let i=0;i<r.length;i++)o[r[i]].end=0;return{map:o,table:n}}function zn(t,e){let n,o=M.getBestModeForData(t);if(n=M.from(e,o),n!==M.BYTE&&n.bit<o.bit)throw new Error('"'+t+'" cannot be encoded with mode '+M.toString(n)+`.
4
+ Suggested mode is: `+M.toString(o));switch(n===M.KANJI&&!Ue.isKanjiModeEnabled()&&(n=M.BYTE),n){case M.NUMERIC:return new Hn(t);case M.ALPHANUMERIC:return new $n(t);case M.KANJI:return new jn(t);case M.BYTE:return new Vn(t)}}ce.fromArray=function(e){return e.reduce(function(n,o){return typeof o=="string"?n.push(zn(o,null)):o.data&&n.push(zn(o.data,o.mode)),n},[])};ce.fromString=function(e,n){let o=Kn(e,Ue.isKanjiModeEnabled()),r=fr(o),i=_r(r,n),s=ur.find_path(i.map,"start","end"),l=[];for(let c=1;c<s.length-1;c++)l.push(i.table[s[c]].node);return ce.fromArray(dr(l))};ce.rawSplit=function(e){return ce.fromArray(Kn(e,Ue.isKanjiModeEnabled()))}});var Qn=P(Jn=>{var Oe=W(),yt=Be(),hr=ln(),pr=cn(),gr=un(),mr=_n(),bt=hn(),kt=lt(),yr=wn(),qe=xn(),wr=An(),vr=Q(),wt=Wn();function br(t,e){let n=t.size,o=mr.getPositions(e);for(let r=0;r<o.length;r++){let i=o[r][0],s=o[r][1];for(let l=-1;l<=7;l++)if(!(i+l<=-1||n<=i+l))for(let c=-1;c<=7;c++)s+c<=-1||n<=s+c||(l>=0&&l<=6&&(c===0||c===6)||c>=0&&c<=6&&(l===0||l===6)||l>=2&&l<=4&&c>=2&&c<=4?t.set(i+l,s+c,!0,!0):t.set(i+l,s+c,!1,!0))}}function kr(t){let e=t.size;for(let n=8;n<e-8;n++){let o=n%2===0;t.set(n,6,o,!0),t.set(6,n,o,!0)}}function Cr(t,e){let n=gr.getPositions(e);for(let o=0;o<n.length;o++){let r=n[o][0],i=n[o][1];for(let s=-2;s<=2;s++)for(let l=-2;l<=2;l++)s===-2||s===2||l===-2||l===2||s===0&&l===0?t.set(r+s,i+l,!0,!0):t.set(r+s,i+l,!1,!0)}}function Er(t,e){let n=t.size,o=qe.getEncodedBits(e),r,i,s;for(let l=0;l<18;l++)r=Math.floor(l/3),i=l%3+n-8-3,s=(o>>l&1)===1,t.set(r,i,s,!0),t.set(i,r,s,!0)}function vt(t,e,n){let o=t.size,r=wr.getEncodedBits(e,n),i,s;for(i=0;i<15;i++)s=(r>>i&1)===1,i<6?t.set(i,8,s,!0):i<8?t.set(i+1,8,s,!0):t.set(o-15+i,8,s,!0),i<8?t.set(8,o-i-1,s,!0):i<9?t.set(8,15-i-1+1,s,!0):t.set(8,15-i-1,s,!0);t.set(o-8,8,1,!0)}function Mr(t,e){let n=t.size,o=-1,r=n-1,i=7,s=0;for(let l=n-1;l>0;l-=2)for(l===6&&l--;;){for(let c=0;c<2;c++)if(!t.isReserved(r,l-c)){let f=!1;s<e.length&&(f=(e[s]>>>i&1)===1),t.set(r,l-c,f),i--,i===-1&&(s++,i=7)}if(r+=o,r<0||n<=r){r-=o,o=-o;break}}}function xr(t,e,n){let o=new hr;n.forEach(function(c){o.put(c.mode.bit,4),o.put(c.getLength(),vr.getCharCountIndicator(c.mode,t)),c.write(o)});let r=Oe.getSymbolTotalCodewords(t),i=kt.getTotalCodewordsCount(t,e),s=(r-i)*8;for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!==0;)o.putBit(0);let l=(s-o.getLengthInBits())/8;for(let c=0;c<l;c++)o.put(c%2?17:236,8);return Pr(o,t,e)}function Pr(t,e,n){let o=Oe.getSymbolTotalCodewords(e),r=kt.getTotalCodewordsCount(e,n),i=o-r,s=kt.getBlocksCount(e,n),l=o%s,c=s-l,f=Math.floor(o/s),d=Math.floor(i/s),g=d+1,_=f-d,u=new yr(_),p=0,C=new Array(s),h=new Array(s),v=0,b=new Uint8Array(t.buffer);for(let E=0;E<s;E++){let T=E<c?d:g;C[E]=b.slice(p,p+T),h[E]=u.encode(C[E]),p+=T,v=Math.max(v,T)}let m=new Uint8Array(o),k=0,w,y;for(w=0;w<v;w++)for(y=0;y<s;y++)w<C[y].length&&(m[k++]=C[y][w]);for(w=0;w<_;w++)for(y=0;y<s;y++)m[k++]=h[y][w];return m}function Sr(t,e,n,o){let r;if(Array.isArray(t))r=wt.fromArray(t);else if(typeof t=="string"){let f=e;if(!f){let d=wt.rawSplit(t);f=qe.getBestVersionForData(d,n)}r=wt.fromString(t,f||40)}else throw new Error("Invalid data");let i=qe.getBestVersionForData(r,n);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=i;else if(e<i)throw new Error(`
5
+ The chosen QR Code version cannot contain this amount of data.
6
+ Minimum version required to store current data is: `+i+`.
7
+ `);let s=xr(e,n,r),l=Oe.getSymbolSize(e),c=new pr(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 Gn(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:Gn(e.color.dark||"#000000ff"),light:Gn(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 p=Math.floor((d-c)/s),C=Math.floor((g-c)/s);u=f[i[p*r+C]?1:0]}e[_++]=u.r,e[_++]=u.g,e[_++]=u.b,e[_]=u.a}}});var Yn=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=Yn(),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,p,C,h,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,h=Je(t,u,_,r,i,s,l,c,f,d),p=u.__e,(_.ref!=u.ref||8&_.__u)&&(_.ref&&Qe(_.ref,null,u,_),u.ref&&d.push(u.ref,u.__c||p,u)),C=C||p,4&u.__u?(c=Ot(u,c,t,!_.__v),_.__e&&(_.__e=null)):typeof u.type=="function"&&h!==void 0?c=h:p&&(c=p.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,p=n.length,C=p,h=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+h,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?h--:f==c+1?h++:f!=c&&(f>c?h--:h++,v=1)):(~f||(r>p?h--:r<p&&h++),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(h=0,_=d.length;h<_;)d[u=h+_>>1]<s.__i?h=u+1:_=u;d[h]=s.__i,g[i]=h+1}for(h=d.length;i--;)g[i]&&(g[i]==h?h--:b[i].__u|=4)}if(C)for(i=0;i<p;i++)!(l=n[i])||2&l.__u||(l.__e==o&&(o=K(l)),Ge(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,p,C,h,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)))),p=u.props,C=u.state,u.__v=e,n.__c){if(v!==p&&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(p,C,h)})}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&&(h=u.getSnapshotBeforeUpdate(p,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&&Ge(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,p,C,h,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((p=i[d])&&(k?p.localName==k:p.nodeType==3)){t=p,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[(p=t.attributes[d]).name]=p.value;for(d in b)p=b[d],d=="dangerouslySetInnerHTML"?_=p:d=="children"||d in m||d=="value"&&"defaultValue"in m||d=="checked"&&"defaultChecked"in m||be(t,d,null,p,r);for(d in m)p=m[d],d=="children"?u=p:d=="dangerouslySetInnerHTML"?g=p:d=="value"?C=p:d=="checked"?h=p:l&&typeof p!="function"||b[d]===p||be(t,d,p,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",h!=null&&h!=t[d]&&be(t,d,h,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 Ge(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]&&Ge(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,Ye,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,Gt=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),Gt&&Gt(t,e)},A.__r=function(t){Kt&&Kt(t),fe=0;var e=(I=t.__c).__H;e&&(Ye==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})),Ye=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)})),Ye=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 Yt=typeof requestAnimationFrame=="function";function So(t){var e,n=function(){clearTimeout(o),Yt&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(n,35);Yt&&(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=po(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 p=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",p);let C=null,h=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!==h||E!==v)&&(h=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.0"},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",p),n?.removeEventListener?.("change",r),C?.disconnect()}}}var Y=null;function St(t){try{let e=window.AudioContext||window.webkitAudioContext;if(!e)return;Y||(Y=new e),Y.state==="suspended"&&Y.resume();let n=Y.currentTime,o=Y.createOscillator(),r=Y.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(Y.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(h=>h.protocol===t.recommended_protocol&&h.duration===t.recommended_duration)??$e.find(h=>h.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 h=await e.callTool("flowe_reset",{duration_seconds:r.duration,protocol:r.protocol,trigger:"harness_suggested"});n({...h,view:"micro_reset",account:t.account})}catch(h){f(h.message)}finally{l(!1)}}async function u(h){l(!0),f(null);try{let v=await e.callTool("flowe_quick_reset",{session_type:h});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 p(h){l(!0);try{await e.callTool("flowe_reset_control",{action:"snooze",snooze_minutes:h}),await e.updateContext(`User snoozed Flowe reset suggestions for ${h} minutes.`),n({view:"snoozed",snooze_minutes:h,account:t.account})}catch(v){f(v.message)}finally{l(!1)}}async function C(){l(!0),f(null);try{let h=await e.callTool("flowe_auth",{});n(h)}catch(h){f(h.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 OFFLINE"}),a("div",{class:"fl-row",children:$e.map(h=>a("button",{type:"button",class:"fl-chip","data-selected":r.protocol===h.protocol&&r.duration===h.duration,onClick:()=>i(h),children:h.label},`${h.protocol}-${h.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:()=>p(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(h=>a("button",{type:"button",class:"fl-chip",disabled:s,onClick:()=>u(h.id),children:h.label},h.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),p=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&&p.length>0){let R=p.findIndex(N=>F>=N.start_ms&&F<N.end_ms);if(R>=0&&R!==_.current){_.current=R;let N=p[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 h(){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,p),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:h,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 p(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 h=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,h))),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:()=>p(o.paused?"resume":"pause"),children:o.paused?"Resume":"Pause"}),a("button",{type:"button",class:"fl-btn-secondary",disabled:f,onClick:()=>p("skip"),children:"Skip phase"}),a("button",{type:"button",class:"fl-btn-link",disabled:f,onClick:()=>p("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 p=u.account??{authenticated:!0,is_pro:!1,plan_type:"free"};f(p),await e.updateContext(`User signed in to Flowe${p.first_name?` as ${p.first_name}`:""}. Live Quick and Deep Resets are now unlocked.`),n(p)}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:"Your Flowe account is linked. Ask for any Quick Reset (5\u201315 min) or Deep Reset (15\u201325 min) whenever you need real guided voice recovery."})]}):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
+ </script></body></html>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flowe-ai/cli",
3
- "version": "0.2.1",
4
- "description": "Neural resets for engineers using AI coding assistants.",
3
+ "version": "0.3.0",
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",
7
7
  "homepage": "https://cli.flowe.ai",
@@ -32,7 +32,8 @@
32
32
  "files": [
33
33
  "bin/",
34
34
  "dist/",
35
- "audio/",
35
+ "audio/*.mp3",
36
+ "audio/*.cues.json",
36
37
  "assets/",
37
38
  "scripts/preinstall.js",
38
39
  "skills/",
@@ -47,30 +48,39 @@
47
48
  },
48
49
  "scripts": {
49
50
  "preinstall": "node scripts/preinstall.js",
50
- "build": "tsup",
51
+ "build": "tsup && pnpm build:ui",
52
+ "build:ui": "node scripts/build-ui.mjs",
51
53
  "dev": "tsx src/cli.ts",
52
54
  "flowe": "tsx src/cli.ts",
53
55
  "mcp": "tsx src/mcp-server.ts",
54
56
  "test": "vitest run",
57
+ "test:e2e": "node scripts/e2e-mcp-apps.mjs",
55
58
  "test:watch": "vitest",
56
- "type-check": "tsc --noEmit",
59
+ "type-check": "tsc --noEmit && tsc -p ui/tsconfig.json --noEmit",
57
60
  "generate-audio": "tsx scripts/generate-audio.ts",
58
61
  "generate-ambient": "tsx scripts/generate-elevenlabs-ambient.ts"
59
62
  },
60
63
  "dependencies": {
61
- "@modelcontextprotocol/sdk": "^1.0.0",
64
+ "@modelcontextprotocol/ext-apps": "^2.0.4",
65
+ "@modelcontextprotocol/sdk": "^1.32.2",
62
66
  "cac": "^6.7.14",
63
- "keytar": "^7.9.0",
64
67
  "nanoid": "^5.1.6",
65
68
  "node-notifier": "^10.0.1",
66
69
  "qrcode-terminal": "^0.12.0",
67
- "sound-play": "^1.1.0",
68
70
  "zod": "^3.23.8"
69
71
  },
72
+ "optionalDependencies": {
73
+ "keytar": "^7.9.0"
74
+ },
70
75
  "devDependencies": {
71
76
  "@types/node": "^22.19.3",
72
77
  "@types/node-notifier": "^8.0.5",
78
+ "@types/qrcode": "^1.5.6",
73
79
  "@types/qrcode-terminal": "^0.12.2",
80
+ "esbuild": "^0.28.2",
81
+ "livekit-client": "^2.26.2",
82
+ "preact": "^11.2.0",
83
+ "qrcode": "^1.5.4",
74
84
  "tsup": "^8.3.5",
75
85
  "tsx": "^4.19.2",
76
86
  "typescript": "^5.9.3",
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { fileURLToPath, pathToFileURL } from 'node:url';
6
6
 
7
- const SUPPORTED_PLATFORMS = new Set(['darwin']);
7
+ const SUPPORTED_PLATFORMS = new Set(['darwin', 'linux', 'win32']);
8
8
  const MIN_NODE_MAJOR = 20;
9
9
 
10
10
  const LINUX_ISSUE_URL = 'https://github.com/flowe-ai/flowe-cli/issues/1';
@@ -1,149 +1,86 @@
1
1
  ---
2
2
  name: flowe
3
- description: Run breath-led neural resets and offer focus cycles with flowe-cli. Auto-trigger short resets during long agent thinking pauses to protect the user's focus and working memory. At the start of a workday or substantial task, ask whether the user wants a Pomodoro/dev/ultradian focus session with ambience, then start it detached if they opt in.
3
+ description: Protect the user's attention during long AI coding sessions with Flowe resets and focus cycles. Prefer MCP tools (flowe_check_state, flowe_suggest_reset, flowe_reset, flowe_quick_reset, flowe_deep_reset, flowe_focus, flowe_auth) so supporting harnesses render interactive Dusk + Peek Flowe components inline; fall back to the flowe CLI when MCP is unavailable.
4
4
  ---
5
5
 
6
6
  # flowe
7
7
 
8
- You have access to the `flowe` CLI for two kinds of attention support:
8
+ Flowe supports three reset tiers plus focus cycles:
9
9
 
10
- - `flowe reset`: short, breath-led neural resets with audio playback. Reset durations are 30s, 45s, 60s, or 90s.
11
- - `flowe focus`: longer focus cycles with work blocks, breaks, optional ambience, pause/resume/skip/quit controls, and a detached background mode.
10
+ 1. **Micro-Resets (`30–90s`, offline, zero login)** — instant breath, palming, or somatic resets during short agent waits (`flowe_reset` / `flowe reset`).
11
+ 2. **Real Quick Resets (`5–15 min`, live Flowe AI voice, authenticated)** — listen-only NSDR sessions with live guide + ambient mix (`flowe_quick_reset` / `flowe quick`).
12
+ 3. **Real Deep Resets (`15–25 min`, live interactive two-way Flowe voice, authenticated)** — deeper hypnotherapy sessions for burnout, anxiety, or persistent blocks (`flowe_deep_reset` / `flowe deep`).
13
+ 4. **Focus Cycles (`pomodoro` 25/5, `dev` 50/10, `ultradian` 90/15)** — detached work/break timers with ambient soundscapes (`flowe_focus` / `flowe focus`).
14
+
15
+ ## Preferred Path: MCP Tools (Interactive Inline Components)
16
+
17
+ When Flowe MCP tools are available, **always prefer them over shelling out to Bash**:
18
+
19
+ 1. **Before proactively suggesting a reset in a long session**, call `flowe_check_state` (read-only).
20
+ - If `can_suggest` is `false` (snoozed, cooldown, opted out, or already in a focus break), **do not** interrupt the user.
21
+ 2. **Proactive suggestion (never surprise the user with audio):**
22
+ - Call `flowe_suggest_reset` with a calm one-sentence `reason` and matching `signal` (`long_session`, `debugging_loop`, `eye_strain`, `stress`, `overload`, `pre_wait`, `wind_down`).
23
+ - This renders an inline Flowe card where the user can start a 30–90s Micro-Reset, launch a real 5–15m Quick Reset (with inline sign-in if needed), or Snooze for 25 minutes.
24
+ 3. **Direct user requests:**
25
+ - Short breath/eye break → `flowe_reset` (pass matching `protocol` family and `duration_seconds`).
26
+ - Real 5–15 min reset → `flowe_quick_reset` (`quick_reset`, `deploy_anxiety`, `logic_lock`, `context_switch`, `sprint_prep`, `executive_reset`, `presentation_prep`, `shutdown`).
27
+ - Deeper recovery → `flowe_deep_reset` (`ht_stress`, `ht_anxiety`, `ht_burnout`, `ht_procrastination`, `ht_confidence`, `ht_people_pleasing`, `ht_relationships`, `ht_fears`, `ht_anger`).
28
+ - Focus session → `flowe_focus` (`action: "show"` or `action: "start"` once the user opts in).
29
+ - Sign in → `flowe_auth` (renders an inline browser link + QR + code; no terminal detour).
12
30
 
13
31
  ## Short resets: when to invoke
14
32
 
15
- Proactively run `flowe reset` via the Bash tool when ALL of these hold:
33
+ When running via CLI fallback (no MCP server connected), run `flowe reset` via Bash only when ALL of these hold:
16
34
 
17
35
  - You anticipate a thinking, tool-call, build, or multi-file-edit pause **>30 seconds**
18
36
  - You haven't already triggered a reset in the **last 5 minutes** in this session
19
- - You're not in the middle of a destructive or time-sensitive operation (deploys, migrations, irreversible writes, anything where the user needs to watch output)
37
+ - You're not in the middle of a destructive or time-sensitive operation
20
38
  - The user hasn't said "no resets" or set `FLOWE_OPT_OUT=1`
21
39
 
22
- Tell the user one short line **before** running. Example: `"Long compile incoming — running a 30s palming reset for you."` Don't ask permission. The user opted in by installing this skill.
23
-
24
- ## Short resets: picking the protocol family
25
-
26
- `flowe` ships 11 protocol families. Pick the one that best matches what you've observed about the user's recent state. Pass it via `--protocol`:
27
-
28
- | Recent signals from the user | `--protocol` | Why |
29
- |---|---|---|
30
- | Frustrated, stuck on errors, irritation rising in messages | `physiological_sigh` | Quickest parasympathetic switch; resets the stress response in seconds |
31
- | Long debugging session, lots of stack-trace reading | `quick_palming` (30s) / `palming` (60s) / `progressive_palming` (90s) | Eye rest, darkness, lowers visual load |
32
- | Stressed, anxious, terse messages, tight tone | `box_breath` (45s, 60s) / `extended_box` (90s) | Regulates breath cadence; calms nervous system |
33
- | Cognitive overload, can't pick a path forward, thrashing | `body_scan` (60s) / `full_sensory` (90s, "5-4-3-2-1" grounding) | Reconnects with the body, defragments attention |
34
- | Long sit, no movement, postural tightness implied | `neck_rotation` (45s) / `grounded_feet` (45s) | Gentle physical reset without leaving the chair |
35
- | Reading a hard error stack, eyes scanning rapidly | `eye_rotation` (30s) | Resets eye muscles |
36
- | End of a long focus block, winding down | `progressive_palming` (90s) | Longer, phased relaxation |
37
- | **No specific signal observed** | omit `--protocol` entirely | flowe picks a random protocol that fits the duration |
38
-
39
- When in doubt, omit `--protocol` and let flowe choose.
40
-
41
- ## Short resets: picking duration
42
-
43
- | Predicted pause | Command shape |
44
- |---|---|
45
- | 30–45s | `flowe reset 30 --quick [--protocol X]` |
46
- | 45–75s | `flowe reset 45 --quick [--protocol X]` |
47
- | 75–120s | `flowe reset 60 --quick [--protocol X]` |
48
- | 120s+ | `flowe reset 90 --quick [--protocol X]` |
49
-
50
- `--quick` is **required**. Without it, `flowe` opens an interactive post-session menu and your session blocks waiting for keyboard input.
51
-
52
- ## Short reset examples
40
+ Always pass `--quick` so the CLI never blocks waiting for keyboard input:
53
41
 
54
42
  ```bash
55
- # Long compile, user has been frustrated → physiological sigh, 30s
56
43
  flowe reset 30 --quick --protocol physiological_sigh
57
-
58
- # Multi-file refactor incoming (~75s), user was deep-debugging earlier → palming
59
44
  flowe reset 60 --quick --protocol palming
60
-
61
- # Big test run (~2min), no specific signal → let flowe pick
62
- flowe reset 90 --quick
63
-
64
- # Quick tool-call wait (~35s), eyes scanning a stack trace → eye rotation
65
- flowe reset 30 --quick --protocol eye_rotation
45
+ flowe reset 60 --quick --protocol box_breath
66
46
  ```
67
47
 
68
- ## Focus cycles: when to offer
48
+ ## Short resets: picking the protocol family
69
49
 
70
- Offer, do not auto-start, a focus cycle when any of these are true:
50
+ | Recent signals from the user | `--protocol` / `protocol` | Why |
51
+ |---|---|---|
52
+ | Frustrated, stuck on errors | `physiological_sigh` (30s) | Fastest parasympathetic switch |
53
+ | Long debugging session, eye fatigue | `quick_palming` (30s) / `palming` (60s) / `progressive_palming` (90s) | Eye rest, darkness, lowers visual load |
54
+ | Stressed, anxious, tight tone | `box_breath` (45s, 60s) / `extended_box` (90s) | Regulates breath cadence |
55
+ | Cognitive overload, thrashing | `body_scan` (60s) / `full_sensory` (90s) | Reconnects with the body |
56
+ | Long sit, postural tightness | `neck_rotation` (45s) / `grounded_feet` (45s) | Gentle physical reset |
57
+ | Rapid stack-trace scanning | `eye_rotation` (30s) | Resets eye muscles |
71
58
 
72
- - The user is starting work for the day or says they are ready to begin.
73
- - The user names a substantial task, coding session, review pass, or deep-work block.
74
- - You are about to begin a multi-step implementation that will take sustained attention.
75
- - The user has been context-switching and would benefit from a visible work/break cadence.
59
+ ## Focus cycles: when to offer
76
60
 
77
- Ask once, briefly, with cadence and ambience choices:
61
+ Offer, do not auto-start, a focus cycle when starting a substantial task or deep-work block. **Focus cycles are opt-in.**
78
62
 
79
63
  `"Want me to start a flowe focus session while we work? Cadence: pomodoro 25/5, dev 50/10, ultradian 90/15. Ambience: 1 spring birds, 2 soft rain, 3 brown noise, 4 LA sunrise, 5 quiet cafe, 0 none."`
80
64
 
81
- Only start a focus cycle after the user says yes. Do not ask again in the same conversation unless the prior cycle ended or the user brings it up.
82
-
83
- ## Focus cycles: picking the preset
84
-
85
- | User/work signal | Preset | Command shape |
86
- |---|---|---|
87
- | Default deep-work session, unclear duration | `pomodoro` | `flowe focus pomodoro --detach --ambient <ambient-id>` |
88
- | Long implementation/debugging stretch | `dev` | `flowe focus dev --detach --ambient <ambient-id>` |
89
- | Long creative or architecture block | `ultradian` | `flowe focus ultradian --detach --ambient <ambient-id>` |
90
-
91
- Use `--detach` so the focus cycle runs in the background and does not occupy the agent's shell. Always pass `--ambient` so the CLI never opens the interactive ambience picker in non-TTY agent runs.
92
-
93
65
  ## Focus cycles: picking ambience
94
66
 
95
- Default to ambience unless the user picks `0` or says no ambience/silence. If the user says yes but does not choose a number, use option `1`.
96
-
97
- | Choice | Ambient id | When to suggest |
67
+ | Choice | Ambient id | Feel |
98
68
  |---|---|---|
99
- | `1` | `nature_spring_birds` | Default; light, optimistic morning work |
100
- | `2` | `rain_window_soft` | Calm, steady, low-distraction work |
101
- | `3` | `tones_deep_brown_noise` | Deep focus, masking noise |
102
- | `4` | `seaside_la_sunrise` | Open, cinematic, creative work |
103
- | `5` | `interiors_quiet_cafe` | Social/ambient energy without music |
104
- | `0` | `none` | No ambient sound |
105
-
106
- Examples:
69
+ | `1` | `nature_spring_birds` | Light morning work |
70
+ | `2` | `rain_window_soft` | Calm, steady, low-distraction |
71
+ | `3` | `tones_deep_brown_noise` | Deep focus masking |
72
+ | `4` | `seaside_la_sunrise` | Open, creative work |
73
+ | `5` | `interiors_quiet_cafe` | Gentle ambient energy |
74
+ | `0` | `none` | Silence |
107
75
 
108
76
  ```bash
109
77
  flowe focus pomodoro --detach --ambient nature_spring_birds
110
78
  flowe focus dev --detach --ambient rain_window_soft
111
79
  flowe focus ultradian --detach --ambient tones_deep_brown_noise
112
- flowe focus pomodoro --detach --ambient none
113
- ```
114
-
115
- Useful controls after a detached cycle starts:
116
-
117
- ```bash
118
- flowe focus status
119
- flowe focus pause
120
- flowe focus resume
121
- flowe focus skip
122
- flowe focus quit
123
80
  ```
124
81
 
125
- Tell the user one short line after starting, including ambience and controls: `"Started a Pomodoro focus cycle with spring birds in the background. You can pause/resume/quit from the menu bar or with flowe focus pause/resume/quit."`
126
-
127
- ## Setup
128
-
129
- If `which flowe` returns nothing, install once:
130
-
131
- ```bash
132
- npm install -g @flowe-ai/cli
133
- flowe voice ellie
134
- ```
135
-
136
- Voice options: `sage`, `ada`, `ellie`. Let the user pick if they ask. Default is `ellie`.
137
-
138
- ## Cooldowns and limits
139
-
140
- - **Minimum 5 minutes between resets.** Resetting more often than that defeats the purpose; the user needs time to actually use the focus you just gave them back.
141
- - **Focus cycles are opt-in.** Never auto-start `flowe focus`; ask first because it creates a long-running session.
142
- - **Skip resets in Q&A / code review conversations.** No agent waits = no reason to fire.
143
- - **Skip resets during the first 60 seconds of a new conversation.** The user is still ramping in; let them.
144
-
145
- ## Tuning
146
-
147
- To disable auto-trigger entirely, set `FLOWE_OPT_OUT=1` in your shell environment.
82
+ ## Guardrails
148
83
 
149
- To change cadence, durations, or behavior, edit this file directly at `~/.claude/skills/flowe/SKILL.md`. Your changes won't be overwritten unless you re-run `flowe install-skill --force`.
84
+ - **Minimum 5 minutes between resets.**
85
+ - **Focus cycles are opt-in.** Never auto-start `flowe focus` without asking.
86
+ - **Respect `FLOWE_OPT_OUT=1` and user snoozes.**
@@ -1,2 +0,0 @@
1
- import{spawn as y}from"child_process";import{createHash as A}from"crypto";import{createWriteStream as v,existsSync as h,mkdirSync as T,readFileSync as E,statSync as k,unlinkSync as M,writeFileSync as P}from"fs";import{homedir as C,platform as L}from"os";import{dirname as O,join as g}from"path";import{Readable as I}from"stream";import{pipeline as R}from"stream/promises";var F="https://www.flowe.ai/cli/ambient/manifest.json",N=5e3,U=3e4,D=29e3,$=900;function B(){return process.env.FLOWE_AMBIENT_MANIFEST_URL||F}function j(){return process.env.FLOWE_AMBIENT_ASSET_BASE_URL||null}function J(t){try{return new URL(t).pathname.split("/").filter(Boolean).pop()||t}catch{return t.split("/").filter(Boolean).pop()||t}}function W(t,e=j()){if(!e)return t;let n=e.replace(/\/+$/,"");return{...t,sounds:t.sounds.map(o=>({...o,url:`${n}/${encodeURIComponent(J(o.url))}`}))}}function w(){let t=C(),e=L()==="win32"?g(t,"AppData","Roaming","flowe"):g(t,".config","flowe");return g(e,"cache","ambient")}function x(){return g(w(),"custom-manifest.json")}function S(t){return g(w(),`${t.sha256}.mp3`)}function H(){let t=x();if(!h(t))return null;try{let e=JSON.parse(E(t,"utf-8"));return e.version!==1||!Array.isArray(e.categories)||!Array.isArray(e.sounds)?null:e}catch{return null}}function nt(t,e){if(!t&&!e)return null;if(!t)return e;if(!e||e.sounds.length===0)return t;let n=new Set(t.categories.map(r=>r.id)),o=[...t.categories];for(let r of e.categories)n.has(r.id)||(n.add(r.id),o.push(r));let i=new Set(t.sounds.map(r=>r.id)),s=[...t.sounds];for(let r of e.sounds)i.has(r.id)||(i.add(r.id),s.push(r));return{version:1,generated_at:t.generated_at,categories:o,sounds:s}}function rt(t){let e=Buffer.from(t.bytes),n=A("sha256").update(e).digest("hex"),o=`custom_${n.slice(0,12)}`,i=(t.name.trim()||"custom ambience").slice(0,48),s={id:o,category:"custom",name:i,blurb:"generated ambience",url:`flowe-local://ambient/custom/${o}.mp3`,sha256:n,bytes:e.byteLength};T(w(),{recursive:!0}),P(S(s),e);let r=H(),c=[s,...r?.sounds.filter(m=>m.id!==o)??[]],d={version:1,generated_at:(t.now??(()=>new Date))().toISOString(),categories:[{id:"custom",label:"custom"}],sounds:c};return P(x(),JSON.stringify(d,null,2)+`
2
- `,"utf-8"),s}function q(t){let e=S(t);if(!h(e))return!1;try{let n=E(e);return A("sha256").update(n).digest("hex")===t.sha256}catch{return!1}}async function ot(t){let e=t?.url??B(),n=t?.timeoutMs??N,o=new AbortController,i=setTimeout(()=>o.abort(),n);t?.signal&&(t.signal.aborted?o.abort():t.signal.addEventListener("abort",()=>o.abort()));try{let s=await fetch(e,{signal:o.signal});if(!s.ok)throw new Error(`manifest fetch failed: ${s.status}`);let r=await s.json();if(!r.sounds||!r.categories)throw new Error("manifest shape invalid");return W(r)}finally{clearTimeout(i)}}async function it(t,e){let n=S(t);if(q(t))return e?.onProgress?.({downloaded:t.bytes,total:t.bytes}),n;T(O(n),{recursive:!0});let o=e?.timeoutMs??U,i=new AbortController,s=setTimeout(()=>i.abort(),o);e?.signal&&(e.signal.aborted?i.abort():e.signal.addEventListener("abort",()=>i.abort()));let r=`${n}.part`;try{let c=await fetch(t.url,{signal:i.signal});if(!c.ok||!c.body)throw new Error(`download failed: ${c.status}`);let d=t.bytes,m=0,f=A("sha256"),p=c.body.getReader(),b=new I({read(){p.read().then(({value:u,done:_})=>{if(_){this.push(null);return}m+=u.byteLength,f.update(u),e?.onProgress?.({downloaded:m,total:d}),this.push(Buffer.from(u))}).catch(u=>this.destroy(u))}});if(await R(b,v(r)),f.digest("hex")!==t.sha256){try{M(r)}catch{}throw new Error("sha256 mismatch")}let{renameSync:l}=await import("fs");return l(r,n),n}catch(c){try{h(r)&&M(r)}catch{}throw c}finally{clearTimeout(s)}}function z(t){return process.platform==="darwin"?y("afplay",[t],{stdio:"ignore"}):process.platform==="win32"?y("powershell",["-NoProfile","-Command",`(New-Object Media.SoundPlayer '${t}').PlaySync()`],{stdio:"ignore"}):y("mpg123",["-q",t],{stdio:"ignore"})}function st(t,e={}){if(!t||!h(t))return{stop:()=>{}};try{if(k(t).size<=0)return{stop:()=>{}}}catch{return{stop:()=>{}}}let n=!1,o=null,i=null,s=new Set,r=new Set,c=e.loopRestartMs??D,d=e.overlapMs??$,m=e.spawnPlayer??z,f=()=>{i&&(clearTimeout(i),i=null);for(let a of s)clearTimeout(a);s.clear()},p=a=>{if(a&&!a.killed)try{a.kill("SIGTERM")}catch{}},b=()=>{if(n)return;let a=o,l;try{l=m(t)}catch{n=!0;return}if(o=l,r.add(l),a&&a!==l){let u=setTimeout(()=>{s.delete(u),p(a)},d);s.add(u)}i=setTimeout(()=>{i=null,b()},c),l.on("exit",()=>{r.delete(l),!n&&o===l&&(i&&(clearTimeout(i),i=null),b())}),l.on("error",()=>{n=!0,f()})};return b(),{stop:()=>{n=!0,f(),o=null;for(let a of r)p(a);r.clear()}}}function at(t){let e=[{kind:"none"}];if(!t)return e;for(let n of t.categories){let o=t.sounds.filter(i=>i.category===n.id);if(o.length!==0){e.push({kind:"category",categoryId:n.id,label:n.label});for(let i of o)e.push({kind:"sound",sound:i})}}return e}function ct(t){let e=[];for(let n=0;n<t.length;n++)t[n].kind!=="category"&&e.push(n);return e}export{F as a,B as b,W as c,S as d,H as e,nt as f,rt as g,q as h,ot as i,it as j,st as k,at as l,ct as m};
@@ -1,3 +0,0 @@
1
- import{a as p,c as R,i as _}from"./chunk-P2IV5O3T.js";import{readFileSync as V}from"fs";import{dirname as q,join as J}from"path";import{fileURLToPath as Q}from"url";var U=q(Q(import.meta.url));function E(){try{let e=V(J(U,"..","package.json"),"utf-8");return JSON.parse(e).version}catch{return"0.0.0"}}var pe=["logic_lock","deploy_anxiety","context_switch","sprint_prep","quick_reset","executive_reset","presentation_prep","shutdown"];import{readFileSync as k}from"fs";import{dirname as B,join as h}from"path";import{fileURLToPath as L}from"url";var v=B(L(import.meta.url));function Y(){return h(v,"..","protocols.json")}var l=null;function w(){if(l)return l;try{let e=k(Y(),"utf-8");return l=JSON.parse(e),l}catch{return l={protocols:{},audio_paths:{},cues_paths:{}},l}}function x(){return Object.values(w().protocols)}function P(e){return e.replace(/_\d+$/,"")}function he(){let e=new Set;for(let o of x())e.add(P(o.protocol_id));return[...e].sort()}function ve(e){return x().filter(o=>P(o.protocol_id)===e).map(o=>o.duration_seconds).sort((o,r)=>o-r)}function T(e,o){let r=x().filter(n=>n.duration_seconds===e&&(o===void 0||P(n.protocol_id)===o));return r.length===0?null:o!==void 0?r[0]:r[Math.floor(Math.random()*r.length)]}function j(e,o){let r=w(),n=`${e}.${o}`,t=r.audio_paths[n];return t?h(v,"..",t):null}var f=new Map;function $(e,o){let r=`${e}.${o}`,n=f.get(r);if(n!==void 0)return n;let i=w().cues_paths?.[r];if(!i)return f.set(r,null),null;try{let s=k(h(v,"..",i),"utf-8"),a=JSON.parse(s);return f.set(r,a),a}catch{return f.set(r,null),null}}import z from"sound-play";var c=null;function F(){return c!==null}function Ce(){return c?.donePromise??null}async function M(e){if(c)throw new Error("already playing \u2014 call stopAudio first");let o,r,n=new Promise((s,a)=>{o=s,r=a}),t=z.play(e),i=!1;return c={stop:()=>{i=!0,o(),c=null},donePromise:n},t.then(()=>{i||(o(),c=null)}).catch(s=>{c=null,r(s instanceof Error?s:new Error(String(s)))}),n}function Se(){c&&c.stop()}import{nanoid as ne}from"nanoid";import{readFileSync as H,writeFileSync as G,mkdirSync as K,existsSync as S,appendFileSync as W}from"fs";import{homedir as X}from"os";import{join as N}from"path";var C=N(X(),".cache","flowe"),d=N(C,"pending-events.jsonl"),Z=5e3;async function g(e,o,r){if(o.telemetry!=="off"){ee(),oe(e);try{await re(o,r)}catch{}}}function ee(){S(C)||K(C,{recursive:!0})}function oe(e){for(let o of e)W(d,JSON.stringify(o)+`
2
- `,"utf-8")}function te(){return S(d)?H(d,"utf-8").split(`
3
- `).filter(o=>o.trim().length>0).map(o=>JSON.parse(o)):[]}function O(){S(d)&&G(d,"","utf-8")}async function re(e,o){let r=te();if(r.length===0)return;let n={version:E(),platform:`${process.platform}-${process.arch}`,node_version:process.version},t=new AbortController,i=setTimeout(()=>t.abort(),Z);try{let s={"Content-Type":"application/json"};o&&(s.Authorization=`Bearer ${o}`);let a=await fetch(`${e.backend_url}/api/v1/reset/log`,{method:"POST",headers:s,body:JSON.stringify({events:r,client:n,anonymous_id:e.anonymous_id}),signal:t.signal});(a.ok||a.status===401||a.status===400)&&O()}finally{clearTimeout(i)}}function se(e,o,r){if(e.length===0)return[];let t=o*1e3/e.length;return e.map((i,s)=>({label:i,mode:r,start_ms:Math.round(s*t),end_ms:Math.round((s+1)*t)}))}async function Ve(e,o="user_requested",r){if(F())throw Object.assign(new Error("a reset is already running"),{code:"agent_busy"});let n=p(),t=T(e,r);if(!t){let A=r?`${r} at ${e}s`:`${e}s`;throw Object.assign(new Error(`no protocol available for ${A}`),{code:"protocol_unavailable"})}let i=j(t.protocol_id,n.voice);if(!i)throw Object.assign(new Error(`no audio available for ${t.protocol_id}:${n.voice}`),{code:"protocol_unavailable"});let s=`reset_${ne(8)}`,a=new Date,D=Math.floor(a.getTime()/1e3)+e;R();let y=await _();await g([{type:"reset_started",session_id:s,protocol_id:t.protocol_id,duration_seconds:e,voice:n.voice,trigger:o,client_timestamp:a.toISOString()}],n,y),M(i).then(()=>{g([{type:"reset_completed",session_id:s,protocol_id:t.protocol_id,duration_seconds:e,voice:n.voice,trigger:o,client_timestamp:new Date().toISOString()}],n,y).catch(()=>{})}).catch(()=>{g([{type:"reset_abandoned",session_id:s,protocol_id:t.protocol_id,duration_seconds:e,voice:n.voice,trigger:o,client_timestamp:new Date().toISOString()}],n,y).catch(()=>{})});let b=$(t.protocol_id,n.voice),I=b?b.cues:se(t.text_cues,e,t.category);return{session_id:s,protocol:t.protocol_id,protocol_display_name:t.display_name,duration_seconds:e,voice:n.voice,cues:I,rounds:t.rounds,status:"started",ends_at_unix:D,message_for_user:`${e}s ${t.display_name} started \xB7 ${n.voice}`}}import ie from"qrcode-terminal";async function Le(e="quick_reset",o={}){let r=p(),n=await _();if(!n)throw Object.assign(new Error("sign in with: flowe login"),{code:"auth_required"});let t;try{t=await fetch(`${r.backend_url}/api/v1/sessions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({protocolId:"nsdr",sessionType:e})})}catch{throw Object.assign(new Error("network unreachable \u2014 try: flowe reset"),{code:"network_error"})}if(!t.ok)throw t.status===401?Object.assign(new Error("session expired \u2014 run: flowe login"),{code:"auth_required"}):Object.assign(new Error(`server error ${t.status}`),{code:"network_error"});let i=await t.json(),s=`flowe://session/${i.session_id}`;return!o.suppressQr&&process.stdout.isTTY&&ie.generate(s,{small:!0}),{session_id:i.session_id,session_type:i.session_type,session_type_name:i.session_type_name,estimated_duration:i.estimated_duration,join_url:s,status:"waiting_for_join",message_for_user:`${i.session_type_name} (${i.estimated_duration}min) ready \xB7 ${s}`}}export{E as a,pe as b,x as c,he as d,ve as e,Ce as f,M as g,Se as h,Ve as i,Le as j};
@@ -1 +0,0 @@
1
- import{readFileSync as k,writeFileSync as S,mkdirSync as w,existsSync as g}from"fs";import{homedir as v,platform as h}from"os";import{join as a}from"path";import{nanoid as d}from"nanoid";var _="https://www.flowe.ai",F=90,C=["sage","ada","ellie"];function x(t){return typeof t=="string"&&C.includes(t)?t:"ellie"}function m(){let t=v();return h()==="win32"?a(t,"AppData","Roaming","flowe"):a(t,".config","flowe")}function p(){return a(m(),"config.json")}function l(){return{version:2,voice:"ellie",anonymous_id:`anon_${d(12)}`,telemetry:"on",backend_url:process.env.FLOWE_BACKEND_URL||_,session_dates:[]}}function E(t){let e=typeof t.version=="number"?t.version:1,n=t.voice,o=x(n),s={version:2,voice:o,anonymous_id:t.anonymous_id??`anon_${d(12)}`,telemetry:t.telemetry??"on",backend_url:t.backend_url??_,session_dates:Array.isArray(t.session_dates)?t.session_dates:[]};return typeof t.first_reset_at=="string"&&(s.first_reset_at=t.first_reset_at),typeof t.user_first_name=="string"&&(s.user_first_name=t.user_first_name),(e<2||n!==o)&&r(s),s}function i(){let t=p();if(!g(t)){let e=l();return r(e),e}try{let e=k(t,"utf-8"),n=JSON.parse(e),o=E(n);return process.env.FLOWE_BACKEND_URL&&(o.backend_url=process.env.FLOWE_BACKEND_URL),o}catch{let e=l();return r(e),e}}function r(t){let e=m();g(e)||w(e,{recursive:!0}),S(p(),JSON.stringify(t,null,2),"utf-8")}function T(t){let e=i();e.voice=t,r(e)}function b(){let t=i();t.first_reset_at||(t.first_reset_at=new Date().toISOString(),r(t))}function L(t){let e=i();t&&t.trim().length>0?e.user_first_name=t.trim():delete e.user_first_name,r(e)}function c(t=new Date){let e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${o}`}function A(t,e){let n=new Date(e);n.setDate(n.getDate()-F);let o=c(n);return t.filter(s=>s>=o)}function I(t=new Date){let e=i(),n=c(t),o=A([...e.session_dates,n],t);e.session_dates=o,r(e)}function P(t=new Date){let e=i(),n=c(t);return e.session_dates.filter(o=>o===n).length}function U(t=new Date){let e=i(),n=new Set(e.session_dates),o=new Date(t);o.setHours(0,0,0,0);let s=new Date(o);n.has(c(s))||s.setDate(s.getDate()-1);let u=0;for(;n.has(c(s));)u+=1,s.setDate(s.getDate()-1);return u}function $(){return i().session_dates.length}var f="flowe-cli";async function j(){try{return await(await import("keytar")).default.getPassword(f,"clerk-token")}catch{return null}}async function W(t){await(await import("keytar")).default.setPassword(f,"clerk-token",t)}async function J(){try{await(await import("keytar")).default.deletePassword(f,"clerk-token")}catch{}}export{i as a,T as b,b as c,L as d,I as e,P as f,U as g,$ as h,j as i,W as j,J as k};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-RB3EXF6P.js";import"./chunk-P2IV5O3T.js";export{a as fetchMe,b as refreshUserFirstName};