@recombine-ai/platform 0.11.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bosun/index.d.ts +2 -2
- package/build/bosun/index.d.ts.map +1 -1
- package/build/bosun/interfaces/agent.d.ts +7 -0
- package/build/bosun/interfaces/agent.d.ts.map +1 -1
- package/build/bosun/interfaces/project.d.ts +6 -0
- package/build/bosun/interfaces/project.d.ts.map +1 -1
- package/build/bosun-app/backend/server.js +7076 -6658
- package/build/bosun-app/backend/server.js.map +4 -4
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BA_s3vf-.js +1 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BA_s3vf-.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BA_s3vf-.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{B6dAvKma.js → BDj12791.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BDj12791.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BDj12791.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BundM1xT.js +1 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BundM1xT.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BundM1xT.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CWrb40J2.js +1 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CWrb40J2.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CWrb40J2.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{DzS2Oxih.js → DaPi9zoH.js} +2 -2
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DaPi9zoH.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DaPi9zoH.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/hHPtUt6H.js +1 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/hHPtUt6H.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/hHPtUt6H.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/{app.d6NReluD.js → app.DEGfM7JG.js} +2 -2
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.DEGfM7JG.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.DEGfM7JG.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.D2Q-9wJB.js +1 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.D2Q-9wJB.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.D2Q-9wJB.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{0.CbpCxLRG.js → 0.D4hVCSQO.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.D4hVCSQO.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.D4hVCSQO.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{1.BSF2Ppp_.js → 1.exu_SEtw.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.exu_SEtw.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.exu_SEtw.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{10.zuftnL65.js → 10.D9EOZOcA.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.D9EOZOcA.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.D9EOZOcA.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{17.Ce5Tbn8k.js → 17.BBzzkhS3.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.BBzzkhS3.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.BBzzkhS3.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{18.BezESfUX.js → 18.C1Wu7YII.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.C1Wu7YII.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.C1Wu7YII.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.K_wNLkOy.js +35 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.K_wNLkOy.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.K_wNLkOy.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{3.DL97ronX.js → 3.DC1YtH2n.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.DC1YtH2n.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.DC1YtH2n.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{4.OKeVO1DM.js → 4.DjofsVgf.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.DjofsVgf.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.DjofsVgf.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{5.DtbvqoNH.js → 5.Daft73xD.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.Daft73xD.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.Daft73xD.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{6.U0GvoBZK.js → 6.BC5i16hF.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.BC5i16hF.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.BC5i16hF.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{8.BgkMXMOC.js → 8.BD-2mMOE.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.BD-2mMOE.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.BD-2mMOE.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DStZMtBP.js +2 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DStZMtBP.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DStZMtBP.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/version.json +1 -1
- package/build/bosun-app/frontend/client/_app/version.json.br +0 -0
- package/build/bosun-app/frontend/client/_app/version.json.gz +0 -0
- package/build/bosun-app/frontend/handler.js +4 -4
- package/build/bosun-app/frontend/index.js +4 -4
- package/build/bosun-app/frontend/server/chunks/chunks/{internal.js-CEK3lz9n.js → internal.js-B2-81-og.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/chunks/{internal.js-CEK3lz9n.js.map → internal.js-B2-81-og.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/chunks/{log-content.svelte.js-C6EzbHLC.js → log-content.svelte.js-NCi6Gu4g.js} +6 -3
- package/build/bosun-app/frontend/server/chunks/chunks/log-content.svelte.js-NCi6Gu4g.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/{_layout.svelte.js-B2wHKJV7.js → _layout.svelte.js-bpxxSpHz.js} +76 -5
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/_layout.svelte.js-bpxxSpHz.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/roleplay/{_page.svelte.js-DDcIjgZD.js → _page.svelte.js-aRz73jD-.js} +58 -18
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/roleplay/_page.svelte.js-aRz73jD-.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/{handler-BHyQK1W7.js → handler-C5nNwvq2.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/{handler-BHyQK1W7.js.map → handler-C5nNwvq2.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/{index.js-UYhngiFj.js → index.js-OQig22wo.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/{index.js-UYhngiFj.js.map → index.js-OQig22wo.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/{manifest.js-Do3zIbnG.js → manifest.js-mMK7bnzv.js} +14 -14
- package/build/bosun-app/frontend/server/chunks/{manifest.js-Do3zIbnG.js.map → manifest.js-mMK7bnzv.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{0.js-M0igMOW3.js → 0.js-DHGYS99S.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{0.js-M0igMOW3.js.map → 0.js-DHGYS99S.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{1.js-DFlIvtLV.js → 1.js-Bcf6Apx5.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{1.js-DFlIvtLV.js.map → 1.js-Bcf6Apx5.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{10.js-B_Oxelgw.js → 10.js-DrOSxSqp.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{10.js-B_Oxelgw.js.map → 10.js-DrOSxSqp.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{17.js-CLWQDSJZ.js → 17.js-CI2KQfFS.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{17.js-CLWQDSJZ.js.map → 17.js-CI2KQfFS.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{18.js-DHxphzB_.js → 18.js-BrwBD9MG.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{18.js-DHxphzB_.js.map → 18.js-BrwBD9MG.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{2.js-DbHCntW0.js → 2.js-CGziSbJs.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{2.js-DbHCntW0.js.map → 2.js-CGziSbJs.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{3.js-DNCZoG-i.js → 3.js-jXjzl_HM.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{3.js-DNCZoG-i.js.map → 3.js-jXjzl_HM.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{4.js-DjTw8jN1.js → 4.js-DHb154Fk.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{4.js-DjTw8jN1.js.map → 4.js-DHb154Fk.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{5.js-eUcCHhQJ.js → 5.js-DncWCDEN.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{5.js-eUcCHhQJ.js.map → 5.js-DncWCDEN.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{6.js-CFZQZHel.js → 6.js-DDVvJCgQ.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{6.js-CFZQZHel.js.map → 6.js-DDVvJCgQ.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{8.js-6P9C8mKt.js → 8.js-DQx6ZWZj.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{8.js-6P9C8mKt.js.map → 8.js-DQx6ZWZj.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{9.js-7_R7HAwF.js → 9.js-CWugbQHv.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{9.js-7_R7HAwF.js.map → 9.js-CWugbQHv.js.map} +1 -1
- package/package.json +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/B6dAvKma.js.br +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/B6dAvKma.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/C_CclDpz.js +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/C_CclDpz.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/C_CclDpz.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CgLfT-y5.js +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CgLfT-y5.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CgLfT-y5.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DFDJkbCA.js +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DFDJkbCA.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DFDJkbCA.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DzS2Oxih.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DzS2Oxih.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/ouMvMh56.js +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/ouMvMh56.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/ouMvMh56.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.d6NReluD.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.d6NReluD.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.CnMplwie.js +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.CnMplwie.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.CnMplwie.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.CbpCxLRG.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.CbpCxLRG.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.BSF2Ppp_.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.BSF2Ppp_.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.zuftnL65.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.zuftnL65.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.Ce5Tbn8k.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.Ce5Tbn8k.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.BezESfUX.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.BezESfUX.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.KJZsLYut.js +0 -35
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.KJZsLYut.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.KJZsLYut.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.DL97ronX.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.DL97ronX.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.OKeVO1DM.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.OKeVO1DM.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.DtbvqoNH.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.DtbvqoNH.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.U0GvoBZK.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.U0GvoBZK.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.BgkMXMOC.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.BgkMXMOC.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DvxARvU2.js +0 -2
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DvxARvU2.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DvxARvU2.js.gz +0 -0
- package/build/bosun-app/frontend/server/chunks/chunks/log-content.svelte.js-C6EzbHLC.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/_layout.svelte.js-B2wHKJV7.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/roleplay/_page.svelte.js-DDcIjgZD.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/DLQqXQ6R.js","../chunks/C1FmrZbK.js","../assets/editor.BMIWPGx3.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var mr=Object.defineProperty;var gr=(C,T,l)=>T in C?mr(C,T,{enumerable:!0,configurable:!0,writable:!0,value:l}):C[T]=l;var Ke=(C,T,l)=>gr(C,typeof T!="symbol"?T+"":T,l);import{a as Z,f as ve,d as tn,b as Rt,t as Ue,c as Nt}from"../chunks/CCYriF4C.js";import{o as nn,a as Mn}from"../chunks/DnMQeiTY.js";import{p as vt,j as y,a as mt,n as we,br as yr,y as ne,d as Je,c as re,r as te,w as Ce,s as he,o as je,t as De,f as Qe,a4 as Bn,bh as Kn,_ as jn,x as bn,T as En}from"../chunks/CR-uVjxM.js";import{s as Ne}from"../chunks/B0nqNj93.js";import{i as Pe}from"../chunks/BQIf5msi.js";import{M as zt,k as _r,R as xr}from"../chunks/C3cROXCy.js";import{e as _t,i as Xt}from"../chunks/DuQdgMax.js";import{s as wr}from"../chunks/9mOMnnWN.js";import{a as br,r as Dn,e as Er,c as kr}from"../chunks/CR5IRTqC.js";import{s as Sr}from"../chunks/C9yBjdYI.js";import{b as Or,a as Lr}from"../chunks/B9pMb6OP.js";import{P as kt,g as rn,s as Tr}from"../chunks/CHCMKZAC.js";import{B as Ze}from"../chunks/joiJcRPz.js";import{e as kn,f as Ar,g as Cr,h as Pr,j as Nr,D as Rr}from"../chunks/CWrb40J2.js";import{I as Ir}from"../chunks/BBk8_Xpk.js";import{T as Zt,a as dt}from"../chunks/BEdAvgYp.js";import{b as on}from"../chunks/ClLUwVGq.js";import{p as st,r as Fr}from"../chunks/BcbX6huO.js";import{p as Qt,l as Mr,C as $n,P as Yt}from"../chunks/BW6P0Ecp.js";import{r as Br,g as Et}from"../chunks/hHPtUt6H.js";import{p as tt}from"../chunks/BDj12791.js";import{e as Jt,t as nt}from"../chunks/BA_s3vf-.js";import{i as Kr}from"../chunks/DgGeUDDh.js";import{_ as Vn}from"../chunks/C1FmrZbK.js";import{e as Un,a as Wn,c as jr}from"../chunks/BU7aeYn4.js";import{A as Dr}from"../chunks/C0rPkxmP.js";import{g as $r}from"../chunks/Dba0_Upf.js";import"../chunks/DXsF11_5.js";import{i as qn}from"../chunks/Bp8N7Z1t.js";import{c as Sn,a as Vr}from"../chunks/B1dhmiqQ.js";var Ur=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wr(C){return C&&C.__esModule&&Object.prototype.hasOwnProperty.call(C,"default")?C.default:C}var qr=new Set(["$$slots","$$events","$$legacy","class","value","variant","el"]),Hr=ve("<textarea></textarea>");function Gr(C,T){vt(T,!0);let l=st(T,"class",3,""),k=st(T,"value",15,""),w=st(T,"variant",3,"config"),p=st(T,"el",15),b=Fr(T,qr),u=we(()=>w()==="chat"?`textarea-chat ${l()}`:`textarea-config ${l()}`);var e=Hr();yr(e),br(e,()=>({class:y(u),...b}),void 0,void 0,void 0,"svelte-1ilrf3m"),on(e,_=>p(_),()=>p()),Or(e,k),Z(C,e),mt()}class zr{constructor(T){Ke(this,"ws",null);Ke(this,"openHandler",null);Ke(this,"closeHandler",null);Ke(this,"errorHandler",null);Ke(this,"messageHandler",null);Ke(this,"retries",0);Ke(this,"maxRetries",5);Ke(this,"retryDelay",500);Ke(this,"retryTimeout",null);Ke(this,"isOpen",!1);Ke(this,"isDestroyed",!1);Ke(this,"agentsLoaded",!1);Ke(this,"init",()=>{if(!this.isOpen){this.agentsLoaded=!1,console.log(`Initializing websocket connection with [${this.wsUrl}]`);try{this.ws=new WebSocket(this.wsUrl)}catch{this.retryConnect();return}this.isDestroyed=!1,this.ws.onmessage=T=>{var k,w,p,b,u,e,_,O;const l=JSON.parse(T.data);l.channel==="error"?(k=this.errorHandler)==null||k.call(this,l.message):l.channel==="app-events"?(console.log("MSG:",l.event.type),l.event.type==="agents-loaded"&&(this.agentsLoaded=!0)):l.channel==="log"?console.log(`MSG: log [${l.message.severity}]`,l.message.message):l.channel==="api-call-trace"?console.log("MSG: api-call-trace",(w=l.trace)==null?void 0:w.operationName,(p=l.trace)==null?void 0:p.method,(b=l.trace)==null?void 0:b.path):l.channel==="conversational-trace"?console.log("MSG: conversational-trace",(u=l.trace)==null?void 0:u.eventName,(e=l.trace)==null?void 0:e.role,(_=l.trace)==null?void 0:_.medium):l.channel==="playground-mock-trace"&&console.log("MSG: playground-mock-trace",l.trace.operationName,l.trace.status),(O=this.messageHandler)==null||O.call(this,l)},this.ws.onerror=T=>{var l;console.error("Websocket error:",T),(l=this.ws)==null||l.close(),this.retryConnect()},this.ws.onclose=()=>{console.log("Websocket closed"),this.isOpen=!1,this.retryConnect()},this.ws.onopen=()=>{var T;this.retries=0,this.isOpen=!0,this.retryTimeout&&clearTimeout(this.retryTimeout),(T=this.openHandler)==null||T.call(this),console.log("Websocket connected")}}});Ke(this,"destroy",()=>{var T;this.isDestroyed=!0,(T=this.ws)==null||T.close()});Ke(this,"onOpen",T=>{this.openHandler=T,this.isOpen&&T()});Ke(this,"onClose",T=>{this.closeHandler=T,this.isOpen||T()});Ke(this,"onError",T=>{this.errorHandler=T});Ke(this,"onMessage",T=>{this.messageHandler=T});Ke(this,"sendMessage",T=>{var l;T.channel,(l=this.ws)==null||l.send(JSON.stringify(T))});Ke(this,"isReady",()=>this.isOpen&&this.agentsLoaded);Ke(this,"retryConnect",()=>{var T,l;this.isDestroyed||(!this.isOpen&&this.retries<this.maxRetries?(this.retries++,this.init(),this.retryTimeout=setTimeout(this.retryConnect,this.retryDelay)):((T=this.errorHandler)==null||T.call(this,"WebSocket Error, please reload the browser"),(l=this.closeHandler)==null||l.call(this)))});this.wsUrl=T}}const Qr=Jt.PUBLIC_WS_HOST??`ws://${Jt.PUBLIC_WS_HOSTNAME??"localhost"}:${Jt.PUBLIC_WS_PORT??"8080"}`,ht=new zr(Qr);var Yr=ve('<div class="flex h-full flex-col"><div class="h-full w-full"></div></div>');function Jr(C,T){vt(T,!0);let l=Ce(null),k=null,w=[],p=!1,b;nn(async()=>{if(!b)return;Un();const u=await Vn(()=>import("../chunks/DLQqXQ6R.js").then(e=>e.e),__vite__mapDeps([0,1,2]),import.meta.url);p||(Wn(u),ne(l,u.editor.create(b,{value:T.schema??"",language:"typescript",theme:"bosun-dark",lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},matchBrackets:"never",bracketPairColorization:{enabled:!1},guides:{highlightActiveBracketPair:!1,bracketPairs:!1,bracketPairsHorizontal:!1},occurrencesHighlight:"off",selectionHighlight:!1,unicodeHighlight:{ambiguousCharacters:!1,nonBasicASCII:!1,invisibleCharacters:!1,includeStrings:!1,includeComments:!1},autoClosingQuotes:"never"}),!0),k=y(l).getModel(),w.push(y(l).onDidChangeModelContent(()=>{if(!y(l))return;const e=y(l).getValue();e!==T.schema&&T.onChange(e)})))}),Mn(()=>{p=!0;for(const e of w)try{e.dispose()}catch{}w=[];const u=k;k=null;try{if(y(l)){try{y(l).setModel(null)}catch{}y(l).dispose()}}finally{ne(l,null)}try{u==null||u.dispose()}catch{}}),Je(()=>{if(!y(l))return;const u=T.schema??"";y(l).getValue()!==u&&y(l).setValue(u)}),kt(C,{get class(){return`overflow-hidden ${T.class??""}`},children:(u,e)=>{var _=Yr(),O=re(_);on(O,V=>b=V,()=>b),te(_),Z(u,_)}}),mt()}function Xr(C,T){return C.languages.registerCompletionItemProvider("markdown",{triggerCharacters:[" ","."],provideCompletionItems:(l,k)=>{const w=l.getValueInRange({startLineNumber:k.lineNumber,startColumn:1,endLineNumber:k.lineNumber,endColumn:k.column}),p=w.match(/\{%\s*(if|elif|for)\s+([^%]*)$/),b=w.match(/\{\{\s*([^}]*)$/);if(p||b){let e="";p?e=p[2].trim():b&&(e=b[1].trim());const{keys:_,lastPartLength:O}=Zr(T,e);return{suggestions:_.map(W=>({label:W,kind:C.languages.CompletionItemKind.Variable,insertText:W,range:{startLineNumber:k.lineNumber,endLineNumber:k.lineNumber,startColumn:k.column-O,endColumn:k.column}}))}}const u=w.match(/\{%\s*([^%]*)$/);if(u){const e=u[1].trim();return{suggestions:en(["if","elif","else","endif","for","endfor"],e).map((O,V)=>({label:O,kind:C.languages.CompletionItemKind.Keyword,insertText:O,sortText:String(V).padStart(2,"0"),range:{startLineNumber:k.lineNumber,endLineNumber:k.lineNumber,startColumn:k.column-e.length,endColumn:k.column}}))}}return{suggestions:[]}}})}function Zr(C,T){let l=C,k=[],w=0;if(T==="")k=Object.keys(C??{}),w=0;else if(T.includes(".")){const p=T.split("."),b=p.pop()||"";w=b.length;for(const u of p)if(l&&typeof l=="object"&&u in l)l=l[u];else{l=null;break}l&&typeof l=="object"&&(k=en(Object.keys(l),b))}else w=T.length,k=en(Object.keys(C??{}),T);return{keys:k,lastPartLength:w}}function en(C,T){return T?C.map((l,k)=>({value:l,index:k,match:ei(l,T)})).filter(l=>l.match!==null).sort((l,k)=>l.match.kindRank!==k.match.kindRank?l.match.kindRank-k.match.kindRank:l.match.span!==k.match.span?l.match.span-k.match.span:l.match.gapCount!==k.match.gapCount?l.match.gapCount-k.match.gapCount:l.match.start!==k.match.start?l.match.start-k.match.start:l.index-k.index).map(l=>l.value):C}function ei(C,T){const l=C.toLowerCase(),k=T.toLowerCase();if(!k)return null;if(l.startsWith(k))return{kindRank:0,start:0,span:k.length,gapCount:0};const w=l.indexOf(k);if(w!==-1)return{kindRank:ii(C,w,k.length),start:w,span:k.length,gapCount:0};const p=ti(l,k);return p?{kindRank:4,start:p.start,span:p.span,gapCount:p.gapCount}:null}function ti(C,T){if(!C||!T)return null;let l=null,k=0;for(;k<C.length;){let w=k,p=0;for(;w<C.length&&p<T.length;)C[w]===T[p]&&(p+=1),w+=1;if(p!==T.length)break;const b=new Array(T.length);let u=w-1;for(let O=T.length-1;O>=0;O--){for(;u>=0&&C[u]!==T[O];)u-=1;if(u<0)return l;b[O]=u,u-=1}let e=0;for(let O=1;O<b.length;O++)e+=b[O]-b[O-1]-1;const _={start:b[0],span:b[b.length-1]-b[0]+1,gapCount:e};(!l||_.span<l.span||_.span===l.span&&_.gapCount<l.gapCount||_.span===l.span&&_.gapCount===l.gapCount&&_.start<l.start)&&(l=_),k=b[0]+1}return l}function ni(C,T){return T<=0?!0:/[\s._-]/.test(C[T-1]??"")}function ri(C,T){return T>=C.length?!0:/[\s._-]/.test(C[T]??"")}function ii(C,T,l){const k=ni(C,T),w=ri(C,T+l);return k&&w?1:k?2:3}const oi=/^(#{1,6})\s/,si=/^\s*\{%\s*(if|elif|elseif|else|endif|for|endfor)\b/,ai={provideFoldingRanges(C){return ci(C)}},li={provideFoldingRanges(C){return ui(C)}};function ci(C){const T=[],l=C.getLineCount(),k=[];for(let w=1;w<=l;w++){const p=oi.exec(C.getLineContent(w));p&&k.push({line:w,level:p[1].length})}for(let w=0;w<k.length;w++){const{line:p,level:b}=k[w];let u=l;for(let e=w+1;e<k.length;e++)if(k[e].level<=b){u=k[e].line-1;break}u=Hn(C,p,u),u>p&&T.push({start:p,end:u})}return T}function ui(C){const T=[],l=[],k=C.getLineCount();for(let w=1;w<=k;w++){const p=si.exec(C.getLineContent(w));if(!p)continue;const b=p[1];if(b==="if"){l.push({kind:"if",branchStarts:[w],startLine:w});continue}if(b==="for"){l.push({kind:"for",branchStarts:[w],startLine:w});continue}if(b==="elif"||b==="elseif"||b==="else"){const u=fi(l,"if");if(!u)continue;Pt(T,C,u.branchStarts.at(-1)??u.startLine,w-1),u.branchStarts.push(w);continue}if(b==="endif"){const u=On(l,"if");if(!u)continue;Pt(T,C,u.branchStarts.at(-1)??u.startLine,w-1);continue}if(b==="endfor"){const u=On(l,"for");if(!u)continue;Pt(T,C,u.startLine,w-1)}}for(const w of l){const p=w.kind==="if"?w.branchStarts.at(-1)??w.startLine:w.startLine;Pt(T,C,p,k)}return T}function fi(C,T){for(let l=C.length-1;l>=0;l--)if(C[l].kind===T)return C[l];return null}function On(C,T){for(let l=C.length-1;l>=0;l--)if(C[l].kind===T)return C.splice(l,1)[0];return null}function Pt(C,T,l,k){const w=Hn(T,l,k);w>l&&C.push({start:l,end:w})}function Hn(C,T,l){let k=l;for(;k>T&&C.getLineContent(k).trim()==="";)k-=1;return k}const pi=/\{%[-\s]*(if|elif|elseif|else|endif|for|endfor)\b/,hi={provideDocumentHighlights(C,T){const l=vi(C),k=T.lineNumber,w=T.column;for(const p of l)for(const b of p)if(b.line===k&&w>=b.startColumn&&w<=b.endColumn)return p.map(u=>({range:{startLineNumber:u.line,startColumn:u.startColumn,endLineNumber:u.line,endColumn:u.endColumn},kind:1}));return[]}};function di(C,T){const l=C.getLineContent(T),k=pi.exec(l);if(!k)return null;const w=k[1],p=k.index+k[0].length-w.length;return{line:T,startColumn:p+1,endColumn:p+w.length+1,keyword:w}}function vi(C){const T=[],l=C.getLineCount(),k=[];for(let w=1;w<=l;w++){const p=di(C,w);if(!p)continue;const b=p.keyword;if(b==="if"){k.push({kind:"if",tags:[p]});continue}if(b==="for"){k.push({kind:"for",tags:[p]});continue}if(b==="elif"||b==="elseif"||b==="else"){const u=mi(k,"if");u&&u.tags.push(p);continue}if(b==="endif"){const u=Ln(k,"if");u&&(u.tags.push(p),T.push(u.tags));continue}if(b==="endfor"){const u=Ln(k,"for");u&&(u.tags.push(p),T.push(u.tags))}}return T}function mi(C,T){for(let l=C.length-1;l>=0;l--)if(C[l].kind===T)return C[l];return null}function Ln(C,T){for(let l=C.length-1;l>=0;l--)if(C[l].kind===T)return C.splice(l,1)[0];return null}var Gn={exports:{}};/*! Browser bundle of nunjucks 3.2.4 */(function(C,T){(function(k,w){C.exports=w()})(typeof self<"u"?self:Ur,function(){return function(l){var k={};function w(p){if(k[p])return k[p].exports;var b=k[p]={i:p,l:!1,exports:{}};return l[p].call(b.exports,b,b.exports,w),b.l=!0,b.exports}return w.m=l,w.c=k,w.d=function(p,b,u){w.o(p,b)||Object.defineProperty(p,b,{configurable:!1,enumerable:!0,get:u})},w.n=function(p){var b=p&&p.__esModule?function(){return p.default}:function(){return p};return w.d(b,"a",b),b},w.o=function(p,b){return Object.prototype.hasOwnProperty.call(p,b)},w.p="",w(w.s=11)}([function(l,_,w){var p=Array.prototype,b=Object.prototype,u={"&":"&",'"':""","'":"'","<":"<",">":">","\\":"\"},e=/[&"'<>\\]/g,_=l.exports={};function O(x,N){return b.hasOwnProperty.call(x,N)}_.hasOwnProp=O;function V(x){return u[x]}function W(x,N,M){if(M.Update||(M=new _.TemplateError(M)),M.Update(x),!N){var P=M;M=new Error(P.message),M.name=P.name}return M}_._prettifyError=W;function j(x,N,M){var P,q;x instanceof Error&&(q=x,x=q.name+": "+q.message),Object.setPrototypeOf?(P=new Error(x),Object.setPrototypeOf(P,j.prototype)):(P=this,Object.defineProperty(P,"message",{enumerable:!1,writable:!0,value:x})),Object.defineProperty(P,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(P,this.constructor);var z;if(q){var X=Object.getOwnPropertyDescriptor(q,"stack");z=X&&(X.get||function(){return X.value}),z||(z=function(){return q.stack})}else{var ye=new Error(x).stack;z=function(){return ye}}return Object.defineProperty(P,"stack",{get:function(){return z.call(P)}}),Object.defineProperty(P,"cause",{value:q}),P.lineno=N,P.colno=M,P.firstUpdate=!0,P.Update=function(oe){var ae="("+(oe||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?ae+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(ae+=" [Line "+this.lineno+"]")),ae+=`
|
|
3
|
+
`,this.firstUpdate&&(ae+=" "),this.message=ae+(this.message||""),this.firstUpdate=!1,this},P}Object.setPrototypeOf?Object.setPrototypeOf(j.prototype,Error.prototype):j.prototype=Object.create(Error.prototype,{constructor:{value:j}}),_.TemplateError=j;function L(x){return x.replace(e,V)}_.escape=L;function I(x){return b.toString.call(x)==="[object Function]"}_.isFunction=I;function t(x){return b.toString.call(x)==="[object Array]"}_.isArray=t;function r(x){return b.toString.call(x)==="[object String]"}_.isString=r;function i(x){return b.toString.call(x)==="[object Object]"}_.isObject=i;function m(x){return x?typeof x=="string"?x.split("."):[x]:[]}function c(x){var N=m(x);return function(P){for(var q=P,z=0;z<N.length;z++){var X=N[z];if(O(q,X))q=q[X];else return}return q}}_.getAttrGetter=c;function g(x,N,M){for(var P={},q=I(N)?N:c(N),z=0;z<x.length;z++){var X=x[z],ye=q(X,z);if(ye===void 0&&M===!0)throw new TypeError('groupby: attribute "'+N+'" resolved to undefined');(P[ye]||(P[ye]=[])).push(X)}return P}_.groupBy=g;function n(x){return Array.prototype.slice.call(x)}_.toArray=n;function o(x){var N=[];if(!x)return N;for(var M=x.length,P=n(arguments).slice(1),q=-1;++q<M;)A(P,x[q])===-1&&N.push(x[q]);return N}_.without=o;function f(x,N){for(var M="",P=0;P<N;P++)M+=x;return M}_.repeat=f;function a(x,N,M){if(x!=null){if(p.forEach&&x.forEach===p.forEach)x.forEach(N,M);else if(x.length===+x.length)for(var P=0,q=x.length;P<q;P++)N.call(M,x[P],P,x)}}_.each=a;function s(x,N){var M=[];if(x==null)return M;if(p.map&&x.map===p.map)return x.map(N);for(var P=0;P<x.length;P++)M[M.length]=N(x[P],P);return x.length===+x.length&&(M.length=x.length),M}_.map=s;function v(x,N,M){var P=-1;function q(){P++,P<x.length?N(x[P],P,q,M):M()}q()}_.asyncIter=v;function d(x,N,M){var P=B(x||{}),q=P.length,z=-1;function X(){z++;var ye=P[z];z<q?N(ye,x[ye],z,q,X):M()}X()}_.asyncFor=d;function A(x,N,M){return Array.prototype.indexOf.call(x||[],N,M)}_.indexOf=A;function B(x){var N=[];for(var M in x)O(x,M)&&N.push(M);return N}_.keys=B;function F(x){return B(x).map(function(N){return[N,x[N]]})}_._entries=F;function K(x){return B(x).map(function(N){return x[N]})}_._values=K;function D(x,N){return x=x||{},B(N).forEach(function(M){x[M]=N[M]}),x}_._assign=_.extend=D;function E(x,N){if(t(N)||r(N))return N.indexOf(x)!==-1;if(i(N))return x in N;throw new Error('Cannot use "in" operator to search for "'+x+'" in unexpected types.')}_.inOperator=E},function(l,k,w){function p(r,i){for(var m=0;m<i.length;m++){var c=i[m];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(r,u(c.key),c)}}function b(r,i,m){return i&&p(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),r}function u(r){var i=e(r,"string");return typeof i=="symbol"?i:String(i)}function e(r,i){if(typeof r!="object"||r===null)return r;var m=r[Symbol.toPrimitive];if(m!==void 0){var c=m.call(r,i);if(typeof c!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function _(r,i){r.prototype=Object.create(i.prototype),r.prototype.constructor=r,O(r,i)}function O(r,i){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(c,g){return c.__proto__=g,c},O(r,i)}var V=w(16),W=w(0);function j(r,i){return typeof r!="function"||typeof i!="function"?i:function(){var c=this.parent;this.parent=r;var g=i.apply(this,arguments);return this.parent=c,g}}function L(r,i,m){m=m||{},W.keys(m).forEach(function(g){m[g]=j(r.prototype[g],m[g])});var c=function(g){_(n,g);function n(){return g.apply(this,arguments)||this}return b(n,[{key:"typename",get:function(){return i}}]),n}(r);return W._assign(c.prototype,m),c}var I=function(){function r(){this.init.apply(this,arguments)}var i=r.prototype;return i.init=function(){},r.extend=function(c,g){return typeof c=="object"&&(g=c,c="anonymous"),L(this,c,g)},b(r,[{key:"typename",get:function(){return this.constructor.name}}]),r}(),t=function(r){_(i,r);function i(){var c,g;return g=r.call(this)||this,(c=g).init.apply(c,arguments),g}var m=i.prototype;return m.init=function(){},i.extend=function(g,n){return typeof g=="object"&&(n=g,g="anonymous"),L(this,g,n)},b(i,[{key:"typename",get:function(){return this.constructor.name}}]),i}(V);l.exports={Obj:I,EmitterObj:t}},function(l,k,w){var p=w(0),b=Array.from,u=typeof Symbol=="function"&&Symbol.iterator&&typeof b=="function",e=function(){function s(d,A){this.variables=Object.create(null),this.parent=d,this.topLevel=!1,this.isolateWrites=A}var v=s.prototype;return v.set=function(A,B,F){var K=A.split("."),D=this.variables,E=this;if(F&&(E=this.resolve(K[0],!0))){E.set(A,B);return}for(var x=0;x<K.length-1;x++){var N=K[x];D[N]||(D[N]={}),D=D[N]}D[K[K.length-1]]=B},v.get=function(A){var B=this.variables[A];return B!==void 0?B:null},v.lookup=function(A){var B=this.parent,F=this.variables[A];return F!==void 0?F:B&&B.lookup(A)},v.resolve=function(A,B){var F=B&&this.isolateWrites?void 0:this.parent,K=this.variables[A];return K!==void 0?this:F&&F.resolve(A)},v.push=function(A){return new s(this,A)},v.pop=function(){return this.parent},s}();function _(s,v,d){return function(){for(var B=arguments.length,F=new Array(B),K=0;K<B;K++)F[K]=arguments[K];var D=j(F),E,x=W(F);if(D>s.length)E=F.slice(0,s.length),F.slice(E.length,D).forEach(function(P,q){q<v.length&&(x[v[q]]=P)}),E.push(x);else if(D<s.length){E=F.slice(0,D);for(var N=D;N<s.length;N++){var M=s[N];E.push(x[M]),delete x[M]}E.push(x)}else E=F;return d.apply(this,E)}}function O(s){return s.__keywords=!0,s}function V(s){return s&&Object.prototype.hasOwnProperty.call(s,"__keywords")}function W(s){var v=s.length;if(v){var d=s[v-1];if(V(d))return d}return{}}function j(s){var v=s.length;if(v===0)return 0;var d=s[v-1];return V(d)?v-1:v}function L(s){if(typeof s!="string")return s;this.val=s,this.length=s.length}L.prototype=Object.create(String.prototype,{length:{writable:!0,configurable:!0,value:0}}),L.prototype.valueOf=function(){return this.val},L.prototype.toString=function(){return this.val};function I(s,v){return s instanceof L?new L(v):v.toString()}function t(s){var v=typeof s;return v==="string"?new L(s):v!=="function"?s:function(A){var B=s.apply(this,arguments);return typeof B=="string"?new L(B):B}}function r(s,v){return s=s??"",v&&!(s instanceof L)&&(s=p.escape(s.toString())),s}function i(s,v,d){if(s==null)throw new p.TemplateError("attempted to output null or undefined value",v+1,d+1);return s}function m(s,v){if(s!=null)return typeof s[v]=="function"?function(){for(var d=arguments.length,A=new Array(d),B=0;B<d;B++)A[B]=arguments[B];return s[v].apply(s,A)}:s[v]}function c(s,v,d,A){if(s){if(typeof s!="function")throw new Error("Unable to call `"+v+"`, which is not a function")}else throw new Error("Unable to call `"+v+"`, which is undefined or falsey");return s.apply(d,A)}function g(s,v,d){var A=v.lookup(d);return A!==void 0?A:s.lookup(d)}function n(s,v,d){return s.lineno?s:new p.TemplateError(s,v,d)}function o(s,v,d,A){if(p.isArray(s)){var B=s.length;p.asyncIter(s,function(K,D,E){switch(v){case 1:d(K,D,B,E);break;case 2:d(K[0],K[1],D,B,E);break;case 3:d(K[0],K[1],K[2],D,B,E);break;default:K.push(D,B,E),d.apply(this,K)}},A)}else p.asyncFor(s,function(K,D,E,x,N){d(K,D,E,x,N)},A)}function f(s,v,d,A){var B=0,F,K;function D(q,z){B++,K[q]=z,B===F&&A(null,K.join(""))}if(p.isArray(s))if(F=s.length,K=new Array(F),F===0)A(null,"");else for(var E=0;E<s.length;E++){var x=s[E];switch(v){case 1:d(x,E,F,D);break;case 2:d(x[0],x[1],E,F,D);break;case 3:d(x[0],x[1],x[2],E,F,D);break;default:x.push(E,F,D),d.apply(this,x)}}else{var N=p.keys(s||{});if(F=N.length,K=new Array(F),F===0)A(null,"");else for(var M=0;M<N.length;M++){var P=N[M];d(P,s[P],M,F,D)}}}function a(s){return typeof s!="object"||s===null||p.isArray(s)?s:u&&Symbol.iterator in s?b(s):s}l.exports={Frame:e,makeMacro:_,makeKeywordArgs:O,numArgs:j,suppressValue:r,ensureDefined:i,memberLookup:m,contextOrFrameLookup:g,callWrap:c,handleError:n,isArray:p.isArray,keys:p.keys,SafeString:L,copySafeness:I,markSafe:t,asyncEach:o,asyncAll:f,inOperator:p.inOperator,fromIterator:a}},function(l,k,w){function p(se,ce){for(var _e=0;_e<ce.length;_e++){var xe=ce[_e];xe.enumerable=xe.enumerable||!1,xe.configurable=!0,"value"in xe&&(xe.writable=!0),Object.defineProperty(se,u(xe.key),xe)}}function b(se,ce,_e){return ce&&p(se.prototype,ce),Object.defineProperty(se,"prototype",{writable:!1}),se}function u(se){var ce=e(se,"string");return typeof ce=="symbol"?ce:String(ce)}function e(se,ce){if(typeof se!="object"||se===null)return se;var _e=se[Symbol.toPrimitive];if(_e!==void 0){var xe=_e.call(se,ce);if(typeof xe!="object")return xe;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(se)}function _(se,ce){se.prototype=Object.create(ce.prototype),se.prototype.constructor=se,O(se,ce)}function O(se,ce){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(xe,Ee){return xe.__proto__=Ee,xe},O(se,ce)}var V=w(1),W=V.Obj;function j(se,ce,_e){se instanceof ce&&_e.push(se),se instanceof L&&se.findAll(ce,_e)}var L=function(se){_(ce,se);function ce(){return se.apply(this,arguments)||this}var _e=ce.prototype;return _e.init=function(Ee,Ie){for(var He=arguments,et=this,ft=arguments.length,ct=new Array(ft>2?ft-2:0),gt=2;gt<ft;gt++)ct[gt-2]=arguments[gt];this.lineno=Ee,this.colno=Ie,this.fields.forEach(function(Lt,Bt){var Ge=He[Bt+2];Ge===void 0&&(Ge=null),et[Lt]=Ge})},_e.findAll=function(Ee,Ie){var He=this;return Ie=Ie||[],this instanceof t?this.children.forEach(function(et){return j(et,Ee,Ie)}):this.fields.forEach(function(et){return j(He[et],Ee,Ie)}),Ie},_e.iterFields=function(Ee){var Ie=this;this.fields.forEach(function(He){Ee(Ie[He],He)})},ce}(W),I=function(se){_(ce,se);function ce(){return se.apply(this,arguments)||this}return b(ce,[{key:"typename",get:function(){return"Value"}},{key:"fields",get:function(){return["value"]}}]),ce}(L),t=function(se){_(ce,se);function ce(){return se.apply(this,arguments)||this}var _e=ce.prototype;return _e.init=function(Ee,Ie,He){se.prototype.init.call(this,Ee,Ie,He||[])},_e.addChild=function(Ee){this.children.push(Ee)},b(ce,[{key:"typename",get:function(){return"NodeList"}},{key:"fields",get:function(){return["children"]}}]),ce}(L),r=t.extend("Root"),i=I.extend("Literal"),m=I.extend("Symbol"),c=t.extend("Group"),g=t.extend("Array"),n=L.extend("Pair",{fields:["key","value"]}),o=t.extend("Dict"),f=L.extend("LookupVal",{fields:["target","val"]}),a=L.extend("If",{fields:["cond","body","else_"]}),s=a.extend("IfAsync"),v=L.extend("InlineIf",{fields:["cond","body","else_"]}),d=L.extend("For",{fields:["arr","name","body","else_"]}),A=d.extend("AsyncEach"),B=d.extend("AsyncAll"),F=L.extend("Macro",{fields:["name","args","body"]}),K=F.extend("Caller"),D=L.extend("Import",{fields:["template","target","withContext"]}),E=function(se){_(ce,se);function ce(){return se.apply(this,arguments)||this}var _e=ce.prototype;return _e.init=function(Ee,Ie,He,et,ft){se.prototype.init.call(this,Ee,Ie,He,et||new t,ft)},b(ce,[{key:"typename",get:function(){return"FromImport"}},{key:"fields",get:function(){return["template","names","withContext"]}}]),ce}(L),x=L.extend("FunCall",{fields:["name","args"]}),N=x.extend("Filter"),M=N.extend("FilterAsync",{fields:["name","args","symbol"]}),P=o.extend("KeywordArgs"),q=L.extend("Block",{fields:["name","body"]}),z=L.extend("Super",{fields:["blockName","symbol"]}),X=L.extend("TemplateRef",{fields:["template"]}),ye=X.extend("Extends"),be=L.extend("Include",{fields:["template","ignoreMissing"]}),oe=L.extend("Set",{fields:["targets","value"]}),ae=L.extend("Switch",{fields:["expr","cases","default"]}),H=L.extend("Case",{fields:["cond","body"]}),Y=t.extend("Output"),Q=L.extend("Capture",{fields:["body"]}),de=i.extend("TemplateData"),Te=L.extend("UnaryOp",{fields:["target"]}),Le=L.extend("BinOp",{fields:["left","right"]}),$e=Le.extend("In"),S=Le.extend("Is"),$=Le.extend("Or"),ee=Le.extend("And"),J=Te.extend("Not"),pe=Le.extend("Add"),ue=Le.extend("Concat"),Oe=Le.extend("Sub"),me=Le.extend("Mul"),ke=Le.extend("Div"),We=Le.extend("FloorDiv"),qe=Le.extend("Mod"),Ye=Le.extend("Pow"),xt=Te.extend("Neg"),St=Te.extend("Pos"),Ft=L.extend("Compare",{fields:["expr","ops"]}),Mt=L.extend("CompareOperand",{fields:["expr","type"]}),wt=L.extend("CallExtension",{init:function(ce,_e,xe,Ee){this.parent(),this.extName=ce.__name||ce,this.prop=_e,this.args=xe||new t,this.contentArgs=Ee||[],this.autoescape=ce.autoescape},fields:["extName","prop","args","contentArgs"]}),Ot=wt.extend("CallExtensionAsync");function at(se,ce,_e){var xe=se.split(`
|
|
4
|
+
`);xe.forEach(function(Ee,Ie){Ee&&(_e&&Ie>0||!_e)&&process.stdout.write(" ".repeat(ce));var He=Ie===xe.length-1?"":`
|
|
5
|
+
`;process.stdout.write(""+Ee+He)})}function lt(se,ce){if(ce=ce||0,at(se.typename+": ",ce),se instanceof t)at(`
|
|
6
|
+
`),se.children.forEach(function(Ee){lt(Ee,ce+2)});else if(se instanceof wt)at(se.extName+"."+se.prop+`
|
|
7
|
+
`),se.args&<(se.args,ce+2),se.contentArgs&&se.contentArgs.forEach(function(Ee){lt(Ee,ce+2)});else{var _e=[],xe=null;se.iterFields(function(Ee,Ie){Ee instanceof L?_e.push([Ie,Ee]):(xe=xe||{},xe[Ie]=Ee)}),xe?at(JSON.stringify(xe,null,2)+`
|
|
8
|
+
`,null,!0):at(`
|
|
9
|
+
`),_e.forEach(function(Ee){var Ie=Ee[0],He=Ee[1];at("["+Ie+"] =>",ce+2),lt(He,ce+4)})}}l.exports={Node:L,Root:r,NodeList:t,Value:I,Literal:i,Symbol:m,Group:c,Array:g,Pair:n,Dict:o,Output:Y,Capture:Q,TemplateData:de,If:a,IfAsync:s,InlineIf:v,For:d,AsyncEach:A,AsyncAll:B,Macro:F,Caller:K,Import:D,FromImport:E,FunCall:x,Filter:N,FilterAsync:M,KeywordArgs:P,Block:q,Super:z,Extends:ye,Include:be,Set:oe,Switch:ae,Case:H,LookupVal:f,BinOp:Le,In:$e,Is:S,Or:$,And:ee,Not:J,Add:pe,Concat:ue,Sub:Oe,Mul:me,Div:ke,FloorDiv:We,Mod:qe,Pow:Ye,Neg:xt,Pos:St,Compare:Ft,CompareOperand:Mt,CallExtension:wt,CallExtensionAsync:Ot,printNodes:lt}},function(l,k){},function(l,k,w){function p(i,m){i.prototype=Object.create(m.prototype),i.prototype.constructor=i,b(i,m)}function b(i,m){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(g,n){return g.__proto__=n,g},b(i,m)}var u=w(8),e=w(17),_=w(3),O=w(0),V=O.TemplateError,W=w(2),j=W.Frame,L=w(1),I=L.Obj,t={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},r=function(i){p(m,i);function m(){return i.apply(this,arguments)||this}var c=m.prototype;return c.init=function(n,o){this.templateName=n,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=o},c.fail=function(n,o,f){throw o!==void 0&&(o+=1),f!==void 0&&(f+=1),new V(n,o,f)},c._pushBuffer=function(){var n=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=n,this._emit("var "+this.buffer+' = "";'),n},c._popBuffer=function(){this.buffer=this.bufferStack.pop()},c._emit=function(n){this.codebuf.push(n)},c._emitLine=function(n){this._emit(n+`
|
|
10
|
+
`)},c._emitLines=function(){for(var n=this,o=arguments.length,f=new Array(o),a=0;a<o;a++)f[a]=arguments[a];f.forEach(function(s){return n._emitLine(s)})},c._emitFuncBegin=function(n,o){this.buffer="output",this._scopeClosers="",this._emitLine("function "+o+"(env, context, frame, runtime, cb) {"),this._emitLine("var lineno = "+n.lineno+";"),this._emitLine("var colno = "+n.colno+";"),this._emitLine("var "+this.buffer+' = "";'),this._emitLine("try {")},c._emitFuncEnd=function(n){n||this._emitLine("cb(null, "+this.buffer+");"),this._closeScopeLevels(),this._emitLine("} catch (e) {"),this._emitLine(" cb(runtime.handleError(e, lineno, colno));"),this._emitLine("}"),this._emitLine("}"),this.buffer=null},c._addScopeLevel=function(){this._scopeClosers+="})"},c._closeScopeLevels=function(){this._emitLine(this._scopeClosers+";"),this._scopeClosers=""},c._withScopedSyntax=function(n){var o=this._scopeClosers;this._scopeClosers="",n.call(this),this._closeScopeLevels(),this._scopeClosers=o},c._makeCallback=function(n){var o=this._tmpid();return"function("+o+(n?","+n:"")+`) {
|
|
11
|
+
if(`+o+") { cb("+o+"); return; }"},c._tmpid=function(){return this.lastId++,"t_"+this.lastId},c._templateName=function(){return this.templateName==null?"undefined":JSON.stringify(this.templateName)},c._compileChildren=function(n,o){var f=this;n.children.forEach(function(a){f.compile(a,o)})},c._compileAggregate=function(n,o,f,a){var s=this;f&&this._emit(f),n.children.forEach(function(v,d){d>0&&s._emit(","),s.compile(v,o)}),a&&this._emit(a)},c._compileExpression=function(n,o){this.assertType(n,_.Literal,_.Symbol,_.Group,_.Array,_.Dict,_.FunCall,_.Caller,_.Filter,_.LookupVal,_.Compare,_.InlineIf,_.In,_.Is,_.And,_.Or,_.Not,_.Add,_.Concat,_.Sub,_.Mul,_.Div,_.FloorDiv,_.Mod,_.Pow,_.Neg,_.Pos,_.Compare,_.NodeList),this.compile(n,o)},c.assertType=function(n){for(var o=arguments.length,f=new Array(o>1?o-1:0),a=1;a<o;a++)f[a-1]=arguments[a];f.some(function(s){return n instanceof s})||this.fail("assertType: invalid type: "+n.typename,n.lineno,n.colno)},c.compileCallExtension=function(n,o,f){var a=this,s=n.args,v=n.contentArgs,d=typeof n.autoescape=="boolean"?n.autoescape:!0;if(f||this._emit(this.buffer+" += runtime.suppressValue("),this._emit('env.getExtension("'+n.extName+'")["'+n.prop+'"]('),this._emit("context"),(s||v)&&this._emit(","),s&&(s instanceof _.NodeList||this.fail("compileCallExtension: arguments must be a NodeList, use `parser.parseSignature`"),s.children.forEach(function(B,F){a._compileExpression(B,o),(F!==s.children.length-1||v.length)&&a._emit(",")})),v.length&&v.forEach(function(B,F){if(F>0&&a._emit(","),B){a._emitLine("function(cb) {"),a._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var K=a._pushBuffer();a._withScopedSyntax(function(){a.compile(B,o),a._emitLine("cb(null, "+K+");")}),a._popBuffer(),a._emitLine("return "+K+";"),a._emitLine("}")}else a._emit("null")}),f){var A=this._tmpid();this._emitLine(", "+this._makeCallback(A)),this._emitLine(this.buffer+" += runtime.suppressValue("+A+", "+d+" && env.opts.autoescape);"),this._addScopeLevel()}else this._emit(")"),this._emit(", "+d+` && env.opts.autoescape);
|
|
12
|
+
`)},c.compileCallExtensionAsync=function(n,o){this.compileCallExtension(n,o,!0)},c.compileNodeList=function(n,o){this._compileChildren(n,o)},c.compileLiteral=function(n){if(typeof n.value=="string"){var o=n.value.replace(/\\/g,"\\\\");o=o.replace(/"/g,'\\"'),o=o.replace(/\n/g,"\\n"),o=o.replace(/\r/g,"\\r"),o=o.replace(/\t/g,"\\t"),o=o.replace(/\u2028/g,"\\u2028"),this._emit('"'+o+'"')}else n.value===null?this._emit("null"):this._emit(n.value.toString())},c.compileSymbol=function(n,o){var f=n.value,a=o.lookup(f);a?this._emit(a):this._emit('runtime.contextOrFrameLookup(context, frame, "'+f+'")')},c.compileGroup=function(n,o){this._compileAggregate(n,o,"(",")")},c.compileArray=function(n,o){this._compileAggregate(n,o,"[","]")},c.compileDict=function(n,o){this._compileAggregate(n,o,"{","}")},c.compilePair=function(n,o){var f=n.key,a=n.value;f instanceof _.Symbol?f=new _.Literal(f.lineno,f.colno,f.value):f instanceof _.Literal&&typeof f.value=="string"||this.fail("compilePair: Dict keys must be strings or names",f.lineno,f.colno),this.compile(f,o),this._emit(": "),this._compileExpression(a,o)},c.compileInlineIf=function(n,o){this._emit("("),this.compile(n.cond,o),this._emit("?"),this.compile(n.body,o),this._emit(":"),n.else_!==null?this.compile(n.else_,o):this._emit('""'),this._emit(")")},c.compileIn=function(n,o){this._emit("runtime.inOperator("),this.compile(n.left,o),this._emit(","),this.compile(n.right,o),this._emit(")")},c.compileIs=function(n,o){var f=n.right.name?n.right.name.value:n.right.value;this._emit('env.getTest("'+f+'").call(context, '),this.compile(n.left,o),n.right.args&&(this._emit(","),this.compile(n.right.args,o)),this._emit(") === true")},c._binOpEmitter=function(n,o,f){this.compile(n.left,o),this._emit(f),this.compile(n.right,o)},c.compileOr=function(n,o){return this._binOpEmitter(n,o," || ")},c.compileAnd=function(n,o){return this._binOpEmitter(n,o," && ")},c.compileAdd=function(n,o){return this._binOpEmitter(n,o," + ")},c.compileConcat=function(n,o){return this._binOpEmitter(n,o,' + "" + ')},c.compileSub=function(n,o){return this._binOpEmitter(n,o," - ")},c.compileMul=function(n,o){return this._binOpEmitter(n,o," * ")},c.compileDiv=function(n,o){return this._binOpEmitter(n,o," / ")},c.compileMod=function(n,o){return this._binOpEmitter(n,o," % ")},c.compileNot=function(n,o){this._emit("!"),this.compile(n.target,o)},c.compileFloorDiv=function(n,o){this._emit("Math.floor("),this.compile(n.left,o),this._emit(" / "),this.compile(n.right,o),this._emit(")")},c.compilePow=function(n,o){this._emit("Math.pow("),this.compile(n.left,o),this._emit(", "),this.compile(n.right,o),this._emit(")")},c.compileNeg=function(n,o){this._emit("-"),this.compile(n.target,o)},c.compilePos=function(n,o){this._emit("+"),this.compile(n.target,o)},c.compileCompare=function(n,o){var f=this;this.compile(n.expr,o),n.ops.forEach(function(a){f._emit(" "+t[a.type]+" "),f.compile(a.expr,o)})},c.compileLookupVal=function(n,o){this._emit("runtime.memberLookup(("),this._compileExpression(n.target,o),this._emit("),"),this._compileExpression(n.val,o),this._emit(")")},c._getNodeName=function(n){switch(n.typename){case"Symbol":return n.value;case"FunCall":return"the return value of ("+this._getNodeName(n.name)+")";case"LookupVal":return this._getNodeName(n.target)+'["'+this._getNodeName(n.val)+'"]';case"Literal":return n.value.toString();default:return"--expression--"}},c.compileFunCall=function(n,o){this._emit("(lineno = "+n.lineno+", colno = "+n.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(n.name,o),this._emit(', "'+this._getNodeName(n.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(n.args,o,"[","])"),this._emit(")")},c.compileFilter=function(n,o){var f=n.name;this.assertType(f,_.Symbol),this._emit('env.getFilter("'+f.value+'").call(context, '),this._compileAggregate(n.args,o),this._emit(")")},c.compileFilterAsync=function(n,o){var f=n.name,a=n.symbol.value;this.assertType(f,_.Symbol),o.set(a,a),this._emit('env.getFilter("'+f.value+'").call(context, '),this._compileAggregate(n.args,o),this._emitLine(", "+this._makeCallback(a)),this._addScopeLevel()},c.compileKeywordArgs=function(n,o){this._emit("runtime.makeKeywordArgs("),this.compileDict(n,o),this._emit(")")},c.compileSet=function(n,o){var f=this,a=[];n.targets.forEach(function(s){var v=s.value,d=o.lookup(v);d==null&&(d=f._tmpid(),f._emitLine("var "+d+";")),a.push(d)}),n.value?(this._emit(a.join(" = ")+" = "),this._compileExpression(n.value,o),this._emitLine(";")):(this._emit(a.join(" = ")+" = "),this.compile(n.body,o),this._emitLine(";")),n.targets.forEach(function(s,v){var d=a[v],A=s.value;f._emitLine('frame.set("'+A+'", '+d+", true);"),f._emitLine("if(frame.topLevel) {"),f._emitLine('context.setVariable("'+A+'", '+d+");"),f._emitLine("}"),A.charAt(0)!=="_"&&(f._emitLine("if(frame.topLevel) {"),f._emitLine('context.addExport("'+A+'", '+d+");"),f._emitLine("}"))})},c.compileSwitch=function(n,o){var f=this;this._emit("switch ("),this.compile(n.expr,o),this._emit(") {"),n.cases.forEach(function(a,s){f._emit("case "),f.compile(a.cond,o),f._emit(": "),f.compile(a.body,o),a.body.children.length&&f._emitLine("break;")}),n.default&&(this._emit("default:"),this.compile(n.default,o)),this._emit("}")},c.compileIf=function(n,o,f){var a=this;this._emit("if("),this._compileExpression(n.cond,o),this._emitLine(") {"),this._withScopedSyntax(function(){a.compile(n.body,o),f&&a._emit("cb()")}),n.else_?(this._emitLine(`}
|
|
13
|
+
else {`),this._withScopedSyntax(function(){a.compile(n.else_,o),f&&a._emit("cb()")})):f&&(this._emitLine(`}
|
|
14
|
+
else {`),this._emit("cb()")),this._emitLine("}")},c.compileIfAsync=function(n,o){this._emit("(function(cb) {"),this.compileIf(n,o,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel()},c._emitLoopBindings=function(n,o,f,a){var s=this,v=[{name:"index",val:f+" + 1"},{name:"index0",val:f},{name:"revindex",val:a+" - "+f},{name:"revindex0",val:a+" - "+f+" - 1"},{name:"first",val:f+" === 0"},{name:"last",val:f+" === "+a+" - 1"},{name:"length",val:a}];v.forEach(function(d){s._emitLine('frame.set("loop.'+d.name+'", '+d.val+");")})},c.compileFor=function(n,o){var f=this,a=this._tmpid(),s=this._tmpid(),v=this._tmpid();if(o=o.push(),this._emitLine("frame = frame.push();"),this._emit("var "+v+" = "),this._compileExpression(n.arr,o),this._emitLine(";"),this._emit("if("+v+") {"),this._emitLine(v+" = runtime.fromIterator("+v+");"),n.name instanceof _.Array){this._emitLine("var "+a+";"),this._emitLine("if(runtime.isArray("+v+")) {"),this._emitLine("var "+s+" = "+v+".length;"),this._emitLine("for("+a+"=0; "+a+" < "+v+".length; "+a+"++) {"),n.name.children.forEach(function(E,x){var N=f._tmpid();f._emitLine("var "+N+" = "+v+"["+a+"]["+x+"];"),f._emitLine('frame.set("'+E+'", '+v+"["+a+"]["+x+"]);"),o.set(n.name.children[x].value,N)}),this._emitLoopBindings(n,v,a,s),this._withScopedSyntax(function(){f.compile(n.body,o)}),this._emitLine("}"),this._emitLine("} else {");var d=n.name.children,A=d[0],B=d[1],F=this._tmpid(),K=this._tmpid();o.set(A.value,F),o.set(B.value,K),this._emitLine(a+" = -1;"),this._emitLine("var "+s+" = runtime.keys("+v+").length;"),this._emitLine("for(var "+F+" in "+v+") {"),this._emitLine(a+"++;"),this._emitLine("var "+K+" = "+v+"["+F+"];"),this._emitLine('frame.set("'+A.value+'", '+F+");"),this._emitLine('frame.set("'+B.value+'", '+K+");"),this._emitLoopBindings(n,v,a,s),this._withScopedSyntax(function(){f.compile(n.body,o)}),this._emitLine("}"),this._emitLine("}")}else{var D=this._tmpid();o.set(n.name.value,D),this._emitLine("var "+s+" = "+v+".length;"),this._emitLine("for(var "+a+"=0; "+a+" < "+v+".length; "+a+"++) {"),this._emitLine("var "+D+" = "+v+"["+a+"];"),this._emitLine('frame.set("'+n.name.value+'", '+D+");"),this._emitLoopBindings(n,v,a,s),this._withScopedSyntax(function(){f.compile(n.body,o)}),this._emitLine("}")}this._emitLine("}"),n.else_&&(this._emitLine("if (!"+s+") {"),this.compile(n.else_,o),this._emitLine("}")),this._emitLine("frame = frame.pop();")},c._compileAsyncLoop=function(n,o,f){var a=this,s=this._tmpid(),v=this._tmpid(),d=this._tmpid(),A=f?"asyncAll":"asyncEach";if(o=o.push(),this._emitLine("frame = frame.push();"),this._emit("var "+d+" = runtime.fromIterator("),this._compileExpression(n.arr,o),this._emitLine(");"),n.name instanceof _.Array){var B=n.name.children.length;this._emit("runtime."+A+"("+d+", "+B+", function("),n.name.children.forEach(function(D){a._emit(D.value+",")}),this._emit(s+","+v+",next) {"),n.name.children.forEach(function(D){var E=D.value;o.set(E,E),a._emitLine('frame.set("'+E+'", '+E+");")})}else{var F=n.name.value;this._emitLine("runtime."+A+"("+d+", 1, function("+F+", "+s+", "+v+",next) {"),this._emitLine('frame.set("'+F+'", '+F+");"),o.set(F,F)}this._emitLoopBindings(n,d,s,v),this._withScopedSyntax(function(){var D;f&&(D=a._pushBuffer()),a.compile(n.body,o),a._emitLine("next("+s+(D?","+D:"")+");"),f&&a._popBuffer()});var K=this._tmpid();this._emitLine("}, "+this._makeCallback(K)),this._addScopeLevel(),f&&this._emitLine(this.buffer+" += "+K+";"),n.else_&&(this._emitLine("if (!"+d+".length) {"),this.compile(n.else_,o),this._emitLine("}")),this._emitLine("frame = frame.pop();")},c.compileAsyncEach=function(n,o){this._compileAsyncLoop(n,o)},c.compileAsyncAll=function(n,o){this._compileAsyncLoop(n,o,!0)},c._compileMacro=function(n,o){var f=this,a=[],s=null,v="macro_"+this._tmpid(),d=o!==void 0;n.args.children.forEach(function(E,x){x===n.args.children.length-1&&E instanceof _.Dict?s=E:(f.assertType(E,_.Symbol),a.push(E))});var A=[].concat(a.map(function(E){return"l_"+E.value}),["kwargs"]),B=a.map(function(E){return'"'+E.value+'"'}),F=(s&&s.children||[]).map(function(E){return'"'+E.key.value+'"'}),K;d?K=o.push(!0):K=new j,this._emitLines("var "+v+" = runtime.makeMacro(","["+B.join(", ")+"], ","["+F.join(", ")+"], ","function ("+A.join(", ")+") {","var callerFrame = frame;","frame = "+(d?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),a.forEach(function(E){f._emitLine('frame.set("'+E.value+'", l_'+E.value+");"),K.set(E.value,"l_"+E.value)}),s&&s.children.forEach(function(E){var x=E.key.value;f._emit('frame.set("'+x+'", '),f._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+x+'")'),f._emit(' ? kwargs["'+x+'"] : '),f._compileExpression(E.value,K),f._emit(");")});var D=this._pushBuffer();return this._withScopedSyntax(function(){f.compile(n.body,K)}),this._emitLine("frame = "+(d?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+D+");"),this._emitLine("});"),this._popBuffer(),v},c.compileMacro=function(n,o){var f=this._compileMacro(n),a=n.name.value;o.set(a,f),o.parent?this._emitLine('frame.set("'+a+'", '+f+");"):(n.name.value.charAt(0)!=="_"&&this._emitLine('context.addExport("'+a+'");'),this._emitLine('context.setVariable("'+a+'", '+f+");"))},c.compileCaller=function(n,o){this._emit("(function (){");var f=this._compileMacro(n,o);this._emit("return "+f+";})()")},c._compileGetTemplate=function(n,o,f,a){var s=this._tmpid(),v=this._templateName(),d=this._makeCallback(s),A=f?"true":"false",B=a?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(n.template,o),this._emitLine(", "+A+", "+v+", "+B+", "+d),s},c.compileImport=function(n,o){var f=n.target.value,a=this._compileGetTemplate(n,o,!1,!1);this._addScopeLevel(),this._emitLine(a+".getExported("+(n.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(a)),this._addScopeLevel(),o.set(f,a),o.parent?this._emitLine('frame.set("'+f+'", '+a+");"):this._emitLine('context.setVariable("'+f+'", '+a+");")},c.compileFromImport=function(n,o){var f=this,a=this._compileGetTemplate(n,o,!1,!1);this._addScopeLevel(),this._emitLine(a+".getExported("+(n.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(a)),this._addScopeLevel(),n.names.children.forEach(function(s){var v,d,A=f._tmpid();s instanceof _.Pair?(v=s.key.value,d=s.value.value):(v=s.value,d=v),f._emitLine("if(Object.prototype.hasOwnProperty.call("+a+', "'+v+'")) {'),f._emitLine("var "+A+" = "+a+"."+v+";"),f._emitLine("} else {"),f._emitLine(`cb(new Error("cannot import '`+v+`'")); return;`),f._emitLine("}"),o.set(d,A),o.parent?f._emitLine('frame.set("'+d+'", '+A+");"):f._emitLine('context.setVariable("'+d+'", '+A+");")})},c.compileBlock=function(n){var o=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+n.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(o)),this._emitLine(this.buffer+" += "+o+";"),this._addScopeLevel()},c.compileSuper=function(n,o){var f=n.blockName.value,a=n.symbol.value,s=this._makeCallback(a);this._emitLine('context.getSuper(env, "'+f+'", b_'+f+", frame, runtime, "+s),this._emitLine(a+" = runtime.markSafe("+a+");"),this._addScopeLevel(),o.set(a,a)},c.compileExtends=function(n,o){var f=this._tmpid(),a=this._compileGetTemplate(n,o,!0,!1);this._emitLine("parentTemplate = "+a),this._emitLine("for(var "+f+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+f+", parentTemplate.blocks["+f+"]);"),this._emitLine("}"),this._addScopeLevel()},c.compileInclude=function(n,o){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var f=this._compileGetTemplate(n,o,!1,n.ignoreMissing);this._emitLine("callback(null,"+f+");});"),this._emitLine("});");var a=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(a)),this._emitLine("callback(null,"+a+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel()},c.compileTemplateData=function(n,o){this.compileLiteral(n,o)},c.compileCapture=function(n,o){var f=this,a=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax(function(){f.compile(n.body,o)}),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=a},c.compileOutput=function(n,o){var f=this,a=n.children;a.forEach(function(s){s instanceof _.TemplateData?s.value&&(f._emit(f.buffer+" += "),f.compileLiteral(s,o),f._emitLine(";")):(f._emit(f.buffer+" += runtime.suppressValue("),f.throwOnUndefined&&f._emit("runtime.ensureDefined("),f.compile(s,o),f.throwOnUndefined&&f._emit(","+n.lineno+","+n.colno+")"),f._emit(`, env.opts.autoescape);
|
|
15
|
+
`))})},c.compileRoot=function(n,o){var f=this;o&&this.fail("compileRoot: root node can't have frame"),o=new j,this._emitFuncBegin(n,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(n,o),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var a=[],s=n.findAll(_.Block);s.forEach(function(v,d){var A=v.name.value;if(a.indexOf(A)!==-1)throw new Error('Block "'+A+'" defined more than once.');a.push(A),f._emitFuncBegin(v,"b_"+A);var B=new j;f._emitLine("var frame = frame.push(true);"),f.compile(v.body,B),f._emitFuncEnd()}),this._emitLine("return {"),s.forEach(function(v,d){var A="b_"+v.name.value;f._emitLine(A+": "+A+",")}),this._emitLine(`root: root
|
|
16
|
+
};`)},c.compile=function(n,o){var f=this["compile"+n.typename];f?f.call(this,n,o):this.fail("compile: Cannot compile node: "+n.typename,n.lineno,n.colno)},c.getCode=function(){return this.codebuf.join("")},m}(I);l.exports={compile:function(m,c,g,n,o){o===void 0&&(o={});var f=new r(n,o.throwOnUndefined),a=(g||[]).map(function(v){return v.preprocess}).filter(function(v){return!!v}),s=a.reduce(function(v,d){return d(v)},m);return f.compile(e.transform(u.parse(s,g,o),c,n)),f.getCode()},Compiler:r}},function(l,k,w){function p(O,V){O.prototype=Object.create(V.prototype),O.prototype.constructor=O,b(O,V)}function b(O,V){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(j,L){return j.__proto__=L,j},b(O,V)}var u=w(4),e=w(1),_=e.EmitterObj;l.exports=function(O){p(V,O);function V(){return O.apply(this,arguments)||this}var W=V.prototype;return W.resolve=function(L,I){return u.resolve(u.dirname(L),I)},W.isRelative=function(L){return L.indexOf("./")===0||L.indexOf("../")===0},V}(_)},function(l,k,w){function p(B,F){B.prototype=Object.create(F.prototype),B.prototype.constructor=B,b(B,F)}function b(B,F){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(D,E){return D.__proto__=E,D},b(B,F)}var u=w(12),e=w(15),_=w(0),O=w(5),V=w(18),W=w(10),j=W.FileSystemLoader,L=W.WebLoader,I=W.PrecompiledLoader,t=w(20),r=w(21),i=w(1),m=i.Obj,c=i.EmitterObj,g=w(2),n=g.handleError,o=g.Frame,f=w(22);function a(B,F,K){u(function(){B(F,K)})}var s={type:"code",obj:{root:function(F,K,D,E,x){try{x(null,"")}catch(N){x(n(N,null,null))}}}},v=function(B){p(F,B);function F(){return B.apply(this,arguments)||this}var K=F.prototype;return K.init=function(E,x){var N=this;x=this.opts=x||{},this.opts.dev=!!x.dev,this.opts.autoescape=x.autoescape!=null?x.autoescape:!0,this.opts.throwOnUndefined=!!x.throwOnUndefined,this.opts.trimBlocks=!!x.trimBlocks,this.opts.lstripBlocks=!!x.lstripBlocks,this.loaders=[],E?this.loaders=_.isArray(E)?E:[E]:j?this.loaders=[new j("views")]:L&&(this.loaders=[new L("/views")]),typeof window<"u"&&window.nunjucksPrecompiled&&this.loaders.unshift(new I(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=r(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],_._entries(V).forEach(function(M){var P=M[0],q=M[1];return N.addFilter(P,q)}),_._entries(t).forEach(function(M){var P=M[0],q=M[1];return N.addTest(P,q)})},K._initLoaders=function(){var E=this;this.loaders.forEach(function(x){x.cache={},typeof x.on=="function"&&(x.on("update",function(N,M){x.cache[N]=null,E.emit("update",N,M,x)}),x.on("load",function(N,M){E.emit("load",N,M,x)}))})},K.invalidateCache=function(){this.loaders.forEach(function(E){E.cache={}})},K.addExtension=function(E,x){return x.__name=E,this.extensions[E]=x,this.extensionsList.push(x),this},K.removeExtension=function(E){var x=this.getExtension(E);x&&(this.extensionsList=_.without(this.extensionsList,x),delete this.extensions[E])},K.getExtension=function(E){return this.extensions[E]},K.hasExtension=function(E){return!!this.extensions[E]},K.addGlobal=function(E,x){return this.globals[E]=x,this},K.getGlobal=function(E){if(typeof this.globals[E]>"u")throw new Error("global not found: "+E);return this.globals[E]},K.addFilter=function(E,x,N){var M=x;return N&&this.asyncFilters.push(E),this.filters[E]=M,this},K.getFilter=function(E){if(!this.filters[E])throw new Error("filter not found: "+E);return this.filters[E]},K.addTest=function(E,x){return this.tests[E]=x,this},K.getTest=function(E){if(!this.tests[E])throw new Error("test not found: "+E);return this.tests[E]},K.resolveTemplate=function(E,x,N){var M=E.isRelative&&x?E.isRelative(N):!1;return M&&E.resolve?E.resolve(x,N):N},K.getTemplate=function(E,x,N,M,P){var q=this,z=this,X=null;if(E&&E.raw&&(E=E.raw),_.isFunction(N)&&(P=N,N=null,x=x||!1),_.isFunction(x)&&(P=x,x=!1),E instanceof A)X=E;else{if(typeof E!="string")throw new Error("template names must be a string: "+E);for(var ye=0;ye<this.loaders.length;ye++){var be=this.loaders[ye];if(X=be.cache[this.resolveTemplate(be,N,E)],X)break}}if(X)if(x&&X.compile(),P){P(null,X);return}else return X;var oe,ae=function(Y,Q){if(!Q&&!Y&&!M&&(Y=new Error("template not found: "+E)),Y)if(P){P(Y);return}else throw Y;var de;Q?(de=new A(Q.src,q,Q.path,x),Q.noCache||(Q.loader.cache[E]=de)):de=new A(s,q,"",x),P?P(null,de):oe=de};return _.asyncIter(this.loaders,function(H,Y,Q,de){function Te(Le,$e){Le?de(Le):$e?($e.loader=H,de(null,$e)):Q()}E=z.resolveTemplate(H,N,E),H.async?H.getSource(E,Te):Te(null,H.getSource(E))},ae),oe},K.express=function(E){return f(this,E)},K.render=function(E,x,N){_.isFunction(x)&&(N=x,x=null);var M=null;return this.getTemplate(E,function(P,q){if(P&&N)a(N,P);else{if(P)throw P;M=q.render(x,N)}}),M},K.renderString=function(E,x,N,M){_.isFunction(N)&&(M=N,N={}),N=N||{};var P=new A(E,this,N.path);return P.render(x,M)},K.waterfall=function(E,x,N){return e(E,x,N)},F}(c),d=function(B){p(F,B);function F(){return B.apply(this,arguments)||this}var K=F.prototype;return K.init=function(E,x,N){var M=this;this.env=N||new v,this.ctx=_.extend({},E),this.blocks={},this.exported=[],_.keys(x).forEach(function(P){M.addBlock(P,x[P])})},K.lookup=function(E){return E in this.env.globals&&!(E in this.ctx)?this.env.globals[E]:this.ctx[E]},K.setVariable=function(E,x){this.ctx[E]=x},K.getVariables=function(){return this.ctx},K.addBlock=function(E,x){return this.blocks[E]=this.blocks[E]||[],this.blocks[E].push(x),this},K.getBlock=function(E){if(!this.blocks[E])throw new Error('unknown block "'+E+'"');return this.blocks[E][0]},K.getSuper=function(E,x,N,M,P,q){var z=_.indexOf(this.blocks[x]||[],N),X=this.blocks[x][z+1],ye=this;if(z===-1||!X)throw new Error('no super block available for "'+x+'"');X(E,ye,M,P,q)},K.addExport=function(E){this.exported.push(E)},K.getExported=function(){var E=this,x={};return this.exported.forEach(function(N){x[N]=E.ctx[N]}),x},F}(m),A=function(B){p(F,B);function F(){return B.apply(this,arguments)||this}var K=F.prototype;return K.init=function(E,x,N,M){if(this.env=x||new v,_.isObject(E))switch(E.type){case"code":this.tmplProps=E.obj;break;case"string":this.tmplStr=E.obj;break;default:throw new Error("Unexpected template object type "+E.type+"; expected 'code', or 'string'")}else if(_.isString(E))this.tmplStr=E;else throw new Error("src must be a string or an object describing the source");if(this.path=N,M)try{this._compile()}catch(P){throw _._prettifyError(this.path,this.env.opts.dev,P)}else this.compiled=!1},K.render=function(E,x,N){var M=this;typeof E=="function"?(N=E,E={}):typeof x=="function"&&(N=x,x=null);var P=!x;try{this.compile()}catch(oe){var q=_._prettifyError(this.path,this.env.opts.dev,oe);if(N)return a(N,q);throw q}var z=new d(E||{},this.blocks,this.env),X=x?x.push(!0):new o;X.topLevel=!0;var ye=null,be=!1;return this.rootRenderFunc(this.env,z,X,g,function(oe,ae){if(!(be&&N&&typeof ae<"u"))if(oe&&(oe=_._prettifyError(M.path,M.env.opts.dev,oe),be=!0),N)P?a(N,oe,ae):N(oe,ae);else{if(oe)throw oe;ye=ae}}),ye},K.getExported=function(E,x,N){typeof E=="function"&&(N=E,E={}),typeof x=="function"&&(N=x,x=null);try{this.compile()}catch(q){if(N)return N(q);throw q}var M=x?x.push():new o;M.topLevel=!0;var P=new d(E||{},this.blocks,this.env);this.rootRenderFunc(this.env,P,M,g,function(q){q?N(q,null):N(null,P.getExported())})},K.compile=function(){this.compiled||this._compile()},K._compile=function(){var E;if(this.tmplProps)E=this.tmplProps;else{var x=O.compile(this.tmplStr,this.env.asyncFilters,this.env.extensionsList,this.path,this.env.opts),N=new Function(x);E=N()}this.blocks=this._getBlocks(E),this.rootRenderFunc=E.root,this.compiled=!0},K._getBlocks=function(E){var x={};return _.keys(E).forEach(function(N){N.slice(0,2)==="b_"&&(x[N.slice(2)]=E[N])}),x},F}(m);l.exports={Environment:v,Template:A}},function(l,k,w){function p(W,j){W.prototype=Object.create(j.prototype),W.prototype.constructor=W,b(W,j)}function b(W,j){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(I,t){return I.__proto__=t,I},b(W,j)}var u=w(9),e=w(3),_=w(1).Obj,O=w(0),V=function(W){p(j,W);function j(){return W.apply(this,arguments)||this}var L=j.prototype;return L.init=function(t){this.tokens=t,this.peeked=null,this.breakOnBlocks=null,this.dropLeadingWhitespace=!1,this.extensions=[]},L.nextToken=function(t){var r;if(this.peeked)if(!t&&this.peeked.type===u.TOKEN_WHITESPACE)this.peeked=null;else return r=this.peeked,this.peeked=null,r;if(r=this.tokens.nextToken(),!t)for(;r&&r.type===u.TOKEN_WHITESPACE;)r=this.tokens.nextToken();return r},L.peekToken=function(){return this.peeked=this.peeked||this.nextToken(),this.peeked},L.pushToken=function(t){if(this.peeked)throw new Error("pushToken: can only push one token on between reads");this.peeked=t},L.error=function(t,r,i){if(r===void 0||i===void 0){var m=this.peekToken()||{};r=m.lineno,i=m.colno}return r!==void 0&&(r+=1),i!==void 0&&(i+=1),new O.TemplateError(t,r,i)},L.fail=function(t,r,i){throw this.error(t,r,i)},L.skip=function(t){var r=this.nextToken();return!r||r.type!==t?(this.pushToken(r),!1):!0},L.expect=function(t){var r=this.nextToken();return r.type!==t&&this.fail("expected "+t+", got "+r.type,r.lineno,r.colno),r},L.skipValue=function(t,r){var i=this.nextToken();return!i||i.type!==t||i.value!==r?(this.pushToken(i),!1):!0},L.skipSymbol=function(t){return this.skipValue(u.TOKEN_SYMBOL,t)},L.advanceAfterBlockEnd=function(t){var r;return t||(r=this.peekToken(),r||this.fail("unexpected end of file"),r.type!==u.TOKEN_SYMBOL&&this.fail("advanceAfterBlockEnd: expected symbol token or explicit name to be passed"),t=this.nextToken().value),r=this.nextToken(),r&&r.type===u.TOKEN_BLOCK_END?r.value.charAt(0)==="-"&&(this.dropLeadingWhitespace=!0):this.fail("expected block end in "+t+" statement"),r},L.advanceAfterVariableEnd=function(){var t=this.nextToken();t&&t.type===u.TOKEN_VARIABLE_END?this.dropLeadingWhitespace=t.value.charAt(t.value.length-this.tokens.tags.VARIABLE_END.length-1)==="-":(this.pushToken(t),this.fail("expected variable end"))},L.parseFor=function(){var t=this.peekToken(),r,i;this.skipSymbol("for")?(r=new e.For(t.lineno,t.colno),i="endfor"):this.skipSymbol("asyncEach")?(r=new e.AsyncEach(t.lineno,t.colno),i="endeach"):this.skipSymbol("asyncAll")?(r=new e.AsyncAll(t.lineno,t.colno),i="endall"):this.fail("parseFor: expected for{Async}",t.lineno,t.colno),r.name=this.parsePrimary(),r.name instanceof e.Symbol||this.fail("parseFor: variable name expected for loop");var m=this.peekToken().type;if(m===u.TOKEN_COMMA){var c=r.name;for(r.name=new e.Array(c.lineno,c.colno),r.name.addChild(c);this.skip(u.TOKEN_COMMA);){var g=this.parsePrimary();r.name.addChild(g)}}return this.skipSymbol("in")||this.fail('parseFor: expected "in" keyword for loop',t.lineno,t.colno),r.arr=this.parseExpression(),this.advanceAfterBlockEnd(t.value),r.body=this.parseUntilBlocks(i,"else"),this.skipSymbol("else")&&(this.advanceAfterBlockEnd("else"),r.else_=this.parseUntilBlocks(i)),this.advanceAfterBlockEnd(),r},L.parseMacro=function(){var t=this.peekToken();this.skipSymbol("macro")||this.fail("expected macro");var r=this.parsePrimary(!0),i=this.parseSignature(),m=new e.Macro(t.lineno,t.colno,r,i);return this.advanceAfterBlockEnd(t.value),m.body=this.parseUntilBlocks("endmacro"),this.advanceAfterBlockEnd(),m},L.parseCall=function(){var t=this.peekToken();this.skipSymbol("call")||this.fail("expected call");var r=this.parseSignature(!0)||new e.NodeList,i=this.parsePrimary();this.advanceAfterBlockEnd(t.value);var m=this.parseUntilBlocks("endcall");this.advanceAfterBlockEnd();var c=new e.Symbol(t.lineno,t.colno,"caller"),g=new e.Caller(t.lineno,t.colno,c,r,m),n=i.args.children;n[n.length-1]instanceof e.KeywordArgs||n.push(new e.KeywordArgs);var o=n[n.length-1];return o.addChild(new e.Pair(t.lineno,t.colno,c,g)),new e.Output(t.lineno,t.colno,[i])},L.parseWithContext=function(){var t=this.peekToken(),r=null;return this.skipSymbol("with")?r=!0:this.skipSymbol("without")&&(r=!1),r!==null&&(this.skipSymbol("context")||this.fail("parseFrom: expected context after with/without",t.lineno,t.colno)),r},L.parseImport=function(){var t=this.peekToken();this.skipSymbol("import")||this.fail("parseImport: expected import",t.lineno,t.colno);var r=this.parseExpression();this.skipSymbol("as")||this.fail('parseImport: expected "as" keyword',t.lineno,t.colno);var i=this.parseExpression(),m=this.parseWithContext(),c=new e.Import(t.lineno,t.colno,r,i,m);return this.advanceAfterBlockEnd(t.value),c},L.parseFrom=function(){var t=this.peekToken();this.skipSymbol("from")||this.fail("parseFrom: expected from");var r=this.parseExpression();this.skipSymbol("import")||this.fail("parseFrom: expected import",t.lineno,t.colno);for(var i=new e.NodeList,m;;){var c=this.peekToken();if(c.type===u.TOKEN_BLOCK_END){i.children.length||this.fail("parseFrom: Expected at least one import name",t.lineno,t.colno),c.value.charAt(0)==="-"&&(this.dropLeadingWhitespace=!0),this.nextToken();break}i.children.length>0&&!this.skip(u.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",t.lineno,t.colno);var g=this.parsePrimary();if(g.value.charAt(0)==="_"&&this.fail("parseFrom: names starting with an underscore cannot be imported",g.lineno,g.colno),this.skipSymbol("as")){var n=this.parsePrimary();i.addChild(new e.Pair(g.lineno,g.colno,g,n))}else i.addChild(g);m=this.parseWithContext()}return new e.FromImport(t.lineno,t.colno,r,i,m)},L.parseBlock=function(){var t=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",t.lineno,t.colno);var r=new e.Block(t.lineno,t.colno);r.name=this.parsePrimary(),r.name instanceof e.Symbol||this.fail("parseBlock: variable name expected",t.lineno,t.colno),this.advanceAfterBlockEnd(t.value),r.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(r.name.value);var i=this.peekToken();return i||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(i.value),r},L.parseExtends=function(){var t="extends",r=this.peekToken();this.skipSymbol(t)||this.fail("parseTemplateRef: expected "+t);var i=new e.Extends(r.lineno,r.colno);return i.template=this.parseExpression(),this.advanceAfterBlockEnd(r.value),i},L.parseInclude=function(){var t="include",r=this.peekToken();this.skipSymbol(t)||this.fail("parseInclude: expected "+t);var i=new e.Include(r.lineno,r.colno);return i.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(i.ignoreMissing=!0),this.advanceAfterBlockEnd(r.value),i},L.parseIf=function(){var t=this.peekToken(),r;this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?r=new e.If(t.lineno,t.colno):this.skipSymbol("ifAsync")?r=new e.IfAsync(t.lineno,t.colno):this.fail("parseIf: expected if, elif, or elseif",t.lineno,t.colno),r.cond=this.parseExpression(),this.advanceAfterBlockEnd(t.value),r.body=this.parseUntilBlocks("elif","elseif","else","endif");var i=this.peekToken();switch(i&&i.value){case"elseif":case"elif":r.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),r.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":r.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return r},L.parseSet=function(){var t=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",t.lineno,t.colno);for(var r=new e.Set(t.lineno,t.colno,[]),i;(i=this.parsePrimary())&&(r.targets.push(i),!!this.skip(u.TOKEN_COMMA)););return this.skipValue(u.TOKEN_OPERATOR,"=")?(r.value=this.parseExpression(),this.advanceAfterBlockEnd(t.value)):this.skip(u.TOKEN_BLOCK_END)?(r.body=new e.Capture(t.lineno,t.colno,this.parseUntilBlocks("endset")),r.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",t.lineno,t.colno),r},L.parseSwitch=function(){var t="switch",r="endswitch",i="case",m="default",c=this.peekToken();!this.skipSymbol(t)&&!this.skipSymbol(i)&&!this.skipSymbol(m)&&this.fail('parseSwitch: expected "switch," "case" or "default"',c.lineno,c.colno);var g=this.parseExpression();this.advanceAfterBlockEnd(t),this.parseUntilBlocks(i,m,r);var n=this.peekToken(),o=[],f;do{this.skipSymbol(i);var a=this.parseExpression();this.advanceAfterBlockEnd(t);var s=this.parseUntilBlocks(i,m,r);o.push(new e.Case(n.line,n.col,a,s)),n=this.peekToken()}while(n&&n.value===i);switch(n.value){case m:this.advanceAfterBlockEnd(),f=this.parseUntilBlocks(r),this.advanceAfterBlockEnd();break;case r:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.')}return new e.Switch(c.lineno,c.colno,g,o,f)},L.parseStatement=function(){var t=this.peekToken(),r;if(t.type!==u.TOKEN_SYMBOL&&this.fail("tag name expected",t.lineno,t.colno),this.breakOnBlocks&&O.indexOf(this.breakOnBlocks,t.value)!==-1)return null;switch(t.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var i=0;i<this.extensions.length;i++){var m=this.extensions[i];if(O.indexOf(m.tags||[],t.value)!==-1)return m.parse(this,e,u)}this.fail("unknown block tag: "+t.value,t.lineno,t.colno)}return r},L.parseRaw=function(t){t=t||"raw";for(var r="end"+t,i=new RegExp("([\\s\\S]*?){%\\s*("+t+"|"+r+")\\s*(?=%})%}"),m=1,c="",g=null,n=this.advanceAfterBlockEnd();(g=this.tokens._extractRegex(i))&&m>0;){var o=g[0],f=g[1],a=g[2];a===t?m+=1:a===r&&(m-=1),m===0?(c+=f,this.tokens.backN(o.length-f.length)):c+=o}return new e.Output(n.lineno,n.colno,[new e.TemplateData(n.lineno,n.colno,c)])},L.parsePostfix=function(t){for(var r,i=this.peekToken();i;){if(i.type===u.TOKEN_LEFT_PAREN)t=new e.FunCall(i.lineno,i.colno,t,this.parseSignature());else if(i.type===u.TOKEN_LEFT_BRACKET)r=this.parseAggregate(),r.children.length>1&&this.fail("invalid index"),t=new e.LookupVal(i.lineno,i.colno,t,r.children[0]);else if(i.type===u.TOKEN_OPERATOR&&i.value==="."){this.nextToken();var m=this.nextToken();m.type!==u.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+m.value,m.lineno,m.colno),r=new e.Literal(m.lineno,m.colno,m.value),t=new e.LookupVal(i.lineno,i.colno,t,r)}else break;i=this.peekToken()}return t},L.parseExpression=function(){var t=this.parseInlineIf();return t},L.parseInlineIf=function(){var t=this.parseOr();if(this.skipSymbol("if")){var r=this.parseOr(),i=t;t=new e.InlineIf(t.lineno,t.colno),t.body=i,t.cond=r,this.skipSymbol("else")?t.else_=this.parseOr():t.else_=null}return t},L.parseOr=function(){for(var t=this.parseAnd();this.skipSymbol("or");){var r=this.parseAnd();t=new e.Or(t.lineno,t.colno,t,r)}return t},L.parseAnd=function(){for(var t=this.parseNot();this.skipSymbol("and");){var r=this.parseNot();t=new e.And(t.lineno,t.colno,t,r)}return t},L.parseNot=function(){var t=this.peekToken();return this.skipSymbol("not")?new e.Not(t.lineno,t.colno,this.parseNot()):this.parseIn()},L.parseIn=function(){for(var t=this.parseIs();;){var r=this.nextToken();if(!r)break;var i=r.type===u.TOKEN_SYMBOL&&r.value==="not";if(i||this.pushToken(r),this.skipSymbol("in")){var m=this.parseIs();t=new e.In(t.lineno,t.colno,t,m),i&&(t=new e.Not(t.lineno,t.colno,t))}else{i&&this.pushToken(r);break}}return t},L.parseIs=function(){var t=this.parseCompare();if(this.skipSymbol("is")){var r=this.skipSymbol("not"),i=this.parseCompare();t=new e.Is(t.lineno,t.colno,t,i),r&&(t=new e.Not(t.lineno,t.colno,t))}return t},L.parseCompare=function(){for(var t=["==","===","!=","!==","<",">","<=",">="],r=this.parseConcat(),i=[];;){var m=this.nextToken();if(m)if(t.indexOf(m.value)!==-1)i.push(new e.CompareOperand(m.lineno,m.colno,this.parseConcat(),m.value));else{this.pushToken(m);break}else break}return i.length?new e.Compare(i[0].lineno,i[0].colno,r,i):r},L.parseConcat=function(){for(var t=this.parseAdd();this.skipValue(u.TOKEN_TILDE,"~");){var r=this.parseAdd();t=new e.Concat(t.lineno,t.colno,t,r)}return t},L.parseAdd=function(){for(var t=this.parseSub();this.skipValue(u.TOKEN_OPERATOR,"+");){var r=this.parseSub();t=new e.Add(t.lineno,t.colno,t,r)}return t},L.parseSub=function(){for(var t=this.parseMul();this.skipValue(u.TOKEN_OPERATOR,"-");){var r=this.parseMul();t=new e.Sub(t.lineno,t.colno,t,r)}return t},L.parseMul=function(){for(var t=this.parseDiv();this.skipValue(u.TOKEN_OPERATOR,"*");){var r=this.parseDiv();t=new e.Mul(t.lineno,t.colno,t,r)}return t},L.parseDiv=function(){for(var t=this.parseFloorDiv();this.skipValue(u.TOKEN_OPERATOR,"/");){var r=this.parseFloorDiv();t=new e.Div(t.lineno,t.colno,t,r)}return t},L.parseFloorDiv=function(){for(var t=this.parseMod();this.skipValue(u.TOKEN_OPERATOR,"//");){var r=this.parseMod();t=new e.FloorDiv(t.lineno,t.colno,t,r)}return t},L.parseMod=function(){for(var t=this.parsePow();this.skipValue(u.TOKEN_OPERATOR,"%");){var r=this.parsePow();t=new e.Mod(t.lineno,t.colno,t,r)}return t},L.parsePow=function(){for(var t=this.parseUnary();this.skipValue(u.TOKEN_OPERATOR,"**");){var r=this.parseUnary();t=new e.Pow(t.lineno,t.colno,t,r)}return t},L.parseUnary=function(t){var r=this.peekToken(),i;return this.skipValue(u.TOKEN_OPERATOR,"-")?i=new e.Neg(r.lineno,r.colno,this.parseUnary(!0)):this.skipValue(u.TOKEN_OPERATOR,"+")?i=new e.Pos(r.lineno,r.colno,this.parseUnary(!0)):i=this.parsePrimary(),t||(i=this.parseFilter(i)),i},L.parsePrimary=function(t){var r=this.nextToken(),i,m=null;if(r?r.type===u.TOKEN_STRING?i=r.value:r.type===u.TOKEN_INT?i=parseInt(r.value,10):r.type===u.TOKEN_FLOAT?i=parseFloat(r.value):r.type===u.TOKEN_BOOLEAN?r.value==="true"?i=!0:r.value==="false"?i=!1:this.fail("invalid boolean: "+r.value,r.lineno,r.colno):r.type===u.TOKEN_NONE?i=null:r.type===u.TOKEN_REGEX&&(i=new RegExp(r.value.body,r.value.flags)):this.fail("expected expression, got end of file"),i!==void 0?m=new e.Literal(r.lineno,r.colno,i):r.type===u.TOKEN_SYMBOL?m=new e.Symbol(r.lineno,r.colno,r.value):(this.pushToken(r),m=this.parseAggregate()),t||(m=this.parsePostfix(m)),m)return m;throw this.error("unexpected token: "+r.value,r.lineno,r.colno)},L.parseFilterName=function(){for(var t=this.expect(u.TOKEN_SYMBOL),r=t.value;this.skipValue(u.TOKEN_OPERATOR,".");)r+="."+this.expect(u.TOKEN_SYMBOL).value;return new e.Symbol(t.lineno,t.colno,r)},L.parseFilterArgs=function(t){if(this.peekToken().type===u.TOKEN_LEFT_PAREN){var r=this.parsePostfix(t);return r.args.children}return[]},L.parseFilter=function(t){for(;this.skip(u.TOKEN_PIPE);){var r=this.parseFilterName();t=new e.Filter(r.lineno,r.colno,r,new e.NodeList(r.lineno,r.colno,[t].concat(this.parseFilterArgs(t))))}return t},L.parseFilterStatement=function(){var t=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var r=this.parseFilterName(),i=this.parseFilterArgs(r);this.advanceAfterBlockEnd(t.value);var m=new e.Capture(r.lineno,r.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var c=new e.Filter(r.lineno,r.colno,r,new e.NodeList(r.lineno,r.colno,[m].concat(i)));return new e.Output(r.lineno,r.colno,[c])},L.parseAggregate=function(){var t=this.nextToken(),r;switch(t.type){case u.TOKEN_LEFT_PAREN:r=new e.Group(t.lineno,t.colno);break;case u.TOKEN_LEFT_BRACKET:r=new e.Array(t.lineno,t.colno);break;case u.TOKEN_LEFT_CURLY:r=new e.Dict(t.lineno,t.colno);break;default:return null}for(;;){var i=this.peekToken().type;if(i===u.TOKEN_RIGHT_PAREN||i===u.TOKEN_RIGHT_BRACKET||i===u.TOKEN_RIGHT_CURLY){this.nextToken();break}if(r.children.length>0&&(this.skip(u.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",t.lineno,t.colno)),r instanceof e.Dict){var m=this.parsePrimary();this.skip(u.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",t.lineno,t.colno);var c=this.parseExpression();r.addChild(new e.Pair(m.lineno,m.colno,m,c))}else{var g=this.parseExpression();r.addChild(g)}}return r},L.parseSignature=function(t,r){var i=this.peekToken();if(!r&&i.type!==u.TOKEN_LEFT_PAREN){if(t)return null;this.fail("expected arguments",i.lineno,i.colno)}i.type===u.TOKEN_LEFT_PAREN&&(i=this.nextToken());for(var m=new e.NodeList(i.lineno,i.colno),c=new e.KeywordArgs(i.lineno,i.colno),g=!1;;){if(i=this.peekToken(),!r&&i.type===u.TOKEN_RIGHT_PAREN){this.nextToken();break}else if(r&&i.type===u.TOKEN_BLOCK_END)break;if(g&&!this.skip(u.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",i.lineno,i.colno);else{var n=this.parseExpression();this.skipValue(u.TOKEN_OPERATOR,"=")?c.addChild(new e.Pair(n.lineno,n.colno,n,this.parseExpression())):m.addChild(n)}g=!0}return c.children.length&&m.addChild(c),m},L.parseUntilBlocks=function(){for(var t=this.breakOnBlocks,r=arguments.length,i=new Array(r),m=0;m<r;m++)i[m]=arguments[m];this.breakOnBlocks=i;var c=this.parse();return this.breakOnBlocks=t,c},L.parseNodes=function(){for(var t,r=[];t=this.nextToken();)if(t.type===u.TOKEN_DATA){var i=t.value,m=this.peekToken(),c=m&&m.value;this.dropLeadingWhitespace&&(i=i.replace(/^\s*/,""),this.dropLeadingWhitespace=!1),m&&(m.type===u.TOKEN_BLOCK_START&&c.charAt(c.length-1)==="-"||m.type===u.TOKEN_VARIABLE_START&&c.charAt(this.tokens.tags.VARIABLE_START.length)==="-"||m.type===u.TOKEN_COMMENT&&c.charAt(this.tokens.tags.COMMENT_START.length)==="-")&&(i=i.replace(/\s*$/,"")),r.push(new e.Output(t.lineno,t.colno,[new e.TemplateData(t.lineno,t.colno,i)]))}else if(t.type===u.TOKEN_BLOCK_START){this.dropLeadingWhitespace=!1;var g=this.parseStatement();if(!g)break;r.push(g)}else if(t.type===u.TOKEN_VARIABLE_START){var n=this.parseExpression();this.dropLeadingWhitespace=!1,this.advanceAfterVariableEnd(),r.push(new e.Output(t.lineno,t.colno,[n]))}else t.type===u.TOKEN_COMMENT?this.dropLeadingWhitespace=t.value.charAt(t.value.length-this.tokens.tags.COMMENT_END.length-1)==="-":this.fail("Unexpected token at top-level: "+t.type,t.lineno,t.colno);return r},L.parse=function(){return new e.NodeList(0,0,this.parseNodes())},L.parseAsRoot=function(){return new e.Root(0,0,this.parseNodes())},j}(_);l.exports={parse:function(j,L,I){var t=new V(u.lex(j,I));return L!==void 0&&(t.extensions=L),t.parseAsRoot()},Parser:V}},function(l,k,w){var p=w(0),b=`
|
|
17
|
+
\r `,u="()[]{}%*-+~/#,:|.<>=!",e="0123456789",_="{%",O="%}",V="{{",W="}}",j="{#",L="#}",I="string",t="whitespace",r="data",i="block-start",m="block-end",c="variable-start",g="variable-end",n="comment",o="left-paren",f="right-paren",a="left-bracket",s="right-bracket",v="left-curly",d="right-curly",A="operator",B="comma",F="colon",K="tilde",D="pipe",E="int",x="float",N="boolean",M="none",P="symbol",q="special",z="regex";function X(be,oe,ae,H){return{type:be,value:oe,lineno:ae,colno:H}}var ye=function(){function be(ae,H){this.str=ae,this.index=0,this.len=ae.length,this.lineno=0,this.colno=0,this.in_code=!1,H=H||{};var Y=H.tags||{};this.tags={BLOCK_START:Y.blockStart||_,BLOCK_END:Y.blockEnd||O,VARIABLE_START:Y.variableStart||V,VARIABLE_END:Y.variableEnd||W,COMMENT_START:Y.commentStart||j,COMMENT_END:Y.commentEnd||L},this.trimBlocks=!!H.trimBlocks,this.lstripBlocks=!!H.lstripBlocks}var oe=be.prototype;return oe.nextToken=function(){var H=this.lineno,Y=this.colno,Q;if(this.in_code){var de=this.current();if(this.isFinished())return null;if(de==='"'||de==="'")return X(I,this._parseString(de),H,Y);if(Q=this._extract(b))return X(t,Q,H,Y);if((Q=this._extractString(this.tags.BLOCK_END))||(Q=this._extractString("-"+this.tags.BLOCK_END)))return this.in_code=!1,this.trimBlocks&&(de=this.current(),de===`
|
|
18
|
+
`?this.forward():de==="\r"&&(this.forward(),de=this.current(),de===`
|
|
19
|
+
`?this.forward():this.back())),X(m,Q,H,Y);if((Q=this._extractString(this.tags.VARIABLE_END))||(Q=this._extractString("-"+this.tags.VARIABLE_END)))return this.in_code=!1,X(g,Q,H,Y);if(de==="r"&&this.str.charAt(this.index+1)==="/"){this.forwardN(2);for(var Te="";!this.isFinished();)if(this.current()==="/"&&this.previous()!=="\\"){this.forward();break}else Te+=this.current(),this.forward();for(var Le=["g","i","m","y"],$e="";!this.isFinished();){var S=Le.indexOf(this.current())!==-1;if(S)$e+=this.current(),this.forward();else break}return X(z,{body:Te,flags:$e},H,Y)}else if(u.indexOf(de)!==-1){this.forward();var $=["==","===","!=","!==","<=",">=","//","**"],ee=de+this.current(),J;switch(p.indexOf($,ee)!==-1&&(this.forward(),de=ee,p.indexOf($,ee+this.current())!==-1&&(de=ee+this.current(),this.forward())),de){case"(":J=o;break;case")":J=f;break;case"[":J=a;break;case"]":J=s;break;case"{":J=v;break;case"}":J=d;break;case",":J=B;break;case":":J=F;break;case"~":J=K;break;case"|":J=D;break;default:J=A}return X(J,de,H,Y)}else if(Q=this._extractUntil(b+u),Q.match(/^[-+]?[0-9]+$/))if(this.current()==="."){this.forward();var pe=this._extract(e);return X(x,Q+"."+pe,H,Y)}else return X(E,Q,H,Y);else{if(Q.match(/^(true|false)$/))return X(N,Q,H,Y);if(Q==="none")return X(M,Q,H,Y);if(Q==="null")return X(M,Q,H,Y);if(Q)return X(P,Q,H,Y);throw new Error("Unexpected value while parsing: "+Q)}}else{var ue=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((Q=this._extractString(this.tags.BLOCK_START+"-"))||(Q=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,X(i,Q,H,Y);if((Q=this._extractString(this.tags.VARIABLE_START+"-"))||(Q=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,X(c,Q,H,Y);Q="";var Oe,me=!1;for(this._matches(this.tags.COMMENT_START)&&(me=!0,Q=this._extractString(this.tags.COMMENT_START));(Oe=this._extractUntil(ue))!==null;)if(Q+=Oe,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!me){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=Q.length){var ke=Q.slice(-this.colno);if(/^\s+$/.test(ke)&&(Q=Q.slice(0,-this.colno),!Q.length))return this.nextToken()}break}else if(this._matches(this.tags.COMMENT_END)){if(!me)throw new Error("unexpected end of comment");Q+=this._extractString(this.tags.COMMENT_END);break}else Q+=this.current(),this.forward();if(Oe===null&&me)throw new Error("expected end of comment, got end of file");return X(me?n:r,Q,H,Y)}},oe._parseString=function(H){this.forward();for(var Y="";!this.isFinished()&&this.current()!==H;){var Q=this.current();if(Q==="\\"){switch(this.forward(),this.current()){case"n":Y+=`
|
|
20
|
+
`;break;case"t":Y+=" ";break;case"r":Y+="\r";break;default:Y+=this.current()}this.forward()}else Y+=Q,this.forward()}return this.forward(),Y},oe._matches=function(H){if(this.index+H.length>this.len)return null;var Y=this.str.slice(this.index,this.index+H.length);return Y===H},oe._extractString=function(H){return this._matches(H)?(this.forwardN(H.length),H):null},oe._extractUntil=function(H){return this._extractMatching(!0,H||"")},oe._extract=function(H){return this._extractMatching(!1,H)},oe._extractMatching=function(H,Y){if(this.isFinished())return null;var Q=Y.indexOf(this.current());if(H&&Q===-1||!H&&Q!==-1){var de=this.current();this.forward();for(var Te=Y.indexOf(this.current());(H&&Te===-1||!H&&Te!==-1)&&!this.isFinished();)de+=this.current(),this.forward(),Te=Y.indexOf(this.current());return de}return""},oe._extractRegex=function(H){var Y=this.currentStr().match(H);return Y?(this.forwardN(Y[0].length),Y):null},oe.isFinished=function(){return this.index>=this.len},oe.forwardN=function(H){for(var Y=0;Y<H;Y++)this.forward()},oe.forward=function(){this.index++,this.previous()===`
|
|
21
|
+
`?(this.lineno++,this.colno=0):this.colno++},oe.backN=function(H){for(var Y=0;Y<H;Y++)this.back()},oe.back=function(){if(this.index--,this.current()===`
|
|
22
|
+
`){this.lineno--;var H=this.src.lastIndexOf(`
|
|
23
|
+
`,this.index-1);H===-1?this.colno=this.index:this.colno=this.index-H}else this.colno--},oe.current=function(){return this.isFinished()?"":this.str.charAt(this.index)},oe.currentStr=function(){return this.isFinished()?"":this.str.substr(this.index)},oe.previous=function(){return this.str.charAt(this.index-1)},be}();l.exports={lex:function(oe,ae){return new ye(oe,ae)},TOKEN_STRING:I,TOKEN_WHITESPACE:t,TOKEN_DATA:r,TOKEN_BLOCK_START:i,TOKEN_BLOCK_END:m,TOKEN_VARIABLE_START:c,TOKEN_VARIABLE_END:g,TOKEN_COMMENT:n,TOKEN_LEFT_PAREN:o,TOKEN_RIGHT_PAREN:f,TOKEN_LEFT_BRACKET:a,TOKEN_RIGHT_BRACKET:s,TOKEN_LEFT_CURLY:v,TOKEN_RIGHT_CURLY:d,TOKEN_OPERATOR:A,TOKEN_COMMA:B,TOKEN_COLON:F,TOKEN_TILDE:K,TOKEN_PIPE:D,TOKEN_INT:E,TOKEN_FLOAT:x,TOKEN_BOOLEAN:N,TOKEN_NONE:M,TOKEN_SYMBOL:P,TOKEN_SPECIAL:q,TOKEN_REGEX:z}},function(l,k,w){function p(V,W){V.prototype=Object.create(W.prototype),V.prototype.constructor=V,b(V,W)}function b(V,W){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(L,I){return L.__proto__=I,L},b(V,W)}var u=w(6),e=w(19),_=e.PrecompiledLoader,O=function(V){p(W,V);function W(L,I){var t;return t=V.call(this)||this,t.baseURL=L||".",I=I||{},t.useCache=!!I.useCache,t.async=!!I.async,t}var j=W.prototype;return j.resolve=function(I,t){throw new Error("relative templates not support in the browser yet")},j.getSource=function(I,t){var r=this,i=this.useCache,m;return this.fetch(this.baseURL+"/"+I,function(c,g){if(c)if(t)t(c.content);else if(c.status===404)m=null;else throw c.content;else m={src:g,path:I,noCache:!i},r.emit("load",I,m),t&&t(null,m)}),m},j.fetch=function(I,t){if(typeof window>"u")throw new Error("WebLoader can only by used in a browser");var r=new XMLHttpRequest,i=!0;r.onreadystatechange=function(){r.readyState===4&&i&&(i=!1,r.status===0||r.status===200?t(null,r.responseText):t({status:r.status,content:r.responseText}))},I+=(I.indexOf("?")===-1?"?":"&")+"s="+new Date().getTime(),r.open("GET",I,this.async),r.send()},W}(u);l.exports={WebLoader:O,PrecompiledLoader:_}},function(l,k,w){var p=w(0),b=w(7),u=b.Environment,e=b.Template,_=w(6),O=w(10),V=w(23),W=w(5),j=w(8),L=w(9),I=w(2),t=w(3),r=w(25),i;function m(c,g){g=g||{},p.isObject(c)&&(g=c,c=null);var n;return O.FileSystemLoader?n=new O.FileSystemLoader(c,{watch:g.watch,noCache:g.noCache}):O.WebLoader&&(n=new O.WebLoader(c,{useCache:g.web&&g.web.useCache,async:g.web&&g.web.async})),i=new u(n,g),g&&g.express&&i.express(g.express),i}l.exports={Environment:u,Template:e,Loader:_,FileSystemLoader:O.FileSystemLoader,NodeResolveLoader:O.NodeResolveLoader,PrecompiledLoader:O.PrecompiledLoader,WebLoader:O.WebLoader,compiler:W,parser:j,lexer:L,runtime:I,lib:p,nodes:t,installJinjaCompat:r,configure:m,reset:function(){i=void 0},compile:function(g,n,o,f){return i||m(),new e(g,n,o,f)},render:function(g,n,o){return i||m(),i.render(g,n,o)},renderString:function(g,n,o){return i||m(),i.renderString(g,n,o)},precompile:V?V.precompile:void 0,precompileString:V?V.precompileString:void 0}},function(l,k,w){var p=w(13),b=[],u=[],e=p.makeRequestCallFromTimer(_);function _(){if(u.length)throw u.shift()}l.exports=O;function O(W){var j;b.length?j=b.pop():j=new V,j.task=W,p(j)}function V(){this.task=null}V.prototype.call=function(){try{this.task.call()}catch(W){O.onerror?O.onerror(W):(u.push(W),e())}finally{this.task=null,b[b.length]=this}}},function(l,k,w){(function(p){l.exports=b;function b(t){u.length||e(),u[u.length]=t}var u=[],e,_=0,O=1024;function V(){for(;_<u.length;){var t=_;if(_=_+1,u[t].call(),_>O){for(var r=0,i=u.length-_;r<i;r++)u[r]=u[r+_];u.length-=_,_=0}}u.length=0,_=0}var W=typeof p<"u"?p:self,j=W.MutationObserver||W.WebKitMutationObserver;typeof j=="function"?e=L(V):e=I(V),b.requestFlush=e;function L(t){var r=1,i=new j(t),m=document.createTextNode("");return i.observe(m,{characterData:!0}),function(){r=-r,m.data=r}}function I(t){return function(){var i=setTimeout(c,0),m=setInterval(c,50);function c(){clearTimeout(i),clearInterval(m),t()}}}b.makeRequestCallFromTimer=I}).call(k,w(14))},function(l,k){var w;w=function(){return this}();try{w=w||Function("return this")()||(0,eval)("this")}catch{typeof window=="object"&&(w=window)}l.exports=w},function(l,k,w){var p,b;(function(u){var e=function(){var j=Array.prototype.slice.call(arguments);typeof j[0]=="function"&&j[0].apply(null,j.splice(1))},_=function(j){typeof setImmediate=="function"?setImmediate(j):typeof process<"u"&&process.nextTick?process.nextTick(j):setTimeout(j,0)},O=function(j){var L=function(I){var t=function(){return j.length&&j[I].apply(null,arguments),t.next()};return t.next=function(){return I<j.length-1?L(I+1):null},t};return L(0)},V=Array.isArray||function(j){return Object.prototype.toString.call(j)==="[object Array]"},W=function(j,L,I){var t=I?_:e;if(L=L||function(){},!V(j)){var r=new Error("First argument to waterfall must be an array of functions");return L(r)}if(!j.length)return L();var i=function(m){return function(c){if(c)L.apply(null,arguments),L=function(){};else{var g=Array.prototype.slice.call(arguments,1),n=m.next();n?g.push(i(n)):g.push(L),t(function(){m.apply(null,g)})}}};i(O(j))()};p=[],b=(function(){return W}).apply(k,p),b!==void 0&&(l.exports=b)})()},function(l,k,w){var p=typeof Reflect=="object"?Reflect:null,b=p&&typeof p.apply=="function"?p.apply:function(s,v,d){return Function.prototype.apply.call(s,v,d)},u;p&&typeof p.ownKeys=="function"?u=p.ownKeys:Object.getOwnPropertySymbols?u=function(s){return Object.getOwnPropertyNames(s).concat(Object.getOwnPropertySymbols(s))}:u=function(s){return Object.getOwnPropertyNames(s)};function e(a){console&&console.warn&&console.warn(a)}var _=Number.isNaN||function(s){return s!==s};function O(){O.init.call(this)}l.exports=O,l.exports.once=n,O.EventEmitter=O,O.prototype._events=void 0,O.prototype._eventsCount=0,O.prototype._maxListeners=void 0;var V=10;function W(a){if(typeof a!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof a)}Object.defineProperty(O,"defaultMaxListeners",{enumerable:!0,get:function(){return V},set:function(a){if(typeof a!="number"||a<0||_(a))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+a+".");V=a}}),O.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},O.prototype.setMaxListeners=function(s){if(typeof s!="number"||s<0||_(s))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+s+".");return this._maxListeners=s,this};function j(a){return a._maxListeners===void 0?O.defaultMaxListeners:a._maxListeners}O.prototype.getMaxListeners=function(){return j(this)},O.prototype.emit=function(s){for(var v=[],d=1;d<arguments.length;d++)v.push(arguments[d]);var A=s==="error",B=this._events;if(B!==void 0)A=A&&B.error===void 0;else if(!A)return!1;if(A){var F;if(v.length>0&&(F=v[0]),F instanceof Error)throw F;var K=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw K.context=F,K}var D=B[s];if(D===void 0)return!1;if(typeof D=="function")b(D,this,v);else for(var E=D.length,x=m(D,E),d=0;d<E;++d)b(x[d],this,v);return!0};function L(a,s,v,d){var A,B,F;if(W(v),B=a._events,B===void 0?(B=a._events=Object.create(null),a._eventsCount=0):(B.newListener!==void 0&&(a.emit("newListener",s,v.listener?v.listener:v),B=a._events),F=B[s]),F===void 0)F=B[s]=v,++a._eventsCount;else if(typeof F=="function"?F=B[s]=d?[v,F]:[F,v]:d?F.unshift(v):F.push(v),A=j(a),A>0&&F.length>A&&!F.warned){F.warned=!0;var K=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(s)+" listeners added. Use emitter.setMaxListeners() to increase limit");K.name="MaxListenersExceededWarning",K.emitter=a,K.type=s,K.count=F.length,e(K)}return a}O.prototype.addListener=function(s,v){return L(this,s,v,!1)},O.prototype.on=O.prototype.addListener,O.prototype.prependListener=function(s,v){return L(this,s,v,!0)};function I(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function t(a,s,v){var d={fired:!1,wrapFn:void 0,target:a,type:s,listener:v},A=I.bind(d);return A.listener=v,d.wrapFn=A,A}O.prototype.once=function(s,v){return W(v),this.on(s,t(this,s,v)),this},O.prototype.prependOnceListener=function(s,v){return W(v),this.prependListener(s,t(this,s,v)),this},O.prototype.removeListener=function(s,v){var d,A,B,F,K;if(W(v),A=this._events,A===void 0)return this;if(d=A[s],d===void 0)return this;if(d===v||d.listener===v)--this._eventsCount===0?this._events=Object.create(null):(delete A[s],A.removeListener&&this.emit("removeListener",s,d.listener||v));else if(typeof d!="function"){for(B=-1,F=d.length-1;F>=0;F--)if(d[F]===v||d[F].listener===v){K=d[F].listener,B=F;break}if(B<0)return this;B===0?d.shift():c(d,B),d.length===1&&(A[s]=d[0]),A.removeListener!==void 0&&this.emit("removeListener",s,K||v)}return this},O.prototype.off=O.prototype.removeListener,O.prototype.removeAllListeners=function(s){var v,d,A;if(d=this._events,d===void 0)return this;if(d.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):d[s]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete d[s]),this;if(arguments.length===0){var B=Object.keys(d),F;for(A=0;A<B.length;++A)F=B[A],F!=="removeListener"&&this.removeAllListeners(F);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(v=d[s],typeof v=="function")this.removeListener(s,v);else if(v!==void 0)for(A=v.length-1;A>=0;A--)this.removeListener(s,v[A]);return this};function r(a,s,v){var d=a._events;if(d===void 0)return[];var A=d[s];return A===void 0?[]:typeof A=="function"?v?[A.listener||A]:[A]:v?g(A):m(A,A.length)}O.prototype.listeners=function(s){return r(this,s,!0)},O.prototype.rawListeners=function(s){return r(this,s,!1)},O.listenerCount=function(a,s){return typeof a.listenerCount=="function"?a.listenerCount(s):i.call(a,s)},O.prototype.listenerCount=i;function i(a){var s=this._events;if(s!==void 0){var v=s[a];if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}O.prototype.eventNames=function(){return this._eventsCount>0?u(this._events):[]};function m(a,s){for(var v=new Array(s),d=0;d<s;++d)v[d]=a[d];return v}function c(a,s){for(;s+1<a.length;s++)a[s]=a[s+1];a.pop()}function g(a){for(var s=new Array(a.length),v=0;v<s.length;++v)s[v]=a[v].listener||a[v];return s}function n(a,s){return new Promise(function(v,d){function A(F){a.removeListener(s,B),d(F)}function B(){typeof a.removeListener=="function"&&a.removeListener("error",A),v([].slice.call(arguments))}f(a,s,B,{once:!0}),s!=="error"&&o(a,A,{once:!0})})}function o(a,s,v){typeof a.on=="function"&&f(a,"error",s,v)}function f(a,s,v,d){if(typeof a.on=="function")d.once?a.once(s,v):a.on(s,v);else if(typeof a.addEventListener=="function")a.addEventListener(s,function A(B){d.once&&a.removeEventListener(s,A),v(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof a)}},function(l,k,w){var p=w(3),b=w(0),u=0;function e(){return"hole_"+u++}function _(i,m){for(var c=null,g=0;g<i.length;g++){var n=m(i[g]);n!==i[g]&&(c||(c=i.slice()),c[g]=n)}return c||i}function O(i,m,c){if(!(i instanceof p.Node))return i;if(!c){var g=m(i);if(g&&g!==i)return g}if(i instanceof p.NodeList){var n=_(i.children,function(v){return O(v,m,c)});n!==i.children&&(i=new p[i.typename](i.lineno,i.colno,n))}else if(i instanceof p.CallExtension){var o=O(i.args,m,c),f=_(i.contentArgs,function(v){return O(v,m,c)});(o!==i.args||f!==i.contentArgs)&&(i=new p[i.typename](i.extName,i.prop,o,f))}else{var a=i.fields.map(function(v){return i[v]}),s=_(a,function(v){return O(v,m,c)});s!==a&&(i=new p[i.typename](i.lineno,i.colno),s.forEach(function(v,d){i[i.fields[d]]=v}))}return c&&m(i)||i}function V(i,m){return O(i,m,!0)}function W(i,m,c){var g=[],n=V(c?i[c]:i,function(o){var f;return o instanceof p.Block?o:((o instanceof p.Filter&&b.indexOf(m,o.name.value)!==-1||o instanceof p.CallExtensionAsync)&&(f=new p.Symbol(o.lineno,o.colno,e()),g.push(new p.FilterAsync(o.lineno,o.colno,o.name,o.args,f))),f)});return c?i[c]=n:i=n,g.length?(g.push(i),new p.NodeList(i.lineno,i.colno,g)):i}function j(i,m){return V(i,function(c){return c instanceof p.Output?W(c,m):c instanceof p.Set?W(c,m,"value"):c instanceof p.For?W(c,m,"arr"):c instanceof p.If?W(c,m,"cond"):c instanceof p.CallExtension?W(c,m,"args"):void 0})}function L(i){return O(i,function(m){if(m instanceof p.Block){var c=!1,g=e();m.body=O(m.body,function(n){if(n instanceof p.FunCall&&n.name.value==="super")return c=!0,new p.Symbol(n.lineno,n.colno,g)}),c&&m.body.children.unshift(new p.Super(0,0,m.name,new p.Symbol(0,0,g)))}})}function I(i){return V(i,function(m){if(!(!(m instanceof p.If)&&!(m instanceof p.For))){var c=!1;if(O(m,function(g){if(g instanceof p.FilterAsync||g instanceof p.IfAsync||g instanceof p.AsyncEach||g instanceof p.AsyncAll||g instanceof p.CallExtensionAsync)return c=!0,g}),c){if(m instanceof p.If)return new p.IfAsync(m.lineno,m.colno,m.cond,m.body,m.else_);if(m instanceof p.For&&!(m instanceof p.AsyncAll))return new p.AsyncEach(m.lineno,m.colno,m.arr,m.name,m.body,m.else_)}}})}function t(i,m){return I(L(j(i,m)))}function r(i,m){return t(i,m||[])}l.exports={transform:r}},function(l,u,w){var p=w(0),b=w(2),u=l.exports={};function e(S,$){return S==null||S===!1?$:S}u.abs=Math.abs;function _(S){return S!==S}function O(S,$,ee){var J,pe=[],ue=[];for(J=0;J<S.length;J++)J%$===0&&ue.length&&(pe.push(ue),ue=[]),ue.push(S[J]);if(ue.length){if(ee)for(J=ue.length;J<$;J++)ue.push(ee);pe.push(ue)}return pe}u.batch=O;function V(S){S=e(S,"");var $=S.toLowerCase();return b.copySafeness(S,$.charAt(0).toUpperCase()+$.slice(1))}u.capitalize=V;function W(S,$){if(S=e(S,""),$=$||80,S.length>=$)return S;var ee=$-S.length,J=p.repeat(" ",ee/2-ee%2),pe=p.repeat(" ",ee/2);return b.copySafeness(S,J+S+pe)}u.center=W;function j(S,$,ee){return ee?S||$:S!==void 0?S:$}u.default=j;function L(S,$,ee){if(!p.isObject(S))throw new p.TemplateError("dictsort filter: val must be an object");var J=[];for(var pe in S)J.push([pe,S[pe]]);var ue;if(ee===void 0||ee==="key")ue=0;else if(ee==="value")ue=1;else throw new p.TemplateError("dictsort filter: You can only sort by either key or value");return J.sort(function(Oe,me){var ke=Oe[ue],We=me[ue];return $||(p.isString(ke)&&(ke=ke.toUpperCase()),p.isString(We)&&(We=We.toUpperCase())),ke>We?1:ke===We?0:-1}),J}u.dictsort=L;function I(S,$){return JSON.stringify(S,null,$)}u.dump=I;function t(S){return S instanceof b.SafeString?S:(S=S??"",b.markSafe(p.escape(S.toString())))}u.escape=t;function r(S){return S instanceof b.SafeString?S:(S=S??"",b.markSafe(S.toString()))}u.safe=r;function i(S){return S[0]}u.first=i;function m(S){return S=S??"",b.markSafe(p.escape(S.toString()))}u.forceescape=m;function c(S,$){return p.groupBy(S,$,this.env.opts.throwOnUndefined)}u.groupby=c;function g(S,$,ee){if(S=e(S,""),S==="")return"";$=$||4;var J=S.split(`
|
|
24
|
+
`),pe=p.repeat(" ",$),ue=J.map(function(Oe,me){return me===0&&!ee?Oe:""+pe+Oe}).join(`
|
|
25
|
+
`);return b.copySafeness(S,ue)}u.indent=g;function n(S,$,ee){return $=$||"",ee&&(S=p.map(S,function(J){return J[ee]})),S.join($)}u.join=n;function o(S){return S[S.length-1]}u.last=o;function f(S){var $=e(S,"");return $!==void 0?typeof Map=="function"&&$ instanceof Map||typeof Set=="function"&&$ instanceof Set?$.size:p.isObject($)&&!($ instanceof b.SafeString)?p.keys($).length:$.length:0}u.length=f;function a(S){if(p.isString(S))return S.split("");if(p.isObject(S))return p._entries(S||{}).map(function($){var ee=$[0],J=$[1];return{key:ee,value:J}});if(p.isArray(S))return S;throw new p.TemplateError("list filter: type not iterable")}u.list=a;function s(S){return S=e(S,""),S.toLowerCase()}u.lower=s;function v(S){return S==null?"":b.copySafeness(S,S.replace(/\r\n|\n/g,`<br />
|
|
26
|
+
`))}u.nl2br=v;function d(S){return S[Math.floor(Math.random()*S.length)]}u.random=d;function A(S){function $(ee,J,pe){J===void 0&&(J="truthy");var ue=this,Oe=ue.env.getTest(J);return p.toArray(ee).filter(function(ke){return Oe.call(ue,ke,pe)===S})}return $}u.reject=A(!1);function B(S,$){return S.filter(function(ee){return!ee[$]})}u.rejectattr=B,u.select=A(!0);function F(S,$){return S.filter(function(ee){return!!ee[$]})}u.selectattr=F;function K(S,$,ee,J){var pe=S;if($ instanceof RegExp)return S.replace($,ee);typeof J>"u"&&(J=-1);var ue="";if(typeof $=="number")$=""+$;else if(typeof $!="string")return S;if(typeof S=="number"&&(S=""+S),typeof S!="string"&&!(S instanceof b.SafeString))return S;if($==="")return ue=ee+S.split("").join(ee)+ee,b.copySafeness(S,ue);var Oe=S.indexOf($);if(J===0||Oe===-1)return S;for(var me=0,ke=0;Oe>-1&&(J===-1||ke<J);)ue+=S.substring(me,Oe)+ee,me=Oe+$.length,ke++,Oe=S.indexOf($,me);return me<S.length&&(ue+=S.substring(me)),b.copySafeness(pe,ue)}u.replace=K;function D(S){var $;return p.isString(S)?$=a(S):$=p.map(S,function(ee){return ee}),$.reverse(),p.isString(S)?b.copySafeness(S,$.join("")):$}u.reverse=D;function E(S,$,ee){$=$||0;var J=Math.pow(10,$),pe;return ee==="ceil"?pe=Math.ceil:ee==="floor"?pe=Math.floor:pe=Math.round,pe(S*J)/J}u.round=E;function x(S,$,ee){for(var J=Math.floor(S.length/$),pe=S.length%$,ue=[],Oe=0,me=0;me<$;me++){var ke=Oe+me*J;me<pe&&Oe++;var We=Oe+(me+1)*J,qe=S.slice(ke,We);ee&&me>=pe&&qe.push(ee),ue.push(qe)}return ue}u.slice=x;function N(S,$,ee){return ee===void 0&&(ee=0),$&&(S=p.map(S,function(J){return J[$]})),ee+S.reduce(function(J,pe){return J+pe},0)}u.sum=N,u.sort=b.makeMacro(["value","reverse","case_sensitive","attribute"],[],function($,ee,J,pe){var ue=this,Oe=p.map($,function(ke){return ke}),me=p.getAttrGetter(pe);return Oe.sort(function(ke,We){var qe=pe?me(ke):ke,Ye=pe?me(We):We;if(ue.env.opts.throwOnUndefined&&pe&&(qe===void 0||Ye===void 0))throw new TypeError('sort: attribute "'+pe+'" resolved to undefined');return!J&&p.isString(qe)&&p.isString(Ye)&&(qe=qe.toLowerCase(),Ye=Ye.toLowerCase()),qe<Ye?ee?1:-1:qe>Ye?ee?-1:1:0}),Oe});function M(S){return b.copySafeness(S,S)}u.string=M;function P(S,$){S=e(S,"");var ee=/<\/?([a-z][a-z0-9]*)\b[^>]*>|<!--[\s\S]*?-->/gi,J=z(S.replace(ee,"")),pe="";return $?pe=J.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,`
|
|
27
|
+
`).replace(/\n\n\n+/g,`
|
|
28
|
+
|
|
29
|
+
`):pe=J.replace(/\s+/gi," "),b.copySafeness(S,pe)}u.striptags=P;function q(S){S=e(S,"");var $=S.split(" ").map(function(ee){return V(ee)});return b.copySafeness(S,$.join(" "))}u.title=q;function z(S){return b.copySafeness(S,S.replace(/^\s*|\s*$/g,""))}u.trim=z;function X(S,$,ee,J){var pe=S;if(S=e(S,""),$=$||255,S.length<=$)return S;if(ee)S=S.substring(0,$);else{var ue=S.lastIndexOf(" ",$);ue===-1&&(ue=$),S=S.substring(0,ue)}return S+=J??"...",b.copySafeness(pe,S)}u.truncate=X;function ye(S){return S=e(S,""),S.toUpperCase()}u.upper=ye;function be(S){var $=encodeURIComponent;if(p.isString(S))return $(S);var ee=p.isArray(S)?S:p._entries(S);return ee.map(function(J){var pe=J[0],ue=J[1];return $(pe)+"="+$(ue)}).join("&")}u.urlencode=be;var oe=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,ae=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,H=/^https?:\/\/.*$/,Y=/^www\./,Q=/\.(?:org|net|com)(?:\:|\/|$)/;function de(S,$,ee){_($)&&($=1/0);var J=ee===!0?' rel="nofollow"':"",pe=S.split(/(\s+)/).filter(function(ue){return ue&&ue.length}).map(function(ue){var Oe=ue.match(oe),me=Oe?Oe[1]:ue,ke=me.substr(0,$);return H.test(me)?'<a href="'+me+'"'+J+">"+ke+"</a>":Y.test(me)?'<a href="http://'+me+'"'+J+">"+ke+"</a>":ae.test(me)?'<a href="mailto:'+me+'">'+me+"</a>":Q.test(me)?'<a href="http://'+me+'"'+J+">"+ke+"</a>":ue});return pe.join("")}u.urlize=de;function Te(S){S=e(S,"");var $=S?S.match(/\w+/g):null;return $?$.length:null}u.wordcount=Te;function Le(S,$){var ee=parseFloat(S);return _(ee)?$:ee}u.float=Le;var $e=b.makeMacro(["value","default","base"],[],function($,ee,J){J===void 0&&(J=10);var pe=parseInt($,J);return _(pe)?ee:pe});u.int=$e,u.d=u.default,u.e=u.escape},function(l,k,w){function p(_,O){_.prototype=Object.create(O.prototype),_.prototype.constructor=_,b(_,O)}function b(_,O){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(W,j){return W.__proto__=j,W},b(_,O)}var u=w(6),e=function(_){p(O,_);function O(W){var j;return j=_.call(this)||this,j.precompiled=W||{},j}var V=O.prototype;return V.getSource=function(j){return this.precompiled[j]?{src:{type:"code",obj:this.precompiled[j]},path:j}:null},O}(u);l.exports={PrecompiledLoader:e}},function(l,k,w){var p=w(2).SafeString;function b(d){return typeof d=="function"}k.callable=b;function u(d){return d!==void 0}k.defined=u;function e(d,A){return d%A===0}k.divisibleby=e;function _(d){return d instanceof p}k.escaped=_;function O(d,A){return d===A}k.equalto=O,k.eq=k.equalto,k.sameas=k.equalto;function V(d){return d%2===0}k.even=V;function W(d){return!d}k.falsy=W;function j(d,A){return d>=A}k.ge=j;function L(d,A){return d>A}k.greaterthan=L,k.gt=k.greaterthan;function I(d,A){return d<=A}k.le=I;function t(d,A){return d<A}k.lessthan=t,k.lt=k.lessthan;function r(d){return d.toLowerCase()===d}k.lower=r;function i(d,A){return d!==A}k.ne=i;function m(d){return d===null}k.null=m;function c(d){return typeof d=="number"}k.number=c;function g(d){return d%2===1}k.odd=g;function n(d){return typeof d=="string"}k.string=n;function o(d){return!!d}k.truthy=o;function f(d){return d===void 0}k.undefined=f;function a(d){return d.toUpperCase()===d}k.upper=a;function s(d){return typeof Symbol<"u"?!!d[Symbol.iterator]:Array.isArray(d)||typeof d=="string"}k.iterable=s;function v(d){var A=d!=null&&typeof d=="object"&&!Array.isArray(d);return Set?A&&!(d instanceof Set):A}k.mapping=v},function(l,k,w){function p(e){var _=-1;return{current:null,reset:function(){_=-1,this.current=null},next:function(){return _++,_>=e.length&&(_=0),this.current=e[_],this.current}}}function b(e){e=e||",";var _=!0;return function(){var O=_?"":e;return _=!1,O}}function u(){return{range:function(_,O,V){typeof O>"u"?(O=_,_=0,V=1):V||(V=1);var W=[];if(V>0)for(var j=_;j<O;j+=V)W.push(j);else for(var L=_;L>O;L+=V)W.push(L);return W},cycler:function(){return p(Array.prototype.slice.call(arguments))},joiner:function(_){return b(_)}}}l.exports=u},function(l,k,w){var p=w(4);l.exports=function(u,e){function _(O,V){if(this.name=O,this.path=O,this.defaultEngine=V.defaultEngine,this.ext=p.extname(O),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=(this.defaultEngine[0]!=="."?".":"")+this.defaultEngine)}return _.prototype.render=function(V,W){u.render(this.name,V,W)},e.set("view",_),e.set("nunjucksEnv",u),u}},function(l,k,w){var p=w(4),b=w(4),u=w(0),e=u._prettifyError,_=w(5),O=w(7),V=O.Environment,W=w(24);function j(r,i){return Array.isArray(i)?i.some(function(m){return r.match(m)}):!1}function L(r,i){i=i||{},i.isString=!0;var m=i.env||new V([]),c=i.wrapper||W;if(!i.name)throw new Error('the "name" option is required when compiling a string');return c([t(r,i.name,m)],i)}function I(r,i){i=i||{};var m=i.env||new V([]),c=i.wrapper||W;if(i.isString)return L(r,i);var g=p.existsSync(r)&&p.statSync(r),n=[],o=[];function f(v){p.readdirSync(v).forEach(function(d){var A=b.join(v,d),B=A.substr(b.join(r,"/").length),F=p.statSync(A);F&&F.isDirectory()?(B+="/",j(B,i.exclude)||f(A)):j(B,i.include)&&o.push(A)})}if(g.isFile())n.push(t(p.readFileSync(r,"utf-8"),i.name||r,m));else if(g.isDirectory()){f(r);for(var a=0;a<o.length;a++){var s=o[a].replace(b.join(r,"/"),"");try{n.push(t(p.readFileSync(o[a],"utf-8"),s,m))}catch(v){if(i.force)console.error(v);else throw v}}}return c(n,i)}function t(r,i,m){m=m||new V([]);var c=m.asyncFilters,g=m.extensionsList,n;i=i.replace(/\\/g,"/");try{n=_.compile(r,c,g,i,m.opts)}catch(o){throw e(i,!1,o)}return{name:i,template:n}}l.exports={precompile:I,precompileString:L}},function(l,k,w){function p(b,u){var e="";u=u||{};for(var _=0;_<b.length;_++){var O=JSON.stringify(b[_].name),V=b[_].template;e+="(function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["+O+`] = (function() {
|
|
30
|
+
`+V+`
|
|
31
|
+
})();
|
|
32
|
+
`,u.asFunction&&(e+="return function(ctx, cb) { return nunjucks.render("+O+`, ctx, cb); }
|
|
33
|
+
`),e+=`})();
|
|
34
|
+
`}return e}l.exports=p},function(l,k,w){function p(){var b=this.runtime,u=this.lib,e=this.compiler.Compiler,_=this.parser.Parser,O=this.nodes,V=this.lexer,W=b.contextOrFrameLookup,j=b.memberLookup,L,I;e&&(L=e.prototype.assertType),_&&(I=_.prototype.parseAggregate);function t(){b.contextOrFrameLookup=W,b.memberLookup=j,e&&(e.prototype.assertType=L),_&&(_.prototype.parseAggregate=I)}b.contextOrFrameLookup=function(f,a,s){var v=W.apply(this,arguments);if(v!==void 0)return v;switch(s){case"True":return!0;case"False":return!1;case"None":return null;default:return}};function r(o){return{index:o.index,lineno:o.lineno,colno:o.colno}}if(O&&e&&_){var i=O.Node.extend("Slice",{fields:["start","stop","step"],init:function(f,a,s,v,d){s=s||new O.Literal(f,a,null),v=v||new O.Literal(f,a,null),d=d||new O.Literal(f,a,1),this.parent(f,a,s,v,d)}});e.prototype.assertType=function(f){f instanceof i||L.apply(this,arguments)},e.prototype.compileSlice=function(f,a){this._emit("("),this._compileExpression(f.start,a),this._emit("),("),this._compileExpression(f.stop,a),this._emit("),("),this._compileExpression(f.step,a),this._emit(")")},_.prototype.parseAggregate=function(){var f=this,a=r(this.tokens);a.colno--,a.index--;try{return I.apply(this)}catch(D){var s=r(this.tokens),v=function(){return u._assign(f.tokens,s),D};u._assign(this.tokens,a),this.peeked=!1;var d=this.peekToken();if(d.type!==V.TOKEN_LEFT_BRACKET)throw v();this.nextToken();for(var A=new i(d.lineno,d.colno),B=!1,F=0;F<=A.fields.length&&!this.skip(V.TOKEN_RIGHT_BRACKET);F++){if(F===A.fields.length)if(B)this.fail("parseSlice: too many slice components",d.lineno,d.colno);else break;if(this.skip(V.TOKEN_COLON))B=!0;else{var K=A.fields[F];A[K]=this.parseExpression(),B=this.skip(V.TOKEN_COLON)||B}}if(!B)throw v();return new O.Array(d.lineno,d.colno,[A])}}}function m(o,f,a,s){o=o||[],f===null&&(f=s<0?o.length-1:0),a===null?a=s<0?-1:o.length:a<0&&(a+=o.length),f<0&&(f+=o.length);for(var v=[],d=f;!(d<0||d>o.length||s>0&&d>=a||s<0&&d<=a);d+=s)v.push(b.memberLookup(o,d));return v}function c(o,f){return Object.prototype.hasOwnProperty.call(o,f)}var g={pop:function(f){if(f===void 0)return this.pop();if(f>=this.length||f<0)throw new Error("KeyError");return this.splice(f,1)},append:function(f){return this.push(f)},remove:function(f){for(var a=0;a<this.length;a++)if(this[a]===f)return this.splice(a,1);throw new Error("ValueError")},count:function(f){for(var a=0,s=0;s<this.length;s++)this[s]===f&&a++;return a},index:function(f){var a;if((a=this.indexOf(f))===-1)throw new Error("ValueError");return a},find:function(f){return this.indexOf(f)},insert:function(f,a){return this.splice(f,0,a)}},n={items:function(){return u._entries(this)},values:function(){return u._values(this)},keys:function(){return u.keys(this)},get:function(f,a){var s=this[f];return s===void 0&&(s=a),s},has_key:function(f){return c(this,f)},pop:function(f,a){var s=this[f];if(s===void 0&&a!==void 0)s=a;else{if(s===void 0)throw new Error("KeyError");delete this[f]}return s},popitem:function(){var f=u.keys(this);if(!f.length)throw new Error("KeyError");var a=f[0],s=this[a];return delete this[a],[a,s]},setdefault:function(f,a){return a===void 0&&(a=null),f in this||(this[f]=a),this[f]},update:function(f){return u._assign(this,f),null}};return n.iteritems=n.items,n.itervalues=n.values,n.iterkeys=n.keys,b.memberLookup=function(f,a,s){return arguments.length===4?m.apply(this,arguments):(f=f||{},u.isArray(f)&&c(g,a)?g[a].bind(f):u.isObject(f)&&c(n,a)?n[a].bind(f):j.apply(this,arguments))},t}l.exports=p}])})})(Gn);var gi=Gn.exports;const It=Wr(gi);var yi=ve('<label class="absolute right-6 top-1 z-10 inline-flex cursor-pointer items-center gap-2 bg-transparent text-rc-gray-100 focus:outline-none focus:ring-0"><input type="checkbox" class="checkbox svelte-1br1z62"/> <span>Preview</span></label>'),_i=ve('<div class="flex justify-end"><!></div>'),xi=ve('<div class="prompt-editor flex h-full flex-col"><div class="relative flex-1"><div class="h-full w-full"></div> <!></div> <!></div>');function Tn(C,T){vt(T,!0);let l=Ce(null),k,w=st(T,"readOnly",3,!1),p=st(T,"readOnlyMessage",3,""),b=st(T,"bottomPadding",3,0),u=st(T,"showPreviewToggle",3,!0),e=st(T,"preview",3,null),_=!1,O=null,V=null,W=!1,j=null,L=[],I=null,t=null,r=0,i=null;const m=24;let c=Ce(!1);const g=we(()=>e()!==null?e():y(c)),n=we(()=>`editorState/prompt/${T.agentId}/${T.stepName}`),o=we(()=>`editorState/prompt/${T.agentId}/${T.stepName}/preview`),f=we(()=>y(g)?y(o):y(n));function a(M,P){const q=M.getLayoutInfo(),z=Number((q==null?void 0:q.contentWidth)??0);if(!Number.isFinite(z)||z<=0)return 80;const X=M.getOption(P.editor.EditorOption.fontInfo),ye=Number(X==null?void 0:X.typicalHalfwidthCharacterWidth)||Number(X==null?void 0:X.typicalFullwidthCharacterWidth)||7;if(!Number.isFinite(ye)||ye<=0)return 80;const be=Math.floor((z-m)/ye);return Math.max(20,be)}function s(){!y(l)||!V||t==null&&(t=requestAnimationFrame(()=>{if(t=null,!y(l)||!V)return;const M=a(y(l),V);M!==r&&(r=M,y(l).updateOptions({wordWrap:"bounded",wordWrapColumn:M}))}))}function v(){Qt(y(f),y(l))}function d(M,P){const q=Mr(P);if(!q)return;const z=M.getContribution("editor.contrib.folding");if(z!=null&&z.getFoldingModel)z.getFoldingModel().then(()=>{try{M.restoreViewState(q)}catch{}});else try{M.restoreViewState(q)}catch{}}function A(){i!=null&&clearTimeout(i),i=setTimeout(()=>{i=null,v()},180)}nn(()=>{if(!k)return;Un();let M=!1;return Vn(()=>import("../chunks/DLQqXQ6R.js").then(P=>P.e),__vite__mapDeps([0,1,2]),import.meta.url).then(P=>{if(M)return;V=P,Wn(P),L.push(P.languages.registerFoldingRangeProvider("markdown",ai)),L.push(P.languages.registerFoldingRangeProvider("markdown",li)),L.push(P.languages.registerDocumentHighlightProvider("markdown",hi)),ne(l,P.editor.create(k,{value:"",language:"markdown",theme:"bosun-dark",lineNumbers:"off",fontSize:14,fontFamily:'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',automaticLayout:!0,minimap:{enabled:!1},wordBasedSuggestions:"off",wordWrap:"bounded",wordWrapColumn:120,wrappingStrategy:"advanced",matchBrackets:"never",bracketPairColorization:{enabled:!0},guides:{highlightActiveBracketPair:!1,bracketPairs:!1,bracketPairsHorizontal:!1},selectionHighlight:!1,unicodeHighlight:{ambiguousCharacters:!1,nonBasicASCII:!1,invisibleCharacters:!1,includeStrings:!1,includeComments:!1},autoClosingQuotes:"never",padding:{top:32,bottom:b()},readOnly:w(),readOnlyMessage:p()?{value:p()}:void 0}),!0),j=y(l).getModel(),s(),L.push(y(l).onDidLayoutChange(()=>s())),L.push(y(l).onDidChangeModelDecorations(()=>A())),L.push(y(l).onDidScrollChange(()=>A())),L.push(y(l).onDidChangeCursorPosition(()=>A())),L.push(y(l).onDidBlurEditorText(()=>v())),nt.agents.context.query({agentId:T.agentId}).then(z=>{M||(I==null||I.dispose(),I=Xr(P,z),L.push(I))}),O=jr(P,y(l));const q=T.initialPrompt??"";if(_=!0,y(l).setValue(q),_=!1,requestAnimationFrame(()=>{O==null||O.update(),y(l)&&d(y(l),y(f))}),L.push(y(l).onDidChangeModelContent(()=>{if(y(l)&&(O==null||O.update(),!_)){A();try{const z=y(l).getValue();T.onPromptChanged(z)}catch(z){console.error("Error updating prompt",z)}}})),W=!0,T.onEditorReady)try{T.onEditorReady(y(l),P)}catch(z){console.error("PromptEditor onEditorReady error",z)}}).catch(P=>{console.error("Error initializing Monaco editor:",P)}),()=>{M=!0,t!=null&&cancelAnimationFrame(t),t=null,i!=null&&clearTimeout(i),i=null,v(),I=null;for(const q of L)try{q.dispose()}catch{}L=[],O==null||O.dispose(),O=null;const P=j;if(j=null,y(l)){try{y(l).setModel(null)}catch{}y(l).dispose(),ne(l,null)}try{P==null||P.dispose()}catch{}}}),Je(()=>{!y(l)||!W||y(l).updateOptions({readOnly:w(),readOnlyMessage:p()?{value:p()}:void 0,padding:{top:32,bottom:b()}})}),Je(()=>{const M=T.initialPrompt??"";if(!(!y(l)||!W||y(g)&&!w())&&y(l).getValue()!==M){_=!0;try{y(l).setValue(M),O==null||O.update()}finally{_=!1}}});function B(M,P){return It.configure({autoescape:!1,trimBlocks:!0,lstripBlocks:!0}),It.renderString(M,P||{})}let F="",K=0;function D(M){var P;if(e()!==null){(P=T.onPreviewChange)==null||P.call(T,M);return}ne(c,M,!0)}function E(){if(K+=1,!!y(l)){Qt(y(o),y(l)),_=!0;try{F&&(y(l).setValue(F),F=""),y(l).updateOptions({readOnly:w()})}finally{_=!1}d(y(l),y(n))}}async function x(){if(!y(l)||w())return;Qt(y(n),y(l)),F=y(l).getValue();const M=K+=1;let P=null;try{P=await nt.agents.context.query({agentId:T.agentId})}catch(z){console.error("Failed to load agent context for preview:",z),P=null}if(M!==K||!y(l)||!y(g))return;const q=B(F,P||{});_=!0;try{y(l).setValue(q),y(l).updateOptions({readOnly:!0})}finally{_=!1}d(y(l),y(o))}let N=Ce(!1);Je(()=>{if(!y(l)||!W)return;const M=!!y(g)&&!w();M!==y(N)&&(ne(N,M,!0),M?x():E())}),kt(C,{get class(){return`relative overflow-hidden ${T.class??""}`},children:(M,P)=>{var q=xi(),z=re(q),X=re(z);on(X,H=>k=H,()=>k);var ye=he(X,2);{var be=H=>{var Y=yi(),Q=re(Y);Dn(Q),je(2),te(Y),De(()=>Er(Q,y(g))),Rt("change",Q,de=>D(de.currentTarget.checked)),Z(H,Y)};Pe(ye,H=>{u()&&!w()&&H(be)})}te(z);var oe=he(z,2);{var ae=H=>{var Y=_i(),Q=re(Y);Ze(Q,{variant:"secondary",get onclick(){return T.onSchemaClick},class:"absolute bottom-2 right-6 !font-medium",children:(de,Te)=>{je();var Le=Ue("Schema");Z(de,Le)},$$slots:{default:!0}}),te(Y),Z(H,Y)};Pe(oe,H=>{T.showSchemaButton&&T.onSchemaClick&&H(ae)})}te(q),Z(M,q)}}),mt()}tn(["change"]);var wi=ve("<!> <!>",1),bi=ve('<div class="flex h-full items-center justify-center text-sm text-rc-gray-300">Loading</div>'),An=ve('<pre class="whitespace-pre-wrap font-mono text-xs text-rc-gray-200"> </pre>'),Ei=ve('<div class="flex h-full flex-col gap-3"><div class="text-sm text-red-400"> </div></div>'),ki=ve('<div class="text-red-400">Error</div>'),Si=ve('<div class="rounded-md border border-rc-gray-700 bg-rc-gray-900/40 px-3 py-2"><div class="flex items-center justify-between text-xs text-rc-gray-400"><div> </div> <!></div> <div class="whitespace-pre-wrap break-words text-sm text-rc-gray-100"> </div></div>'),Oi=ve('<div class="mb-4"><div class="mb-2 text-xs font-semibold text-rc-gray-400">Why this response</div> <div class="flex flex-col gap-2"></div></div>'),Li=ve('<button type="button" class="rounded-md border border-rc-gray-700 bg-rc-gray-900/40 px-3 py-2 text-left hover:border-rc-gray-500"><div class="flex items-center justify-between text-xs text-rc-gray-400"><div> </div> <div> </div></div> <div class="whitespace-pre-wrap break-words text-sm text-rc-gray-100"> </div></button>'),Ti=ve('<div class="flex flex-col gap-2"></div>'),Ai=ve('<div class="text-sm text-rc-gray-300">No quotes returned.</div>'),Ci=ve('<div class="mb-3 text-sm font-semibold text-rc-gray-100"> </div> <!> <!>',1),Pi=ve('<button type="button" class="rounded-md border border-rc-gray-700 bg-rc-gray-900/40 px-3 py-2 text-left hover:border-rc-gray-500"><div class="whitespace-pre-wrap break-words text-sm text-rc-gray-100"> </div></button>'),Ni=ve('<div class="mt-3 flex flex-col gap-2"></div>'),Ri=ve('<div class="rounded-md border border-rc-gray-700 bg-rc-gray-900/40 p-3"><div class="flex items-start justify-between gap-3"><div class="text-xs font-semibold text-rc-gray-400"></div> <div class="text-xs text-rc-gray-500"> </div></div> <div class="mt-1 whitespace-pre-wrap break-words text-sm text-rc-gray-100"> </div> <!></div>'),Ii=ve('<div class="flex flex-col gap-3"></div>'),Fi=ve('<div class="text-sm text-rc-gray-300">No issues found.</div>'),Mi=ve('<div class="mb-3 text-sm font-semibold text-rc-gray-100"> </div> <!>',1),Bi=ve('<div class="border-b border-rc-gray-700 px-2 py-1"><!></div> <div class="min-h-0 flex-1 overflow-auto p-3"><!></div>',1);function Ki(C,T){vt(T,!0);const{state:l,actions:k}=rn();let w=Ce("results"),p=Ce(null);Je(()=>{var O;const _=((O=l.edit.popover)==null?void 0:O.requestId)??null;_!==y(p)&&(ne(p,_,!0),ne(w,"results"))});var b=Nt(),u=Qe(b);{var e=_=>{const O=we(()=>l.edit.popover);var V=Bi(),W=Qe(V),j=re(W);Zt(j,{get value(){return y(w)},ariaLabel:"Popover tabs",onChange:({value:m})=>ne(w,m,!0),children:(m,c)=>{var g=wi(),n=Qe(g);dt(n,{value:"results",children:(f,a)=>{je();var s=Ue("Results");Z(f,s)},$$slots:{default:!0}});var o=he(n,2);dt(o,{value:"raw",children:(f,a)=>{je();var s=Ue("Raw");Z(f,s)},$$slots:{default:!0}}),Z(m,g)},$$slots:{default:!0}}),te(W);var L=he(W,2),I=re(L);{var t=m=>{var c=bi();Z(m,c)},r=m=>{var c=Nt(),g=Qe(c);{var n=f=>{const a=we(()=>{var d;return typeof((d=y(O).data)==null?void 0:d.raw)=="string"?y(O).data.raw:y(O).error});var s=An(),v=re(s,!0);te(s),De(()=>Ne(v,y(a)||"—")),Z(f,s)},o=f=>{var a=Ei(),s=re(a),v=re(s,!0);te(s),te(a),De(()=>Ne(v,y(O).error)),Z(f,a)};Pe(g,f=>{y(w)==="raw"?f(n):f(o,-1)})}Z(m,c)},i=m=>{const c=we(()=>y(O).data);var g=Nt(),n=Qe(g);{var o=s=>{var v=An(),d=re(v,!0);te(v),De(()=>{var A;return Ne(d,typeof((A=y(c))==null?void 0:A.raw)=="string"?y(c).raw:"—")}),Z(s,v)},f=s=>{const v=we(()=>{var P;return typeof((P=y(c))==null?void 0:P.parallelCalls)=="number"&&Number.isFinite(y(c).parallelCalls)?y(c).parallelCalls:10});var d=Ci(),A=Qe(d),B=re(A,!0);te(A);var F=he(A,2);{var K=P=>{var q=Oi(),z=he(re(q),2);_t(z,23,()=>y(c).rationales,(X,ye)=>X.attempt??ye,(X,ye,be)=>{var oe=Si(),ae=re(oe),H=re(ae),Y=re(H);te(H);var Q=he(H,2);{var de=$e=>{var S=ki();Z($e,S)};Pe(Q,$e=>{y(ye).status==="error"&&$e(de)})}te(ae);var Te=he(ae,2),Le=re(Te,!0);te(Te),te(oe),De(()=>{Ne(Y,`Analysis ${y(ye).attempt??y(be)+1??""}`),Ne(Le,y(ye).text)}),Z(X,oe)}),te(z),te(q),Z(P,q)},D=we(()=>{var P;return Array.isArray((P=y(c))==null?void 0:P.rationales)&&y(c).rationales.length>0});Pe(F,P=>{y(D)&&P(K)})}var E=he(F,2);{var x=P=>{var q=Ti();_t(q,23,()=>y(c).quotes,z=>z.quote,(z,X,ye)=>{var be=Li(),oe=re(be),ae=re(oe),H=re(ae);te(ae);var Y=he(ae,2),Q=re(Y);te(Y),te(oe);var de=he(oe,2),Te=re(de,!0);te(de),te(be),De(()=>{Ne(H,`Quote ${y(ye)+1}`),Ne(Q,`x${y(X).count??""}/${y(v)??""}`),Ne(Te,y(X).quote)}),Rt("click",be,()=>k.focusQuote(y(X).quote)),Z(z,be)}),te(q),Z(P,q)},N=we(()=>{var P;return Array.isArray((P=y(c))==null?void 0:P.quotes)&&y(c).quotes.length>0}),M=P=>{var q=Ai();Z(P,q)};Pe(E,P=>{y(N)?P(x):P(M,-1)})}De(()=>{var P;return Ne(B,((P=y(c))==null?void 0:P.title)??"Analysis")}),Z(s,d)},a=s=>{var v=Mi(),d=Qe(v),A=re(d,!0);te(d);var B=he(d,2);{var F=E=>{var x=Ii();_t(x,21,()=>y(c).issues,Xt,(N,M,P)=>{var q=Ri(),z=re(q),X=re(z);X.textContent=`Issue ${P+1}`;var ye=he(X,2),be=re(ye,!0);te(ye),te(z);var oe=he(z,2),ae=re(oe,!0);te(oe);var H=he(oe,2);{var Y=Q=>{var de=Ni();_t(de,20,()=>y(M).contradictingQuotes,Te=>Te,(Te,Le)=>{var $e=Pi(),S=re($e),$=re(S,!0);te(S),te($e),De(()=>Ne($,Le)),Rt("click",$e,()=>k.focusQuote(Le)),Z(Te,$e)}),te(de),Z(Q,de)};Pe(H,Q=>{y(M).contradictingQuotes&&y(M).contradictingQuotes.length>0&&Q(Y)})}te(q),De(()=>{Ne(be,y(M).type),Ne(ae,y(M).reason)}),Z(N,q)}),te(x),Z(E,x)},K=we(()=>{var E;return Array.isArray((E=y(c))==null?void 0:E.issues)&&y(c).issues.length>0}),D=E=>{var x=Fi();Z(E,x)};Pe(B,E=>{y(K)?E(F):E(D,-1)})}De(()=>{var E;return Ne(A,((E=y(c))==null?void 0:E.title)??"Prompt issues")}),Z(s,v)};Pe(n,s=>{y(w)==="raw"?s(o):y(O).kind==="analyze"?s(f,1):s(a,-1)})}Z(m,g)};Pe(I,m=>{y(O).status==="loading"?m(t):y(O).status==="error"?m(r,1):m(i,-1)})}te(L),Z(_,V)};Pe(u,_=>{l.edit.popover&&_(e)})}Z(C,b),mt()}tn(["click"]);var ji=ve('<div class="min-h-0 flex-1 overflow-hidden p-3"><!></div>');function Di(C,T){vt(T,!1);const l=rn(),k=Bn(l.state),w=l.actions;function p(e){Kn(k,y(k).context=e),w.sendAppEvent({type:"context-updated",context:e})}qn();var b=ji(),u=re(b);{let e=jn(()=>{var _;return`editorState/context/${y(k).agentId}/${((_=y(k).currentStep)==null?void 0:_.name)??"main"}`});$n(u,{class:"h-full min-h-0 border-thin border-rc-gray-650 shadow-inner-white-soft backdrop-blur-3xl focus:outline-none focus:ring-0",get context(){return y(k).context},onContextChanged:p,get editorStateKey(){return y(e)},suppressErrors:!0})}te(b),Z(C,b),mt()}var $i=ve('<div class="min-h-0 flex-1 overflow-hidden p-3"><!></div>');function Vi(C,T){vt(T,!1);const l=rn(),k=Bn(l.state),w=l.actions;function p(e){Kn(k,y(k).mocks=e),w.sendAppEvent({type:"mocks-updated",mocks:e})}qn();var b=$i(),u=re(b);{let e=jn(()=>`editorState/mocks/${y(k).agentId}`);$n(u,{class:"h-full min-h-0 border-thin border-rc-gray-650 shadow-inner-white-soft backdrop-blur-3xl focus:outline-none focus:ring-0",get context(){return y(k).mocks},onContextChanged:p,get editorStateKey(){return y(e)},suppressErrors:!0})}te(b),Z(C,b),mt()}function Ui(C){try{return decodeURIComponent(C)}catch{return C}}function zn(C){var p;const l=(((p=String(C||"").split("?")[0])==null?void 0:p.split("#")[0])??"").split("/").filter(Boolean);if(l[0]!=="edit")return{agentId:null,tab:null};if(l.length===1)return{agentId:null,tab:null};const k=Ui(l[1]??""),w=l[2]??null;return w?w==="roleplay"?{agentId:k,tab:"roleplay"}:w==="tests"?{agentId:k,tab:"tests"}:w==="configure"?{agentId:k,tab:"configure"}:{agentId:k,tab:null}:{agentId:k,tab:"roleplay"}}function Wi(C){return{tab:zn(C.pathname).tab??"roleplay",popover:null,highlights:null,requestSeq:0}}function qi(C,T){const k=zn(T.pathname).tab??"roleplay";return{...C,tab:k,popover:null,highlights:null}}function Hi(C,T){const l=C.requestSeq+1;return{...C,requestSeq:l,popover:{kind:T.kind,status:"loading",requestId:l},highlights:null}}function Gi(C,T){return!C.popover||C.popover.requestId!==T.requestId?C:{...C,popover:{...C.popover,status:"ready",data:T.data,error:void 0}}}function zi(C,T){return!C.popover||C.popover.requestId!==T.requestId?C:{...C,popover:{...C.popover,status:"error",error:String(T.error||"Unknown error"),data:T.data}}}function Qi(C){return{...C,popover:null,highlights:null}}function Yi(C,T){return{...C,highlights:{quotes:T??[],focusQuote:null,focusNonce:0}}}function Ji(C,T){const l=String(T||"");if(!l)return C;const k=C.highlights??{quotes:[],focusQuote:null,focusNonce:0};return{...C,highlights:{...k,focusQuote:l,focusNonce:(k.focusNonce??0)+1}}}function Xi(C,T){const l=String(C??""),k=Zi(T),w=Nn(l);for(const p of k){const b=Cn(l,p);if(b.length>0)return b;const u=Pn(l,p);if(u.length>0)return u;const e=Nn(p);if(w!==l||e!==p){const _=Cn(w,e);if(_.length>0)return _;const O=Pn(w,e);if(O.length>0)return O}}return[]}function Cn(C,T){const l=String(T??"");if(!l)return[];const k=[];let w=0;for(;w<=C.length-l.length;){const p=C.indexOf(l,w);if(p===-1)break;k.push({start:p,end:p+l.length}),w=p+1}return k}function Pn(C,T){const l=String(T??"");if(!l.trim())return[];const k=eo(l).replace(/\s+/g,"\\s+");let w;try{w=new RegExp(`(?=(${k}))`,"gu")}catch{return[]}const p=[];let b;for(;(b=w.exec(C))!==null;){const u=b.index,e=b[1]??"",_=u+e.length;_>u&&p.push({start:u,end:_}),w.lastIndex===u&&(w.lastIndex+=1)}return p}function Zi(C){const T=String(C??""),l=T.trim(),k=new Set;for(const b of[T,l])b&&k.add(b);const w=l.replace(/^[-*•]\s+/,"");w&&w!==l&&k.add(w);const p=l.replace(/^(?:\(?\d+\)?[.)]|[a-zA-Z][.)])\s+/,"");return p&&p!==l&&k.add(p),[...k].filter(b=>b.trim().length>0)}function Nn(C){return String(C??"").replace(/\r/g,`
|
|
35
|
+
`).replace(/[\u00A0\u2007\u202F\u2009\u200A\u200B\uFEFF]/g," ").replace(/[\u201C\u201D\u201E\u00AB\u00BB]/g,'"').replace(/[\u2018\u2019]/g,"'").replace(/[\u2013\u2014]/g,"-")}function eo(C){return C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Rn(C,T){const l=C.createDecorationsCollection(),k=C.createDecorationsCollection();let w=null,p=new Map,b=new Map,u=0;function e(){p=new Map,b=new Map,u=0}function _(t,r,i){return Number.isNaN(t)?r:Math.max(r,Math.min(i,t))}function O(t){const r=_(t,1,10);return`rgba(220, 38, 38, ${_(.22+r*.06,.28,.82)})`}function V(t,r){const i=String(t??"");if(!i)return[];const m=p.get(i);if(m)return m;const c=Xi(r,i);return p.set(i,c),c}function W(t){const r=C.getModel();if(!r)return;const i=r.getValue()??"",m=[],c=[...t||[]].sort((g,n)=>(g.count||0)-(n.count||0));for(const g of c){const n=String(g.quote||"");if(!n)continue;const o=_(Number(g.count||0),1,10),f=O(o),a=V(n,i);for(const s of a){const v=r.getPositionAt(s.start),d=r.getPositionAt(s.end);m.push({range:new T.Range(v.lineNumber,v.column,d.lineNumber,d.column),options:{inlineClassName:`analysis-quote analysis-quote-l${o}`,overviewRuler:{color:f,position:T.editor.OverviewRulerLane.Center}}})}}l.set(m)}function j(t){const r=C.getModel();if(!r)return;const i=r.getValue()??"",m=V(t,i);if(m.length===0)return;const g=((b.get(t)??-1)+1)%m.length;b.set(t,g);const n=m[g],o=r.getPositionAt(n.start),f=r.getPositionAt(n.end),a=new T.Range(o.lineNumber,o.column,f.lineNumber,f.column);k.set([{range:a,options:{inlineClassName:"analysis-quote-focus"}}]),C.setSelection(a),C.revealRangeInCenter(a,T.editor.ScrollType.Smooth),C.focus()}function L(t){if(w=t,!w){l.clear(),k.clear(),e();return}W(w.quotes||[]),w.focusQuote&&w.focusNonce!==u?(u=w.focusNonce,j(w.focusQuote)):w.focusQuote||k.clear()}const I=C.onDidChangeModelContent(()=>{w&&(p=new Map,k.clear(),W(w.quotes||[]))});return{setHighlights:L,dispose:()=>{try{I.dispose(),l.clear(),k.clear()}finally{w=null,e()}}}}var In=ve("<!> <!>",1),to=ve('<span class="truncate"> </span> <!>',1),no=ve('<div class="mt-1 overflow-hidden rounded-lg border border-rc-gray-110 bg-rc-gray-930 shadow-inner-white-soft backdrop-blur-2xl" role="listbox" aria-label="Region"></div>'),ro=ve('<span class="text-sm text-rc-gray-300">Region</span> <div><!> <!></div>',1),io=ve('<div class="p-2 text-rc-gray-400">Connecting…</div>'),oo=ve('<div class="p-2 text-rc-gray-400">No steps</div>'),so=ve('<button><span class="block truncate"> </span></button>'),ao=ve('<div class="rc-scroll min-h-0 flex-1 overflow-auto p-2"><!></div>'),lo=ve('<span class="max-w-64 text-sm text-red-300"> </span>'),co=ve('<div class="absolute inset-0 z-10 min-w-0"><!> <div class="absolute bottom-2 left-3 z-20 flex items-center gap-2"><!> <!> <!></div> <!></div>'),uo=ve('<div class="relative h-full min-w-0"><!> <!></div>'),Fn=ve("<!> <!> <!>",1),fo=ve('<div class="border-b border-rc-gray-700 p-2"><!></div> <div class="min-h-0 flex-1"><!></div> <!> <!> <!>',1),po=ve('<div class="text-sm text-red-300"> </div>'),ho=ve('<div class="flex flex-col gap-2"><label for="ai-edit-request" class="font-semibold text-rc-gray-100">What do you want to change?</label> <!> <!></div>'),vo=ve('<div class="min-w-0 truncate whitespace-nowrap text-base text-rc-gray-300"> </div>'),mo=ve('<p class="text-rc-gray-200">Try changing your request and suggest edits again.</p>'),go=ve('<span class="text-rc-red-500 mr-auto text-sm"> </span>'),yo=ve('<span class="mr-auto text-sm text-rc-gray-300"> </span>'),_o=ve('<div class="flex h-screen"><!> <div class="flex h-full min-w-0 flex-1 flex-col bg-rc-gray-980 pb-3 pr-4 pt-2"><nav class="flex flex-none items-center bg-rc-gray-980"><div class="flex w-1/3 justify-start"></div> <div class="flex w-1/3 justify-center"><!></div> <div class="flex w-1/3 items-center justify-end gap-2 pr-2"><!></div></nav> <div class="flex-1 overflow-hidden"><div class="grid h-full w-full grid-cols-[minmax(140px,2fr)_minmax(0,10fr)_minmax(0,11fr)]"><!> <div class="flex h-full min-w-0 flex-col"><div class="flex h-14 flex-none items-center justify-between gap-3 border-b border-rc-gray-700 p-2"><div class="min-w-0"><div class="truncate font-semibold text-rc-gray-100"> </div></div> <div class="flex items-center gap-3"><label class="inline-flex items-center gap-2 text-rc-gray-300"><input type="checkbox" aria-label="Preview rendered prompt" class="h-4 w-4 appearance-none rounded border border-rc-gray-300 bg-rc-gray-600 !accent-rc-gray-600 outline-none ring-0 checked:border-rc-gray-200 checked:bg-rc-gray-600 hover:border-rc-gray-200 hover:bg-rc-gray-600 focus:outline-none focus:ring-0 active:border-rc-gray-200 active:bg-rc-gray-600 disabled:cursor-not-allowed disabled:opacity-50"/> <span>Preview</span></label> <!> <!></div></div> <div class="min-h-0 flex-1"><!></div></div> <!></div></div></div></div> <!> <!> <!>',1);function Jo(C,T){vt(T,!0);const{onError:l}=$r();let k=Ce(bn([]));const w=h=>{try{return h?decodeURIComponent(h):""}catch{return h||""}},p=h=>encodeURIComponent(h);function b(h){return w(h).trim().replace(/^\/+|\/+$/g,"")}const u=we(()=>b(T.params.agent)),e=bn({agentId:b(T.params.agent),region:null,availableRegions:[],defaultRegion:null,agentType:void 0,playgroundMocks:!1,wsLoaded:!1,chatReady:!1,steps:[],currentStep:null,promptDrafts:{},promptEdits:{},context:null,mocks:null,promptContext:null,agentStates:[],currentState:null,contextPopoverOpen:!1,mocksPopoverOpen:!1,edit:Wi({pathname:tt.url.pathname})});let _=null,O=null,V;const W="region-dropdown";let j=Ce(!1),L=Ce(null);Je(()=>{const h=e.availableRegions,R=e.region;(!h.length||!R||!h.includes(R))&&ne(j,!1)});function I(h,R){if(typeof window>"u")return;const U=new URL(window.location.href);R===null?U.searchParams.delete(h):U.searchParams.set(h,R),Br(U.toString(),{})}function t(h){ht.sendMessage({channel:"app-events",event:h})}function r(h){h!=null&&h.name&&e.promptDrafts[h.name]===void 0&&(e.promptDrafts[h.name]=h.prompt??"")}const i=we(()=>{var h;return((h=e.currentStep)==null?void 0:h.name)??null}),m=(h,R)=>`${h}\0${R}`,c=we(()=>{const h=y(i);return h?e.promptEdits[m(e.agentId,h)]??null:null}),g=we(()=>{const h=y(i);if(!h)return"";const R=e.promptDrafts[h];return typeof R=="string"?R:""}),n=we(()=>{var h;return((h=y(c))==null?void 0:h.suggestedPrompt)??y(g)});function o(h=e.agentId){const R={};for(const U of Object.values(e.promptEdits))U.agentId===h&&(R[U.step]=U.suggestedPrompt);return R}function f(){e.wsLoaded&&t({type:"prompt-overrides-updated",prompts:o()})}function a(h,R){return R?e.promptEdits[m(h,R)]??null:null}let s=null,v=null,d=Promise.resolve();const A=800;function B(){s&&(clearTimeout(s),s=null)}async function F(h,R,U){try{await nt.agents.savePrompt.mutate({agentId:h,step:R,prompt:U})}catch(G){console.error("Failed to save prompt",G);const ie=e.promptDrafts[R];throw e.agentId===h&&ie===U&&(v={stepName:R,prompt:U}),G}}function K(h,R,U){const G=d.catch(()=>{}).then(()=>F(h,R,U));return d=G.catch(()=>{}),G}async function D(){if(!v)return;const h=e.agentId.trim();if(!h)return;const{stepName:R,prompt:U}=v;B(),v=null,await K(h,R,U)}function E(h,R){v={stepName:h,prompt:R},B(),s=setTimeout(()=>{s=null,D()},A)}Je(()=>{e.wsLoaded&&D()});async function x(h){try{const R=await nt.regionConfig.meta.query({agent:h});if(!R){e.availableRegions=[],e.defaultRegion=null,e.region=null,I("region",null);return}if(e.availableRegions=R.availableRegions,e.defaultRegion=R.defaultRegion??null,!Array.isArray(R.availableRegions)||R.availableRegions.length===0){e.region=null,I("region",null);return}const U=(tt.url.searchParams.get("region")||"").trim()||null,G=U&&R.availableRegions.includes(U)&&U||R.defaultRegion&&R.availableRegions.includes(R.defaultRegion)&&R.defaultRegion||R.availableRegions[0]||null;e.region=G,I("region",G)}catch(R){console.error("Failed to load region config meta",R),e.availableRegions=[],e.defaultRegion=null,e.region=null,I("region",null)}}Je(()=>{const h=y(u);h&&h!==O&&(O=h,x(h))});function N(h){var U;D(),ct();const R=e.steps.find(G=>G.name===h)||null;e.currentStep=R,R?(r(R),I("step",R.name),t({type:"step-selected",step:R.name}),I("promptEdit",((U=a(e.agentId,R.name))==null?void 0:U.id)??null)):I("step",null)}function M(h){const R=y(i);R&&(e.promptDrafts[R]=h,E(R,h))}let P=Ce(!1),q=Ce(""),z=Ce(!1),X=Ce(null);function ye(h){return(h||"").replace(/[*_`]/g,"").replace(/(^|\s)#{1,6}\s+/g," ").replace(/\s+/g," ").trim()||"Thinking..."}const be=we(()=>{var h;return ye((h=y(X))==null?void 0:h.summary)});let oe=Ce(null),ae=Ce(null),H=Ce(!1),Y=Ce(!1),Q=0,de=!1;const Te=new Set;Je(()=>{const h=y(P);de&&!h&&y(z)&&(Q+=1,ne(z,!1)),de=h});function Le(h=""){!e.currentStep||y(c)||(ne(q,h,!0),ne(oe,null),ne(Y,!1),ne(P,!0))}function $e(){Q+=1,ne(z,!1),ne(P,!1),ne(Y,!1)}async function S(h,R){for(;R===Q&&y(z);){try{const U=await nt.agents.promptEditProgress.query({id:h});if(R!==Q||!y(z))return;U&&ne(X,{phase:U.phase,activity:U.activity,summary:U.summary},!0)}catch(U){R===Q&&console.warn("Failed to read prompt edit progress",U)}await new Promise(U=>setTimeout(U,400))}}async function $(){const h=y(q).trim(),R=y(i),U=e.agentId.trim();if(!h||!R||!U||y(z))return;const G=++Q,ie=crypto.randomUUID();ne(z,!0),ne(X,null),ne(oe,null),S(ie,G);try{await D();const le=await nt.agents.suggestPromptEdit.mutate({agentId:U,step:R,request:h,progressId:ie});if(G!==Q)return;if(le.status==="unchanged"){ne(Y,!0);return}const ge=le.proposal;e.promptEdits[m(ge.agentId,ge.step)]=ge,I("promptEdit",ge.id),ne(P,!1),ne(pt,!1),f()}catch(le){if(G!==Q)return;console.error("Failed to suggest prompt edits",le),ne(oe,le instanceof Error?le.message:"Failed to suggest edits",!0)}finally{G===Q&&(ne(z,!1),ne(X,null))}}function ee(h){for(const[R,U]of Object.entries(e.promptEdits))U.id===h&&delete e.promptEdits[R];tt.url.searchParams.get("promptEdit")===h&&I("promptEdit",null)}function J(){const h=y(c);!h||y(H)||(_e(),ne(ae,null),ee(h.id),f(),nt.agents.rejectPromptEdit.mutate({id:h.id}).catch(R=>{console.error("Failed to release rejected prompt edit",R)}))}async function pe(){var le;const h=y(c);if(!h||y(H))return;const R=Tt??Kt,U=(R==null?void 0:R.saveViewState())??null,G=((le=R==null?void 0:R.getVisibleRanges()[0])==null?void 0:le.startLineNumber)??null,ie=G&&R?R.getTopForLineNumber(G)-R.getScrollTop():0;_e(),ne(H,!0),ne(ae,null);try{const ge=await nt.agents.acceptPromptEdit.mutate({id:h.id});if(e.promptDrafts[h.step]=ge.prompt,e.steps=e.steps.map(fe=>fe.name===h.step?{...fe,prompt:ge.prompt}:fe),e.currentStep=e.steps.find(fe=>fe.name===y(i))??e.currentStep,await En(),ee(h.id),f(),await En(),U&&bt){const fe=bt;requestAnimationFrame(()=>{if(bt===fe)try{fe.restoreViewState(U),G&&fe.setScrollTop(fe.getTopForLineNumber(G)-ie)}catch(Se){console.warn("Failed to preserve accepted prompt scroll position",Se)}})}}catch(ge){console.error("Failed to accept prompt edit",ge),ne(ae,ge instanceof Error?ge.message:"Failed to save prompt",!0)}finally{ne(H,!1)}}Je(()=>{const h=(tt.url.searchParams.get("promptEdit")||"").trim();!h||Te.has(h)||(Te.add(h),nt.agents.promptEditProposal.query({id:h}).then(R=>{!R||R.agentId!==e.agentId||(e.promptEdits[m(R.agentId,R.step)]=R,f())}).catch(R=>console.error("Failed to restore prompt edit",R)))});const ue=we(()=>{var h;return((h=e.currentStep)==null?void 0:h.schema)??null}),Oe=we(()=>!!y(ue)&&y(ue).trim().length>0);let me=Ce(!1),ke=Ce(""),We=Ce(!1),qe=Ce(null),Ye=Ce(null);const xt=we(()=>y(ke)!==(y(ue)??""));function St(){y(ue)&&(ne(ke,y(ue),!0),ne(qe,null),ne(Ye,null),ne(me,!0))}function Ft(h){ne(ke,h,!0),ne(qe,null),ne(Ye,null)}async function Mt(){var U;const h=(U=e.currentStep)==null?void 0:U.name,R=e.agentId.trim();if(!(!h||!R||!y(xt)||y(We))){ne(We,!0),ne(qe,null),ne(Ye,null);try{await D();const G=await nt.agents.saveSchema.mutate({agentId:R,step:h,schema:y(ke)});e.steps=e.steps.map(ie=>ie.name===h?{...ie,schema:y(ke)}:ie),e.currentStep=e.steps.find(ie=>ie.name===h)??e.currentStep,ne(Ye,G.restartScheduled?"Saved. Reloading the project…":"Saved. Restart Bosun to use this schema in tests.",!0),G.restartScheduled&&setTimeout(()=>window.location.reload(),1200)}catch(G){console.error("Failed to save schema",G),ne(qe,G instanceof Error?G.message:"Failed to save schema",!0)}finally{ne(We,!1)}}}function wt({value:h}){if(h===e.edit.tab)return;D(),ct();const R=tt.url.searchParams.get("step"),U=tt.url.searchParams.get("region"),G=`/edit/${p(e.agentId)}/${h}`,ie=new URLSearchParams;R&&ie.set("step",R),U&&ie.set("region",U),y(c)&&ie.set("promptEdit",y(c).id);const le=ie.size?`${G}?${ie.toString()}`:G;Et(le)}const Ot=we(()=>{const h=tt.url.pathname.split("/")[1];return h==="traces"?"view":h});function at({value:h}){if(h!==y(Ot)){if(D(),ct(),h==="edit")return Et("/edit");if(h==="view"){const R=new URLSearchParams({agent:e.agentId});return e.region&&R.set("region",e.region),Et(`/view?${R.toString()}`)}Et("/"+h)}}function lt(h){var R;return e.contextPopoverOpen=!1,e.mocksPopoverOpen=!1,e.edit=Hi(e.edit,{kind:h}),((R=e.edit.popover)==null?void 0:R.requestId)??0}function se(h,R){e.edit=Gi(e.edit,{requestId:h,data:R})}function ce(h,R,U){e.edit=zi(e.edit,{requestId:h,error:R,data:U})}function _e(){e.edit=Qi(e.edit)}function xe(){_e(),e.mocksPopoverOpen=!1,e.contextPopoverOpen=!0}function Ee(){e.contextPopoverOpen=!1}function Ie(){e.contextPopoverOpen?Ee():xe()}function He(){_e(),e.contextPopoverOpen=!1,e.mocksPopoverOpen=!0}function et(){e.mocksPopoverOpen=!1}function ft(){e.mocksPopoverOpen?et():He()}function ct(){_e(),Ee(),et()}function gt(h){return h==="analyze"?"Analyze":"Find issues"}function Lt(h){e.edit=Yi(e.edit,h)}function Bt(h){e.edit=Ji(e.edit,h)}let Ge=null,ze=null,bt=null,Tt=null,Kt=null,pt=Ce(!1),sn=null;function an(h){try{return It.configure({autoescape:!1,trimBlocks:!0,lstripBlocks:!0}),It.renderString(h,e.promptContext??e.context??{})}catch(R){return console.error("Failed to render prompt preview",R),h}}const Qn=we(()=>{const h=y(c);return h?y(pt)?an(h.originalPrompt):h.originalPrompt:""}),Yn=we(()=>{const h=y(c);return h?y(pt)?an(h.suggestedPrompt):h.suggestedPrompt:""});Je(()=>{var R;const h=((R=e.currentStep)==null?void 0:R.name)??null;h!==sn&&(sn=h,ne(pt,!1))});function Jn(h,R){bt=h,Ge==null||Ge.dispose(),Ge=Rn(h,R),Ge.setHighlights(e.edit.highlights)}function Xn(h,R){Tt=h,ze==null||ze.dispose(),ze=Rn(h,R),ze.setHighlights(e.edit.highlights)}Je(()=>{const h=e.edit.highlights;!!y(c)&&!!e.edit.popover?ze==null||ze.setHighlights(h):Ge==null||Ge.setHighlights(h)}),Je(()=>{y(c)&&e.edit.popover||(ze==null||ze.dispose(),ze=null,Tt=null)});let ln=Ce("");Je(()=>{const h=tt.url.toString();h!==y(ln)&&(ne(ln,h,!0),e.edit=qi(e.edit,{pathname:tt.url.pathname}),e.contextPopoverOpen=!1,e.mocksPopoverOpen=!1)});function Zn(h,R,U){return Math.max(R,Math.min(U,h))}function er(h){const R=new Map;for(const U of h||[])for(const G of U.contradictingQuotes||[]){const ie=String(G||"").trim();ie&&R.set(ie,(R.get(ie)||0)+1)}return[...R.entries()].map(([U,G])=>({quote:U,count:Zn(G,1,10)})).sort((U,G)=>G.count-U.count||U.quote.localeCompare(G.quote))}let At=Ce(!1);async function tr(){var R;if(y(At)||!e.currentStep)return;ne(At,!0);const h=lt("findIssues");try{const U=await nt.tests.findPromptIssues.mutate({agent:e.agentId,step:e.currentStep.name,prompt:y(n)}),G=er(U.issues||[]);if(((R=e.edit.popover)==null?void 0:R.requestId)!==h)return;Lt(G);let ie=null;try{ie=JSON.stringify(U.raw,null,2)}catch{ie=null}se(h,{title:`Prompt issues — ${e.currentStep.name}`,issues:U.issues,raw:ie})}catch(U){console.error(U);const G=typeof(U==null?void 0:U.message)=="string"?U.message:(()=>{try{return JSON.stringify(U)}catch{return String(U)}})();ce(h,G||"Failed to find issues in this prompt",{title:`Prompt issues failed — ${e.currentStep.name}`,raw:G})}finally{ne(At,!1)}}function nr(h){D(),ct();const R=tt.url.searchParams.get("step"),U=tt.url.searchParams.get("region"),G=`/edit/${p(h)}/${e.edit.tab}`,ie=new URLSearchParams;R&&ie.set("step",R),U&&ie.set("region",U);const le=a(h,R);le&&ie.set("promptEdit",le.id);const ge=ie.size?`${G}?${ie.toString()}`:G;Et(ge)}function rr(h){!h||h===e.region||(D(),e.region=h,I("region",h))}Tr({state:e,actions:{openPopover:lt,setPopoverReady:se,setPopoverError:ce,closePopover:_e,setHighlightQuotes:Lt,focusQuote:Bt,openContextPopover:xe,closeContextPopover:Ee,toggleContextPopover:Ie,openMocksPopover:He,closeMocksPopover:et,toggleMocksPopover:ft,openAiEdit:h=>Le(h),sendAppEvent:t,sendChatMessage:h=>{if(!e.wsLoaded||!e.chatReady){console.warn("[roleplay] Ignoring chat message while websocket session is reconnecting");return}f(),ht.sendMessage({channel:"chat",message:h})},flushPromptSave:D,getPromptOverrides:()=>o(),getActivePromptEditId:()=>{var h;return((h=y(c))==null?void 0:h.id)??null},selectState:h=>{D(),ct(),V=h,e.currentState=h,kn(),Sn(),t({type:"select-agent",agent:e.agentId,state:h,region:e.region,promptOverrides:o()})},hangup(){t({type:"hangup",agentId:e.agentId,region:e.region})}}}),nn(async()=>{try{ne(k,await nt.agents.catalog.query(),!0)}catch(h){console.error("Failed to load agents",h)}ht.onClose(()=>{e.wsLoaded=!1,e.chatReady=!1,e.context=null,e.mocks=null,e.promptContext=null,e.agentStates=[],e.currentState=null,e.contextPopoverOpen=!1,e.mocksPopoverOpen=!1,_=null}),ht.onError(h=>l(h)),ht.onMessage(h=>{if(h.channel==="app-events"){if(h.event.type==="agents-loaded"){e.wsLoaded=!0;return}if(h.event.type==="context-updated"){e.context=h.event.context,h.event.promptContext&&(e.promptContext=h.event.promptContext);return}if(h.event.type==="mocks-updated"){e.mocks=h.event.mocks;return}if(h.event.type==="update-states"){const R=e.agentStates.length;e.agentStates=h.event.states;const U=e.agentStates.length>0?e.agentStates[e.agentStates.length-1].id:null;V!==void 0?e.currentState=V:(e.currentState===null&&R===0&&U||e.agentStates.length>R)&&(e.currentState=U),V=void 0;return}if(h.event.type==="agent-selected"){e.steps=h.event.agent.steps,e.agentType=h.event.agent.type,e.playgroundMocks=h.event.agent.playgroundMocks;const R={};for(const ge of e.steps){const fe=e.promptDrafts[ge.name];R[ge.name]=typeof fe=="string"?fe:ge.prompt??""}e.promptDrafts=R;const U=(tt.url.searchParams.get("step")||"").trim()||null,G=U?e.steps.find(ge=>ge.name===U)??null:null,ie=e.steps.find(ge=>ge.name.toLowerCase()==="main")??e.steps.find(ge=>Kr(ge.name))??e.steps[0]??null,le=G??ie;e.currentStep=le,le?(r(le),le.name!==U&&I("step",le.name),t({type:"step-selected",step:le.name}),D()):I("step",null);return}return}if(h.channel==="log"){Vr(h.message);return}if(h.channel==="step-trace"){Ar(h.trace);return}if(h.channel==="api-call-trace"){Cr(h.trace);return}if(h.channel==="conversational-trace"){Pr(h.trace);return}if(h.channel==="playground-mock-trace"){Nr(h.trace);return}if(h.channel==="error"){l(h.message);return}}),ht.init(),e.wsLoaded=ht.isReady()}),Mn(()=>{D(),B(),Ge==null||Ge.dispose(),Ge=null,bt=null,ze==null||ze.dispose(),ze=null,Tt=null,Kt=null}),Je(()=>{const h=y(u);if(h!==e.agentId&&(D(),v=null,B(),e.chatReady=!1,e.promptDrafts={},e.steps=[],e.currentStep=null),e.agentId=h,!e.wsLoaded){e.chatReady=!1;return}if(!e.agentId){e.chatReady=!1;return}if(e.availableRegions.length>0&&!e.region){e.chatReady=!1;return}const R=`${e.agentId}::${e.region??""}`;_!==R&&(_=R,kn(),Sn(),ct(),e.currentState=null,e.agentStates=[],e.context=null,e.mocks=null,e.promptContext=null,D(),V=void 0,e.chatReady=!1,t({type:"select-agent",agent:e.agentId,region:e.region,promptOverrides:o()}),e.chatReady=!0)});var cn=_o(),jt=Qe(cn),un=re(jt);Dr(un,{className:"flex-none",get agents(){return y(k)},get currentAgent(){return e.agentId},onAgentClick:nr});var fn=he(un,2),Dt=re(fn),$t=he(re(Dt),2),ir=re($t);Zt(ir,{get value(){return y(Ot)},ariaLabel:"Top tabs",onChange:at,children:(h,R)=>{var U=In(),G=Qe(U);dt(G,{value:"edit",children:(le,ge)=>{je();var fe=Ue("Edit");Z(le,fe)},$$slots:{default:!0}});var ie=he(G,2);dt(ie,{value:"view",children:(le,ge)=>{je();var fe=Ue("View");Z(le,fe)},$$slots:{default:!0}}),Z(h,U)},$$slots:{default:!0}}),te($t);var pn=he($t,2),or=re(pn);{var sr=h=>{var R=ro(),U=he(Qe(R),2),G=re(U);Ze(G,{variant:"secondary",size:"small",get"aria-expanded"(){return y(j)},"aria-haspopup":"listbox","aria-controls":W,onclick:le=>{le.stopPropagation(),ne(j,!y(j))},class:"flex w-32 items-center justify-between gap-1 !px-3 !py-1",get el(){return y(L)},set el(le){ne(L,le,!0)},children:(le,ge)=>{var fe=to(),Se=Qe(fe),Re=re(Se,!0);te(Se);var Ae=he(Se,2);{let Fe=we(()=>"size-5 text-rc-gray-400 transition-transform duration-200 "+(y(j)?"rotate-180":""));Ir(Ae,{name:"chevron-down",get class(){return y(Fe)}})}De(()=>Ne(Re,e.region)),Z(le,fe)},$$slots:{default:!0}});var ie=he(G,2);Rr(ie,{id:W,get open(){return y(j)},onClose:()=>ne(j,!1),get anchorEl(){return y(L)},placement:"bottom-end",offset:[0,1],children:ge=>{var fe=no();_t(fe,21,()=>e.availableRegions,Xt,(Se,Re)=>{{let Ae=we(()=>y(Re)===e.region),Fe=we(()=>`w-full rounded-none py-2 pr-3 text-left backdrop-blur-2xl hover:bg-rc-gray-700 focus:bg-rc-gray-400 ${y(Re)===e.region?"bg-rc-gray-800 text-rc-gray-100":"text-rc-gray-200"}`);Ze(Se,{variant:"ghost",size:"small",role:"option",get"aria-selected"(){return y(Ae)},onclick:Me=>{Me.stopPropagation(),ne(j,!1),rr(y(Re))},get class(){return y(Fe)},children:(Me,Be)=>{je();var rt=Ue();De(()=>Ne(rt,y(Re))),Z(Me,rt)},$$slots:{default:!0}})}}),te(fe),Z(ge,fe)},$$slots:{default:!0}}),te(U),Z(h,R)};Pe(or,h=>{e.availableRegions.length>0&&e.region&&h(sr)})}te(pn),te(Dt);var hn=he(Dt,2),dn=re(hn),vn=re(dn);kt(vn,{class:"flex h-full min-w-0 flex-col !rounded-none p-0",children:(h,R)=>{var U=ao(),G=re(U);{var ie=fe=>{var Se=io();Z(fe,Se)},le=fe=>{var Se=oo();Z(fe,Se)},ge=fe=>{var Se=Nt(),Re=Qe(Se);_t(Re,17,()=>e.steps,Xt,(Ae,Fe)=>{var Me=so(),Be=re(Me),rt=re(Be,!0);te(Be),te(Me),De(()=>{var Xe;Sr(Me,1,`my-1 w-full rounded-lg px-3 py-2 text-left text-rc-gray-200 hover:bg-rc-gray-700 ${y(Fe).name===((Xe=e.currentStep)==null?void 0:Xe.name)?"bg-rc-gray-600":"bg-transparent"}`),Ne(rt,y(Fe).name)}),Rt("click",Me,()=>N(y(Fe).name)),Z(Ae,Me)}),Z(fe,Se)};Pe(G,fe=>{e.wsLoaded?e.steps.length===0?fe(le,1):fe(ge,-1):fe(ie)})}te(U),Z(h,U)}});var Vt=he(vn,2),Ut=re(Vt),Wt=re(Ut),mn=re(Wt),ar=re(mn,!0);te(mn),te(Wt);var gn=he(Wt,2),qt=re(gn),Ht=re(qt);Dn(Ht),je(2),te(qt);var yn=he(qt,2);{let h=we(()=>!e.currentStep||y(At));Ze(yn,{variant:"secondary",get disabled(){return y(h)},onclick:tr,children:(R,U)=>{je();var G=Ue("Find issues");Z(R,G)},$$slots:{default:!0}})}var lr=he(yn,2);{let h=we(()=>!e.currentStep||!!y(c)||y(z));Ze(lr,{variant:"secondary",get disabled(){return y(h)},onclick:()=>Le(),children:(R,U)=>{je();var G=Ue("Edit with AI");Z(R,G)},$$slots:{default:!0}})}te(gn),te(Ut);var _n=he(Ut,2),cr=re(_n);{var ur=h=>{var R=uo(),U=re(R);_r(U,()=>e.currentStep.name,le=>{{let ge=we(()=>y(Oe)&&!y(c)),fe=we(()=>!!y(c)),Se=we(()=>y(c)?"Accept or reject the AI suggestion before editing.":""),Re=we(()=>y(c)?!1:y(pt));Tn(le,{class:"h-full min-w-0 border-thin border-rc-gray-650 bg-rc-gray-800 shadow-inner-white-soft backdrop-blur-3xl focus:outline-none focus:ring-0",get initialPrompt(){return y(g)},get agentId(){return e.agentId},get stepName(){return e.currentStep.name},onPromptChanged:M,get showSchemaButton(){return y(ge)},onSchemaClick:St,get readOnly(){return y(fe)},get readOnlyMessage(){return y(Se)},showPreviewToggle:!1,get preview(){return y(Re)},onEditorReady:Jn})}});var G=he(U,2);{var ie=le=>{var ge=co(),fe=re(ge);{var Se=Ve=>{Tn(Ve,{class:"h-full min-w-0 border-thin border-rc-gray-650 bg-rc-gray-800 shadow-inner-white-soft backdrop-blur-3xl focus:outline-none focus:ring-0",get initialPrompt(){return y(c).suggestedPrompt},get agentId(){return e.agentId},get stepName(){return e.currentStep.name},onPromptChanged:()=>{},showSchemaButton:!1,readOnly:!0,readOnlyMessage:"Accept or reject the AI suggestion before editing.",bottomPadding:56,showPreviewToggle:!1,onEditorReady:Xn})},Re=Ve=>{xr(Ve,{class:"h-full min-w-0 !rounded-none",get original(){return y(Qn)},get modified(){return y(Yn)},inline:!0,bottomPadding:56,readOnlyMessage:"Accept or reject the AI suggestion before editing.",onModifiedEditorReady:it=>Kt=it})};Pe(fe,Ve=>{e.edit.popover?Ve(Se):Ve(Re,-1)})}var Ae=he(fe,2),Fe=re(Ae);Ze(Fe,{variant:"secondary",get disabled(){return y(H)},onclick:J,children:(Ve,it)=>{je();var ut=Ue("✕ Reject");Z(Ve,ut)},$$slots:{default:!0}});var Me=he(Fe,2);Ze(Me,{get disabled(){return y(H)},onclick:pe,children:(Ve,it)=>{je();var ut=Ue("✓ Accept");Z(Ve,ut)},$$slots:{default:!0}});var Be=he(Me,2);{var rt=Ve=>{var it=lo(),ut=re(it,!0);te(it),De(()=>Ne(ut,y(ae))),Z(Ve,it)};Pe(Be,Ve=>{y(ae)&&Ve(rt)})}te(Ae);var Xe=he(Ae,2);{var yt=Ve=>{Ze(Ve,{variant:"secondary",onclick:St,class:"absolute bottom-2 right-6 z-20 !font-medium",children:(it,ut)=>{je();var ot=Ue("Schema");Z(it,ot)},$$slots:{default:!0}})};Pe(Xe,Ve=>{y(Oe)&&Ve(yt)})}te(ge),Z(le,ge)};Pe(G,le=>{y(c)&&le(ie)})}te(R),Z(h,R)},fr=h=>{kt(h,{class:"flex h-full min-w-0 items-center justify-center !rounded-none p-4 text-sm text-rc-gray-400",children:(R,U)=>{je();var G=Ue("Select a step to edit its prompt");Z(R,G)}})};Pe(cr,h=>{e.currentStep?h(ur):h(fr,-1)})}te(_n),te(Vt);var pr=he(Vt,2);kt(pr,{class:"relative flex h-full min-w-0 flex-col overflow-hidden !rounded-none p-0",children:(h,R)=>{var U=fo(),G=Qe(U),ie=re(G);Zt(ie,{get value(){return e.edit.tab},ariaLabel:"Mode tabs",onChange:wt,children:(Be,rt)=>{var Xe=Fn(),yt=Qe(Xe);dt(yt,{value:"roleplay",children:(ot,Gt)=>{je();var Ct=Ue("Roleplay");Z(ot,Ct)},$$slots:{default:!0}});var Ve=he(yt,2);dt(Ve,{value:"tests",children:(ot,Gt)=>{je();var Ct=Ue("Tests");Z(ot,Ct)},$$slots:{default:!0}});var it=he(Ve,2);{var ut=ot=>{dt(ot,{value:"configure",children:(Gt,Ct)=>{je();var vr=Ue("Configure");Z(Gt,vr)},$$slots:{default:!0}})};Pe(it,ot=>{e.defaultRegion!==null&&ot(ut)})}Z(Be,Xe)},$$slots:{default:!0}}),te(G);var le=he(G,2),ge=re(le);wr(ge,()=>T.children),te(le);var fe=he(le,2);{var Se=Be=>{{const rt=yt=>{Ki(yt,{})};let Xe=we(()=>gt(e.edit.popover.kind));Yt(Be,{get title(){return y(Xe)},onClose:_e,children:rt})}};Pe(fe,Be=>{e.edit.popover&&Be(Se)})}var Re=he(fe,2);{var Ae=Be=>{Yt(Be,{title:"Edit context",onClose:Ee,children:Xe=>{Di(Xe,{})}})};Pe(Re,Be=>{e.contextPopoverOpen&&Be(Ae)})}var Fe=he(Re,2);{var Me=Be=>{Yt(Be,{title:"Edit mocks",onClose:et,children:Xe=>{Vi(Xe,{})}})};Pe(Fe,Be=>{e.mocksPopoverOpen&&Be(Me)})}Z(h,U)}}),te(dn),te(hn),te(fn),te(jt);var xn=he(jt,2);zt(xn,{title:"Edit with AI",class:"!max-w-xl",get underlayOpen(){return y(z)},get open(){return y(P)},set open(G){ne(P,G,!0)},children:G=>{var ie=ho(),le=he(re(ie),2);Gr(le,{id:"ai-edit-request",rows:6,get disabled(){return y(z)},placeholder:"I want the agent to ask the user's name during the greeting",class:"rc-scroll disabled:cursor-wait disabled:opacity-70",get value(){return y(q)},set value(Se){ne(q,Se,!0)}});var ge=he(le,2);{var fe=Se=>{var Re=po(),Ae=re(Re,!0);te(Re),De(()=>Ne(Ae,y(oe))),Z(Se,Re)};Pe(ge,Se=>{y(oe)&&Se(fe)})}te(ie),Z(G,ie)},footer:G=>{var ie=In(),le=Qe(ie);Ze(le,{variant:"outlined",size:"small",onclick:$e,children:(fe,Se)=>{je();var Re=Ue("Cancel");Z(fe,Re)},$$slots:{default:!0}});var ge=he(le,2);{let fe=we(()=>!y(q).trim()||y(z));Ze(ge,{size:"small",get disabled(){return y(fe)},onclick:$,children:(Se,Re)=>{je();var Ae=Ue();De(()=>Ne(Ae,y(z)?"Suggesting edits…":"Suggest edits")),Z(Se,Ae)},$$slots:{default:!0}})}Z(G,ie)},underlay:G=>{var ie=vo(),le=re(ie,!0);te(ie),De(()=>{kr(ie,"title",y(be)),Ne(le,y(be))}),Z(G,ie)},$$slots:{default:!0,footer:!0,underlay:!0}});var wn=he(xn,2);zt(wn,{title:"No changes were suggested",class:"!z-[60] !max-w-md",overlayClass:"!z-[60]",get open(){return y(Y)},set open(U){ne(Y,U,!0)},children:U=>{var G=mo();Z(U,G)},footer:U=>{Ze(U,{size:"small",onclick:()=>ne(Y,!1),children:(G,ie)=>{je();var le=Ue("Close");Z(G,le)},$$slots:{default:!0}})},$$slots:{default:!0,footer:!0}});var hr=he(wn,2);{var dr=h=>{zt(h,{title:"Schema",class:"!w-[80vw] !max-w-5xl",get open(){return y(me)},set open(G){ne(me,G,!0)},children:G=>{Jr(G,{class:"h-[70vh] min-w-0",get schema(){return y(ke)},onChange:Ft})},footer:G=>{var ie=Fn(),le=Qe(ie);{var ge=Ae=>{var Fe=go(),Me=re(Fe,!0);te(Fe),De(()=>Ne(Me,y(qe))),Z(Ae,Fe)},fe=Ae=>{var Fe=yo(),Me=re(Fe,!0);te(Fe),De(()=>Ne(Me,y(Ye))),Z(Ae,Fe)};Pe(le,Ae=>{y(qe)?Ae(ge):y(Ye)&&Ae(fe,1)})}var Se=he(le,2);Ze(Se,{variant:"outlined",size:"small",onclick:()=>ne(me,!1),children:(Ae,Fe)=>{je();var Me=Ue();De(()=>Ne(Me,y(xt)?"Cancel":"Close")),Z(Ae,Me)},$$slots:{default:!0}});var Re=he(Se,2);{let Ae=we(()=>!y(xt)||y(We));Ze(Re,{size:"small",get disabled(){return y(Ae)},onclick:Mt,children:(Fe,Me)=>{je();var Be=Ue();De(()=>Ne(Be,y(We)?"Saving…":"Save")),Z(Fe,Be)},$$slots:{default:!0}})}Z(G,ie)},$$slots:{default:!0,footer:!0}})};Pe(hr,h=>{y(ue)&&h(dr)})}De(()=>{var h;Ne(ar,((h=e.currentStep)==null?void 0:h.name)??"Prompt"),Ht.disabled=!e.currentStep||!!y(c)&&!!e.edit.popover}),Lr(Ht,()=>y(pt),h=>ne(pt,h)),Z(C,cn),mt()}tn(["click"]);export{Jo as component};
|
package/build/bosun-app/frontend/client/_app/immutable/nodes/{3.DL97ronX.js → 3.DC1YtH2n.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as zt,b as F,a as v,t as k,f as b,c as Rt}from"../chunks/CCYriF4C.js";import{o as Bt}from"../chunks/DnMQeiTY.js";import{p as Ot,w as d,x as me,d as qt,t as P,j as t,a as Gt,e as Qt,f as _e,s as l,c as n,y as s,n as C,$ as Vt,o as T,r as o}from"../chunks/CR-uVjxM.js";import{s as g}from"../chunks/B0nqNj93.js";import{i as Q}from"../chunks/BQIf5msi.js";import{e as Ve,i as We}from"../chunks/DuQdgMax.js";import{s as Wt}from"../chunks/9mOMnnWN.js";import{h as Ht}from"../chunks/DjujL8K1.js";import{b as He,c as Je}from"../chunks/CR5IRTqC.js";import{s as Jt}from"../chunks/C9yBjdYI.js";import{p as Kt}from"../chunks/BcbX6huO.js";import{g as y}from"../chunks/C_CclDpz.js";import{p as f}from"../chunks/B6dAvKma.js";import{B as V}from"../chunks/joiJcRPz.js";import{I as Xt}from"../chunks/BBk8_Xpk.js";import{I as Yt}from"../chunks/DJnDF3d9.js";import{m as Zt}from"../chunks/ddC1NP9R.js";import{p as Ke,T as er,g as tr}from"../chunks/DjDpMqch.js";import{T as rr,a as Xe}from"../chunks/BEdAvgYp.js";import{A as ar}from"../chunks/C0rPkxmP.js";import{g as sr}from"../chunks/Dba0_Upf.js";import{t as or}from"../chunks/CgLfT-y5.js";var nr=b("<!> <!>",1),Ye=b("<option> </option>"),ir=b('<button type="button" aria-label="Clear search" class="absolute right-2 top-1/2 flex -translate-y-1/2 items-center justify-center rounded p-1 text-rc-gray-200 hover:bg-rc-gray-600 hover:text-rc-gray-100 focus:outline-none"><!></button>'),lr=b('<p class="py-8 text-center text-rc-gray-200">Loading...</p>'),cr=b('<p class="py-8 text-center text-rc-gray-300">No conversations found</p>'),dr=b('<span class="text-rc-gray-200">, Agent Id:</span> <span class="text-rc-green-200"> </span>',1),vr=b('<li><div class="flex w-full flex-col gap-2"><div class="flex w-full items-center justify-between"><div class="text-gray-300"> </div> <div class="flex items-center gap-2"><span class="text-xs text-rc-gray-300"> </span> <span class="font-semibold text-rc-gray-100"> </span></div></div> <div class="flex items-center justify-between gap-4"><div class="text-sm"><span class="text-rc-gray-200">Conversation Id:</span> <span class="text-rc-green-200"> </span> <!></div> <p class="text-sm text-gray-400"> </p></div></div></li>'),ur=b('<ul class="space-y-2"></ul>'),pr=b('<div class="flex h-screen"><!> <div class="flex h-full min-w-0 flex-1 flex-col bg-rc-gray-980 pb-3 pr-4 pt-2"><nav class="flex flex-none flex-col bg-rc-gray-980"><div class="flex items-center justify-center"><!></div> <div class="flex flex-wrap items-center gap-4"><div class="flex-1"><label class="block"><div class="flex gap-2"><select class="select svelte-1uk1thp" aria-label="Telescope source"><!></select> <div class="relative"><!><!></div> <!></div></label></div> <div class="hidden items-center gap-2"><div class="text-rc-gray-200">Sort:</div> <!></div> <div class="hidden items-center gap-2"><div class="text-rc-gray-200">Page size:</div> <select class="rounded-sm border border-rc-gray-300 bg-rc-gray-700 p-2 pr-8 text-rc-gray-100"><option>5</option><option>10</option><option>20</option><option>50</option></select></div> <div class="flex items-center gap-3"><div class="flex items-center gap-2"><!> <!> <div class="text-sm text-rc-gray-200"> </div></div></div> <div class="ml-auto whitespace-nowrap text-sm"><span class="text-gray-400">API Mode:</span> <span class="font-semibold text-rc-green-200"> </span></div></div></nav> <main class="flex flex-1 overflow-hidden"><div class="flex h-full w-1/3 flex-col"><div class="flex-none border-b border-rc-gray-300/40 p-4"><h2 class="text-lg font-semibold text-rc-gray-100">Conversations</h2></div> <div class="rc-scroll min-h-0 flex-1 overflow-scroll px-3 py-4"><!></div></div> <div class="flex h-full w-2/3 flex-col bg-rc-gray-980"><!></div></main></div></div>');function Fr(Ze,W){Ot(W,!0);const j=new er(fetch);let he=d(me([])),_=d(void 0),h=d(null);const p=C(()=>(f.url.searchParams.get("agent")??"").trim()),H=C(()=>(f.url.searchParams.get("region")??"").trim());let L=d(""),J=d(20),M=d("20"),z=d(!0),x=d(me([])),$=d(null),R=d(!1),K=d(null),xe=d(0),w=d(me([])),N=d(""),B=d(!1),X=d(null),ye=d(!1),Y=d(null),be=Kt(W,"useMock",3,!1);const{onError:we}=sr();function et(e){return new Date(e).toLocaleString()}function tt(e){const r=Math.floor(e/60),a=e%60;return`${r}:${String(a).padStart(2,"0")}`}function $e(e=t(p),r=e===t(p)?t(H):""){const a=new URLSearchParams;e&&a.set("agent",e),e&&r&&a.set("region",r);const i=a.toString();return i?`?${i}`:""}function D(e=t(p)){return`${t(Ae)}/conversations${$e(e)}`}const rt=C(()=>f.url.pathname.split("/").at(-1)==="latency"?"latency":"traces");function at(e,r=t(rt),a=t(p)){return`${t(Ae)}/conversations/${encodeURIComponent(e)}/${r}${$e(a)}`}async function st(e,r=t(J),a,i){return be()?Zt.fetchConversations(r,e,a??void 0):j.getConversations({phoneNumber:e,agentId:i,limit:Number(r),lastConversationId:a??void 0})}async function E(){s(x,[],!0),s($,null),await Z()}async function ot(){s(B,!0),s(X,null);try{const e=await fetch("/traces/api/sources");if(!e.ok)throw new Error(`Failed to load sources (${e.status})`);const r=await e.json(),a=Array.isArray(r)?r:[];if(s(w,a.filter(c=>c&&typeof c.id=="string"&&typeof c.label=="string"),!0),!t(w).length)throw new Error("No sources returned");const i=tr(),u=i&&t(w).some(c=>c.id===i)?i:t(w)[0].id;s(N,u,!0),Ke(u),j.setSourceId(u)}catch(e){console.error("Failed to load Telescope sources:",e),s(X,(e==null?void 0:e.message)??"Failed to load Telescope sources",!0),s(w,[],!0),s(N,""),j.setSourceId(void 0)}finally{s(B,!1)}}async function nt(e){const r=e.target.value;s(N,r,!0),Ke(r),j.setSourceId(r),s(h,null),await y(D()),await E()}async function it(){try{s(he,await or.agents.catalog.query(),!0)}catch(e){const r=e instanceof Error?e.message:e?String(e):"Unknown error";console.error("Failed to load agents:",e),we(`Failed to load agents: ${r}`)}}async function Z(){s(R,!0),s(K,null);try{const e=await st(t(L)||void 0,t(J),t($)??void 0,t(p)||void 0);let r=Array.isArray(e.items)?e.items.slice():[];r=r.filter(a=>!!(a!=null&&a.phoneNumber)),s(_,{limit:e.limit,items:r,lastConversationId:e.lastConversationId},!0),s(xe,r.length,!0),s($,e.lastConversationId??null,!0),s(R,!1)}catch(e){s(R,!1),s(K,e.message||"Unknown error",!0),we(`Error loading conversations: ${t(K)}`),console.error("Load page error:",e)}}async function lt(){var e;(e=t(_))!=null&&e.lastConversationId&&(t(x).push(t(_).lastConversationId),s($,t(_).lastConversationId,!0),await Z())}async function ct(){t(x).length&&(t(x).pop(),s($,t(x).length?t(x)[t(x).length-1]:null,!0),await Z())}function dt(){var e;s(z,!t(z)),(e=t(_))!=null&&e.items&&t(_).items.sort((r,a)=>t(z)?a.createdAt-r.createdAt:r.createdAt-a.createdAt)}async function vt(e,r){var i;if(r==null||r.stopPropagation(),f.params.conversationId&&f.params.conversationId===e.conversationId||!f.params.conversationId&&((i=t(h))==null?void 0:i.conversationId)===e.conversationId){s(h,null),await y(D());return}s(h,e,!0),await y(at(e.conversationId))}function ut(e){const r=e.target.value;s(M,r,!0),s(J,parseInt(t(M),10)||20,!0)}async function Ie(){await E()}async function pt(e){e==null||e.preventDefault(),e==null||e.stopPropagation(),s(L,""),s(x,[],!0),s($,null),await E()}const Se=C(()=>{const e=f.url.pathname.split("/")[1];return e==="traces"?"view":e}),Ae=C(()=>f.url.pathname.startsWith("/view")?"/view":"/traces");function ft({value:e}){if(e!==t(Se)){if(e==="edit"){if(!t(p))return y("/edit");const r=new URLSearchParams;t(H)&&r.set("region",t(H));const a=r.toString();return y(`/edit/${encodeURIComponent(t(p))}/roleplay${a?`?${a}`:""}`)}if(e==="view")return y(D());y("/"+e)}}async function gt(e,r){r==null||r.stopPropagation(),e!==t(p)&&(s(h,null),await y(D(e)))}async function mt(e){e==null||e.stopPropagation(),t(p)&&(s(h,null),await y(D("")))}qt(()=>{const e=t(p);t(ye)&&e!==t(Y)&&(s(Y,e,!0),s(h,null),E())}),Bt(()=>{(async()=>(await Promise.all([it(),ot()]),await E(),s(Y,t(p),!0),s(ye,!0)))()});var ee=pr();Ht("1uk1thp",e=>{Qt(()=>{Vt.title="Bosun: Telescope"})});var Ce=n(ee);ar(Ce,{get agents(){return t(he)},get currentAgent(){return t(p)},onAgentClick:gt,showAllAgentsOption:!0,onAllAgentsClick:mt,className:"flex-none"});var ke=l(Ce,2),te=n(ke),re=n(te),_t=n(re);rr(_t,{get value(){return t(Se)},ariaLabel:"Top tabs",onChange:ft,children:(e,r)=>{var a=nr(),i=_e(a);Xe(i,{value:"edit",children:(c,S)=>{T();var m=k("Edit");v(c,m)},$$slots:{default:!0}});var u=l(i,2);Xe(u,{value:"view",children:(c,S)=>{T();var m=k("View");v(c,m)},$$slots:{default:!0}}),v(e,a)},$$slots:{default:!0}}),o(re);var Pe=l(re,2),ae=n(Pe),Te=n(ae),Le=n(Te),I=n(Le),ht=n(I);{var xt=e=>{var r=Rt(),a=_e(r);Ve(a,17,()=>t(w),We,(i,u)=>{var c=Ye(),S=n(c,!0);o(c);var m={};P(()=>{g(S,t(u).label),m!==(m=t(u).id)&&(c.value=(c.__value=t(u).id)??"")}),v(i,c)}),v(e,r)},yt=e=>{var r=Ye(),a=n(r,!0);o(r),r.value=r.__value="",P(()=>g(a,t(B)?"Loading…":"No sources")),v(e,r)};Q(ht,e=>{t(w).length?e(xt):e(yt,-1)})}o(I);var se=l(I,2),Ne=n(se);Yt(Ne,{class:"w-56 rounded-r-none !border !border-rc-gray-500 !p-2 !pr-8 hover:border-rc-gray-400",placeholder:"Search by phone...",onkeydown:e=>{e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),Ie())},get value(){return t(L)},set value(e){s(L,e,!0)}});var bt=l(Ne);{var wt=e=>{var r=ir(),a=n(r);Xt(a,{name:"close",width:18,height:18}),o(r),F("click",r,pt),v(e,r)};Q(bt,e=>{t(L)&&e(wt)})}o(se);var $t=l(se,2);V($t,{onclick:Ie,children:(e,r)=>{T();var a=k("Search");v(e,a)},$$slots:{default:!0}}),o(Le),o(Te),o(ae);var oe=l(ae,2),It=l(n(oe),2);V(It,{onclick:dt,children:(e,r)=>{T();var a=k();P(()=>g(a,t(z)?"Newest first":"Oldest first")),v(e,a)},$$slots:{default:!0}}),o(oe);var ne=l(oe,2),O=l(n(ne),2),ie=n(O);ie.value=ie.__value="5";var le=l(ie);le.value=le.__value="10";var ce=l(le);ce.value=ce.__value="20";var De=l(ce);De.value=De.__value="50",o(O),o(ne);var de=l(ne,2),Ee=n(de),Ue=n(Ee);{let e=C(()=>t(x).length===0&&!t($));V(Ue,{onclick:ct,get disabled(){return t(e)},children:(r,a)=>{T();var i=k("Prev");v(r,i)},$$slots:{default:!0}})}var Fe=l(Ue,2);{let e=C(()=>{var r;return!((r=t(_))!=null&&r.items.length)});V(Fe,{onclick:lt,get disabled(){return t(e)},children:(r,a)=>{T();var i=k("Next");v(r,i)},$$slots:{default:!0}})}var je=l(Fe,2),St=n(je);o(je),o(Ee),o(de);var Me=l(de,2),ze=l(n(Me),2),At=n(ze,!0);o(ze),o(Me),o(Pe),o(te);var Re=l(te,2),ve=n(Re),Be=l(n(ve),2),Ct=n(Be);{var kt=e=>{var r=lr();v(e,r)},Pt=e=>{var r=cr();v(e,r)},Tt=e=>{var r=ur();Ve(r,21,()=>t(_).items,We,(a,i)=>{var u=vr(),c=n(u),S=n(c),m=n(S),Nt=n(m,!0);o(m);var Oe=l(m,2),pe=n(Oe),Dt=n(pe,!0);o(pe);var qe=l(pe,2),Et=n(qe,!0);o(qe),o(Oe),o(S);var Ge=l(S,2),fe=n(Ge),ge=l(n(fe),2),Ut=n(ge,!0);o(ge);var Ft=l(ge,2);{var jt=A=>{var q=dr(),U=l(_e(q),2),G=n(U,!0);o(U),P(()=>g(G,t(i).agentId)),v(A,q)};Q(Ft,A=>{!t(p)&&t(i).agentId&&A(jt)})}o(fe);var Qe=l(fe,2),Mt=n(Qe);o(Qe),o(Ge),o(c),o(u),P((A,q)=>{var U,G;Jt(u,1,`cursor-pointer rounded-lg p-3 transition-colors ${(f.params.conversationId?t(i).conversationId===f.params.conversationId:t(i).conversationId===((U=t(h))==null?void 0:U.conversationId))?"bg-rc-gray-600":"bg-rc-gray-700 hover:bg-rc-gray-650"}`,"svelte-1uk1thp"),Je(u,"aria-selected",f.params.conversationId?t(i).conversationId===f.params.conversationId:t(i).conversationId===((G=t(h))==null?void 0:G.conversationId)),g(Nt,A),g(Dt,t(i).medium),g(Et,t(i).phoneNumber),g(Ut,t(i).conversationId),g(Mt,`Duration: ${q??""}`)},[()=>et(t(i).createdAt),()=>tt(t(i).duration??0)]),F("click",u,A=>vt(t(i),A)),v(a,u)}),o(r),v(e,r)};Q(Ct,e=>{var r,a;t(R)?e(kt):(a=(r=t(_))==null?void 0:r.items)!=null&&a.length?e(Tt,-1):e(Pt,1)})}o(Be),o(ve);var ue=l(ve,2),Lt=n(ue);Wt(Lt,()=>W.children),o(ue),o(Re),o(ke),o(ee),P(()=>{I.disabled=t(B)||!t(w).length,Je(I,"title",t(X)??"Telescope source"),g(St,`Items: ${t(xe)??""}`),g(At,be()?"Mock (local)":"Live")}),F("change",I,nt),He(I,()=>t(N),e=>s(N,e)),F("change",O,ut),He(O,()=>t(M),e=>s(M,e)),F("click",ue,e=>e.stopPropagation()),v(Ze,ee),Gt()}zt(["change","click"]);export{Fr as component};
|
|
1
|
+
import{d as zt,b as F,a as v,t as k,f as b,c as Rt}from"../chunks/CCYriF4C.js";import{o as Bt}from"../chunks/DnMQeiTY.js";import{p as Ot,w as d,x as me,d as qt,t as P,j as t,a as Gt,e as Qt,f as _e,s as l,c as n,y as s,n as C,$ as Vt,o as T,r as o}from"../chunks/CR-uVjxM.js";import{s as g}from"../chunks/B0nqNj93.js";import{i as Q}from"../chunks/BQIf5msi.js";import{e as Ve,i as We}from"../chunks/DuQdgMax.js";import{s as Wt}from"../chunks/9mOMnnWN.js";import{h as Ht}from"../chunks/DjujL8K1.js";import{b as He,c as Je}from"../chunks/CR5IRTqC.js";import{s as Jt}from"../chunks/C9yBjdYI.js";import{p as Kt}from"../chunks/BcbX6huO.js";import{g as y}from"../chunks/hHPtUt6H.js";import{p as f}from"../chunks/BDj12791.js";import{B as V}from"../chunks/joiJcRPz.js";import{I as Xt}from"../chunks/BBk8_Xpk.js";import{I as Yt}from"../chunks/DJnDF3d9.js";import{m as Zt}from"../chunks/ddC1NP9R.js";import{p as Ke,T as er,g as tr}from"../chunks/DjDpMqch.js";import{T as rr,a as Xe}from"../chunks/BEdAvgYp.js";import{A as ar}from"../chunks/C0rPkxmP.js";import{g as sr}from"../chunks/Dba0_Upf.js";import{t as or}from"../chunks/BA_s3vf-.js";var nr=b("<!> <!>",1),Ye=b("<option> </option>"),ir=b('<button type="button" aria-label="Clear search" class="absolute right-2 top-1/2 flex -translate-y-1/2 items-center justify-center rounded p-1 text-rc-gray-200 hover:bg-rc-gray-600 hover:text-rc-gray-100 focus:outline-none"><!></button>'),lr=b('<p class="py-8 text-center text-rc-gray-200">Loading...</p>'),cr=b('<p class="py-8 text-center text-rc-gray-300">No conversations found</p>'),dr=b('<span class="text-rc-gray-200">, Agent Id:</span> <span class="text-rc-green-200"> </span>',1),vr=b('<li><div class="flex w-full flex-col gap-2"><div class="flex w-full items-center justify-between"><div class="text-gray-300"> </div> <div class="flex items-center gap-2"><span class="text-xs text-rc-gray-300"> </span> <span class="font-semibold text-rc-gray-100"> </span></div></div> <div class="flex items-center justify-between gap-4"><div class="text-sm"><span class="text-rc-gray-200">Conversation Id:</span> <span class="text-rc-green-200"> </span> <!></div> <p class="text-sm text-gray-400"> </p></div></div></li>'),ur=b('<ul class="space-y-2"></ul>'),pr=b('<div class="flex h-screen"><!> <div class="flex h-full min-w-0 flex-1 flex-col bg-rc-gray-980 pb-3 pr-4 pt-2"><nav class="flex flex-none flex-col bg-rc-gray-980"><div class="flex items-center justify-center"><!></div> <div class="flex flex-wrap items-center gap-4"><div class="flex-1"><label class="block"><div class="flex gap-2"><select class="select svelte-1uk1thp" aria-label="Telescope source"><!></select> <div class="relative"><!><!></div> <!></div></label></div> <div class="hidden items-center gap-2"><div class="text-rc-gray-200">Sort:</div> <!></div> <div class="hidden items-center gap-2"><div class="text-rc-gray-200">Page size:</div> <select class="rounded-sm border border-rc-gray-300 bg-rc-gray-700 p-2 pr-8 text-rc-gray-100"><option>5</option><option>10</option><option>20</option><option>50</option></select></div> <div class="flex items-center gap-3"><div class="flex items-center gap-2"><!> <!> <div class="text-sm text-rc-gray-200"> </div></div></div> <div class="ml-auto whitespace-nowrap text-sm"><span class="text-gray-400">API Mode:</span> <span class="font-semibold text-rc-green-200"> </span></div></div></nav> <main class="flex flex-1 overflow-hidden"><div class="flex h-full w-1/3 flex-col"><div class="flex-none border-b border-rc-gray-300/40 p-4"><h2 class="text-lg font-semibold text-rc-gray-100">Conversations</h2></div> <div class="rc-scroll min-h-0 flex-1 overflow-scroll px-3 py-4"><!></div></div> <div class="flex h-full w-2/3 flex-col bg-rc-gray-980"><!></div></main></div></div>');function Fr(Ze,W){Ot(W,!0);const j=new er(fetch);let he=d(me([])),_=d(void 0),h=d(null);const p=C(()=>(f.url.searchParams.get("agent")??"").trim()),H=C(()=>(f.url.searchParams.get("region")??"").trim());let L=d(""),J=d(20),M=d("20"),z=d(!0),x=d(me([])),$=d(null),R=d(!1),K=d(null),xe=d(0),w=d(me([])),N=d(""),B=d(!1),X=d(null),ye=d(!1),Y=d(null),be=Kt(W,"useMock",3,!1);const{onError:we}=sr();function et(e){return new Date(e).toLocaleString()}function tt(e){const r=Math.floor(e/60),a=e%60;return`${r}:${String(a).padStart(2,"0")}`}function $e(e=t(p),r=e===t(p)?t(H):""){const a=new URLSearchParams;e&&a.set("agent",e),e&&r&&a.set("region",r);const i=a.toString();return i?`?${i}`:""}function D(e=t(p)){return`${t(Ae)}/conversations${$e(e)}`}const rt=C(()=>f.url.pathname.split("/").at(-1)==="latency"?"latency":"traces");function at(e,r=t(rt),a=t(p)){return`${t(Ae)}/conversations/${encodeURIComponent(e)}/${r}${$e(a)}`}async function st(e,r=t(J),a,i){return be()?Zt.fetchConversations(r,e,a??void 0):j.getConversations({phoneNumber:e,agentId:i,limit:Number(r),lastConversationId:a??void 0})}async function E(){s(x,[],!0),s($,null),await Z()}async function ot(){s(B,!0),s(X,null);try{const e=await fetch("/traces/api/sources");if(!e.ok)throw new Error(`Failed to load sources (${e.status})`);const r=await e.json(),a=Array.isArray(r)?r:[];if(s(w,a.filter(c=>c&&typeof c.id=="string"&&typeof c.label=="string"),!0),!t(w).length)throw new Error("No sources returned");const i=tr(),u=i&&t(w).some(c=>c.id===i)?i:t(w)[0].id;s(N,u,!0),Ke(u),j.setSourceId(u)}catch(e){console.error("Failed to load Telescope sources:",e),s(X,(e==null?void 0:e.message)??"Failed to load Telescope sources",!0),s(w,[],!0),s(N,""),j.setSourceId(void 0)}finally{s(B,!1)}}async function nt(e){const r=e.target.value;s(N,r,!0),Ke(r),j.setSourceId(r),s(h,null),await y(D()),await E()}async function it(){try{s(he,await or.agents.catalog.query(),!0)}catch(e){const r=e instanceof Error?e.message:e?String(e):"Unknown error";console.error("Failed to load agents:",e),we(`Failed to load agents: ${r}`)}}async function Z(){s(R,!0),s(K,null);try{const e=await st(t(L)||void 0,t(J),t($)??void 0,t(p)||void 0);let r=Array.isArray(e.items)?e.items.slice():[];r=r.filter(a=>!!(a!=null&&a.phoneNumber)),s(_,{limit:e.limit,items:r,lastConversationId:e.lastConversationId},!0),s(xe,r.length,!0),s($,e.lastConversationId??null,!0),s(R,!1)}catch(e){s(R,!1),s(K,e.message||"Unknown error",!0),we(`Error loading conversations: ${t(K)}`),console.error("Load page error:",e)}}async function lt(){var e;(e=t(_))!=null&&e.lastConversationId&&(t(x).push(t(_).lastConversationId),s($,t(_).lastConversationId,!0),await Z())}async function ct(){t(x).length&&(t(x).pop(),s($,t(x).length?t(x)[t(x).length-1]:null,!0),await Z())}function dt(){var e;s(z,!t(z)),(e=t(_))!=null&&e.items&&t(_).items.sort((r,a)=>t(z)?a.createdAt-r.createdAt:r.createdAt-a.createdAt)}async function vt(e,r){var i;if(r==null||r.stopPropagation(),f.params.conversationId&&f.params.conversationId===e.conversationId||!f.params.conversationId&&((i=t(h))==null?void 0:i.conversationId)===e.conversationId){s(h,null),await y(D());return}s(h,e,!0),await y(at(e.conversationId))}function ut(e){const r=e.target.value;s(M,r,!0),s(J,parseInt(t(M),10)||20,!0)}async function Ie(){await E()}async function pt(e){e==null||e.preventDefault(),e==null||e.stopPropagation(),s(L,""),s(x,[],!0),s($,null),await E()}const Se=C(()=>{const e=f.url.pathname.split("/")[1];return e==="traces"?"view":e}),Ae=C(()=>f.url.pathname.startsWith("/view")?"/view":"/traces");function ft({value:e}){if(e!==t(Se)){if(e==="edit"){if(!t(p))return y("/edit");const r=new URLSearchParams;t(H)&&r.set("region",t(H));const a=r.toString();return y(`/edit/${encodeURIComponent(t(p))}/roleplay${a?`?${a}`:""}`)}if(e==="view")return y(D());y("/"+e)}}async function gt(e,r){r==null||r.stopPropagation(),e!==t(p)&&(s(h,null),await y(D(e)))}async function mt(e){e==null||e.stopPropagation(),t(p)&&(s(h,null),await y(D("")))}qt(()=>{const e=t(p);t(ye)&&e!==t(Y)&&(s(Y,e,!0),s(h,null),E())}),Bt(()=>{(async()=>(await Promise.all([it(),ot()]),await E(),s(Y,t(p),!0),s(ye,!0)))()});var ee=pr();Ht("1uk1thp",e=>{Qt(()=>{Vt.title="Bosun: Telescope"})});var Ce=n(ee);ar(Ce,{get agents(){return t(he)},get currentAgent(){return t(p)},onAgentClick:gt,showAllAgentsOption:!0,onAllAgentsClick:mt,className:"flex-none"});var ke=l(Ce,2),te=n(ke),re=n(te),_t=n(re);rr(_t,{get value(){return t(Se)},ariaLabel:"Top tabs",onChange:ft,children:(e,r)=>{var a=nr(),i=_e(a);Xe(i,{value:"edit",children:(c,S)=>{T();var m=k("Edit");v(c,m)},$$slots:{default:!0}});var u=l(i,2);Xe(u,{value:"view",children:(c,S)=>{T();var m=k("View");v(c,m)},$$slots:{default:!0}}),v(e,a)},$$slots:{default:!0}}),o(re);var Pe=l(re,2),ae=n(Pe),Te=n(ae),Le=n(Te),I=n(Le),ht=n(I);{var xt=e=>{var r=Rt(),a=_e(r);Ve(a,17,()=>t(w),We,(i,u)=>{var c=Ye(),S=n(c,!0);o(c);var m={};P(()=>{g(S,t(u).label),m!==(m=t(u).id)&&(c.value=(c.__value=t(u).id)??"")}),v(i,c)}),v(e,r)},yt=e=>{var r=Ye(),a=n(r,!0);o(r),r.value=r.__value="",P(()=>g(a,t(B)?"Loading…":"No sources")),v(e,r)};Q(ht,e=>{t(w).length?e(xt):e(yt,-1)})}o(I);var se=l(I,2),Ne=n(se);Yt(Ne,{class:"w-56 rounded-r-none !border !border-rc-gray-500 !p-2 !pr-8 hover:border-rc-gray-400",placeholder:"Search by phone...",onkeydown:e=>{e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),Ie())},get value(){return t(L)},set value(e){s(L,e,!0)}});var bt=l(Ne);{var wt=e=>{var r=ir(),a=n(r);Xt(a,{name:"close",width:18,height:18}),o(r),F("click",r,pt),v(e,r)};Q(bt,e=>{t(L)&&e(wt)})}o(se);var $t=l(se,2);V($t,{onclick:Ie,children:(e,r)=>{T();var a=k("Search");v(e,a)},$$slots:{default:!0}}),o(Le),o(Te),o(ae);var oe=l(ae,2),It=l(n(oe),2);V(It,{onclick:dt,children:(e,r)=>{T();var a=k();P(()=>g(a,t(z)?"Newest first":"Oldest first")),v(e,a)},$$slots:{default:!0}}),o(oe);var ne=l(oe,2),O=l(n(ne),2),ie=n(O);ie.value=ie.__value="5";var le=l(ie);le.value=le.__value="10";var ce=l(le);ce.value=ce.__value="20";var De=l(ce);De.value=De.__value="50",o(O),o(ne);var de=l(ne,2),Ee=n(de),Ue=n(Ee);{let e=C(()=>t(x).length===0&&!t($));V(Ue,{onclick:ct,get disabled(){return t(e)},children:(r,a)=>{T();var i=k("Prev");v(r,i)},$$slots:{default:!0}})}var Fe=l(Ue,2);{let e=C(()=>{var r;return!((r=t(_))!=null&&r.items.length)});V(Fe,{onclick:lt,get disabled(){return t(e)},children:(r,a)=>{T();var i=k("Next");v(r,i)},$$slots:{default:!0}})}var je=l(Fe,2),St=n(je);o(je),o(Ee),o(de);var Me=l(de,2),ze=l(n(Me),2),At=n(ze,!0);o(ze),o(Me),o(Pe),o(te);var Re=l(te,2),ve=n(Re),Be=l(n(ve),2),Ct=n(Be);{var kt=e=>{var r=lr();v(e,r)},Pt=e=>{var r=cr();v(e,r)},Tt=e=>{var r=ur();Ve(r,21,()=>t(_).items,We,(a,i)=>{var u=vr(),c=n(u),S=n(c),m=n(S),Nt=n(m,!0);o(m);var Oe=l(m,2),pe=n(Oe),Dt=n(pe,!0);o(pe);var qe=l(pe,2),Et=n(qe,!0);o(qe),o(Oe),o(S);var Ge=l(S,2),fe=n(Ge),ge=l(n(fe),2),Ut=n(ge,!0);o(ge);var Ft=l(ge,2);{var jt=A=>{var q=dr(),U=l(_e(q),2),G=n(U,!0);o(U),P(()=>g(G,t(i).agentId)),v(A,q)};Q(Ft,A=>{!t(p)&&t(i).agentId&&A(jt)})}o(fe);var Qe=l(fe,2),Mt=n(Qe);o(Qe),o(Ge),o(c),o(u),P((A,q)=>{var U,G;Jt(u,1,`cursor-pointer rounded-lg p-3 transition-colors ${(f.params.conversationId?t(i).conversationId===f.params.conversationId:t(i).conversationId===((U=t(h))==null?void 0:U.conversationId))?"bg-rc-gray-600":"bg-rc-gray-700 hover:bg-rc-gray-650"}`,"svelte-1uk1thp"),Je(u,"aria-selected",f.params.conversationId?t(i).conversationId===f.params.conversationId:t(i).conversationId===((G=t(h))==null?void 0:G.conversationId)),g(Nt,A),g(Dt,t(i).medium),g(Et,t(i).phoneNumber),g(Ut,t(i).conversationId),g(Mt,`Duration: ${q??""}`)},[()=>et(t(i).createdAt),()=>tt(t(i).duration??0)]),F("click",u,A=>vt(t(i),A)),v(a,u)}),o(r),v(e,r)};Q(Ct,e=>{var r,a;t(R)?e(kt):(a=(r=t(_))==null?void 0:r.items)!=null&&a.length?e(Tt,-1):e(Pt,1)})}o(Be),o(ve);var ue=l(ve,2),Lt=n(ue);Wt(Lt,()=>W.children),o(ue),o(Re),o(ke),o(ee),P(()=>{I.disabled=t(B)||!t(w).length,Je(I,"title",t(X)??"Telescope source"),g(St,`Items: ${t(xe)??""}`),g(At,be()?"Mock (local)":"Live")}),F("change",I,nt),He(I,()=>t(N),e=>s(N,e)),F("change",O,ut),He(O,()=>t(M),e=>s(M,e)),F("click",ue,e=>e.stopPropagation()),v(Ze,ee),Gt()}zt(["change","click"]);export{Fr as component};
|
package/build/bosun-app/frontend/client/_app/immutable/nodes/{4.OKeVO1DM.js → 4.DjofsVgf.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as L,b as U,a as t,t as h,f as x}from"../chunks/CCYriF4C.js";import{p as j,a as B,f as M,j as l,s as g,n as $,c,o as b,r as d}from"../chunks/CR-uVjxM.js";import{s as R}from"../chunks/9mOMnnWN.js";import{g as W}from"../chunks/
|
|
1
|
+
import{d as L,b as U,a as t,t as h,f as x}from"../chunks/CCYriF4C.js";import{p as j,a as B,f as M,j as l,s as g,n as $,c,o as b,r as d}from"../chunks/CR-uVjxM.js";import{s as R}from"../chunks/9mOMnnWN.js";import{g as W}from"../chunks/hHPtUt6H.js";import{p as o}from"../chunks/BDj12791.js";import{T as q,a as _}from"../chunks/BEdAvgYp.js";import{p as z}from"../chunks/BJ9KKLWf.js";var A=x("<!> <!>",1),D=x('<div class="flex h-full min-h-0 flex-col bg-rc-gray-980"><div class="flex-none border-b border-rc-gray-300/40 px-4 pt-3"><!></div> <div class="min-h-0 flex-1"><!></div></div>');function O(y,v){j(v,!0),z();const p=$(()=>o.url.pathname.split("/").at(-1)==="latency"?"latency":"traces"),w=$(()=>o.url.pathname.startsWith("/view")?"/view":"/traces");function T(a){const m=o.params.conversationId??"",r=o.url.search;return`${l(w)}/conversations/${encodeURIComponent(m)}/${a}${r}`}function C({value:a}){a!=="traces"&&a!=="latency"||a!==l(p)&&W(T(a))}var e=D(),s=c(e),P=c(s);q(P,{get value(){return l(p)},ariaLabel:"View conversation tabs",onChange:C,children:(a,m)=>{var r=A(),u=M(r);_(u,{value:"traces",children:(n,k)=>{b();var i=h("Traces");t(n,i)},$$slots:{default:!0}});var I=g(u,2);_(I,{value:"latency",children:(n,k)=>{b();var i=h("Latency");t(n,i)},$$slots:{default:!0}}),t(a,r)},$$slots:{default:!0}}),d(s);var f=g(s,2),V=c(f);R(V,()=>v.children),d(f),d(e),U("click",e,a=>a.stopPropagation()),t(y,e),B()}L(["click"]);export{O as component};
|
package/build/bosun-app/frontend/client/_app/immutable/nodes/{5.DtbvqoNH.js → 5.Daft73xD.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as x,b,a as m,f}from"../chunks/CCYriF4C.js";import{o as y}from"../chunks/DnMQeiTY.js";import{p as A,d as w,a as _,s as h,c as n,r as o,t as C,j as r,w as N,x as F,e as S,y as j,$ as q}from"../chunks/CR-uVjxM.js";import{h as H}from"../chunks/DjujL8K1.js";import{e as M,c as O,A as P}from"../chunks/C0rPkxmP.js";import{s as R}from"../chunks/B0nqNj93.js";import{e as z}from"../chunks/DuQdgMax.js";import{s as B,c as D}from"../chunks/CR5IRTqC.js";import{s as E}from"../chunks/C9yBjdYI.js";import{g as G}from"../chunks/Dba0_Upf.js";import{t as I}from"../chunks/
|
|
1
|
+
import{d as x,b,a as m,f}from"../chunks/CCYriF4C.js";import{o as y}from"../chunks/DnMQeiTY.js";import{p as A,d as w,a as _,s as h,c as n,r as o,t as C,j as r,w as N,x as F,e as S,y as j,$ as q}from"../chunks/CR-uVjxM.js";import{h as H}from"../chunks/DjujL8K1.js";import{e as M,c as O,A as P}from"../chunks/C0rPkxmP.js";import{s as R}from"../chunks/B0nqNj93.js";import{e as z}from"../chunks/DuQdgMax.js";import{s as B,c as D}from"../chunks/CR5IRTqC.js";import{s as E}from"../chunks/C9yBjdYI.js";import{g as G}from"../chunks/Dba0_Upf.js";import{t as I}from"../chunks/BA_s3vf-.js";var J=f('<button><span class="agent-name svelte-16acuk9"> </span></button>'),K=f('<div class="agent-grid-container svelte-16acuk9"><div class="agent-grid svelte-16acuk9"><!> <button class="agent-card new-agent svelte-16acuk9" aria-label="Create new agent"><span class="agent-name agent-name_new svelte-16acuk9">New Agent</span></button></div></div>');function L(d,s){A(s,!0),w(()=>{M(s.agents.map(a=>a.id))});var l=K(),i=n(l),c=n(i);z(c,17,()=>s.agents,a=>a.id,(a,e)=>{var t=J();let v;var p=n(t),k=n(p,!0);o(p),o(t),C(u=>{v=E(t,1,"agent-card svelte-16acuk9",null,v,{active:r(e).id===s.currentAgent}),B(t,`--agent-color: ${u??""}`),D(t,"aria-label",`Open ${r(e).displayName}`),R(k,r(e).displayName)},[()=>O(r(e).id)]),b("click",t,u=>s.onAgentClick(r(e).id,u)),m(a,t)});var g=h(c,2);o(i),o(l),b("click",g,function(...a){var e;(e=s.onNewAgent)==null||e.apply(this,a)}),m(d,l),_()}x(["click"]);var Q=f('<div class="flex h-screen"><!> <div class="flex h-full min-w-0 flex-1 flex-col bg-rc-gray-980 py-3 pr-4"><div class="flex-1"><!></div></div></div>');function se(d,s){A(s,!0);const{onAgentSelect:l}=G();let i=N(F([]));y(async()=>{j(i,await I.agents.catalog.query(),!0)});var c=Q();H("1uha8ag",v=>{S(()=>{q.title="Recombine Agents Hub"})});var g=n(c);P(g,{className:"flex-none border-r-thin border-r-rc-gray-600",get agents(){return r(i)},currentAgent:"",get onAgentClick(){return l},initiallyCollapsed:!1,hoverCollapse:!1});var a=h(g,2),e=n(a),t=n(e);L(t,{get agents(){return r(i)},currentAgent:"",get onAgentClick(){return l}}),o(e),o(a),o(c),m(d,c),_()}export{se as component};
|
package/build/bosun-app/frontend/client/_app/immutable/nodes/{6.U0GvoBZK.js → 6.BC5i16hF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,t as b,f as C}from"../chunks/CCYriF4C.js";import{o as L}from"../chunks/DnMQeiTY.js";import{p as M,w as _,x as N,d as U,a as V,e as z,j as t,f as D,s as y,c as i,n as G,y as w,$ as H,o as l,r as f}from"../chunks/CR-uVjxM.js";import{h as I}from"../chunks/DjujL8K1.js";import{g as c}from"../chunks/
|
|
1
|
+
import{a as r,t as b,f as C}from"../chunks/CCYriF4C.js";import{o as L}from"../chunks/DnMQeiTY.js";import{p as M,w as _,x as N,d as U,a as V,e as z,j as t,f as D,s as y,c as i,n as G,y as w,$ as H,o as l,r as f}from"../chunks/CR-uVjxM.js";import{h as I}from"../chunks/DjujL8K1.js";import{g as c}from"../chunks/hHPtUt6H.js";import{g as J}from"../chunks/Dba0_Upf.js";import{t as K}from"../chunks/BA_s3vf-.js";import{A as O}from"../chunks/C0rPkxmP.js";import{T as Q,a as A}from"../chunks/BEdAvgYp.js";import{p as T}from"../chunks/BDj12791.js";var R=C("<!> <!>",1),W=C('<div class="flex h-screen"><!> <div class="flex h-full min-w-0 flex-1 flex-col bg-rc-gray-980 pb-3 pr-4 pt-2"><nav class="flex flex-none items-center justify-center bg-rc-gray-980"><!></nav> <main class="flex-1 pr-80 pt-40"><div class="flex h-full items-start justify-center text-rc-gray-200">Select an agent on the left panel to start editing</div></main></div></div>');function ie(S,E){M(E,!0);const{onAgentSelect:d,onError:j}=J();let a=_(N([])),p=_(!1);const g=G(()=>T.url.pathname.split("/")[1]);function k({value:e}){if(e!==t(g)){if(e==="edit")return c("/edit");if(e==="view")return c("/view");c("/"+e)}}function P(e){d(e)}U(()=>{t(p)||T.url.pathname==="/edit"&&t(a).length&&(w(p,!0),d(t(a)[0].id))}),L(async()=>{try{w(a,await K.agents.catalog.query(),!0)}catch(e){const h=e instanceof Error?e.message:e?String(e):"Unknown error";console.error("Failed to load agents:",e),j(`Failed to load agents: ${h}`)}});var s=W();I("17v3h6h",e=>{z(()=>{H.title="Bosun: Edit"})});var m=i(s);O(m,{className:"flex-none",get agents(){return t(a)},currentAgent:"",onAgentClick:P});var u=y(m,2),v=i(u),F=i(v);Q(F,{get value(){return t(g)},ariaLabel:"Top tabs",onChange:k,children:(e,h)=>{var x=R(),$=D(x);A($,{value:"edit",children:(n,B)=>{l();var o=b("Edit");r(n,o)},$$slots:{default:!0}});var q=y($,2);A(q,{value:"view",children:(n,B)=>{l();var o=b("View");r(n,o)},$$slots:{default:!0}}),r(e,x)},$$slots:{default:!0}}),f(v),l(2),f(u),f(s),r(S,s),V()}export{ie as component};
|