@fungi.computer/grove 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{anthropic-messages-B81gZpyI.js → anthropic-messages-CzrqVj3D.js} +3 -3
- package/dist/assets/{azure-openai-responses-C31garnK.js → azure-openai-responses-CvQ9xjer.js} +1 -1
- package/dist/assets/{burger-D2jgymBm.js → burger-BW8tqiCp.js} +1 -1
- package/dist/assets/{cat-C4b_p5WX.js → cat-BXIkVXbI.js} +1 -1
- package/dist/assets/{compat-BEPXFxep.js → compat-C8dC0AJi.js} +2 -2
- package/dist/assets/{extension-hook-CU9zKOl3.js → extension-hook-C8EcEsru.js} +2 -2
- package/dist/assets/{google-generative-ai-BBWhU2BN.js → google-generative-ai-CYetJdBc.js} +1 -1
- package/dist/assets/{google-shared-BD-WRJUA.js → google-shared-BlpJEQSG.js} +1 -1
- package/dist/assets/{google-vertex-eAGy3UP7.js → google-vertex-BibJIuob.js} +1 -1
- package/dist/assets/{index-DGAQpG4R.js → index-B9JPxELm.js} +4 -4
- package/dist/assets/index-ChM-AVzG.css +1 -0
- package/dist/assets/{mistral-conversations-vxTDfsRc.js → mistral-conversations-CyH7xWkc.js} +1 -1
- package/dist/assets/{node.browser-B4iGbqF4.js → node.browser-Cycq62fH.js} +1 -1
- package/dist/assets/{openai-codex-responses-B7-CzlUV.js → openai-codex-responses-ChhYk5bS.js} +1 -1
- package/dist/assets/{openai-completions-DhpMlMMS.js → openai-completions-CE1TiZN9.js} +1 -1
- package/dist/assets/{openai-responses-CikgDmHZ.js → openai-responses-eXl4tNKu.js} +1 -1
- package/dist/assets/{openai-responses-shared-BJ2bNOt5.js → openai-responses-shared-CrCBglN8.js} +1 -1
- package/dist/assets/{parakeet-Bz6LNdhR.js → parakeet-CQ3Gd-gj.js} +1 -1
- package/dist/assets/{parakeet-conversation-rhJRjEID.js → parakeet-conversation-QV-oaHhj.js} +1 -1
- package/dist/assets/{runtime-core-B0VK1llt.js → runtime-core-C5cCJNx2.js} +1 -1
- package/dist/assets/{sigil-CG2US71x.js → sigil-CwDKTeeQ.js} +1 -1
- package/dist/assets/{transform-messages-zJuTwbPJ.js → transform-messages-Dy-BuyHE.js} +1 -1
- package/dist/assets/{website-conversation-Db8m3YMg.js → website-conversation-B9jJCzfn.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +3 -3
- package/dist/assets/index-CBcYtgV0.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{E as t,Fr as n,Lr as r,Mr as i,Nr as a,Oi as o,Pr as s,Tr as c,an as l,c as u,g as d,gi as f,ji as p,jr as m,u as ee,yr as h}from"./sigil-CG2US71x.js";import{Ea as g,Ta as te,Zi as _,_a as v,ar as y,ba as ne,da as re,fa as ie,ht as ae,ra as oe,sr as se,xa as b,ya as ce}from"./Effect-CsknxyoC.js";import{Ai as x,Bi as le,Ci as S,Dr as ue,Hi as C,Ji as w,Ma as de,Na as T,Ni as E,Pa as D,Pi as fe,Si as O,Ta as k,Wi as pe,Zi as me,_a as A,_i as he,bi as ge,fi as j,i as M,ii as N,ji as _e,ka as P,kr as ve,la as F,li as I,oa as ye,oi as L,pa as be,pi as R,ri as xe,ti as Se,ui as Ce,xa as z,xi as we,yi as B}from"./extension-hook-CU9zKOl3.js";import{a as Te,c as Ee,d as V,i as De,l as Oe,n as ke,o as Ae,r as je,s as Me,u as Ne}from"./parakeet-Bz6LNdhR.js";import{_ as Pe,g as H,h as Fe,m as Ie,p as Le,t as Re,v as ze,y as Be}from"./index-DGAQpG4R.js";var U=e(p(),1),W=f(),G=O.check(k(1),z(256)),Ve=I.check(F(1),A(2**53-1)),He=I.check(F(0),A(2**53-1)),Ue=R([`write`,`external`]),We=S({module:B(G),access:Ue}),Ge=S({agentId:B(G)}),Ke=S({principalId:G,agentId:B(G),sessionId:B(G),displayName:G}),qe=S({title:O.check(k(1),z(512)),inputBytes:I.check(F(0)),inputSha256:O.check(P(/^[a-f0-9]{64}$/))}),Je=S({kind:j(`pending_approval`),recordId:G,description:qe}),Ye=R([`requested`,`pending`,`approved`,`claimed`,`applied`,`denied`,`expired`,`outcome_unknown`]),Xe=R([`not-found`,`not-eligible`,`already-answered`,`stale-revision`,`expired`,`declined`,`fenced`,`not-granted`,`read-only`,`pending`,`in-flight`,`outcome-unknown`,`identity-conflict`]),Ze=O.check(k(1),z(512),P(/^(?=.*\S)[^\p{Cc}\u2028\u2029]*$/u)),Qe=N(S({kind:j(`artifact`),ref:O.check(P(/^sha256:[a-f0-9]{64}$/)),mediaType:j(`image/png`),bytes:I.check(F(1),A(5242880))})).check(z(4)),$e=S({recordId:G,requester:Ke,module:G,operation:G,access:Ue,description:qe,evidence:D(Qe),authorityFence:G,reversibility:R([`reversible`,`irreversible-external`]),state:Ye,by:B(x([S({kind:j(`human`),memberId:G}),S({kind:j(`policy`)})])),reason:B(Xe),denialNote:D(Ze),requestedAt:He,expiresAt:He,updatedAt:He,revision:Ve}),et=S({record:$e,canAnswer:L,canSetAutoApprove:L});S({state:D(Ye),cursor:D(G),limit:D(I.check(F(1),A(100)))}),S({recordId:G}),S({recordId:G,decision:R([`approve`,`deny`]),expectedRevision:Ve,denialNote:D(Ze)});var tt=S({scope:Ge,family:We,enabled:L}),nt=S({kind:j(`refused`),reason:Xe,denialNote:D(Ze)});C(w($e),{onExcessProperty:`error`}),pe(w($e)),C(S({record_json:O})),C(w(Ce)),pe(w(Ce)),C(S({input_json:O,output_json:B(O)}));var rt=nt,it=S({items:N(et),nextCursor:B(O)}),at=x([S({kind:j(`answered`),view:et}),rt]),ot=x([S({kind:j(`updated`),rule:tt}),rt]),K=e=>Ie(te().transform(t=>C(e,{onExcessProperty:`error`})(t))),st=ze(`approvals`,1,ie(()=>Fe({list:H(K(it)),get:H(K(B(et))),answer:H(K(at)),setAutoApprove:H(K(ot))}))),ct=(e,t)=>{if(e.length<=t)return e;let n=Math.max(1,Math.floor((t-1)/2));return`${e.slice(0,n)}…${e.slice(-(t-n-1))}`},lt=(e,t)=>e.length<=t?e:`${e.slice(0,t-1)}…`,ut=e=>e.map(([e,t])=>({label:e,value:t}));function dt(e,t){let{record:n}=e,r=Math.max(0,n.expiresAt-t);return[[`Agent`,`${n.requester.displayName} · ${n.requester.agentId??`none`}`],[`Session`,n.requester.sessionId??`none`],[`Requester`,n.requester.principalId],[`Request`,`${n.module}.${n.operation} · ${n.access}`],[`Input`,`${n.description.inputBytes.toLocaleString()} bytes · SHA-256 ${n.description.inputSha256.slice(0,8)}…${n.description.inputSha256.slice(-6)}`],[`Expires`,`in ${String(Math.floor(r/36e5))} h ${String(Math.floor(r%36e5/6e4))} m`],[`Record`,`${n.recordId} · revision ${String(n.revision)}`]]}function ft(e){return[`Undo`,e.record.reversibility===`irreversible-external`?`Can't be undone`:`Can be undone`]}function pt(e,t){let{record:n}=e;return{content:{title:`Allow ${n.module} · ${n.operation}?`,summary:`${n.requester.displayName} wants to use a connected tool.`,facts:[{label:`Effect`,value:(n.access===`write`?`Changes data in Fungi`:`Changes things outside Fungi`)+(n.reversibility===`irreversible-external`?` · can't be undone`:``)}],details:ut([ft(e),...dt(e,t)])}}}function mt(e,t,n,r,i){let a=t.prefix?.join(` `),o=a!==void 0&&t.alwaysAllowUnavailableReason===void 0,s=t.command,c=`Allow \`${s}\`?`.length<=n?`Allow \`${s}\`?`:`Allow this command?`,l=t.cwd===r?`~`:t.cwd.startsWith(`${r}/`)?`~${t.cwd.slice(r.length)}`:t.cwd,u=Math.max(8,(n-8)*2-2),d=t.justification.length<=u?`“${t.justification}”`:`“${t.justification.slice(0,u-1)}…”`,f=[[`Folder`,ct(l,Math.max(8,n-10))],[`Why`,d]];t.kind===`extension-install`&&f.push([`Note`,`Extensions run inside Fungi with access to every Agent.`]),o&&t.alwaysAllowCoverage!==void 0&&f.push([`Scope`,lt(t.alwaysAllowCoverage,Math.max(8,n-12))]),!o&&t.warning!==void 0&&f.push([`Warning`,t.warning]);let p=o?`Always allow “${ct(a,Math.max(8,n-5-32))}” in this project…`:void 0,m=[[`Command`,s]];return t.argv!==void 0&&m.push([`Arguments`,JSON.stringify(t.argv)]),m.push([`Folder`,t.cwd],[`Runs`,`Outside the sandbox, as you`],ft(e)),!o&&t.alwaysAllowUnavailableReason!==void 0?m.push([`Rule`,t.alwaysAllowUnavailableReason]):t.form===`shell`?m.push([`Rule`,`Shell command: no Always-allow rule can match it.`]):o&&(m.push([`Rule`,`“${a}” would match \`${a} …\` in this project`]),t.alwaysAllowCoverage!==void 0&&m.push([`Coverage`,t.alwaysAllowCoverage]),t.risk!==void 0&&m.push([`Risk`,t.risk.detail])),!o&&t.warning!==void 0&&m.push([`Warning`,t.warning]),m.push(...dt(e,i)),{content:{title:c,body:c===`Allow this command?`?s:void 0,bodyLabel:c===`Allow this command?`?`Command`:void 0,summary:`${e.record.requester.displayName} wants to run this outside the sandbox, as you.`,facts:ut(f),details:ut(m)},always:p===void 0?void 0:lt(p,Math.max(12,n-5)),confirmation:o?{title:`Always allow “${a}” in this project?`,body:lt(t.alwaysAllowCoverage??`Any Workspace Agent here can then run \`${a} …\` without asking.`,Math.max(12,(n-8)*2-2))}:void 0,confirmWarning:o?t.risk?.summary:void 0,confirmYes:o?`Always allow “${a}” and run it now`:void 0}}function ht(e,t,n){let r=Math.min(n.width,60);return t===void 0?pt(e,n.now):mt(e,t,r,n.home,n.now)}function gt(e,t){switch(e){case`stale-revision`:case`already-answered`:return`This request changed. Look again before answering.`;case`expired`:return`This request expired. Nothing ran.`;case`not-eligible`:if(t===`always-allow`)return`Always allow isn't available for this command. Approve once or deny.`}return`Couldn't answer (${e}). Nothing ran.`}var _t=`Couldn't send your answer. It may not have been recorded.`;async function vt(e,t){let{view:n,source:r}=t,i=ht(n,r.review,{width:t.width,home:t.home,now:t.now}),a=n.record;try{let n,o,s=!1;for(;n===void 0;){let c=await e.prompt({type:`decision`,message:i.content.title,summary:s?`Automatic approval is on for this family.`:i.content.summary,facts:i.content.facts?.map(e=>({...e})),body:i.content.body,bodyLabel:i.content.bodyLabel,details:i.content.details?.map(e=>({...e})),options:[{value:`approve`,label:`Approve once`},...i.always===void 0?[]:[{value:`always`,label:i.always}],...r.family===void 0||s?[]:[{value:`family`,label:r.family.label}],{value:`deny`,label:`Deny`}],other:{label:`Deny and say why…`,placeholder:`A short reason for the Agent (optional)`,maxLength:t.noteLimit,blank:`deny`}});if(!t.stillCurrent())return{kind:`abandoned`};if(c.text!==void 0)o=c.text.trim()||void 0,n=`deny`;else if(c.selected[0]===`always`){let r=i.confirmation,a=await e.prompt({type:`decision`,message:r?.title??i.content.title,summary:i.confirmWarning,body:r?.body,options:[{value:`back`,label:`Back`},{value:`always-allow`,label:i.confirmYes??`Always allow`}],escape:`back`});if(!t.stillCurrent())return{kind:`abandoned`};a.selected[0]===`always-allow`&&(n=`always-allow`)}else if(c.selected[0]===`family`&&r.family!==void 0){let n=await e.prompt({type:`decision`,message:`${r.family.label}?`,summary:`Later ${a.module} requests that ${a.access===`write`?`change data in Fungi`:`reach outside Fungi`} will run without asking.`,options:[{value:`back`,label:`Back`},{value:`family`,label:r.family.label}],escape:`back`});if(!t.stillCurrent()||n.selected[0]===`family`&&(s=await r.family.enable(),!t.stillCurrent()))return{kind:`abandoned`}}else c.selected[0]===`approve`?n=`approve`:c.selected[0]===`deny`&&(n=`deny`)}let c={recordId:a.recordId,decision:n,expectedRevision:a.revision},l=await r.answer(o===void 0?c:{...c,denialNote:o});return t.stillCurrent()?l.kind===`refused`?{kind:`refused`,message:gt(l.reason??`unknown`,n)}:{kind:`answered`}:{kind:`abandoned`}}catch(n){return e.signal.aborted?{kind:`abandoned`}:(t.onFailure(n),{kind:`refused`,message:_t})}}var yt=()=>void 0,bt=()=>()=>void 0;function xt(e){let{source:t,store:n,enabled:r,home:i,width:a,noteLimit:o,onFailure:s}=e,c=(0,U.useRef)(s);c.current=s;let l=(0,U.useRef)({home:i,width:a,noteLimit:o});l.current={home:i,width:a,noteLimit:o};let u=(0,U.useSyncExternalStore)(t?.subscribe??bt,t?.snapshot??yt),d=(0,U.useRef)(u);d.current=u;let f=u===void 0?void 0:JSON.stringify([`approval`,u.record.recordId,u.record.revision,u.canAnswer]);(0,U.useEffect)(()=>{let e=d.current;if(!r||t===void 0||e===void 0||!e.canAnswer||f===void 0)return;let{home:i,width:a,noteLimit:o}=l.current,s=Oe({title:`Approval`}),u=s.begin(),p=()=>{let n=t.snapshot();return!u.interaction.signal.aborted&&n?.record.recordId===e.record.recordId&&n.record.revision===e.record.revision&&n.canAnswer},m=n.awaiting.add({key:f,kind:`approval`,arrivedAt:Date.now(),host:s});return vt(u.interaction,{view:e,source:t,home:i,width:a,now:Date.now(),noteLimit:o,stillCurrent:p,onFailure:e=>{c.current(e)}}).then(e=>{e.kind===`refused`?u.settle({status:`failed`,message:e.message}):(m(),u.settle(e.kind===`answered`?{status:`handled`}:{status:`cancelled`}))}),()=>{m(),s.cancel()}},[t,f,r,n])}var q=fe(e=>Ne.safeParse(e).success,{representation:{id:`@fungi.computer/whistle/catalog-step/v1`,payload:null}});ae(()=>xe());var St=O.pipe(E(k(1)),E(z(4e3)),E(P(/\S/u,{message:`Goal objective is blank`}))),Ct=O.pipe(E(k(1)),E(z(1e3)),E(P(/\S/u))),wt=O.pipe(E(k(1)),E(z(256))),Tt=I.check(F(0)),Et=S({kind:R([`person`,`delegator`,`blocked`,`stalled`,`cancelled`,`failed`,`no-terminal`]),detail:B(O)}),J=S({revision:O,objective:St,state:R([`active`,`paused`]),startedAt:Tt,pauseCause:B(Et)}),Dt=S({sequence:I.check(ye(0)),objective:St,outcome:R([`achieved`,`cleared`]),reason:B(Ct),clearedBy:D(he.check(z(256))),endedAt:Tt,afterSequence:I.check(F(0))}),Ot=x([S({action:j(`set`),objective:St,requestId:wt,expectedRevision:T(B(O)),confirmed:T(L)}),S({action:R([`pause`,`resume`,`replace`,`clear`,`clear-ask`]),confirmed:T(L)}),S({})]),kt=S({goal:B(J),ended:N(Dt).check(z(16)),omitted:I.check(F(0))}),At={id:M.make(`botanical-session-goal`),commands:{controlAgent:{scope:`session`,input:S({action:R([`pause`,`resume`,`clear`]),reason:Ct}),output:x([S({result:j(`paused`),goal:J}),S({result:j(`resumed`),goal:J}),S({result:j(`cleared`)}),S({result:j(`no_goal`)}),S({result:j(`refused`),reason:R([`not_delegator`,`not_paused_by_delegator`])})])},goal:{scope:`session`,input:Ot,output:q},pause:{scope:`session`,input:S({}),output:J},resume:{scope:`session`,input:S({}),output:J},clear:{scope:`session`,input:S({}),output:S({})},set:{scope:`session`,input:S({objective:St,expectedRevision:B(O),requestId:wt,adoptCommandId:D(wt)}),output:S({goal:J,accepted:S({status:j(`accepted`),commandId:O})})}},projection:{schema:kt}},Y=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=80?t:`${t.slice(0,79)}…`},jt=e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`};function Mt(e){let t=e.state===`active`,n=t?`Pursuing goal since ${jt(e.startedAt)}`:e.pauseCause?.kind===`delegator`?`Goal paused by ${Y(e.pauseCause.detail??`delegator`)} (/goal resume)`:`Goal paused (/goal resume)`,r=!t&&e.pauseCause?.kind!==`delegator`&&e.pauseCause?.detail!=null?[Y(e.pauseCause.detail)]:[],i={id:`goal`,title:[n,Y(e.objective),...r].join(` · `),tone:t?`running`:`muted`,actions:[{id:`goal`,label:t?`Pause goal`:`Resume goal`,input:{action:t?`pause`:`resume`}}]};return Y(e.objective)===e.objective?i:{...i,detail:e.objective.slice(0,1024)}}function Nt(e){let t={id:`goal-ended`,title:`${e.outcome===`achieved`?`Goal achieved`:`Goal cleared`} · ${Y(e.objective)}`,tone:e.outcome===`achieved`?`settled`:`muted`},n=e.reason===null?t:{...t,detail:e.reason};return{id:String(e.sequence),sequence:e.sequence,at:e.endedAt,commandId:null,afterSequence:e.afterSequence,rows:[n]}}var Pt=V(At,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{goal:t,ended:n,omitted:r}=e.value;return{chips:[],panel:t===null?[]:[Mt(t)],timeline:{cells:n.map(Nt),omitted:r},waiting:null}}}),Ft=O.pipe(E(k(1)),E(z(256))),It=O.pipe(E(k(1)),E(z(262144))),Lt=S({expression:O.pipe(E(k(1)),E(z(256))),timeZone:O.pipe(E(k(1)),E(z(128)))}),X=S({loopId:O,origin:R([`human`,`model`]),expiresAt:B(I),prompt:It,mode:R([`self_paced`,`fixed_interval`]),cron:B(Lt),state:R([`active`,`paused`,`finished`,`failed`,`cancelled`]),commandId:O,reason:B(O),nextDueAt:B(I),lastError:B(O),consecutiveFailures:I.pipe(E(F(0)))}),Rt=S({after:D(Ft),limit:D(I.pipe(E(me({minimum:1,maximum:64}))))}),zt=O.pipe(E(k(1)),E(z(200))),Bt=S({loop:X,accepted:S({status:j(`accepted`),commandId:O})}),Vt=x([S({action:j(`start`),text:It,requestId:zt}),S({action:R([`status`,`pause`,`resume`,`stop`,`stop-ask`,`new`]),confirmed:T(L)}),S({})]),Ht=S({loop:X}),Ut=S({sessionId:Ft,loopId:X.fields.loopId}),Wt={id:M.make(`botanical-session-loop`),commands:{list:{scope:`agent`,input:Rt,output:N(S({...X.fields,sessionId:Ft})).pipe(E(z(64)))},pauseLoop:{scope:`agent`,input:Ut,output:X},resumeLoop:{scope:`agent`,input:Ut,output:X},stopLoop:{scope:`agent`,input:Ut,output:X},loop:{scope:`session`,input:Vt,output:q},startSelfPaced:{scope:`session`,input:S({prompt:It,requestId:zt}),output:Bt},startFixedInterval:{scope:`session`,input:S({prompt:It,requestId:zt,...Lt.fields}),output:Bt},pause:{scope:`session`,input:S({}),output:X},resume:{scope:`session`,input:S({}),output:X},stop:{scope:`session`,input:S({}),output:X}},projection:{schema:Ht}},Gt=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=60?t:`${t.slice(0,59)}…`},Kt=e=>e.state===`failed`?`error`:e.state===`active`?`running`:e.state===`paused`?`muted`:`settled`,qt=e=>new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,timeZoneName:`short`}).format(e),Jt=V(Wt,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{loop:t}=e.value,n=t.state===`active`&&t.nextDueAt!==null;return{chips:t.state!==`active`&&t.state!==`paused`?[]:[{id:`loop`,order:2,row:{id:`loop`,title:`Loop ${t.mode===`self_paced`?`self-paced`:`fixed`}${n?` (waiting)`:``}`,tone:Kt(t)}}],panel:[{id:`loop`,title:`Loop · ${t.state} · ${t.mode===`self_paced`?`self-paced`:`${t.cron?.expression??`fixed`} ${t.cron?.timeZone??``}`}${t.nextDueAt===null?``:` · Next ${qt(t.nextDueAt)}`} · ${Gt(t.prompt)}`,detail:[t.reason,t.prompt].filter(e=>e!==null).join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{E as t,Fr as n,Lr as r,Mr as i,Nr as a,Oi as o,Pr as s,Tr as c,an as l,c as u,g as d,gi as f,ji as p,jr as m,u as ee,yr as h}from"./sigil-CwDKTeeQ.js";import{Ea as g,Ta as te,Zi as _,_a as v,ar as y,ba as ne,da as re,fa as ie,ht as ae,ra as oe,sr as se,xa as b,ya as ce}from"./Effect-CsknxyoC.js";import{Ai as x,Bi as le,Ci as S,Dr as ue,Hi as C,Ji as w,Ma as de,Na as T,Ni as E,Pa as D,Pi as fe,Si as O,Ta as k,Wi as pe,Zi as me,_a as A,_i as he,bi as ge,fi as j,i as M,ii as N,ji as _e,ka as P,kr as ve,la as F,li as I,oa as ye,oi as L,pa as be,pi as R,ri as xe,ti as Se,ui as Ce,xa as z,xi as we,yi as B}from"./extension-hook-C8EcEsru.js";import{a as Te,c as Ee,d as V,i as De,l as Oe,n as ke,o as Ae,r as je,s as Me,u as Ne}from"./parakeet-CQ3Gd-gj.js";import{_ as Pe,g as H,h as Fe,m as Ie,p as Le,t as Re,v as ze,y as Be}from"./index-B9JPxELm.js";var U=e(p(),1),W=f(),G=O.check(k(1),z(256)),Ve=I.check(F(1),A(2**53-1)),He=I.check(F(0),A(2**53-1)),Ue=R([`write`,`external`]),We=S({module:B(G),access:Ue}),Ge=S({agentId:B(G)}),Ke=S({principalId:G,agentId:B(G),sessionId:B(G),displayName:G}),qe=S({title:O.check(k(1),z(512)),inputBytes:I.check(F(0)),inputSha256:O.check(P(/^[a-f0-9]{64}$/))}),Je=S({kind:j(`pending_approval`),recordId:G,description:qe}),Ye=R([`requested`,`pending`,`approved`,`claimed`,`applied`,`denied`,`expired`,`outcome_unknown`]),Xe=R([`not-found`,`not-eligible`,`already-answered`,`stale-revision`,`expired`,`declined`,`fenced`,`not-granted`,`read-only`,`pending`,`in-flight`,`outcome-unknown`,`identity-conflict`]),Ze=O.check(k(1),z(512),P(/^(?=.*\S)[^\p{Cc}\u2028\u2029]*$/u)),Qe=N(S({kind:j(`artifact`),ref:O.check(P(/^sha256:[a-f0-9]{64}$/)),mediaType:j(`image/png`),bytes:I.check(F(1),A(5242880))})).check(z(4)),$e=S({recordId:G,requester:Ke,module:G,operation:G,access:Ue,description:qe,evidence:D(Qe),authorityFence:G,reversibility:R([`reversible`,`irreversible-external`]),state:Ye,by:B(x([S({kind:j(`human`),memberId:G}),S({kind:j(`policy`)})])),reason:B(Xe),denialNote:D(Ze),requestedAt:He,expiresAt:He,updatedAt:He,revision:Ve}),et=S({record:$e,canAnswer:L,canSetAutoApprove:L});S({state:D(Ye),cursor:D(G),limit:D(I.check(F(1),A(100)))}),S({recordId:G}),S({recordId:G,decision:R([`approve`,`deny`]),expectedRevision:Ve,denialNote:D(Ze)});var tt=S({scope:Ge,family:We,enabled:L}),nt=S({kind:j(`refused`),reason:Xe,denialNote:D(Ze)});C(w($e),{onExcessProperty:`error`}),pe(w($e)),C(S({record_json:O})),C(w(Ce)),pe(w(Ce)),C(S({input_json:O,output_json:B(O)}));var rt=nt,it=S({items:N(et),nextCursor:B(O)}),at=x([S({kind:j(`answered`),view:et}),rt]),ot=x([S({kind:j(`updated`),rule:tt}),rt]),K=e=>Ie(te().transform(t=>C(e,{onExcessProperty:`error`})(t))),st=ze(`approvals`,1,ie(()=>Fe({list:H(K(it)),get:H(K(B(et))),answer:H(K(at)),setAutoApprove:H(K(ot))}))),ct=(e,t)=>{if(e.length<=t)return e;let n=Math.max(1,Math.floor((t-1)/2));return`${e.slice(0,n)}…${e.slice(-(t-n-1))}`},lt=(e,t)=>e.length<=t?e:`${e.slice(0,t-1)}…`,ut=e=>e.map(([e,t])=>({label:e,value:t}));function dt(e,t){let{record:n}=e,r=Math.max(0,n.expiresAt-t);return[[`Agent`,`${n.requester.displayName} · ${n.requester.agentId??`none`}`],[`Session`,n.requester.sessionId??`none`],[`Requester`,n.requester.principalId],[`Request`,`${n.module}.${n.operation} · ${n.access}`],[`Input`,`${n.description.inputBytes.toLocaleString()} bytes · SHA-256 ${n.description.inputSha256.slice(0,8)}…${n.description.inputSha256.slice(-6)}`],[`Expires`,`in ${String(Math.floor(r/36e5))} h ${String(Math.floor(r%36e5/6e4))} m`],[`Record`,`${n.recordId} · revision ${String(n.revision)}`]]}function ft(e){return[`Undo`,e.record.reversibility===`irreversible-external`?`Can't be undone`:`Can be undone`]}function pt(e,t){let{record:n}=e;return{content:{title:`Allow ${n.module} · ${n.operation}?`,summary:`${n.requester.displayName} wants to use a connected tool.`,facts:[{label:`Effect`,value:(n.access===`write`?`Changes data in Fungi`:`Changes things outside Fungi`)+(n.reversibility===`irreversible-external`?` · can't be undone`:``)}],details:ut([ft(e),...dt(e,t)])}}}function mt(e,t,n,r,i){let a=t.prefix?.join(` `),o=a!==void 0&&t.alwaysAllowUnavailableReason===void 0,s=t.command,c=`Allow \`${s}\`?`.length<=n?`Allow \`${s}\`?`:`Allow this command?`,l=t.cwd===r?`~`:t.cwd.startsWith(`${r}/`)?`~${t.cwd.slice(r.length)}`:t.cwd,u=Math.max(8,(n-8)*2-2),d=t.justification.length<=u?`“${t.justification}”`:`“${t.justification.slice(0,u-1)}…”`,f=[[`Folder`,ct(l,Math.max(8,n-10))],[`Why`,d]];t.kind===`extension-install`&&f.push([`Note`,`Extensions run inside Fungi with access to every Agent.`]),o&&t.alwaysAllowCoverage!==void 0&&f.push([`Scope`,lt(t.alwaysAllowCoverage,Math.max(8,n-12))]),!o&&t.warning!==void 0&&f.push([`Warning`,t.warning]);let p=o?`Always allow “${ct(a,Math.max(8,n-5-32))}” in this project…`:void 0,m=[[`Command`,s]];return t.argv!==void 0&&m.push([`Arguments`,JSON.stringify(t.argv)]),m.push([`Folder`,t.cwd],[`Runs`,`Outside the sandbox, as you`],ft(e)),!o&&t.alwaysAllowUnavailableReason!==void 0?m.push([`Rule`,t.alwaysAllowUnavailableReason]):t.form===`shell`?m.push([`Rule`,`Shell command: no Always-allow rule can match it.`]):o&&(m.push([`Rule`,`“${a}” would match \`${a} …\` in this project`]),t.alwaysAllowCoverage!==void 0&&m.push([`Coverage`,t.alwaysAllowCoverage]),t.risk!==void 0&&m.push([`Risk`,t.risk.detail])),!o&&t.warning!==void 0&&m.push([`Warning`,t.warning]),m.push(...dt(e,i)),{content:{title:c,body:c===`Allow this command?`?s:void 0,bodyLabel:c===`Allow this command?`?`Command`:void 0,summary:`${e.record.requester.displayName} wants to run this outside the sandbox, as you.`,facts:ut(f),details:ut(m)},always:p===void 0?void 0:lt(p,Math.max(12,n-5)),confirmation:o?{title:`Always allow “${a}” in this project?`,body:lt(t.alwaysAllowCoverage??`Any Workspace Agent here can then run \`${a} …\` without asking.`,Math.max(12,(n-8)*2-2))}:void 0,confirmWarning:o?t.risk?.summary:void 0,confirmYes:o?`Always allow “${a}” and run it now`:void 0}}function ht(e,t,n){let r=Math.min(n.width,60);return t===void 0?pt(e,n.now):mt(e,t,r,n.home,n.now)}function gt(e,t){switch(e){case`stale-revision`:case`already-answered`:return`This request changed. Look again before answering.`;case`expired`:return`This request expired. Nothing ran.`;case`not-eligible`:if(t===`always-allow`)return`Always allow isn't available for this command. Approve once or deny.`}return`Couldn't answer (${e}). Nothing ran.`}var _t=`Couldn't send your answer. It may not have been recorded.`;async function vt(e,t){let{view:n,source:r}=t,i=ht(n,r.review,{width:t.width,home:t.home,now:t.now}),a=n.record;try{let n,o,s=!1;for(;n===void 0;){let c=await e.prompt({type:`decision`,message:i.content.title,summary:s?`Automatic approval is on for this family.`:i.content.summary,facts:i.content.facts?.map(e=>({...e})),body:i.content.body,bodyLabel:i.content.bodyLabel,details:i.content.details?.map(e=>({...e})),options:[{value:`approve`,label:`Approve once`},...i.always===void 0?[]:[{value:`always`,label:i.always}],...r.family===void 0||s?[]:[{value:`family`,label:r.family.label}],{value:`deny`,label:`Deny`}],other:{label:`Deny and say why…`,placeholder:`A short reason for the Agent (optional)`,maxLength:t.noteLimit,blank:`deny`}});if(!t.stillCurrent())return{kind:`abandoned`};if(c.text!==void 0)o=c.text.trim()||void 0,n=`deny`;else if(c.selected[0]===`always`){let r=i.confirmation,a=await e.prompt({type:`decision`,message:r?.title??i.content.title,summary:i.confirmWarning,body:r?.body,options:[{value:`back`,label:`Back`},{value:`always-allow`,label:i.confirmYes??`Always allow`}],escape:`back`});if(!t.stillCurrent())return{kind:`abandoned`};a.selected[0]===`always-allow`&&(n=`always-allow`)}else if(c.selected[0]===`family`&&r.family!==void 0){let n=await e.prompt({type:`decision`,message:`${r.family.label}?`,summary:`Later ${a.module} requests that ${a.access===`write`?`change data in Fungi`:`reach outside Fungi`} will run without asking.`,options:[{value:`back`,label:`Back`},{value:`family`,label:r.family.label}],escape:`back`});if(!t.stillCurrent()||n.selected[0]===`family`&&(s=await r.family.enable(),!t.stillCurrent()))return{kind:`abandoned`}}else c.selected[0]===`approve`?n=`approve`:c.selected[0]===`deny`&&(n=`deny`)}let c={recordId:a.recordId,decision:n,expectedRevision:a.revision},l=await r.answer(o===void 0?c:{...c,denialNote:o});return t.stillCurrent()?l.kind===`refused`?{kind:`refused`,message:gt(l.reason??`unknown`,n)}:{kind:`answered`}:{kind:`abandoned`}}catch(n){return e.signal.aborted?{kind:`abandoned`}:(t.onFailure(n),{kind:`refused`,message:_t})}}var yt=()=>void 0,bt=()=>()=>void 0;function xt(e){let{source:t,store:n,enabled:r,home:i,width:a,noteLimit:o,onFailure:s}=e,c=(0,U.useRef)(s);c.current=s;let l=(0,U.useRef)({home:i,width:a,noteLimit:o});l.current={home:i,width:a,noteLimit:o};let u=(0,U.useSyncExternalStore)(t?.subscribe??bt,t?.snapshot??yt),d=(0,U.useRef)(u);d.current=u;let f=u===void 0?void 0:JSON.stringify([`approval`,u.record.recordId,u.record.revision,u.canAnswer]);(0,U.useEffect)(()=>{let e=d.current;if(!r||t===void 0||e===void 0||!e.canAnswer||f===void 0)return;let{home:i,width:a,noteLimit:o}=l.current,s=Oe({title:`Approval`}),u=s.begin(),p=()=>{let n=t.snapshot();return!u.interaction.signal.aborted&&n?.record.recordId===e.record.recordId&&n.record.revision===e.record.revision&&n.canAnswer},m=n.awaiting.add({key:f,kind:`approval`,arrivedAt:Date.now(),host:s});return vt(u.interaction,{view:e,source:t,home:i,width:a,now:Date.now(),noteLimit:o,stillCurrent:p,onFailure:e=>{c.current(e)}}).then(e=>{e.kind===`refused`?u.settle({status:`failed`,message:e.message}):(m(),u.settle(e.kind===`answered`?{status:`handled`}:{status:`cancelled`}))}),()=>{m(),s.cancel()}},[t,f,r,n])}var q=fe(e=>Ne.safeParse(e).success,{representation:{id:`@fungi.computer/whistle/catalog-step/v1`,payload:null}});ae(()=>xe());var St=O.pipe(E(k(1)),E(z(4e3)),E(P(/\S/u,{message:`Goal objective is blank`}))),Ct=O.pipe(E(k(1)),E(z(1e3)),E(P(/\S/u))),wt=O.pipe(E(k(1)),E(z(256))),Tt=I.check(F(0)),Et=S({kind:R([`person`,`delegator`,`blocked`,`stalled`,`cancelled`,`failed`,`no-terminal`]),detail:B(O)}),J=S({revision:O,objective:St,state:R([`active`,`paused`]),startedAt:Tt,pauseCause:B(Et)}),Dt=S({sequence:I.check(ye(0)),objective:St,outcome:R([`achieved`,`cleared`]),reason:B(Ct),clearedBy:D(he.check(z(256))),endedAt:Tt,afterSequence:I.check(F(0))}),Ot=x([S({action:j(`set`),objective:St,requestId:wt,expectedRevision:T(B(O)),confirmed:T(L)}),S({action:R([`pause`,`resume`,`replace`,`clear`,`clear-ask`]),confirmed:T(L)}),S({})]),kt=S({goal:B(J),ended:N(Dt).check(z(16)),omitted:I.check(F(0))}),At={id:M.make(`botanical-session-goal`),commands:{controlAgent:{scope:`session`,input:S({action:R([`pause`,`resume`,`clear`]),reason:Ct}),output:x([S({result:j(`paused`),goal:J}),S({result:j(`resumed`),goal:J}),S({result:j(`cleared`)}),S({result:j(`no_goal`)}),S({result:j(`refused`),reason:R([`not_delegator`,`not_paused_by_delegator`])})])},goal:{scope:`session`,input:Ot,output:q},pause:{scope:`session`,input:S({}),output:J},resume:{scope:`session`,input:S({}),output:J},clear:{scope:`session`,input:S({}),output:S({})},set:{scope:`session`,input:S({objective:St,expectedRevision:B(O),requestId:wt,adoptCommandId:D(wt)}),output:S({goal:J,accepted:S({status:j(`accepted`),commandId:O})})}},projection:{schema:kt}},Y=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=80?t:`${t.slice(0,79)}…`},jt=e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`};function Mt(e){let t=e.state===`active`,n=t?`Pursuing goal since ${jt(e.startedAt)}`:e.pauseCause?.kind===`delegator`?`Goal paused by ${Y(e.pauseCause.detail??`delegator`)} (/goal resume)`:`Goal paused (/goal resume)`,r=!t&&e.pauseCause?.kind!==`delegator`&&e.pauseCause?.detail!=null?[Y(e.pauseCause.detail)]:[],i={id:`goal`,title:[n,Y(e.objective),...r].join(` · `),tone:t?`running`:`muted`,actions:[{id:`goal`,label:t?`Pause goal`:`Resume goal`,input:{action:t?`pause`:`resume`}}]};return Y(e.objective)===e.objective?i:{...i,detail:e.objective.slice(0,1024)}}function Nt(e){let t={id:`goal-ended`,title:`${e.outcome===`achieved`?`Goal achieved`:`Goal cleared`} · ${Y(e.objective)}`,tone:e.outcome===`achieved`?`settled`:`muted`},n=e.reason===null?t:{...t,detail:e.reason};return{id:String(e.sequence),sequence:e.sequence,at:e.endedAt,commandId:null,afterSequence:e.afterSequence,rows:[n]}}var Pt=V(At,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{goal:t,ended:n,omitted:r}=e.value;return{chips:[],panel:t===null?[]:[Mt(t)],timeline:{cells:n.map(Nt),omitted:r},waiting:null}}}),Ft=O.pipe(E(k(1)),E(z(256))),It=O.pipe(E(k(1)),E(z(262144))),Lt=S({expression:O.pipe(E(k(1)),E(z(256))),timeZone:O.pipe(E(k(1)),E(z(128)))}),X=S({loopId:O,origin:R([`human`,`model`]),expiresAt:B(I),prompt:It,mode:R([`self_paced`,`fixed_interval`]),cron:B(Lt),state:R([`active`,`paused`,`finished`,`failed`,`cancelled`]),commandId:O,reason:B(O),nextDueAt:B(I),lastError:B(O),consecutiveFailures:I.pipe(E(F(0)))}),Rt=S({after:D(Ft),limit:D(I.pipe(E(me({minimum:1,maximum:64}))))}),zt=O.pipe(E(k(1)),E(z(200))),Bt=S({loop:X,accepted:S({status:j(`accepted`),commandId:O})}),Vt=x([S({action:j(`start`),text:It,requestId:zt}),S({action:R([`status`,`pause`,`resume`,`stop`,`stop-ask`,`new`]),confirmed:T(L)}),S({})]),Ht=S({loop:X}),Ut=S({sessionId:Ft,loopId:X.fields.loopId}),Wt={id:M.make(`botanical-session-loop`),commands:{list:{scope:`agent`,input:Rt,output:N(S({...X.fields,sessionId:Ft})).pipe(E(z(64)))},pauseLoop:{scope:`agent`,input:Ut,output:X},resumeLoop:{scope:`agent`,input:Ut,output:X},stopLoop:{scope:`agent`,input:Ut,output:X},loop:{scope:`session`,input:Vt,output:q},startSelfPaced:{scope:`session`,input:S({prompt:It,requestId:zt}),output:Bt},startFixedInterval:{scope:`session`,input:S({prompt:It,requestId:zt,...Lt.fields}),output:Bt},pause:{scope:`session`,input:S({}),output:X},resume:{scope:`session`,input:S({}),output:X},stop:{scope:`session`,input:S({}),output:X}},projection:{schema:Ht}},Gt=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=60?t:`${t.slice(0,59)}…`},Kt=e=>e.state===`failed`?`error`:e.state===`active`?`running`:e.state===`paused`?`muted`:`settled`,qt=e=>new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,timeZoneName:`short`}).format(e),Jt=V(Wt,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{loop:t}=e.value,n=t.state===`active`&&t.nextDueAt!==null;return{chips:t.state!==`active`&&t.state!==`paused`?[]:[{id:`loop`,order:2,row:{id:`loop`,title:`Loop ${t.mode===`self_paced`?`self-paced`:`fixed`}${n?` (waiting)`:``}`,tone:Kt(t)}}],panel:[{id:`loop`,title:`Loop · ${t.state} · ${t.mode===`self_paced`?`self-paced`:`${t.cron?.expression??`fixed`} ${t.cron?.timeZone??``}`}${t.nextDueAt===null?``:` · Next ${qt(t.nextDueAt)}`} · ${Gt(t.prompt)}`,detail:[t.reason,t.prompt].filter(e=>e!==null).join(`
|
|
2
2
|
`).slice(0,1024),tone:Kt(t)},...t.lastError===null?[]:[{id:`error`,title:t.lastError.slice(0,4096),tone:`error`}]],timeline:{cells:[],omitted:0},waiting:n?{summary:`Waiting until ${qt(t.nextDueAt)}`,cancel:{id:`loop`,label:`stop loop`,input:{action:`stop-ask`}}}:null}}});function Yt(e){return S({nextSequence:I.check(ye(0)),omitted:I.check(F(0)),events:N(S({id:O,sequence:I,at:I,commandId:B(O),event:e}))})}new TextEncoder;var Xt=S({explanation:D(O.pipe(E(z(2e3)))),steps:N(S({step:O.pipe(E(k(1)),E(z(500))),status:R([`pending`,`in_progress`,`completed`])})).pipe(E(z(50)))});Xt.pipe(E(de(e=>e.steps.filter(e=>e.status===`in_progress`).length<=1||`At most one plan step may be in progress`)));function Zt(e){return e.steps.some(e=>e.status!==`completed`)}var Qt=S({plan:Xt,history:Yt(Xt)}),$t=x([S({action:j(`clear`)}),S({})]),en={id:M.make(`botanical-session-plan`),commands:{plan:{scope:`session`,input:$t,output:q}},projection:{schema:Qt}},tn=e=>{let t=e.steps.findIndex(e=>e.status===`in_progress`),n=e.steps.filter(e=>e.status===`completed`).length;return{title:(t<0?e.steps.find(e=>e.status===`pending`):e.steps[t])?.step??`Plan complete`,detail:`${String(t<0?n:t+1)}/${String(e.steps.length)}`}},nn=e=>e.steps.map((e,t)=>({id:String(t),title:e.step,tone:e.status===`completed`?`settled`:e.status===`in_progress`?`running`:`muted`})),rn=V(en,{contribute:e=>({chips:[],panel:e.status!==`running`||e.value===null||!Zt(e.value.plan)?[]:[{id:`plan`,...tn(e.value.plan),actions:[{id:`plan`,label:`Clear plan`,input:{action:`clear`}}],inspection:{commandId:`plan`,title:`Plan`,rows:nn(e.value.plan)}}],timeline:{cells:[],omitted:0},waiting:null})}),Z=e=>O.check(k(1),z(e),P(/\S/u)),an=S({id:Z(32).check(P(/^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/u)),header:Z(12),question:Z(1e3),options:N(S({label:Z(60),description:Z(300)})).check(k(2),z(4),de(e=>new Set(e.map(e=>e.label)).size===e.length||`Option labels must be unique`,{representation:{id:`botanical/ask/unique-option-labels`,payload:null}})),multiple:D(L)}),on=N(an).check(k(1),z(4),de(e=>new Set(e.map(e=>e.id)).size===e.length||`Question ids must be unique`,{representation:{id:`botanical/ask/unique-question-ids`,payload:null}})),sn=S({askId:O,waitingOn:D(ve),escalated:D(ue),questions:on,status:R([`live`,`parked`]),createdAt:ge,expiresAt:B(ge)}),cn=S({asks:N(sn).check(z(4))}),ln=Z(256),un=we(an.fields.id,S({selected:N(Z(60)).check(z(4)),text:D(O.check(z(4e3)))})),dn=S({askId:Z(256),requestId:ln,answers:un}),fn=S({askId:Z(256),requestId:ln,note:D(O.check(z(4e3)))}),pn=R([`answered`,`declined`,`withdrawn`,`expired`,`cancelled`,`undeliverable`]),mn=x([S({result:j(`accepted`),via:R([`in_turn`,`follow_up`]),commandId:D(Z(256))}),S({result:j(`closed`),status:pn}),S({result:j(`not_found`)})]),hn=S({result:j(`refused`),reason:j(`not_sender`)}),gn=x([mn,hn]),_n=S({kind:j(`agent`),agentId:Z(256)}),vn=x([S({result:j(`escalated`),to:j(`agent`),waitingOn:ve}),S({result:j(`escalated`),to:j(`person`)}),S({result:j(`closed`),status:pn}),S({result:j(`not_found`)}),hn]),yn=S({askId:Z(256),note:T(O.check(z(1e3)))}),bn={askId:dn.fields.askId,requestId:ln,index:ge.check(be(),me({minimum:0,maximum:3})),answers:un},xn=x([S({stage:j(`decision`),...bn,answer:un.value}),S({askId:dn.fields.askId}),S({})]),Sn={id:M.make(`botanical-session-question`),commands:{answerFlow:{scope:`session`,input:xn,output:q},answer:{scope:`session`,input:dn,output:mn},answerAgent:{scope:`session`,input:dn,output:S({result:gn,answeredBy:_n})},escalateAgent:{scope:`session`,input:yn,output:vn},decline:{scope:`session`,input:fn,output:mn},list:{scope:`session`,input:S({}),output:cn}},projection:{schema:cn}},Cn=V(Sn,{contribute:e=>({chips:[],panel:e.status!==`running`||e.value===null?[]:e.value.asks.map(e=>{let t=e.questions[0],n=`${t?.question??`Question`}${e.questions.length>1?` (+${String(e.questions.length-1)} more)`:``}`,r=t?.options.map(e=>e.label).join(` · `)??``;if(e.escalated!==void 0){let{by:t,reason:i,note:a}=e.escalated;n=`${i===`escalated`?`escalated by ${t.name}`:i===`sender_archived`?`${t.name} archived`:`${t.name} is gone`} · ${n}`,a!==void 0&&(r=`${r}\n${a}`)}return e.waitingOn===void 0?{id:e.askId,title:n,detail:r,tone:`attention`,actions:[{id:`answerFlow`,label:`Answer`,input:{askId:e.askId},awaiting:`question`}]}:{id:e.askId,title:`waiting on ${e.waitingOn.name} · ${n}`,detail:r,tone:`muted`,actions:[{id:`answerFlow`,label:`Answer`,input:{askId:e.askId}}]}}),timeline:{cells:[],omitted:0},waiting:null})}),Q=O.check(k(1),z(256)),wn=R([`escalated`,`sender_archived`,`sender_absent`]),Tn=R([`working`,`waiting_on_agent`,`needs_you`,`idle`,`failed`,`unavailable`]),En=S({agentId:Q,name:Q,sessionId:B(Q),state:Tn,attention:D(O.check(z(200))),waitingOn:D(Q),escalated:D(S({by:Q,reason:wn})),ask:D(S({askId:Q,questions:on}))}),Dn=S({agents:N(En).check(z(16)),more:I.check(F(0)),uncounted:I.check(F(0)),counts:S({working:I.check(F(0)),waiting_on_agent:I.check(F(0)),needs_you:I.check(F(0)),idle:I.check(F(0)),failed:I.check(F(0)),unavailable:I.check(F(0))}),escalated:I.check(F(0)),waitingOn:N(S({name:Q,count:I.check(ye(0))})),escalatedBy:N(S({name:Q,reason:wn,count:I.check(ye(0))})),expanded:L}),On={agentId:Q,sessionId:Q},kn=x(xn.members.map(e=>S({...e.fields,...On}))),An={agents:{scope:`session`,input:S({}),output:q},answerChild:{scope:`session`,input:kn,output:q}},jn={id:M.make(`botanical-session-subagents`),commands:An,projection:{schema:Dn}};function Mn(e){if(e!==void 0)return e.reason===`escalated`?`escalated by ${e.by}`:e.reason===`sender_archived`?`${e.by} archived`:`${e.by} is gone`}var $={working:{label:`working`,tone:`running`,status:`info`},waiting_on_agent:{label:`waiting`,tone:`muted`,status:`neutral`},needs_you:{label:`needs you`,tone:`attention`,status:`warning`},idle:{label:`idle`,tone:`settled`,status:`success`},failed:{label:`failed`,tone:`error`,status:`error`},unavailable:{label:`unavailable`,tone:`muted`,status:`neutral`}};function Nn(e){let t=e.state===`waiting_on_agent`?`waiting on ${e.waitingOn??`its parent`}`:$[e.state].label,n=Mn(e.escalated);return n===void 0?t:`${t} · ${n}`}function Pn(e){let t=$[e.state],n={id:e.agentId,title:`${e.name} · ${Nn(e)}`,tone:t.tone,status:{label:Nn(e),tone:t.status}},r=e.ask?.questions[0]?.question??e.attention,i=r===void 0?n:{...n,detail:r.slice(0,200)};if(e.sessionId===null)return{...i,detail:e.attention??`not messaged yet`};let a={...i,open:{params:[{key:`agent`,value:e.agentId},{key:`session`,value:e.sessionId}]}};if(e.ask===void 0)return a;let o={id:`answerChild`,label:`Answer`,input:{agentId:e.agentId,sessionId:e.sessionId,askId:e.ask.askId}};return{...a,actions:[e.state===`needs_you`?{...o,awaiting:`question`}:o]}}function Fn(e){let t=t=>e.counts[t],n=e.waitingOn.map(({name:e,count:t})=>`${String(t)} waiting on ${e}`),r=e.escalatedBy.map(({name:n,reason:r,count:i})=>{let a=Mn({by:n,reason:r});return e.escalated===t(`needs_you`)&&e.escalatedBy.length===1?a:`${String(i)} ${a}`}),i=r.length===0?`needs you`:`needs you (${r.join(`; `)})`,a=[...[`working`].map(e=>[e,t(e)]).filter(([,e])=>e>0).map(([e,t])=>`${String(t)} ${$[e].label}`),...n,...[`needs_you`,`failed`,`unavailable`].map(e=>[e,t(e)]).filter(([,e])=>e>0).map(([e,t])=>`${String(t)} ${e===`needs_you`?i:$[e].label}`)],o=t(`working`)+t(`needs_you`),s=t(`needs_you`)>0?`attention`:t(`failed`)>0?`error`:t(`working`)>0?`running`:`muted`;return{id:`summary`,title:[`${String(o)} sub-agent${o===1?``:`s`}`,...a,...e.uncounted>0?[`${String(e.uncounted)} not read`]:[],`/agents shows them`].join(` · `),tone:s}}var In=V(jn,{contribute:e=>({chips:[],panel:e.status!==`running`||e.value===null?[]:e.value.agents.length>0&&!e.value.expanded?[Fn(e.value)]:[...e.value.agents.map(Pn),...e.value.more===0&&e.value.uncounted===0?[]:[{id:`more`,title:[...e.value.more===0?[]:[`${String(e.value.more)} more sub-agent${e.value.more===1?``:`s`}`],...e.value.uncounted===0?[]:[`${String(e.value.uncounted)} not read`]].join(` · `),tone:`muted`}]],timeline:{cells:[],omitted:0},waiting:null})});function Ln(e,t){if(e===null||!URL.canParse(t))return!1;let n=new URL(t);return n.protocol!==`https:`||n.hash!==`#team-billing`?!1:(e.openTeamBilling().catch(t=>(console.error(`Chat Billing navigation failed`,t),e.showToast({message:`Billing could not be opened. Please try again.`,tone:`error`}))),!0)}function Rn(e,t){e!==null&&e.showToast({message:t.message,tone:t.variant}).catch(e=>{console.error(`Chat toast failed`,e)})}function zn(e){if(e.name!==`execute`||e.status!==`completed`)return;let t=e.result?.content;if(t?.length!==1||t[0]?.type!==`text`)return;let n=le(w(_e))(t[0].text);if(y(n))return;let r=l.safeParse(n.value);return r.success?r.data.file:void 0}function Bn({item:e,ui:t}){let n=zn(e),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1);if(!n)return null;let s=async()=>{i(!0),o(!1);try{await t.openNavigation(n)}catch(e){console.error(`Chat file navigation failed`,e),o(!0)}finally{i(!1)}};return(0,W.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,W.jsx)(h,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void s(),type:`button`,children:r?`Opening file…`:`Open ${n.path} in Inkcap`}),a?(0,W.jsx)(`p`,{role:`alert`,children:`The file could not be opened. Try again.`}):null]})}var Vn=x([S({kind:j(`compose`),text:O.pipe(E(k(1)),E(z(2e3)))}),S({kind:j(`navigate`),params:N(S({key:O.pipe(E(k(1)),E(z(64))),value:O.pipe(E(z(1024)))})).pipe(E(z(16)))})]);x([S({role:O.pipe(E(k(1)),E(z(80))),intent:Vn}),S({appId:O.pipe(E(k(1)),E(z(128))),intent:Vn})],{mode:`oneOf`});var Hn=ne({displayName:b().min(1).max(80).nullable()}).nullable(),Un=ze(`apps.open`,1,ie(()=>Fe({open:Pe,role:H(Ie(Hn))}))),Wn=(e,t)=>e.require(Un).open(t);ze(`apps.call`,1,ie(()=>Fe({call:H(Ie(te().transform(e=>o(e))))})));var Gn=v({printId:b().min(1).max(256),destination:ne({computerId:b().min(1),path:b().min(1)}),format:_([`png`,`jpeg`,`gif`,`webp`])}),Kn=re(),qn=oe(Kn).or(ce(b(),Kn).transform(e=>Object.values(e)));function Jn(e,t){let n=Gn.safeParse(e);if(n.success)return[n.data];if(t>=3)return[];let r=qn.safeParse(e);return r.success?r.data.flatMap(e=>Jn(e,t+1)):[]}var Yn=Kn.transform(e=>Jn(e,0)).pipe(oe(Gn).min(1).max(8));function Xn(e){if(e.name!==`execute`||e.status!==`completed`||e.result===void 0)return;let t=e.result.content,n=t.at(0);if(n?.type!==`text`||t.slice(1).some(e=>e.type!==`image`))return;let r=le(w(_e))(n.text);if(y(r))return;let i=Yn.safeParse(r.value);return i.success?i.data:void 0}function Zn(e){return Xn(e)!==void 0}function Qn({printId:e,pictures:t,capabilities:n}){let[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),s=async()=>{i(!0),o(!1);try{await Wn(n,{role:`media`,intent:{kind:`navigate`,params:[{key:`print`,value:e}]}})}catch(e){console.error(`Chat print navigation failed`,e),o(!0)}finally{i(!1)}};return(0,W.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-3 py-2`,children:[t.map((e,t)=>(0,W.jsx)(`img`,{alt:`Panel saved in Prints`,className:`max-w-full rounded-box`,src:`data:${e.mimeType};base64,${e.data}`,style:{maxHeight:320}},t)),(0,W.jsx)(h,{variant:`outline`,size:`sm`,disabled:r,onClick:()=>void s(),type:`button`,children:r?`Opening Prints…`:`Open in Prints`}),a?(0,W.jsx)(`p`,{role:`alert`,children:`Prints could not be opened. Try again.`}):null]})}function $n({item:e,capabilities:t}){let n=Xn(e);if(n&&t){let r=(e.result?.content??[]).flatMap(e=>e.type===`image`?[e]:[]),i=r.length===n.length;return(0,W.jsx)(W.Fragment,{children:n.map((e,n)=>(0,W.jsx)(Qn,{printId:e.printId,pictures:i?r.slice(n,n+1):n===0?r:[],capabilities:t},e.printId))})}return null}var er=le(w(Je),{onExcessProperty:`error`});function tr(e){if(!(e.status!==`completed`||e.result?.isError))for(let t of e.result?.content??[]){if(t.type!==`text`)continue;let e=er(t.text);if(se(e))return e.value.recordId}}var nr=(0,U.createContext)(void 0);function rr(){return(0,U.useContext)(nr)}var ir=`Couldn't send your answer. It may not have been recorded.`;function ar({recordId:e,attempt:t,capabilities:n,agentId:r,publish:i}){let a=Me(),[o,s]=(0,U.useState)(),c=(0,U.useRef)(void 0),l=(0,U.useRef)(new Set),u=(0,U.useCallback)(t=>{c.current=t??void 0,s(t),i(e,{view:t,failed:!1});for(let e of l.current)e()},[i,e]);(0,U.useEffect)(()=>{c.current=void 0,s(void 0)},[n]),(0,U.useEffect)(()=>{let t=!0;async function r(){try{let r=await n.require(st).get({recordId:e});t&&u(r)}catch(n){console.warn(`Grove could not read the approval`,n),t&&i(e,{view:null,failed:!0})}}return r(),()=>{t=!1}},[n,e,t,u,i]);let d=o?.canAnswer===!0&&o.record.state===`pending`,f=o?.canSetAutoApprove===!0,p=o?.record.module,m=o?.record.access;return xt({source:(0,U.useMemo)(()=>{if(d)return{snapshot:()=>c.current,subscribe:e=>(l.current.add(e),()=>{l.current.delete(e)}),answer:async e=>{let t=n.require(st),r=e.decision===`always-allow`?void 0:{recordId:e.recordId,decision:e.decision,expectedRevision:e.expectedRevision};if(r===void 0)return{kind:`refused`,reason:`not-eligible`};let i=await t.answer(e.denialNote===void 0?r:{...r,denialNote:e.denialNote});return i.kind===`answered`&&u(i.view),i},family:!f||p===void 0||m===void 0?void 0:{label:`Always approve this family`,enable:async()=>(await n.require(st).setAutoApprove({scope:{agentId:r},family:{module:p,access:m},enabled:!0})).kind===`updated`}}},[d,n,r,f,p,m,u]),store:a,enabled:!0,home:``,width:72,noteLimit:512,onFailure:or}),null}function or(e){console.warn(ir,e)}function sr({capabilities:e,agentId:t,children:n}){let r=Ee(),i=(0,U.useMemo)(()=>{let e=new Set;for(let t of[...r.settled,...r.tail])if(t.kind===`tool_group`)for(let n of t.tools){let t=tr(n);t!==void 0&&e.add(t)}return[...e]},[r.settled,r.tail]),[a,o]=(0,U.useState)(new Map),[s,c]=(0,U.useState)(new Map),l=(0,U.useCallback)((e,t)=>{o(n=>new Map(n).set(e,t))},[]),u=(0,U.useMemo)(()=>({entry:e=>a.get(e),refresh:e=>{c(t=>new Map(t).set(e,(t.get(e)??0)+1))},agentId:t}),[a,t]);return(0,W.jsxs)(nr.Provider,{value:e===void 0?void 0:u,children:[e===void 0?null:i.map(n=>(0,W.jsx)(ar,{recordId:n,attempt:s.get(n)??0,capabilities:e,agentId:t,publish:l},n)),n]})}var cr={requested:`Approval requested.`,pending:`Pending approval.`,approved:`Approved. Waiting to run.`,applied:`Done.`,denied:`Denied.`,expired:`Expired. Nothing ran.`,claimed:`Dispatch in progress.`,outcome_unknown:`Outcome unknown. Check before trying again.`};function lr({view:e,scope:t,onRefresh:r,onAnswer:o}){let{record:c}=e,l=e.canAnswer&&c.state===`pending`;return(0,W.jsxs)(m,{role:`group`,"aria-label":`Approval request`,density:`compact`,children:[(0,W.jsxs)(s,{children:[(0,W.jsxs)(n,{children:[l?`Allow `:``,c.module,` · `,c.operation,l?`?`:``]}),(0,W.jsxs)(`p`,{children:[c.requester.displayName,` wants to use a connected tool.`]})]}),(0,W.jsxs)(i,{className:`min-w-0 space-y-2`,children:[(0,W.jsxs)(`p`,{children:[`Effect`,` `,c.access===`write`?`Changes data in Fungi`:`Changes things outside Fungi`,c.reversibility===`irreversible-external`?` · can't be undone`:``]}),(0,W.jsx)(`p`,{role:`status`,children:l?`Waiting for your answer.`:cr[c.state]}),(0,W.jsxs)(`details`,{children:[(0,W.jsx)(`summary`,{children:`Details`}),(0,W.jsxs)(`p`,{children:[`Requester: `,c.requester.principalId]}),(0,W.jsxs)(`p`,{children:[`Agent: `,c.requester.displayName,` ·`,` `,c.requester.agentId??`none`]}),(0,W.jsxs)(`p`,{children:[`Session: `,c.requester.sessionId??`none`]}),(0,W.jsxs)(`p`,{children:[`Request: `,c.module,`.`,c.operation,` · `,c.access]}),(0,W.jsxs)(`p`,{children:[`Undo:`,` `,c.reversibility===`irreversible-external`?`Can't be undone`:`Can be undone`]}),(0,W.jsxs)(`p`,{children:[`Can answer: `,e.canAnswer?`Yes`:`No`]}),(0,W.jsxs)(`p`,{children:[`Can set auto-approve: `,e.canSetAutoApprove?`Yes`:`No`]}),c.by?.kind===`policy`?(0,W.jsx)(`p`,{children:`Auto-approved by policy`}):null,(0,W.jsx)(`p`,{children:c.description.title}),(0,W.jsxs)(`p`,{className:`break-all`,children:[`Input: `,c.description.inputBytes,` bytes · SHA-256`,` `,c.description.inputSha256]}),(0,W.jsxs)(`p`,{children:[`Record: `,c.recordId,` · revision `,c.revision]}),e.canSetAutoApprove?(0,W.jsxs)(`p`,{children:[`Policy scope:`,` `,t.agentId===null?`whole home`:`agent ${t.agentId}`]}):null]})]}),(0,W.jsxs)(a,{className:`flex flex-wrap gap-2`,children:[l?(0,W.jsx)(h,{variant:`outline`,onClick:o,children:`Answer`}):null,(0,W.jsx)(h,{variant:`ghost`,onClick:r,children:`Refresh approval`})]})]})}function ur({recordId:e}){let t=rr(),n=Me(),r=t?.entry(e);return t===void 0||r===void 0?null:r.failed?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{role:`alert`,children:`Couldn't load this approval. Try again.`}),(0,W.jsx)(h,{variant:`ghost`,onClick:()=>{t.refresh(e)},children:`Refresh approval`})]}):r.view===null||r.view.record.state===`expired`?null:(0,W.jsx)(lr,{view:r.view,scope:{agentId:t.agentId},onRefresh:()=>{t.refresh(e)},onAnswer:()=>{n.awaiting.focus()}})}var dr=(0,U.forwardRef)(function({heading:e,eyebrow:t,cover:n,action:o,children:c,className:l,...u},d){return(0,W.jsxs)(m,{...u,className:r(`caps-game-share`,l),ref:d,children:[n?(0,W.jsx)(`div`,{className:`caps-game-share-cover`,children:n}):null,(0,W.jsxs)(s,{children:[t,(0,W.jsx)(`h3`,{className:`caps-game-share-heading`,children:e})]}),(0,W.jsx)(i,{className:`gap-sm`,children:c}),(0,W.jsx)(a,{children:(0,W.jsx)(h,{asChild:!0,variant:`primary`,className:`caps-game-share-action`,children:o})})]})});function fr(e){let t=0;return e.map(e=>{let n={...e,offset:t};return t+=e.text.length,n})}function pr({value:e,label:n,fieldLabel:i,displayValue:a,layout:o,title:s,tokens:l,className:f,...p}){let m=(0,U.useId)(),[g,te]=(0,U.useState)({kind:`ready`}),_=l?l.map(e=>e.text).join(``):e,v=async()=>{te(await navigator.clipboard.writeText(_).then(()=>({kind:`copied`}),e=>({kind:`failed`,cause:e})))};if(i!==void 0)return(0,W.jsxs)(`div`,{...p,className:r(`caps-copy-field-input`,f),children:[(0,W.jsx)(ee,{htmlFor:m,children:i}),(0,W.jsxs)(u,{children:[(0,W.jsx)(d,{className:`caps-copy-field-control`,"aria-label":i,id:m,onFocus:e=>{e.currentTarget.select()},readOnly:!0,value:a??_}),(0,W.jsx)(h,{onClick:()=>void v(),variant:`outline`,children:g.kind===`copied`?`Copied`:n??`Copy`})]}),g.kind===`failed`?(0,W.jsx)(`span`,{role:`status`,children:`Could not copy. Select the text to copy it.`}):null]});let y=g.kind===`copied`?`Copied`:g.kind===`failed`?`Copy failed`:n??`Copy`;return o===`block`?(0,W.jsxs)(`figure`,{...p,className:r(`caps-copy-field-block`,f),"data-state":g.kind,children:[(0,W.jsxs)(`figcaption`,{className:`caps-copy-field-header`,children:[(0,W.jsx)(`span`,{className:`caps-copy-field-title`,children:s}),(0,W.jsxs)(h,{onClick:()=>void v(),size:`sm`,variant:g.kind===`copied`?`ghost`:`outline`,children:[g.kind===`copied`?(0,W.jsx)(t,{"aria-hidden":`true`,size:15}):(0,W.jsx)(De,{"aria-hidden":`true`,size:15}),y]}),(0,W.jsx)(c,{role:`status`,children:g.kind===`copied`?`Copied to the clipboard`:g.kind===`failed`?`Could not copy. Select the code to copy it.`:``})]}),(0,W.jsx)(`pre`,{className:`caps-copy-field-code`,tabIndex:0,children:(0,W.jsx)(`code`,{children:l?fr(l).map(e=>(0,W.jsx)(`span`,{className:`caps-copy-field-token`,"data-kind":e.kind,children:e.text},e.offset)):_})})]}):(0,W.jsxs)(`div`,{...p,className:r(`caps-copy-field`,f),children:[(0,W.jsx)(`code`,{className:`caps-copy-field-value`,children:_}),(0,W.jsxs)(h,{"aria-label":`${y}: ${_}`,onClick:()=>void v(),size:`sm`,variant:`outline`,children:[g.kind===`copied`?(0,W.jsx)(t,{size:15}):(0,W.jsx)(De,{size:15}),y]})]})}var mr=v({game:v({title:b().min(1),summary:b(),coverUrl:g().nullable(),shareUrl:g()})});function hr(e){let t=/(?:^|\n)\s*Share:\s*(https?:\/\/[^\s<>]+)/iu.exec(e);if(!t?.[1])return null;let n=t[1].replace(/[.,;!?]+$/u,``);if(!URL.canParse(n))return null;let r=new URL(n);return r.username||r.password||r.hash||r.protocol===`http:`&&![`localhost`,`127.0.0.1`].includes(r.hostname)?null:r.href}function gr(e){return hr(e)?e.split(`
|
|
3
3
|
`).filter(e=>!/^\s*Share:\s*/iu.test(e)).join(`
|
|
4
4
|
`).trim():e}function _r(e){let t=new URL(e),n=/^\/([a-z0-9]+(?:-[a-z0-9]+)*)\/?$/u.exec(t.pathname)?.[1];return!n||t.search?null:new URL(`/api/games/${n}`,t.origin)}function vr({reply:e,previewGame:t}){let n=hr(e),r=n?_r(n):null,{data:i}=Be({queryKey:Le.of(null,`game-share`,n),enabled:r!==null&&t===void 0,queryFn:async({signal:e})=>{if(!r)return null;let t=await fetch(r,{signal:e});if(!t.ok)return null;let i=mr.safeParse(await t.json());return i.success&&i.data.game.shareUrl===n?i.data.game:null}}),a=t??i;if(!n)return null;let o=new URL(n),s=`${o.host}${o.pathname.replace(/\/$/u,``)}`,c=a?.coverUrl&&r?t?a.coverUrl:new URL(`${r.pathname}/cover`,r.origin).href:null;return(0,W.jsxs)(dr,{"data-game-share-card":`true`,"data-theme":`vishnu`,heading:a?.title??`Your game is ready`,eyebrow:(0,W.jsx)(je,{tone:`secondary`,variant:`quiet`,children:`Made with your Agent`}),cover:c?(0,W.jsx)(`img`,{alt:`A scene from ${a?.title??`your game`}`,src:c}):null,action:(0,W.jsx)(`a`,{href:n,rel:`noopener noreferrer`,target:`_blank`,children:`Play ↗`}),children:[a?.summary?(0,W.jsx)(`p`,{className:`text-sm`,children:a.summary}):null,(0,W.jsx)(pr,{displayValue:s,fieldLabel:`Share link`,label:`Copy link`,value:n})]})}var yr=[Pt,Jt,rn,Cn,In],br=e=>(0,W.jsx)(vr,{reply:e});function xr({prefill:e,onPrefilled:t}){let n=Ae(),r=(0,U.useRef)(null);return(0,U.useEffect)(()=>{!e||r.current===e.requestId||(r.current=e.requestId,n.setDraft(e.text),e.send===!0&&n.send(),t())},[n.setDraft,n.send,t,e]),null}function Sr({session:e,draftIdentity:t,connection:n,commands:r,prefill:i=null,onPrefilled:a=()=>void 0,onOpen:o,models:s,autoFocus:c}){let l=n?.ui??null,u=n?.capabilities,d=(0,U.useMemo)(()=>({modelSetup:s===void 0?void 0:{state:s,fix:{label:`Add a model key`,onSelect:()=>{l?.openSetup(`model`).catch(e=>{console.error(`Grove could not open model setup`,e)})}}},starters:Re}),[s,l]),f=(0,U.useCallback)(e=>Ln(l,e),[l]),p=(0,U.useCallback)(e=>{let t=tr(e);return t!==void 0&&u!==void 0?(0,W.jsx)(ur,{recordId:t},t):l?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Bn,{item:e,ui:l}),(0,W.jsx)($n,{item:e,capabilities:u})]}):null},[l,u]),m=(0,U.useCallback)(e=>u!==void 0&&Zn(e),[u]),ee=(0,U.useCallback)(e=>{Rn(l,e)},[l]);return(0,W.jsxs)(Te,{session:e,draftIdentity:t,clients:yr,authorOf:Se,onToast:ee,children:[(0,W.jsx)(xr,{prefill:i,onPrefilled:a}),(0,W.jsx)(sr,{capabilities:u,agentId:t.agentId,children:(0,W.jsx)(ke,{onLink:f,onOpen:o,hostFacts:d,autoFocus:c,composerActionVariant:`outline`,commands:r,renderAssistantAttachment:br,formatAssistantText:gr,renderToolActions:p,claimsToolMedia:m})})]})}export{Sr as ParakeetConversation};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Ct as n,D as r,F as i,G as a,I as o,J as s,K as c,N as l,O as u,P as d,Qr as f,R as p,St as m,V as h,Y as g,Z as _,Zi as v,_ as ee,_a as y,_t as te,a as b,ar as ne,ba as x,bt as re,c as ie,ct as ae,d as oe,da as se,dr as S,dt as ce,et as le,f as C,fa as w,ft as T,g as E,ga as ue,gt as D,h as O,ht as k,i as de,ir as fe,j as A,lt as pe,m as j,mr as me,mt as M,n as he,nr as ge,o as N,ot as _e,p as ve,pa as ye,pr as P,pt as F,qn as be,r as xe,ra as Se,rr as Ce,s as I,sr as we,st as Te,t as Ee,tr as De,tt as Oe,vt as ke,w as Ae,wa as je,wt as L,xa as R,xi as Me,xt as z,y as B}from"./Effect-CsknxyoC.js";import{$ as Ne,$n as Pe,$t as Fe,A as Ie,Ai as Le,An as Re,Ao as ze,Ar as Be,At as Ve,B as He,Ba as Ue,Bn as We,Br as Ge,Bt as Ke,C as qe,Ci as V,Cn as Je,Cr as H,Ct as Ye,D as Xe,Dn as Ze,Do as Qe,Dt as $e,E as et,Ei as tt,En as nt,Eo as rt,Et as it,F as at,Fo as ot,Fr as st,Ft as ct,G as lt,Gi as ut,Gn as dt,Gr as ft,Gt as pt,H as mt,Hi as ht,Hn as gt,Hr as _t,Ht as vt,I as yt,Ia as bt,Ii as xt,In as St,Io as Ct,It as wt,J as Tt,Ja as Et,Ji as Dt,Jn as Ot,Jt as kt,K as At,Kn as jt,Kr as Mt,Kt as Nt,L as Pt,La as U,Li as Ft,Ln as It,Lr as Lt,Lt as Rt,M as zt,Ma as Bt,Mn as Vt,Mo as Ht,Mt as Ut,N as Wt,Na as Gt,Ni as W,Nn as Kt,No as qt,Nt as Jt,O as Yt,On as Xt,Or as Zt,Ot as Qt,P as $t,Pa as G,Pn as en,Po as tn,Pr as nn,Pt as rn,Q as an,Qn as on,Qt as sn,R as cn,Ra as ln,Rn as un,Ro as dn,Rt as fn,S as pn,Si as mn,Sn as hn,Sr as gn,St as _n,T as vn,Ta as yn,Tn as bn,To as xn,Tr as Sn,Tt as Cn,U as wn,Ui as Tn,Un as En,Ut as Dn,V as On,Vi as K,Vn as kn,Vr as An,Vt as jn,W as Mn,Wi as Nn,Wn as Pn,Wt as Fn,X as In,Xn as Ln,Xr as Rn,Xt as zn,Y as Bn,Yn as Vn,Yt as Hn,Z as Un,Zn as Wn,Zt as Gn,_ as Kn,_a as qn,_i as Jn,_n as Yn,_o as Xn,_r as Zn,_t as Qn,a as $n,ai as er,an as tr,at as nr,b as rr,bi as ir,bn as ar,br as or,bt as sr,c as cr,ci as lr,cn as ur,co as dr,ct as fr,di as pr,dn as mr,do as hr,dr as gr,dt as _r,ei as vr,en as yr,er as br,et as xr,fi as Sr,fn as Cr,fo as wr,ft as Tr,g as Er,gi as Dr,gn as Or,go as kr,gr as Ar,gt as jr,h as Mr,hn as Nr,ho as Pr,hr as Fr,ht as Ir,i as Lr,ii as Rr,in as zr,ir as Br,it as Vr,j as Hr,ji as Ur,jn as Wr,jo as Gr,jr as Kr,jt as qr,k as Jr,ka as Yr,ki as Xr,kn as Zr,ko as Qr,kt as $r,la as ei,li as ti,ln as ni,lo as ri,lt as ii,mn as ai,mo as oi,mt as si,n as ci,ni as li,nn as ui,nr as di,nt as fi,o as pi,oa as mi,oi as hi,on as q,ot as gi,pi as _i,pn as vi,po as yi,pt as bi,q as xi,qi as Si,qn as Ci,qr as wi,qt as Ti,r as Ei,ri as Di,rn as Oi,rr as ki,rt as Ai,s as ji,sn as Mi,so as Ni,sr as Pi,st as Fi,t as Ii,ti as Li,tn as Ri,tr as zi,tt as Bi,ui as Vi,un as Hi,ur as Ui,ut as Wi,v as Gi,vn as Ki,vr as qi,vt as Ji,w as Yi,wi as Xi,wn as Zi,wo as Qi,wt as $i,x as ea,xa as ta,xi as na,xn as ra,xr as ia,xt as aa,y as oa,yn as sa,yr as J,yt as ca,z as la,zn as ua,zr as da,zt as fa}from"./extension-hook-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Ct as n,D as r,F as i,G as a,I as o,J as s,K as c,N as l,O as u,P as d,Qr as f,R as p,St as m,V as h,Y as g,Z as _,Zi as v,_ as ee,_a as y,_t as te,a as b,ar as ne,ba as x,bt as re,c as ie,ct as ae,d as oe,da as se,dr as S,dt as ce,et as le,f as C,fa as w,ft as T,g as E,ga as ue,gt as D,h as O,ht as k,i as de,ir as fe,j as A,lt as pe,m as j,mr as me,mt as M,n as he,nr as ge,o as N,ot as _e,p as ve,pa as ye,pr as P,pt as F,qn as be,r as xe,ra as Se,rr as Ce,s as I,sr as we,st as Te,t as Ee,tr as De,tt as Oe,vt as ke,w as Ae,wa as je,wt as L,xa as R,xi as Me,xt as z,y as B}from"./Effect-CsknxyoC.js";import{$ as Ne,$n as Pe,$t as Fe,A as Ie,Ai as Le,An as Re,Ao as ze,Ar as Be,At as Ve,B as He,Ba as Ue,Bn as We,Br as Ge,Bt as Ke,C as qe,Ci as V,Cn as Je,Cr as H,Ct as Ye,D as Xe,Dn as Ze,Do as Qe,Dt as $e,E as et,Ei as tt,En as nt,Eo as rt,Et as it,F as at,Fo as ot,Fr as st,Ft as ct,G as lt,Gi as ut,Gn as dt,Gr as ft,Gt as pt,H as mt,Hi as ht,Hn as gt,Hr as _t,Ht as vt,I as yt,Ia as bt,Ii as xt,In as St,Io as Ct,It as wt,J as Tt,Ja as Et,Ji as Dt,Jn as Ot,Jt as kt,K as At,Kn as jt,Kr as Mt,Kt as Nt,L as Pt,La as U,Li as Ft,Ln as It,Lr as Lt,Lt as Rt,M as zt,Ma as Bt,Mn as Vt,Mo as Ht,Mt as Ut,N as Wt,Na as Gt,Ni as W,Nn as Kt,No as qt,Nt as Jt,O as Yt,On as Xt,Or as Zt,Ot as Qt,P as $t,Pa as G,Pn as en,Po as tn,Pr as nn,Pt as rn,Q as an,Qn as on,Qt as sn,R as cn,Ra as ln,Rn as un,Ro as dn,Rt as fn,S as pn,Si as mn,Sn as hn,Sr as gn,St as _n,T as vn,Ta as yn,Tn as bn,To as xn,Tr as Sn,Tt as Cn,U as wn,Ui as Tn,Un as En,Ut as Dn,V as On,Vi as K,Vn as kn,Vr as An,Vt as jn,W as Mn,Wi as Nn,Wn as Pn,Wt as Fn,X as In,Xn as Ln,Xr as Rn,Xt as zn,Y as Bn,Yn as Vn,Yt as Hn,Z as Un,Zn as Wn,Zt as Gn,_ as Kn,_a as qn,_i as Jn,_n as Yn,_o as Xn,_r as Zn,_t as Qn,a as $n,ai as er,an as tr,at as nr,b as rr,bi as ir,bn as ar,br as or,bt as sr,c as cr,ci as lr,cn as ur,co as dr,ct as fr,di as pr,dn as mr,do as hr,dr as gr,dt as _r,ei as vr,en as yr,er as br,et as xr,fi as Sr,fn as Cr,fo as wr,ft as Tr,g as Er,gi as Dr,gn as Or,go as kr,gr as Ar,gt as jr,h as Mr,hn as Nr,ho as Pr,hr as Fr,ht as Ir,i as Lr,ii as Rr,in as zr,ir as Br,it as Vr,j as Hr,ji as Ur,jn as Wr,jo as Gr,jr as Kr,jt as qr,k as Jr,ka as Yr,ki as Xr,kn as Zr,ko as Qr,kt as $r,la as ei,li as ti,ln as ni,lo as ri,lt as ii,mn as ai,mo as oi,mt as si,n as ci,ni as li,nn as ui,nr as di,nt as fi,o as pi,oa as mi,oi as hi,on as q,ot as gi,pi as _i,pn as vi,po as yi,pt as bi,q as xi,qi as Si,qn as Ci,qr as wi,qt as Ti,r as Ei,ri as Di,rn as Oi,rr as ki,rt as Ai,s as ji,sn as Mi,so as Ni,sr as Pi,st as Fi,t as Ii,ti as Li,tn as Ri,tr as zi,tt as Bi,ui as Vi,un as Hi,ur as Ui,ut as Wi,v as Gi,vn as Ki,vr as qi,vt as Ji,w as Yi,wi as Xi,wn as Zi,wo as Qi,wt as $i,x as ea,xa as ta,xi as na,xn as ra,xr as ia,xt as aa,y as oa,yn as sa,yr as J,yt as ca,z as la,zn as ua,zr as da,zt as fa}from"./extension-hook-C8EcEsru.js";import{l as pa,m as ma,p as ha}from"./preload-helper-DY31Aviq.js";import{a as ga,c as _a,d as va,f as ya,i as ba,l as xa,o as Sa,s as Ca,u as wa}from"./index-B9JPxELm.js";var Ta=bt(()=>Xa),Ea=Rr(Ta),Da=V({id:Jn,payload:Vi}),Oa=V({...Da.fields,schemas:Gt(Ea)});function ka(e){let t={};for(let[n,r]of Object.entries(e))Et(r)&&f(t,n,r);return Object.keys(t).length===0?S():P(t)}var Aa=Gt(na(mn,Ur)).pipe(ut(G(pr),{decode:Ni(),encode:ri(e=>ne(e)||e.value===void 0?S():ka(e.value))})),ja=bt(()=>Pa),Ma=Rr(ja),Na={annotations:Aa,checks:Ma},Pa=Le([V({_tag:U(`Filter`),representation:Oa,annotations:Aa,aborted:hi}),V({_tag:U(`FilterGroup`),representation:Gt(Oa),annotations:Aa,checks:Dr(ja)})]);function Y(e){return V({_tag:U(e),...Na})}var Fa=V({_tag:U(`Declaration`),representation:Da,annotations:Aa,typeParameters:Ea,checks:Ma}),Ia=V({_tag:U(`Suspend`),annotations:Aa,checks:tt([]),thunk:Ta});function La(e,t){return t.pipe(ut(V({type:U(e),value:t}),{decode:dr(e=>e.value),encode:dr(t=>({type:e,value:t}))}))}var Ra=La(`string`,mn),za=La(`number`,ir),Ba=V({_tag:U(`Literal`),...Na,literal:Le([Ra,La(`number`,lr),La(`bigint`,er),La(`boolean`,hi)])}),Va=V({_tag:U(`UniqueSymbol`),...Na,symbol:Xi}),Ha=V({_tag:U(`Enum`),...Na,enums:Rr(tt([mn,Le([Ra,za])]))}),Ua=V({_tag:U(`TemplateLiteral`),...Na,parts:Ea}),Wa=V({isOptional:hi,type:Ta,annotations:Aa}),Ga=V({_tag:U(`Arrays`),...Na,elements:Rr(Wa),rest:Ea}),Ka=V({name:Le([Ra,za,La(`symbol`,Xi)]),type:Ta,isOptional:hi,isMutable:hi,annotations:Aa}),qa=V({parameter:Ta,type:Ta}),Ja=V({_tag:U(`Objects`),...Na,propertySignatures:Rr(Ka),indexSignatures:Rr(qa)}),Ya=V({_tag:U(`Union`),...Na,types:Ea,options:G(V({mode:G(_i([`anyOf`,`oneOf`]))}))}),Xa=Le([Fa,V({_tag:U(`Reference`),$ref:Jn}),Ia,Y(`Null`),Y(`Undefined`),Y(`Void`),Y(`Never`),Y(`Unknown`),Y(`Any`),Y(`String`),Y(`Number`),Y(`Boolean`),Y(`BigInt`),Y(`Symbol`),Y(`ObjectKeyword`),Ba,Va,Ha,Ua,Ga,Ja,Ya]),Za=Nn(ln(V({representation:Ta,references:na(mn,Ta)})));function Qa(e){return Za(e)}function $a(e){return e.sql.exec(`CREATE TABLE IF NOT EXISTS shiitake_fleet_delegations (
|
|
2
2
|
request_id TEXT PRIMARY KEY, input TEXT NOT NULL, mail TEXT NOT NULL,
|
|
3
3
|
receipt TEXT
|
|
4
4
|
) STRICT`),e.sql.exec(`CREATE TABLE IF NOT EXISTS shiitake_fleet_held_delegations (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$a as n,Ba as r,Ea as i,Ga as a,Ha as o,Ia as s,Ja as c,Ka as l,La as u,Ma as d,Pa as f,Qa as p,Ra as m,Ua as h,Va as g,Wa as _,Xa as v,Ya as y,Zi as b,_a as x,ba as S,ca as C,da as w,fa as T,ga as E,ia as D,ja as ee,la as O,ma as k,no as A,oa as j,pa as M,qa as N,ra as P,to as F,wa as I,xa as L,ya as te,za as ne}from"./Effect-CsknxyoC.js";import{Ai as re,Ci as R,Ei as ie,Fn as ae,Hi as z,Ir as oe,Ma as se,Mr as ce,Na as B,Ni as le,Rr as ue,Si as de,Ta as fe,Ur as pe,Wr as me,do as he,fi as ge,ii as _e,l as ve,oi as ye,pi as be,xa as xe,xi as Se}from"./extension-hook-CU9zKOl3.js";import{A as Ce,D as we,F as Te,I as Ee,M as De,N as Oe,R as ke,b as Ae,d as je,f as Me,g as Ne,h as Pe,j as Fe,n as Ie,p as Le,v as Re,y as ze,z as Be}from"./animation-Ca8A_H2p.js";var Ve=t((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var O=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function A(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+k(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(O,`$&/`)+`/`),A(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(O,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+k(s,l);c+=A(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+k(s,l++),c+=A(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function j(e,t,n){if(e==null)return e;var r=[],i=0;return A(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function M(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N={current:null},P={transition:null},F={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:P,ReactCurrentOwner:C};function I(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,e.act=I,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:M}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=P.transition;P.transition={};try{e()}finally{P.transition=t}},e.unstable_act=I,e.useCallback=function(e,t){return N.current.useCallback(e,t)},e.useContext=function(e){return N.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return N.current.useDeferredValue(e)},e.useEffect=function(e,t){return N.current.useEffect(e,t)},e.useId=function(){return N.current.useId()},e.useImperativeHandle=function(e,t,n){return N.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return N.current.useMemo(e,t)},e.useReducer=function(e,t,n){return N.current.useReducer(e,t,n)},e.useRef=function(e){return N.current.useRef(e)},e.useState=function(e){return N.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return N.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return N.current.useTransition()},e.version=`18.3.1`})),He=t(((e,t)=>{t.exports=Ve()})),Ue=w(),We=T(()=>C(`status`,[x({status:M(`available`)}).strict(),x({status:M(`unavailable`),reason:L()}).strict()])),Ge=Ue,Ke=T(()=>te(L(),Ge)),qe=e=>Ge.parse(e),Je=e=>Ke.parse(e),Ye=T(()=>x({code:L().min(1).max(160),message:L().min(1).max(512),details:Ge.optional()}).strict()),Xe=e=>Ye.parse(e),Ze=Ke,Qe=T(()=>L().refine(e=>e.trim().length>0)),$e=We,et=T(()=>I([x({type:M(`action`)}).strict(),x({type:M(`custom`),data:Ke}).strict(),x({type:M(`choice`),options:P(x({value:Ge,label:Qe,description:Qe.optional()}))}).strict(),x({type:M(`form`),submitLabel:Qe.optional()}).strict(),x({type:M(`confirmation`),message:Qe,confirmLabel:Qe.optional(),cancelLabel:Qe.optional()}).strict()])),tt=T(()=>x({inputSchema:Ze.optional(),outputSchema:Ze.optional(),presentation:et.optional()}).strict()),nt=T(()=>E().int().refine(e=>Number.isSafeInteger(e))),rt=T(()=>x({hint:Qe.pipe(L().max(120)),words:P(x({word:L().regex(/^\S{1,64}$/u),description:Qe.pipe(L().max(512)).optional(),arguments:Ke}).strict()).max(32).optional(),text:x({field:Qe.pipe(L().max(120)),arguments:Ke,requestIdField:Qe.pipe(L().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),it=T(()=>x({order:nt.optional()}).strict()),at=T(()=>x({bindings:x({order:nt.optional(),values:P(Qe).max(16)}).strict().optional(),agent:x({keybind:Qe.optional(),order:nt.optional()}).strict().optional(),help:it.optional(),menu:it.optional(),palette:it.optional(),slash:x({aliases:P(Qe).max(16),consumesDraft:j().optional(),order:nt.optional(),arguments:rt.optional()}).strict().optional()}).strict()),ot=T(()=>x({id:Qe.refine(e=>!e.includes(`:`)),title:Qe,category:Qe,description:Qe.optional(),projections:at.optional(),action:tt.optional(),availability:$e.optional()}).strict()),st=e=>ot.parse(e),ct=T(()=>x({inputSchema:Ze.optional(),outputSchema:Ze.optional()}).strict()),lt=L().min(1).brand(),ut=T(()=>x({commandId:lt,command:x({namespace:L(),id:L()}).strict(),sourceId:L(),scope:L().optional(),title:L(),category:L(),description:L().optional(),order:E(),availability:We,action:ct.optional(),keybind:L().optional()}).strict());P(ut);var dt=8192,V=Qe.pipe(L().max(dt)),ft=Qe.pipe(L().max(60)),pt=i({protocol:/^https?$/u}),mt=x({label:V,value:V}).strict(),ht={summary:V.optional(),facts:P(mt).max(4).optional(),body:V.optional(),bodyLabel:V.optional(),details:P(mt).max(24).optional()},gt=C(`type`,[x({type:M(`choice`),message:ft,...ht,current:V.optional(),collapsedGroup:V.optional(),options:P(x({value:V,label:V,description:V.optional(),group:V.optional(),destructive:M(!0).optional()}).strict()).min(1).max(256)}).strict(),x({type:M(`text`),message:ft,...ht,placeholder:V.optional(),secret:j().optional()}).strict(),x({type:M(`confirmation`),message:ft,...ht,confirmLabel:V.optional(),cancelLabel:V.optional(),destructive:M(!0).optional()}).strict(),x({type:M(`decision`),message:ft,...ht,options:P(x({value:V,label:V,description:V.optional(),destructive:M(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(e=>e.value)).size===e.length,`Decision option values must be unique`),multiple:j().optional(),other:x({label:V,placeholder:V.optional(),maxLength:E().int().min(1).max(dt),blank:V.optional()}).strict().optional(),escape:V.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(e=>e.value===t)),`A decision's escape and blank answers must be offered options`)]),_t=T(()=>C(`type`,[x({type:M(`info`),message:V,links:P(x({url:pt,label:V.optional()}).strict()).max(16).optional()}).strict(),x({type:M(`progress`),message:V}).strict(),x({type:M(`handoff`),url:pt,code:V.optional(),message:V.optional()}).strict(),x({type:M(`success`),message:V}).strict()])),vt=e=>gt.parse(e),yt=e=>_t.parse(e),bt={decision:e=>{let t=gt.options[3].parse(e),n=new Set(t.options.map(e=>e.value));return x({selected:P(L()).max(t.options.length),text:O(Qe.pipe(L().max(t.other?.maxLength??1)))}).strict().superRefine((e,r)=>{let i=e=>{r.addIssue({code:`custom`,message:e})};(e.selected.some(e=>!n.has(e))||new Set(e.selected).size!==e.selected.length)&&i(`Pick each offered option at most once`),t.multiple!==!0&&e.selected.length>1&&i(`Pick one option`),e.selected.length===0&&e.text===void 0&&i(`Pick an option or write an answer`),t.other===void 0&&e.text!==void 0&&i(`This decision takes no written answer`),t.multiple!==!0&&e.selected.length>0&&e.text!==void 0&&i(`Pick an option or write an answer, not both`)})},confirmation:e=>(gt.options[2].parse(e),j()),text:e=>(gt.options[1].parse(e),L().max(dt)),choice:e=>{let t=gt.options[0].parse(e);return L().refine(e=>t.options.some(t=>t.value===e))}};function xt(e){let t=bt[e.type](e);return e=>{let n=t.safeParse(e);return n.success?{kind:`accepted`,value:n.data}:{kind:`invalid`,cause:n.error}}}var St=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},Ct=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function wt(){let e=!1,t=nn,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=nn,s(),o.clear())},contribute:t=>{if(Nt(t),e)throw new Ct;Pt(t,n),Ft(t,n);let r=Symbol(`whistle-contribution`);Mt(t)||(n=[...n,{contribution:It(t),generation:r}],i=!0,s());let a=!0;return en(o=>{if(!a||e)return;let c={...t,commands:o};Nt(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);Pt(c,u),Ft(c,u);let d=It(c);if(Mt(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=jt(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=an(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&Tt.has(r.origin)&&(o=n({commandId:At(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=sn(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return nn;let a=n.flatMap(e=>e.contribution.commands.map(an));return(i||a.some((e,t)=>!on(e,r[t])))&&(t=cn(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var Tt=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Et=16,Dt=32,Ot=64,kt=256;function At(e,t){return lt.parse(`${e}:${t}`)}function jt(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function Mt(e){return e.commands.length===0}function Nt(e){Qt(e.sourceId,`source ID`),Qt(e.namespace,`namespace`),e.scope!==void 0&&Qt(e.scope,`scope`);for(let t of e.commands)qt(t)}function Pt(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&tn(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(At(i.contribution.namespace,e.id)),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=At(e.namespace,t.id);n.has(i)&&tn(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&tn(`Slash alias is already registered`),r.add(e)}}function Ft(e,t){t.length>=Ot&&tn(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>kt&&tn(`Live command capacity exceeded`)}function It(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(Lt)};return e.scope===void 0?t:{...t,scope:e.scope}}function Lt(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=Rt(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=Vt(e.projections)),t}function Rt(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=H(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=H(e.outputSchema)),e.presentation!==void 0&&(t.presentation=Bt(e.presentation)),Object.freeze(t)}function H(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,zt(t)])))}function zt(e){return Array.isArray(e)?Object.freeze(e.map(zt)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,zt(t)]))):e}function Bt(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:H(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:zt(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function Vt(e){let t={};return e.bindings!==void 0&&(t.bindings=Ht(e.bindings)),e.agent!==void 0&&(t.agent=Ut(e.agent)),e.help!==void 0&&(t.help=Wt(e.help.order)),e.menu!==void 0&&(t.menu=Wt(e.menu.order)),e.palette!==void 0&&(t.palette=Wt(e.palette.order)),e.slash!==void 0&&(t.slash=Gt(e.slash)),t}function Ht(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function Ut(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function Wt(e){let t={};return e!==void 0&&(t.order=e),t}function Gt(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=Kt(e.arguments)),t}function Kt(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:H(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:H(e.text.arguments)})),Object.freeze(t)}function qt(e){Qt(e.id,`command ID`,!0),Qt(e.title,`title`),Qt(e.category,`category`),Jt(e.action),Yt(e.projections)}function Jt(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Qt(t.label,`choice label`),t.description!==void 0&&Qt(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Qt(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Qt(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Qt(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Qt(e.presentation.cancelLabel,`cancellation label`)}}function Yt(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&$t(t.order);if(e.bindings!==void 0&&Zt(e.bindings.values,`binding`),e.slash!==void 0){Zt(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&tn(`slash alias must not contain whitespace`);Xt(e.slash.arguments)}e.agent?.keybind!==void 0&&Qt(e.agent.keybind,`agent keybind`)}}function Xt(e){if(e===void 0)return;Qt(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&tn(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Qt(n.word,`argument word`),/\s/u.test(n.word)&&tn(`argument word must not contain whitespace`),t.has(n.word)&&tn(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Qt(n.description,`argument word description`);t.size>Dt&&tn(`argument word count exceeds 32`),e.text!==void 0&&(Qt(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Qt(e.text.requestIdField,`request id field`))}function Zt(e,t){e.length>Et&&tn(`${t} count exceeds 16`);for(let n of e)Qt(n,t)}function Qt(e,t,n=!1){e.trim().length===0&&tn(`${t} must not be blank`),n&&e.includes(`:`)&&tn(`${t} must not contain a colon`)}function $t(e){e!==void 0&&!Number.isSafeInteger(e)&&tn(`order must be a safe integer`)}function en(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function tn(e){throw Error(e)}var nn=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),rn=Object.freeze({status:`available`});function an(e){let t=e.availability?.()??rn;return t.status===`available`?rn:Object.freeze({status:`unavailable`,reason:t.reason})}function on(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function sn(e){if(e instanceof St){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:zt(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function cn(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??rn;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...hn(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...hn(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...hn(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...hn(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...hn(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(_n(e,l,u.agent,d))}}return fn(n),pn(i),dn(r),dn(a),dn(o),dn(s),Object.freeze({bindings:mn(n),palette:mn(r),slash:mn(i),help:mn(a),menu:mn(o),agent:mn(s)})}var ln=new TextEncoder;function un(e,t){let n=ln.encode(e),r=ln.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function dn(e){e.sort((e,t)=>e.order-t.order||un(e.commandId,t.commandId))}function fn(e){e.sort((e,t)=>e.order-t.order||un(e.commandId,t.commandId)||un(e.binding,t.binding))}function pn(e){e.sort((e,t)=>e.order-t.order||un(e.commandId,t.commandId)||un(e.alias,t.alias))}function mn(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function hn(e,t,n,r){let i=gn(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function gn(e,t,n,r){let i={commandId:At(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id:t.id}),sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function _n(e,t,n,r){let i=hn(e,t,n.order,r),a=i.action===void 0?i:{...i,action:vn(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function vn(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var yn=t((e=>{var t=He(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),bn=t(((e,t)=>{t.exports=yn()})),U=e(He(),1),W=bn(),xn=U.createContext(void 0),Sn=e=>{let t=U.useContext(xn);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Cn=({client:e,children:t})=>(U.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,W.jsx)(xn.Provider,{value:e,children:t})),wn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Tn=new class{#e=wn;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function En(e){setTimeout(e,0)}var Dn=typeof window>`u`||`Deno`in globalThis;function On(){}function kn(e,t){return typeof e==`function`?e(t):e}function An(e){return typeof e==`number`&&e>=0&&e!==1/0}function jn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Mn(e,t){return typeof e==`function`?e(t):e}function Nn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Fn(o,t.options))return!1}else if(!Ln(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Pn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(In(t.options.mutationKey)!==In(a))return!1}else if(!Ln(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Fn(e,t){return(t?.queryKeyHashFn||In)(e)}function In(e){return JSON.stringify(e,(e,t)=>Hn(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ln(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!Ln(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Ln(e[r],t[r]))return!1;return!0}return!1}var Rn=Object.prototype.hasOwnProperty;function zn(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Vn(e)&&Vn(t);if(!r&&!(Hn(e)&&Hn(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Rn.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=zn(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Bn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Vn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Hn(e){if(!Un(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Un(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Un(e){return Object.prototype.toString.call(e)===`[object Object]`}function Wn(e){return new Promise(t=>{Tn.setTimeout(t,e)})}function Gn(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:zn(e,t)}function Kn(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function qn(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Jn=Symbol();function Yn(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Jn?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Xn(e,t){return typeof e==`function`?e(...t):!!e}function Zn(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Qn=()=>Dn,$n=()=>Qn(),er=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tr=new class extends er{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},nr=En;function rr(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=nr,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ir=rr(),ar=new class extends er{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function or(e){return Math.min(1e3*2**e,3e4)}function sr(e){return(e??`online`)!==`online`||ar.isOnline()}var cr=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function lr(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(On);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new cr(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>tr.isFocused()&&(e.networkMode===`always`||ar.isOnline())&&e.canRun(),p=()=>sr(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??($n()?0:3),a=e.retryDelay??or,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Wn(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var ur=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),An(this.gcTime)&&(this.#e=Tn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??($n()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Tn.clearTimeout(this.#e),this.#e=void 0)}};function dr(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Zn(e,()=>t.signal,()=>n=!0)},u=Yn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?qn:Kn;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?pr:fr,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:fr(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function fr(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function pr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function mr(e,t){return t?fr(e,t)!=null:!1}function hr(e,t){return!t||!e.getPreviousPageParam?!1:pr(e,t)!=null}var gr=class extends ur{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=yr(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=yr(this.options);e.data!==void 0&&(this.setState(vr(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Gn(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(On).catch(On):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Mn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Mn(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!jn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Yn(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?dr(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=lr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof cr&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof cr){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,..._r(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...vr(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ir.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function _r(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:sr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function vr(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function yr(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var br=class extends er{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Sr(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Cr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Cr(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Mn(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Bn(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&wr(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Mn(this.options.enabled,this.#t)!==Mn(t.enabled,this.#t)||Mn(this.options.staleTime,this.#t)!==Mn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Mn(this.options.enabled,this.#t)!==Mn(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Bn(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(On)),t}#h(e){return!$n()&&Mn(this.options.enabled,this.#t)!==!1&&An(e)}#g(){this.#b();let e=Mn(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=jn(this.#r.dataUpdatedAt,e)+1;this.#u=Tn.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=Tn.setInterval(()=>{(this.options.refetchIntervalInBackground||tr.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Tn.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Tn.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Sr(e,t),o=i&&wr(e,n,t,r);(a||o)&&(l={...l,..._r(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Gn(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Gn(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Tr(e,t),refetch:this.refetch,isEnabled:Mn(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),Bn(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();ir.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function xr(e,t){return Mn(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Mn(t.retryOnMount,e)!==!1)}function Sr(e,t){return xr(e,t)||e.state.data!==void 0&&Cr(e,t,t.refetchOnMount)}function Cr(e,t,n){if(Mn(t.enabled,e)!==!1&&Mn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Tr(e,t)}return!1}function wr(e,t,n,r){return(e!==t||Mn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Tr(e,n)}function Tr(e,t){return Mn(t.enabled,e)!==!1&&e.isStaleByTime(Mn(t.staleTime,e))}var Er=class extends ur{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Dr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=lr({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ir.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Dr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Or=class extends er{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Er({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=kr(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=kr(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=kr(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=kr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ir.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Pn(t,e))}findAll(e={}){return this.getAll().filter(t=>Pn(e,t))}notify(e){ir.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ir.batch(()=>Promise.all(e.map(e=>e.continue().catch(On))))}};function kr(e){return e.options.scope?.id}var Ar=class extends er{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Bn(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&In(t.mutationKey)!==In(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Dr();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ir.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},jr=class extends er{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Fn(r,t),a=this.get(i);return a||(a=new gr({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ir.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Nn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Nn(e,t)):t}notify(e){ir.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ir.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ir.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Mr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new jr,this.#t=e.mutationCache||new Or,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=tr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ar.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Mn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=kn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ir.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ir.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ir.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=ir.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(On).catch(On)}invalidateQueries(e,t={}){return ir.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ir.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(On)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(On)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Mn(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Mn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(On).catch(On)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(On).catch(On)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ar.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(In(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ln(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(In(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ln(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Fn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Jn&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function Nr({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Kn(e,t),initialValue:r=[]}){return async i=>{let a=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),o=!!a&&a.isFetched();o&&t===`reset`&&a.setState({...a.resetState,fetchStatus:`fetching`});let s=r,c=!1,l=await e(Zn({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>c=!0)),u=o&&t===`replace`;for await(let e of l){if(c)break;u?s=n(s,e):i.client.setQueryData(i.queryKey,t=>n(t===void 0?r:t,e))}return u&&!c&&i.client.setQueryData(i.queryKey,s),i.client.getQueryData(i.queryKey)??r}}function Pr(e){return e}function Fr(e){return e}var Ir=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,j(x);else{var t=n(l);t!==null&&M(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&M(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function ee(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?O():(S=!1,C=null)}}else S=!1}var O;if(typeof v==`function`)O=function(){v(ee)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=ee,O=function(){A.postMessage(null)}}else O=function(){g(ee,0)};function j(e){C=e,S||(S=!0,O())}function M(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,j(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,M(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,j(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Lr=t(((e,t)=>{t.exports=Ir()})),Rr=t((e=>{var t=He(),n=Lr();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function p(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function m(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function h(e,t,n,r){if(t==null||m(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function g(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var _={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){_[e]=new g(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];_[t]=new g(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){_[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){_[e]=new g(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){_[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){_[e]=new g(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){_[e]=new g(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){_[e]=new g(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){_[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),_.xlinkHref=new g(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,t,n,r){var i=_.hasOwnProperty(t)?_[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(h(t,n,i,r)&&(n=null),r||i===null?p(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=Symbol.for(`react.element`),C=Symbol.for(`react.portal`),w=Symbol.for(`react.fragment`),T=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),D=Symbol.for(`react.provider`),ee=Symbol.for(`react.context`),O=Symbol.for(`react.forward_ref`),k=Symbol.for(`react.suspense`),A=Symbol.for(`react.suspense_list`),j=Symbol.for(`react.memo`),M=Symbol.for(`react.lazy`),N=Symbol.for(`react.offscreen`),P=Symbol.iterator;function F(e){return typeof e!=`object`||!e?null:(e=P&&e[P]||e[`@@iterator`],typeof e==`function`?e:null)}var I=Object.assign,L;function te(e){if(L===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);L=t&&t[1]||``}return`
|
|
1
|
+
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$a as n,Ba as r,Ea as i,Ga as a,Ha as o,Ia as s,Ja as c,Ka as l,La as u,Ma as d,Pa as f,Qa as p,Ra as m,Ua as h,Va as g,Wa as _,Xa as v,Ya as y,Zi as b,_a as x,ba as S,ca as C,da as w,fa as T,ga as E,ia as D,ja as ee,la as O,ma as k,no as A,oa as j,pa as M,qa as N,ra as P,to as F,wa as I,xa as L,ya as te,za as ne}from"./Effect-CsknxyoC.js";import{Ai as re,Ci as R,Ei as ie,Fn as ae,Hi as z,Ir as oe,Ma as se,Mr as ce,Na as B,Ni as le,Rr as ue,Si as de,Ta as fe,Ur as pe,Wr as me,do as he,fi as ge,ii as _e,l as ve,oi as ye,pi as be,xa as xe,xi as Se}from"./extension-hook-C8EcEsru.js";import{A as Ce,D as we,F as Te,I as Ee,M as De,N as Oe,R as ke,b as Ae,d as je,f as Me,g as Ne,h as Pe,j as Fe,n as Ie,p as Le,v as Re,y as ze,z as Be}from"./animation-Ca8A_H2p.js";var Ve=t((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var O=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function A(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+k(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(O,`$&/`)+`/`),A(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(O,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+k(s,l);c+=A(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+k(s,l++),c+=A(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function j(e,t,n){if(e==null)return e;var r=[],i=0;return A(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function M(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N={current:null},P={transition:null},F={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:P,ReactCurrentOwner:C};function I(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,e.act=I,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:M}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=P.transition;P.transition={};try{e()}finally{P.transition=t}},e.unstable_act=I,e.useCallback=function(e,t){return N.current.useCallback(e,t)},e.useContext=function(e){return N.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return N.current.useDeferredValue(e)},e.useEffect=function(e,t){return N.current.useEffect(e,t)},e.useId=function(){return N.current.useId()},e.useImperativeHandle=function(e,t,n){return N.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return N.current.useMemo(e,t)},e.useReducer=function(e,t,n){return N.current.useReducer(e,t,n)},e.useRef=function(e){return N.current.useRef(e)},e.useState=function(e){return N.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return N.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return N.current.useTransition()},e.version=`18.3.1`})),He=t(((e,t)=>{t.exports=Ve()})),Ue=w(),We=T(()=>C(`status`,[x({status:M(`available`)}).strict(),x({status:M(`unavailable`),reason:L()}).strict()])),Ge=Ue,Ke=T(()=>te(L(),Ge)),qe=e=>Ge.parse(e),Je=e=>Ke.parse(e),Ye=T(()=>x({code:L().min(1).max(160),message:L().min(1).max(512),details:Ge.optional()}).strict()),Xe=e=>Ye.parse(e),Ze=Ke,Qe=T(()=>L().refine(e=>e.trim().length>0)),$e=We,et=T(()=>I([x({type:M(`action`)}).strict(),x({type:M(`custom`),data:Ke}).strict(),x({type:M(`choice`),options:P(x({value:Ge,label:Qe,description:Qe.optional()}))}).strict(),x({type:M(`form`),submitLabel:Qe.optional()}).strict(),x({type:M(`confirmation`),message:Qe,confirmLabel:Qe.optional(),cancelLabel:Qe.optional()}).strict()])),tt=T(()=>x({inputSchema:Ze.optional(),outputSchema:Ze.optional(),presentation:et.optional()}).strict()),nt=T(()=>E().int().refine(e=>Number.isSafeInteger(e))),rt=T(()=>x({hint:Qe.pipe(L().max(120)),words:P(x({word:L().regex(/^\S{1,64}$/u),description:Qe.pipe(L().max(512)).optional(),arguments:Ke}).strict()).max(32).optional(),text:x({field:Qe.pipe(L().max(120)),arguments:Ke,requestIdField:Qe.pipe(L().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),it=T(()=>x({order:nt.optional()}).strict()),at=T(()=>x({bindings:x({order:nt.optional(),values:P(Qe).max(16)}).strict().optional(),agent:x({keybind:Qe.optional(),order:nt.optional()}).strict().optional(),help:it.optional(),menu:it.optional(),palette:it.optional(),slash:x({aliases:P(Qe).max(16),consumesDraft:j().optional(),order:nt.optional(),arguments:rt.optional()}).strict().optional()}).strict()),ot=T(()=>x({id:Qe.refine(e=>!e.includes(`:`)),title:Qe,category:Qe,description:Qe.optional(),projections:at.optional(),action:tt.optional(),availability:$e.optional()}).strict()),st=e=>ot.parse(e),ct=T(()=>x({inputSchema:Ze.optional(),outputSchema:Ze.optional()}).strict()),lt=L().min(1).brand(),ut=T(()=>x({commandId:lt,command:x({namespace:L(),id:L()}).strict(),sourceId:L(),scope:L().optional(),title:L(),category:L(),description:L().optional(),order:E(),availability:We,action:ct.optional(),keybind:L().optional()}).strict());P(ut);var dt=8192,V=Qe.pipe(L().max(dt)),ft=Qe.pipe(L().max(60)),pt=i({protocol:/^https?$/u}),mt=x({label:V,value:V}).strict(),ht={summary:V.optional(),facts:P(mt).max(4).optional(),body:V.optional(),bodyLabel:V.optional(),details:P(mt).max(24).optional()},gt=C(`type`,[x({type:M(`choice`),message:ft,...ht,current:V.optional(),collapsedGroup:V.optional(),options:P(x({value:V,label:V,description:V.optional(),group:V.optional(),destructive:M(!0).optional()}).strict()).min(1).max(256)}).strict(),x({type:M(`text`),message:ft,...ht,placeholder:V.optional(),secret:j().optional()}).strict(),x({type:M(`confirmation`),message:ft,...ht,confirmLabel:V.optional(),cancelLabel:V.optional(),destructive:M(!0).optional()}).strict(),x({type:M(`decision`),message:ft,...ht,options:P(x({value:V,label:V,description:V.optional(),destructive:M(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(e=>e.value)).size===e.length,`Decision option values must be unique`),multiple:j().optional(),other:x({label:V,placeholder:V.optional(),maxLength:E().int().min(1).max(dt),blank:V.optional()}).strict().optional(),escape:V.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(e=>e.value===t)),`A decision's escape and blank answers must be offered options`)]),_t=T(()=>C(`type`,[x({type:M(`info`),message:V,links:P(x({url:pt,label:V.optional()}).strict()).max(16).optional()}).strict(),x({type:M(`progress`),message:V}).strict(),x({type:M(`handoff`),url:pt,code:V.optional(),message:V.optional()}).strict(),x({type:M(`success`),message:V}).strict()])),vt=e=>gt.parse(e),yt=e=>_t.parse(e),bt={decision:e=>{let t=gt.options[3].parse(e),n=new Set(t.options.map(e=>e.value));return x({selected:P(L()).max(t.options.length),text:O(Qe.pipe(L().max(t.other?.maxLength??1)))}).strict().superRefine((e,r)=>{let i=e=>{r.addIssue({code:`custom`,message:e})};(e.selected.some(e=>!n.has(e))||new Set(e.selected).size!==e.selected.length)&&i(`Pick each offered option at most once`),t.multiple!==!0&&e.selected.length>1&&i(`Pick one option`),e.selected.length===0&&e.text===void 0&&i(`Pick an option or write an answer`),t.other===void 0&&e.text!==void 0&&i(`This decision takes no written answer`),t.multiple!==!0&&e.selected.length>0&&e.text!==void 0&&i(`Pick an option or write an answer, not both`)})},confirmation:e=>(gt.options[2].parse(e),j()),text:e=>(gt.options[1].parse(e),L().max(dt)),choice:e=>{let t=gt.options[0].parse(e);return L().refine(e=>t.options.some(t=>t.value===e))}};function xt(e){let t=bt[e.type](e);return e=>{let n=t.safeParse(e);return n.success?{kind:`accepted`,value:n.data}:{kind:`invalid`,cause:n.error}}}var St=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},Ct=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function wt(){let e=!1,t=nn,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=nn,s(),o.clear())},contribute:t=>{if(Nt(t),e)throw new Ct;Pt(t,n),Ft(t,n);let r=Symbol(`whistle-contribution`);Mt(t)||(n=[...n,{contribution:It(t),generation:r}],i=!0,s());let a=!0;return en(o=>{if(!a||e)return;let c={...t,commands:o};Nt(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);Pt(c,u),Ft(c,u);let d=It(c);if(Mt(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=jt(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=an(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&Tt.has(r.origin)&&(o=n({commandId:At(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=sn(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return nn;let a=n.flatMap(e=>e.contribution.commands.map(an));return(i||a.some((e,t)=>!on(e,r[t])))&&(t=cn(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var Tt=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Et=16,Dt=32,Ot=64,kt=256;function At(e,t){return lt.parse(`${e}:${t}`)}function jt(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function Mt(e){return e.commands.length===0}function Nt(e){Qt(e.sourceId,`source ID`),Qt(e.namespace,`namespace`),e.scope!==void 0&&Qt(e.scope,`scope`);for(let t of e.commands)qt(t)}function Pt(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&tn(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(At(i.contribution.namespace,e.id)),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=At(e.namespace,t.id);n.has(i)&&tn(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&tn(`Slash alias is already registered`),r.add(e)}}function Ft(e,t){t.length>=Ot&&tn(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>kt&&tn(`Live command capacity exceeded`)}function It(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(Lt)};return e.scope===void 0?t:{...t,scope:e.scope}}function Lt(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=Rt(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=Vt(e.projections)),t}function Rt(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=H(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=H(e.outputSchema)),e.presentation!==void 0&&(t.presentation=Bt(e.presentation)),Object.freeze(t)}function H(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,zt(t)])))}function zt(e){return Array.isArray(e)?Object.freeze(e.map(zt)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,zt(t)]))):e}function Bt(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:H(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:zt(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function Vt(e){let t={};return e.bindings!==void 0&&(t.bindings=Ht(e.bindings)),e.agent!==void 0&&(t.agent=Ut(e.agent)),e.help!==void 0&&(t.help=Wt(e.help.order)),e.menu!==void 0&&(t.menu=Wt(e.menu.order)),e.palette!==void 0&&(t.palette=Wt(e.palette.order)),e.slash!==void 0&&(t.slash=Gt(e.slash)),t}function Ht(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function Ut(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function Wt(e){let t={};return e!==void 0&&(t.order=e),t}function Gt(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=Kt(e.arguments)),t}function Kt(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:H(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:H(e.text.arguments)})),Object.freeze(t)}function qt(e){Qt(e.id,`command ID`,!0),Qt(e.title,`title`),Qt(e.category,`category`),Jt(e.action),Yt(e.projections)}function Jt(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Qt(t.label,`choice label`),t.description!==void 0&&Qt(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Qt(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Qt(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Qt(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Qt(e.presentation.cancelLabel,`cancellation label`)}}function Yt(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&$t(t.order);if(e.bindings!==void 0&&Zt(e.bindings.values,`binding`),e.slash!==void 0){Zt(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&tn(`slash alias must not contain whitespace`);Xt(e.slash.arguments)}e.agent?.keybind!==void 0&&Qt(e.agent.keybind,`agent keybind`)}}function Xt(e){if(e===void 0)return;Qt(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&tn(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Qt(n.word,`argument word`),/\s/u.test(n.word)&&tn(`argument word must not contain whitespace`),t.has(n.word)&&tn(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Qt(n.description,`argument word description`);t.size>Dt&&tn(`argument word count exceeds 32`),e.text!==void 0&&(Qt(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Qt(e.text.requestIdField,`request id field`))}function Zt(e,t){e.length>Et&&tn(`${t} count exceeds 16`);for(let n of e)Qt(n,t)}function Qt(e,t,n=!1){e.trim().length===0&&tn(`${t} must not be blank`),n&&e.includes(`:`)&&tn(`${t} must not contain a colon`)}function $t(e){e!==void 0&&!Number.isSafeInteger(e)&&tn(`order must be a safe integer`)}function en(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function tn(e){throw Error(e)}var nn=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),rn=Object.freeze({status:`available`});function an(e){let t=e.availability?.()??rn;return t.status===`available`?rn:Object.freeze({status:`unavailable`,reason:t.reason})}function on(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function sn(e){if(e instanceof St){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:zt(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function cn(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??rn;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...hn(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...hn(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...hn(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...hn(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...hn(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(_n(e,l,u.agent,d))}}return fn(n),pn(i),dn(r),dn(a),dn(o),dn(s),Object.freeze({bindings:mn(n),palette:mn(r),slash:mn(i),help:mn(a),menu:mn(o),agent:mn(s)})}var ln=new TextEncoder;function un(e,t){let n=ln.encode(e),r=ln.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function dn(e){e.sort((e,t)=>e.order-t.order||un(e.commandId,t.commandId))}function fn(e){e.sort((e,t)=>e.order-t.order||un(e.commandId,t.commandId)||un(e.binding,t.binding))}function pn(e){e.sort((e,t)=>e.order-t.order||un(e.commandId,t.commandId)||un(e.alias,t.alias))}function mn(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function hn(e,t,n,r){let i=gn(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function gn(e,t,n,r){let i={commandId:At(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id:t.id}),sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function _n(e,t,n,r){let i=hn(e,t,n.order,r),a=i.action===void 0?i:{...i,action:vn(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function vn(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var yn=t((e=>{var t=He(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),bn=t(((e,t)=>{t.exports=yn()})),U=e(He(),1),W=bn(),xn=U.createContext(void 0),Sn=e=>{let t=U.useContext(xn);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Cn=({client:e,children:t})=>(U.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,W.jsx)(xn.Provider,{value:e,children:t})),wn={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Tn=new class{#e=wn;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function En(e){setTimeout(e,0)}var Dn=typeof window>`u`||`Deno`in globalThis;function On(){}function kn(e,t){return typeof e==`function`?e(t):e}function An(e){return typeof e==`number`&&e>=0&&e!==1/0}function jn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Mn(e,t){return typeof e==`function`?e(t):e}function Nn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Fn(o,t.options))return!1}else if(!Ln(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Pn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(In(t.options.mutationKey)!==In(a))return!1}else if(!Ln(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Fn(e,t){return(t?.queryKeyHashFn||In)(e)}function In(e){return JSON.stringify(e,(e,t)=>Hn(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ln(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!Ln(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Ln(e[r],t[r]))return!1;return!0}return!1}var Rn=Object.prototype.hasOwnProperty;function zn(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Vn(e)&&Vn(t);if(!r&&!(Hn(e)&&Hn(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Rn.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=zn(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Bn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Vn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Hn(e){if(!Un(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Un(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Un(e){return Object.prototype.toString.call(e)===`[object Object]`}function Wn(e){return new Promise(t=>{Tn.setTimeout(t,e)})}function Gn(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:zn(e,t)}function Kn(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function qn(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Jn=Symbol();function Yn(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Jn?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Xn(e,t){return typeof e==`function`?e(...t):!!e}function Zn(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Qn=()=>Dn,$n=()=>Qn(),er=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tr=new class extends er{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},nr=En;function rr(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=nr,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ir=rr(),ar=new class extends er{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function or(e){return Math.min(1e3*2**e,3e4)}function sr(e){return(e??`online`)!==`online`||ar.isOnline()}var cr=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function lr(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(On);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new cr(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>tr.isFocused()&&(e.networkMode===`always`||ar.isOnline())&&e.canRun(),p=()=>sr(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??($n()?0:3),a=e.retryDelay??or,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Wn(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var ur=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),An(this.gcTime)&&(this.#e=Tn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??($n()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Tn.clearTimeout(this.#e),this.#e=void 0)}};function dr(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Zn(e,()=>t.signal,()=>n=!0)},u=Yn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?qn:Kn;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?pr:fr,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:fr(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function fr(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function pr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function mr(e,t){return t?fr(e,t)!=null:!1}function hr(e,t){return!t||!e.getPreviousPageParam?!1:pr(e,t)!=null}var gr=class extends ur{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=yr(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=yr(this.options);e.data!==void 0&&(this.setState(vr(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Gn(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(On).catch(On):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Mn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Mn(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!jn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Yn(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?dr(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=lr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof cr&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof cr){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,..._r(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...vr(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ir.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function _r(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:sr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function vr(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function yr(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var br=class extends er{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Sr(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Cr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Cr(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Mn(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Bn(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&wr(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Mn(this.options.enabled,this.#t)!==Mn(t.enabled,this.#t)||Mn(this.options.staleTime,this.#t)!==Mn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Mn(this.options.enabled,this.#t)!==Mn(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Bn(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(On)),t}#h(e){return!$n()&&Mn(this.options.enabled,this.#t)!==!1&&An(e)}#g(){this.#b();let e=Mn(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=jn(this.#r.dataUpdatedAt,e)+1;this.#u=Tn.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=Tn.setInterval(()=>{(this.options.refetchIntervalInBackground||tr.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Tn.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Tn.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Sr(e,t),o=i&&wr(e,n,t,r);(a||o)&&(l={...l,..._r(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Gn(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Gn(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Tr(e,t),refetch:this.refetch,isEnabled:Mn(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),Bn(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();ir.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function xr(e,t){return Mn(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Mn(t.retryOnMount,e)!==!1)}function Sr(e,t){return xr(e,t)||e.state.data!==void 0&&Cr(e,t,t.refetchOnMount)}function Cr(e,t,n){if(Mn(t.enabled,e)!==!1&&Mn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Tr(e,t)}return!1}function wr(e,t,n,r){return(e!==t||Mn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Tr(e,n)}function Tr(e,t){return Mn(t.enabled,e)!==!1&&e.isStaleByTime(Mn(t.staleTime,e))}var Er=class extends ur{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Dr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=lr({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ir.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Dr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Or=class extends er{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Er({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=kr(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=kr(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=kr(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=kr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ir.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Pn(t,e))}findAll(e={}){return this.getAll().filter(t=>Pn(e,t))}notify(e){ir.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ir.batch(()=>Promise.all(e.map(e=>e.continue().catch(On))))}};function kr(e){return e.options.scope?.id}var Ar=class extends er{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Bn(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&In(t.mutationKey)!==In(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Dr();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ir.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},jr=class extends er{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Fn(r,t),a=this.get(i);return a||(a=new gr({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ir.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Nn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Nn(e,t)):t}notify(e){ir.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ir.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ir.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Mr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new jr,this.#t=e.mutationCache||new Or,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=tr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ar.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Mn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=kn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ir.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ir.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ir.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=ir.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(On).catch(On)}invalidateQueries(e,t={}){return ir.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ir.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(On)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(On)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Mn(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Mn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(On).catch(On)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(On).catch(On)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ar.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(In(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ln(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(In(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ln(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Fn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Jn&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function Nr({streamFn:e,refetchMode:t=`reset`,reducer:n=(e,t)=>Kn(e,t),initialValue:r=[]}){return async i=>{let a=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),o=!!a&&a.isFetched();o&&t===`reset`&&a.setState({...a.resetState,fetchStatus:`fetching`});let s=r,c=!1,l=await e(Zn({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>c=!0)),u=o&&t===`replace`;for await(let e of l){if(c)break;u?s=n(s,e):i.client.setQueryData(i.queryKey,t=>n(t===void 0?r:t,e))}return u&&!c&&i.client.setQueryData(i.queryKey,s),i.client.getQueryData(i.queryKey)??r}}function Pr(e){return e}function Fr(e){return e}var Ir=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,j(x);else{var t=n(l);t!==null&&M(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&M(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function ee(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?O():(S=!1,C=null)}}else S=!1}var O;if(typeof v==`function`)O=function(){v(ee)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=ee,O=function(){A.postMessage(null)}}else O=function(){g(ee,0)};function j(e){C=e,S||(S=!0,O())}function M(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,j(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,M(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,j(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Lr=t(((e,t)=>{t.exports=Ir()})),Rr=t((e=>{var t=He(),n=Lr();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function p(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function m(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function h(e,t,n,r){if(t==null||m(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function g(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var _={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){_[e]=new g(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];_[t]=new g(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){_[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){_[e]=new g(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){_[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){_[e]=new g(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){_[e]=new g(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){_[e]=new g(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){_[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),_.xlinkHref=new g(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,t,n,r){var i=_.hasOwnProperty(t)?_[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(h(t,n,i,r)&&(n=null),r||i===null?p(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=Symbol.for(`react.element`),C=Symbol.for(`react.portal`),w=Symbol.for(`react.fragment`),T=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),D=Symbol.for(`react.provider`),ee=Symbol.for(`react.context`),O=Symbol.for(`react.forward_ref`),k=Symbol.for(`react.suspense`),A=Symbol.for(`react.suspense_list`),j=Symbol.for(`react.memo`),M=Symbol.for(`react.lazy`),N=Symbol.for(`react.offscreen`),P=Symbol.iterator;function F(e){return typeof e!=`object`||!e?null:(e=P&&e[P]||e[`@@iterator`],typeof e==`function`?e:null)}var I=Object.assign,L;function te(e){if(L===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);L=t&&t[1]||``}return`
|
|
2
2
|
`+L+e}var ne=!1;function re(e,t){if(!e||ne)return``;ne=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
3
3
|
`),a=r.stack.split(`
|
|
4
4
|
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./models-BM_0GHMS.js";import{r as t}from"./runtime-core-
|
|
1
|
+
import{n as e}from"./models-BM_0GHMS.js";import{r as t}from"./runtime-core-C5cCJNx2.js";function n(){return typeof process>`u`||!(process.versions?.node||process.versions?.bun)?null:process.getBuiltinModule?.(`node:os`)??null}var r=n();function i(){return r?`pi (${r.platform()} ${r.release()}; ${r.arch()})`:`pi (browser)`}var a=class extends Error{},o=[`$ref`,`$defs`,`definitions`,`allOf`,`oneOf`,`patternProperties`,`dependentSchemas`,`dependencies`,`unevaluatedProperties`,`propertyNames`,`contains`,`prefixItems`,`not`,`if`,`then`,`else`];function s(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function c(e){if(!s(e))return!1;let t=typeof e.type==`string`?[e.type]:Array.isArray(e.type)?e.type:[];return t.includes(`object`)||t.includes(`array`)||e.properties!==void 0||e.items!==void 0}function l(e){return s(e)?e.type===`null`||Array.isArray(e.type)&&e.type.includes(`null`)||e.const===null||Array.isArray(e.enum)&&e.enum.includes(null)?!0:Array.isArray(e.anyOf)&&e.anyOf.some(e=>l(e)):!1}function u(e,t){if(!s(e))throw new a(`boolean schemas are unsupported`);for(let t of o)if(e[t]!==void 0)throw new a(`${t} schemas are unsupported`);if(t){for(let[n,r]of Object.entries(e))if(t(n,r))throw new a(`${n}: ${JSON.stringify(r)} is unsupported`)}if(e.anyOf!==void 0){if(!Array.isArray(e.anyOf)||e.anyOf.length===0)throw new a(`anyOf must contain at least one schema`);for(let n of e.anyOf){if(c(n))throw new a(`object and array unions are unsupported`);u(n,t)}}if(e.items!==void 0){if(Array.isArray(e.items))throw new a(`tuple schemas are unsupported`);u(e.items,t)}let n=e.type===`object`;if(e.properties!==void 0&&!n)throw new a(`properties require type object`);if(!n)return;if(e.additionalProperties!==void 0&&e.additionalProperties!==!1)throw new a(`schema-valued or true additionalProperties is unsupported`);if(e.properties!==void 0&&!s(e.properties))throw new a(`object properties must be a schema map`);if(e.required!==void 0&&(!Array.isArray(e.required)||e.required.some(e=>typeof e!=`string`)))throw new a(`object required must be a string array`);let r=e.properties??{},i=Object.keys(r),d=new Set(Array.isArray(e.required)?e.required:[]);if([...d].some(e=>!i.includes(e)))throw new a(`required contains an unknown property`);for(let[e,n]of Object.entries(r))u(n,t),!d.has(e)&&!l(n)&&(r[e]={anyOf:[n,{type:`null`}]});e.required=i,e.additionalProperties=!1}function d(e,t){let n=structuredClone(e);if(!s(n)||(u(n,t),n.type!==`object`))throw new a(`root schema must have type object`);return n}function f(e,t){return t===!0?d(e.parameters):e.parameters}function p(e,t,n){let r=t[n];if(typeof r!=`string`)throw Error(`Grammar tool call "${e}" requires argument "${n}" to be a string.`);return r}function m(e,t,n,r){if(e.closed){if(r&&n===e.input)return;throw Error(`grammar tool input for property "${t}" changed after it was closed`)}if(!n.startsWith(e.input))throw Error(`grammar tool input for property "${t}" changed non-monotonically`);let i=n.slice(e.input.length);if(!r&&i.length===0)return;let a=``;return e.started||=(a+=`{${JSON.stringify(t)}:"`,!0),a+=JSON.stringify(i).slice(1,-1),e.input=n,r&&(a+=`"}`,e.closed=!0),a}function h(e){let t=e.parameters;if(t.type!==`object`)throw Error(`grammar constrained sampling requires an object parameter schema`);if(!Array.isArray(t.required)||t.required.length!==1||typeof t.required[0]!=`string`)throw Error(`grammar constrained sampling requires exactly one required string property`);let n=t.required[0];if(!t.properties?.[n])throw Error(`grammar constrained sampling requires a properties entry for ${n}`);if(t.properties[n]?.type!==`string`)throw Error(`grammar constrained sampling property ${n} must have type string`);return n}function g(e,t,n){let r=e.constrainedSampling;if(!(!r||r.type!==`json_schema`)){if(t)try{return d(e.parameters,n),!0}catch(t){if(!(t instanceof a))throw t;if(r.strict!==`require`)return;throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but ${t.message}.`)}if(r.strict===`require`)throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`)}}function _(e,t){let n=e.constrainedSampling;if(!n||n.type!==`grammar`||!t)return;let r=n.variants.openai_lark,i=n.variants.openai_regex,a=typeof r==`string`&&r.trim().length>0,o=typeof i==`string`&&i.trim().length>0;if(!a&&!o)throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);try{return{format:a?`lark`:`regex`,definition:a?r:i,inputProperty:h(e)}}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: ${n}.`)}}function v(e,t){let n=new Map;for(let r of e??[]){let e=_(r,t);e&&n.set(r.name,e.inputProperty)}return n}var y=4096,b=1;function x(e,n,r){if(e.contextWindow<=0)return Math.max(b,r);let i=e.contextWindow-t(n).tokens-y;return Math.min(r,Math.max(b,i))}function S(t,n,r){let i=e(t,n),a=t.samplingParamsByThinkingLevel?.[i];return t.samplingParams||a||r?{...t.samplingParams,...a,...r}:void 0}function C(e,t,n,r){let i=S(e,n?.reasoning??`off`,n?.samplingParams);return{temperature:n?.temperature,samplingParams:i,maxTokens:x(e,t,n?.maxTokens??e.maxTokens),signal:n?.signal,telemetryContext:n?.telemetryContext,apiKey:r||n?.apiKey,fetch:n?.fetch,transport:n?.transport,cacheRetention:n?.cacheRetention,sessionId:n?.sessionId,headers:n?.headers,onPayload:n?.onPayload,onResponse:n?.onResponse,onProviderStreamEvent:n?.onProviderStreamEvent,timeoutMs:n?.timeoutMs,websocketConnectTimeoutMs:n?.websocketConnectTimeoutMs,maxRetries:n?.maxRetries,maxRetryDelayMs:n?.maxRetryDelayMs,metadata:n?.metadata,env:n?.env}}var w=1024,T={minimal:1024,low:2048,medium:8192,high:16384};function E(e){return e===`xhigh`||e===`max`?`high`:e}function D(e,t){return{...T,...t}[E(e)]}function O(e,t){return Math.min(e,Math.max(0,t-w))}function k(e,t,n,r){let i=D(n,r),a=e===void 0?t:Math.min(e+i,t);return a<=i&&(i=O(i,a)),{maxTokens:a,thinkingBudget:i}}var A=`(image omitted: model does not support images)`,j=`(tool image omitted: model does not support images)`,M=`(image attached after the tool results)`;function N(e){if(!e.isError)return;let t=e.content.filter(e=>e.type===`image`);if(t.length!==0)return{content:P(e.content,M),caption:`Images from the error result of tool call ${e.toolCallId} (${e.toolName}):`,images:t}}function P(e,t){let n=[],r=!1;for(let i of e){if(i.type===`image`){r||n.push({type:`text`,text:t}),r=!0;continue}n.push(i),r=i.text===t}return n}function F(e,t){return t.input.includes(`image`)?e:e.map(e=>e.role===`user`&&Array.isArray(e.content)?{...e,content:P(e.content,A)}:e.role===`toolResult`?{...e,content:P(e.content,j)}:e)}function I(e,t,n){let r=new Map,i=F(e.map(e=>e.content==null?{...e,content:[]}:e),t).map(e=>{if(e.role===`system`||e.role===`user`)return e;if(e.role===`toolResult`){let t=r.get(e.toolCallId);return t&&t!==e.toolCallId?{...e,toolCallId:t}:e}if(e.role===`assistant`){let i=e,a=i.provider===t.provider&&i.api===t.api&&i.model===t.id,o=i.content.flatMap(e=>{if(e.type===`thinking`)return a?e.redacted||e.thinkingSignature?e:!e.thinking||e.thinking.trim()===``?[]:e:[];if(e.type===`text`)return a?e:{type:`text`,text:e.text};if(e.type===`toolCall`){let o=e,s=o;if(!a&&o.thoughtSignature&&(s={...o},delete s.thoughtSignature),!a&&n){let e=n(o.id,t,i);e!==o.id&&(r.set(o.id,e),s={...s,id:e})}return s}return e});return{...i,content:o}}return e}),a=[],o=[],s=new Set,c=[],l=()=>{if(o.length>0){for(let e of o)s.has(e.id)||a.push({role:`toolResult`,toolCallId:e.id,toolName:e.name,content:[{type:`text`,text:`No result provided`}],isError:!0,timestamp:Date.now()});o=[],s=new Set}a.push(...c),c.length=0};for(let e=0;e<i.length;e++){let t=i[e];if(t.role===`assistant`){l();let e=t;if(e.stopReason===`error`||e.stopReason===`aborted`)continue;let n=e.content.filter(e=>e.type===`toolCall`);n.length>0&&(o=n,s=new Set),a.push(t)}else t.role===`toolResult`?(s.add(t.toolCallId),a.push(t)):t.role===`system`?o.length>0?c.push(t):a.push(t):(t.role===`user`&&l(),a.push(t))}return l(),a}export{x as a,D as c,p as d,f,i as h,C as i,m as l,g as m,I as n,O as o,_ as p,k as r,S as s,N as t,v as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,L as n,M as r,N as i,O as a,P as o,gi as s,j as c,ji as l,yr as u}from"./sigil-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,L as n,M as r,N as i,O as a,P as o,gi as s,j as c,ji as l,yr as u}from"./sigil-CwDKTeeQ.js";import{ti as d}from"./extension-hook-C8EcEsru.js";import{t as f}from"./parakeet-CQ3Gd-gj.js";var p=e(l(),1),m=s();function h({inbox:e}){let{selected:s,session:l,action:h,canManage:g,openingError:_}=e,[v,y]=(0,p.useState)(null);if((0,p.useEffect)(()=>{y(null)},[s?.bindingId,s?.conversation.sessionId,g]),s===void 0)return null;let b=s.conversation;return(0,m.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":`Website conversation`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-base-300 p-2`,children:[(0,m.jsx)(`span`,{className:`min-w-0 flex-1 text-sm`,children:b.heldByYou?`You're replying. The Agent is paused.`:b.held?`${b.heldByName??`A teammate`} is replying.`:`The Agent is replying. Take over to answer as yourself.`}),g?(0,m.jsx)(u,{size:`sm`,disabled:h.isPending,onClick:()=>{let e={bindingId:s.bindingId,sessionId:b.sessionId};b.heldByYou?h.mutate({kind:`release`,...e,expectedVersion:b.holdVersion,confirm:!1}):b.held?y({...e,version:b.holdVersion,name:b.heldByName??`A teammate`}):h.mutate({kind:`hold`,...e,expectedVersion:b.holdVersion,confirm:!1})},children:b.heldByYou?`Hand back to Agent`:`Take over`}):null]}),(0,m.jsx)(a,{open:v!==null,onOpenChange:e=>{e||y(null)},children:(0,m.jsxs)(c,{children:[(0,m.jsxs)(o,{children:[(0,m.jsxs)(n,{children:[v?.name,` is replying — take over?`]}),(0,m.jsx)(r,{children:`You will reply as yourself. Their replies stop until they take over again.`})]}),(0,m.jsxs)(i,{children:[(0,m.jsx)(t,{render:(0,m.jsx)(u,{variant:`outline`}),children:`Cancel`}),(0,m.jsx)(u,{disabled:h.isPending||!g,onClick:()=>{v!==null&&(h.mutate({kind:`hold`,bindingId:v.bindingId,sessionId:v.sessionId,expectedVersion:v.version,confirm:!0}),y(null))},children:`Take over`})]})]})}),g?null:(0,m.jsx)(`p`,{className:`p-3 text-sm`,children:`Allow takeover in Grove's App permissions to reply. Your Team permissions still apply.`}),h.isError?(0,m.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:`This conversation changed or website access was removed. Refresh and try again.`}):null,_?(0,m.jsx)(`p`,{role:`alert`,className:`p-2 text-sm text-error`,children:_}):null,l?(0,m.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,m.jsx)(f,{authorOf:d,disambiguateAuthors:!0,session:l,markdownPolicy:`visitor`,composerActionVariant:`outline`},`${s.bindingId}:${b.sessionId}`)}):null]})}export{h as WebsiteConversation};
|
package/dist/index.html
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>Inbox</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-B9JPxELm.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/Effect-CsknxyoC.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-DY31Aviq.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/extension-hook-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/extension-hook-C8EcEsru.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/animation-Ca8A_H2p.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/sigil-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/sigil-CwDKTeeQ.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/document-Bq-ilh6h.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/base-face-BYNJAADF.js">
|
|
16
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
16
|
+
<link rel="stylesheet" crossorigin href="/assets/index-ChM-AVzG.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
19
19
|
<div id="inbox-root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/grove",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Grove: conversations with agents that call your other Apps, for Oyster",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"@fungi.computer/agar": "0.10.0",
|
|
9
9
|
"@fungi.computer/approvals": "0.2.3",
|
|
10
10
|
"@fungi.computer/cairn": "0.1.0",
|
|
11
|
-
"@fungi.computer/caps": "0.11.
|
|
11
|
+
"@fungi.computer/caps": "0.11.2",
|
|
12
12
|
"@fungi.computer/knapsack": "0.4.9",
|
|
13
13
|
"@fungi.computer/maosaico": "0.1.2",
|
|
14
|
-
"@fungi.computer/parakeet": "0.11.
|
|
14
|
+
"@fungi.computer/parakeet": "0.11.20",
|
|
15
15
|
"@fungi.computer/shiitake": "0.13.1",
|
|
16
16
|
"@fungi.computer/sigils": "0.3.1",
|
|
17
17
|
"@fungi.computer/sprite": "0.2.2",
|