@datalayer/agent-runtimes 1.3.106 → 1.3.108

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.
@@ -110,7 +110,7 @@ ${Au}
110
110
  :scope strong {
111
111
  font-weight: var(--base-text-weight-semibold);
112
112
  }
113
- `,loopThemeStyles=buildThemeStyles(loopLight,loopDark,{fontFamily:loopFontFamily,css:loopControlsCss,shape:{radiusControl:loopShapeVars["--loop-radius-control"],radiusCard:loopShapeVars["--loop-radius-card"],radiusBubble:loopShapeVars["--loop-radius-bubble"],radiusFrame:loopShapeVars["--loop-radius-frame"],shadow:loopShapeVars["--loop-shadow-frame"],motionStatus:loopMotionVars["--loop-motion-status"],motionMessage:loopMotionVars["--loop-motion-message"],motionPane:loopMotionVars["--loop-motion-pane"],motionEasing:loopMotionVars["--loop-motion-easing"],messageLink:"currentColor"},variables:{light:{...loopShapeVars,...loopTints("light"),...loopMotionVars,...loopShadows.light,...loopTypeVars(loopFontFamily),"--loop-hairline":loopHairline.light,"--borderColor-default":loopHairline.light,"--focus-outlineColor":loopFocusRing.light,"--underlineNav-borderColor-active":themeAccents.green.accent},dark:{...loopShapeVars,...loopTints("dark"),...loopMotionVars,...loopShadows.dark,...loopTypeVars(loopFontFamily),"--loop-hairline":loopHairline.dark,"--borderColor-default":loopHairline.dark,"--focus-outlineColor":loopFocusRing.dark,"--underlineNav-borderColor-active":themeAccents.green.accent}}}),loopTheme={...theme$2,fontWeights:{light:loopFontWeights.regular,normal:loopFontWeights.regular,semibold:loopFontWeights.semibold,bold:loopFontWeights.semibold}},themeTokens={datalayer:{label:"Datalayer",description:"Default green palette — the classic Datalayer look.",brandColor:datalayerColors.greenBrand,defaultColorMode:"auto",themeStyles:datalayerThemeStyles,cardGradient:{light:{from:datalayerColors.greenBrand,to:datalayerColors.greenText},dark:{from:datalayerColors.greenAccent,to:datalayerColors.greenBrand}},brightPalette:{glow:datalayerColors.brightGlow,onGlow:"#1b1f24",pop:datalayerColors.brightPop,spark:datalayerColors.brightSpark,blaze:datalayerColors.brightBlaze,surge:datalayerColors.brightSurge,flame:datalayerColors.brightFlame,gold:datalayerColors.brightGold},brightPaletteLight:{glow:datalayerColors.brightLightGlow,onGlow:"#1b1f24",pop:datalayerColors.brightLightPop,spark:datalayerColors.brightLightSpark,blaze:datalayerColors.brightLightBlaze,surge:datalayerColors.brightLightSurge,flame:datalayerColors.brightLightFlame,gold:datalayerColors.brightLightGold}},spatial:{label:"Spatial",description:"Cosmic indigo & deep blues — inspired by space.",brandColor:spatialColors.indigoBrand,defaultColorMode:"auto",themeStyles:spatialThemeStyles,cardGradient:{light:{from:spatialColors.indigoBrand,to:spatialColors.indigoText},dark:{from:spatialColors.indigoAccent,to:spatialColors.indigoBrand}},brightPalette:{glow:spatialColors.brightGlow,onGlow:"#ffffff",pop:spatialColors.brightPop,spark:spatialColors.brightSpark,blaze:spatialColors.brightBlaze,surge:spatialColors.brightSurge,flame:spatialColors.brightFlame,gold:spatialColors.brightGold},brightPaletteLight:{glow:spatialColors.brightLightGlow,onGlow:"#ffffff",pop:spatialColors.brightLightPop,spark:spatialColors.brightLightSpark,blaze:spatialColors.brightLightBlaze,surge:spatialColors.brightLightSurge,flame:spatialColors.brightLightFlame,gold:spatialColors.brightLightGold}},lovely:{label:"Lovely",description:"Warm rose & magenta — soft and inviting.",brandColor:lovelyColors.roseBrand,defaultColorMode:"auto",themeStyles:lovelyThemeStyles,cardGradient:{light:{from:lovelyColors.roseBrand,to:lovelyColors.roseText},dark:{from:lovelyColors.roseAccent,to:lovelyColors.roseBrand}},brightPalette:{glow:lovelyColors.brightGlow,onGlow:"#ffffff",pop:lovelyColors.brightPop,spark:lovelyColors.brightSpark,blaze:lovelyColors.brightBlaze,surge:lovelyColors.brightSurge,flame:lovelyColors.brightFlame,gold:lovelyColors.brightGold},brightPaletteLight:{glow:lovelyColors.brightLightGlow,onGlow:"#ffffff",pop:lovelyColors.brightLightPop,spark:lovelyColors.brightLightSpark,blaze:lovelyColors.brightLightBlaze,surge:lovelyColors.brightLightSurge,flame:lovelyColors.brightLightFlame,gold:lovelyColors.brightLightGold}},matrix:{label:"Matrix",description:"Phosphor green on black — CRT terminal aesthetic.",brandColor:matrixColors.greenPhosphor,defaultColorMode:"dark",themeStyles:matrixThemeStyles,cardGradient:{light:{from:matrixColors.greenBrand,to:matrixColors.greenText},dark:{from:matrixColors.greenGlow,to:matrixColors.greenHover}},brightPalette:{glow:matrixColors.brightGlow,onGlow:"#1b1f24",pop:matrixColors.brightPop,spark:matrixColors.brightSpark,blaze:matrixColors.brightBlaze,surge:matrixColors.brightSurge,flame:matrixColors.brightFlame,gold:matrixColors.brightGold},brightPaletteLight:{glow:matrixColors.brightLightGlow,onGlow:"#1b1f24",pop:matrixColors.brightLightPop,spark:matrixColors.brightLightSpark,blaze:matrixColors.brightLightBlaze,surge:matrixColors.brightLightSurge,flame:matrixColors.brightLightFlame,gold:matrixColors.brightLightGold}},earth:{label:"Earth",description:"Ocean blues, forest greens & golden sun — the Blue Planet.",brandColor:earthColors.oceanBrand,defaultColorMode:"auto",themeStyles:earthThemeStyles,cardGradient:{light:{from:earthColors.oceanBrand,to:earthColors.oceanText},dark:{from:earthColors.oceanAccent,to:earthColors.oceanBrand}},brightPalette:{glow:earthColors.brightGlow,onGlow:"#ffffff",pop:earthColors.brightPop,spark:earthColors.brightSpark,blaze:earthColors.brightBlaze,surge:earthColors.brightSurge,flame:earthColors.brightFlame,gold:earthColors.brightGold},brightPaletteLight:{glow:earthColors.brightLightGlow,onGlow:"#ffffff",pop:earthColors.brightLightPop,spark:earthColors.brightLightSpark,blaze:earthColors.brightLightBlaze,surge:earthColors.brightLightSurge,flame:earthColors.brightLightFlame,gold:earthColors.brightLightGold}},sand:{label:"Sand",description:"Warm, pale desert neutrals with a golden accent — calm & editorial.",brandColor:sandColors.sandBrand,defaultColorMode:"light",themeStyles:sandThemeStyles,cardGradient:{light:{from:sandColors.sandBrand,to:sandColors.sandText},dark:{from:sandColors.sandAccent,to:sandColors.sandBrand}},brightPalette:{glow:sandColors.brightGlow,onGlow:"#211A12",pop:sandColors.brightPop,spark:sandColors.brightSpark,blaze:sandColors.brightBlaze,surge:sandColors.brightSurge,flame:sandColors.brightFlame,gold:sandColors.brightGold},brightPaletteLight:{glow:sandColors.brightLightGlow,onGlow:"#ffffff",pop:sandColors.brightLightPop,spark:sandColors.brightLightSpark,blaze:sandColors.brightLightBlaze,surge:sandColors.brightLightSurge,flame:sandColors.brightLightFlame,gold:sandColors.brightLightGold}},ivory:{label:"Ivory",description:"Soft, warm off-white that creates a calm, refined, and welcoming feeling.",brandColor:ivoryColors.ivoryBrand,defaultColorMode:"light",themeStyles:ivoryThemeStyles,cardGradient:{light:{from:ivoryColors.ivoryBrand,to:ivoryColors.ivoryText},dark:{from:ivoryColors.ivoryAccent,to:ivoryColors.ivoryBrand}},brightPalette:{glow:ivoryColors.brightGlow,onGlow:"#211A12",pop:ivoryColors.brightPop,spark:ivoryColors.brightSpark,blaze:ivoryColors.brightBlaze,surge:ivoryColors.brightSurge,flame:ivoryColors.brightFlame,gold:ivoryColors.brightGold},brightPaletteLight:{glow:ivoryColors.brightLightGlow,onGlow:"#ffffff",pop:ivoryColors.brightLightPop,spark:ivoryColors.brightLightSpark,blaze:ivoryColors.brightLightBlaze,surge:ivoryColors.brightLightSurge,flame:ivoryColors.brightLightFlame,gold:ivoryColors.brightLightGold}},sun:{label:"Sun",description:"Warm, radiant theme inspired by golden light, bringing energy, optimism, and a welcoming atmosphere.",brandColor:sunColors.sunBrand,defaultColorMode:"light",themeStyles:sunThemeStyles,cardGradient:{light:{from:sunColors.sunBrand,to:sunColors.sunText},dark:{from:sunColors.sunAccent,to:sunColors.sunBrand}},brightPalette:{glow:sunColors.brightGlow,onGlow:"#211A08",pop:sunColors.brightPop,spark:sunColors.brightSpark,blaze:sunColors.brightBlaze,surge:sunColors.brightSurge,flame:sunColors.brightFlame,gold:sunColors.brightGold},brightPaletteLight:{glow:sunColors.brightLightGlow,onGlow:"#ffffff",pop:sunColors.brightLightPop,spark:sunColors.brightLightSpark,blaze:sunColors.brightLightBlaze,surge:sunColors.brightLightSurge,flame:sunColors.brightLightFlame,gold:sunColors.brightLightGold}},loop:{label:"Loop",description:"Very clean: one soft accent, neutral everything else. The look of an application built in LOOP.",brandColor:loopColors.loopBrand,defaultColorMode:"light",themeStyles:loopThemeStyles,cardGradient:{light:{from:loopColors.loopBrand,to:loopColors.loopBrand},dark:{from:loopColors.loopBrand,to:loopColors.loopBrand}},brightPalette:{glow:loopColors.brightGlow,onGlow:loopColors.loopOn,pop:loopColors.brightPop,spark:loopColors.brightSpark,blaze:loopColors.brightBlaze,surge:loopColors.brightSurge,flame:loopColors.brightFlame,gold:loopColors.brightGold},brightPaletteLight:{glow:loopColors.brightLightGlow,onGlow:"#ffffff",pop:loopColors.brightLightPop,spark:loopColors.brightLightSpark,blaze:loopColors.brightLightBlaze,surge:loopColors.brightLightSurge,flame:loopColors.brightLightFlame,gold:loopColors.brightLightGold}}};function brightPaletteOf(Au,lo){const $u=themeTokens[Au]??themeTokens.datalayer;return lo==="light"?$u.brightPaletteLight??$u.brightPalette:$u.brightPalette}const primerThemes={datalayer:datalayerTheme,spatial:spatialTheme,lovely:lovelyTheme,matrix:matrixTheme,earth:earthTheme,sand:sandTheme,ivory:ivoryTheme,sun:sunTheme,loop:loopTheme},themeConfigs=Object.fromEntries(Object.keys(themeTokens).map(Au=>[Au,{...themeTokens[Au],primerTheme:primerThemes[Au]}]));function getThemeConfig(Au){return themeConfigs[Au]}const osMode=()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";function getBrightPalette(Au="datalayer",lo){const $u=lo==="auto"?osMode():lo==="light"?"light":"dark";return brightPaletteOf(Au,$u)}const createStoreImpl$2=Au=>{let lo;const $u=new Set,Ru=(ju,Bu)=>{const Fu=typeof ju=="function"?ju(lo):ju;if(!Object.is(Fu,lo)){const zu=lo;lo=Bu??(typeof Fu!="object"||Fu===null)?Fu:Object.assign({},lo,Fu),$u.forEach(qu=>qu(lo,zu))}},Iu=()=>lo,Du={setState:Ru,getState:Iu,getInitialState:()=>Lu,subscribe:ju=>($u.add(ju),()=>$u.delete(ju))},Lu=lo=Au(Ru,Iu,Du);return Du},createStore$2=(Au=>Au?createStoreImpl$2(Au):createStoreImpl$2),identity$4=Au=>Au;function useStore$2(Au,lo=identity$4){const $u=vM.useSyncExternalStore(Au.subscribe,vM.useCallback(()=>lo(Au.getState()),[Au,lo]),vM.useCallback(()=>lo(Au.getInitialState()),[Au,lo]));return vM.useDebugValue($u),$u}const createImpl$2=Au=>{const lo=createStore$2(Au),$u=Ru=>useStore$2(lo,Ru);return Object.assign($u,lo),$u},create$j=(Au=>Au?createImpl$2(Au):createImpl$2);function createJSONStorage$1(Au,lo){let $u;try{$u=Au()}catch{return}return{getItem:Iu=>{var Ou;const Pu=Lu=>Lu===null?null:JSON.parse(Lu,void 0),Du=(Ou=$u.getItem(Iu))!=null?Ou:null;return Du instanceof Promise?Du.then(Pu):Pu(Du)},setItem:(Iu,Ou)=>$u.setItem(Iu,JSON.stringify(Ou,void 0)),removeItem:Iu=>$u.removeItem(Iu)}}const toThenable$1=Au=>lo=>{try{const $u=Au(lo);return $u instanceof Promise?$u:{then(Ru){return toThenable$1(Ru)($u)},catch(Ru){return this}}}catch($u){return{then(Ru){return this},catch(Ru){return toThenable$1(Ru)($u)}}}},persistImpl$1=(Au,lo)=>($u,Ru,Iu)=>{let Ou={storage:createJSONStorage$1(()=>window.localStorage),partialize:Vu=>Vu,version:0,merge:(Vu,Gu)=>({...Gu,...Vu}),...lo},Pu=!1,Du=0;const Lu=new Set,ju=new Set;let Bu=Ou.storage;if(!Bu)return Au((...Vu)=>{console.warn(`[zustand persist middleware] Unable to update item '${Ou.name}', the given storage is currently unavailable.`),$u(...Vu)},Ru,Iu);const Fu=()=>{const Vu=Ou.partialize({...Ru()});return Bu.setItem(Ou.name,{state:Vu,version:Ou.version})},zu=Iu.setState;Iu.setState=(Vu,Gu)=>(zu(Vu,Gu),Fu());const qu=Au((...Vu)=>($u(...Vu),Fu()),Ru,Iu);Iu.getInitialState=()=>qu;let Uu;const Hu=()=>{var Vu,Gu;if(!Bu)return;const Ku=++Du;Pu=!1,Lu.forEach(Qu=>{var Yu;return Qu((Yu=Ru())!=null?Yu:qu)});const Zu=((Gu=Ou.onRehydrateStorage)==null?void 0:Gu.call(Ou,(Vu=Ru())!=null?Vu:qu))||void 0;return toThenable$1(Bu.getItem.bind(Bu))(Ou.name).then(Qu=>{if(Qu)if(typeof Qu.version=="number"&&Qu.version!==Ou.version){if(Ou.migrate){const Yu=Ou.migrate(Qu.state,Qu.version);return Yu instanceof Promise?Yu.then(ed=>[!0,ed]):[!0,Yu]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,Qu.state];return[!1,void 0]}).then(Qu=>{var Yu;if(Ku!==Du)return;const[ed,Xu]=Qu;if(Uu=Ou.merge(Xu,(Yu=Ru())!=null?Yu:qu),$u(Uu,!0),ed)return Fu()}).then(()=>{Ku===Du&&(Zu?.(Ru(),void 0),Uu=Ru(),Pu=!0,ju.forEach(Qu=>Qu(Uu)))}).catch(Qu=>{Ku===Du&&Zu?.(void 0,Qu)})};return Iu.persist={setOptions:Vu=>{Ou={...Ou,...Vu},Vu.storage&&(Bu=Vu.storage)},clearStorage:()=>{++Du,Bu?.removeItem(Ou.name)},getOptions:()=>Ou,rehydrate:()=>Hu(),hasHydrated:()=>Pu,onHydrate:Vu=>(Lu.add(Vu),()=>{Lu.delete(Vu)}),onFinishHydration:Vu=>(ju.add(Vu),()=>{ju.delete(Vu)})},Ou.skipHydration||Hu(),Uu||qu},persist$2=persistImpl$1,VARIANT_SCHEMA_VERSION=1;function normalizeVariantPreference(Au){return{theme:Au.theme,colorMode:Au.colorMode,version:typeof Au.version=="number"?Au.version:VARIANT_SCHEMA_VERSION}}function normalizeVariants(Au){if(!Au)return{};const lo={};for(const[$u,Ru]of Object.entries(Au))!Ru||typeof Ru!="object"||!("theme"in Ru)||!("colorMode"in Ru)||(lo[$u]=normalizeVariantPreference(Ru));return lo}function hasMissingVariantVersion(Au){return!Au||Object.keys(Au).length===0?!1:Object.values(Au).some(lo=>typeof lo?.version!="number")}const colorModeCycle={light:"dark",dark:"auto",auto:"light"};function createThemeStore(Au,lo){return create$j()(persist$2($u=>({colorMode:lo?.colorMode,theme:lo?.theme,activeVariant:null,variants:normalizeVariants(lo?.variants),toggleColorMode:()=>$u(Ru=>{const Iu=colorModeCycle[Ru.colorMode];return Ru.activeVariant&&Ru.variants[Ru.activeVariant]?{colorMode:Iu,variants:{...Ru.variants,[Ru.activeVariant]:{...Ru.variants[Ru.activeVariant],colorMode:Iu,version:VARIANT_SCHEMA_VERSION}}}:{colorMode:Iu}}),setColorMode:Ru=>$u(Iu=>Iu.activeVariant&&Iu.variants[Iu.activeVariant]?{colorMode:Ru,variants:{...Iu.variants,[Iu.activeVariant]:{...Iu.variants[Iu.activeVariant],colorMode:Ru,version:VARIANT_SCHEMA_VERSION}}}:{colorMode:Ru}),setTheme:(Ru,Iu=!0)=>$u(Ou=>{const Pu=Iu?themeConfigs[Ru].defaultColorMode:Ou.colorMode;return Ou.activeVariant&&Ou.variants[Ou.activeVariant]?{theme:Ru,colorMode:Pu,variants:{...Ou.variants,[Ou.activeVariant]:{theme:Ru,colorMode:Pu,version:VARIANT_SCHEMA_VERSION}}}:{theme:Ru,colorMode:Pu}}),registerVariants:Ru=>$u(Iu=>{const Ou={...Iu.variants};for(const[Pu,Du]of Object.entries(Ru))Ou[Pu]?Ou[Pu]=normalizeVariantPreference({...Ou[Pu],version:Ou[Pu].version??VARIANT_SCHEMA_VERSION}):Ou[Pu]=normalizeVariantPreference(Du);return{variants:Ou}}),setVariant:Ru=>$u(Iu=>{const Ou=Iu.variants[Ru];return Ou?{activeVariant:Ru,theme:Ou.theme,colorMode:Ou.colorMode}:{activeVariant:Ru}})}),{name:Au,version:3,storage:createJSONStorage$1(()=>localStorage),partialize:$u=>({colorMode:$u.colorMode,theme:$u.theme,activeVariant:$u.activeVariant,variants:$u.variants}),migrate:$u=>{const Ru=$u??{},Iu=Ru.variants,Ou=hasMissingVariantVersion(Iu),Pu=normalizeVariants(Iu);return Ou&&(Pu["agent-anonymous"]={theme:"matrix",colorMode:"dark",version:VARIANT_SCHEMA_VERSION}),{...Ru,variants:Pu,...Ou?{theme:Ru.activeVariant==="agent-anonymous"?"matrix":Ru.theme,colorMode:Ru.activeVariant==="agent-anonymous"?"dark":Ru.colorMode}:{}}},merge:($u,Ru)=>{const Iu=$u??{},Ou=normalizeVariants(Ru.variants);if(Iu.variants)for(const[Pu,Du]of Object.entries(Iu.variants))Du&&typeof Du=="object"&&"theme"in Du&&(Ou[Pu]=normalizeVariantPreference(Du));return{...Ru,...Iu,variants:Ou}}}))}const useThemeStore=createThemeStore("datalayer-theme",{colorMode:"dark",theme:"matrix"}),dlBrightDark=getBrightPalette("datalayer"),dlBrightLight=getBrightPalette("datalayer","light"),spBrightDark=getBrightPalette("spatial"),spBrightLight=getBrightPalette("spatial","light"),lvBrightDark=getBrightPalette("lovely"),lvBrightLight=getBrightPalette("lovely","light"),mxBrightDark=getBrightPalette("matrix"),mxBrightLight=getBrightPalette("matrix","light"),eaBrightDark=getBrightPalette("earth"),eaBrightLight=getBrightPalette("earth","light"),saBrightDark=getBrightPalette("sand"),saBrightLight=getBrightPalette("sand","light"),ivBrightDark=getBrightPalette("ivory"),ivBrightLight=getBrightPalette("ivory","light"),suBrightDark=getBrightPalette("sun"),suBrightLight=getBrightPalette("sun","light"),loBrightDark=getBrightPalette("loop"),loBrightLight=getBrightPalette("loop","light"),palettes={datalayer:{light:{bg:"#f6f8fa",bgPanel:"#ffffff",bgAlt:"#f0f3f6",primary:datalayerColors.greenBrand,secondary:datalayerColors.greenText,accent:datalayerColors.greenBright,glow:dlBrightLight.glow,pop:dlBrightLight.pop,spark:dlBrightLight.spark,blaze:dlBrightLight.blaze,surge:dlBrightLight.surge,flame:dlBrightLight.flame,gold:dlBrightLight.gold,textLight:"#1f2328",textMuted:"#656d76",isLight:!0},dark:{bg:"#0d1117",bgPanel:"#161b22",bgAlt:"#1c2128",primary:datalayerColors.greenAccent,secondary:datalayerColors.greenBrand,accent:datalayerColors.greenBright,glow:dlBrightDark.glow,pop:dlBrightDark.pop,spark:dlBrightDark.spark,blaze:dlBrightDark.blaze,surge:dlBrightDark.surge,flame:dlBrightDark.flame,gold:dlBrightDark.gold,textLight:"#f0f6fc",textMuted:"#8b949e",isLight:!1}},spatial:{light:{bg:"#f0f2ff",bgPanel:"#ffffff",bgAlt:"#eef2ff",primary:spatialColors.indigoBrand,secondary:spatialColors.indigoText,accent:spatialColors.indigoBright,glow:spBrightLight.glow,pop:spBrightLight.pop,spark:spBrightLight.spark,blaze:spBrightLight.blaze,surge:spBrightLight.surge,flame:spBrightLight.flame,gold:spBrightLight.gold,textLight:"#1E1E3F",textMuted:spatialColors.gray,isLight:!0},dark:{bg:spatialColors.black,bgPanel:"#111827",bgAlt:"#1E293B",primary:spatialColors.indigoAccent,secondary:spatialColors.indigoBrand,accent:spatialColors.indigoBright,glow:spBrightDark.glow,pop:spBrightDark.pop,spark:spBrightDark.spark,blaze:spBrightDark.blaze,surge:spBrightDark.surge,flame:spBrightDark.flame,gold:spBrightDark.gold,textLight:"#E0E7FF",textMuted:"#94A3B8",isLight:!1}},lovely:{light:{bg:"#fff5f7",bgPanel:"#ffffff",bgAlt:lovelyColors.roseTint,primary:lovelyColors.roseBrand,secondary:lovelyColors.roseText,accent:lovelyColors.roseBright,glow:lvBrightLight.glow,pop:lvBrightLight.pop,spark:lvBrightLight.spark,blaze:lvBrightLight.blaze,surge:lvBrightLight.surge,flame:lvBrightLight.flame,gold:lvBrightLight.gold,textLight:"#2D1B28",textMuted:lovelyColors.gray,isLight:!0},dark:{bg:lovelyColors.black,bgPanel:"#250E1D",bgAlt:"#3D1530",primary:lovelyColors.roseAccent,secondary:lovelyColors.roseBrand,accent:lovelyColors.roseBright,glow:lvBrightDark.glow,pop:lvBrightDark.pop,spark:lvBrightDark.spark,blaze:lvBrightDark.blaze,surge:lvBrightDark.surge,flame:lvBrightDark.flame,gold:lvBrightDark.gold,textLight:"#FCE7F3",textMuted:"#D4A5BD",isLight:!1}},matrix:{light:{bg:"#f0fff0",bgPanel:"#ffffff",bgAlt:matrixColors.greenTint,primary:matrixColors.greenBrand,secondary:matrixColors.greenText,accent:matrixColors.greenAccent,glow:mxBrightLight.glow,pop:mxBrightLight.pop,spark:mxBrightLight.spark,blaze:mxBrightLight.blaze,surge:mxBrightLight.surge,flame:mxBrightLight.flame,gold:mxBrightLight.gold,textLight:"#0A2E1A",textMuted:matrixColors.gray,isLight:!0},dark:{bg:matrixColors.black,bgPanel:"#0A1F0A",bgAlt:"#122812",primary:matrixColors.greenPhosphor,secondary:matrixColors.greenGlow,accent:matrixColors.greenGlow,glow:mxBrightDark.glow,pop:mxBrightDark.pop,spark:mxBrightDark.spark,blaze:mxBrightDark.blaze,surge:mxBrightDark.surge,flame:mxBrightDark.flame,gold:mxBrightDark.gold,textLight:"#C8E6C9",textMuted:"#66BB6A",isLight:!1}},earth:{light:{bg:"#F0F5FA",bgPanel:"#ffffff",bgAlt:earthColors.oceanTint,primary:earthColors.oceanBrand,secondary:earthColors.oceanText,accent:earthColors.oceanAccent,glow:eaBrightLight.glow,pop:eaBrightLight.pop,spark:eaBrightLight.spark,blaze:eaBrightLight.blaze,surge:eaBrightLight.surge,flame:eaBrightLight.flame,gold:eaBrightLight.gold,textLight:"#1A2332",textMuted:earthColors.gray,isLight:!0},dark:{bg:earthColors.black,bgPanel:"#0E1D30",bgAlt:"#132840",primary:earthColors.oceanAccent,secondary:earthColors.oceanBrand,accent:earthColors.oceanBright,glow:eaBrightDark.glow,pop:eaBrightDark.pop,spark:eaBrightDark.spark,blaze:eaBrightDark.blaze,surge:eaBrightDark.surge,flame:eaBrightDark.flame,gold:eaBrightDark.gold,textLight:"#D4E4DC",textMuted:"#8A9BA8",isLight:!1}},sand:{light:{bg:"#FBF7EF",bgPanel:"#ffffff",bgAlt:sandColors.sandTint,primary:sandColors.sandBrand,secondary:sandColors.sandText,accent:sandColors.sandAccent,glow:saBrightLight.glow,pop:saBrightLight.pop,spark:saBrightLight.spark,blaze:saBrightLight.blaze,surge:saBrightLight.surge,flame:saBrightLight.flame,gold:saBrightLight.gold,textLight:"#2B2118",textMuted:sandColors.gray,isLight:!0},dark:{bg:sandColors.black,bgPanel:"#2A2118",bgAlt:"#33281A",primary:sandColors.sandAccent,secondary:sandColors.sandBrand,accent:sandColors.sandBright,glow:saBrightDark.glow,pop:saBrightDark.pop,spark:saBrightDark.spark,blaze:saBrightDark.blaze,surge:saBrightDark.surge,flame:saBrightDark.flame,gold:saBrightDark.gold,textLight:"#EDE3D3",textMuted:"#B7A793",isLight:!1}},ivory:{light:{bg:"#FBF6EC",bgPanel:"#ffffff",bgAlt:ivoryColors.ivoryTint,primary:ivoryColors.ivoryBrand,secondary:ivoryColors.ivoryText,accent:ivoryColors.ivoryAccent,glow:ivBrightLight.glow,pop:ivBrightLight.pop,spark:ivBrightLight.spark,blaze:ivBrightLight.blaze,surge:ivBrightLight.surge,flame:ivBrightLight.flame,gold:ivBrightLight.gold,textLight:"#2C2318",textMuted:ivoryColors.gray,isLight:!0},dark:{bg:ivoryColors.black,bgPanel:"#2A2219",bgAlt:"#33291B",primary:ivoryColors.ivoryAccent,secondary:ivoryColors.ivoryBrand,accent:ivoryColors.ivoryBright,glow:ivBrightDark.glow,pop:ivBrightDark.pop,spark:ivBrightDark.spark,blaze:ivBrightDark.blaze,surge:ivBrightDark.surge,flame:ivBrightDark.flame,gold:ivBrightDark.gold,textLight:"#EFE6D6",textMuted:"#BBAC97",isLight:!1}},sun:{light:{bg:"#FFF9EC",bgPanel:"#ffffff",bgAlt:sunColors.sunTint,primary:sunColors.sunBrand,secondary:sunColors.sunText,accent:sunColors.sunAccent,glow:suBrightLight.glow,pop:suBrightLight.pop,spark:suBrightLight.spark,blaze:suBrightLight.blaze,surge:suBrightLight.surge,flame:suBrightLight.flame,gold:suBrightLight.gold,textLight:"#2A2210",textMuted:sunColors.gray,isLight:!0},dark:{bg:sunColors.black,bgPanel:"#2A2109",bgAlt:"#33290C",primary:sunColors.sunAccent,secondary:sunColors.sunBrand,accent:sunColors.sunBright,glow:suBrightDark.glow,pop:suBrightDark.pop,spark:suBrightDark.spark,blaze:suBrightDark.blaze,surge:suBrightDark.surge,flame:suBrightDark.flame,gold:suBrightDark.gold,textLight:"#F3E9CF",textMuted:"#BEAC82",isLight:!1}},loop:{light:{bg:loopColors.white,bgPanel:"#ffffff",bgAlt:loopColors.subtle,primary:loopColors.loopBrand,secondary:loopColors.loopText,accent:loopColors.loopAccent,glow:loBrightLight.glow,pop:loBrightLight.pop,spark:loBrightLight.spark,blaze:loBrightLight.blaze,surge:loBrightLight.surge,flame:loBrightLight.flame,gold:loBrightLight.gold,textLight:loopColors.ink,textMuted:loopColors.gray,isLight:!0},dark:{bg:loopColors.black,bgPanel:"#19191B",bgAlt:loopColors.subtleDark,primary:loopColors.loopBrand,secondary:loopColors.loopBright,accent:loopColors.loopAccent,glow:loBrightDark.glow,pop:loBrightDark.pop,spark:loBrightDark.spark,blaze:loBrightDark.blaze,surge:loBrightDark.surge,flame:loBrightDark.flame,gold:loBrightDark.gold,textLight:loopColors.inkDark,textMuted:loopColors.grayDark,isLight:!1}}};function getColorPalette(Au="datalayer",lo="auto"){const $u=lo==="auto"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":lo;return palettes[Au]?.[$u]??palettes.datalayer.dark}function useColorPalette(){const{colorMode:Au,theme:lo}=useThemeStore();return getColorPalette(lo,Au)}const SHEET_SHADOW="0 1px 2px rgba(0,0,0,0.06), 0 24px 48px -28px rgba(0,0,0,0.35)";function Sheet(Au){return jsxRuntimeExports.jsx(Box,{bg:"canvas.default",border:"1px solid",borderColor:"border.default",borderRadius:"card",boxShadow:SHEET_SHADOW,...Au})}const sizeMap$3={small:16,medium:32,large:64};function _DlIconInverseColormode$3({mode:Au,children:lo}){const $u=reactExports.useRef(null),[Ru,Iu]=reactExports.useState({mode:typeof Au=="string"?Au:null,lightTheme:null,darkTheme:null});return reactExports.useLayoutEffect(()=>{if(typeof document>"u")return;let Ou=null,Pu=null,Du=null,Lu=$u.current&&$u.current.parentElement;for(;Lu&&(!Ou||!Pu||!Du);)Lu.getAttribute&&(Ou=Ou||Lu.getAttribute("data-color-mode"),Pu=Pu||Lu.getAttribute("data-light-theme"),Du=Du||Lu.getAttribute("data-dark-theme")),Lu=Lu.parentElement;(!Ou||Ou==="auto")&&(Ou=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Iu({mode:typeof Au=="string"?Au:Ou==="dark"?"light":"dark",lightTheme:Pu,darkTheme:Du})},[Au]),reactExports.createElement("span",{ref:$u,"data-color-mode":Ru.mode||"light","data-light-theme":Ru.lightTheme||void 0,"data-dark-theme":Ru.darkTheme||void 0,style:{display:"inline-flex",lineHeight:0,color:"var(--fgColor-default, var(--color-fg-default, currentColor))"}},lo)}function AiAgentIcon({title:Au,titleId:lo,size:$u,colored:Ru,themed:Iu,colormode:Ou,...Pu},Du){const Lu=reactExports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:Iu?"var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor))":"var(--datalayer-icon-color, currentColor)",width:$u?typeof $u=="string"?sizeMap$3[$u]:$u:"16px","aria-hidden":"true",ref:Du,"aria-labelledby":lo},Pu,{"data-datalayer-icon":"",style:Pu&&Pu.color!=null?Object.assign({},Pu.style,{"--datalayer-icon-color":Pu.color,color:Pu.color}):Pu&&Pu.style}),reactExports.createElement("style",null,'[data-color-mode="light"]{--datalayer-icon-color-scheme:light}[data-color-mode="dark"]{--datalayer-icon-color-scheme:dark}svg[data-datalayer-icon]{color-scheme:var(--datalayer-icon-color-scheme, light dark)}'),Au?reactExports.createElement("title",{id:lo},Au):null,reactExports.createElement("path",{d:"M5.75 7.5a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5a.75.75 0 01.75-.75zm5.25.75a.75.75 0 00-1.5 0v1.5a.75.75 0 001.5 0v-1.5z"}),reactExports.createElement("path",{d:"M6.25 0h2A.75.75 0 019 .75V3.5h3.25a2.25 2.25 0 012.25 2.25V8h.75a.75.75 0 010 1.5h-.75v2.75a2.25 2.25 0 01-2.25 2.25h-8.5a2.25 2.25 0 01-2.25-2.25V9.5H.75a.75.75 0 010-1.5h.75V5.75A2.25 2.25 0 013.75 3.5H7.5v-2H6.25a.75.75 0 010-1.5zM3 5.75v6.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-6.5a.75.75 0 00-.75-.75h-8.5a.75.75 0 00-.75.75z"}));return Ou?reactExports.createElement(_DlIconInverseColormode$3,{mode:typeof Ou=="string"?Ou:void 0},Lu):Lu}const ForwardRef$3=reactExports.forwardRef(AiAgentIcon),sizeMap$2={small:16,medium:32,large:64};function _DlIconInverseColormode$2({mode:Au,children:lo}){const $u=reactExports.useRef(null),[Ru,Iu]=reactExports.useState({mode:typeof Au=="string"?Au:null,lightTheme:null,darkTheme:null});return reactExports.useLayoutEffect(()=>{if(typeof document>"u")return;let Ou=null,Pu=null,Du=null,Lu=$u.current&&$u.current.parentElement;for(;Lu&&(!Ou||!Pu||!Du);)Lu.getAttribute&&(Ou=Ou||Lu.getAttribute("data-color-mode"),Pu=Pu||Lu.getAttribute("data-light-theme"),Du=Du||Lu.getAttribute("data-dark-theme")),Lu=Lu.parentElement;(!Ou||Ou==="auto")&&(Ou=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Iu({mode:typeof Au=="string"?Au:Ou==="dark"?"light":"dark",lightTheme:Pu,darkTheme:Du})},[Au]),reactExports.createElement("span",{ref:$u,"data-color-mode":Ru.mode||"light","data-light-theme":Ru.lightTheme||void 0,"data-dark-theme":Ru.darkTheme||void 0,style:{display:"inline-flex",lineHeight:0,color:"var(--fgColor-default, var(--color-fg-default, currentColor))"}},lo)}function MicrophoneIcon({title:Au,titleId:lo,size:$u,colored:Ru,themed:Iu,colormode:Ou,...Pu},Du){const Lu=reactExports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 72 72",fill:Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 72%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 62%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 72%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 62%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 72%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",width:$u?typeof $u=="string"?sizeMap$2[$u]:$u:"16px","aria-hidden":"true",ref:Du,"aria-labelledby":lo},Pu,{"data-datalayer-icon":"",style:Pu&&Pu.color!=null?Object.assign({},Pu.style,{"--datalayer-icon-color":Pu.color,color:Pu.color}):Pu&&Pu.style}),reactExports.createElement("style",null,'[data-color-mode="light"]{--datalayer-icon-color-scheme:light}[data-color-mode="dark"]{--datalayer-icon-color-scheme:dark}svg[data-datalayer-icon]{color-scheme:var(--datalayer-icon-color-scheme, light dark)}'),Au?reactExports.createElement("title",{id:lo},Au):null,reactExports.createElement("path",{fill:Ru?"#3F3F3F":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 41%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 93%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 41%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 93%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 41%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",d:"M39.4 29.52c-2.636-2.216-2.553-3.52-2.55-3.523-.109-.127-1.758-1.676-1.777-2.156l-.009-.082-2.556 3.283c.324-.446-6.322 10.406-6.322 10.406L14.393 53.686l3.373 3.372S42.18 35.781 41.828 36.161l3.403-3.356c-.107.004-3.193-1.068-5.83-3.284z"}),reactExports.createElement("path",{fill:Ru?"#D0CFCE":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 71%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 63%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 71%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 63%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 71%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",d:"M54.62 30.18a.998.998 0 01-1.411.093l-16.62-14.58a1 1 0 01-.099-1.4c-.003.003-.007.004-.01.008l-.654.786a1 1 0 00.11 1.391L52.554 31.06a1 1 0 001.427-.113l.655-.787c.04-.047.055-.105.084-.157-.033.06-.054.123-.1.177z"}),reactExports.createElement("path",{fill:Ru?"#3F3F3F":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 41%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 93%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 41%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 93%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 41%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",d:"M55.258 25.541c-1.162 3.4-5.283 5.562-5.283 5.562-1.926 1.097-4.032 1.62-6.038 1.52 0 0-.347-.081-.913-.272-1.828-.634-5.85-2.485-7.25-6.88-.377-2.002-.159-4.185.646-6.277 1.023-4.264 4.995-6.256 4.995-6.256 1.41-.956 2.94-1.59 4.479-1.871 2.82-.533 5.66.08 7.775 1.972 3.327 2.947 3.844 8.086 1.59 12.502z"}),reactExports.createElement("path",{fill:Ru?"#9B9B9A":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 55%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 79%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 55%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 79%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 55%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",d:"M51.475 25.541c-1.172 3.4-5.283 5.562-5.283 5.562a12.08 12.08 0 01-3.168 1.247c-1.828-.633-5.85-2.484-7.25-6.88-.377-2.001-.159-4.184.646-6.276 1.022-4.264 4.995-6.256 4.995-6.256 1.41-.956 2.94-1.59 4.479-1.871 1.46.292 2.83.946 3.992 1.972 3.317 2.947 3.833 8.086 1.589 12.502z"}),reactExports.createElement("path",{d:"M30.75 38.941l4.02-4.619m14.744-3.892c-1.804 1.014-3.774 1.495-5.65 1.404m-2.36-18.184c3.737-2.497 8.405-2.591 11.465.093 3.108 2.727 3.59 7.471 1.489 11.545m-18.223-.065c-.354-1.844-.152-3.862.602-5.789m-3.52 8.196L14.393 53.686l3.373 3.373 23.34-21.572M15.497 56.001l-3.046 3.074m41.417-29.554L37.249 14.94",fill:"none",stroke:Ru?"#000":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 38%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 96%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 38%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 96%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 38%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,strokeWidth:2}));return Ou?reactExports.createElement(_DlIconInverseColormode$2,{mode:typeof Ou=="string"?Ou:void 0},Lu):Lu}const ForwardRef$2=reactExports.forwardRef(MicrophoneIcon),sizeMap$1={small:16,medium:32,large:64};function _DlIconInverseColormode$1({mode:Au,children:lo}){const $u=reactExports.useRef(null),[Ru,Iu]=reactExports.useState({mode:typeof Au=="string"?Au:null,lightTheme:null,darkTheme:null});return reactExports.useLayoutEffect(()=>{if(typeof document>"u")return;let Ou=null,Pu=null,Du=null,Lu=$u.current&&$u.current.parentElement;for(;Lu&&(!Ou||!Pu||!Du);)Lu.getAttribute&&(Ou=Ou||Lu.getAttribute("data-color-mode"),Pu=Pu||Lu.getAttribute("data-light-theme"),Du=Du||Lu.getAttribute("data-dark-theme")),Lu=Lu.parentElement;(!Ou||Ou==="auto")&&(Ou=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Iu({mode:typeof Au=="string"?Au:Ou==="dark"?"light":"dark",lightTheme:Pu,darkTheme:Du})},[Au]),reactExports.createElement("span",{ref:$u,"data-color-mode":Ru.mode||"light","data-light-theme":Ru.lightTheme||void 0,"data-dark-theme":Ru.darkTheme||void 0,style:{display:"inline-flex",lineHeight:0,color:"var(--fgColor-default, var(--color-fg-default, currentColor))"}},lo)}function PlusCircleIcon({title:Au,titleId:lo,size:$u,colored:Ru,themed:Iu,colormode:Ou,...Pu},Du){const Lu=reactExports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",width:$u?typeof $u=="string"?sizeMap$1[$u]:$u:"16px",viewBox:"0 0 24 24",fill:Iu?"var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor))":"var(--datalayer-icon-color, currentColor)","aria-hidden":"true",ref:Du,"aria-labelledby":lo},Pu,{"data-datalayer-icon":"",style:Pu&&Pu.color!=null?Object.assign({},Pu.style,{"--datalayer-icon-color":Pu.color,color:Pu.color}):Pu&&Pu.style}),reactExports.createElement("style",null,'[data-color-mode="light"]{--datalayer-icon-color-scheme:light}[data-color-mode="dark"]{--datalayer-icon-color-scheme:dark}svg[data-datalayer-icon]{color-scheme:var(--datalayer-icon-color-scheme, light dark)}'),Au?reactExports.createElement("title",{id:lo},Au):null,reactExports.createElement("path",{d:"M11.5 0C17.847 0 23 5.153 23 11.5S17.847 23 11.5 23 0 17.847 0 11.5 5.153 0 11.5 0zm0 1C17.295 1 22 5.705 22 11.5S17.295 22 11.5 22 1 17.295 1 11.5 5.705 1 11.5 1zm.5 10h6v1h-6v6h-1v-6H5v-1h6V5h1v6z"}));return Ou?reactExports.createElement(_DlIconInverseColormode$1,{mode:typeof Ou=="string"?Ou:void 0},Lu):Lu}const ForwardRef$1=reactExports.forwardRef(PlusCircleIcon),sizeMap={small:16,medium:32,large:64};function _DlIconInverseColormode({mode:Au,children:lo}){const $u=reactExports.useRef(null),[Ru,Iu]=reactExports.useState({mode:typeof Au=="string"?Au:null,lightTheme:null,darkTheme:null});return reactExports.useLayoutEffect(()=>{if(typeof document>"u")return;let Ou=null,Pu=null,Du=null,Lu=$u.current&&$u.current.parentElement;for(;Lu&&(!Ou||!Pu||!Du);)Lu.getAttribute&&(Ou=Ou||Lu.getAttribute("data-color-mode"),Pu=Pu||Lu.getAttribute("data-light-theme"),Du=Du||Lu.getAttribute("data-dark-theme")),Lu=Lu.parentElement;(!Ou||Ou==="auto")&&(Ou=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Iu({mode:typeof Au=="string"?Au:Ou==="dark"?"light":"dark",lightTheme:Pu,darkTheme:Du})},[Au]),reactExports.createElement("span",{ref:$u,"data-color-mode":Ru.mode||"light","data-light-theme":Ru.lightTheme||void 0,"data-dark-theme":Ru.darkTheme||void 0,style:{display:"inline-flex",lineHeight:0,color:"var(--fgColor-default, var(--color-fg-default, currentColor))"}},lo)}function RestartIcon({title:Au,titleId:lo,size:$u,colored:Ru,themed:Iu,colormode:Ou,...Pu},Du){const Lu=reactExports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Iu?"var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor))":"var(--datalayer-icon-color, currentColor)",width:$u?typeof $u=="string"?sizeMap[$u]:$u:"16px","aria-hidden":"true",ref:Du,"aria-labelledby":lo},Pu,{"data-datalayer-icon":"",style:Pu&&Pu.color!=null?Object.assign({},Pu.style,{"--datalayer-icon-color":Pu.color,color:Pu.color}):Pu&&Pu.style}),reactExports.createElement("style",null,'[data-color-mode="light"]{--datalayer-icon-color-scheme:light}[data-color-mode="dark"]{--datalayer-icon-color-scheme:dark}svg[data-datalayer-icon]{color-scheme:var(--datalayer-icon-color-scheme, light dark)}'),Au?reactExports.createElement("title",{id:lo},Au):null,reactExports.createElement("path",{fillRule:"evenodd",d:"M18.364 3.058a.75.75 0 01.75.75V8.05a.75.75 0 01-.75.75h-4.243a.75.75 0 010-1.5h2.36a7.251 7.251 0 102.523 3.822.75.75 0 111.45-.387 8.75 8.75 0 11-2.84-4.447v-2.48a.75.75 0 01.75-.75z",clipRule:"evenodd"}));return Ou?reactExports.createElement(_DlIconInverseColormode,{mode:typeof Ou=="string"?Ou:void 0},Lu):Lu}const ForwardRef=reactExports.forwardRef(RestartIcon),__vite_import_meta_env__$2={},createStoreImpl$1=Au=>{let lo;const $u=new Set,Ru=(Bu,Fu)=>{const zu=typeof Bu=="function"?Bu(lo):Bu;if(!Object.is(zu,lo)){const qu=lo;lo=Fu??(typeof zu!="object"||zu===null)?zu:Object.assign({},lo,zu),$u.forEach(Uu=>Uu(lo,qu))}},Iu=()=>lo,Lu={setState:Ru,getState:Iu,getInitialState:()=>ju,subscribe:Bu=>($u.add(Bu),()=>$u.delete(Bu)),destroy:()=>{(__vite_import_meta_env__$2?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),$u.clear()}},ju=lo=Au(Ru,Iu,Lu);return Lu},createStore$1=Au=>Au?createStoreImpl$1(Au):createStoreImpl$1;var withSelector={exports:{}},withSelector_production={},shim={exports:{}},useSyncExternalStoreShim_production={};var hasRequiredUseSyncExternalStoreShim_production;function requireUseSyncExternalStoreShim_production(){if(hasRequiredUseSyncExternalStoreShim_production)return useSyncExternalStoreShim_production;hasRequiredUseSyncExternalStoreShim_production=1;var Au=requireReact();function lo(Fu,zu){return Fu===zu&&(Fu!==0||1/Fu===1/zu)||Fu!==Fu&&zu!==zu}var $u=typeof Object.is=="function"?Object.is:lo,Ru=Au.useState,Iu=Au.useEffect,Ou=Au.useLayoutEffect,Pu=Au.useDebugValue;function Du(Fu,zu){var qu=zu(),Uu=Ru({inst:{value:qu,getSnapshot:zu}}),Hu=Uu[0].inst,Vu=Uu[1];return Ou(function(){Hu.value=qu,Hu.getSnapshot=zu,Lu(Hu)&&Vu({inst:Hu})},[Fu,qu,zu]),Iu(function(){return Lu(Hu)&&Vu({inst:Hu}),Fu(function(){Lu(Hu)&&Vu({inst:Hu})})},[Fu]),Pu(qu),qu}function Lu(Fu){var zu=Fu.getSnapshot;Fu=Fu.value;try{var qu=zu();return!$u(Fu,qu)}catch{return!0}}function ju(Fu,zu){return zu()}var Bu=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ju:Du;return useSyncExternalStoreShim_production.useSyncExternalStore=Au.useSyncExternalStore!==void 0?Au.useSyncExternalStore:Bu,useSyncExternalStoreShim_production}var hasRequiredShim;function requireShim(){return hasRequiredShim||(hasRequiredShim=1,shim.exports=requireUseSyncExternalStoreShim_production()),shim.exports}var hasRequiredWithSelector_production;function requireWithSelector_production(){if(hasRequiredWithSelector_production)return withSelector_production;hasRequiredWithSelector_production=1;var Au=requireReact(),lo=requireShim();function $u(ju,Bu){return ju===Bu&&(ju!==0||1/ju===1/Bu)||ju!==ju&&Bu!==Bu}var Ru=typeof Object.is=="function"?Object.is:$u,Iu=lo.useSyncExternalStore,Ou=Au.useRef,Pu=Au.useEffect,Du=Au.useMemo,Lu=Au.useDebugValue;return withSelector_production.useSyncExternalStoreWithSelector=function(ju,Bu,Fu,zu,qu){var Uu=Ou(null);if(Uu.current===null){var Hu={hasValue:!1,value:null};Uu.current=Hu}else Hu=Uu.current;Uu=Du(function(){function Gu(ed){if(!Ku){if(Ku=!0,Zu=ed,ed=zu(ed),qu!==void 0&&Hu.hasValue){var Xu=Hu.value;if(qu(Xu,ed))return Qu=Xu}return Qu=ed}if(Xu=Qu,Ru(Zu,ed))return Xu;var rd=zu(ed);return qu!==void 0&&qu(Xu,rd)?(Zu=ed,Xu):(Zu=ed,Qu=rd)}var Ku=!1,Zu,Qu,Yu=Fu===void 0?null:Fu;return[function(){return Gu(Bu())},Yu===null?void 0:function(){return Gu(Yu())}]},[Bu,Fu,zu,qu]);var Vu=Iu(ju,Uu[0],Uu[1]);return Pu(function(){Hu.hasValue=!0,Hu.value=Vu},[Vu]),Lu(Vu),Vu},withSelector_production}var hasRequiredWithSelector;function requireWithSelector(){return hasRequiredWithSelector||(hasRequiredWithSelector=1,withSelector.exports=requireWithSelector_production()),withSelector.exports}var withSelectorExports=requireWithSelector();const useSyncExternalStoreExports=getDefaultExportFromCjs(withSelectorExports),__vite_import_meta_env__$1={},{useDebugValue}=vM,{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports;let didWarnAboutEqualityFn=!1;const identity$3=Au=>Au;function useStore$1(Au,lo=identity$3,$u){(__vite_import_meta_env__$1?"production":void 0)!=="production"&&$u&&!didWarnAboutEqualityFn&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),didWarnAboutEqualityFn=!0);const Ru=useSyncExternalStoreWithSelector(Au.subscribe,Au.getState,Au.getServerState||Au.getInitialState,lo,$u);return useDebugValue(Ru),Ru}const createImpl$1=Au=>{(__vite_import_meta_env__$1?"production":void 0)!=="production"&&typeof Au!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const lo=typeof Au=="function"?createStore$1(Au):Au,$u=(Ru,Iu)=>useStore$1(lo,Ru,Iu);return Object.assign($u,lo),$u},create$i=Au=>Au?createImpl$1(Au):createImpl$1,CONTROL_PLANE_URL="https://prod1.datalayer.run",RUNTIMES_PLANE_URL="https://r1.datalayer.run",MCP_SERVER_URL="https://mcp.datalayer.run/mcp",DEFAULT_PLANE_URLS={iamUrl:CONTROL_PLANE_URL,managerUrl:CONTROL_PLANE_URL,libraryUrl:CONTROL_PLANE_URL,spacerUrl:CONTROL_PLANE_URL,otelUrl:CONTROL_PLANE_URL,growthUrl:CONTROL_PLANE_URL,inboundsUrl:CONTROL_PLANE_URL,successUrl:CONTROL_PLANE_URL,supportUrl:CONTROL_PLANE_URL,contentsUrl:RUNTIMES_PLANE_URL,runtimesUrl:RUNTIMES_PLANE_URL,schedulerUrl:RUNTIMES_PLANE_URL,aiAgentsUrl:RUNTIMES_PLANE_URL,aiInferenceUrl:RUNTIMES_PLANE_URL,datalayerMcpServerUrl:MCP_SERVER_URL};class Logger{scope;isDevelopment;constructor(lo){this.scope=lo,this.isDevelopment=!1}log(lo,$u,...Ru){if(!this.isDevelopment&&lo==="debug")return;const Ou=`[${new Date().toISOString()}] [${this.scope}] [${lo.toUpperCase()}]`;switch(lo){case"debug":console.debug(Ou,$u,...Ru);break;case"info":console.info(Ou,$u,...Ru);break;case"warn":console.warn(Ou,$u,...Ru);break;case"error":console.error(Ou,$u,...Ru);break}}debug(lo,...$u){this.log("debug",lo,...$u)}info(lo,...$u){this.log("info",lo,...$u)}warn(lo,...$u){this.log("warn",lo,...$u)}error(lo,...$u){this.log("error",lo,...$u)}}function createLogger(Au){return new Logger(Au)}const configLogger=createLogger("config");let loadConfigurationFromServer=!0,initialConfiguration={token:"",credits:0,cpuEnvironment:'ai-agents-env"',gpuEnvironment:"ai-env",useMock:!1,whiteLabel:!0,loadConfigurationFromServer:!0,jupyterServerless:!1,...DEFAULT_PLANE_URLS,launcher:{category:"Datalayer",name:"Datalayer",icon:null,rank:1},brand:{name:"Datalayer",about:"AI Agents for Data Analysis",logoUrl:"https://assets.datalayer.tech/datalayer-25.svg",logoSquareUrl:"https://assets.datalayer.tech/datalayer-square.png",copyright:"© 2025 Datalayer, Inc",docsUrl:"https://datalayer.ai/docs",supportUrl:"https://datalayer.ai/support",termsUrl:"https://datalayer.ai/terms",pricingUrl:"https://datalayer.ai/pricing",privacyUrl:"https://datalayer.ai/privacy"}};const pageConfiguration={};try{if(typeof document<"u"){const Au=document.getElementById("datalayer-config-data");if(Au?.innerText){const lo=JSON.parse(Au?.innerText||"{}");Object.assign(pageConfiguration,lo),lo.loadConfigurationFromServer!=null&&(loadConfigurationFromServer=lo.loadConfigurationFromServer),initialConfiguration={...initialConfiguration,...lo},configLogger.info("Datalayer configuration loaded from HTML page",initialConfiguration),window.document.title=`${initialConfiguration.brand.name} ☰ ${initialConfiguration.brand.about}`}}}catch(Au){configLogger.debug("No valid configuration found in the webpage.",Au)}const coreStore=createStore$1((Au,lo)=>({tab:0,getIntTab:()=>Math.floor(lo().tab),setTab:$u=>Au(Ru=>({tab:$u})),configuration:initialConfiguration,setConfiguration:$u=>{configLogger.debug("Setting Datalayer configuration",$u),Au(Ru=>({configuration:{...Ru.configuration,...$u}}))},version:"",setVersion:$u=>{$u&&!lo().version&&Au(Ru=>({version:$u}))},loadConfigurationFromServer,setLoadConfigurationFromServer:$u=>{Au(Ru=>({loadConfigurationFromServer:$u}))}}));function useCoreStore(Au){return useStore$1(coreStore,Au)}const getOtelConsumeUrl=()=>coreStore.getState().configuration.otelUrl,BACKEND_TOOL_ACTIONS={"create-plan":["read"],"current-time":["read"],decide:["read"],"display-recipe":["read"],"example-create-plan":["read"],"example-current-time":["read"],"example-display-recipe":["read"],"example-generate-haiku":["read"],"example-generate-task-steps":["read"],"example-get-weather":["read"],"example-render-a2ui-surface":["read"],"example-update-plan-step":["read"],"generate-haiku":["read"],"generate-task-steps":["read"],"get-weather":["read"],"runtime-echo":["read"],"runtime-send-mail":["send"],"runtime-sensitive-echo":["read"],"update-plan-step":["read"]},SERVER_ACTIONS={alphavantage:{default:[],tools:{},conditions:{}},chart:{checked:"2026-10-02",default:[],tools:{generate_area_chart:["read"],generate_bar_chart:["read"],generate_boxplot_chart:["read"],generate_column_chart:["read"],generate_district_map:["read"],generate_dual_axes_chart:["read"],generate_fishbone_diagram:["read"],generate_flow_diagram:["read"],generate_funnel_chart:["read"],generate_histogram_chart:["read"],generate_line_chart:["read"],generate_liquid_chart:["read"],generate_mind_map:["read"],generate_network_graph:["read"],generate_organization_chart:["read"],generate_path_map:["read"],generate_pie_chart:["read"],generate_pin_map:["read"],generate_radar_chart:["read"],generate_sankey_chart:["read"],generate_scatter_chart:["read"],generate_treemap_chart:["read"],generate_venn_chart:["read"],generate_violin_chart:["read"],generate_waterfall_chart:["read"],generate_word_cloud_chart:["read"],generate_spreadsheet:["read"]},conditions:{}},datalayer:{checked:"2026-10-05",default:[],tools:{read_notebook:["read"],read_cell:["read"],download_notebook:["read"],list_notebooks:["read"],list_spaces:["read"],list_space_notebooks:["read"],find_notebook:["read"],list_notebook_versions:["read"],list_kernels:["read"],list_files:["read"],list_sandboxes:["read"],list_toolsets:["read"],search_library:["read"],get_library_artifact:["read"],read_library_artifact:["read"],search_earth_datasets:["read"],search_earth_datagranules:["read"],download_earth_data_granules:["read"],odoo_get_context:["read"],odoo_get_account:["read"],odoo_get_settings:["read"],odoo_list_companies:["read"],odoo_set_company:["write"],odoo_list_models:["read"],odoo_get_fields:["read"],odoo_search_records:["read"],odoo_read_records:["read"],odoo_group_records:["read"],odoo_create_record:["write"],odoo_update_records:["write"],odoo_delete_records:["delete"],odoo_accounting_list_invoices:["read"],odoo_accounting_get_invoice:["read"],odoo_accounting_list_journal_entries:["read"],odoo_accounting_list_open_balances:["read"],odoo_accounting_list_accounts:["read"],odoo_accounting_list_journals:["read"],odoo_accounting_get_journal_entry:["read"],odoo_accounting_trial_balance:["read"],odoo_accounting_general_ledger:["read"],odoo_winauditor_preview_balance:["read"],odoo_winauditor_preview_general_journal:["read"],odoo_winauditor_preview_general_ledger:["read"],odoo_accounting_create_draft_invoice:["write"],odoo_accounting_post_invoice:["write"],odoo_accounting_create_draft_journal_entry:["write"],odoo_accounting_post_journal_entry:["write"],odoo_winauditor_import_balance:["write"],odoo_winauditor_import_general_journal:["write"],odoo_winauditor_import_general_ledger:["write"],odoo_winauditor_preview_import_file:["read"],odoo_winauditor_migration_status:["read"],odoo_winauditor_import_partners:["write"],odoo_winauditor_import_chart_of_accounts:["write"],odoo_winauditor_ensure_journals:["write"],odoo_winauditor_import_journal_items:["write"],odoo_winauditor_post_migration_entries:["write"],odoo_winauditor_reconcile_journal_items:["write"],odoo_winauditor_import_assets:["write"],odoo_winauditor_validate_assets:["write"],odoo_winauditor_rollback_migration:["delete"],odoo_winauditor_attach_document:["write"],odoo_winauditor_list_attachments:["read"],odoo_winauditor_validate_migration:["read"],odoo_accounting_list_partners:["read"],odoo_accounting_partner_ledger:["read"],odoo_accounting_aged_balance:["read"],odoo_accounting_list_taxes:["read"],odoo_accounting_list_assets:["read"],odoo_accounting_get_asset:["read"],odoo_accounting_reconcile_lines:["write"],odoo_accounting_unreconcile_lines:["write"],odoo_accounting_bank_status:["read"],odoo_accounting_list_bank_lines:["read"],odoo_accounting_get_bank_line:["read"],odoo_accounting_suggest_bank_matches:["read"],odoo_accounting_suggest_reconciliations:["read"],odoo_accounting_explain_account_balance:["read"],odoo_accounting_list_bank_feeds:["read"],odoo_accounting_list_currency_rates:["read"],odoo_accounting_get_lock_dates:["read"],odoo_accounting_book_bank_line:["write"],odoo_accounting_match_bank_line:["write"],odoo_accounting_reset_bank_line:["write"],odoo_accounting_remove_duplicate_bank_lines:["delete"],odoo_accounting_link_bank_feed:["write"],odoo_accounting_create_vendor_bill:["write"],odoo_accounting_create_customer_invoice:["write"],odoo_accounting_set_currency_rates:["write"],odoo_accounting_set_lock_date:["write"],odoo_accounting_create_matching_model:["write"],odoo_accounting_get_tax_settings:["read"],odoo_accounting_list_tax_returns:["read"],odoo_accounting_get_tax_return:["read"],odoo_accounting_tax_grids:["read"],odoo_accounting_list_tax_grid_lines:["read"],odoo_accounting_check_tax_period:["read"],odoo_accounting_list_untagged_tax_lines:["read"],odoo_accounting_set_tax_periodicity:["write"],odoo_accounting_set_tax_grids:["write"],read_benchmark:["read"],read_benchmark_task:["read"],read_benchmark_task_trajectory:["read"],list_benchmark_task_files:["read"],list_content_sources:["read"],describe_content_source:["read"],list_content_attachments:["read"],list_dataset_revisions:["read"],query_status:["read"],list_secrets:["read"],use_notebook:["read"],unuse_notebook:["read"],connect_to_jupyter:["read"],insert_cell:["write"],delete_cell:["delete"],move_cell:["write"],edit_cell_source:["write"],snapshot_notebook:["write"],restore_notebook:["write"],overwrite_cell_source:["write"],clear_cell_output:["write"],execute_cell:["write"],execute_code:["write"],restart_notebook:["write"],insert_execute_code_cell:["write"],launch_sandbox:["buy"],use_sandbox:["write"],terminate_sandbox:["delete"],snapshot_sandbox:["write","buy"],share_sandbox:["publish"],unshare_sandbox:["write"],marimo_run_cell:["write"],marimo_run_code:["write"],marimo_remove_cell:["delete"],marimo_plan:["read"],marimo_graph:["read"],enable_toolset:["write"],disable_toolset:["write"],attach_content:["write"],detach_content:["write"],query_source:["read"],cancel_query:["write"],save_query_as_revision:["write"],mount_local_folder:["read"]},conditions:{}},earthdata:{checked:"2026-10-07",default:[],tools:{search_earth_datasets:["read"],search_earth_datagranules:["read"],download_earth_data_granules:["write"]},conditions:{}},eurus:{default:[],tools:{},conditions:{}},filesystem:{checked:"2026-10-02",default:[],tools:{read_file:["read"],read_text_file:["read"],read_media_file:["read"],read_multiple_files:["read"],write_file:["write"],edit_file:["write"],create_directory:["write"],list_directory:["read"],list_directory_with_sizes:["read"],directory_tree:["read"],move_file:["write","delete"],search_files:["read"],get_file_info:["read"],list_allowed_directories:["read"]},conditions:{}},github:{default:[],tools:{},conditions:{}},"google-workspace":{checked:"2026-10-02",default:[],tools:{start_google_auth:["write"],search_gmail_messages:["read"],get_gmail_message_content:["read"],get_gmail_messages_content_batch:["read"],get_gmail_attachment_content:["read","write"],send_gmail_message:["send"],draft_gmail_message:["write"],get_gmail_thread_content:["read"],get_gmail_threads_content_batch:["read"],list_gmail_labels:["read"],manage_gmail_label:["write"],list_gmail_filters:["read"],manage_gmail_filter:["write","send"],modify_gmail_message_labels:["write"],batch_modify_gmail_message_labels:["write"],search_drive_files:["read"],get_drive_file_content:["read"],get_drive_file_download_url:["read"],list_drive_items:["read"],create_drive_folder:["write"],create_drive_file:["write"],import_to_google_doc:["write"],import_to_google_slides:["write"],import_to_google_sheets:["write"],get_drive_file_permissions:["read"],check_drive_file_public_access:["read"],update_drive_file:["write"],get_drive_shareable_link:["read"],manage_drive_access:["publish","send","delete"],copy_drive_file:["write"],set_drive_file_permissions:["publish","write"],list_calendars:["read"],get_events:["read"],manage_event:["write","send"],manage_out_of_office:["write","send"],manage_focus_time:["write","send"],query_freebusy:["read"],create_calendar:["write"],search_docs:["read"],get_doc_content:["read"],list_docs_in_folder:["read"],create_doc:["write"],modify_doc_text:["write"],find_and_replace_doc:["write"],insert_doc_elements:["write"],insert_doc_image:["write"],update_doc_headers_footers:["write"],batch_update_doc:["write","delete"],inspect_doc_structure:["read"],debug_docs_runtime_info:["read"],create_table_with_data:["write"],debug_table_structure:["read"],export_doc_to_pdf:["write"],update_paragraph_style:["write"],get_doc_as_markdown:["read"],manage_doc_tab:["write"],list_document_comments:["read"],manage_document_comment:["write","send"],list_spreadsheets:["read"],get_spreadsheet_info:["read"],read_sheet_values:["read"],modify_sheet_values:["write"],format_sheet_range:["write"],manage_conditional_formatting:["write"],create_spreadsheet:["write"],create_sheet:["write"],list_sheet_tables:["read"],append_table_rows:["write"],manage_sheet_tab:["write"],resize_sheet_dimensions:["write","delete"],move_sheet_rows:["write","delete"],manage_named_range:["write"],list_spreadsheet_comments:["read"],manage_spreadsheet_comment:["write","send"],list_spaces:["read"],get_messages:["read"],send_message:["send","write"],search_messages:["read"],create_reaction:["send"],download_chat_attachment:["read","write"],create_form:["write"],get_form:["read"],set_publish_settings:["publish"],get_form_response:["read"],list_form_responses:["read"],batch_update_form:["write","delete"],create_presentation:["write"],get_presentation:["read"],batch_update_presentation:["write","delete"],get_page:["read"],get_page_thumbnail:["read"],list_presentation_comments:["read"],manage_presentation_comment:["write","send"],list_task_lists:["read"],get_task_list:["read"],manage_task_list:["write"],list_tasks:["read"],get_task:["read"],manage_task:["write"],list_contacts:["read"],get_contact:["read"],search_contacts:["read"],manage_contact:["write"],list_contact_groups:["read"],get_contact_group:["read"],manage_contacts_batch:["write"],manage_contact_group:["write"],search_custom:["read"],get_search_engine_info:["read"],get_script_project:["read"],manage_script_content:["write","delete"],run_script_function:["write","send","delete","publish"],manage_deployment:["publish"],list_script_deployments:["read"],manage_script_project:["write"],manage_script_version:["write"],get_script_version:["read"],get_script_activity:["read"],generate_trigger_code:["read"],manage_script_trigger:["write"]},conditions:{manage_gmail_label:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_gmail_filter:[{argument:"action",classes:["delete"],equals:["delete","update"]}],modify_gmail_message_labels:[{argument:"add_label_ids",classes:["delete"],includes:["TRASH","SPAM"]}],batch_modify_gmail_message_labels:[{argument:"add_label_ids",classes:["delete"],includes:["TRASH","SPAM"]}],update_drive_file:[{argument:"trashed",classes:["delete"],equals:[!0]}],manage_event:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_out_of_office:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_focus_time:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_doc_tab:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_conditional_formatting:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_sheet_tab:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_named_range:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_task_list:[{argument:"action",classes:["delete"],equals:["delete","clear_completed"]}],manage_task:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_contact:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_contacts_batch:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_contact_group:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_deployment:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_script_project:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_script_trigger:[{argument:"action",classes:["delete"],equals:["delete"]}]}},huggingface:{default:[],tools:{},conditions:{}},kaggle:{default:[],tools:{},conditions:{}},odoo:{default:[],tools:{},conditions:{}},"odoo-accounting":{checked:"2026-10-05",default:[],tools:{odoo_accounting_list_invoices:["read"],odoo_accounting_get_invoice:["read"],odoo_accounting_list_journal_entries:["read"],odoo_accounting_list_open_balances:["read"],odoo_accounting_list_accounts:["read"],odoo_accounting_list_journals:["read"],odoo_accounting_get_journal_entry:["read"],odoo_accounting_trial_balance:["read"],odoo_accounting_general_ledger:["read"],odoo_accounting_create_draft_invoice:["write"],odoo_accounting_post_invoice:["write"],odoo_accounting_create_draft_journal_entry:["write"],odoo_accounting_post_journal_entry:["write"],odoo_accounting_list_partners:["read"],odoo_accounting_partner_ledger:["read"],odoo_accounting_aged_balance:["read"],odoo_accounting_list_taxes:["read"],odoo_accounting_list_assets:["read"],odoo_accounting_get_asset:["read"],odoo_accounting_reconcile_lines:["write"],odoo_accounting_unreconcile_lines:["write"],odoo_accounting_bank_status:["read"],odoo_accounting_list_bank_lines:["read"],odoo_accounting_get_bank_line:["read"],odoo_accounting_suggest_bank_matches:["read"],odoo_accounting_suggest_reconciliations:["read"],odoo_accounting_explain_account_balance:["read"],odoo_accounting_list_bank_feeds:["read"],odoo_accounting_list_currency_rates:["read"],odoo_accounting_get_lock_dates:["read"],odoo_accounting_book_bank_line:["write"],odoo_accounting_match_bank_line:["write"],odoo_accounting_reset_bank_line:["write"],odoo_accounting_remove_duplicate_bank_lines:["delete"],odoo_accounting_link_bank_feed:["write"],odoo_accounting_create_vendor_bill:["write"],odoo_accounting_create_customer_invoice:["write"],odoo_accounting_set_currency_rates:["write"],odoo_accounting_set_lock_date:["write"],odoo_accounting_create_matching_model:["write"],odoo_accounting_get_tax_settings:["read"],odoo_accounting_list_tax_returns:["read"],odoo_accounting_get_tax_return:["read"],odoo_accounting_tax_grids:["read"],odoo_accounting_list_tax_grid_lines:["read"],odoo_accounting_check_tax_period:["read"],odoo_accounting_list_untagged_tax_lines:["read"],odoo_accounting_set_tax_periodicity:["write"],odoo_accounting_set_tax_grids:["write"]},conditions:{}},salesforce:{default:[],tools:{},conditions:{}},slack:{checked:"2026-10-02",default:[],tools:{slack_list_channels:["read"],slack_post_message:["send"],slack_reply_to_thread:["send"],slack_add_reaction:["send"],slack_get_channel_history:["read"],slack_get_thread_replies:["read"],slack_get_users:["read"],slack_get_user_profile:["read"]},conditions:{}},tavily:{checked:"2026-10-02",default:[],tools:{tavily_search:["read"],tavily_extract:["read"],tavily_crawl:["read"],tavily_map:["read"],tavily_research:["read"]},conditions:{}}},BEHAVIOURS=["do_it","if_asked","ask_first","leave_to_me"],DEFAULT_BEHAVIOURS={read:"do_it",write:"ask_first",send:"ask_first",buy:"ask_first",delete:"ask_first",publish:"ask_first"},SERVER_TOOL=/^([A-Za-z0-9_-]+)(?::\d+(?:\.\d+)*)?\.([A-Za-z_][A-Za-z0-9_-]*)$/,own$a=(Au,lo)=>Object.prototype.hasOwnProperty.call(Au,lo)?Au[lo]:void 0,idOf=Au=>{const lo=Au.lastIndexOf(":");return lo>0&&Au.slice(lo+1).includes(".")?Au.slice(0,lo):Au};function splitRef(Au){const lo=SERVER_TOOL.exec(Au);return lo?[lo[1],lo[2]]:[void 0,idOf(Au)]}const isPattern=Au=>/[*?]/.test(Au);function matchesPattern(Au,lo){const $u=Array.from(lo,Ru=>Ru==="*"?"[\\s\\S]*":Ru==="?"?"[\\s\\S]":Ru.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("");return new RegExp(`^${$u}$`).test(Au)}const isComparable=Au=>typeof Au=="string"||typeof Au=="boolean"||typeof Au=="number"&&Number.isFinite(Au)&&(!Number.isInteger(Au)||Number.isSafeInteger(Au)),same=(Au,lo)=>typeof Au=="string"&&typeof lo=="string"?Au.trim().toLowerCase()===lo.trim().toLowerCase():isComparable(Au)&&isComparable(lo)&&Au===lo;function conditionHolds(Au,lo){if(!Object.prototype.hasOwnProperty.call(lo,Au.argument))return!1;const $u=lo[Au.argument];return Au.equals?.some(Ru=>same($u,Ru))?!0:Au.includes?.length?(Array.isArray($u)?$u:[$u]).some(Iu=>Au.includes.some(Ou=>same(Iu,Ou))):!1}function entryOf$1(Au,lo){const $u=own$a(SERVER_ACTIONS,Au);if(!$u)return[[],[]];const Ru=own$a($u.tools,lo);if(Ru)return[[...Ru],own$a($u.conditions,lo)??[]];for(const[Iu,Ou]of Object.entries($u.tools))if(isPattern(Iu)&&matchesPattern(lo,Iu))return[[...Ou],own$a($u.conditions,Iu)??[]];return[[...$u.default],[]]}const FORWARDING={"google-workspace.send_gmail_message":{message:"forward_message_id",mailbox:"user_google_email",recipients:["to","cc","bcc"]}};function addresses(Au){return(Array.isArray(Au)?Au:[Au]).filter($u=>typeof $u=="string").flatMap($u=>$u.split(",")).map($u=>{const Ru=/<([^>]*)>/.exec($u);return(Ru?Ru[1]:$u).trim().toLowerCase()}).filter($u=>$u.includes("@"))}const domainOf=Au=>Au.slice(Au.lastIndexOf("@")+1).trim();function forwardsOutside(Au,lo,$u){const Ru=own$a(FORWARDING,`${Au}.${lo}`),Iu=Ru?$u[Ru.message]:void 0;if(!Ru||typeof Iu!="string"||!Iu.trim())return!1;const[Ou]=addresses($u[Ru.mailbox]);return Ou?Ru.recipients.flatMap(Pu=>addresses($u[Pu])).some(Pu=>domainOf(Pu)!==domainOf(Ou)):!0}function classesOf(Au,lo){const[$u,Ru]=splitRef(Au);if($u===void 0)return[...own$a(BACKEND_TOOL_ACTIONS,Ru)??[]];const[Iu,Ou]=entryOf$1($u,Ru);for(const Pu of Ou)if(lo===void 0||conditionHolds(Pu,lo))for(const Du of Pu.classes)Iu.includes(Du)||Iu.push(Du);return lo!==void 0&&Iu.length>0&&!Iu.includes("publish")&&forwardsOutside($u,Ru,lo)&&Iu.push("publish"),Iu}const strictest=Au=>Au.reduce((lo,$u)=>BEHAVIOURS.indexOf($u)>BEHAVIOURS.indexOf(lo)?$u:lo),connectionTo=(Au,lo)=>Au.connections.find($u=>idOf($u.server)===lo),reaches=(Au,lo)=>Au.only.length===0||Au.only.some($u=>matchesPattern(lo,$u)),isClass$1=Au=>Object.prototype.hasOwnProperty.call(DEFAULT_BEHAVIOURS,Au),normal=Au=>{if(isClass$1(Au))return Au;const[lo,$u]=splitRef(Au);return lo!==void 0?`${lo}.${$u}`:$u},byClasses=(Au,lo)=>{const $u={};for(const Ru of Au.rules)for(const Iu of Ru.appliesTo)isClass$1(Iu)&&($u[Iu]=Ru.behaviour);return lo.map(Ru=>$u[Ru]??DEFAULT_BEHAVIOURS[Ru])};function behaviourFor(Au,lo,$u={}){const[Ru,Iu]=splitRef(lo);let Ou,Pu=[],Du;if($u.classes?Ou=Du=[...$u.classes]:(Du=classesOf(lo),Ou=classesOf(lo,{}),Pu=($u.arguments===void 0?Du:classesOf(lo,$u.arguments)).filter(Bu=>!Ou.includes(Bu))),Ru!==void 0){const ju=connectionTo(Au,Ru);if(!ju||!reaches(ju,Iu)||ju.access==="read"&&Du.some(Bu=>Bu!=="read"))return"leave_to_me"}const Lu=Ru!==void 0?`${Ru}.${Iu}`:Iu;for(const ju of Au.rules)if(ju.appliesTo.some(Bu=>!isClass$1(Bu)&&normal(Bu)===Lu))return strictest([ju.behaviour,...byClasses(Au,Pu)]);return Ou.length===0&&Pu.length===0?"leave_to_me":strictest(byClasses(Au,[...Ou,...Pu]))}const BEHAVIOUR_WORDS={do_it:{says:"Do it",means:"It does it without asking."},if_asked:{says:"Do it if I asked",means:"Only what you approved in advance."},ask_first:{says:"Ask me first",means:"It waits for your yes."},leave_to_me:{says:"Leave it to me",means:"It never does it, and hands it to you."}},ACTION_WORDS={read:"Read",write:"Create or change",send:"Send",buy:"Buy",delete:"Delete",publish:"Share or publish"};function coverOf(Au){const lo=own$a(ACTION_WORDS,Au);if(lo)return lo;const[$u,Ru]=splitRef(Au);return $u?`${Ru} (${$u})`:Ru}const DEFAULT_UPLOAD_MB=10,DEFAULT_MAX_FILES=5;function kindTakes(Au,lo){const $u=Au.trim().toLowerCase();if($u.startsWith("."))return lo.name.toLowerCase().endsWith($u);const Ru=(lo.type||"").split(";",1)[0].trim().toLowerCase();return $u.endsWith("/*")?Ru.startsWith($u.slice(0,-1)):Ru===$u}const acceptsFile=(Au,lo)=>!Au?.length||Au.some($u=>kindTakes($u,lo)),megabytes=Au=>`${(Au/(1024*1024)).toFixed(1)} MB`,uploadsAccept=Au=>Au.kinds.map(lo=>lo.type).join(",");function uploadsRefusal(Au,lo){if(lo.length===0)return null;const $u=Au.interface.uploads;if(!$u)return`${Au.name} takes no file sent with a message: its Appspec names none it takes (interface.uploads).`;if(lo.length>$u.maxFiles)return`${lo.length} files were sent at once: ${Au.name} takes at most ${$u.maxFiles}.`;for(const Ru of lo){const Iu=$u.kinds.find(Ou=>kindTakes(Ou.type,Ru));if(!Iu){const Ou=$u.kinds.map(Pu=>Pu.type).join(", ");return`${Ru.name} is not a kind of file ${Au.name} takes: it takes ${Ou}.`}if(Ru.size>Iu.maxMb*1024*1024)return`${Ru.name} is ${megabytes(Ru.size)}: ${Au.name} takes ${Iu.type} of at most ${Iu.maxMb} MB.`}return null}function uploadsInWords(Au){return`Takes ${Au.kinds.map($u=>`${$u.type} up to ${$u.maxMb} MB`).join(", ")}; ${Au.maxFiles} at most at once.`}const APP_SCHEMA="loop.app/v1",DEFAULT_LANGUAGE="en",DEFAULT_EMOJI="👀",APP_KINDS=["chat","widget","decision","worker"],APP_ACCENTS=["green","rose","sky","lime","sun","violet"],APP_THEME_VARIANTS=["datalayer","spatial","lovely","matrix","earth","sand","ivory","sun","loop"],APP_THEME_MODES=["light","dark","auto"],APP_EMBED_MODES=["inline","bubble","panel","assistant"],APP_ASSISTANT_CHARACTER_ID=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;function isAssistantCharacterId(Au){return typeof Au=="string"&&Au.length<=64&&APP_ASSISTANT_CHARACTER_ID.test(Au)}const ACTION_CLASS_NAMES=["read","write","send","buy","delete","publish"],DEFAULT_LAYOUTS={chat:"chat",widget:"page",decision:"page",worker:"split"},DEFAULT_RECORD_INCLUDE=["conversations","actions","approvals"],DEFAULT_KEEP_FOR="1_years",DEFAULT_READY_AT=.8,DEFAULT_PROTOCOL="a2ui/v0.9",DEFAULT_ICON="apps",DEFAULT_VERSION="0.0.1",NO_HOST_PARAMETERS={type:"object",properties:{}},isData=Au=>!!Au&&typeof Au=="object"&&!Array.isArray(Au),text$j=(Au,lo="")=>typeof Au=="string"?Au:lo,flag=(Au,lo)=>typeof Au=="boolean"?Au:lo,numberOf=(Au,lo)=>typeof Au=="number"&&Number.isFinite(Au)?Au:lo,texts=Au=>Array.isArray(Au)?Au.filter(lo=>typeof lo=="string"):[],records=Au=>Array.isArray(Au)?Au.filter(isData):[],oneOf$4=(Au,lo,$u)=>lo.includes(Au)?Au:$u,RETENTION$1=/^([1-9]\d*)_(day|days|month|months|year|years)$/,DAYS={day:1,month:30,year:365};function retentionDays(Au){const lo=RETENTION$1.exec(Au.trim());return lo?Number(lo[1])*DAYS[lo[2].replace(/s$/,"")]:0}function emptyAppspec(Au="chat"){return{schema:APP_SCHEMA,id:"",version:DEFAULT_VERSION,name:"",kind:Au,description:"",owner:"",agent:"",team:"",instructions:"",model:"",skills:[],backendTools:[],context:[],contents:[],connections:[],rules:[],permissions:{spaces:[],computer:{browse:!1,files:!1,shell:!1}},interface:{layout:DEFAULT_LAYOUTS[Au],welcome:"",starters:[],commands:[],modes:[],profiles:[],language:DEFAULT_LANGUAGE,translations:{},components:[],outputs:[]},tests:{readyAt:DEFAULT_READY_AT,evalset:"",cases:[],verified:{live:[],recorded:[],unverified:[]}},record:{keepFor:DEFAULT_KEEP_FOR,retentionDays:retentionDays(DEFAULT_KEEP_FOR),include:[...DEFAULT_RECORD_INCLUDE],suggestTests:!1},checks:{guards:[],gates:[],track:""},deployment:{},goal:"",triggers:[],memory:"",notifications:[],samples:{documents:[],alternatives:[]},setup:[],enabled:!0,unavailable_because:"",tags:[],icon:DEFAULT_ICON,emoji:DEFAULT_EMOJI,avatar:"",banner:""}}const KNOWN_KEYS=["schema","id","version","name","kind","description","owner","agent","team","instructions","model","skills","backend_tools","tools","context","contents","connections","rules","permissions","interface","tests","record","checks","deployment","goal","triggers","memory","notifications","decision","samples","enabled","unavailable_because","tags","icon","emoji","avatar","banner"],CHECK_STAGES=["answer","tool_call"];function parseTool(Au){return{name:text$j(Au.name),description:text$j(Au.description),parameters:isData(Au.parameters)?Au.parameters:{...NO_HOST_PARAMETERS},does:texts(Au.does)}}function parseConnection(Au){return{server:text$j(Au.server),access:oneOf$4(Au.access,["read","write"],"read"),as:oneOf$4(Au.as,["owner","user"],"owner"),only:texts(Au.only)}}function parseRule$1(Au){return{action:text$j(Au.action),appliesTo:typeof Au.applies_to=="string"?[Au.applies_to]:texts(Au.applies_to),behaviour:oneOf$4(Au.behaviour,BEHAVIOURS,"ask_first")}}function parseCommand$1(Au){return{name:text$j(Au.name),description:text$j(Au.description),prompt:text$j(Au.prompt)}}function parseModeOption(Au){const lo={id:text$j(Au.id),label:text$j(Au.label)};for(const $u of["description","instructions","model"])typeof Au[$u]=="string"&&Au[$u]&&(lo[$u]=Au[$u]);return lo}function parseMode(Au){const lo={id:text$j(Au.id),label:text$j(Au.label),options:records(Au.options).map(parseModeOption)};return typeof Au.default=="string"&&Au.default&&(lo.default=Au.default),lo}function parseStarter(Au){const lo={label:text$j(Au.label),message:text$j(Au.message)};return typeof Au.category=="string"&&Au.category&&(lo.category=Au.category),lo}function parseProfile(Au){return{id:text$j(Au.id),label:text$j(Au.label),description:text$j(Au.description),instructions:text$j(Au.instructions),model:typeof Au.model=="string"&&Au.model?Au.model:null,starters:records(Au.starters).map(parseStarter)}}function wordsBy(Au){return Object.fromEntries(Object.entries(isData(Au)?Au:{}).filter(lo=>typeof lo[1]=="string"))}function recordsBy(Au){return Object.fromEntries(Object.entries(isData(Au)?Au:{}).filter(lo=>isData(lo[1])))}const mapValues=(Au,lo)=>Object.fromEntries(Object.entries(Au).map(([$u,Ru])=>[$u,lo(Ru)]));function parseTranslation(Au){return{name:text$j(Au.name),description:text$j(Au.description),welcome:text$j(Au.welcome),starters:mapValues(recordsBy(Au.starters),lo=>({label:text$j(lo.label),message:text$j(lo.message)})),categories:wordsBy(Au.categories),settings:mapValues(recordsBy(Au.settings),lo=>({title:text$j(lo.title),description:text$j(lo.description),options:wordsBy(lo.options)})),commands:wordsBy(Au.commands),modes:mapValues(recordsBy(Au.modes),lo=>({label:text$j(lo.label),options:mapValues(recordsBy(lo.options),$u=>({label:text$j($u.label),description:text$j($u.description)}))})),profiles:mapValues(recordsBy(Au.profiles),lo=>({label:text$j(lo.label),description:text$j(lo.description)}))}}function parseSurface(Au){return{protocol:text$j(Au.protocol,DEFAULT_PROTOCOL),components:records(Au.components).filter(lo=>typeof lo.id=="string"&&typeof lo.component=="string"),composedBy:text$j(Au.composed_by),composedAt:text$j(Au.composed_at)}}const DEFAULT_VOICE={enabled:!1,input:"push_to_talk",output:"on_request",where:"auto"};function parseVoice(Au){const lo=isData(Au)?Au:{};return{enabled:lo.enabled===!0,input:oneOf$4(lo.input,["off","push_to_talk","hands_free"],DEFAULT_VOICE.input),output:oneOf$4(lo.output,["off","on_request","always"],DEFAULT_VOICE.output),voice:text$j(lo.voice),language:text$j(lo.language),where:oneOf$4(lo.where,["auto","device","server"],DEFAULT_VOICE.where)}}function parseUploads(Au){return{kinds:records(Au.kinds).map(lo=>({type:text$j(lo.type),maxMb:numberOf(lo.max_mb,DEFAULT_UPLOAD_MB)})),maxFiles:numberOf(Au.max_files,DEFAULT_MAX_FILES)}}const PAGE_OUTPUT_SHOWS={Text:"text",Image:"url",Table:"rows",Chart:"points"},DEFAULT_CUSTOM_HEIGHT=240;function parseCustomComponent(Au){const lo={name:text$j(Au.name),description:text$j(Au.description),props:isData(Au.props)?JSON.parse(JSON.stringify(Au.props)):{type:"object",properties:{}},shows:texts(Au.shows),sends:texts(Au.sends),source:text$j(Au.source),integrity:text$j(Au.integrity),height:numberOf(Au.height,DEFAULT_CUSTOM_HEIGHT)};return isData(Au.example)&&(lo.example=JSON.parse(JSON.stringify(Au.example))),lo}function dumpCustomComponent(Au){const lo=new Writer().text("name",Au.name,"\0").text("description",Au.description,"\0");return lo.data.props=JSON.parse(JSON.stringify(Au.props)),lo.list("shows",Au.shows).list("sends",Au.sends).text("source",Au.source,"\0").text("integrity",Au.integrity).value("height",Au.height,DEFAULT_CUSTOM_HEIGHT),Au.example&&(lo.data.example=JSON.parse(JSON.stringify(Au.example))),lo.data}function pageOutputShows(Au,lo=[]){return Au in PAGE_OUTPUT_SHOWS?PAGE_OUTPUT_SHOWS[Au]:lo.find($u=>$u.name===Au)?.shows[0]}function parsePage(Au){const lo={function:text$j(Au.function),inputs:isData(Au.inputs)?JSON.parse(JSON.stringify(Au.inputs)):{},outputs:records(Au.outputs).map($u=>({name:text$j($u.name),title:text$j($u.title),component:text$j($u.component,"Text"),props:isData($u.props)?JSON.parse(JSON.stringify($u.props)):{}})),live:Au.live!==!1};return isData(Au.inputs_ui)&&(lo.inputsUi=JSON.parse(JSON.stringify(Au.inputs_ui))),lo}function dumpPage(Au){const lo=new Writer().text("function",Au.function,"\0");return lo.data.inputs=JSON.parse(JSON.stringify(Au.inputs)),Au.inputsUi&&(lo.data.inputs_ui={...Au.inputsUi}),lo.list("outputs",Au.outputs.map($u=>new Writer().text("name",$u.name,"\0").text("title",$u.title).text("component",$u.component,"Text").part("props",{...$u.props}).data)),lo.value("live",Au.live,!0).data}function parseInterface(Au,lo){const $u={layout:oneOf$4(Au.layout,["chat","page","split"],DEFAULT_LAYOUTS[lo]),accent:APP_ACCENTS.includes(Au.accent)?Au.accent:void 0,welcome:text$j(Au.welcome),starters:records(Au.starters).map(parseStarter),commands:records(Au.commands).map(parseCommand$1),modes:records(Au.modes).map(parseMode),profiles:records(Au.profiles).map(parseProfile),language:text$j(Au.language,DEFAULT_LANGUAGE),translations:mapValues(recordsBy(Au.translations),parseTranslation),components:texts(Au.components),voice:parseVoice(Au.voice),outputs:texts(Au.outputs)};return isData(Au.settings)&&($u.settings=JSON.parse(JSON.stringify(Au.settings))),isData(Au.settings_ui)&&($u.settingsUi=JSON.parse(JSON.stringify(Au.settings_ui))),isData(Au.uploads)&&($u.uploads=parseUploads(Au.uploads)),Array.isArray(Au.custom_components)&&($u.customComponents=records(Au.custom_components).map(parseCustomComponent)),isData(Au.surface)&&($u.surface=parseSurface(Au.surface)),isData(Au.page)&&($u.page=parsePage(Au.page)),isAssistantCharacterId(Au.assistant)&&($u.assistant=Au.assistant),(Au.balloon==="history"||Au.balloon==="current")&&($u.balloon=Au.balloon),isData(Au.theme)&&APP_THEME_VARIANTS.includes(Au.theme.variant)&&($u.theme={variant:Au.theme.variant},APP_THEME_MODES.includes(Au.theme.mode)&&($u.theme.mode=Au.theme.mode)),$u}function parseCriterion(Au){return{name:text$j(Au.name),kind:oneOf$4(Au.kind,["metric","noul","choice","score"],"metric"),weight:Math.max(0,numberOf(Au.weight,1)),instructions:text$j(Au.instructions),options:texts(Au.options),direction:Au.direction==="lower"?"lower":"higher",measure:oneOf$4(Au.measure,["","pass_rate","cost_per_task","seconds_per_task"],"")}}function parseDecision(Au){return{question:text$j(Au.question),alternatives:texts(Au.alternatives),criteria:records(Au.criteria).map(parseCriterion),minConfidence:Math.min(1,Math.max(0,numberOf(Au.min_confidence,0))),scenarios:records(Au.scenarios).map(lo=>({name:text$j(lo.name),weights:Object.fromEntries(Object.entries(isData(lo.weights)?lo.weights:{}).filter($u=>typeof $u[1]=="number"))})),decisionModel:text$j(Au.decision_model)}}function parseSamples(Au){return{documents:records(Au.documents).map(lo=>({name:text$j(lo.name),file:text$j(lo.file),text:text$j(lo.text)})),alternatives:records(Au.alternatives).map(lo=>({name:text$j(lo.name),evidence:text$j(lo.evidence),metrics:Object.fromEntries(Object.entries(isData(lo.metrics)?lo.metrics:{}).filter($u=>typeof $u[1]=="number"))}))}}function parseDeployment(Au){const lo={};return isData(Au.hosted)&&(lo.hosted={visibility:oneOf$4(Au.hosted.visibility,["private","invited","organization","link","public"],"private"),slug:text$j(Au.hosted.slug),...Au.hosted.character_alone===!0?{characterAlone:!0}:{}}),isData(Au.embedded)&&(lo.embedded={mode:oneOf$4(Au.embedded.mode,APP_EMBED_MODES,"inline"),origins:texts(Au.embedded.origins),...isData(Au.embedded.host)?{host:{context:texts(Au.embedded.host.context),...Au.embedded.host.user!==void 0?{user:text$j(Au.embedded.host.user)}:{},functions:records(Au.embedded.host.functions).map($u=>({name:text$j($u.name),description:text$j($u.description),parameters:isData($u.parameters)?$u.parameters:{...NO_HOST_PARAMETERS}}))}}:{}}),lo}function parseTrigger(Au){return{type:oneOf$4(Au.type,["schedule","event","once"],"schedule"),cron:text$j(Au.cron),event:text$j(Au.event),at:text$j(Au.at),description:text$j(Au.description),prompt:text$j(Au.prompt)}}function parseAppspec(Au){const lo=[];if(!isData(Au))return{app:emptyAppspec(),problems:["The document is not an application."]};const $u=Au;for(const Uu of Object.keys($u))KNOWN_KEYS.includes(Uu)||lo.push(`\`${Uu}\` is not a field of the spec.`);const Ru=text$j($u.schema,APP_SCHEMA);Ru!==APP_SCHEMA&&lo.push(`This reads ${APP_SCHEMA}; the application is written in ${Ru}.`),APP_KINDS.includes($u.kind)||lo.push($u.kind===void 0?"The application does not say its `kind`.":`\`${String($u.kind)}\` is not a kind: chat, widget, decision or worker.`);const Iu=oneOf$4($u.kind,APP_KINDS,"chat"),Ou=emptyAppspec(Iu),Pu=isData($u.permissions)?$u.permissions:{},Du=isData(Pu.computer)?Pu.computer:{},Lu=isData($u.tests)?$u.tests:{},ju=isData(Lu.verified)?Lu.verified:{},Bu=isData($u.record)?$u.record:{},Fu=isData($u.checks)?$u.checks:{};for(const Uu of records(Fu.code))CHECK_STAGES.includes(Uu.on)||lo.push(`The check \`${text$j(Uu.name)}\` of its code runs on answer or tool_call, not \`${String(Uu.on)}\`.`);const zu=text$j(Bu.keep_for,DEFAULT_KEEP_FOR);retentionDays(zu)===0&&lo.push(`Cannot read the retention \`${zu}\`: write 90_days, 18_months or 1_years.`);const qu={...Ou,schema:APP_SCHEMA,id:text$j($u.id),version:text$j($u.version,DEFAULT_VERSION),name:text$j($u.name),kind:Iu,description:text$j($u.description),owner:text$j($u.owner),agent:text$j($u.agent),team:text$j($u.team),instructions:text$j($u.instructions),model:text$j($u.model),skills:texts($u.skills),backendTools:texts($u.backend_tools),tools:records($u.tools).map(parseTool),context:texts($u.context),contents:texts($u.contents),connections:records($u.connections).map(parseConnection),rules:records($u.rules).map(parseRule$1),permissions:{spaces:records(Pu.spaces).map(Uu=>({space:text$j(Uu.space),access:oneOf$4(Uu.access,["read","write"],"read")})),computer:{browse:flag(Du.browse,!1),files:flag(Du.files,!1),shell:flag(Du.shell,!1)}},interface:parseInterface(isData($u.interface)?$u.interface:{},Iu),tests:{readyAt:Math.min(1,Math.max(0,numberOf(Lu.ready_at,DEFAULT_READY_AT))),evalset:text$j(Lu.evalset),cases:records(Lu.cases).map(Uu=>({ask:text$j(Uu.ask),expect:text$j(Uu.expect),...text$j(Uu.code)?{code:text$j(Uu.code)}:{},...records(Uu.files).length?{files:records(Uu.files).map(Hu=>({name:text$j(Hu.name),text:text$j(Hu.text)}))}:{}})),verified:{live:texts(ju.live),recorded:texts(ju.recorded),unverified:texts(ju.unverified)}},record:{keepFor:zu,retentionDays:retentionDays(zu),include:Array.isArray(Bu.include)?texts(Bu.include):[...DEFAULT_RECORD_INCLUDE],suggestTests:Bu.suggest_tests===!0},checks:{guards:texts(Fu.guards),gates:texts(Fu.gates),track:text$j(Fu.track),code:records(Fu.code).map(Uu=>({name:text$j(Uu.name),on:oneOf$4(Uu.on,CHECK_STAGES,"answer"),description:text$j(Uu.description)}))},deployment:parseDeployment(isData($u.deployment)?$u.deployment:{}),goal:text$j($u.goal),triggers:records($u.triggers).map(parseTrigger),memory:text$j($u.memory),notifications:texts($u.notifications),samples:parseSamples(isData($u.samples)?$u.samples:{}),enabled:flag($u.enabled,!0),unavailable_because:text$j($u.unavailable_because),tags:texts($u.tags),icon:text$j($u.icon,DEFAULT_ICON),emoji:text$j($u.emoji,DEFAULT_EMOJI)||DEFAULT_EMOJI,avatar:text$j($u.avatar).trim(),banner:text$j($u.banner).trim()};return isData($u.decision)&&(qu.decision=parseDecision($u.decision)),{app:qu,problems:lo}}const sameList=(Au,lo)=>Au.length===lo.length&&Au.every(($u,Ru)=>$u===lo[Ru]);class Writer{data={};text(lo,$u,Ru=""){return $u!==Ru&&(this.data[lo]=$u),this}value(lo,$u,Ru){return $u!==Ru&&(this.data[lo]=$u),this}list(lo,$u,Ru=[]){return sameList($u,Ru)||(this.data[lo]=$u),this}part(lo,$u){return Object.keys($u).length>0&&(this.data[lo]=$u),this}present(lo,$u){return $u!==void 0&&(this.data[lo]=$u),this}}function sorted(Au){return Array.isArray(Au)?Au.map(sorted):isData(Au)?Object.fromEntries(Object.keys(Au).sort((lo,$u)=>lo<$u?-1:lo>$u?1:0).map(lo=>[lo,sorted(Au[lo])])):Au}function dumpComponent(Au){const{id:lo,component:$u,...Ru}=Au;return{id:lo,component:$u,...sorted(Ru)}}function dumpSurface(Au){return new Writer().text("protocol",Au.protocol,DEFAULT_PROTOCOL).list("components",Au.components.map(dumpComponent)).text("composed_by",Au.composedBy).text("composed_at",Au.composedAt).data}function dumpStarter(Au){return new Writer().text("label",Au.label,"\0").text("message",Au.message,"\0").text("category",Au.category??"").data}const saidWords=Au=>Object.fromEntries(Object.entries(Au).filter(([,lo])=>lo!==""));function dumpTranslation(Au){const lo=($u,Ru)=>Object.fromEntries(Object.entries($u).map(([Iu,Ou])=>[Iu,Ru(Ou)]));return new Writer().text("name",Au.name).text("description",Au.description).text("welcome",Au.welcome).part("starters",lo(Au.starters,$u=>new Writer().text("label",$u.label).text("message",$u.message).data)).part("categories",saidWords(Au.categories)).part("settings",lo(Au.settings,$u=>new Writer().text("title",$u.title).text("description",$u.description).part("options",saidWords($u.options)).data)).part("commands",saidWords(Au.commands)).part("modes",lo(Au.modes,$u=>new Writer().text("label",$u.label).part("options",lo($u.options,Ru=>new Writer().text("label",Ru.label).text("description",Ru.description).data)).data)).part("profiles",lo(Au.profiles,$u=>new Writer().text("label",$u.label).text("description",$u.description).data)).data}function dumpInterface(Au,lo){const $u=new Writer().value("layout",Au.layout,DEFAULT_LAYOUTS[lo]).value("accent",Au.accent,void 0).text("welcome",Au.welcome).list("starters",Au.starters.map(dumpStarter)).list("commands",Au.commands.map(Ru=>({name:Ru.name,description:Ru.description,prompt:Ru.prompt}))).list("modes",Au.modes.map(Ru=>{const Iu=new Writer().text("id",Ru.id,"\0").text("label",Ru.label,"\0").list("options",Ru.options.map(Ou=>new Writer().text("id",Ou.id,"\0").text("label",Ou.label,"\0").text("description",Ou.description??"").text("instructions",Ou.instructions??"").text("model",Ou.model??"").data));return Ru.default&&(Iu.data.default=Ru.default),Iu.data})).list("profiles",(Au.profiles??[]).map(Ru=>new Writer().text("id",Ru.id,"\0").text("label",Ru.label,"\0").text("description",Ru.description).text("instructions",Ru.instructions).text("model",Ru.model??"").list("starters",Ru.starters.map(dumpStarter)).data)).part("settings",Au.settings?{...Au.settings}:{});return Au.settingsUi&&($u.data.settings_ui={...Au.settingsUi}),$u.text("language",Au.language??DEFAULT_LANGUAGE,DEFAULT_LANGUAGE).part("translations",mapValues(Au.translations??{},dumpTranslation)),Au.uploads&&($u.data.uploads=new Writer().list("kinds",Au.uploads.kinds.map(Ru=>new Writer().text("type",Ru.type,"\0").value("max_mb",Ru.maxMb,DEFAULT_UPLOAD_MB).data)).value("max_files",Au.uploads.maxFiles,DEFAULT_MAX_FILES).data),$u.list("components",Au.components),$u.list("custom_components",(Au.customComponents??[]).map(dumpCustomComponent)),Au.surface&&($u.data.surface=dumpSurface(Au.surface)),Au.page&&($u.data.page=dumpPage(Au.page)),Au.assistant&&($u.data.assistant=Au.assistant),Au.balloon&&($u.data.balloon=Au.balloon),Au.theme&&($u.data.theme=Au.theme.mode?{variant:Au.theme.variant,mode:Au.theme.mode}:{variant:Au.theme.variant}),Au.voice&&$u.part("voice",new Writer().value("enabled",Au.voice.enabled,DEFAULT_VOICE.enabled).value("input",Au.voice.input,DEFAULT_VOICE.input).value("output",Au.voice.output,DEFAULT_VOICE.output).text("voice",Au.voice.voice).text("language",Au.voice.language).value("where",Au.voice.where,DEFAULT_VOICE.where).data),$u.list("outputs",Au.outputs??[]),$u.data}function dumpDecision(Au){return new Writer().text("question",Au.question,"\0").list("alternatives",Au.alternatives).list("criteria",Au.criteria.map(lo=>new Writer().text("name",lo.name,"\0").value("kind",lo.kind,"metric").value("weight",lo.weight,1).text("instructions",lo.instructions).list("options",lo.options).value("direction",lo.direction,"higher").value("measure",lo.measure,"").data)).value("min_confidence",Au.minConfidence,0).list("scenarios",Au.scenarios.map(lo=>new Writer().text("name",lo.name,"\0").part("weights",sorted(lo.weights)).data)).text("decision_model",Au.decisionModel).data}function dumpSamples(Au){return new Writer().list("documents",Au.documents.map(lo=>new Writer().text("name",lo.name,"\0").text("file",lo.file,"\0").text("text",lo.text,"\0").data)).list("alternatives",Au.alternatives.map(lo=>new Writer().text("name",lo.name,"\0").text("evidence",lo.evidence,"\0").part("metrics",{...lo.metrics}).data)).data}function dumpAppspec(Au){const lo=new Writer().value("browse",Au.permissions.computer.browse,!1).value("files",Au.permissions.computer.files,!1).value("shell",Au.permissions.computer.shell,!1).data,$u=new Writer;return $u.data.schema=APP_SCHEMA,$u.text("id",Au.id,"\0").text("version",Au.version,DEFAULT_VERSION).text("name",Au.name,"\0").text("kind",Au.kind,"\0").text("description",Au.description).text("owner",Au.owner).text("agent",Au.agent).text("team",Au.team).text("instructions",Au.instructions).text("model",Au.model).list("skills",Au.skills).list("backend_tools",Au.backendTools).list("tools",(Au.tools??[]).map(Ru=>({name:Ru.name,description:Ru.description,...JSON.stringify(Ru.parameters)===JSON.stringify(NO_HOST_PARAMETERS)?{}:{parameters:Ru.parameters},does:Ru.does}))).list("context",Au.context).list("contents",Au.contents).list("connections",Au.connections.map(Ru=>new Writer().text("server",Ru.server,"\0").value("access",Ru.access,"read").value("as",Ru.as,"owner").list("only",Ru.only).data)).list("rules",Au.rules.map(Ru=>({action:Ru.action,applies_to:Ru.appliesTo.length===1&&ACTION_CLASS_NAMES.includes(Ru.appliesTo[0])?Ru.appliesTo[0]:Ru.appliesTo,behaviour:Ru.behaviour}))).part("permissions",new Writer().list("spaces",Au.permissions.spaces.map(Ru=>new Writer().text("space",Ru.space,"\0").value("access",Ru.access,"read").data)).part("computer",lo).data).part("interface",dumpInterface(Au.interface,Au.kind)).part("tests",new Writer().value("ready_at",Au.tests.readyAt,DEFAULT_READY_AT).text("evalset",Au.tests.evalset).list("cases",Au.tests.cases.map(Ru=>({ask:Ru.ask,expect:Ru.expect,...Ru.code?{code:Ru.code}:{},...Ru.files?.length?{files:Ru.files.map(Iu=>({name:Iu.name,text:Iu.text}))}:{}}))).part("verified",new Writer().list("live",Au.tests.verified.live).list("recorded",Au.tests.verified.recorded).list("unverified",Au.tests.verified.unverified).data).data).part("record",new Writer().text("keep_for",Au.record.keepFor,DEFAULT_KEEP_FOR).list("include",Au.record.include,DEFAULT_RECORD_INCLUDE).value("suggest_tests",Au.record.suggestTests,!1).data).part("checks",new Writer().list("guards",Au.checks.guards).list("gates",Au.checks.gates).text("track",Au.checks.track).list("code",(Au.checks.code??[]).map(Ru=>({name:Ru.name,on:Ru.on,description:Ru.description}))).data).part("deployment",new Writer().present("hosted",Au.deployment.hosted&&new Writer().value("visibility",Au.deployment.hosted.visibility,"private").text("slug",Au.deployment.hosted.slug).value("character_alone",Au.deployment.hosted.characterAlone===!0,!1).data).present("embedded",Au.deployment.embedded&&new Writer().value("mode",Au.deployment.embedded.mode,"inline").list("origins",Au.deployment.embedded.origins).present("host",Au.deployment.embedded.host&&new Writer().list("context",Au.deployment.embedded.host.context).list("functions",Au.deployment.embedded.host.functions.map(Ru=>({name:Ru.name,description:Ru.description,...JSON.stringify(Ru.parameters)===JSON.stringify(NO_HOST_PARAMETERS)?{}:{parameters:Ru.parameters}}))).value("user",Au.deployment.embedded.host.user??"claimed","claimed").data).data).data).text("goal",Au.goal).list("triggers",Au.triggers.map(Ru=>new Writer().text("type",Ru.type,"\0").text("cron",Ru.cron).text("event",Ru.event).text("at",Ru.at).text("description",Ru.description).text("prompt",Ru.prompt).data)).text("memory",Au.memory).list("notifications",Au.notifications),Au.decision&&($u.data.decision=dumpDecision(Au.decision)),$u.part("samples",dumpSamples(Au.samples)).value("enabled",Au.enabled,!0).text("unavailable_because",Au.unavailable_because).list("tags",Au.tags).text("icon",Au.icon??DEFAULT_ICON,DEFAULT_ICON).text("emoji",Au.emoji,DEFAULT_EMOJI).text("avatar",Au.avatar??"","").text("banner",Au.banner??"",""),$u.data}const ALIAS=Symbol.for("yaml.alias"),DOC=Symbol.for("yaml.document"),MAP$1=Symbol.for("yaml.map"),PAIR=Symbol.for("yaml.pair"),SCALAR$1=Symbol.for("yaml.scalar"),SEQ=Symbol.for("yaml.seq"),NODE_TYPE$2=Symbol.for("yaml.node.type"),isAlias=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===ALIAS,isDocument$1=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===DOC,isMap$1=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===MAP$1,isPair=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===PAIR,isScalar=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===SCALAR$1,isSeq=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===SEQ;function isCollection(Au){if(Au&&typeof Au=="object")switch(Au[NODE_TYPE$2]){case MAP$1:case SEQ:return!0}return!1}function isNode$1(Au){if(Au&&typeof Au=="object")switch(Au[NODE_TYPE$2]){case ALIAS:case MAP$1:case SCALAR$1:case SEQ:return!0}return!1}const hasAnchor=Au=>(isScalar(Au)||isCollection(Au))&&!!Au.anchor,BREAK=Symbol("break visit"),SKIP$1=Symbol("skip children"),REMOVE=Symbol("remove node");function visit$4(Au,lo){const $u=initVisitor(lo);isDocument$1(Au)?visit_(null,Au.contents,$u,Object.freeze([Au]))===REMOVE&&(Au.contents=null):visit_(null,Au,$u,Object.freeze([]))}visit$4.BREAK=BREAK;visit$4.SKIP=SKIP$1;visit$4.REMOVE=REMOVE;function visit_(Au,lo,$u,Ru){const Iu=callVisitor(Au,lo,$u,Ru);if(isNode$1(Iu)||isPair(Iu))return replaceNode(Au,Ru,Iu),visit_(Au,Iu,$u,Ru);if(typeof Iu!="symbol"){if(isCollection(lo)){Ru=Object.freeze(Ru.concat(lo));for(let Ou=0;Ou<lo.items.length;++Ou){const Pu=visit_(Ou,lo.items[Ou],$u,Ru);if(typeof Pu=="number")Ou=Pu-1;else{if(Pu===BREAK)return BREAK;Pu===REMOVE&&(lo.items.splice(Ou,1),Ou-=1)}}}else if(isPair(lo)){Ru=Object.freeze(Ru.concat(lo));const Ou=visit_("key",lo.key,$u,Ru);if(Ou===BREAK)return BREAK;Ou===REMOVE&&(lo.key=null);const Pu=visit_("value",lo.value,$u,Ru);if(Pu===BREAK)return BREAK;Pu===REMOVE&&(lo.value=null)}}return Iu}function initVisitor(Au){return typeof Au=="object"&&(Au.Collection||Au.Node||Au.Value)?Object.assign({Alias:Au.Node,Map:Au.Node,Scalar:Au.Node,Seq:Au.Node},Au.Value&&{Map:Au.Value,Scalar:Au.Value,Seq:Au.Value},Au.Collection&&{Map:Au.Collection,Seq:Au.Collection},Au):Au}function callVisitor(Au,lo,$u,Ru){if(typeof $u=="function")return $u(Au,lo,Ru);if(isMap$1(lo))return $u.Map?.(Au,lo,Ru);if(isSeq(lo))return $u.Seq?.(Au,lo,Ru);if(isPair(lo))return $u.Pair?.(Au,lo,Ru);if(isScalar(lo))return $u.Scalar?.(Au,lo,Ru);if(isAlias(lo))return $u.Alias?.(Au,lo,Ru)}function replaceNode(Au,lo,$u){const Ru=lo[lo.length-1];if(isCollection(Ru))Ru.items[Au]=$u;else if(isPair(Ru))Au==="key"?Ru.key=$u:Ru.value=$u;else if(isDocument$1(Ru))Ru.contents=$u;else{const Iu=isAlias(Ru)?"alias":"scalar";throw new Error(`Cannot replace node with ${Iu} parent`)}}const escapeChars={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},escapeTagName=Au=>Au.replace(/[!,[\]{}]/g,lo=>escapeChars[lo]);class Directives{constructor(lo,$u){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,lo),this.tags=Object.assign({},Directives.defaultTags,$u)}clone(){const lo=new Directives(this.yaml,this.tags);return lo.docStart=this.docStart,lo}atDocument(){const lo=new Directives(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Directives.defaultTags);break}return lo}add(lo,$u){this.atNextDocument&&(this.yaml={explicit:Directives.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Directives.defaultTags),this.atNextDocument=!1);const Ru=lo.trim().split(/[ \t]+/),Iu=Ru.shift();switch(Iu){case"%TAG":{if(Ru.length!==2&&($u(0,"%TAG directive should contain exactly two parts"),Ru.length<2))return!1;const[Ou,Pu]=Ru;return this.tags[Ou]=Pu,!0}case"%YAML":{if(this.yaml.explicit=!0,Ru.length!==1)return $u(0,"%YAML directive should contain exactly one part"),!1;const[Ou]=Ru;if(Ou==="1.1"||Ou==="1.2")return this.yaml.version=Ou,!0;{const Pu=/^\d+\.\d+$/.test(Ou);return $u(6,`Unsupported YAML version ${Ou}`,Pu),!1}}default:return $u(0,`Unknown directive ${Iu}`,!0),!1}}tagName(lo,$u){if(lo==="!")return"!";if(lo[0]!=="!")return $u(`Not a valid tag: ${lo}`),null;if(lo[1]==="<"){const Pu=lo.slice(2,-1);return Pu==="!"||Pu==="!!"?($u(`Verbatim tags aren't resolved, so ${lo} is invalid.`),null):(lo[lo.length-1]!==">"&&$u("Verbatim tags must end with a >"),Pu)}const[,Ru,Iu]=lo.match(/^(.*!)([^!]*)$/s);Iu||$u(`The ${lo} tag has no suffix`);const Ou=this.tags[Ru];if(Ou)try{return Ou+decodeURIComponent(Iu)}catch(Pu){return $u(String(Pu)),null}return Ru==="!"?lo:($u(`Could not resolve tag: ${lo}`),null)}tagString(lo){for(const[$u,Ru]of Object.entries(this.tags))if(lo.startsWith(Ru))return $u+escapeTagName(lo.substring(Ru.length));return lo[0]==="!"?lo:`!<${lo}>`}toString(lo){const $u=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Ru=Object.entries(this.tags);let Iu;if(lo&&Ru.length>0&&isNode$1(lo.contents)){const Ou={};visit$4(lo.contents,(Pu,Du)=>{isNode$1(Du)&&Du.tag&&(Ou[Du.tag]=!0)}),Iu=Object.keys(Ou)}else Iu=[];for(const[Ou,Pu]of Ru)Ou==="!!"&&Pu==="tag:yaml.org,2002:"||(!lo||Iu.some(Du=>Du.startsWith(Pu)))&&$u.push(`%TAG ${Ou} ${Pu}`);return $u.join(`
113
+ `,loopThemeStyles=buildThemeStyles(loopLight,loopDark,{fontFamily:loopFontFamily,css:loopControlsCss,shape:{radiusControl:loopShapeVars["--loop-radius-control"],radiusCard:loopShapeVars["--loop-radius-card"],radiusBubble:loopShapeVars["--loop-radius-bubble"],radiusFrame:loopShapeVars["--loop-radius-frame"],shadow:loopShapeVars["--loop-shadow-frame"],motionStatus:loopMotionVars["--loop-motion-status"],motionMessage:loopMotionVars["--loop-motion-message"],motionPane:loopMotionVars["--loop-motion-pane"],motionEasing:loopMotionVars["--loop-motion-easing"],messageLink:"currentColor"},variables:{light:{...loopShapeVars,...loopTints("light"),...loopMotionVars,...loopShadows.light,...loopTypeVars(loopFontFamily),"--loop-hairline":loopHairline.light,"--borderColor-default":loopHairline.light,"--focus-outlineColor":loopFocusRing.light,"--underlineNav-borderColor-active":themeAccents.green.accent},dark:{...loopShapeVars,...loopTints("dark"),...loopMotionVars,...loopShadows.dark,...loopTypeVars(loopFontFamily),"--loop-hairline":loopHairline.dark,"--borderColor-default":loopHairline.dark,"--focus-outlineColor":loopFocusRing.dark,"--underlineNav-borderColor-active":themeAccents.green.accent}}}),loopTheme={...theme$2,fontWeights:{light:loopFontWeights.regular,normal:loopFontWeights.regular,semibold:loopFontWeights.semibold,bold:loopFontWeights.semibold}},themeTokens={datalayer:{label:"Datalayer",description:"Default green palette — the classic Datalayer look.",brandColor:datalayerColors.greenBrand,defaultColorMode:"auto",themeStyles:datalayerThemeStyles,cardGradient:{light:{from:datalayerColors.greenBrand,to:datalayerColors.greenText},dark:{from:datalayerColors.greenAccent,to:datalayerColors.greenBrand}},brightPalette:{glow:datalayerColors.brightGlow,onGlow:"#1b1f24",pop:datalayerColors.brightPop,spark:datalayerColors.brightSpark,blaze:datalayerColors.brightBlaze,surge:datalayerColors.brightSurge,flame:datalayerColors.brightFlame,gold:datalayerColors.brightGold},brightPaletteLight:{glow:datalayerColors.brightLightGlow,onGlow:"#1b1f24",pop:datalayerColors.brightLightPop,spark:datalayerColors.brightLightSpark,blaze:datalayerColors.brightLightBlaze,surge:datalayerColors.brightLightSurge,flame:datalayerColors.brightLightFlame,gold:datalayerColors.brightLightGold}},spatial:{label:"Spatial",description:"Cosmic indigo & deep blues — inspired by space.",brandColor:spatialColors.indigoBrand,defaultColorMode:"auto",themeStyles:spatialThemeStyles,cardGradient:{light:{from:spatialColors.indigoBrand,to:spatialColors.indigoText},dark:{from:spatialColors.indigoAccent,to:spatialColors.indigoBrand}},brightPalette:{glow:spatialColors.brightGlow,onGlow:"#ffffff",pop:spatialColors.brightPop,spark:spatialColors.brightSpark,blaze:spatialColors.brightBlaze,surge:spatialColors.brightSurge,flame:spatialColors.brightFlame,gold:spatialColors.brightGold},brightPaletteLight:{glow:spatialColors.brightLightGlow,onGlow:"#ffffff",pop:spatialColors.brightLightPop,spark:spatialColors.brightLightSpark,blaze:spatialColors.brightLightBlaze,surge:spatialColors.brightLightSurge,flame:spatialColors.brightLightFlame,gold:spatialColors.brightLightGold}},lovely:{label:"Lovely",description:"Warm rose & magenta — soft and inviting.",brandColor:lovelyColors.roseBrand,defaultColorMode:"auto",themeStyles:lovelyThemeStyles,cardGradient:{light:{from:lovelyColors.roseBrand,to:lovelyColors.roseText},dark:{from:lovelyColors.roseAccent,to:lovelyColors.roseBrand}},brightPalette:{glow:lovelyColors.brightGlow,onGlow:"#ffffff",pop:lovelyColors.brightPop,spark:lovelyColors.brightSpark,blaze:lovelyColors.brightBlaze,surge:lovelyColors.brightSurge,flame:lovelyColors.brightFlame,gold:lovelyColors.brightGold},brightPaletteLight:{glow:lovelyColors.brightLightGlow,onGlow:"#ffffff",pop:lovelyColors.brightLightPop,spark:lovelyColors.brightLightSpark,blaze:lovelyColors.brightLightBlaze,surge:lovelyColors.brightLightSurge,flame:lovelyColors.brightLightFlame,gold:lovelyColors.brightLightGold}},matrix:{label:"Matrix",description:"Phosphor green on black — CRT terminal aesthetic.",brandColor:matrixColors.greenPhosphor,defaultColorMode:"dark",themeStyles:matrixThemeStyles,cardGradient:{light:{from:matrixColors.greenBrand,to:matrixColors.greenText},dark:{from:matrixColors.greenGlow,to:matrixColors.greenHover}},brightPalette:{glow:matrixColors.brightGlow,onGlow:"#1b1f24",pop:matrixColors.brightPop,spark:matrixColors.brightSpark,blaze:matrixColors.brightBlaze,surge:matrixColors.brightSurge,flame:matrixColors.brightFlame,gold:matrixColors.brightGold},brightPaletteLight:{glow:matrixColors.brightLightGlow,onGlow:"#1b1f24",pop:matrixColors.brightLightPop,spark:matrixColors.brightLightSpark,blaze:matrixColors.brightLightBlaze,surge:matrixColors.brightLightSurge,flame:matrixColors.brightLightFlame,gold:matrixColors.brightLightGold}},earth:{label:"Earth",description:"Ocean blues, forest greens & golden sun — the Blue Planet.",brandColor:earthColors.oceanBrand,defaultColorMode:"auto",themeStyles:earthThemeStyles,cardGradient:{light:{from:earthColors.oceanBrand,to:earthColors.oceanText},dark:{from:earthColors.oceanAccent,to:earthColors.oceanBrand}},brightPalette:{glow:earthColors.brightGlow,onGlow:"#ffffff",pop:earthColors.brightPop,spark:earthColors.brightSpark,blaze:earthColors.brightBlaze,surge:earthColors.brightSurge,flame:earthColors.brightFlame,gold:earthColors.brightGold},brightPaletteLight:{glow:earthColors.brightLightGlow,onGlow:"#ffffff",pop:earthColors.brightLightPop,spark:earthColors.brightLightSpark,blaze:earthColors.brightLightBlaze,surge:earthColors.brightLightSurge,flame:earthColors.brightLightFlame,gold:earthColors.brightLightGold}},sand:{label:"Sand",description:"Warm, pale desert neutrals with a golden accent — calm & editorial.",brandColor:sandColors.sandBrand,defaultColorMode:"light",themeStyles:sandThemeStyles,cardGradient:{light:{from:sandColors.sandBrand,to:sandColors.sandText},dark:{from:sandColors.sandAccent,to:sandColors.sandBrand}},brightPalette:{glow:sandColors.brightGlow,onGlow:"#211A12",pop:sandColors.brightPop,spark:sandColors.brightSpark,blaze:sandColors.brightBlaze,surge:sandColors.brightSurge,flame:sandColors.brightFlame,gold:sandColors.brightGold},brightPaletteLight:{glow:sandColors.brightLightGlow,onGlow:"#ffffff",pop:sandColors.brightLightPop,spark:sandColors.brightLightSpark,blaze:sandColors.brightLightBlaze,surge:sandColors.brightLightSurge,flame:sandColors.brightLightFlame,gold:sandColors.brightLightGold}},ivory:{label:"Ivory",description:"Soft, warm off-white that creates a calm, refined, and welcoming feeling.",brandColor:ivoryColors.ivoryBrand,defaultColorMode:"light",themeStyles:ivoryThemeStyles,cardGradient:{light:{from:ivoryColors.ivoryBrand,to:ivoryColors.ivoryText},dark:{from:ivoryColors.ivoryAccent,to:ivoryColors.ivoryBrand}},brightPalette:{glow:ivoryColors.brightGlow,onGlow:"#211A12",pop:ivoryColors.brightPop,spark:ivoryColors.brightSpark,blaze:ivoryColors.brightBlaze,surge:ivoryColors.brightSurge,flame:ivoryColors.brightFlame,gold:ivoryColors.brightGold},brightPaletteLight:{glow:ivoryColors.brightLightGlow,onGlow:"#ffffff",pop:ivoryColors.brightLightPop,spark:ivoryColors.brightLightSpark,blaze:ivoryColors.brightLightBlaze,surge:ivoryColors.brightLightSurge,flame:ivoryColors.brightLightFlame,gold:ivoryColors.brightLightGold}},sun:{label:"Sun",description:"Warm, radiant theme inspired by golden light, bringing energy, optimism, and a welcoming atmosphere.",brandColor:sunColors.sunBrand,defaultColorMode:"light",themeStyles:sunThemeStyles,cardGradient:{light:{from:sunColors.sunBrand,to:sunColors.sunText},dark:{from:sunColors.sunAccent,to:sunColors.sunBrand}},brightPalette:{glow:sunColors.brightGlow,onGlow:"#211A08",pop:sunColors.brightPop,spark:sunColors.brightSpark,blaze:sunColors.brightBlaze,surge:sunColors.brightSurge,flame:sunColors.brightFlame,gold:sunColors.brightGold},brightPaletteLight:{glow:sunColors.brightLightGlow,onGlow:"#ffffff",pop:sunColors.brightLightPop,spark:sunColors.brightLightSpark,blaze:sunColors.brightLightBlaze,surge:sunColors.brightLightSurge,flame:sunColors.brightLightFlame,gold:sunColors.brightLightGold}},loop:{label:"Loop",description:"Very clean: one soft accent, neutral everything else. The look of an application built in LOOP.",brandColor:loopColors.loopBrand,defaultColorMode:"light",themeStyles:loopThemeStyles,cardGradient:{light:{from:loopColors.loopBrand,to:loopColors.loopBrand},dark:{from:loopColors.loopBrand,to:loopColors.loopBrand}},brightPalette:{glow:loopColors.brightGlow,onGlow:loopColors.loopOn,pop:loopColors.brightPop,spark:loopColors.brightSpark,blaze:loopColors.brightBlaze,surge:loopColors.brightSurge,flame:loopColors.brightFlame,gold:loopColors.brightGold},brightPaletteLight:{glow:loopColors.brightLightGlow,onGlow:"#ffffff",pop:loopColors.brightLightPop,spark:loopColors.brightLightSpark,blaze:loopColors.brightLightBlaze,surge:loopColors.brightLightSurge,flame:loopColors.brightLightFlame,gold:loopColors.brightLightGold}}};function brightPaletteOf(Au,lo){const $u=themeTokens[Au]??themeTokens.datalayer;return lo==="light"?$u.brightPaletteLight??$u.brightPalette:$u.brightPalette}const primerThemes={datalayer:datalayerTheme,spatial:spatialTheme,lovely:lovelyTheme,matrix:matrixTheme,earth:earthTheme,sand:sandTheme,ivory:ivoryTheme,sun:sunTheme,loop:loopTheme},themeConfigs=Object.fromEntries(Object.keys(themeTokens).map(Au=>[Au,{...themeTokens[Au],primerTheme:primerThemes[Au]}]));function getThemeConfig(Au){return themeConfigs[Au]}const osMode=()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";function getBrightPalette(Au="datalayer",lo){const $u=lo==="auto"?osMode():lo==="light"?"light":"dark";return brightPaletteOf(Au,$u)}const createStoreImpl$2=Au=>{let lo;const $u=new Set,Ru=(ju,Bu)=>{const Fu=typeof ju=="function"?ju(lo):ju;if(!Object.is(Fu,lo)){const zu=lo;lo=Bu??(typeof Fu!="object"||Fu===null)?Fu:Object.assign({},lo,Fu),$u.forEach(qu=>qu(lo,zu))}},Iu=()=>lo,Du={setState:Ru,getState:Iu,getInitialState:()=>Lu,subscribe:ju=>($u.add(ju),()=>$u.delete(ju))},Lu=lo=Au(Ru,Iu,Du);return Du},createStore$2=(Au=>Au?createStoreImpl$2(Au):createStoreImpl$2),identity$4=Au=>Au;function useStore$2(Au,lo=identity$4){const $u=vM.useSyncExternalStore(Au.subscribe,vM.useCallback(()=>lo(Au.getState()),[Au,lo]),vM.useCallback(()=>lo(Au.getInitialState()),[Au,lo]));return vM.useDebugValue($u),$u}const createImpl$2=Au=>{const lo=createStore$2(Au),$u=Ru=>useStore$2(lo,Ru);return Object.assign($u,lo),$u},create$j=(Au=>Au?createImpl$2(Au):createImpl$2);function createJSONStorage$1(Au,lo){let $u;try{$u=Au()}catch{return}return{getItem:Iu=>{var Ou;const Pu=Lu=>Lu===null?null:JSON.parse(Lu,void 0),Du=(Ou=$u.getItem(Iu))!=null?Ou:null;return Du instanceof Promise?Du.then(Pu):Pu(Du)},setItem:(Iu,Ou)=>$u.setItem(Iu,JSON.stringify(Ou,void 0)),removeItem:Iu=>$u.removeItem(Iu)}}const toThenable$1=Au=>lo=>{try{const $u=Au(lo);return $u instanceof Promise?$u:{then(Ru){return toThenable$1(Ru)($u)},catch(Ru){return this}}}catch($u){return{then(Ru){return this},catch(Ru){return toThenable$1(Ru)($u)}}}},persistImpl$1=(Au,lo)=>($u,Ru,Iu)=>{let Ou={storage:createJSONStorage$1(()=>window.localStorage),partialize:Vu=>Vu,version:0,merge:(Vu,Gu)=>({...Gu,...Vu}),...lo},Pu=!1,Du=0;const Lu=new Set,ju=new Set;let Bu=Ou.storage;if(!Bu)return Au((...Vu)=>{console.warn(`[zustand persist middleware] Unable to update item '${Ou.name}', the given storage is currently unavailable.`),$u(...Vu)},Ru,Iu);const Fu=()=>{const Vu=Ou.partialize({...Ru()});return Bu.setItem(Ou.name,{state:Vu,version:Ou.version})},zu=Iu.setState;Iu.setState=(Vu,Gu)=>(zu(Vu,Gu),Fu());const qu=Au((...Vu)=>($u(...Vu),Fu()),Ru,Iu);Iu.getInitialState=()=>qu;let Uu;const Hu=()=>{var Vu,Gu;if(!Bu)return;const Ku=++Du;Pu=!1,Lu.forEach(Qu=>{var Yu;return Qu((Yu=Ru())!=null?Yu:qu)});const Zu=((Gu=Ou.onRehydrateStorage)==null?void 0:Gu.call(Ou,(Vu=Ru())!=null?Vu:qu))||void 0;return toThenable$1(Bu.getItem.bind(Bu))(Ou.name).then(Qu=>{if(Qu)if(typeof Qu.version=="number"&&Qu.version!==Ou.version){if(Ou.migrate){const Yu=Ou.migrate(Qu.state,Qu.version);return Yu instanceof Promise?Yu.then(ed=>[!0,ed]):[!0,Yu]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,Qu.state];return[!1,void 0]}).then(Qu=>{var Yu;if(Ku!==Du)return;const[ed,Xu]=Qu;if(Uu=Ou.merge(Xu,(Yu=Ru())!=null?Yu:qu),$u(Uu,!0),ed)return Fu()}).then(()=>{Ku===Du&&(Zu?.(Ru(),void 0),Uu=Ru(),Pu=!0,ju.forEach(Qu=>Qu(Uu)))}).catch(Qu=>{Ku===Du&&Zu?.(void 0,Qu)})};return Iu.persist={setOptions:Vu=>{Ou={...Ou,...Vu},Vu.storage&&(Bu=Vu.storage)},clearStorage:()=>{++Du,Bu?.removeItem(Ou.name)},getOptions:()=>Ou,rehydrate:()=>Hu(),hasHydrated:()=>Pu,onHydrate:Vu=>(Lu.add(Vu),()=>{Lu.delete(Vu)}),onFinishHydration:Vu=>(ju.add(Vu),()=>{ju.delete(Vu)})},Ou.skipHydration||Hu(),Uu||qu},persist$2=persistImpl$1,VARIANT_SCHEMA_VERSION=1;function normalizeVariantPreference(Au){return{theme:Au.theme,colorMode:Au.colorMode,version:typeof Au.version=="number"?Au.version:VARIANT_SCHEMA_VERSION}}function normalizeVariants(Au){if(!Au)return{};const lo={};for(const[$u,Ru]of Object.entries(Au))!Ru||typeof Ru!="object"||!("theme"in Ru)||!("colorMode"in Ru)||(lo[$u]=normalizeVariantPreference(Ru));return lo}function hasMissingVariantVersion(Au){return!Au||Object.keys(Au).length===0?!1:Object.values(Au).some(lo=>typeof lo?.version!="number")}const colorModeCycle={light:"dark",dark:"auto",auto:"light"};function createThemeStore(Au,lo){return create$j()(persist$2($u=>({colorMode:lo?.colorMode,theme:lo?.theme,activeVariant:null,variants:normalizeVariants(lo?.variants),toggleColorMode:()=>$u(Ru=>{const Iu=colorModeCycle[Ru.colorMode];return Ru.activeVariant&&Ru.variants[Ru.activeVariant]?{colorMode:Iu,variants:{...Ru.variants,[Ru.activeVariant]:{...Ru.variants[Ru.activeVariant],colorMode:Iu,version:VARIANT_SCHEMA_VERSION}}}:{colorMode:Iu}}),setColorMode:Ru=>$u(Iu=>Iu.activeVariant&&Iu.variants[Iu.activeVariant]?{colorMode:Ru,variants:{...Iu.variants,[Iu.activeVariant]:{...Iu.variants[Iu.activeVariant],colorMode:Ru,version:VARIANT_SCHEMA_VERSION}}}:{colorMode:Ru}),setTheme:(Ru,Iu=!0)=>$u(Ou=>{const Pu=Iu?themeConfigs[Ru].defaultColorMode:Ou.colorMode;return Ou.activeVariant&&Ou.variants[Ou.activeVariant]?{theme:Ru,colorMode:Pu,variants:{...Ou.variants,[Ou.activeVariant]:{theme:Ru,colorMode:Pu,version:VARIANT_SCHEMA_VERSION}}}:{theme:Ru,colorMode:Pu}}),registerVariants:Ru=>$u(Iu=>{const Ou={...Iu.variants};for(const[Pu,Du]of Object.entries(Ru))Ou[Pu]?Ou[Pu]=normalizeVariantPreference({...Ou[Pu],version:Ou[Pu].version??VARIANT_SCHEMA_VERSION}):Ou[Pu]=normalizeVariantPreference(Du);return{variants:Ou}}),setVariant:Ru=>$u(Iu=>{const Ou=Iu.variants[Ru];return Ou?{activeVariant:Ru,theme:Ou.theme,colorMode:Ou.colorMode}:{activeVariant:Ru}})}),{name:Au,version:3,storage:createJSONStorage$1(()=>localStorage),partialize:$u=>({colorMode:$u.colorMode,theme:$u.theme,activeVariant:$u.activeVariant,variants:$u.variants}),migrate:$u=>{const Ru=$u??{},Iu=Ru.variants,Ou=hasMissingVariantVersion(Iu),Pu=normalizeVariants(Iu);return Ou&&(Pu["agent-anonymous"]={theme:"matrix",colorMode:"dark",version:VARIANT_SCHEMA_VERSION}),{...Ru,variants:Pu,...Ou?{theme:Ru.activeVariant==="agent-anonymous"?"matrix":Ru.theme,colorMode:Ru.activeVariant==="agent-anonymous"?"dark":Ru.colorMode}:{}}},merge:($u,Ru)=>{const Iu=$u??{},Ou=normalizeVariants(Ru.variants);if(Iu.variants)for(const[Pu,Du]of Object.entries(Iu.variants))Du&&typeof Du=="object"&&"theme"in Du&&(Ou[Pu]=normalizeVariantPreference(Du));return{...Ru,...Iu,variants:Ou}}}))}const useThemeStore=createThemeStore("datalayer-theme",{colorMode:"dark",theme:"matrix"}),dlBrightDark=getBrightPalette("datalayer"),dlBrightLight=getBrightPalette("datalayer","light"),spBrightDark=getBrightPalette("spatial"),spBrightLight=getBrightPalette("spatial","light"),lvBrightDark=getBrightPalette("lovely"),lvBrightLight=getBrightPalette("lovely","light"),mxBrightDark=getBrightPalette("matrix"),mxBrightLight=getBrightPalette("matrix","light"),eaBrightDark=getBrightPalette("earth"),eaBrightLight=getBrightPalette("earth","light"),saBrightDark=getBrightPalette("sand"),saBrightLight=getBrightPalette("sand","light"),ivBrightDark=getBrightPalette("ivory"),ivBrightLight=getBrightPalette("ivory","light"),suBrightDark=getBrightPalette("sun"),suBrightLight=getBrightPalette("sun","light"),loBrightDark=getBrightPalette("loop"),loBrightLight=getBrightPalette("loop","light"),palettes={datalayer:{light:{bg:"#f6f8fa",bgPanel:"#ffffff",bgAlt:"#f0f3f6",primary:datalayerColors.greenBrand,secondary:datalayerColors.greenText,accent:datalayerColors.greenBright,glow:dlBrightLight.glow,pop:dlBrightLight.pop,spark:dlBrightLight.spark,blaze:dlBrightLight.blaze,surge:dlBrightLight.surge,flame:dlBrightLight.flame,gold:dlBrightLight.gold,textLight:"#1f2328",textMuted:"#656d76",isLight:!0},dark:{bg:"#0d1117",bgPanel:"#161b22",bgAlt:"#1c2128",primary:datalayerColors.greenAccent,secondary:datalayerColors.greenBrand,accent:datalayerColors.greenBright,glow:dlBrightDark.glow,pop:dlBrightDark.pop,spark:dlBrightDark.spark,blaze:dlBrightDark.blaze,surge:dlBrightDark.surge,flame:dlBrightDark.flame,gold:dlBrightDark.gold,textLight:"#f0f6fc",textMuted:"#8b949e",isLight:!1}},spatial:{light:{bg:"#f0f2ff",bgPanel:"#ffffff",bgAlt:"#eef2ff",primary:spatialColors.indigoBrand,secondary:spatialColors.indigoText,accent:spatialColors.indigoBright,glow:spBrightLight.glow,pop:spBrightLight.pop,spark:spBrightLight.spark,blaze:spBrightLight.blaze,surge:spBrightLight.surge,flame:spBrightLight.flame,gold:spBrightLight.gold,textLight:"#1E1E3F",textMuted:spatialColors.gray,isLight:!0},dark:{bg:spatialColors.black,bgPanel:"#111827",bgAlt:"#1E293B",primary:spatialColors.indigoAccent,secondary:spatialColors.indigoBrand,accent:spatialColors.indigoBright,glow:spBrightDark.glow,pop:spBrightDark.pop,spark:spBrightDark.spark,blaze:spBrightDark.blaze,surge:spBrightDark.surge,flame:spBrightDark.flame,gold:spBrightDark.gold,textLight:"#E0E7FF",textMuted:"#94A3B8",isLight:!1}},lovely:{light:{bg:"#fff5f7",bgPanel:"#ffffff",bgAlt:lovelyColors.roseTint,primary:lovelyColors.roseBrand,secondary:lovelyColors.roseText,accent:lovelyColors.roseBright,glow:lvBrightLight.glow,pop:lvBrightLight.pop,spark:lvBrightLight.spark,blaze:lvBrightLight.blaze,surge:lvBrightLight.surge,flame:lvBrightLight.flame,gold:lvBrightLight.gold,textLight:"#2D1B28",textMuted:lovelyColors.gray,isLight:!0},dark:{bg:lovelyColors.black,bgPanel:"#250E1D",bgAlt:"#3D1530",primary:lovelyColors.roseAccent,secondary:lovelyColors.roseBrand,accent:lovelyColors.roseBright,glow:lvBrightDark.glow,pop:lvBrightDark.pop,spark:lvBrightDark.spark,blaze:lvBrightDark.blaze,surge:lvBrightDark.surge,flame:lvBrightDark.flame,gold:lvBrightDark.gold,textLight:"#FCE7F3",textMuted:"#D4A5BD",isLight:!1}},matrix:{light:{bg:"#f0fff0",bgPanel:"#ffffff",bgAlt:matrixColors.greenTint,primary:matrixColors.greenBrand,secondary:matrixColors.greenText,accent:matrixColors.greenAccent,glow:mxBrightLight.glow,pop:mxBrightLight.pop,spark:mxBrightLight.spark,blaze:mxBrightLight.blaze,surge:mxBrightLight.surge,flame:mxBrightLight.flame,gold:mxBrightLight.gold,textLight:"#0A2E1A",textMuted:matrixColors.gray,isLight:!0},dark:{bg:matrixColors.black,bgPanel:"#0A1F0A",bgAlt:"#122812",primary:matrixColors.greenPhosphor,secondary:matrixColors.greenGlow,accent:matrixColors.greenGlow,glow:mxBrightDark.glow,pop:mxBrightDark.pop,spark:mxBrightDark.spark,blaze:mxBrightDark.blaze,surge:mxBrightDark.surge,flame:mxBrightDark.flame,gold:mxBrightDark.gold,textLight:"#C8E6C9",textMuted:"#66BB6A",isLight:!1}},earth:{light:{bg:"#F0F5FA",bgPanel:"#ffffff",bgAlt:earthColors.oceanTint,primary:earthColors.oceanBrand,secondary:earthColors.oceanText,accent:earthColors.oceanAccent,glow:eaBrightLight.glow,pop:eaBrightLight.pop,spark:eaBrightLight.spark,blaze:eaBrightLight.blaze,surge:eaBrightLight.surge,flame:eaBrightLight.flame,gold:eaBrightLight.gold,textLight:"#1A2332",textMuted:earthColors.gray,isLight:!0},dark:{bg:earthColors.black,bgPanel:"#0E1D30",bgAlt:"#132840",primary:earthColors.oceanAccent,secondary:earthColors.oceanBrand,accent:earthColors.oceanBright,glow:eaBrightDark.glow,pop:eaBrightDark.pop,spark:eaBrightDark.spark,blaze:eaBrightDark.blaze,surge:eaBrightDark.surge,flame:eaBrightDark.flame,gold:eaBrightDark.gold,textLight:"#D4E4DC",textMuted:"#8A9BA8",isLight:!1}},sand:{light:{bg:"#FBF7EF",bgPanel:"#ffffff",bgAlt:sandColors.sandTint,primary:sandColors.sandBrand,secondary:sandColors.sandText,accent:sandColors.sandAccent,glow:saBrightLight.glow,pop:saBrightLight.pop,spark:saBrightLight.spark,blaze:saBrightLight.blaze,surge:saBrightLight.surge,flame:saBrightLight.flame,gold:saBrightLight.gold,textLight:"#2B2118",textMuted:sandColors.gray,isLight:!0},dark:{bg:sandColors.black,bgPanel:"#2A2118",bgAlt:"#33281A",primary:sandColors.sandAccent,secondary:sandColors.sandBrand,accent:sandColors.sandBright,glow:saBrightDark.glow,pop:saBrightDark.pop,spark:saBrightDark.spark,blaze:saBrightDark.blaze,surge:saBrightDark.surge,flame:saBrightDark.flame,gold:saBrightDark.gold,textLight:"#EDE3D3",textMuted:"#B7A793",isLight:!1}},ivory:{light:{bg:"#FBF6EC",bgPanel:"#ffffff",bgAlt:ivoryColors.ivoryTint,primary:ivoryColors.ivoryBrand,secondary:ivoryColors.ivoryText,accent:ivoryColors.ivoryAccent,glow:ivBrightLight.glow,pop:ivBrightLight.pop,spark:ivBrightLight.spark,blaze:ivBrightLight.blaze,surge:ivBrightLight.surge,flame:ivBrightLight.flame,gold:ivBrightLight.gold,textLight:"#2C2318",textMuted:ivoryColors.gray,isLight:!0},dark:{bg:ivoryColors.black,bgPanel:"#2A2219",bgAlt:"#33291B",primary:ivoryColors.ivoryAccent,secondary:ivoryColors.ivoryBrand,accent:ivoryColors.ivoryBright,glow:ivBrightDark.glow,pop:ivBrightDark.pop,spark:ivBrightDark.spark,blaze:ivBrightDark.blaze,surge:ivBrightDark.surge,flame:ivBrightDark.flame,gold:ivBrightDark.gold,textLight:"#EFE6D6",textMuted:"#BBAC97",isLight:!1}},sun:{light:{bg:"#FFF9EC",bgPanel:"#ffffff",bgAlt:sunColors.sunTint,primary:sunColors.sunBrand,secondary:sunColors.sunText,accent:sunColors.sunAccent,glow:suBrightLight.glow,pop:suBrightLight.pop,spark:suBrightLight.spark,blaze:suBrightLight.blaze,surge:suBrightLight.surge,flame:suBrightLight.flame,gold:suBrightLight.gold,textLight:"#2A2210",textMuted:sunColors.gray,isLight:!0},dark:{bg:sunColors.black,bgPanel:"#2A2109",bgAlt:"#33290C",primary:sunColors.sunAccent,secondary:sunColors.sunBrand,accent:sunColors.sunBright,glow:suBrightDark.glow,pop:suBrightDark.pop,spark:suBrightDark.spark,blaze:suBrightDark.blaze,surge:suBrightDark.surge,flame:suBrightDark.flame,gold:suBrightDark.gold,textLight:"#F3E9CF",textMuted:"#BEAC82",isLight:!1}},loop:{light:{bg:loopColors.white,bgPanel:"#ffffff",bgAlt:loopColors.subtle,primary:loopColors.loopBrand,secondary:loopColors.loopText,accent:loopColors.loopAccent,glow:loBrightLight.glow,pop:loBrightLight.pop,spark:loBrightLight.spark,blaze:loBrightLight.blaze,surge:loBrightLight.surge,flame:loBrightLight.flame,gold:loBrightLight.gold,textLight:loopColors.ink,textMuted:loopColors.gray,isLight:!0},dark:{bg:loopColors.black,bgPanel:"#19191B",bgAlt:loopColors.subtleDark,primary:loopColors.loopBrand,secondary:loopColors.loopBright,accent:loopColors.loopAccent,glow:loBrightDark.glow,pop:loBrightDark.pop,spark:loBrightDark.spark,blaze:loBrightDark.blaze,surge:loBrightDark.surge,flame:loBrightDark.flame,gold:loBrightDark.gold,textLight:loopColors.inkDark,textMuted:loopColors.grayDark,isLight:!1}}};function getColorPalette(Au="datalayer",lo="auto"){const $u=lo==="auto"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":lo;return palettes[Au]?.[$u]??palettes.datalayer.dark}function useColorPalette(){const{colorMode:Au,theme:lo}=useThemeStore();return getColorPalette(lo,Au)}const SHEET_SHADOW="0 1px 2px rgba(0,0,0,0.06), 0 24px 48px -28px rgba(0,0,0,0.35)";function Sheet(Au){return jsxRuntimeExports.jsx(Box,{bg:"canvas.default",border:"1px solid",borderColor:"border.default",borderRadius:"card",boxShadow:SHEET_SHADOW,...Au})}const sizeMap$3={small:16,medium:32,large:64};function _DlIconInverseColormode$3({mode:Au,children:lo}){const $u=reactExports.useRef(null),[Ru,Iu]=reactExports.useState({mode:typeof Au=="string"?Au:null,lightTheme:null,darkTheme:null});return reactExports.useLayoutEffect(()=>{if(typeof document>"u")return;let Ou=null,Pu=null,Du=null,Lu=$u.current&&$u.current.parentElement;for(;Lu&&(!Ou||!Pu||!Du);)Lu.getAttribute&&(Ou=Ou||Lu.getAttribute("data-color-mode"),Pu=Pu||Lu.getAttribute("data-light-theme"),Du=Du||Lu.getAttribute("data-dark-theme")),Lu=Lu.parentElement;(!Ou||Ou==="auto")&&(Ou=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Iu({mode:typeof Au=="string"?Au:Ou==="dark"?"light":"dark",lightTheme:Pu,darkTheme:Du})},[Au]),reactExports.createElement("span",{ref:$u,"data-color-mode":Ru.mode||"light","data-light-theme":Ru.lightTheme||void 0,"data-dark-theme":Ru.darkTheme||void 0,style:{display:"inline-flex",lineHeight:0,color:"var(--fgColor-default, var(--color-fg-default, currentColor))"}},lo)}function AiAgentIcon({title:Au,titleId:lo,size:$u,colored:Ru,themed:Iu,colormode:Ou,...Pu},Du){const Lu=reactExports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:Iu?"var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor))":"var(--datalayer-icon-color, currentColor)",width:$u?typeof $u=="string"?sizeMap$3[$u]:$u:"16px","aria-hidden":"true",ref:Du,"aria-labelledby":lo},Pu,{"data-datalayer-icon":"",style:Pu&&Pu.color!=null?Object.assign({},Pu.style,{"--datalayer-icon-color":Pu.color,color:Pu.color}):Pu&&Pu.style}),reactExports.createElement("style",null,'[data-color-mode="light"]{--datalayer-icon-color-scheme:light}[data-color-mode="dark"]{--datalayer-icon-color-scheme:dark}svg[data-datalayer-icon]{color-scheme:var(--datalayer-icon-color-scheme, light dark)}'),Au?reactExports.createElement("title",{id:lo},Au):null,reactExports.createElement("path",{d:"M5.75 7.5a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5a.75.75 0 01.75-.75zm5.25.75a.75.75 0 00-1.5 0v1.5a.75.75 0 001.5 0v-1.5z"}),reactExports.createElement("path",{d:"M6.25 0h2A.75.75 0 019 .75V3.5h3.25a2.25 2.25 0 012.25 2.25V8h.75a.75.75 0 010 1.5h-.75v2.75a2.25 2.25 0 01-2.25 2.25h-8.5a2.25 2.25 0 01-2.25-2.25V9.5H.75a.75.75 0 010-1.5h.75V5.75A2.25 2.25 0 013.75 3.5H7.5v-2H6.25a.75.75 0 010-1.5zM3 5.75v6.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-6.5a.75.75 0 00-.75-.75h-8.5a.75.75 0 00-.75.75z"}));return Ou?reactExports.createElement(_DlIconInverseColormode$3,{mode:typeof Ou=="string"?Ou:void 0},Lu):Lu}const ForwardRef$3=reactExports.forwardRef(AiAgentIcon),sizeMap$2={small:16,medium:32,large:64};function _DlIconInverseColormode$2({mode:Au,children:lo}){const $u=reactExports.useRef(null),[Ru,Iu]=reactExports.useState({mode:typeof Au=="string"?Au:null,lightTheme:null,darkTheme:null});return reactExports.useLayoutEffect(()=>{if(typeof document>"u")return;let Ou=null,Pu=null,Du=null,Lu=$u.current&&$u.current.parentElement;for(;Lu&&(!Ou||!Pu||!Du);)Lu.getAttribute&&(Ou=Ou||Lu.getAttribute("data-color-mode"),Pu=Pu||Lu.getAttribute("data-light-theme"),Du=Du||Lu.getAttribute("data-dark-theme")),Lu=Lu.parentElement;(!Ou||Ou==="auto")&&(Ou=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Iu({mode:typeof Au=="string"?Au:Ou==="dark"?"light":"dark",lightTheme:Pu,darkTheme:Du})},[Au]),reactExports.createElement("span",{ref:$u,"data-color-mode":Ru.mode||"light","data-light-theme":Ru.lightTheme||void 0,"data-dark-theme":Ru.darkTheme||void 0,style:{display:"inline-flex",lineHeight:0,color:"var(--fgColor-default, var(--color-fg-default, currentColor))"}},lo)}function MicrophoneIcon({title:Au,titleId:lo,size:$u,colored:Ru,themed:Iu,colormode:Ou,...Pu},Du){const Lu=reactExports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 72 72",fill:Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 72%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 62%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 72%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 62%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 72%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",width:$u?typeof $u=="string"?sizeMap$2[$u]:$u:"16px","aria-hidden":"true",ref:Du,"aria-labelledby":lo},Pu,{"data-datalayer-icon":"",style:Pu&&Pu.color!=null?Object.assign({},Pu.style,{"--datalayer-icon-color":Pu.color,color:Pu.color}):Pu&&Pu.style}),reactExports.createElement("style",null,'[data-color-mode="light"]{--datalayer-icon-color-scheme:light}[data-color-mode="dark"]{--datalayer-icon-color-scheme:dark}svg[data-datalayer-icon]{color-scheme:var(--datalayer-icon-color-scheme, light dark)}'),Au?reactExports.createElement("title",{id:lo},Au):null,reactExports.createElement("path",{fill:Ru?"#3F3F3F":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 41%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 93%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 41%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 93%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 41%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",d:"M39.4 29.52c-2.636-2.216-2.553-3.52-2.55-3.523-.109-.127-1.758-1.676-1.777-2.156l-.009-.082-2.556 3.283c.324-.446-6.322 10.406-6.322 10.406L14.393 53.686l3.373 3.372S42.18 35.781 41.828 36.161l3.403-3.356c-.107.004-3.193-1.068-5.83-3.284z"}),reactExports.createElement("path",{fill:Ru?"#D0CFCE":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 71%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 63%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 71%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 63%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 71%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",d:"M54.62 30.18a.998.998 0 01-1.411.093l-16.62-14.58a1 1 0 01-.099-1.4c-.003.003-.007.004-.01.008l-.654.786a1 1 0 00.11 1.391L52.554 31.06a1 1 0 001.427-.113l.655-.787c.04-.047.055-.105.084-.157-.033.06-.054.123-.1.177z"}),reactExports.createElement("path",{fill:Ru?"#3F3F3F":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 41%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 93%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 41%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 93%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 41%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",d:"M55.258 25.541c-1.162 3.4-5.283 5.562-5.283 5.562-1.926 1.097-4.032 1.62-6.038 1.52 0 0-.347-.081-.913-.272-1.828-.634-5.85-2.485-7.25-6.88-.377-2.002-.159-4.185.646-6.277 1.023-4.264 4.995-6.256 4.995-6.256 1.41-.956 2.94-1.59 4.479-1.871 2.82-.533 5.66.08 7.775 1.972 3.327 2.947 3.844 8.086 1.59 12.502z"}),reactExports.createElement("path",{fill:Ru?"#9B9B9A":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 55%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 79%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 55%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 79%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 55%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",d:"M51.475 25.541c-1.172 3.4-5.283 5.562-5.283 5.562a12.08 12.08 0 01-3.168 1.247c-1.828-.633-5.85-2.484-7.25-6.88-.377-2.001-.159-4.184.646-6.276 1.022-4.264 4.995-6.256 4.995-6.256 1.41-.956 2.94-1.59 4.479-1.871 1.46.292 2.83.946 3.992 1.972 3.317 2.947 3.833 8.086 1.589 12.502z"}),reactExports.createElement("path",{d:"M30.75 38.941l4.02-4.619m14.744-3.892c-1.804 1.014-3.774 1.495-5.65 1.404m-2.36-18.184c3.737-2.497 8.405-2.591 11.465.093 3.108 2.727 3.59 7.471 1.489 11.545m-18.223-.065c-.354-1.844-.152-3.862.602-5.789m-3.52 8.196L14.393 53.686l3.373 3.373 23.34-21.572M15.497 56.001l-3.046 3.074m41.417-29.554L37.249 14.94",fill:"none",stroke:Ru?"#000":Pu.color!=null?"color-mix(in srgb, var(--datalayer-icon-color, currentColor) 38%, black)":Iu?"light-dark(color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 96%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor)) 38%, var(--bgColor-default, var(--color-canvas-default, Canvas))))":"light-dark(color-mix(in srgb, var(--datalayer-icon-color, currentColor) 96%, var(--bgColor-default, var(--color-canvas-default, Canvas))), color-mix(in srgb, var(--datalayer-icon-color, currentColor) 38%, var(--bgColor-default, var(--color-canvas-default, Canvas))))",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,strokeWidth:2}));return Ou?reactExports.createElement(_DlIconInverseColormode$2,{mode:typeof Ou=="string"?Ou:void 0},Lu):Lu}const ForwardRef$2=reactExports.forwardRef(MicrophoneIcon),sizeMap$1={small:16,medium:32,large:64};function _DlIconInverseColormode$1({mode:Au,children:lo}){const $u=reactExports.useRef(null),[Ru,Iu]=reactExports.useState({mode:typeof Au=="string"?Au:null,lightTheme:null,darkTheme:null});return reactExports.useLayoutEffect(()=>{if(typeof document>"u")return;let Ou=null,Pu=null,Du=null,Lu=$u.current&&$u.current.parentElement;for(;Lu&&(!Ou||!Pu||!Du);)Lu.getAttribute&&(Ou=Ou||Lu.getAttribute("data-color-mode"),Pu=Pu||Lu.getAttribute("data-light-theme"),Du=Du||Lu.getAttribute("data-dark-theme")),Lu=Lu.parentElement;(!Ou||Ou==="auto")&&(Ou=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Iu({mode:typeof Au=="string"?Au:Ou==="dark"?"light":"dark",lightTheme:Pu,darkTheme:Du})},[Au]),reactExports.createElement("span",{ref:$u,"data-color-mode":Ru.mode||"light","data-light-theme":Ru.lightTheme||void 0,"data-dark-theme":Ru.darkTheme||void 0,style:{display:"inline-flex",lineHeight:0,color:"var(--fgColor-default, var(--color-fg-default, currentColor))"}},lo)}function PlusCircleIcon({title:Au,titleId:lo,size:$u,colored:Ru,themed:Iu,colormode:Ou,...Pu},Du){const Lu=reactExports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",width:$u?typeof $u=="string"?sizeMap$1[$u]:$u:"16px",viewBox:"0 0 24 24",fill:Iu?"var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor))":"var(--datalayer-icon-color, currentColor)","aria-hidden":"true",ref:Du,"aria-labelledby":lo},Pu,{"data-datalayer-icon":"",style:Pu&&Pu.color!=null?Object.assign({},Pu.style,{"--datalayer-icon-color":Pu.color,color:Pu.color}):Pu&&Pu.style}),reactExports.createElement("style",null,'[data-color-mode="light"]{--datalayer-icon-color-scheme:light}[data-color-mode="dark"]{--datalayer-icon-color-scheme:dark}svg[data-datalayer-icon]{color-scheme:var(--datalayer-icon-color-scheme, light dark)}'),Au?reactExports.createElement("title",{id:lo},Au):null,reactExports.createElement("path",{d:"M11.5 0C17.847 0 23 5.153 23 11.5S17.847 23 11.5 23 0 17.847 0 11.5 5.153 0 11.5 0zm0 1C17.295 1 22 5.705 22 11.5S17.295 22 11.5 22 1 17.295 1 11.5 5.705 1 11.5 1zm.5 10h6v1h-6v6h-1v-6H5v-1h6V5h1v6z"}));return Ou?reactExports.createElement(_DlIconInverseColormode$1,{mode:typeof Ou=="string"?Ou:void 0},Lu):Lu}const ForwardRef$1=reactExports.forwardRef(PlusCircleIcon),sizeMap={small:16,medium:32,large:64};function _DlIconInverseColormode({mode:Au,children:lo}){const $u=reactExports.useRef(null),[Ru,Iu]=reactExports.useState({mode:typeof Au=="string"?Au:null,lightTheme:null,darkTheme:null});return reactExports.useLayoutEffect(()=>{if(typeof document>"u")return;let Ou=null,Pu=null,Du=null,Lu=$u.current&&$u.current.parentElement;for(;Lu&&(!Ou||!Pu||!Du);)Lu.getAttribute&&(Ou=Ou||Lu.getAttribute("data-color-mode"),Pu=Pu||Lu.getAttribute("data-light-theme"),Du=Du||Lu.getAttribute("data-dark-theme")),Lu=Lu.parentElement;(!Ou||Ou==="auto")&&(Ou=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Iu({mode:typeof Au=="string"?Au:Ou==="dark"?"light":"dark",lightTheme:Pu,darkTheme:Du})},[Au]),reactExports.createElement("span",{ref:$u,"data-color-mode":Ru.mode||"light","data-light-theme":Ru.lightTheme||void 0,"data-dark-theme":Ru.darkTheme||void 0,style:{display:"inline-flex",lineHeight:0,color:"var(--fgColor-default, var(--color-fg-default, currentColor))"}},lo)}function RestartIcon({title:Au,titleId:lo,size:$u,colored:Ru,themed:Iu,colormode:Ou,...Pu},Du){const Lu=reactExports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Iu?"var(--datalayer-icon-color, var(--datalayer-icon-fg, currentColor))":"var(--datalayer-icon-color, currentColor)",width:$u?typeof $u=="string"?sizeMap[$u]:$u:"16px","aria-hidden":"true",ref:Du,"aria-labelledby":lo},Pu,{"data-datalayer-icon":"",style:Pu&&Pu.color!=null?Object.assign({},Pu.style,{"--datalayer-icon-color":Pu.color,color:Pu.color}):Pu&&Pu.style}),reactExports.createElement("style",null,'[data-color-mode="light"]{--datalayer-icon-color-scheme:light}[data-color-mode="dark"]{--datalayer-icon-color-scheme:dark}svg[data-datalayer-icon]{color-scheme:var(--datalayer-icon-color-scheme, light dark)}'),Au?reactExports.createElement("title",{id:lo},Au):null,reactExports.createElement("path",{fillRule:"evenodd",d:"M18.364 3.058a.75.75 0 01.75.75V8.05a.75.75 0 01-.75.75h-4.243a.75.75 0 010-1.5h2.36a7.251 7.251 0 102.523 3.822.75.75 0 111.45-.387 8.75 8.75 0 11-2.84-4.447v-2.48a.75.75 0 01.75-.75z",clipRule:"evenodd"}));return Ou?reactExports.createElement(_DlIconInverseColormode,{mode:typeof Ou=="string"?Ou:void 0},Lu):Lu}const ForwardRef=reactExports.forwardRef(RestartIcon),__vite_import_meta_env__$2={},createStoreImpl$1=Au=>{let lo;const $u=new Set,Ru=(Bu,Fu)=>{const zu=typeof Bu=="function"?Bu(lo):Bu;if(!Object.is(zu,lo)){const qu=lo;lo=Fu??(typeof zu!="object"||zu===null)?zu:Object.assign({},lo,zu),$u.forEach(Uu=>Uu(lo,qu))}},Iu=()=>lo,Lu={setState:Ru,getState:Iu,getInitialState:()=>ju,subscribe:Bu=>($u.add(Bu),()=>$u.delete(Bu)),destroy:()=>{(__vite_import_meta_env__$2?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),$u.clear()}},ju=lo=Au(Ru,Iu,Lu);return Lu},createStore$1=Au=>Au?createStoreImpl$1(Au):createStoreImpl$1;var withSelector={exports:{}},withSelector_production={},shim={exports:{}},useSyncExternalStoreShim_production={};var hasRequiredUseSyncExternalStoreShim_production;function requireUseSyncExternalStoreShim_production(){if(hasRequiredUseSyncExternalStoreShim_production)return useSyncExternalStoreShim_production;hasRequiredUseSyncExternalStoreShim_production=1;var Au=requireReact();function lo(Fu,zu){return Fu===zu&&(Fu!==0||1/Fu===1/zu)||Fu!==Fu&&zu!==zu}var $u=typeof Object.is=="function"?Object.is:lo,Ru=Au.useState,Iu=Au.useEffect,Ou=Au.useLayoutEffect,Pu=Au.useDebugValue;function Du(Fu,zu){var qu=zu(),Uu=Ru({inst:{value:qu,getSnapshot:zu}}),Hu=Uu[0].inst,Vu=Uu[1];return Ou(function(){Hu.value=qu,Hu.getSnapshot=zu,Lu(Hu)&&Vu({inst:Hu})},[Fu,qu,zu]),Iu(function(){return Lu(Hu)&&Vu({inst:Hu}),Fu(function(){Lu(Hu)&&Vu({inst:Hu})})},[Fu]),Pu(qu),qu}function Lu(Fu){var zu=Fu.getSnapshot;Fu=Fu.value;try{var qu=zu();return!$u(Fu,qu)}catch{return!0}}function ju(Fu,zu){return zu()}var Bu=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ju:Du;return useSyncExternalStoreShim_production.useSyncExternalStore=Au.useSyncExternalStore!==void 0?Au.useSyncExternalStore:Bu,useSyncExternalStoreShim_production}var hasRequiredShim;function requireShim(){return hasRequiredShim||(hasRequiredShim=1,shim.exports=requireUseSyncExternalStoreShim_production()),shim.exports}var hasRequiredWithSelector_production;function requireWithSelector_production(){if(hasRequiredWithSelector_production)return withSelector_production;hasRequiredWithSelector_production=1;var Au=requireReact(),lo=requireShim();function $u(ju,Bu){return ju===Bu&&(ju!==0||1/ju===1/Bu)||ju!==ju&&Bu!==Bu}var Ru=typeof Object.is=="function"?Object.is:$u,Iu=lo.useSyncExternalStore,Ou=Au.useRef,Pu=Au.useEffect,Du=Au.useMemo,Lu=Au.useDebugValue;return withSelector_production.useSyncExternalStoreWithSelector=function(ju,Bu,Fu,zu,qu){var Uu=Ou(null);if(Uu.current===null){var Hu={hasValue:!1,value:null};Uu.current=Hu}else Hu=Uu.current;Uu=Du(function(){function Gu(ed){if(!Ku){if(Ku=!0,Zu=ed,ed=zu(ed),qu!==void 0&&Hu.hasValue){var Xu=Hu.value;if(qu(Xu,ed))return Qu=Xu}return Qu=ed}if(Xu=Qu,Ru(Zu,ed))return Xu;var rd=zu(ed);return qu!==void 0&&qu(Xu,rd)?(Zu=ed,Xu):(Zu=ed,Qu=rd)}var Ku=!1,Zu,Qu,Yu=Fu===void 0?null:Fu;return[function(){return Gu(Bu())},Yu===null?void 0:function(){return Gu(Yu())}]},[Bu,Fu,zu,qu]);var Vu=Iu(ju,Uu[0],Uu[1]);return Pu(function(){Hu.hasValue=!0,Hu.value=Vu},[Vu]),Lu(Vu),Vu},withSelector_production}var hasRequiredWithSelector;function requireWithSelector(){return hasRequiredWithSelector||(hasRequiredWithSelector=1,withSelector.exports=requireWithSelector_production()),withSelector.exports}var withSelectorExports=requireWithSelector();const useSyncExternalStoreExports=getDefaultExportFromCjs(withSelectorExports),__vite_import_meta_env__$1={},{useDebugValue}=vM,{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports;let didWarnAboutEqualityFn=!1;const identity$3=Au=>Au;function useStore$1(Au,lo=identity$3,$u){(__vite_import_meta_env__$1?"production":void 0)!=="production"&&$u&&!didWarnAboutEqualityFn&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),didWarnAboutEqualityFn=!0);const Ru=useSyncExternalStoreWithSelector(Au.subscribe,Au.getState,Au.getServerState||Au.getInitialState,lo,$u);return useDebugValue(Ru),Ru}const createImpl$1=Au=>{(__vite_import_meta_env__$1?"production":void 0)!=="production"&&typeof Au!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const lo=typeof Au=="function"?createStore$1(Au):Au,$u=(Ru,Iu)=>useStore$1(lo,Ru,Iu);return Object.assign($u,lo),$u},create$i=Au=>Au?createImpl$1(Au):createImpl$1,CONTROL_PLANE_URL="https://prod1.datalayer.run",RUNTIMES_PLANE_URL="https://r1.datalayer.run",MCP_SERVER_URL="https://mcp.datalayer.run/mcp",DEFAULT_PLANE_URLS={iamUrl:CONTROL_PLANE_URL,managerUrl:CONTROL_PLANE_URL,libraryUrl:CONTROL_PLANE_URL,spacerUrl:CONTROL_PLANE_URL,otelUrl:CONTROL_PLANE_URL,growthUrl:CONTROL_PLANE_URL,inboundsUrl:CONTROL_PLANE_URL,successUrl:CONTROL_PLANE_URL,supportUrl:CONTROL_PLANE_URL,contentsUrl:RUNTIMES_PLANE_URL,runtimesUrl:RUNTIMES_PLANE_URL,schedulerUrl:RUNTIMES_PLANE_URL,aiAgentsUrl:RUNTIMES_PLANE_URL,aiInferenceUrl:RUNTIMES_PLANE_URL,datalayerMcpServerUrl:MCP_SERVER_URL};class Logger{scope;isDevelopment;constructor(lo){this.scope=lo,this.isDevelopment=!1}log(lo,$u,...Ru){if(!this.isDevelopment&&lo==="debug")return;const Ou=`[${new Date().toISOString()}] [${this.scope}] [${lo.toUpperCase()}]`;switch(lo){case"debug":console.debug(Ou,$u,...Ru);break;case"info":console.info(Ou,$u,...Ru);break;case"warn":console.warn(Ou,$u,...Ru);break;case"error":console.error(Ou,$u,...Ru);break}}debug(lo,...$u){this.log("debug",lo,...$u)}info(lo,...$u){this.log("info",lo,...$u)}warn(lo,...$u){this.log("warn",lo,...$u)}error(lo,...$u){this.log("error",lo,...$u)}}function createLogger(Au){return new Logger(Au)}const configLogger=createLogger("config");let loadConfigurationFromServer=!0,initialConfiguration={token:"",credits:0,cpuEnvironment:'ai-agents-env"',gpuEnvironment:"ai-env",useMock:!1,whiteLabel:!0,loadConfigurationFromServer:!0,jupyterServerless:!1,...DEFAULT_PLANE_URLS,launcher:{category:"Datalayer",name:"Datalayer",icon:null,rank:1},brand:{name:"Datalayer",about:"AI Agents for Data Analysis",logoUrl:"https://assets.datalayer.tech/datalayer-25.svg",logoSquareUrl:"https://assets.datalayer.tech/datalayer-square.png",copyright:"© 2025 Datalayer, Inc",docsUrl:"https://datalayer.ai/docs",supportUrl:"https://datalayer.ai/support",termsUrl:"https://datalayer.ai/terms",pricingUrl:"https://datalayer.ai/pricing",privacyUrl:"https://datalayer.ai/privacy"}};const pageConfiguration={};try{if(typeof document<"u"){const Au=document.getElementById("datalayer-config-data");if(Au?.innerText){const lo=JSON.parse(Au?.innerText||"{}");Object.assign(pageConfiguration,lo),lo.loadConfigurationFromServer!=null&&(loadConfigurationFromServer=lo.loadConfigurationFromServer),initialConfiguration={...initialConfiguration,...lo},configLogger.info("Datalayer configuration loaded from HTML page",initialConfiguration),window.document.title=`${initialConfiguration.brand.name} ☰ ${initialConfiguration.brand.about}`}}}catch(Au){configLogger.debug("No valid configuration found in the webpage.",Au)}const coreStore=createStore$1((Au,lo)=>({tab:0,getIntTab:()=>Math.floor(lo().tab),setTab:$u=>Au(Ru=>({tab:$u})),configuration:initialConfiguration,setConfiguration:$u=>{configLogger.debug("Setting Datalayer configuration",$u),Au(Ru=>({configuration:{...Ru.configuration,...$u}}))},version:"",setVersion:$u=>{$u&&!lo().version&&Au(Ru=>({version:$u}))},loadConfigurationFromServer,setLoadConfigurationFromServer:$u=>{Au(Ru=>({loadConfigurationFromServer:$u}))}}));function useCoreStore(Au){return useStore$1(coreStore,Au)}const getOtelConsumeUrl=()=>coreStore.getState().configuration.otelUrl,BACKEND_TOOL_ACTIONS={"create-plan":["read"],"current-time":["read"],decide:["read"],"display-recipe":["read"],"example-create-plan":["read"],"example-current-time":["read"],"example-display-recipe":["read"],"example-generate-haiku":["read"],"example-generate-task-steps":["read"],"example-get-weather":["read"],"example-render-a2ui-surface":["read"],"example-update-plan-step":["read"],"generate-haiku":["read"],"generate-task-steps":["read"],"get-weather":["read"],"runtime-echo":["read"],"runtime-send-mail":["send"],"runtime-sensitive-echo":["read"],"update-plan-step":["read"]},SERVER_ACTIONS={alphavantage:{default:[],tools:{},conditions:{},signs:{}},chart:{checked:"2026-10-02",default:[],tools:{generate_area_chart:["read"],generate_bar_chart:["read"],generate_boxplot_chart:["read"],generate_column_chart:["read"],generate_district_map:["read"],generate_dual_axes_chart:["read"],generate_fishbone_diagram:["read"],generate_flow_diagram:["read"],generate_funnel_chart:["read"],generate_histogram_chart:["read"],generate_line_chart:["read"],generate_liquid_chart:["read"],generate_mind_map:["read"],generate_network_graph:["read"],generate_organization_chart:["read"],generate_path_map:["read"],generate_pie_chart:["read"],generate_pin_map:["read"],generate_radar_chart:["read"],generate_sankey_chart:["read"],generate_scatter_chart:["read"],generate_treemap_chart:["read"],generate_venn_chart:["read"],generate_violin_chart:["read"],generate_waterfall_chart:["read"],generate_word_cloud_chart:["read"],generate_spreadsheet:["read"]},conditions:{},signs:{}},datalayer:{checked:"2026-10-05",default:[],tools:{read_notebook:["read"],read_cell:["read"],download_notebook:["read"],list_notebooks:["read"],list_spaces:["read"],list_space_notebooks:["read"],find_notebook:["read"],list_notebook_versions:["read"],list_kernels:["read"],list_files:["read"],list_sandboxes:["read"],list_toolsets:["read"],search_library:["read"],get_library_artifact:["read"],read_library_artifact:["read"],search_earth_datasets:["read"],search_earth_datagranules:["read"],download_earth_data_granules:["read"],odoo_get_context:["read"],odoo_get_account:["read"],odoo_get_settings:["read"],odoo_list_companies:["read"],odoo_set_company:["write"],odoo_list_models:["read"],odoo_get_fields:["read"],odoo_search_records:["read"],odoo_read_records:["read"],odoo_group_records:["read"],odoo_create_record:["write"],odoo_update_records:["write"],odoo_delete_records:["delete"],odoo_accounting_list_invoices:["read"],odoo_accounting_get_invoice:["read"],odoo_accounting_list_journal_entries:["read"],odoo_accounting_list_open_balances:["read"],odoo_accounting_list_accounts:["read"],odoo_accounting_list_journals:["read"],odoo_accounting_get_journal_entry:["read"],odoo_accounting_trial_balance:["read"],odoo_accounting_general_ledger:["read"],odoo_winauditor_preview_balance:["read"],odoo_winauditor_preview_general_journal:["read"],odoo_winauditor_preview_general_ledger:["read"],odoo_accounting_create_draft_invoice:["write"],odoo_accounting_post_invoice:["write"],odoo_accounting_create_draft_journal_entry:["write"],odoo_accounting_post_journal_entry:["write"],odoo_winauditor_import_balance:["write"],odoo_winauditor_import_general_journal:["write"],odoo_winauditor_import_general_ledger:["write"],odoo_winauditor_preview_import_file:["read"],odoo_winauditor_migration_status:["read"],odoo_winauditor_import_partners:["write"],odoo_winauditor_import_chart_of_accounts:["write"],odoo_winauditor_ensure_journals:["write"],odoo_winauditor_import_journal_items:["write"],odoo_winauditor_post_migration_entries:["write"],odoo_winauditor_reconcile_journal_items:["write"],odoo_winauditor_import_assets:["write"],odoo_winauditor_validate_assets:["write"],odoo_winauditor_rollback_migration:["delete"],odoo_winauditor_attach_document:["write"],odoo_winauditor_list_attachments:["read"],odoo_winauditor_validate_migration:["read"],odoo_accounting_list_partners:["read"],odoo_accounting_partner_ledger:["read"],odoo_accounting_aged_balance:["read"],odoo_accounting_list_taxes:["read"],odoo_accounting_list_assets:["read"],odoo_accounting_get_asset:["read"],odoo_accounting_reconcile_lines:["write"],odoo_accounting_unreconcile_lines:["write"],odoo_accounting_bank_status:["read"],odoo_accounting_list_bank_lines:["read"],odoo_accounting_get_bank_line:["read"],odoo_accounting_suggest_bank_matches:["read"],odoo_accounting_suggest_reconciliations:["read"],odoo_accounting_explain_account_balance:["read"],odoo_accounting_list_bank_feeds:["read"],odoo_accounting_list_currency_rates:["read"],odoo_accounting_get_lock_dates:["read"],odoo_accounting_book_bank_line:["write"],odoo_accounting_match_bank_line:["write"],odoo_accounting_reset_bank_line:["write"],odoo_accounting_remove_duplicate_bank_lines:["delete"],odoo_accounting_link_bank_feed:["write"],odoo_accounting_create_vendor_bill:["write"],odoo_accounting_create_customer_invoice:["write"],odoo_accounting_set_currency_rates:["write"],odoo_accounting_set_lock_date:["write"],odoo_accounting_create_matching_model:["write"],odoo_accounting_get_tax_settings:["read"],odoo_accounting_list_tax_returns:["read"],odoo_accounting_get_tax_return:["read"],odoo_accounting_tax_grids:["read"],odoo_accounting_list_tax_grid_lines:["read"],odoo_accounting_check_tax_period:["read"],odoo_accounting_list_untagged_tax_lines:["read"],odoo_accounting_set_tax_periodicity:["write"],odoo_accounting_set_tax_grids:["write"],read_benchmark:["read"],read_benchmark_task:["read"],read_benchmark_task_trajectory:["read"],list_benchmark_task_files:["read"],list_content_sources:["read"],describe_content_source:["read"],list_content_attachments:["read"],list_dataset_revisions:["read"],query_status:["read"],list_secrets:["read"],use_notebook:["read"],unuse_notebook:["read"],connect_to_jupyter:["read"],insert_cell:["write"],delete_cell:["delete"],move_cell:["write"],edit_cell_source:["write"],snapshot_notebook:["write"],restore_notebook:["write"],overwrite_cell_source:["write"],clear_cell_output:["write"],execute_cell:["write"],execute_code:["write"],restart_notebook:["write"],insert_execute_code_cell:["write"],launch_sandbox:["buy"],use_sandbox:["write"],terminate_sandbox:["delete"],snapshot_sandbox:["write","buy"],share_sandbox:["publish"],unshare_sandbox:["write"],marimo_run_cell:["write"],marimo_run_code:["write"],marimo_remove_cell:["delete"],marimo_plan:["read"],marimo_graph:["read"],enable_toolset:["write"],disable_toolset:["write"],attach_content:["write"],detach_content:["write"],query_source:["read"],cancel_query:["write"],save_query_as_revision:["write"],mount_local_folder:["read"]},conditions:{},signs:{}},earthdata:{checked:"2026-10-07",default:[],tools:{search_earth_datasets:["read"],search_earth_datagranules:["read"],download_earth_data_granules:["write"]},conditions:{},signs:{}},eurus:{default:[],tools:{},conditions:{},signs:{}},filesystem:{checked:"2026-10-02",default:[],tools:{read_file:["read"],read_text_file:["read"],read_media_file:["read"],read_multiple_files:["read"],write_file:["write"],edit_file:["write"],create_directory:["write"],list_directory:["read"],list_directory_with_sizes:["read"],directory_tree:["read"],move_file:["write","delete"],search_files:["read"],get_file_info:["read"],list_allowed_directories:["read"]},conditions:{},signs:{}},github:{default:[],tools:{},conditions:{},signs:{}},"google-workspace":{checked:"2026-10-02",default:[],tools:{start_google_auth:["write"],search_gmail_messages:["read"],get_gmail_message_content:["read"],get_gmail_messages_content_batch:["read"],get_gmail_attachment_content:["read","write"],send_gmail_message:["send"],draft_gmail_message:["write"],get_gmail_thread_content:["read"],get_gmail_threads_content_batch:["read"],list_gmail_labels:["read"],manage_gmail_label:["write"],list_gmail_filters:["read"],manage_gmail_filter:["write","send"],modify_gmail_message_labels:["write"],batch_modify_gmail_message_labels:["write"],search_drive_files:["read"],get_drive_file_content:["read"],get_drive_file_download_url:["read"],list_drive_items:["read"],create_drive_folder:["write"],create_drive_file:["write"],import_to_google_doc:["write"],import_to_google_slides:["write"],import_to_google_sheets:["write"],get_drive_file_permissions:["read"],check_drive_file_public_access:["read"],update_drive_file:["write"],get_drive_shareable_link:["read"],manage_drive_access:["publish","send","delete"],copy_drive_file:["write"],set_drive_file_permissions:["publish","write"],list_calendars:["read"],get_events:["read"],manage_event:["write","send"],manage_out_of_office:["write","send"],manage_focus_time:["write","send"],query_freebusy:["read"],create_calendar:["write"],search_docs:["read"],get_doc_content:["read"],list_docs_in_folder:["read"],create_doc:["write"],modify_doc_text:["write"],find_and_replace_doc:["write"],insert_doc_elements:["write"],insert_doc_image:["write"],update_doc_headers_footers:["write"],batch_update_doc:["write","delete"],inspect_doc_structure:["read"],debug_docs_runtime_info:["read"],create_table_with_data:["write"],debug_table_structure:["read"],export_doc_to_pdf:["write"],update_paragraph_style:["write"],get_doc_as_markdown:["read"],manage_doc_tab:["write"],list_document_comments:["read"],manage_document_comment:["write","send"],list_spreadsheets:["read"],get_spreadsheet_info:["read"],read_sheet_values:["read"],modify_sheet_values:["write"],format_sheet_range:["write"],manage_conditional_formatting:["write"],create_spreadsheet:["write"],create_sheet:["write"],list_sheet_tables:["read"],append_table_rows:["write"],manage_sheet_tab:["write"],resize_sheet_dimensions:["write","delete"],move_sheet_rows:["write","delete"],manage_named_range:["write"],list_spreadsheet_comments:["read"],manage_spreadsheet_comment:["write","send"],list_spaces:["read"],get_messages:["read"],send_message:["send","write"],search_messages:["read"],create_reaction:["send"],download_chat_attachment:["read","write"],create_form:["write"],get_form:["read"],set_publish_settings:["publish"],get_form_response:["read"],list_form_responses:["read"],batch_update_form:["write","delete"],create_presentation:["write"],get_presentation:["read"],batch_update_presentation:["write","delete"],get_page:["read"],get_page_thumbnail:["read"],list_presentation_comments:["read"],manage_presentation_comment:["write","send"],list_task_lists:["read"],get_task_list:["read"],manage_task_list:["write"],list_tasks:["read"],get_task:["read"],manage_task:["write"],list_contacts:["read"],get_contact:["read"],search_contacts:["read"],manage_contact:["write"],list_contact_groups:["read"],get_contact_group:["read"],manage_contacts_batch:["write"],manage_contact_group:["write"],search_custom:["read"],get_search_engine_info:["read"],get_script_project:["read"],manage_script_content:["write","delete"],run_script_function:["write","send","delete","publish"],manage_deployment:["publish"],list_script_deployments:["read"],manage_script_project:["write"],manage_script_version:["write"],get_script_version:["read"],get_script_activity:["read"],generate_trigger_code:["read"],manage_script_trigger:["write"]},conditions:{manage_gmail_label:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_gmail_filter:[{argument:"action",classes:["delete"],equals:["delete","update"]}],modify_gmail_message_labels:[{argument:"add_label_ids",classes:["delete"],includes:["TRASH","SPAM"]}],batch_modify_gmail_message_labels:[{argument:"add_label_ids",classes:["delete"],includes:["TRASH","SPAM"]}],update_drive_file:[{argument:"trashed",classes:["delete"],equals:[!0]}],manage_event:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_out_of_office:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_focus_time:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_doc_tab:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_conditional_formatting:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_sheet_tab:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_named_range:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_task_list:[{argument:"action",classes:["delete"],equals:["delete","clear_completed"]}],manage_task:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_contact:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_contacts_batch:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_contact_group:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_deployment:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_script_project:[{argument:"action",classes:["delete"],equals:["delete"]}],manage_script_trigger:[{argument:"action",classes:["delete"],equals:["delete"]}]},signs:{send_gmail_message:"body",draft_gmail_message:"body",send_message:"message_text"}},huggingface:{default:[],tools:{},conditions:{},signs:{}},kaggle:{default:[],tools:{},conditions:{},signs:{}},odoo:{default:[],tools:{},conditions:{},signs:{}},"odoo-accounting":{checked:"2026-10-05",default:[],tools:{odoo_accounting_list_invoices:["read"],odoo_accounting_get_invoice:["read"],odoo_accounting_list_journal_entries:["read"],odoo_accounting_list_open_balances:["read"],odoo_accounting_list_accounts:["read"],odoo_accounting_list_journals:["read"],odoo_accounting_get_journal_entry:["read"],odoo_accounting_trial_balance:["read"],odoo_accounting_general_ledger:["read"],odoo_accounting_create_draft_invoice:["write"],odoo_accounting_post_invoice:["write"],odoo_accounting_create_draft_journal_entry:["write"],odoo_accounting_post_journal_entry:["write"],odoo_accounting_list_partners:["read"],odoo_accounting_partner_ledger:["read"],odoo_accounting_aged_balance:["read"],odoo_accounting_list_taxes:["read"],odoo_accounting_list_assets:["read"],odoo_accounting_get_asset:["read"],odoo_accounting_reconcile_lines:["write"],odoo_accounting_unreconcile_lines:["write"],odoo_accounting_bank_status:["read"],odoo_accounting_list_bank_lines:["read"],odoo_accounting_get_bank_line:["read"],odoo_accounting_suggest_bank_matches:["read"],odoo_accounting_suggest_reconciliations:["read"],odoo_accounting_explain_account_balance:["read"],odoo_accounting_list_bank_feeds:["read"],odoo_accounting_list_currency_rates:["read"],odoo_accounting_get_lock_dates:["read"],odoo_accounting_book_bank_line:["write"],odoo_accounting_match_bank_line:["write"],odoo_accounting_reset_bank_line:["write"],odoo_accounting_remove_duplicate_bank_lines:["delete"],odoo_accounting_link_bank_feed:["write"],odoo_accounting_create_vendor_bill:["write"],odoo_accounting_create_customer_invoice:["write"],odoo_accounting_set_currency_rates:["write"],odoo_accounting_set_lock_date:["write"],odoo_accounting_create_matching_model:["write"],odoo_accounting_get_tax_settings:["read"],odoo_accounting_list_tax_returns:["read"],odoo_accounting_get_tax_return:["read"],odoo_accounting_tax_grids:["read"],odoo_accounting_list_tax_grid_lines:["read"],odoo_accounting_check_tax_period:["read"],odoo_accounting_list_untagged_tax_lines:["read"],odoo_accounting_set_tax_periodicity:["write"],odoo_accounting_set_tax_grids:["write"]},conditions:{},signs:{}},salesforce:{default:[],tools:{},conditions:{},signs:{}},slack:{checked:"2026-10-02",default:[],tools:{slack_list_channels:["read"],slack_post_message:["send"],slack_reply_to_thread:["send"],slack_add_reaction:["send"],slack_get_channel_history:["read"],slack_get_thread_replies:["read"],slack_get_users:["read"],slack_get_user_profile:["read"]},conditions:{},signs:{slack_post_message:"text",slack_reply_to_thread:"text"}},tavily:{checked:"2026-10-02",default:[],tools:{tavily_search:["read"],tavily_extract:["read"],tavily_crawl:["read"],tavily_map:["read"],tavily_research:["read"]},conditions:{},signs:{}}},BEHAVIOURS=["do_it","if_asked","ask_first","leave_to_me"],DEFAULT_BEHAVIOURS={read:"do_it",write:"ask_first",send:"ask_first",buy:"ask_first",delete:"ask_first",publish:"ask_first"},SERVER_TOOL=/^([A-Za-z0-9_-]+)(?::\d+(?:\.\d+)*)?\.([A-Za-z_][A-Za-z0-9_-]*)$/,own$a=(Au,lo)=>Object.prototype.hasOwnProperty.call(Au,lo)?Au[lo]:void 0,idOf=Au=>{const lo=Au.lastIndexOf(":");return lo>0&&Au.slice(lo+1).includes(".")?Au.slice(0,lo):Au};function splitRef(Au){const lo=SERVER_TOOL.exec(Au);return lo?[lo[1],lo[2]]:[void 0,idOf(Au)]}const isPattern=Au=>/[*?]/.test(Au);function matchesPattern(Au,lo){const $u=Array.from(lo,Ru=>Ru==="*"?"[\\s\\S]*":Ru==="?"?"[\\s\\S]":Ru.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("");return new RegExp(`^${$u}$`).test(Au)}const isComparable=Au=>typeof Au=="string"||typeof Au=="boolean"||typeof Au=="number"&&Number.isFinite(Au)&&(!Number.isInteger(Au)||Number.isSafeInteger(Au)),same=(Au,lo)=>typeof Au=="string"&&typeof lo=="string"?Au.trim().toLowerCase()===lo.trim().toLowerCase():isComparable(Au)&&isComparable(lo)&&Au===lo;function conditionHolds(Au,lo){if(!Object.prototype.hasOwnProperty.call(lo,Au.argument))return!1;const $u=lo[Au.argument];return Au.equals?.some(Ru=>same($u,Ru))?!0:Au.includes?.length?(Array.isArray($u)?$u:[$u]).some(Iu=>Au.includes.some(Ou=>same(Iu,Ou))):!1}function entryOf$1(Au,lo){const $u=own$a(SERVER_ACTIONS,Au);if(!$u)return[[],[]];const Ru=own$a($u.tools,lo);if(Ru)return[[...Ru],own$a($u.conditions,lo)??[]];for(const[Iu,Ou]of Object.entries($u.tools))if(isPattern(Iu)&&matchesPattern(lo,Iu))return[[...Ou],own$a($u.conditions,Iu)??[]];return[[...$u.default],[]]}const FORWARDING={"google-workspace.send_gmail_message":{message:"forward_message_id",mailbox:"user_google_email",recipients:["to","cc","bcc"]}};function addresses(Au){return(Array.isArray(Au)?Au:[Au]).filter($u=>typeof $u=="string").flatMap($u=>$u.split(",")).map($u=>{const Ru=/<([^>]*)>/.exec($u);return(Ru?Ru[1]:$u).trim().toLowerCase()}).filter($u=>$u.includes("@"))}const domainOf=Au=>Au.slice(Au.lastIndexOf("@")+1).trim();function forwardsOutside(Au,lo,$u){const Ru=own$a(FORWARDING,`${Au}.${lo}`),Iu=Ru?$u[Ru.message]:void 0;if(!Ru||typeof Iu!="string"||!Iu.trim())return!1;const[Ou]=addresses($u[Ru.mailbox]);return Ou?Ru.recipients.flatMap(Pu=>addresses($u[Pu])).some(Pu=>domainOf(Pu)!==domainOf(Ou)):!0}function classesOf(Au,lo){const[$u,Ru]=splitRef(Au);if($u===void 0)return[...own$a(BACKEND_TOOL_ACTIONS,Ru)??[]];const[Iu,Ou]=entryOf$1($u,Ru);for(const Pu of Ou)if(lo===void 0||conditionHolds(Pu,lo))for(const Du of Pu.classes)Iu.includes(Du)||Iu.push(Du);return lo!==void 0&&Iu.length>0&&!Iu.includes("publish")&&forwardsOutside($u,Ru,lo)&&Iu.push("publish"),Iu}const strictest=Au=>Au.reduce((lo,$u)=>BEHAVIOURS.indexOf($u)>BEHAVIOURS.indexOf(lo)?$u:lo),connectionTo=(Au,lo)=>Au.connections.find($u=>idOf($u.server)===lo),reaches=(Au,lo)=>Au.only.length===0||Au.only.some($u=>matchesPattern(lo,$u)),isClass$1=Au=>Object.prototype.hasOwnProperty.call(DEFAULT_BEHAVIOURS,Au),normal=Au=>{if(isClass$1(Au))return Au;const[lo,$u]=splitRef(Au);return lo!==void 0?`${lo}.${$u}`:$u},byClasses=(Au,lo)=>{const $u={};for(const Ru of Au.rules)for(const Iu of Ru.appliesTo)isClass$1(Iu)&&($u[Iu]=Ru.behaviour);return lo.map(Ru=>$u[Ru]??DEFAULT_BEHAVIOURS[Ru])};function behaviourFor(Au,lo,$u={}){const[Ru,Iu]=splitRef(lo);let Ou,Pu=[],Du;if($u.classes?Ou=Du=[...$u.classes]:(Du=classesOf(lo),Ou=classesOf(lo,{}),Pu=($u.arguments===void 0?Du:classesOf(lo,$u.arguments)).filter(Bu=>!Ou.includes(Bu))),Ru!==void 0){const ju=connectionTo(Au,Ru);if(!ju||!reaches(ju,Iu)||ju.access==="read"&&Du.some(Bu=>Bu!=="read"))return"leave_to_me"}const Lu=Ru!==void 0?`${Ru}.${Iu}`:Iu;for(const ju of Au.rules)if(ju.appliesTo.some(Bu=>!isClass$1(Bu)&&normal(Bu)===Lu))return strictest([ju.behaviour,...byClasses(Au,Pu)]);return Ou.length===0&&Pu.length===0?"leave_to_me":strictest(byClasses(Au,[...Ou,...Pu]))}const BEHAVIOUR_WORDS={do_it:{says:"Do it",means:"It does it without asking."},if_asked:{says:"Do it if I asked",means:"Only what you approved in advance."},ask_first:{says:"Ask me first",means:"It waits for your yes."},leave_to_me:{says:"Leave it to me",means:"It never does it, and hands it to you."}},ACTION_WORDS={read:"Read",write:"Create or change",send:"Send",buy:"Buy",delete:"Delete",publish:"Share or publish"};function coverOf(Au){const lo=own$a(ACTION_WORDS,Au);if(lo)return lo;const[$u,Ru]=splitRef(Au);return $u?`${Ru} (${$u})`:Ru}const DEFAULT_UPLOAD_MB=10,DEFAULT_MAX_FILES=5;function kindTakes(Au,lo){const $u=Au.trim().toLowerCase();if($u.startsWith("."))return lo.name.toLowerCase().endsWith($u);const Ru=(lo.type||"").split(";",1)[0].trim().toLowerCase();return $u.endsWith("/*")?Ru.startsWith($u.slice(0,-1)):Ru===$u}const acceptsFile=(Au,lo)=>!Au?.length||Au.some($u=>kindTakes($u,lo)),megabytes=Au=>`${(Au/(1024*1024)).toFixed(1)} MB`,uploadsAccept=Au=>Au.kinds.map(lo=>lo.type).join(",");function uploadsRefusal(Au,lo){if(lo.length===0)return null;const $u=Au.interface.uploads;if(!$u)return`${Au.name} takes no file sent with a message: its Appspec names none it takes (interface.uploads).`;if(lo.length>$u.maxFiles)return`${lo.length} files were sent at once: ${Au.name} takes at most ${$u.maxFiles}.`;for(const Ru of lo){const Iu=$u.kinds.find(Ou=>kindTakes(Ou.type,Ru));if(!Iu){const Ou=$u.kinds.map(Pu=>Pu.type).join(", ");return`${Ru.name} is not a kind of file ${Au.name} takes: it takes ${Ou}.`}if(Ru.size>Iu.maxMb*1024*1024)return`${Ru.name} is ${megabytes(Ru.size)}: ${Au.name} takes ${Iu.type} of at most ${Iu.maxMb} MB.`}return null}function uploadsInWords(Au){return`Takes ${Au.kinds.map($u=>`${$u.type} up to ${$u.maxMb} MB`).join(", ")}; ${Au.maxFiles} at most at once.`}const APP_SCHEMA="loop.app/v1",DEFAULT_LANGUAGE="en",DEFAULT_EMOJI="👀",APP_KINDS=["chat","widget","decision","worker"],APP_ACCENTS=["green","rose","sky","lime","sun","violet"],APP_THEME_VARIANTS=["datalayer","spatial","lovely","matrix","earth","sand","ivory","sun","loop"],APP_THEME_MODES=["light","dark","auto"],APP_EMBED_MODES=["inline","bubble","panel","assistant"],APP_ASSISTANT_CHARACTER_ID=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;function isAssistantCharacterId(Au){return typeof Au=="string"&&Au.length<=64&&APP_ASSISTANT_CHARACTER_ID.test(Au)}const ACTION_CLASS_NAMES=["read","write","send","buy","delete","publish"],DEFAULT_LAYOUTS={chat:"chat",widget:"page",decision:"page",worker:"split"},DEFAULT_RECORD_INCLUDE=["conversations","actions","approvals"],DEFAULT_KEEP_FOR="1_years",DEFAULT_READY_AT=.8,DEFAULT_PROTOCOL="a2ui/v0.9",DEFAULT_ICON="apps",DEFAULT_VERSION="0.0.1",NO_HOST_PARAMETERS={type:"object",properties:{}},isData=Au=>!!Au&&typeof Au=="object"&&!Array.isArray(Au),text$j=(Au,lo="")=>typeof Au=="string"?Au:lo,flag=(Au,lo)=>typeof Au=="boolean"?Au:lo,numberOf=(Au,lo)=>typeof Au=="number"&&Number.isFinite(Au)?Au:lo,texts=Au=>Array.isArray(Au)?Au.filter(lo=>typeof lo=="string"):[],records=Au=>Array.isArray(Au)?Au.filter(isData):[],oneOf$4=(Au,lo,$u)=>lo.includes(Au)?Au:$u,RETENTION$1=/^([1-9]\d*)_(day|days|month|months|year|years)$/,DAYS={day:1,month:30,year:365};function retentionDays(Au){const lo=RETENTION$1.exec(Au.trim());return lo?Number(lo[1])*DAYS[lo[2].replace(/s$/,"")]:0}function emptyAppspec(Au="chat"){return{schema:APP_SCHEMA,id:"",version:DEFAULT_VERSION,name:"",kind:Au,description:"",owner:"",agent:"",team:"",instructions:"",model:"",skills:[],backendTools:[],context:[],contents:[],connections:[],rules:[],permissions:{spaces:[],computer:{browse:!1,files:!1,shell:!1}},interface:{layout:DEFAULT_LAYOUTS[Au],welcome:"",starters:[],commands:[],modes:[],profiles:[],language:DEFAULT_LANGUAGE,translations:{},components:[],outputs:[]},tests:{readyAt:DEFAULT_READY_AT,evalset:"",cases:[],verified:{live:[],recorded:[],unverified:[]}},record:{keepFor:DEFAULT_KEEP_FOR,retentionDays:retentionDays(DEFAULT_KEEP_FOR),include:[...DEFAULT_RECORD_INCLUDE],suggestTests:!1},checks:{guards:[],gates:[],track:""},deployment:{},goal:"",triggers:[],memory:"",notifications:[],samples:{documents:[],alternatives:[]},setup:[],enabled:!0,unavailable_because:"",tags:[],icon:DEFAULT_ICON,emoji:DEFAULT_EMOJI,avatar:"",banner:""}}const KNOWN_KEYS=["schema","id","version","name","kind","description","owner","agent","team","instructions","model","skills","backend_tools","tools","context","contents","connections","rules","permissions","interface","tests","record","checks","deployment","goal","triggers","memory","notifications","decision","samples","enabled","unavailable_because","tags","icon","emoji","avatar","banner"],CHECK_STAGES=["answer","tool_call"];function parseTool(Au){return{name:text$j(Au.name),description:text$j(Au.description),parameters:isData(Au.parameters)?Au.parameters:{...NO_HOST_PARAMETERS},does:texts(Au.does)}}function parseConnection(Au){return{server:text$j(Au.server),access:oneOf$4(Au.access,["read","write"],"read"),as:oneOf$4(Au.as,["owner","user"],"owner"),only:texts(Au.only)}}function parseRule$1(Au){return{action:text$j(Au.action),appliesTo:typeof Au.applies_to=="string"?[Au.applies_to]:texts(Au.applies_to),behaviour:oneOf$4(Au.behaviour,BEHAVIOURS,"ask_first")}}function parseCommand$1(Au){return{name:text$j(Au.name),description:text$j(Au.description),prompt:text$j(Au.prompt)}}function parseModeOption(Au){const lo={id:text$j(Au.id),label:text$j(Au.label)};for(const $u of["description","instructions","model"])typeof Au[$u]=="string"&&Au[$u]&&(lo[$u]=Au[$u]);return lo}function parseMode(Au){const lo={id:text$j(Au.id),label:text$j(Au.label),options:records(Au.options).map(parseModeOption)};return typeof Au.default=="string"&&Au.default&&(lo.default=Au.default),lo}function parseStarter(Au){const lo={label:text$j(Au.label),message:text$j(Au.message)};return typeof Au.category=="string"&&Au.category&&(lo.category=Au.category),lo}function parseProfile(Au){return{id:text$j(Au.id),label:text$j(Au.label),description:text$j(Au.description),instructions:text$j(Au.instructions),model:typeof Au.model=="string"&&Au.model?Au.model:null,starters:records(Au.starters).map(parseStarter)}}function wordsBy(Au){return Object.fromEntries(Object.entries(isData(Au)?Au:{}).filter(lo=>typeof lo[1]=="string"))}function recordsBy(Au){return Object.fromEntries(Object.entries(isData(Au)?Au:{}).filter(lo=>isData(lo[1])))}const mapValues=(Au,lo)=>Object.fromEntries(Object.entries(Au).map(([$u,Ru])=>[$u,lo(Ru)]));function parseTranslation(Au){return{name:text$j(Au.name),description:text$j(Au.description),welcome:text$j(Au.welcome),starters:mapValues(recordsBy(Au.starters),lo=>({label:text$j(lo.label),message:text$j(lo.message)})),categories:wordsBy(Au.categories),settings:mapValues(recordsBy(Au.settings),lo=>({title:text$j(lo.title),description:text$j(lo.description),options:wordsBy(lo.options)})),commands:wordsBy(Au.commands),modes:mapValues(recordsBy(Au.modes),lo=>({label:text$j(lo.label),options:mapValues(recordsBy(lo.options),$u=>({label:text$j($u.label),description:text$j($u.description)}))})),profiles:mapValues(recordsBy(Au.profiles),lo=>({label:text$j(lo.label),description:text$j(lo.description)}))}}function parseSurface(Au){return{protocol:text$j(Au.protocol,DEFAULT_PROTOCOL),components:records(Au.components).filter(lo=>typeof lo.id=="string"&&typeof lo.component=="string"),composedBy:text$j(Au.composed_by),composedAt:text$j(Au.composed_at)}}const DEFAULT_VOICE={enabled:!1,input:"push_to_talk",output:"on_request",where:"auto"};function parseVoice(Au){const lo=isData(Au)?Au:{};return{enabled:lo.enabled===!0,input:oneOf$4(lo.input,["off","push_to_talk","hands_free"],DEFAULT_VOICE.input),output:oneOf$4(lo.output,["off","on_request","always"],DEFAULT_VOICE.output),voice:text$j(lo.voice),language:text$j(lo.language),where:oneOf$4(lo.where,["auto","device","server"],DEFAULT_VOICE.where)}}function parseUploads(Au){return{kinds:records(Au.kinds).map(lo=>({type:text$j(lo.type),maxMb:numberOf(lo.max_mb,DEFAULT_UPLOAD_MB)})),maxFiles:numberOf(Au.max_files,DEFAULT_MAX_FILES)}}const PAGE_OUTPUT_SHOWS={Text:"text",Image:"url",Table:"rows",Chart:"points"},DEFAULT_CUSTOM_HEIGHT=240;function parseCustomComponent(Au){const lo={name:text$j(Au.name),description:text$j(Au.description),props:isData(Au.props)?JSON.parse(JSON.stringify(Au.props)):{type:"object",properties:{}},shows:texts(Au.shows),sends:texts(Au.sends),source:text$j(Au.source),integrity:text$j(Au.integrity),height:numberOf(Au.height,DEFAULT_CUSTOM_HEIGHT)};return isData(Au.example)&&(lo.example=JSON.parse(JSON.stringify(Au.example))),lo}function dumpCustomComponent(Au){const lo=new Writer().text("name",Au.name,"\0").text("description",Au.description,"\0");return lo.data.props=JSON.parse(JSON.stringify(Au.props)),lo.list("shows",Au.shows).list("sends",Au.sends).text("source",Au.source,"\0").text("integrity",Au.integrity).value("height",Au.height,DEFAULT_CUSTOM_HEIGHT),Au.example&&(lo.data.example=JSON.parse(JSON.stringify(Au.example))),lo.data}function pageOutputShows(Au,lo=[]){return Au in PAGE_OUTPUT_SHOWS?PAGE_OUTPUT_SHOWS[Au]:lo.find($u=>$u.name===Au)?.shows[0]}function parsePage(Au){const lo={function:text$j(Au.function),inputs:isData(Au.inputs)?JSON.parse(JSON.stringify(Au.inputs)):{},outputs:records(Au.outputs).map($u=>({name:text$j($u.name),title:text$j($u.title),component:text$j($u.component,"Text"),props:isData($u.props)?JSON.parse(JSON.stringify($u.props)):{}})),live:Au.live!==!1};return isData(Au.inputs_ui)&&(lo.inputsUi=JSON.parse(JSON.stringify(Au.inputs_ui))),lo}function dumpPage(Au){const lo=new Writer().text("function",Au.function,"\0");return lo.data.inputs=JSON.parse(JSON.stringify(Au.inputs)),Au.inputsUi&&(lo.data.inputs_ui={...Au.inputsUi}),lo.list("outputs",Au.outputs.map($u=>new Writer().text("name",$u.name,"\0").text("title",$u.title).text("component",$u.component,"Text").part("props",{...$u.props}).data)),lo.value("live",Au.live,!0).data}function parseInterface(Au,lo){const $u={layout:oneOf$4(Au.layout,["chat","page","split"],DEFAULT_LAYOUTS[lo]),accent:APP_ACCENTS.includes(Au.accent)?Au.accent:void 0,welcome:text$j(Au.welcome),starters:records(Au.starters).map(parseStarter),commands:records(Au.commands).map(parseCommand$1),modes:records(Au.modes).map(parseMode),profiles:records(Au.profiles).map(parseProfile),language:text$j(Au.language,DEFAULT_LANGUAGE),translations:mapValues(recordsBy(Au.translations),parseTranslation),components:texts(Au.components),voice:parseVoice(Au.voice),outputs:texts(Au.outputs)};return isData(Au.settings)&&($u.settings=JSON.parse(JSON.stringify(Au.settings))),isData(Au.settings_ui)&&($u.settingsUi=JSON.parse(JSON.stringify(Au.settings_ui))),isData(Au.uploads)&&($u.uploads=parseUploads(Au.uploads)),Array.isArray(Au.custom_components)&&($u.customComponents=records(Au.custom_components).map(parseCustomComponent)),isData(Au.surface)&&($u.surface=parseSurface(Au.surface)),isData(Au.page)&&($u.page=parsePage(Au.page)),isAssistantCharacterId(Au.assistant)&&($u.assistant=Au.assistant),(Au.balloon==="history"||Au.balloon==="current")&&($u.balloon=Au.balloon),isData(Au.theme)&&APP_THEME_VARIANTS.includes(Au.theme.variant)&&($u.theme={variant:Au.theme.variant},APP_THEME_MODES.includes(Au.theme.mode)&&($u.theme.mode=Au.theme.mode)),$u}function parseCriterion(Au){return{name:text$j(Au.name),kind:oneOf$4(Au.kind,["metric","noul","choice","score"],"metric"),weight:Math.max(0,numberOf(Au.weight,1)),instructions:text$j(Au.instructions),options:texts(Au.options),direction:Au.direction==="lower"?"lower":"higher",measure:oneOf$4(Au.measure,["","pass_rate","cost_per_task","seconds_per_task"],"")}}function parseDecision(Au){return{question:text$j(Au.question),alternatives:texts(Au.alternatives),criteria:records(Au.criteria).map(parseCriterion),minConfidence:Math.min(1,Math.max(0,numberOf(Au.min_confidence,0))),scenarios:records(Au.scenarios).map(lo=>({name:text$j(lo.name),weights:Object.fromEntries(Object.entries(isData(lo.weights)?lo.weights:{}).filter($u=>typeof $u[1]=="number"))})),decisionModel:text$j(Au.decision_model)}}function parseSamples(Au){return{documents:records(Au.documents).map(lo=>({name:text$j(lo.name),file:text$j(lo.file),text:text$j(lo.text)})),alternatives:records(Au.alternatives).map(lo=>({name:text$j(lo.name),evidence:text$j(lo.evidence),metrics:Object.fromEntries(Object.entries(isData(lo.metrics)?lo.metrics:{}).filter($u=>typeof $u[1]=="number"))}))}}function parseDeployment(Au){const lo={};return isData(Au.hosted)&&(lo.hosted={visibility:oneOf$4(Au.hosted.visibility,["private","invited","organization","link","public"],"private"),slug:text$j(Au.hosted.slug),...Au.hosted.character_alone===!0?{characterAlone:!0}:{}}),isData(Au.embedded)&&(lo.embedded={mode:oneOf$4(Au.embedded.mode,APP_EMBED_MODES,"inline"),origins:texts(Au.embedded.origins),...isData(Au.embedded.host)?{host:{context:texts(Au.embedded.host.context),...Au.embedded.host.user!==void 0?{user:text$j(Au.embedded.host.user)}:{},functions:records(Au.embedded.host.functions).map($u=>({name:text$j($u.name),description:text$j($u.description),parameters:isData($u.parameters)?$u.parameters:{...NO_HOST_PARAMETERS}}))}}:{}}),lo}function parseTrigger(Au){return{type:oneOf$4(Au.type,["schedule","event","once"],"schedule"),cron:text$j(Au.cron),event:text$j(Au.event),at:text$j(Au.at),description:text$j(Au.description),prompt:text$j(Au.prompt)}}function parseAppspec(Au){const lo=[];if(!isData(Au))return{app:emptyAppspec(),problems:["The document is not an application."]};const $u=Au;for(const Uu of Object.keys($u))KNOWN_KEYS.includes(Uu)||lo.push(`\`${Uu}\` is not a field of the spec.`);const Ru=text$j($u.schema,APP_SCHEMA);Ru!==APP_SCHEMA&&lo.push(`This reads ${APP_SCHEMA}; the application is written in ${Ru}.`),APP_KINDS.includes($u.kind)||lo.push($u.kind===void 0?"The application does not say its `kind`.":`\`${String($u.kind)}\` is not a kind: chat, widget, decision or worker.`);const Iu=oneOf$4($u.kind,APP_KINDS,"chat"),Ou=emptyAppspec(Iu),Pu=isData($u.permissions)?$u.permissions:{},Du=isData(Pu.computer)?Pu.computer:{},Lu=isData($u.tests)?$u.tests:{},ju=isData(Lu.verified)?Lu.verified:{},Bu=isData($u.record)?$u.record:{},Fu=isData($u.checks)?$u.checks:{};for(const Uu of records(Fu.code))CHECK_STAGES.includes(Uu.on)||lo.push(`The check \`${text$j(Uu.name)}\` of its code runs on answer or tool_call, not \`${String(Uu.on)}\`.`);const zu=text$j(Bu.keep_for,DEFAULT_KEEP_FOR);retentionDays(zu)===0&&lo.push(`Cannot read the retention \`${zu}\`: write 90_days, 18_months or 1_years.`);const qu={...Ou,schema:APP_SCHEMA,id:text$j($u.id),version:text$j($u.version,DEFAULT_VERSION),name:text$j($u.name),kind:Iu,description:text$j($u.description),owner:text$j($u.owner),agent:text$j($u.agent),team:text$j($u.team),instructions:text$j($u.instructions),model:text$j($u.model),skills:texts($u.skills),backendTools:texts($u.backend_tools),tools:records($u.tools).map(parseTool),context:texts($u.context),contents:texts($u.contents),connections:records($u.connections).map(parseConnection),rules:records($u.rules).map(parseRule$1),permissions:{spaces:records(Pu.spaces).map(Uu=>({space:text$j(Uu.space),access:oneOf$4(Uu.access,["read","write"],"read")})),computer:{browse:flag(Du.browse,!1),files:flag(Du.files,!1),shell:flag(Du.shell,!1)}},interface:parseInterface(isData($u.interface)?$u.interface:{},Iu),tests:{readyAt:Math.min(1,Math.max(0,numberOf(Lu.ready_at,DEFAULT_READY_AT))),evalset:text$j(Lu.evalset),cases:records(Lu.cases).map(Uu=>({ask:text$j(Uu.ask),expect:text$j(Uu.expect),...text$j(Uu.code)?{code:text$j(Uu.code)}:{},...records(Uu.files).length?{files:records(Uu.files).map(Hu=>({name:text$j(Hu.name),text:text$j(Hu.text)}))}:{}})),verified:{live:texts(ju.live),recorded:texts(ju.recorded),unverified:texts(ju.unverified)}},record:{keepFor:zu,retentionDays:retentionDays(zu),include:Array.isArray(Bu.include)?texts(Bu.include):[...DEFAULT_RECORD_INCLUDE],suggestTests:Bu.suggest_tests===!0},checks:{guards:texts(Fu.guards),gates:texts(Fu.gates),track:text$j(Fu.track),code:records(Fu.code).map(Uu=>({name:text$j(Uu.name),on:oneOf$4(Uu.on,CHECK_STAGES,"answer"),description:text$j(Uu.description)}))},deployment:parseDeployment(isData($u.deployment)?$u.deployment:{}),goal:text$j($u.goal),triggers:records($u.triggers).map(parseTrigger),memory:text$j($u.memory),notifications:texts($u.notifications),samples:parseSamples(isData($u.samples)?$u.samples:{}),enabled:flag($u.enabled,!0),unavailable_because:text$j($u.unavailable_because),tags:texts($u.tags),icon:text$j($u.icon,DEFAULT_ICON),emoji:text$j($u.emoji,DEFAULT_EMOJI)||DEFAULT_EMOJI,avatar:text$j($u.avatar).trim(),banner:text$j($u.banner).trim()};return isData($u.decision)&&(qu.decision=parseDecision($u.decision)),{app:qu,problems:lo}}const sameList=(Au,lo)=>Au.length===lo.length&&Au.every(($u,Ru)=>$u===lo[Ru]);class Writer{data={};text(lo,$u,Ru=""){return $u!==Ru&&(this.data[lo]=$u),this}value(lo,$u,Ru){return $u!==Ru&&(this.data[lo]=$u),this}list(lo,$u,Ru=[]){return sameList($u,Ru)||(this.data[lo]=$u),this}part(lo,$u){return Object.keys($u).length>0&&(this.data[lo]=$u),this}present(lo,$u){return $u!==void 0&&(this.data[lo]=$u),this}}function sorted(Au){return Array.isArray(Au)?Au.map(sorted):isData(Au)?Object.fromEntries(Object.keys(Au).sort((lo,$u)=>lo<$u?-1:lo>$u?1:0).map(lo=>[lo,sorted(Au[lo])])):Au}function dumpComponent(Au){const{id:lo,component:$u,...Ru}=Au;return{id:lo,component:$u,...sorted(Ru)}}function dumpSurface(Au){return new Writer().text("protocol",Au.protocol,DEFAULT_PROTOCOL).list("components",Au.components.map(dumpComponent)).text("composed_by",Au.composedBy).text("composed_at",Au.composedAt).data}function dumpStarter(Au){return new Writer().text("label",Au.label,"\0").text("message",Au.message,"\0").text("category",Au.category??"").data}const saidWords=Au=>Object.fromEntries(Object.entries(Au).filter(([,lo])=>lo!==""));function dumpTranslation(Au){const lo=($u,Ru)=>Object.fromEntries(Object.entries($u).map(([Iu,Ou])=>[Iu,Ru(Ou)]));return new Writer().text("name",Au.name).text("description",Au.description).text("welcome",Au.welcome).part("starters",lo(Au.starters,$u=>new Writer().text("label",$u.label).text("message",$u.message).data)).part("categories",saidWords(Au.categories)).part("settings",lo(Au.settings,$u=>new Writer().text("title",$u.title).text("description",$u.description).part("options",saidWords($u.options)).data)).part("commands",saidWords(Au.commands)).part("modes",lo(Au.modes,$u=>new Writer().text("label",$u.label).part("options",lo($u.options,Ru=>new Writer().text("label",Ru.label).text("description",Ru.description).data)).data)).part("profiles",lo(Au.profiles,$u=>new Writer().text("label",$u.label).text("description",$u.description).data)).data}function dumpInterface(Au,lo){const $u=new Writer().value("layout",Au.layout,DEFAULT_LAYOUTS[lo]).value("accent",Au.accent,void 0).text("welcome",Au.welcome).list("starters",Au.starters.map(dumpStarter)).list("commands",Au.commands.map(Ru=>({name:Ru.name,description:Ru.description,prompt:Ru.prompt}))).list("modes",Au.modes.map(Ru=>{const Iu=new Writer().text("id",Ru.id,"\0").text("label",Ru.label,"\0").list("options",Ru.options.map(Ou=>new Writer().text("id",Ou.id,"\0").text("label",Ou.label,"\0").text("description",Ou.description??"").text("instructions",Ou.instructions??"").text("model",Ou.model??"").data));return Ru.default&&(Iu.data.default=Ru.default),Iu.data})).list("profiles",(Au.profiles??[]).map(Ru=>new Writer().text("id",Ru.id,"\0").text("label",Ru.label,"\0").text("description",Ru.description).text("instructions",Ru.instructions).text("model",Ru.model??"").list("starters",Ru.starters.map(dumpStarter)).data)).part("settings",Au.settings?{...Au.settings}:{});return Au.settingsUi&&($u.data.settings_ui={...Au.settingsUi}),$u.text("language",Au.language??DEFAULT_LANGUAGE,DEFAULT_LANGUAGE).part("translations",mapValues(Au.translations??{},dumpTranslation)),Au.uploads&&($u.data.uploads=new Writer().list("kinds",Au.uploads.kinds.map(Ru=>new Writer().text("type",Ru.type,"\0").value("max_mb",Ru.maxMb,DEFAULT_UPLOAD_MB).data)).value("max_files",Au.uploads.maxFiles,DEFAULT_MAX_FILES).data),$u.list("components",Au.components),$u.list("custom_components",(Au.customComponents??[]).map(dumpCustomComponent)),Au.surface&&($u.data.surface=dumpSurface(Au.surface)),Au.page&&($u.data.page=dumpPage(Au.page)),Au.assistant&&($u.data.assistant=Au.assistant),Au.balloon&&($u.data.balloon=Au.balloon),Au.theme&&($u.data.theme=Au.theme.mode?{variant:Au.theme.variant,mode:Au.theme.mode}:{variant:Au.theme.variant}),Au.voice&&$u.part("voice",new Writer().value("enabled",Au.voice.enabled,DEFAULT_VOICE.enabled).value("input",Au.voice.input,DEFAULT_VOICE.input).value("output",Au.voice.output,DEFAULT_VOICE.output).text("voice",Au.voice.voice).text("language",Au.voice.language).value("where",Au.voice.where,DEFAULT_VOICE.where).data),$u.list("outputs",Au.outputs??[]),$u.data}function dumpDecision(Au){return new Writer().text("question",Au.question,"\0").list("alternatives",Au.alternatives).list("criteria",Au.criteria.map(lo=>new Writer().text("name",lo.name,"\0").value("kind",lo.kind,"metric").value("weight",lo.weight,1).text("instructions",lo.instructions).list("options",lo.options).value("direction",lo.direction,"higher").value("measure",lo.measure,"").data)).value("min_confidence",Au.minConfidence,0).list("scenarios",Au.scenarios.map(lo=>new Writer().text("name",lo.name,"\0").part("weights",sorted(lo.weights)).data)).text("decision_model",Au.decisionModel).data}function dumpSamples(Au){return new Writer().list("documents",Au.documents.map(lo=>new Writer().text("name",lo.name,"\0").text("file",lo.file,"\0").text("text",lo.text,"\0").data)).list("alternatives",Au.alternatives.map(lo=>new Writer().text("name",lo.name,"\0").text("evidence",lo.evidence,"\0").part("metrics",{...lo.metrics}).data)).data}function dumpAppspec(Au){const lo=new Writer().value("browse",Au.permissions.computer.browse,!1).value("files",Au.permissions.computer.files,!1).value("shell",Au.permissions.computer.shell,!1).data,$u=new Writer;return $u.data.schema=APP_SCHEMA,$u.text("id",Au.id,"\0").text("version",Au.version,DEFAULT_VERSION).text("name",Au.name,"\0").text("kind",Au.kind,"\0").text("description",Au.description).text("owner",Au.owner).text("agent",Au.agent).text("team",Au.team).text("instructions",Au.instructions).text("model",Au.model).list("skills",Au.skills).list("backend_tools",Au.backendTools).list("tools",(Au.tools??[]).map(Ru=>({name:Ru.name,description:Ru.description,...JSON.stringify(Ru.parameters)===JSON.stringify(NO_HOST_PARAMETERS)?{}:{parameters:Ru.parameters},does:Ru.does}))).list("context",Au.context).list("contents",Au.contents).list("connections",Au.connections.map(Ru=>new Writer().text("server",Ru.server,"\0").value("access",Ru.access,"read").value("as",Ru.as,"owner").list("only",Ru.only).data)).list("rules",Au.rules.map(Ru=>({action:Ru.action,applies_to:Ru.appliesTo.length===1&&ACTION_CLASS_NAMES.includes(Ru.appliesTo[0])?Ru.appliesTo[0]:Ru.appliesTo,behaviour:Ru.behaviour}))).part("permissions",new Writer().list("spaces",Au.permissions.spaces.map(Ru=>new Writer().text("space",Ru.space,"\0").value("access",Ru.access,"read").data)).part("computer",lo).data).part("interface",dumpInterface(Au.interface,Au.kind)).part("tests",new Writer().value("ready_at",Au.tests.readyAt,DEFAULT_READY_AT).text("evalset",Au.tests.evalset).list("cases",Au.tests.cases.map(Ru=>({ask:Ru.ask,expect:Ru.expect,...Ru.code?{code:Ru.code}:{},...Ru.files?.length?{files:Ru.files.map(Iu=>({name:Iu.name,text:Iu.text}))}:{}}))).part("verified",new Writer().list("live",Au.tests.verified.live).list("recorded",Au.tests.verified.recorded).list("unverified",Au.tests.verified.unverified).data).data).part("record",new Writer().text("keep_for",Au.record.keepFor,DEFAULT_KEEP_FOR).list("include",Au.record.include,DEFAULT_RECORD_INCLUDE).value("suggest_tests",Au.record.suggestTests,!1).data).part("checks",new Writer().list("guards",Au.checks.guards).list("gates",Au.checks.gates).text("track",Au.checks.track).list("code",(Au.checks.code??[]).map(Ru=>({name:Ru.name,on:Ru.on,description:Ru.description}))).data).part("deployment",new Writer().present("hosted",Au.deployment.hosted&&new Writer().value("visibility",Au.deployment.hosted.visibility,"private").text("slug",Au.deployment.hosted.slug).value("character_alone",Au.deployment.hosted.characterAlone===!0,!1).data).present("embedded",Au.deployment.embedded&&new Writer().value("mode",Au.deployment.embedded.mode,"inline").list("origins",Au.deployment.embedded.origins).present("host",Au.deployment.embedded.host&&new Writer().list("context",Au.deployment.embedded.host.context).list("functions",Au.deployment.embedded.host.functions.map(Ru=>({name:Ru.name,description:Ru.description,...JSON.stringify(Ru.parameters)===JSON.stringify(NO_HOST_PARAMETERS)?{}:{parameters:Ru.parameters}}))).value("user",Au.deployment.embedded.host.user??"claimed","claimed").data).data).data).text("goal",Au.goal).list("triggers",Au.triggers.map(Ru=>new Writer().text("type",Ru.type,"\0").text("cron",Ru.cron).text("event",Ru.event).text("at",Ru.at).text("description",Ru.description).text("prompt",Ru.prompt).data)).text("memory",Au.memory).list("notifications",Au.notifications),Au.decision&&($u.data.decision=dumpDecision(Au.decision)),$u.part("samples",dumpSamples(Au.samples)).value("enabled",Au.enabled,!0).text("unavailable_because",Au.unavailable_because).list("tags",Au.tags).text("icon",Au.icon??DEFAULT_ICON,DEFAULT_ICON).text("emoji",Au.emoji,DEFAULT_EMOJI).text("avatar",Au.avatar??"","").text("banner",Au.banner??"",""),$u.data}const ALIAS=Symbol.for("yaml.alias"),DOC=Symbol.for("yaml.document"),MAP$1=Symbol.for("yaml.map"),PAIR=Symbol.for("yaml.pair"),SCALAR$1=Symbol.for("yaml.scalar"),SEQ=Symbol.for("yaml.seq"),NODE_TYPE$2=Symbol.for("yaml.node.type"),isAlias=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===ALIAS,isDocument$1=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===DOC,isMap$1=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===MAP$1,isPair=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===PAIR,isScalar=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===SCALAR$1,isSeq=Au=>!!Au&&typeof Au=="object"&&Au[NODE_TYPE$2]===SEQ;function isCollection(Au){if(Au&&typeof Au=="object")switch(Au[NODE_TYPE$2]){case MAP$1:case SEQ:return!0}return!1}function isNode$1(Au){if(Au&&typeof Au=="object")switch(Au[NODE_TYPE$2]){case ALIAS:case MAP$1:case SCALAR$1:case SEQ:return!0}return!1}const hasAnchor=Au=>(isScalar(Au)||isCollection(Au))&&!!Au.anchor,BREAK=Symbol("break visit"),SKIP$1=Symbol("skip children"),REMOVE=Symbol("remove node");function visit$4(Au,lo){const $u=initVisitor(lo);isDocument$1(Au)?visit_(null,Au.contents,$u,Object.freeze([Au]))===REMOVE&&(Au.contents=null):visit_(null,Au,$u,Object.freeze([]))}visit$4.BREAK=BREAK;visit$4.SKIP=SKIP$1;visit$4.REMOVE=REMOVE;function visit_(Au,lo,$u,Ru){const Iu=callVisitor(Au,lo,$u,Ru);if(isNode$1(Iu)||isPair(Iu))return replaceNode(Au,Ru,Iu),visit_(Au,Iu,$u,Ru);if(typeof Iu!="symbol"){if(isCollection(lo)){Ru=Object.freeze(Ru.concat(lo));for(let Ou=0;Ou<lo.items.length;++Ou){const Pu=visit_(Ou,lo.items[Ou],$u,Ru);if(typeof Pu=="number")Ou=Pu-1;else{if(Pu===BREAK)return BREAK;Pu===REMOVE&&(lo.items.splice(Ou,1),Ou-=1)}}}else if(isPair(lo)){Ru=Object.freeze(Ru.concat(lo));const Ou=visit_("key",lo.key,$u,Ru);if(Ou===BREAK)return BREAK;Ou===REMOVE&&(lo.key=null);const Pu=visit_("value",lo.value,$u,Ru);if(Pu===BREAK)return BREAK;Pu===REMOVE&&(lo.value=null)}}return Iu}function initVisitor(Au){return typeof Au=="object"&&(Au.Collection||Au.Node||Au.Value)?Object.assign({Alias:Au.Node,Map:Au.Node,Scalar:Au.Node,Seq:Au.Node},Au.Value&&{Map:Au.Value,Scalar:Au.Value,Seq:Au.Value},Au.Collection&&{Map:Au.Collection,Seq:Au.Collection},Au):Au}function callVisitor(Au,lo,$u,Ru){if(typeof $u=="function")return $u(Au,lo,Ru);if(isMap$1(lo))return $u.Map?.(Au,lo,Ru);if(isSeq(lo))return $u.Seq?.(Au,lo,Ru);if(isPair(lo))return $u.Pair?.(Au,lo,Ru);if(isScalar(lo))return $u.Scalar?.(Au,lo,Ru);if(isAlias(lo))return $u.Alias?.(Au,lo,Ru)}function replaceNode(Au,lo,$u){const Ru=lo[lo.length-1];if(isCollection(Ru))Ru.items[Au]=$u;else if(isPair(Ru))Au==="key"?Ru.key=$u:Ru.value=$u;else if(isDocument$1(Ru))Ru.contents=$u;else{const Iu=isAlias(Ru)?"alias":"scalar";throw new Error(`Cannot replace node with ${Iu} parent`)}}const escapeChars={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},escapeTagName=Au=>Au.replace(/[!,[\]{}]/g,lo=>escapeChars[lo]);class Directives{constructor(lo,$u){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,lo),this.tags=Object.assign({},Directives.defaultTags,$u)}clone(){const lo=new Directives(this.yaml,this.tags);return lo.docStart=this.docStart,lo}atDocument(){const lo=new Directives(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Directives.defaultTags);break}return lo}add(lo,$u){this.atNextDocument&&(this.yaml={explicit:Directives.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Directives.defaultTags),this.atNextDocument=!1);const Ru=lo.trim().split(/[ \t]+/),Iu=Ru.shift();switch(Iu){case"%TAG":{if(Ru.length!==2&&($u(0,"%TAG directive should contain exactly two parts"),Ru.length<2))return!1;const[Ou,Pu]=Ru;return this.tags[Ou]=Pu,!0}case"%YAML":{if(this.yaml.explicit=!0,Ru.length!==1)return $u(0,"%YAML directive should contain exactly one part"),!1;const[Ou]=Ru;if(Ou==="1.1"||Ou==="1.2")return this.yaml.version=Ou,!0;{const Pu=/^\d+\.\d+$/.test(Ou);return $u(6,`Unsupported YAML version ${Ou}`,Pu),!1}}default:return $u(0,`Unknown directive ${Iu}`,!0),!1}}tagName(lo,$u){if(lo==="!")return"!";if(lo[0]!=="!")return $u(`Not a valid tag: ${lo}`),null;if(lo[1]==="<"){const Pu=lo.slice(2,-1);return Pu==="!"||Pu==="!!"?($u(`Verbatim tags aren't resolved, so ${lo} is invalid.`),null):(lo[lo.length-1]!==">"&&$u("Verbatim tags must end with a >"),Pu)}const[,Ru,Iu]=lo.match(/^(.*!)([^!]*)$/s);Iu||$u(`The ${lo} tag has no suffix`);const Ou=this.tags[Ru];if(Ou)try{return Ou+decodeURIComponent(Iu)}catch(Pu){return $u(String(Pu)),null}return Ru==="!"?lo:($u(`Could not resolve tag: ${lo}`),null)}tagString(lo){for(const[$u,Ru]of Object.entries(this.tags))if(lo.startsWith(Ru))return $u+escapeTagName(lo.substring(Ru.length));return lo[0]==="!"?lo:`!<${lo}>`}toString(lo){const $u=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Ru=Object.entries(this.tags);let Iu;if(lo&&Ru.length>0&&isNode$1(lo.contents)){const Ou={};visit$4(lo.contents,(Pu,Du)=>{isNode$1(Du)&&Du.tag&&(Ou[Du.tag]=!0)}),Iu=Object.keys(Ou)}else Iu=[];for(const[Ou,Pu]of Ru)Ou==="!!"&&Pu==="tag:yaml.org,2002:"||(!lo||Iu.some(Du=>Du.startsWith(Pu)))&&$u.push(`%TAG ${Ou} ${Pu}`);return $u.join(`
114
114
  `)}}Directives.defaultYaml={explicit:!1,version:"1.2"};Directives.defaultTags={"!!":"tag:yaml.org,2002:"};function anchorIsValid(Au){if(/[\x00-\x19\s,[\]{}]/.test(Au)){const $u=`Anchor must not contain whitespace or control characters: ${JSON.stringify(Au)}`;throw new Error($u)}return!0}function anchorNames(Au){const lo=new Set;return visit$4(Au,{Value($u,Ru){Ru.anchor&&lo.add(Ru.anchor)}}),lo}function findNewAnchor(Au,lo){for(let $u=1;;++$u){const Ru=`${Au}${$u}`;if(!lo.has(Ru))return Ru}}function createNodeAnchors(Au,lo){const $u=[],Ru=new Map;let Iu=null;return{onAnchor:Ou=>{$u.push(Ou),Iu??(Iu=anchorNames(Au));const Pu=findNewAnchor(lo,Iu);return Iu.add(Pu),Pu},setAnchors:()=>{for(const Ou of $u){const Pu=Ru.get(Ou);if(typeof Pu=="object"&&Pu.anchor&&(isScalar(Pu.node)||isCollection(Pu.node)))Pu.node.anchor=Pu.anchor;else{const Du=new Error("Failed to resolve repeated object (this should not happen)");throw Du.source=Ou,Du}}},sourceObjects:Ru}}function applyReviver(Au,lo,$u,Ru){if(Ru&&typeof Ru=="object")if(Array.isArray(Ru))for(let Iu=0,Ou=Ru.length;Iu<Ou;++Iu){const Pu=Ru[Iu],Du=applyReviver(Au,Ru,String(Iu),Pu);Du===void 0?delete Ru[Iu]:Du!==Pu&&(Ru[Iu]=Du)}else if(Ru instanceof Map)for(const Iu of Array.from(Ru.keys())){const Ou=Ru.get(Iu),Pu=applyReviver(Au,Ru,Iu,Ou);Pu===void 0?Ru.delete(Iu):Pu!==Ou&&Ru.set(Iu,Pu)}else if(Ru instanceof Set)for(const Iu of Array.from(Ru)){const Ou=applyReviver(Au,Ru,Iu,Iu);Ou===void 0?Ru.delete(Iu):Ou!==Iu&&(Ru.delete(Iu),Ru.add(Ou))}else for(const[Iu,Ou]of Object.entries(Ru)){const Pu=applyReviver(Au,Ru,Iu,Ou);Pu===void 0?delete Ru[Iu]:Pu!==Ou&&(Ru[Iu]=Pu)}return Au.call(lo,$u,Ru)}function toJS(Au,lo,$u){if(Array.isArray(Au))return Au.map((Ru,Iu)=>toJS(Ru,String(Iu),$u));if(Au&&typeof Au.toJSON=="function"){if(!$u||!hasAnchor(Au))return Au.toJSON(lo,$u);const Ru={aliasCount:0,count:1,res:void 0};$u.anchors.set(Au,Ru),$u.onCreate=Ou=>{Ru.res=Ou,delete $u.onCreate};const Iu=Au.toJSON(lo,$u);return $u.onCreate&&$u.onCreate(Iu),Iu}return typeof Au=="bigint"&&!$u?.keep?Number(Au):Au}class NodeBase{constructor(lo){Object.defineProperty(this,NODE_TYPE$2,{value:lo})}clone(){const lo=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(lo.range=this.range.slice()),lo}toJS(lo,{mapAsMap:$u,maxAliasCount:Ru,onAnchor:Iu,reviver:Ou}={}){if(!isDocument$1(lo))throw new TypeError("A document argument is required");const Pu={anchors:new Map,doc:lo,keep:!0,mapAsMap:$u===!0,mapKeyWarned:!1,maxAliasCount:typeof Ru=="number"?Ru:100},Du=toJS(this,"",Pu);if(typeof Iu=="function")for(const{count:Lu,res:ju}of Pu.anchors.values())Iu(ju,Lu);return typeof Ou=="function"?applyReviver(Ou,{"":Du},"",Du):Du}}class Alias extends NodeBase{constructor(lo){super(ALIAS),this.source=lo,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(lo,$u){if($u?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let Ru;$u?.aliasResolveCache?Ru=$u.aliasResolveCache:(Ru=[],visit$4(lo,{Node:(Ou,Pu)=>{(isAlias(Pu)||hasAnchor(Pu))&&Ru.push(Pu)}}),$u&&($u.aliasResolveCache=Ru));let Iu;for(const Ou of Ru){if(Ou===this)break;Ou.anchor===this.source&&(Iu=Ou)}if(Iu&&$u){const{anchors:Ou,doc:Pu,maxAliasCount:Du}=$u;let Lu=Ou.get(Iu);if(Lu||(toJS(Iu,null,$u),Lu=Ou.get(Iu)),Lu?.res===void 0){const ju="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(ju)}if(Du>=0&&(Lu.count+=1,Lu.aliasCount===0&&(Lu.aliasCount=getAliasCount(Pu,Iu,Ou)),Lu.count*Lu.aliasCount>Du)){const ju="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(ju)}}return Iu}toJSON(lo,$u){if(!$u)return{source:this.source};const Ru=this.resolve($u.doc,$u);if(!Ru){const Iu=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(Iu)}return $u.anchors.get(Ru).res}toString(lo,$u,Ru){const Iu=`*${this.source}`;if(lo){if(anchorIsValid(this.source),lo.options.verifyAliasOrder&&!lo.anchors.has(this.source)){const Ou=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(Ou)}if(lo.implicitKey)return`${Iu} `}return Iu}}function getAliasCount(Au,lo,$u){if(isAlias(lo)){const Ru=lo.resolve(Au),Iu=$u&&Ru&&$u.get(Ru);return Iu?Iu.count*Iu.aliasCount:0}else if(isCollection(lo)){let Ru=0;for(const Iu of lo.items){const Ou=getAliasCount(Au,Iu,$u);Ou>Ru&&(Ru=Ou)}return Ru}else if(isPair(lo)){const Ru=getAliasCount(Au,lo.key,$u),Iu=getAliasCount(Au,lo.value,$u);return Math.max(Ru,Iu)}return 1}const isScalarValue=Au=>!Au||typeof Au!="function"&&typeof Au!="object";class Scalar extends NodeBase{constructor(lo){super(SCALAR$1),this.value=lo}toJSON(lo,$u){return $u?.keep?this.value:toJS(this.value,lo,$u)}toString(){return String(this.value)}}Scalar.BLOCK_FOLDED="BLOCK_FOLDED";Scalar.BLOCK_LITERAL="BLOCK_LITERAL";Scalar.PLAIN="PLAIN";Scalar.QUOTE_DOUBLE="QUOTE_DOUBLE";Scalar.QUOTE_SINGLE="QUOTE_SINGLE";const defaultTagPrefix="tag:yaml.org,2002:";function findTagObject(Au,lo,$u){if(lo){const Ru=$u.filter(Ou=>Ou.tag===lo),Iu=Ru.find(Ou=>!Ou.format)??Ru[0];if(!Iu)throw new Error(`Tag ${lo} not found`);return Iu}return $u.find(Ru=>Ru.identify?.(Au)&&!Ru.format)}function createNode(Au,lo,$u){if(isDocument$1(Au)&&(Au=Au.contents),isNode$1(Au))return Au;if(isPair(Au)){const Fu=$u.schema[MAP$1].createNode?.($u.schema,null,$u);return Fu.items.push(Au),Fu}(Au instanceof String||Au instanceof Number||Au instanceof Boolean||typeof BigInt<"u"&&Au instanceof BigInt)&&(Au=Au.valueOf());const{aliasDuplicateObjects:Ru,onAnchor:Iu,onTagObj:Ou,schema:Pu,sourceObjects:Du}=$u;let Lu;if(Ru&&Au&&typeof Au=="object"){if(Lu=Du.get(Au),Lu)return Lu.anchor??(Lu.anchor=Iu(Au)),new Alias(Lu.anchor);Lu={anchor:null,node:null},Du.set(Au,Lu)}lo?.startsWith("!!")&&(lo=defaultTagPrefix+lo.slice(2));let ju=findTagObject(Au,lo,Pu.tags);if(!ju){if(Au&&typeof Au.toJSON=="function"&&(Au=Au.toJSON()),!Au||typeof Au!="object"){const Fu=new Scalar(Au);return Lu&&(Lu.node=Fu),Fu}ju=Au instanceof Map?Pu[MAP$1]:Symbol.iterator in Object(Au)?Pu[SEQ]:Pu[MAP$1]}Ou&&(Ou(ju),delete $u.onTagObj);const Bu=ju?.createNode?ju.createNode($u.schema,Au,$u):typeof ju?.nodeClass?.from=="function"?ju.nodeClass.from($u.schema,Au,$u):new Scalar(Au);return lo?Bu.tag=lo:ju.default||(Bu.tag=ju.tag),Lu&&(Lu.node=Bu),Bu}function collectionFromPath(Au,lo,$u){let Ru=$u;for(let Iu=lo.length-1;Iu>=0;--Iu){const Ou=lo[Iu];if(typeof Ou=="number"&&Number.isInteger(Ou)&&Ou>=0){const Pu=[];Pu[Ou]=Ru,Ru=Pu}else Ru=new Map([[Ou,Ru]])}return createNode(Ru,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:Au,sourceObjects:new Map})}const isEmptyPath=Au=>Au==null||typeof Au=="object"&&!!Au[Symbol.iterator]().next().done;class Collection extends NodeBase{constructor(lo,$u){super(lo),Object.defineProperty(this,"schema",{value:$u,configurable:!0,enumerable:!1,writable:!0})}clone(lo){const $u=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return lo&&($u.schema=lo),$u.items=$u.items.map(Ru=>isNode$1(Ru)||isPair(Ru)?Ru.clone(lo):Ru),this.range&&($u.range=this.range.slice()),$u}addIn(lo,$u){if(isEmptyPath(lo))this.add($u);else{const[Ru,...Iu]=lo,Ou=this.get(Ru,!0);if(isCollection(Ou))Ou.addIn(Iu,$u);else if(Ou===void 0&&this.schema)this.set(Ru,collectionFromPath(this.schema,Iu,$u));else throw new Error(`Expected YAML collection at ${Ru}. Remaining path: ${Iu}`)}}deleteIn(lo){const[$u,...Ru]=lo;if(Ru.length===0)return this.delete($u);const Iu=this.get($u,!0);if(isCollection(Iu))return Iu.deleteIn(Ru);throw new Error(`Expected YAML collection at ${$u}. Remaining path: ${Ru}`)}getIn(lo,$u){const[Ru,...Iu]=lo,Ou=this.get(Ru,!0);return Iu.length===0?!$u&&isScalar(Ou)?Ou.value:Ou:isCollection(Ou)?Ou.getIn(Iu,$u):void 0}hasAllNullValues(lo){return this.items.every($u=>{if(!isPair($u))return!1;const Ru=$u.value;return Ru==null||lo&&isScalar(Ru)&&Ru.value==null&&!Ru.commentBefore&&!Ru.comment&&!Ru.tag})}hasIn(lo){const[$u,...Ru]=lo;if(Ru.length===0)return this.has($u);const Iu=this.get($u,!0);return isCollection(Iu)?Iu.hasIn(Ru):!1}setIn(lo,$u){const[Ru,...Iu]=lo;if(Iu.length===0)this.set(Ru,$u);else{const Ou=this.get(Ru,!0);if(isCollection(Ou))Ou.setIn(Iu,$u);else if(Ou===void 0&&this.schema)this.set(Ru,collectionFromPath(this.schema,Iu,$u));else throw new Error(`Expected YAML collection at ${Ru}. Remaining path: ${Iu}`)}}}const stringifyComment=Au=>Au.replace(/^(?!$)(?: $)?/gm,"#");function indentComment(Au,lo){return/^\n+$/.test(Au)?Au.substring(1):lo?Au.replace(/^(?! *$)/gm,lo):Au}const lineComment=(Au,lo,$u)=>Au.endsWith(`
115
115
  `)?indentComment($u,lo):$u.includes(`
116
116
  `)?`
@@ -4102,10 +4102,10 @@ ${Du}`:zu,inputs:Du,clear:Pu?[]:[DRAFT.path],loop:Bu()}:{refused:"Nothing to sen
4102
4102
  }
4103
4103
  `;function usePaletteStyles(){reactExports.useEffect(()=>{if(typeof document>"u"||document.getElementById(STYLE_ELEMENT_ID))return;const Au=document.createElement("style");Au.id=STYLE_ELEMENT_ID,Au.textContent=PALETTE_CSS,document.head.appendChild(Au)},[])}function rank(Au,lo){if(!lo)return{command:Au,score:0};const $u=lo.toLowerCase(),Ru=[[Au.name.toLowerCase(),0],[Au.id.toLowerCase(),100],[(Au.category??"").toLowerCase(),200],[(Au.description??"").toLowerCase(),300]];for(const[Iu,Ou]of Ru){const Pu=Iu.indexOf($u);if(Pu>=0)return{command:Au,score:Ou+Pu}}return null}const PRIMER_PORTAL_ROOT_ID="__primerPortalRoot__";function paletteRoot(){return document.getElementById(PRIMER_PORTAL_ROOT_ID)??document.body}const LIST_ID="dla-cmdk-list",optionId=Au=>`dla-cmdk-option-${Au}`,PALETTE_KEYBINDING="Mod+K",PALETTE_CHORD=parseKeybinding(PALETTE_KEYBINDING);function CommandPalette(){const Au=useReactorPlatform(),lo=useCommands();usePaletteStyles();const[$u,Ru]=reactExports.useState(!1),[Iu,Ou]=reactExports.useState(""),[Pu,Du]=reactExports.useState(0),[Lu,ju]=reactExports.useState(null),[Bu,Fu]=reactExports.useState(null),zu=reactExports.useRef(null),qu=reactExports.useMemo(()=>lo.map(Ku=>rank(Ku,Iu)).filter(Ku=>Ku!==null).sort((Ku,Zu)=>Ku.score-Zu.score).map(Ku=>Ku.command),[lo,Iu]),Uu=reactExports.useCallback(()=>{Ru(!1),Ou(""),Du(0),Fu(null)},[]),Hu=reactExports.useCallback(async Ku=>{ju(Ku.id),Fu(null);try{await Au.executeCommand(Ku.id),Uu()}catch(Zu){Fu(Zu instanceof Error?Zu.message:String(Zu))}finally{ju(null)}},[Uu,Au]);if(reactExports.useEffect(()=>{const Ku=lo.map(Yu=>{const ed=Yu.keybinding?parseKeybinding(Yu.keybinding):null;return ed?{chord:ed,id:Yu.id}:null}).filter(Yu=>Yu!==null),Zu=isApplePlatform();function Qu(Yu){if(PALETTE_CHORD&&matchesKeybinding(Yu,PALETTE_CHORD,Zu)){Yu.preventDefault(),Yu.stopPropagation(),Ru(ed=>!ed);return}if(Yu.key==="Escape"){Ru(ed=>ed&&!1);return}if(!$u){for(const ed of Ku)if(matchesKeybinding(Yu,ed.chord,Zu)){Yu.preventDefault(),Yu.stopPropagation();const Xu=Au.getCommand(ed.id);Xu&&Xu.isEnabled?.()!==!1&&Au.executeCommand(ed.id).catch(rd=>{console.error(`Command ${ed.id} failed`,rd)});return}}}return document.addEventListener("keydown",Qu,{capture:!0}),()=>document.removeEventListener("keydown",Qu,{capture:!0})},[lo,$u,Au]),reactExports.useEffect(()=>{if(!$u)return;Ou(""),Du(0),Fu(null);const Ku=window.requestAnimationFrame(()=>zu.current?.focus());return()=>window.cancelAnimationFrame(Ku)},[$u]),reactExports.useEffect(()=>{Du(Ku=>Ku>=qu.length?0:Ku)},[qu.length]),!$u||typeof document>"u")return null;const Vu=Ku=>{if(Ku.key==="ArrowDown")Ku.preventDefault(),Du(Zu=>qu.length===0?0:(Zu+1)%qu.length);else if(Ku.key==="ArrowUp")Ku.preventDefault(),Du(Zu=>qu.length===0?0:(Zu-1+qu.length)%qu.length);else if(Ku.key==="Enter"){Ku.preventDefault();const Zu=qu[Pu];Zu&&Zu.isEnabled?.()!==!1&&Hu(Zu)}},Gu=jsxRuntimeExports.jsx("div",{className:"dla-cmdk-backdrop",onClick:Uu,children:jsxRuntimeExports.jsxs("div",{className:"dla-cmdk-panel",role:"dialog","aria-modal":"true","aria-label":"Command palette",onClick:Ku=>Ku.stopPropagation(),children:[jsxRuntimeExports.jsx("div",{className:"dla-cmdk-search",children:jsxRuntimeExports.jsx("input",{ref:zu,className:"dla-cmdk-input",type:"text",placeholder:"Run a command…","aria-label":"Search commands",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,role:"combobox","aria-expanded":!0,"aria-controls":LIST_ID,"aria-autocomplete":"list","aria-activedescendant":qu.length>0?optionId(Pu):void 0,value:Iu,onChange:Ku=>Ou(Ku.target.value),onKeyDown:Vu})}),Bu!==null&&jsxRuntimeExports.jsx("div",{className:"dla-cmdk-error",children:Bu}),jsxRuntimeExports.jsx("ul",{className:"dla-cmdk-list",id:LIST_ID,role:"listbox",children:qu.length===0?jsxRuntimeExports.jsx("li",{className:"dla-cmdk-empty",children:lo.length===0?"No plugin has registered a command yet.":`Nothing matches “${Iu}”.`}):qu.map((Ku,Zu)=>{const Qu=Ku.isEnabled?.()!==!1;return jsxRuntimeExports.jsx("li",{children:jsxRuntimeExports.jsxs("button",{type:"button",className:"dla-cmdk-item",id:optionId(Zu),role:"option","aria-selected":Zu===Pu,"aria-disabled":!Qu,disabled:!Qu,onMouseEnter:()=>Du(Zu),onClick:()=>{Hu(Ku)},children:[jsxRuntimeExports.jsx("span",{className:"dla-cmdk-mark","aria-hidden":"true",children:Ku.emoji??"·"}),jsxRuntimeExports.jsxs("span",{className:"dla-cmdk-text",children:[jsxRuntimeExports.jsx("span",{className:"dla-cmdk-name",children:Ku.name}),Ku.description&&jsxRuntimeExports.jsx("p",{className:"dla-cmdk-description",children:Ku.description})]}),Lu===Ku.id&&jsxRuntimeExports.jsx("span",{className:"dla-cmdk-meta",children:"running…"}),Ku.keybinding&&jsxRuntimeExports.jsx("kbd",{className:"dla-cmdk-key",children:formatKeybinding(Ku.keybinding)}),Ku.category&&jsxRuntimeExports.jsx("span",{className:"dla-cmdk-meta",children:Ku.category})]})},Ku.id)})}),jsxRuntimeExports.jsxs("div",{className:"dla-cmdk-footer",children:[jsxRuntimeExports.jsxs("span",{children:["↑↓ to move · ↵ to run · esc to close ·"," ",jsxRuntimeExports.jsx("kbd",{className:"dla-cmdk-key",children:formatKeybinding(PALETTE_KEYBINDING)})," ","to reopen"]}),jsxRuntimeExports.jsxs("span",{children:[qu.length," of ",lo.length]})]})]})});return reactDomExports.createPortal(Gu,paletteRoot())}const CommandsPlugin={name:"@datalayer/reactor-commands",version:"1.0.0",displayName:"Commands",description:"A command palette: Ctrl-K opens a floating search over every command plugins have registered.",octicon:"command-palette",emoji:"⌘",build(){return{components:[{slot:"root",id:"command-palette",Component:CommandPalette}]}},commands:[{id:"commands.showPalette",name:"Show the command palette",description:"The same thing Ctrl-K does — listed so it is discoverable",emoji:"⌘",category:"Commands",keybinding:PALETTE_KEYBINDING,execute:()=>{document.dispatchEvent(new KeyboardEvent("keydown",{key:"k",ctrlKey:!0,bubbles:!0}))}}]},COMMANDS_PLUGIN_NAME="@datalayer/loop-plugin-commands",DEFAULT_CATEGORY="Workspace",GROUP_EMOJI={Agents:"🤖",Open:"📂",Session:"🧭",Workspace:"🪟"};function LoopCommandBridge({workspace:Au,sync:lo}){const $u=useContributions(LoopCommand);return reactExports.useEffect(()=>{lo($u,Au)},[$u,Au,lo]),null}const LoopCommandsPlugin={name:COMMANDS_PLUGIN_NAME,displayName:"Command palette",description:"Puts the workspace commands in a Ctrl-K palette, beside every plugin that registers one.",octicon:"command-palette",emoji:"⌘",dependencies:[CommandsPlugin,ThemePlugin],build:Au=>{const lo=new Map;let $u="",Ru;const Iu=(Ou,Pu)=>{const Du=Pu?Ou.map(Lu=>`${Lu.plugin}:${Lu.value.name}`).join("|"):"";if(!(Du===$u&&Pu===Ru)){$u=Du,Ru=Pu;for(const Lu of lo.values())Lu();if(lo.clear(),!!Pu)for(const Lu of Ou){const ju=Lu.value,Bu=ju.group??DEFAULT_CATEGORY;lo.set(ju.name,Au.registerCommand({id:`loop.${ju.name}`,name:ju.description,description:`/${ju.name}`,emoji:GROUP_EMOJI[Bu]??"💠",category:Bu,keybinding:ju.keybinding,execute:async()=>{await ju.run({workspace:Pu,argv:""})}}))}}};return{components:[{id:"loop-command-bridge",slot:LoopSlots.status,Component:({workspace:Ou})=>jsxRuntimeExports.jsx(LoopCommandBridge,{workspace:Ou,sync:Iu})}]}}},MODELS_PLUGIN_NAME="@datalayer/loop-plugin-models",ModelsPlugin={name:MODELS_PLUGIN_NAME,displayName:"Models",description:"Which model answers, from the agentspecs catalog.",octicon:"cpu",emoji:"🧠",contributes:[contribution(LoopCommand,{name:"models",aliases:["model"],description:"Show the models available to this session",group:"Agents",keybinding:"Mod+Alt+M",run:async({workspace:Au})=>{const lo=await fetch(`${Au.serverUrl}/api/v1/configure/models`);if(!lo.ok)return{content:"The model catalogue is unavailable."};const $u=await lo.json();return{content:`${($u.models??[]).filter(Iu=>Iu.available!==!1).length} of ${($u.models??[]).length} models are ready. Pick one under the prompt.`}}},{id:"models"})]},WINDOW_CONTROLS_SLOT="loop.window.controls",WINDOW_ACTIONS_SLOT="loop.window.actions";function WindowFrame({children:Au,title:lo,height:$u,slotProps:Ru={}}){const Iu=useOptionalSlotComponents(WINDOW_ACTIONS_SLOT);return jsxRuntimeExports.jsxs(Box,{position:"relative",borderRadius:"14px",overflow:"hidden",border:"1px solid",borderColor:"border.default",bg:"canvas.default",boxShadow:"0 24px 60px -28px rgba(0, 0, 0, 0.55)",height:$u===void 0?"100%":void 0,display:$u===void 0?"flex":void 0,flexDirection:$u===void 0?"column":void 0,children:[jsxRuntimeExports.jsxs(Box,{display:"flex",alignItems:"center",gap:2,px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",bg:"canvas.subtle",flexWrap:"wrap",rowGap:2,flex:"0 0 auto",children:[jsxRuntimeExports.jsx(Box,{display:"flex",alignItems:"center",gap:"6px",mr:1,flexShrink:0,children:jsxRuntimeExports.jsx(ReactorSlot,{slot:WINDOW_CONTROLS_SLOT,props:Ru})}),jsxRuntimeExports.jsx(Box,{minWidth:0,flex:"1 1 auto",children:lo}),Iu.length>0?jsxRuntimeExports.jsx(Box,{display:"flex",alignItems:"center",gap:2,flexShrink:0,ml:"auto",children:jsxRuntimeExports.jsx(ReactorSlot,{slot:WINDOW_ACTIONS_SLOT,props:Ru})}):null]}),jsxRuntimeExports.jsx(Box,{sx:$u===void 0?{flex:"1 1 auto",minHeight:0}:{height:$u,minHeight:0},children:Au})]})}const WINDOW_FRAME_PLUGIN_NAME="@datalayer/loop-plugin-window-frame";function WindowControls(){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:["danger.emphasis","attention.emphasis","success.emphasis"].map(Au=>jsxRuntimeExports.jsx(Box,{width:10,height:10,borderRadius:"50%",bg:Au},Au))})}const WindowFramePlugin={name:WINDOW_FRAME_PLUGIN_NAME,displayName:"Window frame",description:"Draws Loop as a window, and opens its title bar to controls and actions.",octicon:"browser",emoji:"🪟",build:()=>({components:[{id:"window-controls",slot:WINDOW_CONTROLS_SLOT,Component:WindowControls},{id:"full-screen",slot:LoopSlots.header,Component:WorkspaceFullScreenAction}]})},DOCUMENT_PLUGIN_NAME="@datalayer/loop-plugin-document",DocumentPlugin={name:DOCUMENT_PLUGIN_NAME,displayName:"Document editor",description:"A rich-text document beside the chat, driven by the agent.",octicon:"file",emoji:"📄",dependencies:[AgentsPlugin],contributionPoints:[LoopDocumentToolbar,LoopOpeningDocument],contributes:[contribution(LoopEditorView,{surfaceId:"document",title:"Document",icon:FileIcon,order:20,canOpen:Au=>Au.sandbox.state==="running",unavailableReason:()=>"Needs a running sandbox",load:()=>__vitePreload(()=>import("./chunks/DocumentView-DCgaQoOU.js"),[],import.meta.url)},{id:"document",order:20}),contribution(LoopCommand,{name:"document",description:"Open the document beside the chat",group:"Open",keybinding:"Mod+Alt+O",run:async({workspace:Au})=>{if(Au.setActiveViewType("chat"),!requestSurface("document"))throw new Error("No chat is on screen to open the document beside.")}},{id:"document"})],build:Au=>(__vitePreload(async()=>{const{createLexicalTools:lo}=await import("./chunks/lexicalHooks-PS_v7JyS.js");return{createLexicalTools:lo}},[],import.meta.url).then(({createLexicalTools:lo})=>{Au.contribute(LoopFrontendTool,{id:"document-tools",tools:$u=>lo($u.surfaceId)},{id:"document-tools"})},lo=>{console.warn("The document tools could not be loaded",lo)}),{})},DOCUMENT_TOOLBAR_PLUGIN_NAME="@datalayer/loop-plugin-document-toolbar",DocumentToolbarPlugin=defineLazyPlugin({name:DOCUMENT_TOOLBAR_PLUGIN_NAME,displayName:"Document toolbar",description:"Shows what the document’s code blocks run on.",octicon:"circle",emoji:"🔵",activationEvents:[onContributionPoint(LoopDocumentToolbar)],contributionPoints:[LoopDocumentToolbarItem],load:()=>__vitePreload(()=>import("./chunks/plugin-CA_0EWiO.js"),[],import.meta.url)}),NOTEBOOK_PLUGIN_NAME="@datalayer/loop-plugin-notebook",NotebookPlugin={name:NOTEBOOK_PLUGIN_NAME,displayName:"Notebook editor",description:"A notebook beside the chat, on the session’s kernel.",octicon:"rows",emoji:"📓",dependencies:[AgentsPlugin],contributionPoints:[LoopNotebookToolbar,LoopOpeningNotebook],contributes:[contribution(LoopEditorView,{surfaceId:"notebook",title:"Notebook",icon:RowsIcon,order:10,canOpen:Au=>Au.sandbox.state==="running",unavailableReason:()=>"Needs a running sandbox",load:()=>__vitePreload(()=>import("./chunks/NotebookView-CNHzc28A.js"),[],import.meta.url)},{id:"notebook",order:10}),contribution(LoopCommand,{name:"notebook",description:"Open the notebook beside the chat",group:"Open",keybinding:"Mod+Alt+N",run:async({workspace:Au})=>{if(Au.setActiveViewType("chat"),!requestSurface("notebook"))throw new Error("No chat is on screen to open the notebook beside.")}},{id:"notebook"})],build:Au=>(__vitePreload(async()=>{const{createNotebookTools:lo}=await Promise.resolve().then(()=>notebookHooks);return{createNotebookTools:lo}},void 0,import.meta.url).then(({createNotebookTools:lo})=>{Au.contribute(LoopFrontendTool,{id:"notebook-tools",tools:$u=>lo($u.surfaceId)},{id:"notebook-tools"})},lo=>{console.warn("The notebook tools could not be loaded",lo)}),{})},NOTEBOOK_TOOLBAR_PLUGIN_NAME="@datalayer/loop-plugin-notebook-toolbar",NotebookToolbarPlugin=defineLazyPlugin({name:NOTEBOOK_TOOLBAR_PLUGIN_NAME,displayName:"Notebook toolbar",description:"Shows what the notebook is running on, on its toolbar.",octicon:"circle",emoji:"🟢",activationEvents:[onContributionPoint(LoopNotebookToolbar)],contributionPoints:[LoopNotebookToolbarItem],load:()=>__vitePreload(()=>import("./chunks/plugin-LDJjixuG.js"),[],import.meta.url)}),NotebookExtension=defineExtension({name:"@datalayer/loop-extension-notebook",displayName:"Notebooks",description:"A notebook beside the chat, and the toolbar that reports on it.",octicon:"rows",emoji:"📓",plugins:[NotebookPlugin,NotebookToolbarPlugin]}),DocumentExtension=defineExtension({name:"@datalayer/loop-extension-document",displayName:"Documents",description:"A rich-text document beside the chat, and the toolbar that reports on it.",octicon:"file",emoji:"📄",plugins:[DocumentPlugin,DocumentToolbarPlugin]}),NO_TURN$5=signal$2({id:0,status:"idle"}),MAX_HEIGHT=168;function Thinking(){return jsxRuntimeExports.jsxs(Box,{as:"span","aria-label":"The agent is thinking",display:"inline-flex",gap:"4px",alignItems:"center",sx:{height:"1.5em","& > i":{width:5,height:5,borderRadius:"50%",bg:"fg.muted",animation:"loop-turn-dot 1.2s ease-in-out infinite"},"& > i:nth-of-type(2)":{animationDelay:"0.15s"},"& > i:nth-of-type(3)":{animationDelay:"0.3s"},"@keyframes loop-turn-dot":{"0%, 80%, 100%":{opacity:.25},"40%":{opacity:1}}},children:[jsxRuntimeExports.jsx("i",{}),jsxRuntimeExports.jsx("i",{}),jsxRuntimeExports.jsx("i",{})]})}function TurnPanel({footer:Au="full"}){const lo=useContributions(LoopChatTurn),$u=useSignalValue$1(lo[0]?.value.turn??NO_TURN$5),Ru=useSignalValue$1(pageLayoutSheet),Iu=reactExports.useRef(null),[Ou,Pu]=reactExports.useState(null),[Du,Lu]=reactExports.useState(!1);reactExports.useEffect(()=>{const Fu=Iu.current;Fu&&(Fu.scrollTop=Fu.scrollHeight)},[$u.assistant]),reactExports.useEffect(()=>{if(!Du)return;const Fu=window.setTimeout(()=>Lu(!1),1400);return()=>window.clearTimeout(Fu)},[Du]);const ju=reactExports.useCallback(async()=>{const Fu=[$u.user,$u.assistant].filter(Boolean).join(`
4104
4104
 
4105
- `);await navigator.clipboard?.writeText(Fu),Lu(!0)},[$u.user,$u.assistant]);if(Ru==="panel"||$u.status==="idle"||!$u.user||Ou===$u.id)return null;const Bu=$u.status==="thinking"||$u.status==="streaming";return jsxRuntimeExports.jsxs(Box,{"data-turn-panel":"",borderTop:"1px solid",borderColor:"border.muted",px:3,pt:2,pb:Au==="none"?2:1,display:"flex",flexDirection:"column",gap:2,bg:"canvas.default",children:[jsxRuntimeExports.jsx(Box,{display:"flex",justifyContent:"flex-end",children:jsxRuntimeExports.jsx(Text$5,{sx:{fontSize:0,lineHeight:1.45,px:2,py:1,borderRadius:"10px",bg:"accent.subtle",color:"fg.default",maxWidth:"85%",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:$u.user})}),jsxRuntimeExports.jsxs(Box,{display:"flex",gap:2,alignItems:"flex-start",children:[jsxRuntimeExports.jsx(Box,{ref:Iu,flex:"1 1 auto",minWidth:0,maxHeight:MAX_HEIGHT,overflowY:"auto",fontSize:0,lineHeight:1.5,color:$u.assistant?"fg.default":"fg.muted",whiteSpace:$u.assistant?"normal":"pre-wrap",overflowWrap:"anywhere",children:$u.assistant?jsxRuntimeExports.jsx(Box,{sx:{...streamdownMarkdownStyles,fontSize:0},children:jsxRuntimeExports.jsx(_o$1,{rehypePlugins:REHYPE_PLUGINS_WITHOUT_HTML,children:normalizeAssistantMarkdown($u.assistant)})}):$u.activity?jsxRuntimeExports.jsx(Text$5,{sx:{color:"fg.muted",fontStyle:"italic"},children:$u.activity}):Bu?jsxRuntimeExports.jsx(Thinking,{}):$u.status==="error"?"The agent could not answer.":"Done — the result is in the page."}),jsxRuntimeExports.jsx(IconButton,{icon:CommentDiscussionIcon,size:"small",variant:"invisible","aria-label":"Open the conversation",onClick:openPagePanel,sx:{color:"fg.muted",flexShrink:0}})]}),$u.assistant&&$u.activity?jsxRuntimeExports.jsx(Text$5,{sx:{fontSize:0,color:"fg.muted",fontStyle:"italic"},children:$u.activity}):null,Au==="full"?jsxRuntimeExports.jsx(TurnFooter,{usage:$u.usage,live:Bu,latest:!0,padding:0,onCopy:ju,onRemove:()=>Pu($u.id)}):Au==="actions"?jsxRuntimeExports.jsxs(Box,{display:"flex",justifyContent:"flex-end",gap:1,mt:-1,children:[jsxRuntimeExports.jsx(IconButton,{icon:Du?CheckIcon:CopyIcon,size:"small",variant:"invisible","aria-label":Du?"Copied":"Copy this turn",onClick:()=>{ju()},sx:{color:"fg.muted"}}),jsxRuntimeExports.jsx(IconButton,{icon:XIcon,size:"small",variant:"invisible","aria-label":"Dismiss until the next turn",onClick:()=>Pu($u.id),sx:{color:"fg.muted"}})]}):null]})}const SPLIT_DEFAULT_SHARE=.4,SPLIT_MIN_SHARE=.2,SPLIT_MAX_SHARE=.8,SPLIT_KEY_STEP=.05;function clampSplitShare(Au){return Number.isFinite(Au)?Math.min(SPLIT_MAX_SHARE,Math.max(SPLIT_MIN_SHARE,Au)):SPLIT_DEFAULT_SHARE}function splitShareForKey(Au,lo){switch(lo){case"ArrowLeft":return clampSplitShare(Au-SPLIT_KEY_STEP);case"ArrowRight":return clampSplitShare(Au+SPLIT_KEY_STEP);case"Home":return SPLIT_MIN_SHARE;case"End":return SPLIT_MAX_SHARE;default:return null}}function SplitLayout({editors:Au,hasEditor:lo,transcript:$u,prompt:Ru,chips:Iu,picker:Ou,transient:Pu}){const[Du,Lu]=reactExports.useState(SPLIT_DEFAULT_SHARE),ju=reactExports.useRef(null),Bu=reactExports.useRef(!1),Fu=reactExports.useCallback(Gu=>{const Ku=ju.current?.getBoundingClientRect();return!Ku||Ku.width<=0?null:clampSplitShare((Gu-Ku.left)/Ku.width)},[]),zu=Gu=>{Bu.current=!0,Gu.currentTarget.setPointerCapture?.(Gu.pointerId),Gu.preventDefault()},qu=Gu=>{if(!Bu.current)return;const Ku=Fu(Gu.clientX);Ku!==null&&Lu(Ku)},Uu=Gu=>{Bu.current=!1,Gu.currentTarget.releasePointerCapture?.(Gu.pointerId)},Hu=Gu=>{const Ku=splitShareForKey(Du,Gu.key);Ku!==null&&(Gu.preventDefault(),Lu(Ku))},Vu=Math.round(Du*100);return jsxRuntimeExports.jsxs(Box,{"data-testid":"loop-split-layout",flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",children:[Ou,jsxRuntimeExports.jsxs(Box,{ref:ju,flex:"1 1 auto",minHeight:0,display:"flex",position:"relative",overflow:"hidden",children:[jsxRuntimeExports.jsxs(Box,{"data-testid":"loop-split-conversation",flex:lo?`0 0 ${Vu}%`:"1 1 auto",minWidth:0,minHeight:0,display:"flex",flexDirection:"column",ml:lo?"-1px":0,children:[$u,Iu,Ru]}),lo?jsxRuntimeExports.jsx(Box,{role:"separator","aria-orientation":"vertical","aria-label":"Resize the conversation and the page","aria-valuemin":Math.round(SPLIT_MIN_SHARE*100),"aria-valuemax":Math.round(SPLIT_MAX_SHARE*100),"aria-valuenow":Vu,tabIndex:0,onPointerDown:zu,onPointerMove:qu,onPointerUp:Uu,onPointerCancel:Uu,onKeyDown:Hu,flex:"0 0 7px",mx:"-3px",zIndex:1,cursor:"col-resize",display:"flex",justifyContent:"center",outline:"none",touchAction:"none",sx:{"&::before":{content:'""',width:"1px",height:"100%",bg:"border.default"},"&:hover::before, &:focus-visible::before":{width:"3px",bg:"accent.emphasis"}}}):null,jsxRuntimeExports.jsx(Box,{"data-testid":"loop-split-page",sx:lo?{flex:"1 1 0",minWidth:0,minHeight:0,display:"flex",...paneOpening("right")}:{position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",zIndex:-1},children:Au})]}),Pu]})}const LOOP_PAGE_LAYOUT_PLUGIN_NAME="@datalayer/loop-plugin-page-layout",NO_TURN$4=signal$2({id:0,status:"idle"}),pageLayoutChatMode=signal$2("floating-draggable"),promptStance=signal$2("floating-top");let floatingStance="floating-top";const PAGE_LAYOUT_DISABLED_MODES=["assistant"];function pageLayoutForChatMode(Au){switch(Au){case"sidebar":return{bandMode:"panel",panelMode:"docked"};case"floating":return{bandMode:"panel",panelMode:"overlay"};case"floating-small":return{bandMode:"panel",panelMode:"popup"};default:return{bandMode:"floating",panelMode:"docked"}}}function setPageLayoutChatMode(Au){pageLayoutChatMode.value=Au;const{bandMode:lo}=pageLayoutForChatMode(Au);promptStance.value=lo==="floating"?floatingStance:"docked-top",lo==="panel"&&openPagePanel()}function ChatModeAction(){const Au=useSignalValue$1(pageLayoutChatMode);return jsxRuntimeExports.jsx(ChatViewModeToggle,{value:Au,onChange:setPageLayoutChatMode,disabledModes:PAGE_LAYOUT_DISABLED_MODES})}function LoopPageLayout({parts:Au,promptMode:lo,pageSize:$u}){const Ru=useContributions(LoopChatTurn),Iu=useSignalValue$1(Ru[0]?.value.turn??NO_TURN$4),Ou=useSignalValue$1(pageLayoutChatMode),Pu=lo==="floating"?pageLayoutForChatMode(Ou):{bandMode:"docked",panelMode:"docked"};return jsxRuntimeExports.jsx(PageLayout,{page:Au.editors,hasPage:Au.hasEditor,panel:Au.transcript,band:Au.prompt,chips:Au.chips,picker:Au.picker,transient:Au.transient,activity:Iu.activity,bandMode:Pu.bandMode,panelMode:Pu.panelMode,pageSize:$u})}function ConversationToggle(){return jsxRuntimeExports.jsx(PagePanelToggle,{panelName:"conversation",icon:CommentDiscussionIcon,sx:{order:2}})}const LoopPageLayoutPlugin={name:LOOP_PAGE_LAYOUT_PLUGIN_NAME,config:{arrangement:"page",turnPanel:"below",turnPanelFooter:"full",prompt:"docked",promptAnchor:"top",pageSize:void 0},displayName:"Page layout",description:"The editor — or, in the chat view, the conversation — on a centred sheet, the prompt docked above it at the same width or floating over it as a draggable card, the current turn under the prompt, the conversation in a side panel; or, split, the conversation and the work side by side with a hairline to drag.",octicon:"file",emoji:"📄",build:({config:Au,...lo})=>{if(Au.arrangement==="split")return lo.contribute(LoopChatLayout,{id:"split-layout",prompt:"docked",Component:SplitLayout},{id:"split-layout"}),{components:[]};const $u=Au.prompt,Ru=Au.pageSize;floatingStance=Au.promptAnchor==="bottom"?"floating-bottom":"floating-top",$u==="floating"&&(promptStance.value=floatingStance);const Iu=Ou=>jsxRuntimeExports.jsx(LoopPageLayout,{parts:Ou,promptMode:$u,pageSize:Ru});if(lo.contribute(LoopChatLayout,{id:"page-layout",prompt:$u==="floating"?floatingStance:"docked-top",promptStance:$u==="floating"?promptStance:void 0,Component:Iu},{id:"page-layout"}),Au.turnPanel!=="none"){const Ou=Au.turnPanelFooter,Pu=()=>jsxRuntimeExports.jsx(TurnPanel,{footer:Ou});lo.contribute(LoopPromptPanel,{id:"page-layout-turn",placement:Au.turnPanel,order:0,Component:Pu},{id:"page-layout-turn"})}return{components:[{id:"page-layout-conversation-toggle",slot:LoopSlots.header,Component:ConversationToggle},...$u==="floating"?[{id:"page-layout-chat-mode",slot:LoopSlots.promptAction,Component:ChatModeAction}]:[]]}}};function loopPlugins(Au={}){const{serverUrl:lo,target:$u="browser",defaultEditor:Ru,showViewSelector:Iu=!0,hideChatHeader:Ou=!1,chatHeaderButtons:Pu=!1,promptPlacement:Du,autoFocusPrompt:Lu=!0,suggestionLabels:ju=!0,fullScreenTopOffset:Bu=0,showAgentVariants:Fu=!1,agentSummary:zu=!0,teamId:qu,teamPicker:Uu=!0,pageLayout:Hu=!1,pageLayoutArrangement:Vu="page",pageLayoutTurnPanel:Gu="below",pageLayoutPrompt:Ku="docked",pageLayoutPromptAnchor:Zu="top",pageLayoutSize:Qu,pageLayoutTurnPanelFooter:Yu="full",localAgent:ed,localAgentSpec:Xu,datalayerAgentSpecId:rd,datalayerCreatePayload:nd,datalayerVisitors:od,datalayerKept:ad,embedToken:ld,targetFixed:fd,themeVariant:pd,themeOverrides:Sd,colorMode:wd,presence:bd,showTokenUsage:Td,thread:Pd,floatingPrompt:ud=!1,editorSelector:md=!1,editors:_d=!0,conversation:hd=!0,commandPalette:gd=!1,pluginsPanel:Ed=!1,windowFrame:xd=!1,firstPromptHook:Od}=Au,Bd=Ru??(_d?"notebook":"none");return hd?[configurePlugin(ChatPlugin,{defaultSurface:Bd,showSurfaceSelector:_d&&Iu&&!md,hideHeader:Ou,headerButtons:{newChat:Pu,clear:Pu},promptPlacement:ud?"floating":Du,autoFocusPrompt:Lu,suggestionLabels:ju,fullScreenTopOffset:Bu,themeVariant:pd,themeOverrides:Sd,colorMode:wd,presence:bd,showTokenUsage:Td,...Pd?{thread:Pd}:{}}),configurePlugin(InputPromptPlugin,{firstPromptHook:Od}),ChatHeaderPlugin,A2uiSurfacePlugin,ChatViewPlugin,..._d?[NotebookViewPlugin,DocumentViewPlugin]:[],configurePlugin(AgentsPlugin,{serverUrl:lo,target:$u,datalayerAgentSpecId:rd,datalayerCreatePayload:nd,datalayerVisitors:od,datalayerKept:ad,embedToken:ld,targetFixed:fd,showAgentVariants:Fu,showAgentSummary:zu,teamId:qu,showTeamPicker:Uu,localAgent:ed??(Xu?{createPayload:{description:`Local agent from the ${Xu} spec`,agent_library:"pydantic-ai",agent_spec_id:Xu,enable_codemode:!1}}:void 0)}),..._d?[NotebookExtension,DocumentExtension]:[],A2uiPlugin,AgentspecsPlugin,ModelsPlugin,ThemePlugin,SubagentActivityPlugin,configurePlugin(ShellPlugin,{defaultEditor:Bd,showSelector:_d&&md}),...ud?[PromptPlugin]:[],...Hu?[configurePlugin(LoopPageLayoutPlugin,{arrangement:Vu,turnPanel:Gu,turnPanelFooter:Yu,prompt:Ku,promptAnchor:Zu,pageSize:Qu})]:[],...gd?[LoopCommandsPlugin]:[],...Ed?[PluginsPanelPlugin]:[],...xd?[WindowFramePlugin]:[]]:[ThemePlugin,configurePlugin(ShellPlugin,{defaultEditor:"none",showSelector:!1}),...gd?[LoopCommandsPlugin]:[],...Ed?[PluginsPanelPlugin]:[],...xd?[WindowFramePlugin]:[]]}function LoopEmbed({agentId:Au="",showHeader:lo=!1,chatHeaderActions:$u,headerActions:Ru,headerContainer:Iu,frameTitle:Ou,frameHeight:Pu,sidebarRail:Du=!1,plugins:Lu=[],...ju}){const Bu=reactExports.useRef(ju.firstPromptHook);Bu.current=ju.firstPromptHook;const Fu=reactExports.useMemo(()=>buildLoopReactor([...loopPlugins({...ju,windowFrame:ju.windowFrame||Ou!==void 0,firstPromptHook:()=>Bu.current?.()}),...Lu]),[ju.serverUrl,ju.target,ju.datalayerAgentSpecId,ju.targetFixed,ju.themeVariant,JSON.stringify(ju.themeOverrides??null),ju.colorMode,ju.presence?.name,ju.presence?.face,ju.presence?.welcome,ju.presence?.paused,ju.showTokenUsage,ju.thread?.id,JSON.stringify(ju.datalayerCreatePayload??null),JSON.stringify(ju.datalayerVisitors??null),ju.datalayerKept?.url,ju.embedToken,ju.defaultEditor,ju.showViewSelector,ju.hideChatHeader,ju.chatHeaderButtons,ju.promptPlacement,ju.autoFocusPrompt,ju.suggestionLabels,ju.fullScreenTopOffset,ju.showAgentVariants,ju.agentSummary,ju.teamId,ju.teamPicker,ju.pageLayout,ju.pageLayoutTurnPanel,ju.pageLayoutTurnPanelFooter,ju.pageLayoutPrompt,ju.pageLayoutPromptAnchor,ju.pageLayoutSize?.format,ju.pageLayoutSize?.width,ju.pageLayoutSize?.height,ju.localAgentSpec,ju.floatingPrompt,ju.editorSelector,ju.editors,ju.conversation,ju.commandPalette,ju.pluginsPanel,ju.windowFrame,Ou!==void 0,Lu]);useReactor(Fu);const zu=jsxRuntimeExports.jsx(LoopWorkspace,{serverUrl:ju.serverUrl??"",agentId:Au,reactor:Fu,manageReactor:!1,showViewSelector:ju.showViewSelector,showHeader:lo,chatHeaderActions:$u,headerActions:Ru,headerContainer:Iu,sidebarRail:Du});return jsxRuntimeExports.jsx(QueryClientProvider,{client:internalQueryClient,children:Ou!==void 0?jsxRuntimeExports.jsx(WindowFrame,{title:Ou,height:Pu,children:zu}):jsxRuntimeExports.jsx(Box,{height:"100%",minHeight:0,width:"100%",flex:"1 1 auto",minWidth:0,children:zu})})}const RECORD_KIND_WORDS={session:"Session",tool_call:"Tool call",decision:"Rule",check:"Check",approval:"Approval",output:"Answer",feedback:"Feedback",turn:"Turn",run:"Working",notification:"Notification"};function entryOf(Au){return{uid:String(Au.uid??""),sessionUid:String(Au.session_uid??""),deploymentUid:String(Au.deployment_uid??""),version:Number(Au.version)||0,kind:String(Au.kind??"output"),summary:String(Au.summary??""),payload:Au.payload&&typeof Au.payload=="object"?Au.payload:{},createdAt:String(Au.created_at??"")}}function sessionSentence(Au){const lo=Au.filter(Pu=>Pu.kind==="tool_call").length,$u=Au.filter(Pu=>Pu.kind==="check"),Ru=Au.filter(Pu=>Pu.kind==="output"),Iu=Ru[Ru.length-1],Ou=[lo===0?"No tool called":`${lo} tool call${lo===1?"":"s"}`];return $u.length&&Ou.push(`${$u.length} step${$u.length===1?"":"s"} a check did not let pass`),Iu?.summary.startsWith("Stopped:")?Ou.push("stopped"):Ru.length&&Ou.push(`${Ru.length} answer${Ru.length===1?"":"s"}`),`${Ou.join(", ")}.`}async function read(Au,lo,$u){if(!Au.aiAgentsUrl)throw new Error("The record service is not configured.");const Ru=await fetch(`${Au.aiAgentsUrl.replace(/\/+$/,"")}/api/ai-agents/v1/apps${lo}`,{headers:Au.token?{Authorization:`Bearer ${Au.token}`}:{}}),Iu=await Ru.json().catch(()=>({}));if(!Ru.ok||Iu.success===!1)throw new Error(`${$u}: ${String(Iu.detail??Ru.status)}`);return Iu}async function listSessions(Au,lo,$u=20,Ru=!1){const Iu=await read(Au,`/sessions?app_uid=${encodeURIComponent(lo)}&limit=${$u}${Ru===null?"":`&tests=${Ru}`}`,"The sessions could not be read");return Array.isArray(Iu.sessions)?Iu.sessions.map(entryOf):[]}async function readSession(Au,lo){const $u=await read(Au,`/records?session_uid=${encodeURIComponent(lo)}&limit=500`,"The session could not be read");return Array.isArray($u.entries)?$u.entries.map(entryOf).filter(Ru=>Ru.kind!=="run"):[]}const APP_ACTIVITY_WORDS={title:"Activity",unsaved:"Recorded once it is saved on Datalayer: each session there — its address, or its Preview on Datalayer — is listed here.",signedOut:"Its activity is its owner’s: sign in to Datalayer to read it.",none:"Nothing yet: a session on Datalayer — its address, or the Preview on Datalayer — is recorded here."},NO_TURN$3=signal$2({id:0,status:"idle"});function useRead(Au,lo,$u=!0){const[Ru,Iu]=reactExports.useState({loading:$u});return reactExports.useEffect(()=>{if(!$u)return;let Ou=!1;return Iu(Pu=>({...Pu,loading:!0})),Au().then(Pu=>!Ou&&Iu({value:Pu,loading:!1}),Pu=>!Ou&&Iu({error:Pu instanceof Error?Pu.message:String(Pu),loading:!1})),()=>{Ou=!0}},[lo,$u]),Ru}function Session({context:Au,session:lo}){const[$u,Ru]=reactExports.useState(!1),Iu=useRead(()=>readSession(Au,lo.sessionUid),`${lo.sessionUid}:${Au.token}`,$u);return jsxRuntimeExports.jsxs(Box,{as:"details",onToggle:Ou=>Ru(Ou.currentTarget.open),borderTop:"1px solid",borderColor:"border.muted",py:2,children:[jsxRuntimeExports.jsxs(Box,{as:"summary",cursor:"pointer",fontSize:1,children:[lo.createdAt?jsxRuntimeExports.jsx(RelativeTime,{datetime:lo.createdAt}):"A session",lo.version?` · version ${lo.version}`:"",Iu.value?` · ${sessionSentence(Iu.value)}`:""]}),$u?Iu.loading?jsxRuntimeExports.jsx(StyledSpinner,{size:"small"}):Iu.error?jsxRuntimeExports.jsx(Text$5,{role:"alert",sx:{fontSize:1},children:Iu.error}):jsxRuntimeExports.jsx(Box,{as:"ol",pl:3,mt:2,mb:0,fontSize:1,children:(Iu.value??[]).map(Ou=>jsxRuntimeExports.jsxs(Box,{as:"li",mb:1,children:[jsxRuntimeExports.jsx(Label,{sx:{mr:2},children:RECORD_KIND_WORDS[Ou.kind]??Ou.kind}),Ou.summary]},Ou.uid))}):null]})}function AppActivity({appUid:Au}){const lo=useIAMStore(Fu=>Fu.token)??"",$u=useCoreStore(Fu=>Fu.configuration)?.aiAgentsUrl??"",Ru=useContributions(LoopChatTurn),Iu=useSignalValue$1(Ru[0]?.value.turn??NO_TURN$3),Ou=Iu.status!=="thinking"&&Iu.status!=="streaming",[Pu,Du]=reactExports.useState(0);reactExports.useEffect(()=>{Ou&&Du(Iu.id)},[Ou,Iu.id]);const Lu={aiAgentsUrl:$u,token:lo},ju=!!(Au&&lo),Bu=useRead(()=>listSessions(Lu,Au??""),`${Au}:${lo}:${$u}:${Pu}`,ju);return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-activity",children:[jsxRuntimeExports.jsx(Heading$2,{as:"h3",sx:{fontSize:2,mb:2},children:APP_ACTIVITY_WORDS.title}),Au?lo?Bu.loading&&!Bu.value?jsxRuntimeExports.jsx(StyledSpinner,{size:"small"}):Bu.error?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:Bu.error}):(Bu.value??[]).length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_ACTIVITY_WORDS.none}):(Bu.value??[]).map(Fu=>jsxRuntimeExports.jsx(Session,{context:Lu,session:Fu},Fu.uid)):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_ACTIVITY_WORDS.signedOut}):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_ACTIVITY_WORDS.unsaved})]})}const APP_ACTIVITY_PLUGIN_NAME="@datalayer/loop-plugin-app-activity";function defineAppActivityPlugin(Au,lo){function $u(){return jsxRuntimeExports.jsx(AppActivity,{appUid:lo})}return{name:`${APP_ACTIVITY_PLUGIN_NAME}-${Au.id}`,displayName:`${Au.name}: activity`,description:`What ${Au.name} did, session by session, from its record.`,octicon:"pulse",build:()=>({components:[{id:"app-activity",slot:LoopSlots.sidebar,order:20,Component:$u,rail:{label:"Activity",icon:PulseIcon}}]})}}const APP_PANEL_WIDTH=380;function elementsByPlace(Au){const lo=Au.filter($u=>$u.where==="page");return{panels:Au.filter($u=>$u.where==="panel"),page:lo.length>0?lo[lo.length-1]:null}}function ElementBody({element:Au,send:lo}){const $u=reactExports.useMemo(()=>readA2uiToolResult(Au.shows,SURFACE_CATALOG_ID),[Au.shows]),Ru=useOwnCatalog(),Iu=Ou=>{const Pu=answerAction(Ou);Pu&&lo?.(Pu.message,Pu.forwardedProps)};return!$u?.messages||$u.messages.length===0?jsxRuntimeExports.jsx(Text$5,{sx:{color:"fg.muted"},children:"Nothing to show."}):jsxRuntimeExports.jsx(InlineSurface,{messages:$u.messages,onAction:Iu,catalog:Ru},JSON.stringify(Au.shows))}function ElementHeader({element:Au}){return jsxRuntimeExports.jsxs(Box,{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:2,children:[jsxRuntimeExports.jsx(Text$5,{as:"h2",sx:{fontSize:2,fontWeight:"bold",m:0},children:Au.title}),jsxRuntimeExports.jsx(IconButton,{icon:XIcon,variant:"invisible",size:"small","aria-label":`Close ${Au.title}`,onClick:()=>closeLoopElement(Au.id)})]})}function AppElements({workspace:Au}){const lo=reactExports.useSyncExternalStore(onLoopElements,openLoopElements,openLoopElements),{panels:$u,page:Ru}=elementsByPlace(lo),Iu=Au?.viewControls.send;return $u.length===0&&Ru===null?null:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[$u.length>0?jsxRuntimeExports.jsx(Box,{as:"aside","aria-label":"Side panel",position:"absolute",top:0,right:0,bottom:0,width:`min(${APP_PANEL_WIDTH}px, 100%)`,zIndex:1,overflowY:"auto",borderLeft:"1px solid",borderColor:"border.default",bg:"canvas.subtle",boxShadow:"shadow.medium",p:3,display:"flex",flexDirection:"column",gap:3,children:$u.map(Ou=>jsxRuntimeExports.jsxs(Box,{as:"section","aria-label":Ou.title,children:[jsxRuntimeExports.jsx(ElementHeader,{element:Ou}),jsxRuntimeExports.jsx(ElementBody,{element:Ou,send:Iu})]},Ou.id))}):null,Ru!==null?jsxRuntimeExports.jsxs(Box,{role:"dialog","aria-label":Ru.title,position:"absolute",inset:0,zIndex:2,overflowY:"auto",bg:"canvas.default",p:[3,4],children:[jsxRuntimeExports.jsx(ElementHeader,{element:Ru}),jsxRuntimeExports.jsx(ElementBody,{element:Ru,send:Iu})]}):null]})}const APP_ELEMENTS_PLUGIN_NAME="@datalayer/loop-plugin-app-elements",AppElementsPlugin={name:APP_ELEMENTS_PLUGIN_NAME,displayName:"Side panel and pages",description:"What an application opens beside the conversation: a side panel, or a page of its own.",octicon:"sidebar-expand",build:()=>({components:[{id:"app-elements",slot:LoopSlots.root,Component:AppElements}]}),register:()=>clearLoopElements},appComponentsPluginName=Au=>`@datalayer/loop-plugin-app-components-${Au}`,hasCustomComponents=Au=>(Au.interface.customComponents??[]).length>0;function defineAppComponentsPlugin(Au,lo){const $u=Au.interface.customComponents??[];if($u.length===0)throw new Error(`“${Au.name}” has no component of its own to contribute.`);return{name:appComponentsPluginName(Au.id),displayName:`${Au.name}'s components`,description:`The components ${Au.name}'s developer wrote: ${$u.map(Ru=>Ru.name).join(", ")}.`,octicon:"apps",contributes:$u.flatMap(Ru=>[contribution(LoopCanvasBlock,{id:Ru.name,uiPlugin:`app:${Au.id}`,component:customComponentEntry(Ru,Au.version)},{id:Ru.name}),contribution(LoopA2uiComponent,{id:Ru.name,app:Au.id,implementation:customImplementation(Ru,Au.version,lo,Au.id)},{id:Ru.name})])}}const COMPUTER_PARTS=["browse","files","shell"],COMPUTER_PART_TOOLS={browse:[],files:["list_computer_files","read_computer_file","write_computer_file"],shell:["execute_code","run_skill_script"]},COMPUTER_WORDS={title:"Computer",part:{browse:"Browse",files:"Files",shell:"Shell"},on:"on",off:"off",none:"It has no computer: browse, files and shell are all off. Turn one on in its permissions to give it one.",offSaid:Au=>`Off, so its agent is given no tool for it: ${Au.join(", ")}.`,noBrowser:"Browser: no browser runs on its computer yet, so there is nothing to show.",agentHas:"Its agent has the computer.",youHave:"You have the computer: its agent waits for it until you hand it back.",someoneHas:"Somebody else has taken this computer over.",takeOver:"Take over",handBack:"Hand back",run:"Run",yourCode:"Python to run on its computer",terminal:"What ran on it",nothingRan:"Nothing has run on it yet in this conversation.",files:"Files",notStarted:"Its computer starts when its agent first uses it: no file yet.",emptyDirectory:"Empty.",up:"Up",download:"Download",signedOut:"Its computer is shown once you are signed in to Datalayer."};function computerParts(Au){const lo=Au.permissions?.computer;return{browse:!!lo?.browse,files:!!lo?.files,shell:!!lo?.shell}}const hasComputer=Au=>COMPUTER_PARTS.some(lo=>Au[lo]),partsOff=Au=>COMPUTER_PARTS.filter(lo=>!Au[lo]).map(lo=>COMPUTER_WORDS.part[lo].toLowerCase());function partOf(Au){return COMPUTER_PARTS.find(lo=>COMPUTER_PART_TOOLS[lo].includes(Au))}const OUTPUT_LIMIT=4e3;function outputOf(Au){let lo=Au;if(typeof lo=="string")try{const Ru=JSON.parse(lo);Ru&&typeof Ru=="object"&&!Array.isArray(Ru)&&(lo=Ru)}catch{}let $u;if(lo&&typeof lo=="object"&&!Array.isArray(lo)){const Ru=lo,Iu=[typeof Ru.stdout=="string"?Ru.stdout:Ru.output,Ru.stderr,Ru.error??Ru.execution_error??Ru.code_error].filter(Ou=>typeof Ou=="string"&&Ou.trim()!=="");$u=Iu.length>0?Iu.join(`
4105
+ `);await navigator.clipboard?.writeText(Fu),Lu(!0)},[$u.user,$u.assistant]);if(Ru==="panel"||$u.status==="idle"||!$u.user||Ou===$u.id)return null;const Bu=$u.status==="thinking"||$u.status==="streaming";return jsxRuntimeExports.jsxs(Box,{"data-turn-panel":"",borderTop:"1px solid",borderColor:"border.muted",px:3,pt:2,pb:Au==="none"?2:1,display:"flex",flexDirection:"column",gap:2,bg:"canvas.default",children:[jsxRuntimeExports.jsx(Box,{display:"flex",justifyContent:"flex-end",children:jsxRuntimeExports.jsx(Text$5,{sx:{fontSize:0,lineHeight:1.45,px:2,py:1,borderRadius:"10px",bg:"accent.subtle",color:"fg.default",maxWidth:"85%",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:$u.user})}),jsxRuntimeExports.jsxs(Box,{display:"flex",gap:2,alignItems:"flex-start",children:[jsxRuntimeExports.jsx(Box,{ref:Iu,flex:"1 1 auto",minWidth:0,maxHeight:MAX_HEIGHT,overflowY:"auto",fontSize:0,lineHeight:1.5,color:$u.assistant?"fg.default":"fg.muted",whiteSpace:$u.assistant?"normal":"pre-wrap",overflowWrap:"anywhere",children:$u.assistant?jsxRuntimeExports.jsx(Box,{sx:{...streamdownMarkdownStyles,fontSize:0},children:jsxRuntimeExports.jsx(_o$1,{rehypePlugins:REHYPE_PLUGINS_WITHOUT_HTML,children:normalizeAssistantMarkdown($u.assistant)})}):$u.activity?jsxRuntimeExports.jsx(Text$5,{sx:{color:"fg.muted",fontStyle:"italic"},children:$u.activity}):Bu?jsxRuntimeExports.jsx(Thinking,{}):$u.status==="error"?"The agent could not answer.":"Done — the result is in the page."}),jsxRuntimeExports.jsx(IconButton,{icon:CommentDiscussionIcon,size:"small",variant:"invisible","aria-label":"Open the conversation",onClick:openPagePanel,sx:{color:"fg.muted",flexShrink:0}})]}),$u.assistant&&$u.activity?jsxRuntimeExports.jsx(Text$5,{sx:{fontSize:0,color:"fg.muted",fontStyle:"italic"},children:$u.activity}):null,Au==="full"?jsxRuntimeExports.jsx(TurnFooter,{usage:$u.usage,live:Bu,latest:!0,padding:0,onCopy:ju,onRemove:()=>Pu($u.id)}):Au==="actions"?jsxRuntimeExports.jsxs(Box,{display:"flex",justifyContent:"flex-end",gap:1,mt:-1,children:[jsxRuntimeExports.jsx(IconButton,{icon:Du?CheckIcon:CopyIcon,size:"small",variant:"invisible","aria-label":Du?"Copied":"Copy this turn",onClick:()=>{ju()},sx:{color:"fg.muted"}}),jsxRuntimeExports.jsx(IconButton,{icon:XIcon,size:"small",variant:"invisible","aria-label":"Dismiss until the next turn",onClick:()=>Pu($u.id),sx:{color:"fg.muted"}})]}):null]})}const SPLIT_DEFAULT_SHARE=.4,SPLIT_MIN_SHARE=.2,SPLIT_MAX_SHARE=.8,SPLIT_KEY_STEP=.05;function clampSplitShare(Au){return Number.isFinite(Au)?Math.min(SPLIT_MAX_SHARE,Math.max(SPLIT_MIN_SHARE,Au)):SPLIT_DEFAULT_SHARE}function splitShareForKey(Au,lo){switch(lo){case"ArrowLeft":return clampSplitShare(Au-SPLIT_KEY_STEP);case"ArrowRight":return clampSplitShare(Au+SPLIT_KEY_STEP);case"Home":return SPLIT_MIN_SHARE;case"End":return SPLIT_MAX_SHARE;default:return null}}function SplitLayout({editors:Au,hasEditor:lo,transcript:$u,prompt:Ru,chips:Iu,picker:Ou,transient:Pu}){const[Du,Lu]=reactExports.useState(SPLIT_DEFAULT_SHARE),ju=reactExports.useRef(null),Bu=reactExports.useRef(!1),Fu=reactExports.useCallback(Gu=>{const Ku=ju.current?.getBoundingClientRect();return!Ku||Ku.width<=0?null:clampSplitShare((Gu-Ku.left)/Ku.width)},[]),zu=Gu=>{Bu.current=!0,Gu.currentTarget.setPointerCapture?.(Gu.pointerId),Gu.preventDefault()},qu=Gu=>{if(!Bu.current)return;const Ku=Fu(Gu.clientX);Ku!==null&&Lu(Ku)},Uu=Gu=>{Bu.current=!1,Gu.currentTarget.releasePointerCapture?.(Gu.pointerId)},Hu=Gu=>{const Ku=splitShareForKey(Du,Gu.key);Ku!==null&&(Gu.preventDefault(),Lu(Ku))},Vu=Math.round(Du*100);return jsxRuntimeExports.jsxs(Box,{"data-testid":"loop-split-layout",flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",children:[Ou,jsxRuntimeExports.jsxs(Box,{ref:ju,flex:"1 1 auto",minHeight:0,display:"flex",position:"relative",overflow:"hidden",children:[jsxRuntimeExports.jsxs(Box,{"data-testid":"loop-split-conversation",flex:lo?`0 0 ${Vu}%`:"1 1 auto",minWidth:0,minHeight:0,display:"flex",flexDirection:"column",ml:lo?"-1px":0,children:[$u,Iu,Ru]}),lo?jsxRuntimeExports.jsx(Box,{role:"separator","aria-orientation":"vertical","aria-label":"Resize the conversation and the page","aria-valuemin":Math.round(SPLIT_MIN_SHARE*100),"aria-valuemax":Math.round(SPLIT_MAX_SHARE*100),"aria-valuenow":Vu,tabIndex:0,onPointerDown:zu,onPointerMove:qu,onPointerUp:Uu,onPointerCancel:Uu,onKeyDown:Hu,flex:"0 0 7px",mx:"-3px",zIndex:1,cursor:"col-resize",display:"flex",justifyContent:"center",outline:"none",touchAction:"none",sx:{"&::before":{content:'""',width:"1px",height:"100%",bg:"border.default"},"&:hover::before, &:focus-visible::before":{width:"3px",bg:"accent.emphasis"}}}):null,jsxRuntimeExports.jsx(Box,{"data-testid":"loop-split-page",sx:lo?{flex:"1 1 0",minWidth:0,minHeight:0,display:"flex",...paneOpening("right")}:{position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",zIndex:-1},children:Au})]}),Pu]})}const LOOP_PAGE_LAYOUT_PLUGIN_NAME="@datalayer/loop-plugin-page-layout",NO_TURN$4=signal$2({id:0,status:"idle"}),pageLayoutChatMode=signal$2("floating-draggable"),promptStance=signal$2("floating-top");let floatingStance="floating-top";const PAGE_LAYOUT_DISABLED_MODES=["assistant"];function pageLayoutForChatMode(Au){switch(Au){case"sidebar":return{bandMode:"panel",panelMode:"docked"};case"floating":return{bandMode:"panel",panelMode:"overlay"};case"floating-small":return{bandMode:"panel",panelMode:"popup"};default:return{bandMode:"floating",panelMode:"docked"}}}function setPageLayoutChatMode(Au){pageLayoutChatMode.value=Au;const{bandMode:lo}=pageLayoutForChatMode(Au);promptStance.value=lo==="floating"?floatingStance:"docked-top",lo==="panel"&&openPagePanel()}function ChatModeAction(){const Au=useSignalValue$1(pageLayoutChatMode);return jsxRuntimeExports.jsx(ChatViewModeToggle,{value:Au,onChange:setPageLayoutChatMode,disabledModes:PAGE_LAYOUT_DISABLED_MODES})}function LoopPageLayout({parts:Au,promptMode:lo,pageSize:$u}){const Ru=useContributions(LoopChatTurn),Iu=useSignalValue$1(Ru[0]?.value.turn??NO_TURN$4),Ou=useSignalValue$1(pageLayoutChatMode),Pu=lo==="floating"?pageLayoutForChatMode(Ou):{bandMode:"docked",panelMode:"docked"};return jsxRuntimeExports.jsx(PageLayout,{page:Au.editors,hasPage:Au.hasEditor,panel:Au.transcript,band:Au.prompt,chips:Au.chips,picker:Au.picker,transient:Au.transient,activity:Iu.activity,bandMode:Pu.bandMode,panelMode:Pu.panelMode,pageSize:$u})}function ConversationToggle(){return jsxRuntimeExports.jsx(PagePanelToggle,{panelName:"conversation",icon:CommentDiscussionIcon,sx:{order:2}})}const LoopPageLayoutPlugin={name:LOOP_PAGE_LAYOUT_PLUGIN_NAME,config:{arrangement:"page",turnPanel:"below",turnPanelFooter:"full",prompt:"docked",promptAnchor:"top",pageSize:void 0},displayName:"Page layout",description:"The editor — or, in the chat view, the conversation — on a centred sheet, the prompt docked above it at the same width or floating over it as a draggable card, the current turn under the prompt, the conversation in a side panel; or, split, the conversation and the work side by side with a hairline to drag.",octicon:"file",emoji:"📄",build:({config:Au,...lo})=>{if(Au.arrangement==="split")return lo.contribute(LoopChatLayout,{id:"split-layout",prompt:"docked",Component:SplitLayout},{id:"split-layout"}),{components:[]};const $u=Au.prompt,Ru=Au.pageSize;floatingStance=Au.promptAnchor==="bottom"?"floating-bottom":"floating-top",$u==="floating"&&(promptStance.value=floatingStance);const Iu=Ou=>jsxRuntimeExports.jsx(LoopPageLayout,{parts:Ou,promptMode:$u,pageSize:Ru});if(lo.contribute(LoopChatLayout,{id:"page-layout",prompt:$u==="floating"?floatingStance:"docked-top",promptStance:$u==="floating"?promptStance:void 0,Component:Iu},{id:"page-layout"}),Au.turnPanel!=="none"){const Ou=Au.turnPanelFooter,Pu=()=>jsxRuntimeExports.jsx(TurnPanel,{footer:Ou});lo.contribute(LoopPromptPanel,{id:"page-layout-turn",placement:Au.turnPanel,order:0,Component:Pu},{id:"page-layout-turn"})}return{components:[{id:"page-layout-conversation-toggle",slot:LoopSlots.header,Component:ConversationToggle},...$u==="floating"?[{id:"page-layout-chat-mode",slot:LoopSlots.promptAction,Component:ChatModeAction}]:[]]}}};function loopPlugins(Au={}){const{serverUrl:lo,target:$u="browser",defaultEditor:Ru,showViewSelector:Iu=!0,hideChatHeader:Ou=!1,chatHeaderButtons:Pu=!1,promptPlacement:Du,autoFocusPrompt:Lu=!0,suggestionLabels:ju=!0,fullScreenTopOffset:Bu=0,showAgentVariants:Fu=!1,agentSummary:zu=!0,teamId:qu,teamPicker:Uu=!0,pageLayout:Hu=!1,pageLayoutArrangement:Vu="page",pageLayoutTurnPanel:Gu="below",pageLayoutPrompt:Ku="docked",pageLayoutPromptAnchor:Zu="top",pageLayoutSize:Qu,pageLayoutTurnPanelFooter:Yu="full",localAgent:ed,localAgentSpec:Xu,datalayerAgentSpecId:rd,datalayerCreatePayload:nd,datalayerVisitors:od,datalayerKept:ad,embedToken:ld,targetFixed:fd,themeVariant:pd,themeOverrides:Sd,colorMode:wd,presence:bd,showTokenUsage:Td,thread:Pd,floatingPrompt:ud=!1,editorSelector:md=!1,editors:_d=!0,conversation:hd=!0,commandPalette:gd=!1,pluginsPanel:Ed=!1,windowFrame:xd=!1,firstPromptHook:Od}=Au,Bd=Ru??(_d?"notebook":"none");return hd?[configurePlugin(ChatPlugin,{defaultSurface:Bd,showSurfaceSelector:_d&&Iu&&!md,hideHeader:Ou,headerButtons:{newChat:Pu,clear:Pu},promptPlacement:ud?"floating":Du,autoFocusPrompt:Lu,suggestionLabels:ju,fullScreenTopOffset:Bu,themeVariant:pd,themeOverrides:Sd,colorMode:wd,presence:bd,showTokenUsage:Td,...Pd?{thread:Pd}:{}}),configurePlugin(InputPromptPlugin,{firstPromptHook:Od}),ChatHeaderPlugin,A2uiSurfacePlugin,ChatViewPlugin,..._d?[NotebookViewPlugin,DocumentViewPlugin]:[],configurePlugin(AgentsPlugin,{serverUrl:lo,target:$u,datalayerAgentSpecId:rd,datalayerCreatePayload:nd,datalayerVisitors:od,datalayerKept:ad,embedToken:ld,targetFixed:fd,showAgentVariants:Fu,showAgentSummary:zu,teamId:qu,showTeamPicker:Uu,localAgent:ed??(Xu?{createPayload:{description:`Local agent from the ${Xu} spec`,agent_library:"pydantic-ai",agent_spec_id:Xu,enable_codemode:!1}}:void 0)}),..._d?[NotebookExtension,DocumentExtension]:[],A2uiPlugin,AgentspecsPlugin,ModelsPlugin,ThemePlugin,SubagentActivityPlugin,configurePlugin(ShellPlugin,{defaultEditor:Bd,showSelector:_d&&md}),...ud?[PromptPlugin]:[],...Hu?[configurePlugin(LoopPageLayoutPlugin,{arrangement:Vu,turnPanel:Gu,turnPanelFooter:Yu,prompt:Ku,promptAnchor:Zu,pageSize:Qu})]:[],...gd?[LoopCommandsPlugin]:[],...Ed?[PluginsPanelPlugin]:[],...xd?[WindowFramePlugin]:[]]:[ThemePlugin,configurePlugin(ShellPlugin,{defaultEditor:"none",showSelector:!1}),...gd?[LoopCommandsPlugin]:[],...Ed?[PluginsPanelPlugin]:[],...xd?[WindowFramePlugin]:[]]}function LoopEmbed({agentId:Au="",showHeader:lo=!1,chatHeaderActions:$u,headerActions:Ru,headerContainer:Iu,frameTitle:Ou,frameHeight:Pu,sidebarRail:Du=!1,plugins:Lu=[],...ju}){const Bu=reactExports.useRef(ju.firstPromptHook);Bu.current=ju.firstPromptHook;const Fu=reactExports.useMemo(()=>buildLoopReactor([...loopPlugins({...ju,windowFrame:ju.windowFrame||Ou!==void 0,firstPromptHook:()=>Bu.current?.()}),...Lu]),[ju.serverUrl,ju.target,ju.datalayerAgentSpecId,ju.targetFixed,ju.themeVariant,JSON.stringify(ju.themeOverrides??null),ju.colorMode,ju.presence?.name,ju.presence?.face,ju.presence?.welcome,ju.presence?.paused,ju.showTokenUsage,ju.thread?.id,JSON.stringify(ju.datalayerCreatePayload??null),JSON.stringify(ju.datalayerVisitors??null),ju.datalayerKept?.url,ju.embedToken,ju.defaultEditor,ju.showViewSelector,ju.hideChatHeader,ju.chatHeaderButtons,ju.promptPlacement,ju.autoFocusPrompt,ju.suggestionLabels,ju.fullScreenTopOffset,ju.showAgentVariants,ju.agentSummary,ju.teamId,ju.teamPicker,ju.pageLayout,ju.pageLayoutTurnPanel,ju.pageLayoutTurnPanelFooter,ju.pageLayoutPrompt,ju.pageLayoutPromptAnchor,ju.pageLayoutSize?.format,ju.pageLayoutSize?.width,ju.pageLayoutSize?.height,ju.localAgentSpec,ju.floatingPrompt,ju.editorSelector,ju.editors,ju.conversation,ju.commandPalette,ju.pluginsPanel,ju.windowFrame,Ou!==void 0,Lu]);useReactor(Fu);const zu=jsxRuntimeExports.jsx(LoopWorkspace,{serverUrl:ju.serverUrl??"",agentId:Au,reactor:Fu,manageReactor:!1,showViewSelector:ju.showViewSelector,showHeader:lo,chatHeaderActions:$u,headerActions:Ru,headerContainer:Iu,sidebarRail:Du});return jsxRuntimeExports.jsx(QueryClientProvider,{client:internalQueryClient,children:Ou!==void 0?jsxRuntimeExports.jsx(WindowFrame,{title:Ou,height:Pu,children:zu}):jsxRuntimeExports.jsx(Box,{height:"100%",minHeight:0,width:"100%",flex:"1 1 auto",minWidth:0,children:zu})})}const RECORD_KIND_WORDS={session:"Session",tool_call:"Tool call",decision:"Rule",check:"Check",approval:"Approval",output:"Answer",feedback:"Feedback",turn:"Turn",run:"Working",notification:"Notification"};function entryOf(Au){return{uid:String(Au.uid??""),sessionUid:String(Au.session_uid??""),deploymentUid:String(Au.deployment_uid??""),version:Number(Au.version)||0,kind:String(Au.kind??"output"),summary:String(Au.summary??""),payload:Au.payload&&typeof Au.payload=="object"?Au.payload:{},createdAt:String(Au.created_at??"")}}function sessionSentence(Au){const lo=Au.filter(Pu=>Pu.kind==="tool_call").length,$u=Au.filter(Pu=>Pu.kind==="check"),Ru=Au.filter(Pu=>Pu.kind==="output"),Iu=Ru[Ru.length-1],Ou=[lo===0?"No tool called":`${lo} tool call${lo===1?"":"s"}`];return $u.length&&Ou.push(`${$u.length} step${$u.length===1?"":"s"} a check did not let pass`),Iu?.summary.startsWith("Stopped:")?Ou.push("stopped"):Ru.length&&Ou.push(`${Ru.length} answer${Ru.length===1?"":"s"}`),`${Ou.join(", ")}.`}async function read(Au,lo,$u){if(!Au.aiAgentsUrl)throw new Error("The record service is not configured.");const Ru=await fetch(`${Au.aiAgentsUrl.replace(/\/+$/,"")}/api/ai-agents/v1/apps${lo}`,{headers:Au.token?{Authorization:`Bearer ${Au.token}`}:{}}),Iu=await Ru.json().catch(()=>({}));if(!Ru.ok||Iu.success===!1)throw new Error(`${$u}: ${String(Iu.detail??Ru.status)}`);return Iu}async function listSessions(Au,lo,$u=20,Ru=!1){const Iu=await read(Au,`/sessions?app_uid=${encodeURIComponent(lo)}&limit=${$u}${Ru===null?"":`&tests=${Ru}`}`,"The sessions could not be read");return Array.isArray(Iu.sessions)?Iu.sessions.map(entryOf):[]}async function readSession(Au,lo){const $u=await read(Au,`/records?session_uid=${encodeURIComponent(lo)}&limit=500`,"The session could not be read");return Array.isArray($u.entries)?$u.entries.map(entryOf).filter(Ru=>Ru.kind!=="run"):[]}const APP_ACTIVITY_WORDS={title:"Activity",unsaved:"Recorded once it is saved on Datalayer: each session there — its address, or its Preview on Datalayer — is listed here.",signedOut:"Its activity is its owner’s: sign in to Datalayer to read it.",none:"Nothing yet: a session on Datalayer — its address, or the Preview on Datalayer — is recorded here."},NO_TURN$3=signal$2({id:0,status:"idle"});function useRead(Au,lo,$u=!0){const[Ru,Iu]=reactExports.useState({loading:$u});return reactExports.useEffect(()=>{if(!$u)return;let Ou=!1;return Iu(Pu=>({...Pu,loading:!0})),Au().then(Pu=>!Ou&&Iu({value:Pu,loading:!1}),Pu=>!Ou&&Iu({error:Pu instanceof Error?Pu.message:String(Pu),loading:!1})),()=>{Ou=!0}},[lo,$u]),Ru}function Session({context:Au,session:lo}){const[$u,Ru]=reactExports.useState(!1),Iu=useRead(()=>readSession(Au,lo.sessionUid),`${lo.sessionUid}:${Au.token}`,$u);return jsxRuntimeExports.jsxs(Box,{as:"details",onToggle:Ou=>Ru(Ou.currentTarget.open),borderTop:"1px solid",borderColor:"border.muted",py:2,children:[jsxRuntimeExports.jsxs(Box,{as:"summary",cursor:"pointer",fontSize:1,children:[lo.createdAt?jsxRuntimeExports.jsx(RelativeTime,{datetime:lo.createdAt}):"A session",lo.version?` · version ${lo.version}`:"",Iu.value?` · ${sessionSentence(Iu.value)}`:""]}),$u?Iu.loading?jsxRuntimeExports.jsx(StyledSpinner,{size:"small"}):Iu.error?jsxRuntimeExports.jsx(Text$5,{role:"alert",sx:{fontSize:1},children:Iu.error}):jsxRuntimeExports.jsx(Box,{as:"ol",pl:3,mt:2,mb:0,fontSize:1,children:(Iu.value??[]).map(Ou=>jsxRuntimeExports.jsxs(Box,{as:"li",mb:1,children:[jsxRuntimeExports.jsx(Label,{sx:{mr:2},children:RECORD_KIND_WORDS[Ou.kind]??Ou.kind}),Ou.summary]},Ou.uid))}):null]})}function AppActivity({appUid:Au}){const lo=useIAMStore(Fu=>Fu.token)??"",$u=useCoreStore(Fu=>Fu.configuration)?.aiAgentsUrl??"",Ru=useContributions(LoopChatTurn),Iu=useSignalValue$1(Ru[0]?.value.turn??NO_TURN$3),Ou=Iu.status!=="thinking"&&Iu.status!=="streaming",[Pu,Du]=reactExports.useState(0);reactExports.useEffect(()=>{Ou&&Du(Iu.id)},[Ou,Iu.id]);const Lu={aiAgentsUrl:$u,token:lo},ju=!!(Au&&lo),Bu=useRead(()=>listSessions(Lu,Au??""),`${Au}:${lo}:${$u}:${Pu}`,ju);return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-activity",children:[jsxRuntimeExports.jsx(Heading$2,{as:"h3",sx:{fontSize:2,mb:2},children:APP_ACTIVITY_WORDS.title}),Au?lo?Bu.loading&&!Bu.value?jsxRuntimeExports.jsx(StyledSpinner,{size:"small"}):Bu.error?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:Bu.error}):(Bu.value??[]).length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_ACTIVITY_WORDS.none}):(Bu.value??[]).map(Fu=>jsxRuntimeExports.jsx(Session,{context:Lu,session:Fu},Fu.uid)):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_ACTIVITY_WORDS.signedOut}):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_ACTIVITY_WORDS.unsaved})]})}const APP_ACTIVITY_PLUGIN_NAME="@datalayer/loop-plugin-app-activity";function defineAppActivityPlugin(Au,lo){function $u(){return jsxRuntimeExports.jsx(AppActivity,{appUid:lo})}return{name:`${APP_ACTIVITY_PLUGIN_NAME}-${Au.id}`,displayName:`${Au.name}: activity`,description:`What ${Au.name} did, session by session, from its record.`,octicon:"pulse",build:()=>({components:[{id:"app-activity",slot:LoopSlots.sidebar,order:20,Component:$u,rail:{label:"Activity",icon:PulseIcon}}]})}}const APP_PANEL_WIDTH=380;function elementsByPlace(Au){const lo=Au.filter($u=>$u.where==="page");return{panels:Au.filter($u=>$u.where==="panel"),page:lo.length>0?lo[lo.length-1]:null}}function ElementBody({element:Au,send:lo}){const $u=reactExports.useMemo(()=>readA2uiToolResult(Au.shows,SURFACE_CATALOG_ID),[Au.shows]),Ru=useOwnCatalog(),Iu=Ou=>{const Pu=answerAction(Ou);Pu&&lo?.(Pu.message,Pu.forwardedProps)};return!$u?.messages||$u.messages.length===0?jsxRuntimeExports.jsx(Text$5,{sx:{color:"fg.muted"},children:"Nothing to show."}):jsxRuntimeExports.jsx(InlineSurface,{messages:$u.messages,onAction:Iu,catalog:Ru},JSON.stringify(Au.shows))}function ElementHeader({element:Au}){return jsxRuntimeExports.jsxs(Box,{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:2,children:[jsxRuntimeExports.jsx(Text$5,{as:"h2",sx:{fontSize:2,fontWeight:"bold",m:0},children:Au.title}),jsxRuntimeExports.jsx(IconButton,{icon:XIcon,variant:"invisible",size:"small","aria-label":`Close ${Au.title}`,onClick:()=>closeLoopElement(Au.id)})]})}function AppElements({workspace:Au}){const lo=reactExports.useSyncExternalStore(onLoopElements,openLoopElements,openLoopElements),{panels:$u,page:Ru}=elementsByPlace(lo),Iu=Au?.viewControls.send;return $u.length===0&&Ru===null?null:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[$u.length>0?jsxRuntimeExports.jsx(Box,{as:"aside","aria-label":"Side panel",position:"absolute",top:0,right:0,bottom:0,width:`min(${APP_PANEL_WIDTH}px, 100%)`,zIndex:1,overflowY:"auto",borderLeft:"1px solid",borderColor:"border.default",bg:"canvas.subtle",boxShadow:"shadow.medium",p:3,display:"flex",flexDirection:"column",gap:3,children:$u.map(Ou=>jsxRuntimeExports.jsxs(Box,{as:"section","aria-label":Ou.title,children:[jsxRuntimeExports.jsx(ElementHeader,{element:Ou}),jsxRuntimeExports.jsx(ElementBody,{element:Ou,send:Iu})]},Ou.id))}):null,Ru!==null?jsxRuntimeExports.jsxs(Box,{role:"dialog","aria-label":Ru.title,position:"absolute",inset:0,zIndex:2,overflowY:"auto",bg:"canvas.default",p:[3,4],children:[jsxRuntimeExports.jsx(ElementHeader,{element:Ru}),jsxRuntimeExports.jsx(ElementBody,{element:Ru,send:Iu})]}):null]})}const APP_ELEMENTS_PLUGIN_NAME="@datalayer/loop-plugin-app-elements",AppElementsPlugin={name:APP_ELEMENTS_PLUGIN_NAME,displayName:"Side panel and pages",description:"What an application opens beside the conversation: a side panel, or a page of its own.",octicon:"sidebar-expand",build:()=>({components:[{id:"app-elements",slot:LoopSlots.root,Component:AppElements}]}),register:()=>clearLoopElements},appComponentsPluginName=Au=>`@datalayer/loop-plugin-app-components-${Au}`,hasCustomComponents=Au=>(Au.interface.customComponents??[]).length>0;function defineAppComponentsPlugin(Au,lo){const $u=Au.interface.customComponents??[];if($u.length===0)throw new Error(`“${Au.name}” has no component of its own to contribute.`);return{name:appComponentsPluginName(Au.id),displayName:`${Au.name}'s components`,description:`The components ${Au.name}'s developer wrote: ${$u.map(Ru=>Ru.name).join(", ")}.`,octicon:"apps",contributes:$u.flatMap(Ru=>[contribution(LoopCanvasBlock,{id:Ru.name,uiPlugin:`app:${Au.id}`,component:customComponentEntry(Ru,Au.version)},{id:Ru.name}),contribution(LoopA2uiComponent,{id:Ru.name,app:Au.id,implementation:customImplementation(Ru,Au.version,lo,Au.id)},{id:Ru.name})])}}const COMPUTER_PARTS=["browse","files","shell"],COMPUTER_PART_TOOLS={browse:["open_page","read_page","page_screenshot","click_on_page","type_on_page"],files:["list_computer_files","read_computer_file","write_computer_file"],shell:["execute_code","run_skill_script"]},COMPUTER_WORDS={title:"Computer",part:{browse:"Browse",files:"Files",shell:"Shell"},on:"on",off:"off",none:"It has no computer: browse, files and shell are all off. Turn one on in its permissions to give it one.",offSaid:Au=>`Off, so its agent is given no tool for it: ${Au.join(", ")}.`,browser:"Browser",noBrowser:"No browser is installed on its computer.",noPage:"Its browser has opened no page yet.",pageAlt:Au=>`The page its browser shows: ${Au}`,clickToAct:"Click on the page to click there; with the page selected, what you type goes to it.",typeOnPage:"Text to type on the page",type:"Type",address:"An address to open",open:"Open",scrollUp:"Scroll up",scrollDown:"Scroll down",agentHas:"Its agent has the computer.",youHave:"You have the computer: its agent waits for it until you hand it back.",someoneHas:"Somebody else has taken this computer over.",takeOver:"Take over",handBack:"Hand back",run:"Run",yourCode:"Python to run on its computer",terminal:"What ran on it",nothingRan:"Nothing has run on it yet in this conversation.",files:"Files",notStarted:"Its computer starts when its agent first uses it: no file yet.",emptyDirectory:"Empty.",up:"Up",download:"Download",signedOut:"Its computer is shown once you are signed in to Datalayer."};function computerParts(Au){const lo=Au.permissions?.computer;return{browse:!!lo?.browse,files:!!lo?.files,shell:!!lo?.shell}}const hasComputer=Au=>COMPUTER_PARTS.some(lo=>Au[lo]),partsOff=Au=>COMPUTER_PARTS.filter(lo=>!Au[lo]).map(lo=>COMPUTER_WORDS.part[lo].toLowerCase());function partOf(Au){return COMPUTER_PARTS.find(lo=>COMPUTER_PART_TOOLS[lo].includes(Au))}const OUTPUT_LIMIT=4e3;function outputOf(Au){let lo=Au;if(typeof lo=="string")try{const Ru=JSON.parse(lo);Ru&&typeof Ru=="object"&&!Array.isArray(Ru)&&(lo=Ru)}catch{}let $u;if(lo&&typeof lo=="object"&&!Array.isArray(lo)){const Ru=lo,Iu=[typeof Ru.stdout=="string"?Ru.stdout:Ru.output,Ru.stderr,Ru.error??Ru.execution_error??Ru.code_error].filter(Ou=>typeof Ou=="string"&&Ou.trim()!=="");$u=Iu.length>0?Iu.join(`
4106
4106
  `):"stdout"in Ru||"output"in Ru?"":JSON.stringify(lo,null,2)}else $u=typeof lo=="string"?lo:lo==null?"":JSON.stringify(lo,null,2);return $u.length>OUTPUT_LIMIT?`${$u.slice(0,OUTPUT_LIMIT)}
4107
- … (${($u.length-OUTPUT_LIMIT).toLocaleString("en")} characters more)`:$u}function commandOf(Au){for(const lo of["code","path","script_name"]){const $u=Au[lo];if(typeof $u=="string"&&$u.trim())return $u}return Object.keys(Au).length?JSON.stringify(Au):""}function terminalEntries(Au){const lo=[];for(const $u of Au){if($u.role!=="tool")continue;const Ru=partOf($u.name);Ru&&lo.push({tool:$u.name,part:Ru,command:commandOf($u.args??{}),output:$u.result===void 0?void 0:outputOf($u.result)})}return lo}const computerUrl=(Au,lo="")=>`${Au.serverUrl.replace(/\/+$/,"")}/api/v1/apps/agents/${encodeURIComponent(Au.agentId)}/computer${lo}`;function computerFileUrl(Au,lo){const $u=computerUrl(Au,`/file?path=${encodeURIComponent(lo)}`),Ru=(Au.userAppsUrl||"").trim();if(!Ru)return $u;try{const Iu=new URL($u),Ou=new URL(Ru);return Iu.protocol=Ou.protocol,Iu.host=Ou.host,Iu.toString()}catch{return $u}}async function asked(Au,lo,$u={}){const Ru=await fetch(computerUrl(Au,lo),{...$u,headers:{...$u.body?{"Content-Type":"application/json"}:{},...Au.token?{Authorization:`Bearer ${Au.token}`}:{}}});if(!Ru.ok){let Iu=`${Ru.status}`;try{const Ou=await Ru.json();Iu=typeof Ou.detail=="string"?Ou.detail:Iu}catch{}throw new Error(Iu)}return Ru}const readComputer=async Au=>(await asked(Au,"")).json(),listComputerFiles=async(Au,lo=".")=>(await(await asked(Au,`/files?path=${encodeURIComponent(lo)}`)).json()).entries,downloadComputerFile=async(Au,lo)=>{const $u=await fetch(computerFileUrl(Au,lo),{headers:Au.token?{Authorization:`Bearer ${Au.token}`}:{}});if(!$u.ok){let Ru=`${$u.status}`;try{const Iu=await $u.json();Ru=typeof Iu.detail=="string"?Iu.detail:Ru}catch{}throw new Error(Ru)}return $u.blob()},takeOverComputer=async Au=>(await asked(Au,"/take-over",{method:"POST"})).json(),handBackComputer=async Au=>{await asked(Au,"/hand-back",{method:"POST"})},runOnComputer=async(Au,lo)=>(await asked(Au,"/run",{method:"POST",body:JSON.stringify({code:lo})})).json();function parentOf(Au){const lo=Au.split("/").filter($u=>$u&&$u!==".");return lo.pop(),lo.length?lo.join("/"):"."}const NO_TURN$2=signal$2({id:0,status:"idle"}),NO_CONVERSATION$1=signal$2([]),MONO_FACE='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',MONO={fontFamily:MONO_FACE,fontSize:0,whiteSpace:"pre-wrap",wordBreak:"break-word",m:0};function Parts({app:Au}){const lo=computerParts(Au),$u=partsOff(lo);return jsxRuntimeExports.jsxs(Box,{"data-testid":"computer-parts",children:[jsxRuntimeExports.jsx(Box,{display:"flex",gap:1,flexWrap:"wrap",mb:1,children:COMPUTER_PARTS.map(Ru=>jsxRuntimeExports.jsxs(Label,{variant:lo[Ru]?"success":"secondary","data-part":Ru,"data-on":lo[Ru]?"true":"false",children:[COMPUTER_WORDS.part[Ru],":"," ",lo[Ru]?COMPUTER_WORDS.on:COMPUTER_WORDS.off]},Ru))}),$u.length>0&&$u.length<COMPUTER_PARTS.length?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:0,color:"fg.muted",m:0},children:COMPUTER_WORDS.offSaid($u)}):null]})}function Terminal({conversation:Au}){const lo=terminalEntries(Au);return jsxRuntimeExports.jsxs(Box,{"data-testid":"computer-terminal",children:[jsxRuntimeExports.jsx(Heading$2,{as:"h4",sx:{fontSize:1,mt:3,mb:1},children:COMPUTER_WORDS.terminal}),lo.length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:COMPUTER_WORDS.nothingRan}):jsxRuntimeExports.jsx(Box,{bg:"canvas.inset",border:"1px solid",borderColor:"border.muted",borderRadius:2,p:2,maxHeight:320,overflow:"auto",children:lo.map(($u,Ru)=>jsxRuntimeExports.jsxs(Box,{mb:2,children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{...MONO,fontWeight:"semibold"},children:`$ ${$u.tool}${$u.command?`: ${$u.command}`:""}`}),$u.output===void 0?jsxRuntimeExports.jsx(StyledSpinner,{size:"small"}):jsxRuntimeExports.jsx(Text$5,{as:"pre",sx:{...MONO,color:"fg.muted"},children:$u.output})]},Ru))})]})}function save(Au,lo){const $u=URL.createObjectURL(new Blob([Au],{type:"application/octet-stream"})),Ru=document.createElement("a");Ru.href=$u,Ru.download=lo,Ru.click(),URL.revokeObjectURL($u)}function Files({context:Au,state:lo,ended:$u}){const[Ru,Iu]=reactExports.useState("."),[Ou,Pu]=reactExports.useState(),[Du,Lu]=reactExports.useState("");return reactExports.useEffect(()=>{if(!lo.started)return;let ju=!1;return listComputerFiles(Au,Ru).then(Bu=>{ju||(Pu(Bu),Lu(""))},Bu=>!ju&&Lu(Bu instanceof Error?Bu.message:String(Bu))),()=>{ju=!0}},[Au.serverUrl,Au.agentId,Au.token,Ru,lo.started,$u]),jsxRuntimeExports.jsxs(Box,{"data-testid":"computer-files",children:[jsxRuntimeExports.jsxs(Heading$2,{as:"h4",sx:{fontSize:1,mt:3,mb:1},children:[COMPUTER_WORDS.files,Ru!=="."?jsxRuntimeExports.jsx(Text$5,{sx:{fontWeight:"normal",color:"fg.muted"},children:` · ${Ru}`}):null]}),lo.started?Du?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"danger.fg",m:0},children:Du}):Ou?jsxRuntimeExports.jsxs(Box,{as:"ul",listStyle:"none",p:0,m:0,children:[Ru!=="."?jsxRuntimeExports.jsx(Box,{as:"li",children:jsxRuntimeExports.jsx(ButtonComponent,{size:"small",variant:"invisible",onClick:()=>Iu(parentOf(Ru)),children:COMPUTER_WORDS.up})}):null,Ou.length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:COMPUTER_WORDS.emptyDirectory}):null,Ou.map(ju=>jsxRuntimeExports.jsx(Box,{as:"li","data-path":ju.path,display:"flex",alignItems:"center",gap:2,fontSize:1,py:1,borderTop:"1px solid",borderColor:"border.muted",children:ju.type==="directory"?jsxRuntimeExports.jsx(ButtonComponent,{size:"small",variant:"invisible",onClick:()=>Iu(ju.path),children:`${ju.name}/`}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text$5,{sx:{flex:1,fontFamily:MONO_FACE,fontSize:0},children:ju.name}),jsxRuntimeExports.jsx(Text$5,{sx:{color:"fg.muted",fontSize:0},children:`${ju.size.toLocaleString("en")} bytes`}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small","aria-label":`${COMPUTER_WORDS.download} ${ju.name}`,onClick:()=>{downloadComputerFile(Au,ju.path).then(Bu=>save(Bu,ju.name),Bu=>Lu(Bu instanceof Error?Bu.message:String(Bu)))},children:COMPUTER_WORDS.download})]})},ju.path))]}):jsxRuntimeExports.jsx(StyledSpinner,{size:"small"}):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:COMPUTER_WORDS.notStarted})]})}function YourTerminal({context:Au}){const[lo,$u]=reactExports.useState(""),[Ru,Iu]=reactExports.useState(!1),[Ou,Pu]=reactExports.useState([]),Du=()=>{Iu(!0),runOnComputer(Au,lo).then(Lu=>{Pu(ju=>[...ju,{code:lo,output:Lu}]),$u(""),Iu(!1)},Lu=>{Pu(ju=>[...ju,{code:lo,output:{stdout:"",stderr:"",error:Lu instanceof Error?Lu.message:String(Lu)}}]),Iu(!1)})};return jsxRuntimeExports.jsxs(Box,{"data-testid":"computer-your-terminal",mt:2,children:[Ou.map((Lu,ju)=>jsxRuntimeExports.jsxs(Box,{mb:2,children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{...MONO,fontWeight:"semibold"},children:`>>> ${Lu.code}`}),jsxRuntimeExports.jsx(Text$5,{as:"pre",sx:{...MONO,color:"fg.muted"},children:[Lu.output.stdout,Lu.output.stderr,Lu.output.error].filter(Boolean).join(`
4108
- `)})]},ju)),jsxRuntimeExports.jsx(Textarea,{"aria-label":COMPUTER_WORDS.yourCode,placeholder:COMPUTER_WORDS.yourCode,value:lo,onChange:Lu=>$u(Lu.target.value),sx:{width:"100%",fontFamily:MONO_FACE},rows:3}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small",sx:{mt:1},disabled:Ru||!lo.trim(),onClick:Du,children:COMPUTER_WORDS.run})]})}function AppComputer({app:Au,workspace:lo}){const $u=useIAMStore(ad=>ad.token)??"",Ru=useContributions(LoopChatTurn),Iu=useSignalValue$1(Ru[0]?.value.turn??NO_TURN$2),Ou=useSignalValue$1(Ru[0]?.value.conversation??NO_CONVERSATION$1),Pu=Iu.status!=="thinking"&&Iu.status!=="streaming",[Du,Lu]=reactExports.useState(0);reactExports.useEffect(()=>{Pu&&Lu(Iu.id)},[Pu,Iu.id]);const ju=useChatWords(),Bu=lo?agentServerOf(lo.sandbox,lo.serverUrl):void 0,Fu=Bu===void 0?noRuntimeSaid(lo?.sandbox??IDLE_SANDBOX_SNAPSHOT,ju):void 0,zu=lo?.agentId||Au.id,[qu,Uu]=reactExports.useState(),Hu=qu?.servedFrom??"",Vu=reactExports.useMemo(()=>Bu===void 0?void 0:{serverUrl:Bu,agentId:zu,token:$u||void 0,userAppsUrl:Hu||void 0},[Bu,zu,$u,Hu]),Gu=computerParts(Au),[Ku,Zu]=reactExports.useState(""),[Qu,Yu]=reactExports.useState(!1),ed=reactExports.useRef(!0);reactExports.useEffect(()=>(ed.current=!0,()=>{ed.current=!1}),[]);const Xu=reactExports.useCallback(()=>{Vu&&readComputer(Vu).then(ad=>{ed.current&&(Uu(ad),Zu(""))},ad=>ed.current&&Zu(ad instanceof Error?ad.message:String(ad)))},[Vu]),rd=hasComputer(Gu);reactExports.useEffect(()=>{rd&&Vu&&Xu()},[rd,Vu,Xu,Du]);const nd=ad=>{Vu&&(Yu(!0),ad(Vu).then(()=>{ed.current&&(Yu(!1),Xu())},ld=>{ed.current&&(Yu(!1),Zu(ld instanceof Error?ld.message:String(ld)))}))},od=!!qu?.yours;return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-computer",children:[jsxRuntimeExports.jsx(Heading$2,{as:"h3",sx:{fontSize:2,mb:2},children:COMPUTER_WORDS.title}),jsxRuntimeExports.jsx(Parts,{app:Au}),rd?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:0,color:"fg.muted",m:0,mt:1},children:COMPUTER_WORDS.noBrowser}),Fu?jsxRuntimeExports.jsx(Text$5,{as:"p",role:"status",sx:{fontSize:1,color:"fg.default",m:0,mt:2},children:Fu}):null,Ku?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"danger.fg",m:0,mt:2},children:Ku}):null,qu&&Vu?jsxRuntimeExports.jsxs(Box,{mt:2,"data-testid":"computer-holder",children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,m:0,mb:1},children:qu.held?od?COMPUTER_WORDS.youHave:COMPUTER_WORDS.someoneHas:COMPUTER_WORDS.agentHas}),qu.held?od?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ButtonComponent,{size:"small",variant:"primary",disabled:Qu,onClick:()=>nd(handBackComputer),children:COMPUTER_WORDS.handBack}),jsxRuntimeExports.jsx(YourTerminal,{context:Vu})]}):null:jsxRuntimeExports.jsx(ButtonComponent,{size:"small",disabled:Qu,onClick:()=>nd(takeOverComputer),children:COMPUTER_WORDS.takeOver})]}):null,jsxRuntimeExports.jsx(Terminal,{conversation:Ou}),qu&&Vu?jsxRuntimeExports.jsx(Files,{context:Vu,state:qu,ended:Du}):null]}):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0,mt:1},children:COMPUTER_WORDS.none})]})}const APP_COMPUTER_PLUGIN_NAME="@datalayer/loop-plugin-app-computer";function defineAppComputerPlugin(Au){function lo({workspace:Ru}){return jsxRuntimeExports.jsx(AppComputer,{app:Au,workspace:Ru})}return{name:`${APP_COMPUTER_PLUGIN_NAME}-${Au.id}`,displayName:`${Au.name}: computer`,description:`The computer ${Au.name} runs on: what ran on it, its files, and taking it over.`,octicon:"device-desktop",build:()=>({components:[{id:"app-computer",slot:LoopSlots.sidebar,order:30,Component:lo,rail:{label:"Computer",icon:DeviceDesktopIcon}}]})}}const SAVE_TOOL="save_to_space",SAVE_WORDS={approve:"Approve and save",decline:"Decline",where:Au=>Au?`To keep as a page of ${Au}:`:"To keep as a page of its Space:"};function draftOfApproval(Au){if(Au.tool_name!==SAVE_TOOL)return null;const lo=$u=>{const Ru=Au.tool_args?.[$u];return typeof Ru=="string"?Ru:""};return{title:lo("title"),content:lo("content"),space:lo("space")}}const APP_RULES_WORDS={title:"Rules and approvals",byDefault:"With no rule of its own: reading is done, anything else waits for you.",none:"It has no rule of its own.",waiting:"Waiting for you",nothingWaiting:"Nothing is waiting for your yes.",signedOut:"Its approvals reach you here once you are signed in to Datalayer.",offline:"Approvals are not connected yet: what you approve or reject is not sent until they are.",approve:"Approve",reject:"Reject"};function ruleInWords(Au){const lo=BEHAVIOUR_WORDS[Au.behaviour];return{action:Au.action,covers:Au.appliesTo.map(coverOf).join(", "),says:lo.says,means:lo.means}}const ruleOfApproval=Au=>{const lo=Au.tool_args?._rule??Au.tool_args?._check;return typeof lo=="string"?lo:""};function approvalsOfApp(Au,lo){return Au.filter($u=>$u.agent_id===lo||$u.tool_args?._app===lo)}const PENDING={status:"pending"};function DraftShown({draft:Au}){return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-draft",mt:1,children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{m:0,fontSize:0,color:"fg.muted"},children:SAVE_WORDS.where(Au.space)}),jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{m:0,fontWeight:"semibold"},children:Au.title}),jsxRuntimeExports.jsx(Box,{as:"pre",m:0,mt:1,p:2,maxHeight:240,overflow:"auto",whiteSpace:"pre-wrap",fontFamily:"inherit",fontSize:0,bg:"canvas.subtle",borderRadius:2,children:Au.content})]})}function Approvals({app:Au}){const lo=useToolApprovalsQuery(PENDING),$u=useApproveToolRequest(),Ru=useRejectToolRequest(),Iu=reactExports.useMemo(()=>approvalsOfApp(lo.data?.approvals??[],Au.id),[lo.data,Au.id]);return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-approvals",children:[jsxRuntimeExports.jsx(Heading$2,{as:"h4",sx:{fontSize:1,mt:3,mb:1},children:APP_RULES_WORDS.waiting}),$u.connectionState!=="connected"?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:0,color:"fg.muted",m:0,mb:1},children:APP_RULES_WORDS.offline}):null,Iu.length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_RULES_WORDS.nothingWaiting}):jsxRuntimeExports.jsx(Box,{as:"ul",listStyle:"none",p:0,m:0,children:Iu.map(Ou=>{const Pu=draftOfApproval(Ou);return jsxRuntimeExports.jsxs(Box,{as:"li",py:2,borderTop:"1px solid",borderColor:"border.muted",fontSize:1,children:[jsxRuntimeExports.jsx(Text$5,{sx:{fontWeight:"semibold"},children:Ou.tool_name}),ruleOfApproval(Ou)?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{m:0,color:"fg.muted",fontSize:0},children:ruleOfApproval(Ou)}):null,Pu?jsxRuntimeExports.jsx(DraftShown,{draft:Pu}):null,jsxRuntimeExports.jsxs(Box,{display:"flex",gap:2,mt:1,children:[jsxRuntimeExports.jsx(ButtonComponent,{size:"small",variant:"primary",disabled:$u.isPending,onClick:()=>$u.mutate({id:Ou.id}),children:Pu?SAVE_WORDS.approve:APP_RULES_WORDS.approve}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small",disabled:Ru.isPending,onClick:()=>Ru.mutate({id:Ou.id}),children:Pu?SAVE_WORDS.decline:APP_RULES_WORDS.reject})]})]},Ou.id)})})]})}function AppRulesCard({app:Au}){const lo=!!useIAMStore($u=>$u.token);return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-rules",mb:4,children:[jsxRuntimeExports.jsx(Heading$2,{as:"h3",sx:{fontSize:2,mb:2},children:APP_RULES_WORDS.title}),Au.rules.length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_RULES_WORDS.none}):jsxRuntimeExports.jsx(Box,{as:"ul",listStyle:"none",p:0,m:0,children:Au.rules.map(ruleInWords).map(($u,Ru)=>jsxRuntimeExports.jsxs(Box,{as:"li",py:1,fontSize:1,children:[jsxRuntimeExports.jsx(Text$5,{children:$u.action})," ",jsxRuntimeExports.jsx(Label,{title:$u.means,children:$u.says}),jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{m:0,color:"fg.muted",fontSize:0},children:$u.covers})]},Ru))}),jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:0,color:"fg.muted",mt:1,mb:0},children:APP_RULES_WORDS.byDefault}),lo?jsxRuntimeExports.jsx(Approvals,{app:Au}):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",mt:3,mb:0},children:APP_RULES_WORDS.signedOut})]})}const APP_RULES_PLUGIN_NAME="@datalayer/loop-plugin-app-rules";function defineAppRulesPlugin(Au){function lo(){return jsxRuntimeExports.jsx(AppRulesCard,{app:Au})}return{name:`${APP_RULES_PLUGIN_NAME}-${Au.id}`,displayName:`${Au.name}: rules and approvals`,description:`When ${Au.name} acts alone, when it asks, and what waits for your yes.`,octicon:"shield-check",build:()=>({components:[{id:"app-rules",slot:LoopSlots.sidebar,order:10,Component:lo,rail:{label:"Rules",icon:ShieldCheckIcon}}]})}}const COMMAND_INPUT="{input}";function commandPrompt(Au,lo=""){const $u=lo.trim();return Au.prompt.includes(COMMAND_INPUT)?Au.prompt.split(COMMAND_INPUT).join($u).trim():$u?`${Au.prompt}
4107
+ … (${($u.length-OUTPUT_LIMIT).toLocaleString("en")} characters more)`:$u}function commandOf(Au){for(const lo of["code","path","script_name","url","selector"]){const $u=Au[lo];if(typeof $u=="string"&&$u.trim())return $u}return Object.keys(Au).length?JSON.stringify(Au):""}function terminalEntries(Au){const lo=[];for(const $u of Au){if($u.role!=="tool")continue;const Ru=partOf($u.name);Ru&&lo.push({tool:$u.name,part:Ru,command:commandOf($u.args??{}),output:$u.result===void 0?void 0:outputOf($u.result)})}return lo}const computerUrl=(Au,lo="")=>`${Au.serverUrl.replace(/\/+$/,"")}/api/v1/apps/agents/${encodeURIComponent(Au.agentId)}/computer${lo}`;function computerFileUrl(Au,lo){const $u=computerUrl(Au,`/file?path=${encodeURIComponent(lo)}`),Ru=(Au.userAppsUrl||"").trim();if(!Ru)return $u;try{const Iu=new URL($u),Ou=new URL(Ru);return Iu.protocol=Ou.protocol,Iu.host=Ou.host,Iu.toString()}catch{return $u}}async function asked(Au,lo,$u={}){const Ru=await fetch(computerUrl(Au,lo),{...$u,headers:{...$u.body?{"Content-Type":"application/json"}:{},...Au.token?{Authorization:`Bearer ${Au.token}`}:{}}});if(!Ru.ok){let Iu=`${Ru.status}`;try{const Ou=await Ru.json();Iu=typeof Ou.detail=="string"?Ou.detail:Iu}catch{}throw new Error(Iu)}return Ru}const readComputer=async Au=>(await asked(Au,"")).json(),listComputerFiles=async(Au,lo=".")=>(await(await asked(Au,`/files?path=${encodeURIComponent(lo)}`)).json()).entries,downloadComputerFile=async(Au,lo)=>{const $u=await fetch(computerFileUrl(Au,lo),{headers:Au.token?{Authorization:`Bearer ${Au.token}`}:{}});if(!$u.ok){let Ru=`${$u.status}`;try{const Iu=await $u.json();Ru=typeof Iu.detail=="string"?Iu.detail:Ru}catch{}throw new Error(Ru)}return $u.blob()},takeOverComputer=async Au=>(await asked(Au,"/take-over",{method:"POST"})).json(),handBackComputer=async Au=>{await asked(Au,"/hand-back",{method:"POST"})},runOnComputer=async(Au,lo)=>(await asked(Au,"/run",{method:"POST",body:JSON.stringify({code:lo})})).json(),BROWSER_KEYS=["Enter","Tab","Backspace","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown"],readBrowserScreenshot=async Au=>{const lo=await fetch(computerUrl(Au,"/browser/screenshot"),{headers:Au.token?{Authorization:`Bearer ${Au.token}`}:{},cache:"no-store"});if(lo.status!==404){if(!lo.ok){let $u=`${lo.status}`;try{const Ru=await lo.json();$u=typeof Ru.detail=="string"?Ru.detail:$u}catch{}throw new Error($u)}return lo.blob()}},onBrowser=async(Au,lo,$u)=>(await(await asked(Au,`/browser/${lo}`,{method:"POST",body:JSON.stringify($u)})).json()).page,clickOnBrowser=(Au,lo,$u)=>onBrowser(Au,"click",{x:lo,y:$u}),typeOnBrowser=(Au,lo)=>onBrowser(Au,"type",{text:lo}),pressOnBrowser=(Au,lo)=>onBrowser(Au,"key",{key:lo}),scrollBrowser=(Au,lo)=>onBrowser(Au,"scroll",{dy:lo}),openOnBrowser=(Au,lo)=>onBrowser(Au,"open",{url:lo});function pointOnPage(Au,lo,$u){const Ru=(Iu,Ou,Pu)=>Ou>0?Math.round(Iu*Pu/Ou):Iu;return{x:Math.max(0,Math.min($u.width,Ru(Au.x,lo.width,$u.width))),y:Math.max(0,Math.min($u.height,Ru(Au.y,lo.height,$u.height)))}}function parentOf(Au){const lo=Au.split("/").filter($u=>$u&&$u!==".");return lo.pop(),lo.length?lo.join("/"):"."}const NO_TURN$2=signal$2({id:0,status:"idle"}),NO_CONVERSATION$1=signal$2([]),MONO_FACE='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',MONO={fontFamily:MONO_FACE,fontSize:0,whiteSpace:"pre-wrap",wordBreak:"break-word",m:0};function Parts({app:Au}){const lo=computerParts(Au),$u=partsOff(lo);return jsxRuntimeExports.jsxs(Box,{"data-testid":"computer-parts",children:[jsxRuntimeExports.jsx(Box,{display:"flex",gap:1,flexWrap:"wrap",mb:1,children:COMPUTER_PARTS.map(Ru=>jsxRuntimeExports.jsxs(Label,{variant:lo[Ru]?"success":"secondary","data-part":Ru,"data-on":lo[Ru]?"true":"false",children:[COMPUTER_WORDS.part[Ru],":"," ",lo[Ru]?COMPUTER_WORDS.on:COMPUTER_WORDS.off]},Ru))}),$u.length>0&&$u.length<COMPUTER_PARTS.length?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:0,color:"fg.muted",m:0},children:COMPUTER_WORDS.offSaid($u)}):null]})}function Terminal({conversation:Au}){const lo=terminalEntries(Au);return jsxRuntimeExports.jsxs(Box,{"data-testid":"computer-terminal",children:[jsxRuntimeExports.jsx(Heading$2,{as:"h4",sx:{fontSize:1,mt:3,mb:1},children:COMPUTER_WORDS.terminal}),lo.length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:COMPUTER_WORDS.nothingRan}):jsxRuntimeExports.jsx(Box,{bg:"canvas.inset",border:"1px solid",borderColor:"border.muted",borderRadius:2,p:2,maxHeight:320,overflow:"auto",children:lo.map(($u,Ru)=>jsxRuntimeExports.jsxs(Box,{mb:2,children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{...MONO,fontWeight:"semibold"},children:`$ ${$u.tool}${$u.command?`: ${$u.command}`:""}`}),$u.output===void 0?jsxRuntimeExports.jsx(StyledSpinner,{size:"small"}):jsxRuntimeExports.jsx(Text$5,{as:"pre",sx:{...MONO,color:"fg.muted"},children:$u.output})]},Ru))})]})}function save(Au,lo){const $u=URL.createObjectURL(new Blob([Au],{type:"application/octet-stream"})),Ru=document.createElement("a");Ru.href=$u,Ru.download=lo,Ru.click(),URL.revokeObjectURL($u)}function Files({context:Au,state:lo,ended:$u}){const[Ru,Iu]=reactExports.useState("."),[Ou,Pu]=reactExports.useState(),[Du,Lu]=reactExports.useState("");return reactExports.useEffect(()=>{if(!lo.started)return;let ju=!1;return listComputerFiles(Au,Ru).then(Bu=>{ju||(Pu(Bu),Lu(""))},Bu=>!ju&&Lu(Bu instanceof Error?Bu.message:String(Bu))),()=>{ju=!0}},[Au.serverUrl,Au.agentId,Au.token,Ru,lo.started,$u]),jsxRuntimeExports.jsxs(Box,{"data-testid":"computer-files",children:[jsxRuntimeExports.jsxs(Heading$2,{as:"h4",sx:{fontSize:1,mt:3,mb:1},children:[COMPUTER_WORDS.files,Ru!=="."?jsxRuntimeExports.jsx(Text$5,{sx:{fontWeight:"normal",color:"fg.muted"},children:` · ${Ru}`}):null]}),lo.started?Du?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"danger.fg",m:0},children:Du}):Ou?jsxRuntimeExports.jsxs(Box,{as:"ul",listStyle:"none",p:0,m:0,children:[Ru!=="."?jsxRuntimeExports.jsx(Box,{as:"li",children:jsxRuntimeExports.jsx(ButtonComponent,{size:"small",variant:"invisible",onClick:()=>Iu(parentOf(Ru)),children:COMPUTER_WORDS.up})}):null,Ou.length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:COMPUTER_WORDS.emptyDirectory}):null,Ou.map(ju=>jsxRuntimeExports.jsx(Box,{as:"li","data-path":ju.path,display:"flex",alignItems:"center",gap:2,fontSize:1,py:1,borderTop:"1px solid",borderColor:"border.muted",children:ju.type==="directory"?jsxRuntimeExports.jsx(ButtonComponent,{size:"small",variant:"invisible",onClick:()=>Iu(ju.path),children:`${ju.name}/`}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text$5,{sx:{flex:1,fontFamily:MONO_FACE,fontSize:0},children:ju.name}),jsxRuntimeExports.jsx(Text$5,{sx:{color:"fg.muted",fontSize:0},children:`${ju.size.toLocaleString("en")} bytes`}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small","aria-label":`${COMPUTER_WORDS.download} ${ju.name}`,onClick:()=>{downloadComputerFile(Au,ju.path).then(Bu=>save(Bu,ju.name),Bu=>Lu(Bu instanceof Error?Bu.message:String(Bu)))},children:COMPUTER_WORDS.download})]})},ju.path))]}):jsxRuntimeExports.jsx(StyledSpinner,{size:"small"}):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:COMPUTER_WORDS.notStarted})]})}const BROWSER_POLL_MS=1500;function BrowserView({context:Au,state:lo,mine:$u}){const[Ru,Iu]=reactExports.useState(),[Ou,Pu]=reactExports.useState(!1),[Du,Lu]=reactExports.useState(lo.page),[ju,Bu]=reactExports.useState(""),[Fu,zu]=reactExports.useState(""),[qu,Uu]=reactExports.useState(""),[Hu,Vu]=reactExports.useState(0),Gu=reactExports.useRef(void 0);reactExports.useEffect(()=>Lu(lo.page),[lo.page]),reactExports.useEffect(()=>{if(!lo.browser)return;let Yu=!1;const ed=()=>readBrowserScreenshot(Au).then(rd=>{Yu||(Bu(""),Pu(!rd),Gu.current&&URL.revokeObjectURL(Gu.current),Gu.current=rd?URL.createObjectURL(rd):void 0,Iu(Gu.current))},rd=>!Yu&&Bu(rd instanceof Error?rd.message:String(rd)));ed();const Xu=setInterval(ed,BROWSER_POLL_MS);return()=>{Yu=!0,clearInterval(Xu)}},[Au.serverUrl,Au.agentId,Au.token,lo.browser,Hu]),reactExports.useEffect(()=>()=>{Gu.current&&URL.revokeObjectURL(Gu.current)},[]);const Ku=Yu=>Yu.then(ed=>{Lu(ed),Bu(""),Vu(Xu=>Xu+1)},ed=>Bu(ed instanceof Error?ed.message:String(ed))),Zu=Yu=>{const ed=Yu.currentTarget,Xu=ed.getBoundingClientRect(),rd=pointOnPage({x:Yu.clientX-Xu.left,y:Yu.clientY-Xu.top},{width:Xu.width,height:Xu.height},{width:ed.naturalWidth,height:ed.naturalHeight});ed.focus(),Ku(clickOnBrowser(Au,rd.x,rd.y))},Qu=Yu=>{Yu.metaKey||Yu.ctrlKey||Yu.altKey||(BROWSER_KEYS.includes(Yu.key)?(Yu.preventDefault(),Ku(pressOnBrowser(Au,Yu.key))):Yu.key.length===1&&(Yu.preventDefault(),Ku(typeOnBrowser(Au,Yu.key))))};return jsxRuntimeExports.jsxs(Box,{"data-testid":"computer-browser",children:[jsxRuntimeExports.jsxs(Heading$2,{as:"h4",sx:{fontSize:1,mt:3,mb:1},children:[COMPUTER_WORDS.browser,Du?jsxRuntimeExports.jsx(Text$5,{sx:{fontWeight:"normal",color:"fg.muted"},children:` · ${Du.title||Du.url}`}):null]}),lo.browser?Ou||!Ru?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:Ou?COMPUTER_WORDS.noPage:null}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Du?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontFamily:MONO_FACE,fontSize:0,color:"fg.muted",m:0,mb:1,wordBreak:"break-all"},children:Du.url}):null,jsxRuntimeExports.jsx("img",{src:Ru,alt:COMPUTER_WORDS.pageAlt(Du?.title||Du?.url||""),"data-testid":"computer-browser-page",tabIndex:$u?0:-1,onClick:$u?Zu:void 0,onKeyDown:$u?Qu:void 0,style:{width:"100%",height:"auto",display:"block",border:"1px solid var(--borderColor-muted, #d0d7de)",borderRadius:6,cursor:$u?"pointer":"default"}})]}):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:COMPUTER_WORDS.noBrowser}),ju?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"danger.fg",m:0,mt:1},children:ju}):null,$u&&lo.browser?jsxRuntimeExports.jsxs(Box,{mt:2,"data-testid":"computer-browser-controls",children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:0,color:"fg.muted",m:0,mb:1},children:COMPUTER_WORDS.clickToAct}),jsxRuntimeExports.jsxs(Box,{display:"flex",gap:1,mb:1,children:[jsxRuntimeExports.jsx(TextInput$1,{size:"small","aria-label":COMPUTER_WORDS.typeOnPage,placeholder:COMPUTER_WORDS.typeOnPage,value:Fu,onChange:Yu=>zu(Yu.target.value),sx:{flex:1}}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small",disabled:!Fu,onClick:()=>{Ku(typeOnBrowser(Au,Fu)),zu("")},children:COMPUTER_WORDS.type}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small",onClick:()=>{Ku(pressOnBrowser(Au,"Enter"))},children:"Enter"})]}),jsxRuntimeExports.jsxs(Box,{display:"flex",gap:1,mb:1,children:[jsxRuntimeExports.jsx(TextInput$1,{size:"small","aria-label":COMPUTER_WORDS.address,placeholder:COMPUTER_WORDS.address,value:qu,onChange:Yu=>Uu(Yu.target.value),sx:{flex:1}}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small",disabled:!qu.trim(),onClick:()=>{Ku(openOnBrowser(Au,qu.trim()))},children:COMPUTER_WORDS.open})]}),jsxRuntimeExports.jsxs(Box,{display:"flex",gap:1,children:[jsxRuntimeExports.jsx(ButtonComponent,{size:"small",onClick:()=>{Ku(scrollBrowser(Au,-400))},children:COMPUTER_WORDS.scrollUp}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small",onClick:()=>{Ku(scrollBrowser(Au,400))},children:COMPUTER_WORDS.scrollDown})]})]}):null]})}function YourTerminal({context:Au}){const[lo,$u]=reactExports.useState(""),[Ru,Iu]=reactExports.useState(!1),[Ou,Pu]=reactExports.useState([]),Du=()=>{Iu(!0),runOnComputer(Au,lo).then(Lu=>{Pu(ju=>[...ju,{code:lo,output:Lu}]),$u(""),Iu(!1)},Lu=>{Pu(ju=>[...ju,{code:lo,output:{stdout:"",stderr:"",error:Lu instanceof Error?Lu.message:String(Lu)}}]),Iu(!1)})};return jsxRuntimeExports.jsxs(Box,{"data-testid":"computer-your-terminal",mt:2,children:[Ou.map((Lu,ju)=>jsxRuntimeExports.jsxs(Box,{mb:2,children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{...MONO,fontWeight:"semibold"},children:`>>> ${Lu.code}`}),jsxRuntimeExports.jsx(Text$5,{as:"pre",sx:{...MONO,color:"fg.muted"},children:[Lu.output.stdout,Lu.output.stderr,Lu.output.error].filter(Boolean).join(`
4108
+ `)})]},ju)),jsxRuntimeExports.jsx(Textarea,{"aria-label":COMPUTER_WORDS.yourCode,placeholder:COMPUTER_WORDS.yourCode,value:lo,onChange:Lu=>$u(Lu.target.value),sx:{width:"100%",fontFamily:MONO_FACE},rows:3}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small",sx:{mt:1},disabled:Ru||!lo.trim(),onClick:Du,children:COMPUTER_WORDS.run})]})}function AppComputer({app:Au,workspace:lo}){const $u=useIAMStore(ad=>ad.token)??"",Ru=useContributions(LoopChatTurn),Iu=useSignalValue$1(Ru[0]?.value.turn??NO_TURN$2),Ou=useSignalValue$1(Ru[0]?.value.conversation??NO_CONVERSATION$1),Pu=Iu.status!=="thinking"&&Iu.status!=="streaming",[Du,Lu]=reactExports.useState(0);reactExports.useEffect(()=>{Pu&&Lu(Iu.id)},[Pu,Iu.id]);const ju=useChatWords(),Bu=lo?agentServerOf(lo.sandbox,lo.serverUrl):void 0,Fu=Bu===void 0?noRuntimeSaid(lo?.sandbox??IDLE_SANDBOX_SNAPSHOT,ju):void 0,zu=lo?.agentId||Au.id,[qu,Uu]=reactExports.useState(),Hu=qu?.servedFrom??"",Vu=reactExports.useMemo(()=>Bu===void 0?void 0:{serverUrl:Bu,agentId:zu,token:$u||void 0,userAppsUrl:Hu||void 0},[Bu,zu,$u,Hu]),Gu=computerParts(Au),[Ku,Zu]=reactExports.useState(""),[Qu,Yu]=reactExports.useState(!1),ed=reactExports.useRef(!0);reactExports.useEffect(()=>(ed.current=!0,()=>{ed.current=!1}),[]);const Xu=reactExports.useCallback(()=>{Vu&&readComputer(Vu).then(ad=>{ed.current&&(Uu(ad),Zu(""))},ad=>ed.current&&Zu(ad instanceof Error?ad.message:String(ad)))},[Vu]),rd=hasComputer(Gu);reactExports.useEffect(()=>{rd&&Vu&&Xu()},[rd,Vu,Xu,Du]);const nd=ad=>{Vu&&(Yu(!0),ad(Vu).then(()=>{ed.current&&(Yu(!1),Xu())},ld=>{ed.current&&(Yu(!1),Zu(ld instanceof Error?ld.message:String(ld)))}))},od=!!qu?.yours;return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-computer",children:[jsxRuntimeExports.jsx(Heading$2,{as:"h3",sx:{fontSize:2,mb:2},children:COMPUTER_WORDS.title}),jsxRuntimeExports.jsx(Parts,{app:Au}),rd?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Fu?jsxRuntimeExports.jsx(Text$5,{as:"p",role:"status",sx:{fontSize:1,color:"fg.default",m:0,mt:2},children:Fu}):null,Ku?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"danger.fg",m:0,mt:2},children:Ku}):null,qu&&Vu?jsxRuntimeExports.jsxs(Box,{mt:2,"data-testid":"computer-holder",children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,m:0,mb:1},children:qu.held?od?COMPUTER_WORDS.youHave:COMPUTER_WORDS.someoneHas:COMPUTER_WORDS.agentHas}),qu.held?od?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ButtonComponent,{size:"small",variant:"primary",disabled:Qu,onClick:()=>nd(handBackComputer),children:COMPUTER_WORDS.handBack}),jsxRuntimeExports.jsx(YourTerminal,{context:Vu})]}):null:jsxRuntimeExports.jsx(ButtonComponent,{size:"small",disabled:Qu,onClick:()=>nd(takeOverComputer),children:COMPUTER_WORDS.takeOver})]}):null,Gu.browse&&qu&&Vu?jsxRuntimeExports.jsx(BrowserView,{context:Vu,state:qu,mine:od}):null,jsxRuntimeExports.jsx(Terminal,{conversation:Ou}),qu&&Vu?jsxRuntimeExports.jsx(Files,{context:Vu,state:qu,ended:Du}):null]}):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0,mt:1},children:COMPUTER_WORDS.none})]})}const APP_COMPUTER_PLUGIN_NAME="@datalayer/loop-plugin-app-computer";function defineAppComputerPlugin(Au){function lo({workspace:Ru}){return jsxRuntimeExports.jsx(AppComputer,{app:Au,workspace:Ru})}return{name:`${APP_COMPUTER_PLUGIN_NAME}-${Au.id}`,displayName:`${Au.name}: computer`,description:`The computer ${Au.name} runs on: what ran on it, its files, and taking it over.`,octicon:"device-desktop",build:()=>({components:[{id:"app-computer",slot:LoopSlots.sidebar,order:30,Component:lo,rail:{label:"Computer",icon:DeviceDesktopIcon}}]})}}const SAVE_TOOL="save_to_space",SAVE_WORDS={approve:"Approve and save",decline:"Decline",where:Au=>Au?`To keep as a page of ${Au}:`:"To keep as a page of its Space:"};function draftOfApproval(Au){if(Au.tool_name!==SAVE_TOOL)return null;const lo=$u=>{const Ru=Au.tool_args?.[$u];return typeof Ru=="string"?Ru:""};return{title:lo("title"),content:lo("content"),space:lo("space")}}const APP_RULES_WORDS={title:"Rules and approvals",byDefault:"With no rule of its own: reading is done, anything else waits for you.",none:"It has no rule of its own.",waiting:"Waiting for you",nothingWaiting:"Nothing is waiting for your yes.",signedOut:"Its approvals reach you here once you are signed in to Datalayer.",offline:"Approvals are not connected yet: what you approve or reject is not sent until they are.",approve:"Approve",reject:"Reject"};function ruleInWords(Au){const lo=BEHAVIOUR_WORDS[Au.behaviour];return{action:Au.action,covers:Au.appliesTo.map(coverOf).join(", "),says:lo.says,means:lo.means}}const ruleOfApproval=Au=>{const lo=Au.tool_args?._rule??Au.tool_args?._check;return typeof lo=="string"?lo:""};function approvalsOfApp(Au,lo){return Au.filter($u=>$u.agent_id===lo||$u.tool_args?._app===lo)}const PENDING={status:"pending"};function DraftShown({draft:Au}){return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-draft",mt:1,children:[jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{m:0,fontSize:0,color:"fg.muted"},children:SAVE_WORDS.where(Au.space)}),jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{m:0,fontWeight:"semibold"},children:Au.title}),jsxRuntimeExports.jsx(Box,{as:"pre",m:0,mt:1,p:2,maxHeight:240,overflow:"auto",whiteSpace:"pre-wrap",fontFamily:"inherit",fontSize:0,bg:"canvas.subtle",borderRadius:2,children:Au.content})]})}function Approvals({app:Au}){const lo=useToolApprovalsQuery(PENDING),$u=useApproveToolRequest(),Ru=useRejectToolRequest(),Iu=reactExports.useMemo(()=>approvalsOfApp(lo.data?.approvals??[],Au.id),[lo.data,Au.id]);return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-approvals",children:[jsxRuntimeExports.jsx(Heading$2,{as:"h4",sx:{fontSize:1,mt:3,mb:1},children:APP_RULES_WORDS.waiting}),$u.connectionState!=="connected"?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:0,color:"fg.muted",m:0,mb:1},children:APP_RULES_WORDS.offline}):null,Iu.length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_RULES_WORDS.nothingWaiting}):jsxRuntimeExports.jsx(Box,{as:"ul",listStyle:"none",p:0,m:0,children:Iu.map(Ou=>{const Pu=draftOfApproval(Ou);return jsxRuntimeExports.jsxs(Box,{as:"li",py:2,borderTop:"1px solid",borderColor:"border.muted",fontSize:1,children:[jsxRuntimeExports.jsx(Text$5,{sx:{fontWeight:"semibold"},children:Ou.tool_name}),ruleOfApproval(Ou)?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{m:0,color:"fg.muted",fontSize:0},children:ruleOfApproval(Ou)}):null,Pu?jsxRuntimeExports.jsx(DraftShown,{draft:Pu}):null,jsxRuntimeExports.jsxs(Box,{display:"flex",gap:2,mt:1,children:[jsxRuntimeExports.jsx(ButtonComponent,{size:"small",variant:"primary",disabled:$u.isPending,onClick:()=>$u.mutate({id:Ou.id}),children:Pu?SAVE_WORDS.approve:APP_RULES_WORDS.approve}),jsxRuntimeExports.jsx(ButtonComponent,{size:"small",disabled:Ru.isPending,onClick:()=>Ru.mutate({id:Ou.id}),children:Pu?SAVE_WORDS.decline:APP_RULES_WORDS.reject})]})]},Ou.id)})})]})}function AppRulesCard({app:Au}){const lo=!!useIAMStore($u=>$u.token);return jsxRuntimeExports.jsxs(Box,{"data-testid":"app-rules",mb:4,children:[jsxRuntimeExports.jsx(Heading$2,{as:"h3",sx:{fontSize:2,mb:2},children:APP_RULES_WORDS.title}),Au.rules.length===0?jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",m:0},children:APP_RULES_WORDS.none}):jsxRuntimeExports.jsx(Box,{as:"ul",listStyle:"none",p:0,m:0,children:Au.rules.map(ruleInWords).map(($u,Ru)=>jsxRuntimeExports.jsxs(Box,{as:"li",py:1,fontSize:1,children:[jsxRuntimeExports.jsx(Text$5,{children:$u.action})," ",jsxRuntimeExports.jsx(Label,{title:$u.means,children:$u.says}),jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{m:0,color:"fg.muted",fontSize:0},children:$u.covers})]},Ru))}),jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:0,color:"fg.muted",mt:1,mb:0},children:APP_RULES_WORDS.byDefault}),lo?jsxRuntimeExports.jsx(Approvals,{app:Au}):jsxRuntimeExports.jsx(Text$5,{as:"p",sx:{fontSize:1,color:"fg.muted",mt:3,mb:0},children:APP_RULES_WORDS.signedOut})]})}const APP_RULES_PLUGIN_NAME="@datalayer/loop-plugin-app-rules";function defineAppRulesPlugin(Au){function lo(){return jsxRuntimeExports.jsx(AppRulesCard,{app:Au})}return{name:`${APP_RULES_PLUGIN_NAME}-${Au.id}`,displayName:`${Au.name}: rules and approvals`,description:`When ${Au.name} acts alone, when it asks, and what waits for your yes.`,octicon:"shield-check",build:()=>({components:[{id:"app-rules",slot:LoopSlots.sidebar,order:10,Component:lo,rail:{label:"Rules",icon:ShieldCheckIcon}}]})}}const COMMAND_INPUT="{input}";function commandPrompt(Au,lo=""){const $u=lo.trim();return Au.prompt.includes(COMMAND_INPUT)?Au.prompt.split(COMMAND_INPUT).join($u).trim():$u?`${Au.prompt}
4109
4109
 
4110
4110
  ${$u}`:Au.prompt}function modeDefaults(Au){return Object.fromEntries((Au.interface.modes??[]).filter(lo=>lo.options.length>0).map(lo=>[lo.id,lo.default||lo.options[0].id]))}function modeChoice(Au,lo={}){const $u=Au.interface.modes??[];for(const[Ru,Iu]of Object.entries(lo)){const Ou=$u.find(Pu=>Pu.id===Ru);if(!Ou)throw new Error(`${Au.name} has no mode “${Ru}”.`);if(!Ou.options.some(Pu=>Pu.id===Iu))throw new Error(`The mode ${Ou.label} has no option “${Iu}”.`)}return{...modeDefaults(Au),...lo}}function profileChoice(Au,lo){const $u=Au.interface.profiles??[];if(lo){const Ru=$u.find(Iu=>Iu.id===lo);if(!Ru)throw new Error($u.length===0?`${Au.name} has no profiles: “${lo}” cannot be chosen.`:`${Au.name} has no profile “${lo}”.`);return Ru}return $u[0]}function startersFor(Au,lo){const $u=profileChoice(Au,lo);return $u&&$u.starters.length>0?$u.starters:Au.interface.starters}function modeEffect(Au,lo={},$u){const Ru=modeChoice(Au,lo),Iu=profileChoice(Au,$u),Ou=(Au.interface.modes??[]).flatMap(Lu=>Lu.options.filter(ju=>ju.id===Ru[Lu.id])),Pu=[Iu?.instructions??"",...Ou.map(Lu=>Lu.instructions??"")].map(Lu=>Lu.trim()).filter(Boolean).join(`
4111
4111