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AAK,CACL,EACQuG,EAAe,CACnB,UAAW,SACX,MAAO,IACP,IAAK,IACL,SAAU,CACRvG,EAAK,iBACLmG,EACAE,CACN,CACA,EACEA,EAAM,SAAS,KAAKE,CAAY,EAChC,MAAMC,EAAgB,CACpB,MAAO,KACX,EACQC,EAAc,CAClB,UAAW,SACX,MAAO,IACP,IAAK,GACT,EACQC,EAAe,CACnB,MAAO,KACX,EACQC,EAAa,CACjB,MAAO,UACP,IAAK,OACL,SAAU,CACR,CACE,MAAO,gBACP,UAAW,QACnB,EACM3G,EAAK,YACLmG,CACN,CACA,EACQS,EAAiB,CACrB,OACA,OACA,MACA,KACA,MACA,MACA,OACA,OACA,MACJ,EACQC,EAAgB7G,EAAK,QAAQ,CACjC,OAAQ,IAAI4G,EAAe,KAAK,GAAG,CAAC,IACpC,UAAW,EACf,CAAG,EACKE,EAAW,CACf,UAAW,WACX,MAAO,4BACP,YAAa,GACb,SAAU,CAAE9G,EAAK,QAAQA,EAAK,WAAY,CAAE,MAAO,YAAY,CAAE,CAAC,EAClE,UAAW,CACf,EAEQ+G,EAAW,CACf,KACA,OACA,OACA,OACA,KACA,OACA,MACA,QACA,QACA,KACA,KACA,OACA,OACA,OACA,SACA,WACA,QACJ,EAEQC,EAAW,CACf,OACA,OACJ,EAGQC,EAAY,CAAE,MAAO,gBAAgB,EAGrCC,EAAkB,CACtB,QACA,KACA,WACA,OACA,OACA,OACA,SACA,UACA,OACA,MACA,WACA,SACA,QACA,OACA,QACA,OACA,QACA,OACJ,EAEQC,EAAiB,CACrB,QACA,OACA,UACA,SACA,UACA,UACA,OACA,SACA,OACA,MACA,QACA,SACA,UACA,SACA,OACA,YACA,SACA,OACA,OACA,UACA,SACA,SACJ,EAEQC,EAAgB,CACpB,WACA,KACA,UACA,MACA,MACA,QACA,QACA,gBACA,WACA,UACA,eACA,YACA,aACA,YACA,WACA,UACA,aACA,OACA,UACA,SACA,SACA,SACA,UACA,KACA,KACA,QACA,YACA,SACA,QACA,UACA,UACA,OACA,OACA,QACA,MACA,SACA,OACA,QACA,QACA,SACA,SACA,QACA,SACA,SACA,OACA,UACA,SACA,aACA,SACA,UACA,WACA,QACA,OACA,SACA,QACA,QACA,WACA,UACA,OACA,MACA,WACA,aACA,QACA,OACA,cACA,UACA,SACA,MACJ,EAEQC,EAAiB,CACrB,QACA,QACA,QACA,QACA,KACA,KACA,KACA,MACA,YACA,KACA,KACA,QACA,SACA,QACA,SACA,KACA,WACA,KACA,QACA,QACA,OACA,QACA,WACA,OACA,QACA,SACA,SACA,MACA,QACA,OACA,SACA,MACA,SACA,MACA,OACA,OACA,OACA,SACA,KACA,SACA,KACA,QACA,MACA,KACA,UACA,YACA,YACA,YACA,YACA,OACA,OACA,QACA,MACA,MACA,OACA,KACA,QACA,WACA,OACA,KACA,OACA,WACA,SACA,OACA,UACA,KACA,OACA,MACA,OACA,SAEA,SACA,SACA,KACA,OACA,UACA,OACA,QACA,QACA,UACA,QACA,WACA,SACA,MACA,WACA,SACA,MACA,QACA,OACA,SACA,OACA,MACA,OACA,UAEA,MACA,QACA,SACA,SACA,QACA,MACA,SACA,KACJ,EAEE,MAAO,CACL,KAAM,OACN,QAAS,CACP,KACA,KACN,EACI,SAAU,CACR,SAAU,wBACV,QAASN,EACT,QAASC,EACT,SAAU,CACR,GAAGE,EACH,GAAGC,EAEH,MACA,QACA,GAAGC,EACH,GAAGC,CACX,CACA,EACI,SAAU,CACRR,EACA7G,EAAK,QAAO,EACZ8G,EACAH,EACA5L,EACAuL,EACAW,EACAV,EACAC,EACAC,EACAC,EACAP,CACN,CACA,CACA,CC7YA,SAASxhB,GAAGqb,EAAM,CAyEhB,MAAM+G,EAAW,CACf,QA5BU,CACV,QACA,OACA,OACA,QACA,WACA,UACA,QACA,OACA,cACA,MACA,OACA,KACA,OACA,KACA,SACA,YACA,MACA,UACA,QACA,SACA,SACA,SACA,SACA,OACA,KACJ,EAGI,KAnDY,CACZ,OACA,OACA,YACA,aACA,QACA,UACA,UACA,OACA,QACA,QACA,QACA,SACA,QACA,SACA,SACA,SACA,MACA,OACA,UACA,MACJ,EA+BI,QA3Ee,CACf,OACA,QACA,OACA,KACJ,EAuEI,SAtEgB,CAChB,SACA,MACA,QACA,UACA,OACA,OACA,MACA,OACA,MACA,QACA,QACA,UACA,OACA,UACA,QACJ,CAuDA,EACE,MAAO,CACL,KAAM,KACN,QAAS,CAAE,QAAQ,EACnB,SAAUA,EACV,QAAS,KACT,SAAU,CACR/G,EAAK,oBACLA,EAAK,qBACL,CACE,UAAW,SACX,SAAU,CACRA,EAAK,kBACLA,EAAK,iBACL,CACE,MAAO,IACP,IAAK,GACjB,CACA,CACA,EACM,CACE,UAAW,SACX,SAAU,CACR,CACE,MAAO,6DACP,UAAW,CACvB,EACU,CACE,MAAO,sFACP,UAAW,CACvB,EACU,CACE,MAAO,wBACP,UAAW,CACvB,EACU,CACE,MAAO,uCACP,UAAW,CACvB,EACU,CACE,MAAO,wDACP,UAAW,CACvB,CACA,CACA,EACM,CAAE,MAAO,IACf,EACM,CACE,UAAW,WACX,cAAe,OACf,IAAK,cACL,WAAY,GACZ,SAAU,CACRA,EAAK,WACL,CACE,UAAW,SACX,MAAO,KACP,IAAK,KACL,WAAY,GACZ,SAAU+G,EACV,QAAS,MACrB,CACA,CACA,CACA,CACA,CACA,CCzJA,MAAM7M,GAAW,2BACX6M,GAAW,CACf,KACA,KACA,KACA,KACA,MACA,QACA,UACA,MACA,MACA,WACA,KACA,SACA,OACA,OACA,QACA,QACA,aACA,OACA,QACA,OACA,UACA,MACA,SACA,WACA,SACA,SACA,MACA,QACA,QACA,QAIA,WACA,QACA,QACA,SACA,SACA,OACA,SACA,UAEA,OACF,EACMC,GAAW,CACf,OACA,QACA,OACA,YACA,MACA,UACF,EAGMM,GAAQ,CAEZ,SACA,WACA,UACA,SAEA,OACA,OACA,SACA,SAEA,SACA,SAEA,QACA,eACA,eACA,YACA,aACA,oBACA,aACA,aACA,cACA,cACA,gBACA,iBAEA,MACA,MACA,UACA,U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,CAC1F,CACA,EAEM,CACE,MAAO,SACP,UAAW,CACnB,EACM2B,GAIA,CACE,MAAO,MAAQ3B,EACf,UAAW,CACnB,EACM,CACE,MAAO,CAAE,wBAAwB,EACjC,UAAW,CAAE,EAAG,gBAAgB,EAChC,SAAU,CAAEmB,CAAM,CAC1B,EACMO,EACAF,EACAJ,EACAQ,EACA,CACE,MAAO,QACf,CACA,CACA,CACA,CCtvBA,SAASG,GAAK7J,EAAM,CAClB,MAAM8J,EAAY,CAChB,UAAW,OACX,MAAO,8BACP,UAAW,IACf,EACQC,EAAc,CAClB,MAAO,YACP,UAAW,cACX,UAAW,CACf,EACQ/C,EAAW,CACf,OACA,QACA,MACJ,EAMQgD,EAAgB,CACpB,MAAO,UACP,cAAehD,EAAS,KAAK,GAAG,CACpC,EAEE,MAAO,CACL,KAAM,OACN,QAAS,CAAC,OAAO,EACjB,SAAS,CACP,QAASA,CACf,EACI,SAAU,CACR8C,EACAC,EACA/J,EAAK,kBACLgK,EACAhK,EAAK,cACLA,EAAK,oBACLA,EAAK,oBACX,EACI,QAAS,KACb,CACA,CC5CA,SAASiK,GAAOjK,EAAM,CACpB,MAAMhG,EAAQgG,EAAK,MACb9F,EAAW,oDAAoC,EAC/CgQ,EAAiB,CACrB,MACA,KACA,SACA,QACA,QACA,QACA,OACA,QACA,WACA,MACA,MACA,OACA,OACA,SACA,UACA,MACA,OACA,SACA,KACA,SACA,KACA,KACA,SACA,QACA,cACA,MACA,KACA,OACA,QACA,SACA,MACA,QACA,OACA,OACJ,EAsGQnD,EAAW,CACf,SAAU,sBACV,QAASmD,EACT,SAvGgB,CAChB,aACA,MACA,MACA,MACA,QACA,MACA,OACA,aACA,YACA,QACA,WACA,MACA,cACA,UACA,UACA,UACA,OACA,MACA,SACA,YACA,OACA,OACA,SACA,QACA,SACA,YACA,UACA,UACA,UACA,OACA,OACA,MACA,KACA,QACA,MACA,aACA,aACA,OACA,MACA,OACA,SACA,MACA,MACA,aACA,MACA,OACA,SACA,MACA,OACA,MACA,MACA,QACA,WACA,QACA,OACA,WACA,QACA,MACA,UACA,QACA,SACA,eACA,MACA,MACA,QACA,QACA,OACA,OACA,KACJ,EAkCI,QAhCe,CACf,YACA,WACA,QACA,OACA,iBACA,MACJ,EA0BI,KArBY,CACZ,MACA,WACA,YACA,OACA,OACA,UACA,UACA,WACA,WACA,MACA,QACA,OACA,OACJ,CAQA,EAEQC,EAAS,CACb,UAAW,OACX,MAAO,gBACX,EAEQ9D,EAAQ,CACZ,UAAW,QACX,MAAO,KACP,IAAK,KACL,SAAUU,EACV,QAAS,GACb,EAEQqD,EAAkB,CACtB,MAAO,OACP,UAAW,CACf,EAEQC,EAAS,CACb,UAAW,SACX,SAAU,CAAErK,EAAK,gBAAgB,EACjC,SAAU,CACR,CACE,MAAO,yCACP,IAAK,MACL,SAAU,CACRA,EAAK,iBACLmK,CACV,EACQ,UAAW,EACnB,EACM,CACE,MAAO,yCACP,IAAK,MACL,SAAU,CACRnK,EAAK,iBACLmK,CACV,EACQ,UAAW,EACnB,EACM,CACE,MAAO,8BACP,IAAK,MACL,SAAU,CACRnK,EAAK,iBACLmK,EACAC,EACA/D,CACV,CACA,EACM,CACE,MAAO,8BACP,IAAK,MACL,SAAU,CACRrG,EAAK,iBACLmK,EACAC,EACA/D,CACV,CACA,EACM,CACE,MAAO,eACP,IAAK,IACL,UAAW,EACnB,EACM,CACE,MAAO,eACP,IAAK,IACL,UAAW,EACnB,EACM,CACE,MAAO,4BACP,IAAK,GACb,EACM,CACE,MAAO,4BACP,IAAK,GACb,EACM,CACE,MAAO,4BACP,IAAK,IACL,SAAU,CACRrG,EAAK,iBACLoK,EACA/D,CACV,CACA,EACM,CACE,MAAO,4BACP,IAAK,IACL,SAAU,CACRrG,EAAK,iBACLoK,EACA/D,CACV,CACA,EACMrG,EAAK,iBACLA,EAAK,iBACX,CACA,EAGQsK,EAAY,kBACZC,EAAa,QAAQD,CAAS,UAAUA,CAAS,SAASA,CAAS,OAMnErR,EAAY,O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W,MACX/O,EAAU,MACV,QAASA,EAAS,OAChC,CACA,EACU,CACE,MAAO,CACL,UAAW,MACXA,CACd,CACA,CACA,EACQ,MAAO,CACL,EAAG,UACH,EAAG,cACH,EAAG,uBACb,CACA,EACM,CACE,UAAW,OACX,MAAO,WACP,IAAK,UACL,SAAU,CACRuO,EACAQ,EACAoB,CACV,CACA,CACA,CACA,CACA,CCjbA,MAAMnQ,GAAW,2BACX6M,GAAW,CACf,KACA,KACA,KACA,KACA,MACA,QACA,UACA,MACA,MACA,WACA,KACA,SACA,OACA,OACA,QACA,QACA,aACA,OACA,QACA,OACA,UACA,MACA,SACA,WACA,SACA,SACA,MACA,QACA,QACA,QAIA,WACA,QACA,QACA,SACA,SACA,OACA,SACA,UAEA,OACF,EACMC,GAAW,CACf,OACA,QACA,OACA,YACA,MACA,UACF,EAGMM,GAAQ,CAEZ,SACA,WACA,UACA,SAEA,OACA,OACA,SACA,SAEA,SACA,SAEA,QACA,eACA,eACA,YACA,aACA,oBACA,aACA,aACA,cACA,cACA,gBACA,iBAEA,MACA,MACA,UACA,UAEA,cACA,oBACA,UACA,WACA,OAEA,UACA,YACA,oBACA,gBAEA,UACA,QAEA,OAEA,aACF,EAEMC,GAAc,CAClB,QACA,YACA,gBACA,aACA,iBACA,cACA,YACA,UACF,EAEMC,GAAmB,CACvB,cACA,aACA,gBACA,eAEA,UACA,UAEA,OACA,WACA,QACA,aACA,WACA,YACA,qBACA,YACA,qBACA,SACA,UACF,EAEMC,GAAqB,CACzB,YACA,OACA,QACA,UACA,SACA,WACA,eACA,iBACA,SACA,QACF,EAEMC,GAAY,GAAG,OACnBF,GACAF,GACAC,EACF,EAWA,SAASI,GAAW3H,EAAM,CACxB,MAAMhG,EAAQgG,EAAK,MAQb4H,EAAgB,CAAClO,EAAO,CAAE,MAAAmO,EAAK,IAAO,CAC1C,MAAM74B,GAAM,KAAO0qB,EAAM,CAAC,EAAE,MAAM,CAAC,EAEnC,OADYA,EAAM,MAAM,QAAQ1q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C,EAAI,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAChD,OAAO,SAAS,WAAa,oBAAsBA,EAAE,IAAI,MAAM,IAAM,iBAAmBA,EAAE,IAAI,SAAS,IACzG,OAAO,QAAQ,aAAa,KAAM,GAAI,kBAAoB,OAAO,SAAS,MAAM,CAEpF,CAMA,MAAMnX,GAAW,OAAO,SAAS,SAEjC,IAAI8vD,GACAD,GAAkBG,GAAa7kD,GAAkBnL,EAAQ,CAAC,EAC5D8vD,GAAOG,GAAS,YAAYD,GAAarvC,EAAG,GAE5CqvC,GAAY,UAAY,GACxBF,GAAOG,GAAS,WAAWD,EAAW,EACtCF,GAAK,OAAOnvC,EAAG,GAQjBlf,GAAA","names":["RELOAD_KEY","RELOAD_WINDOW_MS","isChunkLoadError","err","msg","lazyWithReload","factory","lazy","retryErr","last","platformRoutes","MessageSquare","Layers","ShieldCheck","Globe","Cloud","Cpu","Box","Clapperboard","Hammer","Bot","Library","Network","CreditCard","Server","Inbox","KeyRound","ScrollText","Code2","Terminal","MonitorCog","Database","Eye","Activity","Workflow","platformRouteByPath","route","CTA_FALLBACK_HREF","platformCtaHref","authenticated","destination","sections","Image","Laptop","FileText","GitBranch","NotebookPen","methodColor","authLabel","baseSlug","path","p","endpointKey","method","slugByKey","usedSlugs","builtEndpoints","section","e","key","slug","n","docEndpoints","bySlug","docEndpointBySlug","slugForEndpoint","docSectionById","id","RE","EC","PO","PF","AS","DE","FU","VO","MU","VI","useCases","useCaseBySlug","u","useCaseCategories","useCaseNeedsImage","kind","useCaseMeta","alternativeCategoryLabels","appNzCore","list","items","item","articleBody","seed","categoryLabel","special","seeds","alternatives","alt","alternativeBySlug","DESKTOP_APP_BASE_PATH","STATIC_PATH_PREFIXES","STATIC_PATHS","pathnameOnly","pathname","rawPath","isDesktopAppPath","stripDesktopAppBasePath","isClientRoutePath","prefix","desktopAppPathForNavigation","currentPathname","installed","patchHistory","original","patched","args","result","navigate","to","opts","url","dest","samePage","_a","onDocumentClick","target","anchor","href","installRouter","useLocationPath","initial","setPath","useState","useEffect","update","categories","promptLibraryJSON","libraryPrompts","libraryPromptBySlug","typeMeta","ImageIcon","Film","Volume2","categoryBySlug","category","tryHref","params","CopyButton","text","compact","copied","setCopied","React","copy","jsxs","jsx","Check","Copy","PromptCard","meta","Icon","tag","ArrowRight","PromptDetail","related","candidate","ArrowLeft","PromptIndex","categorySlug","typeSlug","initialQuery","query","setQuery","activeCategory","activeType","filtered","terms","haystack","term","heading","description","Sparkles","Search","event","PromptLibraryPage","pathProp","categoryMatch","typeMatch","detailMatch","coreTools","Triangle","Music","Scissors","Wand2","Gauge","GitCompareArrows","Globe2","Calculator","Swords","FileSearch","Video","LineChart","ImagePlus","LayoutGrid","PenTool","Regex","Braces","blueprintTool","title","tagline","tags","icon","defaults","exampleOutputs","blueprintTools","Rocket","DollarSign","Clock3","Package","Bug","Shield","FileCode","Table2","Home","Brush","Camera","Presentation","Palette","Type","Shirt","Sticker","Cuboid","Map","Building2","Gamepad2","Link2","tools","toolBySlug","toolCategories","FLUX_SIZES","IMG_PROMPT","VIDEO_PROMPT","REF_IMAGE","REF_GLB","spaces","spaceBySlug","s","spaceCategories","spaceMeta","taskLabel","TASK_LABELS","spaceEndpoint","spaceOrTask","compare","models","evalSources","evalSourceBySlug","source","evalModalities","robot","cogShowcases","cogShowcaseBySlug","showcase","cogShowcaseByTemplate","cogShowcasePaths","HOME_PAGE_META","STATIC_PAGE_META","humanizeSlug","c","ROUTE_ALIASES","canonicalPath","metaForPath","m","tool","post","blogPosts","label","prompt","CLIENT_ONLY_PATHS","prerenderPaths","paths","type","isPrerenderedPath","usePageMeta","previousTitle","previousDescription","openPalette","formatCredits","credits","SiteNav","me","setMe","setCredits","menuOpen","setMenuOpen","cancelled","loadAccount","meResponse","response","balanceResponse","onKey","prevOverflow","isAuthed","navItems","Fragment","Plus","_b","User","LogIn","UserPlus","open","X","Menu","cx","inputs","twMerge","clsx","repoHref","repo","view","SAFE_REPO_FULL_NAME","safeRepoFullName","fullName","trimmed","cloneOrigin","origin","cloneHost","repoHTTPSCloneUrl","repoSSHCloneUrl","repoCloneUrl","protocol","repoCloneCommand","VisibilityIcon","visibility","size","Lock","RadioTower","avatarColor","h","i","OwnerAvatar","name","src","failed","setFailed","Metric","value","ListEmpty","visible","children","Alert","error","notice","clampContextAction","clientX","clientY","width","height","margin","maxLeft","maxTop","copyText","textarea","kindMeta","KindBadge","cls","RepoCard","contextAction","setContextAction","openTimer","closeTimer","httpsCommand","sshCommand","close","onKeyDown","onContextMenu","rect","x","y","pos","cloneAction","createPortal","copiedLabel","command","current","Star","useRequireAuth","next","UI","STATUS_TONES","STATUS_NEUTRAL","statusTone","status","StatusBadge","className","getRecognitionCtor","w","serverSTT","extractTranscript","payload","record","pickRecorderMime","useVoiceInput","state","setState","level","setLevel","browserSupported","useMemo","mediaSupported","supported","onTextRef","useRef","baseRef","mrRef","streamRef","chunksRef","recRef","ctxRef","rafRef","silenceRef","sawSpeechRef","teardownAudio","useCallback","t","startBrowser","Ctor","rec","finalText","interim","r","transcribeBlob","blob","res","data","startRecording","stream","mime","mr","ctx","analyser","tick","sum","v","rms","now","dt","stop","start","base","onText","toggle","VoiceWaveform","active","bars","boost","VoiceOverlay","onStop","MicOff","VoiceDictationControl","onChange","disabled","buttonClassName","ariaLabel","voice","Loader2","Mic","PAGES","NAV_CHORDS","CHORD_TIMEOUT_MS","KEY_OWNER_SELECTOR","KEY_OWNER_PATHS","hasLocalBareKeyOwner","score","q","idx","ti","hits","qi","at","CommandPalette","setOpen","helpOpen","setHelpOpen","setActive","repos","setRepos","pendingChordAt","loaded","inputRef","listRef","loadRepos","toEntry","mine","explore","seen","out","body","isTyping","el","o","chord","results","all","scored","hay","a","b","go","entry","onListKey","k","d","NETWORK_LINKS","COLUMNS","THEMES","Monitor","Moon","Sun","ThemeSelect","theme","setTheme","mq","apply","pick","resolved","SiteFooter","col","l","PALETTE","COLOR_256","parseCast","lines","cols","rows","events","line","parsed","duration","Screen","__publicField","codes","row","remaining","keep","ch","j","renderLines","screen","maxRows","TerminalCast","speed","poster","cast","setCast","loading","setLoading","setError","reducedMotion","setReducedMotion","playing","setPlaying","started","setStarted","progress","setProgress","setLines","containerRef","scrollRef","loopTimerRef","stateRef","playingRef","alive","media","restart","st","advanced","play","pause","obs","entries","Pause","Play","RotateCcw","AlertCircle","li","span","si","productCards","BookOpen","FlaskConical","Wrench","heroBadgeLinks","heroPillars","modelLanes","artShowcase","mediaCapabilities","providerBadges","INSTALL_COMMAND","copyInstallCommand","terminalCards","hostedServices","HardDrive","researchModes","gatewayPrices","repoRows","communityApps","Zap","portfolioSites","faqItems","PlatformHome","HeroMeshCanvas","link","ArrowUpRight","external","card","ProductTile","capability","MediaCapabilityTile","ArtShowcaseCard","provider","InstallCommand","TerminalCard","AgentPanel","lane","service","app","site","canvasRef","canvas","motionQuery","frame","dpr","resize","draw","time","animate","centerX","horizonY","spacing","halfColumns","drawPoint","z","depth","wave","drift","strokeMesh","offset","shimmer","point","index","nextTime","handleMotionChange","isExternal","onCopy","CheckCircle2","firebaseConfig","auth","getApps","getApp","initializeApp","getAuth","googleProvider","GoogleAuthProvider","githubProvider","GithubAuthProvider","GATEWAY_KEY_SLOT","cache","inflight","storedApiKey","mirror","getUserData","force","user","handle","invalidateUserData","authedFetch","input","init","headers","AUTH_PATHS","isAuthPath","safeNextPath","raw","fallback","REDIRECT_PENDING_KEY","REDIRECT_ERROR_KEY","markRedirectPending","authError","message","code","readJSON","legacyPasswordAuth","endpoint","email","password","canUseLegacyPasswordFallback","exchangeSession","idToken","ensureServerSession","handleAccountExistsConflict","attempted","pendingCred","methods","fetchSignInMethodsForEmail","existing","signInWithPopup","linkWithCredential","AuthContext","createContext","AuthProvider","setUser","setPersistence","browserLocalPersistence","browserSessionPersistence","finishing","finishRedirect","pending","getRedirectResult","ensured","onAuthStateChanged","afterSignIn","cred","signInWithProvider","linked","signInWithRedirect","signInWithGoogle","signInWithGithub","signInWithEmail","signInWithEmailAndPassword","signUpWithEmail","createUserWithEmailAndPassword","sendPasswordReset","confirmReset","oobCode","newPassword","confirmPasswordReset","logout","signOut","getIdToken","useAuth","useContext","stripeCache","getStripe","loadStripe","friendlyAuthError","InlineAuthForm","onSuccess","mode","setMode","setEmail","setPassword","busy","setBusy","submit","registerErr","rc","signInErr","sc","oauth","GoogleIcon","GitHubIcon","useSubscribeFlow","publishableKey","stage","setStage","plan","setPlan","mountRef","instanceRef","beginCheckout","planId","clientSecret","stripe","checkout","STATIC_PRICING","money","HOW_IT_WORKS","Wallet","UsageBasedPricing","setData","live","_c","step","StepIcon","PriceBlock","srch","subtitle","STATIC_PLANS","SubscriptionPlans","plans","setPlans","setPublishableKey","flow","prev","tier","cfg","subscribe","pendingPlan","savePct","perk","PlatformPricing","PlatformRoutePage","testMode","setTestMode","setAuthenticated","surface","moduleSurfaceFor","TestStat","CommandBlock","ItemIcon","deepFreeze","obj","prop","Response","escapeHTML","inherit$1","objects","SPAN_CLOSE","emitsWrappingTags","node","scopeToCSSClass","pieces","HTMLRenderer","parseTree","options","newNode","TokenTree","scope","builder","child","TokenTreeEmitter","emitter","re","lookahead","concat","anyNumberOfTimes","optional","stripOptionsFromArgs","either","countMatchGroups","startsWith","lexeme","match","BACKREF_RE","_rewriteBackreferences","regexps","joinWith","numCaptures","regex","MATCH_NOTHING_RE","IDENT_RE","UNDERSCORE_IDENT_RE","NUMBER_RE","C_NUMBER_RE","BINARY_NUMBER_RE","RE_STARTERS_RE","SHEBANG","beginShebang","resp","BACKSLASH_ESCAPE","APOS_STRING_MODE","QUOTE_STRING_MODE","PHRASAL_WORDS_MODE","COMMENT","begin","end","modeOptions","ENGLISH_WORD","C_LINE_COMMENT_MODE","C_BLOCK_COMMENT_MODE","HASH_COMMENT_MODE","NUMBER_MODE","C_NUMBER_MODE","BINARY_NUMBER_MODE","REGEXP_MODE","TITLE_MODE","UNDERSCORE_TITLE_MODE","METHOD_GUARD","MODES","skipIfHasPrecedingDot","scopeClassName","_parent","beginKeywords","parent","compileIllegal","compileMatch","compileRelevance","beforeMatchExt","originalMode","COMMON_KEYWORDS","DEFAULT_KEYWORD_SCOPE","compileKeywords","rawKeywords","caseInsensitive","scopeName","compiledKeywords","compileList","keywordList","keyword","pair","scoreForKeyword","providedScore","commonKeyword","seenDeprecations","warn","deprecated","version","MultiClassError","remapScopeNames","regexes","scopeNames","emit","positions","beginMultiClass","endMultiClass","scopeSugar","MultiClass","compileLanguage","language","langRe","global","MultiRegex","terminators","matchData","ResumableMultiRegex","matcher","m2","buildModeRegex","mm","compileMode","cmode","ext","keywordPattern","expandOrCloneMode","dependencyOnParent","variant","HTMLInjectionError","reason","html","escape","inherit","NO_MATCH","MAX_KEYWORD_HITS","HLJS","hljs","languages","aliases","plugins","SAFE_MODE","LANGUAGE_NOT_FOUND","PLAINTEXT_LANGUAGE","shouldNotHighlight","languageName","blockLanguage","block","classes","getLanguage","_class","highlight","codeOrLanguageName","optionsOrCode","ignoreIllegals","context","fire","_highlight","codeToHighlight","continuation","keywordHits","keywordData","matchText","processKeywords","top","modeBuffer","lastIndex","buf","word","keywordRelevance","relevance","cssClass","emitKeyword","processSubLanguage","continuations","highlightAuto","processBuffer","emitMultiClass","max","klass","startNewMode","endOfMode","matchPlusRemainder","matched","doIgnore","resumeScanAtSamePosition","doBeginMatch","newMode","beforeCallbacks","cb","doEndMatch","endMode","processContinuations","lastMatch","processLexeme","textBeforeMatch","processed","iterations","md","beforeMatch","processedCount","justTextHighlightResult","languageSubset","plaintext","autoDetection","sorted","best","secondBest","updateClassName","element","currentLang","resultLang","highlightElement","configure","userOptions","initHighlighting","highlightAll","initHighlightingOnLoad","wantsHighlight","boot","registerLanguage","languageDefinition","lang","error$1","registerAliases","unregisterLanguage","alias","listLanguages","aliasList","upgradePluginAPI","plugin","addPlugin","removePlugin","deprecateHighlightBlock","core","bash","VAR","BRACED_VAR","SUBST","HERE_DOC","QUOTE_STRING","ESCAPED_QUOTE","APOS_STRING","ESCAPED_APOS","ARITHMETIC","SH_LIKE_SHELLS","KNOWN_SHEBANG","FUNCTION","KEYWORDS","LITERALS","PATH_MODE","SHELL_BUILT_INS","BASH_BUILT_INS","ZSH_BUILT_INS","GNU_CORE_UTILS","TYPES","ERROR_TYPES","BUILT_IN_GLOBALS","BUILT_IN_VARIABLES","BUILT_INS","javascript","hasClosingTag","after","IDENT_RE$1","FRAGMENT","XML_SELF_CLOSING","XML_TAG","afterMatchIndex","nextChar","afterMatch","KEYWORDS$1","decimalDigits","frac","decimalInteger","NUMBER","HTML_TEMPLATE","CSS_TEMPLATE","GRAPHQL_TEMPLATE","TEMPLATE_STRING","SUBST_INTERNALS","SUBST_AND_COMMENTS","PARAMS_CONTAINS","PARAMS","CLASS_OR_EXTENDS","CLASS_REFERENCE","USE_STRICT","FUNCTION_DEFINITION","UPPER_CASE_CONSTANT","noneOf","FUNCTION_CALL","PROPERTY_ACCESS","GETTER_OR_SETTER","FUNC_LEAD_IN_RE","FUNCTION_VARIABLE","json","ATTRIBUTE","PUNCTUATION","LITERALS_MODE","python","RESERVED_WORDS","PROMPT","LITERAL_BRACKET","STRING","digitpart","pointfloat","COMMENT_TYPE","typescript","tsLanguage","NAMESPACE","INTERFACE","TS_SPECIFIC_KEYWORDS","DECORATOR","swapMode","replacement","indx","ATTRIBUTE_HIGHLIGHT","OPTIONAL_KEY_OR_ARGUMENT","functionDeclaration","registered","ensureLanguages","LANGUAGE_ALIASES","normalizeLanguage","escapeHtml","CodeBlock","preClassName","showCopy","testId","LLM_GUIDES","guideIcons","Boxes","LlmQuickstart","selected","setSelected","guide","BUILD_PROMPT","SWITCH_SNIPPET","AiAgentCard","EndpointRow","inner","filterSections","sectionHit","endpoints","paramHit","PlatformDocs","COMMAND_GROUPS","APPNZ_YAML","CopyableCommand","CommandGroupCard","group","CommandRowItem","quickstart","CliPage","ORIGIN","buildCurl","authHeader","NotFound","EndpointDoc","siblings","postRelay","file","form","uploadFile","DOCUMENT_ACCEPT","extractDocument","SEEDANCE_DEMOS","VID","IMG","FAL_VIDEO_DEMOS","GEMINI_VIDEO_DEMOS","VIDEO_RESOLUTIONS","VIDEO_DURATIONS","VIDEO_ASPECT_RATIOS","VIDEO_OUTPUT_FORMATS","BASE","FAMILIES","detectInputs","modelId","isImageToVideo","isReference","getVideoParamSpec","family","f","isHappyHorse","EMPTY_ADVANCED","num","buildVideoPayload","spec","_d","_e","_f","_g","CODE_LANGS","codeLangHl","KEY_ENV","keyLiteral","apiKey","jsonC","indent","buildGatewaySamples","sdk","baseURL","relPath","ctype","curl","qs","pyHead","jsHead","samplesToMarkdown","samples","SignInModal","__vitePreload","TABS","Binary","SAMPLE_I2V_IMAGES","ENDPOINT","inferModality","has","MEDIA_EXT","classifyUrl","findMedia","urls","walk","val","fmtCost","usd","estimateTokens","estimateChatTokens","messages","system","attachmentTokens","acc","att","extracted","fmtTokens","tokens","inferAttachmentKind","formatBytes","bytes","kb","mb","attachmentSummary","location","buildAttachmentText","attachments","messageForAPI","parts","textContext","playCompletionSound","AudioContextClass","gain","osc","makeChatMessage","role","content","extras","messageTime","ts","inputCx","GatewayPlayground","initialTab","initialModel","setApiKey","tab","setTab","showCode","setShowCode","resultView","setResultView","signedIn","setSignedIn","showSignIn","setShowSignIn","showSettings","setShowSettings","systemExpanded","setSystemExpanded","galleryRefresh","setGalleryRefresh","retryRef","latencyMs","setLatencyMs","setResult","setSystem","setMessages","streaming","setStreaming","usage","setUsage","maxTokens","setMaxTokens","chatAttachments","setChatAttachments","chatUploading","setChatUploading","chatUploadError","setChatUploadError","soundEnabled","setSoundEnabled","model","setModel","chatInput","setChatInput","setPrompt","setSize","embedInput","setEmbedInput","setVoice","ttsInput","setTtsInput","setLanguage","assetUrl","setAssetUrl","uploading","setUploading","audioFile","setAudioFile","videoResolution","setVideoResolution","videoDuration","setVideoDuration","videoAspect","setVideoAspect","videoAudio","setVideoAudio","videoAdvanced","setVideoAdvanced","showVideoAdvanced","setShowVideoAdvanced","codeLang","setCodeLang","copiedMd","setCopiedMd","abortRef","blobRef","chatFileInputRef","requestSignIn","retry","onAuthed","saveGenerations","savable","authHeaders","grouped","g","supportsAuto","tabModels","seedanceDemo","videoSpec","lastSeedanceModel","videoBody","pickDefaultModel","switchTab","first","selectedModel","sizeOptions","projectedChatTokens","projectedContextPct","projectedChatCost","output","total","persistKey","setBlob","onUpload","uploadChatFiles","files","extractedText","extractedPreview","uploadErr","removeChatAttachment","streamChatHistory","history","controller","apiMessages","errorDetail","reader","decoder","buffer","promptTok","completionTok","cachedTok","done","chunk","delta","sendChat","userMessage","regenerateMessage","cut","editMessage","nextContent","edited","forkMessage","branch","deleteMessage","_","clearChat","run","runTranscription","runSpeech","runImage","runEmbeddings","runMedia","images","pretty","embedding","codeSamples","common","codeMarkdown","imageCost","chatCost","cached","uncached","inputRate","cachedRate","inC","outC","count","activeTab","Settings2","ChevronUp","ChevronDown","Upload","img","ResultPanel","FileIcon","Paperclip","Square","Trash2","Send","GenerationsPanel","refreshKey","onRequireSignIn","onUsePrompt","setItems","setKind","remove","it","onRegenerate","onEdit","onFork","onDelete","setView","ChatBubble","ResultPreview","isLast","editing","setEditing","draft","setDraft","isUser","isStreamingThis","save","Pencil","GitFork","Empty","emb","detail","DEFAULT_ORIGIN","LANG_LABELS","ENDPOINTS","AUTO_MODELS","buildSamples","v1","fmtPrice","fmtContext","GatewayPage","setOrigin","exampleKey","setExampleKey","task","setTask","setLang","loadError","setLoadError","providerFilter","setProviderFilter","playgroundTab","setPlaygroundTab","stored","applyPlaygroundHash","aborted","copyCurl","providers","filteredModels","loadCatalog","formatContext","formatPrice","modelTitle","modelDisplayLabel","normalized","tail","capabilities","caps","initialProvider","ModelsDirectory","setModels","setProviders","setQ","setProvider","providerMeta","map","needle","IMAGE_DEMOS","SEEDANCE_LOGO_URL","HAPPY_HORSE_RAP_IMAGE_URL","HH11_BASE","HAPPY_HORSE_V11_IMAGE_URL","SYNC_LIPSYNC_BASE","SYNC_LIPSYNC_AVATAR_URL","FAL_VIDEO_BASE","GEMINI_OMNI_BASE","GEMINI_OMNI_PERFUME_IMAGE_URL","VIDEO_DEMOS","Fact","snippet","API_BASE","API_KEY","isForecastModel","forecastSnippet","modelFacts","modality","isVideoModel","demo","generateVideoSnippet","generateImageSnippet","ModelPage","decodedId","mediaLang","setMediaLang","mediaCopied","setMediaCopied","found","isVideo","isForecast","videoDemo","imageDemo","isImage","isMedia","fcastSnippet","videoSnippet","imageSnippet","copyMedia","providerLabel","SelfTestProbe","enabled","ok","KIND_LABEL","UseCaseDirectory","setCategory","extractMediaURL","exts","low","fileToDataURL","resolve","reject","STEPS","stepsFor","UseCasePage","def","setInput","image","setImage","running","setRunning","setResults","fileRef","needsImage","needsText","steps","onPickFile","finalPrompt","Download","FIGURE_RE","parseBlocks","blocks","isTableSep","splitRow","fence","fig","header","para","renderInline","keyBase","nodes","tok","im","lm","Markdown","categoryOrder","categoryIcons","comparisonHighlights","Route","groupedAlternatives","AlternativeDetail","AlternativesIndex","groups","feature","AlternativesPage","PROJECTS","CONTACT_EMAIL","INVESTOR_DOCS","InvestorsSubnav","doc","Eyebrow","DocSection","DocH3","Callout","FactGrid","DocTable","head","InvestorsContactCta","documents","thesisPoints","longTermBets","InfinityIcon","roomFacts","InvestorsPage","LockOpen","eraRows","InvestorsVisionPage","TOC","InvestorsDeepDivePage","ADDONS","addonBySlug","featured","rest","environments","AddonsHubPage","PlugZap","gobed","benchRows","apiRows","indexModes","GobedAddonPage","pg","PostgresAddonPage","stats","features","Rss","FileImage","apiExample","PapersShowcasePage","copyExample","RL_CATEGORY_LABELS","RL_ENVIRONMENTS","RL_ALGORITHMS","RL_GPU_TIERS","RL_STARTER_REPOS","previewMetrics","env","totalSteps","points","noise","rlEnvById","rlAlgoById","POLL_MS","PREVIEW_TICK_MS","PREVIEW_POINTS","fmt","digits","Sparkline","accessor","vals","min","StatTile","sub","RLPage","envId","setEnvId","algoId","setAlgoId","gpuId","setGpuId","gpuTiers","setGpuTiers","job","setJob","previewMode","setPreviewMode","previewTick","setPreviewTick","launching","setLaunching","deploying","setDeploying","panelRef","algo","visibleEnvs","compatibleAlgos","tiers","metrics","launch","deploy","Joystick","tooSmall","thumbFor","cog","promptPreview","CogExamplesHub","kinds","token","ChevronLeft","thumb","CirclePlay","Github","codeFor","Waveform","split","FileAudio","MotionPreview","cxv","cyv","ImagePreview","isCutout","isDepth","isVector","isUpscale","isClean","TextPreview","OutputPreview","InputPreview","SurfaceCode","setSurface","CogShowcasePage","previous","TerminalSquare","Layers3","Waves","ExternalLink","ChevronRight","surfaceStyle","SourceCard","LaunchCard","Method","number","EvalHub","BarChart3","EvalDetail","ShieldAlert","EvalsPage","statusStyles","Users","FileCheck","complianceRows","EnterprisePage","Mail","ClipboardList","pillars","FileKey2","Container","subprocessors","SecurityPage","AuthSection","PlatformShell","VisualBench","VideoEditor","ThreeDEditor","ModelLibraryPage","AnimFlowStudio","ManimAgentPage","MotionVfxLibraryPage","SpatialGalleryPage","AgentStudio","BrowserAgent","PackingAgent","SearchPage","PapersPage","PaperDetailPage","AgentSdkPage","IntegrationsPage","SchedulersPage","AutoAgentsPage","SkillsPage","McpServersPage","DatasetsPage","NotebooksPage","NotebookPage","DashboardsPage","AnalyticsPage","DashboardPage","DeepResearchPage","DrawPage","DiffusionCanvasPage","LiveDrawPage","WritePage","SheetsPage","ArtifactsPage","PullsInbox","MailPage","Profile","RepoHub","RepoView","CogStudio","TrainingPage","ComfyStudio","BuildStudio","CIPage","SiteBuilder","AssistantStudio","GroupChatStudio","CharacterGallery","Characters3DPage","CharacterTalk","ArtPage","MusicPage","AdminPage","ToolsHub","ToolPage","GpuClockerPage","FusionPage","BlogHub","BlogPost","TimeSeriesForecastingPage","ProvidersApplyPage","SpacesIndexPage","SpacePage","AudioEditor","ImageEditor","SlidesEditor","VectorEditor","VideoExtensionTool","TextToImagePage","TextureLibraryPage","ImageTo3DPage","TextTo3DPage","PropsStudio","VRMEditorPage","PanoramaWorldStudio","FastVFXSpace","AbotWorldSpace","ArdySpace","MediaServicesSpace","SamMaskAdjustSpace","SplatSpace","FastVideoSpace","AudioToAudioSpace","PlaygroundPage","TermsPage","SettingsPage","SocialSchedulerPage","CreationFeedPage","DevelopersPage","SkillsMarketPage","PrivacyPage","AppsMarketplacePage","NeonRelayGame","OrbitWordsGame","ReWordGame","BigMultiplayerChessGame","WordSmashingGame","MultiplicationMasterGame","SignalOrchardGame","CartographersKitchenGame","MuseumAfterMidnightGame","RouteFallback","Marketing","routeKey","AuthShell","Suspense","AppShell","AppRoutes","locationPath","pageMeta","shell","nbSlug","dashboardSlug","marketingLazy","aiSlug","blogSlug","platformRoute","handleMatch","repoMatch","App","props","MAX_REPORTS_PER_SESSION","sent","fingerprint","send","report","fp","reportError","partial","__vite_import_meta_env__","installErrorReporter","ErrorBoundary","info","shouldHydrateRoot","root","prerenderedPath","rootElement","ReactDOM"],"ignoreList":[29,30,31,32,33,34,35],"sources":["../../lib/lazyWithReload.ts","../../components/platformRoutes.ts","../../components/docsData.ts","../../components/ai/useCasesData.ts","../../components/alternativesData.ts","../../lib/desktopPath.ts","../../lib/router.tsx","../../components/PromptLibraryPage.tsx","../../components/tools/toolsRegistry.ts","../../components/spaces/spacesRegistry.ts","../../components/evals/evalData.ts","../../components/cogs/cogShowcaseData.ts","../../components/platformPageMeta.ts","../../components/usePageMeta.ts","../../components/SiteNav.tsx","../../components/gitShared.tsx","../../components/useVoiceInput.ts","../../components/VoiceDictationControl.tsx","../../components/CommandPalette.tsx","../../components/SiteFooter.tsx","../../components/TerminalCast.tsx","../../components/PlatformHome.tsx","../../lib/firebase.ts","../../lib/userData.ts","../../lib/authNext.ts","../../lib/auth-context.tsx","../../components/SubscribeFlow.tsx","../../components/PlatformPricing.tsx","../../components/PlatformRoutePage.tsx","../../node_modules/highlight.js/lib/core.js","../../node_modules/highlight.js/es/languages/bash.js","../../node_modules/highlight.js/es/languages/go.js","../../node_modules/highlight.js/es/languages/javascript.js","../../node_modules/highlight.js/es/languages/json.js","../../node_modules/highlight.js/es/languages/python.js","../../node_modules/highlight.js/es/languages/typescript.js","../../components/CodeBlock.tsx","../../components/LlmQuickstart.tsx","../../components/PlatformDocs.tsx","../../components/CliPage.tsx","../../components/EndpointDoc.tsx","../../components/uploadFile.ts","../../components/extractDocument.ts","../../components/seedanceDemos.ts","../../components/falVideoDemos.ts","../../components/geminiVideoDemos.ts","../../components/videoModelParams.ts","../../components/videoPayload.ts","../../components/gatewayCode.ts","../../components/GatewayPlayground.tsx","../../components/GatewayPage.tsx","../../components/modelCatalog.ts","../../components/ModelsDirectory.tsx","../../components/imageDemos.ts","../../components/videoDemos.ts","../../components/ModelPage.tsx","../../components/SelfTestProbe.tsx","../../components/ai/UseCaseDirectory.tsx","../../components/ai/UseCasePage.tsx","../../components/Markdown.tsx","../../components/AlternativesPage.tsx","../../constants.ts","../../components/investors/InvestorsShared.tsx","../../components/investors/InvestorsPage.tsx","../../components/investors/InvestorsVisionPage.tsx","../../components/investors/InvestorsDeepDivePage.tsx","../../components/addons/addonsData.ts","../../components/addons/AddonsHubPage.tsx","../../components/addons/GobedAddonPage.tsx","../../components/addons/PostgresAddonPage.tsx","../../components/PapersShowcasePage.tsx","../../components/rl/rlData.ts","../../components/rl/RLPage.tsx","../../components/cogs/CogExamplesHub.tsx","../../components/cogs/CogShowcasePage.tsx","../../components/evals/EvalsPage.tsx","../../components/enterprise/EnterprisePage.tsx","../../components/enterprise/SecurityPage.tsx","../../App.tsx","../../components/errorReporter.ts","../../components/ErrorBoundary.tsx","../../lib/rootMount.ts","../../index.tsx"],"sourcesContent":["import { lazy, type ComponentType, type LazyExoticComponent } from 'react';\n\n// After a redeploy the hashed chunk filenames change and the old chunks 404.\n// A tab opened before the deploy (or a browser/CDN that served a stale\n// index.html) then fails its first dynamic import with a \"Failed to fetch\n// dynamically imported module\" / \"error loading dynamically imported module\"\n// TypeError, which bubbles to the ErrorBoundary as \"Something went wrong\".\n//\n// lazyWithReload retries the import once, then force-reloads the page a single\n// time (guarded by sessionStorage so we never loop) to pull a fresh\n// index.html with valid chunk hashes. This is the standard Vite stale-chunk\n// recovery and turns a hard error into a transparent reload.\n\nconst RELOAD_KEY = 'appnz:chunk-reload-at';\nconst RELOAD_WINDOW_MS = 15_000;\n\nfunction isChunkLoadError(err: unknown): boolean {\n const msg = err instanceof Error ? err.message : String(err ?? '');\n return (\n /Failed to fetch dynamically imported module/i.test(msg) ||\n /error loading dynamically imported module/i.test(msg) ||\n /Importing a module script failed/i.test(msg) ||\n /'?text\\/html'? is not a valid JavaScript MIME type/i.test(msg)\n );\n}\n\nexport function lazyWithReload>(\n factory: () => Promise<{ default: T }>,\n): LazyExoticComponent {\n return lazy(async () => {\n try {\n return await factory();\n } catch (err) {\n if (!isChunkLoadError(err) || typeof window === 'undefined') throw err;\n // Retry once in case it was a transient network blip rather than a deploy.\n try {\n return await factory();\n } catch (retryErr) {\n if (!isChunkLoadError(retryErr)) throw retryErr;\n let last = 0;\n try {\n last = Number(window.sessionStorage.getItem(RELOAD_KEY) || 0);\n } catch {\n /* sessionStorage blocked (private mode) — fall through and reload */\n }\n if (Date.now() - last > RELOAD_WINDOW_MS) {\n try {\n window.sessionStorage.setItem(RELOAD_KEY, String(Date.now()));\n } catch {\n /* ignore */\n }\n window.location.reload();\n // Keep Suspense pending until the reload swaps the document.\n return new Promise<{ default: T }>(() => {});\n }\n // Already reloaded recently and still failing — surface the real error.\n throw retryErr;\n }\n }\n });\n}\n","import {\n Activity,\n Bot,\n Cloud,\n Code2,\n Cpu,\n CreditCard,\n Database,\n Hammer,\n Eye,\n Globe,\n Inbox,\n KeyRound,\n Layers,\n MessageSquare,\n MonitorCog,\n Network,\n ScrollText,\n Server,\n ShieldCheck,\n Terminal,\n Workflow,\n Library,\n Box,\n Clapperboard,\n} from 'lucide-react';\n\nexport interface PlatformRoute {\n path: string;\n label: string;\n eyebrow: string;\n title: string;\n description: string;\n icon: typeof Cloud;\n primaryAction?: string;\n /** In-app surface the primary CTA opens. See platformCtaHref. */\n appHref?: string;\n command?: string;\n cards: Array<{\n title: string;\n body: string;\n }>;\n}\n\nexport const platformRoutes: PlatformRoute[] = [\n {\n path: '/chat',\n label: 'Chat',\n eyebrow: 'chat & research',\n title: 'AI chat with live web search and deep research.',\n description: 'Ask questions, attach files, search the live web, run multi-step research, and query papers. Models, citations, and history in one workspace.',\n icon: MessageSquare,\n primaryAction: 'Start chatting',\n appHref: '/assistants',\n command: 'app chat \"research R2-backed model hosting\" --web --deep --papers',\n cards: [\n { title: 'Everyday chat', body: 'Fast answers with saved history, your choice of model, and file or image context.' },\n { title: 'Web search', body: 'Current, cited answers from the web. Choose your provider and how fresh results should be.' },\n { title: 'Deep research', body: 'Start a research run that searches, reads sources, and hands you a report you can trust, with citations.' },\n ],\n },\n {\n path: '/projects',\n label: 'Projects',\n eyebrow: 'your workspace',\n title: 'One project for repos, agents, deploys, and keys.',\n description: 'Group apps, repos, coding agents, domains, and API keys in one workspace. Billing, deploy history, and agent runs stay together.',\n icon: Layers,\n primaryAction: 'Create a project',\n appHref: '/apps',\n command: 'app api GET /api/me',\n cards: [\n { title: 'Start in minutes', body: 'Begin with one app, then add teammates, roles, and environments when you need them.' },\n { title: 'Grows with you', body: 'Each area starts simple and scales into a real product without relearning anything.' },\n { title: 'Same everywhere', body: 'The CLI and the web app do the same things, so your scripts and clicks always match.' },\n ],\n },\n {\n path: '/auth',\n label: 'Auth',\n eyebrow: 'identity for your apps',\n title: 'Add Sign in with app.nz without running an auth service.',\n description: 'Register browser, mobile, or server apps, choose exact callback URLs and scopes, and let app.nz handle accounts, consent, PKCE, sessions, and user profiles.',\n icon: ShieldCheck,\n primaryAction: 'Register an app',\n appHref: '/developers',\n command: \"import { createAuthClient } from 'https://app.nz/appnz-auth.js'\",\n cards: [\n { title: 'Firebase-style client', body: 'A small hosted JavaScript client manages PKCE, callback state, token storage, currentUser, and auth-state listeners.' },\n { title: 'Safe public clients', body: 'Browser and mobile apps never receive a secret. Authorization Code + PKCE S256 is mandatory.' },\n { title: 'Scoped by consent', body: 'Each app gets only the profile, credit, or key capabilities the user approved, with exact redirect matching.' },\n ],\n },\n {\n path: '/sites',\n label: 'Sites',\n eyebrow: 'pages',\n title: 'Build and publish a site right in your browser.',\n description: 'Create a page, edit the HTML, CSS, and JS in the builder, and publish instantly to app.nz/sites//. No build step, no DNS wait.',\n icon: Globe,\n primaryAction: 'Open the builder',\n appHref: '/sites',\n command: 'app sites create my-landing-page --title \"My landing page\"',\n cards: [\n { title: 'Live in one click', body: 'Your site goes live the moment you save.' },\n { title: 'Edit in the browser', body: 'A multi-file editor with live preview. Nothing to install.' },\n { title: 'Let an agent help', body: 'Hand a page to a coding agent, then review the published result.' },\n ],\n },\n {\n path: '/deploys',\n label: 'Deploys',\n eyebrow: 'AI app hosting',\n title: 'Deploy AI apps, APIs, workers, and preview branches.',\n description: 'Ship containers to managed CPU and GPU in minutes. Scale into inference, custom build runners, and model endpoints as your product grows.',\n icon: Cloud,\n primaryAction: 'Deploy an app',\n // Deploys are driven by `app apps deploy`; go straight to setup instead of\n // bouncing signed-in users through /signup and back to this marketing page.\n appHref: '/docs#cli',\n command: 'app apps deploy ./my-ai-app',\n cards: [\n { title: 'Your own subdomain', body: 'Claim a name like my-ai-app.app.nz, point it at a deploy, and get HTTPS automatically.' },\n { title: 'Safe by design', body: 'Your secrets stay protected while your code builds and runs, and agent commands run in a sandbox.' },\n { title: 'Easy rollback', body: 'Every deploy keeps its commit, image, logs, and last working version, so you can roll back fast.' },\n ],\n },\n {\n path: '/cogs',\n label: 'Cogs',\n eyebrow: 'GPU model hosting',\n title: 'Run any Cog container as a scale-to-zero GPU endpoint.',\n description: 'Deploy an arbitrary Cog or ML container and serve it through app.nz. Autoscale from zero, use published app.nz pricing, queue requests automatically, and get an auto-generated upload/paste UI for every model.',\n icon: Cpu,\n primaryAction: 'Deploy a cog',\n appHref: '/cogs',\n command: 'app api POST /api/cogs \\'{\"name\":\"fast-vfx\",\"image\":\"r8.im/lee101/fast-vfx\",\"hardware\":\"gpu-rtx4090\"}\\'',\n cards: [\n { title: 'Bring any cog', body: 'Point at a Cog image and run it unchanged. Inputs and outputs come through as-is — video, image, audio, or JSON.' },\n { title: 'Scale to zero', body: 'An idle model costs nothing. The first prediction warms a GPU pod; it sleeps again after a quiet window.' },\n { title: 'Queue API included', body: 'Every Cog gets /queue/join, pollable prediction status, queue position, and the same generated UI automatically.' },\n ],\n },\n {\n path: '/comfy',\n label: 'Comfy',\n eyebrow: 'ComfyUI hosting',\n title: 'Deploy ComfyUI workflows as scale-to-zero GPU endpoints.',\n description: 'Paste a ComfyUI API-format workflow, mirror referenced models to R2, map public inputs, and serve it through app.nz with serverless-to-pod routing and direct warm-pod editor access.',\n icon: Cpu,\n primaryAction: 'Create a workflow endpoint',\n appHref: '/comfy',\n command: 'app api POST /api/comfy \\'{\"name\":\"sdxl-workflow\",\"hardware\":\"auto\",\"mode\":\"auto\"}\\'',\n cards: [\n { title: 'Bring any workflow', body: 'Use ComfyUI Save (API Format), inspect referenced checkpoints and LoRAs, then expose only the inputs your API needs.' },\n { title: 'Serverless to pod', body: 'Low RPS stays on serverless workers; sustained traffic promotes to a warm pod and scales back to zero after idle.' },\n { title: 'Model cache included', body: 'Mirror known model files to R2, reuse them across deployments, and pin heavy workflows to a dedicated machine when needed.' },\n ],\n },\n {\n path: '/spaces/splat',\n label: 'Splat',\n eyebrow: '3D capture',\n title: 'Photos in, gaussian splat out — with mesh export.',\n description: 'Upload 2-64 photos and get a gaussian splat you can orbit in the browser, plus point cloud and textured GLB mesh downloads. Pose-free VGGT init and gsplat refinement, flat per-capture pricing instead of a subscription.',\n icon: Box,\n primaryAction: 'Create a capture',\n appHref: '/spaces/splat',\n command: 'app api POST /api/splat/jobs \\'{\"imageUrls\":[\"https://…/1.jpg\",\"https://…/2.jpg\"],\"tier\":\"quality\"}\\'',\n cards: [\n { title: 'Pose-free pipeline', body: 'No COLMAP wait: VGGT recovers cameras and dense geometry in one pass, gsplat refines to a clean splat in minutes.' },\n { title: 'View and export', body: 'Orbit the splat in-browser, then download .splat, .ply point cloud, or a textured GLB mesh from TSDF fusion.' },\n { title: 'Per-capture pricing', body: 'Fast $0.25, Quality with mesh $0.75. Competitors charge $13-30/mo subscriptions for the same exports.' },\n ],\n },\n {\n path: '/spaces/fast-video',\n label: 'Fast Video',\n eyebrow: 'accelerated video gen',\n title: 'LTX-2.3 video generation at a fraction of API prices.',\n description: 'Distilled 8-step FP8 LTX-2.3 with SageAttention on scale-to-zero RunPod GPUs. Text or image to video with native audio, up to 4K and 20 seconds, billed per second of output — 1080p at $0.025/s versus $0.04-0.06 elsewhere.',\n icon: Clapperboard,\n primaryAction: 'Generate a video',\n appHref: '/spaces/fast-video',\n command: 'app api POST /api/fastvideo/generations \\'{\"prompt\":\"waves at dusk\",\"resolution\":\"1080p\",\"seconds\":5}\\'',\n cards: [\n { title: '8-step distilled', body: 'CFG-free distilled sampling plus FP8 weights: about 4 GPU-seconds per second of 720p video on an RTX 5090.' },\n { title: 'Audio + 4K', body: 'Native synced audio generation and a spatial upscaler stage for 1440p and 4K outputs.' },\n { title: 'Per-second billing', body: 'Pay only for output seconds. 48fps bills 1.5x; serverless workers scale to zero between jobs.' },\n ],\n },\n {\n path: '/builds',\n label: 'Builds',\n eyebrow: 'container CI + registry',\n title: 'Build containers on our cloud, push to your private registry.',\n description: 'Build cog and app images on app.nz\\'s own autoscaling builder fleet and push them to your private namespace in app.nz\\'s registry. No third-party pull auth, nothing public.',\n icon: Hammer,\n primaryAction: 'Start a build',\n appHref: '/builds',\n command: 'app api POST /api/builds \\'{\"image\":\"my-cog\",\"tag\":\"latest\",\"dockerfile\":\"FROM scratch\"}\\'',\n cards: [\n { title: 'Your own registry', body: 'Images push to a private per-user namespace. Pods pull them with a credential you store once.' },\n { title: 'Autoscaling builders', body: 'The builder fleet scales up with the queue and to zero when idle, balanced across boxes.' },\n { title: 'Straight into inference', body: 'A pushed image drops into Cog Studio and runs on a scale-to-zero GPU.' },\n ],\n },\n {\n path: '/agents',\n label: 'Agents',\n eyebrow: 'cloud coding agents',\n title: 'Autonomous coding agents in the cloud.',\n description: 'Point an agent at a repo and describe the work in plain English. It branches, codes, tests, opens a pull request, and keeps going until you approve or stop it.',\n icon: Bot,\n primaryAction: 'Run an agent',\n appHref: '/agent',\n command: 'app agent run --prompt \"fix the failed deploy\" --repo acme/api --model openpaths/auto-code',\n cards: [\n { title: 'You set the guardrails', body: 'Pick model, machine size, branch, skills, spend cap, and timeout, and choose whether PRs merge automatically.' },\n { title: 'Visual proof before merge', body: 'VisualBench captures screenshots, lets the agent self-correct the UI, and only asks you when it looks right.' },\n { title: 'Audit every run', body: 'Logs, diffs, screenshots, and cost for each task, so you know exactly what shipped.' },\n ],\n },\n {\n path: '/skills',\n label: 'Skills',\n eyebrow: 'searchable skill library',\n title: 'Search a library of ready-to-run agent skills.',\n description: 'Semantically search hundreds of self-contained skills. Author your own gist-like skills (install prompt + optional script + use prompt), or copy one and hand it to any agent.',\n icon: Library,\n primaryAction: 'Search skills',\n appHref: '/skills',\n command: 'app skills search \"code review\"',\n cards: [\n { title: 'Semantic search', body: 'Fast local gobed embeddings rank skills by meaning, not just keywords — with a SQL fallback so results always come back.' },\n { title: 'Self-contained', body: 'Every skill is prepended with a \"## Setup\" git-clone preamble so the markdown is runnable standalone.' },\n { title: 'API + CLI', body: 'Query /api/skills/search from anything, or use app skills search. The same index also powers the openpaths gateway.' },\n ],\n },\n {\n path: '/gateway',\n label: 'Gateway',\n eyebrow: 'model gateway',\n title: 'One OpenAI-compatible API for every model and provider.',\n description: 'Route chat, embeddings, images, audio, web search, and paper search through app.nz. Automatic model choice, failover, usage metering, and hosted endpoints, all on one API key.',\n icon: Network,\n primaryAction: 'Create a key',\n appHref: '/api-keys',\n command: 'app gateway models',\n cards: [\n { title: 'One simple API', body: 'OpenAI-compatible chat, embeddings, images, vision, and search. Switch providers without rewriting code.' },\n { title: 'Smart routing', body: 'Send each request to the right model: auto, code, cheap, fast, reasoning, deep search, image, or vision.' },\n { title: 'Clear costs', body: 'See spend by project, key, app, and agent run.' },\n ],\n },\n {\n path: '/pricing',\n label: 'Pricing',\n eyebrow: 'usage-based credits',\n title: 'Usage-based pricing. Prepay credits, pay for what you use.',\n description: 'One prepaid balance covers coding agents, model routing, GPU hosting, compute, and search. Pay by token or second, with optional plans for bundled credits and guaranteed machines.',\n icon: CreditCard,\n primaryAction: 'Manage credits',\n appHref: '/account',\n command: 'app credits buy --packs 25',\n cards: [\n { title: 'One balance, everything', body: 'Agents, models, GPU hosting, compute, and search all draw from the same prepaid credits. 1 credit = $0.001.' },\n { title: 'Metered, with caps', body: 'Pay per token and per second. Set spend caps per project, key, app, or agent run so there are no surprises.' },\n { title: 'Plans are optional', body: 'Pro, Ultra & Max bundle monthly credits at a better rate plus guaranteed machines — usage beyond them just continues at list price.' },\n ],\n },\n {\n path: '/workers',\n label: 'Workers',\n eyebrow: 'compute',\n title: 'CPU and GPU workers for builds, agents, and inference.',\n description: 'Join machines to the app.nz cloud for app builds, agent sandboxes, hosted model inference, and batch jobs, with heartbeats, caps, and live logs.',\n icon: Server,\n primaryAction: 'Add a worker',\n appHref: '/cli',\n command: 'app api GET /api/platform/status?test=true',\n cards: [\n { title: 'CPU workers', body: 'Build apps, run services and tests, and host previews.' },\n { title: 'GPU workers', body: 'Run hosted models, generate images and video, and run batch inference.' },\n { title: 'Always accountable', body: 'Workers report in, pick up jobs, stream logs, and respect your caps.' },\n ],\n },\n {\n path: '/queues',\n label: 'Queues',\n eyebrow: 'queues',\n title: 'Task queues that feed agents and workers.',\n description: 'Push JSON jobs from your app or CLI. Workers and cloud coding agents lease, process, retry, and acknowledge messages, or turn each message into an agent task automatically.',\n icon: Inbox,\n primaryAction: 'Create a queue',\n appHref: '/docs#api',\n command: 'app api POST /api/queues \\'{\"name\":\"orders\",\"dispatch\":\"agent\"}\\'',\n cards: [\n { title: 'SQS-style by default', body: 'Visibility timeouts, retries, dead-letter, and delivery delays, without running your own broker.' },\n { title: 'Producers and consumers', body: 'Send messages over the API or CLI; consumers anywhere lease, ack, and retry with an API key.' },\n { title: 'Drive agents directly', body: 'Point a queue at agents and every message turns into a coding-agent task automatically.' },\n ],\n },\n {\n path: '/domains',\n label: 'Domains',\n eyebrow: 'domains',\n title: 'Every app gets an app.nz subdomain. Add your own later.',\n description: 'Claim a free subdomain, point it at a deploy, and spin up preview URLs for branches and agent tasks.',\n icon: Globe,\n primaryAction: 'Claim a name',\n appHref: '/apps',\n command: 'app sites create my-ai-app --title \"My AI App\"',\n cards: [\n { title: 'Claim in seconds', body: 'Pick an available name and we set up the DNS and HTTPS for you.' },\n { title: 'Preview links', body: 'Branch and task deploys get their own URLs, like pr-42-my-ai-app.app.nz, that expire on their own.' },\n { title: 'Bring your domain', body: 'Connect a custom domain with guided verification and automatic certificates.' },\n ],\n },\n {\n path: '/secrets',\n label: 'Secrets',\n eyebrow: 'keys & secrets',\n title: 'Keep your keys and secrets safe.',\n description: 'Store API keys and secrets once. Each app, deploy, and agent only ever sees the ones it needs.',\n icon: KeyRound,\n primaryAction: 'Set a secret',\n appHref: '/api-keys',\n command: 'app keys create --name deploy-bot',\n cards: [\n { title: 'Scoped access', body: 'Limit each secret to a project, environment, app, deploy, or agent task.' },\n { title: 'Full audit trail', body: 'See who changed what, when a secret was used, and when it was last rotated.' },\n { title: 'Encrypted, always', body: 'Values are encrypted at rest, and ready to move to your own vault whenever you want.' },\n ],\n },\n {\n path: '/logs',\n label: 'Logs',\n eyebrow: 'logs',\n title: 'One place to watch deploys, apps, agents, and model calls.',\n description: 'Every part of your project leaves a clear trail you can search from the web app, the CLI, or an agent.',\n icon: ScrollText,\n primaryAction: 'Tail your logs',\n appHref: '/agent',\n command: 'app agent list',\n cards: [\n { title: 'Everything in one stream', body: 'See the event, source, severity, time, and links to artifacts.' },\n { title: 'Agents can read it too', body: 'Agents pull deploy logs, failures, screenshots, and CI output through one API.' },\n { title: 'Faster answers', body: 'A clear record makes problems quick to find and quick to fix.' },\n ],\n },\n {\n path: '/billing',\n label: 'Billing',\n eyebrow: 'credits',\n title: 'One balance for hosting, agents, and model usage.',\n description: 'Credits cover deploys, workers, gateway calls, GPU jobs, and agent tasks, with reports you can hand to anyone.',\n icon: CreditCard,\n primaryAction: 'Manage credits',\n appHref: '/account',\n command: 'app billing usage',\n cards: [\n { title: 'Set your limits', body: 'Cap spend per project, app, agent task, or hosted model.' },\n { title: 'Easy to reconcile', body: 'An append-only record makes every charge easy to trace.' },\n { title: 'Add expert help', body: 'Bring on managed onboarding, migrations, or custom agents when you need them.' },\n ],\n },\n {\n path: '/docs',\n label: 'Docs',\n eyebrow: 'docs',\n title: 'Documentation for the app.nz AI agent cloud.',\n description: 'Learn by task: run coding agents, call the model gateway, deploy apps, manage keys, and use the CLI, with API examples that match production routes.',\n icon: Code2,\n primaryAction: 'Read the docs',\n appHref: '/docs',\n command: 'app --help',\n cards: [\n { title: 'Organized by task', body: 'Find docs by what you are trying to do, not by how it is built.' },\n { title: 'Start simple', body: 'Begin with the basics and go deeper only when you need to.' },\n { title: 'Always current', body: 'Docs track the API, so what you read matches what you run.' },\n ],\n },\n {\n path: '/cli',\n label: 'CLI',\n eyebrow: 'terminal',\n title: 'CLI for agents, sites, keys, queues, and the model gateway.',\n description: 'Install one small binary to run coding agents, publish sites, rotate keys, inspect queues, call the gateway, and reach any endpoint with app api. Same workflows as the web app, easy to script.',\n icon: Terminal,\n primaryAction: 'Install the CLI',\n appHref: '/cli',\n command: 'curl -fsSL https://app.nz/cli.sh | sh',\n cards: [\n { title: 'Run the real surface', body: 'login, plans, credits, RA1, papers, search, gateway models, agents, queues, sites, and keys.' },\n { title: 'Drive agents', body: 'Launch a coding agent with a prompt, repo, and model, then list tasks from scripts or terminals.' },\n { title: 'Use the escape hatch', body: 'app api METHOD /path JSON reaches platform endpoints before they get a dedicated command.' },\n ],\n },\n {\n path: '/consulting',\n label: 'Consulting',\n eyebrow: 'expert help',\n title: 'Expert help when you want to move faster.',\n description: 'Get hands-on help shipping, and every engagement leaves you with something reusable.',\n icon: MonitorCog,\n primaryAction: 'Start a buildout',\n appHref: '/docs#cli',\n command: 'app agent run --prompt \"turn this repo into an app.nz deploy\" --model openpaths/auto-code',\n cards: [\n { title: 'Migrations', body: 'Move your AI apps onto app.nz hosting, keys, deploys, and monitoring.' },\n { title: 'Custom agents', body: 'Build agents tuned to your code, data, support, or operations.' },\n { title: 'Private infrastructure', body: 'Run dedicated CPU and GPU machines just for your team.' },\n ],\n },\n {\n path: '/schema',\n label: 'Reliability',\n eyebrow: 'built to last',\n title: 'Built on a solid, tested foundation.',\n description: 'app.nz runs on a typed, tested data layer designed to stay reliable as you grow.',\n icon: Database,\n primaryAction: 'See how it works',\n appHref: '/docs',\n command: 'go test ./...',\n cards: [\n { title: 'Tested by default', body: 'Upgrades are tested ahead of time, so changes do not surprise you.' },\n { title: 'Consistent behavior', body: 'One typed model keeps the product predictable everywhere.' },\n { title: 'Ready to scale', body: 'Designed to grow from small projects to heavy production use.' },\n ],\n },\n {\n path: '/security',\n label: 'Security',\n eyebrow: 'security',\n title: 'Your code, agents, and secrets stay separated.',\n description: 'app.nz keeps your app code, agent commands, and secrets in their own zones, so a problem in one never reaches the others.',\n icon: ShieldCheck,\n primaryAction: 'See the model',\n appHref: '/docs',\n command: 'app keys rotate',\n cards: [\n { title: 'Secrets stay protected', body: 'Accounts, billing, and secrets are handled in one trusted place.' },\n { title: 'Work runs with limits', body: 'Builds, deploys, and inference run with only the access they need.' },\n { title: 'Untrusted code is sandboxed', body: 'Agent and app commands run with tight limits on network, files, and time.' },\n ],\n },\n {\n path: '/visualbench',\n label: 'VisualBench',\n eyebrow: 'visual review',\n title: 'Visual proof for agent UI changes.',\n description: 'VisualBench captures before-and-after screenshots, compares them in the agent run, and lets coding agents self-correct the interface before you approve a merge.',\n icon: Eye,\n primaryAction: 'View latest run',\n appHref: '/visualbench',\n command: 'bun run visualbench -- http://127.0.0.1:3000/',\n cards: [\n { title: 'Before and after', body: 'Screenshots, diffs, and the exact page each one came from.' },\n { title: 'Self-correcting', body: 'The agent reviews its own screenshots, fixes the code, and tries again.' },\n { title: 'Approve with confidence', body: 'Make a passing visual check a required step before any deploy.' },\n ],\n },\n {\n path: '/status',\n label: 'Status',\n eyebrow: 'status',\n title: 'Know that app.nz is up.',\n description: 'Check the health of app.nz, the gateway, workers, queues, deploys, and model routing at a glance.',\n icon: Activity,\n primaryAction: 'Check health',\n appHref: '/docs',\n command: 'curl https://app.nz/healthz',\n cards: [\n { title: 'Core health', body: 'API, database, queues, and sign-in status.' },\n { title: 'Gateway health', body: 'Provider availability, fallbacks, latency, and errors.' },\n { title: 'Worker health', body: 'Active machines, capacity, GPU availability, and regions.' },\n ],\n },\n {\n path: '/workflows',\n label: 'Workflows',\n eyebrow: 'automation',\n title: 'Turn repeated work into one-click workflows.',\n description: 'Save the steps you do again and again: migrate a repo, add billing, ship a UI change, fix a deploy, or run VisualBench.',\n icon: Workflow,\n primaryAction: 'Run a workflow',\n appHref: '/agent',\n command: 'app agent run --prompt \"run the migrate-to-appnz workflow\" --repo acme/api --model openpaths/auto-code',\n cards: [\n { title: 'Reusable recipes', body: 'Save your steps once and rerun them whenever you need.' },\n { title: 'Built-in approvals', body: 'Require logs, screenshots, a cost summary, and sign-off before anything ships.' },\n { title: 'Share the work', body: 'Turn expert workflows into templates your whole team can use.' },\n ],\n },\n];\n\nexport const platformRouteByPath = Object.fromEntries(\n platformRoutes.map((route) => [route.path, route]),\n) as Record;\n\n// Destination for a route with no appHref of its own. Never the route's own\n// path: a CTA pointing back at its own page is what created the signup bounce\n// (marketing page -> /signup -> already authenticated -> same marketing page).\nconst CTA_FALLBACK_HREF = '/docs#cli';\n\nexport function platformCtaHref(route: PlatformRoute, authenticated: boolean): string {\n const destination = route.appHref || CTA_FALLBACK_HREF;\n if (authenticated) return destination;\n return `/signup?next=${encodeURIComponent(destination)}`;\n}\n","import { Network, Bot, Box, Globe, KeyRound, Laptop, NotebookPen, GitBranch, Cpu, FileText, Image, ShieldCheck, Terminal } from 'lucide-react';\n\n// Shared API-reference data for /docs (the PlatformDocs list) and the per-endpoint\n// deep-link pages at /docs/{slug} (EndpointDoc). Every endpoint below is backed by\n// a live route in the Go control plane (server/main.go, server/agents.go,\n// server/sites.go) or by the OpenAI-compatible model gateway. Keep this in sync\n// with those handlers — and with the slug mirror in server/sitemap.go\n// (sitemapDocEndpoints) that lists each page in /sitemap.xml.\n\nexport type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport interface Endpoint {\n method: Method;\n path: string;\n summary: string;\n auth?: 'key' | 'session' | 'none';\n // noDoc marks URL-pattern rows (public file serving) that are not callable API\n // endpoints, so they stay plain rows with no /docs/{slug} page or sitemap entry.\n noDoc?: boolean;\n}\n\nexport interface Param {\n name: string;\n type: string;\n required?: boolean;\n desc: string;\n}\n\nexport interface DocSection {\n id: string;\n label: string;\n icon: typeof Network;\n title: string;\n intro: string;\n baseUrl?: string;\n endpoints?: Endpoint[];\n params?: { heading: string; rows: Param[] };\n example?: { label: string; code: string };\n}\n\nexport const sections: DocSection[] = [\n {\n id: 'auth',\n label: 'Auth & keys',\n icon: KeyRound,\n title: 'Authentication',\n intro:\n 'Use account API keys for unattended servers and OAuth for people. `app login` is a native public-client flow with PKCE; its api-scoped token works across the CLI, REST API, desktop cloud bridge, and MCP. To authenticate users in your own app, register a client at /developers. Browser, hosted subdomain, and mobile clients are secretless and require PKCE S256; server clients exchange with a one-time client secret. The hosted appnz-auth.js client provides Firebase-style sign-in, current-user, token, and auth-state helpers.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/keys', summary: 'List keys (metadata only, no secrets)', auth: 'key' },\n { method: 'POST', path: '/api/keys', summary: 'Create a key; response includes the one-time secret', auth: 'key' },\n { method: 'POST', path: '/api/keys/rotate', summary: 'Rotate by id, by name, or all at once', auth: 'key' },\n { method: 'DELETE', path: '/api/keys?id=key_123', summary: 'Revoke a key', auth: 'key' },\n { method: 'GET', path: '/api/me', summary: 'Current account for the supplied key or session', auth: 'key' },\n { method: 'GET', path: '/authorize', summary: 'Start Sign in with app.nz (Authorization Code + PKCE)', auth: 'none', noDoc: true },\n { method: 'POST', path: '/token', summary: 'Exchange a one-use code for a scoped access token', auth: 'none', noDoc: true },\n { method: 'GET', path: '/userinfo', summary: 'Load the profile granted to an OAuth access token', auth: 'key', noDoc: true },\n { method: 'POST', path: '/introspect', summary: 'Server apps validate their app-scoped access tokens or API keys', auth: 'none', noDoc: true },\n { method: 'POST', path: '/revoke', summary: 'Revoke an OAuth token on sign-out', auth: 'none', noDoc: true },\n { method: 'GET', path: '/api/oauth/keys', summary: 'List API keys owned by the authorized app (keys:manage)', auth: 'key', noDoc: true },\n { method: 'GET', path: '/.well-known/oauth-authorization-server', summary: 'OAuth provider discovery metadata', auth: 'none', noDoc: true },\n ],\n example: {\n label: 'Create a key and call the API',\n code: `# Create a key (secret returned once)\ncurl -sX POST https://app.nz/api/keys \\\\\n -H \"Authorization: Bearer $APP_API_KEY\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"name\":\"deploy bot\"}'\n\n# Use it on every other request\ncurl -s https://app.nz/api/me \\\\\n -H \"Authorization: Bearer pk_live_...\"`,\n },\n },\n {\n id: 'developer-apps',\n label: 'Developer apps',\n icon: ShieldCheck,\n title: 'Sign in with app.nz',\n intro:\n 'Give your product app.nz accounts without building identity infrastructure. Register the app and its exact callback URLs in the Developer Apps console, choose the smallest set of scopes it needs, then use Authorization Code with PKCE. Browser, hosted-site, mobile, desktop, and CLI clients are public clients and never receive a secret; confidential server apps exchange the code on their backend.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/authorize', summary: 'Start authorization with response_type=code and a PKCE S256 challenge', auth: 'none', noDoc: true },\n { method: 'POST', path: '/token', summary: 'Exchange a one-use authorization code and PKCE verifier', auth: 'none', noDoc: true },\n { method: 'GET', path: '/userinfo', summary: 'Read the profile granted to the current access token', auth: 'key', noDoc: true },\n { method: 'POST', path: '/introspect', summary: 'Let a confidential app validate an app-scoped token', auth: 'none', noDoc: true },\n { method: 'POST', path: '/revoke', summary: 'Revoke the current access token during sign-out', auth: 'none', noDoc: true },\n { method: 'GET', path: '/.well-known/oauth-authorization-server', summary: 'OAuth authorization-server discovery metadata', auth: 'none', noDoc: true },\n ],\n params: {\n heading: 'Setup checklist',\n rows: [\n { name: 'Redirect URL', type: 'exact URL', required: true, desc: 'Register every production and local callback exactly. Hosted sites normally use https://.app.nz/auth/callback.' },\n { name: 'profile', type: 'scope', required: true, desc: 'Stable account id, email, and handle for the signed-in person.' },\n { name: 'api', type: 'scope', desc: 'Call app.nz REST APIs and authenticated MCP tools as that person.' },\n { name: 'credits:read', type: 'scope', desc: 'Read the person’s credit balance and this app’s ledger entries.' },\n { name: 'credits:spend', type: 'scope', desc: 'Charge the person’s app.nz balance for work your app performs.' },\n { name: 'keys:manage', type: 'server scope', desc: 'Create and revoke API keys owned by the app; confidential server apps only.' },\n ],\n },\n example: {\n label: 'Browser and hosted-site quickstart',\n code: `import { createAuthClient } from 'https://app.nz/appnz-auth.js';\n\nconst auth = createAuthClient({\n clientId: 'YOUR_CLIENT_ID',\n redirectUri: window.location.origin + '/auth/callback',\n scopes: ['profile', 'api'],\n});\n\n// Sign-in button\nawait auth.signIn({ returnTo: '/dashboard' });\n\n// On /auth/callback\nconst result = await auth.handleRedirect();\nif (result) window.location.replace(result.returnTo);\n\n// Restore the user and call app.nz with the saved access token\nconst user = await auth.getUser();\nconst response = await auth.fetch('/api/me');`,\n },\n },\n {\n id: 'cli',\n label: 'CLI',\n icon: Terminal,\n title: 'The app CLI',\n intro:\n 'Every endpoint in these docs is scriptable from one small binary. The CLI shares keys with the API and web app, streams chat, deploys apps and sites, drives coding agents, and mirrors the gh command layout for repos, issues, PRs, and releases. Any command takes --json; anything without a dedicated command is reachable via app api. The full command reference lives at /cli.',\n params: {\n heading: 'Core commands',\n rows: [\n { name: 'app login', type: 'auth', desc: 'Open app.nz in the browser, authorize with PKCE, and save the scoped login; app whoami verifies.' },\n { name: 'app apps deploy [dir]', type: 'hosting', desc: 'Package + build + release an appnz.yaml app (static or server runtime) at .app.nz.' },\n { name: 'app apps logs ', type: 'hosting', desc: 'Build and runtime logs for the latest (or a given) deploy.' },\n { name: 'app apps marketplace [query]', type: 'hosting', desc: 'Browse apps and games built on or showcased by app.nz.' },\n { name: 'app apps publish [slug] --url ', type: 'hosting', desc: 'Instantly enrich a hosted app card or publish an external community app with automatic OG metadata discovery.' },\n { name: 'app sites deploy ', type: 'hosting', desc: 'Mirror a directory of static files to a hosted site.' },\n { name: 'app agent run --prompt \"...\" --repo o/n', type: 'agents', desc: 'Launch a cloud coding agent; get/list/cancel manage tasks.' },\n { name: 'app chat \"...\" [--web] [--deep]', type: 'models', desc: 'Streamed chat through the gateway; --model pins a route.' },\n { name: 'app api [json]', type: 'escape hatch', desc: 'Call any documented endpoint directly.' },\n ],\n },\n example: {\n label: 'Install, build with an agent, deploy a game',\n code: `curl -fsSL https://app.nz/cli.sh | sh\napp login\n\n# hand the build to a cloud agent\napp agent run --prompt \"build a neon snake HTML5 game\" --repo you/neon-snake\n\n# pull the agent's files, then ship to https://neon-snake.app.nz\napp agent apply --dir ./neon-snake\napp apps deploy ./neon-snake`,\n },\n },\n {\n id: 'models',\n label: 'Models gateway',\n icon: Network,\n title: 'Models gateway',\n intro:\n 'An OpenAI- and Anthropic-compatible API in front of 15+ providers. OpenAI clients use https://app.nz/v1; Claude Code and Anthropic Agent SDK use the root https://app.nz because they append /v1/messages. Use app/auto to select a model and thinking depth from the prompt, or pin a provider model. Stable long Anthropic prefixes are cached automatically while explicit cache controls are preserved.',\n baseUrl: 'https://app.nz/v1',\n endpoints: [\n { method: 'POST', path: '/v1/chat/completions', summary: 'Chat completions (streaming + tools)', auth: 'key' },\n { method: 'POST', path: '/v1/messages', summary: 'Anthropic-compatible messages (supports thinking)', auth: 'key' },\n { method: 'GET', path: '/v1/models', summary: 'List routable models and aliases', auth: 'key' },\n { method: 'POST', path: '/v1/embeddings', summary: 'Text embeddings', auth: 'key' },\n { method: 'POST', path: '/v1/images/generations', summary: 'Image generation', auth: 'key' },\n { method: 'POST', path: '/v1/videos/generations', summary: 'Video generation', auth: 'key' },\n { method: 'POST', path: '/v1/videos/edits', summary: 'Video editing', auth: 'key' },\n { method: 'POST', path: '/v1/videos/extensions', summary: 'Video extension', auth: 'key' },\n { method: 'GET', path: '/v1/videos/{request_id}', summary: 'Poll xAI video jobs', auth: 'key' },\n { method: 'POST', path: '/v1/music/generations', summary: 'Music generation', auth: 'key' },\n { method: 'POST', path: '/v1/audio/generations', summary: 'Audio and SFX generation', auth: 'key' },\n { method: 'POST', path: '/v1/3d/generations', summary: 'Image-to-3D GLB generation', auth: 'key' },\n { method: 'POST', path: '/v1/panoramas/generations', summary: 'Image-to-360 panorama or spatial-world generation', auth: 'key' },\n { method: 'POST', path: '/v1/audio/speech', summary: 'Text-to-speech', auth: 'key' },\n { method: 'POST', path: '/v1/audio/transcriptions', summary: 'Audio transcription', auth: 'key' },\n { method: 'POST', path: '/v1/search', summary: 'Web and papers search', auth: 'key' },\n { method: 'POST', path: '/api/audio/generate', summary: 'Generate music or SFX and save to the indexed audio library', auth: 'key' },\n { method: 'GET', path: '/api/audio/search?q=rain', summary: 'Semantic + keyword search over generated public/own audio', auth: 'none' },\n { method: 'GET', path: '/api/audio', summary: 'List recent public/own generated audio', auth: 'none' },\n ],\n params: {\n heading: 'Model routes (the model field)',\n rows: [\n { name: 'app/auto', type: 'route', desc: 'Default. Reads the prompt and picks the backend.' },\n { name: 'app/auto-code', type: 'route', desc: 'Bias toward strong coding models.' },\n { name: 'app/auto-fast', type: 'route', desc: 'Lowest latency for interactive use.' },\n { name: 'app/auto-cheap', type: 'route', desc: 'Bias toward lowest cost per token.' },\n { name: 'app/auto-reasoning', type: 'route', desc: 'Route reasoning depth automatically.' },\n { name: 'app/auto-vision', type: 'route', desc: 'Bias toward image-input models.' },\n { name: 'app/auto-image', type: 'route', desc: 'Bias toward image-generation models.' },\n { name: 'routing_strategy', type: 'param', desc: 'price by default; use config to preserve catalogue order or app/auto-fast for latency bias.' },\n { name: 'provider/model', type: 'pin', desc: 'Pin a specific upstream model, e.g. anthropic/claude or openai/gpt.' },\n ],\n },\n example: {\n label: 'Chat completion with auto routing',\n code: `curl -s https://app.nz/v1/chat/completions \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\n \"model\": \"app/auto\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Explain CRDTs in one paragraph.\"}],\n \"reasoning_effort\": \"auto\",\n \"stream\": false\n }'`,\n },\n },\n {\n id: 'comfy',\n label: 'ComfyUI workflows',\n icon: Image,\n title: 'ComfyUI workflow API',\n intro:\n 'Discover and download tested API-format graphs, deploy one as a scale-to-zero GPU endpoint, and poll hosted output artifacts. app.nz API Input and API Output nodes make typed names part of the graph itself; deployment workflows and their contracts persist in the platform database and can be exported exactly. Serverless workers use pinned reviewed node packs and never install arbitrary plugin code at runtime. The public catalogue includes a ten-part foundations course plus twelve multimedia Creative Systems Labs.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/comfy/tutorials', summary: 'List the 10-part course with runnable workflow links', auth: 'none' },\n { method: 'GET', path: '/api/comfy/labs', summary: 'List 12 multimedia labs with runnable workflow links', auth: 'none' },\n { method: 'GET', path: '/api/comfy/plugins', summary: 'List pinned serverless and recommended editable-pod node packs', auth: 'none' },\n { method: 'GET', path: '/api/comfy/spaces', summary: 'List vetted workflows, inputs, provenance, VRAM, and verification', auth: 'none' },\n { method: 'GET', path: '/api/comfy/spaces/{slug}', summary: 'Get one API-format graph and its complete contract', auth: 'none' },\n { method: 'GET', path: '/api/comfy/spaces/{slug}/download', summary: 'Download exact runnable workflow JSON', auth: 'none' },\n { method: 'POST', path: '/api/comfy/spaces/{slug}/deploy', summary: 'Deploy a gallery workflow', auth: 'key' },\n { method: 'GET', path: '/api/comfy/models?q=proteus', summary: 'Search model sources and global mirror state', auth: 'none' },\n { method: 'POST', path: '/api/comfy/{deployment_id}/run', summary: 'Queue named workflow inputs', auth: 'key' },\n { method: 'GET', path: '/api/comfy/{deployment_id}/download', summary: 'Export the exact persisted deployment workflow', auth: 'key' },\n { method: 'GET', path: '/api/comfy/runs/{run_id}', summary: 'Poll timing, cost, errors, and output artifacts', auth: 'key' },\n ],\n params: {\n heading: 'Gallery deploy and run fields',\n rows: [\n { name: 'name', type: 'string', desc: 'Optional deployment name; defaults to the workflow slug.' },\n { name: 'hardware', type: 'string', desc: 'GPU machine type or auto.' },\n { name: 'mode', type: 'string', desc: 'auto | serverless | pod | local | dedicated.' },\n { name: 'inputs', type: 'object', desc: 'Named values from the selected workflow apiInputs contract.' },\n { name: 'apiOutputs', type: 'array', desc: 'Named output node contract; matching files include the same name.' },\n { name: 'image/video/audio', type: 'string', desc: 'Public URL or artifact: for mapped media inputs.' },\n ],\n },\n example: {\n label: 'Run image, audio-reactive, or talking-character graphs',\n code: `# Proteus V0.4: deploy the tested seven-node SDXL workflow\ncurl -sX POST https://app.nz/api/comfy/spaces/proteus-v04-text-to-image/deploy \\\\\n -H \"Authorization: Bearer $APP_API_KEY\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"mode\":\"auto\",\"name\":\"proteus-course\"}'\n\n# Queue named inputs using the deployment id returned above\ncurl -sX POST https://app.nz/api/comfy/DEPLOYMENT_ID/run \\\\\n -H \"Authorization: Bearer $APP_API_KEY\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"inputs\":{\"prompt\":\"ceramic observatory under an aurora\",\"seed\":42,\"steps\":24,\"cfg\":5}}'\n\n# CuteDSL-accelerated Z-Image Turbo uses the same contract\ncurl -sX POST https://app.nz/api/comfy/spaces/cute-zimage-turbo/deploy \\\\\n -H \"Authorization: Bearer $APP_API_KEY\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"mode\":\"auto\"}'\n\n# CPU audio-reactive frames: map a worker audio file to spectrum animation\ncurl -sX POST https://app.nz/api/comfy/spaces/audio-reactive-visualizer/deploy \\\\\n -H \"Authorization: Bearer $APP_API_KEY\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"mode\":\"auto\"}'\n\n# Inspect the talking-character graph and its open-source dependencies first\ncurl -s https://app.nz/api/comfy/spaces/liveavatar-talking-character | jq '.space.apiInputs, .space.openSource'`,\n },\n },\n {\n id: 'agents',\n label: 'Agents',\n icon: Bot,\n title: 'Agents API',\n intro:\n 'Run cloud coding agents against a repo and a prompt, then poll status, stream step events, inspect changed files, and cancel or retry. GET /api/agents/config returns the option lists (engines, models, reasoning efforts, machine types, providers, skills) and needs no auth so a UI can render the form before sign-in.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/agents/config', summary: 'Option lists for the agent form', auth: 'none' },\n { method: 'POST', path: '/api/agents/tasks', summary: 'Launch an agent task', auth: 'key' },\n { method: 'GET', path: '/api/agents/tasks', summary: 'List your agent tasks', auth: 'key' },\n { method: 'GET', path: '/api/agents/tasks/{id}', summary: 'Get a task with its current status', auth: 'key' },\n { method: 'GET', path: '/api/agents/tasks/{id}/events', summary: 'Step-by-step events and status', auth: 'key' },\n { method: 'POST', path: '/api/agents/tasks/{id}/cancel', summary: 'Cancel a running task', auth: 'key' },\n { method: 'POST', path: '/api/agents/tasks/{id}/retry', summary: 'Retry a finished or failed task', auth: 'key' },\n { method: 'GET', path: '/api/agents/tasks/{id}/files', summary: 'List files the agent changed', auth: 'key' },\n { method: 'PUT', path: '/api/agents/tasks/{id}/files/{fileId}', summary: 'Edit a changed file before review', auth: 'key' },\n ],\n params: {\n heading: 'POST /api/agents/tasks body',\n rows: [\n { name: 'prompt', type: 'string', required: true, desc: 'What the agent should do (max 20k chars).' },\n { name: 'source', type: 'string', desc: 'Provider that runs it: openpaths (default, our cloud) | devin | cursor | codex-cloud. See the Agents SDK section.' },\n { name: 'repo', type: 'string', desc: 'Target repo as owner/name.' },\n { name: 'branch', type: 'string', desc: 'Working branch to create or use.' },\n { name: 'baseBranch', type: 'string', desc: 'Branch to base the work on.' },\n { name: 'model', type: 'string', desc: 'Model route, e.g. app/auto-code.' },\n { name: 'engine', type: 'string', desc: 'Agent engine (see /config).' },\n { name: 'reasoningEffort', type: 'string', desc: 'none | low | medium | high | xhigh | auto.' },\n { name: 'machineType', type: 'string', desc: 'Worker capability tier (see /config), e.g. auto, cpx32, gpu-a100, or win-cpx32 for a Windows worker.' },\n { name: 'provider', type: 'string', desc: 'Execution tier, e.g. shared (auto fleet), cloud CPU, or cloud GPU (see /config).' },\n { name: 'skills', type: 'string[]', desc: 'Enabled skills, e.g. [\"github\",\"visualbench\"].' },\n { name: 'autoMergePr', type: 'boolean', desc: 'Auto-merge the PR when checks pass.' },\n { name: 'autoNextSteps', type: 'boolean', desc: 'Let the agent queue follow-up steps.' },\n { name: 'spendCapUsd', type: 'number', desc: 'Hard spend ceiling for the task.' },\n { name: 'timeoutSeconds', type: 'number', desc: 'Wall-clock timeout.' },\n { name: 'projectId', type: 'string', desc: 'Project to bill and scope to; defaults to your default project.' },\n { name: 'title', type: 'string', desc: 'Display title; derived from the prompt if omitted.' },\n ],\n },\n example: {\n label: 'Launch an agent',\n code: `curl -sX POST https://app.nz/api/agents/tasks \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\n \"prompt\": \"add usage analytics to the dashboard\",\n \"repo\": \"acme/ai-dashboard\",\n \"model\": \"app/auto-code\",\n \"reasoningEffort\": \"high\",\n \"machineType\": \"auto\",\n \"provider\": \"shared\",\n \"skills\": [\"github\", \"visualbench\"],\n \"spendCapUsd\": 2.00,\n \"autoMergePr\": false\n }'`,\n },\n },\n {\n id: 'agents-sdk',\n label: 'Agents SDK',\n icon: Bot,\n title: 'Agents SDK — one API, every provider',\n intro:\n 'The same /api/agents surface is a meta-agent router: set `source` to choose who runs the task. openpaths (the default) runs it on app.nz workers using our model credentials — which take precedence over any provider key when running in our cloud — and opens PRs through our GitHub app. devin, cursor, and codex-cloud launch the run on that vendor and the result (status, logs, diff, pull request) normalizes back into the same task — so every provider reads through one trace. GET /api/agents/config returns `sources` plus a `sourcesConfigured` map so a UI can disable providers that lack server credentials.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/agents/config', summary: 'Sources + which are configured, plus models/engines', auth: 'none' },\n { method: 'POST', path: '/api/agents/tasks', summary: 'Launch on any provider via the source field', auth: 'key' },\n { method: 'GET', path: '/api/agents/tasks', summary: 'List your runs across all providers', auth: 'key' },\n { method: 'GET', path: '/api/agents/tasks/{id}', summary: 'Normalized trace: steps, messages, diff, PR', auth: 'key' },\n { method: 'POST', path: '/api/agents/tasks/{id}/cancel', summary: 'Cancel a running task', auth: 'key' },\n ],\n params: {\n heading: 'Source values',\n rows: [\n { name: 'openpaths', type: 'source', desc: 'Default. Runs on app.nz workers with our credentials; engine selects Claude Code / Codex / Gemini. Real PRs via our GitHub app.' },\n { name: 'devin', type: 'source', desc: 'Launches a Devin cloud session. Needs server DEVIN_API_KEY + DEVIN_ORG_ID.' },\n { name: 'cursor', type: 'source', desc: 'Launches a Cursor cloud agent with auto-PR. Needs server CURSOR_API_KEY.' },\n { name: 'codex-cloud', type: 'source', desc: 'Launches an OpenAI Codex Cloud task against a GitHub-connected repo. Needs CODEX_CLOUD_ENV_ID + the codex CLI.' },\n ],\n },\n example: {\n label: 'Launch on Devin (or swap source for cursor / codex-cloud / openpaths)',\n code: `curl -sX POST https://app.nz/api/agents/tasks \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\n \"source\": \"devin\",\n \"prompt\": \"fix failing CI and open a pull request\",\n \"repo\": \"lee101/edukids\",\n \"baseBranch\": \"main\",\n \"autoMergePr\": false\n }'\n\n# CLI equivalent:\n# app agents-sdk run \"fix failing CI and open a PR\" --source devin --repo lee101/edukids\n# app agents-sdk providers # see which providers are configured\n# app agents-sdk logs # read the normalized trace`,\n },\n },\n {\n id: 'local-workers',\n label: 'Local workers',\n icon: Laptop,\n title: 'Local workers — run agent tasks on your own machines',\n intro:\n 'Run `app worker` on any computer after `app login` and it becomes a private worker for your account: it polls app.nz, leases agent tasks created with provider \"local\", executes them with local engines (our codex fork with automatic fallback to mainline codex, claude, cursor-agent, gemini, grok), and reports steps/diffs/PRs into the normal task trace. Leasing is user-scoped: your workers authenticate every /api/worker call with your API key and only ever see jobs whose user matches your account; fleet workers use the shared X-Worker-Token and never lease provider=local jobs. Job payloads and logs pass through secret redaction, and only allowlisted engines execute. By default a local worker takes only your provider=local jobs; --any-provider opts it into all of your jobs.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/agents/workers', summary: 'List your registered machines with online state and activeJobs', auth: 'session', noDoc: true },\n { method: 'POST', path: '/api/worker/register', summary: 'Worker announces itself (Bearer API key for user workers; X-Worker-Token for the fleet)', auth: 'key', noDoc: true },\n { method: 'POST', path: '/api/worker/heartbeat', summary: 'Liveness + active job count; drives the online indicator', auth: 'key', noDoc: true },\n { method: 'POST', path: '/api/worker/lease', summary: 'Atomically claim the oldest runnable job you own', auth: 'key', noDoc: true },\n { method: 'POST', path: '/api/worker/complete', summary: 'Report a leased job result', auth: 'key', noDoc: true },\n { method: 'POST', path: '/api/worker/job-creds', summary: 'Short-lived credentials for a leased job', auth: 'key', noDoc: true },\n ],\n params: {\n heading: 'app worker flags',\n rows: [\n { name: '--name ', type: 'string', desc: 'Machine display name; defaults to the hostname.' },\n { name: '--dir ', type: 'string', desc: 'Working directory for repo checkouts.' },\n { name: '--engines ', type: 'string', desc: 'Comma-separated engine allowlist, e.g. codex,claude. Defaults to every installed engine.' },\n { name: '--any-provider', type: 'boolean', desc: 'Also lease your non-local (cloud-queued) jobs, not just provider=local.' },\n { name: '--poll ', type: 'duration', desc: 'Poll interval for the lease loop.' },\n { name: '--lease ', type: 'integer', desc: 'Max jobs to run concurrently.' },\n { name: '--once', type: 'boolean', desc: 'Lease at most one job, run it, exit (cron-friendly).' },\n { name: '--dry-run', type: 'boolean', desc: 'Show what would be leased and run without executing.' },\n { name: 'app worker status', type: 'command', desc: 'List your machines, online state, and active jobs from the CLI.' },\n ],\n },\n example: {\n label: 'Turn a desktop into a worker, then fire a task at it from anywhere',\n code: `# on the machine that will do the coding\napp login\napp worker --name desktop --dir ~/agent-work --engines codex,claude\n\n# from any device (or the /agent composer with provider \"Your machine\")\napp agent run --prompt \"add a /health endpoint with a test\" \\\\\n --repo you/api --provider local --model app/auto-code\n\n# see your machines (same data as the studio chips)\napp worker status\ncurl -s https://app.nz/api/agents/workers -H \"Authorization: Bearer pk_live_...\"`,\n },\n },\n {\n id: 'artifacts',\n label: 'Artifacts',\n icon: FileText,\n title: 'Artifacts API',\n intro:\n 'Create, update, list, share, and delete user artifacts. Supported kinds are drawing, doc, sheet, pdf, image, and file. Documents store Markdown text and open in /write; sheets store JSON grid data and open in /sheets, so agents can produce editable office documents directly.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/artifacts', summary: 'List artifacts visible to you; optional ?kind=doc or ?kind=sheet', auth: 'key' },\n { method: 'POST', path: '/api/artifacts', summary: 'Create an artifact', auth: 'key' },\n { method: 'GET', path: '/api/artifacts/{id}', summary: 'Fetch one visible artifact', auth: 'key' },\n { method: 'PUT', path: '/api/artifacts/{id}', summary: 'Update one of your artifacts', auth: 'key' },\n { method: 'DELETE', path: '/api/artifacts/{id}', summary: 'Delete one of your artifacts', auth: 'key' },\n { method: 'POST', path: '/api/artifacts/{id}/share', summary: 'Create or rotate a public share token', auth: 'key' },\n { method: 'DELETE', path: '/api/artifacts/{id}/share', summary: 'Remove the public share token', auth: 'key' },\n { method: 'GET', path: '/api/artifacts/shared/{token}', summary: 'Fetch a shared artifact by token', auth: 'none' },\n ],\n params: {\n heading: 'Artifact body',\n rows: [\n { name: 'kind', type: 'string', required: true, desc: 'drawing | doc | sheet | pdf | image | file.' },\n { name: 'title', type: 'string', required: true, desc: 'Display title.' },\n { name: 'mime', type: 'string', desc: 'MIME type, e.g. text/markdown for doc or application/json for sheet.' },\n { name: 'data', type: 'string', desc: 'Inline data. Documents use Markdown; sheets use JSON grid data.' },\n { name: 'url', type: 'string', desc: 'Optional https:// or app-relative URL for binary artifacts.' },\n { name: 'teamId', type: 'string', desc: 'Optional team visibility scope.' },\n ],\n },\n example: {\n label: 'Create editable document and sheet artifacts',\n code: `curl -sX POST https://app.nz/api/artifacts \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"kind\":\"doc\",\"title\":\"Runbook\",\"mime\":\"text/markdown\",\"data\":\"# Runbook\\\\n\\\\nShip it.\"}'\n\ncurl -sX POST https://app.nz/api/artifacts \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"kind\":\"sheet\",\"title\":\"Budget\",\"mime\":\"application/json\",\"data\":\"[{\\\"name\\\":\\\"Sheet1\\\",\\\"rows\\\":{\\\"0\\\":{\\\"cells\\\":{\\\"0\\\":{\\\"text\\\":\\\"Item\\\"},\\\"1\\\":{\\\"text\\\":\\\"Cost\\\"}}}}}]\"}'`,\n },\n },\n {\n id: 'media-optimizer',\n label: 'Media optimizer',\n icon: Image,\n title: 'Media optimizer API',\n intro:\n 'Cloudflare-style image resizing and AV1-first video re-encoding over your app.nz artifact filesystem. Optimize an existing artifact or a public HTTPS URL, save generated variants back into /artifacts, and serve best-size images through a dynamic URL that negotiates AVIF, WebP, JPEG, or PNG from the Accept header. The same optimizer is available as a Cog image for isolated GPU worker pools.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/media/optimizer/config', summary: 'Optimizer presets, encoder availability, and public pricing metadata', auth: 'none' },\n { method: 'POST', path: '/api/media/optimizer/estimate', summary: 'Estimate variants and credits without running an encode', auth: 'none' },\n { method: 'POST', path: '/api/media/optimize', summary: 'Generate image/video variants and save them into your artifact filesystem', auth: 'key' },\n { method: 'POST', path: '/v1/media/optimizations', summary: 'OpenAI-style alias for POST /api/media/optimize', auth: 'key' },\n { method: 'GET', path: '/api/media/image/{artifact_id}', summary: 'Dynamic best-size image transform: ?w=640&format=auto&q=85', auth: 'key' },\n ],\n params: {\n heading: 'Optimization body',\n rows: [\n { name: 'artifactId', type: 'string', desc: 'Source artifact to read. Required unless url is supplied.' },\n { name: 'url', type: 'string', desc: 'Public HTTPS source URL. Private/reserved network targets are rejected.' },\n { name: 'kind', type: 'string', desc: 'image | video. Inferred from MIME/extension when omitted.' },\n { name: 'widths', type: 'int[]', desc: 'Image widths to generate. Default: [320,640,960,1280].' },\n { name: 'heights', type: 'int[]', desc: 'Video ladder heights. Default: [360,720,1080].' },\n { name: 'formats', type: 'string[]', desc: 'Image: webp | avif | jpeg | png. Video: webm | av1 | mp4.' },\n { name: 'quality', type: 'int', desc: '1-100 quality target; defaults to 85 for images.' },\n { name: 'outputPath', type: 'string', desc: 'Artifact directory for generated variants; defaults to /optimized.' },\n { name: 'dryRun', type: 'boolean', desc: 'Return the plan and estimated credits without encoding.' },\n ],\n },\n example: {\n label: 'Generate responsive variants and build the Cog image',\n code: `# Save responsive image variants back into /artifacts.\ncurl -sX POST https://app.nz/api/media/optimize \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\n \"artifactId\": \"artifact_123\",\n \"kind\": \"image\",\n \"widths\": [320, 640, 1280],\n \"formats\": [\"webp\"],\n \"outputPath\": \"/optimized\"\n }'\n\n# Dynamic best-size image URL.\ncurl -L \"https://app.nz/api/media/image/artifact_123?w=640&format=auto&q=85\" \\\\\n -H \"Authorization: Bearer pk_live_...\"\n\n# CLI equivalents.\napp media optimize --artifact-id artifact_123 --width 640 --width 1280 --format webp\napp media pricing\napp builds media-optimizer-cog`,\n },\n },\n {\n id: 'assistants',\n label: 'Character chat',\n icon: Bot,\n title: 'Character chat API',\n intro:\n 'Start chats with any character by url_name or id, pin a model for that chat, and stream replies over the same server-sent-events shape as the OpenAI-compatible gateway. User-created characters can include long-form text or Markdown documents; app.nz strips image links, chunks the text, stores it in the character vector-search boundary, and retrieves relevant excerpts for each turn.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/search-ais?q=luna&limit=20', summary: 'Find characters by name, title, tags, or description', auth: 'none' },\n { method: 'GET', path: '/api/get-ai-by-name?name=luna', summary: 'Load one character by url_name or display name', auth: 'none' },\n { method: 'POST', path: '/api/characters', summary: 'Create a user-owned character and ingest text/Markdown docs', auth: 'key' },\n { method: 'PATCH', path: '/api/characters/{url_name}', summary: 'Update your character and optionally replace indexed docs', auth: 'key' },\n { method: 'POST', path: '/api/assistant/chats', summary: 'Create a chat for a character with a chosen model', auth: 'key' },\n { method: 'POST', path: '/api/assistant/chats/{id}/messages', summary: 'Send a turn and stream the character reply', auth: 'key' },\n { method: 'GET', path: '/api/assistant/chats/{id}', summary: 'Reload a chat and its active branch', auth: 'key' },\n ],\n params: {\n heading: 'Character and chat bodies',\n rows: [\n { name: 'name', type: 'string', required: true, desc: 'POST /api/characters display name.' },\n { name: 'system_prompt', type: 'string', desc: 'Optional persona prompt; generated from name/description/greeting if omitted.' },\n { name: 'documents', type: 'array', desc: 'Optional long-form docs: [{ \"name\": \"lore.md\", \"content\": \"# Markdown...\" }]. Alias: knowledge_docs.' },\n { name: 'character_url_name', type: 'string', required: true, desc: 'POST /api/assistant/chats target character slug.' },\n { name: 'model', type: 'string', desc: 'Model or route for this chat, e.g. app/auto or app/auto-fast.' },\n { name: 'reasoning_effort', type: 'string', desc: 'auto | off | low | medium | high | xhigh.' },\n { name: 'content', type: 'string', required: true, desc: 'Message text for POST /messages.' },\n ],\n },\n example: {\n label: 'Create a documented character and talk to it with a model',\n code: `# Create a character with long-form Markdown knowledge.\ncurl -sX POST https://app.nz/api/characters \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\n \"name\": \"GPU Brain Operator\",\n \"description\": \"Helps operate the gpu-brain search stack.\",\n \"voice\": \"Kore\",\n \"documents\": [{\n \"name\": \"runbook.md\",\n \"content\": \"# Runbook\\\\nUse gobed for low-latency KNN over text chunks. Never ingest image links.\"\n }]\n }'\n\n# Start a chat with a given model.\nCHAT=$(curl -sX POST https://app.nz/api/assistant/chats \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\n \"character_url_name\": \"gpu-brain-operator\",\n \"model\": \"app/auto-fast\",\n \"reasoning_effort\": \"auto\"\n }' | jq -r .chat.id)\n\n# Send a message. The response is text/event-stream; relevant doc excerpts are\n# retrieved server-side before the model call.\ncurl -N -sX POST https://app.nz/api/assistant/chats/$CHAT/messages \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"content\":\"What should I check if KNN search looks stale?\"}'`,\n },\n },\n {\n id: 'repos',\n label: 'Repos',\n icon: GitBranch,\n title: 'Repos API — git & GitHub parity',\n intro:\n 'GitHub-parity repo hosting on real bare git repositories: clone and push over standard git smart HTTP (git clone https://app.nz/{owner}/{name}.git), plus issues, pull requests with inline line-anchored review comments, a git-backed wiki, releases, labels, Actions-style secrets/variables, and branch-protection rulesets. Read endpoints (repo detail, git browsing, issues/pulls/releases/labels/rulesets, wiki) work with no key at all for public repos — the same code path renders the showcase browser for signed-out visitors — and need a key with read access (owner or a team member) for private ones. Everything that mutates state needs a key with write access, except fork and star, which only need any signed-in reader. Mentioning @agent (or @codex, @claude, @bot, /agent, /fix, /review) in a pull-request comment launches a coding agent on that PR\\'s branch and posts a bot reply linking the task.',\n baseUrl: 'https://app.nz',\n endpoints: [\n // Repo CRUD + discovery\n { method: 'GET', path: '/api/repos', summary: 'List your repos', auth: 'key' },\n { method: 'POST', path: '/api/repos', summary: 'Create a repo (name, description, visibility, org)', auth: 'key' },\n { method: 'GET', path: '/api/repos/explore', summary: 'Public repos for the showcase grid (?kind=code|dataset|model&sort=stars|recent)', auth: 'none' },\n { method: 'GET', path: '/api/repos/search', summary: 'Search public repos by name/description (?q=)', auth: 'none' },\n { method: 'GET', path: '/api/repos/lookup/{owner}/{name}', summary: 'Resolve owner/name to a repo (for pretty URLs)', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}', summary: 'Repo detail — issues, pulls, branches, recent commits', auth: 'none' },\n { method: 'PATCH', path: '/api/repos/{id}', summary: 'Edit name, description, visibility, defaultBranch, imageUrl', auth: 'key' },\n { method: 'DELETE', path: '/api/repos/{id}', summary: 'Archive (soft-delete) a repo', auth: 'key' },\n { method: 'POST', path: '/api/repos/{id}/fork', summary: 'Fork into your namespace (real bare-git clone, full history)', auth: 'key' },\n { method: 'GET', path: '/api/repos/{id}/star', summary: 'Viewer’s star state and total count', auth: 'none' },\n { method: 'PUT', path: '/api/repos/{id}/star', summary: 'Star the repo', auth: 'key' },\n { method: 'DELETE', path: '/api/repos/{id}/star', summary: 'Unstar the repo', auth: 'key' },\n // Git browsing (read-only, backed by the real bare repo on disk)\n { method: 'GET', path: '/api/repos/{id}/git/branches', summary: 'List branches', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/git/tree', summary: 'Directory listing (?ref=&path=&withCommits=1)', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/git/paths', summary: 'Flat file-path list for a fuzzy finder (?ref=)', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/git/blob', summary: 'File content, size, language, latest commit (?ref=&path=)', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/git/raw', summary: 'Raw file bytes with a sniffed content-type (?ref=&path=)', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/git/log', summary: 'Commit history (?ref=&path=&limit=)', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/git/commit/{sha}', summary: 'Commit metadata plus its file diff', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/git/diff', summary: 'Diff and commit range between two refs (?base=&head=)', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/git/readme', summary: 'Rendered README lookup for a ref/path', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/git/search', summary: 'Code search — semantic by default, ?mode=keyword for git grep (?q=&limit=)', auth: 'none' },\n // Branches & commits bookkeeping (real code changes are pushed over git, not these)\n { method: 'POST', path: '/api/repos/{id}/branches', summary: 'Create a branch (name, from)', auth: 'key' },\n { method: 'POST', path: '/api/repos/{id}/commits', summary: 'Record a commit entry (branch, message) — bookkeeping only, not a real git commit', auth: 'key' },\n // Issues\n { method: 'GET', path: '/api/repos/{id}/issues', summary: 'List issues (?state=open|closed|all)', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/issues/{number}', summary: 'Issue detail with its comment thread', auth: 'none' },\n { method: 'POST', path: '/api/repos/{id}/issues', summary: 'Open an issue (title, body)', auth: 'key' },\n { method: 'PATCH', path: '/api/repos/{id}/issues/{number}', summary: 'Set state (state: open|closed)', auth: 'key' },\n { method: 'POST', path: '/api/repos/{id}/issues/{number}/comments', summary: 'Comment on an issue (body)', auth: 'key' },\n // Pull requests\n { method: 'GET', path: '/api/repos/{id}/pulls', summary: 'List pull requests (?state=open|closed|all)', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/pulls/{number}', summary: 'Pull request detail with its comment thread', auth: 'none' },\n { method: 'POST', path: '/api/repos/{id}/pulls', summary: 'Open a PR (title, body, sourceBranch, targetBranch)', auth: 'key' },\n { method: 'PATCH', path: '/api/repos/{id}/pulls/{number}', summary: 'Set state (state: open|closed|merged — merged performs a real git fast-forward or merge commit)', auth: 'key' },\n { method: 'GET', path: '/api/repos/{id}/pulls/{number}/comments', summary: 'List PR comments, including line-anchored review comments', auth: 'none' },\n { method: 'POST', path: '/api/repos/{id}/pulls/{number}/comments', summary: 'Post a PR comment, optionally anchored to a diff line (body, filePath, lineStart, lineEnd, side)', auth: 'key' },\n // Wiki (git-backed: every save is a real commit to a sibling *.wiki.git repo)\n { method: 'GET', path: '/api/repos/{id}/wiki', summary: 'List wiki pages', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/wiki/pages/{slug}', summary: 'Get a wiki page', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/wiki/pages/{slug}/history', summary: 'Page history from the wiki git repo', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/wiki/search', summary: 'Search wiki pages (?q=)', auth: 'none' },\n { method: 'PUT', path: '/api/repos/{id}/wiki/pages/{slug}', summary: 'Create or update a page (title, body, message)', auth: 'key' },\n { method: 'DELETE', path: '/api/repos/{id}/wiki/pages/{slug}', summary: 'Delete a page', auth: 'key' },\n // Releases\n { method: 'GET', path: '/api/repos/{id}/releases', summary: 'List releases', auth: 'none' },\n { method: 'GET', path: '/api/repos/{id}/releases/{tag}', summary: 'Get one release', auth: 'none' },\n { method: 'POST', path: '/api/repos/{id}/releases', summary: 'Create a release (tag, name, body, target, prerelease, draft)', auth: 'key' },\n { method: 'PATCH', path: '/api/repos/{id}/releases/{tag}', summary: 'Update a release', auth: 'key' },\n { method: 'DELETE', path: '/api/repos/{id}/releases/{tag}', summary: 'Delete a release', auth: 'key' },\n // Labels, secrets, variables, rulesets (CI/collaboration parity)\n { method: 'GET', path: '/api/repos/{id}/labels', summary: 'List labels', auth: 'none' },\n { method: 'POST', path: '/api/repos/{id}/labels', summary: 'Create a label (name, color, description)', auth: 'key' },\n { method: 'DELETE', path: '/api/repos/{id}/labels/{name}', summary: 'Delete a label', auth: 'key' },\n { method: 'GET', path: '/api/repos/{id}/secrets', summary: 'List secret names — values are write-only and never returned', auth: 'key' },\n { method: 'POST', path: '/api/repos/{id}/secrets', summary: 'Set a secret (name, value)', auth: 'key' },\n { method: 'DELETE', path: '/api/repos/{id}/secrets/{name}', summary: 'Delete a secret', auth: 'key' },\n { method: 'GET', path: '/api/repos/{id}/variables', summary: 'List variables (values are readable)', auth: 'key' },\n { method: 'POST', path: '/api/repos/{id}/variables', summary: 'Set a variable (name, value)', auth: 'key' },\n { method: 'DELETE', path: '/api/repos/{id}/variables/{name}', summary: 'Delete a variable', auth: 'key' },\n { method: 'GET', path: '/api/repos/{id}/rulesets', summary: 'List branch-protection rulesets', auth: 'none' },\n { method: 'POST', path: '/api/repos/{id}/rulesets', summary: 'Create a ruleset (name, targetBranch, requirePr, requireChecks, blockForcePush)', auth: 'key' },\n { method: 'DELETE', path: '/api/repos/{id}/rulesets/{name}', summary: 'Delete a ruleset', auth: 'key' },\n // Real git, over smart HTTP — not JSON, but the canonical way to move code\n { method: 'GET', path: 'https://app.nz/{owner}/{name}.git/info/refs', summary: 'git clone/pull ref advertisement (git clone https://app.nz/{owner}/{name}.git)', auth: 'none', noDoc: true },\n { method: 'POST', path: 'https://app.nz/{owner}/{name}.git/git-receive-pack', summary: 'git push — HTTP Basic auth, an API key as the password', auth: 'key', noDoc: true },\n ],\n params: {\n heading: 'Access levels',\n rows: [\n { name: 'read', type: 'level', desc: 'Anyone, for public repos; owner + team viewers for private ones. Covers repo detail, git browsing, issues/pulls/releases/labels/rulesets, and wiki reads.' },\n { name: 'write', type: 'level', desc: 'Owner, global admins, or a team member/admin on the repo’s governing org. Required for branches, commits, issues, pulls, wiki writes, labels, secrets, variables, rulesets, releases.' },\n { name: 'fork / star', type: 'level', desc: 'Any signed-in reader — no write access required.' },\n { name: 'admin', type: 'level', desc: 'Owner or global admin. Required to edit or delete the repo itself.' },\n ],\n },\n example: {\n label: 'Create a repo, push real git, open a PR, ask an agent to fix something',\n code: `# Create the repo (private by default)\ncurl -sX POST https://app.nz/api/repos \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"name\":\"my-app\",\"description\":\"demo\",\"visibility\":\"public\"}'\n# -> {\"repo\":{\"id\":\"repo_...\",\"fullName\":\"you/my-app\",...}}\n\n# Real git — clone/push over smart HTTP, an API key as the Basic-auth password\ngit clone https://app.nz/you/my-app.git\ncd my-app && git checkout -b feature/x && git commit --allow-empty -m x\ngit push https://token:pk_live_...@app.nz/you/my-app.git feature/x\n\n# Open a PR against main\ncurl -sX POST https://app.nz/api/repos/repo_.../pulls \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"title\":\"Add feature x\",\"sourceBranch\":\"feature/x\",\"targetBranch\":\"main\"}'\n\n# @mention an agent on the PR thread — it launches on the PR branch and replies\ncurl -sX POST https://app.nz/api/repos/repo_.../pulls/1/comments \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"body\":\"@agent add input validation and a test for the empty case\"}'`,\n },\n },\n {\n id: 'sites',\n label: 'Sites',\n icon: Globe,\n title: 'Sites API',\n intro:\n 'Publish a static app at .app.nz. Create with AI or upload a ZIP in the web UI, deploy a folder with `app sites deploy my-site ./dist`, or use the API below. Static publishing needs no funds. Files publish immediately; each file can be up to 64 MB.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/sites', summary: 'List your sites', auth: 'key' },\n { method: 'POST', path: '/api/sites', summary: 'Create a site (seeds a starter)', auth: 'key' },\n { method: 'GET', path: '/api/sites/{id}', summary: 'Get a site with its files', auth: 'key' },\n { method: 'DELETE', path: '/api/sites/{id}', summary: 'Delete a site', auth: 'key' },\n { method: 'PUT', path: '/api/sites/{id}/files', summary: 'Create or update a file (publishes)', auth: 'key' },\n { method: 'DELETE', path: '/api/sites/{id}/files?path=app.js', summary: 'Delete a file', auth: 'key' },\n { method: 'GET', path: '/sites/{slug}/{path}', summary: 'Public serving — no auth, defaults to index.html', auth: 'none', noDoc: true },\n { method: 'GET', path: 'https://{slug}.app.nz/{path}', summary: 'Public serving on the site’s own subdomain (SPA-friendly)', auth: 'none', noDoc: true },\n ],\n params: {\n heading: 'Request bodies',\n rows: [\n { name: 'slug', type: 'string', required: true, desc: 'POST /api/sites — public name; normalized to a valid slug.' },\n { name: 'title', type: 'string', desc: 'POST /api/sites — display title (max 120 chars).' },\n { name: 'path', type: 'string', required: true, desc: 'PUT files — file path, e.g. index.html or css/app.css.' },\n { name: 'content', type: 'string', desc: 'PUT files — UTF-8 file contents (max 8 MB). Use for text files.' },\n { name: 'contentBase64', type: 'string', desc: 'PUT files — base64 bytes for binary files (images, fonts, audio).' },\n { name: 'contentType', type: 'string', desc: 'PUT files — overrides the type inferred from the extension.' },\n ],\n },\n example: {\n label: 'Deploy a built site with the CLI (or raw curl)',\n code: `# Easiest: push a whole build directory with the app CLI. It creates the\n# site on first run, uploads every text file, and prunes anything removed.\napp login\nbun run build # e.g. Vite -> dist/\napp sites deploy my-app dist --title \"My app\"\n# Live at https://app.nz/sites/my-app/\n# and https://my-app.app.nz/\n\n# Or drive the REST API directly:\nSITE=$(curl -sX POST https://app.nz/api/sites \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"slug\":\"my-landing\",\"title\":\"My landing\"}')\n\nID=$(echo \"$SITE\" | jq -r .site.id)\n\n# Publish index.html — live at /sites/my-landing/ and my-landing.app.nz\ncurl -sX PUT https://app.nz/api/sites/$ID/files \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"path\":\"index.html\",\"content\":\"

Hi

\"}'`,\n },\n },\n {\n id: 'cogs',\n label: 'Cogs',\n icon: Cpu,\n title: 'Cogs API — GPU model hosting',\n intro:\n 'Run an arbitrary Cog container as an autoscaling, scale-to-zero inference endpoint. Register any compliant image once, or use POST /api/cogs/run to atomically ensure a vetted template and queue work in one call. Low traffic can use serverless workers; sustained demand promotes to a warm pod through the GPU router shared with ComfyUI. The idle reaper checks active predictions before terminating the worker, and every response exposes an immediate sleep path. Comfy graphs use template:name references, so durable workflows never contain pod ids or endpoints. Media travels as HTTPS URLs or data URIs, making Pocket TTS, Fish Speech, Audex speech-to-speech, image, video, and 3D Cogs first-class.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/cogs/config', summary: 'GPU hardware catalogue, starter templates, output kinds, markup', auth: 'none' },\n { method: 'GET', path: '/api/cogs', summary: 'List your registered models', auth: 'key' },\n { method: 'POST', path: '/api/cogs', summary: 'Register a model (name, image, hardware, schema, idleSeconds, minVramGb)', auth: 'key' },\n { method: 'POST', path: '/api/cogs/run', summary: 'Ensure a vetted template or use modelId, then queue inference with scale-to-zero lifecycle metadata', auth: 'key' },\n { method: 'POST', path: '/api/cogs/spaces/import', summary: 'Discover a Gradio Hugging Face Space and deploy its published image with generated API/UI and scale-to-zero', auth: 'key' },\n { method: 'GET', path: '/api/cogs/{id}', summary: 'Model detail plus its 20 most recent predictions', auth: 'key' },\n { method: 'DELETE', path: '/api/cogs/{id}', summary: 'Delete a model (tears down any warm pod first)', auth: 'key' },\n { method: 'POST', path: '/api/cogs/{id}/warm', summary: 'Proactively cold-start the pod', auth: 'key' },\n { method: 'POST', path: '/api/cogs/{id}/sleep', summary: 'Scale the model to zero now', auth: 'key' },\n { method: 'POST', path: '/api/cogs/{id}/predict', summary: 'Run a prediction asynchronously (input) — poll for the result', auth: 'key' },\n { method: 'GET', path: '/api/cogs/{id}/predictions', summary: 'List a model’s recent predictions (up to 50)', auth: 'key' },\n { method: 'GET', path: '/api/cogs/predictions/{id}', summary: 'Poll a prediction by id — status, output, cost, timing', auth: 'key' },\n ],\n params: {\n heading: 'POST /api/cogs body',\n rows: [\n { name: 'name', type: 'string', required: true, desc: 'Model display name.' },\n { name: 'image', type: 'string', required: true, desc: 'Container image, e.g. r8.im/owner/model or your own registry image.' },\n { name: 'hardware', type: 'string', desc: 'A GPU machine id (gpu-t4, gpu-rtx3090, gpu-rtx4090, gpu-a40, gpu-l40s, gpu-a100, gpu-h100), or \"auto\"/omitted to pick the cheapest GPU that fits minVramGb.' },\n { name: 'schema', type: 'object', desc: 'Optional { inputs: [{name,type,description,default,required,choices,min,max,order}], outputKind }. Omitted schemas are introspected from the container’s /openapi.json on first warm-up.' },\n { name: 'idleSeconds', type: 'integer', desc: 'Idle window before scale-to-zero (default 120).' },\n { name: 'minVramGb', type: 'integer', desc: 'Model’s VRAM floor, used for auto hardware selection.' },\n ],\n },\n example: {\n label: 'Ensure open audio or register any Cog',\n code: `# One call: ensure Pocket TTS, queue it, and reuse it on later calls\ncurl -sX POST https://app.nz/api/cogs/run \\\\\n -H \"Authorization: Bearer $APP_API_KEY\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"template\":\"pocket-tts\",\"input\":{\"text\":\"Kia ora\",\"voice\":\"alba\",\"format\":\"wav\"}}'\n# -> {\"created\":true,\"model\":{\"id\":\"...\"},\"prediction\":{\"id\":\"...\"},\n# \"lifecycle\":{\"scaleToZero\":true,\"idleSeconds\":60,\"status\":\"...\",\"sleep\":\"...\"}}\n\n# Any Cog image can still be registered directly\ncurl -sX POST https://app.nz/api/cogs \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"name\":\"fast-vfx\",\"image\":\"r8.im/lee101/fast-vfx\",\"hardware\":\"gpu-rtx4090\"}'\n# -> {\"model\":{\"id\":\"cog_...\",\"status\":\"idle\",...}}\n\ncurl -sX POST https://app.nz/api/cogs/cog_.../predict \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"input\":{\"video\":\"https://example.com/clip.mp4\",\"num_levels\":25}}'\n# -> {\"prediction\":{\"id\":\"pred_...\",\"status\":\"starting\"}}\n\n# Poll for the result (a cold start can take a couple of minutes)\ncurl -s https://app.nz/api/cogs/predictions/pred_... \\\\\n -H \"Authorization: Bearer pk_live_...\"\n\n# Audio-to-audio (audex-s2s template): one spoken turn per prediction\ncurl -sX POST https://app.nz/api/cogs/cog_.../predict \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"input\":{\"task\":\"converse\",\"audio\":\"data:audio/webm;base64,...\",\"system_prompt\":\"You are a cheerful pirate captain.\"}}'\n# -> output: {\"transcript\":\"...\",\"response_text\":\"...\",\"audio\":\"data:audio/mpeg;base64,...\"}`,\n },\n },\n {\n id: 'notebooks',\n label: 'Notebooks & datasets',\n icon: NotebookPen,\n title: 'Notebooks & datasets',\n intro:\n 'Hosted marimo notebooks run free in the browser (Pyodide) or on per-minute cloud machines that stop when idle. Datasets accept csv, json, jsonl (agent traces auto-detected), parquet, sqlite .db files, images, and browser-playable video; binary formats stream from the CDN and table previews open in the Sheets editor. Machine rates include the platform margin — what /api/notebooks/pricing returns is what you pay.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/notebooks', summary: 'List your notebooks plus public examples', auth: 'key' },\n { method: 'POST', path: '/api/notebooks', summary: 'Create a notebook ({name, source?, forkOf?})', auth: 'key' },\n { method: 'GET', path: '/api/notebooks/{slug}', summary: 'Fetch a notebook with its marimo source', auth: 'key' },\n { method: 'PUT', path: '/api/notebooks/{slug}', summary: 'Update name, source, visibility, runtime', auth: 'key' },\n { method: 'DELETE', path: '/api/notebooks/{slug}', summary: 'Delete a notebook (stops its sessions)', auth: 'key' },\n { method: 'GET', path: '/api/notebooks/{slug}/sessions', summary: 'List cloud sessions with status and endpoint', auth: 'key' },\n { method: 'POST', path: '/api/notebooks/{slug}/sessions', summary: 'Start a cloud session ({machineType}), billed per minute', auth: 'key' },\n { method: 'DELETE', path: '/api/notebooks/sessions/{id}', summary: 'Stop a session and settle billing', auth: 'key' },\n { method: 'GET', path: '/api/notebooks/pricing', summary: 'Machine catalogue with hourly/credit rates and storage pricing', auth: 'none' },\n { method: 'POST', path: '/api/datasets/upload', summary: 'Upload a table, database, image, or video dataset', auth: 'key' },\n { method: 'GET', path: '/api/datasets/u/{id}/notebook', summary: 'Generated marimo starter notebook for a dataset', auth: 'key' },\n ],\n example: {\n label: 'Create a notebook and run it on a GPU',\n code: `curl -sX POST https://app.nz/api/notebooks \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"name\":\"fraud analysis\"}'\n\ncurl -sX POST https://app.nz/api/notebooks/nb-1a2b3c4d/sessions \\\\\n -H \"Authorization: Bearer pk_live_...\" \\\\\n -d '{\"machineType\":\"gpu-rtx3090\"}'\n# -> {\"session\":{\"id\":\"...\",\"status\":\"provisioning\",\"priceHourly\":\"$0.264\"}}`,\n },\n },\n {\n id: 'billing',\n label: 'Billing & plans',\n icon: KeyRound,\n title: 'Billing & plans',\n intro:\n 'Everything is paid from one prepaid credit balance (credits are ~$0.001 each). On top of pay-as-you-go, a Pro ($20), Ultra ($60), or Max ($200) plan grants monthly credits, a guaranteed number of concurrent machines, and per-product free quotas. Plan credits are used before purchased credits and roll over for one month.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/pricing', summary: 'Usage-based pricing: model token rates, compute, search, credit unit', auth: 'none' },\n { method: 'GET', path: '/api/plans', summary: 'List plan catalog (price, credits, machines, quotas)', auth: 'none' },\n { method: 'GET', path: '/api/plans/me', summary: 'Your plan, credit balance, and product quota usage', auth: 'key' },\n { method: 'POST', path: '/api/plans/subscribe', summary: 'Start a Pro/Ultra/Max checkout', auth: 'session' },\n { method: 'POST', path: '/api/plans/cancel', summary: 'Cancel at period end', auth: 'session' },\n { method: 'POST', path: '/api/plans/portal', summary: 'Open the Stripe billing portal', auth: 'session' },\n { method: 'GET', path: '/api/credits/balance', summary: 'Prepaid credit balance + auto-topup', auth: 'key' },\n { method: 'POST', path: '/api/credits/checkout', summary: 'Buy credit packs', auth: 'session' },\n { method: 'POST', path: '/api/credits/autotopup', summary: 'Configure automatic top-ups', auth: 'session' },\n ],\n params: {\n heading: 'Plan tiers',\n rows: [\n { name: 'free', type: 'plan', desc: '$0 — pay-as-you-go credits, shared worker pool.' },\n { name: 'pro', type: 'plan', desc: '$20/mo — 25,000 credits, 1 guaranteed machine.' },\n { name: 'ultra', type: 'plan', desc: '$60/mo — 80,000 credits, 3 machines + priority.' },\n { name: 'max', type: 'plan', desc: '$200/mo — 280,000 credits, 6 machines + top priority.' },\n ],\n },\n example: {\n label: 'Check your plan and subscribe from the CLI',\n code: `# Inspect the catalog\ncurl -s https://app.nz/api/plans | jq\n\n# From the CLI (app login first)\napp plan show\napp plan subscribe ultra\napp billing usage`,\n },\n },\n {\n id: 'payments',\n label: 'Payments (earn)',\n icon: KeyRound,\n title: 'Payments — let your app earn',\n intro:\n 'Accept payments in anything you build on app.nz. Under the hood it is Stripe Connect with direct charges: you are the merchant of record on your own connected account, Stripe handles KYC/verification and risk, and app.nz white-labels the whole experience. You pay one flat retail rate per plan (Free 5% + 30¢, Pro 4%, Ultra 3.5%, Max 3% — see /api/payments/config), collected automatically as an application fee on each charge. Standard payouts are free; instant payouts cost 1.5% (min 50¢). Earnings can be converted into app.nz credits so an app that earns pays for its own hosting.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/payments/config', summary: 'Fee schedule per plan, limits, instant-payout pricing', auth: 'none' },\n { method: 'POST', path: '/api/payments/enable', summary: 'Create your payment account; returns a hosted onboarding link', auth: 'key' },\n { method: 'GET', path: '/api/payments/account', summary: 'Onboarding status: chargesEnabled, payoutsEnabled, your fee rate', auth: 'key' },\n { method: 'POST', path: '/api/payments/checkout', summary: 'Sell: one-time or recurring checkout; returns a Stripe-hosted payment url', auth: 'key' },\n { method: 'GET', path: '/api/payments/sales', summary: 'List checkouts with paid totals and fees', auth: 'key' },\n { method: 'GET', path: '/api/payments/balance', summary: 'Available / pending / instant-eligible balance', auth: 'key' },\n { method: 'POST', path: '/api/payments/payout', summary: 'Pay out to your bank; {\"instant\": true} arrives in ~30 min for a fee', auth: 'key' },\n { method: 'POST', path: '/api/payments/offset', summary: 'Convert earnings into app.nz credits (1¢ = 10 credits) to pay hosting', auth: 'key' },\n { method: 'POST', path: '/api/payments/settings', summary: 'Toggle automatic hosting offset', auth: 'key' },\n { method: 'POST', path: '/api/payments/webhook', summary: 'Stripe Connect webhook receiver (platform-facing)', auth: 'none', noDoc: true },\n ],\n params: {\n heading: 'Checkout body',\n rows: [\n { name: 'amount', type: 'int', required: true, desc: 'Unit price in cents (50 – 5,000,000).' },\n { name: 'description', type: 'string', desc: 'What the customer is buying; shows on the checkout page.' },\n { name: 'recurring', type: 'string', desc: 'Omit for one-time; \"month\"/\"year\"/\"week\"/\"day\" for a subscription.' },\n { name: 'currency', type: 'string', desc: 'ISO currency, default usd.' },\n { name: 'quantity', type: 'int', desc: 'Line-item quantity, default 1.' },\n { name: 'successUrl', type: 'string', desc: 'Where the buyer lands after paying (your app).' },\n { name: 'cancelUrl', type: 'string', desc: 'Where the buyer lands if they abandon checkout.' },\n { name: 'metadata', type: 'object', desc: 'Your own keys (order id, plan) echoed back on the sale.' },\n ],\n },\n example: {\n label: 'Enable once, then sell a $29/mo plan from your backend',\n code: `# One-time setup: onboard (opens Stripe-hosted KYC, bank account)\napp payments enable --country NZ --description \"Pro subscriptions\"\n\n# From your app's server (never expose the key in browser code):\ncurl -sX POST https://app.nz/api/payments/checkout \\\\\n -H \"Authorization: Bearer $APP_API_KEY\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"amount\": 2900, \"description\": \"Pro plan\", \"recurring\": \"month\",\n \"successUrl\": \"https://myapp.app.nz/thanks\"}'\n# → redirect the buyer to the returned \"url\"\n\napp payments sales # who paid\napp payments balance # available / pending / instant\napp payments payout --amount 100.00 --instant # ~30 min, 1.5% fee\napp payments offset --amount 50.00 # $50 earnings → 50,000 hosting credits`,\n },\n },\n {\n id: 'spatial-assets',\n label: 'Animation & 3D',\n icon: Box,\n title: 'Open animation and spatial asset API',\n intro:\n 'Search the public motion, VFX, terrain, procedural-object, and image-to-3D index by stable ID. Agents can inspect source and license metadata, download portable JSON recipes, fetch OBJ meshes, build deterministic terrain, or prepare an image reconstruction job without parsing the web gallery.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'GET', path: '/api/animation-library', summary: 'Search the indexed asset manifest with q, kind, and limit', auth: 'none' },\n { method: 'GET', path: '/api/animation-library/index.json', summary: 'Fetch the complete cacheable index for offline agent search', auth: 'none' },\n { method: 'GET', path: '/api/animation-library/{id}/download?format=json', summary: 'Download a recipe; use format=obj for terrain and 3D objects', auth: 'none' },\n { method: 'POST', path: '/api/animation-library/terrain', summary: 'Build a deterministic terrain recipe', auth: 'none' },\n { method: 'POST', path: '/api/animation-library/image-to-3d', summary: 'Build an image-to-3D reconstruction recipe', auth: 'none' },\n { method: 'POST', path: '/v1/3d/generations', summary: 'Run an authenticated 3D generation job from image or text input', auth: 'key' },\n ],\n params: {\n heading: 'Search and download parameters',\n rows: [\n { name: 'q', type: 'string', desc: 'Substring matched against stable id, name, description, and tags.' },\n { name: 'kind', type: 'enum', desc: 'pose, motion, vfx, terrain, object, or image3d.' },\n { name: 'format', type: 'enum', desc: 'json for every asset; obj for terrain, object, and image3d.' },\n { name: 'target_polycount', type: 'integer', desc: 'Requested reconstruction budget, clamped to 500,000.' },\n ],\n },\n example: {\n label: 'Agent search → inspect → download',\n code: `# Find downloadable image-to-3D assets\ncurl -s 'https://app.nz/api/animation-library?q=product&kind=image3d&limit=10' | jq\n\n# Download portable geometry\ncurl -L 'https://app.nz/api/animation-library/image3d-sneaker/download?format=obj' -o sneaker.obj\n\n# Equivalent CLI flow\napp animation search product --kind image3d\napp animation download image3d-sneaker --format obj --output sneaker.obj\n\n# MCP tools: search_animation_library, download_animation_asset,\n# create_image_to_3d_recipe, generate_terrain_recipe`,\n },\n },\n {\n id: 'products',\n label: 'Products',\n icon: Bot,\n title: 'First-party products',\n intro:\n 'RA1 art generation, the Papers API, and agentic search are first-party APIs metered against the same balance. Plan subscribers get a monthly free quota per product, consumed before any credits are charged. Interactive Papers search at /papers is public and free; authenticated API, CLI, desktop, and MCP calls keep the shared usage contract.',\n baseUrl: 'https://app.nz',\n endpoints: [\n { method: 'POST', path: '/api/ra1/generate', summary: 'Generate images with RA1 — prompt, count, aspect, style, negative (50 credits each)', auth: 'key' },\n { method: 'GET', path: '/api/ra1/status', summary: 'Poll a queued render by jobId for status + image URLs', auth: 'key' },\n { method: 'GET', path: '/api/papers/public-search', summary: 'Free browser search across papers, methods, datasets, code, and repos (20-result cap)', auth: 'none' },\n { method: 'GET', path: '/api/papers/search', summary: 'Authenticated Papers API search (1 credit each)', auth: 'key' },\n { method: 'POST', path: '/api/search', summary: 'Agentic web search (10 credits per depth)', auth: 'key' },\n { method: 'POST', path: '/api/packing/solve', summary: '3D bin packing — container + items in, placements/utilization/unplaced out (free)', auth: 'none' },\n ],\n example: {\n label: 'Call the products from the CLI',\n code: `app chat \"research R2-backed model hosting\" --web --deep --papers\napp ra1 generate --prompt \"a cat astronaut\" --count 2\napp papers search \"diffusion transformers\" --limit 5\napp search \"best vector database 2026\" --depth 2`,\n },\n },\n];\n\nexport const methodColor: Record = {\n GET: 'text-emerald-300 border-emerald-300/30 bg-emerald-300/10',\n POST: 'text-sky-300 border-sky-300/30 bg-sky-300/10',\n PUT: 'text-amber-300 border-amber-300/30 bg-amber-300/10',\n PATCH: 'text-violet-300 border-violet-300/30 bg-violet-300/10',\n DELETE: 'text-rose-300 border-rose-300/30 bg-rose-300/10',\n};\n\nexport const authLabel: Record, string> = {\n key: 'API key',\n session: 'session',\n none: 'public',\n};\n\n// --- Per-endpoint deep links (/docs/{slug}) ---------------------------------\n// Each callable endpoint gets a stable, crawlable slug so it can have its own\n// documentation page and sitemap entry. Slugs are derived from the path:\n// gateway /v1/* routes drop the version prefix (audio/speech -> audio-speech),\n// control-plane /api/* routes keep an api- prefix to stay collision-free, and\n// path params ({id}) collapse to their name. Endpoints repeated across sections\n// (the Agents SDK reuses Agents routes) resolve to the first section's page.\n\nexport interface DocEndpoint extends Endpoint {\n slug: string;\n sectionId: string;\n sectionTitle: string;\n}\n\nfunction baseSlug(path: string): string {\n let p = path.split('?')[0];\n p = p.replace(/\\{([^}]+)\\}/g, '$1'); // {id} -> id\n p = p.replace(/^\\/v1\\//, '/'); // gateway: drop the version prefix\n p = p.replace(/^\\/api\\//, '/api-'); // control plane: keep api- to disambiguate\n p = p.replace(/^\\//, '');\n return p\n .replace(/[^a-zA-Z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .toLowerCase();\n}\n\nconst endpointKey = (method: string, path: string) => `${method} ${path}`;\n\nconst slugByKey = new Map();\nconst usedSlugs = new Set();\nconst builtEndpoints: DocEndpoint[] = [];\n\nfor (const section of sections) {\n for (const e of section.endpoints ?? []) {\n if (e.noDoc) continue;\n const key = endpointKey(e.method, e.path);\n if (slugByKey.has(key)) continue; // duplicate route across sections\n let slug = baseSlug(e.path);\n if (usedSlugs.has(slug)) slug = `${slug}-${e.method.toLowerCase()}`;\n let n = 2;\n while (usedSlugs.has(slug)) slug = `${baseSlug(e.path)}-${e.method.toLowerCase()}-${n++}`;\n usedSlugs.add(slug);\n slugByKey.set(key, slug);\n builtEndpoints.push({ ...e, slug, sectionId: section.id, sectionTitle: section.title });\n }\n}\n\nexport const docEndpoints: DocEndpoint[] = builtEndpoints;\n\nconst bySlug = new Map(docEndpoints.map((e) => [e.slug, e]));\n\nexport function docEndpointBySlug(slug: string): DocEndpoint | undefined {\n return bySlug.get(slug);\n}\n\n// slugForEndpoint returns the /docs page slug for a list row, or undefined for\n// noDoc URL-pattern rows that have no dedicated page.\nexport function slugForEndpoint(method: string, path: string): string | undefined {\n return slugByKey.get(endpointKey(method, path));\n}\n\nexport function docSectionById(id: string): DocSection | undefined {\n return sections.find((s) => s.id === id);\n}\n\n// docEndpointSlugs is the canonical slug list mirrored by the sitemap (TS side\n// feeds prerenderPaths; server/sitemap.go keeps a matching Go slice).\nexport const docEndpointSlugs: string[] = docEndpoints.map((e) => e.slug);\n","// Data-only catalog of job-specific AI use cases: each entry becomes a\n// prerendered SEO landing page at /ai/ with a working runner wired to the\n// existing gateway endpoints (image edit/gen, TTS, music/SFX, video), billed\n// from the user's credit balance. Imported by platformPageMeta (keep this\n// module free of React/icons so the meta bundle stays small) and mirrored in\n// server/sitemap.go (sitemapAIUseCases) — tests/ai-usecases.test.ts enforces\n// the sync.\n\nexport type UseCaseCategory =\n | 'Real Estate'\n | 'E-commerce'\n | 'Portraits'\n | 'Photo Fix'\n | 'Art Styles'\n | 'Design'\n | 'Fun'\n | 'Voice'\n | 'Music & SFX'\n | 'Video';\n\nexport type UseCaseKind = 'image-edit' | 'image-gen' | 'remove-bg' | 'tts' | 'music' | 'sfx' | 'video' | 'image-video';\n\nexport interface UseCasePreset {\n label: string;\n input: string;\n}\n\nexport interface UseCaseDef {\n slug: string;\n title: string;\n /** Short card line on the /ai directory. */\n tagline: string;\n /** Meta description + landing hero paragraph. Unique per page. */\n description: string;\n category: UseCaseCategory;\n kind: UseCaseKind;\n /** Prompt template; '{input}' is replaced with the user's text (or preset). */\n prompt?: string;\n inputLabel?: string;\n inputPlaceholder?: string;\n defaultInput?: string;\n presets?: UseCasePreset[];\n /** Pin a gateway model; omit for the endpoint default / auto route. */\n model?: string;\n n?: number;\n size?: string;\n duration?: number;\n voice?: string;\n keywords: string[];\n}\n\nconst RE = 'Real Estate';\nconst EC = 'E-commerce';\nconst PO = 'Portraits';\nconst PF = 'Photo Fix';\nconst AS = 'Art Styles';\nconst DE = 'Design';\nconst FU = 'Fun';\nconst VO = 'Voice';\nconst MU = 'Music & SFX';\nconst VI = 'Video';\n\nexport const useCases: UseCaseDef[] = [\n // --- Real Estate ---\n {\n slug: 'virtual-staging',\n title: 'Virtual Staging',\n tagline: 'Furnish empty listing photos with AI staging.',\n description:\n 'Upload a photo of an empty room and get it professionally staged with furniture, rugs, art and lighting — no physical staging costs. Pick a style like modern, Scandinavian or luxury and download listing-ready photos in seconds.',\n category: RE,\n kind: 'image-edit',\n prompt:\n 'Virtually stage this empty room for a real estate listing: add tasteful {input} furniture, a rug, wall art and warm lighting. Keep the walls, windows, floors and room geometry exactly as they are. Photorealistic, bright, magazine-quality staging.',\n inputLabel: 'Staging style',\n defaultInput: 'modern',\n presets: [\n { label: 'Modern', input: 'modern' },\n { label: 'Scandinavian', input: 'scandinavian minimalist' },\n { label: 'Luxury', input: 'high-end luxury' },\n { label: 'Cozy farmhouse', input: 'cozy farmhouse' },\n ],\n keywords: ['virtual staging', 'real estate staging ai', 'stage empty room photo'],\n },\n {\n slug: 'room-restyle',\n title: 'AI Interior Design',\n tagline: 'Redesign any room photo in a new interior style.',\n description:\n 'Upload a photo of a room and restyle it — new furniture, colors and decor in any interior design style. Perfect for renovation ideas, mood boards and showing buyers a space’s potential.',\n category: RE,\n kind: 'image-edit',\n prompt:\n 'Redesign this room in a {input} interior design style: update furniture, decor, textiles and color palette while keeping the room layout, windows and structure the same. Photorealistic interior photography.',\n inputLabel: 'Interior style',\n defaultInput: 'mid-century modern',\n presets: [\n { label: 'Mid-century', input: 'mid-century modern' },\n { label: 'Japandi', input: 'japandi' },\n { label: 'Industrial', input: 'industrial loft' },\n { label: 'Coastal', input: 'light coastal' },\n ],\n keywords: ['ai interior design', 'room restyle', 'redesign room photo'],\n },\n {\n slug: 'sky-replacement',\n title: 'AI Sky Replacement',\n tagline: 'Swap grey skies for perfect blue in exterior shots.',\n description:\n 'Replace a dull or blown-out sky in property and landscape photos with a crisp blue sky, dramatic sunset or soft clouds — with matching scene lighting so the edit looks natural.',\n category: RE,\n kind: 'image-edit',\n prompt:\n 'Replace the sky in this photo with {input}. Adjust the overall lighting and color balance of the scene so it matches the new sky naturally. Keep everything else unchanged. Photorealistic.',\n inputLabel: 'New sky',\n defaultInput: 'a clear blue sky with a few soft white clouds',\n presets: [\n { label: 'Blue sky', input: 'a clear blue sky with a few soft white clouds' },\n { label: 'Golden sunset', input: 'a warm golden-hour sunset sky' },\n { label: 'Dramatic clouds', input: 'a dramatic partly-cloudy sky with god rays' },\n ],\n keywords: ['sky replacement', 'replace sky in photo', 'real estate photo editing'],\n },\n {\n slug: 'twilight-photo',\n title: 'Day to Twilight',\n tagline: 'Turn daytime exteriors into glowing dusk shots.',\n description:\n 'Convert a daytime exterior photo into a premium twilight shot — deep blue dusk sky, warm glowing windows and ambient lighting. The classic listing upgrade, done in seconds instead of a reshoot.',\n category: RE,\n kind: 'image-edit',\n prompt:\n 'Convert this daytime exterior photo to a twilight real estate shot: deep blue dusk sky, warm light glowing from the windows, subtle exterior and landscape lighting. Keep the building and composition identical. Photorealistic.',\n keywords: ['virtual twilight', 'day to dusk photo', 'twilight real estate photo'],\n },\n {\n slug: 'exterior-redesign',\n title: 'Home Exterior Redesign',\n tagline: 'Visualize new facades, paint and landscaping.',\n description:\n 'Upload a photo of a house and preview a new exterior: fresh paint, new cladding, updated landscaping or a whole new architectural style. Great for renovators, builders and agents pitching potential.',\n category: RE,\n kind: 'image-edit',\n prompt:\n 'Redesign the exterior of this house: {input}. Keep the building position, angle and surroundings the same. Photorealistic architectural photography.',\n inputLabel: 'What to change',\n defaultInput: 'repaint in a modern white and charcoal palette with fresh landscaping',\n presets: [\n { label: 'Modern repaint', input: 'repaint in a modern white and charcoal palette with fresh landscaping' },\n { label: 'Cedar + stone', input: 'add cedar wood cladding and natural stone accents' },\n { label: 'Lush garden', input: 'add a lush landscaped front garden with a new path' },\n ],\n keywords: ['exterior redesign ai', 'house facade visualizer', 'curb appeal ai'],\n },\n {\n slug: 'listing-photo-enhance',\n title: 'Listing Photo Enhancer',\n tagline: 'Brighten, balance and sharpen property photos.',\n description:\n 'One-click enhancement for property photos: fix exposure and white balance, brighten dark interiors, green up the lawn and sharpen details — HDR-quality results from phone snaps.',\n category: RE,\n kind: 'image-edit',\n prompt:\n 'Enhance this property photo like a professional real estate editor: correct exposure and white balance, brighten dark areas, make the grass green and healthy, sharpen details, HDR look. Do not add, move or remove any objects.',\n keywords: ['real estate photo enhancement', 'brighten listing photos', 'hdr photo ai'],\n },\n\n // --- E-commerce ---\n {\n slug: 'product-photo-studio',\n title: 'AI Product Photos',\n tagline: 'Turn phone snaps into clean studio product shots.',\n description:\n 'Upload a photo of your product and get a clean studio-quality shot: seamless background, soft professional lighting and subtle shadow. Ready for your store, marketplace listings and ads.',\n category: EC,\n kind: 'image-edit',\n prompt:\n 'Turn this into a professional studio product photo: place the product on {input}, with soft studio lighting and a natural soft shadow. Keep the product itself pixel-accurate and unchanged. Commercial product photography.',\n inputLabel: 'Backdrop',\n defaultInput: 'a seamless white studio background',\n presets: [\n { label: 'White studio', input: 'a seamless white studio background' },\n { label: 'Warm beige', input: 'a warm beige seamless backdrop' },\n { label: 'Marble', input: 'a white marble surface with soft daylight' },\n { label: 'Dark premium', input: 'a dark matte premium backdrop with rim lighting' },\n ],\n keywords: ['ai product photography', 'product photo generator', 'white background product photo'],\n },\n {\n slug: 'product-scene',\n title: 'Product Scene Creator',\n tagline: 'Place your product in lifestyle scenes that sell.',\n description:\n 'Drop your product into a styled lifestyle scene — kitchen counter, beach towel, gym bench, forest moss — without a photoshoot. Describe the scene and get ad-ready lifestyle imagery.',\n category: EC,\n kind: 'image-edit',\n prompt:\n 'Place this product naturally into the following scene: {input}. Match lighting, perspective and shadows so it looks like a real photograph. Keep the product accurate and unchanged. Commercial lifestyle photography.',\n inputLabel: 'Scene',\n defaultInput: 'a sunlit wooden kitchen counter with soft morning light and out-of-focus plants',\n presets: [\n { label: 'Kitchen counter', input: 'a sunlit wooden kitchen counter with soft morning light and out-of-focus plants' },\n { label: 'Beach', input: 'a sandy beach towel scene with ocean bokeh at golden hour' },\n { label: 'Forest', input: 'a mossy forest floor with dappled sunlight' },\n { label: 'Gym', input: 'a modern gym bench with dramatic directional light' },\n ],\n keywords: ['product scene generator', 'lifestyle product photos ai', 'ai product background'],\n },\n {\n slug: 'fashion-model-photo',\n title: 'Flat-lay to Model',\n tagline: 'Show clothing on an AI model, no photoshoot.',\n description:\n 'Turn a flat-lay or mannequin photo of a garment into an on-model shot. Describe the model and setting, and get catalogue-style photos of your clothing being worn — without booking a studio.',\n category: EC,\n kind: 'image-edit',\n prompt:\n 'Show this exact garment worn by {input}, full-body catalogue fashion photo, neutral studio background, natural pose, professional fashion photography. Keep the garment’s design, colors, fabric and details exactly accurate.',\n inputLabel: 'Model & look',\n defaultInput: 'a professional model with a natural relaxed pose',\n keywords: ['ai fashion model', 'flat lay to model', 'virtual try on clothing'],\n },\n {\n slug: 'background-remover',\n title: 'Background Remover',\n tagline: 'Cut out any subject with one click.',\n description:\n 'Remove the background from any image instantly — clean edges around hair, fur and fine details, transparent PNG output. Flat $0.01 per image, powered by BiRefNet v2.',\n category: EC,\n kind: 'remove-bg',\n keywords: ['remove background', 'background remover free', 'transparent png maker'],\n },\n {\n slug: 'food-photo-enhance',\n title: 'Food Photo Enhancer',\n tagline: 'Make menu photos look delicious.',\n description:\n 'Turn phone photos of dishes into appetizing menu-quality shots: richer color, better lighting, steam and freshness cues — without changing the actual dish. Built for restaurants, delivery menus and food bloggers.',\n category: EC,\n kind: 'image-edit',\n prompt:\n 'Enhance this food photo to professional food-photography quality: appetizing warm lighting, rich natural colors, shallow depth of field, crisp details. Keep the exact same dish, plating and composition — enhance only.',\n keywords: ['food photography ai', 'enhance food photos', 'menu photo editor'],\n },\n {\n slug: 'mockup-generator',\n title: 'Mockup Generator',\n tagline: 'Generate product mockups from a description.',\n description:\n 'Describe a mockup — a tote bag on a cafe table, a phone case in hand, packaging on a shelf — and generate photorealistic mockup imagery for stores, pitches and social posts.',\n category: EC,\n kind: 'image-gen',\n prompt: 'Photorealistic product mockup: {input}. Professional commercial photography, soft studio lighting, high detail.',\n inputLabel: 'Describe the mockup',\n defaultInput: 'a plain white ceramic coffee mug on a rustic cafe table, morning light',\n keywords: ['mockup generator ai', 'product mockup maker', 'packaging mockup'],\n },\n\n // --- Portraits ---\n {\n slug: 'professional-headshot',\n title: 'AI Headshot Generator',\n tagline: 'LinkedIn-ready headshots from a selfie.',\n description:\n 'Upload a selfie and get a polished professional headshot: business attire, studio lighting and a clean backdrop, while keeping your face recognizably you. Perfect for LinkedIn, team pages and speaker bios.',\n category: PO,\n kind: 'image-edit',\n prompt:\n 'Turn this photo into a professional corporate headshot: {input}, soft studio lighting, clean neutral background, sharp focus, professional retouching. Keep the person’s face, identity and features accurate.',\n inputLabel: 'Look',\n defaultInput: 'smart business attire',\n presets: [\n { label: 'Business', input: 'smart business attire' },\n { label: 'Business casual', input: 'business casual attire' },\n { label: 'Creative', input: 'smart casual creative-professional look' },\n ],\n keywords: ['ai headshot generator', 'professional headshot from selfie', 'linkedin photo ai'],\n },\n {\n slug: 'id-photo',\n title: 'ID Photo Maker',\n tagline: 'Passport-style photos from any portrait.',\n description:\n 'Turn any portrait into a compliant ID-style photo: plain white background, even lighting, neutral front-facing framing. For passports, visas, licenses and staff badges — check your country’s official specs before submitting.',\n category: PO,\n kind: 'image-edit',\n prompt:\n 'Convert this portrait into an official ID/passport style photo: plain white background, even neutral lighting, head and shoulders framed front-on, neutral expression, no shadows. Keep the person’s face and identity exactly accurate.',\n keywords: ['id photo maker', 'passport photo ai', 'white background photo'],\n },\n {\n slug: 'avatar-maker',\n title: 'AI Avatar Maker',\n tagline: 'Stylized profile avatars from your photo.',\n description:\n 'Turn your photo into a striking profile avatar — stylized digital art, game-style portrait or minimal vector look. One upload, endless profile pictures for socials, Discord and gaming.',\n category: PO,\n kind: 'image-edit',\n prompt:\n 'Turn this photo into a {input} avatar portrait, head and shoulders, striking and clean composition, suitable as a profile picture. Keep the person recognizable.',\n inputLabel: 'Avatar style',\n defaultInput: 'stylized digital painting',\n presets: [\n { label: 'Digital art', input: 'stylized digital painting' },\n { label: 'Cyberpunk', input: 'neon cyberpunk digital art' },\n { label: 'Fantasy', input: 'epic fantasy character art' },\n { label: 'Minimal vector', input: 'flat minimal vector illustration' },\n ],\n keywords: ['ai avatar maker', 'profile picture generator', 'pfp maker'],\n },\n {\n slug: 'yearbook-photo',\n title: '90s Yearbook Photo',\n tagline: 'Retro yearbook portraits from your selfie.',\n description:\n 'The viral look: turn a selfie into a retro 80s/90s yearbook portrait — big hair, studio backdrop, film grain and all. Upload a photo and pick your era.',\n category: PO,\n kind: 'image-edit',\n prompt:\n 'Turn this photo into a vintage {input} school yearbook portrait: era-appropriate hairstyle and clothing, classic studio backdrop, film photo grain and color. Keep the person’s face recognizable.',\n inputLabel: 'Era',\n defaultInput: '1990s',\n presets: [\n { label: '90s', input: '1990s' },\n { label: '80s', input: '1980s' },\n { label: '70s', input: '1970s' },\n ],\n keywords: ['ai yearbook photo', '90s yearbook trend', 'retro portrait ai'],\n },\n {\n slug: 'pet-portrait',\n title: 'AI Pet Portrait',\n tagline: 'Turn your pet into a work of art.',\n description:\n 'Upload a photo of your pet and get a portrait worth framing — Renaissance general, royal oil painting, astronaut, or any style you can describe. The perfect gift for pet lovers.',\n category: PO,\n kind: 'image-edit',\n prompt:\n 'Turn this pet into {input}. Keep the pet’s face, markings and features accurate and recognizable. Rich detailed artwork, portrait composition.',\n inputLabel: 'Portrait style',\n defaultInput: 'a royal renaissance oil painting portrait wearing regal clothing',\n presets: [\n { label: 'Renaissance royal', input: 'a royal renaissance oil painting portrait wearing regal clothing' },\n { label: 'Astronaut', input: 'an astronaut portrait in a detailed spacesuit' },\n { label: 'Watercolor', input: 'a soft watercolor painting portrait' },\n ],\n keywords: ['ai pet portrait', 'dog portrait painting', 'royal pet painting'],\n },\n\n // --- Photo Fix ---\n {\n slug: 'restore-old-photo',\n title: 'Old Photo Restoration',\n tagline: 'Repair scratches, tears and fading with AI.',\n description:\n 'Bring damaged family photos back to life: repair scratches, tears, stains and fading, recover faces and detail, and optionally keep the original character. Upload a scan and download the restored photo.',\n category: PF,\n kind: 'image-edit',\n prompt:\n 'Restore this old damaged photograph: repair scratches, tears, creases, stains and fading, recover facial detail and sharpness, correct exposure. Keep the original people, composition and period character exactly — restoration only, no new content.',\n keywords: ['restore old photos', 'photo restoration ai', 'fix damaged photo'],\n },\n {\n slug: 'colorize-photo',\n title: 'Photo Colorizer',\n tagline: 'Add realistic color to black & white photos.',\n description:\n 'Colorize black-and-white photos with historically plausible, natural color — skin tones, fabrics, skies and landscapes. Great for family archives and history projects.',\n category: PF,\n kind: 'image-edit',\n prompt:\n 'Colorize this black and white photograph with realistic, historically plausible natural colors: accurate skin tones, fabric colors and environment. Keep every detail, person and composition identical — add color only.',\n keywords: ['colorize black and white photos', 'photo colorizer ai', 'colourise old photo'],\n },\n {\n slug: 'photo-enhance',\n title: 'AI Photo Enhancer',\n tagline: 'Sharpen, denoise and upgrade any photo.',\n description:\n 'Enhance any photo in one step: sharpen soft focus, reduce noise, recover detail and improve lighting and color. Rescue low-light phone shots and old compressed images.',\n category: PF,\n kind: 'image-edit',\n prompt:\n 'Enhance this photo: increase sharpness and fine detail, reduce noise and compression artifacts, improve lighting, contrast and color balance. Keep the content, people and composition exactly the same — enhancement only.',\n keywords: ['ai photo enhancer', 'unblur photo', 'increase photo quality'],\n },\n {\n slug: 'object-remover',\n title: 'Object Remover',\n tagline: 'Erase tourists, wires and clutter from photos.',\n description:\n 'Describe what to remove — photobombers, power lines, trash, watermarks on your own work — and AI erases it and rebuilds the background seamlessly.',\n category: PF,\n kind: 'image-edit',\n prompt:\n 'Remove {input} from this photo and reconstruct the background behind it seamlessly and photorealistically. Change nothing else in the image.',\n inputLabel: 'What to remove',\n inputPlaceholder: 'e.g. the people in the background',\n defaultInput: 'the distracting objects in the background',\n keywords: ['remove object from photo', 'ai object remover', 'remove person from photo'],\n },\n {\n slug: 'photo-relight',\n title: 'AI Photo Relight',\n tagline: 'Fix bad lighting after the shot.',\n description:\n 'Relight a photo after the fact: turn harsh midday light into golden hour, brighten backlit faces, or add moody studio lighting — while keeping the subject and scene intact.',\n category: PF,\n kind: 'image-edit',\n prompt:\n 'Relight this photo with {input}. Keep the subject, scene and composition identical — change only the lighting, shadows and color mood. Photorealistic.',\n inputLabel: 'New lighting',\n defaultInput: 'warm golden-hour sunlight',\n presets: [\n { label: 'Golden hour', input: 'warm golden-hour sunlight' },\n { label: 'Soft studio', input: 'soft diffused studio lighting' },\n { label: 'Moody', input: 'dramatic low-key moody lighting' },\n ],\n keywords: ['relight photo ai', 'fix photo lighting', 'golden hour filter'],\n },\n {\n slug: 'season-change',\n title: 'Season Changer',\n tagline: 'Shift a scene to summer, autumn or snow.',\n description:\n 'Change the season of any outdoor photo — summer greens, autumn colors, spring blossom or fresh snow — with matching light and atmosphere. Popular for real estate, travel content and cards.',\n category: PF,\n kind: 'image-edit',\n prompt:\n 'Change the season in this photo to {input}: adjust foliage, ground cover, sky and lighting to match, keeping the location, buildings and composition identical. Photorealistic.',\n inputLabel: 'Season',\n defaultInput: 'a crisp snowy winter day',\n presets: [\n { label: 'Winter snow', input: 'a crisp snowy winter day' },\n { label: 'Autumn', input: 'golden autumn with fall foliage' },\n { label: 'Spring', input: 'spring with fresh blossom' },\n { label: 'Summer', input: 'lush green summer' },\n ],\n keywords: ['season change photo', 'add snow to photo', 'autumn photo filter'],\n },\n\n // --- Art Styles ---\n {\n slug: 'cartoonify',\n title: 'Cartoonify Photo',\n tagline: 'Turn photos into cartoon characters.',\n description:\n 'Turn any photo into a cartoon — bold outlines, expressive features and vibrant color. Great for avatars, gifts and social posts.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Turn this photo into a {input} cartoon illustration: bold clean outlines, expressive stylization, vibrant colors. Keep the subject clearly recognizable.',\n inputLabel: 'Cartoon style',\n defaultInput: 'classic animated movie',\n presets: [\n { label: 'Animated movie', input: 'classic animated movie' },\n { label: 'Comic book', input: 'american comic book' },\n { label: 'Saturday cartoon', input: 'retro saturday-morning cartoon' },\n ],\n keywords: ['cartoonify photo', 'photo to cartoon', 'cartoon yourself'],\n },\n {\n slug: 'anime-style',\n title: 'Photo to Anime',\n tagline: 'Anime-style versions of your photos.',\n description:\n 'Convert photos into high-quality anime art — cel shading, expressive eyes and painterly backgrounds. Turn yourself, friends or scenery into anime stills.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Convert this photo into beautiful anime art: cel-shaded characters with expressive detailed eyes, painterly anime background, cinematic color grading. Keep the subject and composition recognizable.',\n keywords: ['photo to anime', 'anime filter ai', 'anime art generator'],\n },\n {\n slug: 'watercolor-painting',\n title: 'Watercolor Painting',\n tagline: 'Soft watercolor art from any photo.',\n description:\n 'Transform photos into delicate watercolor paintings — soft washes, paper texture and loose brushwork. Beautiful for portraits, houses, pets and wedding photos.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Turn this photo into a delicate watercolor painting: soft translucent washes, visible paper texture, loose expressive brushwork, gentle color palette. Keep the subject recognizable.',\n keywords: ['photo to watercolor', 'watercolor painting ai', 'watercolor portrait'],\n },\n {\n slug: 'oil-painting',\n title: 'Oil Painting Portrait',\n tagline: 'Classic oil paintings from photos.',\n description:\n 'Turn any photo into a classical oil painting with rich impasto brushstrokes, museum lighting and timeless color. Portraits, landscapes and pets all work beautifully.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Turn this photo into a classical oil painting: rich impasto brushstrokes, canvas texture, dramatic museum-quality lighting, timeless color palette in the style of the old masters. Keep the subject recognizable.',\n keywords: ['photo to oil painting', 'oil painting from photo', 'ai painting generator'],\n },\n {\n slug: 'pixel-art',\n title: 'Pixel Art Maker',\n tagline: 'Retro pixel art from photos or prompts.',\n description:\n 'Turn a photo into crisp retro pixel art — 16-bit game style, limited palette, chunky pixels. Perfect for game assets, avatars and retro posters.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Convert this image into retro 16-bit pixel art: chunky visible pixels, limited vibrant color palette, clean video-game sprite aesthetic. Keep the subject recognizable.',\n keywords: ['pixel art generator', 'photo to pixel art', '16 bit art maker'],\n },\n {\n slug: 'pencil-sketch',\n title: 'Pencil Sketch',\n tagline: 'Hand-drawn sketch portraits from photos.',\n description:\n 'Convert photos into realistic pencil sketches — graphite shading, hatching and clean linework, like a street artist drew it. Great for portraits and gifts.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Turn this photo into a realistic graphite pencil sketch: fine linework, cross-hatching and soft graphite shading on textured paper. Keep the subject accurately recognizable.',\n keywords: ['photo to sketch', 'pencil drawing ai', 'sketch portrait generator'],\n },\n {\n slug: 'pop-art',\n title: 'Pop Art Generator',\n tagline: 'Warhol-style pop art from your photos.',\n description:\n 'Turn photos into bold pop art — high-contrast screen-print looks, halftone dots and electric color blocks. Instant statement art for prints and socials.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Turn this photo into bold pop art: high-contrast screen-print style, halftone dot texture, flat electric color blocks, thick outlines. Keep the subject recognizable.',\n keywords: ['pop art generator', 'warhol style photo', 'pop art portrait'],\n },\n {\n slug: 'cyberpunk-style',\n title: 'Cyberpunk Filter',\n tagline: 'Neon cyberpunk versions of any image.',\n description:\n 'Restyle any photo into a neon-soaked cyberpunk scene — rain-slick streets, holographic signage, teal-and-magenta glow. Futuristic art from ordinary shots.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Restyle this image as a cinematic cyberpunk scene: neon teal and magenta lighting, holographic signage glow, rain-slick reflective surfaces, futuristic atmosphere. Keep the subject and composition recognizable.',\n keywords: ['cyberpunk filter', 'neon photo effect', 'cyberpunk art generator'],\n },\n {\n slug: 'plushify',\n title: 'Plushify',\n tagline: 'Turn anyone (or anything) into a plush toy.',\n description:\n 'Turn a person, pet or object into an adorable plush toy — soft felt texture, stitching, button eyes and studio toy photography. Irresistibly giftable.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Turn the subject of this photo into an adorable soft plush toy: felt and fleece texture, visible stitching, cute simplified proportions, studio product photo of the plushie. Keep it clearly recognizable as the subject.',\n keywords: ['plushify photo', 'turn photo into plush toy', 'ai plushie generator'],\n },\n {\n slug: 'action-figure',\n title: 'Action Figure Maker',\n tagline: 'Boxed action figures from your photos.',\n description:\n 'The viral action-figure look: turn a photo into a collectible boxed action figure, complete with blister packaging and accessories you describe. Fun for profiles, teams and gifts.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Turn the person in this photo into a collectible boxed action figure: realistic toy figure in blister-pack packaging with {input} as accessories, product-shot lighting, retail box art. Keep the face recognizable.',\n inputLabel: 'Accessories',\n defaultInput: 'a laptop and a coffee cup',\n keywords: ['ai action figure', 'action figure generator', 'boxed figure trend'],\n },\n {\n slug: 'clay-style',\n title: 'Claymation Style',\n tagline: 'Stop-motion clay versions of your photos.',\n description:\n 'Restyle photos as handcrafted claymation characters — fingerprint-textured clay, stop-motion studio lighting and charming imperfect detail.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Turn this photo into a claymation stop-motion style scene: handcrafted plasticine clay texture with subtle fingerprints, miniature studio set lighting, charming clay character proportions. Keep the subject recognizable.',\n keywords: ['claymation filter', 'clay style ai', 'photo to clay art'],\n },\n {\n slug: 'sticker-maker',\n title: 'AI Sticker Maker',\n tagline: 'Die-cut stickers from photos or ideas.',\n description:\n 'Make glossy die-cut stickers from a photo or a text idea — bold outline, white border, sticker-sheet ready. Export for WhatsApp, Telegram, or print.',\n category: AS,\n kind: 'image-edit',\n prompt:\n 'Turn the subject of this image into a glossy die-cut sticker: bold clean outline, thick white sticker border, vibrant simplified illustration style, plain background. Keep the subject recognizable.',\n keywords: ['ai sticker maker', 'photo to sticker', 'die cut sticker generator'],\n },\n\n // --- Design ---\n {\n slug: 'logo-maker',\n title: 'AI Logo Maker',\n tagline: 'Generate logo concepts from a description.',\n description:\n 'Describe your brand and get distinctive logo concepts — minimal marks, mascots, lettermarks or emblems. Iterate fast, then refine your favorite direction.',\n category: DE,\n kind: 'image-gen',\n prompt:\n 'Professional logo design: {input}. Flat vector style, simple memorable mark, clean composition on a plain background, no photographic elements.',\n inputLabel: 'Describe your brand & logo',\n defaultInput: 'a minimal geometric fox mark for a fintech startup called Foxledger, orange and charcoal',\n keywords: ['ai logo maker', 'logo generator', 'logo design ai'],\n },\n {\n slug: 'tattoo-designer',\n title: 'AI Tattoo Designer',\n tagline: 'Custom tattoo designs from your idea.',\n description:\n 'Describe the tattoo you want — style, subject, placement — and generate clean tattoo design sheets you can take to your artist. Fine-line, traditional, blackwork and more.',\n category: DE,\n kind: 'image-gen',\n prompt:\n 'Tattoo design: {input}. Clean tattoo flash sheet on plain background, crisp linework, professional tattoo design style.',\n inputLabel: 'Describe your tattoo',\n defaultInput: 'a fine-line hummingbird with geometric accents, forearm piece',\n presets: [\n { label: 'Fine-line', input: 'a fine-line hummingbird with geometric accents, forearm piece' },\n { label: 'Traditional', input: 'an american traditional snake and dagger with roses' },\n { label: 'Blackwork', input: 'a bold blackwork wolf with ornamental patterns' },\n ],\n keywords: ['ai tattoo generator', 'tattoo design ideas', 'custom tattoo design'],\n },\n {\n slug: 'coloring-page',\n title: 'Coloring Page Maker',\n tagline: 'Print-ready coloring pages from any idea.',\n description:\n 'Generate clean black-and-white coloring pages from any prompt — animals, mandalas, vehicles, story scenes. Print-ready line art for kids and adults.',\n category: DE,\n kind: 'image-gen',\n prompt:\n 'Black and white coloring book page: {input}. Clean bold outlines only, no shading or grayscale fill, white background, print-ready line art suitable for coloring.',\n inputLabel: 'Coloring page idea',\n defaultInput: 'a friendly dragon reading a book in a cozy library',\n keywords: ['coloring page generator', 'ai coloring book', 'printable coloring pages'],\n },\n {\n slug: 'thumbnail-maker',\n title: 'Thumbnail Maker',\n tagline: 'Click-worthy YouTube thumbnails from a prompt.',\n description:\n 'Describe your video and generate bold, high-contrast thumbnail art — expressive subjects, dramatic lighting and space for your title text.',\n category: DE,\n kind: 'image-gen',\n prompt:\n 'YouTube thumbnail background art: {input}. Bold high-contrast composition, dramatic lighting, vivid colors, expressive and eye-catching, clear space for large title text, 16:9.',\n inputLabel: 'Describe your video',\n defaultInput: 'a developer reacting to code on a giant glowing screen, shocked expression',\n size: '1536x1024',\n keywords: ['youtube thumbnail maker', 'ai thumbnail generator', 'thumbnail background'],\n },\n {\n slug: 'poster-maker',\n title: 'AI Poster Maker',\n tagline: 'Striking poster art from a description.',\n description:\n 'Generate poster-grade artwork for events, films, gigs and rooms — pick a style from swiss minimal to retro sci-fi and describe the subject.',\n category: DE,\n kind: 'image-gen',\n prompt:\n 'Poster artwork: {input}. Striking composition designed as a printed poster, strong focal point, balanced negative space, high detail.',\n inputLabel: 'Describe the poster',\n defaultInput: 'a retro-futuristic travel poster for Mars, bold shapes, sunset palette',\n size: '1024x1536',\n keywords: ['ai poster maker', 'poster generator', 'event poster design'],\n },\n {\n slug: 'pattern-maker',\n title: 'Seamless Pattern Maker',\n tagline: 'Tileable terrain, patterns and materials.',\n description:\n 'Generate truly seamless repeating tiles for game terrain, wallpaper, fabric, wrapping paper and backgrounds. The dedicated tiling model keeps opposite edges compatible instead of relying on prompt wording alone.',\n category: DE,\n kind: 'image-gen',\n prompt:\n 'Seamless repeating tileable texture: {input}. Orthographic surface, even lighting, balanced detail distribution, no border, no frame, no text.',\n inputLabel: 'Tile or pattern idea',\n defaultInput: 'hand-painted mossy forest floor for a top-down fantasy game, readable shapes, low visual noise',\n presets: [\n { label: 'Fantasy grass', input: 'hand-painted emerald grass and tiny clover for a top-down fantasy game, readable low-noise detail' },\n { label: 'Ocean water', input: 'deep blue stylized ocean water with soft wavelets and subtle foam, top-down game terrain' },\n { label: 'Dungeon stone', input: 'ancient dark stone floor with worn cracks, faint moss and restrained fantasy detail' },\n { label: 'Botanical fabric', input: 'hand-drawn botanical leaves and wildflowers, sage green and cream, flat fabric pattern' },\n ],\n model: 'seamless-tiling',\n size: '1024x1024',\n keywords: ['seamless pattern generator', 'ai pattern maker', 'game terrain texture', 'tileable texture generator', 'fabric pattern design'],\n },\n {\n slug: 'icon-maker',\n title: 'AI Icon Generator',\n tagline: 'App icons and icon sets from a prompt.',\n description:\n 'Generate polished app icons and UI icon concepts — describe the subject and style (flat, glassy, pixel, 3D) and get centered icon art on clean backgrounds.',\n category: DE,\n kind: 'image-gen',\n prompt:\n 'App icon design: {input}. Single centered icon, clean silhouette, modern polished style, subtle gradient background, no text, presented like a high-end app store icon.',\n inputLabel: 'Icon idea',\n defaultInput: 'a friendly robot head, flat modern style, indigo gradient',\n size: '1024x1024',\n keywords: ['ai icon generator', 'app icon maker', 'icon design ai'],\n },\n {\n slug: 'tshirt-design',\n title: 'T-shirt Design Maker',\n tagline: 'Print-ready tee graphics from your idea.',\n description:\n 'Describe a t-shirt graphic and generate print-ready designs — bold vector looks, vintage badges, streetwear graphics — centered on a plain background for easy printing.',\n category: DE,\n kind: 'image-gen',\n prompt:\n 'T-shirt graphic design: {input}. Bold screen-print style artwork centered on a plain background, limited color palette, crisp edges, print-ready apparel graphic, no mockup.',\n inputLabel: 'Design idea',\n defaultInput: 'a vintage badge of a mountain sunrise with the text \"Keep Climbing\"',\n keywords: ['t shirt design ai', 'tshirt graphic generator', 'print on demand designs'],\n },\n\n // --- Fun ---\n {\n slug: 'emoji-maker',\n title: 'AI Emoji Maker',\n tagline: 'Custom emoji from any idea.',\n description:\n 'Generate custom emoji-style icons for Slack, Discord and chats — describe any object, face or mashup and get a glossy emoji on a transparent-friendly background.',\n category: FU,\n kind: 'image-gen',\n prompt:\n 'A single emoji icon: {input}. Glossy modern emoji style like iOS emoji, centered on a plain white background, simple bold shapes, expressive.',\n inputLabel: 'Emoji idea',\n defaultInput: 'a happy avocado lifting weights',\n size: '1024x1024',\n keywords: ['ai emoji maker', 'custom emoji generator', 'slack emoji maker'],\n },\n {\n slug: 'fantasy-avatar',\n title: 'Fantasy Character Maker',\n tagline: 'D&D-ready character art from a description.',\n description:\n 'Generate fantasy character portraits for tabletop campaigns, books and games — describe race, class, gear and mood and get detailed character art.',\n category: FU,\n kind: 'image-gen',\n prompt:\n 'Fantasy character portrait: {input}. Detailed digital painting, dramatic lighting, epic fantasy art style, head-and-torso composition.',\n inputLabel: 'Describe your character',\n defaultInput: 'an elven ranger with silver hair, forest cloak and a longbow, confident smirk',\n keywords: ['fantasy character generator', 'dnd character art', 'ai character portrait'],\n },\n {\n slug: 'storybook-illustration',\n title: 'Storybook Illustrator',\n tagline: 'Children’s book art from your story ideas.',\n description:\n 'Generate warm children’s-book illustrations for stories, classroom material and gifts — describe the scene and characters and get consistent picture-book art.',\n category: FU,\n kind: 'image-gen',\n prompt:\n 'Children’s picture book illustration: {input}. Warm friendly art style, soft colors, gentle lighting, whimsical detail, suitable for a kids storybook page.',\n inputLabel: 'Describe the scene',\n defaultInput: 'a little fox in a yellow raincoat splashing in puddles with a duck friend',\n keywords: ['childrens book illustration ai', 'storybook art generator', 'kids book images'],\n },\n\n // --- Voice ---\n {\n slug: 'voiceover-generator',\n title: 'AI Voiceover Generator',\n tagline: 'Studio-quality voiceovers from text.',\n description:\n 'Paste a script and generate a natural, studio-quality voiceover in seconds — for videos, ads, explainers, podcasts intros and e-learning. Download the audio and drop it into any editor.',\n category: VO,\n kind: 'tts',\n inputLabel: 'Script',\n defaultInput: 'Welcome to the future of creative work. With AI voiceovers, your words sound studio-ready in seconds.',\n keywords: ['ai voiceover generator', 'text to speech', 'voice generator online'],\n },\n {\n slug: 'story-narrator',\n title: 'Story Narrator',\n tagline: 'Bring stories to life with narration.',\n description:\n 'Turn stories, chapters and bedtime tales into engaging narrated audio — expressive pacing suited to storytelling. Paste text, get narration, download and share.',\n category: VO,\n kind: 'tts',\n inputLabel: 'Story text',\n defaultInput: 'Once upon a time, in a village at the edge of a whispering forest, a small fox found a map drawn in starlight.',\n keywords: ['ai story narrator', 'audiobook voice generator', 'bedtime story voice'],\n },\n\n // --- Music & SFX ---\n {\n slug: 'music-maker',\n title: 'AI Music Maker',\n tagline: 'Original soundtracks from a text prompt.',\n description:\n 'Describe a track — genre, mood, instruments — and generate original royalty-free music for videos, games, podcasts and projects. Saved to your indexed audio library.',\n category: MU,\n kind: 'music',\n inputLabel: 'Describe the track',\n defaultInput: 'uplifting corporate indie pop with warm acoustic guitar, claps and light synths',\n duration: 30,\n keywords: ['ai music generator', 'royalty free music maker', 'text to music'],\n },\n {\n slug: 'lofi-generator',\n title: 'Lo-fi Beat Generator',\n tagline: 'Chill lo-fi beats to study and stream to.',\n description:\n 'Generate mellow lo-fi hip-hop beats — dusty drums, warm keys, vinyl crackle. Perfect background music for studying, streams and cafes.',\n category: MU,\n kind: 'music',\n inputLabel: 'Vibe',\n defaultInput: 'mellow lofi hip hop beat, dusty drums, warm rhodes keys, vinyl crackle, rainy night mood',\n duration: 30,\n keywords: ['lofi generator', 'ai lofi beats', 'study music generator'],\n },\n {\n slug: 'sound-effects',\n title: 'Sound Effect Generator',\n tagline: 'Any SFX from a text description.',\n description:\n 'Describe a sound — whoosh, footsteps on gravel, sci-fi door, crowd cheer — and generate clean sound effects for videos, games and apps.',\n category: MU,\n kind: 'sfx',\n inputLabel: 'Describe the sound',\n defaultInput: 'a deep cinematic whoosh transition with a soft impact tail',\n duration: 8,\n keywords: ['ai sound effects', 'sfx generator', 'text to sound effect'],\n },\n\n // --- Video ---\n {\n slug: 'image-to-video',\n title: 'Photo Animator',\n tagline: 'Bring still photos to life as video.',\n description:\n 'Upload a photo, describe the motion, and get a short cinematic video clip — drifting clouds, camera push-ins, flowing water, living portraits. Powered by state-of-the-art image-to-video models.',\n category: VI,\n kind: 'image-video',\n prompt: '{input}',\n inputLabel: 'Describe the motion',\n defaultInput: 'gentle cinematic camera push-in, subtle natural motion in the scene',\n model: 'ltx-2.3-image-to-video',\n keywords: ['image to video ai', 'animate photo', 'photo to video generator'],\n },\n {\n slug: 'text-to-video',\n title: 'AI Video Generator',\n tagline: 'Short video clips from a text prompt.',\n description:\n 'Describe a shot and generate a short AI video clip — product b-roll, mood loops, concept previz. The auto route picks a strong current video model for your prompt.',\n category: VI,\n kind: 'video',\n prompt: '{input}',\n inputLabel: 'Describe the video',\n defaultInput: 'aerial drone shot over turquoise coastline at golden hour, cinematic',\n model: 'auto-video',\n keywords: ['ai video generator', 'text to video', 'video clip generator'],\n },\n];\n\nexport const useCaseBySlug: Record = Object.fromEntries(useCases.map((u) => [u.slug, u]));\n\nexport const useCaseCategories: UseCaseCategory[] = [\n 'Real Estate',\n 'E-commerce',\n 'Portraits',\n 'Photo Fix',\n 'Art Styles',\n 'Design',\n 'Fun',\n 'Voice',\n 'Music & SFX',\n 'Video',\n];\n\nexport function useCaseNeedsImage(kind: UseCaseKind): boolean {\n return kind === 'image-edit' || kind === 'remove-bg' || kind === 'image-video';\n}\n\nexport function useCaseMeta(slug: string): { title: string; description: string } | null {\n const u = useCaseBySlug[slug];\n if (!u) return null;\n return { title: `${u.title} — free to try with credits | app.nz`, description: u.description };\n}\n","export type AlternativeCategory = 'cloud-hosting' | 'model-infra' | 'agent-cloud';\n\ninterface AlternativeSeed {\n slug: string;\n competitor: string;\n category: AlternativeCategory;\n url: string;\n summary: string;\n strengths: string[];\n chooseThem: string;\n appNzAngle: string;\n migration: string;\n specialNote?: string;\n}\n\nexport interface Alternative {\n slug: string;\n title: string;\n competitor: string;\n category: AlternativeCategory;\n categoryLabel: string;\n url: string;\n excerpt: string;\n readTime: string;\n summary: string;\n strengths: string[];\n chooseThem: string;\n appNzAngle: string;\n migration: string;\n body: string;\n}\n\nexport const alternativeCategoryLabels: Record = {\n 'cloud-hosting': 'Cloud hosting',\n 'model-infra': 'AI model infrastructure',\n 'agent-cloud': 'AI agent cloud',\n};\n\nconst appNzCore = [\n 'cloud coding agents that can work on repos and hand back durable diffs',\n 'static sites, server deploys, private container builds, domains, logs, queues, and secrets',\n 'one OpenAI-compatible model gateway for text, image, video, audio, embeddings, search, and 3D',\n 'scale-to-zero GPU hosting for Cog and Comfy workloads',\n 'one credit balance and API surface across the product instead of separate tools for every layer',\n];\n\nfunction list(items: string[]): string {\n return items.map((item) => `- ${item}`).join('\\n');\n}\n\nfunction articleBody(seed: AlternativeSeed): string {\n const categoryLabel = alternativeCategoryLabels[seed.category];\n const special = seed.specialNote\n ? `\\n\\n## A note on ${seed.competitor}\\n\\n${seed.specialNote}\\n`\n : '';\n\n return `\n## ${seed.competitor} Alternative: app.nz\n\n[${seed.competitor}](${seed.url}) is a strong ${categoryLabel.toLowerCase()} option. ${seed.summary}\n\nThis comparison is written with respect for ${seed.competitor}. The point is not that one product is universally better. The question is which scope you want: a focused specialist, or one place where agents, deploys, model routing, GPU workloads, and app hosting live together.\n\n## Where ${seed.competitor} is strong\n\n${list(seed.strengths)}\n\n## Where app.nz is different\n\napp.nz is broader than a single hosting product, gateway, or coding assistant. It combines:\n\n${list(appNzCore)}\n\n${seed.appNzAngle}\n\n## Choose ${seed.competitor} when\n\n${seed.chooseThem}\n\n## Choose app.nz when\n\nUse app.nz when you want the development loop and the runtime loop in one system: ask an agent to work on code, build or deploy the result, route models through the gateway, host GPU endpoints when needed, and keep operational primitives like queues, logs, domains, datasets, notebooks, and billing close to the same account.\n\n## Migration path\n\n${seed.migration}\n\n## Bottom line\n\n${seed.competitor} is a good product for its lane. app.nz is the alternative when the lane is too narrow and you want an AI agent cloud that also hosts the application, routes the models, and runs the GPU or worker infrastructure behind it.${special}\n`;\n}\n\nconst seeds: AlternativeSeed[] = [\n {\n slug: 'vercel',\n competitor: 'Vercel',\n category: 'cloud-hosting',\n url: 'https://vercel.com',\n summary: 'Vercel is especially strong for frontend teams shipping Next.js and edge-rendered web apps with a polished developer experience.',\n strengths: ['Excellent frontend workflow for Next.js teams.', 'Fast previews and branch-based deployments.', 'A mature ecosystem around web performance and framework integrations.'],\n chooseThem: 'Choose Vercel when your core problem is deploying a frontend or full-stack Next.js app with first-class preview deployments and edge delivery.',\n appNzAngle: 'app.nz is aimed at teams whose frontend is only one part of the system: agents need to edit the repo, models need to route across providers, background jobs need queues, and GPU workloads may need to scale to zero.',\n migration: 'Move static output to app.nz sites first, then move API containers or GPU-backed model endpoints when you want the same account to own the agent, model, and deploy workflow.',\n },\n {\n slug: 'netlify',\n competitor: 'Netlify',\n category: 'cloud-hosting',\n url: 'https://www.netlify.com',\n summary: 'Netlify is a well-known platform for Jamstack sites, deploy previews, forms, functions, and edge-oriented frontend hosting.',\n strengths: ['Simple static and Jamstack deploys.', 'Good collaboration model for previews and branches.', 'Useful built-in frontend platform features around forms and functions.'],\n chooseThem: 'Choose Netlify when you want a mature Jamstack workflow and the site itself is the main product surface.',\n appNzAngle: 'app.nz focuses on the broader builder loop: coding agents, model gateway, GPU model hosting, container builds, datasets, notebooks, and deploys under one product.',\n migration: 'Export or build your frontend to a directory and deploy it as an app.nz site; keep backend and model work on app.nz when you want fewer separate control planes.',\n },\n {\n slug: 'cloudflare-pages-workers',\n competitor: 'Cloudflare Pages and Workers',\n category: 'cloud-hosting',\n url: 'https://www.cloudflare.com/developer-platform/',\n summary: 'Cloudflare has a powerful global edge network and a strong developer platform for Pages, Workers, storage, queues, and edge compute.',\n strengths: ['Huge global edge footprint.', 'Workers are a strong fit for low-latency edge logic.', 'A broad developer platform with storage, queues, and security features.'],\n chooseThem: 'Choose Cloudflare when your main requirement is edge-first runtime behavior close to users or deep use of the Cloudflare network.',\n appNzAngle: 'app.nz is not trying to replace the entire Cloudflare network. It is the alternative when your main work is AI-native app building: agents, model routing, GPU inference, notebooks, repos, and deploys together.',\n migration: 'Keep Cloudflare for DNS or edge security if it is already working, and move app build, model gateway, agent, or GPU workloads to app.nz where the AI workflow benefits from one account.',\n },\n {\n slug: 'heroku',\n competitor: 'Heroku',\n category: 'cloud-hosting',\n url: 'https://www.heroku.com',\n summary: 'Heroku made application deployment approachable with git-driven deploys, dynos, add-ons, logs, and a simple app-centric mental model.',\n strengths: ['Simple app deployment model.', 'Useful add-on ecosystem and operational defaults.', 'Good fit for teams that value product simplicity over raw infrastructure control.'],\n chooseThem: 'Choose Heroku when you want a classic PaaS for web processes, workers, and add-ons with a familiar developer workflow.',\n appNzAngle: 'app.nz takes the PaaS idea into the AI-agent era: the platform can host the app, run agents on the repo, route model calls, and run GPU endpoints without leaving the same product.',\n migration: 'Containerize the Heroku app or deploy static output first, then move model calls to the app.nz gateway and background work to app.nz queues or workers.',\n },\n {\n slug: 'railway',\n competitor: 'Railway',\n category: 'cloud-hosting',\n url: 'https://railway.app',\n summary: 'Railway is popular for fast app and database deployments with a clean developer experience and simple project-based infrastructure.',\n strengths: ['Fast project setup for apps and databases.', 'Good developer ergonomics for small teams.', 'A friendly path from prototype to hosted service.'],\n chooseThem: 'Choose Railway when you want a fast general-purpose app host and your infrastructure shape is mostly services and databases.',\n appNzAngle: 'app.nz is a stronger fit when the app is AI-native: coding agents, model routing, prompt/model evaluation, GPU inference, and deploys all need to work together.',\n migration: 'Start with the service that benefits most from app.nz, often static hosting, model gateway calls, or agent-driven repo work, then move containers once the deploy path is proven.',\n },\n {\n slug: 'render',\n competitor: 'Render',\n category: 'cloud-hosting',\n url: 'https://render.com',\n summary: 'Render gives teams a straightforward way to run web services, static sites, background workers, cron jobs, and managed databases.',\n strengths: ['Clear service model across web, worker, cron, and static deployments.', 'Good fit for conventional web apps.', 'Managed databases and operational basics in one platform.'],\n chooseThem: 'Choose Render when you need a conventional app platform with a clean service model and managed infrastructure primitives.',\n appNzAngle: 'app.nz adds the AI-native layer on top of hosting: agents that change code, gateway routes that pick models, GPU endpoints that scale down, and notebooks/datasets for analysis.',\n migration: 'Move static sites or container services incrementally; route AI calls through app.nz first if you want immediate benefit without changing the hosting layer.',\n },\n {\n slug: 'fly-io',\n competitor: 'Fly.io',\n category: 'cloud-hosting',\n url: 'https://fly.io',\n summary: 'Fly.io is strong for running containers close to users, especially when geography and low-latency distributed apps matter.',\n strengths: ['Container-first deployment model.', 'Good global placement story.', 'Useful when app instances need to run close to users.'],\n chooseThem: 'Choose Fly.io when your primary need is distributed container placement and low-latency app instances across regions.',\n appNzAngle: 'app.nz is the alternative when the higher-level AI workflow matters more than regional container placement: agents, model gateway, GPU cogs, Comfy workflows, queues, and hosted sites.',\n migration: 'Keep latency-sensitive services on Fly.io if they are already tuned, and move AI routing, model hosting, and agent-driven deploy workflows to app.nz.',\n },\n {\n slug: 'digitalocean-app-platform',\n competitor: 'DigitalOcean App Platform',\n category: 'cloud-hosting',\n url: 'https://www.digitalocean.com/products/app-platform',\n summary: 'DigitalOcean is a familiar cloud for developers who want droplets, managed databases, Kubernetes, object storage, and a simpler app platform.',\n strengths: ['Developer-friendly cloud primitives.', 'Good fit for teams that want simple virtual machines or managed databases.', 'A broad infrastructure footprint without hyperscaler complexity.'],\n chooseThem: 'Choose DigitalOcean when you want straightforward cloud infrastructure and know exactly which resources you want to operate.',\n appNzAngle: 'app.nz works at a higher product level for AI apps: agent tasks, deploys, model routes, GPU workloads, notebooks, queues, and billing are first-class product surfaces.',\n migration: 'Move the parts that benefit from managed AI workflow first: model gateway traffic, agent tasks, static sites, or GPU endpoints.',\n },\n {\n slug: 'aws',\n competitor: 'AWS',\n category: 'cloud-hosting',\n url: 'https://aws.amazon.com',\n summary: 'AWS is the broadest cloud platform for teams that need deep infrastructure choice, enterprise controls, regions, services, and ecosystem depth.',\n strengths: ['Very broad infrastructure and managed-service catalog.', 'Strong enterprise controls and global availability.', 'Good fit for teams with platform engineering capacity.'],\n chooseThem: 'Choose AWS when you need maximum infrastructure breadth, deep enterprise governance, or direct control over low-level cloud architecture.',\n appNzAngle: 'app.nz is deliberately narrower and more productized: it gives AI builders the common path for agents, deploys, model routing, GPU endpoints, and app hosting without assembling dozens of services.',\n migration: 'Do not move everything at once. Put app.nz in front of AI model traffic or agent workflows first, then decide which deploys or GPU workloads should leave custom AWS infrastructure.',\n },\n {\n slug: 'google-cloud',\n competitor: 'Google Cloud',\n category: 'cloud-hosting',\n url: 'https://cloud.google.com',\n summary: 'Google Cloud is strong for data, Kubernetes, AI infrastructure, and teams already invested in Google services and identity.',\n strengths: ['Strong data and AI platform story.', 'Mature Kubernetes and cloud infrastructure.', 'Good fit for teams standardized on Google Cloud.'],\n chooseThem: 'Choose Google Cloud when your organization already runs on GCP or needs direct access to its data, AI, and infrastructure services.',\n appNzAngle: 'app.nz is a higher-level alternative for shipping AI apps quickly: model routing, agents, deploys, GPU hosting, notebooks, and app primitives are product surfaces rather than cloud architecture projects.',\n migration: 'Use app.nz for the application and model workflow while keeping existing GCP data or enterprise systems where they are.',\n },\n {\n slug: 'azure',\n competitor: 'Microsoft Azure',\n category: 'cloud-hosting',\n url: 'https://azure.microsoft.com',\n summary: 'Azure is a major enterprise cloud, especially strong for Microsoft-aligned organizations, identity, compliance, and hybrid infrastructure.',\n strengths: ['Strong enterprise and Microsoft ecosystem fit.', 'Broad infrastructure and managed services.', 'Good governance options for large organizations.'],\n chooseThem: 'Choose Azure when Microsoft identity, enterprise procurement, compliance, or existing Azure estates are central requirements.',\n appNzAngle: 'app.nz is the alternative for product teams that want a smaller AI-native control plane: coding agents, deploys, model routing, GPU endpoints, and operational primitives without building an internal platform first.',\n migration: 'Keep enterprise systems on Azure and move AI app workflows, agent tasks, or model calls to app.nz when the product team needs speed.',\n },\n {\n slug: 'firebase',\n competitor: 'Firebase',\n category: 'cloud-hosting',\n url: 'https://firebase.google.com',\n summary: 'Firebase is a strong backend and hosting platform for web and mobile apps that want auth, realtime data, functions, and app analytics.',\n strengths: ['Great mobile and frontend developer experience.', 'Integrated auth, database, functions, and hosting.', 'Good fit for realtime app prototypes and consumer apps.'],\n chooseThem: 'Choose Firebase when your app depends heavily on Firebase auth, realtime data, mobile SDKs, or the Google-backed app platform ecosystem.',\n appNzAngle: 'app.nz is built around AI-native production loops: code agents, model gateway, GPU inference, hosted sites, container builds, queues, and notebooks.',\n migration: 'Keep Firebase auth or data if it is core, and use app.nz for AI gateway calls, agent-driven code work, static deploys, or GPU-backed features.',\n },\n {\n slug: 'supabase',\n competitor: 'Supabase',\n category: 'cloud-hosting',\n url: 'https://supabase.com',\n summary: 'Supabase is a strong open-source Firebase alternative centered on Postgres, auth, storage, realtime, and edge functions.',\n strengths: ['Excellent Postgres-centered developer experience.', 'Open-source posture and familiar SQL foundation.', 'Useful integrated auth, storage, realtime, and functions.'],\n chooseThem: 'Choose Supabase when Postgres, auth, and database-backed app development are the main problems to solve.',\n appNzAngle: 'app.nz complements database platforms by handling AI-specific workflow: agents, model routing, GPU hosting, app deploys, queues, and notebooks.',\n migration: 'A common path is Supabase for data and app.nz for the AI and hosting layer: route model calls through app.nz, deploy frontends to sites, and let agents work on the repo.',\n },\n {\n slug: 'deno-deploy',\n competitor: 'Deno Deploy',\n category: 'cloud-hosting',\n url: 'https://deno.com/deploy',\n summary: 'Deno Deploy is a focused runtime for JavaScript and TypeScript at the edge, with a clean Deno-native developer story.',\n strengths: ['Clean TypeScript-first runtime.', 'Good edge deployment story.', 'Strong fit for teams already using Deno.'],\n chooseThem: 'Choose Deno Deploy when your app is Deno-native and edge JavaScript or TypeScript execution is the primary requirement.',\n appNzAngle: 'app.nz is broader: it can host static or containerized apps while also running coding agents, routing model calls, and serving GPU-backed inference.',\n migration: 'Move the frontend or AI-facing service to app.nz when you need integrated model routing or deploy automation beyond Deno runtime hosting.',\n },\n {\n slug: 'github-pages',\n competitor: 'GitHub Pages',\n category: 'cloud-hosting',\n url: 'https://pages.github.com',\n summary: 'GitHub Pages is a simple and reliable way to publish static content directly from GitHub repositories.',\n strengths: ['Very simple static publishing for repo-backed sites.', 'Great fit for docs, project pages, and open-source sites.', 'Low operational overhead.'],\n chooseThem: 'Choose GitHub Pages when you only need static public pages from a repository and do not need app hosting or AI infrastructure.',\n appNzAngle: 'app.nz keeps static hosting simple but adds the rest of the AI app stack: agents, model gateway, GPU workloads, private builds, queues, domains, and logs.',\n migration: 'Build the static output and deploy it to app.nz sites when you want the page to sit next to agents, model calls, analytics, and richer deploy workflows.',\n },\n {\n slug: 'gitlab-pages',\n competitor: 'GitLab Pages',\n category: 'cloud-hosting',\n url: 'https://docs.gitlab.com/user/project/pages/',\n summary: 'GitLab Pages is useful for teams already using GitLab CI/CD who want static pages published from the same repository workflow.',\n strengths: ['Good fit for GitLab-centered teams.', 'Works naturally with GitLab CI/CD.', 'Simple static site publishing.'],\n chooseThem: 'Choose GitLab Pages when your team is already standardized on GitLab and needs static publishing from GitLab pipelines.',\n appNzAngle: 'app.nz is broader than static publishing. It is built for agents that edit code, model gateway calls, GPU endpoints, deploys, queues, datasets, and notebooks.',\n migration: 'Keep GitLab as source control if that is your system of record, and deploy built output or AI workloads to app.nz.',\n },\n {\n slug: 'platform-sh',\n competitor: 'Platform.sh',\n category: 'cloud-hosting',\n url: 'https://platform.sh',\n summary: 'Platform.sh is a mature application platform for complex web apps, preview environments, and managed infrastructure workflows.',\n strengths: ['Strong preview and environment workflows.', 'Good fit for complex application stacks.', 'Mature platform controls for larger teams.'],\n chooseThem: 'Choose Platform.sh when you need sophisticated environment management for conventional application stacks.',\n appNzAngle: 'app.nz is more AI-native and productized: agents, model routing, GPU hosting, and deploy workflows are core rather than add-ons around a web stack.',\n migration: 'Move AI-facing services or frontend deploys to app.nz first; keep complex legacy app environments on Platform.sh until there is a clear simplification path.',\n },\n {\n slug: 'koyeb',\n competitor: 'Koyeb',\n category: 'cloud-hosting',\n url: 'https://www.koyeb.com',\n summary: 'Koyeb is a serverless platform for deploying containers, web apps, APIs, workers, and AI workloads with a simple developer experience.',\n strengths: ['Container and app deployment with a clean workflow.', 'Useful for APIs, workers, and serverless-style services.', 'Good fit for teams that want less infrastructure management.'],\n chooseThem: 'Choose Koyeb when containerized services and serverless deployment are the main requirements.',\n appNzAngle: 'app.nz is the alternative when the deployment is part of a larger AI system involving coding agents, model routing, GPU endpoints, datasets, notebooks, and queues.',\n migration: 'Container services can move gradually; model gateway usage and agent-driven code tasks are often the easiest first app.nz wins.',\n },\n {\n slug: 'northflank',\n competitor: 'Northflank',\n category: 'cloud-hosting',\n url: 'https://northflank.com',\n summary: 'Northflank is a developer platform for deploying services, jobs, databases, and pipelines with strong container and environment workflows.',\n strengths: ['Good container deployment and pipeline model.', 'Useful service, job, and database primitives.', 'Strong fit for teams that want more control than simple static hosting.'],\n chooseThem: 'Choose Northflank when your main platform need is container orchestration, jobs, environments, and databases.',\n appNzAngle: 'app.nz adds AI-specific product surfaces: agents that operate on repos, model gateway routing, GPU cogs, Comfy workflows, notebooks, and app deploys.',\n migration: 'Move AI workloads and static deploys first; container services can move when you want a single account to own code work, model work, and hosting.',\n },\n {\n slug: 'qovery',\n competitor: 'Qovery',\n category: 'cloud-hosting',\n url: 'https://www.qovery.com',\n summary: 'Qovery helps teams deploy applications on top of their cloud or Kubernetes infrastructure with a developer-friendly control plane.',\n strengths: ['Useful for teams that want a platform layer over existing cloud infrastructure.', 'Good fit for Kubernetes-backed application delivery.', 'Helps standardize deployments across teams.'],\n chooseThem: 'Choose Qovery when your strategy is to run on your own cloud account while giving developers a simpler deployment layer.',\n appNzAngle: 'app.nz is more opinionated and AI-native: instead of being only a deployment layer, it includes agents, model routing, GPU hosting, app hosting, queues, and notebooks.',\n migration: 'Use app.nz for new AI apps or agent workflows first, while existing Kubernetes-backed services continue through Qovery until consolidation makes sense.',\n },\n {\n slug: 'coolify',\n competitor: 'Coolify',\n category: 'cloud-hosting',\n url: 'https://coolify.io',\n summary: 'Coolify is a popular open-source self-hosted platform for deploying apps, databases, and services on your own servers.',\n strengths: ['Open-source and self-hostable.', 'Good for teams that want control over their own servers.', 'Useful for app, database, and service deployment without a large platform team.'],\n chooseThem: 'Choose Coolify when self-hosting and control are more important than managed AI-specific workflows.',\n appNzAngle: 'app.nz trades some self-hosting control for an integrated AI product: coding agents, model gateway, GPU endpoints, sites, builds, queues, notebooks, and billing in one place.',\n migration: 'Keep self-hosted services on Coolify where control matters; use app.nz for AI gateway, agents, GPU workloads, or hosted sites that benefit from managed orchestration.',\n },\n {\n slug: 'dokku',\n competitor: 'Dokku',\n category: 'cloud-hosting',\n url: 'https://dokku.com',\n summary: 'Dokku is a lightweight open-source PaaS that brings Heroku-like git push deployment to your own server.',\n strengths: ['Small, understandable, and self-hosted.', 'Great for developers who want Heroku-like deploys on one VM.', 'Low abstraction compared with larger platforms.'],\n chooseThem: 'Choose Dokku when you want to own the server and keep deployment mechanics simple.',\n appNzAngle: 'app.nz is for teams that want the platform to own more of the AI workflow: agents, model routing, GPU hosting, static and server deploys, queues, and logs.',\n migration: 'Move the apps that need AI gateway, GPU, or agent integration first; leave simple self-hosted services on Dokku if they are working well.',\n },\n {\n slug: 'caprover',\n competitor: 'CapRover',\n category: 'cloud-hosting',\n url: 'https://caprover.com',\n summary: 'CapRover is a self-hosted PaaS for deploying web apps, databases, and one-click app templates on your own server.',\n strengths: ['Self-hosted app platform with a visual control plane.', 'Good for teams comfortable operating their own server.', 'Useful for simple web app and database deployments.'],\n chooseThem: 'Choose CapRover when self-hosting is the goal and your workloads fit a straightforward app platform.',\n appNzAngle: 'app.nz is the managed AI-native alternative: it connects coding agents, deploys, model gateway, GPU hosting, queues, notebooks, and app hosting.',\n migration: 'Use app.nz for AI-facing services, frontends, or GPU workloads while keeping self-hosted internal apps on CapRover as needed.',\n },\n {\n slug: 'hetzner',\n competitor: 'Hetzner',\n category: 'cloud-hosting',\n url: 'https://www.hetzner.com',\n summary: 'Hetzner is valued by many builders for cost-effective servers and straightforward infrastructure.',\n strengths: ['Strong value for virtual and dedicated servers.', 'Good choice for teams comfortable managing machines.', 'Useful for predictable server workloads.'],\n chooseThem: 'Choose Hetzner when you want raw server value and are comfortable assembling the platform yourself.',\n appNzAngle: 'app.nz can use providers like Hetzner behind the scenes, but exposes a product surface for agents, deploys, model routing, GPU hosting, queues, and notebooks instead of raw servers.',\n migration: 'Keep cost-sensitive infrastructure on Hetzner where it is already efficient; move app and AI orchestration to app.nz when developer speed matters more than machine-level control.',\n },\n {\n slug: 'vultr',\n competitor: 'Vultr',\n category: 'cloud-hosting',\n url: 'https://www.vultr.com',\n summary: 'Vultr offers cloud compute, bare metal, Kubernetes, storage, and GPU options for teams that want infrastructure primitives.',\n strengths: ['Broad infrastructure primitives.', 'Good fit for teams that want direct control over servers and regions.', 'Useful compute options for conventional hosting needs.'],\n chooseThem: 'Choose Vultr when you need infrastructure building blocks and are ready to operate the stack yourself.',\n appNzAngle: 'app.nz is the alternative when you want productized AI app infrastructure: agents, deploys, model routes, GPU cogs, Comfy workflows, queues, and logs.',\n migration: 'Move the AI product layer first. Raw infrastructure can remain on Vultr until the managed app.nz path is simpler.',\n },\n {\n slug: 'openrouter',\n competitor: 'OpenRouter',\n category: 'model-infra',\n url: 'https://openrouter.ai',\n summary: 'OpenRouter is a respected model router with a single API surface for many language models.',\n strengths: ['Broad model catalog behind an OpenAI-compatible API.', 'Useful for comparing and routing language models.', 'Good fit when chat model access is the main problem.'],\n chooseThem: 'Choose OpenRouter when you mainly need a model marketplace/router and your application hosting already lives elsewhere.',\n appNzAngle: 'app.nz includes a model gateway too, but places it next to coding agents, deploys, GPU model hosting, queues, notebooks, datasets, and app hosting.',\n migration: 'Many OpenAI-compatible clients can move by changing base URL and key, then deciding which model names should become app.nz auto routes or pinned provider routes.',\n },\n {\n slug: 'openai',\n competitor: 'OpenAI API',\n category: 'model-infra',\n url: 'https://platform.openai.com',\n summary: 'The OpenAI API is a default starting point for many teams building with frontier models and the OpenAI SDK shape.',\n strengths: ['Frontier models and a widely used SDK/API shape.', 'Strong ecosystem of examples and client libraries.', 'Good fit when OpenAI-only access is enough.'],\n chooseThem: 'Choose the OpenAI API directly when you want direct vendor access and do not need cross-provider routing or app hosting in the same product.',\n appNzAngle: 'app.nz keeps the OpenAI-compatible shape while routing across providers and adding app deploys, coding agents, GPU endpoints, and broader infrastructure.',\n migration: 'Switch the base URL and API key for compatible calls, then use app.nz model ids or auto routes where cross-provider flexibility is useful.',\n },\n {\n slug: 'anthropic',\n competitor: 'Anthropic API',\n category: 'model-infra',\n url: 'https://www.anthropic.com/api',\n summary: 'Anthropic is known for Claude models and is a strong direct provider choice for teams that want to build around Claude.',\n strengths: ['Strong Claude model family.', 'Good fit for teams standardizing on Anthropic.', 'Direct vendor relationship and provider-specific features.'],\n chooseThem: 'Choose Anthropic directly when Claude is your primary model family and vendor-specific API behavior is important.',\n appNzAngle: 'app.nz routes Anthropic alongside other model providers and connects those calls to agents, hosting, deploys, GPU endpoints, and billing.',\n migration: 'Use app.nz for OpenAI-compatible routed calls or keep direct Anthropic usage where provider-specific features matter.',\n },\n {\n slug: 'together-ai',\n competitor: 'Together AI',\n category: 'model-infra',\n url: 'https://www.together.ai',\n summary: 'Together AI is strong for open-weight model inference, fine-tuning, and teams working closely with open models.',\n strengths: ['Strong open-model infrastructure.', 'Useful for teams that care about Llama, DeepSeek, Mistral, and similar model families.', 'Good fit for open-weight inference workflows.'],\n chooseThem: 'Choose Together AI when open model infrastructure is the center of your stack.',\n appNzAngle: 'app.nz can route to open and closed models while also hosting apps, running agents, deploying GPU endpoints, and managing broader AI product infrastructure.',\n migration: 'Keep specialized open-model workflows where they are strongest; route application-level model traffic through app.nz when you want one gateway across providers.',\n },\n {\n slug: 'replicate',\n competitor: 'Replicate',\n category: 'model-infra',\n url: 'https://replicate.com',\n summary: 'Replicate is well known for running machine-learning models as APIs, especially community-published image, video, and Cog-style models.',\n strengths: ['Large ecosystem of model APIs.', 'Good experience for trying community models quickly.', 'Cog conventions are familiar for model packaging.'],\n chooseThem: 'Choose Replicate when you want immediate access to its model ecosystem and hosted model APIs.',\n appNzAngle: 'app.nz supports Cog-style GPU hosting too, but places it beside deploys, agents, model gateway routing, Comfy workflows, queues, and app hosting.',\n migration: 'Move custom Cog containers to app.nz when you want the model endpoint to live with the rest of the app platform; keep Replicate calls where its marketplace is the fastest path.',\n },\n {\n slug: 'fal-ai',\n competitor: 'fal.ai',\n category: 'model-infra',\n url: 'https://fal.ai',\n summary: 'fal.ai is strong for fast media-generation APIs and creative model workflows.',\n strengths: ['Strong image, video, and media model API focus.', 'Good developer experience for creative AI workloads.', 'Useful model catalog for generation tasks.'],\n chooseThem: 'Choose fal.ai when you primarily need fal-hosted media models and want direct access to that ecosystem.',\n appNzAngle: 'app.nz routes media models too, and adds app hosting, agents, GPU cogs, Comfy workflows, and one operational surface for the broader AI app.',\n migration: 'Use app.nz gateway routes for app-level media calls, and keep direct fal usage where you need a specific fal endpoint or behavior.',\n },\n {\n slug: 'runpod',\n competitor: 'RunPod',\n category: 'model-infra',\n url: 'https://www.runpod.io',\n summary: 'RunPod is a useful GPU cloud for pods and serverless GPU workloads.',\n strengths: ['GPU pods and serverless GPU execution.', 'Good fit for teams that know their container and GPU requirements.', 'Useful GPU marketplace and operational model.'],\n chooseThem: 'Choose RunPod directly when you want to manage GPU endpoints yourself and need direct provider-level control.',\n appNzAngle: 'app.nz can use RunPod-style GPU capacity behind the scenes while exposing a higher-level product: cogs, Comfy workflows, routing, idle reaping, metering, and app integration.',\n migration: 'Move model images to app.nz cogs or Comfy deployments when you want scale-to-zero GPU behavior connected to app deploys and the model gateway.',\n },\n {\n slug: 'modal',\n competitor: 'Modal',\n category: 'model-infra',\n url: 'https://modal.com',\n summary: 'Modal is a strong serverless compute platform for Python, ML, batch jobs, and GPU-backed functions.',\n strengths: ['Excellent Python-first compute workflow.', 'Strong fit for ML jobs, batch work, and serverless GPU functions.', 'Developer-friendly abstraction over infrastructure.'],\n chooseThem: 'Choose Modal when your workload is primarily Python functions, ML jobs, or serverless compute pipelines.',\n appNzAngle: 'app.nz focuses on the product around the compute: coding agents, deploys, model gateway, hosted apps, GPU endpoints, queues, notebooks, and billing.',\n migration: 'Keep specialized Python compute on Modal if it is working well; move product-facing model endpoints, agents, and app deploys to app.nz when integration matters.',\n },\n {\n slug: 'baseten',\n competitor: 'Baseten',\n category: 'model-infra',\n url: 'https://www.baseten.co',\n summary: 'Baseten is focused on deploying, scaling, and operating machine-learning inference workloads.',\n strengths: ['Strong model-serving focus.', 'Good fit for teams operationalizing ML inference.', 'Useful when inference infrastructure is the main platform problem.'],\n chooseThem: 'Choose Baseten when production ML inference operations are the central requirement.',\n appNzAngle: 'app.nz is broader: it includes inference but also app hosting, coding agents, gateway routing, GPU cogs, Comfy workflows, queues, notebooks, and deploys.',\n migration: 'Use app.nz for AI app workflows and gateway calls first; move model endpoints when you want them in the same control plane as the application.',\n },\n {\n slug: 'hugging-face-spaces',\n competitor: 'Hugging Face Spaces',\n category: 'model-infra',\n url: 'https://huggingface.co/spaces',\n summary: 'Hugging Face Spaces is a great way to share ML demos and apps with the Hugging Face community.',\n strengths: ['Excellent model and community ecosystem.', 'Good path for Gradio, Streamlit, and demo apps.', 'Strong discovery for open ML projects.'],\n chooseThem: 'Choose Hugging Face Spaces when community sharing, demos, and the Hugging Face ecosystem are the primary goals.',\n appNzAngle: 'app.nz is aimed at production AI app workflows: coding agents, deploys, model gateway, GPU hosting, queues, datasets, notebooks, and billing.',\n migration: 'Keep public demos on Spaces if discovery matters; deploy production-facing apps, gateways, or GPU endpoints to app.nz.',\n },\n {\n slug: 'lightning-ai',\n competitor: 'Lightning AI',\n category: 'model-infra',\n url: 'https://lightning.ai',\n summary: 'Lightning AI is strong for AI development workspaces, training, experiments, and model-building workflows.',\n strengths: ['Good environment for AI research and experimentation.', 'Useful GPU workspaces and training-oriented workflows.', 'Strong fit for teams already using the Lightning ecosystem.'],\n chooseThem: 'Choose Lightning AI when experimentation, training, and ML workspaces are the main need.',\n appNzAngle: 'app.nz is the alternative for shipping the result: agents edit code, apps deploy, models route through a gateway, and GPU inference can scale down.',\n migration: 'Use Lightning AI for research-heavy workflows and app.nz for deployed apps, model endpoints, and product infrastructure.',\n },\n {\n slug: 'vast-ai',\n competitor: 'Vast.ai',\n category: 'model-infra',\n url: 'https://vast.ai',\n summary: 'Vast.ai is a GPU marketplace for renting compute, often attractive when raw GPU price and availability are the main variables.',\n strengths: ['Broad GPU marketplace.', 'Good fit for users optimizing raw GPU cost.', 'Useful when you are comfortable managing the machine-level workflow.'],\n chooseThem: 'Choose Vast.ai when you want direct GPU rentals and are prepared to manage setup, security, images, and lifecycle yourself.',\n appNzAngle: 'app.nz turns GPU work into product primitives: Cog and Comfy deploys, routing, health checks, idle reaping, metering, and app integration.',\n migration: 'Move recurring inference workloads to app.nz when lifecycle management is more valuable than raw marketplace control.',\n },\n {\n slug: 'fireworks-ai',\n competitor: 'Fireworks AI',\n category: 'model-infra',\n url: 'https://fireworks.ai',\n summary: 'Fireworks AI is focused on fast inference and serving for generative AI models, especially open and customizable models.',\n strengths: ['Strong inference platform for model serving.', 'Good fit for open and customizable model use cases.', 'Useful when latency and throughput are central concerns.'],\n chooseThem: 'Choose Fireworks AI when model-serving performance is the core requirement and the rest of your application platform is already handled.',\n appNzAngle: 'app.nz wraps model routing into a larger AI app cloud with deploys, agents, GPU endpoints, queues, notebooks, and hosting.',\n migration: 'Route product traffic through app.nz when you want provider flexibility; keep direct Fireworks usage for workloads tuned to that platform.',\n },\n {\n slug: 'groq',\n competitor: 'GroqCloud',\n category: 'model-infra',\n url: 'https://groq.com',\n summary: 'GroqCloud is known for very fast inference on supported models and a developer-friendly API.',\n strengths: ['Fast inference for supported model families.', 'Good fit for latency-sensitive text workloads.', 'Simple developer path for trying supported models.'],\n chooseThem: 'Choose GroqCloud when supported model latency is the main requirement.',\n appNzAngle: 'app.nz can route across providers and modalities while also hosting the app, running coding agents, and serving GPU workflows.',\n migration: 'Keep Groq as a direct lane for latency-critical supported calls, or access fast model routes through app.nz where gateway and app integration matter.',\n },\n {\n slug: 'cerebras-cloud',\n competitor: 'Cerebras Cloud',\n category: 'model-infra',\n url: 'https://www.cerebras.ai',\n summary: 'Cerebras Cloud is known for high-speed inference on Cerebras infrastructure.',\n strengths: ['Very fast inference for supported workloads.', 'Interesting hardware-backed model serving story.', 'Good fit for teams testing high-throughput text generation.'],\n chooseThem: 'Choose Cerebras Cloud when its supported models and hardware-backed latency profile are the main reason for the integration.',\n appNzAngle: 'app.nz is useful when Cerebras is one provider among many and the product also needs deploys, agents, GPU hosting, queues, and model fallback logic.',\n migration: 'Use app.nz as the routing layer where provider flexibility matters, while keeping direct Cerebras paths for specialized high-speed needs.',\n },\n {\n slug: 'aws-bedrock',\n competitor: 'Amazon Bedrock',\n category: 'model-infra',\n url: 'https://aws.amazon.com/bedrock/',\n summary: 'Amazon Bedrock gives AWS customers managed access to foundation models inside the AWS ecosystem.',\n strengths: ['Strong fit for AWS-centered organizations.', 'Managed access to multiple model families through AWS.', 'Enterprise controls and cloud integration for AWS teams.'],\n chooseThem: 'Choose Bedrock when AWS governance, procurement, and integration are the deciding factors.',\n appNzAngle: 'app.nz is lighter and more productized for AI builders who want one gateway, coding agents, deploys, GPU endpoints, and app hosting without building an AWS platform around it.',\n migration: 'Keep regulated or AWS-native model calls in Bedrock; use app.nz for product teams that need fast cross-provider routing and app infrastructure.',\n },\n {\n slug: 'vertex-ai',\n competitor: 'Vertex AI',\n category: 'model-infra',\n url: 'https://cloud.google.com/vertex-ai',\n summary: \"Vertex AI is Google Cloud's managed AI platform for models, training, deployment, and enterprise AI workflows.\",\n strengths: ['Strong fit for Google Cloud teams.', 'Broad managed AI and ML platform capabilities.', 'Useful for enterprise data and model workflows inside GCP.'],\n chooseThem: 'Choose Vertex AI when your AI work is deeply tied to Google Cloud data, governance, and ML platform workflows.',\n appNzAngle: 'app.nz is the alternative when you want a simpler AI app cloud: gateway, agents, deploys, GPU endpoints, notebooks, queues, and hosted sites in one product.',\n migration: 'Keep GCP-native model and data workflows on Vertex; move application-level routing, deploys, and agents to app.nz when teams need speed.',\n },\n {\n slug: 'codex-infinity',\n competitor: 'Codex Infinity',\n category: 'agent-cloud',\n url: 'https://codex-infinity.com',\n summary: 'Codex Infinity is sibling work focused on long-running autonomous coding sessions and Codex-style agent orchestration.',\n strengths: ['Run-forever coding-agent focus.', 'Autonomous continuation and goal-driven workflows.', 'Useful for builders who want to push coding agents toward longer horizons.'],\n chooseThem: 'Choose Codex Infinity when the core job is autonomous coding-agent orchestration and you want to explore long-running agent behavior directly.',\n appNzAngle: 'app.nz overlaps with that agent direction, but it is broader: it hosts the apps, deploys containers and static sites, routes models, runs GPU endpoints, and owns product infrastructure around the agent.',\n migration: 'Cross-link the two: use Codex Infinity for long-running agent experiments, and use app.nz when the result needs hosting, model routing, GPU inference, queues, domains, logs, and billing.',\n specialNote:\n 'Codex Infinity is close to app.nz philosophically. It focuses on coding agents that can keep working for long horizons. The wider Codex Infinity/OpenPath ecosystem also experiments with agent-friendly payment flows, including Solana-oriented work. app.nz is positioned as the broader hosted cloud around that style of agent work.',\n },\n {\n slug: 'cursor',\n competitor: 'Cursor',\n category: 'agent-cloud',\n url: 'https://cursor.com',\n summary: 'Cursor is a popular AI code editor that brings model-assisted coding directly into the developer environment.',\n strengths: ['Excellent editor-native AI coding workflow.', 'Good fit for developers who want assistance while staying in the IDE.', 'Strong daily-driver experience for code understanding and edits.'],\n chooseThem: 'Choose Cursor when the IDE is the center of your workflow and you want an AI coding experience inside the editor.',\n appNzAngle: 'app.nz is not trying to be only an editor. It runs cloud agents, hosts apps, deploys outputs, routes models, and provides infrastructure for the software after the code is written.',\n migration: 'Use Cursor for local development and app.nz for cloud agent tasks, deploys, previews, model routing, and GPU-backed features.',\n },\n {\n slug: 'devin',\n competitor: 'Devin',\n category: 'agent-cloud',\n url: 'https://devin.ai',\n summary: 'Devin is known as an AI software engineer product focused on delegating software tasks to an autonomous agent.',\n strengths: ['Clear autonomous software-engineer positioning.', 'Good fit for teams experimenting with delegated coding tasks.', 'Strong product focus around agent task execution.'],\n chooseThem: 'Choose Devin when you want a focused autonomous software-engineering teammate experience.',\n appNzAngle: 'app.nz treats coding agents as one part of the cloud: after the agent edits code, the platform can build, deploy, route models, host GPU endpoints, and expose operational tools.',\n migration: 'Use app.nz when you want agent work to connect directly to deploys, model gateway calls, hosted sites, queues, datasets, and infrastructure.',\n },\n {\n slug: 'github-copilot',\n competitor: 'GitHub Copilot',\n category: 'agent-cloud',\n url: 'https://github.com/features/copilot',\n summary: 'GitHub Copilot is deeply integrated with GitHub and developer workflows, from editor assistance to coding-agent style tasks.',\n strengths: ['Deep GitHub and editor ecosystem integration.', 'Strong fit for teams already standardized on GitHub.', 'Useful everyday coding assistance and automation.'],\n chooseThem: 'Choose GitHub Copilot when your team wants AI coding directly inside GitHub and supported editors.',\n appNzAngle: 'app.nz is broader than code assistance: it adds hosted repos, agents, deploys, model gateway, GPU endpoints, queues, and app infrastructure.',\n migration: 'Keep Copilot for editor assistance and use app.nz for cloud agent runs, deployable artifacts, previews, model routing, and hosted AI infrastructure.',\n },\n {\n slug: 'replit-agent',\n competitor: 'Replit Agent',\n category: 'agent-cloud',\n url: 'https://replit.com',\n summary: \"Replit Agent is strong for building and iterating on apps inside Replit's browser-based development environment.\",\n strengths: ['Browser-native development environment.', 'Good fit for quick app creation and education-friendly workflows.', 'Integrated coding, running, and sharing in one workspace.'],\n chooseThem: 'Choose Replit Agent when you want the whole coding experience in Replit and the app fits that environment well.',\n appNzAngle: 'app.nz is more infrastructure-oriented for AI apps: agents, deploys, model gateway, GPU endpoints, queues, datasets, notebooks, and hosting are connected in one cloud.',\n migration: 'Move generated apps to app.nz when they need production hosting, model routing, GPU inference, or operational primitives beyond the Replit workspace.',\n },\n {\n slug: 'lovable',\n competitor: 'Lovable',\n category: 'agent-cloud',\n url: 'https://lovable.dev',\n summary: 'Lovable is popular for prompting full-stack web apps into existence quickly, especially for prototypes and product experiments.',\n strengths: ['Fast prompt-to-app workflow.', 'Good fit for nontraditional builders and product prototypes.', 'Useful for exploring UI and app ideas quickly.'],\n chooseThem: 'Choose Lovable when the main goal is rapidly generating and iterating on a web app from prompts.',\n appNzAngle: 'app.nz is the next layer when the generated app needs agents, deploys, model routing, GPU endpoints, queues, datasets, notebooks, and product infrastructure.',\n migration: 'Export or connect the generated code, then use app.nz for hosting, agent maintenance, model gateway calls, and production workflows.',\n },\n {\n slug: 'bolt-new',\n competitor: 'Bolt.new',\n category: 'agent-cloud',\n url: 'https://bolt.new',\n summary: 'Bolt.new is strong for browser-based AI app generation and fast interactive prototyping.',\n strengths: ['Fast browser-based app generation.', 'Good fit for prototypes and frontend-heavy experiments.', 'Tight loop between prompt, edit, and preview.'],\n chooseThem: 'Choose Bolt.new when prompt-to-prototype speed in the browser is the main requirement.',\n appNzAngle: 'app.nz is broader than app generation: it gives the generated app a place to live, routes model calls, runs agents on repos, and hosts GPU or worker infrastructure.',\n migration: 'Move the resulting app code or static build to app.nz when it needs durable hosting, model gateway integration, agents, or GPU-backed features.',\n },\n {\n slug: 'windsurf',\n competitor: 'Windsurf',\n category: 'agent-cloud',\n url: 'https://windsurf.com',\n summary: 'Windsurf is an AI coding environment focused on agentic development inside the editor.',\n strengths: ['Editor-centered agentic coding workflow.', 'Good fit for developers who want AI assistance inside their coding environment.', 'Useful for codebase-aware edits and iteration.'],\n chooseThem: 'Choose Windsurf when your primary need is an AI coding environment for day-to-day development.',\n appNzAngle: 'app.nz starts where editor agents leave off: cloud agent runs, deploys, model routing, GPU hosting, queues, datasets, notebooks, and app operations.',\n migration: 'Use Windsurf for coding and app.nz for cloud execution, deploy previews, model gateway calls, and hosted AI infrastructure.',\n },\n];\n\nexport const alternatives: Alternative[] = seeds.map((seed) => ({\n ...seed,\n title: `${seed.competitor} Alternative: app.nz`,\n categoryLabel: alternativeCategoryLabels[seed.category],\n excerpt: `${seed.summary} app.nz is the alternative when you want agents, hosting, deploys, model routing, and GPU infrastructure together.`,\n readTime: seed.category === 'cloud-hosting' ? '6 min read' : '5 min read',\n body: articleBody(seed),\n}));\n\nexport const alternativeSlugs = alternatives.map((alt) => alt.slug);\n\nexport const alternativeBySlug: Record = Object.fromEntries(\n alternatives.map((alt) => [alt.slug, alt]),\n);\n","export const DESKTOP_APP_BASE_PATH = '/app';\n\nconst STATIC_PATH_PREFIXES = ['/api/', '/assets/', '/logos/', '/visualbench/', '/og/'];\nconst STATIC_PATHS = new Set([\n '/favicon.ico',\n '/favicon-16x16.png',\n '/favicon-32x32.png',\n '/favicon-48x48.png',\n '/apple-touch-icon.png',\n '/site.webmanifest',\n '/robots.txt',\n '/sitemap.xml',\n '/og.png',\n '/og.webp',\n '/cli.sh',\n]);\n\nfunction pathnameOnly(pathname: string): string {\n const rawPath = (pathname || '/').split(/[?#]/)[0] || '/';\n return rawPath.startsWith('/') ? rawPath : `/${rawPath}`;\n}\n\nexport function isDesktopAppPath(pathname: string): boolean {\n const path = pathnameOnly(pathname);\n return path === DESKTOP_APP_BASE_PATH || path.startsWith(`${DESKTOP_APP_BASE_PATH}/`);\n}\n\nexport function stripDesktopAppBasePath(pathname: string): string {\n const path = pathnameOnly(pathname);\n if (path === DESKTOP_APP_BASE_PATH) return '/';\n if (path.startsWith(`${DESKTOP_APP_BASE_PATH}/`)) return path.slice(DESKTOP_APP_BASE_PATH.length) || '/';\n return path;\n}\n\nexport function isClientRoutePath(pathname: string): boolean {\n const path = pathnameOnly(pathname);\n if (STATIC_PATHS.has(path)) return false;\n return !STATIC_PATH_PREFIXES.some((prefix) => path.startsWith(prefix));\n}\n\nexport function desktopAppPathForNavigation(pathname: string, currentPathname: string): string {\n const path = pathnameOnly(pathname);\n if (!isDesktopAppPath(currentPathname) || isDesktopAppPath(path) || !isClientRoutePath(path)) return path;\n return path === '/' ? `${DESKTOP_APP_BASE_PATH}/` : `${DESKTOP_APP_BASE_PATH}${path}`;\n}\n","import { useEffect, useState } from 'react';\nimport { desktopAppPathForNavigation, isClientRoutePath, stripDesktopAppBasePath } from './desktopPath';\n\n// Lightweight global client router — gives the whole app instant pushState\n// navigation (no full page reloads) without pulling in react-router. It works\n// by (1) patching history.pushState/replaceState to emit a popstate event so\n// any component can react to URL changes, and (2) intercepting clicks on\n// same-origin links and routing them through history instead of the browser\n// load. RepoView already listens to popstate for its in-repo routing, so this\n// keeps it in sync for free.\n//\n// Escape hatches: external links, target/_blank, download, rel=\"external\",\n// data-no-router, and modified clicks (cmd/ctrl/shift/alt, middle-click) all\n// fall through to a normal browser navigation.\n\nlet installed = false;\n\nfunction patchHistory(): void {\n for (const key of ['pushState', 'replaceState'] as const) {\n const original = history[key];\n if ((original as any).__patched) continue;\n const patched = function (this: History, ...args: any[]) {\n const result = original.apply(this, args as any);\n // Notify listeners (our hook + RepoView) that the location changed.\n window.dispatchEvent(new PopStateEvent('popstate', { state: history.state }));\n return result;\n } as typeof history.pushState;\n (patched as any).__patched = true;\n history[key] = patched;\n }\n}\n\n// navigate performs a client-side navigation. Same-origin only; anything else\n// (or an explicit hard flag) falls back to a full browser load.\nexport function navigate(to: string, opts: { replace?: boolean; hard?: boolean } = {}): void {\n if (typeof window === 'undefined') return;\n const url = new URL(to, window.location.href);\n if (opts.hard || url.origin !== window.location.origin) {\n window.location.href = to;\n return;\n }\n const pathname = desktopAppPathForNavigation(url.pathname, window.location.pathname);\n const dest = pathname + url.search + url.hash;\n const samePage = pathname === window.location.pathname && url.search === window.location.search;\n if (opts.replace) history.replaceState({}, '', dest);\n else history.pushState({}, '', dest);\n if (samePage && url.hash) {\n document.getElementById(decodeURIComponent(url.hash.slice(1)))?.scrollIntoView({ behavior: 'smooth' });\n } else {\n window.scrollTo(0, 0);\n }\n}\n\nfunction onDocumentClick(e: MouseEvent): void {\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n const target = e.target as HTMLElement | null;\n const anchor = target?.closest?.('a');\n if (!anchor) return;\n const href = anchor.getAttribute('href');\n if (\n !href ||\n href.startsWith('#') ||\n anchor.target === '_blank' ||\n anchor.hasAttribute('download') ||\n anchor.getAttribute('rel') === 'external' ||\n anchor.dataset.noRouter !== undefined\n ) {\n return;\n }\n const url = new URL(href, window.location.href);\n if (url.origin !== window.location.origin) return; // external — let the browser handle it\n if (!isClientRoutePath(url.pathname)) return;\n e.preventDefault();\n navigate(url.pathname + url.search + url.hash);\n}\n\n// installRouter wires the history patch + the global click interceptor exactly\n// once. Safe to call from multiple components / StrictMode double-invokes.\nexport function installRouter(): void {\n if (installed || typeof window === 'undefined') return;\n installed = true;\n patchHistory();\n document.addEventListener('click', onDocumentClick);\n}\n\n// useLocationPath returns the current pathname and re-renders on any client\n// navigation (pushState, replaceState, or back/forward). On the server it\n// returns the provided initial path so SSR/prerender output is stable.\nexport function useLocationPath(initial?: string): string {\n const [path, setPath] = useState(\n () => stripDesktopAppBasePath(initial ?? (typeof window === 'undefined' ? '/' : window.location.pathname)),\n );\n useEffect(() => {\n const update = () => setPath(stripDesktopAppBasePath(window.location.pathname));\n update(); // sync once on mount in case the URL changed before hydration\n window.addEventListener('popstate', update);\n return () => window.removeEventListener('popstate', update);\n }, []);\n return path;\n}\n","import React from 'react';\nimport {\n ArrowLeft,\n ArrowRight,\n Bot,\n Check,\n Code2,\n Copy,\n Film,\n Image as ImageIcon,\n Search,\n Sparkles,\n Volume2,\n} from 'lucide-react';\nimport promptLibraryJSON from '../server/seed/prompt_library.json';\nimport { useLocationPath } from '../lib/router';\n\nexport interface PromptCategory {\n slug: string;\n name: string;\n description: string;\n}\n\nexport interface LibraryPrompt {\n slug: string;\n title: string;\n summary: string;\n category: string;\n type: 'text' | 'image' | 'video' | 'audio';\n model: string;\n featured: boolean;\n tags: string[];\n prompt: string;\n}\n\nconst categories = promptLibraryJSON.categories as PromptCategory[];\nexport const libraryPrompts = promptLibraryJSON.prompts as LibraryPrompt[];\nexport const libraryPromptBySlug = Object.fromEntries(libraryPrompts.map((item) => [item.slug, item]));\n\nconst typeMeta = {\n text: { name: 'Text', icon: Code2 },\n image: { name: 'Image', icon: ImageIcon },\n video: { name: 'Video', icon: Film },\n audio: { name: 'Audio', icon: Volume2 },\n} as const;\n\nfunction categoryBySlug(slug: string) {\n return categories.find((category) => category.slug === slug);\n}\n\nfunction tryHref(item: LibraryPrompt) {\n const params = new URLSearchParams({ model: item.model, prompt: item.prompt });\n if (item.type === 'text') return `/chat?${params.toString()}`;\n if (item.type === 'image') return `/text-to-image?${params.toString()}`;\n if (item.type === 'video') return `/spaces/seedance-2?${params.toString()}`;\n return `/music?${params.toString()}`;\n}\n\nfunction CopyButton({ text, compact = false }: { text: string; compact?: boolean }) {\n const [copied, setCopied] = React.useState(false);\n const copy = async () => {\n try {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1600);\n } catch {\n // Clipboard permission can be unavailable in prerendered previews.\n }\n };\n return (\n \n {copied ? : }\n {copied ? 'Copied' : 'Copy'}\n \n );\n}\n\nfunction PromptCard({ item }: { item: LibraryPrompt }) {\n const meta = typeMeta[item.type];\n const Icon = meta.icon;\n return (\n \n );\n}\n\nfunction PromptDetail({ item }: { item: LibraryPrompt }) {\n const category = categoryBySlug(item.category);\n const meta = typeMeta[item.type];\n const Icon = meta.icon;\n const related = libraryPrompts\n .filter((candidate) => candidate.slug !== item.slug && (candidate.category === item.category || candidate.type === item.type))\n .slice(0, 3);\n\n React.useEffect(() => window.scrollTo(0, 0), [item.slug]);\n\n return (\n
\n \n
\n );\n}\n\nfunction PromptIndex({ categorySlug = '', typeSlug = '' }: { categorySlug?: string; typeSlug?: string }) {\n const initialQuery = typeof window === 'undefined' ? '' : new URLSearchParams(window.location.search).get('q') || '';\n const [query, setQuery] = React.useState(initialQuery);\n const activeCategory = categoryBySlug(categorySlug);\n const activeType = typeSlug && typeSlug in typeMeta ? (typeSlug as keyof typeof typeMeta) : '';\n const filtered = React.useMemo(() => {\n const terms = query.toLowerCase().trim().split(/\\s+/).filter(Boolean);\n return libraryPrompts.filter((item) => {\n if (categorySlug && item.category !== categorySlug) return false;\n if (activeType && item.type !== activeType) return false;\n if (!terms.length) return true;\n const haystack = `${item.title} ${item.summary} ${item.prompt} ${item.model} ${item.tags.join(' ')}`.toLowerCase();\n return terms.every((term) => haystack.includes(term));\n });\n }, [activeType, categorySlug, query]);\n\n const heading = activeCategory?.name || (activeType ? `${typeMeta[activeType].name} prompts` : 'AI prompt library');\n const description = activeCategory?.description || (activeType\n ? `Copy-ready ${typeMeta[activeType].name.toLowerCase()} prompts tuned for app.nz model routes and generation spaces.`\n : 'Copy proven starting points for agents, coding, research, images, video, audio, and product work—then run them through the same platform.');\n\n return (\n
\n
\n
\n Prompt library\n
\n

{heading}

\n

{description}

\n
\n {libraryPrompts.length} maintained prompts\n {categories.length} workflows\n web · API · CLI · MCP\n
\n
\n\n
\n \n\n
\n All\n {categories.map((category) => (\n {category.name}\n ))}\n
\n
\n {Object.entries(typeMeta).map(([slug, meta]) => {\n const Icon = meta.icon;\n return (\n \n {meta.name}\n \n );\n })}\n
\n
\n\n
\n
\n
\n
Library
\n

{filtered.length} {filtered.length === 1 ? 'prompt' : 'prompts'}

\n
\n \n Use from an agent\n \n
\n {filtered.length > 0 ? (\n
\n {filtered.map((item) => )}\n
\n ) : (\n
No prompts match “{query}”.
\n )}\n
\n
\n );\n}\n\nexport const PromptLibraryPage: React.FC<{ path?: string }> = ({ path: pathProp }) => {\n const path = useLocationPath(pathProp);\n const categoryMatch = path.match(/^\\/prompts\\/category\\/([^/?#]+)/);\n const typeMatch = path.match(/^\\/prompts\\/type\\/([^/?#]+)/);\n if (categoryMatch) return ;\n if (typeMatch) return ;\n const detailMatch = path.match(/^\\/prompts\\/([^/?#]+)/);\n if (detailMatch) {\n const item = libraryPromptBySlug[decodeURIComponent(detailMatch[1])];\n if (item) return ;\n return (\n
\n

Prompt not found

\n Prompt library\n
\n );\n }\n return ;\n};\n\nexport default PromptLibraryPage;\n","import {\n Wand2,\n Gauge,\n GitCompareArrows,\n Globe2,\n Calculator,\n Cloud,\n Server,\n Cpu,\n Database,\n DollarSign,\n Rocket,\n Workflow,\n Shield,\n KeyRound,\n Code2,\n FileCode,\n Table2,\n Bug,\n Clock3,\n Layers,\n Swords,\n FileSearch,\n ImagePlus,\n Regex,\n Braces,\n Video,\n Music,\n Scissors,\n LineChart,\n Image,\n Box,\n LayoutGrid,\n FileText,\n PenTool,\n Sparkles,\n Palette,\n Home,\n Building2,\n Map,\n Gamepad2,\n Cuboid,\n Hammer,\n Brush,\n Package,\n Camera,\n Shirt,\n Sticker,\n Presentation,\n Type,\n Link2,\n Triangle,\n} from 'lucide-react';\nimport type React from 'react';\n\nexport type ToolCategory =\n | 'AI & Prompts'\n | 'Evals'\n | 'Developer'\n | 'Cloud & Cost'\n | 'Design & Media'\n | '3D & Games'\n | 'SEO & Content'\n | 'Marketing'\n | 'Fun';\ntype IconType = React.ComponentType<{ size?: number; className?: string }>;\n\nexport interface ToolDef {\n slug: string;\n title: string;\n tagline: string;\n description: string;\n category: ToolCategory;\n tags: string[];\n icon: IconType;\n /** Human-readable pricing line shown on cards + detail headers. */\n pricing: string;\n /** Whether the tool requires a signed-in account (it spends credits). */\n auth?: boolean;\n /** Optional ribbon shown on the card. */\n badge?: string;\n /** Optional link override for tools that live on their own standalone page. */\n href?: string;\n /** Render the tool body in a wider container (editor/grid-style tools). */\n wide?: boolean;\n /** Starter inputs shown by generic blueprint pages. */\n defaults?: string[];\n /** Example results shown by generic blueprint pages. */\n exampleOutputs?: string[];\n /** Upsell copy for credit-backed or paid variants. */\n upsell?: string;\n}\n\n// The registry is the single source of truth for the /tools index, search, and\n// the per-tool detail header. The actual interactive component for each slug is\n// wired in ToolPage.tsx (lazy-loaded) so the /tools index bundle stays small.\nconst coreTools: ToolDef[] = [\n {\n slug: 'polygonalize',\n title: 'Polygonalize',\n tagline: 'Make stable low-poly image and video art with up to 20k triangles.',\n description:\n 'A free, open-source Go/WASM studio with edge-aware meshes up to 20,000 triangles, stable video topology, five built-in primitive shapes, and custom transparent primitive uploads. Canvas is the fast flat renderer; Three.js adds an interactive 3D lift.',\n category: 'Design & Media',\n tags: ['low-poly', 'image', 'video', 'golang', 'wasm', 'threejs', 'primitives', 'open-source'],\n icon: Triangle,\n pricing: 'Free · runs locally',\n badge: 'Open source',\n href: 'https://polygon.app.nz',\n },\n {\n slug: 'ai-use-cases',\n title: 'AI Use-Case Directory',\n tagline: 'Job-specific AI tools: staging, headshots, voiceovers and 50 more.',\n description:\n 'A directory of ready-to-run AI tools built on the gateway: virtual staging for real estate, product photo studio, headshots, photo restoration, art styles, logos, voiceovers, music, SFX and video.',\n category: 'AI & Prompts',\n tags: ['image', 'audio', 'video', 'directory', 'use-cases', 'media'],\n icon: Sparkles,\n pricing: 'Usage-based',\n badge: 'New',\n href: '/ai',\n },\n {\n slug: 'text-to-image',\n title: 'Text to Image',\n tagline: 'Generate images from a prompt via the app.nz image API.',\n description:\n 'Type a prompt, pick an image model, and generate — backed by the OpenAI-compatible /v1/images/generations endpoint. Copy ready-to-run Python, JS, and cURL snippets.',\n category: 'AI & Prompts',\n tags: ['image', 'generation', 'flux', 'diffusion', 'media'],\n icon: Image,\n pricing: 'Usage-based',\n href: '/text-to-image',\n },\n {\n slug: '3d-packing',\n title: '3D Packing Agent',\n tagline: 'Will it fit? Chat an inventory, get 3D bin-packed loading plans.',\n description:\n 'Describe a van, trailer, container, or storage unit and everything going into it. The agent estimates real item dimensions, runs 3D bin-packing algorithms (tight, layers, walls), and renders interactive three.js plans — with a verdict on whether it fits and what to cut if not. Also available as the /api/packing/solve API.',\n category: 'AI & Prompts',\n tags: ['3d', 'packing', 'bin-packing', 'moving', 'agent', 'threejs'],\n icon: Box,\n pricing: 'Usage-based',\n href: '/3d-packing',\n },\n {\n slug: 'image-to-3d',\n title: 'Image to 3D',\n tagline: 'Turn a reference image into a downloadable 3D model.',\n description:\n 'Upload, paste, or drop a reference image and generate a GLB 3D asset via /v1/3d/generations. Preview in-browser and copy Python, JS, and cURL snippets.',\n category: 'AI & Prompts',\n tags: ['3d', 'glb', 'model-viewer', 'media', 'generation'],\n icon: Box,\n pricing: 'Usage-based',\n href: '/image-to-3d',\n },\n {\n slug: 'text-to-3d',\n title: 'Text to 3D',\n tagline: 'Generate a 3D model straight from a text prompt.',\n description:\n 'Describe an object, generate a reference image through /v1/images/generations, then convert it to a GLB via /v1/3d/generations. Preview in-browser and copy ready-to-run snippets.',\n category: 'AI & Prompts',\n tags: ['3d', 'glb', 'model-viewer', 'media', 'generation'],\n icon: Box,\n pricing: 'Usage-based',\n href: '/text-to-3d',\n },\n {\n slug: 'music',\n title: 'Music and SFX',\n tagline: 'Generate tracks, loops, ambience, foley, and UI sounds.',\n description:\n 'Create music through /v1/music/generations or sound effects through /v1/audio/generations, then browse saved output in the searchable audio library.',\n category: 'AI & Prompts',\n tags: ['music', 'audio', 'sfx', 'sound', 'generation', 'media'],\n icon: Music,\n pricing: 'Usage-based',\n href: '/music',\n },\n {\n slug: 'audio-editor',\n title: 'Audio Editor',\n tagline: 'Edit generated or uploaded audio in a waveform workspace.',\n description:\n 'Open generated music and SFX, upload or record audio, trim selections, fade, gain, normalize, reverse, export WAV, and save edits back to your audio library.',\n category: 'AI & Prompts',\n tags: ['audio', 'music', 'sfx', 'waveform', 'editor', 'trim', 'fade'],\n icon: Scissors,\n pricing: 'Free editor',\n href: '/audio',\n wide: true,\n },\n {\n slug: 'prompt-optimizer',\n title: 'Prompt Optimizer',\n tagline: 'Auto-tune a prompt to score highest across your dataset.',\n description:\n 'Give a starting prompt, an eval prompt that scores an output 0–100, and a list of test rows. The optimizer generates and tests prompt variants, scoring each across every row, and returns the variant with the best mean/median score — with the full leaderboard.',\n category: 'AI & Prompts',\n tags: ['prompt', 'optimization', 'evals', 'llm-as-judge', 'dspy'],\n icon: Wand2,\n pricing: 'Usage-based',\n auth: true,\n badge: 'Flagship',\n },\n {\n slug: 'bulk-evals',\n title: 'Bulk Evals',\n tagline: 'Run a prompt over a dataset and judge every output with an LLM.',\n description:\n 'Run one prompt across many input rows, then score each output with a judge (LLM-as-a-judge) prompt that returns a number. Get per-row scores plus mean, median, and pass-rate — the fastest way to A/B a prompt or model on real data.',\n category: 'Evals',\n tags: ['evals', 'llm-as-judge', 'bulk', 'scoring', 'benchmark'],\n icon: Gauge,\n pricing: 'Usage-based',\n auth: true,\n badge: 'Flagship',\n },\n {\n slug: 'model-compare',\n title: 'Model Comparison',\n tagline: 'Send one prompt to many models and compare side by side.',\n description:\n 'Pick a handful of models from across 15+ providers, send the same prompt to all of them, and compare outputs, latency, and cost side by side. Great for choosing the cheapest model that still passes your bar.',\n category: 'AI & Prompts',\n tags: ['compare', 'models', 'latency', 'cost', 'gateway'],\n icon: GitCompareArrows,\n pricing: 'Usage-based',\n auth: true,\n },\n {\n slug: 'domain-check',\n title: 'Domain Availability',\n tagline: 'Check domain availability across TLDs — and brainstorm names.',\n description:\n 'Type a name to check availability across popular TLDs in parallel (DNS + RDAP, no registrar markup), or describe a business and let an AI suggest brandable names and check them all at once.',\n category: 'Developer',\n tags: ['domains', 'dns', 'rdap', 'whois', 'naming'],\n icon: Globe2,\n pricing: 'Free (AI suggestions usage-based)',\n },\n {\n slug: 'token-counter',\n title: 'Token & Cost Estimator',\n tagline: 'Count tokens and estimate cost across models before you spend.',\n description:\n 'Paste text to estimate token counts and see what a request would cost across frontier, fast, and cheap models — pulled live from the app.nz gateway price list. Runs entirely in your browser.',\n category: 'Developer',\n tags: ['tokens', 'cost', 'pricing', 'estimate'],\n icon: Calculator,\n pricing: 'Free',\n },\n {\n slug: 'gpu-clocker',\n title: 'GPU Clock & Power Lab',\n tagline: 'Drag through GPU clock curves and find the sustained perf-per-watt sweet spot.',\n description:\n 'Visualize how clock, voltage-shaped power, throughput, thermals, and electricity cost move together across RTX 3090/4090/5090, L40S, A100, and H100 GPUs. Compare workload curves, log real benchmark points, and generate a safe NVIDIA clock/power starting point.',\n category: 'Cloud & Cost',\n tags: ['gpu', 'clock', 'power', 'undervolt', 'efficiency', 'inference', 'calculator'],\n icon: Gauge,\n pricing: 'Free · runs in browser',\n badge: 'Interactive',\n href: '/gpu-clocker',\n wide: true,\n },\n {\n slug: 'competitor-teardown',\n title: 'Competitor Teardown',\n tagline: 'Turn a competitor URL into positioning gaps and copy angles.',\n description:\n 'Describe a competitor (and optionally paste their copy) to extract their positioning, messaging patterns, CTAs, and the gaps you can attack — with ready-to-use angles for your own landing page.',\n category: 'Marketing',\n tags: ['marketing', 'positioning', 'copywriting', 'seo'],\n icon: Swords,\n pricing: 'Usage-based',\n auth: true,\n },\n {\n slug: 'seo-brief',\n title: 'SEO Brief Builder',\n tagline: 'Generate an SEO content brief from a topic and competitors.',\n description:\n 'Give a target topic, your site, and a few competitor URLs to generate a structured SEO brief: search intent, outline, entities to cover, internal links, and a title/meta set.',\n category: 'Marketing',\n tags: ['seo', 'content', 'brief', 'keywords'],\n icon: FileSearch,\n pricing: 'Usage-based',\n auth: true,\n },\n {\n slug: 'fast-vfx',\n title: 'FastVFX Cog',\n tagline: 'Run a hosted Cog that turns an input video into a processed output video.',\n description:\n 'A concrete Cog hosting example using lee101/fastvfx. The page shows the input video, the processed output, the exact Cog image, and the schema used by Cog Studio.',\n category: 'AI & Prompts',\n tags: ['video', 'cog', 'runpod', 'registry', 'fastvfx'],\n icon: Video,\n pricing: 'Usage-based',\n href: '/spaces/fast-vfx',\n },\n {\n slug: 'media-services',\n title: 'Media Services',\n tagline: 'Transcribe audio and re-encode video through app.nz GPU services.',\n description:\n 'A first-party media API space for faster-whisper transcription and ffmpeg AV1/WebM video re-encoding, backed by app.nz Cog hosting and R2 output storage.',\n category: 'AI & Prompts',\n tags: ['transcription', 'whisper', 'video', 'av1', 'cog', 'r2'],\n icon: Video,\n pricing: 'Usage-based',\n href: '/spaces/media-services',\n },\n {\n slug: 'video-extension',\n title: 'Video Extension',\n tagline: 'Continue an MP4 with Grok Imagine Video.',\n description:\n 'Upload or paste a short MP4, describe what happens next, and call the xAI Grok Imagine video extension API through the app.nz gateway.',\n category: 'AI & Prompts',\n tags: ['video', 'grok', 'xai', 'extension', 'generation'],\n icon: Video,\n pricing: 'Usage-based',\n auth: true,\n },\n {\n slug: 'time-series-forecasting',\n title: 'Time-Series Forecasting',\n tagline: 'Forecast any series with Chronos-2 — paste data, get a horizon.',\n description:\n 'Paste a time series (or upload a CSV), pick a horizon, and get a probabilistic forecast from Chronos-2 (8192-step context, 1024-step horizon) with prediction intervals. Usage-based via the app.nz gateway.',\n category: 'AI & Prompts',\n tags: ['forecasting', 'time-series', 'chronos', 'prediction'],\n icon: LineChart,\n pricing: 'Usage-based',\n auth: true,\n href: '/time-series-forecasting',\n },\n {\n slug: 'meme-generator',\n title: 'Meme Generator',\n tagline: 'Search thousands of templates and caption on a full canvas editor.',\n description:\n 'Search the imgflip meme template library, then caption on a multi-box canvas editor — drag, resize and rotate each text box, set per-box font, fill/outline color, size, shadow, caps and alignment, add or duplicate boxes, or upload your own image. Exports a clean PNG, all in-browser.',\n category: 'Fun',\n tags: ['meme', 'image', 'canvas', 'editor', 'templates', 'fun'],\n icon: ImagePlus,\n pricing: 'Free',\n wide: true,\n },\n {\n slug: 'batch-image-generator',\n title: 'Batch Image Generator',\n tagline: 'Generate a prompt × model matrix of images in one run.',\n description:\n 'Enter one prompt per line, pick the image models to compare, and generate every combination at once — a grid you can scan side by side and download. Backed by the OpenAI-compatible /v1/images/generations endpoint, billed per image.',\n category: 'AI & Prompts',\n tags: ['image', 'batch', 'matrix', 'generation', 'compare', 'media'],\n icon: LayoutGrid,\n pricing: 'Usage-based',\n auth: true,\n wide: true,\n },\n {\n slug: 'markdown-to-pdf',\n title: 'Markdown to PDF',\n tagline: 'Write inline or in markdown, export a clean PDF.',\n description:\n 'Write a document in an inline rich-text editor or raw markdown and download it as a typeset PDF — headings, bullets, code blocks and pagination handled for you. Signed-in users can save PDFs straight to their library and share them by link or with a team.',\n category: 'Developer',\n tags: ['pdf', 'markdown', 'document', 'export', 'writing', 'content'],\n icon: FileText,\n pricing: 'Free',\n wide: true,\n },\n {\n slug: 'draw',\n title: 'Draw — whiteboard',\n tagline: 'Sketch diagrams on an Excalidraw canvas, save and share.',\n description:\n 'A full Excalidraw whiteboard: sketch diagrams, wireframes and ideas, save drawings to your library, share them by link or with your team, and export PNGs.',\n category: 'Fun',\n tags: ['draw', 'whiteboard', 'diagram', 'sketch', 'excalidraw', 'canvas'],\n icon: PenTool,\n pricing: 'Free',\n href: '/draw',\n },\n {\n slug: 'regex-tester',\n title: 'Regex Tester',\n tagline: 'Test JavaScript regular expressions with live match highlights.',\n description:\n 'Write a pattern and flags, paste test text, and see matches highlighted live with capture groups broken out. Runs in your browser.',\n category: 'Developer',\n tags: ['regex', 'developer', 'testing'],\n icon: Regex,\n pricing: 'Free',\n },\n {\n slug: 'json-formatter',\n title: 'JSON Formatter',\n tagline: 'Format, minify, and validate JSON with clear error messages.',\n description:\n 'Paste JSON to pretty-print, minify, or validate it. Errors point at the line and column. Runs entirely in your browser.',\n category: 'Developer',\n tags: ['json', 'format', 'validate', 'developer'],\n icon: Braces,\n pricing: 'Free',\n },\n];\n\nconst blueprintTool = (\n slug: string,\n title: string,\n tagline: string,\n category: ToolCategory,\n tags: string[],\n icon: IconType,\n defaults: string[],\n exampleOutputs: string[],\n opts: Partial> = {},\n): ToolDef => ({\n slug,\n title,\n tagline,\n description:\n opts.description ??\n `${tagline} Use the starter defaults, adapt the inputs, and turn the result into a reusable workflow or API-backed app.nz tool.`,\n category,\n tags,\n icon,\n pricing: opts.pricing ?? 'Free blueprint',\n badge: opts.badge,\n auth: opts.auth,\n defaults,\n exampleOutputs,\n upsell: opts.upsell,\n wide: opts.wide,\n href: opts.href,\n});\n\nconst blueprintTools: ToolDef[] = [\n blueprintTool('gpu-cost-calculator', 'GPU Cost Calculator', 'Compare hourly, monthly, and per-job GPU costs across clouds.', 'Cloud & Cost', ['gpu', 'pricing', 'calculator', 'cloud'], Cpu, ['GPU: H100 80GB', 'Utilization: 42%', 'Jobs per day: 180'], ['Effective cost per successful job', 'Monthly burn at low/medium/high utilization', 'Break-even point for reserved capacity'], { badge: 'Live prices', wide: true, pricing: 'Free · price snapshot', description: 'Compare dated, source-linked GPU rates from app.nz, RunPod, Paperspace, CoreWeave, and Google Cloud. Normalize hourly, monthly, and runtime-only job cost while preserving Spot and multi-GPU minimum constraints.' }),\n blueprintTool('cloud-pricing-calculator', 'Cloud Pricing Calculator', 'Estimate compute, storage, bandwidth, and managed-service spend.', 'Cloud & Cost', ['cloud', 'pricing', 'aws', 'gcp', 'azure'], Cloud, ['Region: us-east-1', 'Instances: 6 web + 2 workers', 'Traffic: 8 TB/month'], ['Monthly cost range', 'Largest cost driver', 'Cheaper architecture notes']),\n blueprintTool('deployment-cost-calculator', 'Deployment Cost Calculator', 'Forecast the cost of shipping an app from preview to production.', 'Cloud & Cost', ['deployment', 'hosting', 'calculator', 'devops'], Rocket, ['Preview deploys: 80/month', 'Production replicas: 3', 'Build minutes: 1,200'], ['Preview cost', 'Production run-rate', 'Optimization checklist']),\n blueprintTool('llm-api-cost-calculator', 'LLM API Cost Calculator', 'Estimate token, image, audio, and tool-call spend before launch.', 'Cloud & Cost', ['llm', 'tokens', 'pricing', 'api'], Calculator, ['Requests/day: 25,000', 'Input tokens: 1,200', 'Output tokens: 350'], ['Daily and monthly spend', 'Cost per active user', 'Cheapest passing model shortlist']),\n blueprintTool('serverless-gpu-break-even', 'Serverless GPU Break-Even', 'Find when serverless GPUs beat dedicated GPU boxes.', 'Cloud & Cost', ['gpu', 'serverless', 'break-even', 'inference'], DollarSign, ['Cold starts: 4%', 'Average runtime: 38s', 'Dedicated GPU: $3.20/hr'], ['Break-even requests/hour', 'Idle waste estimate', 'Recommended deployment mode'], { badge: 'Interactive', wide: true, pricing: 'Free', description: 'Model monthly serverless and always-on GPU spend from request volume, runtime, cold-start frequency, and cold-start delay. See the exact traffic point where a dedicated RTX 4090, L40S, A100, or H100 becomes cheaper.' }),\n blueprintTool('inference-throughput-planner', 'Inference Throughput Planner', 'Plan replicas, batch size, and queue depth for AI inference.', 'Cloud & Cost', ['inference', 'throughput', 'capacity', 'latency'], Workflow, ['Target p95: 4s', 'Model latency: 900ms', 'Peak RPS: 18'], ['Replica count', 'Batching window', 'Expected queue latency']),\n blueprintTool('storage-egress-calculator', 'Storage & Egress Calculator', 'Calculate object storage, CDN, and download bandwidth costs.', 'Cloud & Cost', ['storage', 'egress', 'cdn', 'calculator'], Database, ['Stored assets: 14 TB', 'Downloads: 38 TB/month', 'Cache hit rate: 82%'], ['Storage bill', 'Egress bill', 'Cache savings estimate']),\n blueprintTool('vector-db-cost-calculator', 'Vector Database Cost Calculator', 'Estimate embedding storage, search traffic, and reranking costs.', 'Cloud & Cost', ['vector', 'database', 'embeddings', 'rag'], Database, ['Documents: 2.4M', 'Embedding dims: 1536', 'Queries/day: 120k'], ['Index size', 'Search unit cost', 'RAG monthly total']),\n blueprintTool('ci-minutes-calculator', 'CI Minutes Calculator', 'Predict CI spend from matrix builds, test duration, and cache hit rate.', 'Cloud & Cost', ['ci', 'github-actions', 'builds', 'calculator'], Clock3, ['PRs/week: 90', 'Matrix jobs: 8', 'Median job: 6 min'], ['Monthly runner minutes', 'Cache savings', 'Flaky-test waste']),\n blueprintTool('docker-image-size-estimator', 'Docker Image Size Estimator', 'Estimate image transfer time, registry storage, and cold-start impact.', 'Cloud & Cost', ['docker', 'container', 'cold-start', 'registry'], Package, ['Base image: CUDA runtime', 'Layers: 18', 'Deploys/day: 45'], ['Image size budget', 'Pull-time estimate', 'Layer trimming plan']),\n blueprintTool('kubernetes-capacity-planner', 'Kubernetes Capacity Planner', 'Size nodes, pods, requests, limits, and headroom for a cluster.', 'Cloud & Cost', ['kubernetes', 'capacity', 'pods', 'nodes'], Server, ['Pods: 140', 'CPU request: 500m', 'Memory request: 1Gi'], ['Node pool recommendation', 'Headroom percentage', 'Bin-packing warnings']),\n blueprintTool('cloud-migration-estimator', 'Cloud Migration Estimator', 'Estimate migration effort, cutover risk, and first-month cloud spend.', 'Cloud & Cost', ['migration', 'cloud', 'planning', 'cost'], Cloud, ['Servers: 24', 'Databases: 5', 'Data to move: 18 TB'], ['Migration phases', 'Cost delta', 'Risk register']),\n blueprintTool('reserved-instance-planner', 'Reserved Instance Planner', 'Find commit levels for reserved, savings-plan, or spot capacity.', 'Cloud & Cost', ['reserved', 'savings-plan', 'spot', 'cloud'], DollarSign, ['Baseline CPU hours: 9,000', 'Burst hours: 2,500', 'Risk tolerance: medium'], ['Commitment recommendation', 'Expected savings', 'Spot-safe workloads']),\n blueprintTool('runpod-vs-cloud-gpu', 'RunPod vs Cloud GPU Calculator', 'Compare specialist GPU hosts with hyperscaler GPU instances.', 'Cloud & Cost', ['runpod', 'gpu', 'pricing', 'comparison'], Cpu, ['GPU: A100', 'Runtime: 220 hr/month', 'Data egress: 2 TB'], ['Provider cost table', 'Operational tradeoffs', 'Best-fit recommendation']),\n blueprintTool('bandwidth-bill-estimator', 'Bandwidth Bill Estimator', 'Estimate traffic cost for downloads, APIs, video, and image delivery.', 'Cloud & Cost', ['bandwidth', 'egress', 'api', 'video'], Cloud, ['API responses: 80 GB/day', 'Video: 12 TB/month', 'CDN hit rate: 75%'], ['Traffic cost', 'CDN savings', 'Compression targets']),\n blueprintTool('api-rate-limit-planner', 'API Rate Limit Planner', 'Convert traffic forecasts into rate limits, quotas, and burst capacity.', 'Developer', ['api', 'rate-limit', 'quota', 'traffic'], Gauge, ['Users: 40k', 'Peak requests/user/min: 12', 'Burst window: 60s'], ['Per-user quota', 'Global limiter', 'Retry-after policy']),\n blueprintTool('queue-worker-sizing', 'Queue Worker Sizing', 'Calculate worker concurrency from job volume and latency targets.', 'Cloud & Cost', ['queue', 'worker', 'capacity', 'jobs'], Workflow, ['Jobs/day: 1.2M', 'Avg runtime: 700ms', 'SLA: 2 minutes'], ['Worker count', 'Concurrency setting', 'Backlog drain time']),\n blueprintTool('database-pricing-calculator', 'Database Pricing Calculator', 'Estimate database compute, storage, replicas, and backup costs.', 'Cloud & Cost', ['database', 'postgres', 'pricing', 'replica'], Database, ['Primary: 8 vCPU', 'Storage: 2 TB', 'Read replicas: 2'], ['Monthly database bill', 'Backup cost', 'Replica tradeoffs']),\n blueprintTool('observability-cost-calculator', 'Observability Cost Calculator', 'Estimate logs, metrics, traces, retention, and sampling costs.', 'Cloud & Cost', ['logs', 'metrics', 'tracing', 'observability'], Bug, ['Logs/day: 120 GB', 'Retention: 30 days', 'Trace sample: 10%'], ['Monthly ingest cost', 'Retention cost', 'Sampling plan']),\n blueprintTool('ai-agent-cost-planner', 'AI Agent Cost Planner', 'Forecast model, browser, sandbox, and storage costs for agent runs.', 'Cloud & Cost', ['agents', 'llm', 'browser', 'sandbox'], Sparkles, ['Runs/day: 3,000', 'Avg steps: 14', 'Browser minutes/run: 3'], ['Cost per run', 'Monthly agent spend', 'Upsell-ready plan tiers'], { upsell: 'Connect this to live app.nz usage and plan limits for paid agent workspaces.' }),\n\n blueprintTool('jwt-debugger', 'JWT Debugger', 'Decode JWTs, inspect claims, and validate expiry without sending secrets away.', 'Developer', ['jwt', 'auth', 'debugger', 'tokens'], Shield, ['Paste token header.payload.signature', 'Expected audience: app.nz', 'Clock skew: 60s'], ['Decoded header', 'Claim warnings', 'Expiry status']),\n blueprintTool('cron-expression-builder', 'Cron Expression Builder', 'Build and explain cron schedules with next-run previews.', 'Developer', ['cron', 'scheduler', 'developer'], Clock3, ['Every weekday', 'Timezone: Pacific/Auckland', 'Start after 9am'], ['Cron expression', 'Plain-English explanation', 'Next 10 run times']),\n blueprintTool('webhook-tester', 'Webhook Tester', 'Design webhook payloads and retry behavior before integrating.', 'Developer', ['webhook', 'api', 'testing', 'payload'], Workflow, ['Event: invoice.paid', 'Retries: exponential', 'Signature header: X-Signature'], ['Sample payload', 'Verification code', 'Retry timeline']),\n blueprintTool('openapi-schema-linter', 'OpenAPI Schema Linter', 'Review OpenAPI specs for missing schemas, examples, and auth notes.', 'Developer', ['openapi', 'schema', 'api', 'lint'], FileCode, ['Spec version: 3.1', 'Auth: bearer token', 'Endpoints: 42'], ['Lint findings', 'Missing examples', 'SDK-readiness score']),\n blueprintTool('env-var-diff', 'Env Var Diff', 'Compare environment variables across local, staging, and production.', 'Developer', ['env', 'config', 'diff', 'deploy'], Code2, ['Local .env', 'Staging secrets', 'Production secrets'], ['Missing variables', 'Value-shape mismatches', 'Rollout checklist']),\n blueprintTool('sql-index-advisor', 'SQL Index Advisor', 'Turn slow queries into practical Postgres index suggestions.', 'Developer', ['sql', 'postgres', 'index', 'performance'], Database, ['Query text', 'Table rows: 18M', 'Filter columns: org_id, created_at'], ['Index candidates', 'Write overhead notes', 'EXPLAIN checklist']),\n blueprintTool('postgres-plan-explainer', 'Postgres Plan Explainer', 'Explain EXPLAIN output in plain English with fix suggestions.', 'Developer', ['postgres', 'explain', 'performance', 'sql'], Database, ['EXPLAIN ANALYZE output', 'Target latency: 100ms', 'Current p95: 1.8s'], ['Plan summary', 'Bottleneck nodes', 'Fix order']),\n blueprintTool('uuid-ulid-generator', 'UUID & ULID Generator', 'Generate sortable IDs, random UUIDs, and fixture-safe identifiers.', 'Developer', ['uuid', 'ulid', 'generator', 'ids'], KeyRound, ['Count: 50', 'Format: ULID', 'Prefix: task_'], ['Generated IDs', 'Collision note', 'Copyable test fixtures']),\n blueprintTool('base64-converter', 'Base64 Converter', 'Encode, decode, and inspect Base64 strings and data URLs.', 'Developer', ['base64', 'encode', 'decode', 'data-url'], Code2, ['Mode: decode', 'Input: data URL', 'Output: text'], ['Decoded payload', 'MIME type', 'Byte size']),\n blueprintTool('yaml-json-converter', 'YAML JSON Converter', 'Convert YAML, JSON, and TOML config with validation.', 'Developer', ['yaml', 'json', 'toml', 'config'], Braces, ['Input: YAML', 'Output: JSON', 'Preserve comments: no'], ['Converted config', 'Validation errors', 'Schema hints']),\n blueprintTool('gitignore-generator', 'Gitignore Generator', 'Build a `.gitignore` from language, framework, and deployment target.', 'Developer', ['git', 'gitignore', 'developer', 'repo'], FileCode, ['Stack: Node + Go', 'IDE: VS Code', 'Deploy: Docker'], ['Merged .gitignore', 'Ignored build outputs', 'Repo hygiene notes']),\n blueprintTool('docker-compose-generator', 'Docker Compose Generator', 'Generate a compose file for app, database, cache, and workers.', 'Developer', ['docker', 'compose', 'devops', 'local'], Server, ['App port: 3000', 'Database: Postgres', 'Cache: Redis'], ['docker-compose.yml', 'Health checks', 'Volume notes']),\n blueprintTool('api-mock-generator', 'API Mock Generator', 'Generate mock responses from endpoints, schemas, or examples.', 'Developer', ['api', 'mock', 'testing', 'openapi'], FileCode, ['Endpoint: POST /orders', 'Status codes: 200, 400, 500', 'Data style: realistic'], ['Mock payloads', 'Error cases', 'Contract-test ideas']),\n blueprintTool('http-header-checker', 'HTTP Header Checker', 'Audit cache, security, CORS, and content headers.', 'Developer', ['headers', 'security', 'cache', 'http'], Shield, ['URL: https://app.nz', 'Mode: production', 'Asset type: HTML'], ['Header report', 'Missing protections', 'Cache policy suggestions']),\n blueprintTool('cors-debugger', 'CORS Debugger', 'Diagnose preflight failures and generate correct CORS config.', 'Developer', ['cors', 'http', 'browser', 'api'], Bug, ['Origin: https://studio.example', 'Method: PUT', 'Headers: Authorization'], ['Preflight explanation', 'Server config', 'Browser-side fix']),\n blueprintTool('oauth-url-builder', 'OAuth URL Builder', 'Construct authorization URLs with scopes, PKCE, and callback validation.', 'Developer', ['oauth', 'pkce', 'auth', 'url'], KeyRound, ['Provider: Google', 'Scopes: email profile', 'Redirect URL: /oauth/callback'], ['Authorization URL', 'PKCE values', 'Callback checklist']),\n blueprintTool('feature-flag-matrix', 'Feature Flag Matrix', 'Plan feature rollout states across teams, plans, and environments.', 'Developer', ['feature-flags', 'release', 'rollout', 'matrix'], Table2, ['Plans: Free, Pro, Enterprise', 'Environments: staging, prod', 'Rollout: 10%'], ['Flag matrix', 'Kill-switch plan', 'QA cases']),\n blueprintTool('release-notes-generator', 'Release Notes Generator', 'Turn commits or PR summaries into user-facing release notes.', 'Developer', ['release-notes', 'changelog', 'github', 'writing'], FileText, ['PR list', 'Audience: developers', 'Tone: concise'], ['Highlights', 'Fixes', 'Upgrade notes']),\n blueprintTool('changelog-summarizer', 'Changelog Summarizer', 'Summarize long changelogs into risks, breaking changes, and upgrades.', 'Developer', ['changelog', 'dependencies', 'upgrade', 'summary'], FileSearch, ['Package: React', 'From: 18', 'To: 19'], ['Breaking changes', 'Migration steps', 'Test focus']),\n blueprintTool('prompt-regression-suite', 'Prompt Regression Suite', 'Design regression cases that catch prompt and model drift.', 'Evals', ['prompt', 'evals', 'regression', 'quality'], Gauge, ['Task: support replies', 'Rows: 25', 'Rubric: policy + helpfulness'], ['Test cases', 'Judge prompt', 'Pass/fail dashboard']),\n blueprintTool('mcp-server-manifest-builder', 'MCP Server Manifest Builder', 'Draft MCP tool descriptors, schemas, and safety notes.', 'Developer', ['mcp', 'tools', 'schema', 'agents'], Workflow, ['Server: billing tools', 'Auth: OAuth', 'Tools: 6'], ['Tool descriptors', 'Input schemas', 'Permission notes']),\n\n blueprintTool('virtual-staging-tool', 'Virtual Staging Tool', 'Stage empty rooms with furniture styles and listing-ready defaults.', 'Design & Media', ['real-estate', 'staging', 'image', 'interior'], Home, ['Room: empty living room', 'Style: warm modern', 'Output: MLS-safe'], ['Staged room preview', 'Prompt variants', 'Before/after caption'], { pricing: 'Usage-based', auth: true, upsell: 'Use higher-resolution image models and batch listing exports on paid plans.' }),\n blueprintTool('declutter-room-tool', 'Declutter Room Tool', 'Remove clutter from listing photos while preserving room structure.', 'Design & Media', ['real-estate', 'declutter', 'image-editing'], Brush, ['Photo: messy kitchen', 'Keep: counters and appliances', 'Remove: loose items'], ['Clean listing image', 'Masking instructions', 'Agent disclosure note'], { pricing: 'Usage-based', auth: true }),\n blueprintTool('design-my-house', 'Design My House', 'Generate exterior and interior redesign concepts from a house photo.', 'Design & Media', ['home-design', 'renovation', 'image', 'architecture'], Home, ['Photo: front elevation', 'Style: coastal contemporary', 'Budget: mid-range'], ['Concept render', 'Materials palette', 'Contractor brief']),\n blueprintTool('floorplan-to-house-render', 'Floorplan to House Render', 'Turn a floorplan into a watercolor house concept on a clean white background.', 'Design & Media', ['floorplan', 'architecture', 'watercolor', 'real-estate'], Home, ['Floorplan image', 'Facade style: modern farmhouse', 'Background: white'], ['Watercolor exterior', 'Room-to-facade assumptions', 'Listing illustration copy'], { badge: 'Creative' }),\n blueprintTool('real-estate-twilight-editor', 'Real Estate Twilight Editor', 'Convert daytime exterior photos into warm twilight listing shots.', 'Design & Media', ['real-estate', 'twilight', 'photo', 'listing'], Camera, ['Exterior photo', 'Window glow: medium', 'Sky: blue hour'], ['Twilight image', 'Sky prompt', 'MLS-safe edit notes']),\n blueprintTool('product-background-swap', 'Product Background Swap', 'Place product photos into clean ecommerce or campaign scenes.', 'Design & Media', ['product-photo', 'ecommerce', 'background', 'image'], Package, ['Product: perfume bottle', 'Scene: marble bathroom', 'Aspect: 1:1'], ['Product scene', 'Shadow prompt', 'Marketplace-safe variant']),\n blueprintTool('infographic-generator', 'Infographic Generator', 'Turn facts, stats, or a blog section into a polished infographic brief.', 'Design & Media', ['infographic', 'content', 'design', 'seo'], Presentation, ['Topic: GPU cost trends', 'Stats: 5 bullets', 'Format: vertical'], ['Layout plan', 'Copy blocks', 'Image generation prompt']),\n blueprintTool('brand-kit-generator', 'Brand Kit Generator', 'Generate palettes, typography, visual rules, and example assets.', 'Design & Media', ['brand', 'palette', 'typography', 'design'], Palette, ['Brand: AI infra startup', 'Vibe: technical, calm', 'Audience: developers'], ['Color system', 'Font pairing', 'Sample social card prompt']),\n blueprintTool('logo-brief-generator', 'Logo Brief Generator', 'Convert a company idea into logo directions and generation prompts.', 'Design & Media', ['logo', 'brand', 'prompt', 'design'], Sparkles, ['Company: cloud notebooks', 'Avoid: generic clouds', 'Style: precise'], ['Logo directions', 'Negative prompts', 'Designer handoff']),\n blueprintTool('social-ad-creative-generator', 'Social Ad Creative Generator', 'Create ad concepts, prompts, and variants for paid social.', 'Marketing', ['ads', 'creative', 'social', 'image'], ImagePlus, ['Offer: GPU credits', 'Audience: startup CTOs', 'Format: square'], ['Ad concepts', 'Image prompts', 'Headline variants']),\n blueprintTool('thumbnail-ab-test-generator', 'Thumbnail A/B Test Generator', 'Generate thumbnail concepts and hypotheses for videos or articles.', 'Design & Media', ['thumbnail', 'youtube', 'ab-test', 'creative'], Image, ['Topic: model routing', 'Audience: builders', 'Emotion: clarity'], ['Thumbnail variants', 'Text overlays', 'Test hypothesis']),\n blueprintTool('style-transfer-studio', 'Style Transfer Studio', 'Convert images into consistent editorial, watercolor, anime, or product styles.', 'Design & Media', ['style-transfer', 'image', 'gpt-image', 'art'], Wand2, ['Input image', 'Style: editorial watercolor', 'Strength: medium'], ['Styled output prompt', 'Consistency notes', 'Batch variant plan'], { pricing: 'Usage-based', auth: true }),\n blueprintTool('watercolor-house-portrait', 'Watercolor House Portrait', 'Create clean watercolor home portraits for gifts and real estate marketing.', 'Design & Media', ['watercolor', 'house', 'real-estate', 'art'], Home, ['House photo', 'Background: white', 'Detail: preserve roofline'], ['Watercolor prompt', 'Print-ready crop', 'Caption']),\n blueprintTool('interior-moodboard-generator', 'Interior Moodboard Generator', 'Generate room palettes, furniture direction, and image prompts.', 'Design & Media', ['interior', 'moodboard', 'design', 'home'], Palette, ['Room: small bedroom', 'Style: Japandi', 'Budget: affordable'], ['Moodboard sections', 'Palette', 'Shopping keywords']),\n blueprintTool('color-palette-extractor', 'Color Palette Extractor', 'Extract accessible color palettes from images or brand descriptions.', 'Design & Media', ['color', 'palette', 'accessibility', 'brand'], Palette, ['Image or URL', 'Contrast target: WCAG AA', 'Palette size: 6'], ['Hex palette', 'Usage roles', 'Contrast warnings']),\n blueprintTool('font-pairing-tool', 'Font Pairing Tool', 'Find font pairs for apps, brands, editorial pages, and dashboards.', 'Design & Media', ['fonts', 'typography', 'brand', 'ui'], Type, ['Use case: SaaS dashboard', 'Mood: compact, trustworthy', 'Source: Google Fonts'], ['Heading/body pair', 'Scale suggestions', 'Fallback stack']),\n blueprintTool('ui-screenshot-polisher', 'UI Screenshot Polisher', 'Turn rough app screenshots into launch-ready marketing images.', 'Design & Media', ['screenshot', 'ui', 'marketing', 'image'], Image, ['Screenshot', 'Frame: browser chrome', 'Background: clean'], ['Polished prompt', 'Crop variants', 'Alt text']),\n blueprintTool('mockup-scene-generator', 'Mockup Scene Generator', 'Place app, merch, or packaging into realistic campaign mockups.', 'Design & Media', ['mockup', 'product', 'scene', 'image'], LayoutGrid, ['Asset: app screenshot', 'Scene: desk setup', 'Aspect: 16:9'], ['Scene prompt', 'Composition notes', 'Export sizes']),\n blueprintTool('apparel-design-generator', 'Apparel Design Generator', 'Create t-shirt, hoodie, and merch design prompts and mockups.', 'Design & Media', ['tshirt', 'apparel', 'merch', 'design'], Shirt, ['Theme: developer tools', 'Ink colors: 2', 'Placement: front chest'], ['Design prompt', 'Mockup prompt', 'Print notes']),\n blueprintTool('sticker-sheet-generator', 'Sticker Sheet Generator', 'Generate cohesive sticker sheet prompts for brands and communities.', 'Design & Media', ['stickers', 'brand', 'illustration', 'print'], Sticker, ['Theme: AI builder tools', 'Count: 12', 'Style: clean vector'], ['Sticker list', 'Sheet prompt', 'Cut-line notes']),\n blueprintTool('icon-set-generator', 'Icon Set Generator', 'Plan consistent app, docs, or marketing icon sets.', 'Design & Media', ['icons', 'design-system', 'vector', 'ui'], Cuboid, ['Category: cloud platform', 'Count: 24', 'Stroke: 2px'], ['Icon inventory', 'Style rules', 'Generation prompts']),\n blueprintTool('presentation-visual-generator', 'Presentation Visual Generator', 'Turn slide bullets into visuals, diagrams, and image prompts.', 'Design & Media', ['slides', 'presentation', 'visuals', 'diagrams'], Presentation, ['Slide title: reduce GPU idle', 'Bullets: 4', 'Audience: executives'], ['Visual concept', 'Diagram labels', 'Speaker-note cue']),\n blueprintTool('image-prompt-builder', 'Image Prompt Builder', 'Build production-ready prompts for image generation models.', 'AI & Prompts', ['image', 'prompt', 'generation', 'defaults'], Wand2, ['Subject: product hero', 'Style: clean editorial', 'Negative: clutter'], ['Final prompt', 'Negative prompt', 'Model-specific variants']),\n blueprintTool('photo-restoration-brief', 'Photo Restoration Brief', 'Create precise prompts for repairing, colorizing, and sharpening old photos.', 'Design & Media', ['photo-restoration', 'colorize', 'image-editing'], Camera, ['Photo condition: faded', 'Goal: natural color', 'Keep: faces'], ['Restoration prompt', 'Repair priorities', 'Print export notes']),\n blueprintTool('marketplace-listing-photo-tool', 'Marketplace Listing Photo Tool', 'Create clean listing photos for Etsy, eBay, Amazon, and Shopify.', 'Design & Media', ['marketplace', 'product-photo', 'ecommerce', 'listing'], Package, ['Product: handmade mug', 'Marketplace: Etsy', 'Background: warm kitchen'], ['Hero prompt', 'Gallery shot list', 'SEO alt text']),\n\n blueprintTool('terrain-generator', 'Terrain Generator', 'Generate terrain prompts, heightmap settings, and biome presets.', '3D & Games', ['terrain', 'game-dev', 'heightmap', 'worldbuilding'], Map, ['Biome: alpine valley', 'Scale: 4 km', 'Output: heightmap + texture'], ['Terrain recipe', 'Heightmap settings', 'Playable landmarks'], { badge: 'Popular' }),\n blueprintTool('city-generator', 'City Generator', 'Generate city layouts, districts, roads, and skyline prompts.', '3D & Games', ['city', 'procedural', 'game-dev', 'environment'], Building2, ['City: coastal trading hub', 'Era: near future', 'Density: medium'], ['District map', 'Landmark list', '3D generation prompts']),\n blueprintTool('building-generator', 'Building Generator', 'Create prompt-to-3D building briefs for Pixal3D-style prefab output.', '3D & Games', ['building', '3d', 'prefab', 'architecture'], Building2, ['Prompt: modular sci-fi apartment', 'Poly budget: 20k', 'Export: GLB'], ['Model prompt', 'Prefab parts', 'Material list'], { pricing: 'Usage-based', auth: true, upsell: 'Paid runs can route to multiple 3D models and keep the best GLB.' }),\n blueprintTool('prefab-generator', 'Prefab Generator', 'Design reusable game prefabs with geometry, materials, and variation notes.', '3D & Games', ['prefab', '3d', 'game-dev', 'assets'], Cuboid, ['Asset: market stall', 'Style: low-poly', 'Variants: 6'], ['Prefab spec', 'Variation table', '3D prompts']),\n blueprintTool('weapon-generator', 'Weapon Generator', 'Generate game-ready weapon concepts, stats, and 3D model prompts.', '3D & Games', ['weapon', 'game-dev', '3d', 'concept'], Swords, ['Type: energy rifle', 'Faction: miners', 'Rarity: rare'], ['Concept brief', 'Balance stats', 'Model prompt']),\n blueprintTool('prop-generator', 'Prop Generator', 'Create environmental props for games, films, and virtual production.', '3D & Games', ['props', '3d', 'game-dev', 'assets'], Box, ['Prop: repair terminal', 'Style: worn industrial', 'Scale: human'], ['Asset prompt', 'Texture notes', 'LOD plan']),\n blueprintTool('character-concept-generator', 'Character Concept Generator', 'Create character sheets, outfit prompts, and turnaround notes.', '3D & Games', ['character', 'concept-art', '3d', 'game-dev'], Gamepad2, ['Role: engineer', 'Setting: orbital station', 'Silhouette: compact'], ['Character brief', 'Pose sheet prompts', 'Asset handoff']),\n blueprintTool('vehicle-generator', 'Vehicle Generator', 'Generate vehicle concepts, model prompts, and gameplay roles.', '3D & Games', ['vehicle', '3d', 'game-dev', 'concept'], Cuboid, ['Vehicle: mining rover', 'Terrain: ice', 'Crew: 2'], ['Concept prompt', 'Part breakdown', 'Gameplay stats']),\n blueprintTool('spaceship-generator', 'Spaceship Generator', 'Create spaceship silhouettes, modules, and 3D generation prompts.', '3D & Games', ['spaceship', '3d', 'concept', 'game-dev'], Rocket, ['Class: courier', 'Faction: independent', 'Modules: cargo + medbay'], ['Ship brief', 'Module list', 'Model prompt']),\n blueprintTool('dungeon-map-generator', 'Dungeon Map Generator', 'Generate room graphs, encounter pacing, and map prompts.', '3D & Games', ['dungeon', 'map', 'game-dev', 'level-design'], Map, ['Theme: sunken archive', 'Rooms: 18', 'Loopbacks: 3'], ['Room graph', 'Encounter table', 'Map prompt']),\n blueprintTool('voxel-asset-generator', 'Voxel Asset Generator', 'Generate voxel asset briefs and palette constraints.', '3D & Games', ['voxel', 'pixel-art', '3d', 'assets'], Cuboid, ['Asset: potion shop', 'Grid: 32 cubed', 'Palette: 16 colors'], ['Voxel prompt', 'Palette', 'Export checklist']),\n blueprintTool('pixel-sprite-generator', 'Pixel Sprite Generator', 'Plan sprite sheets, animations, and palette rules.', '3D & Games', ['pixel-art', 'sprite', 'game-dev', 'animation'], Gamepad2, ['Character: courier', 'Frames: idle/run/jump', 'Size: 32x32'], ['Sprite sheet prompt', 'Frame list', 'Palette']),\n blueprintTool('tilemap-generator', 'Tilemap Generator', 'Generate tile sets, auto-tile rules, and level-painting prompts.', '3D & Games', ['tilemap', '2d', 'game-dev', 'tiles'], LayoutGrid, ['Theme: desert ruins', 'Tile size: 16px', 'Needs: corners + slopes'], ['Tile inventory', 'Auto-tile rules', 'Prompt']),\n blueprintTool('material-texture-generator', 'Material Texture Generator', 'Create seamless PBR texture prompts and map requirements.', '3D & Games', ['texture', 'pbr', 'materials', '3d'], Layers, ['Material: cracked ceramic', 'Resolution: 2k', 'Maps: albedo normal roughness'], ['Texture prompt', 'Map checklist', 'Tiling notes']),\n blueprintTool('normal-map-generator', 'Normal Map Generator', 'Plan normal-map creation from sketches, photos, or texture prompts.', '3D & Games', ['normal-map', 'texture', '3d', 'pbr'], Layers, ['Source: stone wall', 'Depth: medium', 'Tileable: yes'], ['Normal-map prompt', 'Strength setting', 'QA checklist']),\n blueprintTool('low-poly-asset-generator', 'Low-Poly Asset Generator', 'Generate low-poly asset briefs with strict budget and silhouette rules.', '3D & Games', ['low-poly', '3d', 'game-dev', 'assets'], Cuboid, ['Asset: guard tower', 'Triangle budget: 3k', 'Texture: 512px'], ['Model prompt', 'Budget table', 'LOD notes']),\n blueprintTool('glb-optimizer', 'GLB Optimizer', 'Estimate compression, texture downsizing, and web delivery savings for GLB files.', '3D & Games', ['glb', '3d', 'optimization', 'web'], Box, ['Current GLB: 48 MB', 'Target: web', 'Textures: 4k'], ['Optimization plan', 'Expected file size', 'Viewer QA list']),\n blueprintTool('rigging-prep-tool', 'Rigging Prep Tool', 'Prepare 3D assets for rigging with naming, topology, and pivot checks.', '3D & Games', ['rigging', '3d', 'character', 'prep'], Workflow, ['Asset: humanoid GLB', 'Target: Mixamo-style rig', 'Issues: unknown'], ['Rigging checklist', 'Bone naming plan', 'Export settings']),\n blueprintTool('scene-lighting-planner', 'Scene Lighting Planner', 'Plan lighting setups for 3D renders, games, and product shots.', '3D & Games', ['lighting', '3d', 'render', 'scene'], Sparkles, ['Scene: cyberpunk alley', 'Mood: rainy neon', 'Engine: Blender'], ['Light rig', 'Color notes', 'Render prompt']),\n blueprintTool('game-economy-balancer', 'Game Economy Balancer', 'Model rewards, prices, sinks, and progression pacing.', '3D & Games', ['game-economy', 'balance', 'spreadsheet', 'design'], Calculator, ['Currency/hour: 450', 'Item tiers: 5', 'Target unlock: 3 days'], ['Balance table', 'Sink suggestions', 'Progression warnings']),\n blueprintTool('quest-generator', 'Quest Generator', 'Generate quest arcs, objectives, rewards, and branching outcomes.', '3D & Games', ['quest', 'narrative', 'game-dev', 'writing'], FileText, ['Setting: sky city', 'Quest length: 20 minutes', 'Reward: crafting part'], ['Quest outline', 'Objective chain', 'Dialogue beats']),\n blueprintTool('level-blockout-generator', 'Level Blockout Generator', 'Create greybox level plans with routes, sightlines, and pacing.', '3D & Games', ['level-design', 'blockout', 'game-dev', 'map'], Map, ['Mode: co-op mission', 'Length: 12 minutes', 'Theme: factory'], ['Blockout plan', 'Encounter pacing', 'Sightline notes']),\n blueprintTool('isometric-room-generator', 'Isometric Room Generator', 'Generate isometric rooms, props, and style prompts.', '3D & Games', ['isometric', 'room', '3d', 'game-art'], Home, ['Room: hacker den', 'Style: cozy sci-fi', 'Grid: 10x10'], ['Room layout', 'Prop list', 'Image prompt']),\n blueprintTool('ar-product-preview-generator', 'AR Product Preview Generator', 'Plan AR-ready product models with scale and material constraints.', '3D & Games', ['ar', 'product', '3d', 'glb'], Box, ['Product: chair', 'Scale: real-world', 'Target: mobile web'], ['AR model spec', 'Texture budget', 'Placement QA']),\n\n blueprintTool('keyword-cluster-builder', 'Keyword Cluster Builder', 'Cluster keywords by search intent and page type.', 'SEO & Content', ['seo', 'keywords', 'cluster', 'content'], FileSearch, ['Seed: GPU cost calculator', 'Market: US', 'Intent: mixed'], ['Keyword clusters', 'Page map', 'Priority score']),\n blueprintTool('programmatic-seo-page-brief', 'Programmatic SEO Page Brief', 'Generate scalable page templates with variables, FAQs, and schema.', 'SEO & Content', ['programmatic-seo', 'brief', 'schema', 'templates'], LayoutGrid, ['Template: {model} pricing', 'Rows: 250', 'Audience: developers'], ['Page template', 'Variable list', 'Internal-link plan']),\n blueprintTool('schema-markup-generator', 'Schema Markup Generator', 'Generate JSON-LD for tools, products, FAQs, articles, and local pages.', 'SEO & Content', ['schema', 'json-ld', 'seo', 'structured-data'], Braces, ['Type: SoftwareApplication', 'Name: GPU Cost Calculator', 'Pricing: free'], ['JSON-LD block', 'Validation checklist', 'Rich-result notes']),\n blueprintTool('meta-title-tester', 'Meta Title Tester', 'Draft SERP titles and descriptions with pixel-length guardrails.', 'SEO & Content', ['meta-title', 'serp', 'seo', 'copy'], Type, ['Keyword: cloud pricing calculator', 'Brand: app.nz', 'Angle: free tool'], ['Title variants', 'Meta descriptions', 'Truncation warnings']),\n blueprintTool('internal-link-planner', 'Internal Link Planner', 'Find internal link targets and anchor text for new SEO pages.', 'SEO & Content', ['internal-links', 'seo', 'site-architecture'], Link2, ['New page: deployment cost calculator', 'Cluster: cloud tools', 'Depth limit: 3'], ['Link targets', 'Anchor text', 'Navigation suggestions']),\n blueprintTool('content-gap-finder', 'Content Gap Finder', 'Compare competitors and generate missing sections, entities, and tools.', 'SEO & Content', ['content-gap', 'competitors', 'seo', 'brief'], FileSearch, ['Your URL', 'Competitors: 3', 'Topic: vector database cost'], ['Missing entities', 'Section gaps', 'Tool ideas']),\n blueprintTool('landing-page-copy-generator', 'Landing Page Copy Generator', 'Draft landing-page copy from offer, audience, proof, and objections.', 'SEO & Content', ['landing-page', 'copywriting', 'marketing', 'seo'], FileText, ['Offer: hosted GPU endpoints', 'Audience: AI founders', 'Proof: p95 latency'], ['Hero copy', 'Sections', 'CTA variants']),\n blueprintTool('faq-generator', 'FAQ Generator', 'Generate search-intent FAQs with concise answers and schema markup.', 'SEO & Content', ['faq', 'schema', 'seo', 'content'], FileText, ['Topic: LLM API cost', 'Questions: 8', 'Tone: practical'], ['FAQ list', 'JSON-LD', 'Internal links']),\n blueprintTool('comparison-page-builder', 'Comparison Page Builder', 'Draft comparison pages for tools, models, APIs, or cloud providers.', 'SEO & Content', ['comparison', 'seo', 'alternatives', 'copy'], GitCompareArrows, ['A: RunPod', 'B: AWS GPU', 'Audience: ML engineers'], ['Comparison table', 'Verdict copy', 'Use-case fit']),\n blueprintTool('alternative-page-builder', 'Alternative Page Builder', 'Build “alternative to” pages with fair positioning and feature tables.', 'SEO & Content', ['alternative', 'seo', 'competitor', 'landing-page'], Swords, ['Competitor: OpenRouter', 'Product: app.nz gateway', 'Angle: agents + hosting'], ['Feature table', 'Migration pitch', 'FAQ']),\n blueprintTool('backlinkable-tool-idea-generator', 'Backlinkable Tool Idea Generator', 'Generate calculator and utility ideas that naturally earn links.', 'SEO & Content', ['backlinks', 'tools', 'seo', 'ideas'], Sparkles, ['Niche: AI infrastructure', 'Audience: developers', 'Moat: live pricing data'], ['Tool ideas', 'Link intent', 'Build difficulty']),\n blueprintTool('calculator-embed-generator', 'Calculator Embed Generator', 'Plan embeddable calculators with inputs, formulas, and share states.', 'SEO & Content', ['calculator', 'embed', 'seo', 'interactive'], Calculator, ['Calculator: GPU cost', 'Embed size: responsive', 'Share URL: yes'], ['Input schema', 'Formula notes', 'Embed snippet plan']),\n blueprintTool('local-seo-brief', 'Local SEO Brief', 'Create service-area briefs with local entities and trust signals.', 'SEO & Content', ['local-seo', 'brief', 'services', 'content'], Map, ['Service: AI consulting', 'City: Auckland', 'Proof: case studies'], ['Page outline', 'Local entities', 'FAQ']),\n blueprintTool('image-alt-text-generator', 'Image Alt Text Generator', 'Generate concise, useful alt text for galleries, blogs, and ecommerce.', 'SEO & Content', ['alt-text', 'accessibility', 'seo', 'images'], Image, ['Image: product on desk', 'Context: ecommerce listing', 'Max: 125 chars'], ['Alt text variants', 'Decorative-image note', 'Keyword-safe wording']),\n blueprintTool('llms-txt-generator', 'LLMs.txt Generator', 'Generate llms.txt and llms-full.txt outlines for AI agent discovery.', 'SEO & Content', ['llms.txt', 'agents', 'seo', 'docs'], FileCode, ['Site: app.nz', 'Docs paths: /docs', 'Priority: API + tools'], ['llms.txt outline', 'Full index sections', 'Crawler notes']),\n];\n\nexport const tools: ToolDef[] = [...coreTools, ...blueprintTools];\n\nexport const toolBySlug: Record = Object.fromEntries(tools.map((t) => [t.slug, t]));\n\nexport const toolCategories: ToolCategory[] = [\n 'AI & Prompts',\n 'Evals',\n 'Developer',\n 'Cloud & Cost',\n 'Design & Media',\n '3D & Games',\n 'SEO & Content',\n 'Marketing',\n 'Fun',\n];\n\nexport const toolSlugs = tools.map((t) => t.slug);\n","// Registry of hosted model spaces — one playground + SEO page per gateway media\n// model (fal-routed image/video/3d/audio, in the style of fal.ai's /models pages).\n// Adding an entry here creates /spaces/, its /meta, and its\n// sitemap/prerender coverage. Keep slugs in sync with sitemapSpaceSlugs in\n// server/sitemap.go.\n\nexport type SpaceTask =\n | 'text-to-image'\n | 'image-edit'\n | 'image-to-3d'\n | 'model-to-3d'\n | 'text-to-video'\n | 'image-to-video'\n | 'reference-to-video'\n | 'text-to-audio';\n\nexport type SpaceCategory = 'image' | 'video' | '3d' | 'audio';\n\nexport interface CogSpaceConfig {\n /** Catalog template used by the zero-config /api/cogs/run bridge. */\n template: string;\n /** Stable name shared by compatible Spaces so they reuse one warm worker. */\n deploymentName: string;\n aspectRatios?: string[];\n steps?: { min: number; max: number; default: number };\n allowSeed?: boolean;\n structuredPrompt?: boolean;\n /** Optional H3 final-frame keyframe, separate from first-frame loop mode. */\n lastFrame?: boolean;\n /** Model-native first-frame-as-last-frame conditioning, not post-processing. */\n loop?: boolean;\n audio?: boolean;\n codecs?: string[];\n encodeQuality?: { min: number; max: number; default: number };\n notice?: string;\n}\n\nexport interface Space {\n slug: string;\n /** Gateway catalog model id sent as `model` in the request body. */\n model: string;\n name: string;\n task: SpaceTask;\n category: SpaceCategory;\n tagline: string;\n /** Meta description (also the index-card copy). */\n description: string;\n /** SEO body copy under the playground. */\n about: string[];\n price: string;\n defaultPrompt?: string;\n defaultImageUrl?: string;\n defaultModelUrl?: string;\n sizes?: string[];\n /** Seconds choices for video/audio tasks. */\n durations?: number[];\n /** Extra fixed fields merged into the request payload. */\n extraPayload?: Record<string, string | number | boolean>;\n /** Optional direct Cog runtime. Generic Spaces otherwise use the media gateway. */\n cog?: CogSpaceConfig;\n}\n\nconst FLUX_SIZES = ['1024x1024', '1152x768', '768x1152', '1360x768', '768x1360'];\nconst IMG_PROMPT =\n 'A beige ceramic coffee mug on a wooden table, soft natural window light, editorial product photo';\nconst VIDEO_PROMPT = 'A cinematic fly-through of a neon-lit cyberpunk street at night, rain reflections, slow dolly';\nconst REF_IMAGE = 'https://openpathsstatic.openpaths.io/static/uploads/image-to-3d/sword-reference.jpg';\nconst REF_GLB = 'https://openpathsstatic.openpaths.io/static/uploads/image-to-3d/sword-pixal3d.glb';\n\nexport const spaces: Space[] = [\n // ---- Image generation ----\n {\n slug: 'flux-schnell',\n model: 'flux-schnell',\n name: 'FLUX.1 Schnell',\n task: 'text-to-image',\n category: 'image',\n tagline: 'The fastest FLUX — production text-to-image in a few steps.',\n description:\n 'Run FLUX.1 Schnell through the app.nz gateway: fast, cheap text-to-image at $0.003 per image with an OpenAI-compatible API, live playground, and prepaid credits.',\n about: [\n 'FLUX.1 Schnell is Black Forest Labs\\' distilled FLUX variant tuned for speed: it generates in a handful of diffusion steps, making it the right default for thumbnails, drafts, high-volume pipelines, and anywhere latency matters more than the last few percent of detail.',\n 'On app.nz it runs behind the same /v1/images/generations endpoint as every other image model — switch to flux-pro or gpt-image-2 by changing one field. Requests are metered per image against your prepaid credits.',\n ],\n price: '$0.003 / image',\n defaultPrompt: IMG_PROMPT,\n sizes: FLUX_SIZES,\n },\n {\n slug: 'flux-dev',\n model: 'flux-dev',\n name: 'FLUX.1 Dev',\n task: 'text-to-image',\n category: 'image',\n tagline: 'The open-weights FLUX workhorse — quality text-to-image.',\n description:\n 'Generate with FLUX.1 Dev on app.nz: strong prompt-following and detail at $0.025 per image, OpenAI-compatible API, playground, and usage-based billing.',\n about: [\n 'FLUX.1 Dev is the open-weights guidance-distilled FLUX model — a big step up from Schnell in detail, typography, and prompt adherence while staying far cheaper than Pro. It is the sweet spot for product shots, concept art, and marketing imagery.',\n 'Call it through /v1/images/generations with your app.nz key, or try it here first. Every image is metered against prepaid credits at the published price.',\n ],\n price: '$0.025 / image',\n defaultPrompt: IMG_PROMPT,\n sizes: FLUX_SIZES,\n },\n {\n slug: 'flux-pro',\n model: 'flux-pro',\n name: 'FLUX 1.1 Pro',\n task: 'text-to-image',\n category: 'image',\n tagline: 'Top-tier FLUX quality for hero images and client work.',\n description:\n 'FLUX 1.1 Pro on the app.nz gateway: state-of-the-art text-to-image at $0.04 per image with an OpenAI-compatible API and a live browser playground.',\n about: [\n 'FLUX 1.1 Pro is the flagship FLUX model: the best prompt-following, cleanest text rendering, and most reliable anatomy in the family. Use it when the image is the product — hero banners, ads, packaging mockups, editorial art.',\n 'It shares the /v1/images/generations endpoint with every other model on the gateway, so upgrading a pipeline from Schnell or Dev is a one-line change.',\n ],\n price: '$0.04 / image',\n defaultPrompt: IMG_PROMPT,\n sizes: FLUX_SIZES,\n },\n {\n slug: 'flux-klein',\n model: 'klein',\n name: 'FLUX.2 Klein',\n task: 'text-to-image',\n category: 'image',\n tagline: 'FLUX.2\\'s compact 4B model — modern quality, small price.',\n description:\n 'FLUX.2 Klein (4B) on app.nz: next-gen FLUX architecture at $0.02 per image through the OpenAI-compatible /v1/images/generations endpoint.',\n about: [\n 'Klein is the compact 4-billion-parameter member of the FLUX.2 family: newer architecture and training than FLUX.1 at a fraction of Pro pricing. It handles complex scenes and text noticeably better than similarly priced FLUX.1 variants.',\n 'Generate here in the playground or call it with model \"klein\" from any OpenAI SDK pointed at https://app.nz/v1.',\n ],\n price: '$0.02 / image',\n defaultPrompt: IMG_PROMPT,\n sizes: FLUX_SIZES,\n },\n {\n slug: 'gpt-image-2',\n model: 'fal-gpt-image-2',\n name: 'GPT Image 2',\n task: 'text-to-image',\n category: 'image',\n tagline: 'OpenAI\\'s strongest image model, hosted with instant failover.',\n description:\n 'GPT Image 2 through the app.nz gateway: best-in-class instruction following and text rendering at $0.22 per image, with automatic fallback across hosts.',\n about: [\n 'GPT Image 2 leads on instruction-following: long multi-part prompts, accurate in-image text, charts, UI mockups, and edits that respect the rest of the scene. It costs more per image, so most pipelines pair it with a cheap draft model and reserve it for finals.',\n 'app.nz routes it across multiple hosts with automatic failover, and the auto-image router picks it automatically when a prompt needs its strengths.',\n ],\n price: '$0.22 / image',\n defaultPrompt: 'A clean infographic poster that says \"SHIP IT FRIDAY\" in bold type, minimal Swiss design, off-white background',\n },\n {\n slug: 'hidream-o1',\n model: 'hidream-o1-image-dev',\n name: 'HiDream O1',\n task: 'text-to-image',\n category: 'image',\n tagline: 'Megapixel-priced image generation with vision-grade fidelity.',\n description:\n 'HiDream O1 (dev) on app.nz: high-fidelity text-to-image billed per megapixel (~$0.011/MP) through the OpenAI-compatible gateway.',\n about: [\n 'HiDream O1 is a strong open image model with unusually good photorealism and lighting. On app.nz it bills per output megapixel, so smaller renders cost proportionally less — useful for iterating at low resolution before a full-size final.',\n 'It also has an edit variant (see the HiDream O1 Edit space) that applies prompt-guided changes to an input image.',\n ],\n price: '~$0.011 / megapixel',\n defaultPrompt: IMG_PROMPT,\n },\n\n {\n slug: 'fast-sdxl',\n model: 'fast-sdxl',\n name: 'Fast SDXL',\n task: 'text-to-image',\n category: 'image',\n tagline: 'Netwrck\\'s open stable-diffusion-server — 8-step SDXL for $0.003.',\n description:\n 'Run Fast SDXL (Proteus, 8 steps) from the open-source stable-diffusion-server on app.nz: turbo-priced text-to-image at $0.003 per image via the OpenAI-compatible gateway.',\n about: [\n 'Fast SDXL runs netwrck\\'s open-source stable-diffusion-server: a Proteus-SDXL pipeline distilled to a handful of steps, priced like SDXL Turbo. It is the cheapest way to iterate on compositions, thumbnails, and bulk art before a quality pass with a larger model.',\n 'The same server also powers the SDXL Style Transfer space — send {model: \"fast-sdxl\", prompt} to /v1/images/generations, or alias it as \"stable-diffusion-server\".',\n ],\n price: '$0.003 / image',\n defaultPrompt: IMG_PROMPT,\n sizes: ['1024x1024', '768x768', '512x512', '1024x768', '768x1024'],\n },\n\n // ---- Image editing ----\n {\n slug: 'sdxl-style-transfer',\n model: 'sdxl-style-transfer',\n name: 'SDXL Style Transfer',\n task: 'image-edit',\n category: 'image',\n tagline: 'Restyle any image along its lines — canny-guided SDXL at $0.003.',\n description:\n 'Style transfer on app.nz: canny edge-guided SDXL redraws your image in any style for $0.003 per image — input image in, restyled image out, via the gateway API.',\n about: [\n 'SDXL Style Transfer extracts the line structure of your input image (canny ControlNet) and redraws it in the style you describe — anime, watercolor, blueprint, oil paint — preserving composition while fully changing the look. It runs on netwrck\\'s open-source stable-diffusion-server at SDXL Turbo pricing.',\n 'Send {model: \"sdxl-style-transfer\", prompt, image_url, strength} to /v1/images/generations. The example below restyles a photo of a fox into anime — swap in your own image URL or upload one.',\n ],\n price: '$0.003 / image',\n defaultPrompt: 'anime style, vibrant colors, clean lineart',\n defaultImageUrl: 'https://netwrckstatic.netwrck.com/static/uploads/test/appnz-probe-fox.webp',\n extraPayload: { strength: 0.75 },\n },\n {\n slug: 'hidream-o1-edit',\n model: 'fal-ai/hidream-o1-image/edit',\n name: 'HiDream O1 Edit',\n task: 'image-edit',\n category: 'image',\n tagline: 'Prompt-guided edits that keep the rest of the image intact.',\n description:\n 'Edit any image with a text instruction using HiDream O1 Edit on app.nz — restyle, replace, and retouch at ~$0.011 per megapixel via the gateway API.',\n about: [\n 'HiDream O1 Edit takes an input image plus an instruction (\"make it night\", \"replace the mug with a teapot\", \"watercolor style\") and rewrites only what the prompt asks for, preserving composition and identity.',\n 'Send {model, prompt, image_url} to /v1/images/generations — the same endpoint as generation, so edit steps drop into existing pipelines unchanged.',\n ],\n price: '~$0.011 / megapixel',\n defaultPrompt: 'Make it golden hour: warm low sun, long soft shadows, keep everything else unchanged',\n defaultImageUrl: REF_IMAGE,\n },\n {\n slug: 'extend-image',\n model: 'extend-image',\n name: 'Extend Image',\n task: 'image-edit',\n category: 'image',\n tagline: 'Outpaint any image — grow the canvas in any direction.',\n description:\n 'Extend an image beyond its borders with AI outpainting on app.nz: $0.05 per image through the gateway API, with a live playground.',\n about: [\n 'Extend Image grows a picture past its original edges, hallucinating coherent surroundings — turn a portrait crop into a wide banner, or recover headroom lost to a tight crop. A prompt steers what the new regions contain.',\n 'For FLUX-quality outpainting see the FLUX.2 Pro Outpaint space; this endpoint is the cheaper general-purpose option.',\n ],\n price: '$0.05 / image',\n defaultPrompt: 'Extend the scene naturally, matching lighting and perspective',\n defaultImageUrl: REF_IMAGE,\n },\n {\n slug: 'flux-2-pro-outpaint',\n model: 'fal-ai/flux-2-pro/outpaint',\n name: 'FLUX.2 Pro Outpaint',\n task: 'image-edit',\n category: 'image',\n tagline: 'FLUX.2 Pro quality applied to canvas extension.',\n description:\n 'Outpaint with FLUX.2 Pro on app.nz: seamless canvas extension at $0.033 for the first megapixel through the OpenAI-compatible gateway.',\n about: [\n 'FLUX.2 Pro Outpaint extends images with the flagship FLUX.2 model, so the generated regions match the original in texture, grain, and lighting well enough to survive print and hero placements.',\n 'Billing is per megapixel of output ($0.033 first MP, $0.0165 each additional), so cost scales with how much canvas you add.',\n ],\n price: '$0.033 first MP + $0.0165 / extra MP',\n defaultPrompt: 'Continue the environment seamlessly on all sides',\n defaultImageUrl: REF_IMAGE,\n },\n {\n slug: 'smart-resize',\n model: 'smart-resize',\n name: 'Smart Resize',\n task: 'image-edit',\n category: 'image',\n tagline: 'Retarget any image to a new aspect ratio without stretching.',\n description:\n 'AI-aware image resizing on app.nz: convert any image to a new aspect ratio — content is extended or recomposed, never squashed. $0.18 per image.',\n about: [\n 'Smart Resize retargets an image to a different aspect ratio by understanding its content: subjects stay undistorted while backgrounds extend or recompose. One product shot becomes a square tile, a story, and a wide banner.',\n 'Pass the target size alongside the image URL; the result comes back through the standard images response envelope.',\n ],\n price: '$0.18 / image',\n defaultPrompt: '',\n defaultImageUrl: REF_IMAGE,\n sizes: ['1024x1024', '1280x720', '720x1280', '1360x768'],\n },\n\n // ---- 3D ----\n {\n slug: 'pixal3d',\n model: 'pixal3d-image-to-3d',\n name: 'Pixal3D',\n task: 'image-to-3d',\n category: '3d',\n tagline: 'One photo in, a textured GLB out — fast and cheap.',\n description:\n 'Convert an image to a textured 3D model (GLB) with Pixal3D on app.nz: $0.30 per generation via the /v1/3d/generations API, previewed in-browser.',\n about: [\n 'Pixal3D reconstructs a single reference image into a textured, game-ready GLB mesh. It is the fastest and cheapest image-to-3D route on the gateway — right for previz, prototyping, and bulk asset generation.',\n 'Jobs run async: POST returns a job id you poll until the GLB URL is ready. The playground below handles polling and renders the result in an interactive viewer.',\n ],\n price: '$0.30 / model',\n defaultImageUrl: REF_IMAGE,\n },\n {\n slug: 'meshy-v6',\n model: 'meshy-v6-image-to-3d',\n name: 'Meshy v6',\n task: 'image-to-3d',\n category: '3d',\n tagline: 'Production-grade image-to-3D with clean topology control.',\n description:\n 'Meshy v6 image-to-3D on app.nz: high-quality textured meshes with topology and polycount control, $0.80 per generation through the gateway API.',\n about: [\n 'Meshy v6 is the quality pick for image-to-3D: cleaner topology, better texture projection, and controls for target polycount and remeshing. Use it when the asset ships in a real scene rather than a prototype.',\n 'Compare against Pixal3D (fastest) and Tripo P1 (balanced) — all three share the same /v1/3d/generations request shape, so switching engines is a one-field change.',\n ],\n price: '$0.80 / model',\n defaultImageUrl: REF_IMAGE,\n },\n {\n slug: 'tripo-p1',\n model: 'tripo-p1-image-to-3d',\n name: 'Tripo P1',\n task: 'image-to-3d',\n category: '3d',\n tagline: 'Balanced image-to-3D — strong meshes at mid price.',\n description:\n 'Tripo P1 image-to-3D on app.nz: reliable textured GLB reconstruction at $0.50 per generation via the OpenAI-compatible gateway.',\n about: [\n 'Tripo P1 sits between Pixal3D and Meshy v6 on the quality/price curve, with dependable silhouettes and textures across product shots, characters, and props.',\n 'The async job API and in-browser GLB preview below work identically across all image-to-3D spaces on app.nz.',\n ],\n price: '$0.50 / model',\n defaultImageUrl: REF_IMAGE,\n },\n {\n slug: 'meshy-rigging',\n model: 'meshy-rigging',\n name: 'Meshy Auto-Rig',\n task: 'model-to-3d',\n category: '3d',\n tagline: 'Upload a humanoid mesh, get back a rigged, animatable GLB.',\n description:\n 'Automatic character rigging on app.nz: Meshy adds a skeleton and skin weights to a humanoid GLB for $0.20 per rig via /v1/3d/generations.',\n about: [\n 'Meshy Auto-Rig takes an unrigged humanoid mesh and returns it with a skeleton and skinning weights, ready for animation in Blender, Unity, or Unreal. It pairs naturally with the image-to-3D spaces: generate a character, then rig it in one more call.',\n 'Pass the GLB URL as model_url; the job completes with a download URL for the rigged asset.',\n ],\n price: '$0.20 / rig',\n defaultModelUrl: REF_GLB,\n },\n {\n slug: 'trellis-retexture',\n model: 'trellis-2-retexture',\n name: 'Trellis 2 Retexture',\n task: 'model-to-3d',\n category: '3d',\n tagline: 'Re-skin any mesh from a text prompt — geometry untouched.',\n description:\n 'Retexture 3D models with Trellis 2 on app.nz: describe a new material or style and get the same mesh back with fresh textures. $0.24 per run.',\n about: [\n 'Trellis 2 Retexture repaints an existing mesh from a prompt — \"weathered bronze\", \"toon-shaded\", \"sci-fi panels\" — without altering geometry or UVs, so one asset yields a whole palette of variants.',\n 'Provide model_url plus a prompt; the async job returns a new textured GLB.',\n ],\n price: '$0.24 / run',\n defaultPrompt: 'Weathered bronze with verdigris in the recesses, subtle scratches on edges',\n defaultModelUrl: REF_GLB,\n },\n\n // ---- Video ----\n {\n slug: 'minimax-h3-text-to-video',\n model: 'minimax-h3',\n name: 'MiniMax H3 Text-to-Video',\n task: 'text-to-video',\n category: 'video',\n tagline: 'Joint video and stereo audio from one prompt on a shared 5090 Cog.',\n description:\n 'Run MiniMax H3 text-to-video on app.nz with native synced audio, honest flow-matching controls, GPU AV1 delivery, and a shared scale-to-zero Cog worker.',\n about: [\n 'MiniMax H3 generates the picture and stereo soundtrack together. This Space exposes the controls the model actually uses: canvas tier, duration, sampling steps, seed, structured prompting, audio, and delivery codec. H3 is guidance-distilled, so there is no decorative CFG, negative-prompt, or alternate-scheduler control. Pick size=audio for a 32×32 near-realtime foley/dialogue sketch (video disposable; keep native audio on).',\n 'Text-to-video and image-to-video requests use the same named minimax-h3-shared deployment. A signed-in account therefore pays for one reusable scale-to-zero worker rather than warming two copies of the model. For a naturally closing cinemagraph, use the companion image-to-video Space: loop mode needs a real first-frame anchor.',\n ],\n price: '~$2.24 / GPU-hour, billed per execution second',\n defaultPrompt: 'A quiet moss-covered courtyard after rain, a shallow reflecting pool ripples in a light breeze, slow locked-off cinematic shot; distant birds and soft water ambience',\n sizes: ['balanced', 'preview', 'native', 'audio'],\n durations: [5, 8, 12, 15, 30, 45, 60],\n cog: {\n template: 'minimax-h3',\n deploymentName: 'minimax-h3-shared',\n aspectRatios: ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9'],\n steps: { min: 8, max: 30, default: 12 },\n allowSeed: true,\n structuredPrompt: true,\n audio: true,\n codecs: ['webm-av1', 'mp4-h264'],\n encodeQuality: { min: 16, max: 45, default: 26 },\n notice: 'Requires APPNZ_MINIMAX_H3_LICENSE_ACCEPTED=1. int8_convrot is the stable default; w4a8 is experimental opt-in. Durations >15s auto-chain ~5s segments with a 1s first_frame overlap (same seed). size=audio forces 32×32 (≤45s, no chain).',\n },\n },\n {\n slug: 'minimax-h3-image-to-video',\n model: 'minimax-h3',\n name: 'MiniMax H3 Image-to-Video',\n task: 'image-to-video',\n category: 'video',\n tagline: 'Animate a first frame, land on a chosen final frame, or generate a natural loop.',\n description:\n 'Animate an image with MiniMax H3 on app.nz, including optional model-native first/last loop conditioning, native audio, GPU AV1, and a shared scale-to-zero Cog worker.',\n about: [\n 'The input image becomes H3\\'s first-frame condition. Add an optional ending keyframe for a first/last-frame transition, or turn on Natural loop to reuse the opening image as the final-frame condition. Loop mode asks the model to create a coherent path back to its start—it is not a reversed clip, cross-fade, or duplicated frame added after generation.',\n 'This Space shares the minimax-h3-shared deployment with H3 text-to-video. The fixed sampler is H3\\'s flow-match Euler path; useful tuning stays focused on prompt, canvas, duration, steps, seed, audio, and encode quality.',\n ],\n price: '~$2.24 / GPU-hour, billed per execution second',\n defaultPrompt: 'Locked camera. Only the steam, reflections, leaves, and small water ripples move; preserve the composition and return gently to the opening frame; soft courtyard ambience',\n sizes: ['balanced', 'preview', 'native'],\n durations: [5, 8, 12, 15, 30],\n cog: {\n template: 'minimax-h3',\n deploymentName: 'minimax-h3-shared',\n aspectRatios: ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9'],\n steps: { min: 8, max: 30, default: 12 },\n allowSeed: true,\n structuredPrompt: true,\n lastFrame: true,\n loop: true,\n audio: true,\n codecs: ['webm-av1', 'mp4-h264'],\n encodeQuality: { min: 16, max: 45, default: 26 },\n notice: 'Requires APPNZ_MINIMAX_H3_LICENSE_ACCEPTED=1. int8_convrot is the stable default; w4a8 is experimental opt-in. Durations >15s auto-chain from the opening frame (loop/last_frame disabled while chaining).',\n },\n },\n {\n slug: 'seedance-2',\n model: 'seedance-2.0-text-to-video',\n name: 'Seedance 2.0',\n task: 'text-to-video',\n category: 'video',\n tagline: 'Flagship text-to-video — cinematic motion from a prompt.',\n description:\n 'Generate video from text with Seedance 2.0 on app.nz: cinematic clips at ~$0.33 per second through the async /v1/videos/generations API.',\n about: [\n 'Seedance 2.0 is ByteDance\\'s flagship generation model: strong camera language, coherent motion, and reliable prompt-following across styles. Clips are billed per output second, so a 6-second draft costs about $2.',\n 'Jobs are asynchronous — submit, poll, download. The playground handles the loop and plays the result inline; the same three calls work from any HTTP client.',\n ],\n price: '~$0.33 / second',\n defaultPrompt: VIDEO_PROMPT,\n durations: [4, 6, 8],\n },\n {\n slug: 'seedance-2-fast',\n model: 'seedance-2.0-fast-text-to-video',\n name: 'Seedance 2.0 Fast',\n task: 'text-to-video',\n category: 'video',\n tagline: 'Same Seedance DNA, tuned for drafts and volume.',\n description:\n 'Seedance 2.0 Fast text-to-video on app.nz: quicker, cheaper clips (~$0.27/second) for iteration and high-volume pipelines.',\n about: [\n 'Seedance 2.0 Fast trades a little fidelity for meaningfully faster turnaround and a lower per-second rate — the right default while iterating on prompts, then re-render finals on full Seedance 2.0 with the same request body.',\n ],\n price: '~$0.27 / second',\n defaultPrompt: VIDEO_PROMPT,\n durations: [4, 6, 8],\n },\n {\n slug: 'seedance-2-image-to-video',\n model: 'seedance-2.0-image-to-video',\n name: 'Seedance 2.0 Image-to-Video',\n task: 'image-to-video',\n category: 'video',\n tagline: 'Animate a still — your image becomes the first frame.',\n description:\n 'Turn any image into video with Seedance 2.0 on app.nz: the input image anchors frame one and a prompt directs the motion. ~$0.33 per second.',\n about: [\n 'Image-to-video keeps your exact composition, product, or character and brings it to life: the input image is the first frame and the prompt describes camera and subject motion. This is the highest-control way to get brand-safe motion.',\n 'Works with generated images too — create in a FLUX space, animate here, all against one prepaid balance.',\n ],\n price: '~$0.33 / second',\n defaultPrompt: 'Slow push-in, steam rising, shallow depth of field',\n defaultImageUrl: REF_IMAGE,\n durations: [4, 6, 8],\n },\n {\n slug: 'seedance-2-reference-to-video',\n model: 'seedance-2.0-reference-to-video',\n name: 'Seedance 2.0 Reference-to-Video',\n task: 'reference-to-video',\n category: 'video',\n tagline: 'Keep a character or product consistent across every shot.',\n description:\n 'Reference-to-video with Seedance 2.0 on app.nz: supply reference images of a subject and generate new scenes that keep it consistent. ~$0.33/second.',\n about: [\n 'Reference-to-video solves consistency: the reference images define what a character or product looks like, and the prompt puts it in a new scene — different angle, action, or setting, same subject. Essential for multi-shot narratives and product campaigns.',\n 'A fast variant (seedance-2.0-fast-reference-to-video) runs the same requests at a lower rate for drafts.',\n ],\n price: '~$0.33 / second',\n defaultPrompt: 'The subject rotates slowly on a marble pedestal, studio lighting, 360 orbit',\n defaultImageUrl: REF_IMAGE,\n durations: [4, 6, 8],\n },\n {\n slug: 'ltx-2-3',\n model: 'ltx-2.3-image-to-video',\n name: 'LTX 2.3',\n task: 'image-to-video',\n category: 'video',\n tagline: 'Fast, affordable image-to-video from Lightricks.',\n description:\n 'LTX 2.3 image-to-video on app.nz: quick, natural motion from a still at $0.28 per second through the gateway video API.',\n about: [\n 'LTX 2.3 is Lightricks\\' open video model — one of the fastest ways to animate a still, with smooth motion and good temporal stability at a friendly per-second rate.',\n 'Same async API as the Seedance spaces; switching models is a one-field change.',\n ],\n price: '$0.28 / second',\n defaultPrompt: 'Gentle parallax, ambient motion, cinematic grade',\n defaultImageUrl: REF_IMAGE,\n durations: [4, 6, 8],\n },\n {\n slug: 'happy-horse',\n model: 'alibaba/happy-horse/image-to-video',\n name: 'Happy Horse',\n task: 'image-to-video',\n category: 'video',\n tagline: 'Alibaba\\'s expressive image-to-video — motion with character.',\n description:\n 'Happy Horse image-to-video on app.nz: Alibaba\\'s animation-strong video model at $0.28 per second via /v1/videos/generations.',\n about: [\n 'Happy Horse leans expressive: character motion, gesture, and stylized animation from a single still. It complements Seedance (cinematic realism) and LTX (speed) in the gateway\\'s video lineup.',\n ],\n price: '$0.28 / second',\n defaultPrompt: 'The character waves and smiles, lively animated motion',\n defaultImageUrl: REF_IMAGE,\n durations: [4, 6, 8],\n },\n\n // ---- Audio ----\n {\n slug: 'sound-effects',\n model: 'elevenlabs-sound-effects',\n name: 'Sound Effects',\n task: 'text-to-audio',\n category: 'audio',\n tagline: 'Describe any sound, get a clean SFX clip in seconds.',\n description:\n 'Generate sound effects from text on app.nz: ElevenLabs SFX v2 at $0.002 per second via the async /v1/audio/generations API.',\n about: [\n 'Type \"heavy wooden door creaking open in a stone hall\" and get a production-ready effect — foley, UI sounds, ambience, impacts. At $0.002/second, entire game soundscapes cost cents.',\n 'Clips return as hosted audio URLs through the standard job API, and the same endpoint powers SFX in the app.nz agents and editors.',\n ],\n price: '$0.002 / second',\n defaultPrompt: 'Heavy wooden door creaking open slowly in a large stone hall, natural reverb',\n durations: [5, 10, 15, 22],\n },\n {\n slug: 'stable-audio',\n model: 'stable-audio-25',\n name: 'Stable Audio 2.5',\n task: 'text-to-audio',\n category: 'audio',\n tagline: 'Text-to-audio for loops, beds, and musical textures.',\n description:\n 'Stable Audio 2.5 on app.nz: generate music beds, loops, and ambient textures from a prompt at $0.20 per generation.',\n about: [\n 'Stable Audio 2.5 generates coherent musical passages and ambient beds — background tracks, loopable game audio, tension stingers — from plain-text descriptions with tempo and instrumentation control.',\n 'For full songs with vocals see the /music page; this space is the API-first route for programmatic audio.',\n ],\n price: '$0.20 / generation',\n defaultPrompt: 'Warm lo-fi hip hop loop, dusty drums, mellow Rhodes chords, vinyl crackle, 80 BPM',\n durations: [10, 20, 30, 45],\n },\n];\n\nexport const spaceBySlug: Record<string, Space> = Object.fromEntries(spaces.map((s) => [s.slug, s]));\n\nexport const spaceCategories: Array<{ id: SpaceCategory; label: string }> = [\n { id: 'image', label: 'Image' },\n { id: 'video', label: 'Video' },\n { id: '3d', label: '3D' },\n { id: 'audio', label: 'Audio' },\n];\n\nexport function spaceMeta(slug: string): { title: string; description: string } | null {\n const s = spaceBySlug[slug];\n if (!s) return null;\n const taskLabel = TASK_LABELS[s.task];\n return { title: `${s.name} — ${taskLabel} API & playground | app.nz`, description: s.description };\n}\n\nexport const TASK_LABELS: Record<SpaceTask, string> = {\n 'text-to-image': 'Text to Image',\n 'image-edit': 'Image Editing',\n 'image-to-3d': 'Image to 3D',\n 'model-to-3d': '3D to 3D',\n 'text-to-video': 'Text to Video',\n 'image-to-video': 'Image to Video',\n 'reference-to-video': 'Reference to Video',\n 'text-to-audio': 'Text to Audio',\n};\n\nexport function spaceEndpoint(spaceOrTask: Space | SpaceTask): string {\n if (typeof spaceOrTask !== 'string' && spaceOrTask.cog) return '/api/cogs/run';\n const task = typeof spaceOrTask === 'string' ? spaceOrTask : spaceOrTask.task;\n switch (task) {\n case 'text-to-image':\n case 'image-edit':\n return '/v1/images/generations';\n case 'image-to-3d':\n case 'model-to-3d':\n return '/v1/3d/generations';\n case 'text-to-video':\n case 'image-to-video':\n case 'reference-to-video':\n return '/v1/videos/generations';\n case 'text-to-audio':\n return '/v1/audio/generations';\n }\n}\n","export type EvalModality = 'language' | 'coding' | 'image' | 'video' | 'open-models';\n\nexport interface EvalLaunch {\n title: string;\n model: string;\n description: string;\n href: string;\n surface: 'Gateway' | 'Comfy' | 'Agent' | 'Evals';\n tags: string[];\n}\n\nexport interface EvalSource {\n slug: string;\n name: string;\n operator: string;\n eyebrow: string;\n description: string;\n measures: string[];\n usefulFor: string;\n caution: string;\n updateNote: string;\n href: string;\n methodologyHref: string;\n modalities: EvalModality[];\n launches: EvalLaunch[];\n}\n\nconst compare = (models: string[]) => `/tools/model-compare?models=${encodeURIComponent(models.join(','))}`;\n\nexport const evalSources: EvalSource[] = [\n {\n slug: 'artificial-analysis',\n name: 'Artificial Analysis',\n operator: 'Artificial Analysis',\n eyebrow: 'Quality, price, and measured speed',\n description:\n 'Independent model analysis spanning language intelligence, price and latency plus blind preference arenas for image and video generation.',\n measures: [\n 'Language intelligence across agentic, coding, scientific-reasoning, and general tasks',\n 'Provider price, output speed, latency, and context-window comparisons',\n 'Blind human preference for text-to-image, image editing, and video modalities',\n ],\n usefulFor: 'Building a broad shortlist while keeping quality, speed, and API price visible together.',\n caution:\n 'Its Intelligence Index is a composite and the media arenas measure relative preference at standardized defaults. Neither substitutes for prompts, hardware, or failure modes from your workload.',\n updateNote: 'Live leaderboards; read current values at the source instead of relying on a copied snapshot.',\n href: 'https://artificialanalysis.ai/',\n methodologyHref: 'https://artificialanalysis.ai/methodology/intelligence-benchmarking',\n modalities: ['language', 'coding', 'image', 'video'],\n launches: [\n {\n title: 'Compare a frontier language panel',\n model: 'GPT · Claude · Gemini · DeepSeek',\n description: 'Send one production prompt to four routed models and inspect output, latency, and billed cost side by side.',\n href: compare(['gpt-5.5', 'claude-sonnet-5', 'gemini-3.5-flash', 'deepseek-v4-flash']),\n surface: 'Evals',\n tags: ['language', 'cost', 'latency'],\n },\n {\n title: 'Run GPT Image 2',\n model: 'gpt-image-2',\n description: 'Use the hosted image playground and OpenAI-compatible image endpoint for a prompt-level check.',\n href: '/spaces/gpt-image-2',\n surface: 'Gateway',\n tags: ['text-to-image', 'hosted'],\n },\n {\n title: 'Run open FLUX or SDXL',\n model: 'FLUX.1 · RealVisXL / SDXL',\n description: 'Try hosted FLUX immediately or open a deployable RealVisXL Comfy workflow with mirrored weights.',\n href: '/comfy?workflow=realvisxl-photo',\n surface: 'Comfy',\n tags: ['text-to-image', 'open-weights'],\n },\n {\n title: 'Run open video workflows',\n model: 'Wan VACE · LTX-Video',\n description: 'Move from the video leaderboard to tested image-to-video, text-to-video, or video-to-video workflow JSON.',\n href: '/comfy?workflow=wan-vace-video-to-video',\n surface: 'Comfy',\n tags: ['video-to-video', 'GPU'],\n },\n ],\n },\n {\n slug: 'arena',\n name: 'Arena',\n operator: 'LMArena / Arena',\n eyebrow: 'Blind human preference',\n description:\n 'Pairwise, anonymous human votes compare model responses and media outputs generated from the same prompt.',\n measures: [\n 'Which response a voter prefers in a blind head-to-head',\n 'Category and modality leaderboards derived from many pairwise votes',\n 'Confidence ranges where the leaderboard exposes them',\n ],\n usefulFor: 'Finding models people tend to prefer for open-ended chat, style, instruction following, and media quality.',\n caution:\n 'Preference is audience- and prompt-distribution dependent. Elo-like ratings are relative, close ranks can overlap, and popularity is not correctness or safety.',\n updateNote: 'Continuously updated from new votes; use the live leaderboard and its current category filters.',\n href: 'https://arena.ai/leaderboard',\n methodologyHref: 'https://lmarena.ai/',\n modalities: ['language', 'image', 'video'],\n launches: [\n {\n title: 'Recreate a blind-text shortlist',\n model: 'app/auto · frontier panel',\n description: 'Start with a shared prompt, compare exact outputs, then repeat with your own acceptance criteria.',\n href: compare(['app/auto', 'gpt-5.5', 'claude-sonnet-5', 'gemini-3.5-flash']),\n surface: 'Evals',\n tags: ['human preference', 'language'],\n },\n {\n title: 'Compare image families',\n model: 'GPT Image · FLUX · SDXL',\n description: 'Run proprietary hosted models beside open workflows rather than treating one global preference score as universal.',\n href: '/spaces',\n surface: 'Gateway',\n tags: ['image', 'playgrounds'],\n },\n ],\n },\n {\n slug: 'livebench',\n name: 'LiveBench',\n operator: 'LiveBench',\n eyebrow: 'Fresh, objective language tasks',\n description:\n 'A frequently refreshed benchmark designed around recent questions, objective ground-truth scoring, and reduced test contamination.',\n measures: [\n 'Math, coding, reasoning, language, instruction following, and data analysis',\n 'Objective answers rather than a model judge where possible',\n 'Performance on questions sourced or transformed from recent material',\n ],\n usefulFor: 'Checking whether a language-model shortlist still generalizes beyond old, heavily circulated benchmark sets.',\n caution:\n 'Freshness reduces one contamination risk; it does not make the category mix identical to your users or account for end-to-end agent scaffolding.',\n updateNote: 'Questions and releases evolve; compare results from compatible benchmark versions.',\n href: 'https://livebench.ai/',\n methodologyHref: 'https://github.com/LiveBench/LiveBench',\n modalities: ['language', 'coding'],\n launches: [\n {\n title: 'Test the same models on your prompt',\n model: 'Reasoning and fast routes',\n description: 'Use benchmark evidence to pick candidates, then measure the exact task, latency, and cost you will ship.',\n href: compare(['app/auto', 'app/auto-fast', 'gpt-5.4-mini', 'deepseek-v4-flash']),\n surface: 'Evals',\n tags: ['reasoning', 'fresh tasks'],\n },\n {\n title: 'Run a repeatable dataset eval',\n model: 'Any gateway models',\n description: 'Turn representative inputs into a scored regression set with an explicit judge rubric.',\n href: '/tools/bulk-evals',\n surface: 'Evals',\n tags: ['dataset', 'regression'],\n },\n ],\n },\n {\n slug: 'swe-bench',\n name: 'SWE-bench Verified',\n operator: 'SWE-bench',\n eyebrow: 'Repository-level software repair',\n description:\n 'A human-validated 500-instance subset of real GitHub issues, evaluated by applying generated patches and running repository tests.',\n measures: [\n 'Whether a generated patch resolves a real repository issue',\n 'End-to-end coding systems on containerized repository tasks',\n 'Language models under a shared minimal bash-agent scaffold',\n ],\n usefulFor: 'Shortlisting coding models and agent systems for multi-file issue resolution rather than isolated code completion.',\n caution:\n 'Agent scaffold, tools, retries, repository selection, and release version materially affect the result. Model-only and full-system tables answer different questions.',\n updateNote: 'Use the leaderboard agent filter and compare like-for-like harness versions.',\n href: 'https://www.swebench.com/verified.html',\n methodologyHref: 'https://www.swebench.com/SWE-bench/guides/evaluation/',\n modalities: ['coding'],\n launches: [\n {\n title: 'Run a cloud coding agent',\n model: 'Provider-aware coding agent',\n description: 'Give an app.nz agent a real repository issue and inspect its patch, tests, logs, and durable artifacts.',\n href: '/agent',\n surface: 'Agent',\n tags: ['repository', 'tests', 'patch'],\n },\n {\n title: 'Compare coding models first',\n model: 'Frontier coding panel',\n description: 'Use one issue and acceptance rubric to narrow the model panel before paying for full repository runs.',\n href: compare(['gpt-5.5', 'claude-sonnet-5', 'gemini-3.5-flash', 'deepseek-v4-flash']),\n surface: 'Evals',\n tags: ['coding', 'shortlist'],\n },\n ],\n },\n {\n slug: 'open-evals',\n name: 'Hugging Face OpenEvals',\n operator: 'Hugging Face community',\n eyebrow: 'Reproducible open-model evaluation',\n description:\n 'A route into task-specific, open leaderboards and evaluation artifacts after the original Open LLM Leaderboard was retired.',\n measures: [\n 'Task-specific open leaderboards rather than one permanent universal ranking',\n 'Public model, dataset, harness, and result artifacts where a leaderboard provides them',\n 'Open-weight models that can be downloaded and hosted independently',\n ],\n usefulFor: 'Finding reproducible evidence for an open model and following it through to the exact model repository or weights.',\n caution:\n '“Open” leaderboards vary in maintenance, task quality, licenses, quantization, prompts, and hardware. Inspect each leaderboard card and result artifact.',\n updateNote: 'The original Open LLM Leaderboard stopped accepting evaluations in 2025; use the maintained leaderboard directory.',\n href: 'https://huggingface.co/spaces/OpenEvals/find-a-leaderboard',\n methodologyHref: 'https://huggingface.co/docs/leaderboards/',\n modalities: ['language', 'coding', 'open-models'],\n launches: [\n {\n title: 'Link Hugging Face weights to Comfy',\n model: 'HF checkpoints, LoRAs, VAEs, ControlNets',\n description: 'Paste a public Hugging Face file URL, preserve provenance, and warm the shared R2 cache before a GPU starts.',\n href: '/comfy?tab=models&q=huggingface',\n surface: 'Comfy',\n tags: ['Hugging Face', 'R2 cache'],\n },\n {\n title: 'Browse hosted provider models',\n model: 'Open and proprietary routes',\n description: 'Check live gateway availability, pricing, context, and capabilities for the model you found.',\n href: '/models',\n surface: 'Gateway',\n tags: ['catalog', 'providers'],\n },\n ],\n },\n];\n\nexport const evalSourceBySlug: Record<string, EvalSource> = Object.fromEntries(evalSources.map((source) => [source.slug, source]));\n\nexport const evalModalities: { id: EvalModality; label: string }[] = [\n { id: 'language', label: 'Language' },\n { id: 'coding', label: 'Coding' },\n { id: 'image', label: 'Image' },\n { id: 'video', label: 'Video' },\n { id: 'open-models', label: 'Open models' },\n];\n","export type CogShowcaseKind =\n | 'motion'\n | 'video'\n | 'voxel'\n | 'clean'\n | 'depth'\n | 'vector'\n | 'upscale'\n | 'stems'\n | 'cutout'\n | 'speech'\n | 'text'\n | 'image'\n | 'music';\n\nexport interface CogShowcase {\n slug: string;\n aliases?: string[];\n template: string;\n title: string;\n eyebrow: string;\n description: string;\n hardware: string;\n output: string;\n kind: CogShowcaseKind;\n input: Record<string, string | number | boolean>;\n source?: string;\n upstream?: string;\n tags: string[];\n inputImage?: string;\n inputVideo?: string;\n inputAudio?: string;\n outputMedia?: string;\n outputFile?: string;\n outputText?: string;\n outputNote: string;\n}\n\nconst robot = '/static/animation-library/image3d/robot.webp';\n\nexport const cogShowcases: CogShowcase[] = [\n {\n slug: 'fastserve-qwen-27b', aliases: ['qwen3.8-27b', 'fastserve-qwen'], template: 'fastserve-qwen-27b',\n title: 'Qwen3.8-27B FastServe', eyebrow: 'Prompt → reasoning, code, tool calls',\n description: 'Qwen3.8-27B on SGLang with a C launcher that reads the GPU and picks the fastest profile for it: NVFP4 on Blackwell, FP8 on Hopper and GB300, DSPARK speculative decoding everywhere. Answers the OpenAI API and Cog predictions on one port.',\n hardware: 'RTX 5090 32GB', output: 'Streaming text', kind: 'text',\n input: { prompt: 'Refactor this Go handler to stream results, then explain the tradeoff in two sentences.', system: 'You are a precise staff engineer.', max_tokens: 800, temperature: 0.7 },\n outputText: 'Stream the rows as you scan them: keep the *sql.Rows open, write each JSON object into the http.ResponseWriter, and Flush() every N records.\\n\\nThe tradeoff is that you cannot set a Content-Length or fail cleanly mid-response — once the first byte is out, an error becomes a truncated body rather than a 500.',\n source: 'https://github.com/lee101/fastserve-qwen-3.8-27b', upstream: 'https://huggingface.co/Qwen/Qwen3.8-27B',\n tags: ['Qwen3.8', 'SGLang', 'NVFP4', 'DSPARK', 'tool calling'],\n outputNote: 'OpenAI-compatible /v1 plus Cog predictions from the same container',\n },\n {\n slug: 'anima-2.9b', template: 'anima-2.9b', title: 'Anima 2.9B', eyebrow: 'Prompt → anime illustration',\n description: 'Run the expanded 2.9B Anima diffusion transformer through a native BF16 Cog with TF32, SDPA, batched guidance, a precompiled torch.compile cache, and a RunPod worker that returns to zero after the burst.',\n hardware: 'L40S 48GB', output: 'WebP, PNG, or JPEG', kind: 'image',\n input: {\n prompt: 'masterpiece, best quality, 1girl, wind-swept cape, luminous city at dusk, detailed background, dramatic illustration',\n negative_prompt: 'low quality, blurry, malformed hands', width: 832, height: 1216,\n num_inference_steps: 28, guidance_scale: 4, seed: 42, output_format: 'webp',\n },\n source: 'https://github.com/lee101/anima-omniserve-native', upstream: 'https://huggingface.co/Gazingstars123/Anima-2.9B',\n tags: ['Anima', 'Cosmos', 'serverless', 'scale-to-zero'],\n outputNote: 'A generated image appears here after the run completes.',\n },\n {\n slug: 'ardy-motion', aliases: ['ardy'], template: 'ardy', title: 'ARDY Motion', eyebrow: 'Text → live pose stream',\n description: 'Direct a humanoid with natural-language motion, waypoints, and WASD controls. ARDY streams structured pose frames at 20 FPS for games, avatars, and animation tools.',\n hardware: 'RTX 3090', output: 'JSON pose stream', kind: 'motion',\n input: { prompt: 'Walk forward, turn left, then break into a joyful run.', steps: 40 },\n source: 'https://github.com/lee101/appnz-ardy', upstream: 'https://research.nvidia.com/labs/toronto-ai/ardy/',\n tags: ['real-time', 'websocket', 'humanoid motion'], outputNote: 'Live session output · 20 FPS skeleton frames',\n },\n {\n slug: 'liveavatar-appnz', aliases: ['liveavatar'], template: 'liveavatar', title: 'LiveAvatar', eyebrow: 'Portrait + audio → character video',\n description: 'Turn one character image and a speech or singing track into expressive long-form video with face, body, camera, and scene guidance.',\n hardware: 'H100 80GB', output: 'MP4 video', kind: 'video',\n input: { image: robot, audio: 'voice.wav', prompt: 'Friendly presenter, natural gestures, soft studio light.', quality: 'standard' },\n inputImage: robot, outputMedia: '/static/uploads/playground/happy-horse-v1.1/image-to-video.mp4',\n source: 'https://github.com/lee101/liveavatar-app-nz', tags: ['audio-driven', 'character', 'long-form'],\n outputNote: 'Video-format preview · durable LiveAvatar example pending',\n },\n {\n slug: 'voxel-3d', template: 'voxel-3d', title: 'Voxel 3D', eyebrow: 'Image → browser-ready 3D',\n description: 'Isolate an object, reconstruct its surface with TripoSR, optionally voxelize it, and return a portable GLB ready for the web or a game engine.',\n hardware: 'RTX 3090', output: 'GLB model', kind: 'voxel',\n input: { image: robot, style: 'mesh', foreground_ratio: 0.85, mc_resolution: 256 }, inputImage: robot,\n outputMedia: '/static/cogs/voxel-3d-output.webp', outputFile: '/static/cogs/voxel-3d-output.glb',\n source: 'https://github.com/lee101/appnz-voxel-3d', upstream: 'https://github.com/VAST-AI-Research/TripoSR',\n tags: ['TripoSR', 'GLB', 'voxel'], outputNote: 'Verified hosted result · colored TripoSR mesh GLB (1.9MB) from the exact input · voxel32/48/64 variants available',\n },\n {\n slug: 'lama-cleaner', template: 'lama-cleaner', title: 'LaMa Cleaner', eyebrow: 'Image + mask → clean plate',\n description: 'Remove unwanted objects with a white mask. LaMa fills the selected region, feathers the edge, and preserves pixels outside the repair.',\n hardware: 'RTX 3090', output: 'PNG image', kind: 'clean',\n input: { image: robot, mask: 'remove-object-mask.png', grow: 8, feather: 6 }, inputImage: robot,\n source: 'https://github.com/lee101/appnz-lama-cleaner', upstream: 'https://github.com/advimman/lama',\n tags: ['inpainting', 'object removal', 'ONNX'], outputNote: 'Output-format preview · verified artifact pending',\n },\n {\n slug: 'depth-vfx', template: 'depth-vfx', title: 'Depth VFX', eyebrow: 'Image → depth-powered passes',\n description: 'Run Depth Anything V2 once and export a depth map, heatmap, normal pass, or a subtle looping parallax move.',\n hardware: 'RTX 3090', output: 'MP4 or image pass', kind: 'depth',\n input: { image: robot, effect: 'parallax', strength: 0.55, seconds: 3 }, inputImage: robot,\n source: 'https://github.com/lee101/appnz-depth-vfx', upstream: 'https://huggingface.co/depth-anything/Depth-Anything-V2-Small-hf',\n tags: ['depth', 'parallax', 'VFX'], outputNote: 'Depth-pass visualization · verified artifact pending',\n },\n {\n slug: 'vectorizer', template: 'vectorizer', title: 'Vectorizer', eyebrow: 'Raster → editable SVG',\n description: 'Convert logos, posters, photos, and pixel art into compact SVG paths with VTracer’s deterministic multithreaded Rust core.',\n hardware: 'RTX 3090', output: 'SVG file', kind: 'vector',\n input: { image: 'https://app.nz/static/cogs/vectorizer-input.webp', preset: 'poster', speckle: 6, color_precision: 6 }, inputImage: '/static/cogs/vectorizer-input.webp',\n outputMedia: '/static/cogs/vectorizer-output.webp',\n source: 'https://github.com/lee101/appnz-vectorizer', upstream: 'https://github.com/visioncortex/vtracer',\n tags: ['SVG', 'VTracer', 'CPU-friendly'], outputNote: 'Verified hosted result · SVG paths returned',\n },\n {\n slug: 'image-upscaler', template: 'image-upscaler', title: 'Image Upscaler', eyebrow: 'Small image → restored 4× image',\n description: 'Restore detail with Real-ESRGAN at 2× or 4×, select general or anime tuning, and optionally enhance faces with GFPGAN.',\n hardware: 'RTX 3090', output: 'PNG or JPEG', kind: 'upscale',\n input: { image: 'https://app.nz/static/cogs/image-upscaler-input.webp', scale: 2, model: 'general', face_enhance: false }, inputImage: '/static/cogs/image-upscaler-input.webp',\n outputMedia: '/static/cogs/image-upscaler-output.webp',\n source: 'https://github.com/lee101/appnz-image-upscaler', upstream: 'https://github.com/xinntao/Real-ESRGAN',\n tags: ['Real-ESRGAN', 'GFPGAN', 'restoration'], outputNote: 'Verified hosted result · 2× raster output',\n },\n {\n slug: 'vocal-separator', template: 'vocal-separator', title: 'Vocal Separator', eyebrow: 'Song → clean stems',\n description: 'Split a track into vocals and instrumental, or export all four Demucs stems as a ZIP for remixing and post-production.',\n hardware: 'RTX 3090', output: 'Audio stems or ZIP', kind: 'stems',\n input: { audio: 'full-mix.wav', stems: 'two', format: 'wav', model: 'htdemucs' },\n source: 'https://github.com/lee101/appnz-vocal-separator', upstream: 'https://github.com/facebookresearch/demucs',\n tags: ['Demucs', 'vocals', 'music'], outputNote: 'Two synchronized audio outputs',\n },\n {\n slug: 'background-remover', template: 'background-remover', title: 'Background Remover', eyebrow: 'Image → transparent cutout',\n description: 'Remove a photo or illustration background to a transparent PNG with a warm, reusable segmentation session.',\n hardware: 'RTX 3090', output: 'Transparent PNG', kind: 'cutout',\n input: { image: 'https://app.nz/static/cogs/background-remover-input.webp', model: 'isnet-general-use' }, inputImage: '/static/cogs/background-remover-input.webp',\n outputMedia: '/static/cogs/background-remover-output.webp',\n source: 'https://github.com/lee101/appnz-rembg', upstream: 'https://github.com/danielgatis/rembg',\n tags: ['rembg', 'segmentation', 'transparent PNG'], outputNote: 'Verified hosted result · transparent PNG',\n },\n {\n slug: 'wan22-t2v-h100-test', aliases: ['wan22-t2v'], template: 'wan22-t2v', title: 'Wan 2.2 T2V + CG-Taylor', eyebrow: 'Prompt → accelerated video',\n description: 'Generate video with Wan 2.2 A14B using NF4 dual-stage transformers and confidence-gated Taylor caching for training-free acceleration.',\n hardware: 'H100 80GB', output: 'MP4 video', kind: 'video',\n input: { prompt: 'A beautiful anime fairy walking through an enchanted forest, soft sunlight filtering through the trees, cinematic tracking shot.', resolution: '480x480', num_frames: 81, steps: 27, guidance: 4, seed: 7, cgtaylor: true },\n outputMedia: '/static/cogs/wan22-t2v-output.mp4',\n source: 'https://github.com/lee101/accelerated-cgtaylor-wan-app-nz', upstream: 'https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B-Diffusers',\n tags: ['Wan 2.2', 'CG-Taylor', 'NF4'], outputNote: 'Verified hosted result · 81-frame live MP4 from the exact input (L40S, cached weights)',\n },\n {\n slug: 'wan22-i2v', template: 'wan22-i2v', title: 'Wan 2.2 I2V + CG-Taylor', eyebrow: 'Image + prompt → accelerated video',\n description: 'Animate a reference frame while preserving its aspect ratio. The I2V image uses the same R2-backed weight path and 48 GB-friendly NF4 runtime.',\n hardware: 'H100 80GB', output: 'MP4 video', kind: 'video',\n input: { image: robot, prompt: 'The robot waves, then takes one step toward camera.', resolution: 'auto', num_frames: 81, steps: 27, cgtaylor: true }, inputImage: robot,\n outputMedia: '/static/uploads/playground/fal-video/veo-3.1-fast-image-to-video.mp4',\n source: 'https://github.com/lee101/accelerated-cgtaylor-wan-app-nz', upstream: 'https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B-Diffusers',\n tags: ['Wan 2.2', 'image-to-video', 'R2 weights'], outputNote: 'Video-format preview · verified Cog result pending',\n },\n {\n slug: 'wan-animate-2', aliases: ['video-restyle-shared', 'wan-animate-shared'], template: 'wan-animate-2',\n title: 'Wan Animate 2', eyebrow: 'Character image + driving video → restyled motion',\n description: 'Transfer the motion, expression, and timing of a driving clip onto a reference character while preserving identity, clothing, and the reference composition.',\n hardware: 'L40S 48GB', output: 'MP4 video', kind: 'video',\n input: {\n image: 'https://appstatic.app.nz/static/cogs/wan-animate-2/reference.png',\n driving_video: 'https://appstatic.app.nz/static/cogs/wan-animate-2/driving.mp4',\n prompt: 'A full-body character dancing naturally, stable identity and clothing, continuous motion.',\n quality: 'preview', max_seconds: 1, fps: 12, frames_per_segment: 17, steps: 6,\n seed: 43, preserve_audio: false, cgtaylor: false, cgtaylor_threshold: 0.015,\n },\n inputImage: 'https://appstatic.app.nz/static/cogs/wan-animate-2/reference.png',\n inputVideo: 'https://appstatic.app.nz/static/cogs/wan-animate-2/driving.mp4',\n outputMedia: 'https://appstatic.app.nz/cogs/1c6cf879-d533-49bf-ac31-2280713a0385/output.mp4',\n source: 'https://github.com/lee101/wan-animate-cog', upstream: 'https://github.com/Wan-Video/Wan-Animate-2',\n tags: ['Wan Animate 2', 'character animation', 'driving video', 'FP8'],\n outputNote: 'Verified hosted result · exact reference, driving clip, settings, and output',\n },\n {\n slug: 'pocket-tts', template: 'pocket-tts', title: 'Pocket TTS', eyebrow: 'Text + voice → speech',\n description: 'Fast 100M-parameter speech synthesis with 26 voices across six languages and optional authorized voice cloning from a sample.',\n hardware: 'RTX 3090', output: 'MP3, Opus, or WAV', kind: 'speech',\n input: { text: 'Kia ora. Your scale-to-zero voice model is ready.', voice: 'alba', format: 'mp3' },\n source: 'https://github.com/lee101/pocket-tts-cog', upstream: 'https://github.com/kyutai-labs/pocket-tts',\n tags: ['TTS', 'multilingual', 'voice cloning'], outputNote: 'Streaming audio output',\n },\n {\n slug: 'appnz-tts', template: 'appnz-tts', title: 'app.nz TTS', eyebrow: 'Text + reference → expressive speech',\n description: 'Fish Speech synthesis with stored or inline reference voices, reusable model cache, and serverless-to-warm-pod promotion.',\n hardware: 'RTX 3090', output: 'MP3, Opus, or WAV', kind: 'speech',\n input: { input: \"Hi, let's think through the best things in the world.\", voice: 'studio-narrator', response_format: 'mp3', speed: 1 },\n source: 'https://github.com/lee101/app-site/tree/master/replicatecog/appnz-tts', upstream: 'https://github.com/fishaudio/fish-speech',\n tags: ['Fish Speech', 'reference voice', 'serverless'], outputNote: 'Expressive audio output',\n },\n {\n slug: 'minimax-h3', template: 'minimax-h3', title: 'MiniMax H3', eyebrow: 'Text → video + native audio',\n description: 'MiniMax H3 text-to-video with structured audiovisual prompts, GPU AV1 WebM delivery, R2/HF weight cache, and optional EasyCache operator sweeps in the open-source adapter.',\n hardware: 'RTX 5090', output: 'WebM AV1 + stereo audio', kind: 'video',\n input: {\n prompt: 'Macro product film in one continuous shot: a translucent glass hummingbird unfolds its wings above a dark reflective table, the camera makes a slow 30-degree arc, cool rim light refracts into spectral highlights, delicate crystalline wing chimes and a low room tone, no cuts, photorealistic.',\n aspect_ratio: '16:9', size: 'balanced', duration: 5, steps: 20, seed: 31001,\n structured_prompt: true, include_audio: true, output_codec: 'webm-av1', encode_quality: 26,\n },\n outputMedia: '/static/cogs/h3/glass-hummingbird-t2v.webm',\n source: 'https://github.com/lee101/h3-cog', upstream: 'https://huggingface.co/MiniMaxAI/MiniMax-H3',\n tags: ['MiniMax H3', 'native audio', 'AV1'], outputNote: 'glass-hummingbird T2V · 1184×672 · 5s · seed 31001',\n },\n {\n slug: 'minimax-h3-i2v', template: 'minimax-h3', title: 'MiniMax H3 I2V', eyebrow: 'Image + prompt → video',\n description: 'Animate a supplied first frame while preserving identity and layout. Uses the same minimax-h3 template with first_frame conditioning and native stereo audio.',\n hardware: 'RTX 5090', output: 'WebM AV1 + stereo audio', kind: 'video',\n input: {\n prompt: 'One continuous shoulder-height tracking shot alongside the tram as it begins to move through gentle night rain; reflections stretch across wet pavement, passengers shift naturally behind the windows, soft wheel rumble, rain ticks and a distant crossing bell, preserve the tram design and faces.',\n aspect_ratio: '16:9', size: 'balanced', duration: 5, steps: 20, seed: 31002,\n structured_prompt: true, include_audio: true, output_codec: 'webm-av1',\n first_frame: '/static/cogs/h3/tram-rain-i2v-first.png',\n },\n inputImage: '/static/cogs/h3/tram-rain-i2v-first.png',\n source: 'https://github.com/lee101/h3-cog', upstream: 'https://huggingface.co/MiniMaxAI/MiniMax-H3',\n tags: ['MiniMax H3', 'image-to-video', 'keyframes'], outputNote: 'tram-rain I2V · first frame in static/cogs/h3',\n },\n {\n slug: 'minimax-h3-talk', template: 'minimax-h3', title: 'MiniMax H3 Talk', eyebrow: 'Portrait + uploaded audio → talking video',\n description: 'Drive mouth timing and delivery from an uploaded speech clip via H3 Ref2VA. Upload a face (first_frame) plus 2–15s of talking audio; duration snaps to the clip.',\n hardware: 'RTX 5090', output: 'WebM AV1 + stereo audio', kind: 'video',\n input: {\n prompt: 'Medium close-up of the person in the reference portrait speaking warmly to camera; natural head motion, soft studio key light, shallow depth of field, mouth and expression follow the uploaded speech exactly.',\n aspect_ratio: '9:16', size: 'balanced', duration: 5, steps: 20, seed: 31008,\n structured_prompt: true, include_audio: true, output_codec: 'webm-av1',\n first_frame: '/static/cogs/h3/talking-portrait.png',\n audio: '/static/cogs/h3/talking-hello.wav',\n },\n inputImage: '/static/cogs/h3/talking-portrait.png',\n inputAudio: '/static/cogs/h3/talking-hello.wav',\n source: 'https://github.com/lee101/h3-cog', upstream: 'https://huggingface.co/MiniMaxAI/MiniMax-H3',\n tags: ['MiniMax H3', 'audio-driven', 'Ref2VA', 'talking'], outputNote: 'Upload audio + portrait · Ref2VA mouth sync',\n },\n {\n slug: 'yue2', template: 'yue2', title: 'YuE2 Song', eyebrow: 'Lyrics + style → full song',\n description: 'Turn tagged lyrics and a style prompt into a 48kHz stereo song: YuE2 plans melody and chords, sings with bf16 AR + flow-matching NAR under CUDA graphs, and decodes through a tiled VAE. Scale-to-zero RunPod serverless.',\n hardware: 'RTX 4090 24GB', output: 'MP3, WAV, or FLAC', kind: 'music',\n input: {\n style: 'English, upbeat synth-pop, bright male voice, punchy synth bass, neon pads, driving beat, 116 BPM',\n lyrics: '[Verse]\\nCity lights are calling out my name\\nMidnight streets all look the same\\n[Chorus]\\nWe are electric, we are gold\\nStories that will never get old',\n cot: 'full', seed: 831002, ode_steps: 32, semantic_max_tokens: 3000, format: 'mp3',\n },\n outputMedia: '/static/cogs/yue2/synthpop.mp3',\n source: 'https://github.com/lee101/yue-cog', upstream: 'https://github.com/multimodal-art-projection/YuE',\n tags: ['YuE2', 'lyrics-to-song', 'music', 'serverless'],\n outputNote: 'Verified local result · 60.9s stereo MP3 from the exact input (seed 831002) · pop-piano + folk variants in /static/cogs/yue2',\n },\n];\n\nexport const cogShowcaseBySlug = Object.fromEntries(\n cogShowcases.flatMap((showcase) => [showcase.slug, ...(showcase.aliases || [])].map((slug) => [slug, showcase])),\n) as Record<string, CogShowcase>;\n\nexport const cogShowcaseByTemplate = Object.fromEntries(\n [...cogShowcases].reverse().map((showcase) => [showcase.template, showcase]),\n) as Record<string, CogShowcase>;\n// reverse so the first listed showcase for a shared template wins (minimax-h3 over -i2v/-talk)\n\nexport const cogShowcasePaths = cogShowcases.map((showcase) => `/cogs/${showcase.slug}`);\n","import { platformRouteByPath, platformRoutes } from './platformRoutes';\nimport { docEndpointBySlug, docEndpoints } from './docsData';\nimport { useCases, useCaseMeta } from './ai/useCasesData';\nimport { alternativeBySlug, alternatives } from './alternativesData';\nimport { libraryPromptBySlug, libraryPrompts } from './PromptLibraryPage';\nimport promptLibraryJSON from '../server/seed/prompt_library.json';\nimport { toolBySlug, toolSlugs } from './tools/toolsRegistry';\nimport { spaceMeta, spaces } from './spaces/spacesRegistry';\nimport { stripDesktopAppBasePath } from '../lib/desktopPath';\nimport { evalSourceBySlug, evalSources } from './evals/evalData';\nimport blogPosts from './blog/blogMetadata.json';\nimport { cogShowcaseBySlug, cogShowcasePaths } from './cogs/cogShowcaseData';\n\nexport const HOME_PAGE_META = {\n title: 'app.nz | AI Agent Cloud for Coding Agents, Deploy, Models',\n description:\n 'Run coding agents on your repos, deploy AI apps and APIs, and route every major model through one OpenAI-compatible gateway. The AI agent cloud.',\n};\n\nconst STATIC_PAGE_META: Record<string, { title: string; description: string }> = {\n '/feed': {\n title: 'Creation feed — AI models, datasets, code and tutorials | app.nz',\n description: 'Follow AI builders and discover searchable models, datasets, coding artifacts, visual science tutorials, research and generated art on app.nz.',\n },\n '/mail': {\n title: 'Mail — a fast agentic inbox and transactional email studio | app.nz',\n description: 'Manage personal and connected inboxes, search with exact and Gobed semantic ranking, automate mail with agents, and design transactional email on app.nz.',\n },\n '/apps': {\n title: 'Apps built on app.nz — games, tools, and community projects',\n description: 'Discover games, creative tools, education products, and developer apps built or showcased on app.nz. Deploy once and join the gallery automatically.',\n },\n '/games/neon-relay': {\n title: 'Neon Relay — free browser arcade game | app.nz',\n description: 'Play Neon Relay free in your browser: dodge signal blocks, build your score, and race your personal best.',\n },\n '/games/orbit-words': {\n title: 'Orbit Words — free browser word game | app.nz',\n description: 'Connect letter planets into words and build a high-scoring constellation in this free app.nz browser puzzle.',\n },\n '/games/reword': {\n title: 'reWord — play the V5Games word puzzle | app.nz',\n description: 'Rearrange letters, solve clues, and play the revived reWord puzzle free on app.nz.',\n },\n '/games/big-multiplayer-chess': {\n title: 'Big Multiplayer Chess — connected app.nz arcade',\n description: 'Play the original Big Multiplayer Chess MMO through the app.nz games marketplace.',\n },\n '/games/word-smashing': {\n title: 'Word Smashing — connected app.nz arcade',\n description: 'Play the V5Games Word Smashing challenge through the app.nz games marketplace.',\n },\n '/games/multiplication-master': {\n title: 'Multiplication Master — connected app.nz arcade',\n description: 'Play the educational Multiplication Master maths game through the app.nz games marketplace.',\n },\n '/games/signal-orchard': {\n title: 'Signal Orchard — rhythm story game | app.nz',\n description: 'Tune coloured radio pulses, grow a bioluminescent signal tree, and recover the last messages from a vanished island.',\n },\n '/games/cartographers-kitchen': {\n title: \"Cartographer's Kitchen — mapmaking cooking game | app.nz\",\n description: 'Combine magical ingredients to reveal roads, reshape a fogged map, and cook your way to the lighthouse market.',\n },\n '/games/museum-after-midnight': {\n title: 'Museum After Midnight — stealth detective game | app.nz',\n description: 'Rearrange a moonlit collection, build a trap from contradictory clues, and expose the museum thief before midnight.',\n },\n '/docs': {\n title: 'Documentation | app.nz',\n description:\n 'Documentation and HTTP API reference for cloud coding agents, the OpenAI-compatible model gateway, auth keys, and instant sites on app.nz.',\n },\n '/investors': {\n title: 'Investor Room — open-source data room | app.nz',\n description:\n 'The app.nz investor room, published in the open: the 10-year vision, a full technical deep dive, security posture, and economics — every claim linked to a live product surface.',\n },\n '/investors/vision': {\n title: 'The 10-Year Vision | app.nz Investor Room',\n description:\n 'Why app.nz should exist and why the opportunity is large: the agent cloud, auto-optimizing infrastructure, self-organizing software, and run-forever agents — the decade plan, in public.',\n },\n '/investors/deep-dive': {\n title: 'Technical Deep Dive | app.nz Investor Room',\n description:\n 'Architecture, ~1 ms learned model routing, GPU placement across serverless and hosted pods on any provider, security, unit economics, benchmarks methodology, roadmap, and risks.',\n },\n '/addons': {\n title: 'Hosted Addons — databases, GPU search, auth, monitoring | app.nz',\n description:\n 'Attach managed services to any app or agent in one command: gobed GPU vector search, PostgreSQL with pgvector HNSW + PostGIS, Mongo, memcache, auth, and AI monitoring — env vars injected into every runtime.',\n },\n '/addons/gobed': {\n title: 'gobed — GPU vector search addon with CAGRA indexes | app.nz',\n description:\n 'Our flagship search engine as a service: int8 static embeddings (15 MB model, ~150K embeds/sec), flat/IVF/HNSW on CPU and cuVS CAGRA graph search on GPU, behind three HTTP endpoints and one env var.',\n },\n '/addons/postgres': {\n title: 'Hosted PostgreSQL — HNSW vectors, PostGIS, graph traversal | app.nz',\n description:\n 'Managed Postgres with pgvector and PostGIS enabled by default, recursive-CTE graph traversal, and hybrid retrieval APIs — attached to your app and agents as DATABASE_URL in one command.',\n },\n '/products/papers': {\n title: 'Papers — semantic search over 725K ML papers and their code | app.nz',\n description:\n 'A papers-with-code search engine in one Go binary: free gobed semantic search over 725K papers, 613K code links, a live arXiv crawler, embedded PDF reader, and figure-aware social cards at app.nz/papers.',\n },\n '/rl': {\n title: 'Hosted RL — train reinforcement learning policies on cloud GPUs | app.nz',\n description:\n 'Pick a gymnasium, Atari, MuJoCo, LLM-RLHF, or robotics environment plus a PPO/DQN/GRPO baseline repo, train on per-second billed GPUs with live metrics, and deploy the trained policy as a scale-to-zero cog or serverless endpoint.',\n },\n '/enterprise': {\n title: 'Enterprise — teams, RBAC, audit logs, spend limits | app.nz',\n description:\n 'Run app.nz with your team: organizations with roles and invites, audit logs, per-user spend limits, API key management, and a straight-talking roadmap for SAML SSO, SCIM, private networking, and SOC 2.',\n },\n '/security': {\n title: 'Security and trust — encryption, isolation, subprocessors | app.nz',\n description:\n 'How app.nz protects your data: encryption in transit and at rest, hashed key storage, container and VM isolation, vulnerability reporting with safe harbor, data deletion, and the full subprocessor list.',\n },\n '/settings': {\n title: 'Settings | app.nz',\n description:\n 'Manage your profile, workspace members and roles, notifications, privacy controls, spend limit, and default GPU region.',\n },\n '/group-chat': {\n title: 'AI Group Chats — multi-character rooms | app.nz',\n description: 'Create a shared room with multiple AI characters, send one prompt, and get distinct responses that build on the same conversation.',\n },\n '/social': {\n title: 'Social scheduler — queue posts across networks | app.nz',\n description:\n 'Compose once and schedule to X, LinkedIn, Reddit, Bluesky, and Mastodon; the desktop browser agent posts on time and saves screenshot proof.',\n },\n '/skills/market': {\n title: 'Skills marketplace — installable MCP servers and prompt packs | app.nz',\n description:\n 'Browse and search MCP servers and prompt packs, get ready-to-paste config snippets, or one-click install to the app.nz desktop agent.',\n },\n '/agent': {\n title: 'Cloud coding agents | app.nz',\n description: platformRouteByPath['/agents'].description,\n },\n '/cli': {\n title: 'CLI — agents, deploys, and models from your terminal | app.nz',\n description:\n 'Install one small binary to run cloud coding agents, deploy apps and static sites to <name>.app.nz, stream chat from 100+ models, manage repos and CI, and script every endpoint. Watch a real recorded session build and ship a game.',\n },\n '/browser-agent': {\n title: 'Browser Agent — an in-browser coding agent | app.nz',\n description:\n 'A coding agent that runs entirely in your browser tab: a tool-calling loop over the app.nz gateway that runs Python in Pyodide and searches the web, repos, and papers — with one-click escalation to a full cloud agent for real repos and shells.',\n },\n '/schedulers': {\n title: 'Agent schedulers — recurring autonomous work | app.nz',\n description: 'Schedule recurring coding-agent and automation runs, inspect run history, and manage cron-driven work from the app.nz cloud, CLI, and desktop app.',\n },\n '/agents-sdk': {\n title: 'Agents SDK — build tool-using agents | app.nz',\n description: 'Build and run tool-using agents against app.nz models and cloud workers with streaming output, durable tasks, and the same APIs used by the CLI and desktop app.',\n },\n '/auto-agents': {\n title: 'Auto agents — event-driven software automation | app.nz',\n description: 'Create autonomous agents that react to repository, deployment, and monitoring events, then inspect every run, tool call, artifact, and result.',\n },\n '/monitors': {\n title: 'Site and service monitoring | app.nz',\n description: 'Monitor websites, APIs, Git repositories, and hosted models with uptime checks, incident history, and agent-assisted remediation from app.nz.',\n },\n '/video-extension': {\n title: 'AI video extension tool | app.nz',\n description: 'Extend a video forward or backward with generative AI, preview the result in the browser, and use the same workflow through the app.nz media API.',\n },\n '/text-to-image': {\n title: 'Text-to-image generator and API | app.nz',\n description: 'Generate images from prompts with leading image models, compare output and pricing, and copy OpenAI-compatible app.nz API examples.',\n },\n '/textures': {\n title: 'Verified seamless texture library and generator | app.nz',\n description: 'Search and generate objectively verified tileable textures with Z-Image, exact procedural synthesis, 2×2 seam proofs, background-priority inference, and cyclic similarity search.',\n },\n '/image-to-3d': {\n title: 'Image-to-3D generator | app.nz',\n description: 'Turn a reference image into a textured 3D model, preview the result in the browser, and download a production-ready GLB through app.nz.',\n },\n '/text-to-3d': {\n title: 'Text-to-3D generator | app.nz',\n description: 'Describe a prop or object, generate a textured 3D asset, inspect it in an interactive viewer, and download the GLB through app.nz.',\n },\n '/playground': {\n title: 'AI model playground | app.nz',\n description: 'Try and compare app.nz model routes in the browser, tune inputs, inspect outputs, and move working requests into production with one API.',\n },\n '/spaces/creator-lab': {\n title: '3D Creator Lab — generate and edit game assets | app.nz',\n description: 'Generate, inspect, edit, and export 3D game assets in one browser workspace with app.nz models, procedural tools, and downloadable GLB output.',\n },\n '/spaces/blender-lab': {\n title: 'Blender Agent Lab — automate 3D scenes | app.nz',\n description: 'Use an AI agent and reproducible Blender recipes to create, modify, render, and export 3D scenes through the app.nz desktop and cloud toolchain.',\n },\n '/spaces/unreal-lab': {\n title: 'Unreal Agent Lab — build game worlds | app.nz',\n description: 'Plan and automate Unreal Engine scenes, assets, materials, and gameplay tasks with app.nz agents, desktop tools, and reproducible project recipes.',\n },\n '/props': {\n title: 'Props Studio — text to 3D game props | app.nz',\n description:\n 'Generate 3D game props from text: prompt to reference image to textured GLB via pixal3d image-to-3D. Build a library of weapons, shields, hats, hair, and costumes ready to equip on VRM characters.',\n },\n '/vrm-editor': {\n title: 'VRM Character Editor — blend animations, equip props | app.nz',\n description:\n 'Load a VRM avatar, blend walk, run, wave, and attack animations, attach AI-generated props to hands, head, and back, swap hair and tint costumes — all in the browser.',\n },\n '/worlds': {\n title: 'AI Panorama & 3D World Studio | app.nz',\n description:\n 'Turn one image into a seamless 360 panorama or spatial world, preview it in an interactive WebGL viewer, and visit it with a Netwrck VRM companion.',\n },\n '/3d-packing': {\n title: '3D Packing Agent — will it fit? AI bin packing in 3D | app.nz',\n description:\n 'Plan loads for vans, trailers, containers, and storage units with AI-estimated item sizes, 3D bin-packing, interactive layouts, and practical loading guidance.',\n },\n '/skills': {\n title: 'Agent skills — searchable skill library | app.nz',\n description: platformRouteByPath['/skills'].description,\n },\n '/mcp-servers': {\n title: 'MCP Server Directory — searchable index of Model Context Protocol servers | app.nz',\n description:\n 'Search 120+ MCP servers for Claude, Codex, and any agent — GitHub, Gmail, fal, Canva, Hugging Face, Stripe, Notion, and more. Filter by category and pricing, with links to every provider.',\n },\n '/integrations': {\n title: 'Integrations — chat with cloud coding agents from Slack, Jira, GitHub and more | app.nz',\n description:\n 'Connect Slack, Microsoft Teams, Jira, Linear, Notion, GitHub, GitLab, Azure DevOps, Bitbucket, JetBrains, Xcode, deeplinks, and SDKs to app.nz cloud coding agents and meta-agent launch flows.',\n },\n '/datasets': {\n title: 'Dataset Studio — chat to a dataset, get charts | app.nz',\n description:\n 'Hosted datasets, charted in plain English. Open one, preview the rows, and ask for any chart — a built-in data analyst agent writes the query and returns an interactive Plotly figure.',\n },\n '/notebooks': {\n title: 'Notebooks — marimo in your browser or on cloud GPUs | app.nz',\n description:\n 'Hosted marimo notebooks: run Python free in your browser on Pyodide, or spin up a per-minute CPU/GPU machine that auto-stops when idle. Load app.nz datasets directly and fork Kaggle-style examples.',\n },\n '/search': {\n title: 'Fast web search — live, indexed, and agentic | app.nz',\n description:\n 'Search the live web and a compact gobed-ranked page index, open cached readable pages, or hand the query to a search agent.',\n },\n '/search/web': { title: 'Live web search | app.nz', description: 'Fast Google-style live web results through app.nz search providers.' },\n '/search/index': { title: 'Compact indexed web search | app.nz', description: 'Search disk-efficient snippets from the WebFiddle cache, reranked by gobed and linked to readable cached pages.' },\n '/search/agent': { title: 'Web search agent | app.nz', description: 'Run a generic search agent across the compact index and live web with deduplicated sources.' },\n '/deep-research': { title: 'Deep Research — cited multi-source reports | app.nz', description: 'Plan, search the live web, compact index and papers, read cached pages, verify sources, and produce a cited report.' },\n '/papers': {\n title: 'Papers — semantic research search | app.nz',\n description: 'Search papers, methods, datasets, citations, and linked GitHub code free in the app.nz Papers workspace.',\n },\n '/draw': {\n title: 'Draw — whiteboard for diagrams and sketches | app.nz',\n description:\n 'A free Excalidraw whiteboard: sketch diagrams, wireframes and ideas, save drawings to your library, share them by link or with your team, and export PNGs.',\n },\n '/diffusion': {\n title: 'Diffusion canvas — infinite AI image canvas | app.nz',\n description:\n 'An infinite canvas for diffusion models: generate images into 512 or 1024 frames, expand edges with outpainting, rerender any region with a prompt, and animate tiles into video.',\n },\n '/livedraw': {\n title: 'Live Draw — sketch to AI render in real time | app.nz',\n description:\n 'Draw with pressure-sensitive pen dynamics and watch a fast diffusion model rerender your sketch live. Drive it with a prompt, an image, or both.',\n },\n '/sheets': {\n title: 'Sheets — AI spreadsheet and forecasting | app.nz',\n description:\n 'Edit spreadsheets in the browser with formulas, rich charts, XLSX and CSV import/export, an AI sheet agent, and Chronos-2 time-series forecasting.',\n },\n '/audio': {\n title: 'Audio editor — record, trim, and export in the browser | app.nz',\n description:\n 'A free browser audio editor: upload or record, edit the waveform with trim, fade, gain, normalize and reverse, then export WAV or save to your library.',\n },\n '/image': {\n title: 'Image editor — layers, brushes, and adjustments | app.nz',\n description:\n 'A free Photopea-style browser image editor: layers with blend modes, crop, brush, text and shapes, color adjustments, and PNG/JPEG/WebP export.',\n },\n '/slides': {\n title: 'Slides — browser presentation editor with PPTX export | app.nz',\n description:\n 'Build presentations in the browser: drag-and-drop slide canvas, templates and themes, present mode, autosave to your library, and PowerPoint (.pptx) export.',\n },\n '/vector': {\n title: 'Vector editor — SVG shapes, pen tool, and layers | app.nz',\n description:\n 'A free browser SVG editor: draw shapes and bezier paths, edit fills and strokes, manage layers and groups, then export clean SVG or PNG.',\n },\n '/artifacts': {\n title: 'Library — your drawings, PDFs and generated content | app.nz',\n description:\n 'Everything you generate on app.nz in one library: whiteboard drawings, markdown-generated PDFs and saved images, private by default with link and team sharing.',\n },\n '/dashboards': {\n title: 'Dashboards — native dataset dashboards | app.nz',\n description:\n 'Build native app.nz dashboards over uploaded datasets with tables, charts, metrics, markdown panels, and reusable dataframe-style transform steps.',\n },\n '/repos': {\n title: 'Repository Hub | app.nz',\n description: 'Host repositories, branches, commits, issues, and pull requests for app.nz agents and deploys.',\n },\n '/models': {\n title: 'Model directory | app.nz',\n description:\n 'Browse every model routable through the app.nz OpenAI-compatible gateway — pricing, context windows, capabilities, and usage. One API key, automatic failover.',\n },\n '/evals': {\n title: 'AI Model Evals — benchmarks to working inference | app.nz',\n description:\n 'Use Artificial Analysis, Arena, LiveBench, SWE-bench, and open leaderboards to shortlist AI models, then run hosted gateway models or tested ComfyUI GPU workflows.',\n },\n '/cogs': {\n title: 'Cog Studio — GPU model hosting | app.nz',\n description: 'Deploy any Cog container as a scale-to-zero GPU endpoint on app.nz with published usage-based pricing and an auto-generated UI.',\n },\n '/cogs/examples': {\n title: 'Open Cog examples — verified input/output recipes | app.nz',\n description: 'Browse canonical Cog showcases with default inputs, hardware tiers, and side-by-side outputs. Deploy the same template through HTTP, CLI, desktop, or MCP.',\n },\n '/training': {\n title: 'Training — hosted fine-tuning | app.nz',\n description:\n 'Fine-tune open text, image, video, and time-series models with LoRA or full training on per-second billed GPUs, then deploy to a dedicated endpoint.',\n },\n '/comfy': {\n title: 'Comfy Studio — ComfyUI workflow hosting | app.nz',\n description: 'Deploy ComfyUI API-format workflows as scale-to-zero GPU endpoints with model mirroring, generated inputs, and warm-pod editor access.',\n },\n '/media-optimizer': {\n title: 'Media Optimizer — dynamic images and AV1 video | app.nz',\n description:\n 'Cloudflare-style dynamic image resizing, responsive WebP/AVIF/JPEG variants, and AV1-first video ladders backed by app.nz artifacts, R2 storage, CLI, API, and Cog hosting.',\n },\n '/image-cdn': {\n title: 'Image CDN — dynamic resizing on app.nz',\n description:\n 'Serve best-size images from artifact IDs with automatic AVIF/WebP/JPEG negotiation and private artifact access controls on app.nz.',\n },\n '/builds': {\n title: 'Build Studio — container CI + private registry | app.nz',\n description: 'Build container images on app.nz\\'s own builder fleet and push them to your private registry. No third-party registry auth, nothing public.',\n },\n '/ci': {\n title: 'CI Control Room — provider-compatible pipelines | app.nz',\n description:\n 'Create GitHub Actions, Buildkite, CircleCI, and GitLab CI compatible pipeline definitions, trigger runs, and inspect CI stages and logs on app.nz.',\n },\n '/spaces': {\n title: 'Model Spaces — image, video, 3D & audio playgrounds | app.nz',\n description:\n 'Browse hosted model spaces for text-to-image, video generation, image-to-3D, editing, and sound effects, each with a playground and OpenAI-compatible API.',\n },\n '/spaces/fast-vfx': {\n title: 'FastVFX Cog Space — video in, video out | app.nz',\n description: 'A real lee101/fastvfx Cog hosted on app.nz: send in a video, run a GPU Cog endpoint, and get a processed video back.',\n },\n '/spaces/media-services': {\n title: 'Media Services — transcription and video encoding APIs | app.nz',\n description: 'Transcribe audio and re-encode video through app.nz GPU Cog hosting, including AV1/WebM output backed by R2 CDN storage.',\n },\n '/spaces/splat': {\n title: 'Splat Capture — photos to gaussian splat | app.nz',\n description:\n 'Turn 2-64 photos into a gaussian splat with an in-browser viewer, plus point cloud and textured GLB mesh exports. Pose-free VGGT + gsplat pipeline, flat per-capture pricing.',\n },\n '/spaces/fast-video': {\n title: 'Fast Video — accelerated LTX-2.3 image-to-video | app.nz',\n description:\n 'LTX-2.3 22B distilled 8-step FP8 video generation: text or image to video with native audio, up to 4K and 20 seconds, billed per second of output video.',\n },\n '/spaces/sam-mask-adjust': {\n title: 'SAM Mask Adjustment Cog Space | app.nz',\n description:\n 'A self-hosted SAM2 Cog space for selecting objects on the first video frame and applying color, blur, and sharpness edits to the mask or background.',\n },\n '/spaces/audio-to-audio': {\n title: 'Audio to Audio — live voice conversation with Audex-2B | app.nz',\n description:\n 'Talk to NVIDIA Nemotron-Labs-Audex-2B in the browser: live waveforms for your mic and the AI character, powered by an open-source speech-to-speech cog you can deploy to app.nz in one click.',\n },\n '/login': {\n title: 'Sign in | app.nz',\n description: 'Sign in to run coding agents, deploy apps, manage API keys, and use the model gateway on app.nz.',\n },\n '/signup': {\n title: 'Create account | app.nz',\n description: 'Create a free app.nz account to run cloud coding agents, deploy AI apps, and route models from one place.',\n },\n '/account': {\n title: 'Account | app.nz',\n description: 'Manage credits, API keys, projects, and usage for your app.nz AI agent cloud account.',\n },\n '/api-keys': {\n title: 'API keys | app.nz',\n description: 'Manage app.nz bearer keys, provider API keys, GLM API keys, and connected ChatGPT Max plans.',\n },\n '/visualbench': {\n title: 'VisualBench | app.nz',\n description:\n 'Visual regression screenshots for coding agents: capture, compare, and self-correct UI before merge on app.nz.',\n },\n '/studio': {\n title: 'Video Studio — timeline editor + render | app.nz',\n description:\n 'A full video editor in the browser: Canva-style stage, multi-track timeline, draggable clips, text and shapes, realtime playback, and one-click WebM/MP4 render on app.nz.',\n },\n '/3d-editor': {\n title: '3D Studio — AI 3D editor | app.nz',\n description:\n 'A full 3D editor in the browser: generate models from text or images with AI credits, then simplify, smooth, voxelize, warp, paint, relight and export GLB/OBJ/STL on app.nz.',\n },\n '/3d-models': {\n title: '3D Model Library — Search Thousands of Community GLBs | app.nz',\n description: 'Browse and search community GLBs and CC0 Smithsonian Open Access scans, preview them in 3D, download from R2, or open any asset in the app.nz 3D editor.',\n },\n '/animflow': {\n title: 'AnimFlow — AI animation studio with git versioning | app.nz',\n description:\n 'A browser animation studio: layers, keyframe timeline, tweens and onion skinning, AI-generated motion and image layers, git-backed version history, and WebM/sprite-sheet export.',\n },\n '/animation-library': {\n title: 'Open 3D Motion, VFX & Terrain Library | app.nz',\n description:\n 'Search and preview open character motion, YOLO/MediaPipe/BodyPose3D pose capture, configurable Three.js VFX, terrain recipes, and procedural object generators.',\n },\n '/manim': {\n title: 'Manim Agent — animated math explainers from a prompt | app.nz',\n description: 'Chat with a talking AI guide, generate and edit Manim Python scenes, validate in browser WASM, render video natively, and search a public gallery by its original prompts.',\n },\n '/vfx-library': {\n title: 'Open VFX Gallery — Fire, Water, Smoke & Weather | app.nz',\n description: 'Search, preview, configure, and download source-linked Three.js VFX recipes for fire, water, smoke, impacts, energy, and weather.',\n },\n '/animation-gallery': {\n title: 'Open Character Motion & Camera Animation Gallery | app.nz',\n description: 'Search retargetable BVH and VRMA character motion plus configurable procedural camera animation.',\n },\n '/3d-object-gallery': {\n title: 'Procedural 3D Object Gallery with OBJ Downloads | app.nz',\n description: 'Preview, search, and download deterministic rocks, trees, buildings, asteroids, recipes, and OBJ geometry.',\n },\n '/image-to-3d-gallery': {\n title: 'Image to 3D Object Gallery & Reconstruction API | app.nz',\n description: 'Compare reference images with live reconstructed meshes, then download recipes and OBJ assets or call the image-to-3D API.',\n },\n '/characters': {\n title: 'AI characters | app.nz',\n description: 'Browse, create, and chat with AI characters on app.nz using selectable models, voices, knowledge files, and persistent conversations.',\n },\n '/characters-3d': {\n title: '3D AI characters | app.nz',\n description: 'Browse live 3D AI characters and chat with voiced, animated avatars on app.nz.',\n },\n '/assistants': {\n title: 'AI assistants | app.nz',\n description:\n 'Chat with thousands of AI characters and assistants. Pick a model, auto-thinking, editable chats, voice calls, and voiced replies — all on app.nz.',\n },\n '/art': {\n title: 'AI art gallery | app.nz',\n description: 'Explore AI-generated art and characters on app.nz.',\n },\n '/music': {\n title: 'AI music and SFX library | app.nz',\n description: 'Generate music and sound effects, then search an indexed audio library of public and personal generations on app.nz.',\n },\n '/fusion': {\n title: 'Fusion — multi-model comparison | app.nz',\n description:\n 'Run a model panel through the app.nz gateway, compare cost and latency, and synthesize the strongest answer.',\n },\n '/admin': {\n title: 'Admin — cloud spend | app.nz',\n description: 'Owner-only dashboard estimating cloud cost per customer with credits, plans and usage.',\n },\n '/ai': {\n title: 'AI tools for every job — staging, headshots, voiceovers & more | app.nz',\n description:\n 'A directory of job-specific AI tools: virtual staging, product photos, headshots, photo restoration, art styles, logos, voiceovers, music, SFX and video — run them with credits or call them as APIs.',\n },\n '/tools': {\n title: 'AI tools for builders | app.nz',\n description:\n 'Free and AI-powered tools: prompt optimizer, bulk evals (LLM-as-a-judge), model comparison, domain availability, token & cost estimator, and more — billed from one credit balance.',\n },\n '/gpu-clocker': {\n title: 'GPU Clock & Power Curve Calculator | app.nz',\n description:\n 'Interactively compare RTX 3090, 4090, 5090, L40S, A100 and H100 clock, power, throughput, temperature and perf-per-watt curves; then test your own sustained AI workload.',\n },\n '/blog': {\n title: 'Blog — models, evals & building with AI | app.nz',\n description:\n 'Hands-on model comparisons, pricing breakdowns, and the eval-driven workflow we use to pick models and tune prompts on app.nz.',\n },\n '/alternatives': {\n title: 'Alternatives to cloud hosts and AI agent clouds | app.nz',\n description:\n 'Compare app.nz with Vercel, Netlify, Cloudflare, AWS, OpenRouter, RunPod, Cursor, Devin, Codex Infinity, and other cloud hosting, model, and AI agent platforms.',\n },\n '/prompts': {\n title: 'AI Prompt Library for Agents, Code, Image & Video | app.nz',\n description:\n 'Copy and run maintained prompts for coding agents, research, software, images, video, audio, positioning, and growth through the app.nz AI agent cloud.',\n },\n '/analytics': {\n title: 'Analytics | app.nz',\n description:\n 'GA-style analytics for every site hosted on app.nz — auto-instrumented, cookieless pageviews, custom events, referrers, devices, and Core Web Vitals, with an API and CLI.',\n },\n '/terms': {\n title: 'Terms of Service | app.nz',\n description: 'The terms that govern use of app.nz — the AI agent cloud by App AI NZ Ltd.',\n },\n '/privacy': {\n title: 'Privacy Policy | app.nz',\n description: 'How app.nz collects, uses, and protects your data, under the NZ Privacy Act 2020 and GDPR.',\n },\n '/providers': {\n title: 'Become a model provider | app.nz',\n description:\n 'List your models on the app.nz gateway: OpenAI-compatible routing, metered billing handled by us, and distribution across agents, assistants, and tools. Requirements and how to apply.',\n },\n '/time-series-forecasting': {\n title: 'Time-series forecasting — Chronos-2 playground | app.nz',\n description:\n 'Forecast any time series in your browser with Chronos-2: paste a column of numbers, predict up to 1024 steps ahead with calibrated confidence bands. Zero-shot, 8192-step context, ~$0.002 per forecast.',\n },\n};\n\n// Humanize a slug like \"best-coding-models-2026\" → \"Best Coding Models 2026\".\nfunction humanizeSlug(slug: string): string {\n return slug\n .replace(/[-_]+/g, ' ')\n .replace(/\\b\\w/g, (c) => c.toUpperCase())\n .trim();\n}\n\n// Common URLs people type or that other sites/links use, mapped to the canonical\n// route. Keeps /signin, /register, /sign-up, etc. from falling through to a blank\n// 404 (the reported \"/signin failing\"). Consumed by both routing (App.tsx) and\n// metaForPath so an alias still gets the right <title>.\nexport const ROUTE_ALIASES: Record<string, string> = {\n '/3d-library': '/3d-models',\n '/models-3d': '/3d-models',\n '/addons/postgresql': '/addons/postgres',\n '/addon': '/addons',\n '/signin': '/login',\n '/sign-in': '/login',\n '/log-in': '/login',\n '/logon': '/login',\n '/register': '/signup',\n '/sign-up': '/signup',\n '/create-account': '/signup',\n '/join': '/signup',\n '/forgot': '/forgot-password',\n '/reset': '/reset-password',\n '/whiteboard': '/draw',\n '/canvas': '/diffusion',\n '/live-draw': '/livedraw',\n '/packing': '/3d-packing',\n '/agents': '/agent',\n '/mcp': '/mcp-servers',\n '/video': '/studio',\n '/group-chats': '/group-chat',\n '/groups': '/group-chat',\n '/goals': '/agent',\n '/goal': '/agent',\n '/spreadsheet': '/sheets',\n '/audio-editor': '/audio',\n '/image-editor': '/image',\n '/photo': '/image',\n '/presentation': '/slides',\n '/svg-editor': '/vector',\n '/animation': '/animflow',\n '/manim-agent': '/manim',\n '/3d-characters': '/characters-3d',\n '/library': '/artifacts',\n '/tos': '/terms',\n '/privacy-policy': '/privacy',\n '/providers/apply': '/providers',\n};\n\n// canonicalPath resolves an alias (with any trailing slash) to its canonical\n// route, strips the desktop /app mount prefix, or returns the normalized path\n// unchanged.\nexport function canonicalPath(pathname: string): string {\n const path = stripDesktopAppBasePath(pathname).replace(/\\/$/, '') || '/';\n return ROUTE_ALIASES[path] || path;\n}\n\nexport function metaForPath(pathname: string): { title: string; description: string } {\n const path = canonicalPath(pathname);\n if (path === '/') return HOME_PAGE_META;\n if (STATIC_PAGE_META[path]) return STATIC_PAGE_META[path];\n if (path.startsWith('/cogs/')) {\n const showcase = cogShowcaseBySlug[path.slice('/cogs/'.length).split('/')[0]];\n if (showcase) return {\n title: `${showcase.title} Cog — input, output, API | app.nz`,\n description: `${showcase.description} See the canonical input and ${showcase.output} output, then run the same recipe through HTTP, CLI, desktop, or MCP.`,\n };\n }\n if (path.startsWith('/papers/')) return {\n title: 'Research paper | app.nz Papers',\n description: STATIC_PAGE_META['/papers'].description,\n };\n if (path.startsWith('/evals/')) {\n const slug = path.slice('/evals/'.length).split('/')[0];\n const source = evalSourceBySlug[slug];\n if (source) return {\n title: `${source.name} eval guide — run benchmarked models | app.nz`,\n description: `${source.description} Follow the evidence into hosted inference, ComfyUI workflows, and workload-specific evals on app.nz.`,\n };\n }\n // Per-endpoint API reference pages: /docs/{slug}.\n if (path.startsWith('/docs/')) {\n const slug = path.slice('/docs/'.length).split('/')[0];\n const e = docEndpointBySlug(slug);\n if (e) {\n return {\n title: `${e.method} ${e.path} — ${e.sectionTitle} | app.nz API`,\n description: `${e.summary}. ${e.method} ${e.path} on the app.nz AI agent cloud — authenticated HTTP API reference with request examples.`,\n };\n }\n }\n // /assistants/:slug deep links share the assistants page meta.\n if (path.startsWith('/assistants/')) return STATIC_PAGE_META['/assistants'];\n if (path.startsWith('/characters-3d/')) return STATIC_PAGE_META['/characters-3d'];\n // /spaces/:slug — registry-driven model spaces (custom spaces hit the exact\n // STATIC_PAGE_META entries above before reaching here).\n if (path.startsWith('/spaces/')) {\n const m = spaceMeta(path.slice('/spaces/'.length).split('/')[0]);\n if (m) return m;\n }\n // Catalog detail routes carry unique, content-derived metadata.\n // /ai/:slug use-case landing pages carry unique catalog-driven meta.\n if (path.startsWith('/ai/')) {\n const slug = path.slice('/ai/'.length).split('/')[0];\n return useCaseMeta(slug) ?? STATIC_PAGE_META['/ai'];\n }\n if (path.startsWith('/tools/')) {\n const slug = path.slice('/tools/'.length).split('/')[0];\n const tool = toolBySlug[slug];\n if (tool) {\n return {\n title: `${tool.title} — ${tool.category} tool | app.nz`,\n description: tool.description,\n };\n }\n return { title: `${humanizeSlug(slug)} — Tools | app.nz`, description: STATIC_PAGE_META['/tools'].description };\n }\n if (path.startsWith('/blog/')) {\n const slug = path.slice('/blog/'.length).split('/')[0];\n const post = blogPosts.find((item) => item.slug === slug);\n if (post) return { title: `${post.title} | app.nz Blog`, description: post.description };\n return { title: `${humanizeSlug(slug)} | app.nz Blog`, description: STATIC_PAGE_META['/blog'].description };\n }\n if (path.startsWith('/alternatives/')) {\n const slug = path.slice('/alternatives/'.length).split('/')[0];\n const alt = alternativeBySlug[slug];\n if (alt) {\n return {\n title: alt.title,\n description: alt.excerpt,\n };\n }\n return { title: `${humanizeSlug(slug)} Alternative | app.nz`, description: STATIC_PAGE_META['/alternatives'].description };\n }\n if (path.startsWith('/prompts/category/')) {\n const slug = path.slice('/prompts/category/'.length).split('/')[0];\n const category = promptLibraryJSON.categories.find((item) => item.slug === slug);\n if (category) return { title: `${category.name} Prompts | app.nz`, description: category.description };\n }\n if (path.startsWith('/prompts/type/')) {\n const slug = path.slice('/prompts/type/'.length).split('/')[0];\n const label = slug === 'audio' ? 'Audio' : slug === 'video' ? 'Video' : slug === 'image' ? 'Image' : 'Text';\n return { title: `${label} Prompts | app.nz`, description: `Copy-ready ${label.toLowerCase()} prompts tuned for app.nz model routes and generation spaces.` };\n }\n if (path.startsWith('/prompts/')) {\n const slug = path.slice('/prompts/'.length).split('/')[0];\n const prompt = libraryPromptBySlug[slug];\n if (prompt) return { title: `${prompt.title} Prompt | app.nz`, description: prompt.summary };\n }\n\n const route = platformRouteByPath[path];\n if (route) {\n return {\n title: `${route.label} | app.nz`,\n description: route.description,\n };\n }\n\n return HOME_PAGE_META;\n}\n\n// Interactive routes render client-only (they read auth, window, and live data),\n// so prerendering them would risk hydration mismatches. Everything else is static\n// marketing content that benefits from per-route prerendered HTML for SEO.\nconst CLIENT_ONLY_PATHS = new Set<string>([\n '/agent',\n '/browser-agent',\n '/3d-packing',\n '/search',\n '/search/web',\n '/search/index',\n '/search/agent',\n '/deep-research',\n '/skills',\n '/datasets',\n '/notebooks',\n '/dashboards',\n '/draw',\n '/diffusion',\n '/livedraw',\n '/sheets',\n '/artifacts',\n '/repos',\n '/cogs',\n '/training',\n '/comfy',\n '/spaces/splat',\n '/spaces/fast-video',\n '/builds',\n '/sites',\n '/visualbench',\n '/characters',\n '/characters-3d',\n '/assistants',\n '/group-chat',\n '/art',\n '/time-series-forecasting',\n '/account',\n '/api-keys',\n '/login',\n '/signup',\n '/forgot-password',\n '/reset-password',\n '/admin',\n]);\n\n// prerenderPaths is the list of routes baked to their own dist/<path>/index.html\n// with per-route <title>/<meta>. The homepage plus every static marketing route.\nexport function prerenderPaths(): string[] {\n const paths = ['/', '/apps', '/games/neon-relay', '/games/orbit-words', '/games/reword', '/games/big-multiplayer-chess', '/games/word-smashing', '/games/multiplication-master', '/games/signal-orchard', '/games/cartographers-kitchen', '/games/museum-after-midnight', '/docs', '/evals', ...evalSources.map((source) => `/evals/${source.slug}`), '/investors', '/investors/vision', '/investors/deep-dive', '/addons', '/addons/gobed', '/addons/postgres', '/products/papers', '/rl', '/enterprise', '/security'];\n for (const route of platformRoutes) {\n // Canonicalize so a route registered under an alias (e.g. /agents → /agent)\n // still matches the client-only exclusion list.\n if (!CLIENT_ONLY_PATHS.has(canonicalPath(route.path)) && !CLIENT_ONLY_PATHS.has(route.path) && !paths.includes(route.path)) {\n paths.push(route.path);\n }\n }\n // Per-endpoint API reference pages — static content, baked for SEO + sitemap.\n for (const e of docEndpoints) {\n paths.push(`/docs/${e.slug}`);\n }\n // AI use-case landing pages — the /ai directory plus one page per use case.\n paths.push('/ai');\n for (const u of useCases) {\n paths.push(`/ai/${u.slug}`);\n }\n // Comparison landing pages for cloud hosts, model infrastructure, and AI agents.\n paths.push('/alternatives');\n for (const alt of alternatives) {\n paths.push(`/alternatives/${alt.slug}`);\n }\n paths.push('/prompts');\n for (const category of promptLibraryJSON.categories) paths.push(`/prompts/category/${category.slug}`);\n for (const type of ['text', 'image', 'video', 'audio']) paths.push(`/prompts/type/${type}`);\n for (const prompt of libraryPrompts) paths.push(`/prompts/${prompt.slug}`);\n // Blog pages are static editorial content. Streaming SSR resolves their lazy\n // chunks before writing HTML, so crawlers receive the real article and H1.\n paths.push('/blog');\n for (const post of blogPosts) paths.push(`/blog/${post.slug}`);\n paths.push('/mcp-servers');\n paths.push('/cogs/examples');\n paths.push(...cogShowcasePaths);\n return paths;\n}\n\nexport function indexableShellPaths(): string[] {\n return [\n // Public product surfaces which need crawlable canonical shells even when\n // their live-data/browser dependencies make full SSR inappropriate.\n '/integrations', '/tools', '/gpu-clocker', '/papers', '/characters', '/characters-3d', '/art',\n '/search', '/search/web', '/search/index', '/search/agent', '/deep-research',\n '/repos', '/skills', '/skills/market', '/datasets', '/notebooks', '/dashboards',\n '/cogs', '/builds', '/ci', '/visualbench', '/schedulers', '/browser-agent',\n '/agents-sdk', '/social', '/auto-agents', '/monitors', '/analytics', '/training', '/comfy',\n '/worlds', '/animation-library', '/animation-gallery', '/vfx-library', '/3d-models',\n '/3d-object-gallery', '/image-to-3d-gallery', '/animflow', '/music',\n '/3d-editor', '/diffusion', '/livedraw', '/audio', '/image', '/slides', '/vector',\n '/spaces/creator-lab', '/spaces/blender-lab', '/spaces/unreal-lab',\n '/video-extension', '/text-to-image', '/image-to-3d', '/text-to-3d',\n '/media-optimizer', '/time-series-forecasting', '/playground', '/fusion',\n '/terms', '/privacy', '/providers',\n ...toolSlugs.map((slug) => `/tools/${slug}`),\n ];\n}\n\n// spaceIndexablePaths lists every /spaces route (index, registry spaces, and the\n// hand-built custom spaces) for prerendered shells + the sitemap.\nexport function spaceIndexablePaths(): string[] {\n return [\n '/spaces',\n ...spaces.map((s) => `/spaces/${s.slug}`),\n '/spaces/fast-vfx',\n '/spaces/media-services',\n '/spaces/sam-mask-adjust',\n '/spaces/audio-to-audio',\n '/spaces/abot-world',\n '/spaces/ardy',\n '/spaces/splat',\n '/spaces/fast-video',\n ];\n}\n\n\n// isPrerenderedPath reports whether the client can safely hydrate a prerendered\n// route. The marketplace and arcade are intentionally lazy interactive\n// boundaries: their server stream and client chunk resolution do not produce\n// the same Suspense markers, so keep their complete HTML for crawlers but use a\n// clean client mount to avoid React #418 and duplicated event trees.\nexport function isPrerenderedPath(pathname: string): boolean {\n const path = pathname.replace(/\\/$/, '') || '/';\n if (path === '/apps' || path.startsWith('/games/')) return false;\n return prerenderPaths().includes(path);\n}\n","import { useEffect } from 'react';\n\nexport function usePageMeta(title: string, description?: string): void {\n useEffect(() => {\n const previousTitle = document.title;\n document.title = title;\n\n const meta = document.querySelector('meta[name=\"description\"]');\n const previousDescription = meta?.getAttribute('content') ?? null;\n if (description && meta) {\n meta.setAttribute('content', description);\n }\n\n return () => {\n document.title = previousTitle;\n if (meta && previousDescription !== null) {\n meta.setAttribute('content', previousDescription);\n }\n };\n }, [title, description]);\n}\n","import React, { useEffect, useState } from 'react';\nimport { ArrowRight, LogIn, Menu, Plus, Search, User, UserPlus, X } from 'lucide-react';\nimport { platformRoutes } from './platformRoutes';\n\n// openPalette opens the global command palette from a click by synthesising the\n// Cmd/Ctrl+K hotkey the palette already listens for.\nfunction openPalette() {\n window.dispatchEvent(new KeyboardEvent('keydown', { key: 'k', metaKey: true }));\n}\n\ninterface MeResponse {\n authenticated: boolean;\n user?: { id: string; email: string };\n}\n\ninterface BalanceResponse {\n success: boolean;\n balance?: { total: number };\n}\n\nconst formatCredits = (credits: number) => credits.toLocaleString();\n\nexport const SiteNav: React.FC = () => {\n const [me, setMe] = useState<MeResponse | null>(null);\n const [credits, setCredits] = useState<number | null>(null);\n const [menuOpen, setMenuOpen] = useState(false);\n\n useEffect(() => {\n let cancelled = false;\n\n async function loadAccount() {\n try {\n const meResponse = await fetch('/api/me').then((response) => response.json());\n if (cancelled) return;\n setMe(meResponse);\n\n if (meResponse?.authenticated) {\n const balanceResponse: BalanceResponse = await fetch('/api/credits/balance').then((response) => response.json());\n if (!cancelled && balanceResponse?.success) {\n setCredits(balanceResponse.balance?.total ?? 0);\n }\n }\n } catch {\n if (!cancelled) setMe({ authenticated: false });\n }\n }\n\n loadAccount();\n return () => {\n cancelled = true;\n };\n }, []);\n\n // Close the mobile menu on Escape, and lock body scroll while it is open.\n useEffect(() => {\n if (!menuOpen) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') setMenuOpen(false);\n };\n document.addEventListener('keydown', onKey);\n const prevOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n return () => {\n document.removeEventListener('keydown', onKey);\n document.body.style.overflow = prevOverflow;\n };\n }, [menuOpen]);\n\n const isAuthed = Boolean(me?.authenticated);\n const navItems = [\n { label: 'Apps', path: '/apps' },\n { label: 'Projects', path: '/projects' },\n { label: 'Repos', path: '/repos' },\n { label: 'Pulls', path: '/pulls' },\n { label: 'Agent', path: '/agent' },\n { label: 'Chat', path: '/chat' },\n { label: 'Integrations', path: '/integrations' },\n { label: 'Gateway', path: '/gateway' },\n { label: 'Models', path: '/models' },\n { label: 'Evals', path: '/evals' },\n { label: 'Tools', path: '/tools' },\n { label: 'Datasets', path: '/datasets' },\n { label: 'MCP', path: '/mcp-servers' },\n { label: 'Deploys', path: '/deploys' },\n { label: 'Pricing', path: '/pricing' },\n { label: 'Blog', path: '/blog' },\n { label: 'Docs', path: '/docs' },\n { label: 'Assistants', path: '/assistants' },\n { label: 'Characters', path: '/characters' },\n { label: 'Art', path: '/art' },\n { label: 'Music', path: '/music' },\n ].filter(\n (item) =>\n ['/apps', '/repos', '/pulls', '/tools', '/datasets', '/integrations', '/mcp-servers', '/blog', '/assistants', '/characters', '/art', '/music', '/models', '/evals'].includes(item.path) ||\n platformRoutes.some((route) => route.path === item.path),\n );\n\n return (\n <nav className=\"fixed top-0 z-50 w-full pointer-events-none\">\n <div className=\"flex h-16 w-full items-center justify-between gap-3 border-b border-white/10 bg-black/86 px-4 shadow-2xl shadow-black/30 backdrop-blur-md sm:px-6 lg:px-8 2xl:px-10\">\n <a href=\"/\" className=\"pointer-events-auto inline-flex min-w-0 items-center gap-2 font-display text-xl font-bold tracking-tight text-white\">\n <img\n src=\"/assets/app-logo-64.webp\"\n alt=\"app.nz\"\n className=\"h-8 w-8 object-contain\"\n width=\"64\"\n height=\"64\"\n decoding=\"async\"\n />\n <span className=\"truncate\">app</span>\n </a>\n\n <button\n type=\"button\"\n onClick={openPalette}\n className=\"pointer-events-auto hidden h-9 items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 text-sm text-white/55 transition-colors hover:bg-white/10 hover:text-white lg:inline-flex\"\n aria-label=\"Search (press / or Cmd+K)\"\n >\n <Search size={15} />\n <span>Search</span>\n <kbd className=\"rounded bg-white/10 px-1.5 py-0.5 text-[10px] text-white/40\">/</kbd>\n </button>\n\n <div className=\"pointer-events-auto hidden min-w-0 items-center gap-4 overflow-x-auto whitespace-nowrap text-sm font-medium text-white/58 lg:flex [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\">\n {navItems.map((item) => (\n <a key={item.path} href={item.path} className=\"shrink-0 transition-colors hover:text-white\">\n {item.label}\n </a>\n ))}\n </div>\n\n <div className=\"pointer-events-auto flex shrink-0 items-center gap-2\">\n {isAuthed ? (\n <>\n <a\n href=\"/account#topup\"\n className=\"hidden h-9 items-center gap-2 rounded-lg border border-white/10 bg-white/[0.06] px-3 text-sm font-semibold text-white transition-colors hover:bg-white hover:text-black sm:inline-flex sm:px-4\"\n aria-label=\"Top up account credits\"\n >\n <span>{credits === null ? 'Credits' : `${formatCredits(credits)} credits`}</span>\n <Plus size={16} />\n </a>\n <a\n href=\"/account\"\n className=\"inline-flex h-9 w-9 items-center justify-center rounded-full bg-white text-sm font-bold uppercase text-black ring-1 ring-white/20 transition-transform hover:scale-105\"\n aria-label=\"Account\"\n title={me?.user?.email || 'Account'}\n >\n {me?.user?.email ? me.user.email[0].toUpperCase() : <User size={16} />}\n </a>\n </>\n ) : (\n <>\n <a\n href=\"/login\"\n aria-label=\"Sign in\"\n className=\"inline-flex h-9 items-center gap-2 whitespace-nowrap rounded-lg border border-white/10 bg-white/[0.06] px-3 text-sm font-semibold text-white transition-colors hover:bg-white hover:text-black sm:px-4\"\n >\n <LogIn size={16} />\n <span className=\"hidden sm:inline\">Sign in</span>\n </a>\n <a\n href=\"/signup\"\n className=\"hidden h-9 items-center gap-2 whitespace-nowrap rounded-lg bg-sky-400 px-3 text-sm font-bold text-black transition-colors hover:bg-sky-300 sm:inline-flex sm:px-4\"\n >\n <UserPlus size={16} className=\"sm:hidden\" />\n <span>Start building</span>\n <ArrowRight size={15} />\n </a>\n </>\n )}\n\n <button\n type=\"button\"\n onClick={() => setMenuOpen((open) => !open)}\n className=\"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-white/10 bg-white/[0.06] text-white transition-colors hover:bg-white hover:text-black lg:hidden\"\n aria-label={menuOpen ? 'Close menu' : 'Open menu'}\n aria-expanded={menuOpen}\n aria-controls=\"site-nav-mobile\"\n >\n {menuOpen ? <X size={18} /> : <Menu size={18} />}\n </button>\n </div>\n </div>\n\n {menuOpen ? (\n <>\n <button\n type=\"button\"\n aria-label=\"Close menu\"\n onClick={() => setMenuOpen(false)}\n className=\"pointer-events-auto fixed inset-0 z-40 cursor-default bg-black/40 backdrop-blur-sm lg:hidden\"\n />\n <div\n id=\"site-nav-mobile\"\n className=\"pointer-events-auto absolute left-3 right-3 top-16 z-50 max-h-[calc(100vh-5rem)] overflow-y-auto rounded-xl border border-white/10 bg-black/92 p-2 shadow-2xl shadow-black/50 backdrop-blur-md sm:left-5 sm:right-5 lg:hidden\"\n >\n <div className=\"grid grid-cols-2 gap-1\">\n {navItems.map((item) => (\n <a\n key={item.path}\n href={item.path}\n onClick={() => setMenuOpen(false)}\n className=\"rounded-lg px-3 py-2.5 text-sm font-medium text-white/72 transition-colors hover:bg-white/[0.08] hover:text-white\"\n >\n {item.label}\n </a>\n ))}\n </div>\n\n <div className=\"mt-2 border-t border-white/10 pt-2\">\n {isAuthed ? (\n <div className=\"grid gap-1\">\n <a\n href=\"/account#topup\"\n onClick={() => setMenuOpen(false)}\n className=\"flex items-center justify-between rounded-lg px-3 py-2.5 text-sm font-medium text-white/72 transition-colors hover:bg-white/[0.08] hover:text-white\"\n >\n <span>{credits === null ? 'Top up credits' : `${formatCredits(credits)} credits`}</span>\n <Plus size={16} />\n </a>\n <a\n href=\"/account\"\n onClick={() => setMenuOpen(false)}\n className=\"flex items-center gap-2 rounded-lg bg-white px-3 py-2.5 text-sm font-bold text-black transition-colors hover:bg-white/86\"\n >\n <User size={16} />\n <span>Account</span>\n </a>\n </div>\n ) : (\n <div className=\"grid gap-1\">\n <a\n href=\"/login\"\n onClick={() => setMenuOpen(false)}\n className=\"flex items-center gap-2 rounded-lg px-3 py-2.5 text-sm font-medium text-white/72 transition-colors hover:bg-white/[0.08] hover:text-white\"\n >\n <LogIn size={16} />\n <span>Sign in</span>\n </a>\n <a\n href=\"/signup\"\n onClick={() => setMenuOpen(false)}\n className=\"flex items-center justify-center gap-2 rounded-lg bg-sky-400 px-3 py-2.5 text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <span>Start building</span>\n <ArrowRight size={15} />\n </a>\n </div>\n )}\n </div>\n </div>\n </>\n ) : null}\n </nav>\n );\n};\n","import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { Box, Check, Code2, Copy, Database, Lock, RadioTower, Star } from 'lucide-react';\nimport clsx, { type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n// cx merges Tailwind classes (clsx + tailwind-merge) so later utilities win.\nexport const cx = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n\n// Shared types + presentational atoms for the additive git-platform pages that\n// live alongside RepoView (the repo browser): RepoHub (list), PullsInbox\n// (/pulls) and Profile (/u/:handle). Keeping them here means those surfaces\n// render repo cards, state badges and metrics identically.\n\nexport interface MeResponse {\n authenticated: boolean;\n user?: { id: string; email: string };\n handle?: string;\n}\n\nexport interface RepoCounts {\n openIssues: number;\n openPulls: number;\n branches: number;\n commits: number;\n}\n\nexport interface RepoSummary {\n id: string;\n fullName: string;\n owner: string;\n name: string;\n description: string;\n visibility: string;\n defaultBranch: string;\n counts: RepoCounts;\n updatedAt?: string;\n imageUrl?: string;\n ownerAvatar?: string;\n ownerHandle?: string;\n kind?: string;\n topics?: string[];\n homepage?: string;\n stars?: number;\n viewerHasStarred?: boolean;\n}\n\nexport interface RepoPull {\n number: number;\n title: string;\n sourceBranch: string;\n targetBranch: string;\n state: string;\n}\n\nexport interface InboxPull extends RepoPull {\n id: string;\n repoId: string;\n repoFullName: string;\n repoVisibility: string;\n updatedAt?: string;\n}\n\nexport interface ProfileApp {\n type: 'site' | 'model';\n name: string;\n slug?: string;\n url: string;\n status: string;\n hardware?: string;\n updatedAt?: string;\n}\n\nexport interface ProfileContributions {\n total: number;\n days: Record<string, number>;\n start: string;\n end: string;\n}\n\nexport interface ProfileData {\n handle: string;\n displayName?: string;\n avatar?: string;\n bio: string;\n joinedAt: string;\n isSelf: boolean;\n following: boolean;\n counts: { repos: number; apps?: number; posts?: number; followers: number; following: number };\n repos: RepoSummary[];\n apps?: ProfileApp[];\n contributions?: ProfileContributions;\n}\n\n// repoHref builds the pretty owner/name URL that RepoView routes on, so every\n// additive page links into the repo browser the same way.\nexport function repoHref(repo: { fullName: string }, view = ''): string {\n return view ? `/repos/${repo.fullName}/${view}` : `/repos/${repo.fullName}`;\n}\n\nexport type RepoCloneProtocol = 'https' | 'ssh';\n\nconst SAFE_REPO_FULL_NAME = /^[A-Za-z0-9._-]+\\/[A-Za-z0-9._-]+$/;\n\nfunction safeRepoFullName(fullName: string): string {\n const trimmed = fullName.trim();\n if (!SAFE_REPO_FULL_NAME.test(trimmed)) {\n return '';\n }\n return trimmed;\n}\n\nfunction cloneOrigin(origin?: string): string {\n return (origin || (typeof window !== 'undefined' ? window.location.origin : 'https://app.nz')).replace(/\\/$/, '');\n}\n\nfunction cloneHost(origin?: string): string {\n try {\n return new URL(cloneOrigin(origin)).host;\n } catch {\n return 'app.nz';\n }\n}\n\nexport function repoHTTPSCloneUrl(repo: { fullName: string }, origin?: string): string {\n const fullName = safeRepoFullName(repo.fullName);\n if (!fullName) return '';\n return `${cloneOrigin(origin)}/${fullName}.git`;\n}\n\nexport function repoSSHCloneUrl(repo: { fullName: string }, origin?: string): string {\n const fullName = safeRepoFullName(repo.fullName);\n if (!fullName) return '';\n return `ssh://git@${cloneHost(origin)}/${fullName}.git`;\n}\n\nexport function repoCloneUrl(repo: { fullName: string }, origin?: string, protocol: RepoCloneProtocol = 'https'): string {\n return protocol === 'ssh' ? repoSSHCloneUrl(repo, origin) : repoHTTPSCloneUrl(repo, origin);\n}\n\nexport function repoCloneCommand(repo: { fullName: string }, origin?: string, protocol: RepoCloneProtocol = 'https'): string {\n const url = repoCloneUrl(repo, origin, protocol);\n return url ? `git clone ${url}` : '';\n}\n\nexport function VisibilityIcon({ visibility, size = 14 }: { visibility: string; size?: number }) {\n return visibility === 'private' ? <Lock size={size} /> : <RadioTower size={size} />;\n}\n\n// Deterministic colour for the initial-letter fallback avatar.\nfunction avatarColor(seed: string): string {\n let h = 0;\n for (let i = 0; i < seed.length; i++) h = (h * 31 + seed.charCodeAt(i)) % 360;\n return `hsl(${h} 48% 42%)`;\n}\n\n// OwnerAvatar renders the owner's Gravatar when present, falling back to a\n// branded coloured initial when there's no image or the image 404s.\nexport function OwnerAvatar({ name, src, size = 22 }: { name: string; src?: string; size?: number }) {\n const [failed, setFailed] = React.useState(false);\n const seed = name || '?';\n if (src && !failed) {\n return (\n <img\n src={src}\n alt={name}\n width={size}\n height={size}\n loading=\"lazy\"\n onError={() => setFailed(true)}\n className=\"shrink-0 rounded-full object-cover ring-1 ring-white/15\"\n style={{ width: size, height: size }}\n />\n );\n }\n return (\n <span\n className=\"inline-flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/15\"\n style={{ width: size, height: size, background: avatarColor(seed), fontSize: size * 0.46 }}\n >\n {seed.trim().charAt(0).toUpperCase()}\n </span>\n );\n}\n\nconst STATE_STYLES: Record<string, string> = {\n open: 'border-emerald-500/40 bg-emerald-500/10 text-emerald-300',\n closed: 'border-red-500/40 bg-red-500/10 text-red-300',\n merged: 'border-violet-500/40 bg-violet-500/10 text-violet-300',\n draft: 'border-white/20 bg-white/[0.06] text-white/60',\n};\n\nexport function StateBadge({ state }: { state: string }) {\n const cls = STATE_STYLES[state] || STATE_STYLES.draft;\n return (\n <span className={`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold capitalize ${cls}`}>\n {state}\n </span>\n );\n}\n\nexport function Metric({ label, value }: { label: string; value: number | string }) {\n return (\n <div className=\"min-w-[68px] rounded-lg border border-white/10 bg-black px-3 py-2\">\n <div className=\"font-display text-lg font-bold\">{value}</div>\n <div className=\"text-[10px] uppercase tracking-[0.14em] text-white/34\">{label}</div>\n </div>\n );\n}\n\nexport function ListEmpty({ visible, children }: { visible: boolean; children: React.ReactNode }) {\n if (!visible) return null;\n return <p className=\"rounded-lg border border-dashed border-white/10 px-3 py-6 text-center text-sm text-white/34\">{children}</p>;\n}\n\nexport function Alert({ error, notice }: { error?: string; notice?: string }) {\n return (\n <>\n {error && <p className=\"mb-4 rounded-lg border border-red-900 bg-red-950/60 px-4 py-3 text-sm text-red-200\">{error}</p>}\n {notice && <p className=\"mb-4 rounded-lg border border-emerald-900 bg-emerald-950/60 px-4 py-3 text-sm text-emerald-100\">{notice}</p>}\n </>\n );\n}\n\ntype RepoContextAction = {\n left: number;\n top: number;\n copied?: RepoCloneProtocol;\n};\n\nfunction clampContextAction(clientX: number, clientY: number) {\n if (typeof window === 'undefined') return { left: clientX, top: clientY };\n const width = 244;\n const height = 104;\n const margin = 12;\n const maxLeft = Math.max(margin, window.innerWidth - width - margin);\n const maxTop = Math.max(margin, window.innerHeight - height - margin);\n return {\n left: Math.min(Math.max(clientX + 10, margin), maxLeft),\n top: Math.min(Math.max(clientY + 10, margin), maxTop),\n };\n}\n\nasync function copyText(text: string): Promise<boolean> {\n try {\n if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text);\n return true;\n }\n if (typeof document === 'undefined') return false;\n const textarea = document.createElement('textarea');\n textarea.value = text;\n textarea.setAttribute('readonly', '');\n textarea.style.position = 'fixed';\n textarea.style.left = '-9999px';\n document.body.appendChild(textarea);\n textarea.select();\n const copied = document.execCommand('copy');\n document.body.removeChild(textarea);\n return copied;\n } catch {\n return false;\n }\n}\n\n// RepoCard is the shared repo tile used by both the hub and profile pages.\n// kindMeta maps a repo kind to its badge label, icon, and accent classes so the\n// hub can distinguish code, Hugging Face datasets, and models at a glance.\nexport function kindMeta(kind?: string): { label: string; Icon: typeof Code2; cls: string } {\n switch (kind) {\n case 'dataset':\n return { label: 'Dataset', Icon: Database, cls: 'border-amber-400/30 bg-amber-400/10 text-amber-200' };\n case 'model':\n return { label: 'Model', Icon: Box, cls: 'border-violet-400/30 bg-violet-400/10 text-violet-200' };\n default:\n return { label: 'Code', Icon: Code2, cls: 'border-sky-400/30 bg-sky-400/10 text-sky-200' };\n }\n}\n\nexport function KindBadge({ kind, size = 11 }: { kind?: string; size?: number }) {\n if (!kind || kind === 'code') return null;\n const { label, Icon, cls } = kindMeta(kind);\n return (\n <span className={cx('inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide', cls)}>\n <Icon size={size} /> {label}\n </span>\n );\n}\n\nexport function RepoCard({ repo }: { repo: RepoSummary }) {\n const [contextAction, setContextAction] = React.useState<RepoContextAction | null>(null);\n const openTimer = React.useRef<number | null>(null);\n const closeTimer = React.useRef<number | null>(null);\n const httpsCommand = repoCloneCommand(repo);\n const sshCommand = repoCloneCommand(repo, undefined, 'ssh');\n\n React.useEffect(() => {\n if (!contextAction || typeof window === 'undefined') return;\n const close = () => setContextAction(null);\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') close();\n };\n window.addEventListener('pointerdown', close);\n window.addEventListener('resize', close);\n window.addEventListener('scroll', close, true);\n window.addEventListener('keydown', onKeyDown);\n if (closeTimer.current) window.clearTimeout(closeTimer.current);\n closeTimer.current = window.setTimeout(close, contextAction.copied ? 1800 : 8000);\n return () => {\n window.removeEventListener('pointerdown', close);\n window.removeEventListener('resize', close);\n window.removeEventListener('scroll', close, true);\n window.removeEventListener('keydown', onKeyDown);\n if (closeTimer.current) {\n window.clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n };\n }, [contextAction]);\n\n React.useEffect(() => {\n return () => {\n if (openTimer.current && typeof window !== 'undefined') window.clearTimeout(openTimer.current);\n };\n }, []);\n\n const onContextMenu = (event: React.MouseEvent<HTMLAnchorElement>) => {\n if (typeof window === 'undefined') return;\n const rect = event.currentTarget.getBoundingClientRect();\n const x = event.clientX || rect.left + 16;\n const y = event.clientY || rect.top + 16;\n const pos = clampContextAction(x, y);\n if (openTimer.current) window.clearTimeout(openTimer.current);\n openTimer.current = window.setTimeout(() => {\n setContextAction(pos);\n }, 0);\n };\n\n const cloneAction =\n contextAction && typeof document !== 'undefined'\n ? createPortal(\n <div\n className=\"fixed z-[1000] rounded-lg border border-white/15 bg-black/95 p-1 shadow-2xl shadow-black/50 backdrop-blur\"\n style={{ left: contextAction.left, top: contextAction.top }}\n role=\"menu\"\n aria-label={`${repo.fullName} repository actions`}\n onPointerDown={(event) => event.stopPropagation()}\n >\n {([\n ['https', 'Copy clone command', 'Copied clone command', httpsCommand],\n ['ssh', 'Copy SSH clone command', 'Copied SSH clone command', sshCommand],\n ] as const).map(([protocol, label, copiedLabel, command]) => (\n <button\n key={protocol}\n type=\"button\"\n className=\"flex h-11 min-w-[224px] items-center gap-3 rounded-md px-3 text-left text-sm font-semibold text-white/86 transition-colors hover:bg-white/10 focus:bg-white/10 focus:outline-none\"\n onClick={async (event) => {\n event.stopPropagation();\n const copied = await copyText(command);\n setContextAction((current) => (current ? { ...current, copied: copied ? protocol : undefined } : current));\n }}\n >\n {contextAction.copied === protocol ? <Check size={16} className=\"text-emerald-300\" /> : <Copy size={16} className=\"text-white/58\" />}\n <span>{contextAction.copied === protocol ? copiedLabel : label}</span>\n </button>\n ))}\n </div>,\n document.body,\n )\n : null;\n\n return (\n <>\n <a\n href={repoHref(repo)}\n data-testid={`repo-card-${repo.id}`}\n data-repo-full-name={repo.fullName}\n onContextMenu={onContextMenu}\n className=\"group flex min-w-0 flex-col overflow-hidden rounded-xl border border-white/10 bg-white/[0.035] transition-colors hover:border-white/30 hover:bg-white/[0.06]\"\n >\n {repo.imageUrl ? (\n <div className=\"aspect-[16/7] w-full overflow-hidden border-b border-white/10 bg-black\">\n <img\n src={repo.imageUrl}\n alt=\"\"\n loading=\"lazy\"\n className=\"h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.03]\"\n />\n </div>\n ) : null}\n <div className=\"min-w-0 p-4\">\n <div className=\"flex items-center gap-2 text-white/48\">\n <OwnerAvatar name={repo.owner} src={repo.ownerAvatar} size={20} />\n <span className=\"truncate font-mono text-xs text-white/56\">{repo.owner}</span>\n <VisibilityIcon visibility={repo.visibility} />\n <span className=\"ml-auto\"><KindBadge kind={repo.kind} /></span>\n </div>\n <h2 className=\"mt-1.5 truncate font-display text-lg font-bold text-white group-hover:underline\">{repo.name}</h2>\n <p className=\"mt-1 line-clamp-2 min-h-[2.5rem] break-words text-sm leading-6 text-white/52\">\n {repo.description || 'No description yet.'}\n </p>\n <div className=\"mt-3 flex flex-wrap items-center gap-4 text-xs text-white/46\">\n {repo.stars ? (\n <span className=\"inline-flex items-center gap-1 font-mono text-amber-200/80\"><Star size={12} /> {repo.stars}</span>\n ) : null}\n <span className=\"font-mono\">{repo.counts.openIssues} issues</span>\n <span className=\"font-mono\">{repo.counts.openPulls} PRs</span>\n <span className=\"font-mono\">{repo.counts.commits} commits</span>\n </div>\n </div>\n </a>\n {cloneAction}\n </>\n );\n}\n\n// Shared auth gate: returns a loading/redirect node, or null when the signed-in\n// user is ready and the page can render.\nexport function useRequireAuth(me: MeResponse | null, next: string): React.ReactNode | null {\n if (!me) {\n return (\n <section className=\"min-h-screen bg-black pt-28 text-white\">\n <div className=\"mx-auto max-w-[1800px] px-6 text-white/50\">Loading…</div>\n </section>\n );\n }\n if (!me.authenticated) {\n if (typeof window !== 'undefined') window.location.href = `/login?next=${encodeURIComponent(next)}`;\n return null;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Canonical design tokens for the platform \"cloud\" surfaces (agents, repos,\n// pulls, builds, cogs, sites, assistants). Everything is black + white with\n// colour reserved for status. Studios should compose from UI / StatusBadge\n// instead of hand-rolling slate/cyan classes so the whole app stays uniform.\n// ---------------------------------------------------------------------------\n\nexport const UI = {\n page: 'min-h-screen bg-black text-white',\n panel: 'rounded-xl border border-white/10 bg-white/[0.04]',\n panelHover: 'transition-colors hover:border-white/30 hover:bg-white/[0.06]',\n card: 'rounded-xl border border-white/10 bg-white/[0.035]',\n input:\n 'h-9 w-full rounded-lg border border-white/10 bg-black px-3 text-sm text-white outline-none placeholder:text-white/30 focus:border-white/40',\n textarea:\n 'w-full resize-y rounded-lg border border-white/10 bg-black px-3 py-2 text-sm text-white outline-none placeholder:text-white/30 focus:border-white/40',\n btn: 'inline-flex h-9 items-center justify-center gap-2 rounded-lg px-4 text-sm font-bold transition-colors disabled:opacity-60',\n btnPrimary: 'bg-sky-400 text-black hover:bg-sky-300',\n btnGhost: 'border border-white/10 bg-white/[0.06] text-white hover:bg-white/[0.1]',\n btnOutline: 'border border-white/15 text-white hover:border-white/40 hover:bg-white/[0.04]',\n label: 'text-[10px] font-bold uppercase tracking-[0.16em] text-white/40',\n heading: 'font-display font-bold tracking-tight',\n muted: 'text-white/56',\n faint: 'text-white/34',\n} as const;\n\n// One status vocabulary for every studio. Keys are normalised lowercase status\n// strings; synonyms are aliased so agent/build/cog/PR states share colours.\nconst STATUS_TONES: Record<string, string> = {\n // neutral / queued\n queued: 'border-white/15 bg-white/[0.06] text-white/70',\n pending: 'border-white/15 bg-white/[0.06] text-white/70',\n idle: 'border-white/15 bg-white/[0.06] text-white/70',\n draft: 'border-white/15 bg-white/[0.06] text-white/60',\n idea: 'border-white/15 bg-white/[0.06] text-white/60',\n todo: 'border-white/15 bg-white/[0.06] text-white/60',\n // in-flight (warm)\n provisioning: 'border-amber-500/30 bg-amber-500/12 text-amber-300',\n building: 'border-amber-500/30 bg-amber-500/12 text-amber-300',\n starting: 'border-amber-500/30 bg-amber-500/12 text-amber-300',\n processing: 'border-amber-500/30 bg-amber-500/12 text-amber-300',\n // running (active blue)\n running: 'border-sky-500/30 bg-sky-500/12 text-sky-300',\n in_progress: 'border-sky-500/30 bg-sky-500/12 text-sky-300',\n ci: 'border-sky-500/30 bg-sky-500/12 text-sky-300',\n // review\n review: 'border-amber-500/30 bg-amber-500/12 text-amber-300',\n pr_review: 'border-amber-500/30 bg-amber-500/12 text-amber-300',\n // success / open / cron\n open: 'border-emerald-500/30 bg-emerald-500/12 text-emerald-300',\n done: 'border-emerald-500/30 bg-emerald-500/12 text-emerald-300',\n succeeded: 'border-emerald-500/30 bg-emerald-500/12 text-emerald-300',\n ready: 'border-emerald-500/30 bg-emerald-500/12 text-emerald-300',\n pushed: 'border-emerald-500/30 bg-emerald-500/12 text-emerald-300',\n passed: 'border-emerald-500/30 bg-emerald-500/12 text-emerald-300',\n cron: 'border-emerald-500/30 bg-emerald-500/12 text-emerald-300',\n // merged (violet)\n merged: 'border-violet-500/30 bg-violet-500/12 text-violet-300',\n // failure\n failed: 'border-red-500/30 bg-red-500/12 text-red-300',\n error: 'border-red-500/30 bg-red-500/12 text-red-300',\n closed: 'border-red-500/30 bg-red-500/12 text-red-300',\n // stopped\n cancelled: 'border-white/12 bg-white/[0.04] text-white/45',\n canceled: 'border-white/12 bg-white/[0.04] text-white/45',\n skipped: 'border-white/12 bg-white/[0.04] text-white/45',\n};\n\nconst STATUS_NEUTRAL = 'border-white/15 bg-white/[0.06] text-white/60';\n\n// statusTone returns the capsule classes for a status string (case/space/dash\n// insensitive). Use when you need the raw classes; prefer StatusBadge for UI.\nexport function statusTone(status: string): string {\n const key = (status || '').toLowerCase().trim().replace(/[\\s-]+/g, '_');\n return STATUS_TONES[key] || STATUS_NEUTRAL;\n}\n\n// StatusBadge is the canonical status capsule used across every studio.\nexport function StatusBadge({\n status,\n label,\n className,\n}: {\n status: string;\n label?: string;\n className?: string;\n}) {\n return (\n <span\n className={cx(\n 'inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold capitalize',\n statusTone(status),\n className,\n )}\n >\n {(label ?? status).replace(/_/g, ' ')}\n </span>\n );\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\n// ---------------------------------------------------------------------------\n// Dictation (STT): server-side providers first, browser speech as last resort\n// ---------------------------------------------------------------------------\n//\n// Primary path records the mic (MediaRecorder) and POSTs the audio to the\n// /api/assistant/transcribe fallback chain (Groq → OpenAI → Gemini → …), which\n// is higher quality. The browser's Web Speech recognition is the WORST quality,\n// so it's only used when the server has no STT provider (a 501 latches the whole\n// session to browser mode) or where MediaRecorder isn't available. A transient\n// server failure (502/network) falls back to browser for that one utterance.\n//\n// Extracted from AssistantStudio so the agent composer shares the exact same\n// mic-to-text behaviour. Call toggle(currentText, setText) on a mic button.\n\ninterface SpeechRecognitionAlt {\n transcript: string;\n}\ninterface SpeechRecognitionResultLike {\n isFinal: boolean;\n 0: SpeechRecognitionAlt;\n}\ninterface SpeechRecognitionEventLike {\n resultIndex: number;\n results: { length: number; [i: number]: SpeechRecognitionResultLike };\n}\ninterface SpeechRecognitionLike {\n lang: string;\n continuous: boolean;\n interimResults: boolean;\n onresult: ((e: SpeechRecognitionEventLike) => void) | null;\n onend: (() => void) | null;\n onerror: ((e: unknown) => void) | null;\n start: () => void;\n stop: () => void;\n}\nfunction getRecognitionCtor(): (new () => SpeechRecognitionLike) | null {\n if (typeof window === 'undefined') return null;\n const w = window as unknown as {\n SpeechRecognition?: new () => SpeechRecognitionLike;\n webkitSpeechRecognition?: new () => SpeechRecognitionLike;\n };\n return w.SpeechRecognition || w.webkitSpeechRecognition || null;\n}\n\nexport type DictationState = 'idle' | 'recording' | 'transcribing';\n\n// Session-wide memory of whether the server can transcribe at all. Once we see a\n// 501 (\"no provider configured\") we stop recording-and-uploading and go straight\n// to browser speech — the documented last-resort path.\nlet serverSTT: 'unknown' | 'ok' | 'down' = 'unknown';\n\nfunction extractTranscript(payload: unknown): string {\n if (typeof payload === 'string') return payload.trim();\n if (!payload || typeof payload !== 'object') return '';\n const record = payload as Record<string, unknown>;\n for (const key of ['text', 'transcript', 'transcription', 'output']) {\n const text = extractTranscript(record[key]);\n if (text) return text;\n }\n return '';\n}\n\nfunction pickRecorderMime(): string {\n if (typeof MediaRecorder === 'undefined') return '';\n for (const m of ['audio/webm;codecs=opus', 'audio/webm', 'audio/mp4', 'audio/ogg']) {\n if (MediaRecorder.isTypeSupported?.(m)) return m;\n }\n return '';\n}\n\nexport interface VoiceInput {\n supported: boolean;\n state: DictationState;\n level: number;\n /** Start dictation. `base` is the current text; `onText` receives base+transcript. */\n start: (base: string, onText: (t: string) => void) => void;\n /** Stop the current dictation session and transcribe the captured audio. */\n stop: () => void;\n /** Start/stop dictation. `base` is the current text; `onText` receives base+transcript. */\n toggle: (base: string, onText: (t: string) => void) => void;\n}\n\nexport function useVoiceInput(): VoiceInput {\n const [state, setState] = useState<DictationState>('idle');\n const [level, setLevel] = useState(0);\n const browserSupported = useMemo(() => Boolean(getRecognitionCtor()), []);\n const mediaSupported = useMemo(\n () =>\n typeof navigator !== 'undefined' &&\n !!navigator.mediaDevices?.getUserMedia &&\n typeof MediaRecorder !== 'undefined',\n [],\n );\n const supported = mediaSupported || browserSupported;\n\n const onTextRef = useRef<(t: string) => void>(() => {});\n const baseRef = useRef('');\n const mrRef = useRef<MediaRecorder | null>(null);\n const streamRef = useRef<MediaStream | null>(null);\n const chunksRef = useRef<Blob[]>([]);\n const recRef = useRef<SpeechRecognitionLike | null>(null);\n const ctxRef = useRef<AudioContext | null>(null);\n const rafRef = useRef<number | null>(null);\n const silenceRef = useRef<number>(0);\n const sawSpeechRef = useRef(false);\n\n const teardownAudio = useCallback(() => {\n if (rafRef.current != null) cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n streamRef.current?.getTracks().forEach((t) => t.stop());\n streamRef.current = null;\n ctxRef.current?.close().catch(() => {});\n ctxRef.current = null;\n setLevel(0);\n }, []);\n\n // --- browser Web Speech recognition (last resort) ---\n const startBrowser = useCallback(() => {\n const Ctor = getRecognitionCtor();\n if (!Ctor) {\n setState('idle');\n return;\n }\n const rec = new Ctor();\n rec.lang = 'en-US';\n rec.continuous = true;\n rec.interimResults = true;\n let finalText = '';\n rec.onresult = (e) => {\n let interim = '';\n for (let i = e.resultIndex; i < e.results.length; i++) {\n const r = e.results[i];\n if (r.isFinal) finalText += r[0].transcript;\n else interim += r[0].transcript;\n }\n onTextRef.current(baseRef.current + (finalText + interim).replace(/\\s+/g, ' ').trimStart());\n };\n rec.onend = () => {\n setState('idle');\n recRef.current = null;\n };\n rec.onerror = () => setState('idle');\n recRef.current = rec;\n rec.start();\n setState('recording');\n }, []);\n\n // --- server transcription of a recorded blob ---\n const transcribeBlob = useCallback(\n async (blob: Blob) => {\n if (blob.size < 1024) {\n setState('idle');\n return;\n }\n setState('transcribing');\n try {\n const res = await fetch('/api/assistant/transcribe', {\n method: 'POST',\n headers: { 'Content-Type': blob.type || 'audio/webm' },\n credentials: 'same-origin',\n body: blob,\n });\n if (res.ok) {\n serverSTT = 'ok';\n const data = await res.json().catch(() => ({}));\n const text = extractTranscript(data);\n if (text) onTextRef.current(baseRef.current + text);\n setState('idle');\n return;\n }\n if (res.status === 501) serverSTT = 'down'; // no provider — latch to browser\n // Transient/no-provider failure: retry this utterance with browser speech.\n if (browserSupported) {\n startBrowser();\n return;\n }\n } catch {\n if (browserSupported) {\n startBrowser();\n return;\n }\n }\n setState('idle');\n },\n [browserSupported, startBrowser],\n );\n\n // --- mic recording with a simple level meter + silence auto-stop ---\n const startRecording = useCallback(async () => {\n let stream: MediaStream;\n try {\n stream = await navigator.mediaDevices.getUserMedia({\n audio: { echoCancellation: true, noiseSuppression: true, autoGainControl: true },\n });\n } catch {\n // Mic blocked — try browser recognition (it may prompt separately) else give up.\n if (browserSupported) startBrowser();\n else setState('idle');\n return;\n }\n streamRef.current = stream;\n const mime = pickRecorderMime();\n const mr = new MediaRecorder(stream, mime ? { mimeType: mime } : undefined);\n chunksRef.current = [];\n mr.ondataavailable = (e) => {\n if (e.data.size) chunksRef.current.push(e.data);\n };\n mr.onstop = () => {\n teardownAudio();\n const blob = new Blob(chunksRef.current, { type: mr.mimeType || 'audio/webm' });\n transcribeBlob(blob);\n };\n mrRef.current = mr;\n mr.start();\n setState('recording');\n\n // Level meter + silence detection (auto-stop ~2.5s after speech ends).\n try {\n const ctx = new AudioContext();\n if (ctx.state === 'suspended') {\n ctx.resume().catch(() => {});\n }\n ctxRef.current = ctx;\n const src = ctx.createMediaStreamSource(stream);\n const analyser = ctx.createAnalyser();\n analyser.fftSize = 512;\n src.connect(analyser);\n const data = new Uint8Array(analyser.frequencyBinCount);\n sawSpeechRef.current = false;\n silenceRef.current = 0;\n let last = ctx.currentTime;\n const tick = () => {\n analyser.getByteTimeDomainData(data);\n let sum = 0;\n for (let i = 0; i < data.length; i++) {\n const v = (data[i] - 128) / 128;\n sum += v * v;\n }\n const rms = Math.sqrt(sum / data.length);\n setLevel(Math.min(1, rms * 12));\n const now = ctx.currentTime;\n const dt = now - last;\n last = now;\n if (rms > 0.015) {\n sawSpeechRef.current = true;\n silenceRef.current = 0;\n } else if (sawSpeechRef.current) {\n silenceRef.current += dt;\n if (silenceRef.current > 2.5 && mrRef.current?.state === 'recording') {\n mrRef.current.stop();\n mrRef.current = null;\n return;\n }\n }\n rafRef.current = requestAnimationFrame(tick);\n };\n rafRef.current = requestAnimationFrame(tick);\n } catch {\n /* no level meter — manual stop still works */\n }\n }, [browserSupported, startBrowser, teardownAudio, transcribeBlob]);\n\n const stop = useCallback(() => {\n if (recRef.current) {\n recRef.current.stop();\n return;\n }\n if (mrRef.current && mrRef.current.state === 'recording') {\n mrRef.current.stop();\n mrRef.current = null;\n }\n }, []);\n\n const start = useCallback(\n (base: string, onText: (t: string) => void) => {\n baseRef.current = base ? base.replace(/\\s+$/, '') + ' ' : '';\n onTextRef.current = onText;\n if (mediaSupported && serverSTT !== 'down') startRecording();\n else if (browserSupported) startBrowser();\n },\n [mediaSupported, browserSupported, startRecording, startBrowser],\n );\n\n const toggle = useCallback(\n (base: string, onText: (t: string) => void) => {\n if (state !== 'idle') {\n stop();\n return;\n }\n start(base, onText);\n },\n [state, stop, start],\n );\n\n useEffect(\n () => () => {\n recRef.current?.stop();\n if (mrRef.current?.state === 'recording') mrRef.current.stop();\n teardownAudio();\n },\n [teardownAudio],\n );\n\n return { supported, state, level, start, stop, toggle };\n}\n","import React, { useCallback, useEffect } from 'react';\nimport { Loader2, Mic, MicOff } from 'lucide-react';\nimport { createPortal } from 'react-dom';\nimport { cx } from './gitShared';\nimport { useVoiceInput } from './useVoiceInput';\n\ninterface VoiceDictationControlProps {\n value: string;\n onChange: (value: string) => void;\n disabled?: boolean;\n className?: string;\n buttonClassName?: string;\n ariaLabel?: string;\n}\n\nconst VoiceWaveform: React.FC<{ level: number; active: boolean }> = ({ level, active }) => {\n const bars = [0.28, 0.62, 0.42, 0.84, 0.5, 0.72, 0.34, 0.58, 0.46, 0.78, 0.38, 0.66];\n const boost = Math.max(0.2, level);\n return (\n <div className=\"flex h-14 items-center gap-1.5\" aria-hidden=\"true\">\n {bars.map((base, i) => (\n <span\n key={i}\n className={cx(\n 'block w-1.5 rounded-full bg-white/80',\n active && 'animate-pulse',\n )}\n style={{\n height: `${Math.round(12 + base * 34 + boost * 22)}px`,\n opacity: active ? 0.5 + base * 0.45 : 0.35,\n animationDelay: `${i * 70}ms`,\n }}\n />\n ))}\n </div>\n );\n};\n\nconst VoiceOverlay: React.FC<{ level: number; state: string; onStop: () => void }> = ({ level, state, onStop }) => {\n if (typeof document === 'undefined') return null;\n return createPortal(\n <div\n data-testid=\"voice-dictation-overlay\"\n className=\"pointer-events-none fixed inset-0 z-[260] flex items-end justify-center p-4 pb-[max(1rem,env(safe-area-inset-bottom))] sm:items-center sm:pb-4\"\n >\n <div className=\"pointer-events-auto flex min-w-0 max-w-[calc(100vw-2rem)] items-center gap-4 rounded-2xl border border-white/15 bg-black/35 px-5 py-3 text-white shadow-2xl shadow-black/45 backdrop-blur-md\">\n <VoiceWaveform level={level} active={state === 'recording'} />\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-white\">\n {state === 'transcribing' ? 'Transcribing' : 'Listening'}\n </p>\n <p className=\"truncate text-xs text-white/45\">Enter stops</p>\n </div>\n <button\n type=\"button\"\n onClick={onStop}\n className=\"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full border border-white/15 bg-white text-black transition-colors hover:bg-white/90\"\n aria-label=\"Stop dictation\"\n title=\"Stop dictation\"\n >\n <MicOff size={17} />\n </button>\n </div>\n </div>,\n document.body,\n );\n};\n\nexport const VoiceDictationControl: React.FC<VoiceDictationControlProps> = ({\n value,\n onChange,\n disabled,\n className,\n buttonClassName,\n ariaLabel = 'Dictate',\n}) => {\n const voice = useVoiceInput();\n const active = voice.state !== 'idle';\n\n const toggle = useCallback(() => {\n if (voice.state !== 'idle') {\n voice.stop();\n return;\n }\n voice.start(value, onChange);\n }, [voice, value, onChange]);\n\n useEffect(() => {\n if (!active) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;\n event.preventDefault();\n event.stopPropagation();\n voice.stop();\n };\n window.addEventListener('keydown', onKeyDown, { capture: true });\n return () => window.removeEventListener('keydown', onKeyDown, { capture: true });\n }, [active, voice]);\n\n if (!voice.supported) return null;\n\n return (\n <span className={cx('inline-flex shrink-0', className)}>\n <button\n data-testid=\"voice-dictation-button\"\n type=\"button\"\n onClick={toggle}\n disabled={disabled || voice.state === 'transcribing'}\n aria-label={voice.state === 'recording' ? 'Stop dictation' : ariaLabel}\n title={voice.state === 'recording' ? 'Stop dictation' : ariaLabel}\n className={cx(\n 'inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border transition-colors disabled:cursor-not-allowed disabled:opacity-45',\n voice.state === 'recording'\n ? 'border-rose-400/70 bg-rose-400/15 text-rose-100'\n : voice.state === 'transcribing'\n ? 'border-white/10 bg-black text-white/40'\n : 'border-white/10 bg-black text-white/65 hover:bg-white/[0.06] hover:text-white',\n buttonClassName,\n )}\n style={\n voice.state === 'recording'\n ? { boxShadow: `0 0 0 ${Math.round(2 + voice.level * 10)}px rgba(244,63,94,0.14)` }\n : undefined\n }\n >\n {voice.state === 'transcribing' ? <Loader2 size={17} className=\"animate-spin\" /> : <Mic size={17} />}\n </button>\n {active && <VoiceOverlay level={voice.level} state={voice.state} onStop={voice.stop} />}\n </span>\n );\n};\n\n","import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { ArrowRight, FileText, GitBranch, Search } from 'lucide-react';\nimport { OwnerAvatar, type RepoSummary } from './gitShared';\nimport { VoiceDictationControl } from './VoiceDictationControl';\n\n// CommandPalette is the app-wide keyboard launcher. It is mounted once (in\n// SiteNav) so `/`, `t`, and Cmd/Ctrl+K open it from anywhere. It searches your\n// repos, the showcase repos, and the top-level pages, then full-navigates on\n// Enter. Full-screen tools can mark their shell with [data-owns-keys] so local\n// keymaps own bare-letter shortcuts; Cmd/Ctrl+K remains the universal launcher.\n\ninterface PageEntry {\n type: 'page';\n label: string;\n href: string;\n keywords: string;\n}\n\ninterface RepoEntry {\n type: 'repo';\n label: string; // owner/name\n sub: string;\n href: string;\n avatar?: string;\n owner: string;\n}\n\ntype Entry = PageEntry | RepoEntry;\n\nconst PAGES: PageEntry[] = [\n { type: 'page', label: 'Repos', href: '/repos', keywords: 'repositories git source code browse' },\n { type: 'page', label: 'Search', href: '/search', keywords: 'web repos pages voice command palette' },\n { type: 'page', label: 'Pull requests', href: '/pulls', keywords: 'prs review merge inbox' },\n { type: 'page', label: 'Mail', href: '/mail', keywords: 'email inbox superhuman compose transactional designer agent filters' },\n { type: 'page', label: 'Projects', href: '/projects', keywords: 'workspace' },\n { type: 'page', label: 'Agent', href: '/agent', keywords: 'coding agent studio tasks goal' },\n { type: 'page', label: 'Integrations', href: '/integrations', keywords: 'slack teams jira linear notion github gitlab azure devops bitbucket jetbrains xcode deeplinks sdk cloud agent meta agent' },\n { type: 'page', label: 'RL training', href: '/rl', keywords: 'reinforcement learning ppo dqn grpo gymnasium atari mujoco rlhf policy gpu train' },\n { type: 'page', label: 'Enterprise', href: '/enterprise', keywords: 'teams rbac sso saml scim audit logs spend limits soc2' },\n { type: 'page', label: 'Settings', href: '/settings', keywords: 'profile workspace members roles invites privacy spend limit region audit' },\n { type: 'page', label: 'Social scheduler', href: '/social', keywords: 'posts schedule twitter x linkedin reddit bluesky mastodon calendar queue' },\n { type: 'page', label: 'Skills marketplace', href: '/skills/market', keywords: 'mcp servers prompt packs install desktop agent tools' },\n { type: 'page', label: 'Chat', href: '/chat', keywords: 'ai assistant research web search' },\n { type: 'page', label: 'Gateway', href: '/gateway', keywords: 'api models proxy playground' },\n { type: 'page', label: 'Worlds', href: '/worlds', keywords: 'panorama 360 vr environment hunyuan metahuman' },\n { type: 'page', label: 'Models', href: '/models', keywords: 'catalog pricing compare' },\n { type: 'page', label: 'Tools', href: '/tools', keywords: 'prompt optimizer evals compare' },\n { type: 'page', label: 'AI Use Cases', href: '/ai', keywords: 'staging headshot voiceover restore product photo sticker logo tattoo music sfx video directory' },\n { type: 'page', label: 'Deploys', href: '/deploys', keywords: 'builds ship release' },\n { type: 'page', label: 'Build Studio', href: '/builds', keywords: 'container image registry docker build' },\n { type: 'page', label: 'CI Control Room', href: '/ci', keywords: 'pipeline github actions buildkite circleci gitlab builds' },\n { type: 'page', label: 'Media Optimizer', href: '/media-optimizer', keywords: 'image cdn resize responsive av1 video reencode transform' },\n { type: 'page', label: 'Assistants', href: '/assistants', keywords: 'characters chat voice' },\n { type: 'page', label: 'Group Chats', href: '/group-chat', keywords: 'characters room multi ai conversation' },\n { type: 'page', label: 'Characters', href: '/characters', keywords: 'gallery roleplay' },\n { type: 'page', label: 'Art', href: '/art', keywords: 'image search gallery' },\n { type: 'page', label: 'Write', href: '/write', keywords: 'docs document editor rich text docx' },\n { type: 'page', label: 'Sheets', href: '/sheets', keywords: 'spreadsheet xlsx csv table' },\n { type: 'page', label: 'Draw', href: '/draw', keywords: 'whiteboard excalidraw diagram sketch' },\n { type: 'page', label: 'Diffusion Canvas', href: '/diffusion', keywords: 'image generate inpaint outpaint expand infinite canvas playground' },\n { type: 'page', label: 'Live Draw', href: '/livedraw', keywords: 'sketch render realtime krea img2img pen pressure' },\n { type: 'page', label: 'Music', href: '/music', keywords: 'audio sfx sound generate song' },\n { type: 'page', label: 'Audio editor', href: '/audio', keywords: 'waveform trim fade record wav mp3 podcast' },\n { type: 'page', label: 'Image editor', href: '/image', keywords: 'photo raster layers crop brush photopea' },\n { type: 'page', label: 'Slides', href: '/slides', keywords: 'presentation deck pptx powerpoint canva' },\n { type: 'page', label: 'Vector editor', href: '/vector', keywords: 'svg illustrator inkscape pen bezier shapes' },\n { type: 'page', label: 'Video studio', href: '/studio', keywords: 'video timeline edit render' },\n { type: 'page', label: '3D editor', href: '/3d', keywords: 'three model mesh glb obj' },\n { type: 'page', label: 'AnimFlow', href: '/animflow', keywords: 'animation keyframe timeline tween onion skin layers ai motion git webm sprite sheet' },\n { type: 'page', label: 'Manim Agent', href: '/manim', keywords: 'math explainer python animation video code tts character wasm gallery prompt' },\n { type: 'page', label: 'Creation Feed', href: '/feed', keywords: 'social creators tutorials code models datasets artifacts follow likes' },\n { type: 'page', label: 'Artifacts', href: '/artifacts', keywords: 'library files share' },\n { type: 'page', label: 'Pricing', href: '/pricing', keywords: 'credits cost plans' },\n { type: 'page', label: 'Blog', href: '/blog', keywords: 'posts writing' },\n { type: 'page', label: 'Investors', href: '/investors', keywords: 'investor room vision deep dive company fundraising' },\n { type: 'page', label: 'Addons', href: '/addons', keywords: 'postgres postgis pgvector gobed vector search database mongo memcache auth monitor hosted' },\n { type: 'page', label: 'Docs', href: '/docs', keywords: 'documentation help' },\n { type: 'page', label: 'Account', href: '/account', keywords: 'settings credits billing topup' },\n];\n\n// `g` then one of these navigates (GitHub-style chords). Listed in the `?` help.\nconst NAV_CHORDS: Array<{ key: string; label: string; href: string }> = [\n { key: 'h', label: 'Home', href: '/' },\n { key: 'r', label: 'Repos', href: '/repos' },\n { key: 'p', label: 'Pull requests', href: '/pulls' },\n { key: 'e', label: 'Mail', href: '/mail' },\n { key: 'a', label: 'Agent', href: '/agent' },\n { key: 'c', label: 'Chat', href: '/chat' },\n { key: 'i', label: 'Art (images)', href: '/art' },\n { key: 'w', label: 'Write (docs)', href: '/write' },\n { key: 's', label: 'Sheets', href: '/sheets' },\n { key: 'd', label: 'Draw', href: '/draw' },\n { key: 'm', label: 'Music', href: '/music' },\n { key: 'g', label: 'Gateway', href: '/gateway' },\n { key: 'l', label: 'Artifacts library', href: '/artifacts' },\n { key: 'u', label: 'Account / usage', href: '/account' },\n];\n\nconst CHORD_TIMEOUT_MS = 1500;\n\nconst KEY_OWNER_SELECTOR = '[data-owns-keys], [data-repo-shell]';\nconst KEY_OWNER_PATHS = new Set([\n '/studio', '/video', '/3d-editor', '/3d', '/3d-studio', '/animflow', '/animation',\n '/audio', '/audio-editor', '/image', '/image-editor', '/photo',\n '/slides', '/presentation', '/vector', '/svg-editor',\n]);\n\nfunction hasLocalBareKeyOwner(): boolean {\n if (document.querySelector(KEY_OWNER_SELECTOR)) return true;\n const path = window.location.pathname.replace(/\\/$/, '') || '/';\n return KEY_OWNER_PATHS.has(path) || path.startsWith('/repos/');\n}\n\nfunction score(text: string, q: string): number {\n if (!q) return 0;\n const t = text.toLowerCase();\n const query = q.toLowerCase();\n const idx = t.indexOf(query);\n if (idx >= 0) return 1000 - idx - t.length * 0.05; // substring: strong, prefer early/short\n // subsequence fallback\n let ti = 0;\n let hits = 0;\n for (let qi = 0; qi < query.length; qi++) {\n const at = t.indexOf(query[qi], ti);\n if (at < 0) return -Infinity;\n ti = at + 1;\n hits++;\n }\n return hits - t.length * 0.05;\n}\n\nexport const CommandPalette: React.FC = () => {\n const [open, setOpen] = useState(false);\n const [helpOpen, setHelpOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [active, setActive] = useState(0);\n const [repos, setRepos] = useState<RepoEntry[]>([]);\n const pendingChordAt = useRef(0);\n const loaded = useRef(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n\n const loadRepos = useCallback(async () => {\n if (loaded.current) return;\n loaded.current = true;\n const toEntry = (r: RepoSummary): RepoEntry => ({\n type: 'repo',\n label: r.fullName,\n sub: r.description || '',\n href: `/repos/${r.fullName}`,\n avatar: r.ownerAvatar,\n owner: r.owner,\n });\n const [mine, explore] = await Promise.all([\n fetch('/api/repos').then((r) => r.json()).catch(() => null),\n fetch('/api/repos/explore').then((r) => r.json()).catch(() => null),\n ]);\n const seen = new Set<string>();\n const out: RepoEntry[] = [];\n for (const body of [mine, explore]) {\n for (const r of (body?.repos || []) as RepoSummary[]) {\n if (seen.has(r.fullName)) continue;\n seen.add(r.fullName);\n out.push(toEntry(r));\n }\n }\n setRepos(out);\n }, []);\n\n const openPalette = useCallback(() => {\n setOpen(true);\n setQuery('');\n setActive(0);\n loadRepos();\n }, [loadRepos]);\n\n // Global hotkeys. Cmd/Ctrl+K everywhere; `/` and `t` everywhere except where\n // a mounted app shell declares ownership of bare-letter shortcuts.\n useEffect(() => {\n const isTyping = (el: EventTarget | null) => {\n const t = el as HTMLElement | null;\n return !!t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable);\n };\n const onKey = (e: KeyboardEvent) => {\n if ((e.metaKey || e.ctrlKey) && (e.key === 'k' || e.key === 'K')) {\n e.preventDefault();\n openPalette();\n return;\n }\n if (e.defaultPrevented || e.metaKey || e.ctrlKey || e.altKey) return;\n if (isTyping(e.target)) return;\n if (e.key === 'Escape') {\n setHelpOpen(false);\n return;\n }\n if (hasLocalBareKeyOwner()) return;\n if (e.key === '?') {\n e.preventDefault();\n setHelpOpen((o) => !o);\n return;\n }\n if (pendingChordAt.current && Date.now() - pendingChordAt.current < CHORD_TIMEOUT_MS) {\n pendingChordAt.current = 0;\n const chord = NAV_CHORDS.find((c) => c.key === e.key);\n if (chord) {\n e.preventDefault();\n window.location.href = chord.href;\n return;\n }\n }\n if (e.key === 'g') {\n pendingChordAt.current = Date.now();\n return;\n }\n if (e.key !== '/' && e.key !== 't') return;\n e.preventDefault();\n openPalette();\n };\n window.addEventListener('keydown', onKey);\n return () => window.removeEventListener('keydown', onKey);\n }, [openPalette]);\n\n useEffect(() => {\n if (open) inputRef.current?.focus();\n }, [open]);\n\n const results = useMemo<Entry[]>(() => {\n const all: Entry[] = [...repos, ...PAGES];\n if (!query.trim()) {\n // Default view: pages first (fast nav), then a few repos.\n return [...PAGES, ...repos].slice(0, 40);\n }\n const scored = all\n .map((e) => {\n const hay = e.type === 'repo' ? `${e.label} ${e.sub}` : `${e.label} ${e.keywords}`;\n return { e, s: score(hay, query.trim()) };\n })\n .filter((x) => x.s > -Infinity);\n scored.sort((a, b) => b.s - a.s);\n return scored.slice(0, 40).map((x) => x.e);\n }, [query, repos]);\n\n useEffect(() => {\n setActive((a) => Math.min(a, Math.max(0, results.length - 1)));\n }, [results.length]);\n\n const go = useCallback((entry: Entry | undefined) => {\n if (!entry) return;\n setOpen(false);\n window.location.href = entry.href;\n }, []);\n\n const onListKey = (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n setOpen(false);\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n setActive((a) => Math.min(a + 1, results.length - 1));\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n setActive((a) => Math.max(a - 1, 0));\n } else if (e.key === 'Enter') {\n e.preventDefault();\n go(results[active]);\n }\n };\n\n useEffect(() => {\n const el = listRef.current?.querySelector<HTMLElement>(`[data-idx=\"${active}\"]`);\n el?.scrollIntoView({ block: 'nearest' });\n }, [active]);\n\n if (!open) {\n if (!helpOpen) return null;\n return (\n <div\n className=\"pointer-events-auto fixed inset-0 z-[200] flex items-start justify-center bg-black/60 p-4 pt-[12vh] backdrop-blur-sm\"\n onClick={() => setHelpOpen(false)}\n >\n <div\n className=\"w-full max-w-md overflow-hidden rounded-xl border border-white/12 bg-[#0d1117] shadow-2xl shadow-black/60\"\n onClick={(e) => e.stopPropagation()}\n >\n <div className=\"flex items-center justify-between border-b border-white/10 px-4 py-3\">\n <span className=\"text-sm font-medium text-white\">Keyboard shortcuts</span>\n <kbd className=\"rounded bg-white/10 px-1.5 py-0.5 text-[10px] text-white/40\">esc</kbd>\n </div>\n <div className=\"max-h-[60vh] overflow-y-auto px-4 py-3 text-sm\">\n <div className=\"mb-3 space-y-1.5\">\n {[\n ['⌘K / Ctrl+K', 'Command palette (anywhere)'],\n ['/ or t', 'Command palette'],\n ['?', 'This help'],\n ].map(([k, d]) => (\n <div key={k} className=\"flex items-center justify-between gap-4\">\n <span className=\"text-white/72\">{d}</span>\n <kbd className=\"shrink-0 rounded bg-white/10 px-1.5 py-0.5 text-[11px] text-white/60\">{k}</kbd>\n </div>\n ))}\n </div>\n <p className=\"mb-1.5 text-[11px] font-medium uppercase tracking-wide text-white/34\">Go to — press g then…</p>\n <div className=\"grid grid-cols-2 gap-x-4 gap-y-1.5\">\n {NAV_CHORDS.map((c) => (\n <div key={c.key} className=\"flex items-center justify-between gap-2\">\n <span className=\"truncate text-white/72\">{c.label}</span>\n <kbd className=\"shrink-0 rounded bg-white/10 px-1.5 py-0.5 text-[11px] text-white/60\">g {c.key}</kbd>\n </div>\n ))}\n </div>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div\n className=\"pointer-events-auto fixed inset-0 z-[200] flex items-start justify-center bg-black/60 p-4 pt-[12vh] backdrop-blur-sm\"\n onClick={() => setOpen(false)}\n >\n <div\n className=\"w-full max-w-xl overflow-hidden rounded-xl border border-white/12 bg-[#0d1117] shadow-2xl shadow-black/60\"\n onClick={(e) => e.stopPropagation()}\n >\n <div className=\"flex items-center gap-2 border-b border-white/10 px-3\">\n <Search size={16} className=\"text-white/40\" />\n <input\n ref={inputRef}\n value={query}\n onChange={(e) => {\n setQuery(e.target.value);\n setActive(0);\n }}\n onKeyDown={onListKey}\n placeholder=\"Search repos and pages…\"\n className=\"h-12 min-w-0 flex-1 bg-transparent text-sm text-white outline-none placeholder:text-white/34\"\n />\n <VoiceDictationControl\n value={query}\n onChange={(next) => {\n setQuery(next);\n setActive(0);\n }}\n ariaLabel=\"Dictate search\"\n buttonClassName=\"h-9 w-9\"\n />\n <kbd className=\"hidden rounded bg-white/10 px-1.5 py-0.5 text-[10px] text-white/40 sm:block\">esc</kbd>\n </div>\n <div ref={listRef} className=\"max-h-[52vh] overflow-y-auto py-1\">\n {results.length === 0 ? (\n <p className=\"px-4 py-6 text-center text-sm text-white/40\">No matches.</p>\n ) : (\n results.map((entry, i) => (\n <button\n key={`${entry.type}:${entry.href}`}\n data-idx={i}\n type=\"button\"\n onMouseEnter={() => setActive(i)}\n onClick={() => go(entry)}\n className={`flex w-full items-center gap-3 px-3 py-2 text-left text-sm ${\n i === active ? 'bg-white/10 text-white' : 'text-white/72 hover:bg-white/[0.06]'\n }`}\n >\n {entry.type === 'repo' ? (\n <OwnerAvatar name={entry.owner} src={entry.avatar} size={20} />\n ) : (\n <FileText size={18} className=\"shrink-0 text-white/40\" />\n )}\n <span className=\"flex min-w-0 flex-col\">\n <span className=\"flex items-center gap-1.5 truncate font-medium\">\n {entry.type === 'repo' && <GitBranch size={12} className=\"shrink-0 text-white/34\" />}\n {entry.label}\n </span>\n {entry.type === 'repo' && entry.sub && (\n <span className=\"truncate text-xs text-white/40\">{entry.sub}</span>\n )}\n </span>\n <ArrowRight size={14} className={`ml-auto shrink-0 ${i === active ? 'text-white/60' : 'text-transparent'}`} />\n </button>\n ))\n )}\n </div>\n <div className=\"flex items-center gap-3 border-t border-white/10 px-3 py-2 text-[11px] text-white/34\">\n <span><kbd className=\"rounded bg-white/10 px-1\">↑↓</kbd> navigate</span>\n <span><kbd className=\"rounded bg-white/10 px-1\">↵</kbd> open</span>\n <span className=\"ml-auto\"><kbd className=\"rounded bg-white/10 px-1\">⌘K</kbd> / <kbd className=\"rounded bg-white/10 px-1\">/</kbd></span>\n </div>\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport { Monitor, Moon, Sun } from \"lucide-react\";\n\n// Sister sites in the app.nz network. Rendered in the footer on every marketing\n// and auth page for cross-linking / SEO. Kept here (not inlined in PlatformHome)\n// so the footer stays a single shared component across the whole site.\nconst NETWORK_LINKS: Array<{ href: string; label: string }> = [\n { href: \"https://gpubrain.app.nz\", label: \"GpuBrain\" },\n { href: \"/papers\", label: \"Papers\" },\n { href: \"https://readingtime.app.nz\", label: \"Reading Time\" },\n { href: \"https://mojojojo.app.nz\", label: \"mojojojo\" },\n { href: \"https://netwrck.com\", label: \"Netwrck\" },\n { href: \"https://text-generator.io\", label: \"Text-Generator.io\" },\n { href: \"https://codex-infinity.com\", label: \"Codex Infinity\" },\n { href: \"https://openpaths.io\", label: \"OpenPaths\" },\n { href: \"https://cutedsl.cc\", label: \"CuteDSL\" },\n { href: \"https://ebank.nz\", label: \"AI Art Generator\" },\n { href: \"https://aiart-generator.art\", label: \"AIArt-Generator.art\" },\n { href: \"https://sitesim.net\", label: \"SiteSim\" },\n { href: \"https://simplexgen.com\", label: \"SimplexGen\" },\n { href: \"https://dictatorflow.com\", label: \"DictatorFlow\" },\n { href: \"https://webfiddle.net\", label: \"WebFiddle\" },\n { href: \"https://ring.nz\", label: \"Ring.nz\" },\n { href: \"https://chatgibidy.com\", label: \"ChatGibidy\" },\n { href: \"https://bitbank.nz\", label: \"BitBank\" },\n { href: \"https://experimentflow.com\", label: \"ExperimentFlow\" },\n { href: \"https://evangeler.com\", label: \"Evangeler\" },\n { href: \"https://hires.nz\", label: \"Hires.nz\" },\n { href: \"https://how.nz\", label: \"How.nz\" },\n { href: \"https://v5games.com\", label: \"V5 Games\" },\n { href: \"https://addictingwordgames.com\", label: \"Addicting Word Games\" },\n { href: \"https://bigmultiplayerchess.com\", label: \"Big Multiplayer Chess\" },\n { href: \"https://wordsmashing.com\", label: \"Word Smashing\" },\n { href: \"https://rewordgame.com\", label: \"reWord Game\" },\n { href: \"https://multiplicationmaster.com\", label: \"Multiplication Master\" },\n];\n\n// Product columns. Every href is a real route (App.tsx / platformRoutes.ts) —\n// the footer doubles as the sitemap, so no dead marketing stubs.\nconst COLUMNS: Array<{ title: string; links: Array<{ href: string; label: string }> }> = [\n {\n title: \"Agent stack\",\n links: [\n { href: \"/agent\", label: \"Cloud coding agent\" },\n { href: \"/agents-sdk\", label: \"Agents SDK\" },\n { href: \"/integrations\", label: \"Integrations\" },\n { href: \"/browser-agent\", label: \"Browser agent\" },\n { href: \"/auto-agents\", label: \"Monitors & auto-agents\" },\n { href: \"/schedulers\", label: \"Schedulers\" },\n { href: \"/skills\", label: \"Agent skills\" },\n { href: \"/mcp-servers\", label: \"MCP servers\" },\n { href: \"/deep-research\", label: \"Deep research\" },\n ],\n },\n {\n title: \"Models & API\",\n links: [\n { href: \"/gateway\", label: \"AI Gateway\" },\n { href: \"/models\", label: \"Model catalog\" },\n { href: \"/evals\", label: \"Model evals\" },\n { href: \"/spaces\", label: \"Model spaces\" },\n { href: \"/gateway#playground\", label: \"Playground\" },\n { href: \"/text-to-image\", label: \"Text to image\" },\n { href: \"/image-to-3d\", label: \"Image to 3D\" },\n { href: \"/text-to-3d\", label: \"Text to 3D\" },\n { href: \"/music\", label: \"Music & SFX\" },\n { href: \"/audio\", label: \"Audio editor\" },\n { href: \"/media-optimizer\", label: \"Media optimizer\" },\n { href: \"/art\", label: \"AI art & library\" },\n { href: \"/chat\", label: \"Chat\" },\n { href: \"/docs\", label: \"API reference\" },\n { href: \"/schema\", label: \"Schema\" },\n { href: \"/providers\", label: \"Become a provider\" },\n ],\n },\n {\n title: \"Compute & hosting\",\n links: [\n { href: \"/deploys\", label: \"Deploys\" },\n { href: \"/addons\", label: \"Addons\" },\n { href: \"/addons/postgres\", label: \"Postgres hosting\" },\n { href: \"/addons/gobed\", label: \"gobed vector search\" },\n { href: \"/sites\", label: \"Site hosting\" },\n { href: \"/analytics\", label: \"Analytics\" },\n { href: \"/cogs\", label: \"Cog GPU hosting\" },\n { href: \"/rl\", label: \"RL training\" },\n { href: \"/builds\", label: \"Builds & CI\" },\n { href: \"/workers\", label: \"Workers\" },\n { href: \"/queues\", label: \"Task queues\" },\n { href: \"/domains\", label: \"Domains\" },\n { href: \"/repos\", label: \"Git hosting\" },\n ],\n },\n {\n title: \"Tools\",\n links: [\n { href: \"/tools\", label: \"AI tools\" },\n { href: \"/draw\", label: \"Draw\" },\n { href: \"/diffusion\", label: \"Diffusion canvas\" },\n { href: \"/livedraw\", label: \"Live Draw\" },\n { href: \"/write\", label: \"Write\" },\n { href: \"/sheets\", label: \"Sheets\" },\n { href: \"/artifacts\", label: \"Artifacts\" },\n { href: \"/studio\", label: \"Video studio\" },\n { href: \"/notebooks\", label: \"Notebooks\" },\n { href: \"/datasets\", label: \"Datasets\" },\n ],\n },\n {\n title: \"Learn\",\n links: [\n { href: \"/docs\", label: \"Docs\" },\n { href: \"/blog\", label: \"Blog\" },\n { href: \"/evals\", label: \"Eval guides\" },\n { href: \"/prompts\", label: \"Prompt library\" },\n { href: \"/cli\", label: \"CLI\" },\n { href: \"/alternatives\", label: \"Alternatives\" },\n { href: \"/papers\", label: \"Papers\" },\n { href: \"/characters\", label: \"AI characters\" },\n { href: \"/art\", label: \"Art gallery\" },\n { href: \"/security\", label: \"Security\" },\n { href: \"/consulting\", label: \"Consulting\" },\n ],\n },\n {\n title: \"Company\",\n links: [\n { href: \"/pricing\", label: \"Pricing\" },\n { href: \"/enterprise\", label: \"Enterprise\" },\n { href: \"/settings\", label: \"Settings\" },\n { href: \"/billing\", label: \"Billing\" },\n { href: \"/status\", label: \"Status\" },\n { href: \"/investors\", label: \"Investors\" },\n { href: \"/signup\", label: \"Create account\" },\n { href: \"/terms\", label: \"Terms of Service\" },\n { href: \"/privacy\", label: \"Privacy Policy\" },\n ],\n },\n];\n\nconst THEMES: Array<{ id: string; label: string; icon: React.ComponentType<{ size?: number }> }> = [\n { id: \"system\", label: \"System theme\", icon: Monitor },\n { id: \"dark\", label: \"Dark theme\", icon: Moon },\n { id: \"light\", label: \"Light theme\", icon: Sun },\n];\n\n// Theme selector (Vercel-style segmented control). Dark is the site default;\n// the choice persists in localStorage and is applied before first paint by the\n// inline boot script in index.html. Renders \"dark\" on the server and hydrates\n// the stored value in an effect so SSR markup always matches.\nfunction ThemeSelect() {\n const [theme, setTheme] = React.useState(\"dark\");\n\n React.useEffect(() => {\n try {\n setTheme(localStorage.getItem(\"appnz_theme\") || \"dark\");\n } catch {\n /* storage blocked */\n }\n }, []);\n\n React.useEffect(() => {\n if (theme !== \"system\" || typeof window === \"undefined\") return;\n const mq = window.matchMedia(\"(prefers-color-scheme: light)\");\n const apply = () => {\n document.documentElement.dataset.theme = mq.matches ? \"light\" : \"dark\";\n };\n mq.addEventListener(\"change\", apply);\n return () => mq.removeEventListener(\"change\", apply);\n }, [theme]);\n\n const pick = (t: string) => {\n setTheme(t);\n try {\n localStorage.setItem(\"appnz_theme\", t);\n } catch {\n /* storage blocked */\n }\n const resolved =\n t === \"system\"\n ? window.matchMedia(\"(prefers-color-scheme: light)\").matches\n ? \"light\"\n : \"dark\"\n : t;\n document.documentElement.dataset.theme = resolved;\n };\n\n return (\n <div\n className=\"inline-flex items-center rounded-full border border-white/12 p-0.5\"\n role=\"radiogroup\"\n aria-label=\"Select a display theme\"\n data-testid=\"theme-select\"\n >\n {THEMES.map(({ id, label, icon: Icon }) => (\n <button\n key={id}\n type=\"button\"\n role=\"radio\"\n aria-checked={theme === id}\n aria-label={label}\n title={label}\n onClick={() => pick(id)}\n data-testid={`theme-${id}`}\n className={`rounded-full p-1.5 transition-colors ${\n theme === id ? \"bg-white/12 text-white\" : \"text-white/65 hover:text-white\"\n }`}\n >\n <Icon size={14} />\n </button>\n ))}\n </div>\n );\n}\n\n// SiteFooter is the shared marketing footer shown on every marketing + auth page\n// (home, platform routes, docs, gateway, login/signup, etc.). It is rendered once\n// from the Marketing wrapper in App.tsx so coverage stays consistent.\nexport function SiteFooter() {\n return (\n <footer className=\"px-5 py-8 sm:px-8 lg:px-12\">\n <div className=\"mx-auto max-w-[1800px] border-t border-white/10 pt-8\">\n <div className=\"grid gap-x-6 gap-y-8 text-sm text-white/65 sm:grid-cols-3 lg:grid-cols-6\">\n {COLUMNS.map((col) => (\n <div key={col.title}>\n <div className=\"mb-2 text-xs font-bold uppercase tracking-[0.16em] text-white/60\">\n {col.title}\n </div>\n <div className=\"grid gap-2\">\n {col.links.map((l) => (\n <a key={`${col.title}-${l.href}`} href={l.href} className=\"hover:text-white\">\n {l.label}\n </a>\n ))}\n </div>\n </div>\n ))}\n </div>\n\n <div className=\"mt-10 flex flex-col justify-between gap-6 border-t border-white/10 pt-6 sm:flex-row sm:items-start\">\n <div className=\"max-w-sm\">\n <a\n href=\"/\"\n className=\"inline-flex items-center gap-2 font-display text-lg font-bold text-white\"\n >\n <img\n src=\"/assets/app-logo-64.webp\"\n alt=\"app.nz\"\n className=\"h-7 w-7 object-contain\"\n width=\"64\"\n height=\"64\"\n />\n app.nz\n </a>\n <p className=\"mt-3 text-sm leading-6 text-white/65\">\n AI agent cloud for coding, deploys, model routing, and research.\n Built for teams shipping software.\n </p>\n <p className=\"mt-3 text-sm leading-6 text-white/65\">\n Built in New Zealand by App AI NZ.\n </p>\n </div>\n <div className=\"grid gap-2 text-sm text-white/65\">\n <div className=\"mb-1 text-xs font-bold uppercase tracking-[0.16em] text-white/60\">\n Social\n </div>\n <a href=\"https://x.com/leepenkman\" className=\"hover:text-white\">\n X / Twitter\n </a>\n <a href=\"https://github.com/lee101\" className=\"hover:text-white\">\n GitHub\n </a>\n <a\n href=\"https://www.youtube.com/channel/UC99WzS0KTNLl2hbx-xXA5lg\"\n className=\"hover:text-white\"\n >\n YouTube\n </a>\n </div>\n </div>\n\n <div className=\"mt-10 border-t border-white/10 pt-6\">\n <div className=\"mb-3 text-xs font-bold uppercase tracking-[0.16em] text-white/60\">\n The app.nz network\n </div>\n <div className=\"grid gap-x-6 gap-y-2 text-[13px] text-white/65 sm:grid-cols-3 lg:grid-cols-5\">\n {NETWORK_LINKS.map((l) => (\n <a key={l.href} href={l.href} className=\"hover:text-white\">\n {l.label}\n </a>\n ))}\n </div>\n </div>\n\n <div className=\"mt-8 flex flex-col justify-between gap-3 border-t border-white/10 pt-6 text-xs text-white/60 sm:flex-row sm:items-center\">\n <span>\n © {new Date().getFullYear()} App AI NZ Ltd. All rights reserved.\n </span>\n <span className=\"flex flex-wrap items-center gap-3\">\n <a href=\"/status\" className=\"inline-flex items-center gap-1.5 hover:text-white\">\n <span className=\"h-1.5 w-1.5 rounded-full bg-emerald-400\" aria-hidden />\n All systems normal\n </a>\n <a href=\"/terms\" className=\"hover:text-white\">\n Terms\n </a>\n <a href=\"/privacy\" className=\"hover:text-white\">\n Privacy\n </a>\n <ThemeSelect />\n </span>\n </div>\n </div>\n </footer>\n );\n}\n\nexport default SiteFooter;\n","import React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { AlertCircle, Loader2, Pause, Play, RotateCcw } from \"lucide-react\";\n\n// Minimal asciinema v2 (.cast) player: JSONL header + [time, \"o\", data] events.\n// Supports the SGR subset our recordings use (16/256 fg colors, bold, dim,\n// reset) plus \\r line-overwrite and ESC[K erase — enough for real CLI output\n// without pulling in xterm.js.\n\ntype CastEvent = [number, string];\n\ninterface Cast {\n cols: number;\n rows: number;\n events: CastEvent[];\n duration: number;\n}\n\nconst PALETTE: Record<number, string> = {\n 30: \"#3f4451\", 31: \"#f87171\", 32: \"#4ade80\", 33: \"#fbbf24\",\n 34: \"#60a5fa\", 35: \"#e879f9\", 36: \"#22d3ee\", 37: \"#d4d4d8\",\n 90: \"#6b7280\", 91: \"#fca5a5\", 92: \"#86efac\", 93: \"#fde68a\",\n 94: \"#93c5fd\", 95: \"#f0abfc\", 96: \"#67e8f9\", 97: \"#ffffff\",\n};\n\nconst COLOR_256: Record<number, string> = {\n 8: \"#6b7280\", 10: \"#4ade80\", 12: \"#60a5fa\", 13: \"#e879f9\", 14: \"#22d3ee\",\n 39: \"#38bdf8\", 45: \"#22d3ee\", 48: \"#34d399\", 141: \"#a78bfa\", 156: \"#bef264\",\n 205: \"#f472b6\", 208: \"#fb923c\", 213: \"#f0abfc\", 220: \"#facc15\", 244: \"#9ca3af\",\n};\n\ninterface Style { color?: string; bold?: boolean; dim?: boolean }\ninterface Span { text: string; style: Style }\n\nfunction parseCast(src: string): Cast {\n const lines = src.split(\"\\n\").filter(Boolean);\n let cols = 80;\n let rows = 24;\n const events: CastEvent[] = [];\n for (const line of lines) {\n let parsed: unknown;\n try {\n parsed = JSON.parse(line);\n } catch {\n continue;\n }\n if (Array.isArray(parsed)) {\n const [t, kind, data] = parsed as [number, string, string];\n if (kind === \"o\" && typeof data === \"string\") events.push([t, data]);\n } else if (parsed && typeof parsed === \"object\") {\n const h = parsed as { width?: number; height?: number };\n if (h.width) cols = h.width;\n if (h.height) rows = h.height;\n }\n }\n const duration = events.length ? events[events.length - 1][0] : 0;\n return { cols, rows, events, duration };\n}\n\n// Feed raw output into a line buffer, applying \\r, \\n, ESC[K and SGR styling.\nclass Screen {\n lines: Span[][] = [[]];\n private col = 0;\n private style: Style = {};\n\n private row(): Span[] {\n return this.lines[this.lines.length - 1];\n }\n\n private applySgr(params: string) {\n const codes = params.length ? params.split(\";\").map(Number) : [0];\n for (let i = 0; i < codes.length; i++) {\n const c = codes[i];\n if (c === 0) this.style = {};\n else if (c === 1) this.style = { ...this.style, bold: true };\n else if (c === 2) this.style = { ...this.style, dim: true };\n else if (c === 22) this.style = { ...this.style, bold: false, dim: false };\n else if (c === 39) this.style = { ...this.style, color: undefined };\n else if (PALETTE[c]) this.style = { ...this.style, color: PALETTE[c] };\n else if (c === 38 && codes[i + 1] === 5) {\n const n = codes[i + 2];\n this.style = { ...this.style, color: COLOR_256[n] || \"#d4d4d8\" };\n i += 2;\n }\n }\n }\n\n private overwrite(text: string) {\n const row = this.row();\n let remaining = this.col;\n let idx = 0;\n while (idx < row.length && remaining >= row[idx].text.length) {\n remaining -= row[idx].text.length;\n idx++;\n }\n if (idx < row.length) {\n const keep = row[idx].text.slice(0, remaining);\n row.splice(idx, row.length - idx, ...(keep ? [{ text: keep, style: row[idx].style }] : []));\n }\n if (text) row.push({ text, style: this.style });\n this.col += text.length;\n }\n\n write(data: string) {\n let i = 0;\n while (i < data.length) {\n const ch = data[i];\n if (ch === \"\\x1b\") {\n const m = /^\\x1b\\[([0-9;?]*)([A-Za-z])/.exec(data.slice(i));\n if (m) {\n if (m[2] === \"m\") this.applySgr(m[1]);\n else if (m[2] === \"K\") {\n // erase to end of line: overwrite() already truncates on next write,\n // but handle standalone erase too\n this.overwrite(\"\");\n }\n i += m[0].length;\n continue;\n }\n i++;\n continue;\n }\n if (ch === \"\\n\") {\n this.lines.push([]);\n this.col = 0;\n i++;\n continue;\n }\n if (ch === \"\\r\") {\n this.col = 0;\n i++;\n continue;\n }\n let j = i;\n while (j < data.length && !\"\\x1b\\n\\r\".includes(data[j])) j++;\n this.overwrite(data.slice(i, j));\n i = j;\n }\n }\n}\n\nfunction renderLines(screen: Screen, maxRows: number): Span[][] {\n const lines = screen.lines;\n return lines.slice(Math.max(0, lines.length - maxRows));\n}\n\nexport default function TerminalCast({\n src,\n title = \"app.nz — terminal\",\n speed = 1,\n rows = 22,\n className = \"\",\n poster = \"$ press play to replay this workflow\",\n}: {\n src: string;\n title?: string;\n speed?: number;\n rows?: number;\n className?: string;\n poster?: string;\n}) {\n const [cast, setCast] = useState<Cast | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState(\"\");\n const [reducedMotion, setReducedMotion] = useState(false);\n const [playing, setPlaying] = useState(false);\n const [started, setStarted] = useState(false);\n const [progress, setProgress] = useState(0);\n const [lines, setLines] = useState<Span[][]>([[{ text: poster, style: {} }]]);\n const containerRef = useRef<HTMLDivElement>(null);\n const scrollRef = useRef<HTMLDivElement>(null);\n const loopTimerRef = useRef<number | null>(null);\n const stateRef = useRef({ idx: 0, elapsed: 0, screen: new Screen(), raf: 0, last: 0 });\n const playingRef = useRef(false);\n\n useEffect(() => {\n let alive = true;\n setLoading(true);\n setError(\"\");\n setCast(null);\n fetch(src)\n .then((r) => (r.ok ? r.text() : Promise.reject(new Error(String(r.status)))))\n .then((text) => {\n if (!alive) return;\n const next = parseCast(text);\n if (next.events.length === 0) throw new Error(\"empty recording\");\n setCast(next);\n setLoading(false);\n })\n .catch(() => {\n if (!alive) return;\n setError(\"Recording unavailable\");\n setLoading(false);\n });\n return () => {\n alive = false;\n };\n }, [src]);\n\n useEffect(() => {\n if (typeof window === \"undefined\" || !window.matchMedia) return;\n const media = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n const update = () => setReducedMotion(media.matches);\n update();\n media.addEventListener?.(\"change\", update);\n return () => media.removeEventListener?.(\"change\", update);\n }, []);\n\n const restart = useCallback(() => {\n if (loopTimerRef.current) window.clearTimeout(loopTimerRef.current);\n loopTimerRef.current = null;\n const st = stateRef.current;\n st.idx = 0;\n st.elapsed = 0;\n st.screen = new Screen();\n setProgress(0);\n setLines([[{ text: poster, style: {} }]]);\n }, [poster]);\n\n const tick = useCallback(\n (now: number) => {\n const st = stateRef.current;\n if (!playingRef.current || !cast) return;\n const dt = st.last ? (now - st.last) / 1000 : 0;\n st.last = now;\n st.elapsed += dt * speed;\n let advanced = false;\n while (st.idx < cast.events.length && cast.events[st.idx][0] <= st.elapsed) {\n st.screen.write(cast.events[st.idx][1]);\n st.idx++;\n advanced = true;\n }\n if (advanced) {\n setLines(renderLines(st.screen, rows));\n setProgress(Math.min(1, st.elapsed / (cast.duration || 1)));\n }\n if (st.idx >= cast.events.length) {\n setProgress(1);\n playingRef.current = false;\n setPlaying(false);\n // loop after a beat so the finished state is readable\n loopTimerRef.current = window.setTimeout(() => {\n loopTimerRef.current = null;\n if (!stateRef.current.raf && containerRef.current) {\n restart();\n playingRef.current = true;\n setPlaying(true);\n stateRef.current.last = 0;\n stateRef.current.raf = requestAnimationFrame(tick);\n }\n }, 3500);\n st.raf = 0;\n return;\n }\n st.raf = requestAnimationFrame(tick);\n },\n [cast, speed, rows, restart],\n );\n\n const play = useCallback(() => {\n if (!cast || playingRef.current) return;\n playingRef.current = true;\n setPlaying(true);\n setStarted(true);\n stateRef.current.last = 0;\n stateRef.current.raf = requestAnimationFrame(tick);\n }, [cast, tick]);\n\n const pause = useCallback(() => {\n playingRef.current = false;\n setPlaying(false);\n if (stateRef.current.raf) cancelAnimationFrame(stateRef.current.raf);\n stateRef.current.raf = 0;\n }, []);\n\n // autoplay once when scrolled into view\n useEffect(() => {\n if (!cast || started || reducedMotion || typeof IntersectionObserver === \"undefined\") return;\n const el = containerRef.current;\n if (!el) return;\n const obs = new IntersectionObserver(\n (entries) => {\n if (entries.some((e) => e.isIntersecting)) {\n play();\n obs.disconnect();\n }\n },\n { threshold: 0.35 },\n );\n obs.observe(el);\n return () => obs.disconnect();\n }, [cast, started, reducedMotion, play]);\n\n useEffect(() => {\n const el = scrollRef.current;\n if (el) el.scrollTop = el.scrollHeight;\n }, [lines]);\n\n useEffect(\n () => () => {\n playingRef.current = false;\n if (stateRef.current.raf) cancelAnimationFrame(stateRef.current.raf);\n if (loopTimerRef.current) window.clearTimeout(loopTimerRef.current);\n },\n [],\n );\n\n return (\n <div\n ref={containerRef}\n aria-label={`${title} terminal recording`}\n className={`min-w-0 max-w-full overflow-hidden rounded-2xl border border-white/12 bg-[#070b14] shadow-[0_0_60px_rgba(8,145,178,0.12)] ${className}`}\n >\n <div className=\"flex items-center gap-2 border-b border-white/10 bg-white/[0.03] px-4 py-2.5\">\n <span className=\"h-2.5 w-2.5 rounded-full bg-[#f87171]/80\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-[#fbbf24]/80\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-[#4ade80]/80\" />\n <span className=\"ml-3 min-w-0 truncate font-mono text-xs text-white/55\">{title}</span>\n <div className=\"ml-auto flex shrink-0 items-center gap-1.5\">\n <button\n type=\"button\"\n aria-label={playing ? \"Pause\" : \"Play\"}\n disabled={!cast}\n onClick={playing ? pause : play}\n className=\"rounded-md p-1.5 text-white/60 transition hover:bg-white/10 hover:text-white disabled:cursor-not-allowed disabled:opacity-30\"\n >\n {playing ? <Pause className=\"h-3.5 w-3.5\" /> : <Play className=\"h-3.5 w-3.5\" />}\n </button>\n <button\n type=\"button\"\n aria-label=\"Restart\"\n disabled={!cast}\n onClick={() => {\n pause();\n restart();\n play();\n }}\n className=\"rounded-md p-1.5 text-white/60 transition hover:bg-white/10 hover:text-white disabled:cursor-not-allowed disabled:opacity-30\"\n >\n <RotateCcw className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n </div>\n <div\n ref={scrollRef}\n role=\"log\"\n aria-live=\"polite\"\n aria-label=\"Terminal output\"\n className=\"max-h-[22rem] overflow-y-hidden px-4 py-3 font-mono text-[13px] leading-6 text-[#d4d4d8] sm:max-h-none\"\n style={{ height: `${rows * 1.5 + 1.5}rem` }}\n onClick={playing ? pause : play}\n >\n {loading ? (\n <div className=\"flex items-center gap-2 text-white/45\"><Loader2 className=\"h-4 w-4 animate-spin\" /> Loading recording…</div>\n ) : error ? (\n <div role=\"status\" className=\"flex items-center gap-2 text-amber-200/75\"><AlertCircle className=\"h-4 w-4\" /> {error}</div>\n ) : lines.map((line, li) => (\n <div key={li} className=\"whitespace-pre-wrap break-words\">\n {line.length === 0\n ? \" \"\n : line.map((span, si) => (\n <span\n key={si}\n style={{\n color: span.style.color,\n fontWeight: span.style.bold ? 600 : undefined,\n opacity: span.style.dim ? 0.6 : undefined,\n }}\n >\n {span.text}\n </span>\n ))}\n {li === lines.length - 1 && playing && (\n <span className=\"ml-0.5 inline-block h-4 w-2 translate-y-0.5 animate-pulse bg-[#22d3ee]\" />\n )}\n </div>\n ))}\n </div>\n <div className=\"h-0.5 w-full bg-white/[0.06]\">\n <div\n className=\"h-full bg-gradient-to-r from-cyan-400 to-fuchsia-400 transition-[width] duration-300\"\n style={{ width: `${progress * 100}%` }}\n />\n </div>\n </div>\n );\n}\n","import React from 'react';\nimport {\n Activity,\n ArrowRight,\n ArrowUpRight,\n BookOpen,\n Bot,\n Box,\n CheckCircle2,\n Cloud,\n Code2,\n Copy,\n FlaskConical,\n GitBranch,\n Globe,\n Hammer,\n HardDrive,\n Image as ImageIcon,\n Inbox,\n KeyRound,\n Layers,\n MessageSquare,\n MonitorCog,\n Palette,\n Play,\n Search,\n Server,\n ShieldCheck,\n Sparkles,\n Terminal,\n Video,\n Wrench,\n Zap,\n Library,\n} from 'lucide-react';\n\nimport TerminalCast from './TerminalCast';\ntype IconType = React.ComponentType<{ size?: number; className?: string }>;\n\ninterface ProductCard {\n title: string;\n eyebrow: string;\n description: string;\n href: string;\n icon: IconType;\n}\n\ninterface ModelLane {\n model: string;\n route: string;\n use: string;\n price: string;\n href: string;\n tools?: { label: string; href: string }[];\n}\n\ninterface ArtShowcaseItem {\n title: string;\n provider: string;\n model: string;\n prompt: string;\n imageUrl: string;\n href: string;\n}\n\ninterface MediaCapability {\n title: string;\n label: string;\n body: string;\n href: string;\n icon: IconType;\n}\n\nconst productCards: ProductCard[] = [\n {\n title: 'Create Apps',\n eyebrow: 'start fast',\n description: 'Spin up a project with repos, models, and storage. Ship a full-stack AI app, no infra wiring.',\n href: '/projects',\n icon: Box,\n },\n {\n title: 'Coding Agents',\n eyebrow: 'autonomous',\n description: 'Give an agent a repo task. It creates a branch, edits code, runs tests, and opens a PR for review.',\n href: '/agent',\n icon: Bot,\n },\n {\n title: 'Skills',\n eyebrow: 'searchable library',\n description: 'Semantically search hundreds of self-contained agent skills. Author gist-like skills (install prompt + script + use prompt), or copy one and hand it to any agent.',\n href: '/skills',\n icon: Library,\n },\n {\n title: 'AI Use Cases',\n eyebrow: '50+ tools',\n description: 'Job-specific AI tools: virtual staging, product photos, headshots, photo restore, art styles, logos, voiceovers, music and video — run with credits, no setup.',\n href: '/ai',\n icon: Sparkles,\n },\n {\n title: 'Repos & PRs',\n eyebrow: 'git hosting',\n description: 'Hosted repos with git sync, branch previews, review queues, and agents that repair failing CI.',\n href: '/repos',\n icon: GitBranch,\n },\n {\n title: 'Chat & Research',\n eyebrow: 'chat & search',\n description: 'Ask questions, attach files, run deep research, and keep every citation in one workspace.',\n href: '/chat',\n icon: MessageSquare,\n },\n {\n title: 'Papers',\n eyebrow: 'free research search',\n description: 'Search papers, methods, datasets, citations, GitHub code, and repositories free in the browser.',\n href: '/papers',\n icon: BookOpen,\n },\n {\n title: 'Search the Web',\n eyebrow: 'agent tools',\n description: 'Fresh web results, summaries, and citations for your agents and apps, through one API key.',\n href: '/gateway',\n icon: Search,\n },\n {\n title: 'Live Art Playground',\n eyebrow: 'media lab',\n description: 'Generate images, video, music, speech, and 3D assets from the browser with app.nz credits.',\n href: '/gateway#playground',\n icon: Palette,\n },\n {\n title: 'Browse Art',\n eyebrow: 'prompt search',\n description: 'Search and browse generated art prompts, models, tags, and visual styles from the app.nz art index.',\n href: '/art',\n icon: ImageIcon,\n },\n {\n title: 'Fusion',\n eyebrow: 'multi-model',\n description: 'Compare a model panel, judge the outputs, and synthesize the strongest answer through app.nz Fusion.',\n href: '/fusion',\n icon: Sparkles,\n },\n {\n title: 'Models',\n eyebrow: 'model routing',\n description: 'One OpenAI-compatible API for frontier, fast, cheap, vision, image, and code models. Auto-route or pin a provider.',\n href: '/gateway',\n icon: Layers,\n },\n {\n title: 'Hosting',\n eyebrow: 'deploy',\n description: 'Deploy static sites, containers, APIs, workers, and model endpoints with HTTPS preview URLs on app.nz.',\n href: '/deploys',\n icon: Cloud,\n },\n {\n title: 'Cog Studio',\n eyebrow: 'GPU inference',\n description: 'Deploy Cog containers as scale-to-zero GPU endpoints with generated forms, prediction logs, and clear billing.',\n href: '/cogs',\n icon: MonitorCog,\n },\n {\n title: 'Training',\n eyebrow: 'fine-tuning',\n description: 'Fine-tune open models with LoRA or full training on per-second billed GPUs, then deploy the weights to a dedicated endpoint.',\n href: '/training',\n icon: FlaskConical,\n },\n {\n title: 'Build Studio',\n eyebrow: 'container CI',\n description: 'Build Docker images on app.nz workers, push to your private registry, then run them in Cog Studio or deploys.',\n href: '/builds',\n icon: Hammer,\n },\n {\n title: 'Queues',\n eyebrow: 'task queues',\n description: 'Push JSON jobs to a queue and let agents or workers process them with retries, dead-letter, and spend caps.',\n href: '/queues',\n icon: Inbox,\n },\n {\n title: 'Tools',\n eyebrow: 'free + AI',\n description: 'Prompt optimizer, bulk evals, model comparison, domain checks, token cost — handy tools on one credit balance.',\n href: '/tools',\n icon: Wrench,\n },\n];\n\nconst heroBadgeLinks: { label: string; href: string }[] = [\n { label: 'repos', href: '/repos' },\n { label: 'papers', href: '/papers' },\n { label: 'routing', href: '/gateway' },\n { label: 'models', href: '/models' },\n { label: 'datasets', href: '/datasets' },\n { label: 'assistants', href: '/assistants' },\n { label: 'CI', href: '/builds' },\n { label: 'hosting', href: '/sites' },\n];\n\nconst heroPillars: { icon: IconType; label: string; href: string }[] = [\n { icon: Bot, label: 'Coding agent', href: '/agent' },\n { icon: GitBranch, label: 'Repos & PRs', href: '/repos' },\n { icon: Palette, label: 'Live art playground', href: '#art-playground' },\n { icon: Layers, label: '20+ model providers', href: '/gateway#providers' },\n { icon: Cloud, label: 'App & GPU hosting', href: '/deploys' },\n { icon: Search, label: 'Web & paper search', href: '/papers' },\n];\n\nconst modelLanes: ModelLane[] = [\n { model: 'app/auto', route: 'frontier', use: 'general chat, planning, mixed workloads', price: 'auto-routed', href: '/chat' },\n { model: 'app/auto-code', route: 'agentic', use: 'repo edits, PR repair, migrations', price: 'best-fit', href: '/agent' },\n { model: 'app/auto-fast', route: 'latency', use: 'realtime UX, chat, tools', price: 'low-latency', href: '/chat' },\n { model: 'app/search-deep', route: 'research', use: 'web search, papers, citations, extraction', price: '$0.001+ per search', href: '/gateway#playground' },\n {\n model: 'app/auto-image',\n route: 'media',\n use: 'images, edits, art workflows',\n price: 'per output',\n href: '/text-to-image',\n tools: [\n { label: 'text-to-image', href: '/text-to-image' },\n { label: 'art search', href: '/art' },\n ],\n },\n { model: 'app/auto-video', route: 'media', use: 'video clips, image-to-video, motion tests', price: 'per job', href: '/video' },\n {\n model: 'app/music',\n route: 'media',\n use: 'music, loops, ambience, foley, sound effects',\n price: 'per job',\n href: '/music',\n tools: [\n { label: 'music space', href: '/music' },\n { label: 'audio editor', href: '/audio' },\n { label: 'gateway playground', href: '/gateway#playground-music' },\n ],\n },\n {\n model: 'app/3d',\n route: 'media',\n use: 'image-to-3D, text-to-3D, rigging, retexture',\n price: 'per asset',\n href: '/3d-editor',\n tools: [\n { label: 'image-to-3D', href: '/image-to-3d' },\n { label: 'text-to-3D', href: '/text-to-3d' },\n { label: 'rigging', href: '/3d-editor' },\n { label: 'retexture', href: '/3d-editor' },\n ],\n },\n { model: 'app/model-hosted', route: 'hosted', use: 'custom hosted model endpoints', price: 'from $0.228/hr', href: '/cogs' },\n];\n\nconst artShowcase: ArtShowcaseItem[] = [\n {\n title: 'Archive Chapel',\n provider: 'Fal',\n model: 'FLUX Klein 4B',\n prompt: 'A brutalist chapel grown from translucent salt crystals on the edge of a frozen black lake.',\n imageUrl: 'https://openpathsstatic.openpaths.io/static/uploads/landing/art-playground/fal/fal-klein-archive-chapel.webp',\n href: '/models?q=flux%20klein',\n },\n {\n title: 'Gravity Orchard',\n provider: 'Fal',\n model: 'FLUX Schnell',\n prompt: 'An orchard where every fruit is a tiny moon with its own orbit, harvested by lantern light.',\n imageUrl: 'https://openpathsstatic.openpaths.io/static/uploads/landing/art-playground/fal/fal-schnell-gravity-orchard.webp',\n href: '/models?q=flux%20schnell',\n },\n {\n title: 'Ocean Typewriter',\n provider: 'Together AI',\n model: 'Stable Diffusion 3',\n prompt: 'A vintage typewriter on the seafloor releasing schools of silver punctuation fish.',\n imageUrl: 'https://openpathsstatic.openpaths.io/static/uploads/landing/art-playground/together-ai/together-sd3-ocean-typewriter.webp',\n href: '/models?q=stable%20diffusion',\n },\n {\n title: 'Lantern Koi Station',\n provider: 'Netwrck',\n model: 'ZImage',\n prompt: 'Anime train platform floating above a koi pond at blue hour with paper lantern reflections.',\n imageUrl: 'https://openpathsstatic.openpaths.io/static/uploads/landing/art-playground/netwrck/zimage-lantern-koi-station.webp',\n href: '/models?q=zimage',\n },\n];\n\nconst mediaCapabilities: MediaCapability[] = [\n {\n title: 'Image generation',\n label: 'GPT Image · FLUX · RA1 · ZImage · SD3',\n body: 'Prompt images, edit with image input, resize, extend canvas, and route across OpenAI, Fal, Netwrck, Together AI, Z.AI, and CuteDSL.',\n href: '/gateway#playground',\n icon: ImageIcon,\n },\n {\n title: 'Video generation',\n label: 'Sora · Hailuo · Seedance · Wan · LTX',\n body: 'Text-to-video and image-to-video jobs share the same API key, credits, usage logs, and provider fallback model catalogue.',\n href: '/gateway#playground',\n icon: Video,\n },\n {\n title: '3D generation',\n label: 'Pixal3D · Meshy · Tripo · Trellis',\n body: 'Generate textured GLB assets from a source image, run text-to-3D chains, rig meshes, and retexture models in the 3D Studio.',\n href: '/3d-editor',\n icon: Box,\n },\n {\n title: 'Fusion and comparison',\n label: 'app.nz Fusion · model compare',\n body: 'Run multiple models against the same prompt, inspect the panel, and synthesize a stronger final answer when you need a second opinion.',\n href: '/fusion',\n icon: Sparkles,\n },\n {\n title: 'Browse art prompts',\n label: 'Art search · tags · prompt reuse',\n body: 'Search a large prompt/image index by style, scene, mood, tag, aspect ratio, or model, then reuse the prompt in the playground.',\n href: '/art',\n icon: Search,\n },\n {\n title: 'Provider routing',\n label: '20+ providers · one balance',\n body: 'OpenAI, Anthropic, Google, xAI, DeepSeek, Mistral, Groq, Together, OpenRouter, Fal, Netwrck, MiniMax, Exa, and more.',\n href: '/gateway#providers',\n icon: Layers,\n },\n];\n\nconst providerBadges = [\n { label: 'OpenAI', provider: 'openai' },\n { label: 'Anthropic', provider: 'anthropic' },\n { label: 'Google', provider: 'google' },\n { label: 'xAI', provider: 'xai' },\n { label: 'DeepSeek', provider: 'deepseek' },\n { label: 'Mistral', provider: 'mistral' },\n { label: 'Groq', provider: 'groq' },\n { label: 'Together AI', provider: 'together' },\n { label: 'OpenRouter', provider: 'openrouter' },\n { label: 'Fal', provider: 'fal' },\n { label: 'Netwrck', provider: 'netwrck' },\n { label: 'MiniMax', provider: 'minimax' },\n { label: 'CuteDSL', provider: 'cutedsl' },\n { label: 'Z.AI', provider: 'zai' },\n { label: 'Fireworks', provider: 'fireworks' },\n { label: 'NVIDIA', provider: 'nvidia' },\n { label: 'Exa', provider: 'exa' },\n { label: 'Papers', provider: 'papers' },\n { label: 'Text-Generator.io', provider: 'textgenerator' },\n { label: 'Nous', provider: 'nous' },\n];\n\nconst INSTALL_COMMAND = 'curl -fsSL https://app.nz/cli.sh | sh';\n\nfunction copyInstallCommand(): Promise<boolean> {\n if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {\n return navigator.clipboard.writeText(INSTALL_COMMAND).then(\n () => true,\n () => false,\n );\n }\n return Promise.resolve(false);\n}\n\nconst terminalCards = [\n {\n title: 'Create a site',\n command: '$ app sites create ai-dashboard --title \"AI Dashboard\"',\n lines: ['Creating hosted site', 'Configured title', 'Ready for files', 'https://ai-dashboard.app.nz'],\n },\n {\n title: 'Run an agent',\n command: '$ app agent run --prompt \"add usage analytics\" --repo acme/ai-dashboard',\n lines: ['Planning task', 'Creating branch feat/usage-analytics', 'Writing code and tests', 'Opening PR #42'],\n },\n {\n title: 'Deploy an app',\n command: '$ app apps deploy ./ai-dashboard',\n lines: ['Packaging source', 'Running build on the server', 'Release running', 'https://ai-dashboard.app.nz'],\n },\n {\n title: 'Ask a model',\n command: '$ app chat \"why is this deploy failing?\" --model app/auto',\n lines: ['Routing via gateway', 'Streaming tokens live', 'Same credits as the API', 'app gateway models lists routes'],\n },\n];\n\nconst hostedServices = [\n { label: 'Free app.nz subdomains', detail: 'Claim names like my-ai-app.app.nz, attach them to a deploy, and get HTTPS without touching DNS.', icon: Globe, href: '/domains' },\n { label: 'Model storage', detail: 'Keep weights, LoRAs, datasets, and generated assets next to the workers that run inference.', icon: HardDrive, href: '/artifacts' },\n { label: 'Hosted model endpoints', detail: 'Serve your models behind OpenAI-compatible routes and the same API keys your apps already use.', icon: Server, href: '/cogs' },\n { label: 'One balance, many keys', detail: 'Shared credits, per-project keys, spend caps, and model lanes across agents, gateway, and deploys.', icon: KeyRound, href: '/api-keys' },\n];\n\nconst researchModes = [\n { mode: 'Chat', detail: 'Fast assistant conversations with uploads, images, model selection, and conversation history.', href: '/chat' },\n { mode: 'Web Search', detail: 'Ground answers with live web results, highlights, citations, freshness controls, and provider choice.', href: '/search' },\n { mode: 'Deep Research', detail: 'Multi-step research plans that search, fetch, summarize, cross-check, and produce source-backed reports.', href: '/deep-research' },\n { mode: 'Papers', detail: 'Search papers, methods, datasets, GitHub code, citations, and recent work free at app.nz/papers.', href: '/papers' },\n];\n\nconst gatewayPrices = [\n { label: 'Papers search', price: '$1 / 1,000 API searches · browser free', href: '/papers' },\n { label: 'Exa web search', price: '$0.0077 / request', href: '/search' },\n { label: 'Extra result/page', price: '$0.0011 each', href: '/search' },\n { label: 'GPU compute', price: 'from $0.228/hr', href: '/workers' },\n];\n\n// Featured repos link through to the real repo browser, their builds/CI, and the\n// live deploy. edukids is the open-source flagship: public source, secure CI\n// (secrets are scrubbed from build logs), and a working site at edukids.app.nz.\nconst repoRows = [\n { repo: 'lee101/edukids', branch: 'main', status: 'live', time: 'open source', href: '/repos/lee101/edukids', ci: 'https://github.com/lee101/edukids/actions', live: 'https://edukids.app.nz' },\n { repo: 'lee101/omniserve', branch: 'master', status: 'live', time: 'open source', href: '/repos/lee101/omniserve', ci: '/ci?repo=lee101/omniserve' },\n { repo: 'leepenkman/cutedsl', branch: 'codex/556-optimize-inference-kernels-for-performance', status: 'review', time: '5w ago', href: '/repos/leepenkman/cutedsl', ci: '/ci?repo=leepenkman/cutedsl' },\n { repo: 'leepenkman/hermes-agent', branch: 'openpaths-provider-integration', status: 'review', time: '4w ago', href: '/repos/leepenkman/hermes-agent', ci: '/ci?repo=leepenkman/hermes-agent' },\n { repo: 'leepenkman/gobed', branch: 'main', status: 'indexed', time: '3mo ago', href: '/repos/leepenkman/gobed', ci: '/ci?repo=leepenkman/gobed' },\n];\n\n// Live products built and hosted on app.nz — same repos, agents, gateway, and\n// credit balance as everything else on the platform.\nconst communityApps = [\n { title: 'app.nz/papers', description: 'Free semantic search over 725K ML papers, methods, datasets, and 613K code links.', href: '/papers', icon: BookOpen },\n { title: 'readingtime.app.nz', description: 'Illustrated kids picture books generated on demand, with word-by-word read-along.', href: 'https://readingtime.app.nz', icon: Sparkles },\n { title: 'mojojojo.app.nz', description: 'Run Python by the millisecond — free in your browser, native-compiled hot loops on ours.', href: 'https://mojojojo.app.nz', icon: Zap },\n { title: 'helix.app.nz', description: 'Ask questions in plain English, get back charts and SQL over your own data.', href: 'https://helix.app.nz', icon: Activity },\n { title: 'food.app.nz', description: 'Evidence-based techniques for optimizing everyday foods for nutrition and glucose response.', href: 'https://food.app.nz', icon: Zap },\n { title: 'gpubrain.app.nz', description: 'Persistent markdown memory so agents recall context across conversations, over MCP, CLI, and API.', href: 'https://gpubrain.app.nz', icon: Layers },\n];\n\n// Sibling products in the app.nz portfolio. Screenshots are real homepage\n// captures (visualbench), stored as 480x300 webp in public/assets/portfolio/.\nconst portfolioSites: Array<{ domain: string; name: string; description: string }> = [\n { domain: 'netwrck.com', name: 'Netwrck', description: 'AI chat, roleplay characters, art creation, and chatrooms.' },\n { domain: 'ebank.nz', name: 'eBank', description: 'AI art generator plus search across generated art.' },\n { domain: 'text-generator.io', name: 'Text Generator', description: 'Text, vision, and speech AI API for developers.' },\n { domain: 'openpaths.io', name: 'OpenPaths', description: 'Open source, OpenAI-compatible AI model router.' },\n { domain: 'codex-infinity.com', name: 'Codex Infinity', description: 'Autonomous AI coding agents on bare-metal workers.' },\n { domain: 'sitesim.net', name: 'SiteSim', description: 'AI website builder: create web pages and games instantly.' },\n { domain: 'webfiddle.net', name: 'WebFiddle', description: 'AI creator for CSS and JavaScript pages you can share.' },\n { domain: 'simplexgen.com', name: 'SimplexGen', description: 'Text to art to 3D model, then sculpt and export in the browser.' },\n { domain: 'dictatorflow.com', name: 'DictatorFlow', description: 'Free local voice dictation for Windows, macOS, and Linux.' },\n { domain: 'ring.nz', name: 'Ring', description: 'AI voice calls: talk to AI characters in real time.' },\n { domain: 'experimentflow.com', name: 'ExperimentFlow', description: 'A/B tests, bandits, and AI personalization for websites.' },\n { domain: 'evangeler.com', name: 'Evangeler', description: 'Affiliate program software and partner marketplace.' },\n { domain: 'hires.nz', name: 'Hires.nz', description: 'NZ marketplace for rentals, services, equipment, and jobs.' },\n { domain: 'how.nz', name: 'How.nz', description: 'AI development blog: kernels, models, and tooling.' },\n { domain: 'bitbank.nz', name: 'BitBank', description: 'AI crypto forecasts, trading bot, and developer API.' },\n { domain: 'v5games.com', name: 'V5 Games', description: 'Text adventure games, AI chatbots, and story games.' },\n { domain: 'addictingwordgames.com', name: 'Addicting Word Games', description: 'Free addicting word games and word puzzles.' },\n { domain: 'wordsmashing.com', name: 'Word Smashing', description: 'Addicting word puzzle game, free to play online.' },\n { domain: 'rewordgame.com', name: 'reWord', description: 'Swap words to make sense of strange sentences.' },\n { domain: 'multiplicationmaster.com', name: 'Multiplication Master', description: 'Multiplication game to train your times tables.' },\n { domain: 'bigmultiplayerchess.com', name: 'Big Multiplayer Chess', description: 'Massive chess board for 6+ players, or play 1v1.' },\n];\n\nconst faqItems = [\n {\n question: 'What is app.nz?',\n answer:\n 'app.nz is an AI agent cloud: run autonomous coding agents on your repos, route models through one OpenAI-compatible API, deploy apps and workers, and search the web and papers from a single account.',\n },\n {\n question: 'How do cloud coding agents work?',\n answer:\n 'Describe a task in plain English and point the agent at a repo. It creates a branch, writes code, runs checks, opens a pull request, and can repair failing CI or capture UI screenshots with VisualBench before you merge.',\n },\n {\n question: 'Can I use my existing OpenAI client?',\n answer:\n 'Yes. Point your SDK or HTTP client at the app.nz gateway with an API key. Use app/auto for automatic model routing or pin a specific provider model when you need to.',\n },\n {\n question: 'What does pricing look like?',\n answer:\n 'Prepaid credits cover agents, deploys, gateway usage, search, and GPU time. Optional Pro, Ultra, and Max plans bundle monthly credits, reserved agent machines, and quotas. See Pricing for current tiers.',\n },\n {\n question: 'Do I get a public URL for my app?',\n answer:\n 'Every deploy can use a free app.nz subdomain with HTTPS, plus branch and task preview URLs. You can add a custom domain when you are ready.',\n },\n];\n\nexport const PlatformHome: React.FC = () => {\n return (\n <div className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative min-h-screen overflow-hidden border-b border-white/10 px-4 pb-12 pt-20 sm:px-8 lg:px-12\">\n <HeroMeshCanvas />\n\n <div className=\"relative mx-auto max-w-[1800px]\">\n <div className=\"hero-content flex flex-col items-center pt-10 text-center lg:pt-14\">\n <div className=\"mb-5 inline-flex flex-wrap items-center justify-center gap-x-1.5 gap-y-1 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.18em] text-white/58\">\n <Zap size={13} className=\"text-white\" />\n {heroBadgeLinks.map((link, i) => (\n <React.Fragment key={link.href}>\n {i > 0 && <span className=\"text-white/25\">·</span>}\n <a href={link.href} className=\"transition-colors hover:text-white\">\n {link.label}\n </a>\n </React.Fragment>\n ))}\n </div>\n <h1 className=\"max-w-[15ch] font-display text-[2.6rem] font-bold leading-[1] tracking-tight text-white sm:text-6xl sm:leading-[0.94] lg:text-[4.75rem]\">\n The AI agent cloud for shipping software.\n </h1>\n <p className=\"mt-5 max-w-[44rem] text-base leading-7 text-white/70 sm:text-lg sm:leading-8\">\n Start with a repo task. app.nz runs the coding agent, proves the change with tests and visual checks, opens the PR, then hosts the app, worker, API, or Cog endpoint from the same account.\n </p>\n <div className=\"mt-7 flex flex-col gap-3 sm:flex-row\">\n <a\n href=\"/signup\"\n className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-5 text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n Start building <ArrowRight size={17} />\n </a>\n <a\n href=\"#product\"\n className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-5 text-sm font-bold text-white transition-colors hover:bg-white hover:text-black\"\n >\n Explore platform <ArrowUpRight size={17} />\n </a>\n </div>\n <div className=\"mt-7 flex flex-wrap items-center justify-center gap-2 text-[11px] font-semibold text-white/64\">\n {heroPillars.map(({ icon: Icon, label, href }) => {\n const external = href.startsWith('http');\n return (\n <a\n key={label}\n href={href}\n {...(external ? { target: '_blank', rel: 'noreferrer' } : {})}\n className=\"inline-flex items-center gap-1.5 rounded-full border border-white/10 bg-white/[0.03] px-3 py-1.5 transition-colors hover:border-white/25 hover:bg-white/[0.08] hover:text-white\"\n >\n <Icon size={13} className=\"text-white/72\" />\n {label}\n </a>\n );\n })}\n </div>\n\n <a\n href=\"/animflow\"\n className=\"mt-8 inline-flex items-center gap-2 text-sm font-semibold text-cyan-300 transition-colors hover:text-cyan-200\"\n >\n AnimFlow studio — keyframes, bones, mocap & VRM <ArrowRight size={15} />\n </a>\n </div>\n\n <div id=\"product\" className=\"mt-12 grid grid-cols-1 gap-3 text-left sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\">\n {productCards.map((card) => (\n <ProductTile key={card.title} card={card} />\n ))}\n </div>\n </div>\n </section>\n\n <section id=\"art-playground\" className=\"border-b border-white/10 bg-[#030404] px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1800px]\">\n <div className=\"mb-8 grid gap-6 lg:grid-cols-[0.82fr_1.18fr] lg:items-end\">\n <div>\n <p className=\"inline-flex items-center gap-2 text-xs font-bold uppercase tracking-[0.22em] text-amber-200\">\n <Palette size={15} /> Live Art Playground\n </p>\n <h2 className=\"mt-3 max-w-4xl font-display text-3xl font-bold leading-tight tracking-tight sm:text-5xl\">\n Image, video, 3D generation with all the best providers.\n </h2>\n </div>\n <div>\n <p className=\"max-w-3xl text-base leading-8 text-white/72\">\n app.nz brings creative model tools into the same account as agents and deploys: generate images,\n launch video jobs, turn references into 3D assets, browse prompt art, and route across the full provider catalogue.\n </p>\n <div className=\"mt-5 flex flex-col gap-3 sm:flex-row\">\n <a\n href=\"/gateway#playground\"\n className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg bg-sky-400 px-4 text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <Play size={16} /> Open playground\n </a>\n <a\n href=\"/models?q=art%20generation\"\n className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-4 text-sm font-bold text-white transition-colors hover:bg-white hover:text-black\"\n >\n Browse Art Models <ArrowRight size={16} />\n </a>\n <a\n href=\"/art\"\n className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-4 text-sm font-bold text-white/82 transition-colors hover:text-white\"\n >\n Browse Art <ArrowUpRight size={16} />\n </a>\n </div>\n </div>\n </div>\n\n <div className=\"grid gap-3 lg:grid-cols-[1.05fr_0.95fr]\">\n <div className=\"grid gap-3 sm:grid-cols-2 xl:grid-cols-3\">\n {mediaCapabilities.map((capability) => (\n <MediaCapabilityTile key={capability.title} capability={capability} />\n ))}\n </div>\n\n <div className=\"grid gap-3 sm:grid-cols-2\">\n {artShowcase.map((item) => (\n <ArtShowcaseCard key={item.title} item={item} />\n ))}\n </div>\n </div>\n\n <div className=\"mt-6 border-t border-white/10 pt-6\">\n <div className=\"mb-3 flex flex-wrap items-center justify-between gap-3\">\n <p className=\"text-xs font-bold uppercase tracking-[0.2em] text-white/52\">app.nz provider coverage</p>\n <a href=\"/gateway#providers\" className=\"inline-flex items-center gap-1.5 text-sm font-semibold text-white/60 transition-colors hover:text-white\">\n Explore providers <ArrowRight size={15} />\n </a>\n </div>\n <div className=\"flex flex-wrap gap-2\">\n {providerBadges.map((provider) => (\n <a\n key={provider.provider}\n href={`/models?provider=${encodeURIComponent(provider.provider)}`}\n className=\"rounded-full border border-white/10 bg-white/[0.035] px-3 py-1.5 text-xs font-semibold text-white/64 transition-colors hover:border-white/25 hover:bg-white/[0.07] hover:text-white\"\n >\n {provider.label}\n </a>\n ))}\n </div>\n </div>\n </div>\n </section>\n\n <section id=\"install\" className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1800px]\">\n <div className=\"mb-8 text-center\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-white/70\">Desktop and CLI</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Open repos locally, start agents, and route models from your terminal.</h2>\n <p className=\"mx-auto mt-4 max-w-xl text-base leading-7 text-white/56\">\n The <code className=\"rounded bg-white/[0.06] px-1.5 py-0.5 font-mono text-sm text-white\">app</code> binary installs the CLI and desktop launcher, registers <code className=\"rounded bg-white/[0.06] px-1.5 py-0.5 font-mono text-sm text-white\">appnz://</code> deep links, runs agents, builds images, ships deploys, and calls the model gateway.\n </p>\n <div className=\"mt-7 flex justify-center\">\n <InstallCommand />\n </div>\n <p className=\"mt-3 text-xs text-white/55\">Native installers: signed macOS DMG, Windows NSIS EXE, Linux DEB, and AppImage.</p>\n </div>\n\n <div className=\"mx-auto mb-8 max-w-4xl\">\n <TerminalCast src=\"/casts/cli-deploy-game.cast\" title=\"app — build and ship a game\" rows={19} />\n <p className=\"mt-2.5 text-center text-xs text-white/48\">\n Real recorded session, sped up: a cloud agent writes a game, <code className=\"font-mono text-white/65\">app apps deploy</code> ships it to{' '}\n <a href=\"https://neon-snake.app.nz/\" target=\"_blank\" rel=\"noreferrer\" className=\"text-cyan-300/80 underline decoration-cyan-300/30 hover:text-cyan-200\">neon-snake.app.nz</a>.\n {' '}<a href=\"/cli\" className=\"text-white/70 underline decoration-white/30 hover:text-white\">Full command reference →</a>\n </p>\n </div>\n\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\">\n {terminalCards.map((card) => (\n <TerminalCard key={card.title} {...card} />\n ))}\n </div>\n </div>\n </section>\n\n <section id=\"agents\" className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto grid max-w-[1800px] gap-8 lg:grid-cols-[0.9fr_1.1fr]\">\n <div>\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-white/70\">Cloud coding agents</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">\n Autonomous agents that code in your repos and ship through CI.\n </h2>\n <p className=\"mt-5 text-base leading-8 text-white/72\">\n Hand off a task in plain English. Agents branch, build, test, open pull requests, and fix red CI. You see the plan, logs, changed files, costs, and review link before anything merges.\n </p>\n </div>\n\n <div className=\"grid gap-3 sm:grid-cols-2\">\n <AgentPanel href=\"/agent\" icon={Bot} title=\"Plan and implement\" body=\"Each agent gets a branch, sandboxed terminal, full repo context, and tools to iterate until the change is ready.\" />\n <AgentPanel href=\"/security\" icon={ShieldCheck} title=\"Prove it before merge\" body=\"Tests, lint, security checks, and reviewer passes all run before a PR lands.\" />\n <AgentPanel href=\"/visualbench\" icon={MonitorCog} title=\"VisualBench proof\" body=\"Agents screenshot the UI, compare the result, and fix their own work until the interface matches what you asked for.\" />\n <AgentPanel href=\"/ci\" icon={Activity} title=\"Repair CI automatically\" body=\"When checks fail, agents read logs, patch the regression, and rerun jobs without you copying errors by hand.\" />\n </div>\n </div>\n </section>\n\n <section id=\"research\" className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto grid max-w-[1800px] gap-8 lg:grid-cols-[0.86fr_1.14fr]\">\n <div>\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-white/70\">Research for builders</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">\n Chat, live web search, papers, and deep research in one place.\n </h2>\n <p className=\"mt-5 text-base leading-8 text-white/72\">\n Ask a question, attach files, pull live web results, run multi-step research, or search papers, then feed the answer into your next agent task. Every source stays in your account.\n </p>\n <div className=\"mt-6 flex flex-wrap gap-3\">\n <a href=\"/papers\" className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg bg-sky-400 px-4 text-sm font-bold text-black transition-colors hover:bg-sky-300\">\n <BookOpen size={16} /> Search papers free\n </a>\n <a href=\"/deep-research\" className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-4 text-sm font-bold text-white transition-colors hover:bg-white hover:text-black\">\n Open deep research <ArrowRight size={16} />\n </a>\n </div>\n </div>\n\n <div className=\"rounded-2xl border border-white/10 bg-[#060606] p-4 shadow-2xl shadow-black/60\">\n <div className=\"mb-4 flex flex-wrap items-center justify-between gap-3 border-b border-white/10 pb-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex h-10 w-10 items-center justify-center rounded-lg border border-white/10 bg-white/[0.04]\">\n <MessageSquare size={19} className=\"text-white/70\" />\n </div>\n <div>\n <div className=\"font-display text-lg font-bold\">Research Chat</div>\n <div className=\"text-xs text-white/55\">web + papers + files + model routing</div>\n </div>\n </div>\n <div className=\"rounded-full border border-white/10 px-3 py-1 text-[10px] font-bold uppercase tracking-[0.16em] text-white/46\">\n one workspace\n </div>\n </div>\n\n <div className=\"grid gap-3 sm:grid-cols-2\">\n {researchModes.map((item) => (\n <a\n key={item.mode}\n href={item.href}\n className={`group rounded-xl border p-4 transition-colors hover:border-white/25 hover:bg-white/[0.07] ${\n item.mode === 'Papers' ? 'border-sky-300/20 bg-sky-400/[0.07]' : 'border-white/10 bg-white/[0.04]'\n }`}\n >\n <div className=\"flex items-center justify-between gap-3\">\n <h3 className=\"font-display text-base font-bold\">{item.mode}</h3>\n <ArrowRight size={15} className=\"text-white/35 transition-transform group-hover:translate-x-0.5 group-hover:text-white\" />\n </div>\n <p className=\"mt-2 text-sm leading-6 text-white/64\">{item.detail}</p>\n </a>\n ))}\n </div>\n\n <div className=\"mt-3 rounded-xl border border-white/10 bg-black p-4 font-mono text-xs text-white/58\">\n <div className=\"text-white/36\">POST /v1/search</div>\n <div className=\"mt-2 text-white\">{'{\"provider\":\"exa\",\"type\":\"deep\",\"query\":\"compare hosted model pricing with citations\"}'}</div>\n <div className=\"mt-3 text-white/36\">POST /api/research/start</div>\n <div className=\"mt-2 text-white\">{'{\"message\":\"research model hosting options\",\"web_search\":true,\"papers\":true}'}</div>\n </div>\n </div>\n </div>\n </section>\n\n <section id=\"models\" className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1800px]\">\n <div className=\"mb-8 grid gap-6 lg:grid-cols-[0.82fr_1.18fr] lg:items-end\">\n <div>\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-white/70\">Models</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">\n One gateway. Route providers or host your own weights.\n </h2>\n </div>\n <p className=\"text-base leading-8 text-white/72\">\n Point any OpenAI-compatible client at app.nz and let <code className=\"text-white/80\">app/auto</code> pick the model, or pin a provider. Use app.nz routes for chat, images, video, music, speech, transcription, embeddings, and 3D; host custom weights, LoRAs, and datasets when you need your own inference lane.\n </p>\n </div>\n\n <div className=\"grid gap-3 md:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4\">\n {modelLanes.map((lane) => (\n <div key={lane.model} className=\"group flex flex-col rounded-xl border border-white/10 bg-white/[0.04] p-5 transition-colors hover:border-white/24 hover:bg-white/[0.055]\">\n <a href={lane.href} className=\"mb-5 flex items-center justify-between gap-3\">\n <Code2 size={20} className=\"text-white/64\" />\n <span className=\"rounded-full border border-white/10 px-2 py-1 text-[10px] font-bold uppercase tracking-[0.16em] text-white/55\">\n {lane.route}\n </span>\n </a>\n <a href={lane.href} className=\"font-mono text-sm font-bold text-white hover:text-sky-300\">{lane.model}</a>\n {lane.tools ? (\n <div className=\"mt-3 flex min-h-12 flex-wrap content-start gap-1.5\">\n {lane.tools.map((tool) => (\n <a\n key={tool.label}\n href={tool.href}\n className=\"rounded-md border border-white/10 bg-black/30 px-2 py-1 text-xs text-white/70 transition-colors hover:border-white/30 hover:text-white\"\n >\n {tool.label}\n </a>\n ))}\n </div>\n ) : (\n <p className=\"mt-3 min-h-12 text-sm leading-6 text-white/64\">{lane.use}</p>\n )}\n <div className=\"mt-4 flex items-center justify-between border-t border-white/10 pt-4 text-xs text-white/55\">\n <span>{lane.price}</span>\n <a href={lane.href} className=\"inline-flex items-center gap-1 text-white/55 hover:text-white\">\n Open <ArrowRight size={13} className=\"transition-transform group-hover:translate-x-0.5\" />\n </a>\n </div>\n </div>\n ))}\n </div>\n\n <div className=\"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n {gatewayPrices.map((item) => (\n <a key={item.label} href={item.href} className=\"group rounded-xl border border-white/10 bg-white/[0.035] p-4 transition-colors hover:border-white/25 hover:bg-white/[0.06]\">\n <div className=\"flex items-center justify-between gap-3 text-xs font-bold uppercase tracking-[0.18em] text-white/55\">\n {item.label}\n <ArrowRight size={13} className=\"transition-transform group-hover:translate-x-0.5 group-hover:text-white\" />\n </div>\n <div className=\"mt-2 font-mono text-sm text-white/72\">{item.price}</div>\n </a>\n ))}\n </div>\n </div>\n </section>\n\n <section id=\"hosting\" className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1800px]\">\n <div className=\"mb-8 flex flex-col justify-between gap-5 md:flex-row md:items-end\">\n <div>\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-white/70\">Hosting</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">\n Deploy AI apps, APIs, workers, and model endpoints to the cloud.\n </h2>\n <p className=\"mt-4 max-w-2xl text-base leading-8 text-white/72\">\n Use the browser Site Builder for static pages, Build Studio for containers, Cog Studio for GPU inference, and deploys for long-running apps. Each path has logs, status, and a public URL.\n </p>\n </div>\n <a href=\"/signup\" className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg bg-sky-400 px-4 text-sm font-bold text-black hover:bg-sky-300\">\n Create a project <ArrowRight size={17} />\n </a>\n </div>\n\n <div className=\"grid gap-3 md:grid-cols-2 lg:grid-cols-4\">\n {hostedServices.map((service) => {\n const Icon = service.icon;\n return (\n <a key={service.label} href={service.href} className=\"group rounded-xl border border-white/10 bg-white/[0.04] p-5 transition-colors hover:border-white/25 hover:bg-white/[0.06]\">\n <div className=\"flex items-center justify-between gap-3\">\n <Icon size={24} className=\"text-white/68\" />\n <ArrowRight size={15} className=\"text-white/35 transition-transform group-hover:translate-x-0.5 group-hover:text-white\" />\n </div>\n <h3 className=\"mt-5 font-display text-lg font-bold\">{service.label}</h3>\n <p className=\"mt-3 text-sm leading-6 text-white/64\">{service.detail}</p>\n </a>\n );\n })}\n </div>\n </div>\n </section>\n\n <section id=\"repos\" className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto grid max-w-[1800px] gap-8 lg:grid-cols-[0.8fr_1.2fr]\">\n <div>\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-white/70\">Repos at the center</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Your code, agents, and deploys share one repo.</h2>\n <p className=\"mt-5 text-base leading-8 text-white/72\">\n Push once. Agents branch, open PRs, and ship previews. Every repo gets HTTPS on app.nz, with branch URLs to share before merge.\n </p>\n </div>\n <div className=\"rounded-xl border border-white/10 bg-white/[0.04] p-4\">\n {repoRows.map((row) => (\n <div key={row.repo} className=\"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-b border-white/10 py-4 last:border-b-0\">\n <div className=\"min-w-0\">\n <a href={row.href} className=\"group flex items-center gap-2 truncate font-mono text-sm text-white transition-colors hover:text-sky-300\">\n <span className=\"truncate\">{row.repo}</span>\n <ArrowUpRight size={13} className=\"shrink-0 opacity-0 transition-opacity group-hover:opacity-100\" />\n </a>\n <div className=\"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-white/55\">\n <span className=\"inline-flex items-center gap-1.5\"><GitBranch size={13} />{row.branch}</span>\n <a href={row.ci} {...(row.ci.startsWith('http') ? { target: '_blank', rel: 'noreferrer' } : {})} className=\"inline-flex items-center gap-1 text-white/55 transition-colors hover:text-sky-300\"><Hammer size={12} /> CI</a>\n {row.live && <a href={row.live} target=\"_blank\" rel=\"noreferrer\" className=\"inline-flex items-center gap-1 text-white/55 transition-colors hover:text-sky-300\"><Globe size={12} /> Live</a>}\n </div>\n </div>\n <div className=\"text-right\">\n <div className=\"rounded-full border border-white/10 px-2 py-1 text-[10px] font-bold uppercase tracking-[0.14em] text-white/58\">{row.status}</div>\n <div className=\"mt-1 text-xs text-white/55\">{row.time}</div>\n </div>\n </div>\n ))}\n </div>\n </div>\n </section>\n\n <section id=\"community\" className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1800px]\">\n <div className=\"mb-8 max-w-2xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-white/70\">Community</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Real products running on app.nz.</h2>\n <p className=\"mt-4 text-base leading-8 text-white/72\">\n Live sites built and hosted on the same platform, using the same repos, agents, model gateway, and credit balance you get.\n </p>\n </div>\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5\">\n {communityApps.map((app) => {\n const Icon = app.icon;\n const external = app.href.startsWith('http');\n return (\n <a\n key={app.title}\n href={app.href}\n target={external ? '_blank' : undefined}\n rel={external ? 'noreferrer' : undefined}\n className=\"group flex flex-col rounded-xl border border-white/10 bg-white/[0.04] p-5 transition-colors hover:border-white/24 hover:bg-white/[0.055]\"\n >\n <div className=\"flex items-center justify-between\">\n <Icon size={24} className=\"text-white/68\" />\n <ArrowUpRight size={15} className=\"text-white/40 transition-colors group-hover:text-white\" />\n </div>\n <h3 className=\"mt-5 font-mono text-sm font-bold text-white\">{app.title}</h3>\n <p className=\"mt-3 text-sm leading-6 text-white/64\">{app.description}</p>\n </a>\n );\n })}\n </div>\n </div>\n </section>\n\n <section id=\"portfolio\" aria-labelledby=\"portfolio-heading\" className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1800px]\">\n <div className=\"mb-8 max-w-2xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-white/70\">Portfolio</p>\n <h2 id=\"portfolio-heading\" className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Products from the app.nz team.</h2>\n <p className=\"mt-4 text-base leading-8 text-white/72\">\n AI apps, developer tools, and games we build and run. Try any of them free.\n </p>\n </div>\n <ul className=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\">\n {portfolioSites.map((site) => (\n <li key={site.domain}>\n <a\n href={`https://${site.domain}`}\n target=\"_blank\"\n rel=\"noopener\"\n className=\"group block overflow-hidden rounded-xl border border-white/10 bg-white/[0.04] transition-colors hover:border-white/30\"\n >\n <img\n src={`/assets/portfolio/${site.domain}.webp?v=2`}\n alt={`${site.name} homepage screenshot`}\n width={480}\n height={300}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"aspect-[8/5] w-full border-b border-white/10 bg-white/5 object-cover object-top\"\n />\n <div className=\"p-4\">\n <div className=\"flex items-center justify-between gap-2\">\n <h3 className=\"font-display text-base font-bold text-white\">{site.name}</h3>\n <ArrowUpRight size={15} aria-hidden=\"true\" className=\"text-white/60 transition-colors group-hover:text-white\" />\n </div>\n <p className=\"mt-1 font-mono text-xs text-white/65\">{site.domain}</p>\n <p className=\"mt-2 text-sm leading-6 text-white/72\">{site.description}</p>\n </div>\n </a>\n </li>\n ))}\n </ul>\n </div>\n </section>\n\n <section id=\"faq\" className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1800px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-white/70\">FAQ</p>\n <h2 id=\"faq-heading\" className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">\n Common questions about the app.nz agent cloud\n </h2>\n <div className=\"mt-8 grid gap-3 lg:grid-cols-2\">\n {faqItems.map((item) => (\n <article key={item.question} className=\"rounded-xl border border-white/10 bg-white/[0.04] p-5\">\n <h3 className=\"font-display text-lg font-bold text-white\">{item.question}</h3>\n <p className=\"mt-3 text-sm leading-7 text-white/64\">{item.answer}</p>\n </article>\n ))}\n </div>\n </div>\n </section>\n\n <section className=\"relative overflow-hidden border-b border-white/10 px-4 py-16 text-center sm:px-8 sm:py-28 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(255,255,255,0.08),transparent_55%)]\" />\n <div className=\"relative mx-auto max-w-[1800px]\">\n <h2 className=\"mx-auto max-w-3xl font-display text-3xl font-bold tracking-tight sm:text-5xl\">\n Ship your next AI app today.\n </h2>\n <p className=\"mx-auto mt-5 max-w-xl text-base leading-8 text-white/72\">\n Agents, repos, deploys, models, and research on one account. Start free, pay as you grow.\n </p>\n <div className=\"mt-9 flex flex-col items-center justify-center gap-3 sm:flex-row\">\n <a\n href=\"/signup\"\n className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n Start building <ArrowRight size={17} />\n </a>\n <a\n href=\"/pricing\"\n className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition-colors hover:bg-white hover:text-black\"\n >\n See pricing <ArrowUpRight size={17} />\n </a>\n </div>\n </div>\n </section>\n </div>\n );\n};\n\nfunction HeroMeshCanvas() {\n const canvasRef = React.useRef<HTMLCanvasElement | null>(null);\n\n React.useEffect(() => {\n const canvas = canvasRef.current;\n if (!canvas) return;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n const motionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n\n let frame = 0;\n let width = 0;\n let height = 0;\n let dpr = 1;\n\n const resize = () => {\n dpr = Math.min(window.devicePixelRatio || 1, 2);\n width = canvas.offsetWidth;\n height = canvas.offsetHeight;\n canvas.width = Math.floor(width * dpr);\n canvas.height = Math.floor(height * dpr);\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n if (motionQuery.matches) draw(0, false);\n };\n\n const draw = (time: number, animate = true) => {\n const t = time * 0.00012;\n ctx.clearRect(0, 0, width, height);\n\n const centerX = width * 0.5;\n const horizonY = height * 0.4;\n const spacing = Math.max(42, Math.min(width, height) / 12);\n const halfColumns = Math.ceil(width / spacing) + 9;\n const rows = 24;\n\n ctx.save();\n ctx.translate(0, height * 0.02);\n ctx.rotate(-0.03);\n\n const drawPoint = (x: number, z: number) => {\n const depth = 1 / (1 + z * 0.075);\n const wave = Math.sin(x * 0.015 + z * 0.4 + t * 7) * 15;\n const drift = Math.cos(z * 0.24 + t * 5) * 26;\n return {\n x: centerX + (x + drift) * depth * 1.55,\n y: horizonY + z * spacing * depth * 0.62 + wave * depth,\n };\n };\n\n const strokeMesh = (path: Array<{ x: number; y: number }>, offset: number) => {\n if (path.length < 2) return;\n const shimmer = (Math.sin(t * 11 + offset) + 1) / 2;\n ctx.beginPath();\n path.forEach((point, index) => {\n if (index === 0) ctx.moveTo(point.x, point.y);\n else ctx.lineTo(point.x, point.y);\n });\n ctx.strokeStyle = `rgba(255,255,255,${0.1 + shimmer * 0.16})`;\n ctx.lineWidth = 1;\n ctx.stroke();\n };\n\n for (let row = 0; row < rows; row++) {\n const z = row + 0.6;\n const path = [];\n for (let col = -halfColumns; col <= halfColumns; col++) path.push(drawPoint(col * spacing, z));\n strokeMesh(path, row * 0.41);\n }\n for (let col = -halfColumns; col <= halfColumns; col++) {\n const x = col * spacing;\n const path = [];\n for (let row = 0; row < rows; row++) path.push(drawPoint(x, row + 0.6));\n strokeMesh(path, col * 0.28);\n }\n\n ctx.restore();\n if (animate && !motionQuery.matches) frame = requestAnimationFrame((nextTime) => draw(nextTime, true));\n };\n\n const handleMotionChange = () => {\n cancelAnimationFrame(frame);\n frame = 0;\n draw(0, !motionQuery.matches);\n };\n\n resize();\n window.addEventListener('resize', resize);\n motionQuery.addEventListener('change', handleMotionChange);\n draw(0, !motionQuery.matches);\n return () => {\n window.removeEventListener('resize', resize);\n motionQuery.removeEventListener('change', handleMotionChange);\n cancelAnimationFrame(frame);\n };\n }, []);\n\n return (\n <div className=\"pointer-events-none absolute inset-0\">\n <div className=\"absolute inset-0 bg-[radial-gradient(circle_at_50%_42%,rgba(255,255,255,0.07),transparent_46%),linear-gradient(180deg,#070707_0%,#000_82%)]\" />\n <canvas\n ref={canvasRef}\n className=\"absolute inset-x-0 top-0 h-full w-full opacity-95 [mask-image:linear-gradient(to_bottom,black_0%,black_74%,transparent_100%)]\"\n aria-hidden=\"true\"\n />\n <div className=\"absolute inset-0 bg-[radial-gradient(ellipse_52%_46%_at_50%_40%,#000_0%,rgba(0,0,0,0.94)_30%,rgba(0,0,0,0.6)_56%,transparent_78%)]\" />\n <div className=\"absolute inset-x-0 bottom-0 h-40 bg-gradient-to-t from-black to-transparent\" />\n </div>\n );\n}\n\nfunction ProductTile({ card }: { card: ProductCard }) {\n const Icon = card.icon;\n const isExternal = card.href.startsWith('http');\n return (\n <a\n href={card.href}\n target={isExternal ? '_blank' : undefined}\n rel={isExternal ? 'noreferrer' : undefined}\n className=\"group grid min-h-[126px] grid-cols-[44px_minmax(0,1fr)_18px] gap-4 rounded-xl border border-white/10 bg-black/30 p-4 backdrop-blur-xl transition-colors hover:border-white/28 hover:bg-black/40\"\n >\n <div className=\"flex h-11 w-11 items-center justify-center rounded-lg border border-white/10 bg-black\">\n <Icon size={22} className=\"text-white/70\" />\n </div>\n <div className=\"min-w-0\">\n <div className=\"text-[10px] font-bold uppercase tracking-[0.18em] text-white/55\">{card.eyebrow}</div>\n <h2 className=\"mt-1 font-display text-lg font-bold text-white\">{card.title}</h2>\n <p className=\"mt-2 line-clamp-2 text-sm leading-5 text-white/64\">{card.description}</p>\n </div>\n <ArrowRight size={17} className=\"mt-1 text-white/55 transition-transform group-hover:translate-x-0.5 group-hover:text-white\" />\n </a>\n );\n}\n\nfunction MediaCapabilityTile({ capability }: { capability: MediaCapability }) {\n const Icon = capability.icon;\n const isExternal = capability.href.startsWith('http');\n return (\n <a\n href={capability.href}\n target={isExternal ? '_blank' : undefined}\n rel={isExternal ? 'noreferrer' : undefined}\n className=\"group flex min-h-[194px] flex-col rounded-lg border border-white/10 bg-white/[0.035] p-5 transition-colors hover:border-white/24 hover:bg-white/[0.055]\"\n >\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"inline-flex h-10 w-10 items-center justify-center rounded-lg border border-white/10 bg-black/70\">\n <Icon size={20} className=\"text-white/72\" />\n </span>\n <ArrowRight size={16} className=\"text-white/32 transition-transform group-hover:translate-x-0.5 group-hover:text-white\" />\n </div>\n <h3 className=\"mt-5 font-display text-lg font-bold text-white\">{capability.title}</h3>\n <div className=\"mt-2 text-[11px] font-bold uppercase tracking-[0.16em] text-amber-100/58\">{capability.label}</div>\n <p className=\"mt-3 text-sm leading-6 text-white/62\">{capability.body}</p>\n </a>\n );\n}\n\nfunction ArtShowcaseCard({ item }: { item: ArtShowcaseItem }) {\n return (\n <a href={item.href} className=\"group overflow-hidden rounded-lg border border-white/10 bg-black/60 transition-colors hover:border-white/28\">\n <div className=\"relative aspect-[4/3] overflow-hidden\">\n <img\n src={item.imageUrl}\n alt={`${item.title} generated with ${item.model}`}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.035]\"\n />\n <div className=\"absolute inset-0 bg-gradient-to-t from-black via-black/25 to-transparent\" />\n <div className=\"absolute left-3 top-3 rounded-full border border-white/15 bg-black/62 px-2.5 py-1 text-[11px] font-semibold text-white/78 backdrop-blur\">\n {item.provider}\n </div>\n <div className=\"absolute bottom-0 left-0 right-0 p-4\">\n <div className=\"text-[10px] font-bold uppercase tracking-[0.18em] text-white/48\">{item.model}</div>\n <h3 className=\"mt-1 font-display text-lg font-bold\">{item.title}</h3>\n <p className=\"mt-2 line-clamp-2 text-sm leading-5 text-white/64\">{item.prompt}</p>\n </div>\n </div>\n </a>\n );\n}\n\nfunction InstallCommand() {\n const [copied, setCopied] = React.useState(false);\n\n const onCopy = async () => {\n const ok = await copyInstallCommand();\n if (ok) {\n setCopied(true);\n window.setTimeout(() => setCopied(false), 2000);\n }\n };\n\n return (\n <div className=\"flex w-full max-w-2xl flex-col items-stretch gap-3 sm:flex-row sm:items-center\">\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={`$ ${INSTALL_COMMAND} — copy install command`}\n className=\"group flex h-14 flex-1 items-center gap-4 rounded-xl border border-white/12 bg-[#050505] px-5 font-mono text-base text-white transition-colors hover:border-white/30\"\n >\n <span className=\"text-white/55\">$</span>\n <span className=\"min-w-0 flex-1 truncate text-left\">{INSTALL_COMMAND}</span>\n {copied ? (\n <span className=\"inline-flex shrink-0 items-center gap-1.5 text-sm font-sans font-semibold text-white\">\n <CheckCircle2 size={17} /> Copied\n </span>\n ) : (\n <Copy size={18} className=\"shrink-0 text-white/55 transition-colors group-hover:text-white\" />\n )}\n </button>\n <a\n href=\"/repos/leepenkman/app-cli\"\n className=\"inline-flex h-14 shrink-0 items-center justify-center gap-2 rounded-xl border border-white/12 bg-white/[0.04] px-5 text-sm font-semibold text-white transition-colors hover:bg-white hover:text-black\"\n >\n View source <Terminal size={16} />\n </a>\n </div>\n );\n}\n\nfunction TerminalCard({ title, command, lines }: { title: string; command: string; lines: string[] }) {\n return (\n <div className=\"min-h-[174px] rounded-xl border border-white/10 bg-[#050505] p-4 font-mono text-xs\">\n <div className=\"mb-3 flex items-center justify-between gap-3\">\n <span className=\"text-white/48\">{title}</span>\n <Copy size={14} className=\"text-white/55\" />\n </div>\n <div className=\"mb-3 truncate text-white\">\n <span className=\"text-white/55\">$</span> {command.replace('$ ', '')}\n </div>\n <div className=\"space-y-1.5 text-white/52\">\n {lines.map((line) => (\n <div key={line} className=\"flex gap-2\">\n <CheckCircle2 size={13} className=\"mt-0.5 shrink-0 text-white/54\" />\n <span className=\"truncate\">{line}</span>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nfunction AgentPanel({ icon: Icon, title, body, href }: { icon: IconType; title: string; body: string; href: string }) {\n return (\n <a href={href} className=\"group rounded-xl border border-white/10 bg-white/[0.04] p-5 transition-colors hover:border-white/25 hover:bg-white/[0.06]\">\n <div className=\"flex items-center justify-between gap-3\">\n <Icon size={24} className=\"text-white/68\" />\n <ArrowRight size={15} className=\"text-white/35 transition-transform group-hover:translate-x-0.5 group-hover:text-white\" />\n </div>\n <h3 className=\"mt-5 font-display text-lg font-bold\">{title}</h3>\n <p className=\"mt-3 text-sm leading-6 text-white/64\">{body}</p>\n </a>\n );\n}\n","import { initializeApp, type FirebaseApp, getApps, getApp } from 'firebase/app'\nimport { getAuth, GithubAuthProvider, GoogleAuthProvider, type Auth } from 'firebase/auth'\n\n// app.nz (appainz) Firebase project. Identity for email/password, Google and\n// GitHub sign-in. The Go server verifies the resulting ID token and mints the\n// existing app.nz session cookie (see /api/firebase-session).\nconst firebaseConfig = {\n apiKey: 'AIzaSyBJjTjLFyVUb5Izx5fJl5wlYx3JrN-N07E',\n authDomain: 'appainz-2.firebaseapp.com',\n projectId: 'appainz-2',\n storageBucket: 'appainz-2.firebasestorage.app',\n messagingSenderId: '1065725049829',\n appId: '1:1065725049829:web:8c40cf7665d46777e88d0c',\n}\n\nlet app: FirebaseApp | undefined\nlet auth: Auth | undefined\n\n// Guard init to the browser: during SSR/prerender there is no window/IndexedDB,\n// and the AuthProvider treats a missing `auth` as \"not signed in\".\nif (typeof window !== 'undefined') {\n try {\n app = getApps().length > 0 ? getApp() : initializeApp(firebaseConfig)\n auth = getAuth(app)\n } catch (e) {\n console.warn('Firebase init failed:', e)\n }\n}\n\nexport { app, auth }\n\nexport const googleProvider = new GoogleAuthProvider()\ngoogleProvider.setCustomParameters({ prompt: 'select_account' })\n\nexport const githubProvider = new GithubAuthProvider()\ngithubProvider.addScope('read:user')\ngithubProvider.addScope('user:email')\n","// Single client-side identity surface: session user (/api/me) plus the stored\n// gateway API key ('appnz_gateway_key', same slot GatewayPlayground persists).\n// authedFetch attaches both — cookie session always, bearer key when present —\n// so every caller (playgrounds, spaces, canvas, e2e) authenticates the same way.\n// Also mirrored to window.userData for e2e and console use.\n\nexport interface UserData {\n authenticated: boolean\n user: { id: string; email?: string; name?: string; is_admin?: boolean } | null\n handle: string\n apiKey: string\n}\n\nconst GATEWAY_KEY_SLOT = 'appnz_gateway_key'\n\nlet cache: UserData | null = null\nlet inflight: Promise<UserData> | null = null\n\nexport function storedApiKey(): string {\n try {\n return localStorage.getItem(GATEWAY_KEY_SLOT) || ''\n } catch {\n return ''\n }\n}\n\nexport function setStoredApiKey(key: string): void {\n try {\n if (key) localStorage.setItem(GATEWAY_KEY_SLOT, key)\n else localStorage.removeItem(GATEWAY_KEY_SLOT)\n } catch { /* storage unavailable */ }\n if (cache) {\n cache = { ...cache, apiKey: key }\n mirror(cache)\n }\n}\n\nfunction mirror(data: UserData) {\n try {\n ;(window as any).userData = data\n } catch { /* SSR */ }\n}\n\nexport async function getUserData(force = false): Promise<UserData> {\n if (cache && !force) return cache\n if (inflight && !force) return inflight\n inflight = (async () => {\n let authenticated = false\n let user: UserData['user'] = null\n let handle = ''\n try {\n const res = await fetch('/api/me', { credentials: 'include' })\n const body = await res.json().catch(() => ({}))\n authenticated = !!body?.authenticated\n user = body?.user || null\n handle = body?.handle || ''\n } catch { /* offline — report signed out */ }\n cache = { authenticated, user, handle, apiKey: storedApiKey() }\n mirror(cache)\n inflight = null\n return cache\n })()\n return inflight\n}\n\nexport function invalidateUserData(): void {\n cache = null\n inflight = null\n}\n\n// fetch with the full identity attached: session cookie always; stored gateway\n// API key as a bearer when the caller hasn't set its own Authorization.\nexport function authedFetch(input: RequestInfo | URL, init: RequestInit = {}): Promise<Response> {\n const headers = new Headers(init.headers || {})\n const key = storedApiKey()\n if (key && !headers.has('Authorization')) headers.set('Authorization', `Bearer ${key}`)\n return fetch(input, { ...init, headers, credentials: init.credentials || 'include' })\n}\n","// Shared sanitizer for post-auth ?next= targets.\n//\n// An auth route is never a valid destination: sending a freshly signed-in user\n// to /login or /signup just re-runs the same redirect against the session they\n// now have, which is a loop. Off-origin targets are refused too, so ?next=\n// cannot be used as an open redirect.\nconst AUTH_PATHS = new Set([\n '/login',\n '/signin',\n '/sign-in',\n '/log-in',\n '/logon',\n '/signup',\n '/register',\n '/sign-up',\n '/create-account',\n '/join',\n '/forgot-password',\n '/reset-password',\n '/reset',\n]);\n\nexport function isAuthPath(pathname: string): boolean {\n return AUTH_PATHS.has((pathname || '/').replace(/\\/$/, '') || '/');\n}\n\nexport function safeNextPath(raw: string, fallback = ''): string {\n if (!raw) return fallback;\n if (typeof window === 'undefined') {\n const path = raw.split(/[?#]/)[0];\n return raw.startsWith('/') && !raw.startsWith('//') && !raw.startsWith('/\\\\') && !isAuthPath(path) ? raw : fallback;\n }\n let url: URL;\n try {\n url = new URL(raw, window.location.href);\n } catch {\n return fallback;\n }\n if (url.origin !== window.location.origin) return fallback;\n if (isAuthPath(url.pathname)) return fallback;\n return url.pathname + url.search + url.hash;\n}\n","import { createContext, useCallback, useContext, useEffect, useState, type ReactNode } from 'react'\nimport {\n type User,\n type UserCredential,\n type AuthProvider as FirebaseAuthProvider,\n browserLocalPersistence,\n browserSessionPersistence,\n confirmPasswordReset,\n createUserWithEmailAndPassword,\n fetchSignInMethodsForEmail,\n getRedirectResult,\n GithubAuthProvider,\n GoogleAuthProvider,\n linkWithCredential,\n onAuthStateChanged,\n setPersistence,\n signInWithEmailAndPassword,\n signInWithPopup,\n signInWithRedirect,\n signOut,\n} from 'firebase/auth'\nimport { auth, githubProvider, googleProvider } from './firebase'\nimport { getUserData, invalidateUserData } from './userData'\nimport { safeNextPath } from './authNext'\n\ntype AuthError = Error & { code?: string }\n\n// A redirect-based OAuth sign-in (popup-blocked fallback) bounces the whole page\n// through the provider and back. We stash the intended destination before leaving\n// so we can finish the session exchange and land the user correctly on return —\n// even on browsers where getRedirectResult() comes back null (mobile Safari, the\n// GitHub in-app browser) but onAuthStateChanged still delivers the user.\nconst REDIRECT_PENDING_KEY = 'appnz:auth:redirect-next'\nconst REDIRECT_ERROR_KEY = 'appnz:auth:redirect-error'\n\nfunction markRedirectPending(next: string) {\n try {\n sessionStorage.setItem(REDIRECT_PENDING_KEY, safeNextPath(next))\n } catch {\n // sessionStorage can throw in locked-down/incognito contexts; the redirect\n // still works, we just fall back to the ?next query param on return.\n }\n}\n\nfunction authError(message: string, code: string): AuthError {\n const err = new Error(message) as AuthError\n err.code = code\n return err\n}\n\nasync function readJSON(response: Response): Promise<Record<string, unknown>> {\n return response.json().catch(() => ({}))\n}\n\nasync function legacyPasswordAuth(endpoint: '/api/login' | '/api/register', email: string, password: string): Promise<void> {\n const response = await fetch(endpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ email, password }),\n })\n\n if (response.ok) return\n\n const body = await readJSON(response)\n const message = typeof body.error === 'string' ? body.error : 'Authentication failed'\n if (response.status === 401) throw authError(message, 'legacy/invalid-credentials')\n if (response.status === 409) throw authError(message, 'legacy/email-already-in-use')\n throw authError(message, `legacy/${response.status}`)\n}\n\nfunction canUseLegacyPasswordFallback(err: unknown): boolean {\n const code = (err as { code?: string })?.code || ''\n return (\n code === 'auth/operation-not-allowed' ||\n code === 'auth/admin-restricted-operation' ||\n code === 'auth/configuration-not-found' ||\n code === 'auth/auth-domain-config-required' ||\n code === 'auth/unavailable' ||\n // Firebase unreachable (offline dev boxes, locked-down CI/e2e networks):\n // the local password endpoints still work, so don't strand the user.\n code === 'auth/network-request-failed' ||\n code === 'auth/internal-error' ||\n code === 'firebase-session/503'\n )\n}\n\n// Trade a Firebase ID token for an app.nz server session cookie. Every sign-in\n// path (email, Google, GitHub) funnels through here so the existing cookie-based\n// endpoints (/api/me, billing, API keys) keep working unchanged.\nasync function exchangeSession(user: User): Promise<void> {\n const idToken = await user.getIdToken()\n const res = await fetch('/api/firebase-session', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ idToken }),\n })\n if (!res.ok) {\n const body = await readJSON(res)\n const err = new Error(typeof body.error === 'string' ? body.error : 'Could not establish your session') as AuthError\n err.code = `firebase-session/${res.status}`\n throw err\n }\n}\n\n// Firebase local persistence outlives the server session cookie (expiry,\n// cleared cookies, session-store loss), leaving the UI \"signed in\" while API\n// calls 401. On load, verify the cookie and silently re-mint it if stale.\nasync function ensureServerSession(user: User): Promise<void> {\n try {\n const res = await fetch('/api/me', { credentials: 'include' })\n const body = await readJSON(res)\n if (!body?.authenticated) await exchangeSession(user)\n } catch {\n // Offline or Firebase unreachable: leave things as they are.\n }\n invalidateUserData()\n void getUserData(true)\n}\n\n// Firebase enforces one-account-per-email by default. If a user signs in with a\n// provider whose email already belongs to a different provider, link the new\n// credential onto the existing account so Google + GitHub merge into one user.\nasync function handleAccountExistsConflict(\n attempted: 'github' | 'google',\n err: { customData?: { email?: string } },\n): Promise<UserCredential> {\n if (!auth) throw err\n const email = err?.customData?.email\n const pendingCred =\n attempted === 'github'\n ? GithubAuthProvider.credentialFromError(err as never)\n : GoogleAuthProvider.credentialFromError(err as never)\n if (!email || !pendingCred) throw err\n\n let methods: string[] = []\n try {\n methods = await fetchSignInMethodsForEmail(auth, email)\n } catch {\n // Email-enumeration protection can hide methods; fall through to the\n // deterministic guess below (only Google + GitHub are configured).\n }\n\n if (methods.includes('password')) {\n const e = new Error(\n `An account already exists for ${email} with an email/password login. Sign in with your email and password first.`,\n ) as Error & { code?: string }\n e.code = 'auth/account-exists-with-different-credential'\n throw e\n }\n\n let existing: FirebaseAuthProvider\n if (methods.includes(GoogleAuthProvider.PROVIDER_ID)) existing = googleProvider\n else if (methods.includes(GithubAuthProvider.PROVIDER_ID)) existing = githubProvider\n else existing = attempted === 'github' ? googleProvider : githubProvider\n\n const result = await signInWithPopup(auth, existing)\n return linkWithCredential(result.user, pendingCred)\n}\n\ninterface AuthContextType {\n user: User | null\n loading: boolean\n signInWithGoogle: () => Promise<void>\n signInWithGithub: () => Promise<void>\n signInWithEmail: (email: string, password: string) => Promise<void>\n signUpWithEmail: (email: string, password: string) => Promise<void>\n sendPasswordReset: (email: string) => Promise<void>\n confirmReset: (oobCode: string, newPassword: string) => Promise<void>\n logout: () => Promise<void>\n getIdToken: () => Promise<string | null>\n}\n\nconst AuthContext = createContext<AuthContextType | null>(null)\n\nexport function AuthProvider({ children }: { children: ReactNode }) {\n const [user, setUser] = useState<User | null>(null)\n const [loading, setLoading] = useState(true)\n\n useEffect(() => {\n const a = auth\n if (!a) {\n setLoading(false)\n return\n }\n setPersistence(a, browserLocalPersistence).catch(() => {\n setPersistence(a, browserSessionPersistence).catch(() => {})\n })\n\n // Finish a redirect-based sign-in (the popup-blocked fallback below): trade the\n // returned Firebase user for the server session cookie, then send them on to\n // where the popup path would have. Guarded so it runs at most once and only\n // when a redirect was actually pending — a normal authenticated page load must\n // not hijack navigation.\n let finishing = false\n const finishRedirect = async (u: User) => {\n // Gate strictly on the flag set right before signInWithRedirect. It lives in\n // first-party sessionStorage (which works even on the browsers where\n // getRedirectResult returns null), so it reliably marks a redirect return\n // without hijacking navigation on a normal already-signed-in page load.\n let pending: string | null = null\n try {\n pending = sessionStorage.getItem(REDIRECT_PENDING_KEY)\n } catch {\n pending = null\n }\n if (pending === null || finishing) return\n finishing = true\n try { sessionStorage.removeItem(REDIRECT_PENDING_KEY) } catch {}\n try {\n await exchangeSession(u)\n window.location.href = pending || '/account'\n } catch (err) {\n finishing = false\n const message = (err as Error)?.message || 'Could not finish sign-in. Please try again.'\n try { sessionStorage.setItem(REDIRECT_ERROR_KEY, message) } catch {}\n }\n }\n\n // getRedirectResult resolves the pending credential on most browsers (and runs\n // account-linking). On mobile Safari / the GitHub in-app browser it can resolve\n // null even on a successful return, so onAuthStateChanged below is the safety\n // net: it still delivers the user, and finishRedirect only acts when a redirect\n // was actually pending.\n getRedirectResult(a)\n .then((result) => {\n if (result?.user) return finishRedirect(result.user)\n })\n .catch(() => {})\n\n let ensured = false\n return onAuthStateChanged(a, (next) => {\n setUser(next)\n setLoading(false)\n if (next) {\n void finishRedirect(next)\n if (!ensured && !finishing) {\n ensured = true\n void ensureServerSession(next)\n }\n }\n })\n }, [])\n\n const afterSignIn = useCallback(async (cred: UserCredential) => {\n await exchangeSession(cred.user)\n }, [])\n\n const signInWithProvider = useCallback(\n async (provider: FirebaseAuthProvider, name: 'github' | 'google') => {\n if (!auth) throw new Error('Sign-in is unavailable right now.')\n try {\n const result = await signInWithPopup(auth, provider)\n await afterSignIn(result)\n } catch (err: unknown) {\n const code = (err as { code?: string })?.code || ''\n if (code === 'auth/account-exists-with-different-credential') {\n const linked = await handleAccountExistsConflict(name, err as { customData?: { email?: string } })\n await afterSignIn(linked)\n return\n }\n if (code === 'auth/popup-blocked' || code === 'auth/operation-not-supported-in-this-environment') {\n // Popups are blocked (common on mobile Safari / strict browsers): fall\n // back to a full-page redirect. On return, the AuthProvider effect\n // finishes the session exchange and navigates to this stored target.\n const params = new URLSearchParams(window.location.search)\n markRedirectPending(params.get('next') || '')\n await signInWithRedirect(auth, provider)\n return\n }\n if (code === 'auth/popup-closed-by-user' || code === 'auth/cancelled-popup-request') {\n return // user dismissed; not an error\n }\n throw err\n }\n },\n [afterSignIn],\n )\n\n const signInWithGoogle = useCallback(() => signInWithProvider(googleProvider, 'google'), [signInWithProvider])\n const signInWithGithub = useCallback(() => signInWithProvider(githubProvider, 'github'), [signInWithProvider])\n\n const signInWithEmail = useCallback(async (email: string, password: string) => {\n if (!auth) {\n await legacyPasswordAuth('/api/login', email, password)\n return\n }\n\n try {\n const cred = await signInWithEmailAndPassword(auth, email, password)\n await exchangeSession(cred.user)\n } catch (err) {\n if (!canUseLegacyPasswordFallback(err)) throw err\n await legacyPasswordAuth('/api/login', email, password)\n }\n }, [])\n\n const signUpWithEmail = useCallback(async (email: string, password: string) => {\n if (!auth) {\n await legacyPasswordAuth('/api/register', email, password)\n return\n }\n\n try {\n const cred = await createUserWithEmailAndPassword(auth, email, password)\n await exchangeSession(cred.user)\n } catch (err) {\n if (!canUseLegacyPasswordFallback(err)) throw err\n await legacyPasswordAuth('/api/register', email, password)\n }\n }, [])\n\n const sendPasswordReset = useCallback(async (email: string) => {\n // Always send via our own server (AWS SES, from lee.penkman@netwrck.com) so a\n // real email goes out and sets a local password_hash usable with /api/login.\n // Firebase's sendPasswordResetEmail is a silent no-op for Google-only accounts\n // (email-enumeration protection), so we don't route resets through it.\n const res = await fetch('/api/forgot-password', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ email }),\n })\n if (!res.ok) throw new Error('Could not send reset email right now.')\n }, [])\n\n // Completes a reset using the oobCode from a Firebase reset-email link, for\n // the in-app /reset-password page (when the Firebase action URL points here).\n const confirmReset = useCallback(async (oobCode: string, newPassword: string) => {\n if (!auth) throw new Error('Password reset is unavailable right now.')\n await confirmPasswordReset(auth, oobCode, newPassword)\n }, [])\n\n const logout = useCallback(async () => {\n try {\n await fetch('/api/logout', { method: 'POST' })\n } catch {\n // best-effort; still clear Firebase state below\n }\n if (auth) await signOut(auth)\n invalidateUserData()\n void getUserData(true)\n }, [])\n\n const getIdToken = useCallback(async () => {\n if (!user) return null\n try {\n return await user.getIdToken()\n } catch {\n return null\n }\n }, [user])\n\n return (\n <AuthContext.Provider\n value={{\n user,\n loading,\n signInWithGoogle,\n signInWithGithub,\n signInWithEmail,\n signUpWithEmail,\n sendPasswordReset,\n confirmReset,\n logout,\n getIdToken,\n }}\n >\n {children}\n </AuthContext.Provider>\n )\n}\n\nexport function useAuth() {\n const ctx = useContext(AuthContext)\n if (!ctx) throw new Error('useAuth must be used within AuthProvider')\n return ctx\n}\n","import React, { useEffect, useRef, useState } from 'react';\nimport { loadStripe, type Stripe, type StripeEmbeddedCheckout } from '@stripe/stripe-js';\nimport { X, LogIn, UserPlus } from 'lucide-react';\nimport { useAuth } from '../lib/auth-context';\n\n// Inline subscribe flow: clicking a plan opens ONE dialog that gates on the\n// server session — an unauthenticated user signs in right inside the dialog,\n// then the embedded Stripe checkout mounts in place without ever leaving the\n// page. Mirrors the netwrck/openpaths single-dialog subscribe flow.\n\nconst stripeCache = new Map<string, Promise<Stripe | null>>();\nfunction getStripe(key: string): Promise<Stripe | null> {\n let p = stripeCache.get(key);\n if (!p) {\n p = loadStripe(key);\n stripeCache.set(key, p);\n }\n return p;\n}\n\nfunction friendlyAuthError(err: unknown): string {\n const code = (err as { code?: string })?.code || '';\n switch (code) {\n case 'auth/invalid-email':\n return 'That email address looks invalid.';\n case 'auth/missing-password':\n return 'Enter your password.';\n case 'auth/weak-password':\n return 'Choose a password with at least 6 characters.';\n case 'auth/user-not-found':\n case 'auth/wrong-password':\n case 'auth/invalid-credential':\n case 'legacy/invalid-credentials':\n return 'Invalid email or password.';\n case 'auth/too-many-requests':\n return 'Too many attempts. Try again in a moment.';\n case 'auth/popup-blocked':\n case 'auth/account-exists-with-different-credential':\n return (err as Error).message;\n default:\n return (err as Error)?.message || 'Sign in failed';\n }\n}\n\n// Compact email (auto-flip login→register) + Google + GitHub sign-in. Unlike the\n// full-page LoginPanel it calls onSuccess() instead of navigating, so the caller\n// can continue the in-place checkout once the session cookie is set.\nconst InlineAuthForm: React.FC<{ onSuccess: () => void }> = ({ onSuccess }) => {\n const { signInWithEmail, signUpWithEmail, signInWithGoogle, signInWithGithub } = useAuth();\n const [mode, setMode] = useState<'login' | 'register'>('login');\n const [email, setEmail] = useState('');\n const [password, setPassword] = useState('');\n const [error, setError] = useState('');\n const [busy, setBusy] = useState<'' | 'email' | 'google' | 'github'>('');\n const disabled = busy !== '';\n\n async function submit(event: React.FormEvent) {\n event.preventDefault();\n setBusy('email');\n setError('');\n try {\n if (mode === 'login') {\n try {\n await signInWithEmail(email, password);\n } catch (err) {\n const code = (err as { code?: string })?.code || '';\n if (!['auth/user-not-found', 'auth/invalid-credential', 'legacy/invalid-credentials'].includes(code)) throw err;\n try {\n await signUpWithEmail(email, password);\n } catch (registerErr) {\n const rc = (registerErr as { code?: string })?.code || '';\n if (rc === 'auth/email-already-in-use' || rc === 'legacy/email-already-in-use') {\n throw Object.assign(new Error('Invalid email or password.'), { code: 'legacy/invalid-credentials' });\n }\n throw registerErr;\n }\n }\n } else {\n try {\n await signUpWithEmail(email, password);\n } catch (err) {\n const code = (err as { code?: string })?.code || '';\n if (code !== 'auth/email-already-in-use' && code !== 'legacy/email-already-in-use') throw err;\n // Existing account — sign them straight in with the same password.\n try {\n await signInWithEmail(email, password);\n } catch (signInErr) {\n const sc = (signInErr as { code?: string })?.code || '';\n if (['auth/user-not-found', 'auth/wrong-password', 'auth/invalid-credential', 'legacy/invalid-credentials'].includes(sc)) {\n setMode('login');\n setError('You already have an account — enter your password to sign in.');\n return;\n }\n throw signInErr;\n }\n }\n }\n onSuccess();\n } catch (err) {\n setError(friendlyAuthError(err));\n } finally {\n setBusy('');\n }\n }\n\n async function oauth(provider: 'google' | 'github') {\n setBusy(provider);\n setError('');\n try {\n if (provider === 'google') await signInWithGoogle();\n else await signInWithGithub();\n onSuccess();\n } catch (err) {\n setError(friendlyAuthError(err));\n } finally {\n setBusy('');\n }\n }\n\n return (\n <form onSubmit={submit} data-testid=\"subscribe-auth\">\n <p className=\"mb-4 text-sm text-white/56\">Sign in or create an account to continue to checkout.</p>\n <div className=\"mb-4 grid grid-cols-2 gap-2\">\n <button\n type=\"button\"\n onClick={() => { setMode('login'); setError(''); }}\n aria-pressed={mode === 'login'}\n className={`flex items-center justify-center gap-2 rounded-lg border px-4 py-2 text-sm font-bold transition-all ${mode === 'login' ? 'border-white bg-sky-400/15 text-sky-200 shadow-[0_0_18px_rgba(255,255,255,0.25)]' : 'border-white/15 bg-white/[0.02] text-white/55 hover:border-white/35 hover:text-white'}`}\n >\n <LogIn size={16} /> Sign in\n </button>\n <button\n type=\"button\"\n onClick={() => { setMode('register'); setError(''); }}\n aria-pressed={mode === 'register'}\n className={`flex items-center justify-center gap-2 rounded-lg border px-4 py-2 text-sm font-bold transition-all ${mode === 'register' ? 'border-white bg-sky-400/15 text-sky-200 shadow-[0_0_18px_rgba(255,255,255,0.25)]' : 'border-white/15 bg-white/[0.02] text-white/55 hover:border-white/35 hover:text-white'}`}\n >\n <UserPlus size={16} /> Create account\n </button>\n </div>\n\n <label className=\"mb-1.5 block text-[11px] uppercase tracking-widest text-white/55\" htmlFor=\"subscribe-email\">Email</label>\n <input\n id=\"subscribe-email\"\n type=\"email\"\n required\n autoComplete=\"email\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n className=\"mb-3 h-10 w-full rounded-lg border border-white/15 bg-white/[0.03] px-3 text-sm text-white outline-none transition-colors focus:border-white focus:bg-white/10\"\n />\n <label className=\"mb-1.5 block text-[11px] uppercase tracking-widest text-white/55\" htmlFor=\"subscribe-password\">Password</label>\n <input\n id=\"subscribe-password\"\n type=\"password\"\n required\n minLength={6}\n autoComplete={mode === 'login' ? 'current-password' : 'new-password'}\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n className=\"mb-4 h-10 w-full rounded-lg border border-white/15 bg-white/[0.03] px-3 text-sm text-white outline-none transition-colors focus:border-white focus:bg-white/10\"\n />\n\n {error && <p className=\"mb-3 rounded-lg border border-red-500/40 bg-red-950/60 px-3 py-2 text-sm text-red-100\">{error}</p>}\n\n <button\n type=\"submit\"\n disabled={disabled}\n className=\"inline-flex h-10 w-full items-center justify-center gap-2 rounded-lg bg-sky-400 px-5 text-sm font-bold text-black transition-colors hover:bg-sky-300 disabled:opacity-60\"\n >\n {mode === 'login' ? <LogIn size={18} /> : <UserPlus size={18} />}\n {busy === 'email' ? 'Working…' : mode === 'login' ? 'Continue' : 'Create account'}\n </button>\n\n <div className=\"my-4 flex items-center gap-3 text-[11px] uppercase tracking-widest text-white/35\">\n <span className=\"h-px flex-1 bg-white/15\" />\n or\n <span className=\"h-px flex-1 bg-white/15\" />\n </div>\n\n <div className=\"grid gap-2.5\">\n <button\n type=\"button\"\n onClick={() => oauth('google')}\n disabled={disabled}\n className=\"inline-flex h-10 w-full items-center justify-center gap-2.5 rounded-lg border border-white/20 bg-white/[0.03] px-4 text-sm font-bold text-white transition-colors hover:border-white/40 hover:bg-white/10 disabled:opacity-60\"\n >\n <GoogleIcon />\n {busy === 'google' ? 'Connecting…' : 'Continue with Google'}\n </button>\n <button\n type=\"button\"\n onClick={() => oauth('github')}\n disabled={disabled}\n className=\"inline-flex h-10 w-full items-center justify-center gap-2.5 rounded-lg border border-white/20 bg-white/[0.03] px-4 text-sm font-bold text-white transition-colors hover:border-white/40 hover:bg-white/10 disabled:opacity-60\"\n >\n <GitHubIcon />\n {busy === 'github' ? 'Connecting…' : 'Continue with GitHub'}\n </button>\n </div>\n </form>\n );\n};\n\ntype Stage = 'closed' | 'auth' | 'loading' | 'checkout';\n\nexport interface SubscribeFlow {\n // open the dialog for a plan ('free' short-circuits to /signup).\n start: (plan: string) => void;\n // the plan whose button should show a busy label, '' when idle.\n pendingPlan: string;\n // last error, surfaced by the caller if it wants an inline banner too.\n error: string;\n // the dialog element — render once, anywhere in the tree.\n element: React.ReactNode;\n}\n\n// useSubscribeFlow drives the gated dialog. Auth is gated on the SERVER session\n// (a 401 from /api/plans/subscribe), not client-side Firebase state, so it works\n// identically with Firebase and the cookie-only legacy/e2e path.\nexport function useSubscribeFlow(publishableKey?: string): SubscribeFlow {\n const [stage, setStage] = useState<Stage>('closed');\n const [plan, setPlan] = useState('');\n const [error, setError] = useState('');\n const mountRef = useRef<HTMLDivElement | null>(null);\n const instanceRef = useRef<StripeEmbeddedCheckout | null>(null);\n\n useEffect(() => () => { instanceRef.current?.destroy(); }, []);\n\n function close() {\n instanceRef.current?.destroy();\n instanceRef.current = null;\n setStage('closed');\n setPlan('');\n setError('');\n }\n\n async function beginCheckout(planId: string) {\n setError('');\n setStage('loading');\n let clientSecret: string;\n try {\n const res = await fetch('/api/plans/subscribe', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ plan: planId }),\n });\n if (res.status === 401) {\n setStage('auth');\n return;\n }\n const data = await res.json().catch(() => ({}));\n if (!res.ok || !data.clientSecret) throw new Error(data.error || 'Could not start checkout');\n clientSecret = data.clientSecret as string;\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Could not start checkout');\n return;\n }\n\n try {\n if (!publishableKey) throw new Error('Checkout is not configured yet.');\n const stripe = await getStripe(publishableKey);\n if (!stripe) throw new Error('Stripe failed to load');\n instanceRef.current?.destroy();\n instanceRef.current = null;\n setStage('checkout');\n const checkout = await stripe.createEmbeddedCheckoutPage({ clientSecret });\n instanceRef.current = checkout;\n requestAnimationFrame(() => {\n if (mountRef.current) checkout.mount(mountRef.current);\n });\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Could not start checkout');\n }\n }\n\n function start(planId: string) {\n if (planId === 'free') {\n window.location.href = '/signup';\n return;\n }\n setPlan(planId);\n beginCheckout(planId);\n }\n\n const element =\n stage === 'closed' ? null : (\n <div\n className=\"fixed inset-0 z-[90] flex items-start justify-center overflow-y-auto bg-black/75 p-4 backdrop-blur-sm sm:p-8\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Subscribe\"\n data-testid=\"subscribe-dialog\"\n onMouseDown={(e) => { if (e.target === e.currentTarget) close(); }}\n >\n <div className=\"my-auto w-full max-w-xl rounded-2xl border border-white/12 bg-[#0b0b0c] p-5 shadow-2xl\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h3 className=\"font-bold text-white\">{stage === 'auth' ? 'Sign in to subscribe' : 'Secure checkout'}</h3>\n <button\n type=\"button\"\n onClick={close}\n aria-label=\"Close\"\n className=\"rounded-md p-1 text-white/56 transition-colors hover:text-white\"\n >\n <X size={18} />\n </button>\n </div>\n\n {error && (\n <p className=\"mb-4 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-300\">{error}</p>\n )}\n\n {stage === 'auth' && <InlineAuthForm onSuccess={() => beginCheckout(plan)} />}\n\n {stage === 'loading' && !error && (\n <div className=\"flex items-center justify-center gap-3 py-12 text-sm text-white/56\" data-testid=\"subscribe-loading\">\n <span className=\"h-4 w-4 animate-spin rounded-full border-2 border-white/30 border-t-white\" />\n Starting secure checkout…\n </div>\n )}\n\n <div ref={mountRef} id=\"subscribe-checkout-mount\" className={stage === 'checkout' ? '' : 'hidden'} />\n </div>\n </div>\n );\n\n return { start, pendingPlan: stage === 'loading' ? plan : '', error, element };\n}\n\nconst GoogleIcon: React.FC = () => (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path fill=\"#4285F4\" d=\"M23.52 12.27c0-.82-.07-1.6-.2-2.36H12v4.48h6.47a5.53 5.53 0 0 1-2.4 3.63v3h3.88c2.27-2.09 3.57-5.17 3.57-8.75z\" />\n <path fill=\"#34A853\" d=\"M12 24c3.24 0 5.96-1.07 7.95-2.91l-3.88-3c-1.08.72-2.45 1.15-4.07 1.15-3.13 0-5.78-2.11-6.73-4.96H1.26v3.09A12 12 0 0 0 12 24z\" />\n <path fill=\"#FBBC05\" d=\"M5.27 14.28a7.2 7.2 0 0 1 0-4.56V6.63H1.26a12 12 0 0 0 0 10.74l4.01-3.09z\" />\n <path fill=\"#EA4335\" d=\"M12 4.75c1.77 0 3.35.61 4.6 1.8l3.43-3.43A11.97 11.97 0 0 0 12 0 12 12 0 0 0 1.26 6.63l4.01 3.09C6.22 6.86 8.87 4.75 12 4.75z\" />\n </svg>\n);\n\nconst GitHubIcon: React.FC = () => (\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M12 .5C5.37.5 0 5.87 0 12.5c0 5.3 3.44 9.8 8.21 11.39.6.11.82-.26.82-.58v-2.03c-3.34.73-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.09-.75.08-.73.08-.73 1.2.08 1.84 1.24 1.84 1.24 1.07 1.83 2.81 1.3 3.5.99.11-.78.42-1.31.76-1.61-2.67-.3-5.47-1.34-5.47-5.95 0-1.31.47-2.39 1.24-3.23-.13-.31-.54-1.53.12-3.19 0 0 1.01-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.29-1.55 3.3-1.23 3.3-1.23.66 1.66.25 2.88.12 3.19.77.84 1.24 1.92 1.24 3.23 0 4.62-2.81 5.64-5.49 5.94.43.37.81 1.1.81 2.22v3.29c0 .32.22.7.83.58A12 12 0 0 0 24 12.5C24 5.87 18.63.5 12 .5z\" />\n </svg>\n);\n","import React from 'react';\nimport { Check, Cpu, Gauge, Image, Search, Server, Sparkles, Video, Wallet } from 'lucide-react';\nimport { AuthProvider } from '../lib/auth-context';\nimport { useSubscribeFlow } from './SubscribeFlow';\n\n// The pricing page is usage-based first: one prepaid credit balance covers\n// agents, the model gateway, GPU hosting, rented compute, and search. Real\n// numbers come from GET /api/pricing (single source of truth in server/\n// pricing.go); the static tables below are a deterministic fallback so the\n// prerendered HTML paints real prices before the fetch resolves. Subscription\n// plans (GET /api/plans) live further down as an optional monthly bundle.\n\n// ---- usage-based pricing -------------------------------------------------\n\ntype ModelPrice = {\n id: string;\n providerName: string;\n logo?: string;\n inputPer1m: number;\n outputPer1m: number;\n};\n\ntype ComputePrice = {\n id: string;\n label: string;\n kind: string;\n vcpu: number;\n ramGb: number;\n gpu?: string;\n gpuCount?: number;\n vramGb?: number;\n priceHourText: string;\n priceSecondText?: string;\n comingSoon?: boolean;\n};\n\ntype SearchPrice = { id: string; label: string; unit: string; priceUsd: number; note: string };\ntype MediaPrice = {\n image?: { label: string; unit: string; credits: number; priceUsd: number; note: string };\n video?: { label: string; unit: string; minCredits: number; exampleUsd: number; exampleUnit: string; note: string };\n};\n\ntype PricingData = {\n creditUnitUsd: number;\n models: ModelPrice[];\n compute: ComputePrice[];\n search: SearchPrice[];\n media?: MediaPrice;\n};\n\n// Static fallback mirrors server/pricing.go output (provider cost with the\n// platform margin already applied) so SSR renders real prices, then the fetch\n// refreshes them. Keep in rough sync with the catalogue; the live fetch wins.\nconst STATIC_PRICING: PricingData = {\n creditUnitUsd: 0.001,\n models: [\n { id: 'openpaths/auto-fast', providerName: 'DeepSeek', inputPer1m: 0.168, outputPer1m: 0.336 },\n { id: 'openpaths/auto-cheap', providerName: 'OpenAI', inputPer1m: 0.24, outputPer1m: 1.5 },\n { id: 'openpaths/auto', providerName: 'Google Gemini', inputPer1m: 1.8, outputPer1m: 10.8 },\n { id: 'openpaths/auto-code', providerName: 'OpenAI', inputPer1m: 6.0, outputPer1m: 36.0 },\n { id: 'openpaths/auto-reasoning', providerName: 'OpenAI', inputPer1m: 0.9, outputPer1m: 5.4 },\n { id: 'claude-opus-5', providerName: 'Anthropic', inputPer1m: 6.0, outputPer1m: 30.0 },\n { id: 'claude-sonnet-5', providerName: 'Anthropic', inputPer1m: 3.6, outputPer1m: 18.0 },\n { id: 'claude-haiku-4-5-20251001', providerName: 'Anthropic', inputPer1m: 1.2, outputPer1m: 6.0 },\n { id: 'gpt-5.4', providerName: 'OpenAI', inputPer1m: 3.0, outputPer1m: 18.0 },\n { id: 'gpt-5-mini', providerName: 'OpenAI', inputPer1m: 0.3, outputPer1m: 2.4 },\n { id: 'gemini-2.5-pro', providerName: 'Google Gemini', inputPer1m: 1.5, outputPer1m: 12.0 },\n { id: 'gemini-3.5-flash', providerName: 'Google Gemini', inputPer1m: 1.8, outputPer1m: 10.8 },\n { id: 'deepseek-chat', providerName: 'DeepSeek', inputPer1m: 0.336, outputPer1m: 0.504 },\n { id: 'grok-4.5', providerName: 'xAI', inputPer1m: 2.4, outputPer1m: 7.2 },\n { id: 'grok-4.3', providerName: 'xAI', inputPer1m: 1.5, outputPer1m: 3.0 },\n { id: 'llama-3.3-70b-versatile', providerName: 'Groq', inputPer1m: 0.708, outputPer1m: 0.948 },\n ],\n compute: [\n { id: 'cpx21', label: 'CPU Small', kind: 'cpu', vcpu: 3, ramGb: 4, priceHourText: '$0.010', priceSecondText: '$0.000003' },\n { id: 'cpx32', label: 'CPU Medium', kind: 'cpu', vcpu: 4, ramGb: 8, priceHourText: '$0.018', priceSecondText: '$0.000005' },\n { id: 'cpx41', label: 'CPU Large', kind: 'cpu', vcpu: 8, ramGb: 16, priceHourText: '$0.038', priceSecondText: '$0.000010' },\n { id: 'win-cpx32', label: 'Windows CPU Medium', kind: 'cpu', vcpu: 4, ramGb: 8, priceHourText: '$0.018', priceSecondText: '$0.000005' },\n { id: 'win-cpx41', label: 'Windows CPU Large', kind: 'cpu', vcpu: 8, ramGb: 16, priceHourText: '$0.038', priceSecondText: '$0.000010' },\n { id: 'gpu-a100', label: 'A100 80GB', kind: 'gpu', vcpu: 12, ramGb: 80, gpu: 'A100-80GB', gpuCount: 1, vramGb: 80, priceHourText: '$2.624', priceSecondText: '$0.000729' },\n { id: 'gpu-h100', label: 'H100 80GB', kind: 'gpu', vcpu: 16, ramGb: 80, gpu: 'H100-80GB', gpuCount: 1, vramGb: 80, priceHourText: '$4.784', priceSecondText: '$0.001329' },\n { id: 'gpu-h200', label: 'H200 141GB', kind: 'gpu', vcpu: 16, ramGb: 141, gpu: 'H200-141GB', gpuCount: 1, vramGb: 141, priceHourText: '$6.384', priceSecondText: '$0.001773' },\n { id: 'gpu-a40', label: 'A40 48GB', kind: 'gpu', vcpu: 9, ramGb: 48, gpu: 'A40', gpuCount: 1, vramGb: 48, priceHourText: '$0.640', priceSecondText: '$0.000178' },\n { id: 'gpu-l40s', label: 'L40S', kind: 'gpu', vcpu: 8, ramGb: 48, gpu: 'L40S', gpuCount: 1, vramGb: 48, priceHourText: '$1.376', priceSecondText: '$0.000382' },\n { id: 'gpu-rtx3090', label: 'RTX 3090 24GB', kind: 'gpu', vcpu: 8, ramGb: 24, gpu: 'RTX-3090', gpuCount: 1, vramGb: 24, priceHourText: '$0.352', priceSecondText: '$0.000098' },\n { id: 'gpu-rtx4090', label: 'RTX 4090 24GB', kind: 'gpu', vcpu: 8, ramGb: 24, gpu: 'RTX-4090', gpuCount: 1, vramGb: 24, priceHourText: '$0.544', priceSecondText: '$0.000151' },\n { id: 'gpu-t4', label: 'T4 16GB', kind: 'gpu', vcpu: 4, ramGb: 16, gpu: 'T4', gpuCount: 1, vramGb: 16, priceHourText: '$0.304', priceSecondText: '$0.000084' },\n { id: 'tpu-v5e', label: 'TPU v5e', kind: 'gpu', vcpu: 24, ramGb: 48, gpu: 'TPU-v5e', gpuCount: 1, vramGb: 16, priceHourText: '$2.304', priceSecondText: '$0.000640', comingSoon: true },\n { id: 'tpu-v6e', label: 'TPU v6e (Trillium)', kind: 'gpu', vcpu: 44, ramGb: 176, gpu: 'TPU-v6e', gpuCount: 1, vramGb: 32, priceHourText: '$5.184', priceSecondText: '$0.001440', comingSoon: true },\n ],\n search: [\n { id: 'web', label: 'Web search', unit: '1,000 requests', priceUsd: 7.7, note: 'Live web results with citations' },\n { id: 'papers', label: 'Paper search', unit: '1,000 requests', priceUsd: 1.0, note: 'Academic + preprint search' },\n ],\n media: {\n image: {\n label: 'Responsive image set',\n unit: 'set up to 8 generated variants',\n credits: 1,\n priceUsd: 0.001,\n note: 'Dynamic reads are cacheable; generated artifact variants are billed once.',\n },\n video: {\n label: 'AV1 video ladder',\n unit: 'wall-clock encode time',\n minCredits: 2,\n exampleUsd: 0.057,\n exampleUnit: 'one minute of encoder time at the default GPU rate',\n note: 'Uses AV1 NVENC when available, then CPU AV1/VP9/H.264 fallback.',\n },\n },\n};\n\n// money formats a per-1M-token or flat dollar price compactly: sub-dollar prices\n// keep three significant decimals, everything else two.\nfunction money(n: number): string {\n if (n === 0) return 'included';\n return `$${n.toFixed(n < 1 ? 3 : 2)}`;\n}\n\nconst HOW_IT_WORKS = [\n { icon: Wallet, title: 'Prepay credits', body: 'Top up once. 1 credit = $0.001. No subscription required, no minimums, no monthly commitment.' },\n { icon: Gauge, title: 'Use anything', body: 'Agents, the model gateway, GPU model hosting, rented compute, and search all draw from the same balance.' },\n { icon: Check, title: 'Pay for what you use', body: 'Metered to the token and to the second. Set spend caps per project, key, app, or agent run.' },\n];\n\nconst UsageBasedPricing: React.FC = () => {\n const [data, setData] = React.useState<PricingData>(STATIC_PRICING);\n\n React.useEffect(() => {\n let cancelled = false;\n fetch('/api/pricing')\n .then((r) => (r.ok ? r.json() : null))\n .then((live) => {\n if (cancelled || !live?.models?.length) return;\n setData({\n creditUnitUsd: live.creditUnitUsd ?? STATIC_PRICING.creditUnitUsd,\n models: live.models,\n compute: live.compute?.length ? live.compute : STATIC_PRICING.compute,\n search: live.search?.length ? live.search : STATIC_PRICING.search,\n media: live.media || STATIC_PRICING.media,\n });\n })\n .catch(() => undefined);\n return () => {\n cancelled = true;\n };\n }, []);\n\n return (\n <section data-testid=\"usage-pricing\" className=\"mt-10 border-t border-white/10 pt-8\">\n <div className=\"mb-3 flex items-center gap-2\">\n <Sparkles size={16} className=\"text-white/48\" />\n <h2 className=\"font-display text-2xl font-bold\">Or pay as you go — one prepaid balance</h2>\n </div>\n <p className=\"mb-5 max-w-3xl text-sm leading-6 text-white/54\">\n Everything on app.nz — coding agents, the model gateway, GPU model hosting, rented CPU/GPU compute,\n and web & paper search — is usage-based and billed from one prepaid credit balance. Top up once and\n use anything. No subscription required.\n </p>\n\n <div className=\"mb-6 grid gap-3 sm:grid-cols-3\">\n {HOW_IT_WORKS.map((step) => {\n const StepIcon = step.icon;\n return (\n <div key={step.title} className=\"rounded-xl border border-white/10 bg-white/[0.035] p-4\">\n <div className=\"mb-2 flex items-center gap-2\">\n <StepIcon size={16} className=\"text-white/64\" />\n <h3 className=\"font-display text-base font-bold\">{step.title}</h3>\n </div>\n <p className=\"text-sm leading-6 text-white/54\">{step.body}</p>\n </div>\n );\n })}\n </div>\n\n {/* Models */}\n <PriceBlock icon={Sparkles} title=\"Models\" subtitle=\"Per 1M tokens, through one OpenAI-compatible gateway. Auto routes pick the right model for the job.\">\n <div className=\"overflow-x-auto rounded-xl border border-white/10 bg-white/[0.025]\">\n <table className=\"w-full min-w-[460px] text-left text-sm\">\n <thead>\n <tr className=\"border-b border-white/10 text-xs uppercase tracking-wide text-white/40\">\n <th className=\"px-4 py-3 font-semibold\">Model</th>\n <th className=\"px-4 py-3 font-semibold\">Provider</th>\n <th className=\"px-4 py-3 text-right font-semibold\">Input / 1M</th>\n <th className=\"px-4 py-3 text-right font-semibold\">Output / 1M</th>\n </tr>\n </thead>\n <tbody>\n {data.models.map((m) => (\n <tr key={m.id} data-testid={`model-price-${m.id}`} className=\"border-b border-white/[0.06] last:border-0\">\n <td className=\"px-4 py-2.5 font-mono text-[13px] text-white/82\">{m.id}</td>\n <td className=\"px-4 py-2.5 text-white/54\">\n <span className=\"inline-flex items-center gap-2\">\n {m.logo ? <img src={m.logo} alt=\"\" width={14} height={14} className=\"opacity-80\" loading=\"lazy\" /> : null}\n {m.providerName}\n </span>\n </td>\n <td className=\"px-4 py-2.5 text-right font-mono text-white/82\">{money(m.inputPer1m)}</td>\n <td className=\"px-4 py-2.5 text-right font-mono text-white/82\">{money(m.outputPer1m)}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <p className=\"mt-2 text-xs text-white/40\">\n A representative slice — <a href=\"/gateway\" className=\"text-white/64 underline hover:text-white\">see every model and provider</a>.\n </p>\n </PriceBlock>\n\n {/* Compute */}\n <PriceBlock\n icon={Server}\n title=\"Hardware pricing\"\n subtitle=\"Billed per second of wall-clock, from the same balance. GPU model endpoints scale to zero, so idle hardware costs nothing — and every machine is priced below Replicate's rate for the same GPU.\"\n >\n <div className=\"overflow-x-auto rounded-xl border border-white/10 bg-white/[0.025]\">\n <table className=\"w-full min-w-[640px] text-left text-sm\">\n <thead>\n <tr className=\"border-b border-white/10 text-xs uppercase tracking-wide text-white/40\">\n <th className=\"px-4 py-3 font-semibold\">Hardware</th>\n <th className=\"px-4 py-3 text-right font-semibold\">Price</th>\n <th className=\"px-4 py-3 text-right font-semibold\">GPU</th>\n <th className=\"px-4 py-3 text-right font-semibold\">CPU</th>\n <th className=\"px-4 py-3 text-right font-semibold\">GPU RAM</th>\n <th className=\"px-4 py-3 text-right font-semibold\">RAM</th>\n </tr>\n </thead>\n <tbody>\n {data.compute.map((c) => (\n <tr\n key={c.id}\n data-testid={`compute-price-${c.id}`}\n className={`border-b border-white/[0.06] last:border-0 ${c.comingSoon ? 'opacity-55' : ''}`}\n >\n <td className=\"px-4 py-2.5 text-white/82\">\n <span className=\"inline-flex items-center gap-2\">\n <Cpu size={13} className=\"shrink-0 text-white/40\" />\n <span>\n {c.label}\n {c.comingSoon && (\n <span className=\"ml-2 rounded-full border border-white/15 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-white/50\">\n coming soon\n </span>\n )}\n <span className=\"block font-mono text-[11px] text-white/36\">{c.id}</span>\n </span>\n </span>\n </td>\n <td className=\"px-4 py-2.5 text-right\">\n <span className=\"block font-mono text-white/82\">{c.priceSecondText ? `${c.priceSecondText}/sec` : c.priceHourText}</span>\n {c.priceSecondText && <span className=\"block font-mono text-xs text-white/40\">{c.priceHourText}/hr</span>}\n </td>\n <td className=\"px-4 py-2.5 text-right text-white/54\">{c.gpu ? `${c.gpuCount || 1}x ${c.gpu.startsWith('TPU') ? 'TPU' : 'GPU'}` : '—'}</td>\n <td className=\"px-4 py-2.5 text-right text-white/54\">{c.vcpu}x</td>\n <td className=\"px-4 py-2.5 text-right text-white/54\">{c.vramGb ? `${c.vramGb}GB` : '—'}</td>\n <td className=\"px-4 py-2.5 text-right text-white/54\">{c.ramGb}GB</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <p className=\"mt-2 text-xs text-white/40\">\n You only pay while a machine is running your work, metered per second. TPUs land with the Google Cloud\n integration — pricing shown so you can plan; Google-Cloud-only hardware carries GCP's higher list prices.\n </p>\n </PriceBlock>\n\n {/* Search */}\n <PriceBlock icon={Search} title=\"Search\" subtitle=\"Flat usage pricing for live web and academic search, drawn from the same balance.\">\n <div className=\"grid gap-3 sm:grid-cols-2\">\n {data.search.map((srch) => (\n <div key={srch.id} data-testid={`search-price-${srch.id}`} className=\"rounded-xl border border-white/10 bg-white/[0.035] p-4\">\n <div className=\"flex items-baseline justify-between gap-3\">\n <h4 className=\"font-display text-base font-bold\">{srch.label}</h4>\n <span className=\"font-mono text-white/82\">${srch.priceUsd.toFixed(2)}<span className=\"text-white/40\"> / {srch.unit}</span></span>\n </div>\n <p className=\"mt-1 text-sm text-white/54\">{srch.note}</p>\n </div>\n ))}\n </div>\n </PriceBlock>\n\n <PriceBlock icon={Image} title=\"Media optimization\" subtitle=\"Cloudflare-style responsive images and AV1 video ladders, saved into your artifact filesystem.\">\n <div className=\"grid gap-3 sm:grid-cols-2\">\n {data.media?.image && (\n <div data-testid=\"media-price-image\" className=\"rounded-xl border border-white/10 bg-white/[0.035] p-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex items-center gap-2\">\n <Image size={15} className=\"text-white/44\" />\n <h4 className=\"font-display text-base font-bold\">{data.media.image.label}</h4>\n </div>\n <span className=\"font-mono text-white/82\">${data.media.image.priceUsd.toFixed(3)}</span>\n </div>\n <p className=\"mt-1 text-sm text-white/54\">{data.media.image.unit}</p>\n <p className=\"mt-2 text-xs leading-5 text-white/40\">{data.media.image.note}</p>\n </div>\n )}\n {data.media?.video && (\n <div data-testid=\"media-price-video\" className=\"rounded-xl border border-white/10 bg-white/[0.035] p-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex items-center gap-2\">\n <Video size={15} className=\"text-white/44\" />\n <h4 className=\"font-display text-base font-bold\">{data.media.video.label}</h4>\n </div>\n <span className=\"font-mono text-white/82\">${data.media.video.exampleUsd.toFixed(3)}</span>\n </div>\n <p className=\"mt-1 text-sm text-white/54\">{data.media.video.exampleUnit}</p>\n <p className=\"mt-2 text-xs leading-5 text-white/40\">{data.media.video.note}</p>\n </div>\n )}\n </div>\n </PriceBlock>\n </section>\n );\n};\n\nconst PriceBlock: React.FC<{ icon: typeof Sparkles; title: string; subtitle: string; children: React.ReactNode }> = ({\n icon: Icon,\n title,\n subtitle,\n children,\n}) => (\n <div className=\"mt-6\">\n <div className=\"mb-1 flex items-center gap-2\">\n <Icon size={15} className=\"text-white/48\" />\n <h3 className=\"font-display text-lg font-bold\" dangerouslySetInnerHTML={{ __html: title }} />\n </div>\n <p className=\"mb-3 max-w-2xl text-sm leading-6 text-white/48\">{subtitle}</p>\n {children}\n </div>\n);\n\n// ---- optional subscription plans -----------------------------------------\n\ntype PlanTier = {\n id: string;\n name: string;\n priceUsd: number;\n monthlyCredits: number;\n reservedSlots: number;\n highlight?: boolean;\n blurb: string;\n perks: string[];\n};\n\nconst STATIC_PLANS: PlanTier[] = [\n {\n id: 'free',\n name: 'Free',\n priceUsd: 0,\n monthlyCredits: 0,\n reservedSlots: 0,\n blurb: 'Start free. Pay only for what you use.',\n perks: ['Prepaid credits, no minimum', 'Shared worker pool', 'Every API + the CLI', 'Web, paper & agentic search'],\n },\n {\n id: 'pro',\n name: 'Pro',\n priceUsd: 20,\n monthlyCredits: 25000,\n reservedSlots: 1,\n blurb: 'For solo builders shipping every day.',\n perks: ['25,000 credits / month', '1 guaranteed agent machine', 'RA1 + papers + agentic search quota', 'Priority over free tier'],\n },\n {\n id: 'ultra',\n name: 'Ultra',\n priceUsd: 60,\n monthlyCredits: 80000,\n reservedSlots: 3,\n highlight: true,\n blurb: 'For teams running agents in parallel.',\n perks: ['80,000 credits / month', '3 guaranteed machines + priority queue', 'Higher first-party product quotas', 'Best value per credit'],\n },\n {\n id: 'max',\n name: 'Max',\n priceUsd: 200,\n monthlyCredits: 280000,\n reservedSlots: 6,\n blurb: 'For heavy, always-on workloads.',\n perks: ['280,000 credits / month', '6 guaranteed machines + top priority', 'Largest RA1 / papers / search quotas', 'First-party credits across products'],\n },\n];\n\nconst SubscriptionPlans: React.FC = () => {\n const [plans, setPlans] = React.useState<PlanTier[]>(STATIC_PLANS);\n const [publishableKey, setPublishableKey] = React.useState<string | undefined>(undefined);\n const flow = useSubscribeFlow(publishableKey);\n\n React.useEffect(() => {\n let cancelled = false;\n fetch('/api/plans')\n .then((r) => (r.ok ? r.json() : null))\n .then((data) => {\n if (cancelled || !data?.plans) return;\n // Merge live pricing/credits onto the static presentation copy.\n setPlans((prev) =>\n prev.map((tier) => {\n const live = data.plans.find((p: { id: string }) => p.id === tier.id);\n return live ? { ...tier, priceUsd: live.priceUsd, monthlyCredits: live.monthlyCredits, reservedSlots: live.reservedSlots } : tier;\n }),\n );\n })\n .catch(() => undefined);\n // The publishable key powers the inline checkout modal (same source the\n // account panel uses), so subscribing happens here instead of bouncing to\n // /account just to mount Stripe.\n fetch('/api/credits/config')\n .then((r) => (r.ok ? r.json() : null))\n .then((cfg) => {\n if (!cancelled && cfg?.publishableKey) setPublishableKey(cfg.publishableKey);\n })\n .catch(() => undefined);\n return () => {\n cancelled = true;\n };\n }, []);\n\n // subscribe opens the gated dialog: an unauthenticated user signs in inside the\n // dialog, then the embedded Stripe checkout mounts in place (no navigation).\n // Free → signup. On success Stripe redirects to /account?plan=success (server\n // return_url) where the purchase is verified.\n const subscribe = flow.start;\n const pendingPlan = flow.pendingPlan;\n\n return (\n <section data-testid=\"pricing-plans\" className=\"mt-2\">\n <div className=\"mb-3 flex items-center gap-2\">\n <Sparkles size={16} className=\"text-white/48\" />\n <h2 className=\"font-display text-2xl font-bold\">Start free, or save with a plan</h2>\n </div>\n <p className=\"mb-5 max-w-2xl text-sm leading-6 text-white/54\">\n Plans add monthly credits at a better rate, guaranteed machines, and priority in the queue. Same balance —\n go over your plan and you just keep paying the usage rates below. No subscription required. Cancel anytime.\n </p>\n {flow.error && (\n <p className=\"mb-4 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-300\">{flow.error}</p>\n )}\n <div className=\"grid gap-3 md:grid-cols-2 lg:grid-cols-4\">\n {plans.map((plan) => (\n <article\n key={plan.id}\n data-testid={`plan-${plan.id}`}\n className={`flex flex-col rounded-xl border p-4 ${\n plan.highlight ? 'border-white/30 bg-sky-400/15' : 'border-white/10 bg-white/[0.035]'\n }`}\n >\n <div className=\"flex items-baseline justify-between\">\n <h3 className=\"font-display text-lg font-bold\">{plan.name}</h3>\n {plan.highlight && (\n <span className=\"rounded-full bg-white px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-black\">\n Popular\n </span>\n )}\n </div>\n <div className=\"mt-2\">\n <span className=\"font-display text-3xl font-bold\">${plan.priceUsd}</span>\n <span className=\"text-sm text-white/48\">/mo</span>\n </div>\n <p className=\"mt-1 text-sm text-white/54\">{plan.blurb}</p>\n {plan.monthlyCredits > 0 && (\n <div className=\"mt-3 rounded-lg border border-white/10 bg-black px-3 py-2\">\n <div className=\"text-sm text-white/72\">{plan.monthlyCredits.toLocaleString()} credits / month</div>\n {(() => {\n const savePct = Math.round((1 - plan.priceUsd / plan.monthlyCredits / 0.001) * 100);\n return savePct > 0 ? (\n <div className=\"mt-0.5 text-xs font-semibold text-emerald-300/80\">Save {savePct}% vs pay-as-you-go</div>\n ) : null;\n })()}\n </div>\n )}\n <ul className=\"mt-3 flex flex-1 flex-col gap-2 text-sm text-white/58\">\n {plan.perks.map((perk) => (\n <li key={perk} className=\"flex items-start gap-2\">\n <Check size={15} className=\"mt-0.5 shrink-0 text-white/48\" />\n <span>{perk}</span>\n </li>\n ))}\n </ul>\n <button\n type=\"button\"\n onClick={() => subscribe(plan.id)}\n disabled={pendingPlan === plan.id}\n aria-label={plan.id === 'free' ? 'Get started free' : `Subscribe to ${plan.name}`}\n className={`mt-4 inline-flex h-10 items-center justify-center rounded-lg px-4 text-sm font-bold transition-colors disabled:opacity-60 ${\n plan.highlight\n ? 'bg-sky-400 text-black hover:bg-sky-300'\n : 'border border-white/12 bg-white/[0.04] text-white hover:bg-white hover:text-black'\n }`}\n >\n {pendingPlan === plan.id ? 'Opening…' : plan.id === 'free' ? 'Get started' : `Subscribe to ${plan.name}`}\n </button>\n </article>\n ))}\n </div>\n {flow.element}\n </section>\n );\n};\n\nexport const PlatformPricing: React.FC = () => (\n <>\n <AuthProvider>\n <SubscriptionPlans />\n </AuthProvider>\n <UsageBasedPricing />\n </>\n);\n","import React from 'react';\nimport { ArrowLeft, ArrowRight, Check, CheckCircle2, Copy, Database, Network } from 'lucide-react';\nimport { platformRoutes, platformCtaHref, type PlatformRoute } from './platformRoutes';\nimport { PlatformPricing } from './PlatformPricing';\nimport { getUserData } from '../lib/userData';\n\nexport const PlatformRoutePage: React.FC<{ route: PlatformRoute }> = ({ route }) => {\n const Icon = route.icon;\n // testMode reads the query string, which only exists on the client. Defer it to\n // after mount so the server-rendered and first client render match (clean\n // hydration); the fixture appears once mounted.\n const [testMode, setTestMode] = React.useState(false);\n React.useEffect(() => {\n setTestMode(new URLSearchParams(window.location.search).get('test') === 'true');\n }, []);\n // Signed-in visitors must skip /signup entirely: it would see the session,\n // redirect to ?next=, and land them right back here with nothing done.\n // Starts false so the prerendered (signed-out) markup hydrates cleanly.\n const [authenticated, setAuthenticated] = React.useState(false);\n React.useEffect(() => {\n let cancelled = false;\n getUserData()\n .then((data) => { if (!cancelled) setAuthenticated(data.authenticated); })\n .catch(() => {});\n return () => { cancelled = true; };\n }, []);\n const surface = moduleSurfaceFor(route.path);\n\n return (\n <main className=\"bg-black bg-[radial-gradient(circle_at_50%_-8%,rgba(255,255,255,0.10),transparent_55%),radial-gradient(circle_at_88%_115%,rgba(120,140,255,0.06),transparent_45%),linear-gradient(rgba(255,255,255,0.022)_1px,transparent_1px),linear-gradient(90deg,rgba(255,255,255,0.022)_1px,transparent_1px)] bg-[size:100%_100%,100%_100%,48px_48px,48px_48px] px-4 pb-16 pt-24 text-white sm:px-6 lg:px-8\">\n <div className=\"mx-auto max-w-[1800px]\">\n <div className=\"mb-5\">\n <a href=\"/\" className=\"mb-5 inline-flex items-center gap-2 text-sm font-semibold text-white/48 hover:text-white\">\n <ArrowLeft size={16} />\n Back to overview\n </a>\n\n <div className=\"grid gap-5 lg:grid-cols-[0.9fr_1.1fr] lg:items-end\">\n <div>\n <div className=\"mb-4 inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-white/54\">\n <Icon size={14} />\n {route.eyebrow}\n </div>\n <h1 className=\"font-display text-2xl font-bold leading-tight tracking-tight sm:text-4xl\">\n {route.title}\n </h1>\n </div>\n <div>\n <p className=\"text-sm leading-7 text-white/58\">{route.description}</p>\n <div className=\"mt-4 flex flex-col gap-3 sm:flex-row\">\n {route.primaryAction && (\n <a\n href={platformCtaHref(route, authenticated)}\n className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg bg-sky-400 px-4 text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n {route.primaryAction} <ArrowRight size={17} />\n </a>\n )}\n <a\n href=\"/docs\"\n className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-4 text-sm font-semibold text-white transition-colors hover:bg-white hover:text-black\"\n >\n Read docs\n </a>\n </div>\n </div>\n </div>\n </div>\n\n {testMode && (\n <div data-testid=\"route-test-mode\" className=\"mb-4 rounded-xl border border-white/14 bg-white/[0.06] p-4\">\n <div className=\"grid gap-3 text-xs sm:grid-cols-4\">\n <TestStat label=\"route\" value={route.path} />\n <TestStat label=\"source\" value={surface.source} />\n <TestStat label=\"cards\" value={String(route.cards.length)} />\n <TestStat label=\"command\" value={route.command || 'none'} />\n </div>\n </div>\n )}\n\n {route.command && <CommandBlock command={route.command} />}\n\n <div className=\"grid gap-3 lg:grid-cols-[0.78fr_1.22fr]\">\n <section className=\"rounded-xl border border-white/10 bg-white/[0.035] p-4\">\n <div className=\"mb-4 flex items-center justify-between gap-3\">\n <div>\n <div className=\"text-xs font-bold uppercase tracking-[0.2em] text-white/34\">What you get</div>\n <h2 className=\"mt-1 font-display text-xl font-bold\">{surface.source}</h2>\n </div>\n <Network size={20} className=\"text-white/42\" />\n </div>\n <div className=\"grid gap-2\">\n {surface.functions.map((item) => (\n <div key={item} className=\"flex items-start gap-2 rounded-lg border border-white/10 bg-black px-3 py-2 text-sm text-white/58\">\n <CheckCircle2 size={15} className=\"mt-0.5 shrink-0 text-white/48\" />\n <span>{item}</span>\n </div>\n ))}\n </div>\n </section>\n\n <section className=\"grid gap-3 md:grid-cols-3\">\n {route.cards.map((card) => (\n <article key={card.title} data-testid=\"route-card\" className=\"rounded-xl border border-white/10 bg-white/[0.04] p-4\">\n <h2 className=\"font-display text-lg font-bold\">{card.title}</h2>\n <p className=\"mt-2 text-sm leading-6 text-white/54\">{card.body}</p>\n </article>\n ))}\n </section>\n </div>\n\n {route.path === '/pricing' && <PlatformPricing />}\n\n <div className=\"mt-8 rounded-xl border border-white/10 bg-white/[0.035] p-4\">\n <div className=\"mb-4 text-xs font-bold uppercase tracking-[0.2em] text-white/34\">Explore more</div>\n <div className=\"grid gap-2 sm:grid-cols-2 lg:grid-cols-4\">\n {platformRoutes\n .filter((item) => item.path !== route.path)\n .map((item) => {\n const ItemIcon = item.icon;\n return (\n <a\n key={item.path}\n href={item.path}\n className=\"flex items-center gap-3 rounded-lg border border-white/10 bg-black px-3 py-3 text-sm text-white/58 transition-colors hover:border-white/24 hover:text-white\"\n >\n <ItemIcon size={16} />\n {item.label}\n </a>\n );\n })}\n </div>\n </div>\n </div>\n </main>\n );\n};\n\nfunction CommandBlock({ command }: { command: string }) {\n const [copied, setCopied] = React.useState(false);\n const copy = React.useCallback(() => {\n navigator.clipboard\n ?.writeText(command)\n .then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n })\n .catch(() => {});\n }, [command]);\n return (\n <div className=\"mb-3 flex w-fit max-w-full items-center gap-2 rounded-xl border border-white/10 bg-[#050505] p-3 font-mono text-sm\">\n <span aria-hidden className=\"select-none text-white/34\">$</span>\n <code className=\"min-w-0 truncate text-white/72\">{command}</code>\n <button\n type=\"button\"\n onClick={copy}\n aria-label={copied ? 'Copied' : 'Copy command'}\n className=\"inline-flex shrink-0 items-center gap-1 rounded-md border border-white/10 px-2 py-1 text-xs font-semibold text-white/54 transition-colors hover:border-white/24 hover:text-white\"\n >\n {copied ? <Check size={14} /> : <Copy size={14} />}\n <span className=\"hidden sm:inline\">{copied ? 'Copied' : 'Copy'}</span>\n </button>\n </div>\n );\n}\n\nfunction TestStat({ label, value }: { label: string; value: string }) {\n return (\n <div className=\"min-w-0 rounded-lg border border-white/10 bg-black px-3 py-2\">\n <div className=\"mb-1 flex items-center gap-1 text-[10px] font-bold uppercase tracking-[0.16em] text-white/34\">\n <Database size={11} />\n {label}\n </div>\n <div data-testid={`route-stat-${label}`} className=\"truncate font-mono text-white/72\">\n {value}\n </div>\n </div>\n );\n}\n\nfunction moduleSurfaceFor(path: string) {\n const map: Record<string, { source: string; functions: string[] }> = {\n '/chat': {\n source: 'Chat and research',\n functions: ['AI chat', 'Live web search', 'Deep research', 'Paper search'],\n },\n '/agents': {\n source: 'Cloud coding agents',\n functions: ['Repo tasks', 'Pull requests', 'VisualBench', 'CI repair'],\n },\n '/pricing': {\n source: 'Simple credits',\n functions: ['Pay as you go', 'Search pricing', 'Model hosting', 'Spend caps'],\n },\n '/projects': {\n source: 'Everything in one project',\n functions: ['Apps and repos', 'Agents and tasks', 'Domains and keys', 'Usage and billing'],\n },\n '/sites': {\n source: 'Sites you control',\n functions: ['In-browser editor', 'Instant publish', 'Public pages', 'Agent-editable'],\n },\n '/deploys': {\n source: 'AI app hosting',\n functions: ['Container deploys', 'Preview URLs', 'GPU inference', 'One-click rollback'],\n },\n '/gateway': {\n source: 'Model gateway',\n functions: ['OpenAI-compatible API', 'Automatic routing', 'Web & paper search', 'Usage you can read'],\n },\n '/workers': {\n source: 'CPU and GPU workers',\n functions: ['Builds and deploys', 'Agent sandboxes', 'Model inference', 'Live heartbeats'],\n },\n '/queues': {\n source: 'Agent task queues',\n functions: ['JSON messages', 'Retries + dead-letter', 'Remote consumers', 'Agent dispatch'],\n },\n '/domains': {\n source: 'Domains made easy',\n functions: ['Free app.nz subdomains', 'Reserved names', 'Custom domains', 'Automatic HTTPS'],\n },\n '/secrets': {\n source: 'Secrets, scoped',\n functions: ['Bring your own keys', 'Per-app env vars', 'Per-deploy secrets', 'Rotation audit'],\n },\n '/logs': {\n source: 'One clear trail',\n functions: ['Agent logs', 'Deploy logs', 'Gateway events', 'Linked artifacts'],\n },\n '/billing': {\n source: 'One simple balance',\n functions: ['Shared credits', 'Gateway usage', 'Spend caps', 'Worker minutes'],\n },\n '/docs': {\n source: 'Docs by task',\n functions: ['Getting started', 'CLI reference', 'Migration guides', 'Team setup'],\n },\n '/cli': {\n source: 'CLI for the agent cloud',\n functions: ['Agent commands', 'Deploy commands', 'Model gateway', 'Key rotation'],\n },\n '/consulting': {\n source: 'Hands-on help',\n functions: ['Migrations', 'Private machines', 'Custom agents', 'Ongoing support'],\n },\n '/schema': {\n source: 'Built to last',\n functions: ['Tested upgrades', 'Predictable behavior', 'Scales with you', 'No surprises'],\n },\n '/security': {\n source: 'Separate by design',\n functions: ['Protected secrets', 'Scoped access', 'Sandboxed code', 'Clear boundaries'],\n },\n '/status': {\n source: 'Live status',\n functions: ['Health checks', 'Service status', 'Region status', 'Worker status'],\n },\n '/workflows': {\n source: 'Reusable workflows',\n functions: ['VisualBench', 'CI repair', 'Deploy checks', 'Team recipes'],\n },\n };\n return map[path] || { source: 'Everything you need', functions: ['Everyday use', 'One API', 'CLI access', 'Always tested'] };\n}\n","/* eslint-disable no-multi-assign */\n\nfunction deepFreeze(obj) {\n if (obj instanceof Map) {\n obj.clear =\n obj.delete =\n obj.set =\n function () {\n throw new Error('map is read-only');\n };\n } else if (obj instanceof Set) {\n obj.add =\n obj.clear =\n obj.delete =\n function () {\n throw new Error('set is read-only');\n };\n }\n\n // Freeze self\n Object.freeze(obj);\n\n Object.getOwnPropertyNames(obj).forEach((name) => {\n const prop = obj[name];\n const type = typeof prop;\n\n // Freeze prop if it is an object or function and also not already frozen\n if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {\n deepFreeze(prop);\n }\n });\n\n return obj;\n}\n\n/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */\n/** @typedef {import('highlight.js').CompiledMode} CompiledMode */\n/** @implements CallbackResponse */\n\nclass Response {\n /**\n * @param {CompiledMode} mode\n */\n constructor(mode) {\n // eslint-disable-next-line no-undefined\n if (mode.data === undefined) mode.data = {};\n\n this.data = mode.data;\n this.isMatchIgnored = false;\n }\n\n ignoreMatch() {\n this.isMatchIgnored = true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {string}\n */\nfunction escapeHTML(value) {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/**\n * performs a shallow merge of multiple objects into one\n *\n * @template T\n * @param {T} original\n * @param {Record<string,any>[]} objects\n * @returns {T} a single new object\n */\nfunction inherit$1(original, ...objects) {\n /** @type Record<string,any> */\n const result = Object.create(null);\n\n for (const key in original) {\n result[key] = original[key];\n }\n objects.forEach(function(obj) {\n for (const key in obj) {\n result[key] = obj[key];\n }\n });\n return /** @type {T} */ (result);\n}\n\n/**\n * @typedef {object} Renderer\n * @property {(text: string) => void} addText\n * @property {(node: Node) => void} openNode\n * @property {(node: Node) => void} closeNode\n * @property {() => string} value\n */\n\n/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */\n/** @typedef {{walk: (r: Renderer) => void}} Tree */\n/** */\n\nconst SPAN_CLOSE = '</span>';\n\n/**\n * Determines if a node needs to be wrapped in <span>\n *\n * @param {Node} node */\nconst emitsWrappingTags = (node) => {\n // rarely we can have a sublanguage where language is undefined\n // TODO: track down why\n return !!node.scope;\n};\n\n/**\n *\n * @param {string} name\n * @param {{prefix:string}} options\n */\nconst scopeToCSSClass = (name, { prefix }) => {\n // sub-language\n if (name.startsWith(\"language:\")) {\n return name.replace(\"language:\", \"language-\");\n }\n // tiered scope: comment.line\n if (name.includes(\".\")) {\n const pieces = name.split(\".\");\n return [\n `${prefix}${pieces.shift()}`,\n ...(pieces.map((x, i) => `${x}${\"_\".repeat(i + 1)}`))\n ].join(\" \");\n }\n // simple scope\n return `${prefix}${name}`;\n};\n\n/** @type {Renderer} */\nclass HTMLRenderer {\n /**\n * Creates a new HTMLRenderer\n *\n * @param {Tree} parseTree - the parse tree (must support `walk` API)\n * @param {{classPrefix: string}} options\n */\n constructor(parseTree, options) {\n this.buffer = \"\";\n this.classPrefix = options.classPrefix;\n parseTree.walk(this);\n }\n\n /**\n * Adds texts to the output stream\n *\n * @param {string} text */\n addText(text) {\n this.buffer += escapeHTML(text);\n }\n\n /**\n * Adds a node open to the output stream (if needed)\n *\n * @param {Node} node */\n openNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n const className = scopeToCSSClass(node.scope,\n { prefix: this.classPrefix });\n this.span(className);\n }\n\n /**\n * Adds a node close to the output stream (if needed)\n *\n * @param {Node} node */\n closeNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n this.buffer += SPAN_CLOSE;\n }\n\n /**\n * returns the accumulated buffer\n */\n value() {\n return this.buffer;\n }\n\n // helpers\n\n /**\n * Builds a span element\n *\n * @param {string} className */\n span(className) {\n this.buffer += `<span class=\"${className}\">`;\n }\n}\n\n/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */\n/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */\n/** @typedef {import('highlight.js').Emitter} Emitter */\n/** */\n\n/** @returns {DataNode} */\nconst newNode = (opts = {}) => {\n /** @type DataNode */\n const result = { children: [] };\n Object.assign(result, opts);\n return result;\n};\n\nclass TokenTree {\n constructor() {\n /** @type DataNode */\n this.rootNode = newNode();\n this.stack = [this.rootNode];\n }\n\n get top() {\n return this.stack[this.stack.length - 1];\n }\n\n get root() { return this.rootNode; }\n\n /** @param {Node} node */\n add(node) {\n this.top.children.push(node);\n }\n\n /** @param {string} scope */\n openNode(scope) {\n /** @type Node */\n const node = newNode({ scope });\n this.add(node);\n this.stack.push(node);\n }\n\n closeNode() {\n if (this.stack.length > 1) {\n return this.stack.pop();\n }\n // eslint-disable-next-line no-undefined\n return undefined;\n }\n\n closeAllNodes() {\n while (this.closeNode());\n }\n\n toJSON() {\n return JSON.stringify(this.rootNode, null, 4);\n }\n\n /**\n * @typedef { import(\"./html_renderer\").Renderer } Renderer\n * @param {Renderer} builder\n */\n walk(builder) {\n // this does not\n return this.constructor._walk(builder, this.rootNode);\n // this works\n // return TokenTree._walk(builder, this.rootNode);\n }\n\n /**\n * @param {Renderer} builder\n * @param {Node} node\n */\n static _walk(builder, node) {\n if (typeof node === \"string\") {\n builder.addText(node);\n } else if (node.children) {\n builder.openNode(node);\n node.children.forEach((child) => this._walk(builder, child));\n builder.closeNode(node);\n }\n return builder;\n }\n\n /**\n * @param {Node} node\n */\n static _collapse(node) {\n if (typeof node === \"string\") return;\n if (!node.children) return;\n\n if (node.children.every(el => typeof el === \"string\")) {\n // node.text = node.children.join(\"\");\n // delete node.children;\n node.children = [node.children.join(\"\")];\n } else {\n node.children.forEach((child) => {\n TokenTree._collapse(child);\n });\n }\n }\n}\n\n/**\n Currently this is all private API, but this is the minimal API necessary\n that an Emitter must implement to fully support the parser.\n\n Minimal interface:\n\n - addText(text)\n - __addSublanguage(emitter, subLanguageName)\n - startScope(scope)\n - endScope()\n - finalize()\n - toHTML()\n\n*/\n\n/**\n * @implements {Emitter}\n */\nclass TokenTreeEmitter extends TokenTree {\n /**\n * @param {*} options\n */\n constructor(options) {\n super();\n this.options = options;\n }\n\n /**\n * @param {string} text\n */\n addText(text) {\n if (text === \"\") { return; }\n\n this.add(text);\n }\n\n /** @param {string} scope */\n startScope(scope) {\n this.openNode(scope);\n }\n\n endScope() {\n this.closeNode();\n }\n\n /**\n * @param {Emitter & {root: DataNode}} emitter\n * @param {string} name\n */\n __addSublanguage(emitter, name) {\n /** @type DataNode */\n const node = emitter.root;\n if (name) node.scope = `language:${name}`;\n\n this.add(node);\n }\n\n toHTML() {\n const renderer = new HTMLRenderer(this, this.options);\n return renderer.value();\n }\n\n finalize() {\n this.closeAllNodes();\n return true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction anyNumberOfTimes(re) {\n return concat('(?:', re, ')*');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction optional(re) {\n return concat('(?:', re, ')?');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array<string | RegExp | Object> } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '('\n + (opts.capture ? \"\" : \"?:\")\n + args.map((x) => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\n/**\n * @param {RegExp | string} re\n * @returns {number}\n */\nfunction countMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n}\n\n/**\n * Does lexeme start with a regular expression match at the beginning\n * @param {RegExp} re\n * @param {string} lexeme\n */\nfunction startsWith(re, lexeme) {\n const match = re && re.exec(lexeme);\n return match && match.index === 0;\n}\n\n// BACKREF_RE matches an open parenthesis or backreference. To avoid\n// an incorrect parse, it additionally matches the following:\n// - [...] elements, where the meaning of parentheses and escapes change\n// - other escape sequences, so we do not misparse escape sequences as\n// interesting elements\n// - non-matching or lookahead parentheses, which do not capture. These\n// follow the '(' with a '?'.\nconst BACKREF_RE = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n\n// **INTERNAL** Not intended for outside usage\n// join logically computes regexps.join(separator), but fixes the\n// backreferences so they continue to match.\n// it also places each individual regular expression into it's own\n// match group, keeping track of the sequencing of those match groups\n// is currently an exercise for the caller. :-)\n/**\n * @param {(string | RegExp)[]} regexps\n * @param {{joinWith: string}} opts\n * @returns {string}\n */\nfunction _rewriteBackreferences(regexps, { joinWith }) {\n let numCaptures = 0;\n\n return regexps.map((regex) => {\n numCaptures += 1;\n const offset = numCaptures;\n let re = source(regex);\n let out = '';\n\n while (re.length > 0) {\n const match = BACKREF_RE.exec(re);\n if (!match) {\n out += re;\n break;\n }\n out += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] === '\\\\' && match[1]) {\n // Adjust the backreference.\n out += '\\\\' + String(Number(match[1]) + offset);\n } else {\n out += match[0];\n if (match[0] === '(') {\n numCaptures++;\n }\n }\n }\n return out;\n }).map(re => `(${re})`).join(joinWith);\n}\n\n/** @typedef {import('highlight.js').Mode} Mode */\n/** @typedef {import('highlight.js').ModeCallback} ModeCallback */\n\n// Common regexps\nconst MATCH_NOTHING_RE = /\\b\\B/;\nconst IDENT_RE = '[a-zA-Z]\\\\w*';\nconst UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\nconst NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\nconst C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\nconst BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\nconst RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n/**\n* @param { Partial<Mode> & {binary?: string | RegExp} } opts\n*/\nconst SHEBANG = (opts = {}) => {\n const beginShebang = /^#![ ]*\\//;\n if (opts.binary) {\n opts.begin = concat(\n beginShebang,\n /.*\\b/,\n opts.binary,\n /\\b.*/);\n }\n return inherit$1({\n scope: 'meta',\n begin: beginShebang,\n end: /$/,\n relevance: 0,\n /** @type {ModeCallback} */\n \"on:begin\": (m, resp) => {\n if (m.index !== 0) resp.ignoreMatch();\n }\n }, opts);\n};\n\n// Common modes\nconst BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n};\nconst APOS_STRING_MODE = {\n scope: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst QUOTE_STRING_MODE = {\n scope: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n};\n/**\n * Creates a comment mode\n *\n * @param {string | RegExp} begin\n * @param {string | RegExp} end\n * @param {Mode | {}} [modeOptions]\n * @returns {Partial<Mode>}\n */\nconst COMMENT = function(begin, end, modeOptions = {}) {\n const mode = inherit$1(\n {\n scope: 'comment',\n begin,\n end,\n contains: []\n },\n modeOptions\n );\n mode.contains.push({\n scope: 'doctag',\n // hack to avoid the space from being included. the space is necessary to\n // match here to prevent the plain text rule below from gobbling up doctags\n begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',\n end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,\n excludeBegin: true,\n relevance: 0\n });\n const ENGLISH_WORD = either(\n // list of common 1 and 2 letter words in English\n \"I\",\n \"a\",\n \"is\",\n \"so\",\n \"us\",\n \"to\",\n \"at\",\n \"if\",\n \"in\",\n \"it\",\n \"on\",\n // note: this is not an exhaustive list of contractions, just popular ones\n /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, // contractions - can't we'd they're let's, etc\n /[A-Za-z]+[-][a-z]+/, // `no-way`, etc.\n /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences\n );\n // looking like plain text, more likely to be a comment\n mode.contains.push(\n {\n // TODO: how to include \", (, ) without breaking grammars that use these for\n // comment delimiters?\n // begin: /[ ]+([()\"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()\":]?([.][ ]|[ ]|\\))){3}/\n // ---\n\n // this tries to find sequences of 3 english words in a row (without any\n // \"programming\" type syntax) this gives us a strong signal that we've\n // TRULY found a comment - vs perhaps scanning with the wrong language.\n // It's possible to find something that LOOKS like the start of the\n // comment - but then if there is no readable text - good chance it is a\n // false match and not a comment.\n //\n // for a visual example please see:\n // https://github.com/highlightjs/highlight.js/issues/2827\n\n begin: concat(\n /[ ]+/, // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */\n '(',\n ENGLISH_WORD,\n /[.]?[:]?([.][ ]|[ ])/,\n '){3}') // look for 3 words in a row\n }\n );\n return mode;\n};\nconst C_LINE_COMMENT_MODE = COMMENT('//', '$');\nconst C_BLOCK_COMMENT_MODE = COMMENT('/\\\\*', '\\\\*/');\nconst HASH_COMMENT_MODE = COMMENT('#', '$');\nconst NUMBER_MODE = {\n scope: 'number',\n begin: NUMBER_RE,\n relevance: 0\n};\nconst C_NUMBER_MODE = {\n scope: 'number',\n begin: C_NUMBER_RE,\n relevance: 0\n};\nconst BINARY_NUMBER_MODE = {\n scope: 'number',\n begin: BINARY_NUMBER_RE,\n relevance: 0\n};\nconst REGEXP_MODE = {\n scope: \"regexp\",\n begin: /\\/(?=[^/\\n]*\\/)/,\n end: /\\/[gimuy]*/,\n contains: [\n BACKSLASH_ESCAPE,\n {\n begin: /\\[/,\n end: /\\]/,\n relevance: 0,\n contains: [BACKSLASH_ESCAPE]\n }\n ]\n};\nconst TITLE_MODE = {\n scope: 'title',\n begin: IDENT_RE,\n relevance: 0\n};\nconst UNDERSCORE_TITLE_MODE = {\n scope: 'title',\n begin: UNDERSCORE_IDENT_RE,\n relevance: 0\n};\nconst METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + UNDERSCORE_IDENT_RE,\n relevance: 0\n};\n\n/**\n * Adds end same as begin mechanics to a mode\n *\n * Your mode must include at least a single () match group as that first match\n * group is what is used for comparison\n * @param {Partial<Mode>} mode\n */\nconst END_SAME_AS_BEGIN = function(mode) {\n return Object.assign(mode,\n {\n /** @type {ModeCallback} */\n 'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },\n /** @type {ModeCallback} */\n 'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }\n });\n};\n\nvar MODES = /*#__PURE__*/Object.freeze({\n __proto__: null,\n APOS_STRING_MODE: APOS_STRING_MODE,\n BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,\n BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,\n BINARY_NUMBER_RE: BINARY_NUMBER_RE,\n COMMENT: COMMENT,\n C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,\n C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,\n C_NUMBER_MODE: C_NUMBER_MODE,\n C_NUMBER_RE: C_NUMBER_RE,\n END_SAME_AS_BEGIN: END_SAME_AS_BEGIN,\n HASH_COMMENT_MODE: HASH_COMMENT_MODE,\n IDENT_RE: IDENT_RE,\n MATCH_NOTHING_RE: MATCH_NOTHING_RE,\n METHOD_GUARD: METHOD_GUARD,\n NUMBER_MODE: NUMBER_MODE,\n NUMBER_RE: NUMBER_RE,\n PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,\n QUOTE_STRING_MODE: QUOTE_STRING_MODE,\n REGEXP_MODE: REGEXP_MODE,\n RE_STARTERS_RE: RE_STARTERS_RE,\n SHEBANG: SHEBANG,\n TITLE_MODE: TITLE_MODE,\n UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,\n UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE\n});\n\n/**\n@typedef {import('highlight.js').CallbackResponse} CallbackResponse\n@typedef {import('highlight.js').CompilerExt} CompilerExt\n*/\n\n// Grammar extensions / plugins\n// See: https://github.com/highlightjs/highlight.js/issues/2833\n\n// Grammar extensions allow \"syntactic sugar\" to be added to the grammar modes\n// without requiring any underlying changes to the compiler internals.\n\n// `compileMatch` being the perfect small example of now allowing a grammar\n// author to write `match` when they desire to match a single expression rather\n// than being forced to use `begin`. The extension then just moves `match` into\n// `begin` when it runs. Ie, no features have been added, but we've just made\n// the experience of writing (and reading grammars) a little bit nicer.\n\n// ------\n\n// TODO: We need negative look-behind support to do this properly\n/**\n * Skip a match if it has a preceding dot\n *\n * This is used for `beginKeywords` to prevent matching expressions such as\n * `bob.keyword.do()`. The mode compiler automatically wires this up as a\n * special _internal_ 'on:begin' callback for modes with `beginKeywords`\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\nfunction skipIfHasPrecedingDot(match, response) {\n const before = match.input[match.index - 1];\n if (before === \".\") {\n response.ignoreMatch();\n }\n}\n\n/**\n *\n * @type {CompilerExt}\n */\nfunction scopeClassName(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.className !== undefined) {\n mode.scope = mode.className;\n delete mode.className;\n }\n}\n\n/**\n * `beginKeywords` syntactic sugar\n * @type {CompilerExt}\n */\nfunction beginKeywords(mode, parent) {\n if (!parent) return;\n if (!mode.beginKeywords) return;\n\n // for languages with keywords that include non-word characters checking for\n // a word boundary is not sufficient, so instead we check for a word boundary\n // or whitespace - this does no harm in any case since our keyword engine\n // doesn't allow spaces in keywords anyways and we still check for the boundary\n // first\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\\\.)(?=\\\\b|\\\\s)';\n mode.__beforeBegin = skipIfHasPrecedingDot;\n mode.keywords = mode.keywords || mode.beginKeywords;\n delete mode.beginKeywords;\n\n // prevents double relevance, the keywords themselves provide\n // relevance, the mode doesn't need to double it\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 0;\n}\n\n/**\n * Allow `illegal` to contain an array of illegal values\n * @type {CompilerExt}\n */\nfunction compileIllegal(mode, _parent) {\n if (!Array.isArray(mode.illegal)) return;\n\n mode.illegal = either(...mode.illegal);\n}\n\n/**\n * `match` to match a single expression for readability\n * @type {CompilerExt}\n */\nfunction compileMatch(mode, _parent) {\n if (!mode.match) return;\n if (mode.begin || mode.end) throw new Error(\"begin & end are not supported with match\");\n\n mode.begin = mode.match;\n delete mode.match;\n}\n\n/**\n * provides the default 1 relevance to all modes\n * @type {CompilerExt}\n */\nfunction compileRelevance(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 1;\n}\n\n// allow beforeMatch to act as a \"qualifier\" for the match\n// the full match begin must be [beforeMatch][begin]\nconst beforeMatchExt = (mode, parent) => {\n if (!mode.beforeMatch) return;\n // starts conflicts with endsParent which we need to make sure the child\n // rule is not matched multiple times\n if (mode.starts) throw new Error(\"beforeMatch cannot be used with starts\");\n\n const originalMode = Object.assign({}, mode);\n Object.keys(mode).forEach((key) => { delete mode[key]; });\n\n mode.keywords = originalMode.keywords;\n mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));\n mode.starts = {\n relevance: 0,\n contains: [\n Object.assign(originalMode, { endsParent: true })\n ]\n };\n mode.relevance = 0;\n\n delete originalMode.beforeMatch;\n};\n\n// keywords that should have no default relevance value\nconst COMMON_KEYWORDS = [\n 'of',\n 'and',\n 'for',\n 'in',\n 'not',\n 'or',\n 'if',\n 'then',\n 'parent', // common variable name\n 'list', // common variable name\n 'value' // common variable name\n];\n\nconst DEFAULT_KEYWORD_SCOPE = \"keyword\";\n\n/**\n * Given raw keywords from a language definition, compile them.\n *\n * @param {string | Record<string,string|string[]> | Array<string>} rawKeywords\n * @param {boolean} caseInsensitive\n */\nfunction compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {\n /** @type {import(\"highlight.js/private\").KeywordDict} */\n const compiledKeywords = Object.create(null);\n\n // input can be a string of keywords, an array of keywords, or a object with\n // named keys representing scopeName (which can then point to a string or array)\n if (typeof rawKeywords === 'string') {\n compileList(scopeName, rawKeywords.split(\" \"));\n } else if (Array.isArray(rawKeywords)) {\n compileList(scopeName, rawKeywords);\n } else {\n Object.keys(rawKeywords).forEach(function(scopeName) {\n // collapse all our objects back into the parent object\n Object.assign(\n compiledKeywords,\n compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName)\n );\n });\n }\n return compiledKeywords;\n\n // ---\n\n /**\n * Compiles an individual list of keywords\n *\n * Ex: \"for if when while|5\"\n *\n * @param {string} scopeName\n * @param {Array<string>} keywordList\n */\n function compileList(scopeName, keywordList) {\n if (caseInsensitive) {\n keywordList = keywordList.map(x => x.toLowerCase());\n }\n keywordList.forEach(function(keyword) {\n const pair = keyword.split('|');\n compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];\n });\n }\n}\n\n/**\n * Returns the proper score for a given keyword\n *\n * Also takes into account comment keywords, which will be scored 0 UNLESS\n * another score has been manually assigned.\n * @param {string} keyword\n * @param {string} [providedScore]\n */\nfunction scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore) {\n return Number(providedScore);\n }\n\n return commonKeyword(keyword) ? 0 : 1;\n}\n\n/**\n * Determines if a given keyword is common or not\n *\n * @param {string} keyword */\nfunction commonKeyword(keyword) {\n return COMMON_KEYWORDS.includes(keyword.toLowerCase());\n}\n\n/*\n\nFor the reasoning behind this please see:\nhttps://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419\n\n*/\n\n/**\n * @type {Record<string, boolean>}\n */\nconst seenDeprecations = {};\n\n/**\n * @param {string} message\n */\nconst error = (message) => {\n console.error(message);\n};\n\n/**\n * @param {string} message\n * @param {any} args\n */\nconst warn = (message, ...args) => {\n console.log(`WARN: ${message}`, ...args);\n};\n\n/**\n * @param {string} version\n * @param {string} message\n */\nconst deprecated = (version, message) => {\n if (seenDeprecations[`${version}/${message}`]) return;\n\n console.log(`Deprecated as of ${version}. ${message}`);\n seenDeprecations[`${version}/${message}`] = true;\n};\n\n/* eslint-disable no-throw-literal */\n\n/**\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n*/\n\nconst MultiClassError = new Error();\n\n/**\n * Renumbers labeled scope names to account for additional inner match\n * groups that otherwise would break everything.\n *\n * Lets say we 3 match scopes:\n *\n * { 1 => ..., 2 => ..., 3 => ... }\n *\n * So what we need is a clean match like this:\n *\n * (a)(b)(c) => [ \"a\", \"b\", \"c\" ]\n *\n * But this falls apart with inner match groups:\n *\n * (a)(((b)))(c) => [\"a\", \"b\", \"b\", \"b\", \"c\" ]\n *\n * Our scopes are now \"out of alignment\" and we're repeating `b` 3 times.\n * What needs to happen is the numbers are remapped:\n *\n * { 1 => ..., 2 => ..., 5 => ... }\n *\n * We also need to know that the ONLY groups that should be output\n * are 1, 2, and 5. This function handles this behavior.\n *\n * @param {CompiledMode} mode\n * @param {Array<RegExp | string>} regexes\n * @param {{key: \"beginScope\"|\"endScope\"}} opts\n */\nfunction remapScopeNames(mode, regexes, { key }) {\n let offset = 0;\n const scopeNames = mode[key];\n /** @type Record<number,boolean> */\n const emit = {};\n /** @type Record<number,string> */\n const positions = {};\n\n for (let i = 1; i <= regexes.length; i++) {\n positions[i + offset] = scopeNames[i];\n emit[i + offset] = true;\n offset += countMatchGroups(regexes[i - 1]);\n }\n // we use _emit to keep track of which match groups are \"top-level\" to avoid double\n // output from inside match groups\n mode[key] = positions;\n mode[key]._emit = emit;\n mode[key]._multi = true;\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction beginMultiClass(mode) {\n if (!Array.isArray(mode.begin)) return;\n\n if (mode.skip || mode.excludeBegin || mode.returnBegin) {\n error(\"skip, excludeBegin, returnBegin not compatible with beginScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.beginScope !== \"object\" || mode.beginScope === null) {\n error(\"beginScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.begin, { key: \"beginScope\" });\n mode.begin = _rewriteBackreferences(mode.begin, { joinWith: \"\" });\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction endMultiClass(mode) {\n if (!Array.isArray(mode.end)) return;\n\n if (mode.skip || mode.excludeEnd || mode.returnEnd) {\n error(\"skip, excludeEnd, returnEnd not compatible with endScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.endScope !== \"object\" || mode.endScope === null) {\n error(\"endScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.end, { key: \"endScope\" });\n mode.end = _rewriteBackreferences(mode.end, { joinWith: \"\" });\n}\n\n/**\n * this exists only to allow `scope: {}` to be used beside `match:`\n * Otherwise `beginScope` would necessary and that would look weird\n\n {\n match: [ /def/, /\\w+/ ]\n scope: { 1: \"keyword\" , 2: \"title\" }\n }\n\n * @param {CompiledMode} mode\n */\nfunction scopeSugar(mode) {\n if (mode.scope && typeof mode.scope === \"object\" && mode.scope !== null) {\n mode.beginScope = mode.scope;\n delete mode.scope;\n }\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction MultiClass(mode) {\n scopeSugar(mode);\n\n if (typeof mode.beginScope === \"string\") {\n mode.beginScope = { _wrap: mode.beginScope };\n }\n if (typeof mode.endScope === \"string\") {\n mode.endScope = { _wrap: mode.endScope };\n }\n\n beginMultiClass(mode);\n endMultiClass(mode);\n}\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage\n*/\n\n// compilation\n\n/**\n * Compiles a language definition result\n *\n * Given the raw result of a language definition (Language), compiles this so\n * that it is ready for highlighting code.\n * @param {Language} language\n * @returns {CompiledLanguage}\n */\nfunction compileLanguage(language) {\n /**\n * Builds a regex with the case sensitivity of the current language\n *\n * @param {RegExp | string} value\n * @param {boolean} [global]\n */\n function langRe(value, global) {\n return new RegExp(\n source(value),\n 'm'\n + (language.case_insensitive ? 'i' : '')\n + (language.unicodeRegex ? 'u' : '')\n + (global ? 'g' : '')\n );\n }\n\n /**\n Stores multiple regular expressions and allows you to quickly search for\n them all in a string simultaneously - returning the first match. It does\n this by creating a huge (a|b|c) regex - each individual item wrapped with ()\n and joined by `|` - using match groups to track position. When a match is\n found checking which position in the array has content allows us to figure\n out which of the original regexes / match groups triggered the match.\n\n The match object itself (the result of `Regex.exec`) is returned but also\n enhanced by merging in any meta-data that was registered with the regex.\n This is how we keep track of which mode matched, and what type of rule\n (`illegal`, `begin`, end, etc).\n */\n class MultiRegex {\n constructor() {\n this.matchIndexes = {};\n // @ts-ignore\n this.regexes = [];\n this.matchAt = 1;\n this.position = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n opts.position = this.position++;\n // @ts-ignore\n this.matchIndexes[this.matchAt] = opts;\n this.regexes.push([opts, re]);\n this.matchAt += countMatchGroups(re) + 1;\n }\n\n compile() {\n if (this.regexes.length === 0) {\n // avoids the need to check length every time exec is called\n // @ts-ignore\n this.exec = () => null;\n }\n const terminators = this.regexes.map(el => el[1]);\n this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: '|' }), true);\n this.lastIndex = 0;\n }\n\n /** @param {string} s */\n exec(s) {\n this.matcherRe.lastIndex = this.lastIndex;\n const match = this.matcherRe.exec(s);\n if (!match) { return null; }\n\n // eslint-disable-next-line no-undefined\n const i = match.findIndex((el, i) => i > 0 && el !== undefined);\n // @ts-ignore\n const matchData = this.matchIndexes[i];\n // trim off any earlier non-relevant match groups (ie, the other regex\n // match groups that make up the multi-matcher)\n match.splice(0, i);\n\n return Object.assign(match, matchData);\n }\n }\n\n /*\n Created to solve the key deficiently with MultiRegex - there is no way to\n test for multiple matches at a single location. Why would we need to do\n that? In the future a more dynamic engine will allow certain matches to be\n ignored. An example: if we matched say the 3rd regex in a large group but\n decided to ignore it - we'd need to started testing again at the 4th\n regex... but MultiRegex itself gives us no real way to do that.\n\n So what this class creates MultiRegexs on the fly for whatever search\n position they are needed.\n\n NOTE: These additional MultiRegex objects are created dynamically. For most\n grammars most of the time we will never actually need anything more than the\n first MultiRegex - so this shouldn't have too much overhead.\n\n Say this is our search group, and we match regex3, but wish to ignore it.\n\n regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0\n\n What we need is a new MultiRegex that only includes the remaining\n possibilities:\n\n regex4 | regex5 ' ie, startAt = 3\n\n This class wraps all that complexity up in a simple API... `startAt` decides\n where in the array of expressions to start doing the matching. It\n auto-increments, so if a match is found at position 2, then startAt will be\n set to 3. If the end is reached startAt will return to 0.\n\n MOST of the time the parser will be setting startAt manually to 0.\n */\n class ResumableMultiRegex {\n constructor() {\n // @ts-ignore\n this.rules = [];\n // @ts-ignore\n this.multiRegexes = [];\n this.count = 0;\n\n this.lastIndex = 0;\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n getMatcher(index) {\n if (this.multiRegexes[index]) return this.multiRegexes[index];\n\n const matcher = new MultiRegex();\n this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));\n matcher.compile();\n this.multiRegexes[index] = matcher;\n return matcher;\n }\n\n resumingScanAtSamePosition() {\n return this.regexIndex !== 0;\n }\n\n considerAll() {\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n this.rules.push([re, opts]);\n if (opts.type === \"begin\") this.count++;\n }\n\n /** @param {string} s */\n exec(s) {\n const m = this.getMatcher(this.regexIndex);\n m.lastIndex = this.lastIndex;\n let result = m.exec(s);\n\n // The following is because we have no easy way to say \"resume scanning at the\n // existing position but also skip the current rule ONLY\". What happens is\n // all prior rules are also skipped which can result in matching the wrong\n // thing. Example of matching \"booger\":\n\n // our matcher is [string, \"booger\", number]\n //\n // ....booger....\n\n // if \"booger\" is ignored then we'd really need a regex to scan from the\n // SAME position for only: [string, number] but ignoring \"booger\" (if it\n // was the first match), a simple resume would scan ahead who knows how\n // far looking only for \"number\", ignoring potential string matches (or\n // future \"booger\" matches that might be valid.)\n\n // So what we do: We execute two matchers, one resuming at the same\n // position, but the second full matcher starting at the position after:\n\n // /--- resume first regex match here (for [number])\n // |/---- full match here for [string, \"booger\", number]\n // vv\n // ....booger....\n\n // Which ever results in a match first is then used. So this 3-4 step\n // process essentially allows us to say \"match at this position, excluding\n // a prior rule that was ignored\".\n //\n // 1. Match \"booger\" first, ignore. Also proves that [string] does non match.\n // 2. Resume matching for [number]\n // 3. Match at index + 1 for [string, \"booger\", number]\n // 4. If #2 and #3 result in matches, which came first?\n if (this.resumingScanAtSamePosition()) {\n if (result && result.index === this.lastIndex) ; else { // use the second matcher result\n const m2 = this.getMatcher(0);\n m2.lastIndex = this.lastIndex + 1;\n result = m2.exec(s);\n }\n }\n\n if (result) {\n this.regexIndex += result.position + 1;\n if (this.regexIndex === this.count) {\n // wrap-around to considering all matches again\n this.considerAll();\n }\n }\n\n return result;\n }\n }\n\n /**\n * Given a mode, builds a huge ResumableMultiRegex that can be used to walk\n * the content and find matches.\n *\n * @param {CompiledMode} mode\n * @returns {ResumableMultiRegex}\n */\n function buildModeRegex(mode) {\n const mm = new ResumableMultiRegex();\n\n mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: \"begin\" }));\n\n if (mode.terminatorEnd) {\n mm.addRule(mode.terminatorEnd, { type: \"end\" });\n }\n if (mode.illegal) {\n mm.addRule(mode.illegal, { type: \"illegal\" });\n }\n\n return mm;\n }\n\n /** skip vs abort vs ignore\n *\n * @skip - The mode is still entered and exited normally (and contains rules apply),\n * but all content is held and added to the parent buffer rather than being\n * output when the mode ends. Mostly used with `sublanguage` to build up\n * a single large buffer than can be parsed by sublanguage.\n *\n * - The mode begin ands ends normally.\n * - Content matched is added to the parent mode buffer.\n * - The parser cursor is moved forward normally.\n *\n * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it\n * never matched) but DOES NOT continue to match subsequent `contains`\n * modes. Abort is bad/suboptimal because it can result in modes\n * farther down not getting applied because an earlier rule eats the\n * content but then aborts.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is added to the mode buffer.\n * - The parser cursor is moved forward accordingly.\n *\n * @ignore - Ignores the mode (as if it never matched) and continues to match any\n * subsequent `contains` modes. Ignore isn't technically possible with\n * the current parser implementation.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is ignored.\n * - The parser cursor is not moved forward.\n */\n\n /**\n * Compiles an individual mode\n *\n * This can raise an error if the mode contains certain detectable known logic\n * issues.\n * @param {Mode} mode\n * @param {CompiledMode | null} [parent]\n * @returns {CompiledMode | never}\n */\n function compileMode(mode, parent) {\n const cmode = /** @type CompiledMode */ (mode);\n if (mode.isCompiled) return cmode;\n\n [\n scopeClassName,\n // do this early so compiler extensions generally don't have to worry about\n // the distinction between match/begin\n compileMatch,\n MultiClass,\n beforeMatchExt\n ].forEach(ext => ext(mode, parent));\n\n language.compilerExtensions.forEach(ext => ext(mode, parent));\n\n // __beforeBegin is considered private API, internal use only\n mode.__beforeBegin = null;\n\n [\n beginKeywords,\n // do this later so compiler extensions that come earlier have access to the\n // raw array if they wanted to perhaps manipulate it, etc.\n compileIllegal,\n // default to 1 relevance if not specified\n compileRelevance\n ].forEach(ext => ext(mode, parent));\n\n mode.isCompiled = true;\n\n let keywordPattern = null;\n if (typeof mode.keywords === \"object\" && mode.keywords.$pattern) {\n // we need a copy because keywords might be compiled multiple times\n // so we can't go deleting $pattern from the original on the first\n // pass\n mode.keywords = Object.assign({}, mode.keywords);\n keywordPattern = mode.keywords.$pattern;\n delete mode.keywords.$pattern;\n }\n keywordPattern = keywordPattern || /\\w+/;\n\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n }\n\n cmode.keywordPatternRe = langRe(keywordPattern, true);\n\n if (parent) {\n if (!mode.begin) mode.begin = /\\B|\\b/;\n cmode.beginRe = langRe(cmode.begin);\n if (!mode.end && !mode.endsWithParent) mode.end = /\\B|\\b/;\n if (mode.end) cmode.endRe = langRe(cmode.end);\n cmode.terminatorEnd = source(cmode.end) || '';\n if (mode.endsWithParent && parent.terminatorEnd) {\n cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;\n }\n }\n if (mode.illegal) cmode.illegalRe = langRe(/** @type {RegExp | string} */ (mode.illegal));\n if (!mode.contains) mode.contains = [];\n\n mode.contains = [].concat(...mode.contains.map(function(c) {\n return expandOrCloneMode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });\n\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n\n cmode.matcher = buildModeRegex(cmode);\n return cmode;\n }\n\n if (!language.compilerExtensions) language.compilerExtensions = [];\n\n // self is not valid at the top-level\n if (language.contains && language.contains.includes('self')) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\");\n }\n\n // we need a null object, which inherit will guarantee\n language.classNameAliases = inherit$1(language.classNameAliases || {});\n\n return compileMode(/** @type Mode */ (language));\n}\n\n/**\n * Determines if a mode has a dependency on it's parent or not\n *\n * If a mode does have a parent dependency then often we need to clone it if\n * it's used in multiple places so that each copy points to the correct parent,\n * where-as modes without a parent can often safely be re-used at the bottom of\n * a mode chain.\n *\n * @param {Mode | null} mode\n * @returns {boolean} - is there a dependency on the parent?\n * */\nfunction dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n}\n\n/**\n * Expands a mode or clones it if necessary\n *\n * This is necessary for modes with parental dependenceis (see notes on\n * `dependencyOnParent`) and for nodes that have `variants` - which must then be\n * exploded into their own individual modes at compile time.\n *\n * @param {Mode} mode\n * @returns {Mode | Mode[]}\n * */\nfunction expandOrCloneMode(mode) {\n if (mode.variants && !mode.cachedVariants) {\n mode.cachedVariants = mode.variants.map(function(variant) {\n return inherit$1(mode, { variants: null }, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cachedVariants) {\n return mode.cachedVariants;\n }\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode)) {\n return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });\n }\n\n if (Object.isFrozen(mode)) {\n return inherit$1(mode);\n }\n\n // no special dependency issues, just return ourselves\n return mode;\n}\n\nvar version = \"11.11.1\";\n\nclass HTMLInjectionError extends Error {\n constructor(reason, html) {\n super(reason);\n this.name = \"HTMLInjectionError\";\n this.html = html;\n }\n}\n\n/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').CompiledScope} CompiledScope\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSApi} HLJSApi\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').PluginEvent} PluginEvent\n@typedef {import('highlight.js').HLJSOptions} HLJSOptions\n@typedef {import('highlight.js').LanguageFn} LanguageFn\n@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement\n@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext\n@typedef {import('highlight.js/private').MatchType} MatchType\n@typedef {import('highlight.js/private').KeywordData} KeywordData\n@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch\n@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError\n@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult\n@typedef {import('highlight.js').HighlightOptions} HighlightOptions\n@typedef {import('highlight.js').HighlightResult} HighlightResult\n*/\n\n\nconst escape = escapeHTML;\nconst inherit = inherit$1;\nconst NO_MATCH = Symbol(\"nomatch\");\nconst MAX_KEYWORD_HITS = 7;\n\n/**\n * @param {any} hljs - object that is extended (legacy)\n * @returns {HLJSApi}\n */\nconst HLJS = function(hljs) {\n // Global internal variables used within the highlight.js library.\n /** @type {Record<string, Language>} */\n const languages = Object.create(null);\n /** @type {Record<string, string>} */\n const aliases = Object.create(null);\n /** @type {HLJSPlugin[]} */\n const plugins = [];\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n let SAFE_MODE = true;\n const LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n /** @type {Language} */\n const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n /** @type HLJSOptions */\n let options = {\n ignoreUnescapedHTML: false,\n throwUnescapedHTML: false,\n noHighlightRe: /^(no-?highlight)$/i,\n languageDetectRe: /\\blang(?:uage)?-([\\w-]+)\\b/i,\n classPrefix: 'hljs-',\n cssSelector: 'pre code',\n languages: null,\n // beta configuration options, subject to change, welcome to discuss\n // https://github.com/highlightjs/highlight.js/issues/1086\n __emitter: TokenTreeEmitter\n };\n\n /* Utility functions */\n\n /**\n * Tests a language name to see if highlighting should be skipped\n * @param {string} languageName\n */\n function shouldNotHighlight(languageName) {\n return options.noHighlightRe.test(languageName);\n }\n\n /**\n * @param {HighlightedHTMLElement} block - the HTML element to determine language for\n */\n function blockLanguage(block) {\n let classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n const match = options.languageDetectRe.exec(classes);\n if (match) {\n const language = getLanguage(match[1]);\n if (!language) {\n warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n\n return classes\n .split(/\\s+/)\n .find((_class) => shouldNotHighlight(_class) || getLanguage(_class));\n }\n\n /**\n * Core highlighting function.\n *\n * OLD API\n * highlight(lang, code, ignoreIllegals, continuation)\n *\n * NEW API\n * highlight(code, {lang, ignoreIllegals})\n *\n * @param {string} codeOrLanguageName - the language to use for highlighting\n * @param {string | HighlightOptions} optionsOrCode - the code to highlight\n * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n *\n * @returns {HighlightResult} Result - an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {string} code - the original raw code\n * @property {CompiledMode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {\n let code = \"\";\n let languageName = \"\";\n if (typeof optionsOrCode === \"object\") {\n code = codeOrLanguageName;\n ignoreIllegals = optionsOrCode.ignoreIllegals;\n languageName = optionsOrCode.language;\n } else {\n // old API\n deprecated(\"10.7.0\", \"highlight(lang, code, ...args) has been deprecated.\");\n deprecated(\"10.7.0\", \"Please use highlight(code, options) instead.\\nhttps://github.com/highlightjs/highlight.js/issues/2277\");\n languageName = codeOrLanguageName;\n code = optionsOrCode;\n }\n\n // https://github.com/highlightjs/highlight.js/issues/3149\n // eslint-disable-next-line no-undefined\n if (ignoreIllegals === undefined) { ignoreIllegals = true; }\n\n /** @type {BeforeHighlightContext} */\n const context = {\n code,\n language: languageName\n };\n // the plugin can change the desired language or the code to be highlighted\n // just be changing the object it was passed\n fire(\"before:highlight\", context);\n\n // a before plugin can usurp the result completely by providing it's own\n // in which case we don't even need to call highlight\n const result = context.result\n ? context.result\n : _highlight(context.language, context.code, ignoreIllegals);\n\n result.code = context.code;\n // the plugin can change anything in result to suite it\n fire(\"after:highlight\", result);\n\n return result;\n }\n\n /**\n * private highlight that's used internally and does not fire callbacks\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} codeToHighlight - the code to highlight\n * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n * @param {CompiledMode?} [continuation] - current continuation mode, if any\n * @returns {HighlightResult} - result of the highlight operation\n */\n function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {\n const keywordHits = Object.create(null);\n\n /**\n * Return keyword data if a match is a keyword\n * @param {CompiledMode} mode - current mode\n * @param {string} matchText - the textual match\n * @returns {KeywordData | false}\n */\n function keywordData(mode, matchText) {\n return mode.keywords[matchText];\n }\n\n function processKeywords() {\n if (!top.keywords) {\n emitter.addText(modeBuffer);\n return;\n }\n\n let lastIndex = 0;\n top.keywordPatternRe.lastIndex = 0;\n let match = top.keywordPatternRe.exec(modeBuffer);\n let buf = \"\";\n\n while (match) {\n buf += modeBuffer.substring(lastIndex, match.index);\n const word = language.case_insensitive ? match[0].toLowerCase() : match[0];\n const data = keywordData(top, word);\n if (data) {\n const [kind, keywordRelevance] = data;\n emitter.addText(buf);\n buf = \"\";\n\n keywordHits[word] = (keywordHits[word] || 0) + 1;\n if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;\n if (kind.startsWith(\"_\")) {\n // _ implied for relevance only, do not highlight\n // by applying a class name\n buf += match[0];\n } else {\n const cssClass = language.classNameAliases[kind] || kind;\n emitKeyword(match[0], cssClass);\n }\n } else {\n buf += match[0];\n }\n lastIndex = top.keywordPatternRe.lastIndex;\n match = top.keywordPatternRe.exec(modeBuffer);\n }\n buf += modeBuffer.substring(lastIndex);\n emitter.addText(buf);\n }\n\n function processSubLanguage() {\n if (modeBuffer === \"\") return;\n /** @type HighlightResult */\n let result = null;\n\n if (typeof top.subLanguage === 'string') {\n if (!languages[top.subLanguage]) {\n emitter.addText(modeBuffer);\n return;\n }\n result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);\n continuations[top.subLanguage] = /** @type {CompiledMode} */ (result._top);\n } else {\n result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);\n }\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n emitter.__addSublanguage(result._emitter, result.language);\n }\n\n function processBuffer() {\n if (top.subLanguage != null) {\n processSubLanguage();\n } else {\n processKeywords();\n }\n modeBuffer = '';\n }\n\n /**\n * @param {string} text\n * @param {string} scope\n */\n function emitKeyword(keyword, scope) {\n if (keyword === \"\") return;\n\n emitter.startScope(scope);\n emitter.addText(keyword);\n emitter.endScope();\n }\n\n /**\n * @param {CompiledScope} scope\n * @param {RegExpMatchArray} match\n */\n function emitMultiClass(scope, match) {\n let i = 1;\n const max = match.length - 1;\n while (i <= max) {\n if (!scope._emit[i]) { i++; continue; }\n const klass = language.classNameAliases[scope[i]] || scope[i];\n const text = match[i];\n if (klass) {\n emitKeyword(text, klass);\n } else {\n modeBuffer = text;\n processKeywords();\n modeBuffer = \"\";\n }\n i++;\n }\n }\n\n /**\n * @param {CompiledMode} mode - new mode to start\n * @param {RegExpMatchArray} match\n */\n function startNewMode(mode, match) {\n if (mode.scope && typeof mode.scope === \"string\") {\n emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);\n }\n if (mode.beginScope) {\n // beginScope just wraps the begin match itself in a scope\n if (mode.beginScope._wrap) {\n emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);\n modeBuffer = \"\";\n } else if (mode.beginScope._multi) {\n // at this point modeBuffer should just be the match\n emitMultiClass(mode.beginScope, match);\n modeBuffer = \"\";\n }\n }\n\n top = Object.create(mode, { parent: { value: top } });\n return top;\n }\n\n /**\n * @param {CompiledMode } mode - the mode to potentially end\n * @param {RegExpMatchArray} match - the latest match\n * @param {string} matchPlusRemainder - match plus remainder of content\n * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode\n */\n function endOfMode(mode, match, matchPlusRemainder) {\n let matched = startsWith(mode.endRe, matchPlusRemainder);\n\n if (matched) {\n if (mode[\"on:end\"]) {\n const resp = new Response(mode);\n mode[\"on:end\"](match, resp);\n if (resp.isMatchIgnored) matched = false;\n }\n\n if (matched) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n }\n // even if on:end fires an `ignore` it's still possible\n // that we might trigger the end node because of a parent mode\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, match, matchPlusRemainder);\n }\n }\n\n /**\n * Handle matching but then ignoring a sequence of text\n *\n * @param {string} lexeme - string containing full match text\n */\n function doIgnore(lexeme) {\n if (top.matcher.regexIndex === 0) {\n // no more regexes to potentially match here, so we move the cursor forward one\n // space\n modeBuffer += lexeme[0];\n return 1;\n } else {\n // no need to move the cursor, we still have additional regexes to try and\n // match at this very spot\n resumeScanAtSamePosition = true;\n return 0;\n }\n }\n\n /**\n * Handle the start of a new potential mode match\n *\n * @param {EnhancedMatch} match - the current match\n * @returns {number} how far to advance the parse cursor\n */\n function doBeginMatch(match) {\n const lexeme = match[0];\n const newMode = match.rule;\n\n const resp = new Response(newMode);\n // first internal before callbacks, then the public ones\n const beforeCallbacks = [newMode.__beforeBegin, newMode[\"on:begin\"]];\n for (const cb of beforeCallbacks) {\n if (!cb) continue;\n cb(match, resp);\n if (resp.isMatchIgnored) return doIgnore(lexeme);\n }\n\n if (newMode.skip) {\n modeBuffer += lexeme;\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme;\n }\n }\n startNewMode(newMode, match);\n return newMode.returnBegin ? 0 : lexeme.length;\n }\n\n /**\n * Handle the potential end of mode\n *\n * @param {RegExpMatchArray} match - the current match\n */\n function doEndMatch(match) {\n const lexeme = match[0];\n const matchPlusRemainder = codeToHighlight.substring(match.index);\n\n const endMode = endOfMode(top, match, matchPlusRemainder);\n if (!endMode) { return NO_MATCH; }\n\n const origin = top;\n if (top.endScope && top.endScope._wrap) {\n processBuffer();\n emitKeyword(lexeme, top.endScope._wrap);\n } else if (top.endScope && top.endScope._multi) {\n processBuffer();\n emitMultiClass(top.endScope, match);\n } else if (origin.skip) {\n modeBuffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n modeBuffer = lexeme;\n }\n }\n do {\n if (top.scope) {\n emitter.closeNode();\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== endMode.parent);\n if (endMode.starts) {\n startNewMode(endMode.starts, match);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n function processContinuations() {\n const list = [];\n for (let current = top; current !== language; current = current.parent) {\n if (current.scope) {\n list.unshift(current.scope);\n }\n }\n list.forEach(item => emitter.openNode(item));\n }\n\n /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */\n let lastMatch = {};\n\n /**\n * Process an individual match\n *\n * @param {string} textBeforeMatch - text preceding the match (since the last match)\n * @param {EnhancedMatch} [match] - the match itself\n */\n function processLexeme(textBeforeMatch, match) {\n const lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type === \"begin\" && match.type === \"end\" && lastMatch.index === match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n modeBuffer += codeToHighlight.slice(match.index, match.index + 1);\n if (!SAFE_MODE) {\n /** @type {AnnotatedError} */\n const err = new Error(`0 width match regex (${languageName})`);\n err.languageName = languageName;\n err.badRule = lastMatch.rule;\n throw err;\n }\n return 1;\n }\n lastMatch = match;\n\n if (match.type === \"begin\") {\n return doBeginMatch(match);\n } else if (match.type === \"illegal\" && !ignoreIllegals) {\n // illegal match, we do not continue processing\n /** @type {AnnotatedError} */\n const err = new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.scope || '<unnamed>') + '\"');\n err.mode = top;\n throw err;\n } else if (match.type === \"end\") {\n const processed = doEndMatch(match);\n if (processed !== NO_MATCH) {\n return processed;\n }\n }\n\n // edge case for when illegal matches $ (end of line) which is technically\n // a 0 width match but not a begin/end match so it's not caught by the\n // first handler (when ignoreIllegals is true)\n if (match.type === \"illegal\" && lexeme === \"\") {\n // advance so we aren't stuck in an infinite loop\n modeBuffer += \"\\n\";\n return 1;\n }\n\n // infinite loops are BAD, this is a last ditch catch all. if we have a\n // decent number of iterations yet our index (cursor position in our\n // parsing) still 3x behind our index then something is very wrong\n // so we bail\n if (iterations > 100000 && iterations > match.index * 3) {\n const err = new Error('potential infinite loop, way more iterations than matches');\n throw err;\n }\n\n /*\n Why might be find ourselves here? An potential end match that was\n triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.\n (this could be because a callback requests the match be ignored, etc)\n\n This causes no real harm other than stopping a few times too many.\n */\n\n modeBuffer += lexeme;\n return lexeme.length;\n }\n\n const language = getLanguage(languageName);\n if (!language) {\n error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n\n const md = compileLanguage(language);\n let result = '';\n /** @type {CompiledMode} */\n let top = continuation || md;\n /** @type Record<string,CompiledMode> */\n const continuations = {}; // keep continuations for sub-languages\n const emitter = new options.__emitter(options);\n processContinuations();\n let modeBuffer = '';\n let relevance = 0;\n let index = 0;\n let iterations = 0;\n let resumeScanAtSamePosition = false;\n\n try {\n if (!language.__emitTokens) {\n top.matcher.considerAll();\n\n for (;;) {\n iterations++;\n if (resumeScanAtSamePosition) {\n // only regexes not matched previously will now be\n // considered for a potential match\n resumeScanAtSamePosition = false;\n } else {\n top.matcher.considerAll();\n }\n top.matcher.lastIndex = index;\n\n const match = top.matcher.exec(codeToHighlight);\n // console.log(\"match\", match[0], match.rule && match.rule.begin)\n\n if (!match) break;\n\n const beforeMatch = codeToHighlight.substring(index, match.index);\n const processedCount = processLexeme(beforeMatch, match);\n index = match.index + processedCount;\n }\n processLexeme(codeToHighlight.substring(index));\n } else {\n language.__emitTokens(codeToHighlight, emitter);\n }\n\n emitter.finalize();\n result = emitter.toHTML();\n\n return {\n language: languageName,\n value: result,\n relevance,\n illegal: false,\n _emitter: emitter,\n _top: top\n };\n } catch (err) {\n if (err.message && err.message.includes('Illegal')) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: true,\n relevance: 0,\n _illegalBy: {\n message: err.message,\n index,\n context: codeToHighlight.slice(index - 100, index + 100),\n mode: err.mode,\n resultSoFar: result\n },\n _emitter: emitter\n };\n } else if (SAFE_MODE) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: false,\n relevance: 0,\n errorRaised: err,\n _emitter: emitter,\n _top: top\n };\n } else {\n throw err;\n }\n }\n }\n\n /**\n * returns a valid highlight result, without actually doing any actual work,\n * auto highlight starts with this and it's possible for small snippets that\n * auto-detection may not find a better match\n * @param {string} code\n * @returns {HighlightResult}\n */\n function justTextHighlightResult(code) {\n const result = {\n value: escape(code),\n illegal: false,\n relevance: 0,\n _top: PLAINTEXT_LANGUAGE,\n _emitter: new options.__emitter(options)\n };\n result._emitter.addText(code);\n return result;\n }\n\n /**\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - secondBest (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n @param {string} code\n @param {Array<string>} [languageSubset]\n @returns {AutoHighlightResult}\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n const plaintext = justTextHighlightResult(code);\n\n const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name =>\n _highlight(name, code, false)\n );\n results.unshift(plaintext); // plaintext is always an option\n\n const sorted = results.sort((a, b) => {\n // sort base on relevance\n if (a.relevance !== b.relevance) return b.relevance - a.relevance;\n\n // always award the tie to the base language\n // ie if C++ and Arduino are tied, it's more likely to be C++\n if (a.language && b.language) {\n if (getLanguage(a.language).supersetOf === b.language) {\n return 1;\n } else if (getLanguage(b.language).supersetOf === a.language) {\n return -1;\n }\n }\n\n // otherwise say they are equal, which has the effect of sorting on\n // relevance while preserving the original ordering - which is how ties\n // have historically been settled, ie the language that comes first always\n // wins in the case of a tie\n return 0;\n });\n\n const [best, secondBest] = sorted;\n\n /** @type {AutoHighlightResult} */\n const result = best;\n result.secondBest = secondBest;\n\n return result;\n }\n\n /**\n * Builds new class name for block given the language name\n *\n * @param {HTMLElement} element\n * @param {string} [currentLang]\n * @param {string} [resultLang]\n */\n function updateClassName(element, currentLang, resultLang) {\n const language = (currentLang && aliases[currentLang]) || resultLang;\n\n element.classList.add(\"hljs\");\n element.classList.add(`language-${language}`);\n }\n\n /**\n * Applies highlighting to a DOM node containing code.\n *\n * @param {HighlightedHTMLElement} element - the HTML element to highlight\n */\n function highlightElement(element) {\n /** @type HTMLElement */\n let node = null;\n const language = blockLanguage(element);\n\n if (shouldNotHighlight(language)) return;\n\n fire(\"before:highlightElement\",\n { el: element, language });\n\n if (element.dataset.highlighted) {\n console.log(\"Element previously highlighted. To highlight again, first unset `dataset.highlighted`.\", element);\n return;\n }\n\n // we should be all text, no child nodes (unescaped HTML) - this is possibly\n // an HTML injection attack - it's likely too late if this is already in\n // production (the code has likely already done its damage by the time\n // we're seeing it)... but we yell loudly about this so that hopefully it's\n // more likely to be caught in development before making it to production\n if (element.children.length > 0) {\n if (!options.ignoreUnescapedHTML) {\n console.warn(\"One of your code blocks includes unescaped HTML. This is a potentially serious security risk.\");\n console.warn(\"https://github.com/highlightjs/highlight.js/wiki/security\");\n console.warn(\"The element with unescaped HTML:\");\n console.warn(element);\n }\n if (options.throwUnescapedHTML) {\n const err = new HTMLInjectionError(\n \"One of your code blocks includes unescaped HTML.\",\n element.innerHTML\n );\n throw err;\n }\n }\n\n node = element;\n const text = node.textContent;\n const result = language ? highlight(text, { language, ignoreIllegals: true }) : highlightAuto(text);\n\n element.innerHTML = result.value;\n element.dataset.highlighted = \"yes\";\n updateClassName(element, language, result.language);\n element.result = {\n language: result.language,\n // TODO: remove with version 11.0\n re: result.relevance,\n relevance: result.relevance\n };\n if (result.secondBest) {\n element.secondBest = {\n language: result.secondBest.language,\n relevance: result.secondBest.relevance\n };\n }\n\n fire(\"after:highlightElement\", { el: element, result, text });\n }\n\n /**\n * Updates highlight.js global options with the passed options\n *\n * @param {Partial<HLJSOptions>} userOptions\n */\n function configure(userOptions) {\n options = inherit(options, userOptions);\n }\n\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlighting() deprecated. Use highlightAll() now.\");\n };\n\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() deprecated. Use highlightAll() now.\");\n }\n\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n highlightAll();\n }\n\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n // make sure the event listener is only added once\n if (!wantsHighlight) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n wantsHighlight = true;\n return;\n }\n\n const blocks = document.querySelectorAll(options.cssSelector);\n blocks.forEach(highlightElement);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) { throw error$1; } else { error(error$1); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n\n if (lang.aliases) {\n registerAliases(lang.aliases, { languageName });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, { languageName }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = (data) => {\n plugin[\"before:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = (data) => {\n plugin[\"after:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function removePlugin(plugin) {\n const index = plugins.indexOf(plugin);\n if (index !== -1) {\n plugins.splice(index, 1);\n }\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function(plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n * DEPRECATED\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n autoDetection,\n inherit,\n addPlugin,\n removePlugin\n });\n\n hljs.debugMode = function() { SAFE_MODE = false; };\n hljs.safeMode = function() { SAFE_MODE = true; };\n hljs.versionString = version;\n\n hljs.regex = {\n concat: concat,\n lookahead: lookahead,\n either: either,\n optional: optional,\n anyNumberOfTimes: anyNumberOfTimes\n };\n\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreeze(MODES[key]);\n }\n }\n\n // merge all the modes/regexes into our main object\n Object.assign(hljs, MODES);\n\n return hljs;\n};\n\n// Other names for the variable may break build script\nconst highlight = HLJS({});\n\n// returns a new instance of the highlighter to be used for extensions\n// check https://github.com/wooorm/lowlight/issues/47\nhighlight.newInstance = () => HLJS({});\n\nmodule.exports = highlight;\nhighlight.HighlightJS = highlight;\nhighlight.default = highlight;\n","/*\nLanguage: Bash\nAuthor: vah <vahtenberg@gmail.com>\nContributrors: Benjamin Pannell <contact@sierrasoftworks.com>\nWebsite: https://www.gnu.org/software/bash/\nCategory: common, scripting\n*/\n\n/** @type LanguageFn */\nfunction bash(hljs) {\n const regex = hljs.regex;\n const VAR = {};\n const BRACED_VAR = {\n begin: /\\$\\{/,\n end: /\\}/,\n contains: [\n \"self\",\n {\n begin: /:-/,\n contains: [ VAR ]\n } // default values\n ]\n };\n Object.assign(VAR, {\n className: 'variable',\n variants: [\n { begin: regex.concat(/\\$[\\w\\d#@][\\w\\d_]*/,\n // negative look-ahead tries to avoid matching patterns that are not\n // Perl at all like $ident$, @ident@, etc.\n `(?![\\\\w\\\\d])(?![$])`) },\n BRACED_VAR\n ]\n });\n\n const SUBST = {\n className: 'subst',\n begin: /\\$\\(/,\n end: /\\)/,\n contains: [ hljs.BACKSLASH_ESCAPE ]\n };\n const COMMENT = hljs.inherit(\n hljs.COMMENT(),\n {\n match: [\n /(^|\\s)/,\n /#.*$/\n ],\n scope: {\n 2: 'comment'\n }\n }\n );\n const HERE_DOC = {\n begin: /<<-?\\s*(?=\\w+)/,\n starts: { contains: [\n hljs.END_SAME_AS_BEGIN({\n begin: /(\\w+)/,\n end: /(\\w+)/,\n className: 'string'\n })\n ] }\n };\n const QUOTE_STRING = {\n className: 'string',\n begin: /\"/,\n end: /\"/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n VAR,\n SUBST\n ]\n };\n SUBST.contains.push(QUOTE_STRING);\n const ESCAPED_QUOTE = {\n match: /\\\\\"/\n };\n const APOS_STRING = {\n className: 'string',\n begin: /'/,\n end: /'/\n };\n const ESCAPED_APOS = {\n match: /\\\\'/\n };\n const ARITHMETIC = {\n begin: /\\$?\\(\\(/,\n end: /\\)\\)/,\n contains: [\n {\n begin: /\\d+#[0-9a-f]+/,\n className: \"number\"\n },\n hljs.NUMBER_MODE,\n VAR\n ]\n };\n const SH_LIKE_SHELLS = [\n \"fish\",\n \"bash\",\n \"zsh\",\n \"sh\",\n \"csh\",\n \"ksh\",\n \"tcsh\",\n \"dash\",\n \"scsh\",\n ];\n const KNOWN_SHEBANG = hljs.SHEBANG({\n binary: `(${SH_LIKE_SHELLS.join(\"|\")})`,\n relevance: 10\n });\n const FUNCTION = {\n className: 'function',\n begin: /\\w[\\w\\d_]*\\s*\\(\\s*\\)\\s*\\{/,\n returnBegin: true,\n contains: [ hljs.inherit(hljs.TITLE_MODE, { begin: /\\w[\\w\\d_]*/ }) ],\n relevance: 0\n };\n\n const KEYWORDS = [\n \"if\",\n \"then\",\n \"else\",\n \"elif\",\n \"fi\",\n \"time\",\n \"for\",\n \"while\",\n \"until\",\n \"in\",\n \"do\",\n \"done\",\n \"case\",\n \"esac\",\n \"coproc\",\n \"function\",\n \"select\"\n ];\n\n const LITERALS = [\n \"true\",\n \"false\"\n ];\n\n // to consume paths to prevent keyword matches inside them\n const PATH_MODE = { match: /(\\/[a-z._-]+)+/ };\n\n // http://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html\n const SHELL_BUILT_INS = [\n \"break\",\n \"cd\",\n \"continue\",\n \"eval\",\n \"exec\",\n \"exit\",\n \"export\",\n \"getopts\",\n \"hash\",\n \"pwd\",\n \"readonly\",\n \"return\",\n \"shift\",\n \"test\",\n \"times\",\n \"trap\",\n \"umask\",\n \"unset\"\n ];\n\n const BASH_BUILT_INS = [\n \"alias\",\n \"bind\",\n \"builtin\",\n \"caller\",\n \"command\",\n \"declare\",\n \"echo\",\n \"enable\",\n \"help\",\n \"let\",\n \"local\",\n \"logout\",\n \"mapfile\",\n \"printf\",\n \"read\",\n \"readarray\",\n \"source\",\n \"sudo\",\n \"type\",\n \"typeset\",\n \"ulimit\",\n \"unalias\"\n ];\n\n const ZSH_BUILT_INS = [\n \"autoload\",\n \"bg\",\n \"bindkey\",\n \"bye\",\n \"cap\",\n \"chdir\",\n \"clone\",\n \"comparguments\",\n \"compcall\",\n \"compctl\",\n \"compdescribe\",\n \"compfiles\",\n \"compgroups\",\n \"compquote\",\n \"comptags\",\n \"comptry\",\n \"compvalues\",\n \"dirs\",\n \"disable\",\n \"disown\",\n \"echotc\",\n \"echoti\",\n \"emulate\",\n \"fc\",\n \"fg\",\n \"float\",\n \"functions\",\n \"getcap\",\n \"getln\",\n \"history\",\n \"integer\",\n \"jobs\",\n \"kill\",\n \"limit\",\n \"log\",\n \"noglob\",\n \"popd\",\n \"print\",\n \"pushd\",\n \"pushln\",\n \"rehash\",\n \"sched\",\n \"setcap\",\n \"setopt\",\n \"stat\",\n \"suspend\",\n \"ttyctl\",\n \"unfunction\",\n \"unhash\",\n \"unlimit\",\n \"unsetopt\",\n \"vared\",\n \"wait\",\n \"whence\",\n \"where\",\n \"which\",\n \"zcompile\",\n \"zformat\",\n \"zftp\",\n \"zle\",\n \"zmodload\",\n \"zparseopts\",\n \"zprof\",\n \"zpty\",\n \"zregexparse\",\n \"zsocket\",\n \"zstyle\",\n \"ztcp\"\n ];\n\n const GNU_CORE_UTILS = [\n \"chcon\",\n \"chgrp\",\n \"chown\",\n \"chmod\",\n \"cp\",\n \"dd\",\n \"df\",\n \"dir\",\n \"dircolors\",\n \"ln\",\n \"ls\",\n \"mkdir\",\n \"mkfifo\",\n \"mknod\",\n \"mktemp\",\n \"mv\",\n \"realpath\",\n \"rm\",\n \"rmdir\",\n \"shred\",\n \"sync\",\n \"touch\",\n \"truncate\",\n \"vdir\",\n \"b2sum\",\n \"base32\",\n \"base64\",\n \"cat\",\n \"cksum\",\n \"comm\",\n \"csplit\",\n \"cut\",\n \"expand\",\n \"fmt\",\n \"fold\",\n \"head\",\n \"join\",\n \"md5sum\",\n \"nl\",\n \"numfmt\",\n \"od\",\n \"paste\",\n \"ptx\",\n \"pr\",\n \"sha1sum\",\n \"sha224sum\",\n \"sha256sum\",\n \"sha384sum\",\n \"sha512sum\",\n \"shuf\",\n \"sort\",\n \"split\",\n \"sum\",\n \"tac\",\n \"tail\",\n \"tr\",\n \"tsort\",\n \"unexpand\",\n \"uniq\",\n \"wc\",\n \"arch\",\n \"basename\",\n \"chroot\",\n \"date\",\n \"dirname\",\n \"du\",\n \"echo\",\n \"env\",\n \"expr\",\n \"factor\",\n // \"false\", // keyword literal already\n \"groups\",\n \"hostid\",\n \"id\",\n \"link\",\n \"logname\",\n \"nice\",\n \"nohup\",\n \"nproc\",\n \"pathchk\",\n \"pinky\",\n \"printenv\",\n \"printf\",\n \"pwd\",\n \"readlink\",\n \"runcon\",\n \"seq\",\n \"sleep\",\n \"stat\",\n \"stdbuf\",\n \"stty\",\n \"tee\",\n \"test\",\n \"timeout\",\n // \"true\", // keyword literal already\n \"tty\",\n \"uname\",\n \"unlink\",\n \"uptime\",\n \"users\",\n \"who\",\n \"whoami\",\n \"yes\"\n ];\n\n return {\n name: 'Bash',\n aliases: [\n 'sh',\n 'zsh'\n ],\n keywords: {\n $pattern: /\\b[a-z][a-z0-9._-]+\\b/,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: [\n ...SHELL_BUILT_INS,\n ...BASH_BUILT_INS,\n // Shell modifiers\n \"set\",\n \"shopt\",\n ...ZSH_BUILT_INS,\n ...GNU_CORE_UTILS\n ]\n },\n contains: [\n KNOWN_SHEBANG, // to catch known shells and boost relevancy\n hljs.SHEBANG(), // to catch unknown shells but still highlight the shebang\n FUNCTION,\n ARITHMETIC,\n COMMENT,\n HERE_DOC,\n PATH_MODE,\n QUOTE_STRING,\n ESCAPED_QUOTE,\n APOS_STRING,\n ESCAPED_APOS,\n VAR\n ]\n };\n}\n\nexport { bash as default };\n","/*\nLanguage: Go\nAuthor: Stephan Kountso aka StepLg <steplg@gmail.com>\nContributors: Evgeny Stepanischev <imbolk@gmail.com>\nDescription: Google go language (golang). For info about language\nWebsite: http://golang.org/\nCategory: common, system\n*/\n\nfunction go(hljs) {\n const LITERALS = [\n \"true\",\n \"false\",\n \"iota\",\n \"nil\"\n ];\n const BUILT_INS = [\n \"append\",\n \"cap\",\n \"close\",\n \"complex\",\n \"copy\",\n \"imag\",\n \"len\",\n \"make\",\n \"new\",\n \"panic\",\n \"print\",\n \"println\",\n \"real\",\n \"recover\",\n \"delete\"\n ];\n const TYPES = [\n \"bool\",\n \"byte\",\n \"complex64\",\n \"complex128\",\n \"error\",\n \"float32\",\n \"float64\",\n \"int8\",\n \"int16\",\n \"int32\",\n \"int64\",\n \"string\",\n \"uint8\",\n \"uint16\",\n \"uint32\",\n \"uint64\",\n \"int\",\n \"uint\",\n \"uintptr\",\n \"rune\"\n ];\n const KWS = [\n \"break\",\n \"case\",\n \"chan\",\n \"const\",\n \"continue\",\n \"default\",\n \"defer\",\n \"else\",\n \"fallthrough\",\n \"for\",\n \"func\",\n \"go\",\n \"goto\",\n \"if\",\n \"import\",\n \"interface\",\n \"map\",\n \"package\",\n \"range\",\n \"return\",\n \"select\",\n \"struct\",\n \"switch\",\n \"type\",\n \"var\",\n ];\n const KEYWORDS = {\n keyword: KWS,\n type: TYPES,\n literal: LITERALS,\n built_in: BUILT_INS\n };\n return {\n name: 'Go',\n aliases: [ 'golang' ],\n keywords: KEYWORDS,\n illegal: '</',\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n {\n className: 'string',\n variants: [\n hljs.QUOTE_STRING_MODE,\n hljs.APOS_STRING_MODE,\n {\n begin: '`',\n end: '`'\n }\n ]\n },\n {\n className: 'number',\n variants: [\n {\n match: /-?\\b0[xX]\\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\\d(_?\\d)*i?/, // hex without a present digit before . (making a digit afterwards required)\n relevance: 0\n },\n {\n match: /-?\\b0[xX](_?[a-fA-F0-9])+((\\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\\d(_?\\d)*)?i?/, // hex with a present digit before . (making a digit afterwards optional)\n relevance: 0\n },\n {\n match: /-?\\b0[oO](_?[0-7])*i?/, // leading 0o octal\n relevance: 0\n },\n {\n match: /-?\\.\\d(_?\\d)*([eE][+-]?\\d(_?\\d)*)?i?/, // decimal without a present digit before . (making a digit afterwards required)\n relevance: 0\n },\n {\n match: /-?\\b\\d(_?\\d)*(\\.(\\d(_?\\d)*)?)?([eE][+-]?\\d(_?\\d)*)?i?/, // decimal with a present digit before . (making a digit afterwards optional)\n relevance: 0\n }\n ]\n },\n { begin: /:=/ // relevance booster\n },\n {\n className: 'function',\n beginKeywords: 'func',\n end: '\\\\s*(\\\\{|$)',\n excludeEnd: true,\n contains: [\n hljs.TITLE_MODE,\n {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n endsParent: true,\n keywords: KEYWORDS,\n illegal: /[\"']/\n }\n ]\n }\n ]\n };\n}\n\nexport { go as default };\n","const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\n \"as\", // for exports\n \"in\",\n \"of\",\n \"if\",\n \"for\",\n \"while\",\n \"finally\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\",\n \"catch\",\n \"instanceof\",\n \"with\",\n \"throw\",\n \"case\",\n \"default\",\n \"try\",\n \"switch\",\n \"continue\",\n \"typeof\",\n \"delete\",\n \"let\",\n \"yield\",\n \"const\",\n \"class\",\n // JS handles these with a special rule\n // \"get\",\n // \"set\",\n \"debugger\",\n \"async\",\n \"await\",\n \"static\",\n \"import\",\n \"from\",\n \"export\",\n \"extends\",\n // It's reached stage 3, which is \"recommended for implementation\":\n \"using\"\n];\nconst LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\",\n \"NaN\",\n \"Infinity\"\n];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // numbers and dates\n \"Math\",\n \"Date\",\n \"Number\",\n \"BigInt\",\n // text\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Int32Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n // Keyed collections\n \"Set\",\n \"Map\",\n \"WeakSet\",\n \"WeakMap\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"Atomics\",\n \"DataView\",\n \"JSON\",\n // Control abstraction objects\n \"Promise\",\n \"Generator\",\n \"GeneratorFunction\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\",\n // WebAssembly\n \"WebAssembly\"\n];\n\nconst ERROR_TYPES = [\n \"Error\",\n \"EvalError\",\n \"InternalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\"\n];\n\nconst BUILT_IN_GLOBALS = [\n \"setInterval\",\n \"setTimeout\",\n \"clearInterval\",\n \"clearTimeout\",\n\n \"require\",\n \"exports\",\n\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\"\n];\n\nconst BUILT_IN_VARIABLES = [\n \"arguments\",\n \"this\",\n \"super\",\n \"console\",\n \"window\",\n \"document\",\n \"localStorage\",\n \"sessionStorage\",\n \"module\",\n \"global\" // Node.js\n];\n\nconst BUILT_INS = [].concat(\n BUILT_IN_GLOBALS,\n TYPES,\n ERROR_TYPES\n);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \"<Booger\" and checks to see\n * if we can find a matching \"</Booger\" later in the\n * content.\n * @param {RegExpMatchArray} match\n * @param {{after:number}} param1\n */\n const hasClosingTag = (match, { after }) => {\n const tag = \"</\" + match[0].slice(1);\n const pos = match.input.indexOf(tag, after);\n return pos !== -1;\n };\n\n const IDENT_RE$1 = IDENT_RE;\n const FRAGMENT = {\n begin: '<>',\n end: '</>'\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `<Array<Array<number>>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // `<T, A extends keyof T, V>`\n nextChar === \",\"\n ) {\n response.ignoreMatch();\n return;\n }\n\n // `<something>`\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, { after: afterMatchIndex })) {\n response.ignoreMatch();\n }\n }\n\n // `<blah />` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // <T = any>(key?: string) => Modify<\n if ((m = afterMatch.match(/^\\s*=/))) {\n response.ignoreMatch();\n return;\n }\n\n // `<From extends string>`\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if ((m = afterMatch.match(/^\\s+extends\\s+/))) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n { begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` +\n `[eE][+-]?(${decimalDigits})\\\\b` },\n { begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b` },\n\n // DecimalBigIntegerLiteral\n { begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b` },\n\n // NonDecimalIntegerLiteral\n { begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\" },\n { begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\" },\n { begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\" },\n\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n { begin: \"\\\\b0[0-7]+n?\\\\b\" },\n ],\n relevance: 0\n };\n\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: '\\.?html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: '\\.?css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: '\\.?gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n const JSDOC_COMMENT = hljs.COMMENT(\n /\\/\\*\\*(?!\\/)/,\n '\\\\*/',\n {\n relevance: 0,\n contains: [\n {\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [\n {\n className: 'doctag',\n begin: '@[A-Za-z]+'\n },\n {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n },\n {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }\n ]\n }\n ]\n }\n );\n const COMMENT = {\n className: \"comment\",\n variants: [\n JSDOC_COMMENT,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]\n };\n const SUBST_INTERNALS = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS\n .concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\n \"self\"\n ].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /(\\s*)\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }\n ]);\n const PARAMS = {\n className: 'params',\n // convert this to negative lookbehind in v12\n begin: /(\\s*)\\(/, // to match the parms with\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1,\n /\\s+/,\n /extends/,\n /\\s+/,\n regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n\n ]\n };\n\n const CLASS_REFERENCE = {\n relevance: 0,\n match:\n regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/,\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES,\n ...ERROR_TYPES\n ]\n }\n };\n\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n\n const FUNCTION_DEFINITION = {\n variants: [\n {\n match: [\n /function/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\s*\\()/\n ]\n },\n // anonymous function\n {\n match: [\n /function/,\n /\\s*(?=\\()/\n ]\n }\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [ PARAMS ],\n illegal: /%/\n };\n\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n\n const FUNCTION_CALL = {\n match: regex.concat(\n /\\b/,\n noneOf([\n ...BUILT_IN_GLOBALS,\n \"super\",\n \"import\"\n ].map(x => `${x}\\\\s*\\\\(`)),\n IDENT_RE$1, regex.lookahead(/\\s*\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(\n regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)\n )),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n\n const GETTER_OR_SETTER = {\n match: [\n /get|set/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\()/\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n { // eat to avoid empty params\n begin: /\\(\\)/\n },\n PARAMS\n ]\n };\n\n const FUNC_LEAD_IN_RE = '(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n\n const FUNCTION_VARIABLE = {\n match: [\n /const|var|let/, /\\s+/,\n IDENT_RE$1, /\\s*/,\n /=\\s*/,\n /(async\\s*)?/, // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)\n ],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n PARAMS\n ]\n };\n\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: { PARAMS_CONTAINS, CLASS_REFERENCE },\n illegal: /#(?![$_A-z])/,\n contains: [\n hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }),\n USE_STRICT,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n COMMENT,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n CLASS_REFERENCE,\n {\n scope: 'attr',\n match: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n },\n FUNCTION_VARIABLE,\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [\n COMMENT,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n },\n {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /(\\s*)\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n },\n { // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n },\n {\n match: /\\s+/,\n relevance: 0\n },\n { // JSX\n variants: [\n { begin: FRAGMENT.begin, end: FRAGMENT.end },\n { match: XML_SELF_CLOSING },\n {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }\n ],\n subLanguage: 'xml',\n contains: [\n {\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }\n ]\n }\n ],\n },\n FUNCTION_DEFINITION,\n {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n },\n {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +\n '\\\\(' + // first parens\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)\\\\s*\\\\{', // end parens\n returnBegin:true,\n label: \"func.def\",\n contains: [\n PARAMS,\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: \"title.function\" })\n ]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n },\n PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n },\n {\n match: [ /\\bconstructor(?=\\s*\\()/ ],\n className: { 1: \"title.function\" },\n contains: [ PARAMS ]\n },\n FUNCTION_CALL,\n UPPER_CASE_CONSTANT,\n CLASS_OR_EXTENDS,\n GETTER_OR_SETTER,\n {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }\n ]\n };\n}\n\nexport { javascript as default };\n","/*\nLanguage: JSON\nDescription: JSON (JavaScript Object Notation) is a lightweight data-interchange format.\nAuthor: Ivan Sagalaev <maniac@softwaremaniacs.org>\nWebsite: http://www.json.org\nCategory: common, protocols, web\n*/\n\nfunction json(hljs) {\n const ATTRIBUTE = {\n className: 'attr',\n begin: /\"(\\\\.|[^\\\\\"\\r\\n])*\"(?=\\s*:)/,\n relevance: 1.01\n };\n const PUNCTUATION = {\n match: /[{}[\\],:]/,\n className: \"punctuation\",\n relevance: 0\n };\n const LITERALS = [\n \"true\",\n \"false\",\n \"null\"\n ];\n // NOTE: normally we would rely on `keywords` for this but using a mode here allows us\n // - to use the very tight `illegal: \\S` rule later to flag any other character\n // - as illegal indicating that despite looking like JSON we do not truly have\n // - JSON and thus improve false-positively greatly since JSON will try and claim\n // - all sorts of JSON looking stuff\n const LITERALS_MODE = {\n scope: \"literal\",\n beginKeywords: LITERALS.join(\" \"),\n };\n\n return {\n name: 'JSON',\n aliases: ['jsonc'],\n keywords:{\n literal: LITERALS,\n },\n contains: [\n ATTRIBUTE,\n PUNCTUATION,\n hljs.QUOTE_STRING_MODE,\n LITERALS_MODE,\n hljs.C_NUMBER_MODE,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ],\n illegal: '\\\\S'\n };\n}\n\nexport { json as default };\n","/*\nLanguage: Python\nDescription: Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.\nWebsite: https://www.python.org\nCategory: common\n*/\n\nfunction python(hljs) {\n const regex = hljs.regex;\n const IDENT_RE = /[\\p{XID_Start}_]\\p{XID_Continue}*/u;\n const RESERVED_WORDS = [\n 'and',\n 'as',\n 'assert',\n 'async',\n 'await',\n 'break',\n 'case',\n 'class',\n 'continue',\n 'def',\n 'del',\n 'elif',\n 'else',\n 'except',\n 'finally',\n 'for',\n 'from',\n 'global',\n 'if',\n 'import',\n 'in',\n 'is',\n 'lambda',\n 'match',\n 'nonlocal|10',\n 'not',\n 'or',\n 'pass',\n 'raise',\n 'return',\n 'try',\n 'while',\n 'with',\n 'yield'\n ];\n\n const BUILT_INS = [\n '__import__',\n 'abs',\n 'all',\n 'any',\n 'ascii',\n 'bin',\n 'bool',\n 'breakpoint',\n 'bytearray',\n 'bytes',\n 'callable',\n 'chr',\n 'classmethod',\n 'compile',\n 'complex',\n 'delattr',\n 'dict',\n 'dir',\n 'divmod',\n 'enumerate',\n 'eval',\n 'exec',\n 'filter',\n 'float',\n 'format',\n 'frozenset',\n 'getattr',\n 'globals',\n 'hasattr',\n 'hash',\n 'help',\n 'hex',\n 'id',\n 'input',\n 'int',\n 'isinstance',\n 'issubclass',\n 'iter',\n 'len',\n 'list',\n 'locals',\n 'map',\n 'max',\n 'memoryview',\n 'min',\n 'next',\n 'object',\n 'oct',\n 'open',\n 'ord',\n 'pow',\n 'print',\n 'property',\n 'range',\n 'repr',\n 'reversed',\n 'round',\n 'set',\n 'setattr',\n 'slice',\n 'sorted',\n 'staticmethod',\n 'str',\n 'sum',\n 'super',\n 'tuple',\n 'type',\n 'vars',\n 'zip'\n ];\n\n const LITERALS = [\n '__debug__',\n 'Ellipsis',\n 'False',\n 'None',\n 'NotImplemented',\n 'True'\n ];\n\n // https://docs.python.org/3/library/typing.html\n // TODO: Could these be supplemented by a CamelCase matcher in certain\n // contexts, leaving these remaining only for relevance hinting?\n const TYPES = [\n \"Any\",\n \"Callable\",\n \"Coroutine\",\n \"Dict\",\n \"List\",\n \"Literal\",\n \"Generic\",\n \"Optional\",\n \"Sequence\",\n \"Set\",\n \"Tuple\",\n \"Type\",\n \"Union\"\n ];\n\n const KEYWORDS = {\n $pattern: /[A-Za-z]\\w+|__\\w+__/,\n keyword: RESERVED_WORDS,\n built_in: BUILT_INS,\n literal: LITERALS,\n type: TYPES\n };\n\n const PROMPT = {\n className: 'meta',\n begin: /^(>>>|\\.\\.\\.) /\n };\n\n const SUBST = {\n className: 'subst',\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS,\n illegal: /#/\n };\n\n const LITERAL_BRACKET = {\n begin: /\\{\\{/,\n relevance: 0\n };\n\n const STRING = {\n className: 'string',\n contains: [ hljs.BACKSLASH_ESCAPE ],\n variants: [\n {\n begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,\n end: /'''/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n PROMPT\n ],\n relevance: 10\n },\n {\n begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?\"\"\"/,\n end: /\"\"\"/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n PROMPT\n ],\n relevance: 10\n },\n {\n begin: /([fF][rR]|[rR][fF]|[fF])'''/,\n end: /'''/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n PROMPT,\n LITERAL_BRACKET,\n SUBST\n ]\n },\n {\n begin: /([fF][rR]|[rR][fF]|[fF])\"\"\"/,\n end: /\"\"\"/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n PROMPT,\n LITERAL_BRACKET,\n SUBST\n ]\n },\n {\n begin: /([uU]|[rR])'/,\n end: /'/,\n relevance: 10\n },\n {\n begin: /([uU]|[rR])\"/,\n end: /\"/,\n relevance: 10\n },\n {\n begin: /([bB]|[bB][rR]|[rR][bB])'/,\n end: /'/\n },\n {\n begin: /([bB]|[bB][rR]|[rR][bB])\"/,\n end: /\"/\n },\n {\n begin: /([fF][rR]|[rR][fF]|[fF])'/,\n end: /'/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n LITERAL_BRACKET,\n SUBST\n ]\n },\n {\n begin: /([fF][rR]|[rR][fF]|[fF])\"/,\n end: /\"/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n LITERAL_BRACKET,\n SUBST\n ]\n },\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE\n ]\n };\n\n // https://docs.python.org/3.9/reference/lexical_analysis.html#numeric-literals\n const digitpart = '[0-9](_?[0-9])*';\n const pointfloat = `(\\\\b(${digitpart}))?\\\\.(${digitpart})|\\\\b(${digitpart})\\\\.`;\n // Whitespace after a number (or any lexical token) is needed only if its absence\n // would change the tokenization\n // https://docs.python.org/3.9/reference/lexical_analysis.html#whitespace-between-tokens\n // We deviate slightly, requiring a word boundary or a keyword\n // to avoid accidentally recognizing *prefixes* (e.g., `0` in `0x41` or `08` or `0__1`)\n const lookahead = `\\\\b|${RESERVED_WORDS.join('|')}`;\n const NUMBER = {\n className: 'number',\n relevance: 0,\n variants: [\n // exponentfloat, pointfloat\n // https://docs.python.org/3.9/reference/lexical_analysis.html#floating-point-literals\n // optionally imaginary\n // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals\n // Note: no leading \\b because floats can start with a decimal point\n // and we don't want to mishandle e.g. `fn(.5)`,\n // no trailing \\b for pointfloat because it can end with a decimal point\n // and we don't want to mishandle e.g. `0..hex()`; this should be safe\n // because both MUST contain a decimal point and so cannot be confused with\n // the interior part of an identifier\n {\n begin: `(\\\\b(${digitpart})|(${pointfloat}))[eE][+-]?(${digitpart})[jJ]?(?=${lookahead})`\n },\n {\n begin: `(${pointfloat})[jJ]?`\n },\n\n // decinteger, bininteger, octinteger, hexinteger\n // https://docs.python.org/3.9/reference/lexical_analysis.html#integer-literals\n // optionally \"long\" in Python 2\n // https://docs.python.org/2.7/reference/lexical_analysis.html#integer-and-long-integer-literals\n // decinteger is optionally imaginary\n // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals\n {\n begin: `\\\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${lookahead})`\n },\n {\n begin: `\\\\b0[bB](_?[01])+[lL]?(?=${lookahead})`\n },\n {\n begin: `\\\\b0[oO](_?[0-7])+[lL]?(?=${lookahead})`\n },\n {\n begin: `\\\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${lookahead})`\n },\n\n // imagnumber (digitpart-based)\n // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals\n {\n begin: `\\\\b(${digitpart})[jJ](?=${lookahead})`\n }\n ]\n };\n const COMMENT_TYPE = {\n className: \"comment\",\n begin: regex.lookahead(/# type:/),\n end: /$/,\n keywords: KEYWORDS,\n contains: [\n { // prevent keywords from coloring `type`\n begin: /# type:/\n },\n // comment within a datatype comment includes no keywords\n {\n begin: /#/,\n end: /\\b\\B/,\n endsWithParent: true\n }\n ]\n };\n const PARAMS = {\n className: 'params',\n variants: [\n // Exclude params in functions without params\n {\n className: \"\",\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS,\n contains: [\n 'self',\n PROMPT,\n NUMBER,\n STRING,\n hljs.HASH_COMMENT_MODE\n ]\n }\n ]\n };\n SUBST.contains = [\n STRING,\n NUMBER,\n PROMPT\n ];\n\n return {\n name: 'Python',\n aliases: [\n 'py',\n 'gyp',\n 'ipython'\n ],\n unicodeRegex: true,\n keywords: KEYWORDS,\n illegal: /(<\\/|\\?)|=>/,\n contains: [\n PROMPT,\n NUMBER,\n {\n // very common convention\n scope: 'variable.language',\n match: /\\bself\\b/\n },\n {\n // eat \"if\" prior to string so that it won't accidentally be\n // labeled as an f-string\n beginKeywords: \"if\",\n relevance: 0\n },\n { match: /\\bor\\b/, scope: \"keyword\" },\n STRING,\n COMMENT_TYPE,\n hljs.HASH_COMMENT_MODE,\n {\n match: [\n /\\bdef/, /\\s+/,\n IDENT_RE,\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [ PARAMS ]\n },\n {\n variants: [\n {\n match: [\n /\\bclass/, /\\s+/,\n IDENT_RE, /\\s*/,\n /\\(\\s*/, IDENT_RE,/\\s*\\)/\n ],\n },\n {\n match: [\n /\\bclass/, /\\s+/,\n IDENT_RE\n ],\n }\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 6: \"title.class.inherited\",\n }\n },\n {\n className: 'meta',\n begin: /^[\\t ]*@/,\n end: /(?=#)|$/,\n contains: [\n NUMBER,\n PARAMS,\n STRING\n ]\n }\n ]\n };\n}\n\nexport { python as default };\n","const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\n \"as\", // for exports\n \"in\",\n \"of\",\n \"if\",\n \"for\",\n \"while\",\n \"finally\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\",\n \"catch\",\n \"instanceof\",\n \"with\",\n \"throw\",\n \"case\",\n \"default\",\n \"try\",\n \"switch\",\n \"continue\",\n \"typeof\",\n \"delete\",\n \"let\",\n \"yield\",\n \"const\",\n \"class\",\n // JS handles these with a special rule\n // \"get\",\n // \"set\",\n \"debugger\",\n \"async\",\n \"await\",\n \"static\",\n \"import\",\n \"from\",\n \"export\",\n \"extends\",\n // It's reached stage 3, which is \"recommended for implementation\":\n \"using\"\n];\nconst LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\",\n \"NaN\",\n \"Infinity\"\n];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // numbers and dates\n \"Math\",\n \"Date\",\n \"Number\",\n \"BigInt\",\n // text\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Int32Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n // Keyed collections\n \"Set\",\n \"Map\",\n \"WeakSet\",\n \"WeakMap\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"Atomics\",\n \"DataView\",\n \"JSON\",\n // Control abstraction objects\n \"Promise\",\n \"Generator\",\n \"GeneratorFunction\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\",\n // WebAssembly\n \"WebAssembly\"\n];\n\nconst ERROR_TYPES = [\n \"Error\",\n \"EvalError\",\n \"InternalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\"\n];\n\nconst BUILT_IN_GLOBALS = [\n \"setInterval\",\n \"setTimeout\",\n \"clearInterval\",\n \"clearTimeout\",\n\n \"require\",\n \"exports\",\n\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\"\n];\n\nconst BUILT_IN_VARIABLES = [\n \"arguments\",\n \"this\",\n \"super\",\n \"console\",\n \"window\",\n \"document\",\n \"localStorage\",\n \"sessionStorage\",\n \"module\",\n \"global\" // Node.js\n];\n\nconst BUILT_INS = [].concat(\n BUILT_IN_GLOBALS,\n TYPES,\n ERROR_TYPES\n);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \"<Booger\" and checks to see\n * if we can find a matching \"</Booger\" later in the\n * content.\n * @param {RegExpMatchArray} match\n * @param {{after:number}} param1\n */\n const hasClosingTag = (match, { after }) => {\n const tag = \"</\" + match[0].slice(1);\n const pos = match.input.indexOf(tag, after);\n return pos !== -1;\n };\n\n const IDENT_RE$1 = IDENT_RE;\n const FRAGMENT = {\n begin: '<>',\n end: '</>'\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `<Array<Array<number>>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // `<T, A extends keyof T, V>`\n nextChar === \",\"\n ) {\n response.ignoreMatch();\n return;\n }\n\n // `<something>`\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, { after: afterMatchIndex })) {\n response.ignoreMatch();\n }\n }\n\n // `<blah />` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // <T = any>(key?: string) => Modify<\n if ((m = afterMatch.match(/^\\s*=/))) {\n response.ignoreMatch();\n return;\n }\n\n // `<From extends string>`\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if ((m = afterMatch.match(/^\\s+extends\\s+/))) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n { begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` +\n `[eE][+-]?(${decimalDigits})\\\\b` },\n { begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b` },\n\n // DecimalBigIntegerLiteral\n { begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b` },\n\n // NonDecimalIntegerLiteral\n { begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\" },\n { begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\" },\n { begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\" },\n\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n { begin: \"\\\\b0[0-7]+n?\\\\b\" },\n ],\n relevance: 0\n };\n\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: '\\.?html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: '\\.?css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: '\\.?gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n const JSDOC_COMMENT = hljs.COMMENT(\n /\\/\\*\\*(?!\\/)/,\n '\\\\*/',\n {\n relevance: 0,\n contains: [\n {\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [\n {\n className: 'doctag',\n begin: '@[A-Za-z]+'\n },\n {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n },\n {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }\n ]\n }\n ]\n }\n );\n const COMMENT = {\n className: \"comment\",\n variants: [\n JSDOC_COMMENT,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]\n };\n const SUBST_INTERNALS = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS\n .concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\n \"self\"\n ].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /(\\s*)\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }\n ]);\n const PARAMS = {\n className: 'params',\n // convert this to negative lookbehind in v12\n begin: /(\\s*)\\(/, // to match the parms with\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1,\n /\\s+/,\n /extends/,\n /\\s+/,\n regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n\n ]\n };\n\n const CLASS_REFERENCE = {\n relevance: 0,\n match:\n regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/,\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES,\n ...ERROR_TYPES\n ]\n }\n };\n\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n\n const FUNCTION_DEFINITION = {\n variants: [\n {\n match: [\n /function/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\s*\\()/\n ]\n },\n // anonymous function\n {\n match: [\n /function/,\n /\\s*(?=\\()/\n ]\n }\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [ PARAMS ],\n illegal: /%/\n };\n\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n\n const FUNCTION_CALL = {\n match: regex.concat(\n /\\b/,\n noneOf([\n ...BUILT_IN_GLOBALS,\n \"super\",\n \"import\"\n ].map(x => `${x}\\\\s*\\\\(`)),\n IDENT_RE$1, regex.lookahead(/\\s*\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(\n regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)\n )),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n\n const GETTER_OR_SETTER = {\n match: [\n /get|set/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\()/\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n { // eat to avoid empty params\n begin: /\\(\\)/\n },\n PARAMS\n ]\n };\n\n const FUNC_LEAD_IN_RE = '(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n\n const FUNCTION_VARIABLE = {\n match: [\n /const|var|let/, /\\s+/,\n IDENT_RE$1, /\\s*/,\n /=\\s*/,\n /(async\\s*)?/, // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)\n ],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n PARAMS\n ]\n };\n\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: { PARAMS_CONTAINS, CLASS_REFERENCE },\n illegal: /#(?![$_A-z])/,\n contains: [\n hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }),\n USE_STRICT,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n COMMENT,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n CLASS_REFERENCE,\n {\n scope: 'attr',\n match: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n },\n FUNCTION_VARIABLE,\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [\n COMMENT,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n },\n {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /(\\s*)\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n },\n { // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n },\n {\n match: /\\s+/,\n relevance: 0\n },\n { // JSX\n variants: [\n { begin: FRAGMENT.begin, end: FRAGMENT.end },\n { match: XML_SELF_CLOSING },\n {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }\n ],\n subLanguage: 'xml',\n contains: [\n {\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }\n ]\n }\n ],\n },\n FUNCTION_DEFINITION,\n {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n },\n {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +\n '\\\\(' + // first parens\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)\\\\s*\\\\{', // end parens\n returnBegin:true,\n label: \"func.def\",\n contains: [\n PARAMS,\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: \"title.function\" })\n ]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n },\n PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n },\n {\n match: [ /\\bconstructor(?=\\s*\\()/ ],\n className: { 1: \"title.function\" },\n contains: [ PARAMS ]\n },\n FUNCTION_CALL,\n UPPER_CASE_CONSTANT,\n CLASS_OR_EXTENDS,\n GETTER_OR_SETTER,\n {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }\n ]\n };\n}\n\n/*\nLanguage: TypeScript\nAuthor: Panu Horsmalahti <panu.horsmalahti@iki.fi>\nContributors: Ike Ku <dempfi@yahoo.com>\nDescription: TypeScript is a strict superset of JavaScript\nWebsite: https://www.typescriptlang.org\nCategory: common, scripting\n*/\n\n\n/** @type LanguageFn */\nfunction typescript(hljs) {\n const regex = hljs.regex;\n const tsLanguage = javascript(hljs);\n\n const IDENT_RE$1 = IDENT_RE;\n const TYPES = [\n \"any\",\n \"void\",\n \"number\",\n \"boolean\",\n \"string\",\n \"object\",\n \"never\",\n \"symbol\",\n \"bigint\",\n \"unknown\"\n ];\n const NAMESPACE = {\n begin: [\n /namespace/,\n /\\s+/,\n hljs.IDENT_RE\n ],\n beginScope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n };\n const INTERFACE = {\n beginKeywords: 'interface',\n end: /\\{/,\n excludeEnd: true,\n keywords: {\n keyword: 'interface extends',\n built_in: TYPES\n },\n contains: [ tsLanguage.exports.CLASS_REFERENCE ]\n };\n const USE_STRICT = {\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use strict['\"]/\n };\n const TS_SPECIFIC_KEYWORDS = [\n \"type\",\n // \"namespace\",\n \"interface\",\n \"public\",\n \"private\",\n \"protected\",\n \"implements\",\n \"declare\",\n \"abstract\",\n \"readonly\",\n \"enum\",\n \"override\",\n \"satisfies\"\n ];\n /*\n namespace is a TS keyword but it's fine to use it as a variable name too.\n const message = 'foo';\n const namespace = 'bar';\n */\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS),\n literal: LITERALS,\n built_in: BUILT_INS.concat(TYPES),\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n const DECORATOR = {\n className: 'meta',\n begin: '@' + IDENT_RE$1,\n };\n\n const swapMode = (mode, label, replacement) => {\n const indx = mode.contains.findIndex(m => m.label === label);\n if (indx === -1) { throw new Error(\"can not find mode to replace\"); }\n\n mode.contains.splice(indx, 1, replacement);\n };\n\n\n // this should update anywhere keywords is used since\n // it will be the same actual JS object\n Object.assign(tsLanguage.keywords, KEYWORDS$1);\n\n tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);\n\n // highlight the function params\n const ATTRIBUTE_HIGHLIGHT = tsLanguage.contains.find(c => c.scope === \"attr\");\n\n // take default attr rule and extend it to support optionals\n const OPTIONAL_KEY_OR_ARGUMENT = Object.assign({},\n ATTRIBUTE_HIGHLIGHT,\n { match: regex.concat(IDENT_RE$1, regex.lookahead(/\\s*\\?:/)) }\n );\n tsLanguage.exports.PARAMS_CONTAINS.push([\n tsLanguage.exports.CLASS_REFERENCE, // class reference for highlighting the params types\n ATTRIBUTE_HIGHLIGHT, // highlight the params key\n OPTIONAL_KEY_OR_ARGUMENT, // Added for optional property assignment highlighting\n ]);\n\n // Add the optional property assignment highlighting for objects or classes\n tsLanguage.contains = tsLanguage.contains.concat([\n DECORATOR,\n NAMESPACE,\n INTERFACE,\n OPTIONAL_KEY_OR_ARGUMENT, // Added for optional property assignment highlighting\n ]);\n\n // TS gets a simpler shebang rule than JS\n swapMode(tsLanguage, \"shebang\", hljs.SHEBANG());\n // JS use strict rule purposely excludes `asm` which makes no sense\n swapMode(tsLanguage, \"use_strict\", USE_STRICT);\n\n const functionDeclaration = tsLanguage.contains.find(m => m.label === \"func.def\");\n functionDeclaration.relevance = 0; // () => {} is more typical in TypeScript\n\n Object.assign(tsLanguage, {\n name: 'TypeScript',\n aliases: [\n 'ts',\n 'tsx',\n 'mts',\n 'cts'\n ]\n });\n\n return tsLanguage;\n}\n\nexport { typescript as default };\n","import React from 'react';\nimport hljs from 'highlight.js/lib/core';\nimport bash from 'highlight.js/lib/languages/bash';\nimport go from 'highlight.js/lib/languages/go';\nimport javascript from 'highlight.js/lib/languages/javascript';\nimport json from 'highlight.js/lib/languages/json';\nimport python from 'highlight.js/lib/languages/python';\nimport typescript from 'highlight.js/lib/languages/typescript';\nimport { Check, Copy } from 'lucide-react';\n\n// CodeBlock renders a syntax-highlighted, copy-to-clipboard code sample. Only the\n// handful of languages the gateway docs use are registered so highlight.js stays\n// small in the bundle. Highlighting runs at render time (deterministic), so the\n// same markup is produced on the server prerender and the first client render —\n// hydration-safe. The copy button is the only interactive bit.\n\nlet registered = false;\nfunction ensureLanguages() {\n if (registered) return;\n hljs.registerLanguage('bash', bash);\n hljs.registerLanguage('go', go);\n hljs.registerLanguage('javascript', javascript);\n hljs.registerLanguage('json', json);\n hljs.registerLanguage('python', python);\n hljs.registerLanguage('typescript', typescript);\n registered = true;\n}\n\nconst LANGUAGE_ALIASES: Record<string, string> = {\n js: 'javascript',\n jsx: 'javascript',\n ts: 'typescript',\n tsx: 'typescript',\n py: 'python',\n sh: 'bash',\n shell: 'bash',\n zsh: 'bash',\n curl: 'bash',\n};\n\nfunction normalizeLanguage(language?: string): string {\n if (!language) return '';\n const n = language.trim().toLowerCase();\n return LANGUAGE_ALIASES[n] || n;\n}\n\nfunction highlight(code: string, language?: string): string {\n ensureLanguages();\n const lang = normalizeLanguage(language);\n if (lang && hljs.getLanguage(lang)) {\n return hljs.highlight(code, { language: lang, ignoreIllegals: true }).value;\n }\n return escapeHtml(code);\n}\n\nfunction escapeHtml(s: string): string {\n return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');\n}\n\nexport interface CodeBlockProps {\n code: string;\n language?: string;\n className?: string;\n preClassName?: string;\n showCopy?: boolean;\n testId?: string;\n}\n\nexport const CodeBlock: React.FC<CodeBlockProps> = ({\n code,\n language,\n className,\n preClassName,\n showCopy = true,\n testId,\n}) => {\n const [copied, setCopied] = React.useState(false);\n const html = highlight(code, language);\n\n const copy = async () => {\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1500);\n } catch {\n /* clipboard blocked — non-fatal */\n }\n };\n\n return (\n <div className={`group relative min-w-0 ${className || ''}`}>\n {showCopy && (\n <button\n type=\"button\"\n onClick={copy}\n aria-label=\"Copy code\"\n className=\"absolute right-2 top-2 z-10 inline-flex items-center gap-1 rounded-md border border-white/10 bg-black/70 px-2 py-1 text-[11px] font-mono text-white/50 opacity-0 transition-opacity hover:text-white focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-cyan-300/60 group-hover:opacity-100\"\n >\n {copied ? <Check size={12} className=\"text-green-400\" /> : <Copy size={12} />}\n {copied ? 'Copied' : 'Copy'}\n </button>\n )}\n <pre\n data-testid={testId}\n className={`max-w-full overflow-x-auto rounded-xl border border-white/10 bg-[#050505] p-4 text-xs leading-6 ${preClassName || ''}`}\n >\n <code\n className=\"hljs block w-max min-w-full font-mono\"\n dangerouslySetInnerHTML={{ __html: html }}\n />\n </pre>\n </div>\n );\n};\n","import React from 'react';\nimport { Bot, Boxes, Rocket } from 'lucide-react';\nimport { CodeBlock } from './CodeBlock';\n\nexport type LlmGuideId = 'agent' | 'models' | 'deploy';\n\nexport const LLM_GUIDES: Record<LlmGuideId, { title: string; summary: string; markdown: string }> = {\n agent: {\n title: 'Work with a coding agent',\n summary: 'Inspect a repo, make a bounded change, test it, and return a reviewable PR.',\n markdown: `Read https://app.nz/llms-full.txt, especially “Launch a cloud coding agent”.\n\nUse app.nz to complete this outcome: <describe the outcome>.\n\n- Repository: <owner/repo>\n- Constraints: preserve unrelated work; never expose secrets; ask before destructive or costly actions.\n- Execution: choose an appropriate agent/model route, inspect existing instructions, implement the smallest coherent change, and run relevant tests.\n- Visual changes: capture desktop and mobile evidence in VisualBench and inspect it.\n- Return: summary, changed files, tests, remaining risks, and PR/deploy URL when created.`,\n },\n models: {\n title: 'Integrate or route a model',\n summary: 'Choose a route, keep OpenAI-compatible code, and validate cost and fallback behavior.',\n markdown: `Read https://app.nz/llms-full.txt, especially “Call any model”.\n\nIntegrate this workload through the app.nz gateway: <describe the workload>.\n\n- Start with model app/auto; pin provider/model only when the workload requires it.\n- Use base URL https://app.nz/v1 and read APP_API_KEY from the environment.\n- Do not print, log, or commit API keys.\n- Validate one successful request, structured error handling, timeout behavior, and streaming if used.\n- Compare the chosen route with one reasonable fallback for quality, latency, and estimated cost.\n- Return: runnable code, setup commands, selected route, fallback, and verification results.`,\n },\n deploy: {\n title: 'Build and ship an app',\n summary: 'Turn a requirement into a tested app.nz deploy with logs and a live URL.',\n markdown: `Read https://app.nz/llms-full.txt, especially “Deploy and publish”.\n\nBuild and ship this application on app.nz: <describe the application>.\n\n- Inspect the repository and its AGENTS.md before editing.\n- Add or verify appnz.yaml; use a static runtime unless a server process is required.\n- Keep secrets in app.nz environment configuration, never in source or terminal output.\n- Run unit and end-to-end tests before deployment.\n- For UI work, capture and inspect desktop and mobile VisualBench screenshots.\n- Deploy with the app CLI, verify health and the public URL, then report logs, URL, and rollback notes.`,\n },\n};\n\nconst guideIcons = { agent: Bot, models: Boxes, deploy: Rocket };\n\nexport function LlmQuickstart({ className = '' }: { className?: string }) {\n const [selected, setSelected] = React.useState<LlmGuideId>('agent');\n const guide = LLM_GUIDES[selected];\n\n return (\n <section className={`min-w-0 rounded-xl border border-white/10 bg-gradient-to-br from-white/[0.06] to-white/[0.02] p-5 ${className}`}>\n <div className=\"flex flex-col gap-1 sm:flex-row sm:items-end sm:justify-between\">\n <div>\n <p className=\"text-xs font-bold uppercase tracking-[0.16em] text-cyan-200/55\">Quick copy for any LLM</p>\n <h2 className=\"mt-1 font-display text-xl font-bold\">Give an agent a complete, safer brief.</h2>\n </div>\n <a href=\"/llms-full.txt\" className=\"text-xs font-mono text-white/55 underline decoration-white/25 hover:text-white\">\n Raw Markdown guide ↗\n </a>\n </div>\n <div className=\"mt-4 grid gap-2 sm:grid-cols-3\" role=\"tablist\" aria-label=\"LLM instruction type\">\n {(Object.keys(LLM_GUIDES) as LlmGuideId[]).map((id) => {\n const item = LLM_GUIDES[id];\n const Icon = guideIcons[id];\n const active = id === selected;\n return (\n <button\n key={id}\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => setSelected(id)}\n className={`rounded-lg border p-3 text-left transition ${active ? 'border-cyan-300/40 bg-cyan-300/[0.08]' : 'border-white/10 bg-black/45 hover:border-white/25'}`}\n >\n <span className=\"flex items-center gap-2 text-sm font-bold\"><Icon size={15} /> {item.title}</span>\n <span className=\"mt-1 block text-xs leading-5 text-white/45\">{item.summary}</span>\n </button>\n );\n })}\n </div>\n <div className=\"mt-3\" role=\"tabpanel\">\n <CodeBlock code={guide.markdown} language=\"markdown\" testId={`llm-guide-${selected}`} preClassName=\"!text-[13px] !leading-6 text-white/78\" />\n </div>\n <p className=\"mt-3 text-xs text-white/42\">\n Also available offline as <code className=\"font-mono text-white/68\">app guide {selected}</code> and through the app.nz MCP server.\n </p>\n </section>\n );\n}\n\n","import React from 'react';\nimport { ArrowLeft, Terminal, BookOpen, Search, Sparkles } from 'lucide-react';\nimport { CodeBlock } from './CodeBlock';\nimport { LlmQuickstart } from './LlmQuickstart';\nimport TerminalCast from './TerminalCast';\nimport { sections, methodColor, authLabel, slugForEndpoint, type DocSection, type Endpoint } from './docsData';\n\n// Real API reference for app.nz. The endpoint data lives in ./docsData (shared\n// with the per-endpoint deep-link pages at /docs/{slug} and the sitemap). Each\n// callable row links to its own documentation page.\n\n// AiAgentCard is the AI-friendly onboarding block: the docs are machine-readable\n// at /llms.txt (index) and /llms-full.txt (self-contained build-an-agent guide),\n// so a developer can hand either to a coding agent. The copy buttons make the\n// \"Read X and follow it\" prompt one click — the OpenRouter-style flow.\nconst BUILD_PROMPT =\n 'Read https://app.nz/llms-full.txt and follow it to build an agent on app.nz: ' +\n 'call the OpenAI-compatible gateway, launch a cloud coding agent, and ship a deploy.';\n\nconst SWITCH_SNIPPET = `from openai import OpenAI\n\n# Same OpenAI code — only the base URL and key change.\nclient = OpenAI(base_url=\"https://app.nz/v1\", api_key=\"pk_live_...\")\nr = client.chat.completions.create(\n model=\"app/auto\", # router picks the model, or pin \"provider/model\"\n messages=[{\"role\": \"user\", \"content\": \"Hello from app.nz\"}],\n)`;\n\nconst AiAgentCard: React.FC = () => (\n <section className=\"mb-6 min-w-0 rounded-xl border border-white/10 bg-gradient-to-br from-white/[0.06] to-white/[0.02] p-5\">\n <div className=\"mb-3 flex items-center gap-2\">\n <Sparkles size={18} className=\"text-white/70\" />\n <h2 className=\"font-display text-lg font-bold\">Use these docs with your AI agent</h2>\n </div>\n <p className=\"mb-4 max-w-3xl text-sm leading-7 text-white/58\">\n Every page here is machine-readable. Point a coding agent at{' '}\n <a href=\"/llms.txt\" className=\"font-mono text-white underline decoration-white/30 hover:decoration-white\">/llms.txt</a>{' '}\n for the index, or{' '}\n <a href=\"/llms-full.txt\" className=\"font-mono text-white underline decoration-white/30 hover:decoration-white\">/llms-full.txt</a>{' '}\n for a self-contained build-an-agent guide. Paste this prompt into any agent:\n </p>\n <div className=\"grid min-w-0 gap-4 lg:grid-cols-2\">\n <div className=\"min-w-0\">\n <div className=\"mb-2 text-xs font-bold uppercase tracking-[0.16em] text-white/34\">Build-an-agent prompt</div>\n <CodeBlock code={BUILD_PROMPT} preClassName=\"!text-[13px] !leading-6 text-white/80\" />\n </div>\n <div className=\"min-w-0\">\n <div className=\"mb-2 text-xs font-bold uppercase tracking-[0.16em] text-white/34\">Already have OpenAI code?</div>\n <CodeBlock code={SWITCH_SNIPPET} language=\"python\" preClassName=\"!text-[13px] !leading-6\" />\n </div>\n </div>\n </section>\n);\n\n// EndpointRow renders one endpoint. Callable endpoints link to their /docs/{slug}\n// detail page; noDoc URL-pattern rows render as plain, non-clickable rows.\nconst EndpointRow: React.FC<{ endpoint: Endpoint }> = ({ endpoint: e }) => {\n const slug = slugForEndpoint(e.method, e.path);\n const inner = (\n <>\n <span\n className={`inline-flex w-16 shrink-0 justify-center rounded border px-2 py-0.5 text-xs font-bold ${methodColor[e.method]}`}\n >\n {e.method}\n </span>\n <code className=\"min-w-0 break-all font-mono text-sm text-white/80\">{e.path}</code>\n <span className=\"flex w-full min-w-0 items-center gap-3 sm:ml-auto sm:w-auto\">\n <span className=\"min-w-0 break-words text-sm text-white/48\">{e.summary}</span>\n {e.auth && (\n <span className=\"shrink-0 rounded border border-white/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-white/40\">\n {authLabel[e.auth]}\n </span>\n )}\n </span>\n </>\n );\n\n if (!slug) {\n return (\n <div className=\"flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-1.5 rounded-lg border border-white/10 bg-black px-3 py-2\">\n {inner}\n </div>\n );\n }\n\n return (\n <a\n href={`/docs/${slug}`}\n className=\"flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-1.5 rounded-lg border border-white/10 bg-black px-3 py-2 transition-colors hover:border-white/25 hover:bg-white/[0.04]\"\n >\n {inner}\n </a>\n );\n};\n\n// filterSections narrows the docs to sections/endpoints matching a query:\n// section label/title, endpoint path/summary, and param names all count.\nfunction filterSections(all: DocSection[], query: string): DocSection[] {\n const q = query.trim().toLowerCase();\n if (!q) return all;\n const out: DocSection[] = [];\n for (const s of all) {\n const sectionHit =\n s.label.toLowerCase().includes(q) || s.title.toLowerCase().includes(q) || s.intro.toLowerCase().includes(q);\n const endpoints = s.endpoints?.filter(\n (e) => e.path.toLowerCase().includes(q) || e.summary.toLowerCase().includes(q) || e.method.toLowerCase() === q,\n );\n const paramHit = s.params?.rows.some((p) => p.name.toLowerCase().includes(q) || p.desc.toLowerCase().includes(q));\n if (sectionHit || paramHit || (endpoints && endpoints.length > 0)) {\n out.push(sectionHit || paramHit ? s : { ...s, endpoints });\n }\n }\n return out;\n}\n\nexport const PlatformDocs: React.FC = () => {\n const [query, setQuery] = React.useState('');\n const visible = React.useMemo(() => filterSections(sections, query), [query]);\n return (\n <main className=\"min-h-screen bg-black px-4 pb-16 pt-24 text-white sm:px-6 lg:px-8\">\n <div className=\"mx-auto max-w-[1800px] min-w-0\">\n <a href=\"/\" className=\"mb-5 inline-flex items-center gap-2 text-sm font-semibold text-white/48 hover:text-white\">\n <ArrowLeft size={16} />\n Back to overview\n </a>\n\n <div className=\"mb-6 grid gap-5 lg:grid-cols-[0.9fr_1.1fr] lg:items-end\">\n <div>\n <div className=\"mb-4 inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-white/54\">\n <Terminal size={14} />\n api reference\n </div>\n <h1 className=\"font-display text-2xl font-bold leading-tight tracking-tight sm:text-4xl\">\n Documentation for the app.nz AI agent cloud.\n </h1>\n </div>\n <p className=\"text-sm leading-7 text-white/58\">\n One control-plane API and one OpenAI-compatible model gateway, both authenticated with the same key. Launch\n coding agents on your repos, route chat across providers, and publish sites, all over HTTP. Every endpoint\n here maps to a live route in the Go server — click any one for its own reference page.\n </p>\n </div>\n\n <AiAgentCard />\n <LlmQuickstart className=\"mb-6\" />\n <div className=\"mb-6 grid items-center gap-5 rounded-xl border border-white/10 bg-white/[0.025] p-5 lg:grid-cols-[0.34fr_0.66fr]\">\n <div>\n <p className=\"text-xs font-bold uppercase tracking-[0.16em] text-cyan-200/55\">CLI + MCP handoff</p>\n <h2 className=\"mt-2 font-display text-xl font-bold\">Give any LLM the same platform context.</h2>\n <p className=\"mt-2 text-sm leading-6 text-white/52\">Generate a deployment brief offline, or connect the app.nz MCP server so an agent can retrieve instructions and use platform tools directly.</p>\n </div>\n <TerminalCast src=\"/casts/cli-llm-handoff.cast\" title=\"app — hand the platform to any LLM\" rows={15} />\n </div>\n\n <div className=\"grid min-w-0 gap-6 lg:grid-cols-[0.22fr_0.78fr]\">\n <nav className=\"top-24 hidden h-fit rounded-xl border border-white/10 bg-white/[0.035] p-3 lg:sticky lg:block\">\n <label className=\"mb-3 flex items-center gap-2 rounded-lg border border-white/10 bg-black px-2.5 py-2\">\n <Search size={14} className=\"shrink-0 text-white/40\" />\n <input\n type=\"search\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search endpoints…\"\n className=\"w-full bg-transparent text-sm text-white placeholder-white/35 outline-none\"\n />\n </label>\n <div className=\"mb-2 px-2 text-xs font-bold uppercase tracking-[0.2em] text-white/34\">On this page</div>\n <div className=\"grid gap-1\">\n {visible.map((s) => {\n const Icon = s.icon;\n return (\n <a\n key={s.id}\n href={`#${s.id}`}\n className=\"flex items-center gap-2 rounded-lg px-2 py-2 text-sm text-white/58 transition-colors hover:bg-white/[0.06] hover:text-white\"\n >\n <Icon size={15} />\n {s.label}\n </a>\n );\n })}\n <a\n href=\"/docs/architecture.md\"\n className=\"mt-1 flex items-center gap-2 rounded-lg px-2 py-2 text-sm text-white/40 transition-colors hover:bg-white/[0.06] hover:text-white\"\n >\n <BookOpen size={15} />\n Architecture\n </a>\n </div>\n </nav>\n\n <div className=\"grid min-w-0 gap-5\">\n <div className=\"lg:hidden\">\n <label className=\"flex items-center gap-2 rounded-lg border border-white/10 bg-black px-2.5 py-2\">\n <Search size={14} className=\"shrink-0 text-white/40\" />\n <input\n type=\"search\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search endpoints…\"\n className=\"w-full bg-transparent text-sm text-white placeholder-white/35 outline-none\"\n />\n </label>\n </div>\n {visible.length === 0 && (\n <div className=\"rounded-xl border border-white/10 bg-white/[0.035] p-5 text-sm text-white/55\">\n Nothing matches “{query}”. Try an endpoint path (e.g. <code className=\"text-white/75\">/api/apps</code>), a\n method, or a product name — or ask in <a href=\"/chat\" className=\"text-white/80 underline\">chat</a>.\n </div>\n )}\n {visible.map((section) => (\n <section\n key={section.id}\n id={section.id}\n data-testid={`docs-section-${section.id}`}\n className=\"min-w-0 scroll-mt-24 rounded-xl border border-white/10 bg-white/[0.035] p-5\"\n >\n <div className=\"mb-2 flex items-center gap-3\">\n <section.icon size={18} className=\"text-white/54\" />\n <h2 className=\"font-display text-xl font-bold\">{section.title}</h2>\n </div>\n <p className=\"mb-4 max-w-3xl text-sm leading-7 text-white/58\">{section.intro}</p>\n\n {section.baseUrl && (\n <div className=\"mb-4 flex items-center gap-3 rounded-lg border border-white/10 bg-[#050505] p-3 font-mono text-sm\">\n <span className=\"text-xs font-bold uppercase tracking-[0.16em] text-white/34\">base</span>\n <span className=\"text-white/72\">{section.baseUrl}</span>\n </div>\n )}\n\n {section.endpoints && (\n <div className=\"mb-4 grid gap-2\">\n {section.endpoints.map((e) => (\n <EndpointRow key={e.method + e.path} endpoint={e} />\n ))}\n </div>\n )}\n\n {section.params && (\n <div className=\"mb-4 overflow-hidden rounded-lg border border-white/10\">\n <div className=\"border-b border-white/10 bg-white/[0.04] px-3 py-2 text-xs font-bold uppercase tracking-[0.16em] text-white/40\">\n {section.params.heading}\n </div>\n <div className=\"divide-y divide-white/[0.06]\">\n {section.params.rows.map((p) => (\n <div key={p.name} className=\"grid gap-1 px-3 py-2 sm:grid-cols-[0.28fr_0.14fr_0.58fr] sm:items-baseline\">\n <code className=\"font-mono text-sm text-white/80\">\n {p.name}\n {p.required && <span className=\"ml-1 text-rose-300/80\">*</span>}\n </code>\n <span className=\"font-mono text-xs text-white/40\">{p.type}</span>\n <span className=\"text-sm text-white/54\">{p.desc}</span>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {section.example && (\n <div>\n <div className=\"mb-2 text-xs font-bold uppercase tracking-[0.16em] text-white/34\">\n {section.example.label}\n </div>\n <pre className=\"overflow-x-auto rounded-lg border border-white/10 bg-[#050505] p-4 font-mono text-[13px] leading-6 text-white/72\">\n <code>{section.example.code}</code>\n </pre>\n </div>\n )}\n </section>\n ))}\n\n <section className=\"rounded-xl border border-white/10 bg-white/[0.035] p-5\">\n <h2 className=\"font-display text-lg font-bold\">Conventions</h2>\n <ul className=\"mt-3 grid gap-2 text-sm leading-6 text-white/54\">\n <li>• Auth: <code className=\"text-white/72\">Authorization: Bearer pk_live_...</code> on every non-public route.</li>\n <li>• Bodies and responses are JSON; successful writes return <code className=\"text-white/72\">{'{ \"success\": true, ... }'}</code>.</li>\n <li>• Errors return a non-2xx status with <code className=\"text-white/72\">{'{ \"error\": \"message\" }'}</code>.</li>\n <li>• Get a key with the CLI: <code className=\"text-white/72\">app keys create --name \"deploy bot\"</code>.</li>\n </ul>\n </section>\n </div>\n </div>\n </div>\n </main>\n );\n};\n","import React from \"react\";\nimport {\n ArrowLeft,\n Bot,\n Check,\n Copy,\n Gamepad2,\n Globe,\n KeyRound,\n Rocket,\n Terminal,\n} from \"lucide-react\";\nimport TerminalCast from \"./TerminalCast\";\nimport { LlmQuickstart } from \"./LlmQuickstart\";\n\n// Bespoke /cli page: install, a real recorded demo (agent builds a game, the\n// CLI deploys it), and the full command reference. The cast file is a genuine\n// asciinema v2 recording produced by scripts/record-cli-cast.mjs.\n\nconst INSTALL_COMMAND = \"curl -fsSL https://app.nz/cli.sh | sh\";\n\ninterface CommandRow {\n cmd: string;\n desc: string;\n}\n\ninterface CommandGroup {\n title: string;\n blurb?: string;\n rows: CommandRow[];\n}\n\nconst COMMAND_GROUPS: CommandGroup[] = [\n {\n title: \"Auth & account\",\n rows: [\n { cmd: \"app login\", desc: \"Sign in through app.nz with browser OAuth + PKCE\" },\n { cmd: \"app auth status\", desc: \"Show login state\" },\n { cmd: \"app whoami\", desc: \"Show the signed-in account\" },\n { cmd: \"app keys create --name deploy-bot\", desc: \"Mint an API key (secret shown once)\" },\n { cmd: \"app keys rotate\", desc: \"Rotate the key authenticating this call\" },\n ],\n },\n {\n title: \"Apps hosting\",\n blurb: \"Heroku-style deploys driven by appnz.yaml — static buckets or server runtimes at <slug>.app.nz.\",\n rows: [\n { cmd: \"app apps init --runtime static\", desc: \"Scaffold appnz.yaml in the current directory\" },\n { cmd: \"app apps deploy\", desc: \"Package, build, and release the current directory\" },\n { cmd: \"app apps deploy ./game --app neon-snake\", desc: \"Deploy a directory to a named app\" },\n { cmd: \"app apps logs neon-snake\", desc: \"Build + runtime logs for the latest release\" },\n { cmd: \"app apps deploys neon-snake\", desc: \"Release history\" },\n { cmd: \"app apps open neon-snake\", desc: \"Open the live app in your browser\" },\n ],\n },\n {\n title: \"Static sites\",\n blurb: \"The fastest path for plain files: mirror a directory to a hosted site.\",\n rows: [\n { cmd: \"app sites create my-game --title \\\"My Game\\\"\", desc: \"Create a hosted site\" },\n { cmd: \"app sites deploy my-game ./dist\", desc: \"Publish a directory (uploads + prunes)\" },\n { cmd: \"app sites firewall my-game list\", desc: \"Per-site rate limits and blocks\" },\n { cmd: \"app analytics top my-game\", desc: \"Traffic for a deployed site\" },\n ],\n },\n {\n title: \"Coding agents\",\n rows: [\n { cmd: \"app agent\", desc: \"Local coding agent in this directory (interactive)\" },\n { cmd: \"app agent \\\"why is this test flaky?\\\"\", desc: \"One-shot local run, streamed\" },\n { cmd: \"app agent auto \\\"<goal>\\\" --verify \\\"npm test\\\" --commit\", desc: \"Autonomous run: plans, verifies, commits, second model supervises\" },\n { cmd: \"app agent resume\", desc: \"Continue the last local session\" },\n { cmd: \"app agent doctor\", desc: \"Storage failover chain, model routes, plan sync, skills\" },\n { cmd: \"app agent auth sync\", desc: \"Bill gateway calls to your own ChatGPT plan\" },\n { cmd: \"app agent run --prompt \\\"...\\\" --repo owner/name\", desc: \"Launch a cloud coding agent\" },\n { cmd: \"app agent list\", desc: \"Task history with status\" },\n { cmd: \"app agent get <id>\", desc: \"One task: status, PR link, logs\" },\n { cmd: \"app agent apply <id> --dir ./out\", desc: \"Write a task's changed files locally\" },\n { cmd: \"app agent cancel <id>\", desc: \"Stop a running task\" },\n { cmd: \"app agents-sdk run \\\"...\\\" --repo owner/name\", desc: \"Provider-aware cloud coding task\" },\n { cmd: \"app scheduler create --kind agent --cron \\\"0 9 * * *\\\" --prompt \\\"...\\\"\", desc: \"Agents on a schedule\" },\n ],\n },\n {\n title: \"Models & chat\",\n rows: [\n { cmd: \"app chat \\\"explain this error\\\" --model app/auto\", desc: \"Streamed chat from the gateway\" },\n { cmd: \"app chat \\\"latest on X\\\" --web\", desc: \"Web-grounded answers\" },\n { cmd: \"app gateway models\", desc: \"Every routable model\" },\n { cmd: \"app ra1 generate --prompt \\\"neon city\\\"\", desc: \"Image generation\" },\n { cmd: \"app papers search \\\"diffusion transformers\\\" --type github_code\", desc: \"Shared paper, code, repo, and web search\" },\n ],\n },\n {\n title: \"Repos, PRs & CI\",\n blurb: \"GitHub-parity: repo, issue, pr, release, label, secret, ruleset, gist — check coverage with app parity.\",\n rows: [\n { cmd: \"app repo create my-game --public --clone\", desc: \"Create + clone over smart-HTTP\" },\n { cmd: \"app pr create owner/name --title \\\"...\\\" --head feat\", desc: \"Open a pull request\" },\n { cmd: \"app ci run <pipeline-id> --watch\", desc: \"Start CI and poll to completion\" },\n { cmd: \"app run list\", desc: \"CI/agent run history\" },\n ],\n },\n {\n title: \"Addons\",\n blurb: \"Managed services attached to a repo or deploy — env vars (DATABASE_URL, GOBED_SEARCH_URL, APP_ADDON_*) injected into every runtime.\",\n rows: [\n { cmd: \"app addons create --type postgres --plan starter --attach-default\", desc: \"Managed Postgres (pgvector HNSW + PostGIS) as DATABASE_URL\" },\n { cmd: \"app addons create --type gobed --plan gpu\", desc: \"gobed GPU vector search (cuVS CAGRA)\" },\n { cmd: \"app addons list\", desc: \"All addons with plan, region, status\" },\n { cmd: \"app addons env <addon-id>\", desc: \"Print the injected environment\" },\n { cmd: \"app addons delete <addon-id> --force\", desc: \"Destroy an addon and its data\" },\n ],\n },\n {\n title: \"Machines & data\",\n rows: [\n { cmd: \"app instance create --type cpx21\", desc: \"Rent a CPU/GPU machine\" },\n { cmd: \"app ssh <id>\", desc: \"SSH in (keys auto-injected)\" },\n { cmd: \"app datasets push data.csv\", desc: \"Upload a dataset\" },\n { cmd: \"app notebook create analysis\", desc: \"Hosted marimo notebook\" },\n { cmd: \"app queue send jobs \\\"encode video 42\\\"\", desc: \"Queue a message\" },\n ],\n },\n {\n title: \"Billing & escape hatch\",\n rows: [\n { cmd: \"app usage\", desc: \"Model + server spend, credit balance\" },\n { cmd: \"app credits buy --packs 2\", desc: \"Prepaid credit packs\" },\n { cmd: \"app api GET /api/me\", desc: \"Call any endpoint directly\" },\n { cmd: \"app completion bash\", desc: \"Shell completions (bash/zsh/fish)\" },\n { cmd: \"app alias set dg \\\"apps deploy ./game\\\"\", desc: \"Your own shorthands\" },\n ],\n },\n];\n\nconst APPNZ_YAML = `# appnz.yaml — one file describes the deploy\nname: neon-snake\nruntime: static # or: server\noutput: . # dir published to neon-snake.app.nz\n\n# server runtimes add:\n# build:\n# command: npm ci && npm run build\n# run:\n# command: node server.js\n# port: 3000`;\n\nfunction CopyableCommand({ command, className = \"\" }: { command: string; className?: string }) {\n const [copied, setCopied] = React.useState(false);\n const onCopy = async () => {\n try {\n await navigator.clipboard.writeText(command);\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1800);\n } catch {\n /* clipboard unavailable */\n }\n };\n return (\n <button\n type=\"button\"\n onClick={onCopy}\n className={`group flex w-full min-w-0 max-w-full items-center gap-3 rounded-xl border border-white/12 bg-[#070b14] px-4 py-3 text-left font-mono text-sm text-white/85 transition hover:border-white/30 ${className}`}\n >\n <span className=\"text-cyan-300/80\">$</span>\n <span className=\"min-w-0 flex-1 truncate\">{command}</span>\n {copied ? (\n <Check className=\"h-4 w-4 shrink-0 text-emerald-300\" />\n ) : (\n <Copy className=\"h-4 w-4 shrink-0 text-white/35 transition group-hover:text-white/70\" />\n )}\n </button>\n );\n}\n\nfunction CommandGroupCard({ group }: { group: CommandGroup }) {\n return (\n <section className=\"min-w-0 rounded-xl border border-white/10 bg-white/[0.035] p-5\">\n <h3 className=\"font-display text-lg font-bold\">{group.title}</h3>\n {group.blurb && <p className=\"mt-1.5 text-sm leading-6 text-white/50\">{group.blurb}</p>}\n <div className=\"mt-3 grid gap-1.5\">\n {group.rows.map((row) => (\n <CommandRowItem key={row.cmd} row={row} />\n ))}\n </div>\n </section>\n );\n}\n\nfunction CommandRowItem({ row }: { row: CommandRow }) {\n const [copied, setCopied] = React.useState(false);\n const onCopy = async () => {\n try {\n await navigator.clipboard.writeText(row.cmd);\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1500);\n } catch {\n /* clipboard unavailable */\n }\n };\n return (\n <button\n type=\"button\"\n onClick={onCopy}\n title=\"Copy command\"\n className=\"group grid min-w-0 gap-0.5 rounded-lg border border-white/[0.07] bg-black/60 px-3 py-2 text-left transition hover:border-white/25\"\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <code className=\"min-w-0 flex-1 truncate font-mono text-[13px] text-white/85\">{row.cmd}</code>\n {copied ? (\n <Check className=\"h-3.5 w-3.5 shrink-0 text-emerald-300\" />\n ) : (\n <Copy className=\"h-3.5 w-3.5 shrink-0 text-white/0 transition group-hover:text-white/50\" />\n )}\n </span>\n <span className=\"text-xs leading-5 text-white/44\">{row.desc}</span>\n </button>\n );\n}\n\nconst quickstart = [\n {\n icon: KeyRound,\n title: \"1 — Sign in\",\n body: \"Run app login. Your browser opens app.nz, then the scoped login is shared by the CLI, API, desktop cloud bridge, Git credentials, and MCP proxy.\",\n },\n {\n icon: Bot,\n title: \"2 — Build with an agent\",\n body: \"app agent runs a full coding agent in your terminal — or app agent run hands the task to a cloud agent that branches, codes, tests, and opens a PR.\",\n },\n {\n icon: Rocket,\n title: \"3 — Deploy\",\n body: \"app apps deploy packages the directory, runs the build server-side, and serves it at <name>.app.nz with HTTPS. No DNS, no YAML beyond one file.\",\n },\n];\n\nexport const CliPage: React.FC = () => {\n return (\n <main className=\"min-h-screen bg-black px-4 pb-16 pt-24 text-white sm:px-6 lg:px-8\">\n <div className=\"mx-auto max-w-[1400px] min-w-0\">\n <a href=\"/\" className=\"mb-5 inline-flex items-center gap-2 text-sm font-semibold text-white/48 hover:text-white\">\n <ArrowLeft size={16} />\n Back to overview\n </a>\n\n <div className=\"mb-10 grid items-center gap-10 lg:grid-cols-[0.95fr_1.05fr]\">\n <div className=\"min-w-0\">\n <div className=\"mb-4 inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-white/54\">\n <Terminal size={14} />\n app cli\n </div>\n <h1 className=\"font-display text-3xl font-bold leading-tight tracking-tight sm:text-5xl\">\n The CLI for the agent cloud.\n </h1>\n <p className=\"mt-4 max-w-xl text-base leading-7 text-white/58\">\n One small binary runs coding agents, deploys apps and sites, routes 100+ models, manages repos and CI,\n rents machines, and reaches every endpoint with <code className=\"rounded bg-white/[0.06] px-1.5 py-0.5 font-mono text-sm text-white\">app api</code>.\n Everything below is real output.\n </p>\n <div className=\"mt-6 grid gap-3\">\n <CopyableCommand command={INSTALL_COMMAND} />\n <p className=\"text-xs text-white/45\">\n macOS, Linux, and Windows builds — or <code className=\"font-mono\">go install github.com/lee101/app/cmd/app@latest</code>.\n Source at{\" \"}\n <a href=\"/repos/leepenkman/app-cli\" className=\"text-white/70 underline decoration-white/30 hover:text-white\">\n /repos/leepenkman/app-cli\n </a>.\n </p>\n </div>\n </div>\n\n <div className=\"min-w-0\">\n <TerminalCast\n src=\"/casts/cli-deploy-game.cast\"\n title=\"app — build and ship a game\"\n rows={19}\n />\n <p className=\"mt-2.5 flex flex-wrap items-center gap-x-2 text-xs text-white/45\">\n <Gamepad2 className=\"h-3.5 w-3.5\" />\n Real recorded session, sped up: a cloud agent writes the game, <code className=\"font-mono\">app apps deploy</code> ships it.\n <a href=\"https://neon-snake.app.nz/\" target=\"_blank\" rel=\"noreferrer\" className=\"text-cyan-300/80 underline decoration-cyan-300/30 hover:text-cyan-200\">\n Play the result →\n </a>\n </p>\n </div>\n </div>\n\n <div className=\"mb-10 grid gap-3 sm:grid-cols-3\">\n {quickstart.map((step) => (\n <div key={step.title} className=\"rounded-xl border border-white/10 bg-white/[0.035] p-5\">\n <step.icon className=\"h-5 w-5 text-white/54\" />\n <h3 className=\"mt-3 font-display text-base font-bold\">{step.title}</h3>\n <p className=\"mt-1.5 text-sm leading-6 text-white/52\">{step.body}</p>\n </div>\n ))}\n </div>\n\n <LlmQuickstart className=\"mb-10\" />\n\n <section className=\"mb-10\">\n <div className=\"mb-4 flex flex-col gap-1 sm:flex-row sm:items-end sm:justify-between\">\n <div className=\"min-w-0\">\n <p className=\"text-xs font-bold uppercase tracking-[0.16em] text-cyan-200/55\">Recorded workflows</p>\n <h2 className=\"mt-1 font-display text-2xl font-bold tracking-tight\">From a good brief to the right runtime.</h2>\n </div>\n <p className=\"max-w-xl text-sm leading-6 text-white/48\">Read-only sessions recorded from the real CLI and live public catalog—safe to replay, copy, and adapt.</p>\n </div>\n <div className=\"grid gap-5 xl:grid-cols-2\">\n <div className=\"min-w-0\">\n <TerminalCast src=\"/casts/cli-agent-workflow.cast\" title=\"app — brief and choose a coding agent\" rows={17} />\n <p className=\"mt-2 text-xs leading-5 text-white/45\">Create a bounded brief, inspect available agent providers, then choose a maintained task prompt.</p>\n </div>\n <div className=\"min-w-0\">\n <TerminalCast src=\"/casts/cli-model-routing.cast\" title=\"app — route models without rewriting your client\" rows={17} />\n <p className=\"mt-2 text-xs leading-5 text-white/45\">Start with the router, then filter the live model catalog by provider and keep a fallback ready.</p>\n </div>\n </div>\n </section>\n\n <div className=\"mb-10 grid gap-5 lg:grid-cols-[1.05fr_0.95fr]\">\n <section className=\"min-w-0 rounded-xl border border-white/10 bg-white/[0.035] p-5\">\n <div className=\"mb-2 flex items-center gap-2\">\n <Globe className=\"h-4.5 w-4.5 text-white/54\" size={18} />\n <h2 className=\"font-display text-xl font-bold\">Hosting: one manifest, two runtimes</h2>\n </div>\n <p className=\"mb-4 max-w-2xl text-sm leading-7 text-white/58\">\n <code className=\"font-mono text-white/80\">app apps deploy</code> reads <code className=\"font-mono text-white/80\">appnz.yaml</code> (or\n deploys a bare directory as a static app with zero config), uploads a source tarball, runs your build on\n the server, and publishes to <code className=\"font-mono text-white/80\"><name>.app.nz</code>. Server\n runtimes get a managed process, injected <code className=\"font-mono text-white/80\">PORT</code>, env vars\n per deploy, and <code className=\"font-mono text-white/80\">app apps logs</code>.\n </p>\n <pre className=\"overflow-x-auto rounded-lg border border-white/10 bg-[#050505] p-4 font-mono text-[13px] leading-6 text-white/72\">\n <code>{APPNZ_YAML}</code>\n </pre>\n </section>\n <section className=\"min-w-0 rounded-xl border border-white/10 bg-white/[0.035] p-5\">\n <h2 className=\"font-display text-xl font-bold\">Scriptable by design</h2>\n <p className=\"mb-4 mt-2 max-w-2xl text-sm leading-7 text-white/58\">\n Every command takes <code className=\"font-mono text-white/80\">--json</code> for machine-readable output,\n reads <code className=\"font-mono text-white/80\">APP_API_KEY</code> / <code className=\"font-mono text-white/80\">APP_BASE_URL</code>{\" \"}\n from the environment, and exits non-zero on failure — drop it straight into CI, cron, or an agent's toolbox.\n </p>\n <div className=\"grid gap-2\">\n <CopyableCommand command=\"app --json apps deploys neon-snake | jq '.deploys[0].status'\" />\n <CopyableCommand command={'app chat \"summarize today\\'s deploy logs\" --model app/auto'} />\n <CopyableCommand command={'app api POST /api/queues/jobs/messages \\'{\"text\":\"encode 42\"}\\''} />\n </div>\n <p className=\"mt-4 text-sm leading-6 text-white/52\">\n Coming from GitHub's CLI? <code className=\"font-mono text-white/80\">app parity</code> prints the{\" \"}\n <code className=\"font-mono text-white/80\">gh</code> command-coverage manifest — repo, issue, pr, release,\n secret, ruleset and friends behave the way your fingers expect.\n </p>\n </section>\n </div>\n\n <h2 className=\"mb-4 font-display text-2xl font-bold tracking-tight\">Command reference</h2>\n <div className=\"grid gap-4 md:grid-cols-2\">\n {COMMAND_GROUPS.map((group) => (\n <CommandGroupCard key={group.title} group={group} />\n ))}\n </div>\n\n <p className=\"mt-8 text-sm text-white/50\">\n Full API behind every command:{\" \"}\n <a href=\"/docs\" className=\"text-white/75 underline decoration-white/30 hover:text-white\">\n /docs\n </a>\n {\" · \"}machine-readable guide for agents:{\" \"}\n <a href=\"/llms-full.txt\" className=\"font-mono text-white/75 underline decoration-white/30 hover:text-white\">\n /llms-full.txt\n </a>\n </p>\n </div>\n </main>\n );\n};\n\nexport default CliPage;\n","import React from 'react';\nimport { ArrowLeft, Terminal } from 'lucide-react';\nimport { CodeBlock } from './CodeBlock';\nimport {\n docEndpointBySlug,\n docSectionById,\n slugForEndpoint,\n methodColor,\n authLabel,\n type DocEndpoint,\n type DocSection,\n} from './docsData';\n\n// EndpointDoc renders the standalone reference page for a single endpoint at\n// /docs/{slug}. It reuses the parent section's intro, request params, and example\n// so each endpoint is independently crawlable (own <title>, listed in the sitemap)\n// without duplicating prose. Linked from the endpoint list on /docs.\n\nconst ORIGIN = 'https://app.nz';\n\n// buildCurl produces a copy-pasteable request for this exact endpoint.\nfunction buildCurl(e: DocEndpoint): string {\n const url = ORIGIN + e.path;\n const authHeader = e.auth === 'none' ? '' : ` \\\\\\n -H \"Authorization: Bearer pk_live_...\"`;\n if (e.method === 'GET' || e.method === 'DELETE') {\n const flag = e.method === 'GET' ? '-s' : '-sX DELETE';\n return `curl ${flag} \"${url}\"${authHeader}`;\n }\n return (\n `curl -sX ${e.method} ${url}${authHeader} \\\\\\n` +\n ` -H \"Content-Type: application/json\" \\\\\\n` +\n ` -d '{}'`\n );\n}\n\nconst NotFound: React.FC<{ slug: string }> = ({ slug }) => (\n <main className=\"min-h-screen bg-black px-4 pb-16 pt-24 text-white sm:px-6 lg:px-8\">\n <div className=\"mx-auto max-w-2xl\">\n <a href=\"/docs\" className=\"mb-5 inline-flex items-center gap-2 text-sm font-semibold text-white/48 hover:text-white\">\n <ArrowLeft size={16} />\n API reference\n </a>\n <h1 className=\"font-display text-2xl font-bold\">Unknown endpoint</h1>\n <p className=\"mt-3 text-sm leading-7 text-white/58\">\n There is no documented endpoint at <code className=\"text-white/80\">/docs/{slug}</code>. Browse the full{' '}\n <a href=\"/docs\" className=\"text-white underline underline-offset-4\">API reference</a>.\n </p>\n </div>\n </main>\n);\n\nexport const EndpointDoc: React.FC<{ slug: string }> = ({ slug }) => {\n const endpoint = docEndpointBySlug(slug);\n if (!endpoint) return <NotFound slug={slug} />;\n const section = docSectionById(endpoint.sectionId) as DocSection;\n const siblings = (section.endpoints ?? []).filter(\n (e) => !(e.method === endpoint.method && e.path === endpoint.path) && !e.noDoc,\n );\n\n return (\n <main className=\"min-h-screen bg-black px-4 pb-16 pt-24 text-white sm:px-6 lg:px-8\">\n <div className=\"mx-auto max-w-3xl min-w-0\">\n <nav className=\"mb-5 flex flex-wrap items-center gap-2 text-sm font-semibold text-white/48\">\n <a href=\"/docs\" className=\"inline-flex items-center gap-2 hover:text-white\">\n <ArrowLeft size={16} />\n API reference\n </a>\n <span className=\"text-white/24\">/</span>\n <a href={`/docs#${section.id}`} className=\"hover:text-white\">\n {section.title}\n </a>\n </nav>\n\n <div className=\"mb-3 inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-white/54\">\n <Terminal size={14} />\n endpoint\n </div>\n\n <div className=\"mb-4 flex flex-wrap items-center gap-3\">\n <span\n className={`inline-flex shrink-0 justify-center rounded border px-2.5 py-1 text-sm font-bold ${methodColor[endpoint.method]}`}\n >\n {endpoint.method}\n </span>\n <h1 className=\"min-w-0 break-all font-mono text-xl font-bold sm:text-2xl\">{endpoint.path}</h1>\n </div>\n\n <p className=\"mb-5 text-base leading-7 text-white/72\">{endpoint.summary}</p>\n\n <div className=\"mb-6 flex flex-wrap gap-2\">\n {endpoint.auth && (\n <span className=\"rounded border border-white/10 bg-white/[0.04] px-2 py-1 text-xs font-semibold uppercase tracking-wide text-white/54\">\n auth: {authLabel[endpoint.auth]}\n </span>\n )}\n {section.baseUrl && (\n <span className=\"rounded border border-white/10 bg-white/[0.04] px-2 py-1 font-mono text-xs text-white/54\">\n base {section.baseUrl}\n </span>\n )}\n </div>\n\n <div className=\"mb-6\">\n <div className=\"mb-2 text-xs font-bold uppercase tracking-[0.16em] text-white/34\">Request</div>\n <CodeBlock code={buildCurl(endpoint)} language=\"bash\" preClassName=\"!text-[13px] !leading-6\" />\n </div>\n\n <div className=\"mb-6 rounded-xl border border-white/10 bg-white/[0.035] p-5\">\n <div className=\"mb-2 flex items-center gap-3\">\n <section.icon size={18} className=\"text-white/54\" />\n <h2 className=\"font-display text-lg font-bold\">{section.title}</h2>\n </div>\n <p className=\"text-sm leading-7 text-white/58\">{section.intro}</p>\n </div>\n\n {section.params && (\n <div className=\"mb-6 overflow-hidden rounded-xl border border-white/10\">\n <div className=\"border-b border-white/10 bg-white/[0.04] px-3 py-2 text-xs font-bold uppercase tracking-[0.16em] text-white/40\">\n {section.params.heading}\n </div>\n <div className=\"divide-y divide-white/[0.06]\">\n {section.params.rows.map((p) => (\n <div key={p.name} className=\"grid gap-1 px-3 py-2 sm:grid-cols-[0.28fr_0.14fr_0.58fr] sm:items-baseline\">\n <code className=\"font-mono text-sm text-white/80\">\n {p.name}\n {p.required && <span className=\"ml-1 text-rose-300/80\">*</span>}\n </code>\n <span className=\"font-mono text-xs text-white/40\">{p.type}</span>\n <span className=\"text-sm text-white/54\">{p.desc}</span>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {section.example && (\n <div className=\"mb-6\">\n <div className=\"mb-2 text-xs font-bold uppercase tracking-[0.16em] text-white/34\">{section.example.label}</div>\n <pre className=\"overflow-x-auto rounded-xl border border-white/10 bg-[#050505] p-4 font-mono text-[13px] leading-6 text-white/72\">\n <code>{section.example.code}</code>\n </pre>\n </div>\n )}\n\n {siblings.length > 0 && (\n <div className=\"rounded-xl border border-white/10 bg-white/[0.035] p-5\">\n <div className=\"mb-3 text-xs font-bold uppercase tracking-[0.16em] text-white/40\">\n More in {section.title}\n </div>\n <div className=\"grid gap-2\">\n {siblings.map((e) => (\n <a\n key={e.method + e.path}\n href={`/docs/${slugForEndpoint(e.method, e.path) ?? ''}`}\n className=\"flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-lg border border-white/10 bg-black px-3 py-2 transition-colors hover:border-white/25 hover:bg-white/[0.04]\"\n >\n <span\n className={`inline-flex w-16 shrink-0 justify-center rounded border px-2 py-0.5 text-xs font-bold ${methodColor[e.method]}`}\n >\n {e.method}\n </span>\n <code className=\"min-w-0 break-all font-mono text-sm text-white/80\">{e.path}</code>\n <span className=\"min-w-0 break-words text-sm text-white/48 sm:ml-auto\">{e.summary}</span>\n </a>\n ))}\n </div>\n </div>\n )}\n </div>\n </main>\n );\n};\n","// uploadFile uploads a browser File/Blob to appstatic.app.nz and returns its\n// public URL. The same-origin relay in server/upload.go validates the sniffed\n// file type and enforces the endpoint-specific size limit before writing to R2.\n\nexport interface UploadProgress {\n (fraction: number): void;\n}\n\nasync function postRelay(file: File): Promise<string> {\n const form = new FormData();\n form.append('file', file);\n const res = await fetch('/api/upload', { method: 'POST', body: form, credentials: 'include' });\n const body = await res.json().catch(() => null);\n if (!res.ok || !body?.success) {\n throw new Error(body?.error || `upload failed (${res.status})`);\n }\n const url = body.url || body.publicUrl || body.public_url;\n if (!url) throw new Error('upload returned no URL');\n return url as string;\n}\n\n// uploadFile returns the public URL of the stored file. Throws on failure.\nexport async function uploadFile(file: File): Promise<string> {\n return postRelay(file);\n}\n","// extractDocument uploads a document (PDF, DOCX, XLSX, HTML, Markdown, CSV, JSON, txt)\n// to the server's in-process document-understanding pipeline (server/docparse,\n// a \"MarkItDown in Go\") and returns the extracted retrieval text + metadata. The\n// caller attaches the result to a character as knowledge (knowledge_docs), where\n// it is chunked, indexed (gobed semantic when enabled), and retrieved at chat time.\n\nexport interface ExtractedDocument {\n name: string;\n contentType: string;\n text: string;\n preview: string;\n chars: number;\n words: number;\n truncated: boolean;\n title?: string;\n}\n\n// Extensions docparse can extract text from — used for the file picker's accept.\nexport const DOCUMENT_ACCEPT =\n '.pdf,.docx,.doc,.xlsx,.html,.htm,.md,.markdown,.txt,.csv,.json';\n\nexport async function extractDocument(file: File): Promise<ExtractedDocument> {\n const form = new FormData();\n form.append('file', file);\n const res = await fetch('/api/documents/extract', {\n method: 'POST',\n body: form,\n credentials: 'same-origin',\n });\n const body = await res.json().catch(() => null);\n if (!res.ok || !body?.success) {\n throw new Error(body?.error || `extract failed (${res.status})`);\n }\n return {\n name: body.name || file.name,\n contentType: body.content_type || '',\n text: body.text || '',\n preview: body.preview || '',\n chars: body.chars || 0,\n words: body.words || 0,\n truncated: Boolean(body.truncated),\n title: body.title || undefined,\n };\n}\n","// AUTO-GENERATED by scripts/gen-seedance-demos.mjs — Seedance 2.0 demo clips hosted on appstatic.app.nz.\nexport const SEEDANCE_LOGO_URL = 'https://appstatic.app.nz/app/static/uploads/playground/seedance/applogo.png';\n\nexport type SeedanceDemo = {\n prompt: string;\n outputUrl: string;\n resolution: '480p' | '720p' | '1080p';\n duration: 'auto' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '13' | '14' | '15';\n aspectRatio: 'auto' | '21:9' | '16:9' | '4:3' | '1:1' | '3:4' | '9:16';\n generateAudio: boolean;\n imageUrl?: string;\n imageUrls?: string[];\n};\n\nexport const SEEDANCE_DEMOS: Record<string, SeedanceDemo> = {\n \"seedance-2.0-fast-text-to-video\": {\n \"prompt\": \"A cinematic 4-second shot of a sleek AI gateway console on a dark workstation, luminous routes connecting model nodes across glass, slow handheld push-in, realistic reflections, premium product demo lighting, no readable text.\",\n \"outputUrl\": \"https://appstatic.app.nz/app/static/videos/seedance/seedance-2.0-fast-text-to-video.mp4\",\n \"resolution\": \"720p\",\n \"duration\": \"4\",\n \"aspectRatio\": \"16:9\",\n \"generateAudio\": false\n },\n \"seedance-2.0-text-to-video\": {\n \"prompt\": \"A polished studio macro shot of an AI platform dashboard rendered as glowing fiber-optic routes inside a transparent cube, slow orbiting camera, cinematic depth of field, clean black background, no readable text.\",\n \"outputUrl\": \"https://appstatic.app.nz/app/static/videos/seedance/seedance-2.0-text-to-video.mp4\",\n \"resolution\": \"720p\",\n \"duration\": \"4\",\n \"aspectRatio\": \"16:9\",\n \"generateAudio\": false\n },\n \"seedance-2.0-image-to-video\": {\n \"prompt\": \"Animate the supplied app.nz logo as a premium product mark: subtle camera push-in, soft light sweep across the surface, tiny particles drifting around it, clean dark studio background, elegant motion, no added text.\",\n \"outputUrl\": \"https://appstatic.app.nz/app/static/videos/seedance/seedance-2.0-image-to-video.mp4\",\n \"resolution\": \"720p\",\n \"duration\": \"4\",\n \"aspectRatio\": \"1:1\",\n \"generateAudio\": false,\n \"imageUrl\": \"https://appstatic.app.nz/app/static/uploads/playground/seedance/applogo.png\"\n },\n \"seedance-2.0-fast-reference-to-video\": {\n \"prompt\": \"Use @Image1 as the exact brand mark on a small illuminated badge mounted to a matte black server rack. Slow dolly-in, shallow depth of field, cool white rim light, subtle cable movement, premium infrastructure commercial, no extra text.\",\n \"outputUrl\": \"https://appstatic.app.nz/app/static/videos/seedance/seedance-2.0-fast-reference-to-video.mp4\",\n \"resolution\": \"720p\",\n \"duration\": \"4\",\n \"aspectRatio\": \"16:9\",\n \"generateAudio\": false,\n \"imageUrls\": [\n \"https://appstatic.app.nz/app/static/uploads/playground/seedance/applogo.png\"\n ]\n },\n \"seedance-2.0-reference-to-video\": {\n \"prompt\": \"@Image1 is projected as a crisp holographic interface element above a developer desk. Camera slides left to right, soft reflections on glass, realistic workstation lighting, cinematic product demo, no additional words or watermarks.\",\n \"outputUrl\": \"https://appstatic.app.nz/app/static/videos/seedance/seedance-2.0-reference-to-video.mp4\",\n \"resolution\": \"720p\",\n \"duration\": \"4\",\n \"aspectRatio\": \"16:9\",\n \"generateAudio\": false,\n \"imageUrls\": [\n \"https://appstatic.app.nz/app/static/uploads/playground/seedance/applogo.png\"\n ]\n }\n};\n","// Hand-maintained demo clips for the fal video catalog (Happy Horse + Kling/Veo/Wan/\n// MiniMax/Hunyuan/Pika/Luma/CogVideo flagships), hosted on appstatic.app.nz. Merged with\n// SEEDANCE_DEMOS in GatewayPlayground. Keyed by gateway model id.\nimport type { SeedanceDemo } from './seedanceDemos';\n\nconst VID = 'https://appstatic.app.nz/app/static/videos/fal-video';\nconst IMG = 'https://appstatic.app.nz/app/static/uploads/playground/fal-video/rap.png';\n\nexport const FAL_VIDEO_DEMOS: Record<string, SeedanceDemo> = {\n 'alibaba/happy-horse/v1.1/text-to-video': {\n prompt: 'A little girl walking on the road at sunset, cinematic lighting, smooth camera movement.',\n outputUrl: `${VID}/happy-horse-v1.1-text-to-video.mp4`,\n resolution: '1080p', duration: '5', aspectRatio: '16:9', generateAudio: true,\n },\n 'alibaba/happy-horse/v1.1/image-to-video': {\n prompt: 'Bring the scene in the image to life with natural motion and ambient audio.',\n outputUrl: `${VID}/happy-horse-v1.1-image-to-video.mp4`,\n resolution: '1080p', duration: '5', aspectRatio: '16:9', generateAudio: true, imageUrl: IMG,\n },\n 'alibaba/happy-horse/v1.1/reference-to-video': {\n prompt: 'character1 performs an energetic rap on a neon-lit stage, cinematic lighting, smooth camera movement, synchronized lip-sync.',\n outputUrl: `${VID}/happy-horse-v1.1-reference-to-video.mp4`,\n resolution: '1080p', duration: '5', aspectRatio: '16:9', generateAudio: true, imageUrls: [IMG],\n },\n 'fal-ai/kling-video/v3/pro/text-to-video': {\n prompt: 'A lone astronaut drifts weightless inside a derelict space station, dust motes glittering in shafts of golden sunlight through cracked viewports, slow cinematic dolly push, volumetric god rays.',\n outputUrl: `${VID}/kling-v3-pro-text-to-video.mp4`,\n resolution: '1080p', duration: '5', aspectRatio: '16:9', generateAudio: true,\n },\n 'fal-ai/wan/v2.7/text-to-video': {\n prompt: 'Cinematic aerial shot soaring over a neon-drenched futuristic megacity at dusk, glass towers reflecting magenta and cyan light, flying vehicles streaking between skyscrapers, volumetric fog, ultra-smooth glide.',\n outputUrl: `${VID}/wan-2.7-text-to-video.mp4`,\n resolution: '1080p', duration: '5', aspectRatio: '16:9', generateAudio: true,\n },\n 'fal-ai/minimax/hailuo-2.3/standard/text-to-video': {\n prompt: 'Sweeping cinematic drone shot gliding over neon-lit futuristic city canyons at dusk, holographic light trails reflecting on glass towers, volumetric fog, dramatic teal-and-amber color grade.',\n outputUrl: `${VID}/hailuo-2.3-text-to-video.mp4`,\n resolution: '720p', duration: '6', aspectRatio: '16:9', generateAudio: false,\n },\n 'fal-ai/hunyuan-video-v1.5/text-to-video': {\n prompt: 'Cinematic slow-motion close-up of molten gold liquid swirling into elegant ribbons against a black void, caustic light refractions, hyper-detailed fluid simulation, dramatic spotlight, shallow focus.',\n outputUrl: `${VID}/hunyuan-1.5-text-to-video.mp4`,\n resolution: '720p', duration: '5', aspectRatio: '16:9', generateAudio: false,\n },\n 'fal-ai/pika/v2.2/text-to-video': {\n prompt: 'Cinematic dolly through a bioluminescent jungle at night, glowing blue spores drifting in the air, mist curling around ancient vines, a waterfall shimmering in moonlight, lush atmospheric color grade.',\n outputUrl: `${VID}/pika-2.2-text-to-video.mp4`,\n resolution: '1080p', duration: '5', aspectRatio: '16:9', generateAudio: false,\n },\n 'fal-ai/cogvideox-5b': {\n prompt: 'Cinematic tracking shot following a sleek silver sports car carving through a coastal mountain road at sunset, ocean glittering below, lens flare, motion blur, dramatic golden light, ultra-detailed.',\n outputUrl: `${VID}/cogvideox-text-to-video.mp4`,\n resolution: '720p', duration: '5', aspectRatio: '16:9', generateAudio: false,\n },\n 'fal-ai/veo3.1/fast/image-to-video': {\n prompt: 'Bring the portrait to life: subtle head turn and blink, gentle breeze in the hair, soft volumetric light drifting across the face, cinematic shallow focus, ambient room tone.',\n outputUrl: `${VID}/veo-3.1-fast-image-to-video.mp4`,\n resolution: '1080p', duration: '5', aspectRatio: '16:9', generateAudio: true, imageUrl: IMG,\n },\n 'fal-ai/luma-dream-machine/ray-2/image-to-video': {\n prompt: 'The scene comes alive with gentle cinematic motion, soft parallax depth, drifting light and dust particles, photoreal slow push-in.',\n outputUrl: `${VID}/luma-ray-2-image-to-video.mp4`,\n resolution: '720p', duration: '5', aspectRatio: '16:9', generateAudio: false, imageUrl: IMG,\n },\n};\n","import type { SeedanceDemo } from './seedanceDemos';\n\nconst VID = 'https://appstatic.app.nz/app/static/videos/gemini-omni';\nconst IMG = 'https://appstatic.app.nz/app/static/uploads/playground/gemini-omni/perfume.jpg';\n\nexport const GEMINI_VIDEO_DEMOS: Record<string, SeedanceDemo> = {\n 'gemini-omni-flash-preview': {\n prompt: '[# Sources <FIRST_FRAME>@Image1] Continuous single-shot premium product video: the perfume bottle remains the hero object from the input image, the camera makes a slow cinematic push-in, soft studio lights sweep across the glass, subtle reflections move on the surface, no scene cuts, no added text, no dialogue. Use Image1 as the starting frame.',\n outputUrl: `${VID}/gemini-omni-perfume-image-to-video.mp4`,\n resolution: '720p',\n duration: '4',\n aspectRatio: '16:9',\n generateAudio: false,\n imageUrl: IMG,\n },\n};\n","// Per-model fal video argument specs for the app.nz gateway. Declares which\n// optional args each video model exposes in the UI + their ranges/options.\n// Advanced args are opt-in: only sent when the user provides a value, so default\n// behaviour is unchanged. Mirrors the openpaths spec.\n\nexport type NumRange = { min: number; max: number; step?: number; placeholder?: string };\n\nexport type VideoParamSpec = {\n resolutions: string[];\n durations: string[];\n aspectRatios: string[];\n generateAudio: boolean;\n enableSafetyChecker: boolean;\n imageToVideo: boolean;\n endImage: boolean;\n referenceToVideo: boolean;\n negativePrompt: boolean;\n seed: boolean;\n numFrames?: NumRange;\n framesPerSecond?: { options: number[] };\n guidanceScale?: NumRange;\n numInferenceSteps?: NumRange;\n outputFormats?: string[];\n};\n\nexport const VIDEO_RESOLUTIONS = ['480p', '720p', '1080p'];\nexport const VIDEO_DURATIONS = ['auto', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15'];\nexport const VIDEO_ASPECT_RATIOS = ['auto', '21:9', '16:9', '4:3', '1:1', '3:4', '9:16'];\nexport const VIDEO_OUTPUT_FORMATS = ['mp4', 'webm'];\n\nconst BASE: VideoParamSpec = {\n resolutions: VIDEO_RESOLUTIONS,\n durations: VIDEO_DURATIONS,\n aspectRatios: VIDEO_ASPECT_RATIOS,\n generateAudio: true,\n enableSafetyChecker: false,\n imageToVideo: false,\n endImage: false,\n referenceToVideo: false,\n negativePrompt: true,\n seed: true,\n outputFormats: VIDEO_OUTPUT_FORMATS,\n};\n\nconst FAMILIES: Array<{ test: RegExp; spec: Partial<VideoParamSpec> }> = [\n {\n test: /gemini-omni/i,\n spec: {\n resolutions: ['720p'],\n durations: ['3', '4', '5', '6', '7', '8', '9', '10'],\n aspectRatios: ['16:9'],\n generateAudio: false,\n negativePrompt: false,\n seed: false,\n outputFormats: ['mp4'],\n },\n },\n {\n test: /ltx/i,\n spec: {\n numFrames: { min: 9, max: 161, step: 8, placeholder: '121' },\n framesPerSecond: { options: [24, 25, 30] },\n guidanceScale: { min: 1, max: 10, step: 0.5, placeholder: '3' },\n numInferenceSteps: { min: 10, max: 50, placeholder: '30' },\n },\n },\n {\n test: /wan\\//i,\n spec: {\n guidanceScale: { min: 1, max: 10, step: 0.5, placeholder: '5' },\n numInferenceSteps: { min: 10, max: 50, placeholder: '30' },\n },\n },\n {\n test: /hunyuan/i,\n spec: {\n guidanceScale: { min: 1, max: 10, step: 0.5, placeholder: '6' },\n numInferenceSteps: { min: 10, max: 50, placeholder: '30' },\n },\n },\n {\n test: /cogvideo/i,\n spec: {\n guidanceScale: { min: 1, max: 10, step: 0.5, placeholder: '7' },\n numInferenceSteps: { min: 10, max: 50, placeholder: '50' },\n },\n },\n];\n\nfunction detectInputs(modelId: string) {\n const isImageToVideo = /image-to-video|i2v/i.test(modelId);\n const isReference = /reference-to-video|reference/i.test(modelId);\n return { imageToVideo: isImageToVideo, endImage: isImageToVideo, referenceToVideo: isReference };\n}\n\nexport function getVideoParamSpec(modelId: string): VideoParamSpec {\n const family = FAMILIES.find((f) => f.test.test(modelId));\n const isHappyHorse = modelId === 'alibaba/happy-horse/image-to-video';\n return {\n ...BASE,\n ...detectInputs(modelId),\n enableSafetyChecker: isHappyHorse,\n generateAudio: !isHappyHorse,\n ...(family?.spec ?? {}),\n };\n}\n\nexport type VideoAdvancedValues = {\n negativePrompt: string;\n seed: string;\n numFrames: string;\n framesPerSecond: string;\n guidanceScale: string;\n numInferenceSteps: string;\n outputFormat: string;\n};\n\nexport const EMPTY_ADVANCED: VideoAdvancedValues = {\n negativePrompt: '',\n seed: '',\n numFrames: '',\n framesPerSecond: '',\n guidanceScale: '',\n numInferenceSteps: '',\n outputFormat: '',\n};\n","// Single source of truth for building a /v1/videos/generations request body for\n// the app.nz gateway playground + model pages. Mirrors the openpaths builder.\nimport {\n getVideoParamSpec,\n type VideoAdvancedValues,\n type VideoParamSpec,\n} from './videoModelParams';\n\nexport type VideoBaseValues = {\n prompt: string;\n resolution: string;\n duration: string;\n aspectRatio: string;\n generateAudio: boolean;\n imageUrl?: string;\n endImageUrl?: string;\n imageUrls?: string[];\n};\n\nfunction num(v: string): number | undefined {\n const t = v.trim();\n if (t === '') return undefined;\n const n = Number(t);\n return Number.isFinite(n) ? n : undefined;\n}\n\nexport function buildVideoPayload(\n modelId: string,\n base: VideoBaseValues,\n advanced: Partial<VideoAdvancedValues> = {},\n spec: VideoParamSpec = getVideoParamSpec(modelId),\n): Record<string, unknown> {\n const body: Record<string, unknown> = {\n model: modelId,\n prompt: base.prompt,\n resolution: base.resolution,\n duration: base.duration,\n aspect_ratio: base.aspectRatio,\n };\n\n if (spec.enableSafetyChecker) {\n body.duration = base.duration === 'auto' ? 5 : Number(base.duration) || 5;\n body.enable_safety_checker = true;\n } else {\n body.generate_audio = base.generateAudio;\n }\n\n if (spec.referenceToVideo) {\n if (base.imageUrls?.length) body.image_urls = base.imageUrls;\n else if (base.imageUrl?.trim()) body.image_urls = [base.imageUrl.trim()];\n } else if (spec.imageToVideo) {\n if (base.imageUrl?.trim()) body.image_url = base.imageUrl.trim();\n if (spec.endImage && base.endImageUrl?.trim()) body.end_image_url = base.endImageUrl.trim();\n } else if (base.imageUrl?.trim()) {\n // Generic image-conditioned model: still pass the source image.\n body.image_url = base.imageUrl.trim();\n }\n\n const a = advanced;\n if (spec.negativePrompt && a.negativePrompt?.trim()) body.negative_prompt = a.negativePrompt.trim();\n if (spec.seed && a.seed !== undefined) {\n const s = num(a.seed);\n if (s !== undefined) body.seed = Math.trunc(s);\n }\n if (spec.numFrames && a.numFrames !== undefined) {\n const n = num(a.numFrames);\n if (n !== undefined) body.num_frames = Math.trunc(n);\n }\n if (spec.framesPerSecond && a.framesPerSecond !== undefined) {\n const n = num(a.framesPerSecond);\n if (n !== undefined) body.frames_per_second = Math.trunc(n);\n }\n if (spec.guidanceScale && a.guidanceScale !== undefined) {\n const n = num(a.guidanceScale);\n if (n !== undefined) body.guidance_scale = n;\n }\n if (spec.numInferenceSteps && a.numInferenceSteps !== undefined) {\n const n = num(a.numInferenceSteps);\n if (n !== undefined) body.num_inference_steps = Math.trunc(n);\n }\n if (spec.outputFormats && a.outputFormat?.trim()) body.output_format = a.outputFormat.trim();\n\n return body;\n}\n","// Multi-language code samples for the gateway playground \"View code\" panel.\n// Produces cURL / Python / JavaScript for the OpenAI-compatible app.nz gateway,\n// plus a Markdown export. The key is the user's real stored key when available,\n// otherwise a clearly-placeholder env reference (we can't recover hashed keys).\n\nexport type CodeKind = 'curl' | 'python' | 'javascript';\n\nexport const CODE_LANGS: { id: CodeKind; label: string }[] = [\n { id: 'python', label: 'Python' },\n { id: 'javascript', label: 'JavaScript' },\n { id: 'curl', label: 'cURL' },\n];\n\nexport const codeLangHl: Record<CodeKind, string> = {\n curl: 'bash',\n python: 'python',\n javascript: 'javascript',\n};\n\nexport type GatewaySpec = {\n origin: string;\n path: string; // e.g. /v1/videos/generations\n apiKey: string; // real key if available, '' otherwise\n // sdk shape decides the idiomatic call used in Python/JS:\n sdk: 'chat' | 'image' | 'embeddings' | 'speech' | 'transcription' | 'post';\n body?: Record<string, unknown>;\n langQuery?: string; // transcription ?language=\n};\n\n// Placeholder shown when the user has no stored key (e.g. only cookie-logged-in).\nconst KEY_ENV = 'APPNZ_API_KEY';\n\nfunction keyLiteral(apiKey: string): { curl: string; py: string; js: string; isReal: boolean } {\n const k = apiKey.trim();\n if (k) return { curl: k, py: `\"${k}\"`, js: `\"${k}\"`, isReal: true };\n return {\n curl: `$${KEY_ENV}`,\n py: `os.environ[\"${KEY_ENV}\"]`,\n js: `process.env.${KEY_ENV}`,\n isReal: false,\n };\n}\n\nfunction jsonC(body: unknown, indent: number): string {\n return JSON.stringify(body ?? {}, null, indent);\n}\n\nexport function buildGatewaySamples(spec: GatewaySpec): Record<CodeKind, string> {\n const { origin, path, apiKey, sdk, body } = spec;\n const base = `${origin}${path}`;\n const baseURL = `${origin}/v1`;\n const relPath = path.replace(/^\\/v1/, '');\n const key = keyLiteral(apiKey);\n\n // ---- cURL ----\n const auth = `-H \"Authorization: Bearer ${key.curl}\"`;\n const ctype = '-H \"Content-Type: application/json\"';\n let curl: string;\n if (sdk === 'speech') {\n curl = `curl ${base} \\\\\\n ${ctype} \\\\\\n ${auth} \\\\\\n -d '${jsonC(body, 0)}' \\\\\\n --output speech.mp3`;\n } else if (sdk === 'transcription') {\n const qs = spec.langQuery ? `?language=${spec.langQuery}` : '';\n curl = `curl ${base}${qs} \\\\\\n -H \"Content-Type: audio/webm\" \\\\\\n ${auth} \\\\\\n --data-binary @audio.webm`;\n } else {\n curl = `curl ${base} \\\\\\n ${ctype} \\\\\\n ${auth} \\\\\\n -d '${jsonC(body, 0)}'`;\n }\n\n // ---- Python ----\n const pyHead = `import os\\nfrom openai import OpenAI\\n\\nclient = OpenAI(base_url=\"${baseURL}\", api_key=${key.py})\\n`;\n let python: string;\n switch (sdk) {\n case 'chat':\n python = `${pyHead}\\nstream = client.chat.completions.create(\\n **${jsonC(body, 4)},\\n)\\nfor chunk in stream:\\n print(chunk.choices[0].delta.content or \"\", end=\"\")`;\n break;\n case 'image':\n python = `${pyHead}\\nresult = client.images.generate(**${jsonC(body, 4)})\\nprint(result.data[0].url)`;\n break;\n case 'embeddings':\n python = `${pyHead}\\nresult = client.embeddings.create(**${jsonC(body, 4)})\\nprint(result.data[0].embedding[:8])`;\n break;\n case 'speech':\n python = `${pyHead}\\nresult = client.audio.speech.create(**${jsonC(body, 4)})\\nresult.stream_to_file(\"speech.mp3\")`;\n break;\n case 'transcription':\n python = `${pyHead}\\nwith open(\"audio.webm\", \"rb\") as f:\\n result = client.audio.transcriptions.create(model=\"whisper-1\", file=f)\\nprint(result.text)`;\n break;\n default:\n python = `${pyHead}\\nresult = client.post(\\n \"${relPath}\",\\n body=${jsonC(body, 4)},\\n cast_to=dict,\\n)\\nprint(result.get(\"video_url\") or result)`;\n }\n\n // ---- JavaScript ----\n const jsHead = `import OpenAI from \"openai\";\\n\\nconst client = new OpenAI({ baseURL: \"${baseURL}\", apiKey: ${key.js} });\\n`;\n let javascript: string;\n switch (sdk) {\n case 'chat':\n javascript = `${jsHead}\\nconst stream = await client.chat.completions.create(${jsonC(body, 2)});\\nfor await (const chunk of stream) {\\n process.stdout.write(chunk.choices[0]?.delta?.content || \"\");\\n}`;\n break;\n case 'image':\n javascript = `${jsHead}\\nconst result = await client.images.generate(${jsonC(body, 2)});\\nconsole.log(result.data[0].url);`;\n break;\n case 'embeddings':\n javascript = `${jsHead}\\nconst result = await client.embeddings.create(${jsonC(body, 2)});\\nconsole.log(result.data[0].embedding.slice(0, 8));`;\n break;\n case 'speech':\n javascript = `${jsHead}\\nconst result = await client.audio.speech.create(${jsonC(body, 2)});\\nconst buf = Buffer.from(await result.arrayBuffer());\\nawait (await import(\"node:fs/promises\")).writeFile(\"speech.mp3\", buf);`;\n break;\n case 'transcription':\n javascript = `${jsHead}\\nimport fs from \"node:fs\";\\nconst result = await client.audio.transcriptions.create({\\n model: \"whisper-1\",\\n file: fs.createReadStream(\"audio.webm\"),\\n});\\nconsole.log(result.text);`;\n break;\n default:\n javascript = `${jsHead}\\nconst result = await client.post(\"${relPath}\", {\\n body: ${jsonC(body, 2)},\\n cast_to: Object,\\n});\\nconsole.log(result.video_url ?? result);`;\n }\n\n return { curl, python, javascript };\n}\n\nexport function samplesToMarkdown(samples: Record<CodeKind, string>, title: string): string {\n return [\n `# ${title}`,\n '',\n 'Call the app.nz OpenAI-compatible gateway. Set `APPNZ_API_KEY` to a key from https://app.nz/api-keys (or sign in — your session authenticates browser requests automatically).',\n '',\n '## Python',\n '```python',\n samples.python,\n '```',\n '',\n '## JavaScript',\n '```javascript',\n samples.javascript,\n '```',\n '',\n '## cURL',\n '```bash',\n samples.curl,\n '```',\n '',\n ].join('\\n');\n}\n","import React from 'react';\nimport {\n Binary,\n Box,\n Code2,\n Image as ImageIcon,\n Loader2,\n MessageSquare,\n Mic,\n Music,\n Paperclip,\n Send,\n Square,\n Upload,\n Video,\n Volume2,\n X,\n FileText,\n Film,\n File as FileIcon,\n Copy,\n Check,\n RotateCcw,\n GitFork,\n Pencil,\n Trash2,\n Settings2,\n Search,\n ChevronDown,\n ChevronUp,\n LogIn,\n} from 'lucide-react';\nimport { CodeBlock } from './CodeBlock';\nimport { uploadFile } from './uploadFile';\nimport { DOCUMENT_ACCEPT, extractDocument } from './extractDocument';\nimport { SEEDANCE_DEMOS, type SeedanceDemo } from './seedanceDemos';\nimport { FAL_VIDEO_DEMOS } from './falVideoDemos';\nimport { GEMINI_VIDEO_DEMOS } from './geminiVideoDemos';\nimport { getVideoParamSpec, EMPTY_ADVANCED, type VideoAdvancedValues } from './videoModelParams';\nimport { buildVideoPayload } from './videoPayload';\nimport { buildGatewaySamples, samplesToMarkdown, CODE_LANGS, codeLangHl, type CodeKind } from './gatewayCode';\n\n// Lazy: pulls in firebase/auth. Only loaded when a 401 needs the sign-in modal.\nconst SignInModal = React.lazy(() => import('./SignInModal'));\n\n// GatewayPlayground runs real requests against the app.nz gateway from the\n// browser, one surface per modality (chat, image, embeddings, video, music,\n// speech, transcription, image→3d). Each surface renders a live preview of the\n// result alongside the raw JSON the API returned. It is lazy-loaded by\n// GatewayPage so it never ships in the homepage bundle. Auth is implicit:\n// same-origin fetch sends the session cookie for signed-in users; anyone else\n// can paste an API key (persisted to localStorage).\n\ntype Modality =\n | 'chat'\n | 'image'\n | 'embeddings'\n | 'video'\n | 'music'\n | 'speech'\n | 'transcription'\n | '3d';\n\ninterface CatalogModel {\n id: string;\n provider: string;\n modality?: string;\n supported_sizes?: string[];\n input_price_per_1m?: number;\n output_price_per_1m?: number;\n input_cache_hit_per_1m?: number;\n price_per_image?: number;\n price_per_video?: number;\n price_per_request?: number;\n price_per_minute?: number;\n supports_streaming?: boolean;\n supports_vision?: boolean;\n context_window?: number;\n max_output_tokens?: number;\n}\n\ninterface Props {\n models: CatalogModel[];\n origin: string;\n initialTab?: Modality;\n initialModel?: string;\n}\n\ninterface ChatMessage {\n role: 'user' | 'assistant';\n content: string;\n createdAt?: number;\n attachments?: ChatAttachment[];\n branchOf?: number;\n}\n\ntype ChatAttachmentKind = 'image' | 'document' | 'video' | 'audio' | 'file';\n\ninterface ChatAttachment {\n id: string;\n name: string;\n type: string;\n size: number;\n url?: string;\n kind: ChatAttachmentKind;\n extractedText?: string;\n extractedPreview?: string;\n}\n\ntype MediaKind = 'video' | 'audio' | 'image' | 'model' | '';\n\ninterface RunResult {\n kind: Modality;\n json?: unknown;\n raw?: string;\n text?: string;\n images?: string[];\n embedding?: number[];\n mediaUrl?: string;\n mediaKind?: MediaKind;\n blobUrl?: string;\n blobNote?: string;\n}\n\nconst TABS: { key: Modality; label: string; icon: React.ComponentType<{ size?: number }> }[] = [\n { key: 'chat', label: 'Chat', icon: MessageSquare },\n { key: 'image', label: 'Image', icon: ImageIcon },\n { key: 'embeddings', label: 'Embeddings', icon: Binary },\n { key: 'video', label: 'Video', icon: Video },\n { key: 'music', label: 'Music', icon: Music },\n { key: 'speech', label: 'Speech', icon: Volume2 },\n { key: 'transcription', label: 'Transcribe', icon: Mic },\n { key: '3d', label: 'Image → 3D', icon: Box },\n];\n\nconst SAMPLE_I2V_IMAGES = [\n { label: 'Mountain lake', src: 'https://picsum.photos/seed/i2v1/1280/720' },\n { label: 'City street', src: 'https://picsum.photos/seed/i2v2/1280/720' },\n { label: 'Forest path', src: 'https://picsum.photos/seed/i2v3/1280/720' },\n { label: 'Ocean sunset', src: 'https://picsum.photos/seed/i2v4/1280/720' },\n];\n\nconst ENDPOINT: Record<Modality, string> = {\n chat: '/v1/chat/completions',\n image: '/v1/images/generations',\n embeddings: '/v1/embeddings',\n video: '/v1/videos/generations',\n music: '/v1/music/generations',\n speech: '/v1/audio/speech',\n transcription: '/v1/audio/transcriptions',\n '3d': '/v1/3d/generations',\n};\n\nfunction extractTranscript(payload: unknown): string {\n if (typeof payload === 'string') return payload.trim();\n if (!payload || typeof payload !== 'object') return '';\n const record = payload as Record<string, unknown>;\n for (const key of ['text', 'transcript', 'transcription', 'output']) {\n const text = extractTranscript(record[key]);\n if (text) return text;\n }\n return '';\n}\n\n// Fallback modality inference for when a cached /api/gateway/models response\n// predates the server-side `modality` field. Mirrors server/gateway.go.\nfunction inferModality(id: string): Modality {\n const i = id.toLowerCase();\n const has = (...s: string[]) => s.some((x) => i.includes(x));\n if (has('transcribe', 'whisper', 'stt')) return 'transcription';\n if (has('embed', 'rerank')) return 'embeddings';\n if (has('tts', 'speech-', 'voice')) return 'speech';\n if (has('3d', 'mesh', 'tripo', 'trellis', 'rigging')) return '3d';\n if (has('music', 'lyria')) return 'music';\n if (has('video', 'sora', 'hailuo', 'seedance', 'veo', 'kling', 'ltx', 'ra2v', 'wan', 'happy-horse', 'pika', 'luma', 'ray-2', 'ray/', 'pixverse', 'vidu', 'cogvideo', 'hunyuan', 'kandinsky', 'cosmos', 'lucy', 'gemini-omni')) return 'video';\n if (has('image', 'flux', 'dall-e', 'imagine', 'zimage', 'klein', 'ra1', 'diffusion')) return 'image';\n return 'chat';\n}\n\nconst MEDIA_EXT: Record<Exclude<MediaKind, ''>, string[]> = {\n video: ['mp4', 'webm', 'mov', 'm4v'],\n audio: ['mp3', 'wav', 'ogg', 'm4a', 'flac', 'aac'],\n image: ['png', 'jpg', 'jpeg', 'webp', 'gif', 'avif'],\n model: ['glb', 'gltf', 'usdz', 'obj', 'ply', 'fbx', 'splat'],\n};\n\nfunction classifyUrl(u: string): MediaKind {\n const m = u.split('?')[0].toLowerCase().match(/\\.([a-z0-9]+)$/);\n const ext = m ? m[1] : '';\n for (const kind of Object.keys(MEDIA_EXT) as Exclude<MediaKind, ''>[]) {\n if (MEDIA_EXT[kind].includes(ext)) return kind;\n }\n return '';\n}\n\n// findMedia walks a job/result envelope and returns the most likely renderable\n// asset URL — extension wins, then a key-name hint, then the first URL seen.\nfunction findMedia(obj: unknown): { url: string; kind: MediaKind } | null {\n const urls: { key: string; url: string }[] = [];\n const walk = (v: unknown, key: string) => {\n if (v == null) return;\n if (typeof v === 'string') {\n if (/^https?:\\/\\//.test(v)) urls.push({ key, url: v });\n return;\n }\n if (Array.isArray(v)) {\n v.forEach((x) => walk(x, key));\n return;\n }\n if (typeof v === 'object') {\n for (const [k, val] of Object.entries(v as Record<string, unknown>)) walk(val, k.toLowerCase());\n }\n };\n walk(obj, '');\n for (const { url } of urls) {\n const kind = classifyUrl(url);\n if (kind) return { url, kind };\n }\n for (const { key, url } of urls) {\n if (/video/.test(key)) return { url, kind: 'video' };\n if (/audio|speech|music|sound/.test(key)) return { url, kind: 'audio' };\n if (/image|thumb|preview/.test(key)) return { url, kind: 'image' };\n if (/model|mesh|glb|asset|3d/.test(key)) return { url, kind: 'model' };\n }\n return urls.length ? { url: urls[0].url, kind: '' } : null;\n}\n\nfunction fmtCost(usd: number): string {\n if (usd <= 0) return '$0.00';\n if (usd < 0.0001) return '<$0.0001';\n if (usd < 0.01) return `$${usd.toFixed(4)}`;\n return `$${usd.toFixed(3)}`;\n}\n\nfunction estimateTokens(text: string): number {\n const trimmed = text.trim();\n if (!trimmed) return 0;\n return Math.max(1, Math.ceil(trimmed.length / 4));\n}\n\nfunction estimateChatTokens(messages: ChatMessage[], system: string): number {\n return estimateTokens(system) + messages.reduce((sum, m) => {\n const attachmentTokens = (m.attachments || []).reduce((acc, att) => {\n const extracted = estimateTokens(att.extractedText || '');\n const media = att.kind === 'image' ? 512 : att.kind === 'video' || att.kind === 'audio' ? 256 : 24;\n return acc + extracted + media;\n }, 0);\n return sum + estimateTokens(m.content) + attachmentTokens + 4;\n }, 0);\n}\n\nfunction fmtTokens(tokens: number): string {\n if (tokens >= 1_000_000) return `${(tokens / 1_000_000).toFixed(1)}M`;\n if (tokens >= 1000) return `${(tokens / 1000).toFixed(tokens >= 10_000 ? 0 : 1)}K`;\n return tokens.toLocaleString();\n}\n\nfunction inferAttachmentKind(file: File): ChatAttachmentKind {\n const mime = file.type.toLowerCase();\n const name = file.name.toLowerCase();\n if (mime.startsWith('image/')) return 'image';\n if (mime.startsWith('video/')) return 'video';\n if (mime.startsWith('audio/')) return 'audio';\n if (DOCUMENT_ACCEPT.split(',').some((ext) => name.endsWith(ext.trim().toLowerCase()))) return 'document';\n if (mime.startsWith('text/') || /(\\.txt|\\.md|\\.csv|\\.json|\\.jsonl|\\.xml|\\.html|\\.css|\\.js|\\.ts|\\.tsx|\\.py|\\.go|\\.rs|\\.sql|\\.log)$/i.test(name)) return 'document';\n return 'file';\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n const kb = bytes / 1024;\n if (kb < 1024) return `${kb.toFixed(kb < 10 ? 1 : 0)} KB`;\n const mb = kb / 1024;\n return `${mb.toFixed(mb < 10 ? 1 : 0)} MB`;\n}\n\nfunction attachmentSummary(att: ChatAttachment): string {\n const location = att.url ? `: ${att.url}` : ' (text extracted locally; no public URL)';\n return `${att.name} (${att.type || att.kind}, ${formatBytes(att.size)})${location}`;\n}\n\nfunction buildAttachmentText(attachments: ChatAttachment[]): string {\n if (!attachments.length) return '';\n const lines = ['Attached files:'];\n for (const att of attachments) {\n lines.push(`- ${attachmentSummary(att)}`);\n if (att.extractedText) {\n lines.push(`\\nExtracted text from ${att.name}:\\n\\`\\`\\`\\n${att.extractedText.slice(0, 120_000)}${att.extractedText.length > 120_000 ? '\\n\\n[Truncated after 120,000 characters.]' : ''}\\n\\`\\`\\``);\n } else if (att.kind === 'video') {\n lines.push(' Video is attached as a public URL for video-capable models.');\n }\n }\n return lines.join('\\n');\n}\n\nfunction messageForAPI(message: ChatMessage): { role: ChatMessage['role']; content: string | any[] } {\n const attachments = message.attachments || [];\n if (!attachments.length) return { role: message.role, content: message.content };\n\n const parts: any[] = [];\n if (message.content.trim()) parts.push({ type: 'text', text: message.content });\n\n const textContext = buildAttachmentText(attachments.filter((att) => att.kind !== 'image' && !(att.kind === 'video' && att.url)));\n if (textContext) parts.push({ type: 'text', text: textContext });\n\n for (const att of attachments) {\n if (att.kind === 'image' && att.url) parts.push({ type: 'image_url', image_url: { url: att.url } });\n if (att.kind === 'video' && att.url) parts.push({ type: 'video_url', video_url: { url: att.url } });\n }\n\n if (!parts.length) parts.push({ type: 'text', text: buildAttachmentText(attachments) });\n return { role: message.role, content: parts };\n}\n\nfunction playCompletionSound() {\n try {\n const AudioContextClass = window.AudioContext || (window as any).webkitAudioContext;\n if (!AudioContextClass) return;\n const ctx = new AudioContextClass();\n const now = ctx.currentTime;\n const gain = ctx.createGain();\n gain.gain.setValueAtTime(0.0001, now);\n gain.gain.exponentialRampToValueAtTime(0.04, now + 0.015);\n gain.gain.exponentialRampToValueAtTime(0.0001, now + 0.18);\n gain.connect(ctx.destination);\n const osc = ctx.createOscillator();\n osc.type = 'sine';\n osc.frequency.setValueAtTime(720, now);\n osc.frequency.exponentialRampToValueAtTime(980, now + 0.08);\n osc.connect(gain);\n osc.start(now);\n osc.stop(now + 0.2);\n window.setTimeout(() => void ctx.close(), 300);\n } catch {\n /* browser audio unavailable */\n }\n}\n\nfunction makeChatMessage(\n role: ChatMessage['role'],\n content: string,\n extras: Omit<ChatMessage, 'role' | 'content' | 'createdAt'> = {},\n): ChatMessage {\n return { role, content, createdAt: Date.now(), ...extras };\n}\n\nfunction messageTime(ts?: number): string {\n if (!ts) return '';\n return new Date(ts).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });\n}\n\nconst inputCx =\n 'h-10 w-full rounded-lg border border-white/10 bg-[#050505] px-3 text-sm text-white placeholder:text-white/30 focus:border-white/25 focus:outline-none';\n\nexport const GatewayPlayground: React.FC<Props> = ({ models, origin, initialTab, initialModel }) => {\n const [apiKey, setApiKey] = React.useState('');\n const [tab, setTab] = React.useState<Modality>(initialTab ?? 'chat');\n const [showCode, setShowCode] = React.useState(false);\n const [resultView, setResultView] = React.useState<'preview' | 'json'>('preview');\n\n // Session state + sign-in-on-401: a 401 opens the in-page sign-in modal and\n // the interrupted request re-runs after auth instead of dead-ending on an\n // error string.\n const [signedIn, setSignedIn] = React.useState<boolean | null>(null);\n const [showSignIn, setShowSignIn] = React.useState(false);\n const [showSettings, setShowSettings] = React.useState(false);\n const [systemExpanded, setSystemExpanded] = React.useState(false);\n const [galleryRefresh, setGalleryRefresh] = React.useState(0);\n const retryRef = React.useRef<(() => void) | null>(null);\n\n // Shared request lifecycle.\n const [busy, setBusy] = React.useState(false);\n const [error, setError] = React.useState<string | null>(null);\n const [latencyMs, setLatencyMs] = React.useState<number | null>(null);\n const [result, setResult] = React.useState<RunResult | null>(null);\n\n // Chat (streaming) is its own little world.\n const [system, setSystem] = React.useState('You are a helpful assistant.');\n const [messages, setMessages] = React.useState<ChatMessage[]>([]);\n const [streaming, setStreaming] = React.useState(false);\n const [usage, setUsage] = React.useState<{ prompt: number; completion: number; cached?: number } | null>(null);\n const [maxTokens, setMaxTokens] = React.useState(4096);\n const [chatAttachments, setChatAttachments] = React.useState<ChatAttachment[]>([]);\n const [chatUploading, setChatUploading] = React.useState(false);\n const [chatUploadError, setChatUploadError] = React.useState<string | null>(null);\n const [soundEnabled, setSoundEnabled] = React.useState(false);\n\n // Per-surface inputs.\n const [model, setModel] = React.useState(initialModel ?? 'auto');\n const [chatInput, setChatInput] = React.useState('Explain what an AI model gateway is in two sentences.');\n const [prompt, setPrompt] = React.useState('A beige coffee mug on a wooden table, soft natural light');\n const [size, setSize] = React.useState('1024x1024');\n const [embedInput, setEmbedInput] = React.useState('app.nz routes every model through one API');\n const [voice, setVoice] = React.useState('eve');\n const [ttsInput, setTtsInput] = React.useState('Welcome to app.nz. One API key routes every model.');\n const [language, setLanguage] = React.useState('');\n\n // Uploaded asset URL for image-conditioned surfaces (video, 3d).\n const [assetUrl, setAssetUrl] = React.useState('');\n const [uploading, setUploading] = React.useState(false);\n const [audioFile, setAudioFile] = React.useState<File | null>(null);\n\n // Video generation args (per-model fal params).\n const [videoResolution, setVideoResolution] = React.useState('720p');\n const [videoDuration, setVideoDuration] = React.useState('4');\n const [videoAspect, setVideoAspect] = React.useState('16:9');\n const [videoAudio, setVideoAudio] = React.useState(false);\n const [videoAdvanced, setVideoAdvanced] = React.useState<VideoAdvancedValues>(EMPTY_ADVANCED);\n const [showVideoAdvanced, setShowVideoAdvanced] = React.useState(false);\n\n // Code panel: language switcher + markdown copy.\n const [codeLang, setCodeLang] = React.useState<CodeKind>('python');\n const [copiedMd, setCopiedMd] = React.useState(false);\n\n const abortRef = React.useRef<AbortController | null>(null);\n const scrollRef = React.useRef<HTMLDivElement | null>(null);\n const blobRef = React.useRef<string | null>(null);\n const chatFileInputRef = React.useRef<HTMLInputElement | null>(null);\n\n React.useEffect(() => {\n try {\n const k = localStorage.getItem('appnz_gateway_key');\n if (k) setApiKey(k);\n setSoundEnabled(localStorage.getItem('appnz_gateway_sound') === '1');\n } catch {\n /* storage blocked */\n }\n }, []);\n\n React.useEffect(() => {\n fetch('/api/me')\n .then((r) => r.json())\n .then((d) => setSignedIn(!!d?.authenticated))\n .catch(() => setSignedIn(false));\n }, []);\n\n // A 401 means \"not signed in and no key\": open the sign-in modal and queue\n // the interrupted action to re-run once the session cookie exists.\n const requestSignIn = React.useCallback((retry: (() => void) | null) => {\n retryRef.current = retry;\n setShowSignIn(true);\n }, []);\n\n const onAuthed = React.useCallback(() => {\n setSignedIn(true);\n setError(null);\n setGalleryRefresh((x) => x + 1);\n const retry = retryRef.current;\n retryRef.current = null;\n retry?.();\n }, []);\n\n // Persist successful generations to the user's media library so the\n // playground doubles as a searchable gallery of everything they've made.\n const saveGenerations = React.useCallback(\n (items: Array<{ kind: 'image' | 'video' | 'audio'; url: string; prompt?: string; title?: string }>) => {\n const savable = items.filter((i) => /^https?:/i.test(i.url));\n if (!savable.length) return;\n void Promise.all(\n savable.map((i) =>\n fetch('/api/media/items', {\n method: 'POST',\n headers: authHeaders(),\n credentials: 'include',\n body: JSON.stringify({ ...i, source: 'playground' }),\n }).catch(() => null),\n ),\n ).then(() => setGalleryRefresh((x) => x + 1));\n },\n [apiKey],\n );\n\n React.useEffect(() => {\n try {\n localStorage.setItem('appnz_gateway_sound', soundEnabled ? '1' : '0');\n } catch {\n /* storage blocked */\n }\n }, [soundEnabled]);\n\n React.useEffect(() => {\n scrollRef.current?.scrollTo({ top: scrollRef.current.scrollHeight });\n }, [messages, streaming]);\n\n // Group the catalogue by modality once (deduping repeated ids).\n const grouped = React.useMemo(() => {\n const g: Record<Modality, CatalogModel[]> = {\n chat: [], image: [], embeddings: [], video: [], music: [], speech: [], transcription: [], '3d': [],\n };\n const seen = new Set<string>();\n for (const m of models) {\n if (seen.has(m.id)) continue;\n seen.add(m.id);\n const k = ((m.modality as Modality) && g[m.modality as Modality] ? m.modality : inferModality(m.id)) as Modality;\n g[k].push(m);\n }\n return g;\n }, [models]);\n\n const supportsAuto = tab === 'chat' || tab === 'image' || tab === 'video';\n const tabModels = grouped[tab];\n const seedanceDemo = SEEDANCE_DEMOS[model] || FAL_VIDEO_DEMOS[model] || GEMINI_VIDEO_DEMOS[model];\n const videoSpec = React.useMemo(() => getVideoParamSpec(model), [model]);\n\n // Prefill prompt + reference image + video args when a Seedance demo model is\n // selected, so the video surface opens ready-to-run with a hosted example.\n const lastSeedanceModel = React.useRef('');\n React.useEffect(() => {\n if (!seedanceDemo || lastSeedanceModel.current === model) return;\n lastSeedanceModel.current = model;\n setPrompt(seedanceDemo.prompt);\n setAssetUrl(seedanceDemo.imageUrl || seedanceDemo.imageUrls?.[0] || '');\n setVideoResolution(seedanceDemo.resolution || '720p');\n setVideoDuration(seedanceDemo.duration || '4');\n setVideoAspect(seedanceDemo.aspectRatio || '16:9');\n setVideoAudio(seedanceDemo.generateAudio ?? false);\n }, [model, seedanceDemo]);\n\n const videoBody = React.useCallback(\n () =>\n buildVideoPayload(\n model,\n {\n prompt,\n resolution: videoResolution,\n duration: videoDuration,\n aspectRatio: videoAspect,\n generateAudio: videoAudio,\n imageUrl: assetUrl,\n },\n videoAdvanced,\n videoSpec,\n ),\n [model, prompt, videoResolution, videoDuration, videoAspect, videoAudio, assetUrl, videoAdvanced, videoSpec],\n );\n\n const pickDefaultModel = React.useCallback(\n (t: Modality): string => {\n const list = grouped[t];\n if (t === 'chat') return 'auto';\n if (t === 'image') return 'auto';\n if (t === 'video') return list.find((m) => m.id.includes('auto'))?.id || 'auto';\n if (t === 'transcription') return ''; // server picks the STT provider chain\n return list[0]?.id || '';\n },\n [grouped],\n );\n\n // Reset model + result when switching surfaces.\n const switchTab = (t: Modality) => {\n if (t === tab) return;\n setTab(t);\n setModel(pickDefaultModel(t));\n setResult(null);\n setError(null);\n setLatencyMs(null);\n setResultView('preview');\n if (t === 'image') {\n const first = grouped.image.find((m) => m.supported_sizes?.length);\n setSize(first?.supported_sizes?.[0] || '1024x1024');\n }\n };\n\n const selectedModel = React.useMemo(() => tabModels.find((m) => m.id === model), [tabModels, model]);\n const sizeOptions = selectedModel?.supported_sizes?.length\n ? selectedModel.supported_sizes\n : ['1024x1024', '1024x768', '768x1024', '512x512'];\n const projectedChatTokens = React.useMemo(() => {\n const pending = chatInput.trim() || chatAttachments.length\n ? [makeChatMessage('user', chatInput.trim() || 'Please analyze the attached file.', { attachments: chatAttachments })]\n : [];\n return estimateChatTokens([...messages, ...pending], system);\n }, [messages, chatInput, chatAttachments, system]);\n const projectedContextPct = selectedModel?.context_window\n ? Math.min(100, Math.round((projectedChatTokens / selectedModel.context_window) * 100))\n : null;\n const projectedChatCost = React.useMemo(() => {\n if (tab !== 'chat' || !selectedModel) return null;\n const input = ((selectedModel.input_price_per_1m || 0) * projectedChatTokens) / 1_000_000;\n const output = ((selectedModel.output_price_per_1m || 0) * maxTokens) / 1_000_000;\n const total = input + output;\n return total > 0 ? total : null;\n }, [tab, selectedModel, projectedChatTokens, maxTokens]);\n\n const persistKey = (k: string) => {\n setApiKey(k);\n try {\n if (k) localStorage.setItem('appnz_gateway_key', k);\n else localStorage.removeItem('appnz_gateway_key');\n } catch {\n /* storage blocked */\n }\n };\n\n const authHeaders = (): Record<string, string> => {\n const h: Record<string, string> = { 'Content-Type': 'application/json' };\n if (apiKey.trim()) h.Authorization = `Bearer ${apiKey.trim()}`;\n return h;\n };\n\n const setBlob = (url: string | null) => {\n if (blobRef.current) URL.revokeObjectURL(blobRef.current);\n blobRef.current = url;\n };\n React.useEffect(() => () => setBlob(null), []);\n\n const onUpload = async (file: File | undefined) => {\n if (!file) return;\n setUploading(true);\n setError(null);\n try {\n const url = await uploadFile(file);\n setAssetUrl(url);\n } catch (e) {\n setError(e instanceof Error ? e.message : String(e));\n } finally {\n setUploading(false);\n }\n };\n\n const uploadChatFiles = async (files: FileList | File[]) => {\n const list = Array.from(files);\n if (!list.length) return;\n setChatUploading(true);\n setChatUploadError(null);\n try {\n const next: ChatAttachment[] = [];\n for (const file of list) {\n const kind = inferAttachmentKind(file);\n let extractedText = '';\n let extractedPreview = '';\n if (kind === 'document') {\n try {\n const extracted = await extractDocument(file);\n extractedText = extracted.text;\n extractedPreview = extracted.preview;\n } catch {\n if (file.type.startsWith('text/') || /\\.(txt|md|csv|json|jsonl|html|css|js|ts|tsx|py|go|rs|sql|log)$/i.test(file.name)) {\n extractedText = await file.slice(0, 120_000).text();\n extractedPreview = extractedText.slice(0, 700);\n }\n }\n }\n let url = '';\n try {\n url = await uploadFile(file);\n } catch (uploadErr) {\n if (!extractedText) throw uploadErr;\n }\n next.push({\n id: `${Date.now()}-${Math.random().toString(36).slice(2)}`,\n name: file.name || 'upload',\n type: file.type || 'application/octet-stream',\n size: file.size,\n url: url || undefined,\n kind,\n extractedText,\n extractedPreview,\n });\n }\n setChatAttachments((prev) => [...prev, ...next]);\n } catch (e) {\n setChatUploadError(e instanceof Error ? e.message : String(e));\n } finally {\n setChatUploading(false);\n if (chatFileInputRef.current) chatFileInputRef.current.value = '';\n }\n };\n\n const removeChatAttachment = (id: string) => {\n setChatAttachments((prev) => prev.filter((att) => att.id !== id));\n };\n\n const stop = () => {\n abortRef.current?.abort();\n abortRef.current = null;\n setStreaming(false);\n };\n\n // ---- Chat (streaming) --------------------------------------------------\n const streamChatHistory = async (history: ChatMessage[]) => {\n if (!history.length || streaming || chatUploading) return;\n setError(null);\n setChatUploadError(null);\n setUsage(null);\n setLatencyMs(null);\n setMessages([...history, makeChatMessage('assistant', '')]);\n setStreaming(true);\n\n const controller = new AbortController();\n abortRef.current = controller;\n const start = performance.now();\n const apiMessages = [\n ...(system.trim() ? [{ role: 'system', content: system.trim() }] : []),\n ...history.map(messageForAPI),\n ];\n\n try {\n // Relative URL on purpose: the playground must hit THIS origin so the\n // session cookie (host-only __Host-appnz_sso_session) is sent. Using the\n // `origin` prop here would post cross-origin on beta/www/localhost (where\n // it briefly holds the hardcoded prod origin) and drop the cookie → 401.\n const resp = await fetch('/v1/chat/completions', {\n method: 'POST',\n headers: authHeaders(),\n credentials: 'include',\n signal: controller.signal,\n body: JSON.stringify({ model, messages: apiMessages, stream: true, max_tokens: maxTokens }),\n });\n if (!resp.ok || !resp.body) throw new Error(await errorDetail(resp));\n\n const reader = resp.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n let acc = '';\n let promptTok = 0;\n let completionTok = 0;\n let cachedTok = 0;\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() || '';\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed.startsWith('data:')) continue;\n const payload = trimmed.slice(5).trim();\n if (!payload || payload === '[DONE]') continue;\n let chunk: any;\n try {\n chunk = JSON.parse(payload);\n } catch {\n continue;\n }\n if (chunk.appnz) continue;\n const delta = chunk?.choices?.[0]?.delta?.content;\n if (delta) {\n acc += delta;\n setMessages((prev) => {\n const next = [...prev];\n next[next.length - 1] = { ...(next[next.length - 1] || makeChatMessage('assistant', '')), role: 'assistant', content: acc };\n return next;\n });\n }\n if (chunk?.usage) {\n promptTok = chunk.usage.prompt_tokens || promptTok;\n completionTok = chunk.usage.completion_tokens || completionTok;\n cachedTok = chunk.usage.prompt_cache_hit_tokens || chunk.usage.prompt_tokens_details?.cached_tokens || cachedTok;\n }\n }\n }\n setLatencyMs(Math.round(performance.now() - start));\n if (promptTok || completionTok) setUsage({ prompt: promptTok, completion: completionTok, cached: cachedTok || undefined });\n if (soundEnabled) playCompletionSound();\n if (!acc) {\n setMessages((prev) => {\n const next = [...prev];\n next[next.length - 1] = { ...(next[next.length - 1] || makeChatMessage('assistant', '')), role: 'assistant', content: '(no content returned)' };\n return next;\n });\n }\n } catch (e: any) {\n if (e?.name !== 'AbortError') {\n setError(String(e?.message || e));\n setMessages((prev) => prev.slice(0, -1));\n if (String(e?.message || '').startsWith('401')) requestSignIn(() => void streamChatHistory(history));\n }\n } finally {\n setStreaming(false);\n abortRef.current = null;\n }\n };\n\n const sendChat = async () => {\n const text = chatInput.trim();\n if ((!text && !chatAttachments.length) || streaming || chatUploading) return;\n\n const userMessage = makeChatMessage('user', text || 'Please analyze the attached file.', {\n attachments: chatAttachments,\n });\n const history = [...messages, userMessage];\n setChatInput('');\n setChatAttachments([]);\n await streamChatHistory(history);\n };\n\n const regenerateMessage = (index: number) => {\n if (streaming || chatUploading) return;\n const target = messages[index];\n if (!target) return;\n const cut = target.role === 'user' ? index + 1 : index;\n const history = messages.slice(0, cut);\n if (!history.some((m) => m.role === 'user')) return;\n void streamChatHistory(history);\n };\n\n const editMessage = (index: number, content: string) => {\n const nextContent = content.trim();\n if (!nextContent || streaming || chatUploading) return;\n const target = messages[index];\n if (!target) return;\n const edited = messages.map((m, i) => (i === index ? { ...m, content: nextContent, createdAt: m.createdAt || Date.now() } : m));\n\n if (target.role === 'user') {\n const history = edited.slice(0, index + 1);\n void streamChatHistory(history);\n return;\n }\n\n setMessages(edited);\n };\n\n const forkMessage = (index: number) => {\n if (streaming || chatUploading) return;\n const target = messages[index];\n if (!target) return;\n const branch = messages.slice(0, index + 1).map((m, i) => ({\n ...m,\n createdAt: m.createdAt || Date.now(),\n branchOf: i === index ? index : m.branchOf,\n }));\n setMessages(branch);\n };\n\n const deleteMessage = (index: number) => {\n if (streaming || chatUploading) return;\n setMessages((prev) => prev.filter((_, i) => i !== index));\n };\n\n const clearChat = () => {\n stop();\n setMessages([]);\n setUsage(null);\n setLatencyMs(null);\n setError(null);\n };\n\n // ---- Non-chat surfaces -------------------------------------------------\n const run = async () => {\n if (busy) return;\n setError(null);\n setResult(null);\n setLatencyMs(null);\n setResultView('preview');\n setBusy(true);\n const start = performance.now();\n try {\n if (tab === 'transcription') await runTranscription();\n else if (tab === 'speech') await runSpeech();\n else if (tab === 'image') await runImage();\n else if (tab === 'embeddings') await runEmbeddings();\n else await runMedia(tab); // video | music | 3d\n setLatencyMs(Math.round(performance.now() - start));\n if (soundEnabled) playCompletionSound();\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n setError(msg);\n if (msg.startsWith('401')) requestSignIn(() => void run());\n } finally {\n setBusy(false);\n }\n };\n\n const runImage = async () => {\n const resp = await fetch('/v1/images/generations', {\n method: 'POST',\n headers: authHeaders(),\n credentials: 'include',\n body: JSON.stringify({ model, prompt, size, n: 1 }),\n });\n if (!resp.ok) throw new Error(await errorDetail(resp));\n const json = await resp.json();\n const images: string[] = (json?.data || [])\n .map((d: any) => d?.url || (d?.b64_json ? `data:image/png;base64,${d.b64_json}` : null))\n .filter(Boolean);\n setResult({ kind: 'image', json, images, raw: pretty(json) });\n saveGenerations(images.map((url) => ({ kind: 'image' as const, url, prompt })));\n };\n\n const runEmbeddings = async () => {\n const resp = await fetch('/v1/embeddings', {\n method: 'POST',\n headers: authHeaders(),\n credentials: 'include',\n body: JSON.stringify({ model, input: embedInput }),\n });\n if (!resp.ok) throw new Error(await errorDetail(resp));\n const json = await resp.json();\n const embedding: number[] = json?.data?.[0]?.embedding || [];\n setResult({ kind: 'embeddings', json, embedding, raw: pretty(json) });\n };\n\n const runMedia = async (kind: Modality) => {\n if (kind === '3d' && !assetUrl) throw new Error('Upload an image first — image→3D needs a source image.');\n let body: Record<string, unknown>;\n if (kind === '3d') {\n body = { model, image_url: assetUrl };\n } else if (kind === 'video') {\n body = videoBody();\n } else {\n body = { model, prompt };\n if (assetUrl) body.image_url = assetUrl;\n }\n const resp = await fetch(ENDPOINT[kind], {\n method: 'POST',\n headers: authHeaders(),\n credentials: 'include',\n body: JSON.stringify(body),\n });\n if (!resp.ok) throw new Error(await errorDetail(resp));\n const json = await resp.json();\n const media = findMedia(json);\n setResult({\n kind,\n json,\n raw: pretty(json),\n mediaUrl: media?.url,\n mediaKind: media?.kind ?? '',\n });\n if (media?.url && (media.kind === 'image' || media.kind === 'video' || media.kind === 'audio')) {\n saveGenerations([{ kind: media.kind, url: media.url, prompt }]);\n }\n };\n\n const runSpeech = async () => {\n const resp = await fetch('/v1/audio/speech', {\n method: 'POST',\n headers: authHeaders(),\n credentials: 'include',\n body: JSON.stringify({ model, voice, input: ttsInput }),\n });\n if (!resp.ok) throw new Error(await errorDetail(resp));\n const blob = await resp.blob();\n const url = URL.createObjectURL(blob);\n setBlob(url);\n setResult({\n kind: 'speech',\n blobUrl: url,\n mediaKind: 'audio',\n blobNote: `${blob.type || 'audio'} · ${(blob.size / 1024).toFixed(1)} KB`,\n raw: `# binary audio response\\n${blob.type || 'audio/mpeg'}\\n${blob.size} bytes`,\n });\n };\n\n const runTranscription = async () => {\n if (!audioFile) throw new Error('Choose an audio file to transcribe.');\n const headers: Record<string, string> = { 'Content-Type': audioFile.type || 'audio/webm' };\n if (apiKey.trim()) headers.Authorization = `Bearer ${apiKey.trim()}`;\n const qs = language.trim() ? `?language=${encodeURIComponent(language.trim())}` : '';\n const resp = await fetch(`/v1/audio/transcriptions${qs}`, {\n method: 'POST',\n headers,\n credentials: 'include',\n body: audioFile,\n });\n if (!resp.ok) throw new Error(await errorDetail(resp));\n const json = await resp.json();\n setResult({ kind: 'transcription', json, text: extractTranscript(json), raw: pretty(json) });\n };\n\n // ---- View-code (multi-language) ----------------------------------------\n const codeSamples = React.useMemo(() => {\n const common = { origin, path: ENDPOINT[tab], apiKey };\n switch (tab) {\n case 'chat':\n return buildGatewaySamples({ ...common, sdk: 'chat', body: { model, messages: [messageForAPI({ role: 'user', content: chatInput || (chatAttachments.length ? 'Please analyze the attached file.' : '...'), attachments: chatAttachments })], stream: true, max_tokens: maxTokens } });\n case 'image':\n return buildGatewaySamples({ ...common, sdk: 'image', body: { model, prompt, size, n: 1 } });\n case 'embeddings':\n return buildGatewaySamples({ ...common, sdk: 'embeddings', body: { model, input: embedInput } });\n case 'speech':\n return buildGatewaySamples({ ...common, sdk: 'speech', body: { model, voice, input: ttsInput } });\n case 'transcription':\n return buildGatewaySamples({ ...common, sdk: 'transcription', langQuery: language.trim() || undefined });\n case 'video':\n return buildGatewaySamples({ ...common, sdk: 'post', body: videoBody() });\n case 'music':\n return buildGatewaySamples({ ...common, sdk: 'post', body: assetUrl ? { model, prompt, image_url: assetUrl } : { model, prompt } });\n case '3d':\n return buildGatewaySamples({ ...common, sdk: 'post', body: { model, image_url: assetUrl || 'https://appstatic.app.nz/app/static/uploads/…' } });\n default:\n return buildGatewaySamples({ ...common, sdk: 'post', body: { model } });\n }\n }, [tab, origin, apiKey, model, chatInput, chatAttachments, maxTokens, prompt, size, embedInput, voice, ttsInput, language, assetUrl, videoBody]);\n\n const codeMarkdown = React.useMemo(\n () => samplesToMarkdown(codeSamples, `${tab} — app.nz gateway`),\n [codeSamples, tab],\n );\n\n const imageCost =\n tab === 'image' && selectedModel?.price_per_image ? selectedModel.price_per_image : null;\n const chatCost = React.useMemo(() => {\n if (tab !== 'chat' || !usage || !selectedModel) return null;\n const cached = Math.max(0, Math.min(usage.prompt, usage.cached || 0));\n const uncached = Math.max(0, usage.prompt - cached);\n const inputRate = selectedModel.input_price_per_1m || 0;\n const cachedRate = selectedModel.input_cache_hit_per_1m ?? inputRate;\n const inC = ((inputRate * uncached) + (cachedRate * cached)) / 1_000_000;\n const outC = ((selectedModel.output_price_per_1m || 0) * usage.completion) / 1_000_000;\n const total = inC + outC;\n return total > 0 ? total : null;\n }, [tab, usage, selectedModel]);\n\n // ---- Render ------------------------------------------------------------\n return (\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.02] p-4\" data-testid=\"gateway-playground\">\n {/* Modality tabs */}\n <div className=\"mb-4 flex flex-wrap gap-1.5\" role=\"tablist\">\n {TABS.map(({ key, label, icon: Icon }) => {\n const count = grouped[key].length;\n const activeTab = key === tab;\n return (\n <button\n key={key}\n role=\"tab\"\n aria-selected={activeTab}\n onClick={() => switchTab(key)}\n data-testid={`gateway-playground-tab-${key}`}\n className={`inline-flex items-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-semibold transition-colors ${\n activeTab\n ? 'border-white/20 bg-sky-400/15 text-sky-200'\n : 'border-white/10 bg-white/[0.03] text-white/65 hover:text-white'\n }`}\n >\n <Icon size={14} /> {label}\n {count > 0 && (\n <span className={activeTab ? 'text-black/45' : 'text-white/30'}>{count}</span>\n )}\n </button>\n );\n })}\n </div>\n\n {/* Model + code toggle + settings */}\n <div className=\"mb-3 grid gap-2 sm:grid-cols-[1fr_auto_auto] sm:items-end\">\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Model</span>\n <select\n value={model}\n onChange={(e) => setModel(e.target.value)}\n data-testid=\"gateway-playground-model\"\n disabled={tab === 'transcription'}\n className={`${inputCx} disabled:opacity-50`}\n >\n {tab === 'transcription' && <option value=\"\">auto (server picks STT provider)</option>}\n {supportsAuto && <option value=\"auto\">auto (smart routing)</option>}\n {tabModels.map((m) => (\n <option key={m.id} value={m.id}>\n {m.id}\n </option>\n ))}\n </select>\n </label>\n <button\n onClick={() => setShowCode((v) => !v)}\n className=\"inline-flex h-10 items-center justify-center gap-1.5 rounded-lg border border-white/10 px-3 text-xs font-mono text-white/60 hover:text-white\"\n >\n <Code2 size={14} /> {showCode ? 'Hide code' : 'View code'}\n </button>\n <div className=\"relative\">\n <button\n type=\"button\"\n onClick={() => setShowSettings((v) => !v)}\n data-testid=\"gateway-playground-settings\"\n aria-expanded={showSettings}\n className={`inline-flex h-10 items-center justify-center gap-1.5 rounded-lg border px-3 text-xs font-mono transition-colors ${\n showSettings ? 'border-white/25 bg-white/[0.06] text-white' : 'border-white/10 text-white/60 hover:text-white'\n }`}\n >\n <Settings2 size={14} /> Settings\n <span className={signedIn ? 'text-emerald-300/70' : apiKey ? 'text-sky-300/70' : 'text-white/30'}>\n {signedIn ? '· session' : apiKey ? '· key' : ''}\n </span>\n </button>\n {showSettings && (\n <div className=\"absolute right-0 top-11 z-30 w-80 max-w-[calc(100vw-2rem)] rounded-xl border border-white/15 bg-[#0b0b0c] p-3 shadow-[0_18px_60px_rgba(0,0,0,0.6)]\">\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">API key (optional when signed in)</span>\n <input\n value={apiKey}\n onChange={(e) => persistKey(e.target.value)}\n type=\"password\"\n placeholder=\"pk_live_…\"\n data-testid=\"gateway-playground-key\"\n className={inputCx}\n />\n </label>\n <p className=\"mt-1.5 text-[11px] leading-4 text-white/40\">\n {signedIn\n ? 'Signed in — requests use your session automatically. A key overrides it.'\n : 'Stored locally in this browser. Or sign in and skip keys entirely.'}\n </p>\n {signedIn === false && (\n <button\n type=\"button\"\n onClick={() => {\n setShowSettings(false);\n requestSignIn(null);\n }}\n className=\"mt-2 inline-flex h-9 w-full items-center justify-center gap-1.5 rounded-lg bg-sky-400 text-xs font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <LogIn size={13} /> Sign in\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => {\n setSoundEnabled((v) => !v);\n if (!soundEnabled) playCompletionSound();\n }}\n className={`mt-2 inline-flex h-9 w-full items-center justify-center gap-1.5 rounded-lg border text-xs font-mono transition-colors ${\n soundEnabled\n ? 'border-emerald-400/30 bg-emerald-400/10 text-emerald-200'\n : 'border-white/10 text-white/60 hover:text-white'\n }`}\n title=\"Play a sound when a gateway response finishes\"\n >\n <Volume2 size={14} /> Sound on completion {soundEnabled ? 'on' : 'off'}\n </button>\n </div>\n )}\n </div>\n </div>\n\n {showCode && (\n <div className=\"mb-3\">\n <div className=\"mb-2 flex flex-wrap items-center gap-2\">\n {CODE_LANGS.map((l) => (\n <button\n key={l.id}\n type=\"button\"\n onClick={() => setCodeLang(l.id)}\n className={`rounded px-2.5 py-1 text-xs font-mono transition-colors ${codeLang === l.id ? 'bg-white text-black' : 'border border-white/10 text-white/50 hover:text-white'}`}\n data-testid={`gateway-code-lang-${l.id}`}\n >\n {l.label}\n </button>\n ))}\n <button\n type=\"button\"\n onClick={async () => {\n try {\n await navigator.clipboard.writeText(codeMarkdown);\n setCopiedMd(true);\n window.setTimeout(() => setCopiedMd(false), 1600);\n } catch {\n /* clipboard blocked */\n }\n }}\n className=\"ml-auto inline-flex items-center gap-1.5 rounded border border-white/10 px-2.5 py-1 text-xs font-mono text-white/55 hover:text-white\"\n data-testid=\"gateway-code-copy-md\"\n >\n {copiedMd ? <Check size={13} className=\"text-emerald-300\" /> : <Copy size={13} />}\n {copiedMd ? 'Copied' : 'Copy as Markdown'}\n </button>\n </div>\n <CodeBlock code={codeSamples[codeLang] || ''} language={codeLangHl[codeLang]} testId=\"gateway-playground-code\" />\n </div>\n )}\n\n {/* Per-surface controls */}\n {tab === 'chat' && (\n <div className=\"mb-3 grid gap-3 lg:grid-cols-[1fr_18rem]\">\n <label className=\"block\">\n <span className=\"mb-1 flex items-center justify-between text-xs font-mono text-white/40\">\n <span>System prompt</span>\n <button\n type=\"button\"\n onClick={() => setSystemExpanded((v) => !v)}\n data-testid=\"gateway-playground-system-expand\"\n className=\"inline-flex items-center gap-1 text-white/40 transition-colors hover:text-white\"\n aria-label={systemExpanded ? 'Collapse system prompt' : 'Expand system prompt'}\n >\n {systemExpanded ? <ChevronUp size={13} /> : <ChevronDown size={13} />}\n {systemExpanded ? 'collapse' : 'expand'}\n </button>\n </span>\n <textarea\n value={system}\n onChange={(e) => setSystem(e.target.value)}\n rows={systemExpanded ? 8 : 1}\n className=\"w-full resize-none rounded-lg border border-white/10 bg-[#050505] px-3 py-2 text-sm text-white placeholder:text-white/30 focus:border-white/25 focus:outline-none\"\n />\n </label>\n <label className=\"block\">\n <span className=\"mb-1 flex justify-between text-xs font-mono text-white/40\">\n <span>Max tokens</span>\n <span className=\"text-white/60\">{maxTokens.toLocaleString()}</span>\n </span>\n <input\n type=\"range\"\n min=\"256\"\n max={Math.min(32768, Math.max(4096, selectedModel?.max_output_tokens || 4096))}\n step=\"256\"\n value={maxTokens}\n onChange={(e) => setMaxTokens(parseInt(e.target.value))}\n className=\"h-1 w-full accent-white\"\n data-testid=\"gateway-playground-max-tokens\"\n />\n <div className=\"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[10px] font-mono text-white/35\">\n <span>\n ctx {fmtTokens(projectedChatTokens)}\n {selectedModel?.context_window ? `/${fmtTokens(selectedModel.context_window)}` : ''}\n {projectedContextPct !== null ? ` (${projectedContextPct}%)` : ''}\n </span>\n {projectedChatCost !== null && <span className=\"text-amber-300/70\">est {fmtCost(projectedChatCost)}</span>}\n </div>\n </label>\n </div>\n )}\n\n {(tab === 'image' || tab === 'video' || tab === 'music') && (\n <label className=\"mb-3 block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Prompt</span>\n <textarea\n value={prompt}\n onChange={(e) => setPrompt(e.target.value)}\n rows={2}\n className=\"w-full resize-none rounded-lg border border-white/10 bg-[#050505] px-3 py-2 text-sm text-white placeholder:text-white/30 focus:border-white/25 focus:outline-none\"\n />\n </label>\n )}\n\n {tab === 'video' && (\n <div className=\"mb-3\">\n <div className=\"grid grid-cols-2 gap-2 sm:grid-cols-4\">\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Resolution</span>\n <select value={videoResolution} onChange={(e) => setVideoResolution(e.target.value)} className={inputCx} data-testid=\"video-resolution\">\n {videoSpec.resolutions.map((v) => <option key={v} value={v}>{v}</option>)}\n </select>\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Duration</span>\n <select value={videoDuration} onChange={(e) => setVideoDuration(e.target.value)} className={inputCx} data-testid=\"video-duration\">\n {videoSpec.durations.map((v) => <option key={v} value={v}>{v}</option>)}\n </select>\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Aspect</span>\n <select value={videoAspect} onChange={(e) => setVideoAspect(e.target.value)} className={inputCx} data-testid=\"video-aspect-ratio\">\n {videoSpec.aspectRatios.map((v) => <option key={v} value={v}>{v}</option>)}\n </select>\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">{videoSpec.enableSafetyChecker ? 'Safety' : 'Audio'}</span>\n <button\n type=\"button\"\n onClick={() => videoSpec.generateAudio && setVideoAudio((v) => !v)}\n className={`h-10 w-full rounded-lg border px-3 text-xs font-mono transition-colors ${(videoSpec.enableSafetyChecker || videoAudio) ? 'border-emerald-400/30 bg-emerald-400/10 text-emerald-200' : 'border-white/10 bg-[#050505] text-white/50'}`}\n data-testid=\"video-generate-audio\"\n >\n {videoSpec.enableSafetyChecker || videoAudio ? 'on' : 'off'}\n </button>\n </label>\n </div>\n <button type=\"button\" onClick={() => setShowVideoAdvanced((v) => !v)} className=\"mt-2 text-[11px] font-mono uppercase tracking-wider text-white/40 hover:text-white\" data-testid=\"video-advanced-toggle\">\n {showVideoAdvanced ? '− Advanced args' : '+ Advanced args'}\n </button>\n {showVideoAdvanced && (\n <div className=\"mt-2 grid grid-cols-2 gap-2 sm:grid-cols-4\" data-testid=\"video-advanced\">\n {videoSpec.negativePrompt && (\n <label className=\"block col-span-2 sm:col-span-1\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Negative prompt</span>\n <input value={videoAdvanced.negativePrompt} onChange={(e) => setVideoAdvanced((p) => ({ ...p, negativePrompt: e.target.value }))} placeholder=\"blurry, distorted\" className={inputCx} data-testid=\"video-negative-prompt\" />\n </label>\n )}\n {videoSpec.seed && (\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Seed</span>\n <input value={videoAdvanced.seed} onChange={(e) => setVideoAdvanced((p) => ({ ...p, seed: e.target.value }))} inputMode=\"numeric\" placeholder=\"random\" className={inputCx} data-testid=\"video-seed\" />\n </label>\n )}\n {videoSpec.numFrames && (\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Num frames</span>\n <input value={videoAdvanced.numFrames} onChange={(e) => setVideoAdvanced((p) => ({ ...p, numFrames: e.target.value }))} inputMode=\"numeric\" placeholder={videoSpec.numFrames.placeholder} className={inputCx} data-testid=\"video-num-frames\" />\n </label>\n )}\n {videoSpec.framesPerSecond && (\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">FPS</span>\n <select value={videoAdvanced.framesPerSecond} onChange={(e) => setVideoAdvanced((p) => ({ ...p, framesPerSecond: e.target.value }))} className={inputCx} data-testid=\"video-fps\">\n <option value=\"\">default</option>\n {videoSpec.framesPerSecond.options.map((o) => <option key={o} value={o}>{o}</option>)}\n </select>\n </label>\n )}\n {videoSpec.guidanceScale && (\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Guidance</span>\n <input value={videoAdvanced.guidanceScale} onChange={(e) => setVideoAdvanced((p) => ({ ...p, guidanceScale: e.target.value }))} inputMode=\"decimal\" placeholder={videoSpec.guidanceScale.placeholder} className={inputCx} data-testid=\"video-guidance-scale\" />\n </label>\n )}\n {videoSpec.numInferenceSteps && (\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Steps</span>\n <input value={videoAdvanced.numInferenceSteps} onChange={(e) => setVideoAdvanced((p) => ({ ...p, numInferenceSteps: e.target.value }))} inputMode=\"numeric\" placeholder={videoSpec.numInferenceSteps.placeholder} className={inputCx} data-testid=\"video-num-inference-steps\" />\n </label>\n )}\n {videoSpec.outputFormats && (\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Format</span>\n <select value={videoAdvanced.outputFormat} onChange={(e) => setVideoAdvanced((p) => ({ ...p, outputFormat: e.target.value }))} className={inputCx} data-testid=\"video-output-format\">\n <option value=\"\">default</option>\n {videoSpec.outputFormats.map((o) => <option key={o} value={o}>{o}</option>)}\n </select>\n </label>\n )}\n </div>\n )}\n </div>\n )}\n\n {tab === 'image' && (\n <label className=\"mb-3 block max-w-[200px]\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Size</span>\n <select value={size} onChange={(e) => setSize(e.target.value)} className={inputCx}>\n {sizeOptions.map((s) => (\n <option key={s} value={s}>\n {s}\n </option>\n ))}\n </select>\n </label>\n )}\n\n {tab === 'embeddings' && (\n <label className=\"mb-3 block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Input text</span>\n <textarea\n value={embedInput}\n onChange={(e) => setEmbedInput(e.target.value)}\n rows={2}\n className=\"w-full resize-none rounded-lg border border-white/10 bg-[#050505] px-3 py-2 text-sm text-white focus:border-white/25 focus:outline-none\"\n />\n </label>\n )}\n\n {tab === 'speech' && (\n <div className=\"mb-3 grid gap-2 sm:grid-cols-[160px_1fr]\">\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Voice</span>\n <input value={voice} onChange={(e) => setVoice(e.target.value)} className={inputCx} />\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Text to speak</span>\n <input value={ttsInput} onChange={(e) => setTtsInput(e.target.value)} className={inputCx} />\n </label>\n </div>\n )}\n\n {/* Image upload for video (optional) + 3d (required) */}\n {(tab === 'video' || tab === '3d') && (\n <div className=\"mb-3\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">\n {tab === '3d' ? 'Source image (required)' : 'Source image (optional — enables image-to-video)'}\n </span>\n <div className=\"flex flex-wrap items-center gap-3\">\n <label className=\"inline-flex h-10 cursor-pointer items-center gap-2 rounded-lg border border-white/10 bg-[#050505] px-3 text-sm text-white/70 hover:text-white\">\n {uploading ? <Loader2 size={15} className=\"animate-spin\" /> : <Upload size={15} />}\n {uploading ? 'Uploading…' : 'Upload image'}\n <input\n type=\"file\"\n accept=\"image/*\"\n className=\"hidden\"\n onChange={(e) => onUpload(e.target.files?.[0])}\n />\n </label>\n {SAMPLE_I2V_IMAGES.map((img) => (\n <button\n key={img.src}\n type=\"button\"\n title={img.label}\n onClick={() => setAssetUrl(img.src)}\n className={`relative h-10 w-10 overflow-hidden rounded-md border transition-colors ${assetUrl === img.src ? 'border-white/60' : 'border-white/10 hover:border-white/30'}`}\n >\n <img src={img.src} alt={img.label} className=\"h-full w-full object-cover\" />\n </button>\n ))}\n {assetUrl && !SAMPLE_I2V_IMAGES.some(i => i.src === assetUrl) && (\n <div className=\"flex items-center gap-2\">\n <img src={assetUrl} alt=\"source\" className=\"h-10 w-10 rounded-md border border-white/10 object-cover\" />\n <button onClick={() => setAssetUrl('')} className=\"text-white/40 hover:text-white\" aria-label=\"Remove image\">\n <X size={15} />\n </button>\n </div>\n )}\n </div>\n </div>\n )}\n\n {tab === 'transcription' && (\n <div className=\"mb-3 grid gap-2 sm:grid-cols-[1fr_160px]\">\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Audio file</span>\n <label className=\"flex h-10 cursor-pointer items-center gap-2 rounded-lg border border-white/10 bg-[#050505] px-3 text-sm text-white/70 hover:text-white\">\n <Upload size={15} /> {audioFile ? audioFile.name : 'Choose audio…'}\n <input\n type=\"file\"\n accept=\"audio/*\"\n className=\"hidden\"\n onChange={(e) => setAudioFile(e.target.files?.[0] || null)}\n />\n </label>\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-mono text-white/40\">Language (optional)</span>\n <input value={language} onChange={(e) => setLanguage(e.target.value)} placeholder=\"en\" className={inputCx} />\n </label>\n </div>\n )}\n\n {/* Result panel */}\n <ResultPanel\n tab={tab}\n result={result}\n busy={busy}\n streaming={streaming}\n messages={messages}\n onRegenerate={regenerateMessage}\n onEdit={editMessage}\n onFork={forkMessage}\n onDelete={deleteMessage}\n scrollRef={scrollRef}\n view={resultView}\n setView={setResultView}\n seedanceDemo={seedanceDemo}\n />\n\n {error && (\n <div\n className=\"mt-3 rounded-lg border border-red-500/20 bg-red-500/5 p-3 text-sm text-red-300\"\n data-testid=\"gateway-playground-error\"\n >\n {error}\n </div>\n )}\n\n {/* Action row */}\n <div className=\"mt-3 flex flex-wrap items-end gap-2\">\n {tab === 'chat' ? (\n <>\n <div className=\"flex min-w-[min(100%,260px)] flex-1 flex-col gap-2\">\n {(chatAttachments.length > 0 || chatUploadError) && (\n <div className=\"flex flex-wrap gap-2\">\n {chatAttachments.map((att) => (\n <div\n key={att.id}\n className=\"inline-flex max-w-full items-center gap-2 rounded-lg border border-white/10 bg-[#050505] px-2.5 py-1.5 text-xs font-mono text-white/60\"\n title={attachmentSummary(att)}\n >\n {att.kind === 'video' ? (\n <Film size={14} className=\"shrink-0\" />\n ) : att.kind === 'image' ? (\n <ImageIcon size={14} className=\"shrink-0\" />\n ) : att.kind === 'document' ? (\n <FileText size={14} className=\"shrink-0\" />\n ) : (\n <FileIcon size={14} className=\"shrink-0\" />\n )}\n {att.url ? (\n <a href={att.url} target=\"_blank\" rel=\"noreferrer\" className=\"truncate hover:text-white\">\n {att.name}\n </a>\n ) : (\n <span className=\"truncate\">{att.name}</span>\n )}\n <span className=\"shrink-0 text-white/30\">{formatBytes(att.size)}</span>\n {att.extractedPreview && <span className=\"hidden text-emerald-300/60 sm:inline\">text ready</span>}\n <button\n type=\"button\"\n onClick={() => removeChatAttachment(att.id)}\n className=\"rounded p-0.5 text-white/30 hover:bg-white/10 hover:text-white\"\n aria-label={`Remove ${att.name}`}\n >\n <X size={13} />\n </button>\n </div>\n ))}\n {chatUploadError && (\n <div className=\"rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-1.5 text-xs text-red-300\">\n {chatUploadError}\n </div>\n )}\n </div>\n )}\n <textarea\n value={chatInput}\n onChange={(e) => setChatInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n sendChat();\n }\n }}\n rows={2}\n placeholder=\"Message or attach a file… (Enter to send, Shift+Enter for newline)\"\n data-testid=\"gateway-playground-input\"\n className=\"resize-none rounded-lg border border-white/10 bg-[#050505] px-3 py-2 text-sm text-white placeholder:text-white/30 focus:border-white/25 focus:outline-none\"\n />\n </div>\n <button\n type=\"button\"\n onClick={() => chatFileInputRef.current?.click()}\n disabled={chatUploading || streaming}\n className=\"inline-flex h-11 items-center gap-1.5 rounded-lg border border-white/15 px-3 text-sm font-semibold text-white/65 hover:bg-white/5 hover:text-white disabled:cursor-not-allowed disabled:opacity-40\"\n title=\"Attach PDF, document, image, video, audio, or file\"\n data-testid=\"gateway-playground-attach\"\n >\n {chatUploading ? <Loader2 size={15} className=\"animate-spin\" /> : <Paperclip size={15} />}\n </button>\n <input\n ref={chatFileInputRef}\n type=\"file\"\n multiple\n className=\"hidden\"\n accept={`${DOCUMENT_ACCEPT},image/*,video/*,audio/*,.js,.jsx,.ts,.tsx,.py,.go,.rs,.sql,.log`}\n onChange={(e) => e.target.files && uploadChatFiles(e.target.files)}\n />\n {streaming ? (\n <button\n onClick={stop}\n className=\"inline-flex h-11 items-center gap-1.5 rounded-lg border border-white/15 px-4 text-sm font-semibold text-white hover:bg-white/5\"\n >\n <Square size={15} /> Stop\n </button>\n ) : (\n <>\n {messages.length > 0 && (\n <button\n type=\"button\"\n onClick={clearChat}\n className=\"inline-flex h-11 items-center gap-1.5 rounded-lg border border-white/15 px-3 text-sm font-semibold text-white/60 hover:bg-white/5 hover:text-white\"\n title=\"Clear chat\"\n data-testid=\"gateway-playground-clear\"\n >\n <Trash2 size={15} />\n </button>\n )}\n <button\n onClick={sendChat}\n data-testid=\"gateway-playground-send\"\n disabled={(!chatInput.trim() && !chatAttachments.length) || chatUploading}\n className=\"inline-flex h-11 items-center gap-1.5 rounded-lg bg-white px-4 text-sm font-bold text-black transition-colors hover:bg-white/86 disabled:cursor-not-allowed disabled:opacity-40\"\n >\n <Send size={15} /> Send\n </button>\n </>\n )}\n </>\n ) : (\n <button\n onClick={run}\n disabled={busy || uploading}\n data-testid=\"gateway-playground-run\"\n className=\"inline-flex h-11 w-full items-center justify-center gap-1.5 rounded-lg bg-sky-400 px-4 text-sm font-bold text-black transition-colors hover:bg-sky-300 disabled:cursor-not-allowed disabled:opacity-40\"\n >\n {busy ? <Loader2 size={16} className=\"animate-spin\" /> : <Send size={15} />}\n {busy ? 'Running…' : `Run ${TABS.find((t) => t.key === tab)?.label}`}\n </button>\n )}\n </div>\n\n {(latencyMs != null || usage || imageCost) && (\n <div className=\"mt-2 flex flex-wrap gap-3 text-xs font-mono text-white/40\" data-testid=\"gateway-playground-stats\">\n {latencyMs != null && <span>{latencyMs} ms</span>}\n {usage && <span>{usage.prompt} in / {usage.completion} out tokens</span>}\n {usage?.cached ? <span className=\"text-cyan-300/70\">cache {fmtTokens(usage.cached)}</span> : null}\n {chatCost != null && <span>~{fmtCost(chatCost)}</span>}\n {imageCost != null && <span>~{fmtCost(imageCost)} / image</span>}\n </div>\n )}\n\n {tab !== 'chat' && tab !== 'embeddings' && tab !== 'transcription' && (\n <GenerationsPanel\n signedIn={signedIn}\n refreshKey={galleryRefresh}\n onRequireSignIn={() => requestSignIn(null)}\n onUsePrompt={(p) => setPrompt(p)}\n />\n )}\n\n {showSignIn && (\n <React.Suspense fallback={null}>\n <SignInModal\n onClose={() => setShowSignIn(false)}\n onAuthed={onAuthed}\n message=\"Sign in to run this request with your account — no API key needed. Your generations are saved to your library.\"\n />\n </React.Suspense>\n )}\n </div>\n );\n};\n\n// GenerationsPanel: the signed-in user's saved generations (media library),\n// searchable by prompt/title, shown under the media surfaces so the playground\n// doubles as a gallery of everything they've made.\nconst GenerationsPanel: React.FC<{\n signedIn: boolean | null;\n refreshKey: number;\n onRequireSignIn: () => void;\n onUsePrompt: (prompt: string) => void;\n}> = ({ signedIn, refreshKey, onRequireSignIn, onUsePrompt }) => {\n type LibItem = {\n id: string;\n kind: string;\n url: string;\n thumbUrl?: string;\n posterUrl?: string;\n prompt?: string;\n title?: string;\n createdAt?: string;\n };\n const [items, setItems] = React.useState<LibItem[] | null>(null);\n const [query, setQuery] = React.useState('');\n const [kind, setKind] = React.useState('');\n const [loading, setLoading] = React.useState(false);\n\n React.useEffect(() => {\n if (!signedIn) return;\n let cancelled = false;\n setLoading(true);\n const t = window.setTimeout(() => {\n const params = new URLSearchParams({ limit: '60' });\n if (query.trim()) params.set('q', query.trim());\n if (kind) params.set('kind', kind);\n fetch(`/api/media/library?${params}`, { credentials: 'include' })\n .then((r) => (r.ok ? r.json() : Promise.reject(new Error(String(r.status)))))\n .then((d) => {\n if (!cancelled) setItems(Array.isArray(d?.items) ? d.items : []);\n })\n .catch(() => {\n if (!cancelled) setItems([]);\n })\n .finally(() => {\n if (!cancelled) setLoading(false);\n });\n }, 250);\n return () => {\n cancelled = true;\n window.clearTimeout(t);\n };\n }, [signedIn, refreshKey, query, kind]);\n\n const remove = async (id: string) => {\n setItems((prev) => (prev || []).filter((i) => i.id !== id));\n await fetch(`/api/media/items?id=${encodeURIComponent(id)}`, { method: 'DELETE', credentials: 'include' }).catch(\n () => null,\n );\n };\n\n return (\n <div className=\"mt-4 border-t border-white/10 pt-3\" data-testid=\"gateway-playground-generations\">\n <div className=\"mb-2 flex flex-wrap items-center gap-2\">\n <span className=\"text-xs font-mono uppercase tracking-[0.14em] text-white/40\">Your generations</span>\n {signedIn ? (\n <>\n <div className=\"relative ml-auto w-full min-w-0 sm:w-60\">\n <Search size={13} className=\"absolute left-2.5 top-1/2 -translate-y-1/2 text-white/30\" />\n <input\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search prompts…\"\n data-testid=\"gateway-generations-search\"\n className=\"h-8 w-full rounded-lg border border-white/10 bg-[#050505] pl-8 pr-2.5 text-xs text-white placeholder:text-white/30 focus:border-white/25 focus:outline-none\"\n />\n </div>\n <div className=\"flex gap-1\">\n {[\n ['', 'All'],\n ['image', 'Image'],\n ['video', 'Video'],\n ['audio', 'Audio'],\n ].map(([k, label]) => (\n <button\n key={k}\n type=\"button\"\n onClick={() => setKind(k)}\n className={`rounded px-2 py-1 text-[11px] font-mono transition-colors ${\n kind === k ? 'bg-sky-400/15 text-sky-200' : 'text-white/40 hover:text-white'\n }`}\n >\n {label}\n </button>\n ))}\n </div>\n <a href=\"/art\" className=\"text-[11px] font-mono text-white/35 hover:text-white\">\n Full library →\n </a>\n </>\n ) : (\n <button\n type=\"button\"\n onClick={onRequireSignIn}\n data-testid=\"gateway-generations-signin\"\n className=\"ml-auto inline-flex items-center gap-1.5 rounded-lg border border-white/12 px-2.5 py-1.5 text-xs font-semibold text-white/70 transition-colors hover:border-white/30 hover:text-white\"\n >\n <LogIn size={13} /> Sign in to see your generations\n </button>\n )}\n </div>\n\n {signedIn && (\n <>\n {loading && !items && <div className=\"py-4 text-center text-xs text-white/35\">Loading…</div>}\n {items && items.length === 0 && (\n <div className=\"py-4 text-center text-xs text-white/35\">\n {query ? `Nothing matches “${query}”.` : 'Run a generation and it lands here automatically.'}\n </div>\n )}\n {items && items.length > 0 && (\n <div className=\"grid grid-cols-3 gap-1.5 sm:grid-cols-5 lg:grid-cols-8\">\n {items.map((it) => (\n <div key={it.id} className=\"group relative overflow-hidden rounded-lg border border-white/10 bg-[#050505]\">\n <a href={it.url} target=\"_blank\" rel=\"noreferrer\" title={it.prompt || it.title || it.kind}>\n {it.kind === 'video' ? (\n <video\n src={it.url}\n poster={it.posterUrl || it.thumbUrl || undefined}\n muted\n loop\n playsInline\n preload=\"metadata\"\n className=\"aspect-square w-full object-cover\"\n onMouseEnter={(e) => void (e.currentTarget as HTMLVideoElement).play().catch(() => null)}\n onMouseLeave={(e) => (e.currentTarget as HTMLVideoElement).pause()}\n />\n ) : it.kind === 'audio' ? (\n <div className=\"flex aspect-square w-full flex-col items-center justify-center gap-1 p-2 text-white/45\">\n <Music size={18} />\n <span className=\"line-clamp-2 text-center text-[10px] leading-3\">{it.title || it.prompt || 'audio'}</span>\n </div>\n ) : (\n <img\n src={it.thumbUrl || it.url}\n alt={it.prompt || it.title || 'generation'}\n loading=\"lazy\"\n className=\"aspect-square w-full object-cover\"\n />\n )}\n </a>\n <div className=\"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 to-transparent p-1.5 opacity-0 transition-opacity group-hover:opacity-100\">\n <div className=\"line-clamp-2 text-[10px] leading-3 text-white/80\">{it.prompt || it.title || ''}</div>\n </div>\n <div className=\"absolute right-1 top-1 flex gap-1 opacity-0 transition-opacity group-hover:opacity-100\">\n {it.prompt && (\n <button\n type=\"button\"\n onClick={() => onUsePrompt(it.prompt || '')}\n title=\"Use this prompt\"\n className=\"rounded bg-black/70 p-1 text-white/70 hover:text-white\"\n >\n <RotateCcw size={12} />\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => void remove(it.id)}\n title=\"Remove from library\"\n className=\"rounded bg-black/70 p-1 text-white/70 hover:text-red-300\"\n >\n <Trash2 size={12} />\n </button>\n </div>\n </div>\n ))}\n </div>\n )}\n </>\n )}\n </div>\n );\n};\n\n// ResultPanel renders the live preview (per modality) and a raw-JSON toggle.\nconst ResultPanel: React.FC<{\n tab: Modality;\n result: RunResult | null;\n busy: boolean;\n streaming: boolean;\n messages: ChatMessage[];\n onRegenerate: (index: number) => void;\n onEdit: (index: number, content: string) => void;\n onFork: (index: number) => void;\n onDelete: (index: number) => void;\n scrollRef: React.RefObject<HTMLDivElement | null>;\n view: 'preview' | 'json';\n setView: (v: 'preview' | 'json') => void;\n seedanceDemo?: SeedanceDemo;\n}> = ({ tab, result, busy, streaming, messages, onRegenerate, onEdit, onFork, onDelete, scrollRef, view, setView, seedanceDemo }) => {\n if (tab === 'chat') {\n return (\n <div\n ref={scrollRef}\n data-testid=\"gateway-playground-transcript\"\n className=\"max-h-[420px] min-h-[180px] overflow-y-auto rounded-xl border border-white/10 bg-[#050505] p-3\"\n >\n {messages.length === 0 ? (\n <div className=\"py-10 text-center text-sm text-white/35\">Send a message to try the gateway.</div>\n ) : (\n <div className=\"space-y-3\">\n {messages.map((m, i) => (\n <ChatBubble\n key={`${m.role}-${i}-${m.createdAt || 0}`}\n message={m}\n index={i}\n streaming={streaming}\n isLast={i === messages.length - 1}\n onRegenerate={onRegenerate}\n onEdit={onEdit}\n onFork={onFork}\n onDelete={onDelete}\n />\n ))}\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div className=\"rounded-xl border border-white/10 bg-[#050505]\" data-testid=\"gateway-playground-result\">\n <div className=\"flex items-center justify-between border-b border-white/10 px-3 py-2\">\n <span className=\"text-xs font-mono text-white/40\">Result</span>\n {result && (\n <div className=\"flex gap-1\">\n {(['preview', 'json'] as const).map((v) => (\n <button\n key={v}\n onClick={() => setView(v)}\n className={`rounded px-2 py-1 text-xs font-mono transition-colors ${\n view === v ? 'bg-sky-400/15 text-sky-200' : 'text-white/40 hover:text-white'\n }`}\n >\n {v === 'preview' ? 'Preview' : 'JSON'}\n </button>\n ))}\n </div>\n )}\n </div>\n <div className=\"min-h-[140px] p-3\">\n {busy ? (\n <div className=\"flex items-center justify-center gap-2 py-10 text-sm text-white/40\">\n <Loader2 size={16} className=\"animate-spin\" /> Running…\n </div>\n ) : !result ? (\n seedanceDemo ? (\n <figure className=\"space-y-2\" data-testid=\"seedance-demo\">\n <video\n controls\n loop\n muted\n playsInline\n poster={seedanceDemo.imageUrl}\n src={seedanceDemo.outputUrl}\n className=\"w-full rounded-lg border border-white/10\"\n />\n <figcaption className=\"text-xs text-white/35\">\n Example {seedanceDemo.resolution} · {seedanceDemo.duration}s output — run to generate your own.\n </figcaption>\n </figure>\n ) : (\n <div className=\"py-10 text-center text-sm text-white/35\">Run a request to see the result here.</div>\n )\n ) : view === 'json' && result.raw ? (\n <CodeBlock code={result.raw} language=\"json\" testId=\"gateway-playground-json\" />\n ) : (\n <ResultPreview result={result} />\n )}\n </div>\n </div>\n );\n};\n\nconst ChatBubble: React.FC<{\n message: ChatMessage;\n index: number;\n streaming: boolean;\n isLast: boolean;\n onRegenerate: (index: number) => void;\n onEdit: (index: number, content: string) => void;\n onFork: (index: number) => void;\n onDelete: (index: number) => void;\n}> = ({ message, index, streaming, isLast, onRegenerate, onEdit, onFork, onDelete }) => {\n const [copied, setCopied] = React.useState(false);\n const [editing, setEditing] = React.useState(false);\n const [draft, setDraft] = React.useState(message.content);\n const isUser = message.role === 'user';\n const isStreamingThis = streaming && isLast && !isUser;\n\n React.useEffect(() => {\n if (!editing) setDraft(message.content);\n }, [editing, message.content]);\n\n const copy = () => {\n navigator.clipboard.writeText(message.content);\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1200);\n };\n\n const save = () => {\n const next = draft.trim();\n if (next && next !== message.content) onEdit(index, next);\n setEditing(false);\n };\n\n return (\n <div className={isUser ? 'text-right' : 'text-left'}>\n <div className={`group inline-flex max-w-[92%] flex-col gap-1.5 ${isUser ? 'items-end' : 'items-start'}`}>\n <div className=\"flex items-center gap-2 text-[10px] font-mono text-white/25\">\n {message.branchOf != null && <span className=\"rounded border border-white/10 px-1.5 py-0.5\">forked</span>}\n {messageTime(message.createdAt)}\n </div>\n {editing ? (\n <div className=\"w-[min(620px,82vw)] rounded-lg border border-white/10 bg-black/80 p-2\">\n <textarea\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n rows={Math.min(8, Math.max(3, draft.split('\\n').length))}\n autoFocus\n className=\"w-full resize-y rounded-md border border-white/10 bg-[#050505] px-3 py-2 text-sm text-white outline-none focus:border-white/25\"\n data-testid=\"gateway-playground-edit-input\"\n />\n <div className=\"mt-2 flex justify-end gap-2\">\n <button\n onClick={() => {\n setDraft(message.content);\n setEditing(false);\n }}\n className=\"rounded border border-white/10 px-2 py-1 text-xs font-mono text-white/45 hover:text-white\"\n >\n Cancel\n </button>\n <button onClick={save} disabled={!draft.trim()} className=\"rounded bg-white px-2 py-1 text-xs font-mono font-bold text-black disabled:opacity-40\">\n Save\n </button>\n </div>\n </div>\n ) : (\n <>\n <div\n className={`whitespace-pre-wrap rounded-lg px-3 py-2 text-sm shadow-sm ${\n isUser ? 'bg-white text-black' : 'border border-white/10 bg-white/[0.04] text-white/85'\n }`}\n >\n {message.content || (isStreamingThis ? <Loader2 size={14} className=\"animate-spin\" /> : '')}\n </div>\n {!isStreamingThis && (\n <div className={`flex items-center gap-0.5 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100 ${isUser ? 'justify-end' : ''}`}>\n {message.content && (\n <button onClick={copy} className=\"rounded-md p-1.5 text-white/30 hover:bg-white/10 hover:text-white\" title=\"Copy message\" data-testid=\"gateway-msg-copy\">\n {copied ? <Check size={14} className=\"text-emerald-300\" /> : <Copy size={14} />}\n </button>\n )}\n {message.content && (\n <button onClick={() => setEditing(true)} disabled={streaming} className=\"rounded-md p-1.5 text-white/30 hover:bg-white/10 hover:text-white disabled:opacity-40\" title=\"Edit message\" data-testid=\"gateway-msg-edit\">\n <Pencil size={14} />\n </button>\n )}\n <button onClick={() => onRegenerate(index)} disabled={streaming} className=\"rounded-md p-1.5 text-white/30 hover:bg-white/10 hover:text-white disabled:opacity-40\" title={isUser ? 'Resend from here' : 'Regenerate response'} data-testid=\"gateway-msg-regenerate\">\n <RotateCcw size={14} />\n </button>\n <button onClick={() => onFork(index)} disabled={streaming} className=\"rounded-md p-1.5 text-white/30 hover:bg-white/10 hover:text-white disabled:opacity-40\" title=\"Fork from here\" data-testid=\"gateway-msg-fork\">\n <GitFork size={14} />\n </button>\n <button onClick={() => onDelete(index)} disabled={streaming} className=\"rounded-md p-1.5 text-white/30 hover:bg-red-500/10 hover:text-red-300 disabled:opacity-40\" title=\"Delete message\" data-testid=\"gateway-msg-delete\">\n <Trash2 size={14} />\n </button>\n </div>\n )}\n </>\n )}\n {message.attachments && message.attachments.length > 0 && (\n <div className=\"flex flex-col gap-1\">\n {message.attachments.map((att) =>\n att.url ? (\n <a\n key={att.id}\n href={att.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex max-w-full items-center gap-2 rounded-md border border-white/10 bg-white/[0.04] px-2 py-1 text-[11px] font-mono text-white/55 hover:border-white/25 hover:text-white\"\n title={attachmentSummary(att)}\n >\n {att.kind === 'video' ? <Film size={13} /> : att.kind === 'image' ? <ImageIcon size={13} /> : att.kind === 'document' ? <FileText size={13} /> : <FileIcon size={13} />}\n <span className=\"truncate\">{att.name}</span>\n <span className=\"shrink-0 text-white/25\">{formatBytes(att.size)}</span>\n </a>\n ) : (\n <div\n key={att.id}\n className=\"inline-flex max-w-full items-center gap-2 rounded-md border border-white/10 bg-white/[0.04] px-2 py-1 text-[11px] font-mono text-white/55\"\n title={attachmentSummary(att)}\n >\n {att.kind === 'video' ? <Film size={13} /> : att.kind === 'image' ? <ImageIcon size={13} /> : att.kind === 'document' ? <FileText size={13} /> : <FileIcon size={13} />}\n <span className=\"truncate\">{att.name}</span>\n <span className=\"shrink-0 text-white/25\">{formatBytes(att.size)}</span>\n </div>\n )\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nconst ResultPreview: React.FC<{ result: RunResult }> = ({ result }) => {\n const r = result;\n if (r.kind === 'image') {\n if (!r.images?.length) return <Empty>No image data returned.</Empty>;\n return (\n <div className=\"grid grid-cols-2 gap-2 sm:grid-cols-3\">\n {r.images.map((src, i) => (\n <img key={i} src={src} alt={`result ${i + 1}`} className=\"w-full rounded-lg border border-white/10\" />\n ))}\n </div>\n );\n }\n\n if (r.kind === 'embeddings') {\n const emb = r.embedding || [];\n if (!emb.length) return <Empty>No embedding returned.</Empty>;\n const max = Math.max(...emb.slice(0, 64).map((v) => Math.abs(v)), 1e-6);\n return (\n <div>\n <div className=\"mb-2 text-sm text-white/70\">\n <span className=\"font-mono text-white\">{emb.length}</span> dimensions\n </div>\n <div className=\"flex h-16 items-center gap-px\">\n {emb.slice(0, 96).map((v, i) => (\n <div\n key={i}\n title={String(v)}\n className={v >= 0 ? 'flex-1 bg-emerald-400/70' : 'flex-1 bg-rose-400/70'}\n style={{ height: `${Math.max(4, (Math.abs(v) / max) * 100)}%` }}\n />\n ))}\n </div>\n <div className=\"mt-2 font-mono text-xs text-white/40\">\n [{emb.slice(0, 6).map((v) => v.toFixed(4)).join(', ')}, …]\n </div>\n </div>\n );\n }\n\n if (r.kind === 'transcription') {\n if (!r.text) return <Empty>No transcript returned.</Empty>;\n return <p className=\"whitespace-pre-wrap text-sm leading-7 text-white/85\">{r.text}</p>;\n }\n\n if (r.kind === 'speech') {\n return (\n <div>\n {r.blobUrl ? <audio controls src={r.blobUrl} className=\"w-full\" /> : <Empty>No audio returned.</Empty>}\n {r.blobNote && <div className=\"mt-2 font-mono text-xs text-white/40\">{r.blobNote}</div>}\n </div>\n );\n }\n\n // video | music | 3d — rendered from a discovered asset URL.\n if (r.mediaUrl) {\n const k = r.mediaKind;\n if (k === 'video') return <video controls src={r.mediaUrl} className=\"w-full rounded-lg border border-white/10\" />;\n if (k === 'audio') return <audio controls src={r.mediaUrl} className=\"w-full\" />;\n if (k === 'image')\n return <img src={r.mediaUrl} alt=\"result\" className=\"w-full rounded-lg border border-white/10\" />;\n return (\n <a\n href={r.mediaUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-2 rounded-lg border border-white/15 bg-white/[0.04] px-4 py-2 text-sm font-semibold text-white hover:bg-white hover:text-black\"\n >\n <Box size={16} /> Open {r.kind === '3d' ? '3D asset' : 'result'}\n </a>\n );\n }\n\n return <Empty>Job submitted — no renderable asset URL in the response yet. See the JSON tab.</Empty>;\n};\n\nconst Empty: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div className=\"py-8 text-center text-sm text-white/40\">{children}</div>\n);\n\nfunction pretty(v: unknown): string {\n try {\n return JSON.stringify(v, null, 2);\n } catch {\n return String(v);\n }\n}\n\nasync function errorDetail(resp: Response): Promise<string> {\n const text = await resp.text().catch(() => '');\n let detail = text.slice(0, 300);\n try {\n const j = JSON.parse(text);\n detail = j?.error?.message || j?.error?.detail || j?.error || j?.detail || detail;\n } catch {\n /* not json */\n }\n return `${resp.status}: ${detail || 'request failed'}`;\n}\n","import React from 'react';\nimport {\n ArrowLeft,\n ArrowRight,\n BookOpen,\n Boxes,\n Check,\n Copy,\n Eye,\n KeyRound,\n Network,\n Play,\n Search,\n Wrench,\n Zap,\n} from 'lucide-react';\nimport { CodeBlock } from './CodeBlock';\nimport { GatewayPlayground } from './GatewayPlayground';\nimport { slugForEndpoint } from './docsData';\n\n// GatewayPage is the app.nz model-gateway hub: openpaths-parity documentation, a\n// searchable model + provider catalogue, copy-paste code samples for every SDK,\n// and a live in-browser playground. It mirrors ../openpaths (Docs + Models +\n// Playground) folded into one page so /gateway is a real product surface, not a\n// marketing stub.\n//\n// Prerender-safe: every browser-only value (origin, stored key, live catalogue)\n// is initialised to a deterministic default and hydrated in an effect, so the\n// server prerender and the first client render produce identical markup. The\n// playground renders its empty initial state on the server prerender and\n// hydrates cleanly (deterministic defaults; browser-only values set in effects).\n\nconst DEFAULT_ORIGIN = 'https://app.nz';\n\ninterface ProviderDetail {\n name: string;\n displayName: string;\n logo: string;\n website: string;\n enabled: boolean;\n modelCount: number;\n}\n\ninterface CatalogModel {\n id: string;\n provider: string;\n aliases?: string[];\n fallback_models?: string[];\n input_price_per_1m?: number;\n output_price_per_1m?: number;\n context_window?: number;\n max_output_tokens?: number;\n supports_streaming?: boolean;\n supports_tools?: boolean;\n supports_vision?: boolean;\n modality?: string;\n supported_sizes?: string[];\n price_per_image?: number;\n price_per_video?: number;\n price_per_request?: number;\n price_per_minute?: number;\n}\n\ninterface ModelsResponse {\n models: CatalogModel[];\n providers: string[];\n providerDetails: ProviderDetail[];\n total: number;\n}\n\ntype Task = 'chat' | 'images' | 'embeddings' | 'video' | 'music' | '3d' | 'speech' | 'transcription';\ntype Lang = 'python' | 'javascript' | 'go' | 'curl';\n\nconst TASK_LABELS: Record<Task, string> = {\n chat: 'Chat',\n images: 'Images',\n embeddings: 'Embeddings',\n video: 'Video',\n music: 'Music',\n '3d': '3D',\n speech: 'Speech',\n transcription: 'Transcription',\n};\n\nconst LANG_LABELS: Record<Lang, { label: string; hljs: string }> = {\n python: { label: 'Python', hljs: 'python' },\n javascript: { label: 'JavaScript', hljs: 'javascript' },\n go: { label: 'Go', hljs: 'go' },\n curl: { label: 'cURL', hljs: 'bash' },\n};\n\nconst ENDPOINTS = [\n { method: 'POST', path: '/v1/chat/completions', description: 'OpenAI-compatible chat completions (streaming + tools).' },\n { method: 'POST', path: '/v1/messages', description: 'Anthropic-compatible Messages API for Claude + agent SDKs.' },\n { method: 'POST', path: '/v1/images/generations', description: 'Generate images (GPT Image, Flux, and more).' },\n { method: 'POST', path: '/v1/embeddings', description: 'Vector embeddings for search and RAG.' },\n { method: 'POST', path: '/v1/audio/speech', description: 'Text-to-speech (also /v1/tts).' },\n { method: 'POST', path: '/v1/audio/transcriptions', description: 'Speech-to-text transcription.' },\n { method: 'POST', path: '/v1/videos/generations', description: 'Generate video clips (job-based).' },\n { method: 'POST', path: '/v1/music/generations', description: 'Generate music (job-based).' },\n { method: 'POST', path: '/v1/audio/generations', description: 'Generate SFX and short audio (job-based).' },\n { method: 'POST', path: '/v1/3d/generations', description: 'Generate textured 3D models (job-based).' },\n { method: 'POST', path: '/v1/panoramas/generations', description: 'Expand one image into a 360 panorama or spatial world (job-based).' },\n { method: 'GET', path: '/api/gateway/models', description: 'List every routable model + provider metadata.' },\n { method: 'GET', path: '/api/gateway/resolve?model=', description: 'Preview how a model name routes (provider, fallbacks).' },\n { method: 'POST', path: '/api/gateway/route', description: 'Preview which model a bare \"auto\" request resolves to.' },\n];\n\nconst AUTO_MODELS = [\n { id: 'auto', body: 'Default chat. Classifies the prompt and routes to the best tier.' },\n { id: 'app/auto-code', body: 'Agents, refactors, and bug fixes.' },\n { id: 'app/auto-reasoning', body: 'Planning, math, and hard reasoning (auto thinking depth).' },\n { id: 'app/auto-cheap', body: 'Trivial / classification prompts on the cheapest capable model.' },\n { id: 'app/auto-vision', body: 'Prompts that include images.' },\n { id: 'app/auto-image', body: 'Image generation with a hosted fallback.' },\n];\n\nfunction buildSamples(origin: string, key: string): Record<Task, { description: string } & Record<Lang, string>> {\n const v1 = `${origin}/v1`;\n return {\n chat: {\n description: 'Send messages, stream tokens back. OpenAI SDK drop-in — just change base_url + key.',\n python: `from openai import OpenAI\n\nclient = OpenAI(base_url=\"${v1}\", api_key=\"${key}\")\n\nresp = client.chat.completions.create(\n model=\"auto\", # smart routing, or pin a model like \"gpt-latest\"\n messages=[{\"role\": \"user\", \"content\": \"Write a tiny SSE server in Go.\"}],\n reasoning_effort=\"auto\", # none | low | medium | high | xhigh | auto\n)\nprint(resp.choices[0].message.content)`,\n javascript: `import OpenAI from \"openai\";\n\nconst client = new OpenAI({ baseURL: \"${v1}\", apiKey: \"${key}\" });\n\nconst resp = await client.chat.completions.create({\n model: \"auto\",\n messages: [{ role: \"user\", content: \"Write a tiny SSE server in Go.\" }],\n reasoning_effort: \"auto\",\n});\nconsole.log(resp.choices[0].message.content);`,\n go: `package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody := []byte(\\`{\"model\":\"auto\",\"messages\":[{\"role\":\"user\",\"content\":\"Write a tiny SSE server in Go.\"}]}\\`)\n\treq, _ := http.NewRequest(\"POST\", \"${v1}/chat/completions\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer ${key}\")\n\tresp, _ := http.DefaultClient.Do(req)\n\tdefer resp.Body.Close()\n\tout, _ := io.ReadAll(resp.Body)\n\tfmt.Println(string(out))\n}`,\n curl: `curl ${v1}/chat/completions \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer ${key}\" \\\\\n -d '{\n \"model\": \"auto\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Write a tiny SSE server in Go.\"}]\n }'`,\n },\n images: {\n description: 'Generate images. The model field picks the image provider; \"auto\" routes for you.',\n python: `from openai import OpenAI\nimport base64, pathlib\n\nclient = OpenAI(base_url=\"${v1}\", api_key=\"${key}\")\n\nresult = client.images.generate(\n model=\"auto\",\n prompt=\"A beige coffee mug on a wooden table, natural light\",\n size=\"1024x1024\",\n n=1,\n)\npathlib.Path(\"mug.png\").write_bytes(base64.b64decode(result.data[0].b64_json))`,\n javascript: `import OpenAI from \"openai\";\nimport { writeFile } from \"node:fs/promises\";\n\nconst client = new OpenAI({ baseURL: \"${v1}\", apiKey: \"${key}\" });\n\nconst result = await client.images.generate({\n model: \"auto\",\n prompt: \"A beige coffee mug on a wooden table, natural light\",\n size: \"1024x1024\",\n n: 1,\n});\nawait writeFile(\"mug.png\", Buffer.from(result.data[0].b64_json, \"base64\"));`,\n go: `package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody := []byte(\\`{\"model\":\"auto\",\"prompt\":\"A beige coffee mug on a wooden table\",\"size\":\"1024x1024\",\"n\":1}\\`)\n\treq, _ := http.NewRequest(\"POST\", \"${v1}/images/generations\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer ${key}\")\n\tresp, _ := http.DefaultClient.Do(req)\n\tdefer resp.Body.Close()\n\tout, _ := io.ReadAll(resp.Body)\n\tfmt.Println(string(out))\n}`,\n curl: `curl ${v1}/images/generations \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer ${key}\" \\\\\n -d '{\"model\": \"auto\", \"prompt\": \"A beige coffee mug on a wooden table\", \"size\": \"1024x1024\", \"n\": 1}'`,\n },\n embeddings: {\n description: 'Turn text into vectors for search, clustering, and RAG.',\n python: `from openai import OpenAI\n\nclient = OpenAI(base_url=\"${v1}\", api_key=\"${key}\")\n\nresp = client.embeddings.create(\n model=\"text-embedding-3-small\",\n input=[\"app.nz routes every model through one API\"],\n)\nprint(len(resp.data[0].embedding))`,\n javascript: `import OpenAI from \"openai\";\n\nconst client = new OpenAI({ baseURL: \"${v1}\", apiKey: \"${key}\" });\n\nconst resp = await client.embeddings.create({\n model: \"text-embedding-3-small\",\n input: [\"app.nz routes every model through one API\"],\n});\nconsole.log(resp.data[0].embedding.length);`,\n go: `package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody := []byte(\\`{\"model\":\"text-embedding-3-small\",\"input\":[\"app.nz routes every model through one API\"]}\\`)\n\treq, _ := http.NewRequest(\"POST\", \"${v1}/embeddings\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer ${key}\")\n\tresp, _ := http.DefaultClient.Do(req)\n\tdefer resp.Body.Close()\n\tout, _ := io.ReadAll(resp.Body)\n\tfmt.Println(string(out))\n}`,\n curl: `curl ${v1}/embeddings \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer ${key}\" \\\\\n -d '{\"model\": \"text-embedding-3-small\", \"input\": [\"one API for every model\"]}'`,\n },\n video: {\n description: 'Generate video clips. Job-based: the call returns a job you poll for the result.',\n python: `from openai import OpenAI\n\nclient = OpenAI(base_url=\"${v1}\", api_key=\"${key}\")\n\njob = client.post(\"/videos/generations\", body={\n \"model\": \"auto\",\n \"prompt\": \"A cinematic fly-through of a neon-lit cyberpunk street at night.\",\n \"resolution\": \"1280x720\",\n}, cast_to=dict)\n\nwhile job[\"status\"] not in (\"completed\", \"failed\"):\n job = client.get(f\"/videos/generations/{job['id']}\", cast_to=dict)\nprint(job[\"result\"][\"video_url\"])`,\n javascript: `const res = await fetch(\"${v1}/videos/generations\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Authorization: \"Bearer ${key}\" },\n body: JSON.stringify({\n model: \"auto\",\n prompt: \"A cinematic fly-through of a neon-lit cyberpunk street at night.\",\n resolution: \"1280x720\",\n }),\n});\nlet job = await res.json();\nwhile (job.status && job.status !== \"completed\" && job.status !== \"failed\") {\n await new Promise((r) => setTimeout(r, 2000));\n job = await (await fetch(\"${v1}/videos/generations/\" + job.id, {\n headers: { Authorization: \"Bearer ${key}\" },\n })).json();\n}\nconsole.log((job.result ?? job).video_url);`,\n go: `package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody := []byte(\\`{\"model\":\"auto\",\"prompt\":\"A neon-lit cyberpunk street at night.\",\"resolution\":\"1280x720\"}\\`)\n\treq, _ := http.NewRequest(\"POST\", \"${v1}/videos/generations\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer ${key}\")\n\tresp, _ := http.DefaultClient.Do(req)\n\tdefer resp.Body.Close()\n\tout, _ := io.ReadAll(resp.Body)\n\tfmt.Println(string(out)) // poll result.id for the finished video_url\n}`,\n curl: `curl ${v1}/videos/generations \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer ${key}\" \\\\\n -d '{\"model\": \"auto\", \"prompt\": \"A neon-lit cyberpunk street at night.\", \"resolution\": \"1280x720\"}'`,\n },\n music: {\n description: 'Generate music or SFX. Music uses /music/generations; SFX uses /audio/generations.',\n python: `from openai import OpenAI\n\nclient = OpenAI(base_url=\"${v1}\", api_key=\"${key}\")\n\njob = client.post(\"/music/generations\", body={\n \"model\": \"music-2.5\",\n \"prompt\": \"Warm synthwave theme with analog drums and a hopeful chorus\",\n \"duration\": 30,\n}, cast_to=dict)\n\nprint(job.get(\"audio\", {}).get(\"url\") or job.get(\"audio_url\") or job)`,\n javascript: `const res = await fetch(\"${v1}/music/generations\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Authorization: \"Bearer ${key}\" },\n body: JSON.stringify({\n model: \"music-2.5\",\n prompt: \"Warm synthwave theme with analog drums and a hopeful chorus\",\n duration: 30,\n }),\n});\nconst data = await res.json();\nconsole.log(data.audio?.url || data.audio_url || data);`,\n go: `package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody := []byte(\\`{\"model\":\"music-2.5\",\"prompt\":\"Warm synthwave theme with analog drums\",\"duration\":30}\\`)\n\treq, _ := http.NewRequest(\"POST\", \"${v1}/music/generations\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer ${key}\")\n\tresp, _ := http.DefaultClient.Do(req)\n\tdefer resp.Body.Close()\n\tout, _ := io.ReadAll(resp.Body)\n\tfmt.Println(string(out))\n}`,\n curl: `curl ${v1}/music/generations \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer ${key}\" \\\\\n -d '{\"model\": \"music-2.5\", \"prompt\": \"Warm synthwave theme with analog drums\", \"duration\": 30}'`,\n },\n '3d': {\n description: 'Convert a reference image URL into a textured GLB model.',\n python: `from openai import OpenAI\n\nclient = OpenAI(base_url=\"${v1}\", api_key=\"${key}\")\n\nresult = client.post(\"/3d/generations\", body={\n \"model\": \"pixal3d-image-to-3d\",\n \"image_url\": \"https://example.com/reference.png\",\n \"texture_size\": 1024,\n \"remesh\": True,\n}, cast_to=dict)\n\nprint(result[\"model_glb\"][\"url\"])`,\n javascript: `const res = await fetch(\"${v1}/3d/generations\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Authorization: \"Bearer ${key}\" },\n body: JSON.stringify({\n model: \"pixal3d-image-to-3d\",\n image_url: \"https://example.com/reference.png\",\n texture_size: 1024,\n remesh: true,\n }),\n});\nconst data = await res.json();\nconsole.log(data.model_glb.url);`,\n go: `package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody := []byte(\\`{\"model\":\"pixal3d-image-to-3d\",\"image_url\":\"https://example.com/reference.png\",\"texture_size\":1024,\"remesh\":true}\\`)\n\treq, _ := http.NewRequest(\"POST\", \"${v1}/3d/generations\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer ${key}\")\n\tresp, _ := http.DefaultClient.Do(req)\n\tdefer resp.Body.Close()\n\tout, _ := io.ReadAll(resp.Body)\n\tfmt.Println(string(out))\n}`,\n curl: `curl ${v1}/3d/generations \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer ${key}\" \\\\\n -d '{\"model\": \"pixal3d-image-to-3d\", \"image_url\": \"https://example.com/reference.png\", \"texture_size\": 1024, \"remesh\": true}'`,\n },\n speech: {\n description: 'Text-to-speech. Returns audio bytes you can stream or save.',\n python: `from openai import OpenAI\n\nclient = OpenAI(base_url=\"${v1}\", api_key=\"${key}\")\n\nwith client.audio.speech.with_streaming_response.create(\n model=\"xai-tts\",\n voice=\"eve\",\n input=\"Welcome to app.nz. One API key routes every model.\",\n) as resp:\n resp.stream_to_file(\"welcome.mp3\")`,\n javascript: `const res = await fetch(\"${v1}/audio/speech\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Authorization: \"Bearer ${key}\" },\n body: JSON.stringify({ model: \"xai-tts\", voice: \"eve\", input: \"Welcome to app.nz.\" }),\n});\nconst buf = Buffer.from(await res.arrayBuffer());\nawait (await import(\"node:fs/promises\")).writeFile(\"welcome.mp3\", buf);`,\n go: `package main\n\nimport (\n\t\"bytes\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n)\n\nfunc main() {\n\tbody := []byte(\\`{\"model\":\"xai-tts\",\"voice\":\"eve\",\"input\":\"Welcome to app.nz.\"}\\`)\n\treq, _ := http.NewRequest(\"POST\", \"${v1}/audio/speech\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer ${key}\")\n\tresp, _ := http.DefaultClient.Do(req)\n\tdefer resp.Body.Close()\n\tout, _ := os.Create(\"welcome.mp3\")\n\tdefer out.Close()\n\tio.Copy(out, resp.Body)\n}`,\n curl: `curl ${v1}/audio/speech \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer ${key}\" \\\\\n -d '{\"model\": \"xai-tts\", \"voice\": \"eve\", \"input\": \"Welcome to app.nz.\"}' \\\\\n --output welcome.mp3`,\n },\n transcription: {\n description: 'Upload an audio file, get a JSON transcript back.',\n python: `from openai import OpenAI\n\nclient = OpenAI(base_url=\"${v1}\", api_key=\"${key}\")\n\nwith open(\"meeting.mp3\", \"rb\") as f:\n transcript = client.audio.transcriptions.create(model=\"gpt-4o-transcribe\", file=f)\nprint(transcript.text)`,\n javascript: `import OpenAI from \"openai\";\nimport fs from \"node:fs\";\n\nconst client = new OpenAI({ baseURL: \"${v1}\", apiKey: \"${key}\" });\n\nconst transcript = await client.audio.transcriptions.create({\n model: \"gpt-4o-transcribe\",\n file: fs.createReadStream(\"meeting.mp3\"),\n});\nconsole.log(transcript.text);`,\n go: `package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"mime/multipart\"\n\t\"net/http\"\n\t\"os\"\n)\n\nfunc main() {\n\tvar body bytes.Buffer\n\tw := multipart.NewWriter(&body)\n\tw.WriteField(\"model\", \"gpt-4o-transcribe\")\n\tf, _ := os.Open(\"meeting.mp3\")\n\tdefer f.Close()\n\tpart, _ := w.CreateFormFile(\"file\", \"meeting.mp3\")\n\tio.Copy(part, f)\n\tw.Close()\n\treq, _ := http.NewRequest(\"POST\", \"${v1}/audio/transcriptions\", &body)\n\treq.Header.Set(\"Content-Type\", w.FormDataContentType())\n\treq.Header.Set(\"Authorization\", \"Bearer ${key}\")\n\tresp, _ := http.DefaultClient.Do(req)\n\tdefer resp.Body.Close()\n\tout, _ := io.ReadAll(resp.Body)\n\tfmt.Println(string(out))\n}`,\n curl: `curl ${v1}/audio/transcriptions \\\\\n -H \"Authorization: Bearer ${key}\" \\\\\n -F model=gpt-4o-transcribe \\\\\n -F file=@meeting.mp3`,\n },\n };\n}\n\nfunction fmtPrice(p?: number): string {\n if (!p || p <= 0) return '—';\n if (p < 1) return `$${p.toFixed(2)}`;\n return `$${p.toFixed(2)}`;\n}\n\nfunction fmtContext(n?: number): string {\n if (!n || n <= 0) return '—';\n if (n >= 1000) return `${Math.round(n / 1000)}K`;\n return String(n);\n}\n\nexport const GatewayPage: React.FC = () => {\n const [origin, setOrigin] = React.useState(DEFAULT_ORIGIN);\n const [exampleKey, setExampleKey] = React.useState('pk_live_...');\n const [task, setTask] = React.useState<Task>('chat');\n const [lang, setLang] = React.useState<Lang>('python');\n const [copied, setCopied] = React.useState(false);\n\n const [data, setData] = React.useState<ModelsResponse | null>(null);\n const [loadError, setLoadError] = React.useState<string | null>(null);\n const [query, setQuery] = React.useState('');\n const [providerFilter, setProviderFilter] = React.useState('');\n\n // Deep-link tab for the playground: #playground scrolls to it, and\n // #playground-image / #playground-video / … opens that surface directly (the\n // \"art generation playground\" links land on the image tab, not chat).\n const [playgroundTab, setPlaygroundTab] = React.useState<string | undefined>(undefined);\n\n // Hydrate browser-only values after mount so the prerender markup matches.\n React.useEffect(() => {\n setOrigin(window.location.origin);\n try {\n const stored = localStorage.getItem('appnz_gateway_key');\n if (stored) setExampleKey(stored);\n } catch {\n /* storage blocked */\n }\n const applyPlaygroundHash = () => {\n const m = window.location.hash.match(/^#playground(?:[-=]([a-z0-9]+))?$/i);\n if (!m) return;\n const t = (m[1] || '').toLowerCase();\n if (['chat', 'image', 'embeddings', 'video', 'music', 'speech', 'transcription', '3d'].includes(t)) {\n setPlaygroundTab(t);\n }\n window.setTimeout(\n () => document.getElementById('playground')?.scrollIntoView({ behavior: 'smooth', block: 'start' }),\n 120,\n );\n };\n applyPlaygroundHash();\n window.addEventListener('hashchange', applyPlaygroundHash);\n return () => window.removeEventListener('hashchange', applyPlaygroundHash);\n }, []);\n\n React.useEffect(() => {\n let aborted = false;\n fetch('/api/gateway/models')\n .then((r) => {\n if (!r.ok) throw new Error(`models ${r.status}`);\n return r.json();\n })\n .then((d: ModelsResponse) => {\n if (!aborted) setData(d);\n })\n .catch((e) => {\n if (!aborted) setLoadError(String(e?.message || e));\n });\n return () => {\n aborted = true;\n };\n }, []);\n\n const samples = React.useMemo(() => buildSamples(origin, exampleKey), [origin, exampleKey]);\n const active = samples[task];\n\n const copyCurl = async () => {\n try {\n await navigator.clipboard.writeText(active.curl);\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1500);\n } catch {\n /* clipboard blocked */\n }\n };\n\n const providers = data?.providerDetails || [];\n const models = data?.models || [];\n const filteredModels = React.useMemo(() => {\n const q = query.trim().toLowerCase();\n return models.filter((m) => {\n if (providerFilter && m.provider.toLowerCase() !== providerFilter.toLowerCase()) return false;\n if (!q) return true;\n return (\n m.id.toLowerCase().includes(q) ||\n m.provider.toLowerCase().includes(q) ||\n (m.aliases || []).some((a) => a.toLowerCase().includes(q))\n );\n });\n }, [models, query, providerFilter]);\n\n return (\n <main className=\"min-h-screen bg-black px-4 pb-16 pt-24 text-white sm:px-6 lg:px-8\">\n <div className=\"mx-auto max-w-[1800px]\">\n <a href=\"/\" className=\"mb-5 inline-flex items-center gap-2 text-sm font-semibold text-white/48 hover:text-white\">\n <ArrowLeft size={16} /> Back to overview\n </a>\n\n {/* Hero */}\n <div className=\"mb-8 grid gap-5 lg:grid-cols-[0.95fr_1.05fr] lg:items-end\">\n <div>\n <div className=\"mb-4 inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-white/54\">\n <Network size={14} /> model gateway\n </div>\n <h1 className=\"font-display text-2xl font-bold leading-tight tracking-tight sm:text-4xl\">\n One OpenAI-compatible API for every model and provider.\n </h1>\n </div>\n <div>\n <p className=\"text-sm leading-7 text-white/58\">\n Route chat, images, embeddings, audio, and video through app.nz. Point any OpenAI or Anthropic SDK\n at the base URL below, keep your code, and switch models with one field. Smart <code className=\"rounded bg-white/10 px-1 text-white/80\">auto</code> routing,\n adaptive thinking, prompt caching, automatic failover, usage metering, and one API key.\n </p>\n <div className=\"mt-4 flex flex-col gap-3 sm:flex-row\">\n <a\n href=\"/signup\"\n className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg bg-sky-400 px-4 text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n Create a key <ArrowRight size={17} />\n </a>\n <a\n href=\"#playground\"\n className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-4 text-sm font-semibold text-white transition-colors hover:bg-white hover:text-black\"\n >\n <Play size={16} /> Open playground\n </a>\n <a\n href=\"#models\"\n className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-4 text-sm font-semibold text-white/80 transition-colors hover:text-white\"\n >\n Browse models\n </a>\n <a\n href=\"/spaces\"\n className=\"inline-flex h-11 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-4 text-sm font-semibold text-white/80 transition-colors hover:text-white\"\n >\n Model spaces\n </a>\n </div>\n </div>\n </div>\n\n {/* Quickstart + reference */}\n <div className=\"grid gap-4 lg:grid-cols-[1.25fr_0.75fr] lg:items-start\">\n {/* Code card */}\n <section className=\"min-w-0 rounded-2xl border border-white/10 bg-white/[0.02] p-5\" data-testid=\"gateway-code-card\">\n <div className=\"mb-4 flex flex-wrap items-center justify-between gap-3\">\n <div>\n <div className=\"text-xs font-mono text-white/40\">Base URL</div>\n <code className=\"text-sm text-white/85\" data-testid=\"gateway-base-url\">{`${origin}/v1`}</code>\n </div>\n <button\n onClick={copyCurl}\n data-testid=\"gateway-copy-curl\"\n className=\"inline-flex items-center gap-2 rounded-lg border border-white/10 px-3 py-2 text-xs font-mono text-white/70 transition-colors hover:border-white/20 hover:text-white\"\n >\n {copied ? <Check size={14} className=\"text-green-400\" /> : <Copy size={14} />}\n {copied ? 'Copied' : 'Copy cURL'}\n </button>\n </div>\n\n <div className=\"mb-3 flex flex-wrap gap-1 border-b border-white/10\">\n {(Object.keys(TASK_LABELS) as Task[]).map((t) => (\n <button\n key={t}\n onClick={() => setTask(t)}\n data-testid={`gateway-task-${t}`}\n className={`-mb-px border-b-2 px-3 py-2 text-xs font-mono transition-colors ${\n task === t ? 'border-white text-white' : 'border-transparent text-white/40 hover:text-white/70'\n }`}\n >\n {TASK_LABELS[t]}\n </button>\n ))}\n </div>\n\n <div className=\"mb-3 flex flex-wrap gap-1.5\">\n {(Object.keys(LANG_LABELS) as Lang[]).map((l) => (\n <button\n key={l}\n onClick={() => setLang(l)}\n data-testid={`gateway-lang-${l}`}\n className={`rounded-md px-2.5 py-1 text-xs font-mono transition-colors ${\n lang === l ? 'bg-sky-400/15 text-sky-200' : 'bg-white/[0.04] text-white/55 hover:text-white'\n }`}\n >\n {LANG_LABELS[l].label}\n </button>\n ))}\n </div>\n\n <div className=\"mb-2 text-xs font-mono text-white/40\">{active.description}</div>\n <CodeBlock code={active[lang]} language={LANG_LABELS[lang].hljs} testId=\"gateway-code-sample\" />\n </section>\n\n {/* Reference column */}\n <section className=\"grid min-w-0 gap-4\">\n <div className=\"min-w-0 rounded-2xl border border-white/10 bg-white/[0.02] p-5\">\n <div className=\"mb-3 flex items-start gap-2\">\n <KeyRound size={18} className=\"mt-0.5 text-white/50\" />\n <div className=\"min-w-0\">\n <h2 className=\"text-lg font-bold tracking-tight\">Authentication</h2>\n <p className=\"text-sm text-white/58\">\n Send your key as <code className=\"rounded bg-white/10 px-1 text-white/80\">Authorization: Bearer pk_live_...</code>.\n Create one on the <a href=\"/account\" className=\"text-white underline underline-offset-4\">account page</a>.\n Signed in here? Same-origin calls use your session automatically.\n </p>\n </div>\n </div>\n </div>\n\n <div className=\"min-w-0 rounded-2xl border border-white/10 bg-white/[0.02] p-5\" data-testid=\"gateway-anthropic-setup\">\n <div className=\"mb-2 flex items-center gap-2\">\n <Network size={16} className=\"text-white/50\" />\n <h2 className=\"text-lg font-bold tracking-tight\">Claude Code + Anthropic SDK</h2>\n </div>\n <p className=\"mb-3 text-sm leading-6 text-white/55\">\n Use the site root—no <code className=\"rounded bg-white/10 px-1 text-white/80\">/v1</code>. The gateway translates Messages,\n tools, and streaming for every compatible provider model.\n </p>\n <CodeBlock\n code={`$env:ANTHROPIC_BASE_URL = \"${origin}\"\n$env:ANTHROPIC_AUTH_TOKEN = $env:APP_API_KEY\n$env:ANTHROPIC_API_KEY = \"\"\n$env:ANTHROPIC_MODEL = \"nvidia/deepseek-v4-pro\"\nclaude`}\n language=\"powershell\"\n testId=\"gateway-anthropic-code\"\n />\n </div>\n\n <div className=\"min-w-0 rounded-2xl border border-white/10 bg-white/[0.02] p-5\" data-testid=\"gateway-auto-models\">\n <div className=\"mb-1 flex items-center gap-2\">\n <Zap size={16} className=\"text-white/50\" />\n <h2 className=\"text-lg font-bold tracking-tight\">Smart auto routing</h2>\n </div>\n <p className=\"mb-3 text-sm text-white/55\">\n Send <code className=\"rounded bg-white/10 px-1 text-white/80\">\"model\": \"auto\"</code> and the gateway\n classifies the prompt and routes to the right tier and thinking depth — or pin an explicit model id.\n Stable long Anthropic system/tool prefixes are cached automatically; explicit cache controls are preserved.\n </p>\n <div className=\"space-y-1.5 text-sm\">\n {AUTO_MODELS.map((m) => (\n <div key={m.id} className=\"flex flex-col\">\n <code className=\"font-mono text-[13px] text-white/85\">{m.id}</code>\n <span className=\"text-xs text-white/45\">{m.body}</span>\n </div>\n ))}\n </div>\n </div>\n\n </section>\n </div>\n\n {/* Endpoints — full-width grid so the reference column stays level with\n the code card instead of leaving a tall empty gutter. */}\n <section className=\"mt-4 rounded-2xl border border-white/10 bg-white/[0.02] p-5\">\n <h2 className=\"mb-3 flex items-center gap-2 text-lg font-bold tracking-tight\">\n <BookOpen size={16} className=\"text-white/50\" /> Endpoints\n </h2>\n <div className=\"grid gap-2 sm:grid-cols-2 lg:grid-cols-3\" data-testid=\"gateway-endpoints\">\n {ENDPOINTS.map((e) => {\n const slug = slugForEndpoint(e.method, e.path);\n const href = slug ? `/docs/${slug}` : '/docs#models';\n return (\n <a\n key={`${e.method} ${e.path}`}\n href={href}\n data-testid=\"gateway-endpoint-link\"\n className=\"group block rounded-lg border border-white/10 p-3 transition-colors hover:border-white/25 hover:bg-white/[0.04]\"\n >\n <div className=\"flex items-center gap-2\">\n <span className=\"rounded bg-white/10 px-2 py-0.5 font-mono text-[10px] text-white/80\">{e.method}</span>\n <code className=\"min-w-0 truncate text-[13px] text-white/90\">{e.path}</code>\n <ArrowRight size={13} className=\"ml-auto shrink-0 text-white/25 transition-colors group-hover:text-white/70\" />\n </div>\n <p className=\"mt-1 text-xs text-white/50\">{e.description}</p>\n </a>\n );\n })}\n </div>\n </section>\n\n {/* Playground */}\n <section id=\"playground\" className=\"mt-10 scroll-mt-24\">\n <div className=\"mb-3 flex items-center gap-2\">\n <Play size={18} className=\"text-white/55\" />\n <h2 className=\"font-display text-2xl font-bold tracking-tight\">Playground</h2>\n </div>\n <p className=\"mb-4 max-w-3xl text-sm text-white/55\">\n Run real requests against any model right here — chat, image, embeddings, video, music, speech,\n transcription, and image→3D, each with a live preview and the raw JSON response. Signed in, it uses your\n session; otherwise paste an API key.\n </p>\n <GatewayPlayground\n key={playgroundTab || 'default'}\n models={models}\n origin={origin}\n initialTab={playgroundTab as never}\n />\n </section>\n\n {/* Models browser */}\n <section id=\"models\" className=\"mt-10 scroll-mt-24\">\n <div className=\"mb-3 flex items-center gap-2\">\n <Boxes size={18} className=\"text-white/55\" />\n <h2 className=\"font-display text-2xl font-bold tracking-tight\">\n Models {data ? <span className=\"text-white/40\">({data.total})</span> : null}\n </h2>\n <a href=\"/models\" className=\"ml-auto inline-flex items-center gap-1 text-xs font-mono text-white/45 hover:text-white\">\n Full directory <ArrowRight size={13} />\n </a>\n </div>\n\n <div className=\"mb-4 flex flex-wrap items-center gap-2\">\n <div className=\"relative flex-1 min-w-[220px]\">\n <Search size={15} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-white/35\" />\n <input\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search models, aliases, providers…\"\n data-testid=\"gateway-model-search\"\n className=\"h-10 w-full rounded-lg border border-white/10 bg-white/[0.03] pl-9 pr-3 text-sm text-white placeholder:text-white/35 focus:border-white/25 focus:outline-none\"\n />\n </div>\n <select\n value={providerFilter}\n onChange={(e) => setProviderFilter(e.target.value)}\n data-testid=\"gateway-provider-filter\"\n className=\"h-10 rounded-lg border border-white/10 bg-white/[0.03] px-3 text-sm text-white focus:border-white/25 focus:outline-none\"\n >\n <option value=\"\">All providers</option>\n {providers.map((p) => (\n <option key={p.name} value={p.name}>\n {p.displayName} ({p.modelCount})\n </option>\n ))}\n </select>\n </div>\n\n {loadError && (\n <div className=\"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-300\" data-testid=\"gateway-models-error\">\n Could not load the model catalogue: {loadError}\n </div>\n )}\n\n {!data && !loadError && (\n <div className=\"rounded-lg border border-white/10 bg-white/[0.02] p-8 text-center text-sm text-white/40\">\n Loading catalogue…\n </div>\n )}\n\n {data && (\n <div className=\"grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5\" data-testid=\"gateway-model-grid\">\n {filteredModels.slice(0, 240).map((m) => (\n <a key={`${m.provider}:${m.id}`} href={`/models/${encodeURIComponent(m.id)}`} data-testid=\"gateway-model-card\" className=\"group block rounded-xl border border-white/10 bg-white/[0.025] p-3 transition-colors hover:border-white/25 hover:bg-white/[0.04]\">\n <div className=\"flex items-start justify-between gap-2\">\n <code className=\"break-all text-sm font-semibold text-white/90\">{m.id}</code>\n <ArrowRight size={14} className=\"mt-0.5 shrink-0 text-white/20 transition-colors group-hover:text-white/60\" />\n </div>\n <div className=\"mt-1 text-xs text-white/45\">{m.provider}</div>\n <div className=\"mt-2 flex flex-wrap gap-1.5 text-[10px] font-mono\">\n <span className=\"rounded bg-white/[0.06] px-1.5 py-0.5 text-white/55\">ctx {fmtContext(m.context_window)}</span>\n {(m.input_price_per_1m || m.output_price_per_1m) ? (\n <span className=\"rounded bg-white/[0.06] px-1.5 py-0.5 text-white/55\">\n {fmtPrice(m.input_price_per_1m)}/{fmtPrice(m.output_price_per_1m)} per 1M\n </span>\n ) : null}\n {m.supports_vision && (\n <span className=\"inline-flex items-center gap-0.5 rounded bg-white/[0.06] px-1.5 py-0.5 text-white/55\"><Eye size={10} /> vision</span>\n )}\n {m.supports_tools && (\n <span className=\"inline-flex items-center gap-0.5 rounded bg-white/[0.06] px-1.5 py-0.5 text-white/55\"><Wrench size={10} /> tools</span>\n )}\n </div>\n </a>\n ))}\n {filteredModels.length === 0 && (\n <div className=\"col-span-full rounded-lg border border-white/10 bg-white/[0.02] p-6 text-center text-sm text-white/40\">\n No models match “{query}”.\n </div>\n )}\n </div>\n )}\n </section>\n\n {/* Providers */}\n <section id=\"providers\" className=\"mt-10 scroll-mt-24\">\n <div className=\"mb-3 flex flex-wrap items-center gap-2\">\n <Network size={18} className=\"text-white/55\" />\n <h2 className=\"font-display text-2xl font-bold tracking-tight\">\n Providers {data ? <span className=\"text-white/40\">({providers.length})</span> : null}\n </h2>\n <a href=\"/providers\" className=\"ml-auto text-sm font-semibold text-sky-300 hover:text-sky-200\">\n Become a provider →\n </a>\n </div>\n {data && (\n <div className=\"grid gap-2 sm:grid-cols-2 lg:grid-cols-4\" data-testid=\"gateway-provider-grid\">\n {providers.map((p) => (\n <button\n key={p.name}\n onClick={() => {\n setProviderFilter(p.name);\n document.getElementById('models')?.scrollIntoView({ behavior: 'smooth' });\n }}\n data-testid=\"gateway-provider-card\"\n className=\"flex items-center gap-3 rounded-xl border border-white/10 bg-white/[0.025] p-3 text-left transition-colors hover:border-white/25\"\n >\n <img\n src={p.logo}\n alt=\"\"\n loading=\"lazy\"\n className=\"h-8 w-8 shrink-0 rounded-md border border-white/10 bg-white/[0.04] object-contain p-1\"\n />\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-semibold text-white/90\">{p.displayName}</div>\n <div className=\"text-xs text-white/40\">{p.modelCount} models</div>\n </div>\n </button>\n ))}\n </div>\n )}\n </section>\n </div>\n </main>\n );\n};\n","// Shared client helpers for the app.nz model directory. The catalogue is served\n// live by the gateway (GET /api/gateway/models) from the same model_catalog.json\n// the router uses, so the directory always matches what actually routes.\n\nexport interface CatalogModel {\n id: string;\n provider: string;\n aliases?: string[];\n fallback_models?: string[];\n input_price_per_1m?: number;\n output_price_per_1m?: number;\n context_window?: number;\n max_output_tokens?: number;\n modality?: string;\n // Media pricing the gateway exposes for non-text models.\n price_per_image?: number;\n price_per_video?: number;\n price_per_second?: number;\n price_per_minute?: number;\n price_per_forecast?: number;\n supported_sizes?: string[];\n supports_streaming: boolean;\n supports_tools: boolean;\n supports_vision: boolean;\n}\n\nexport interface ProviderDetail {\n name: string;\n displayName: string;\n logo: string;\n website: string;\n modelCount: number;\n}\n\nexport interface CatalogResponse {\n models: CatalogModel[];\n providerDetails: ProviderDetail[];\n total: number;\n}\n\nlet cache: Promise<CatalogResponse> | null = null;\n\nexport function loadCatalog(): Promise<CatalogResponse> {\n if (!cache) {\n cache = fetch('/api/gateway/models')\n .then((r) => {\n if (!r.ok) throw new Error('catalogue unavailable');\n return r.json();\n })\n .catch((err) => {\n cache = null;\n throw err;\n });\n }\n return cache;\n}\n\nexport function formatContext(tokens?: number): string {\n if (!tokens) return 'N/A';\n if (tokens >= 1_000_000) return `${+(tokens / 1_000_000).toFixed(tokens % 1_000_000 ? 1 : 0)}M`;\n if (tokens >= 1_000) return `${Math.round(tokens / 1_000)}K`;\n return String(tokens);\n}\n\nexport function formatPrice(value?: number): string {\n if (value == null) return 'N/A';\n if (value === 0) return '$0';\n if (value < 0.01) return `$${value.toFixed(4)}`;\n if (value < 1) return `$${value.toFixed(2)}`;\n return `$${value.toFixed(2)}`;\n}\n\n// Prettify a model id into a heading without losing accuracy: keep the id text\n// but title-case the dash/slash segments for the eye.\nexport function modelTitle(id: string): string {\n const tail = id.includes('/') ? id.slice(id.indexOf('/') + 1) : id;\n return tail\n .split(/[-_]/)\n .map((w) => (/^\\d/.test(w) || w.length <= 2 ? w : w[0].toUpperCase() + w.slice(1)))\n .join(' ');\n}\n\nexport function modelDisplayLabel(id: string): string {\n const normalized = id.trim().toLowerCase();\n const tail = normalized.includes('/') ? normalized.slice(normalized.indexOf('/') + 1) : normalized;\n if (normalized === 'auto' || tail === 'auto' || tail === 'openpaths-auto') return 'Auto model';\n if (tail === 'auto-code') return 'Auto code';\n if (tail === 'auto-fast') return 'Auto fast';\n if (tail === 'auto-cheap') return 'Auto cheap';\n if (tail === 'auto-reasoning' || tail === 'auto-thinking' || tail === 'autothinking') return 'Auto thinking';\n if (tail === 'auto-vision') return 'Auto vision';\n if (tail === 'auto-image') return 'Auto image';\n return id;\n}\n\nexport function capabilities(m: CatalogModel): string[] {\n const caps: string[] = [];\n if (m.supports_vision) caps.push('vision');\n if (m.supports_tools) caps.push('tools');\n if (m.supports_streaming) caps.push('streaming');\n return caps;\n}\n","import React, { useEffect, useMemo, useState } from 'react';\nimport { Search, Cpu, ArrowUpRight } from 'lucide-react';\nimport {\n loadCatalog,\n formatContext,\n formatPrice,\n modelTitle,\n capabilities,\n type CatalogModel,\n type ProviderDetail,\n} from './modelCatalog';\n\nconst initialProvider = (): string => {\n if (typeof window === 'undefined') return '';\n return new URLSearchParams(window.location.search).get('provider')?.toLowerCase() ?? '';\n};\n\nconst initialQuery = (): string => {\n if (typeof window === 'undefined') return '';\n return new URLSearchParams(window.location.search).get('q') ?? '';\n};\n\nexport const ModelsDirectory: React.FC = () => {\n const [models, setModels] = useState<CatalogModel[]>([]);\n const [providers, setProviders] = useState<ProviderDetail[]>([]);\n const [error, setError] = useState('');\n const [loading, setLoading] = useState(true);\n const [q, setQ] = useState(initialQuery);\n const [provider, setProvider] = useState(initialProvider);\n\n useEffect(() => {\n let cancelled = false;\n loadCatalog()\n .then((data) => {\n if (cancelled) return;\n setModels(data.models);\n setProviders(data.providerDetails);\n setLoading(false);\n })\n .catch(() => {\n if (cancelled) return;\n setError('Could not load the model catalogue.');\n setLoading(false);\n });\n return () => {\n cancelled = true;\n };\n }, []);\n\n const providerMeta = useMemo(() => {\n const map: Record<string, ProviderDetail> = {};\n for (const p of providers) map[p.name.toLowerCase()] = p;\n return map;\n }, [providers]);\n\n const filtered = useMemo(() => {\n const needle = q.trim().toLowerCase();\n return models.filter((m) => {\n if (provider && m.provider.toLowerCase() !== provider) return false;\n if (!needle) return true;\n return (\n m.id.toLowerCase().includes(needle) ||\n m.provider.toLowerCase().includes(needle) ||\n (m.aliases ?? []).some((a) => a.toLowerCase().includes(needle))\n );\n });\n }, [models, q, provider]);\n\n return (\n <main className=\"mx-auto max-w-[1800px] px-6 pb-24 pt-28\">\n <header className=\"mb-10\">\n <div className=\"mb-3 flex items-center gap-2 text-xs font-mono uppercase tracking-[0.18em] text-white/40\">\n <Cpu className=\"h-4 w-4\" /> Model gateway\n </div>\n <h1 className=\"text-4xl font-bold tracking-tight md:text-5xl\">Model directory</h1>\n <p className=\"mt-4 max-w-2xl text-lg font-light leading-relaxed text-white/60\">\n Every model routable through the app.nz OpenAI-compatible gateway. One API key, one base URL,\n automatic failover. Click any model for pricing, context, and usage.\n </p>\n <a href=\"/evals\" className=\"mt-4 inline-flex items-center gap-2 text-sm font-semibold text-emerald-200 hover:underline\">\n Start with independent model evals <ArrowUpRight className=\"h-4 w-4\" />\n </a>\n </header>\n\n <div className=\"mb-8 flex flex-col gap-4 sm:flex-row sm:items-center\">\n <label className=\"relative flex-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-white/35\" />\n <input\n value={q}\n onChange={(e) => setQ(e.target.value)}\n placeholder=\"Search models, providers, aliases…\"\n className=\"w-full rounded-lg border border-white/10 bg-white/[0.03] py-2.5 pl-10 pr-3 text-sm text-white placeholder:text-white/35 focus:border-white/30 focus:outline-none\"\n />\n </label>\n <select\n value={provider}\n onChange={(e) => setProvider(e.target.value)}\n className=\"rounded-lg border border-white/10 bg-white/[0.03] px-3 py-2.5 text-sm text-white focus:border-white/30 focus:outline-none\"\n >\n <option value=\"\">All providers</option>\n {providers.map((p) => (\n <option key={p.name} value={p.name.toLowerCase()}>\n {p.displayName} ({p.modelCount})\n </option>\n ))}\n </select>\n </div>\n\n {error && <div className=\"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-200\">{error}</div>}\n\n {loading ? (\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3\">\n {Array.from({ length: 9 }).map((_, i) => (\n <div key={i} className=\"h-32 animate-pulse rounded-xl border border-white/10 bg-white/[0.02]\" />\n ))}\n </div>\n ) : (\n <>\n <div className=\"mb-4 text-xs font-mono text-white/40\">{filtered.length} models</div>\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5\">\n {filtered.map((m) => {\n const meta = providerMeta[m.provider.toLowerCase()];\n return (\n <a\n key={m.id}\n href={`/models/${encodeURIComponent(m.id)}`}\n className=\"group flex flex-col rounded-xl border border-white/10 bg-white/[0.02] p-4 transition-colors hover:border-white/25 hover:bg-white/[0.04]\"\n >\n <div className=\"mb-2 flex items-center gap-2 text-xs font-mono text-white/45\">\n {meta?.logo ? (\n <img src={meta.logo} alt=\"\" className=\"h-4 w-4 rounded-sm object-contain\" />\n ) : null}\n <span>{meta?.displayName ?? m.provider}</span>\n <ArrowUpRight className=\"ml-auto h-4 w-4 text-white/20 transition-colors group-hover:text-white/60\" />\n </div>\n <div className=\"truncate text-base font-semibold tracking-tight\" title={m.id}>\n {modelTitle(m.id)}\n </div>\n <code className=\"mb-3 truncate text-[11px] text-white/40\">{m.id}</code>\n <div className=\"mt-auto flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono text-white/50\">\n <span>{formatContext(m.context_window)} ctx</span>\n {m.input_price_per_1m != null && (\n <span>\n {formatPrice(m.input_price_per_1m)}/{formatPrice(m.output_price_per_1m)}\n </span>\n )}\n {capabilities(m).map((c) => (\n <span key={c} className=\"rounded border border-white/10 px-1.5 py-0.5 text-white/55\">\n {c}\n </span>\n ))}\n </div>\n </a>\n );\n })}\n </div>\n {filtered.length === 0 && (\n <div className=\"rounded-xl border border-white/10 bg-white/[0.02] p-10 text-center text-sm text-white/45\">\n No models match “{q}”.\n </div>\n )}\n </>\n )}\n </main>\n );\n};\n","export interface ImageDemo {\n imageUrl?: string;\n outputUrl: string;\n prompt?: string;\n payload: Record<string, unknown>;\n title: string;\n description: string;\n}\n\nexport const IMAGE_DEMOS: Record<string, ImageDemo> = {\n 'fal-ai/hidream-o1-image/edit': {\n title: 'Prompted image edit example',\n description: 'Use a reference image plus an edit prompt to replace a product while preserving the photographed scene.',\n imageUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/hidream-edit/perfume.jpg',\n outputUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/hidream-edit/lipstick.png',\n prompt: 'Replace the perfume bottle with a lipstick',\n payload: {\n model: 'fal-ai/hidream-o1-image/edit',\n prompt: 'Replace the perfume bottle with a lipstick',\n reference_image_urls: [\n 'https://openpathsstatic.openpaths.io/static/uploads/playground/hidream-edit/perfume.jpg',\n ],\n image_size: 'landscape_16_9',\n num_inference_steps: 50,\n guidance_scale: 5,\n num_images: 1,\n output_format: 'png',\n enable_safety_checker: false,\n },\n },\n 'fal-ai/flux-2-pro/outpaint': {\n title: 'Outpainted image example',\n description: 'Expand the canvas to the left, right, and bottom while keeping the original scene coherent.',\n imageUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/flux-outpaint/input.png',\n outputUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/flux-outpaint/output.jpg',\n payload: {\n model: 'fal-ai/flux-2-pro/outpaint',\n image_url: 'https://openpathsstatic.openpaths.io/static/uploads/playground/flux-outpaint/input.png',\n expand_top: 0,\n expand_bottom: 200,\n expand_left: 200,\n expand_right: 200,\n enable_safety_checker: true,\n output_format: 'jpeg',\n },\n },\n};\n","export const SEEDANCE_LOGO_URL = 'https://openpathsstatic.openpaths.io/static/uploads/playground/seedance/openpaths-logo.webp';\nexport const HAPPY_HORSE_RAP_IMAGE_URL = 'https://openpathsstatic.openpaths.io/static/uploads/playground/happy-horse/rap.png';\nconst HH11_BASE = 'https://openpathsstatic.openpaths.io/static/uploads/playground/happy-horse-v1.1';\nexport const HAPPY_HORSE_V11_IMAGE_URL = `${HH11_BASE}/rap.png`;\nconst SYNC_LIPSYNC_BASE = 'https://openpathsstatic.openpaths.io/static/uploads/playground/sync-lipsync';\nexport const SYNC_LIPSYNC_AVATAR_URL = `${SYNC_LIPSYNC_BASE}/avatar.jpg`;\nconst FAL_VIDEO_BASE = 'https://openpathsstatic.openpaths.io/static/uploads/playground/fal-video';\nconst GEMINI_OMNI_BASE = 'https://appstatic.app.nz/app/static/videos/gemini-omni';\nexport const GEMINI_OMNI_PERFUME_IMAGE_URL = 'https://appstatic.app.nz/app/static/uploads/playground/gemini-omni/perfume.jpg';\n\nexport type VideoDemo = {\n prompt: string;\n outputUrl: string;\n resolution: '480p' | '720p' | '1080p';\n duration: 'auto' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '13' | '14' | '15';\n aspectRatio: 'auto' | '21:9' | '16:9' | '4:3' | '1:1' | '3:4' | '9:16';\n generateAudio: boolean;\n imageUrl?: string;\n endImageUrl?: string;\n imageUrls?: string[];\n videoUrls?: string[];\n audioUrls?: string[];\n};\n\nexport const VIDEO_DEMOS: Record<string, VideoDemo> = {\n 'gemini-omni-flash-preview': {\n prompt: '[# Sources <FIRST_FRAME>@Image1] Continuous single-shot premium product video: the perfume bottle remains the hero object from the input image, the camera makes a slow cinematic push-in, soft studio lights sweep across the glass, subtle reflections move on the surface, no scene cuts, no added text, no dialogue. Use Image1 as the starting frame.',\n outputUrl: `${GEMINI_OMNI_BASE}/gemini-omni-perfume-image-to-video.mp4`,\n resolution: '720p',\n duration: '4',\n aspectRatio: '16:9',\n generateAudio: false,\n imageUrl: GEMINI_OMNI_PERFUME_IMAGE_URL,\n },\n 'seedance-2.0-fast-text-to-video': {\n prompt: 'A cinematic 4-second shot of a compact AI routing console on a dark workstation, luminous paths connecting model nodes across a glass interface, slow handheld push-in, realistic reflections, premium product demo lighting, no readable text.',\n outputUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/seedance/seedance-fast-text-to-video.mp4',\n resolution: '720p',\n duration: '4',\n aspectRatio: '16:9',\n generateAudio: false,\n },\n 'seedance-2.0-text-to-video': {\n prompt: 'A polished studio macro shot of an AI infrastructure dashboard represented as glowing fiber-optic routes inside a transparent cube, slow orbiting camera, cinematic depth of field, clean black background, no readable text.',\n outputUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/seedance/seedance-text-to-video.mp4',\n resolution: '720p',\n duration: '4',\n aspectRatio: '16:9',\n generateAudio: false,\n },\n 'seedance-2.0-image-to-video': {\n prompt: 'Animate the supplied app.nz logo as a premium product mark: subtle camera push-in, soft light sweep across the surface, tiny particles moving around it, clean dark studio background, elegant motion, no added text.',\n outputUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/seedance/seedance-image-to-video.mp4',\n resolution: '720p',\n duration: '4',\n aspectRatio: '1:1',\n generateAudio: false,\n imageUrl: SEEDANCE_LOGO_URL,\n },\n 'seedance-2.0-fast-reference-to-video': {\n prompt: 'Use @Image1 as the exact brand mark on a small illuminated badge mounted to a matte black server rack. Slow dolly-in, shallow depth of field, cool white rim light, subtle cable movement, premium infrastructure commercial, no extra text.',\n outputUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/seedance/seedance-fast-reference-to-video.mp4',\n resolution: '720p',\n duration: '4',\n aspectRatio: '16:9',\n generateAudio: false,\n imageUrls: [SEEDANCE_LOGO_URL],\n audioUrls: [],\n },\n 'seedance-2.0-reference-to-video': {\n prompt: '@Image1 is projected as a crisp holographic interface element above a developer desk. Camera slides left to right, soft reflections on glass, realistic workstation lighting, cinematic product demo, no additional words or watermarks.',\n outputUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/seedance/seedance-reference-to-video.mp4',\n resolution: '720p',\n duration: '4',\n aspectRatio: '16:9',\n generateAudio: false,\n imageUrls: [SEEDANCE_LOGO_URL],\n audioUrls: [],\n },\n 'alibaba/happy-horse/image-to-video': {\n prompt: 'Bring the scene in the image to life.',\n outputUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/happy-horse/happy-horse-image-to-video.mp4',\n resolution: '1080p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: true,\n imageUrl: HAPPY_HORSE_RAP_IMAGE_URL,\n },\n 'alibaba/happy-horse/v1.1/text-to-video': {\n prompt: 'A cinematic 5-second shot of a luminous AI model-routing console on a dark studio desk, glowing fiber-optic paths connecting model nodes across a glass interface, slow handheld push-in, realistic reflections, premium product lighting, no readable text.',\n outputUrl: `${HH11_BASE}/text-to-video.mp4`,\n resolution: '1080p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: true,\n },\n 'alibaba/happy-horse/v1.1/image-to-video': {\n prompt: 'Bring the scene in the image to life with natural motion and ambient audio.',\n outputUrl: `${HH11_BASE}/image-to-video.mp4`,\n resolution: '1080p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: true,\n imageUrl: HAPPY_HORSE_V11_IMAGE_URL,\n },\n 'alibaba/happy-horse/v1.1/reference-to-video': {\n prompt: 'character1 performs an energetic rap on a neon-lit stage, cinematic lighting, smooth camera movement, synchronized lip-sync.',\n outputUrl: `${HH11_BASE}/reference-to-video.mp4`,\n resolution: '1080p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: true,\n imageUrls: [HAPPY_HORSE_V11_IMAGE_URL],\n },\n 'ltx-2.3-image-to-video': {\n prompt: 'A polished real-estate listing still becomes a smooth slow zoom-in video, subtle parallax, stable architecture, natural lighting, no text overlays.',\n outputUrl: 'https://openpathsstatic.openpaths.io/static/uploads/playground/happy-horse/happy-horse-image-to-video.mp4',\n resolution: '1080p',\n duration: '6',\n aspectRatio: 'auto',\n generateAudio: false,\n imageUrl: SEEDANCE_LOGO_URL,\n },\n 'fal-ai/kling-video/v3/pro/text-to-video': {\n prompt: 'A lone astronaut drifts weightless inside a derelict space station, dust motes glittering in shafts of golden sunlight through cracked viewports, slow cinematic dolly push, anamorphic lens flare, volumetric god rays, hyper-detailed.',\n outputUrl: `${FAL_VIDEO_BASE}/kling-v3-pro-text-to-video.mp4`,\n resolution: '1080p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: true,\n },\n 'fal-ai/wan/v2.7/text-to-video': {\n prompt: 'Cinematic aerial shot soaring over a neon-drenched futuristic megacity at dusk, sleek glass towers reflecting magenta and cyan light, flying vehicles streaking between skyscrapers, volumetric fog, ultra-smooth glide.',\n outputUrl: `${FAL_VIDEO_BASE}/wan-2.7-text-to-video.mp4`,\n resolution: '1080p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: true,\n },\n 'fal-ai/pika/v2.2/text-to-video': {\n prompt: 'Cinematic dolly through a bioluminescent jungle at night, glowing blue spores drifting in the air, mist curling around ancient vines, a waterfall shimmering in moonlight, ultra-detailed, lush atmospheric color grade.',\n outputUrl: `${FAL_VIDEO_BASE}/pika-2.2-text-to-video.mp4`,\n resolution: '1080p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: false,\n },\n 'fal-ai/cogvideox-5b': {\n prompt: 'Cinematic tracking shot following a sleek silver sports car carving through a coastal mountain road at sunset, ocean glittering below, lens flare, motion blur, dramatic golden light, ultra-detailed.',\n outputUrl: `${FAL_VIDEO_BASE}/cogvideox-text-to-video.mp4`,\n resolution: '720p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: false,\n },\n 'fal-ai/hunyuan-video-v1.5/text-to-video': {\n prompt: 'Cinematic slow-motion close-up of molten gold liquid swirling into elegant ribbons against a black void, caustic light refractions, hyper-detailed fluid simulation, dramatic spotlight, luxurious, shallow focus.',\n outputUrl: `${FAL_VIDEO_BASE}/hunyuan-1.5-text-to-video.mp4`,\n resolution: '720p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: false,\n },\n 'fal-ai/minimax/hailuo-2.3/standard/text-to-video': {\n prompt: 'Sweeping cinematic drone shot gliding over neon-lit futuristic city canyons at dusk, holographic light trails reflecting on glass towers, volumetric fog, dramatic teal-and-amber color grade.',\n outputUrl: `${FAL_VIDEO_BASE}/hailuo-2.3-text-to-video.mp4`,\n resolution: '720p',\n duration: '6',\n aspectRatio: '16:9',\n generateAudio: false,\n },\n 'fal-ai/veo3.1/fast/image-to-video': {\n prompt: 'Bring the portrait to life: subtle head turn and blink, gentle breeze in the hair, soft volumetric light drifting across the face, cinematic shallow focus, ambient room tone.',\n outputUrl: `${FAL_VIDEO_BASE}/veo-3.1-fast-image-to-video.mp4`,\n resolution: '1080p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: true,\n imageUrl: HAPPY_HORSE_V11_IMAGE_URL,\n },\n 'fal-ai/luma-dream-machine/ray-2/image-to-video': {\n prompt: 'The scene comes alive with gentle cinematic motion, soft parallax depth, drifting light and dust particles, photoreal slow push-in.',\n outputUrl: `${FAL_VIDEO_BASE}/luma-ray-2-image-to-video.mp4`,\n resolution: '720p',\n duration: '5',\n aspectRatio: '16:9',\n generateAudio: false,\n imageUrl: HAPPY_HORSE_V11_IMAGE_URL,\n },\n 'sync-lipsync-v3': {\n prompt: 'Lip-sync the character in the image to the supplied voice track.',\n outputUrl: `${SYNC_LIPSYNC_BASE}/sync-lipsync-v3-demo.mp4`,\n resolution: '1080p',\n duration: '10',\n aspectRatio: '1:1',\n generateAudio: false,\n imageUrl: SYNC_LIPSYNC_AVATAR_URL,\n audioUrls: [`${SYNC_LIPSYNC_BASE}/voice.wav`],\n },\n};\n","import React, { useEffect, useMemo, useState } from 'react';\nimport { ArrowLeft, BookOpen, Check, Copy, Image as ImageIcon, LineChart, MessageSquare, Video } from 'lucide-react';\nimport { CodeBlock } from './CodeBlock';\nimport {\n loadCatalog,\n formatContext,\n formatPrice,\n modelTitle,\n capabilities,\n type CatalogModel,\n type ProviderDetail,\n} from './modelCatalog';\nimport { IMAGE_DEMOS, type ImageDemo } from './imageDemos';\nimport { VIDEO_DEMOS, type VideoDemo } from './videoDemos';\n\ntype MediaLanguage = 'python' | 'javascript' | 'curl';\n\nconst Fact: React.FC<{ label: string; value: string; code?: boolean }> = ({ label, value, code }) => (\n <div className=\"min-w-0 rounded-xl border border-white/10 bg-white/[0.02] p-5\">\n <div className=\"mb-2 text-xs font-mono uppercase tracking-[0.18em] text-white/35\">{label}</div>\n {code ? (\n <code className=\"block truncate text-sm text-white/80\">{value}</code>\n ) : (\n <div className=\"truncate text-lg font-semibold tracking-tight\">{value}</div>\n )}\n </div>\n);\n\nconst snippet = (id: string) =>\n `from openai import OpenAI\n\nclient = OpenAI(\n api_key=\"app-...\", # app.nz gateway key\n base_url=\"https://app.nz/v1\",\n)\n\nresp = client.chat.completions.create(\n model=\"${id}\",\n messages=[{\"role\": \"user\", \"content\": \"say hi\"}],\n)\nprint(resp.choices[0].message.content)`;\n\nconst API_BASE = 'https://app.nz/v1';\nconst API_KEY = 'app-...';\n\nfunction isForecastModel(m: CatalogModel): boolean {\n if (m.modality === 'forecast') return true;\n if ((m.price_per_forecast ?? 0) > 0) return true;\n return /(chronos|forecast|time-series|timeseries)/i.test(m.id);\n}\n\n// Forecast models speak a forecasting API, not chat.completions. Give a correct,\n// copy-pasteable /api/forecast example instead of a misleading chat snippet.\nfunction forecastSnippet(lang: MediaLanguage): string {\n if (lang === 'python') {\n return `import requests\n\nr = requests.post(\n \"https://app.nz/api/forecast\",\n headers={\"Authorization\": \"Bearer ${API_KEY}\"},\n json={\n \"values\": [100, 102, 99, 105, 110, 108, 112, 120], # your history\n \"prediction_length\": 12, # steps ahead\n \"quantile_levels\": [0.1, 0.5, 0.9],\n # optional — paste extra columns for multivariate forecasting:\n # \"past_covariates\": {\"price\": [...], \"ad_spend\": [...]},\n },\n).json()\n\nprint(r[\"forecast\"][\"mean\"]) # median forecast per step\nprint(r[\"forecast\"][\"quantiles\"][\"0.9\"]) # upper band`;\n }\n if (lang === 'javascript') {\n return `const r = await fetch(\"https://app.nz/api/forecast\", {\n method: \"POST\",\n headers: {\n \"Authorization\": \"Bearer ${API_KEY}\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n values: [100, 102, 99, 105, 110, 108, 112, 120],\n prediction_length: 12,\n quantile_levels: [0.1, 0.5, 0.9],\n // optional multivariate covariates:\n // past_covariates: { price: [...], ad_spend: [...] },\n }),\n}).then((res) => res.json());\n\nconsole.log(r.forecast.mean);`;\n }\n return `curl https://app.nz/api/forecast \\\\\n -H \"Authorization: Bearer ${API_KEY}\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\n \"values\": [100, 102, 99, 105, 110, 108, 112, 120],\n \"prediction_length\": 12,\n \"quantile_levels\": [0.1, 0.5, 0.9]\n }'`;\n}\n\n// modelFacts returns the spec tiles that actually apply to a model's modality.\n// Image/video/media models have no token context or per-1M pricing, so showing\n// those as \"N/A\" reads like broken docs — surface price-per-output + sizes.\nfunction modelFacts(model: CatalogModel, modality: string): { label: string; value: string }[] {\n const usd = (v?: number) => (v == null ? 'N/A' : v < 0.01 ? `$${v.toFixed(4)}` : `$${v.toFixed(2)}`);\n if (modality === 'image') {\n return [\n { label: 'Price / image', value: usd(model.price_per_image) },\n { label: 'Sizes', value: model.supported_sizes?.length ? model.supported_sizes.slice(0, 4).join(', ') : 'flexible' },\n ];\n }\n if (modality === 'video') {\n const price = model.price_per_video != null ? `${usd(model.price_per_video)} / video` : model.price_per_second != null ? `${usd(model.price_per_second)} / sec` : 'N/A';\n return [{ label: 'Price', value: price }, { label: 'Output', value: 'video' }];\n }\n if (modality === 'forecast') {\n return [{ label: 'Price / forecast', value: usd(model.price_per_forecast) }, { label: 'Context', value: `${formatContext(model.context_window)} steps` }];\n }\n if (modality === 'embeddings') {\n return [{ label: 'Input price', value: `${formatPrice(model.input_price_per_1m)} / 1M` }, { label: 'Context', value: `${formatContext(model.context_window)} tokens` }];\n }\n if (modality === 'speech' || modality === 'transcription') {\n const price = model.price_per_minute != null ? `${usd(model.price_per_minute)} / min` : `${formatPrice(model.input_price_per_1m)} / 1M`;\n return [{ label: 'Price', value: price }, { label: 'Output', value: modality === 'speech' ? 'audio' : 'text' }];\n }\n // Chat / text models.\n return [\n { label: 'Context', value: `${formatContext(model.context_window)} tokens` },\n { label: 'Max output', value: model.max_output_tokens ? `${formatContext(model.max_output_tokens)} tokens` : 'N/A' },\n { label: 'Input price', value: `${formatPrice(model.input_price_per_1m)} / 1M` },\n { label: 'Output price', value: `${formatPrice(model.output_price_per_1m)} / 1M` },\n ];\n}\n\nfunction isVideoModel(id: string): boolean {\n if (VIDEO_DEMOS[id]) return true;\n return /(text-to-video|image-to-video|reference-to-video|lipsync|\\bvideo\\b)/i.test(id);\n}\n\nfunction buildVideoPayload(modelId: string, demo?: VideoDemo) {\n const isHappyHorse = modelId === 'alibaba/happy-horse/image-to-video';\n const payload: Record<string, unknown> = {\n model: modelId,\n prompt: demo?.prompt || 'A cinematic product demo shot of a compact AI routing console, slow camera push-in, clean studio lighting, no readable text.',\n resolution: demo?.resolution || '720p',\n duration: isHappyHorse ? Number(demo?.duration || 5) : demo?.duration || '4',\n aspect_ratio: demo?.aspectRatio || '16:9',\n };\n if (isHappyHorse) {\n payload.enable_safety_checker = true;\n } else {\n payload.generate_audio = demo?.generateAudio ?? false;\n }\n if (demo?.imageUrl) payload.image_url = demo.imageUrl;\n if (demo?.endImageUrl) payload.end_image_url = demo.endImageUrl;\n if (demo?.imageUrls?.length) payload.image_urls = demo.imageUrls;\n if (demo?.videoUrls?.length) payload.video_urls = demo.videoUrls;\n if (demo?.audioUrls?.length) payload.audio_urls = demo.audioUrls;\n return payload;\n}\n\nfunction generateVideoSnippet(modelId: string, demo: VideoDemo | undefined, lang: MediaLanguage) {\n const payload = buildVideoPayload(modelId, demo);\n const body = JSON.stringify(payload, null, 2);\n\n if (lang === 'python') {\n return `from openai import OpenAI\n\nclient = OpenAI(\n api_key=\"${API_KEY}\",\n base_url=\"${API_BASE}\",\n)\n\nresult = client.post(\n \"/videos/generations\",\n body=${JSON.stringify(payload, null, 4)},\n cast_to=dict,\n)\n\nprint(result[\"video_url\"])`;\n }\n\n if (lang === 'javascript') {\n return `import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n apiKey: \"${API_KEY}\",\n baseURL: \"${API_BASE}\",\n});\n\nconst result = await client.post(\"/videos/generations\", {\n body: ${body},\n cast_to: Object,\n});\n\nconsole.log(result.video_url);`;\n }\n\n return `curl \"${API_BASE}/videos/generations\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer ${API_KEY}\" \\\\\n -d @- <<'JSON'\n${body}\nJSON`;\n}\n\nfunction generateImageSnippet(demo: ImageDemo, lang: MediaLanguage) {\n const payload = demo.payload;\n const body = JSON.stringify(payload, null, 2);\n\n if (lang === 'python') {\n return `from openai import OpenAI\n\nclient = OpenAI(\n api_key=\"${API_KEY}\",\n base_url=\"${API_BASE}\",\n)\n\nresult = client.post(\n \"/images/generations\",\n body=${JSON.stringify(payload, null, 4)},\n cast_to=dict,\n)\n\nprint(result[\"data\"][0][\"url\"])`;\n }\n\n if (lang === 'javascript') {\n return `import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n apiKey: \"${API_KEY}\",\n baseURL: \"${API_BASE}\",\n});\n\nconst result = await client.post(\"/images/generations\", {\n body: ${body},\n cast_to: Object,\n});\n\nconsole.log(result.data[0].url);`;\n }\n\n return `curl \"${API_BASE}/images/generations\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer ${API_KEY}\" \\\\\n -d @- <<'JSON'\n${body}\nJSON`;\n}\n\nexport const ModelPage: React.FC<{ modelId: string }> = ({ modelId }) => {\n const decodedId = useMemo(() => {\n try {\n return decodeURIComponent(modelId);\n } catch {\n return modelId;\n }\n }, [modelId]);\n\n const [model, setModel] = useState<CatalogModel | null>(null);\n const [provider, setProvider] = useState<ProviderDetail | null>(null);\n const [state, setState] = useState<'loading' | 'ok' | 'missing' | 'error'>('loading');\n const [copied, setCopied] = useState(false);\n const [mediaLang, setMediaLang] = useState<MediaLanguage>('python');\n const [mediaCopied, setMediaCopied] = useState(false);\n\n useEffect(() => {\n let cancelled = false;\n setState('loading');\n loadCatalog()\n .then((data) => {\n if (cancelled) return;\n const found = data.models.find((m) => m.id === decodedId);\n if (!found) {\n setState('missing');\n return;\n }\n setModel(found);\n setProvider(data.providerDetails.find((p) => p.name.toLowerCase() === found.provider.toLowerCase()) ?? null);\n setState('ok');\n })\n .catch(() => {\n if (!cancelled) setState('error');\n });\n return () => {\n cancelled = true;\n };\n }, [decodedId]);\n\n const modality = model?.modality ?? '';\n const isVideo = useMemo(() => (model ? modality === 'video' || isVideoModel(model.id) : false), [model, modality]);\n const isForecast = useMemo(() => (model ? isForecastModel(model) : false), [model]);\n const videoDemo = model ? VIDEO_DEMOS[model.id] : undefined;\n const imageDemo = model ? IMAGE_DEMOS[model.id] : undefined;\n const isImage = modality === 'image' || !!imageDemo;\n const isMedia = isVideo || isImage || isForecast;\n\n const fcastSnippet = useMemo(() => (isForecast ? forecastSnippet(mediaLang) : ''), [isForecast, mediaLang]);\n\n const videoSnippet = useMemo(\n () => (model && isVideo ? generateVideoSnippet(model.id, videoDemo, mediaLang) : ''),\n [model, isVideo, videoDemo, mediaLang],\n );\n const imageSnippet = useMemo(\n () => (imageDemo ? generateImageSnippet(imageDemo, mediaLang) : ''),\n [imageDemo, mediaLang],\n );\n\n const copy = async () => {\n if (!model) return;\n await navigator.clipboard.writeText(snippet(model.id));\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1600);\n };\n\n const copyMedia = async () => {\n await navigator.clipboard.writeText(isForecast ? fcastSnippet : isVideo ? videoSnippet : imageSnippet);\n setMediaCopied(true);\n window.setTimeout(() => setMediaCopied(false), 1600);\n };\n\n if (state === 'loading') {\n return (\n <main className=\"mx-auto max-w-5xl px-6 pb-24 pt-28\">\n <div className=\"h-8 w-40 animate-pulse rounded bg-white/10\" />\n <div className=\"mt-6 h-16 w-2/3 animate-pulse rounded bg-white/10\" />\n </main>\n );\n }\n\n if (state !== 'ok' || !model) {\n return (\n <main className=\"mx-auto max-w-5xl px-6 pb-24 pt-28\">\n <a href=\"/models\" className=\"inline-flex items-center gap-1.5 text-xs font-mono text-white/50 hover:text-white\">\n <ArrowLeft className=\"h-3.5 w-3.5\" /> Model directory\n </a>\n <h1 className=\"mt-8 text-3xl font-bold tracking-tight\">\n {state === 'missing' ? `No model “${decodedId}”` : 'Catalogue unavailable'}\n </h1>\n <p className=\"mt-3 text-white/55\">\n {state === 'missing'\n ? 'That model id is not in the gateway catalogue. Browse the directory for available models.'\n : 'Could not reach the model catalogue. Try again shortly.'}\n </p>\n </main>\n );\n }\n\n const providerLabel = provider?.displayName ?? model.provider;\n const name = modelTitle(model.id);\n\n return (\n <main className=\"mx-auto max-w-5xl px-6 pb-24 pt-28\">\n <a href=\"/models\" className=\"inline-flex items-center gap-1.5 text-xs font-mono text-white/50 hover:text-white\">\n <ArrowLeft className=\"h-3.5 w-3.5\" /> Model directory\n </a>\n\n <div className=\"mb-10 mt-8\">\n <div className=\"mb-4 flex items-center gap-2 text-xs font-mono text-white/45\">\n {provider?.logo ? <img src={provider.logo} alt=\"\" className=\"h-5 w-5 rounded-sm object-contain\" /> : null}\n <a\n href={`/models?provider=${encodeURIComponent(model.provider.toLowerCase())}`}\n className=\"underline decoration-white/20 underline-offset-4 hover:text-white\"\n >\n {providerLabel}\n </a>\n </div>\n <h1 className=\"mb-4 text-4xl font-bold tracking-tight md:text-5xl\">{name}</h1>\n <div className=\"flex flex-wrap gap-2\">\n {capabilities(model).map((c) => (\n <span key={c} className=\"rounded-full border border-white/10 bg-white/[0.04] px-3 py-1 text-xs font-mono text-white/65\">\n {c}\n </span>\n ))}\n </div>\n </div>\n\n <div className=\"mb-10 grid gap-4 md:grid-cols-3\">\n <Fact label=\"Model ID\" value={model.id} code />\n {modelFacts(model, modality).map((f) => (\n <Fact key={f.label} label={f.label} value={f.value} />\n ))}\n <Fact label=\"Provider\" value={providerLabel} />\n </div>\n\n {model.aliases?.length ? (\n <div className=\"mb-10 rounded-2xl border border-white/10 bg-white/[0.02] p-6\">\n <h2 className=\"mb-3 text-sm font-mono uppercase tracking-[0.18em] text-white/35\">Aliases</h2>\n <div className=\"flex flex-wrap gap-2\">\n {model.aliases.map((a) => (\n <code key={a} className=\"rounded border border-white/10 bg-white/[0.04] px-2 py-1 text-xs text-white/70\">\n {a}\n </code>\n ))}\n </div>\n </div>\n ) : null}\n\n {!isMedia && (\n <div className=\"mb-10 rounded-2xl border border-white/10 bg-white/[0.02] p-6\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-xl font-bold tracking-tight\">Call it through the gateway</h2>\n <button\n type=\"button\"\n onClick={copy}\n className=\"inline-flex items-center gap-2 rounded border border-white/12 px-3 py-2 font-mono text-xs text-white/60 transition-colors hover:border-white/30 hover:text-white\"\n >\n {copied ? <Check className=\"h-3.5 w-3.5\" /> : <Copy className=\"h-3.5 w-3.5\" />}\n {copied ? 'Copied' : 'Copy'}\n </button>\n </div>\n <pre className=\"overflow-x-auto rounded-lg border border-white/10 bg-black/60 p-4 text-xs leading-relaxed text-white/80\">\n {snippet(model.id)}\n </pre>\n </div>\n )}\n\n <div className=\"flex flex-col gap-3 sm:flex-row\">\n {isForecast ? (\n <a\n href=\"/time-series-forecasting\"\n className=\"inline-flex items-center justify-center gap-2 rounded border border-white bg-sky-400 px-5 py-3 font-mono text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <LineChart className=\"h-4 w-4\" /> Open forecaster\n </a>\n ) : isVideo ? (\n <a\n href={`/playground?model=${encodeURIComponent(model.id)}&mode=video`}\n className=\"inline-flex items-center justify-center gap-2 rounded border border-white bg-sky-400 px-5 py-3 font-mono text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <Video className=\"h-4 w-4\" /> Generate video\n </a>\n ) : isImage ? (\n <a\n href={`/playground?model=${encodeURIComponent(model.id)}&mode=image`}\n className=\"inline-flex items-center justify-center gap-2 rounded border border-white bg-sky-400 px-5 py-3 font-mono text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <ImageIcon className=\"h-4 w-4\" /> Generate image\n </a>\n ) : (\n <a\n href=\"/chat\"\n className=\"inline-flex items-center justify-center gap-2 rounded border border-white bg-sky-400 px-5 py-3 font-mono text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <MessageSquare className=\"h-4 w-4\" /> Try in chat\n </a>\n )}\n <a\n href=\"/docs\"\n className=\"inline-flex items-center justify-center gap-2 rounded border border-white/15 bg-white/[0.03] px-5 py-3 font-mono text-sm text-white/70 transition-colors hover:border-white/30 hover:text-white\"\n >\n <BookOpen className=\"h-4 w-4\" /> Gateway docs\n </a>\n {provider?.website ? (\n <a\n href={provider.website}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center justify-center gap-2 rounded border border-white/15 bg-white/[0.03] px-5 py-3 font-mono text-sm text-white/70 transition-colors hover:border-white/30 hover:text-white\"\n >\n {providerLabel} site\n </a>\n ) : null}\n </div>\n\n {isForecast && (\n <section className=\"mt-12 rounded-2xl border border-white/10 bg-white/[0.02] p-5\">\n <div className=\"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2 className=\"text-xl font-bold tracking-tight\">Forecast API example</h2>\n <p className=\"mt-1 text-sm text-white/45\">\n This is a time-series model — call <code className=\"rounded bg-white/10 px-1 text-xs\">/api/forecast</code> with\n a history and a horizon. Paste extra columns as <code className=\"rounded bg-white/10 px-1 text-xs\">past_covariates</code> for\n multivariate forecasting.\n </p>\n </div>\n <button\n type=\"button\"\n onClick={copyMedia}\n className=\"inline-flex items-center justify-center gap-2 rounded border border-white/12 px-3 py-2 font-mono text-xs text-white/60 transition-colors hover:border-white/30 hover:text-white\"\n >\n {mediaCopied ? <Check className=\"h-3.5 w-3.5\" /> : <Copy className=\"h-3.5 w-3.5\" />}\n {mediaCopied ? 'Copied' : 'Copy'}\n </button>\n </div>\n <div className=\"mb-3 flex flex-wrap gap-2\">\n {(['python', 'javascript', 'curl'] as const).map((lang) => (\n <button\n key={lang}\n type=\"button\"\n onClick={() => setMediaLang(lang)}\n className={`rounded px-3 py-1.5 font-mono text-xs transition-colors ${mediaLang === lang ? 'bg-sky-400/15 text-sky-200' : 'border border-white/10 text-white/45 hover:text-white'}`}\n >\n {lang === 'javascript' ? 'JavaScript' : lang === 'python' ? 'Python' : 'cURL'}\n </button>\n ))}\n </div>\n <CodeBlock\n code={fcastSnippet}\n language={mediaLang === 'curl' ? 'bash' : mediaLang}\n preClassName=\"max-h-[460px] text-xs\"\n />\n <a\n href=\"/time-series-forecasting\"\n className=\"mt-4 inline-flex w-full items-center justify-center gap-2 rounded border border-white bg-sky-400 px-4 py-2.5 font-mono text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <LineChart className=\"h-4 w-4\" /> Try it in the forecaster\n </a>\n </section>\n )}\n\n {isVideo && (\n <section className=\"mt-12 overflow-hidden rounded-2xl border border-white/10 bg-white/[0.02]\">\n <div className=\"grid gap-0 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]\">\n <div className=\"border-b border-white/10 lg:border-b-0 lg:border-r\">\n {videoDemo ? (\n <video src={videoDemo.outputUrl} controls muted loop playsInline className=\"aspect-video w-full bg-black object-contain\" />\n ) : (\n <div className=\"flex aspect-video items-center justify-center bg-white/[0.03] text-sm font-mono text-white/35\">\n Generate a sample in the playground\n </div>\n )}\n {videoDemo && (\n <div className=\"grid gap-4 border-t border-white/10 p-4 md:grid-cols-[120px_minmax(0,1fr)]\">\n {videoDemo.imageUrl || videoDemo.imageUrls?.[0] ? (\n <div>\n <div className=\"mb-2 text-[10px] font-mono uppercase tracking-[0.16em] text-white/35\">Input image</div>\n <img\n src={videoDemo.imageUrl || videoDemo.imageUrls?.[0]}\n alt={`${name} reference input`}\n className=\"aspect-square w-full rounded-lg border border-white/10 bg-white/[0.03] object-contain p-2\"\n />\n </div>\n ) : null}\n <div className=\"min-w-0\">\n <div className=\"mb-2 text-[10px] font-mono uppercase tracking-[0.16em] text-white/35\">Prompt</div>\n <p className=\"text-sm leading-relaxed text-white/58\">{videoDemo.prompt}</p>\n <div className=\"mt-4 flex flex-wrap gap-2 text-[10px] font-mono uppercase tracking-[0.14em] text-white/35\">\n <span className=\"rounded border border-white/10 px-2 py-1\">{videoDemo.resolution}</span>\n <span className=\"rounded border border-white/10 px-2 py-1\">{videoDemo.duration}s</span>\n <span className=\"rounded border border-white/10 px-2 py-1\">{videoDemo.aspectRatio}</span>\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"p-5\">\n <div className=\"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2 className=\"text-xl font-bold tracking-tight\">Video API example</h2>\n <p className=\"mt-1 text-sm text-white/45\">Copy the request or open it with this model selected in the playground.</p>\n </div>\n <button\n type=\"button\"\n onClick={copyMedia}\n className=\"inline-flex items-center justify-center gap-2 rounded border border-white/12 px-3 py-2 font-mono text-xs text-white/60 transition-colors hover:border-white/30 hover:text-white\"\n >\n {mediaCopied ? <Check className=\"h-3.5 w-3.5\" /> : <Copy className=\"h-3.5 w-3.5\" />}\n {mediaCopied ? 'Copied' : 'Copy'}\n </button>\n </div>\n <div className=\"mb-3 flex flex-wrap gap-2\">\n {(['python', 'javascript', 'curl'] as const).map((lang) => (\n <button\n key={lang}\n type=\"button\"\n onClick={() => setMediaLang(lang)}\n className={`rounded px-3 py-1.5 font-mono text-xs transition-colors ${mediaLang === lang ? 'bg-sky-400/15 text-sky-200' : 'border border-white/10 text-white/45 hover:text-white'}`}\n >\n {lang === 'javascript' ? 'JavaScript' : lang === 'python' ? 'Python' : 'cURL'}\n </button>\n ))}\n </div>\n <CodeBlock\n code={videoSnippet}\n language={mediaLang === 'curl' ? 'bash' : mediaLang}\n preClassName=\"max-h-[420px] text-xs\"\n />\n <a\n href={`/playground?model=${encodeURIComponent(model.id)}&mode=video`}\n className=\"mt-4 inline-flex w-full items-center justify-center gap-2 rounded border border-white bg-sky-400 px-4 py-2.5 font-mono text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <Video className=\"h-4 w-4\" /> Use this in playground\n </a>\n </div>\n </div>\n </section>\n )}\n\n {imageDemo && (\n <section className=\"mt-12 overflow-hidden rounded-2xl border border-white/10 bg-white/[0.02]\">\n <div className=\"grid gap-0 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]\">\n <div className=\"border-b border-white/10 lg:border-b-0 lg:border-r\">\n <div className=\"grid grid-cols-2 gap-px bg-white/10\">\n {imageDemo.imageUrl && (\n <div className=\"bg-black\">\n <div className=\"border-b border-white/10 px-4 py-2 text-[10px] font-mono uppercase tracking-[0.16em] text-white/35\">Input</div>\n <img src={imageDemo.imageUrl} alt={`${name} input`} className=\"aspect-square w-full object-contain p-3\" />\n </div>\n )}\n <div className=\"bg-black\">\n <div className=\"border-b border-white/10 px-4 py-2 text-[10px] font-mono uppercase tracking-[0.16em] text-white/35\">Output</div>\n <img src={imageDemo.outputUrl} alt={`${name} output`} className=\"aspect-square w-full object-contain p-3\" />\n </div>\n </div>\n <div className=\"border-t border-white/10 p-5\">\n <h2 className=\"text-xl font-bold tracking-tight\">{imageDemo.title}</h2>\n <p className=\"mt-2 text-sm leading-relaxed text-white/55\">{imageDemo.description}</p>\n </div>\n </div>\n\n <div className=\"p-5\">\n <div className=\"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2 className=\"text-xl font-bold tracking-tight\">Image API example</h2>\n <p className=\"mt-1 text-sm text-white/45\">Copy the request or open it with this model selected in the playground.</p>\n </div>\n <button\n type=\"button\"\n onClick={copyMedia}\n className=\"inline-flex items-center justify-center gap-2 rounded border border-white/12 px-3 py-2 font-mono text-xs text-white/60 transition-colors hover:border-white/30 hover:text-white\"\n >\n {mediaCopied ? <Check className=\"h-3.5 w-3.5\" /> : <Copy className=\"h-3.5 w-3.5\" />}\n {mediaCopied ? 'Copied' : 'Copy'}\n </button>\n </div>\n <div className=\"mb-3 flex flex-wrap gap-2\">\n {(['python', 'javascript', 'curl'] as const).map((lang) => (\n <button\n key={lang}\n type=\"button\"\n onClick={() => setMediaLang(lang)}\n className={`rounded px-3 py-1.5 font-mono text-xs transition-colors ${mediaLang === lang ? 'bg-sky-400/15 text-sky-200' : 'border border-white/10 text-white/45 hover:text-white'}`}\n >\n {lang === 'javascript' ? 'JavaScript' : lang === 'python' ? 'Python' : 'cURL'}\n </button>\n ))}\n </div>\n <CodeBlock\n code={imageSnippet}\n language={mediaLang === 'curl' ? 'bash' : mediaLang}\n preClassName=\"max-h-[420px] text-xs\"\n />\n <a\n href={`/playground?model=${encodeURIComponent(model.id)}&mode=image`}\n className=\"mt-4 inline-flex w-full items-center justify-center gap-2 rounded border border-white bg-sky-400 px-4 py-2.5 font-mono text-sm font-bold text-black transition-colors hover:bg-sky-300\"\n >\n <ImageIcon className=\"h-4 w-4\" /> Use this in playground\n </a>\n </div>\n </div>\n </section>\n )}\n </main>\n );\n};\n","import React, { useEffect, useState } from 'react';\n\n// SelfTestProbe gives every page a machine-readable test surface. Append\n// ?test=true to any route and this fetches /api/selftest — the same deterministic\n// contract the Go server and e2e tests use — exposes it on\n// window.__APPNZ_SELFTEST__, and renders a hidden [data-testid=\"selftest\"] node\n// carrying data-ok plus the full JSON. Integration tests (and humans debugging)\n// can then pull each page's health without scraping the rendered UI.\n//\n// It is SSR-safe and hydration-safe: it renders null on the server and on the\n// first client render (data is still null), so the prerendered and hydrated\n// trees match; the probe element only appears after the fetch resolves.\nexport const SelfTestProbe: React.FC = () => {\n const enabled =\n typeof window !== 'undefined' &&\n new URLSearchParams(window.location.search).get('test') === 'true';\n const [data, setData] = useState<unknown>(null);\n\n useEffect(() => {\n if (!enabled) return;\n let cancelled = false;\n fetch('/api/selftest')\n .then((r) => r.json())\n .then((d) => {\n if (cancelled) return;\n (window as unknown as { __APPNZ_SELFTEST__?: unknown }).__APPNZ_SELFTEST__ = d;\n setData(d);\n })\n .catch((e) => {\n if (!cancelled) setData({ ok: false, error: String(e) });\n });\n return () => {\n cancelled = true;\n };\n }, [enabled]);\n\n if (!enabled || data === null) return null;\n const ok = Boolean((data as { ok?: boolean }).ok);\n return (\n <div data-testid=\"selftest\" data-ok={String(ok)} hidden>\n {JSON.stringify(data)}\n </div>\n );\n};\n","import React from 'react';\nimport { Search, Sparkles } from 'lucide-react';\nimport { useCases, useCaseCategories, type UseCaseCategory } from './useCasesData';\n\nconst KIND_LABEL: Record<string, string> = {\n 'image-edit': 'Photo in',\n 'image-gen': 'Prompt to image',\n 'remove-bg': 'Photo in',\n tts: 'Text to speech',\n music: 'Text to music',\n sfx: 'Text to SFX',\n video: 'Text to video',\n 'image-video': 'Photo to video',\n};\n\nexport const UseCaseDirectory: React.FC = () => {\n const [query, setQuery] = React.useState('');\n const [category, setCategory] = React.useState<UseCaseCategory | 'All'>('All');\n\n const filtered = React.useMemo(() => {\n const q = query.trim().toLowerCase();\n return useCases.filter((u) => {\n if (category !== 'All' && u.category !== category) return false;\n if (!q) return true;\n return (\n u.title.toLowerCase().includes(q) ||\n u.tagline.toLowerCase().includes(q) ||\n u.keywords.some((k) => k.includes(q)) ||\n u.category.toLowerCase().includes(q)\n );\n });\n }, [query, category]);\n\n return (\n <main className=\"px-4 pb-24 pt-28 sm:px-6\">\n <div className=\"mx-auto max-w-6xl\">\n <header className=\"mb-8 max-w-3xl\">\n <div className=\"mb-3 inline-flex items-center gap-2 rounded border border-white/10 bg-white/[0.03] px-3 py-1 text-xs font-mono text-white/45\">\n <Sparkles size={13} /> {useCases.length} AI tools, one credit balance\n </div>\n <h1 className=\"text-3xl font-bold tracking-tight text-white sm:text-5xl\">AI tools for every job</h1>\n <p className=\"mt-4 text-base leading-relaxed text-white/55\">\n Job-specific AI tools built on the app.nz model gateway: stage real estate photos, shoot product images\n without a studio, restore family photos, generate voiceovers, music and video. Sign in, use your credits,\n download the result — every tool is also an API.\n </p>\n </header>\n\n <div className=\"mb-6 flex flex-col gap-3 sm:flex-row sm:items-center\">\n <label className=\"relative flex-1\">\n <Search size={15} className=\"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-white/35\" />\n <input\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search tools — staging, headshot, voiceover…\"\n className=\"w-full rounded-lg border border-white/10 bg-white/[0.03] py-2.5 pl-9 pr-3 text-sm text-white placeholder:text-white/30 focus:border-white/30 focus:outline-none\"\n />\n </label>\n </div>\n\n <div className=\"mb-8 flex flex-wrap gap-2\">\n {(['All', ...useCaseCategories] as const).map((c) => (\n <button\n key={c}\n onClick={() => setCategory(c)}\n className={`rounded-full border px-3 py-1.5 text-xs font-medium transition ${\n category === c\n ? 'border-sky-400/50 bg-sky-400/10 text-sky-300'\n : 'border-white/10 bg-white/[0.02] text-white/55 hover:border-white/25 hover:text-white'\n }`}\n >\n {c}\n </button>\n ))}\n </div>\n\n <div className=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {filtered.map((u) => (\n <a\n key={u.slug}\n href={`/ai/${u.slug}`}\n className=\"group rounded-xl border border-white/10 bg-white/[0.02] p-5 transition hover:border-white/25 hover:bg-white/[0.04]\"\n >\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"text-[10px] font-mono uppercase tracking-wider text-white/35\">{u.category}</span>\n <span className=\"rounded-full border border-white/10 px-2 py-0.5 text-[10px] text-white/40\">\n {KIND_LABEL[u.kind]}\n </span>\n </div>\n <h2 className=\"mt-2 text-base font-semibold text-white group-hover:text-sky-300\">{u.title}</h2>\n <p className=\"mt-1.5 text-sm leading-5 text-white/50\">{u.tagline}</p>\n </a>\n ))}\n </div>\n\n {filtered.length === 0 ? (\n <p className=\"py-16 text-center text-white/40\">No tools match — try a different search.</p>\n ) : null}\n </div>\n </main>\n );\n};\n","import React from 'react';\nimport { ArrowLeft, Download, ImagePlus, Loader2, Play, Sparkles, X } from 'lucide-react';\nimport {\n useCaseBySlug,\n useCases,\n useCaseNeedsImage,\n type UseCaseDef,\n} from './useCasesData';\n\ninterface ResultItem {\n kind: 'image' | 'audio' | 'video';\n url: string;\n}\n\nfunction extractMediaURL(obj: unknown, exts: string[]): string {\n const seen = new Set<unknown>();\n const walk = (v: unknown): string => {\n if (!v || seen.has(v)) return '';\n if (typeof v === 'string') {\n const low = v.split('?')[0].toLowerCase();\n if ((v.startsWith('http') || v.startsWith('data:')) && exts.some((e) => low.endsWith(e) || v.startsWith(`data:${e}`)))\n return v;\n return '';\n }\n if (typeof v !== 'object') return '';\n seen.add(v);\n for (const val of Object.values(v as Record<string, unknown>)) {\n const found = walk(val);\n if (found) return found;\n }\n return '';\n };\n return walk(obj);\n}\n\nasync function fileToDataURL(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n const r = new FileReader();\n r.onload = () => resolve(String(r.result));\n r.onerror = () => reject(new Error('Could not read file'));\n r.readAsDataURL(file);\n });\n}\n\nconst STEPS: Record<string, [string, string, string]> = {\n image: ['Upload your photo', 'Pick a style or describe what you want', 'Generate and download the result'],\n gen: ['Describe what you want', 'Generate — the gateway picks a strong model', 'Download and reuse anywhere'],\n audio: ['Paste your text or describe the sound', 'Generate audio in seconds', 'Play, download, and drop it in your editor'],\n video: ['Describe the shot (and upload a photo if animating one)', 'Generate a short clip', 'Download the video'],\n};\n\nfunction stepsFor(u: UseCaseDef): [string, string, string] {\n if (u.kind === 'tts' || u.kind === 'music' || u.kind === 'sfx') return STEPS.audio;\n if (u.kind === 'video' || u.kind === 'image-video') return STEPS.video;\n if (u.kind === 'image-gen') return STEPS.gen;\n return STEPS.image;\n}\n\nexport const UseCasePage: React.FC<{ slug: string }> = ({ slug }) => {\n const def = useCaseBySlug[slug];\n\n const [input, setInput] = React.useState(def?.defaultInput ?? '');\n const [image, setImage] = React.useState('');\n const [running, setRunning] = React.useState(false);\n const [error, setError] = React.useState('');\n const [results, setResults] = React.useState<ResultItem[]>([]);\n const fileRef = React.useRef<HTMLInputElement>(null);\n\n React.useEffect(() => {\n setInput(def?.defaultInput ?? '');\n setImage('');\n setResults([]);\n setError('');\n }, [slug]); // eslint-disable-line react-hooks/exhaustive-deps\n\n if (!def) {\n return (\n <main className=\"px-4 pb-24 pt-28\">\n <div className=\"mx-auto max-w-2xl text-center\">\n <h1 className=\"text-2xl font-bold text-white\">Tool not found</h1>\n <a href=\"/ai\" className=\"mt-6 inline-flex items-center gap-2 text-sm font-semibold text-sky-400 hover:underline\">\n <ArrowLeft size={15} /> All AI tools\n </a>\n </div>\n </main>\n );\n }\n\n const needsImage = useCaseNeedsImage(def.kind);\n const needsText = def.kind !== 'remove-bg';\n const related = useCases.filter((u) => u.category === def.category && u.slug !== def.slug).slice(0, 6);\n const steps = stepsFor(def);\n\n async function onPickFile(files: FileList | null) {\n const f = files?.[0];\n if (!f) return;\n if (f.size > 12 * 1024 * 1024) {\n setError('Image too large — max 12MB.');\n return;\n }\n setError('');\n setImage(await fileToDataURL(f));\n }\n\n async function run() {\n if (needsImage && !image) {\n setError('Upload an image first.');\n return;\n }\n if (needsText && !input.trim() && def.kind !== 'image-edit') {\n setError('Enter some text first.');\n return;\n }\n setRunning(true);\n setError('');\n try {\n const finalPrompt = def.prompt ? def.prompt.replace('{input}', input.trim() || def.defaultInput || '') : input.trim();\n let out: ResultItem[] = [];\n const post = async (url: string, body: unknown) => {\n const resp = await fetch(url, {\n method: 'POST',\n credentials: 'include',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n });\n if (resp.status === 401) throw new Error('Sign in to run this tool — it uses your credits. Sign in at /login and retry.');\n return resp;\n };\n\n if (def.kind === 'image-edit') {\n const resp = await post('/api/image/edit', { prompt: finalPrompt, image, n: def.n ?? 1 });\n const data = await resp.json();\n if (!resp.ok || !data?.success) throw new Error(data?.error || 'Generation failed');\n out = (data.images as string[]).map((u) => ({ kind: 'image', url: u }));\n } else if (def.kind === 'remove-bg') {\n const resp = await post('/api/image/remove-background', { image });\n const data = await resp.json();\n if (!resp.ok || !data?.success) throw new Error(data?.error || 'Background removal failed');\n out = [{ kind: 'image', url: data.image }];\n } else if (def.kind === 'image-gen') {\n const resp = await post('/v1/images/generations', {\n model: def.model ?? '',\n prompt: finalPrompt,\n size: def.size ?? '1024x1024',\n n: def.n ?? 1,\n });\n const data = await resp.json();\n if (!resp.ok) throw new Error(data?.error?.message || data?.error || 'Generation failed');\n out = (data?.data ?? [])\n .map((d: { url?: string; b64_json?: string }) =>\n d.url ? d.url : d.b64_json ? `data:image/png;base64,${d.b64_json}` : '',\n )\n .filter(Boolean)\n .map((u: string) => ({ kind: 'image' as const, url: u }));\n } else if (def.kind === 'tts') {\n const resp = await post('/v1/audio/speech', { input: input.trim(), voice: def.voice });\n if (!resp.ok) {\n const data = await resp.json().catch(() => null);\n throw new Error((data as { error?: { message?: string } })?.error?.message || 'Speech generation failed');\n }\n const blob = await resp.blob();\n out = [{ kind: 'audio', url: URL.createObjectURL(blob) }];\n } else if (def.kind === 'music' || def.kind === 'sfx') {\n const resp = await post('/api/audio/generate', {\n prompt: finalPrompt || input.trim(),\n kind: def.kind === 'music' ? 'music' : 'sfx',\n duration: def.duration,\n });\n const data = await resp.json();\n if (!resp.ok || !data?.item?.url) throw new Error(data?.error || 'Audio generation failed');\n out = [{ kind: 'audio', url: data.item.url }];\n } else {\n const body: Record<string, unknown> = { model: def.model ?? 'auto-video', prompt: finalPrompt };\n if (def.kind === 'image-video') body.image_url = image;\n const resp = await post('/v1/videos/generations', body);\n const data = await resp.json();\n if (!resp.ok) throw new Error(data?.error?.message || data?.error || 'Video generation failed');\n const url = extractMediaURL(data, ['.mp4', '.webm', 'video/']);\n if (!url) throw new Error('Video generation returned no video');\n out = [{ kind: 'video', url }];\n }\n setResults(out);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Generation failed');\n } finally {\n setRunning(false);\n }\n }\n\n return (\n <main className=\"px-4 pb-24 pt-28 sm:px-6\">\n <div className=\"mx-auto max-w-5xl\">\n <a href=\"/ai\" className=\"inline-flex items-center gap-1.5 text-sm font-medium text-white/45 hover:text-white\">\n <ArrowLeft size={15} /> All AI tools\n </a>\n\n <header className=\"mt-4 mb-8 max-w-3xl\">\n <div className=\"mb-3 inline-flex items-center gap-2 rounded border border-white/10 bg-white/[0.03] px-3 py-1 text-xs font-mono text-white/45\">\n <Sparkles size={13} /> {def.category} · usage-based credits\n </div>\n <h1 className=\"text-3xl font-bold tracking-tight text-white sm:text-4xl\">{def.title}</h1>\n <p className=\"mt-3 text-base leading-relaxed text-white/55\">{def.description}</p>\n </header>\n\n <div className=\"grid gap-6 lg:grid-cols-[400px_minmax(0,1fr)]\">\n <section className=\"rounded-xl border border-white/10 bg-white/[0.02] p-5\">\n {needsImage ? (\n <div className=\"mb-4\">\n <span className=\"mb-1.5 block text-[10px] font-mono uppercase tracking-wider text-white/40\">Your image</span>\n {image ? (\n <div className=\"relative\">\n <img src={image} alt=\"input\" className=\"max-h-56 w-full rounded-lg border border-white/10 object-contain\" />\n <button\n onClick={() => setImage('')}\n className=\"absolute right-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-full bg-black/70 text-white/70 hover:text-white\"\n aria-label=\"Remove image\"\n >\n <X size={14} />\n </button>\n </div>\n ) : (\n <button\n onClick={() => fileRef.current?.click()}\n onDragOver={(e) => e.preventDefault()}\n onDrop={(e) => {\n e.preventDefault();\n void onPickFile(e.dataTransfer.files);\n }}\n className=\"flex h-36 w-full flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-white/20 bg-black/30 text-white/40 hover:border-white/40 hover:text-white/70\"\n >\n <ImagePlus size={22} />\n <span className=\"text-xs\">Click or drop an image (max 12MB)</span>\n </button>\n )}\n <input ref={fileRef} type=\"file\" accept=\"image/*\" className=\"hidden\" onChange={(e) => void onPickFile(e.target.files)} />\n </div>\n ) : null}\n\n {needsText ? (\n <label className=\"mb-4 block\">\n <span className=\"mb-1.5 block text-[10px] font-mono uppercase tracking-wider text-white/40\">\n {def.inputLabel ?? 'Prompt'}\n </span>\n <textarea\n value={input}\n onChange={(e) => setInput(e.target.value)}\n placeholder={def.inputPlaceholder ?? def.defaultInput}\n rows={def.kind === 'tts' ? 6 : 3}\n className=\"w-full resize-y rounded-lg border border-white/10 bg-black px-3 py-2 text-sm text-white placeholder:text-white/25 focus:border-white/30 focus:outline-none\"\n />\n </label>\n ) : null}\n\n {def.presets?.length ? (\n <div className=\"mb-4 flex flex-wrap gap-1.5\">\n {def.presets.map((p) => (\n <button\n key={p.label}\n onClick={() => setInput(p.input)}\n className={`rounded-full border px-2.5 py-1 text-xs transition ${\n input === p.input\n ? 'border-sky-400/50 bg-sky-400/10 text-sky-300'\n : 'border-white/10 text-white/50 hover:border-white/25 hover:text-white'\n }`}\n >\n {p.label}\n </button>\n ))}\n </div>\n ) : null}\n\n <button\n onClick={() => void run()}\n disabled={running}\n className=\"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-sky-500 px-4 py-2.5 text-sm font-semibold text-white transition hover:bg-sky-400 disabled:opacity-50\"\n >\n {running ? <Loader2 size={16} className=\"animate-spin\" /> : <Play size={15} />}\n {running ? 'Generating…' : 'Generate'}\n </button>\n {def.kind === 'video' || def.kind === 'image-video' ? (\n <p className=\"mt-2 text-center text-[11px] text-white/35\">Video generation can take a minute or two.</p>\n ) : null}\n {error ? (\n <p className=\"mt-3 rounded-lg border border-red-400/30 bg-red-400/10 px-3 py-2 text-xs text-red-300\">\n {error}{' '}\n {error.includes('Sign in') ? (\n <a href={`/login?next=${encodeURIComponent(`/ai/${slug}`)}`} className=\"font-semibold underline\">\n Sign in\n </a>\n ) : null}\n </p>\n ) : null}\n </section>\n\n <section className=\"min-h-[280px] rounded-xl border border-white/10 bg-white/[0.02] p-5\">\n <h2 className=\"mb-4 font-mono text-sm font-bold uppercase tracking-wider text-white/70\">Result</h2>\n {results.length === 0 ? (\n <div className=\"flex h-48 items-center justify-center text-sm text-white/30\">\n {running ? 'Working…' : 'Your result will appear here.'}\n </div>\n ) : (\n <div className=\"grid gap-4\">\n {results.map((r, i) =>\n r.kind === 'image' ? (\n <div key={i} className=\"relative\">\n <img src={r.url} alt={`${def.title} result`} className=\"w-full rounded-lg border border-white/10\" />\n <a\n href={r.url}\n download={`${def.slug}.png`}\n className=\"absolute right-2 top-2 inline-flex h-8 w-8 items-center justify-center rounded-full bg-black/70 text-white/80 hover:text-white\"\n aria-label=\"Download\"\n >\n <Download size={15} />\n </a>\n </div>\n ) : r.kind === 'audio' ? (\n <div key={i} className=\"flex items-center gap-3\">\n <audio src={r.url} controls className=\"w-full\" />\n <a href={r.url} download={`${def.slug}.mp3`} className=\"text-white/60 hover:text-white\" aria-label=\"Download\">\n <Download size={16} />\n </a>\n </div>\n ) : (\n <div key={i}>\n <video src={r.url} controls className=\"w-full rounded-lg border border-white/10\" />\n <a href={r.url} download className=\"mt-2 inline-flex items-center gap-1.5 text-xs text-sky-400 hover:underline\">\n <Download size={13} /> Download video\n </a>\n </div>\n ),\n )}\n </div>\n )}\n </section>\n </div>\n\n <section className=\"mt-12 grid gap-6 sm:grid-cols-3\">\n {steps.map((s, i) => (\n <div key={i} className=\"rounded-xl border border-white/10 bg-white/[0.02] p-5\">\n <span className=\"font-mono text-xs text-sky-400\">Step {i + 1}</span>\n <p className=\"mt-1.5 text-sm text-white/70\">{s}</p>\n </div>\n ))}\n </section>\n\n {related.length ? (\n <section className=\"mt-12\">\n <h2 className=\"mb-4 text-lg font-semibold text-white\">More {def.category} tools</h2>\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3\">\n {related.map((u) => (\n <a\n key={u.slug}\n href={`/ai/${u.slug}`}\n className=\"rounded-lg border border-white/10 bg-white/[0.02] p-4 transition hover:border-white/25\"\n >\n <span className=\"text-sm font-semibold text-white\">{u.title}</span>\n <p className=\"mt-1 text-xs text-white/45\">{u.tagline}</p>\n </a>\n ))}\n </div>\n </section>\n ) : null}\n </div>\n </main>\n );\n};\n","import React from 'react';\nimport { CodeBlock } from './CodeBlock';\n\n// Markdown renders a safe subset of GitHub-flavored markdown used by blog posts\n// and tool descriptions. It is deliberately dependency-free (no react-markdown)\n// and deterministic, so the same markup renders on the server prerender and the\n// first client render — hydration-safe. Supported: ATX headings, paragraphs,\n// unordered/ordered lists, fenced code (via CodeBlock), GFM tables, blockquotes,\n// horizontal rules, images (block figures + inline), and inline\n// bold/italic/code/links. Raw HTML is NOT rendered.\n\ntype Block =\n | { kind: 'heading'; level: number; text: string }\n | { kind: 'paragraph'; text: string }\n | { kind: 'code'; lang: string; code: string }\n | { kind: 'ul'; items: string[] }\n | { kind: 'ol'; items: string[] }\n | { kind: 'quote'; text: string }\n | { kind: 'table'; header: string[]; rows: string[][] }\n | { kind: 'figure'; src: string; alt: string }\n | { kind: 'hr' };\n\n// A line that is nothing but an image: render it as a block <figure> with the\n// alt text as a caption (the common case for blog-post figures).\nconst FIGURE_RE = /^\\s*!\\[([^\\]]*)\\]\\(([^)\\s]+)\\)\\s*$/;\n\nfunction parseBlocks(src: string): Block[] {\n const lines = src.replace(/\\r\\n/g, '\\n').split('\\n');\n const blocks: Block[] = [];\n let i = 0;\n\n const isTableSep = (s: string) => /^\\s*\\|?\\s*:?-{2,}:?\\s*(\\|\\s*:?-{2,}:?\\s*)+\\|?\\s*$/.test(s);\n const splitRow = (s: string) =>\n s.trim().replace(/^\\|/, '').replace(/\\|$/, '').split('|').map((c) => c.trim());\n\n while (i < lines.length) {\n const line = lines[i];\n\n if (!line.trim()) {\n i++;\n continue;\n }\n\n // Fenced code block\n const fence = line.match(/^```(.*)$/);\n if (fence) {\n const lang = fence[1].trim();\n const code: string[] = [];\n i++;\n while (i < lines.length && !/^```/.test(lines[i])) {\n code.push(lines[i]);\n i++;\n }\n i++; // closing fence\n blocks.push({ kind: 'code', lang, code: code.join('\\n') });\n continue;\n }\n\n // Horizontal rule\n if (/^(-{3,}|\\*{3,}|_{3,})$/.test(line.trim())) {\n blocks.push({ kind: 'hr' });\n i++;\n continue;\n }\n\n // Standalone image -> block figure\n const fig = line.match(FIGURE_RE);\n if (fig) {\n blocks.push({ kind: 'figure', alt: fig[1].trim(), src: fig[2] });\n i++;\n continue;\n }\n\n // Heading\n const heading = line.match(/^(#{1,6})\\s+(.*)$/);\n if (heading) {\n blocks.push({ kind: 'heading', level: heading[1].length, text: heading[2].trim() });\n i++;\n continue;\n }\n\n // Table (header row followed by a separator row)\n if (line.includes('|') && i + 1 < lines.length && isTableSep(lines[i + 1])) {\n const header = splitRow(line);\n const rows: string[][] = [];\n i += 2;\n while (i < lines.length && lines[i].includes('|') && lines[i].trim()) {\n rows.push(splitRow(lines[i]));\n i++;\n }\n blocks.push({ kind: 'table', header, rows });\n continue;\n }\n\n // Blockquote\n if (/^>\\s?/.test(line)) {\n const buf: string[] = [];\n while (i < lines.length && /^>\\s?/.test(lines[i])) {\n buf.push(lines[i].replace(/^>\\s?/, ''));\n i++;\n }\n blocks.push({ kind: 'quote', text: buf.join(' ') });\n continue;\n }\n\n // Unordered list\n if (/^\\s*[-*]\\s+/.test(line)) {\n const items: string[] = [];\n while (i < lines.length && /^\\s*[-*]\\s+/.test(lines[i])) {\n items.push(lines[i].replace(/^\\s*[-*]\\s+/, ''));\n i++;\n }\n blocks.push({ kind: 'ul', items });\n continue;\n }\n\n // Ordered list\n if (/^\\s*\\d+\\.\\s+/.test(line)) {\n const items: string[] = [];\n while (i < lines.length && /^\\s*\\d+\\.\\s+/.test(lines[i])) {\n items.push(lines[i].replace(/^\\s*\\d+\\.\\s+/, ''));\n i++;\n }\n blocks.push({ kind: 'ol', items });\n continue;\n }\n\n // Paragraph (consume until blank line or next block starter)\n const para: string[] = [];\n while (\n i < lines.length &&\n lines[i].trim() &&\n !/^```/.test(lines[i]) &&\n !/^#{1,6}\\s/.test(lines[i]) &&\n !/^\\s*[-*]\\s+/.test(lines[i]) &&\n !/^\\s*\\d+\\.\\s+/.test(lines[i]) &&\n !/^>\\s?/.test(lines[i]) &&\n !FIGURE_RE.test(lines[i]) &&\n !(lines[i].includes('|') && i + 1 < lines.length && isTableSep(lines[i + 1]))\n ) {\n para.push(lines[i]);\n i++;\n }\n if (para.length) blocks.push({ kind: 'paragraph', text: para.join(' ') });\n }\n\n return blocks;\n}\n\n// Inline renderer: bold, italic, inline code, and links. Splits on tokens and\n// returns React nodes so we never inject raw HTML for user-ish content.\nfunction renderInline(text: string, keyBase: string): React.ReactNode[] {\n const nodes: React.ReactNode[] = [];\n const re = /(!\\[[^\\]]*\\]\\([^)]+\\)|\\*\\*[^*]+\\*\\*|`[^`]+`|\\[[^\\]]+\\]\\([^)]+\\)|\\*[^*]+\\*)/g;\n let last = 0;\n let m: RegExpExecArray | null;\n let n = 0;\n while ((m = re.exec(text))) {\n if (m.index > last) nodes.push(text.slice(last, m.index));\n const tok = m[0];\n const key = `${keyBase}-${n++}`;\n if (tok.startsWith('![')) {\n const im = tok.match(/^!\\[([^\\]]*)\\]\\(([^)]+)\\)$/);\n if (im) {\n nodes.push(\n <img key={key} src={im[2]} alt={im[1]} loading=\"lazy\" className=\"inline-block max-w-full rounded\" />,\n );\n } else {\n nodes.push(tok);\n }\n } else if (tok.startsWith('**')) {\n nodes.push(<strong key={key} className=\"font-semibold text-white\">{tok.slice(2, -2)}</strong>);\n } else if (tok.startsWith('`')) {\n nodes.push(\n <code key={key} className=\"rounded bg-white/10 px-1.5 py-0.5 font-mono text-[0.85em] text-white/90\">\n {tok.slice(1, -1)}\n </code>,\n );\n } else if (tok.startsWith('[')) {\n const lm = tok.match(/^\\[([^\\]]+)\\]\\(([^)]+)\\)$/);\n if (lm) {\n const external = /^https?:\\/\\//.test(lm[2]);\n nodes.push(\n <a\n key={key}\n href={lm[2]}\n {...(external ? { target: '_blank', rel: 'noreferrer' } : {})}\n className=\"font-medium text-sky-400 underline-offset-2 hover:underline\"\n >\n {lm[1]}\n </a>,\n );\n } else {\n nodes.push(tok);\n }\n } else if (tok.startsWith('*')) {\n nodes.push(<em key={key} className=\"italic text-white/80\">{tok.slice(1, -1)}</em>);\n }\n last = m.index + tok.length;\n }\n if (last < text.length) nodes.push(text.slice(last));\n return nodes;\n}\n\nexport const Markdown: React.FC<{ source: string; className?: string }> = ({ source, className }) => {\n const blocks = React.useMemo(() => parseBlocks(source), [source]);\n\n return (\n <div className={className}>\n {blocks.map((b, idx) => {\n const key = `b-${idx}`;\n switch (b.kind) {\n case 'heading': {\n const cls =\n b.level <= 1\n ? 'mt-10 mb-4 text-3xl font-bold tracking-tight text-white'\n : b.level === 2\n ? 'mt-9 mb-3 text-2xl font-bold tracking-tight text-white'\n : 'mt-7 mb-2 text-lg font-semibold text-white';\n const id = b.text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');\n if (b.level <= 1) return <h1 key={key} id={id} className={cls}>{renderInline(b.text, key)}</h1>;\n if (b.level === 2) return <h2 key={key} id={id} className={cls}>{renderInline(b.text, key)}</h2>;\n return <h3 key={key} id={id} className={cls}>{renderInline(b.text, key)}</h3>;\n }\n case 'paragraph':\n return <p key={key} className=\"my-4 leading-7 text-white/72\">{renderInline(b.text, key)}</p>;\n case 'code':\n return <CodeBlock key={key} code={b.code} language={b.lang} className=\"my-5\" />;\n case 'ul':\n return (\n <ul key={key} className=\"my-4 list-disc space-y-1.5 pl-6 text-white/72 marker:text-white/30\">\n {b.items.map((it, j) => <li key={j} className=\"leading-7\">{renderInline(it, `${key}-${j}`)}</li>)}\n </ul>\n );\n case 'ol':\n return (\n <ol key={key} className=\"my-4 list-decimal space-y-1.5 pl-6 text-white/72 marker:text-white/40\">\n {b.items.map((it, j) => <li key={j} className=\"leading-7\">{renderInline(it, `${key}-${j}`)}</li>)}\n </ol>\n );\n case 'quote':\n return (\n <blockquote key={key} className=\"my-5 border-l-2 border-white/20 pl-4 text-white/60 italic\">\n {renderInline(b.text, key)}\n </blockquote>\n );\n case 'figure':\n return (\n <figure key={key} className=\"my-6\">\n <img\n src={b.src}\n alt={b.alt}\n loading=\"lazy\"\n className=\"mx-auto max-w-full rounded-xl border border-white/10\"\n />\n {b.alt ? (\n <figcaption className=\"mt-2 text-center text-xs text-white/45\">{b.alt}</figcaption>\n ) : null}\n </figure>\n );\n case 'hr':\n return <hr key={key} className=\"my-8 border-white/10\" />;\n case 'table':\n return (\n <div key={key} className=\"my-6 overflow-x-auto rounded-xl border border-white/10\">\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr className=\"bg-white/[0.04]\">\n {b.header.map((h, j) => (\n <th key={j} className=\"border-b border-white/10 px-3 py-2.5 text-left font-semibold text-white\">\n {renderInline(h, `${key}-h-${j}`)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {b.rows.map((row, r) => (\n <tr key={r} className=\"border-b border-white/5 last:border-0\">\n {row.map((c, j) => (\n <td key={j} className=\"px-3 py-2.5 align-top text-white/70\">\n {renderInline(c, `${key}-${r}-${j}`)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n default:\n return null;\n }\n })}\n </div>\n );\n};\n","import React from 'react';\nimport { ArrowLeft, ArrowRight, CheckCircle2, Cpu, Globe2, Layers, Route, Server, Sparkles } from 'lucide-react';\nimport { useLocationPath } from '../lib/router';\nimport { Markdown } from './Markdown';\nimport {\n alternativeBySlug,\n alternativeCategoryLabels,\n alternatives,\n type Alternative,\n type AlternativeCategory,\n} from './alternativesData';\n\nconst categoryOrder: AlternativeCategory[] = ['cloud-hosting', 'model-infra', 'agent-cloud'];\n\nconst categoryIcons: Record<AlternativeCategory, React.ReactNode> = {\n 'cloud-hosting': <Server className=\"h-4 w-4\" />,\n 'model-infra': <Cpu className=\"h-4 w-4\" />,\n 'agent-cloud': <Sparkles className=\"h-4 w-4\" />,\n};\n\nconst comparisonHighlights = [\n {\n icon: <Globe2 className=\"h-5 w-5\" />,\n title: 'Hosts the app',\n copy: 'Deploy static sites, server containers, domains, logs, queues, secrets, and private builds from the same product.',\n },\n {\n icon: <Sparkles className=\"h-5 w-5\" />,\n title: 'Runs the agents',\n copy: 'Cloud coding agents work on repos, create durable artifacts, and can hand off directly into deploy workflows.',\n },\n {\n icon: <Route className=\"h-5 w-5\" />,\n title: 'Routes the models',\n copy: 'One OpenAI-compatible gateway covers text, image, video, audio, embeddings, search, and 3D generation.',\n },\n {\n icon: <Layers className=\"h-5 w-5\" />,\n title: 'Owns GPU paths',\n copy: 'Cog and Comfy workloads can scale from zero to GPU capacity, then sleep again when the burst is over.',\n },\n];\n\nfunction groupedAlternatives() {\n return categoryOrder.map((category) => ({\n category,\n label: alternativeCategoryLabels[category],\n items: alternatives.filter((alt) => alt.category === category),\n }));\n}\n\nconst AlternativeDetail: React.FC<{ alt: Alternative }> = ({ alt }) => {\n React.useEffect(() => {\n if (typeof window !== 'undefined') window.scrollTo(0, 0);\n }, [alt.slug]);\n\n const related = alternatives.filter((item) => item.category === alt.category && item.slug !== alt.slug).slice(0, 4);\n\n return (\n <main className=\"px-4 pb-24 pt-28 sm:px-6\">\n <article className=\"mx-auto max-w-3xl\">\n <a href=\"/alternatives\" className=\"inline-flex items-center gap-1.5 text-sm font-medium text-white/45 hover:text-white\">\n <ArrowLeft size={15} /> All alternatives\n </a>\n\n <header className=\"mb-2 mt-4\">\n <div className=\"mb-3 flex flex-wrap items-center gap-3 text-xs text-white/40\">\n <span className=\"inline-flex items-center gap-1.5 rounded border border-white/10 bg-white/[0.04] px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em] text-white/45\">\n {categoryIcons[alt.category]}\n {alt.categoryLabel}\n </span>\n <a href={alt.url} className=\"text-white/40 underline decoration-white/15 underline-offset-4 hover:text-white/70\">\n {alt.competitor}\n </a>\n <span>{alt.readTime}</span>\n </div>\n <h1 className=\"text-3xl font-bold tracking-tight text-white sm:text-4xl\">{alt.title}</h1>\n <p className=\"mt-3 text-lg leading-7 text-white/60\">{alt.excerpt}</p>\n </header>\n\n <Markdown source={alt.body} className=\"mt-6\" />\n\n {related.length > 0 && (\n <section className=\"mt-14 border-t border-white/10 pt-7\">\n <div className=\"mb-4 font-mono text-xs uppercase tracking-[0.18em] text-white/40\">Related comparisons</div>\n <div className=\"grid gap-3 sm:grid-cols-2\">\n {related.map((item) => (\n <a\n key={item.slug}\n href={`/alternatives/${item.slug}`}\n className=\"group rounded-lg border border-white/10 bg-white/[0.02] p-4 transition-colors hover:border-white/24 hover:bg-white/[0.045]\"\n >\n <div className=\"text-sm font-semibold text-white/80 group-hover:text-white\">{item.competitor}</div>\n <div className=\"mt-1 text-xs leading-5 text-white/42\">{item.summary}</div>\n </a>\n ))}\n </div>\n </section>\n )}\n\n <footer className=\"mt-10 border-t border-white/10 pt-6\">\n <a href=\"/alternatives\" className=\"inline-flex items-center gap-1.5 text-sm font-semibold text-sky-400 hover:underline\">\n <ArrowLeft size={15} /> All alternatives\n </a>\n </footer>\n </article>\n </main>\n );\n};\n\nconst AlternativesIndex: React.FC = () => {\n const groups = groupedAlternatives();\n\n return (\n <main className=\"mx-auto max-w-7xl px-6 pb-24 pt-28\">\n <section className=\"mb-12 max-w-4xl\">\n <div className=\"mb-4 inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.03] px-3 py-1 font-mono text-xs uppercase tracking-[0.18em] text-white/45\">\n Alternatives\n </div>\n <h1 className=\"text-4xl font-semibold tracking-tight md:text-6xl\">\n Compare app.nz with cloud hosts and AI agent clouds.\n </h1>\n <p className=\"mt-5 max-w-3xl text-lg leading-relaxed text-white/58\">\n Fifty comparison guides for hosting platforms, model infrastructure providers, and AI coding-agent products. The short version: many tools are excellent specialists. app.nz is for teams that want agents, deploys, model routing, GPU endpoints, and app hosting in one place.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"/signup\" className=\"inline-flex items-center gap-2 rounded bg-sky-400 px-4 py-2 font-mono text-sm font-bold text-black transition-colors hover:bg-sky-300\">\n Start building <ArrowRight className=\"h-4 w-4\" />\n </a>\n <a href=\"/blog\" className=\"inline-flex items-center gap-2 rounded border border-white/12 px-4 py-2 font-mono text-sm text-white/70 transition-colors hover:border-white/30 hover:text-white\">\n Engineering blog\n </a>\n <a href=\"/blog/what-is-an-ai-agent-cloud\" className=\"inline-flex items-center gap-2 rounded border border-white/12 px-4 py-2 font-mono text-sm text-white/70 transition-colors hover:border-white/30 hover:text-white\">\n Why an agent cloud\n </a>\n </div>\n </section>\n\n <section className=\"mb-12 grid gap-4 md:grid-cols-2 lg:grid-cols-4\">\n {comparisonHighlights.map((item) => (\n <div key={item.title} className=\"rounded-lg border border-white/10 bg-white/[0.02] p-5\">\n <div className=\"mb-4 flex h-10 w-10 items-center justify-center rounded border border-white/10 bg-white/[0.04] text-white/70\">\n {item.icon}\n </div>\n <h2 className=\"mb-2 text-lg font-semibold tracking-tight\">{item.title}</h2>\n <p className=\"text-sm leading-relaxed text-white/48\">{item.copy}</p>\n </div>\n ))}\n </section>\n\n <section className=\"mb-14 overflow-hidden rounded-lg border border-white/10 bg-white/[0.02]\">\n <div className=\"grid border-b border-white/10 md:grid-cols-3\">\n {groups.map((group) => (\n <a\n key={group.category}\n href={`#${group.category}`}\n className=\"flex items-center justify-between gap-4 border-b border-white/10 p-5 transition-colors hover:bg-white/[0.035] md:border-b-0 md:border-r last:md:border-r-0\"\n >\n <span>\n <span className=\"flex items-center gap-2 font-mono text-xs uppercase tracking-[0.18em] text-white/40\">\n {categoryIcons[group.category]}\n {group.label}\n </span>\n <span className=\"mt-2 block text-2xl font-semibold text-white\">{group.items.length}</span>\n </span>\n <ArrowRight className=\"h-4 w-4 text-white/35\" />\n </a>\n ))}\n </div>\n <div className=\"grid gap-0 md:grid-cols-3\">\n {['Respect the specialist', 'Explain the tradeoff', 'Prefer truthful scope', 'Link to competitors', 'Show app.nz fit', 'Avoid fake benchmark claims'].map((feature) => (\n <div key={feature} className=\"flex items-center gap-3 border-b border-white/8 px-5 py-4 text-sm text-white/58 md:border-r\">\n <CheckCircle2 className=\"h-4 w-4 flex-none text-emerald-300\" />\n {feature}\n </div>\n ))}\n </div>\n </section>\n\n {groups.map((group) => (\n <section key={group.category} id={group.category} className=\"mb-16 scroll-mt-24\">\n <div className=\"mb-6 flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between\">\n <div>\n <div className=\"flex items-center gap-2 font-mono text-xs uppercase tracking-[0.18em] text-white/40\">\n {categoryIcons[group.category]}\n {group.label}\n </div>\n <h2 className=\"mt-2 text-3xl font-semibold tracking-tight\">{group.items.length} alternatives</h2>\n </div>\n </div>\n\n <div className=\"grid gap-4 md:grid-cols-2\">\n {group.items.map((alt) => (\n <a\n key={alt.slug}\n href={`/alternatives/${alt.slug}`}\n className=\"group block h-full rounded-lg border border-white/10 bg-white/[0.02] p-6 transition-all hover:border-white/24 hover:bg-white/[0.045]\"\n >\n <div className=\"mb-4 flex flex-wrap items-center gap-2\">\n <span className=\"rounded border border-white/10 bg-white/[0.04] px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em] text-white/45\">\n {alt.categoryLabel}\n </span>\n <span className=\"font-mono text-xs text-white/28\">{alt.readTime}</span>\n </div>\n <h3 className=\"mb-3 text-xl font-semibold tracking-tight transition-colors group-hover:text-white\">\n {alt.title}\n </h3>\n <p className=\"mb-6 text-sm leading-relaxed text-white/50\">\n {alt.excerpt}\n </p>\n <div className=\"flex items-center gap-2 font-mono text-sm text-white/40 transition-colors group-hover:text-white\">\n Read comparison <ArrowRight className=\"h-4 w-4\" />\n </div>\n </a>\n ))}\n </div>\n </section>\n ))}\n </main>\n );\n};\n\nconst AlternativesPage: React.FC<{ path?: string }> = ({ path: pathProp }) => {\n const path = useLocationPath(pathProp);\n const slug = React.useMemo(() => {\n const m = path.match(/^\\/alternatives\\/([^/?#]+)/);\n return m ? decodeURIComponent(m[1]) : '';\n }, [path]);\n\n const alt = slug ? alternativeBySlug[slug] : undefined;\n\n if (slug && alt) return <AlternativeDetail alt={alt} />;\n\n if (slug && !alt) {\n return (\n <main className=\"px-4 pb-24 pt-28\">\n <div className=\"mx-auto max-w-2xl text-center\">\n <h1 className=\"text-2xl font-bold text-white\">Alternative not found</h1>\n <a href=\"/alternatives\" className=\"mt-6 inline-flex items-center gap-2 text-sm font-semibold text-sky-400 hover:underline\">\n <ArrowLeft size={15} /> All alternatives\n </a>\n </div>\n </main>\n );\n }\n\n return <AlternativesIndex />;\n};\n\nexport default AlternativesPage;\n","import { Project } from './types';\n\nexport const PROJECTS: Project[] = [\n {\n id: 'codex-infinity',\n title: 'Codex Infinity',\n subtitle: 'Autonomous coding-agent platform',\n description: 'Cloud fleet orchestration, GitHub integration, streamed agent sessions, CI repair loops, and multi-model coding workflows.',\n url: 'https://codex-infinity.com',\n technologies: ['Go', 'React', 'GitHub', 'AI Agents'],\n category: 'flagship',\n image: '/assets/codex-infinity.webp',\n color: 'from-sky-500 to-cyan-300',\n },\n {\n id: 'openpaths',\n title: 'OpenPaths',\n subtitle: 'OpenAI-compatible model gateway',\n description: 'Provider routing across chat, image, video, music, speech, transcription, and embeddings with reasoning controls and unified API shape.',\n url: 'https://openpaths.io',\n github: 'https://codex-infinity.com/lee101/openpaths',\n technologies: ['Go', 'LLMs', 'API Gateway', 'Routing'],\n category: 'flagship',\n image: '/assets/openpaths.svg',\n color: 'from-emerald-400 to-teal-500',\n },\n {\n id: 'cutedsl',\n title: 'CuteDSL',\n subtitle: 'AI acceleration and kernels',\n description: 'Custom CUDA/Triton kernels, fused model pipelines, Chronos-2 acceleration, and an API surface for fast AI inference and training.',\n url: 'https://cutedsl.app.nz',\n github: 'https://codex-infinity.com/lee101/cutedsl',\n technologies: ['CUDA', 'Triton', 'PyTorch', 'Compilers'],\n category: 'flagship',\n image: '/assets/cutedsl.webp',\n color: 'from-orange-400 to-red-500',\n },\n {\n id: 'netwrck',\n title: 'Netwrck',\n subtitle: 'AI media and community network',\n description: 'Social AI community with chatbots, stories, generated art, voices, and agent-style entertainment experiences.',\n url: 'https://netwrck.com',\n technologies: ['PyTorch', 'Hugging Face', 'Agents', 'Media'],\n category: 'flagship',\n image: '/assets/netwrck.webp',\n color: 'from-fuchsia-500 to-rose-500',\n },\n {\n id: 'ebank',\n title: 'eBank.nz Art Generator',\n subtitle: 'AI art generation and editing',\n description: 'HD diffusion outputs, prompt discovery, style workflows, image editing, and subscription-backed generation capacity.',\n url: 'https://ebank.nz',\n technologies: ['Diffusion', 'LoRA', 'CLIP', 'GPU Serving'],\n category: 'flagship',\n image: '/assets/ebank.webp',\n color: 'from-blue-500 to-indigo-500',\n },\n {\n id: 'text-generator',\n title: 'Text Generator',\n subtitle: 'Unified AI API and model stack',\n description: 'Text, speech, vision, code generation, prompt tooling, OCR/caption enrichment, and self-hostable model-serving infrastructure.',\n url: 'https://text-generator.io',\n github: 'https://github.com/TextGeneratorio/text-generator.io',\n technologies: ['LLMs', 'Speech', 'Vision', 'Model Serving'],\n category: 'flagship',\n image: '/assets/text-generator.webp',\n color: 'from-lime-400 to-emerald-500',\n },\n {\n id: 'dictatorflow',\n title: 'DictatorFlow',\n subtitle: 'Speech control and dictation',\n description: 'Desktop and browser dictation with hotkey recording, local GPU Parakeet ONNX transcription, cloud fallback, command mode, and transcript history.',\n url: 'https://dictatorflow.com',\n technologies: ['Speech', 'ONNX', 'GPU', 'Desktop'],\n category: 'innovation',\n image: '/assets/dictatorflow.webp',\n },\n {\n id: 'simplexgen',\n title: 'SimplexGen',\n subtitle: '3D generation and editing',\n description: 'Go-backed 3D generation app with Vite frontend, local asset indexing, mesh tools, generation queues, billing, and R2 storage.',\n url: 'https://simplexgen.com',\n technologies: ['Go', 'Three.js', '3D', 'R2'],\n category: 'innovation',\n image: '/assets/simplexgen.webp',\n },\n {\n id: 'etherealstorm',\n title: 'Ethereal Storm',\n subtitle: 'Go/Ebiten action game',\n description: 'Twin-stick bullet hell with co-op, procedural terrain, wave survival, bosses, spell combinations, progression, and dynamic audio.',\n url: 'https://etherealstorm.app.nz',\n technologies: ['Go', 'Ebiten', 'Game AI', 'Procedural'],\n category: 'innovation',\n image: '/assets/etherealstorm.webp',\n },\n {\n id: 'ring',\n title: 'Ring.nz',\n subtitle: 'Voice chat with AI friends',\n description: 'Voice and product communication experiments for real-time AI conversations and friend-like AI interaction.',\n url: 'https://ring.nz',\n technologies: ['Voice', 'Realtime', 'AI UX'],\n category: 'innovation',\n image: '/assets/ring.webp',\n },\n {\n id: 'gpubrain',\n title: 'GPUBrain',\n subtitle: '1ms instant GPU search',\n description: 'GPU-accelerated agent memory — sub-millisecond semantic + keyword retrieval at scale, MCP tools, knowledge graph links, and CLI workflows.',\n url: 'https://gobrain.app.nz',\n github: 'https://codex-infinity.com/lee101/gobrain',\n technologies: ['CUDA', 'Postgres', 'Embeddings', 'MCP'],\n category: 'innovation',\n image: '/assets/gobrain-brain-chip.webp',\n },\n {\n id: 'papers',\n title: 'Papers',\n subtitle: 'Research search engine',\n description: 'Search engine for papers, code, methods, datasets, and evals with semantic search, crawler jobs, GPU acceleration, and CUDA optimization.',\n url: '/papers',\n technologies: ['Search', 'CAGRA', 'CUDA', 'Crawlers'],\n category: 'innovation',\n image: '/assets/papers.webp',\n },\n {\n id: 'stock-prediction',\n title: 'Stock Prediction',\n subtitle: 'Market forecasting research',\n description: 'Auto-research and RL trading experiments over Alpaca/Binance, selector evaluation, Chronos-style forecasting, and realistic portfolio probes.',\n github: 'https://codex-infinity.com/lee101/stock-prediction',\n technologies: ['RL', 'Forecasting', 'Chronos', 'Backtests'],\n category: 'innovation',\n image: '/assets/stock-prediction.webp',\n },\n {\n id: 'helix',\n title: 'Helix',\n subtitle: 'AI data analyst',\n description: 'AI data scientist product for interpreting datasets, generating insights, and automating reporting with model-backed analysis workflows.',\n url: 'https://helix.app.nz',\n technologies: ['Analytics', 'LLMs', 'Reports'],\n category: 'innovation',\n image: '/assets/helix.webp',\n },\n {\n id: 'experimentflow',\n title: 'ExperimentFlow',\n subtitle: 'Online learning and RL platform',\n description: 'Neural contextual bandits, policy optimization, and continual personalization that keeps improving in production.',\n url: 'https://experimentflow.com',\n technologies: ['Bandits', 'RL', 'Optimization'],\n category: 'innovation',\n image: '/assets/experimentflow-icon.webp',\n },\n {\n id: 'hires',\n title: 'Hires.nz',\n subtitle: 'Recruitment and marketplace experiments',\n description: 'Recruitment/product experiments in the SimplexGen workspace with deployed web assets and Go-backed services.',\n technologies: ['Go', 'Marketplace', 'Recruitment'],\n category: 'innovation',\n image: '/assets/hires.webp',\n },\n {\n id: 'stable-diffusion-server',\n title: 'Stable Diffusion Server',\n subtitle: 'Production image generation server',\n description: 'Flux/SDXL, ControlNet, inpainting, R2/GCS storage, FastAPI, and Gradio tooling for production image generation.',\n github: 'https://github.com/netwrck/stable-diffusion-server',\n technologies: ['FastAPI', 'Flux', 'SDXL', 'ControlNet'],\n category: 'opensource',\n image: '/assets/netwrck.webp',\n },\n {\n id: 'gpubrain-search',\n title: 'GPUBrain Search Engine',\n subtitle: '1ms GPU-native retrieval',\n description: 'Open-source engine behind GPUBrain — Postgres-backed semantic search, BM25, RRF fusion, MCP server, REST API, and CLI.',\n github: 'https://codex-infinity.com/lee101/gobrain',\n technologies: ['Postgres', 'BM25', 'RRF', 'MCP'],\n category: 'opensource',\n image: '/assets/gobrain-brain-chip.webp',\n },\n {\n id: 'how',\n title: 'How.nz',\n subtitle: 'Technical writing archive',\n description: 'Programming, performance, networking, algorithms, graphics, and game-system design writing since 2015.',\n url: 'https://how.nz',\n technologies: ['Writing', 'Systems', 'Graphics'],\n category: 'classic',\n image: '/assets/how.webp',\n },\n {\n id: 'bitbank',\n title: 'BitBank.nz',\n subtitle: 'Live crypto forecasting',\n description: 'Cryptocurrency prediction dashboard using time-series transformers, RL trading policies, PufferLib agents, custom CUDA/C++ kernels, and Triton.',\n url: 'https://bitbank.nz',\n technologies: ['Chronos', 'TimesFM', 'RL', 'Triton'],\n category: 'classic',\n image: '/assets/bitbank.webp',\n },\n {\n id: 'stackhack',\n title: 'StackHack',\n subtitle: 'AI stack analysis',\n description: 'AI tech-stack analysis tool for breaking down websites, libraries, frameworks, and implementation choices with LLMs.',\n url: 'https://stackhack.netwrck.com',\n technologies: ['LLMs', 'NLP', 'Web Analysis'],\n category: 'classic',\n image: '/assets/stackhack.webp',\n },\n {\n id: 'websim',\n title: 'WebSim',\n subtitle: 'AI website simulator',\n description: 'Website simulator for generating and iterating web pages with language models, Python services, and browser tooling.',\n url: 'https://websim.netwrck.com',\n technologies: ['LLMs', 'Python', 'Browser Tooling'],\n category: 'classic',\n image: '/assets/websim.webp',\n },\n {\n id: 'mojojojo',\n title: 'mojojojo',\n subtitle: 'Python execution billed by the millisecond',\n description: 'Send Python, get output, pay for the milliseconds it ran. Numeric loops are transpiled to Mojo and cached so repeat kernels run natively; everything else is real CPython with uv-installed packages. Runs free in your browser via WebAssembly and only falls back to our machines when it needs a GPU or a package wasm cannot build. Signs in with your app.nz account and shared credits.',\n url: 'https://mojojojo.app.nz',\n technologies: ['Mojo', 'Go', 'WebAssembly', 'Serverless Compute'],\n category: 'classic',\n image: '/assets/mojojojo.webp',\n },\n {\n id: 'readingtime',\n title: 'Reading Time',\n subtitle: 'AI picture-book studio & reader',\n description: 'AI storytelling & reading app for kids. Generate fully illustrated picture books with your choice of story and image models, then read along as each word lights up. Signs in with your app.nz account and uses your shared credits.',\n url: 'https://readingtime.app.nz',\n technologies: ['Go', 'AI Story Gen', 'Image Models', 'Education'],\n category: 'classic',\n image: '/assets/readingtime.webp',\n },\n {\n id: 'big-multiplayer-chess',\n title: 'Big Multiplayer Chess',\n subtitle: 'Many-player chess variant',\n description: 'Large-board chess with move generation, game heuristics, AI evaluation, and mobile constraints.',\n url: 'https://bigmultiplayerchess.v5games.com',\n technologies: ['Python', 'Game AI', 'JavaScript'],\n category: 'classic',\n image: '/assets/big-multiplayer-chess.webp',\n },\n {\n id: 'webfiddle',\n title: 'WebFiddle',\n subtitle: 'Edit and share the web',\n description: 'Tool for modifying pages, storing the resulting state, and sharing the result back through a link.',\n url: 'https://webfiddle.net',\n technologies: ['Python', 'App Engine', 'JavaScript'],\n category: 'classic',\n image: '/assets/webfiddle.webp',\n },\n {\n id: 'reword',\n title: 'reWord',\n subtitle: 'Sentence puzzle game',\n description: 'Language puzzle game built with Python, Google App Engine, and JavaScript.',\n url: 'https://rewordgame.com',\n technologies: ['Python', 'JavaScript', 'Game'],\n category: 'classic',\n image: '/assets/rewordgame.webp',\n },\n {\n id: 'evangeler',\n title: 'Evangeler',\n subtitle: 'Viral marketing product',\n description: 'Campaign product with Python, Backbone, Facebook integrations, and viral campaign mechanics.',\n url: 'https://evangeler.com',\n technologies: ['Python', 'Backbone', 'Facebook API'],\n category: 'classic',\n image: '/assets/evangeler.webp',\n },\n {\n id: 'multiplicationmaster',\n title: 'Multiplication Master',\n subtitle: 'Education game',\n description: 'Math practice game built with Python, Bootstrap, JavaScript, and Google App Engine.',\n url: 'https://multiplicationmaster.com',\n technologies: ['Python', 'Bootstrap', 'Education'],\n category: 'classic',\n image: '/assets/multiplicationmaster.webp',\n },\n {\n id: 'addicting-word-games',\n title: 'Addicting Word Games',\n subtitle: 'Word game portal',\n description: 'Word-game portal built with Python, Bootstrap, JavaScript, and Google App Engine.',\n url: 'https://addictingwordgames.com',\n technologies: ['Python', 'Bootstrap', 'Word Games'],\n category: 'classic',\n image: '/assets/addicting-word-games.webp',\n },\n {\n id: 'joydrop',\n title: 'Joy Drop',\n subtitle: 'Kids creative app',\n description: 'Creative drag-and-drop app for kids, now being rebuilt with transparency-aware touch gestures and paid access.',\n url: 'https://joydrop.app.nz',\n technologies: ['JavaScript', 'Go', 'Touch UX'],\n category: 'classic',\n image: '/assets/joydrop.webp',\n },\n {\n id: 'wordsmashing',\n title: 'Word Smashing',\n subtitle: 'Word puzzle game',\n description: 'Word puzzle across Python, Bootstrap, JavaScript, App Engine, and browser/mobile packaging.',\n url: 'https://wordsmashing.v5games.com',\n technologies: ['Python', 'JavaScript', 'Game'],\n category: 'classic',\n image: '/assets/wordsmashing.webp',\n },\n {\n id: 'shoppingsmart',\n title: 'Shopping Smart',\n subtitle: 'NZ price comparison',\n description: 'Price-comparison product with ASP.NET, C#, MVC, ecommerce crawling, and marketplace-style data handling.',\n github: 'https://codex-infinity.com/lee101/shoppingsmart-old',\n technologies: ['ASP.NET', 'C#', 'Ecommerce'],\n category: 'classic',\n image: '/assets/shoppingsmart.webp',\n },\n];\n\nexport const EXPERIENCE = [\n 'Founder and builder of an applied AI product ecosystem across coding agents, model gateways, media generation, search, speech, data analysis, games, and infrastructure.',\n 'Senior Machine Learning Engineer at Microsoft, Founding Machine Learning Engineer at Compose.ai YC W21, and Image Processing / ML Engineer at Canva.',\n 'Earlier engineering across Fairfax Media, Weta Digital Motion R&D, .nz Registry Services, Infoxchange, 99designs, Kiwiplan, and the University of Auckland.',\n];\n\nexport const INTERESTS = [\n 'Machine learning, acceleration, CUDA/Triton kernels, model serving, embeddings, interpretability, and AI/human interaction.',\n 'Search, data analytics, scientific tooling, big data systems, graphics, VFX, games, web systems, security, automation, and testing.',\n];\n\nexport const CONTACT_EMAIL = 'lee.penkman@netwrck.com';\n","import React from 'react';\nimport { CONTACT_EMAIL } from '../../constants';\n\nexport const INVESTOR_DOCS = [\n { href: '/investors', label: 'Investor Room' },\n { href: '/investors/vision', label: '10-Year Vision' },\n { href: '/investors/deep-dive', label: 'Technical Deep Dive' },\n] as const;\n\nexport const InvestorsSubnav: React.FC<{ active: string }> = ({ active }) => (\n <nav aria-label=\"Investor documents\" className=\"flex flex-wrap items-center gap-2\">\n {INVESTOR_DOCS.map((doc) => (\n <a\n key={doc.href}\n href={doc.href}\n aria-current={active === doc.href ? 'page' : undefined}\n className={\n active === doc.href\n ? 'rounded-full bg-sky-400 px-4 py-1.5 text-xs font-bold text-black'\n : 'rounded-full border border-white/12 bg-white/[0.04] px-4 py-1.5 text-xs font-semibold text-white/70 transition hover:border-white/25 hover:text-white'\n }\n >\n {doc.label}\n </a>\n ))}\n </nav>\n);\n\nexport const Eyebrow: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">{children}</p>\n);\n\nexport const DocSection: React.FC<{ id: string; num?: string; title: string; children: React.ReactNode }> = ({ id, num, title, children }) => (\n <section id={id} className=\"scroll-mt-28 border-t border-white/10 pt-10\">\n <h2 className=\"font-display text-2xl font-bold tracking-tight sm:text-3xl\">\n {num ? <span className=\"mr-3 text-white/30\">{num}</span> : null}\n {title}\n </h2>\n <div className=\"mt-5 space-y-4 text-[15px] leading-8 text-white/72\">{children}</div>\n </section>\n);\n\nexport const DocH3: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <h3 className=\"pt-4 font-display text-lg font-bold tracking-tight text-white\">{children}</h3>\n);\n\nexport const Callout: React.FC<{ label?: string; children: React.ReactNode }> = ({ label, children }) => (\n <div className=\"rounded-2xl border border-sky-400/25 bg-sky-400/[0.06] p-5 text-[15px] leading-7 text-white/80\">\n {label ? <p className=\"mb-2 text-xs font-bold uppercase tracking-[0.18em] text-sky-400\">{label}</p> : null}\n {children}\n </div>\n);\n\nexport const FactGrid: React.FC<{ items: { k: string; v: string }[] }> = ({ items }) => (\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n {items.map((it) => (\n <div key={it.k} className=\"rounded-xl border border-white/10 bg-white/[0.04] p-4\">\n <p className=\"font-display text-xl font-bold text-white\">{it.v}</p>\n <p className=\"mt-1 text-xs leading-5 text-white/55\">{it.k}</p>\n </div>\n ))}\n </div>\n);\n\nexport const DocTable: React.FC<{ head: string[]; rows: string[][] }> = ({ head, rows }) => (\n <div className=\"overflow-x-auto rounded-2xl border border-white/10\">\n <table className=\"w-full min-w-[560px] text-left text-sm\">\n <thead>\n <tr className=\"border-b border-white/10 bg-white/[0.04]\">\n {head.map((h) => (\n <th key={h} className=\"px-4 py-3 text-xs font-bold uppercase tracking-[0.14em] text-white/55\">{h}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((r, i) => (\n <tr key={i} className=\"border-b border-white/5 last:border-0\">\n {r.map((c, j) => (\n <td key={j} className={`px-4 py-3 leading-6 ${j === 0 ? 'font-semibold text-white' : 'text-white/68'}`}>{c}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n);\n\nexport const InvestorsContactCta: React.FC = () => (\n <section className=\"border-t border-white/10 py-14\">\n <div className=\"relative overflow-hidden rounded-3xl border border-white/10 bg-white/[0.03] px-6 py-12 text-center sm:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(56,189,248,0.14),transparent_60%)]\" />\n <div className=\"relative\">\n <h2 className=\"font-display text-2xl font-bold tracking-tight sm:text-4xl\">Diligence in the open</h2>\n <p className=\"mx-auto mt-4 max-w-2xl text-[15px] leading-8 text-white/70\">\n Every claim in this room links to a live product surface, a public repo, or a published document.\n Read the docs, run the platform, then talk to us.\n </p>\n <div className=\"mt-8 flex flex-wrap items-center justify-center gap-3\">\n <a href={`mailto:${CONTACT_EMAIL}?subject=${encodeURIComponent('Investor conversation — app.nz')}`} className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n Contact the founder\n </a>\n <a href=\"/signup\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n Try the product\n </a>\n </div>\n </div>\n </div>\n </section>\n);\n","import React from 'react';\nimport {\n ArrowRight,\n BookOpen,\n Bot,\n Cpu,\n FileText,\n GitBranch,\n Globe,\n Infinity as InfinityIcon,\n Layers,\n LockOpen,\n Network,\n Palette,\n ShieldCheck,\n Workflow,\n Zap,\n} from 'lucide-react';\nimport { Eyebrow, InvestorsContactCta, InvestorsSubnav } from './InvestorsShared';\n\ntype IconType = React.ComponentType<{ size?: number; className?: string }>;\n\nconst documents: { title: string; eyebrow: string; description: string; href: string; icon: IconType; meta: string }[] = [\n {\n title: '10-Year Vision',\n eyebrow: 'why we exist',\n description:\n 'Why software creation is collapsing in cost, why the winners own the loop from intent to running system, and the decade arc from agent cloud to self-organizing software.',\n href: '/investors/vision',\n icon: BookOpen,\n meta: 'Long-form essay · public',\n },\n {\n title: 'Technical Deep Dive',\n eyebrow: 'for partners who dig',\n description:\n 'Architecture, auto-optimizing infrastructure, model routing, security, economics, benchmarks methodology, roadmap, and risks — the full technical document.',\n href: '/investors/deep-dive',\n icon: FileText,\n meta: '16 chapters · public',\n },\n {\n title: 'Security posture',\n eyebrow: 'how we protect workloads',\n description: 'Isolation model, secret handling, CI log scrubbing, and the standing security practices behind agent execution and hosting.',\n href: '/security',\n icon: ShieldCheck,\n meta: 'Product page',\n },\n {\n title: 'Docs & API reference',\n eyebrow: 'the actual surface',\n description: 'Every endpoint the platform exposes — the same docs customers build against. The product is the data room.',\n href: '/docs',\n icon: GitBranch,\n meta: 'Live reference',\n },\n];\n\nconst thesisPoints = [\n {\n icon: Bot,\n title: 'Agents are the new developers',\n body: 'Autonomous coding agents already branch, edit, test, and open PRs on app.nz today. The number of software operators is about to be dominated by agents, not people — and they need a cloud built for them.',\n },\n {\n icon: Layers,\n title: 'One account, the whole loop',\n body: 'Repos, model routing across 20+ providers, GPU compute, hosting, CI, editors for every medium, and search — one balance, one key. Owning the loop from intent to running system is the moat.',\n },\n {\n icon: Zap,\n title: 'Infrastructure that optimizes itself',\n body: 'Routing decisions made in a sub-millisecond budget pick the best model and the cheapest capable GPU across serverless and hosted pods on any provider. Margin compounds as routing gets smarter.',\n },\n {\n icon: Globe,\n title: 'Compounding open surface',\n body: 'Live products — papers, reading, charts, memory — are built on the platform itself, dogfooding every layer. Public repos, public docs, public investor room.',\n },\n];\n\nconst longTermBets: { icon: IconType; title: string; body: string; href: string }[] = [\n {\n icon: Network,\n title: 'Auto-optimizing infra',\n body: 'A learned router with a ~1 ms decision budget arbitrages price, latency, and quality across every GPU provider — serverless, spot, and hosted pods — continuously, per request.',\n href: '/investors/deep-dive#auto-optimizing-infra',\n },\n {\n icon: Palette,\n title: 'Rich editors for every medium',\n body: 'Video, audio, image, vector, slides, sheets, docs, 3D, animation, whiteboard — AI-native editors sharing one asset store, one credit balance, and one agent runtime.',\n href: '/investors/deep-dive#editors',\n },\n {\n icon: Workflow,\n title: 'Self-organizing software',\n body: 'Systems that watch their own telemetry, propose and test their own changes, and restructure themselves under review gates — software that maintains software.',\n href: '/investors/deep-dive#self-organizing-software',\n },\n {\n icon: InfinityIcon,\n title: 'Run-forever agents',\n body: 'Agents with durable memory, budgets, and escalation rules that operate for months: watching queues, repairing CI, renegotiating infra, and shipping improvements while you sleep.',\n href: '/investors/deep-dive#run-forever-agents',\n },\n];\n\nconst roomFacts = [\n { k: 'model providers routed through one API', v: '20+' },\n { k: 'AI-native editors and studios live today', v: '12' },\n { k: 'routing decision budget per request', v: '~1 ms' },\n { k: 'of this investor room is public and versioned', v: '100%' },\n];\n\nexport const InvestorsPage: React.FC = () => (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-14 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(56,189,248,0.12),transparent_55%)]\" />\n <div className=\"relative mx-auto max-w-5xl\">\n <div className=\"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.18em] text-white/58\">\n <LockOpen size={12} className=\"text-sky-400\" />\n Open-source investor room\n </div>\n <h1 className=\"mt-6 max-w-[18ch] font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-6xl\">\n The data room is public. The product is the pitch.\n </h1>\n <p className=\"mt-6 max-w-2xl text-base leading-8 text-white/72\">\n app.nz is the cloud where AI agents build, ship, and run software: hosted repos, autonomous coding\n agents, model routing across 20+ providers, GPU compute, hosting, and AI-native editors for every\n content type — on one account. This room holds the documents we would hand any serious partner,\n published for everyone.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"/investors/vision\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n Read the 10-year vision <ArrowRight size={16} />\n </a>\n <a href=\"/investors/deep-dive\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n Technical deep dive\n </a>\n </div>\n <div className=\"mt-10\">\n <InvestorsSubnav active=\"/investors\" />\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <Eyebrow>the thesis</Eyebrow>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Why this company should exist</h2>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n The marginal cost of writing software is collapsing. What remains scarce is everything around the\n code: the repos, the compute, the models, the deploys, the review loops, and the trust. app.nz is\n built to own that remaining scarcity — the full loop from intent to running system — for a world\n where most software is written and operated by agents.\n </p>\n <div className=\"mt-8 grid gap-4 sm:grid-cols-2\">\n {thesisPoints.map((p) => (\n <div key={p.title} className=\"rounded-2xl border border-white/10 bg-white/[0.04] p-6 transition hover:border-white/25 hover:bg-white/[0.05]\">\n <p.icon size={20} className=\"text-sky-400\" />\n <h3 className=\"mt-4 font-display text-lg font-bold\">{p.title}</h3>\n <p className=\"mt-2 text-sm leading-7 text-white/68\">{p.body}</p>\n </div>\n ))}\n </div>\n <div className=\"mt-8 grid gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n {roomFacts.map((f) => (\n <div key={f.k} className=\"rounded-xl border border-white/10 bg-white/[0.04] p-4\">\n <p className=\"font-display text-2xl font-bold text-sky-400\">{f.v}</p>\n <p className=\"mt-1 text-xs leading-5 text-white/55\">{f.k}</p>\n </div>\n ))}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <Eyebrow>the documents</Eyebrow>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Read what we would send you anyway</h2>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n Investor updates that live in a private PDF go stale the day they are exported. Ours are pages on\n the product, versioned in the repo, and updated the way we update code — in public, under review.\n </p>\n <div className=\"mt-8 grid gap-4 sm:grid-cols-2\">\n {documents.map((d) => (\n <a key={d.title} href={d.href} className=\"group rounded-2xl border border-white/10 bg-white/[0.04] p-6 transition hover:border-sky-400/40 hover:bg-white/[0.05]\">\n <div className=\"flex items-center justify-between\">\n <d.icon size={20} className=\"text-sky-400\" />\n <span className=\"text-[11px] font-semibold uppercase tracking-[0.16em] text-white/40\">{d.meta}</span>\n </div>\n <p className=\"mt-4 text-[11px] font-bold uppercase tracking-[0.18em] text-white/45\">{d.eyebrow}</p>\n <h3 className=\"mt-1 font-display text-xl font-bold group-hover:text-sky-300\">{d.title}</h3>\n <p className=\"mt-2 text-sm leading-7 text-white/68\">{d.description}</p>\n <span className=\"mt-4 inline-flex items-center gap-1 text-sm font-semibold text-sky-400\">\n Read <ArrowRight size={14} className=\"transition group-hover:translate-x-0.5\" />\n </span>\n </a>\n ))}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <Eyebrow>the long game</Eyebrow>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Four bets we are making for the decade</h2>\n <div className=\"mt-8 grid gap-4 lg:grid-cols-2\">\n {longTermBets.map((b) => (\n <a key={b.title} href={b.href} className=\"group flex gap-4 rounded-2xl border border-white/10 bg-white/[0.04] p-6 transition hover:border-sky-400/40 hover:bg-white/[0.05]\">\n <div className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-sky-400/25 bg-sky-400/10\">\n <b.icon size={18} className=\"text-sky-400\" />\n </div>\n <div>\n <h3 className=\"font-display text-lg font-bold group-hover:text-sky-300\">{b.title}</h3>\n <p className=\"mt-2 text-sm leading-7 text-white/68\">{b.body}</p>\n </div>\n </a>\n ))}\n </div>\n <div className=\"mt-8 rounded-2xl border border-white/10 bg-white/[0.03] p-6\">\n <div className=\"flex items-start gap-4\">\n <Cpu size={20} className=\"mt-1 shrink-0 text-sky-400\" />\n <p className=\"text-sm leading-7 text-white/68\">\n These are not slideware. The routing gateway, the agent runtime, the editors, and the GPU\n hosting all exist and bill customers today — the bets above describe where each of those lines\n of code is headed. The <a href=\"/investors/deep-dive\" className=\"font-semibold text-sky-400 hover:text-sky-300\">deep dive</a> maps\n every bet to what is live now, what ships next, and what is research.\n </p>\n </div>\n </div>\n </div>\n </section>\n\n <div className=\"px-4 sm:px-8 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <InvestorsContactCta />\n </div>\n </div>\n </main>\n);\n\nexport default InvestorsPage;\n","import React from 'react';\nimport { Callout, DocSection, Eyebrow, FactGrid, InvestorsContactCta, InvestorsSubnav } from './InvestorsShared';\n\nconst eraRows = [\n {\n era: '2026 — 2028',\n name: 'The agent cloud',\n body: 'Agents become the primary users of developer infrastructure. We win the account that agents bill against: repos, routing, compute, hosting, editors — one balance. Every product surface doubles as a tool an agent can call.',\n },\n {\n era: '2028 — 2031',\n name: 'Infrastructure that optimizes itself',\n body: 'The router stops being a lookup table and becomes a learned system: per-request price/latency/quality arbitrage across every model and every GPU provider, serverless or hosted, within a millisecond budget. Customers stop making infrastructure decisions because the platform makes better ones.',\n },\n {\n era: '2031 — 2036',\n name: 'Self-organizing software',\n body: 'Software that watches its own telemetry, files its own issues, proposes and tests its own changes, and restructures itself under human-set review gates. Run-forever agents operate businesses’ software estates continuously. The platform is the substrate they live on.',\n },\n];\n\nexport const InvestorsVisionPage: React.FC = () => (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-12 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(56,189,248,0.10),transparent_55%)]\" />\n <div className=\"relative mx-auto max-w-3xl\">\n <Eyebrow>investor room · document 1 of 2</Eyebrow>\n <h1 className=\"mt-4 font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-5xl\">\n The 10-Year Vision\n </h1>\n <p className=\"mt-5 text-base leading-8 text-white/72\">\n Why app.nz should exist, why the opportunity is enormous, and what we intend to build over the\n next decade. Written to be read start to finish; updated in public as the thesis sharpens.\n </p>\n <div className=\"mt-8\">\n <InvestorsSubnav active=\"/investors/vision\" />\n </div>\n </div>\n </section>\n\n <div className=\"px-4 sm:px-8 lg:px-12\">\n <div className=\"mx-auto max-w-3xl space-y-12 py-12\">\n <DocSection id=\"premise\" title=\"The premise\">\n <p>\n For seventy years, the limiting factor on software was people who could write it. Every\n abstraction — compilers, open source, cloud, SaaS — was a lever on scarce human attention, and\n every one of those levers created a bigger industry than the one it disrupted. Language models\n are the last lever: they remove the human from the inner loop of writing code entirely.\n </p>\n <p>\n When the marginal cost of producing software falls toward the cost of the compute that writes\n it, the volume of software explodes. Not tenfold — the way web pages exploded when publishing\n stopped requiring a printing press. Billions of programs, most written by agents, most maintained\n by agents, many with no human who has ever read the source.\n </p>\n <p>\n That world does not need another IDE. It needs the thing every one of those programs must have:\n somewhere to live. Repos to version them, models to power them, GPUs to run them, deploys to\n serve them, budgets to constrain them, and review gates so humans stay in charge of what matters.\n The scarce asset stops being the ability to write code and becomes the loop around the code.\n </p>\n <Callout label=\"the one-line thesis\">\n <p>\n app.nz exists to own the loop from intent to running system, for a world where most software\n is written and operated by agents. Whoever owns that loop owns the account everything bills to.\n </p>\n </Callout>\n </DocSection>\n\n <DocSection id=\"opportunity\" title=\"Why the opportunity is large\">\n <p>\n Developer infrastructure today is a set of enormous, separate markets: code hosting, CI/CD,\n cloud compute, GPU inference, model APIs, observability, and the creative-tools stack beside\n them. Each was sized by the number of human developers and human creators. Agents break that\n sizing assumption in both directions at once.\n </p>\n <p>\n First, agents multiply the number of active builders. A single customer with one subscription\n runs dozens of concurrent agents, each consuming repos, compute, model calls, and deploys around\n the clock. Usage-based platforms are levered to agent count, not seat count — and agent count\n compounds with model capability, which is improving on a curve no human-headcount market has\n ever matched.\n </p>\n <p>\n Second, agents collapse the boundaries between those markets. An agent doing one task touches a\n repo, calls three models, renders an image, runs a GPU job, and ships a deploy — in one session.\n Forcing that session across six vendors with six auth systems and six bills is friction that\n agents, unlike patient humans, simply route around. The integrated platform is not a convenience;\n it is what agent traffic structurally selects for.\n </p>\n <p>\n We do not need to displace the incumbents to build a very large company here. We need to be\n where new, agent-first workloads land — and those workloads are the fastest-growing spend in\n software.\n </p>\n <FactGrid\n items={[\n { v: 'Seats → usage', k: 'pricing basis shifts from human headcount to agent work' },\n { v: '24/7', k: 'agents consume infrastructure around the clock, not office hours' },\n { v: '6 → 1', k: 'vendor consolidation pressure from agents that hate friction' },\n { v: 'Compounding', k: 'demand grows with model capability, not hiring pipelines' },\n ]}\n />\n </DocSection>\n\n <DocSection id=\"what-we-are\" title=\"What app.nz is today\">\n <p>\n Everything in this section is live and billing customers now — not roadmap. Hosted repos with\n branch previews and PR review; autonomous coding agents that branch, edit, run tests, and open\n pull requests; an OpenAI-compatible gateway routing across 20+ model providers under one key;\n GPU inference with scale-to-zero endpoints, fine-tuning, and container builds; app and site\n hosting with free HTTPS subdomains; and a full suite of AI-native editors — video, audio, image,\n vector, slides, sheets, docs, 3D, animation, whiteboard — sharing one asset store and one credit\n balance.\n </p>\n <p>\n We dogfood relentlessly: app.nz/papers, readingtime.app.nz, helix.app.nz, and gpubrain.app.nz\n are real consumer and prosumer products built on the same repos, agents, gateway, and hosting we\n sell. When the platform breaks, our own products break first, and an agent usually files the fix.\n </p>\n <p>\n This breadth is deliberate. Each surface alone has a bigger, better-funded competitor. Together\n they form the thing no competitor sells: the whole loop, on one account, priced in one prepaid\n balance that agents can be trusted to spend.\n </p>\n </DocSection>\n\n <DocSection id=\"decade\" title=\"The decade, in three eras\">\n <div className=\"space-y-4\">\n {eraRows.map((e) => (\n <div key={e.era} className=\"rounded-2xl border border-white/10 bg-white/[0.04] p-6\">\n <p className=\"text-xs font-bold uppercase tracking-[0.18em] text-sky-400\">{e.era}</p>\n <h3 className=\"mt-2 font-display text-xl font-bold text-white\">{e.name}</h3>\n <p className=\"mt-2 text-sm leading-7 text-white/68\">{e.body}</p>\n </div>\n ))}\n </div>\n <p>\n The eras overlap — pieces of era three are in research now — but the sequencing matters\n commercially. Era one earns the account. Era two earns the margin, because a router that saves\n customers money on every request is a router customers never leave. Era three earns the\n category: the platform where software runs itself.\n </p>\n </DocSection>\n\n <DocSection id=\"auto-infra\" title=\"Infrastructure that optimizes itself\">\n <p>\n Today, choosing infrastructure is a human job done badly. Teams pin a model because switching is\n scary, overpay for reserved GPUs because spot is fiddly, and leave latency on the table because\n benchmarking is a chore. Our position is that none of these decisions should be made by a person\n more than once — they should be made by a router, per request, forever.\n </p>\n <p>\n The gateway already routes across 20+ providers behind lanes like <code>app/auto</code>,{' '}\n <code>app/auto-code</code>, and <code>app/auto-fast</code>. The decade version is a learned\n router operating within a roughly one-millisecond decision budget: embed the request, consult\n live price/latency/health telemetry from every provider, and place the work on the best model\n and the cheapest capable GPU — a serverless burst here, a hosted pod there, spot capacity when\n the interruption math works, across any provider we can reach. The same machinery moves\n long-running workloads: pods migrate to whichever cloud is cheapest tonight without the\n customer noticing anything but a smaller bill.\n </p>\n <p>\n This is a flywheel disguised as a feature. Every request teaches the router; a smarter router\n wins more traffic on price and quality; more traffic buys better capacity economics and more\n training signal. Infrastructure arbitrage, compounding, sold as a one-line model name.\n </p>\n </DocSection>\n\n <DocSection id=\"every-medium\" title=\"Every content type gets an AI-native editor\">\n <p>\n Software is no longer just code, and agents do not stop at pull requests. The same customer who\n asks an agent to fix CI asks it to cut a launch video, generate a slide deck, retexture a 3D\n asset, and master a voiceover. Legacy creative tools bolt AI onto file formats designed for\n humans working alone; we build editors where the agent is a first-class collaborator — every\n editor exposes its operations as tools, every asset lives in shared storage, every render bills\n the same balance.\n </p>\n <p>\n Ten editors sharing one substrate beat ten point products, for the same reason the integrated\n loop beats six vendors: agents chain them. A run-forever marketing agent that writes the copy,\n draws the diagrams, cuts the video, and ships the landing page is only possible when every one\n of those actions is an API call on one account.\n </p>\n </DocSection>\n\n <DocSection id=\"self-organizing\" title=\"Self-organizing software\">\n <p>\n The endgame of agent-written software is not faster feature requests. It is software that\n maintains itself: systems that read their own logs and traces, notice degradation, file the\n issue, write the fix, prove it with tests and benchmarks, and merge it through a human-set\n review gate. Ownership shifts from \"who wrote this code\" to \"who set this system's goals and\n constraints.\"\n </p>\n <p>\n We are building toward this from both ends. From below: repos, CI repair, VisualBench screenshot\n review, schedulers, queues, and auto-agents are the organs such a system needs, and all exist on\n the platform today. From above: budgets, spend caps, permissions, and review gates are the\n governance layer that makes autonomy safe enough to sell. The gap between the two ends is the\n product roadmap for the back half of the decade.\n </p>\n <Callout label=\"why this is ours to win\">\n <p>\n Self-organizing software cannot be a feature of an IDE or a model API — it needs the repos,\n the telemetry, the compute, the deploys, and the governance in one place. The integrated\n platform is not just convenient for this future; it is the prerequisite.\n </p>\n </Callout>\n </DocSection>\n\n <DocSection id=\"run-forever\" title=\"Run-forever agents\">\n <p>\n Today's agents are sprinters: spawn, task, PR, terminate. The valuable ones will be marathoners\n — agents with durable memory, standing budgets, and escalation rules that operate for months.\n Watching a dependency tree for CVEs and patching them. Holding a service's p99 under target by\n renegotiating its infrastructure nightly. Running a storefront's content pipeline end to end.\n Growing a codebase the way a gardener grows a garden: continuously, incrementally, accountably.\n </p>\n <p>\n Run-forever agents are the customer that never churns and never sleeps. They are also the\n hardest workload to host: they need persistent memory, resumable execution, spend governance,\n observable behavior, and an owner who can always pull the cord. Every one of those is an\n infrastructure product, and we are building each as a billable primitive — schedulers,\n auto-agents, and queues are the first three, live now.\n </p>\n </DocSection>\n\n <DocSection id=\"why-us\" title=\"Why us\">\n <p>\n We are a small, technical, founder-led team in New Zealand that has shipped an implausible\n surface area — because we build with the product we sell. The agents write the platform; the\n platform hosts the agents. That loop is our development velocity, our best sales demo, and our\n proof that the thesis works, all at once.\n </p>\n <p>\n We operate in the open. Public repos, public docs, public benchmarks methodology, and this\n public investor room. Openness is partly conviction and partly strategy: in a market where every\n claim is a demo away from being checked, the vendor whose claims are all checkable compounds\n trust faster than the vendor with the better deck.\n </p>\n <p>\n And we are capital-efficient by construction. Auto-optimizing infrastructure is not only the\n product — it is our own cost structure. We arbitrage the same GPU markets we sell, run\n scale-to-zero everywhere, and let agents do work that would otherwise be headcount.\n </p>\n </DocSection>\n\n <DocSection id=\"beliefs\" title=\"What we believe\">\n <ul className=\"list-disc space-y-3 pl-5\">\n <li>\n <strong className=\"text-white\">Agents are customers.</strong> Design every surface to be\n operated by an agent with a budget, and humans get a better product too.\n </li>\n <li>\n <strong className=\"text-white\">The loop is the moat.</strong> Any single feature can be\n copied; the integrated loop from intent to running system, on one account, cannot be copied\n piecemeal.\n </li>\n <li>\n <strong className=\"text-white\">Routing is compounding margin.</strong> Every decision the\n platform makes better than a human — model choice, GPU placement, spot timing — is margin\n that grows with traffic.\n </li>\n <li>\n <strong className=\"text-white\">Autonomy needs governance to be sellable.</strong> Budgets,\n gates, and audit trails are not compliance chores; they are the features that let customers\n say yes.\n </li>\n <li>\n <strong className=\"text-white\">Build in the open.</strong> Checkable claims beat polished\n decks. This document is the practice of that belief.\n </li>\n </ul>\n <p>\n The next document, the <a href=\"/investors/deep-dive\" className=\"font-semibold text-sky-400 hover:text-sky-300\">technical deep dive</a>,\n grounds every claim above in architecture, security, economics, benchmarks, and a dated roadmap.\n </p>\n </DocSection>\n\n <InvestorsContactCta />\n </div>\n </div>\n </main>\n);\n\nexport default InvestorsVisionPage;\n","import React from 'react';\nimport { Callout, DocH3, DocSection, DocTable, Eyebrow, FactGrid, InvestorsContactCta, InvestorsSubnav } from './InvestorsShared';\n\nconst TOC: { id: string; num: string; title: string }[] = [\n { id: 'executive-summary', num: '01', title: 'Executive summary' },\n { id: 'product-surface', num: '02', title: 'Product surface map' },\n { id: 'architecture', num: '03', title: 'System architecture' },\n { id: 'gateway', num: '04', title: 'Model routing & the gateway' },\n { id: 'auto-optimizing-infra', num: '05', title: 'Auto-optimizing infrastructure' },\n { id: 'gpu-compute', num: '06', title: 'GPU compute & training' },\n { id: 'agent-runtime', num: '07', title: 'Agent runtime' },\n { id: 'run-forever-agents', num: '08', title: 'Run-forever agents' },\n { id: 'self-organizing-software', num: '09', title: 'Self-organizing software' },\n { id: 'editors', num: '10', title: 'Editors for every medium' },\n { id: 'data-plane', num: '11', title: 'Data plane: repos & storage' },\n { id: 'security', num: '12', title: 'Security' },\n { id: 'economics', num: '13', title: 'Economics' },\n { id: 'benchmarks', num: '14', title: 'Benchmarks & measurement' },\n { id: 'roadmap', num: '15', title: 'Roadmap' },\n { id: 'risks', num: '16', title: 'Risks' },\n { id: 'diligence', num: '17', title: 'How to diligence us' },\n];\n\nexport const InvestorsDeepDivePage: React.FC = () => (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-12 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(56,189,248,0.10),transparent_55%)]\" />\n <div className=\"relative mx-auto max-w-6xl\">\n <Eyebrow>investor room · document 2 of 2</Eyebrow>\n <h1 className=\"mt-4 max-w-[20ch] font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-5xl\">\n Technical Deep Dive\n </h1>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n Architecture, routing, security, economics, benchmarks, roadmap, and risks — the document for\n partners who want to dig. Every section links to the live surface it describes. Where a number is\n a design target rather than a shipped measurement, it says so.\n </p>\n <div className=\"mt-8\">\n <InvestorsSubnav active=\"/investors/deep-dive\" />\n </div>\n </div>\n </section>\n\n <div className=\"px-4 sm:px-8 lg:px-12\">\n <div className=\"mx-auto flex max-w-6xl gap-12 py-12\">\n <aside className=\"hidden w-64 shrink-0 lg:block\">\n <nav aria-label=\"Contents\" className=\"sticky top-24 rounded-2xl border border-white/10 bg-white/[0.03] p-5\">\n <p className=\"text-xs font-bold uppercase tracking-[0.18em] text-white/45\">Contents</p>\n <ol className=\"mt-4 space-y-2\">\n {TOC.map((t) => (\n <li key={t.id}>\n <a href={`#${t.id}`} className=\"flex gap-2 text-[13px] leading-6 text-white/60 transition hover:text-sky-300\">\n <span className=\"text-white/30\">{t.num}</span>\n {t.title}\n </a>\n </li>\n ))}\n </ol>\n </nav>\n </aside>\n\n <div className=\"min-w-0 max-w-3xl flex-1 space-y-12\">\n <DocSection id=\"executive-summary\" num=\"01\" title=\"Executive summary\">\n <p>\n app.nz is an integrated agent cloud: hosted git repos, autonomous coding agents, an\n OpenAI-compatible gateway routing 20+ model providers, GPU inference and training, app/site\n hosting, task queues and schedulers, web and paper search, and a dozen AI-native editors —\n billed from one prepaid credit balance under one API key.\n </p>\n <p>\n The strategic claim is that agent traffic structurally prefers integrated platforms: an agent\n session touches repos, models, media, compute, and deploys in minutes, and consolidating that\n onto one account removes friction agents will not tolerate. The technical claim is that a\n platform seeing the whole loop can optimize it — routing every request to the best model and\n cheapest capable GPU inside a millisecond-scale decision budget — creating compounding margin\n no single-product competitor can match.\n </p>\n <FactGrid\n items={[\n { v: '20+', k: 'model providers behind one OpenAI-compatible API' },\n { v: '12', k: 'AI-native editors and studios sharing one asset store' },\n { v: '$0.228/hr', k: 'GPU compute entry price, per-second billed' },\n { v: '1', k: 'credit balance across agents, gateway, GPUs, hosting' },\n ]}\n />\n </DocSection>\n\n <DocSection id=\"product-surface\" num=\"02\" title=\"Product surface map\">\n <p>Every row is live. Links go to the product, not a screenshot of it.</p>\n <DocTable\n head={['Surface', 'What it does', 'Where']}\n rows={[\n ['Repos & PRs', 'Hosted git, branch previews, review queues, CI repair', '/repos'],\n ['Coding agents', 'Branch, edit, test, open PRs autonomously', '/agent'],\n ['Gateway', 'OpenAI-compatible routing across 20+ providers', '/gateway'],\n ['Models', 'Catalog, pricing, comparison, playground', '/models'],\n ['Cog Studio', 'Scale-to-zero GPU endpoints from Cog containers', '/cogs'],\n ['Training', 'LoRA and full fine-tuning on per-second GPUs', '/training'],\n ['Build Studio & CI', 'Container builds, registry, CI control room', '/builds'],\n ['Hosting & sites', 'Static sites, containers, workers, HTTPS subdomains', '/deploys'],\n ['Queues & schedulers', 'JSON job queues, cron agents, auto-agents', '/queues'],\n ['Search', 'Web search, deep research, 200M+ papers', '/deep-research'],\n ['Editors', 'Video, audio, image, vector, slides, sheets, docs, 3D, animation, whiteboard', '/studio'],\n ['Skills & assistants', 'Reusable agent skills, hosted assistants, characters', '/skills'],\n ['Datasets & notebooks', 'Hosted datasets, notebooks, dashboards', '/datasets'],\n ]}\n />\n <p>\n The surface is wide by design: each product is a tool an agent can call, and the value of the\n platform scales with the number of tools reachable from one account. Live consumer proof\n points built on this stack: app.nz/papers, readingtime.app.nz, helix.app.nz, gpubrain.app.nz.\n </p>\n </DocSection>\n\n <DocSection id=\"architecture\" num=\"03\" title=\"System architecture\">\n <DocH3>Control plane</DocH3>\n <p>\n A single account system owns identity, API keys, prepaid credits, spend caps, and permissions.\n Every product — gateway call, agent minute, GPU second, deploy, search — meters into the same\n ledger. This is the load-bearing decision in the company: one ledger is what makes agent\n spending governable and cross-product bundling possible.\n </p>\n <DocH3>Execution planes</DocH3>\n <p>\n Work runs on three planes. The <strong className=\"text-white\">request plane</strong> (gateway,\n search) is latency-critical, stateless, and horizontally scaled. The{' '}\n <strong className=\"text-white\">job plane</strong> (agents, builds, training, media renders)\n is queue-fed, checkpointable, and scheduled onto the cheapest capable capacity. The{' '}\n <strong className=\"text-white\">serving plane</strong> (deploys, hosted models, sites) is\n long-lived, health-checked, and migratable between providers. Separating the planes lets each\n be optimized on its own axis — latency, cost, and availability respectively.\n </p>\n <DocH3>Provider abstraction</DocH3>\n <p>\n Beneath all three planes sits a uniform provider layer: every model API, GPU vendor, and\n hosting substrate is wrapped in the same interface with live health, price, and latency\n telemetry. Providers are cattle. This is what makes the routing story in chapters 04–05\n possible and what keeps us out of anyone's walled garden.\n </p>\n <DocH3>Frontend</DocH3>\n <p>\n The site itself is a server-rendered React app with prerendered marketing routes, lazy-loaded\n studio surfaces, and a screenshot harness (VisualBench) that captures every page on every\n change — the same harness we sell to agents for UI review, pointed at ourselves.\n </p>\n </DocSection>\n\n <DocSection id=\"gateway\" num=\"04\" title=\"Model routing & the gateway\">\n <p>\n The gateway is an OpenAI-compatible API in front of OpenAI, Anthropic, Google, xAI, DeepSeek,\n Mistral, Groq, Together, Fireworks, NVIDIA, OpenRouter, Fal, Netwrck, MiniMax, Z.AI, Exa, and\n more. Customers point an existing SDK at us and either pin a provider model or use an\n auto-routed lane:\n </p>\n <DocTable\n head={['Lane', 'Optimized for', 'Typical use']}\n rows={[\n ['app/auto', 'frontier quality', 'general chat, planning, mixed workloads'],\n ['app/auto-code', 'agentic coding', 'repo edits, PR repair, migrations'],\n ['app/auto-fast', 'latency', 'realtime UX, interactive tools'],\n ['app/search-deep', 'grounding', 'web, papers, citations, extraction'],\n ['app/auto-image · auto-video · music · 3d', 'media', 'generation routed across media providers'],\n ]}\n />\n <p>\n Routing inputs today: task lane, live provider health, published and negotiated prices,\n measured latency distributions, and per-customer preferences (pin, exclude, data-locality).\n Fallback is automatic — a provider outage degrades to the next-best provider, not to an error.\n Fusion extends the same machinery to run a panel of models against one prompt, judge the\n outputs, and synthesize a stronger answer.\n </p>\n <Callout label=\"why routing is a moat and not a feature\">\n <p>\n Any proxy can forward requests. The compounding asset is the telemetry: every request\n deepens our price/latency/quality dataset across every provider, which makes the next\n routing decision better, which wins more traffic. Providers churn, models leapfrog each\n other monthly — the router is the only layer whose value grows through that churn.\n </p>\n </Callout>\n </DocSection>\n\n <DocSection id=\"auto-optimizing-infra\" num=\"05\" title=\"Auto-optimizing infrastructure\">\n <p>\n This chapter is the technical core of the ten-year plan: infrastructure decisions made per\n request by a learned router, not per quarter by a human.\n </p>\n <DocH3>The ~1 ms decision budget</DocH3>\n <p>\n A router is only usable if it is invisible: its decision time must vanish against the tens of\n milliseconds of network and the seconds of inference around it. Our design budget is roughly\n one millisecond per decision. That rules out calling a model to choose a model. It requires the\n decision to be a lookup-shaped computation: a static embedding of the request, a\n nearest-neighbor consultation against a routing index, and an arg-max over live\n price/latency/health scores — all in memory, all on CPU. Our routing research (static-embedding\n kNN routers trained on model-comparison outcomes) targets exactly this shape: quality within\n a point or two of an LLM-judge router at three to four orders of magnitude lower decision cost.\n The budget is a design constraint we hold ourselves to, not a marketing benchmark.\n </p>\n <DocH3>GPU placement across any provider</DocH3>\n <p>\n The same discipline applies below the model layer. A GPU job — an inference burst, a training\n run, a render — carries requirements (VRAM, interconnect, region, deadline) and the placer\n solves for cheapest capable capacity across every substrate we can reach: serverless GPU\n (scale-to-zero, per-second billing, cold-start cost), hosted pods (warm, predictable,\n reservation economics), and spot capacity (cheapest, interruptible, needs checkpointing).\n Because the job plane requires checkpointable workloads, the placer can chase price across\n providers mid-workload: pods migrate to whichever cloud is cheapest tonight, and the customer\n sees a smaller bill, not a migration.\n </p>\n <DocTable\n head={['Substrate', 'Economics', 'Placed when']}\n rows={[\n ['Serverless GPU', 'per-second, scale-to-zero, cold-start penalty', 'bursty inference, low duty cycle'],\n ['Hosted pods', 'reserved-rate, always-warm', 'steady traffic, latency floors'],\n ['Spot / preemptible', 'deepest discount, interruptible', 'checkpointable training, batch renders'],\n ['On-prem / BYO', 'customer capex, zero marginal', 'data locality, sovereign requirements'],\n ]}\n />\n <DocH3>The flywheel</DocH3>\n <p>\n Routing telemetry improves placement; placement volume improves capacity pricing; better\n pricing wins more traffic; more traffic improves telemetry. Every turn of that wheel is margin\n that does not depend on raising prices — it depends on making better decisions than customers\n would make manually, and splitting the savings with them.\n </p>\n </DocSection>\n\n <DocSection id=\"gpu-compute\" num=\"06\" title=\"GPU compute & training\">\n <p>\n Cog Studio deploys any Cog container as a scale-to-zero HTTPS endpoint with generated input\n forms, prediction logs, and per-second billing from $0.228/hr. Build Studio builds images on\n platform workers and pushes to a private registry; the CI control room watches external\n pipelines (GitHub Actions and friends) and lets agents repair failures. Training runs LoRA and\n full fine-tunes on per-second GPUs and deploys resulting weights to dedicated endpoints behind\n the same gateway key.\n </p>\n <p>\n The kernel-level work matters too: our accelerated inference projects (custom Triton/CuteDSL\n kernels for forecasting and diffusion workloads) exist to make owned capacity cheaper per\n token than rented capacity — widening the arbitrage the placer exploits.\n </p>\n </DocSection>\n\n <DocSection id=\"agent-runtime\" num=\"07\" title=\"Agent runtime\">\n <p>\n A coding agent run is: clone into an isolated workspace, plan against the task, edit, run\n tests and linters, capture VisualBench screenshots for UI changes, and open a PR with logs\n attached. Agents hold scoped credentials (repo-scoped tokens, per-run budgets) and their whole\n trace — every command, diff, and model call — is replayable for review.\n </p>\n <p>\n Around the core runner: <strong className=\"text-white\">schedulers</strong> run agents on cron;{' '}\n <strong className=\"text-white\">auto-agents</strong> trigger on events (failing CI, new issue,\n queue depth); <strong className=\"text-white\">queues</strong> feed fleets of workers with\n retries, dead-letter, and spend caps; and <strong className=\"text-white\">skills</strong> are\n versioned markdown capabilities any agent can load — a searchable library of several hundred,\n usable on our runtime or copied out to any other.\n </p>\n </DocSection>\n\n <DocSection id=\"run-forever-agents\" num=\"08\" title=\"Run-forever agents\">\n <p>\n The next runtime primitive is the agent that does not terminate. Design requirements, each of\n which is an infrastructure product:\n </p>\n <DocTable\n head={['Requirement', 'What it means', 'Status']}\n rows={[\n ['Durable memory', 'context that survives restarts and model swaps (gpubrain lineage)', 'live'],\n ['Resumable execution', 'checkpoint/replay so a crash or migration loses nothing', 'building'],\n ['Standing budgets', 'monthly spend envelopes with hard caps and alerts', 'live'],\n ['Escalation rules', 'when to act, when to page a human, when to stop', 'building'],\n ['Observability', 'every action logged, diffable, attributable', 'live'],\n ['Kill switch', 'owner can always pause or revoke instantly', 'live'],\n ]}\n />\n <p>\n Target workloads: dependency and CVE patrol, p99 defense (renegotiate a service's infra\n nightly via the placer), content pipelines that write/illustrate/publish continuously, and\n codebase gardening — the long tail of refactors no team ever schedules. Commercially, a\n run-forever agent is a subscription that expands with the estate it manages and does not\n churn while it is visibly earning its budget.\n </p>\n </DocSection>\n\n <DocSection id=\"self-organizing-software\" num=\"09\" title=\"Self-organizing software\">\n <p>\n Self-organizing software is the composition of everything above into a loop: telemetry →\n detection → proposal → proof → gated merge → deploy → telemetry. A system that notices its own\n regression, writes the fix, proves it with tests and benchmarks, and ships it through a review\n gate a human configured once.\n </p>\n <DocH3>What exists today</DocH3>\n <p>\n Each organ of the loop is a shipped product: repos and PRs (proposal), CI and VisualBench\n (proof), auto-agents (detection), deploys with previews (shipping), budgets and permissions\n (governance). We run early versions of the loop on our own estate — agents file and fix real\n issues on the platform that hosts them.\n </p>\n <DocH3>What has to be true</DocH3>\n <p>\n Three hard problems stand between here and the category: verification strong enough to trust\n (tests, benchmarks, and visual review that catch what reviewers catch), goal stability over\n long horizons (constraints that survive thousands of iterations without drift), and governance\n that scales (review gates that stay meaningful when proposals arrive faster than humans read).\n Our bet is that these are platform problems — solvable with better proof machinery and better\n gates, not just better models — which is why a platform company gets to own the answer.\n </p>\n </DocSection>\n\n <DocSection id=\"editors\" num=\"10\" title=\"Editors for every medium\">\n <p>\n Twelve editors and studios, one substrate: video, audio, image (raster), vector, slides,\n sheets, docs, 3D, animation (AnimFlow), whiteboard, notebooks, and dashboards. Three design\n rules make them a platform rather than a bundle:\n </p>\n <ul className=\"list-disc space-y-3 pl-5\">\n <li>\n <strong className=\"text-white\">Agent-operable.</strong> Every editor operation is exposed as\n a callable tool, so an agent can cut a video or restyle a deck the same way it edits code.\n </li>\n <li>\n <strong className=\"text-white\">One asset store.</strong> A generated image is immediately a\n video layer, a slide asset, a 3D texture source. No exports between products.\n </li>\n <li>\n <strong className=\"text-white\">One balance.</strong> Every render, generation, and model\n call in every editor meters into the same prepaid credits as the gateway and agents.\n </li>\n </ul>\n <p>\n Media generation routes like text does: images across GPT Image, FLUX, SD3, ZImage; video\n across Sora, Hailuo, Seedance, Wan, LTX; music, speech, and 3D across their own provider\n panels — same key, same fallback, same usage logs.\n </p>\n </DocSection>\n\n <DocSection id=\"data-plane\" num=\"11\" title=\"Data plane: repos & storage\">\n <p>\n Hosted git repos with branch previews, PR review queues, and pretty GitHub-style URLs; model\n storage keeping weights, LoRAs, and datasets next to the workers that use them; hosted\n datasets and notebooks for analysis; and artifacts as the shared library every editor and\n agent reads and writes. Data locality is a routing input: workloads follow their data, and\n customers can pin regions or providers for sovereignty.\n </p>\n </DocSection>\n\n <DocSection id=\"security\" num=\"12\" title=\"Security\">\n <p>Standing practices, live today (details on <a href=\"/security\" className=\"font-semibold text-sky-400 hover:text-sky-300\">/security</a>):</p>\n <ul className=\"list-disc space-y-3 pl-5\">\n <li>\n <strong className=\"text-white\">Workload isolation.</strong> Agent runs and builds execute in\n isolated workspaces with scoped, short-lived credentials — never account-wide keys.\n </li>\n <li>\n <strong className=\"text-white\">Secret hygiene.</strong> Secrets are injected at runtime and\n scrubbed from build and CI logs; public repos can run secure CI without leaking (edukids,\n our open-source flagship, is the standing proof).\n </li>\n <li>\n <strong className=\"text-white\">Spend governance.</strong> Per-key and per-agent budgets with\n hard caps — financial blast-radius control as a first-class primitive.\n </li>\n <li>\n <strong className=\"text-white\">Auditability.</strong> Agent traces, gateway usage logs, and\n deploy histories are replayable and attributable to a key.\n </li>\n <li>\n <strong className=\"text-white\">Provider containment.</strong> Customers can exclude\n providers or pin data-locality per key; the gateway enforces it at routing time.\n </li>\n <li>\n <strong className=\"text-white\">Hardened hosts.</strong> Default-deny firewalls, integrity\n monitoring, and alerting on the machines we operate.\n </li>\n </ul>\n <p>\n The honest gap: we are early on formal certification (SOC 2 and friends are roadmap, chapter\n 15). Our compensating posture is radical inspectability — public code, replayable traces, and\n this document.\n </p>\n </DocSection>\n\n <DocSection id=\"economics\" num=\"13\" title=\"Economics\">\n <DocH3>How money flows</DocH3>\n <p>\n Prepaid credits are the unit of everything: customers top up a balance (or hold Pro/Ultra/Max\n plans that bundle monthly credits, reserved agent machines, and quotas) and every product\n meters against it. Prepay matters doubly in an agent economy — it is both working capital and\n the mechanism that makes autonomous spending safe to allow.\n </p>\n <DocH3>Margin sources</DocH3>\n <DocTable\n head={['Source', 'Mechanism']}\n rows={[\n ['Gateway spread', 'routing to the cheapest capable provider; spread widens as the router learns'],\n ['GPU arbitrage', 'serverless/pod/spot placement plus owned-kernel efficiency vs rented list price'],\n ['Plans', 'bundled credits and reserved capacity with predictable utilization'],\n ['Search & tools', 'priced per unit (e.g. papers $1/1k searches, web from $0.0077/request) over wholesale'],\n ['Hosting', 'scale-to-zero density: many idle apps per machine'],\n ]}\n />\n <DocH3>Cost structure</DocH3>\n <p>\n We are levered to our own thesis: the placer that saves customers money runs our fleet too,\n scale-to-zero keeps idle surface near-free, and agents do work that would otherwise be\n headcount. Small team, wide surface, usage-based revenue — the model only works if the\n automation story is true, which is the point.\n </p>\n <Callout label=\"what we deliberately do not publish here\">\n <p>\n Customer-level revenue, cohort, and pipeline data live in the private annex shared under NDA\n in a raise. Everything structural — pricing, mechanisms, margins logic — is public above and\n on <a href=\"/pricing\" className=\"font-semibold text-sky-400 hover:text-sky-300\">/pricing</a>.\n </p>\n </Callout>\n </DocSection>\n\n <DocSection id=\"benchmarks\" num=\"14\" title=\"Benchmarks & measurement\">\n <p>\n We publish methodology and hold a rule: a number is either measured and reproducible, or it is\n labeled a design target. Current instruments:\n </p>\n <ul className=\"list-disc space-y-3 pl-5\">\n <li>\n <strong className=\"text-white\">Routing evals.</strong> Static-embedding kNN routers scored\n against LLM-judge baselines on model-comparison datasets — quality-vs-decision-cost curves,\n run whenever the model catalog shifts. Target: judge-level lane assignment inside the ~1 ms\n budget (design target, tracked in the open research repo).\n </li>\n <li>\n <strong className=\"text-white\">Provider telemetry.</strong> Continuous latency, error-rate,\n and price sampling across all 20+ providers — the dataset the router consumes, and the\n basis for the model catalog's live pricing.\n </li>\n <li>\n <strong className=\"text-white\">VisualBench.</strong> Full-page screenshot sweeps of every\n route on every change, desktop and mobile — UI regression as a benchmark suite (browse it at{' '}\n <a href=\"/visualbench\" className=\"font-semibold text-sky-400 hover:text-sky-300\">/visualbench</a>).\n </li>\n <li>\n <strong className=\"text-white\">Kernel benchmarks.</strong> Owned-kernel inference speedups\n (e.g. our forecasting-kernel work) measured against reference implementations before any\n capacity-cost claim is made.\n </li>\n <li>\n <strong className=\"text-white\">Agent evals.</strong> Task-completion and PR-acceptance rates\n on our own estate — the dogfood metric that gates what we claim agents can do.\n </li>\n </ul>\n </DocSection>\n\n <DocSection id=\"roadmap\" num=\"15\" title=\"Roadmap\">\n <DocTable\n head={['Horizon', 'Shipping']}\n rows={[\n [\n 'Now — 6 months',\n 'learned lane routing in production; placer v1 across serverless/pod/spot; run-forever memory + escalation primitives; editor tool-surface completion; SOC 2 groundwork',\n ],\n [\n '6 — 18 months',\n 'cross-provider pod migration in GA; per-customer routing policies (cost/latency/quality dials); agent fleets over queues at scale; self-repair loop (auto-agent → fix → gated merge) as a product; certification',\n ],\n [\n '18 — 36 months',\n 'run-forever agents GA with standing budgets and audited autonomy; self-organizing estate management for customer codebases; routing index licensed as its own product',\n ],\n [\n '3 — 10 years',\n 'the vision doc, executed: the default substrate where agent-built software lives, optimizes itself, and is governed by the people who own it',\n ],\n ]}\n />\n <p>\n Roadmaps are claims about the future; ours is versioned. When priorities move, the diff to\n this page is public like any other commit.\n </p>\n </DocSection>\n\n <DocSection id=\"risks\" num=\"16\" title=\"Risks\">\n <ul className=\"list-disc space-y-3 pl-5\">\n <li>\n <strong className=\"text-white\">Platform compression.</strong> Model labs bundle more of the\n loop themselves. Mitigation: multi-provider neutrality is our product — labs are unlikely to\n route to competitors, and customers increasingly refuse single-lab lock-in.\n </li>\n <li>\n <strong className=\"text-white\">Breadth vs. depth.</strong> A wide surface risks shallow\n products. Mitigation: shared substrate (one ledger, one asset store, one runtime) means each\n surface is thin UI over deep common infrastructure; dogfooding exposes shallow spots fast.\n </li>\n <li>\n <strong className=\"text-white\">Provider dependence.</strong> Upstream price or ToS shifts.\n Mitigation: 20+ providers, live re-routing, owned capacity at the margin.\n </li>\n <li>\n <strong className=\"text-white\">Autonomy incidents.</strong> An agent doing damage is the\n category's existential PR risk. Mitigation: budgets, gates, kill switches, and replayable\n traces are shipped defaults, not options — and we sell the governance as hard as the\n autonomy.\n </li>\n <li>\n <strong className=\"text-white\">Small-team execution risk.</strong> Real. The counterweight\n is the thesis itself: we compound with model capability and agent leverage, not headcount.\n </li>\n </ul>\n </DocSection>\n\n <DocSection id=\"diligence\" num=\"17\" title=\"How to diligence us\">\n <ol className=\"list-decimal space-y-3 pl-5\">\n <li>\n Create an account and run the loop: point an agent at a repo, watch the PR arrive, check the\n trace.\n </li>\n <li>\n Point an OpenAI SDK at the <a href=\"/gateway\" className=\"font-semibold text-sky-400 hover:text-sky-300\">gateway</a>,\n call <code>app/auto</code>, and compare the usage log against any provider's list price.\n </li>\n <li>\n Read the open code: the platform's public repos, the open-source flagship (edukids), and the\n routing research.\n </li>\n <li>\n Browse <a href=\"/visualbench\" className=\"font-semibold text-sky-400 hover:text-sky-300\">VisualBench</a> —\n the screenshot record of every surface, including its failures.\n </li>\n <li>\n Then ask for the private annex (financials, cohorts, cap table) under NDA.\n </li>\n </ol>\n <p>\n Most diligence processes reconstruct reality from a deck. Ours starts from reality: it is all\n running, and you have an account.\n </p>\n </DocSection>\n\n <InvestorsContactCta />\n </div>\n </div>\n </div>\n </main>\n);\n\nexport default InvestorsDeepDivePage;\n","// Registry for hosted addons marketing pages (/addons). Mirrors the\n// codex-infinity addon control plane (types, plans, env-var injection) with\n// app.nz naming, plus gobed as the first-party GPU vector search flagship.\n\nexport interface AddonEnvVar {\n name: string;\n description: string;\n secret?: boolean;\n}\n\nexport interface AddonPlan {\n plan: string;\n credits: string;\n detail: string;\n}\n\nexport interface AddonEntry {\n slug: string;\n name: string;\n eyebrow: string;\n firstParty?: boolean;\n featured?: boolean;\n tagline: string;\n description: string;\n envVars: AddonEnvVar[];\n plans?: AddonPlan[];\n href: string;\n}\n\nexport const ADDONS: AddonEntry[] = [\n {\n slug: 'gobed',\n name: 'gobed',\n eyebrow: 'GPU vector search · first party',\n firstParty: true,\n featured: true,\n tagline: 'GPU-accelerated semantic search with CAGRA graph indexes and int8 static embeddings.',\n description:\n 'Our flagship search engine as an addon: a Go vector engine with a 15 MB int8 embedding model, flat/IVF/HNSW indexes on CPU and cuVS CAGRA graph search on GPU. The same engine that powers character, art, and repo search on app.nz.',\n envVars: [\n { name: 'GOBED_SEARCH_URL', description: 'HTTP endpoint of your provisioned gobed instance (POST /search, /batch_search, /index)' },\n { name: 'GOBED_API_KEY', description: 'Bearer token scoped to this addon', secret: true },\n { name: 'GOBED_INDEX', description: 'Default index/namespace name for this app' },\n ],\n plans: [\n { plan: 'Shared CPU', credits: 'metered', detail: 'int8 CPU engine on shared workers, per-request billing' },\n { plan: 'Dedicated CPU', credits: '40 credits/mo', detail: 'pinned instance, ~600 bytes/vector, up to ~5M vectors' },\n { plan: 'GPU (CAGRA)', credits: 'from $0.228/hr', detail: 'per-second billed GPU pod with cuVS CAGRA graph index' },\n ],\n href: '/addons/gobed',\n },\n {\n slug: 'postgres',\n name: 'Postgres',\n eyebrow: 'managed database · featured',\n featured: true,\n tagline: 'PostgreSQL hosting with HNSW vector search, PostGIS, graph traversal, and hybrid retrieval.',\n description:\n 'Managed PostgreSQL with pgvector (HNSW) and PostGIS enabled by default, recursive-CTE graph traversal, full-text search, and hybrid retrieval patterns that combine all three — attached to your app as DATABASE_URL in one command.',\n envVars: [\n { name: 'APP_ADDON_POSTGRES_URL', description: 'Full connection string (postgres://…)', secret: true },\n { name: 'DATABASE_URL', description: 'Set to the same URL when created with --attach-default', secret: true },\n { name: 'APP_ADDON_POSTGRES_HOST', description: 'Hostname' },\n { name: 'APP_ADDON_POSTGRES_PORT', description: 'Port' },\n { name: 'APP_ADDON_POSTGRES_DB', description: 'Database name' },\n { name: 'APP_ADDON_POSTGRES_USER', description: 'Role name' },\n { name: 'APP_ADDON_POSTGRES_PASSWORD', description: 'Password', secret: true },\n ],\n plans: [\n { plan: 'Starter', credits: '50 credits/mo', detail: 'shared pool, daily backups' },\n { plan: 'Pro', credits: '150 credits/mo', detail: 'more compute + storage, PITR backups' },\n { plan: 'Scale', credits: '400 credits/mo', detail: 'dedicated resources, read replicas on request' },\n ],\n href: '/addons/postgres',\n },\n {\n slug: 'mongo',\n name: 'Mongo',\n eyebrow: 'document database',\n tagline: 'Managed MongoDB for document workloads.',\n description: 'A managed MongoDB database with the same one-command attach, env injection, backups, and credit billing as every addon.',\n envVars: [\n { name: 'APP_ADDON_MONGO_URL', description: 'Connection string', secret: true },\n { name: 'APP_ADDON_MONGO_HOST', description: 'Hostname' },\n { name: 'APP_ADDON_MONGO_DB', description: 'Database name' },\n { name: 'APP_ADDON_MONGO_PASSWORD', description: 'Password', secret: true },\n ],\n plans: [\n { plan: 'Starter', credits: '60 credits/mo', detail: 'shared pool' },\n { plan: 'Pro', credits: '170 credits/mo', detail: 'more compute + storage' },\n { plan: 'Scale', credits: '420 credits/mo', detail: 'dedicated resources' },\n ],\n href: '/addons#mongo',\n },\n {\n slug: 'memcache',\n name: 'Memcache',\n eyebrow: 'cache',\n tagline: 'Shared memcache namespace for hot keys and sessions.',\n description: 'A shared memcache instance with a per-app namespace — cache pages, sessions, and expensive lookups without running your own.',\n envVars: [\n { name: 'APP_ADDON_MEMCACHE_URL', description: 'Endpoint URL' },\n { name: 'APP_ADDON_MEMCACHE_NAMESPACE', description: 'Key prefix isolated to this app' },\n ],\n href: '/addons#memcache',\n },\n {\n slug: 'auth',\n name: 'Auth',\n eyebrow: 'auth + realtime',\n tagline: 'Supabase-style auth and realtime channels.',\n description: 'Hosted auth (email, OAuth, JWTs) plus realtime pub/sub channels, with anon and service keys injected into your environment.',\n envVars: [\n { name: 'APP_ADDON_AUTH_URL', description: 'Auth API base URL' },\n { name: 'APP_ADDON_REALTIME_URL', description: 'Realtime channels endpoint' },\n { name: 'APP_ADDON_AUTH_ANON_KEY', description: 'Public client key' },\n { name: 'APP_ADDON_AUTH_SERVICE_KEY', description: 'Server-side key', secret: true },\n { name: 'APP_ADDON_AUTH_JWT_SECRET', description: 'Token signing secret', secret: true },\n ],\n href: '/addons#auth',\n },\n {\n slug: 'monitor',\n name: 'Monitor Agent',\n eyebrow: 'AI ops',\n tagline: 'AI-assisted error intake, dedupe, and auto-tasking.',\n description: 'Point your app’s errors at the ingest endpoint; the monitor agent dedupes, triages, and can open repo tasks for real regressions.',\n envVars: [\n { name: 'APP_ADDON_MONITOR_INGEST_URL', description: 'Error/event ingest endpoint' },\n { name: 'APP_ADDON_MONITOR_INGEST_KEY', description: 'Ingest key', secret: true },\n { name: 'APP_ADDON_MONITOR_DASHBOARD_URL', description: 'Dashboard for this project' },\n ],\n plans: [\n { plan: 'Starter', credits: '15 credits/mo', detail: 'error intake + dedupe' },\n { plan: 'Pro', credits: '40 credits/mo', detail: 'auto-tasking into repos' },\n { plan: 'Scale', credits: '120 credits/mo', detail: 'high volume + SLOs' },\n ],\n href: '/addons#monitor',\n },\n];\n\nexport const addonBySlug: Record<string, AddonEntry> = Object.fromEntries(ADDONS.map((a) => [a.slug, a]));\n","import React from 'react';\nimport {\n ArrowRight,\n Boxes,\n Database,\n KeyRound,\n Layers,\n PlugZap,\n Search,\n ShieldCheck,\n Terminal,\n Zap,\n} from 'lucide-react';\nimport TerminalCast from '../TerminalCast';\nimport { ADDONS } from './addonsData';\n\nconst featured = ADDONS.filter((a) => a.featured);\nconst rest = ADDONS.filter((a) => !a.featured);\n\nconst environments = [\n { name: 'Deploys', detail: 'containers, workers, and sites get addon vars at boot', href: '/deploys' },\n { name: 'Coding agents', detail: 'agent runs see the same env as the app they work on', href: '/agent' },\n { name: 'Schedulers & queues', detail: 'cron agents and queue workers inherit project addons', href: '/schedulers' },\n { name: 'Notebooks', detail: 'hosted notebooks can read addon connection vars', href: '/notebooks' },\n];\n\nexport const AddonsHubPage: React.FC = () => (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-14 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(56,189,248,0.12),transparent_55%)]\" />\n <div className=\"relative mx-auto grid max-w-[1400px] gap-10 lg:grid-cols-2 lg:items-center\">\n <div>\n <div className=\"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.18em] text-white/58\">\n <PlugZap size={12} className=\"text-sky-400\" />\n Hosted addons\n </div>\n <h1 className=\"mt-6 max-w-[16ch] font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-6xl\">\n Attach a database in one command\n </h1>\n <p className=\"mt-6 max-w-xl text-base leading-8 text-white/72\">\n Managed services that clip onto any repo, deploy, or agent: GPU vector search, PostgreSQL with\n pgvector and PostGIS, Mongo, cache, auth, and an AI monitor. Connection strings are injected as\n environment variables your app — and your agents — can use immediately.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"/addons/gobed\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n gobed GPU search <ArrowRight size={16} />\n </a>\n <a href=\"/addons/postgres\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n Hosted Postgres\n </a>\n </div>\n </div>\n <div>\n <TerminalCast src=\"/casts/cli-addons.cast\" title=\"app addons — attach Postgres + gobed\" rows={19} />\n <p className=\"mt-2.5 flex flex-wrap items-center gap-x-2 text-xs text-white/45\">\n <Terminal className=\"h-3.5 w-3.5\" />\n Scripted demo of the <code className=\"font-mono\">app addons</code> flow — create, inspect env, query.\n </p>\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">first-party flagships</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Search and storage, built in-house</h2>\n <div className=\"mt-8 grid gap-4 lg:grid-cols-2\">\n {featured.map((a) => (\n <a key={a.slug} href={a.href} className=\"group rounded-2xl border border-white/10 bg-white/[0.04] p-7 transition hover:border-sky-400/40 hover:bg-white/[0.05]\">\n <div className=\"flex items-center justify-between\">\n {a.slug === 'gobed' ? <Search size={22} className=\"text-sky-400\" /> : <Database size={22} className=\"text-sky-400\" />}\n <span className=\"rounded-full border border-sky-400/25 bg-sky-400/10 px-3 py-1 text-[10px] font-bold uppercase tracking-[0.16em] text-sky-300\">\n {a.eyebrow}\n </span>\n </div>\n <h3 className=\"mt-5 font-display text-2xl font-bold group-hover:text-sky-300\">{a.name}</h3>\n <p className=\"mt-2 text-[15px] leading-7 text-white/72\">{a.tagline}</p>\n <p className=\"mt-3 text-sm leading-7 text-white/60\">{a.description}</p>\n <div className=\"mt-5 flex flex-wrap gap-2\">\n {a.envVars.slice(0, 3).map((v) => (\n <code key={v.name} className=\"rounded-md border border-white/10 bg-black/40 px-2 py-1 font-mono text-[11px] text-white/60\">{v.name}</code>\n ))}\n </div>\n <span className=\"mt-5 inline-flex items-center gap-1 text-sm font-semibold text-sky-400\">\n Explore {a.name} <ArrowRight size={14} className=\"transition group-hover:translate-x-0.5\" />\n </span>\n </a>\n ))}\n </div>\n\n <div className=\"mt-10 grid gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n {rest.map((a) => (\n <div key={a.slug} id={a.slug} className=\"scroll-mt-24 rounded-2xl border border-white/10 bg-white/[0.04] p-5\">\n <p className=\"text-[10px] font-bold uppercase tracking-[0.16em] text-white/45\">{a.eyebrow}</p>\n <h3 className=\"mt-2 font-display text-lg font-bold\">{a.name}</h3>\n <p className=\"mt-2 text-sm leading-6 text-white/65\">{a.tagline}</p>\n <div className=\"mt-3 space-y-1.5\">\n {a.envVars.slice(0, 3).map((v) => (\n <p key={v.name} className=\"truncate font-mono text-[11px] text-white/45\">{v.name}</p>\n ))}\n </div>\n {a.plans ? (\n <p className=\"mt-3 text-xs text-white/50\">from {a.plans[0].credits}</p>\n ) : null}\n </div>\n ))}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">supported environments</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">One attach, every runtime</h2>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n Addon variables merge into your environment in a fixed order — account, then project, then addon —\n so an addon-provided <code className=\"font-mono text-sm\">DATABASE_URL</code> lands everywhere the\n project runs. Agents see the same environment your app does, which is what lets an agent run\n migrations, seed data, and verify queries without any manual credential handoff.\n </p>\n <div className=\"mt-8 grid gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n {environments.map((e) => (\n <a key={e.name} href={e.href} className=\"group rounded-xl border border-white/10 bg-white/[0.04] p-5 transition hover:border-white/25\">\n <Zap size={16} className=\"text-sky-400\" />\n <h3 className=\"mt-3 font-display text-base font-bold group-hover:text-sky-300\">{e.name}</h3>\n <p className=\"mt-1 text-sm leading-6 text-white/60\">{e.detail}</p>\n </a>\n ))}\n </div>\n <div className=\"mt-8 grid gap-4 lg:grid-cols-2\">\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.03] p-6\">\n <p className=\"flex items-center gap-2 text-xs font-bold uppercase tracking-[0.16em] text-white/45\">\n <Terminal size={14} className=\"text-sky-400\" /> CLI\n </p>\n <pre className=\"mt-4 overflow-x-auto rounded-lg bg-black/50 p-4 font-mono text-[13px] leading-6 text-white/80\">{`app addons create --type postgres --plan starter --attach-default\napp addons create --type gobed --plan gpu\napp addons env <addon-id> # print injected variables\napp addons list`}</pre>\n </div>\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.03] p-6\">\n <p className=\"flex items-center gap-2 text-xs font-bold uppercase tracking-[0.16em] text-white/45\">\n <Boxes size={14} className=\"text-sky-400\" /> appnz.yaml\n </p>\n <pre className=\"mt-4 overflow-x-auto rounded-lg bg-black/50 p-4 font-mono text-[13px] leading-6 text-white/80\">{`name: my-app\nruntime: static\naddons:\n - type: postgres\n plan: starter\n - type: gobed\n plan: shared`}</pre>\n </div>\n </div>\n <div className=\"mt-6 flex items-start gap-3 rounded-2xl border border-white/10 bg-white/[0.03] p-5\">\n <ShieldCheck size={18} className=\"mt-0.5 shrink-0 text-sky-400\" />\n <p className=\"text-sm leading-7 text-white/65\">\n Secret-marked variables (passwords, service keys) are injected at runtime, scrubbed from build\n and CI logs, and rotatable per addon — the same secret hygiene as{' '}\n <a href=\"/secrets\" className=\"font-semibold text-sky-400 hover:text-sky-300\">project secrets</a>.\n Billing meters into the shared <a href=\"/pricing\" className=\"font-semibold text-sky-400 hover:text-sky-300\">credit balance</a>.\n </p>\n </div>\n </div>\n </section>\n\n <section className=\"px-4 py-14 sm:px-8 sm:py-20 lg:px-12\">\n <div className=\"relative mx-auto max-w-[1400px] overflow-hidden rounded-3xl border border-white/10 bg-white/[0.03] px-6 py-12 text-center sm:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(56,189,248,0.14),transparent_60%)]\" />\n <div className=\"relative\">\n <h2 className=\"font-display text-2xl font-bold tracking-tight sm:text-4xl\">Ship the app; clip on the infrastructure</h2>\n <p className=\"mx-auto mt-4 max-w-2xl text-[15px] leading-8 text-white/70\">\n Read the deep pages for the two flagships, or install the CLI and attach your first addon now.\n </p>\n <div className=\"mt-8 flex flex-wrap items-center justify-center gap-3\">\n <a href=\"/addons/gobed\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n <Search size={16} /> gobed\n </a>\n <a href=\"/addons/postgres\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n <Database size={16} /> Postgres\n </a>\n <a href=\"/cli\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n <Terminal size={16} /> Install the CLI\n </a>\n </div>\n </div>\n </div>\n </section>\n </main>\n);\n\nexport default AddonsHubPage;\n","import React from 'react';\nimport { ArrowRight, Cpu, Gauge, GitBranch, Layers, Search, Server, Zap } from 'lucide-react';\nimport { addonBySlug } from './addonsData';\n\nconst gobed = addonBySlug['gobed'];\n\nconst benchRows = [\n ['1K docs', 'flat (exact)', '357 µs', '~2,800 QPS'],\n ['100K docs', 'flat (exact)', '2.23 ms', 'NDCG@10 > 0.99'],\n ['100K docs', 'IVF', '417 µs', '~2,400 QPS'],\n ['500K docs', 'IVF', '~1.4 ms', '~715 QPS'],\n ['1M docs', 'GPU batch', '—', '~1,050 QPS sustained'],\n];\n\nconst apiRows = [\n ['POST /search', 'single or multi query, k, timeout_ms → results with similarity scores'],\n ['POST /batch_search', 'high-throughput query batches'],\n ['POST /index', 'index documents [{id, text}], sync or async'],\n ['POST /batch_index', 'bulk ingestion'],\n ['GET /health · /metrics · /gpu_stats', 'liveness, Prometheus metrics, GPU utilization'],\n];\n\nconst indexModes = [\n {\n icon: Zap,\n name: 'Flat',\n detail: 'Exact brute-force with SIMD (AVX2/arm64) dot products. Default under ~1.5K vectors — zero recall loss.',\n },\n {\n icon: Layers,\n name: 'IVF + HNSW routing',\n detail: 'K-means inverted lists with an HNSW graph over centroids. ~3× faster at scale for ~10% recall trade, tunable via nprobe.',\n },\n {\n icon: Cpu,\n name: 'CAGRA on GPU',\n detail: 'NVIDIA cuVS CAGRA graph index with custom fused CUDA kernels, GPU k-means, and a pooled memory manager. Auto-enabled when CUDA is present.',\n },\n];\n\nexport const GobedAddonPage: React.FC = () => (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-14 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(56,189,248,0.12),transparent_55%)]\" />\n <div className=\"relative mx-auto max-w-5xl\">\n <div className=\"inline-flex items-center gap-2 rounded-full border border-sky-400/25 bg-sky-400/10 px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.18em] text-sky-300\">\n <Search size={12} /> First-party addon · flagship\n </div>\n <h1 className=\"mt-6 max-w-[18ch] font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-6xl\">\n gobed: GPU vector search as a service\n </h1>\n <p className=\"mt-6 max-w-2xl text-base leading-8 text-white/72\">\n The search engine we built for app.nz, offered as an addon. A 15 MB int8 embedding model, exact\n and IVF/HNSW indexes on CPU, and cuVS CAGRA graph search on GPU — behind three HTTP endpoints and\n one injected env var. It already powers character, art, audio, and repo search across this site.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"/signup\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n Attach gobed <ArrowRight size={16} />\n </a>\n <a href=\"/addons\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n All addons\n </a>\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">why it is fast</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Static embeddings + the right index per scale</h2>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n gobed embeds with static retrieval embeddings (token vectors + mean pooling — no attention pass),\n quantized to int8 at 512 dimensions: a 15 MB model that embeds at ~150K texts/sec on CPU and needs\n roughly 600 bytes per stored vector, so a million documents fit in ~600 MB. The engine then picks\n the index that fits your corpus:\n </p>\n <div className=\"mt-8 grid gap-4 lg:grid-cols-3\">\n {indexModes.map((m) => (\n <div key={m.name} className=\"rounded-2xl border border-white/10 bg-white/[0.04] p-6\">\n <m.icon size={20} className=\"text-sky-400\" />\n <h3 className=\"mt-4 font-display text-lg font-bold\">{m.name}</h3>\n <p className=\"mt-2 text-sm leading-7 text-white/65\">{m.detail}</p>\n </div>\n ))}\n </div>\n <div className=\"mt-8 overflow-x-auto rounded-2xl border border-white/10\">\n <table className=\"w-full min-w-[560px] text-left text-sm\">\n <thead>\n <tr className=\"border-b border-white/10 bg-white/[0.04]\">\n {['Corpus', 'Index', 'Latency', 'Throughput / quality'].map((h) => (\n <th key={h} className=\"px-4 py-3 text-xs font-bold uppercase tracking-[0.14em] text-white/55\">{h}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {benchRows.map((r) => (\n <tr key={r[0] + r[1]} className=\"border-b border-white/5 last:border-0\">\n {r.map((c, j) => (\n <td key={j} className={`px-4 py-3 leading-6 ${j === 0 ? 'font-semibold text-white' : 'text-white/68'}`}>{c}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <p className=\"mt-4 text-sm leading-7 text-white/55\">\n Measured on our benchmark suite (RTX 3090 for GPU rows); methodology ships in the repo. Sub-millisecond\n CAGRA search at 100K+ docs is the current optimization target, not yet a shipped measurement — we\n publish the distinction on every number.\n </p>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">the addon</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Three endpoints, one env var</h2>\n <div className=\"mt-8 grid gap-4 lg:grid-cols-2\">\n <div className=\"overflow-x-auto rounded-2xl border border-white/10\">\n <table className=\"w-full text-left text-sm\">\n <thead>\n <tr className=\"border-b border-white/10 bg-white/[0.04]\">\n <th className=\"px-4 py-3 text-xs font-bold uppercase tracking-[0.14em] text-white/55\">Endpoint</th>\n <th className=\"px-4 py-3 text-xs font-bold uppercase tracking-[0.14em] text-white/55\">Purpose</th>\n </tr>\n </thead>\n <tbody>\n {apiRows.map((r) => (\n <tr key={r[0]} className=\"border-b border-white/5 last:border-0\">\n <td className=\"px-4 py-3 font-mono text-[12px] font-semibold text-white\">{r[0]}</td>\n <td className=\"px-4 py-3 leading-6 text-white/68\">{r[1]}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.03] p-6\">\n <p className=\"text-xs font-bold uppercase tracking-[0.16em] text-white/45\">Injected environment</p>\n <div className=\"mt-4 space-y-3\">\n {gobed.envVars.map((v) => (\n <div key={v.name}>\n <code className=\"font-mono text-[13px] font-semibold text-sky-300\">{v.name}</code>\n <p className=\"text-sm leading-6 text-white/60\">{v.description}{v.secret ? ' · secret' : ''}</p>\n </div>\n ))}\n </div>\n <pre className=\"mt-5 overflow-x-auto rounded-lg bg-black/50 p-4 font-mono text-[13px] leading-6 text-white/80\">{`curl \"$GOBED_SEARCH_URL/search\" \\\\\n -H \"Authorization: Bearer $GOBED_API_KEY\" \\\\\n -d '{\"query\": \"cozy sci-fi reading nook\", \"k\": 5}'`}</pre>\n </div>\n </div>\n <div className=\"mt-8 grid gap-3 sm:grid-cols-3\">\n {(gobed.plans || []).map((p) => (\n <div key={p.plan} className=\"rounded-xl border border-white/10 bg-white/[0.04] p-5\">\n <p className=\"font-display text-lg font-bold\">{p.plan}</p>\n <p className=\"mt-1 text-sm font-semibold text-sky-400\">{p.credits}</p>\n <p className=\"mt-2 text-sm leading-6 text-white/60\">{p.detail}</p>\n </div>\n ))}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">dogfood</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">It runs this site</h2>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n gobed is not a demo we stood up for a landing page. The in-process int8 engine indexes app.nz\n characters, art, audio, documents, and repo code today, and the GPU sidecar serves\n <code className=\"mx-1 font-mono text-sm\">/api/search-ais</code> semantic character search with a\n SQLite fallback when it is absent — the exact architecture the addon gives you: fast path on GPU,\n graceful degradation, one env var to wire it.\n </p>\n <div className=\"mt-6 flex flex-wrap gap-3 text-sm\">\n {[\n { label: 'character search', href: '/characters' },\n { label: 'art search', href: '/art' },\n { label: 'repo code search', href: '/repos' },\n { label: 'GoBrain memory', href: 'https://gpubrain.app.nz' },\n ].map((l) => (\n <a key={l.label} href={l.href} className=\"rounded-full border border-white/12 bg-white/[0.04] px-4 py-1.5 font-semibold text-white/70 transition hover:border-white/25 hover:text-white\">\n {l.label}\n </a>\n ))}\n </div>\n </div>\n </section>\n\n <section className=\"px-4 py-14 sm:px-8 sm:py-20 lg:px-12\">\n <div className=\"relative mx-auto max-w-5xl overflow-hidden rounded-3xl border border-white/10 bg-white/[0.03] px-6 py-12 text-center sm:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(56,189,248,0.14),transparent_60%)]\" />\n <div className=\"relative\">\n <h2 className=\"font-display text-2xl font-bold tracking-tight sm:text-4xl\">Semantic search without the platform tax</h2>\n <p className=\"mx-auto mt-4 max-w-2xl text-[15px] leading-8 text-white/70\">\n No per-seat pricing, no minimum clusters — a metered index on shared CPU, or a per-second GPU pod\n when you need CAGRA throughput.\n </p>\n <div className=\"mt-8 flex flex-wrap items-center justify-center gap-3\">\n <a href=\"/signup\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n Get started\n </a>\n <a href=\"/addons/postgres\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n Pair it with Postgres <ArrowRight size={16} />\n </a>\n </div>\n </div>\n </div>\n </section>\n </main>\n);\n\nexport default GobedAddonPage;\n","import React from 'react';\nimport { ArrowRight, Database, GitBranch, Globe, Layers, Search, ShieldCheck } from 'lucide-react';\nimport { addonBySlug } from './addonsData';\n\nconst pg = addonBySlug['postgres'];\n\nconst capabilities = [\n {\n icon: Search,\n title: 'HNSW vector search',\n body: 'pgvector ships enabled. Build HNSW indexes over embedding columns and run approximate nearest-neighbor queries in plain SQL, next to the rest of your data.',\n code: `CREATE INDEX ON docs\n USING hnsw (embedding vector_cosine_ops);\n\nSELECT id, title\nFROM docs\nORDER BY embedding <=> $1\nLIMIT 10;`,\n },\n {\n icon: Globe,\n title: 'PostGIS geospatial',\n body: 'PostGIS ships enabled. Geometry and geography types, spatial indexes, and distance/containment queries for anything with a location.',\n code: `SELECT name\nFROM places\nWHERE ST_DWithin(\n geog,\n ST_MakePoint($lng, $lat)::geography,\n 5000 -- within 5 km\n)\nORDER BY geog <-> ST_MakePoint($lng, $lat)::geography;`,\n },\n {\n icon: GitBranch,\n title: 'Graph traversal',\n body: 'Model edges as rows and traverse natively with recursive CTEs — multi-hop reachability, shortest paths, and dependency walks without a separate graph database. openCypher via Apache AGE is on the roadmap.',\n code: `WITH RECURSIVE reach AS (\n SELECT dst, 1 AS depth FROM edges WHERE src = $start\n UNION\n SELECT e.dst, r.depth + 1\n FROM edges e JOIN reach r ON e.src = r.dst\n WHERE r.depth < 4\n)\nSELECT DISTINCT dst, min(depth) FROM reach GROUP BY dst;`,\n },\n {\n icon: Layers,\n title: 'Hybrid retrieval',\n body: 'Combine vector similarity, full-text rank, and recency in one query — or fan out to a gobed addon for GPU-scale candidate generation and rerank in SQL.',\n code: `SELECT id, title,\n 0.6 * (1 - (embedding <=> $emb))\n+ 0.4 * ts_rank(fts, plainto_tsquery($q)) AS score\nFROM docs\nWHERE fts @@ plainto_tsquery($q)\n OR embedding <=> $emb < 0.35\nORDER BY score DESC LIMIT 20;`,\n },\n];\n\nexport const PostgresAddonPage: React.FC = () => (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-14 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(56,189,248,0.12),transparent_55%)]\" />\n <div className=\"relative mx-auto max-w-5xl\">\n <div className=\"inline-flex items-center gap-2 rounded-full border border-sky-400/25 bg-sky-400/10 px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.18em] text-sky-300\">\n <Database size={12} /> Hosted addon · featured\n </div>\n <h1 className=\"mt-6 max-w-[18ch] font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-6xl\">\n Postgres with vectors, maps, and graphs\n </h1>\n <p className=\"mt-6 max-w-2xl text-base leading-8 text-white/72\">\n Managed PostgreSQL with pgvector and PostGIS enabled by default, native graph traversal through\n recursive CTEs, and hybrid retrieval that mixes vector, full-text, and geo in one SQL statement.\n Attached to your app — and your agents — as <code className=\"font-mono text-sm\">DATABASE_URL</code> in\n one command.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"/signup\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n Attach Postgres <ArrowRight size={16} />\n </a>\n <a href=\"/addons\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n All addons\n </a>\n </div>\n <pre className=\"mt-8 max-w-xl overflow-x-auto rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-[13px] leading-6 text-white/80\">{`$ app addons create --type postgres --plan starter --attach-default\nProvisioning postgres (starter)…\nExtensions: vector, postgis\nInjected: DATABASE_URL, APP_ADDON_POSTGRES_URL\nReady in 9s`}</pre>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">one database, four retrieval engines</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Everything is a SQL query</h2>\n <div className=\"mt-8 grid gap-4 lg:grid-cols-2\">\n {capabilities.map((c) => (\n <div key={c.title} className=\"rounded-2xl border border-white/10 bg-white/[0.04] p-6\">\n <div className=\"flex items-center gap-3\">\n <c.icon size={20} className=\"text-sky-400\" />\n <h3 className=\"font-display text-lg font-bold\">{c.title}</h3>\n </div>\n <p className=\"mt-3 text-sm leading-7 text-white/65\">{c.body}</p>\n <pre className=\"mt-4 overflow-x-auto rounded-lg bg-black/50 p-4 font-mono text-[12.5px] leading-6 text-white/78\">{c.code}</pre>\n </div>\n ))}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">operations</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Managed like an addon should be</h2>\n <div className=\"mt-8 grid gap-4 lg:grid-cols-2\">\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.03] p-6\">\n <p className=\"text-xs font-bold uppercase tracking-[0.16em] text-white/45\">Injected environment</p>\n <div className=\"mt-4 space-y-3\">\n {pg.envVars.map((v) => (\n <div key={v.name}>\n <code className=\"font-mono text-[13px] font-semibold text-sky-300\">{v.name}</code>\n <p className=\"text-sm leading-6 text-white/60\">{v.description}{v.secret ? ' · secret' : ''}</p>\n </div>\n ))}\n </div>\n </div>\n <div className=\"space-y-4\">\n <div className=\"grid gap-3 sm:grid-cols-3\">\n {(pg.plans || []).map((p) => (\n <div key={p.plan} className=\"rounded-xl border border-white/10 bg-white/[0.04] p-5\">\n <p className=\"font-display text-lg font-bold\">{p.plan}</p>\n <p className=\"mt-1 text-sm font-semibold text-sky-400\">{p.credits}</p>\n <p className=\"mt-2 text-sm leading-6 text-white/60\">{p.detail}</p>\n </div>\n ))}\n </div>\n <div className=\"flex items-start gap-3 rounded-2xl border border-white/10 bg-white/[0.03] p-5\">\n <ShieldCheck size={18} className=\"mt-0.5 shrink-0 text-sky-400\" />\n <p className=\"text-sm leading-7 text-white/65\">\n Backups billed per GB in credits, credential rotation on demand, secrets scrubbed from\n build and CI logs, and one-click test/disable/delete from the addons dashboard or CLI.\n Coding agents get the same <code className=\"font-mono\">DATABASE_URL</code> — so migrations,\n seeds, and query verification are agent tasks, not runbooks.\n </p>\n </div>\n </div>\n </div>\n </div>\n </section>\n\n <section className=\"px-4 py-14 sm:px-8 sm:py-20 lg:px-12\">\n <div className=\"relative mx-auto max-w-5xl overflow-hidden rounded-3xl border border-white/10 bg-white/[0.03] px-6 py-12 text-center sm:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(56,189,248,0.14),transparent_60%)]\" />\n <div className=\"relative\">\n <h2 className=\"font-display text-2xl font-bold tracking-tight sm:text-4xl\">Vectors in Postgres, GPUs when you outgrow it</h2>\n <p className=\"mx-auto mt-4 max-w-2xl text-[15px] leading-8 text-white/70\">\n Start with pgvector HNSW inside your database. When a corpus needs GPU throughput, pair it with\n the gobed addon and keep Postgres as the source of truth.\n </p>\n <div className=\"mt-8 flex flex-wrap items-center justify-center gap-3\">\n <a href=\"/signup\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n Get started\n </a>\n <a href=\"/addons/gobed\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n gobed GPU search <ArrowRight size={16} />\n </a>\n </div>\n </div>\n </div>\n </section>\n </main>\n);\n\nexport default PostgresAddonPage;\n","import React, { useState } from 'react';\nimport { ArrowRight, BookOpen, Check, Code2, Copy, Cpu, Database, FileImage, GitBranch, Rss, Search } from 'lucide-react';\n\nconst stats = [\n ['725K+', 'papers with abstracts'],\n ['613K+', 'paper ↔ code links'],\n ['15.5K', 'datasets'],\n ['9.5K', 'methods'],\n ['59K+', 'eval results'],\n];\n\nconst features = [\n {\n icon: Search,\n name: 'Semantic search on gobed',\n detail:\n 'Queries run through the gobed int8 engine with IVF-HNSW-PQ indexes over 725K paper embeddings — millisecond lookups on CPU, GPU CAGRA when attached. The same engine sold as the gobed addon.',\n },\n {\n icon: GitBranch,\n name: 'Code-linked results',\n detail:\n 'Every paper joins against 613K paper-to-repository links plus methods, datasets, and leaderboard evals, so a search lands you on runnable code, not just a PDF.',\n },\n {\n icon: Rss,\n name: 'Live arXiv crawler',\n detail:\n 'A Go crawler ingests new arXiv submissions continuously with historical backfill, keeping coverage gap-free since the archive dumps ended.',\n },\n {\n icon: FileImage,\n name: 'Figure-aware social cards',\n detail:\n 'Every paper gets an OG card composed from its best PDF figure: pages render in-process via MuPDF, embedded images are extracted and scored, and the card is drawn natively in Go — no Python, no subprocesses.',\n },\n {\n icon: BookOpen,\n name: 'Embedded PDF reader',\n detail: 'Open any paper in a viewer with the PDF inline, linked code repos, tasks, and related papers one click away.',\n },\n {\n icon: Cpu,\n name: 'One Go binary',\n detail:\n 'fasthttp + SQLite WAL + gobed in a single process. The whole 725K-paper engine, its crawler, and its image pipeline deploy as two binaries and a systemd unit.',\n },\n];\n\nconst apiRows = [\n ['GET /api/papers/search?q=…&type=papers|methods|datasets', 'authenticated semantic search for apps, CLI, and MCP'],\n ['GET /api/papers/search?q=…&type=github_code', 'search indexed GitHub source files'],\n ['GET /api/papers/search?q=…&type=repos', 'search tracked code repositories'],\n ['GET /api/papers/item?id=…', 'full paper record as JSON or Markdown'],\n ['GET /papers/:id', 'canonical app.nz paper detail page'],\n];\n\nconst apiExample = `curl \"https://app.nz/api/papers/search?q=state+space+models&type=papers&limit=5\" \\\\\n -H \"Authorization: Bearer $APP_API_KEY\"`;\n\nexport const PapersShowcasePage: React.FC = () => {\n const [copied, setCopied] = useState(false);\n const copyExample = async () => {\n await navigator.clipboard?.writeText(apiExample);\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1600);\n };\n\n return (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-14 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(167,139,250,0.12),transparent_55%)]\" />\n <div className=\"relative mx-auto max-w-5xl\">\n <div className=\"inline-flex items-center gap-2 rounded-full border border-violet-400/25 bg-violet-400/10 px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.18em] text-violet-300\">\n <BookOpen size={12} /> app.nz/papers · research search\n </div>\n <h1 className=\"mt-6 max-w-[20ch] font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-6xl\">\n Papers: semantic search over 725K ML papers and their code\n </h1>\n <p className=\"mt-6 max-w-2xl text-base leading-8 text-white/72\">\n A papers-with-code search engine rebuilt in Go: gobed vector search over every abstract, method,\n and dataset, a live arXiv crawler, an embedded PDF reader, and figure-aware social cards rendered\n natively — now available directly at app.nz/papers.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"/papers\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-violet-400 px-6 text-sm font-bold text-black transition hover:bg-violet-300\">\n Search papers free <ArrowRight size={16} />\n </a>\n </div>\n <dl className=\"mt-10 grid grid-cols-2 gap-4 sm:grid-cols-5\">\n {stats.map(([value, label]) => (\n <div key={label} className=\"rounded-xl border border-white/10 bg-white/[0.03] px-4 py-3\">\n <dt className=\"text-[11px] font-bold uppercase tracking-[0.14em] text-white/45\">{label}</dt>\n <dd className=\"mt-1 font-display text-xl font-bold text-violet-300\">{value}</dd>\n </div>\n ))}\n </dl>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-violet-400/90\">the product</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Search, read, and trace papers to code</h2>\n <div className=\"mt-8 grid gap-6 lg:grid-cols-2\">\n <figure className=\"overflow-hidden rounded-2xl border border-white/10 bg-white/[0.03]\">\n <img src=\"/assets/papers-home.webp\" alt=\"app.nz Papers semantic search results\" loading=\"lazy\" className=\"w-full\" />\n <figcaption className=\"px-5 py-4 text-sm leading-6 text-white/60\">\n Instant semantic results across papers, methods, and datasets — ranked by gobed embedding similarity, joined with code links.\n </figcaption>\n </figure>\n <figure className=\"overflow-hidden rounded-2xl border border-white/10 bg-white/[0.03]\">\n <img src=\"/assets/papers-viewer.webp\" alt=\"app.nz Papers reader with embedded PDF\" loading=\"lazy\" className=\"w-full\" />\n <figcaption className=\"px-5 py-4 text-sm leading-6 text-white/60\">\n The reader view: abstract, authors, tasks, linked repositories, and the PDF embedded on one page.\n </figcaption>\n </figure>\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-violet-400/90\">figure-aware cards</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Every paper ships with a generated social card</h2>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n Share a paper link and the preview is built from the paper itself: the engine renders the PDF with\n in-process MuPDF, extracts and scores embedded figures against detected page crops, falls back to an\n abstract screenshot, then composes a 1200×630 card — palette, typography, and layout derived from the\n winning figure. The whole pipeline is native Go inside the server; the original Python/Pillow\n subprocess version was retired.\n </p>\n <div className=\"mt-8 grid gap-6 sm:grid-cols-2\">\n {['/assets/papers-og-1.webp', '/assets/papers-og-2.webp'].map((src) => (\n <img key={src} src={src} alt=\"Generated paper social card\" loading=\"lazy\" className=\"w-full rounded-2xl border border-white/10\" />\n ))}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-violet-400/90\">under the hood</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Built like the rest of app.nz: small, fast, self-hosted</h2>\n <div className=\"mt-8 grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {features.map((f) => (\n <div key={f.name} className=\"rounded-2xl border border-white/10 bg-white/[0.04] p-6\">\n <f.icon size={20} className=\"text-violet-400\" />\n <h3 className=\"mt-4 font-display text-lg font-bold\">{f.name}</h3>\n <p className=\"mt-2 text-sm leading-7 text-white/65\">{f.detail}</p>\n </div>\n ))}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-5xl\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-violet-400/90\">api</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Everything is an endpoint</h2>\n <div className=\"mt-8 overflow-x-auto rounded-2xl border border-white/10\">\n <table className=\"w-full min-w-[560px] text-left text-sm\">\n <thead>\n <tr className=\"border-b border-white/10 bg-white/[0.04]\">\n <th className=\"px-4 py-3 text-xs font-bold uppercase tracking-[0.14em] text-white/55\">Endpoint</th>\n <th className=\"px-4 py-3 text-xs font-bold uppercase tracking-[0.14em] text-white/55\">Purpose</th>\n </tr>\n </thead>\n <tbody>\n {apiRows.map((r) => (\n <tr key={r[0]} className=\"border-b border-white/5 last:border-0\">\n <td className=\"px-4 py-3 font-mono text-[12px] font-semibold text-white\">{r[0]}</td>\n <td className=\"px-4 py-3 leading-6 text-white/68\">{r[1]}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <div className=\"relative mt-6\">\n <button type=\"button\" onClick={copyExample} className=\"absolute right-3 top-3 inline-flex items-center gap-1.5 rounded-lg border border-white/10 bg-white/[0.06] px-2.5 py-1.5 text-xs font-bold text-white/65 transition hover:bg-white/10 hover:text-white\" aria-label=\"Copy Papers API example\">\n {copied ? <Check size={13} className=\"text-emerald-300\" /> : <Copy size={13} />}\n {copied ? 'Copied' : 'Copy'}\n </button>\n <pre className=\"overflow-x-auto rounded-2xl border border-white/10 bg-black/50 p-5 pr-24 font-mono text-[13px] leading-6 text-white/80\">{apiExample}</pre>\n </div>\n </div>\n </section>\n\n <section className=\"px-4 py-14 sm:px-8 sm:py-20 lg:px-12\">\n <div className=\"relative mx-auto max-w-5xl overflow-hidden rounded-3xl border border-white/10 bg-white/[0.03] px-6 py-12 text-center sm:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(167,139,250,0.14),transparent_60%)]\" />\n <div className=\"relative\">\n <h2 className=\"font-display text-2xl font-bold tracking-tight sm:text-4xl\">From query to running code</h2>\n <p className=\"mx-auto mt-4 max-w-2xl text-[15px] leading-8 text-white/70\">\n Papers search is free to use, wired into app.nz agents and Deep Research, and powered by the same\n gobed engine you can attach to your own apps.\n </p>\n <div className=\"mt-8 flex flex-wrap items-center justify-center gap-3\">\n <a href=\"/papers\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-violet-400 px-6 text-sm font-bold text-black transition hover:bg-violet-300\">\n Open app.nz Papers <ArrowRight size={16} />\n </a>\n <a href=\"/addons/gobed\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n The engine behind it <Database size={16} />\n </a>\n <a href=\"/deep-research\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n Deep Research <Code2 size={16} />\n </a>\n </div>\n </div>\n </div>\n </section>\n </main>\n );\n};\n\nexport default PapersShowcasePage;\n","// Registry for the hosted RL page (/rl). Static fallback mirrors the server\n// catalog in server/rl.go; the page swaps in live data (incl. marked-up GPU\n// pricing) from GET /api/rl/environments once loaded.\n\nexport interface RLEnvironment {\n id: string;\n name: string;\n category: string;\n categoryLabel: string;\n description: string;\n observation: string;\n action: string;\n algorithms: string[];\n minVramGb: number;\n startReward: number;\n targetReward: number;\n}\n\nexport interface RLAlgorithm {\n id: string;\n name: string;\n description: string;\n repo: string;\n}\n\nexport interface RLGpuTier {\n id: string;\n label: string;\n gpu: string;\n vramGb: number;\n priceHourText: string;\n note: string;\n}\n\nexport interface RLStarterRepo {\n name: string;\n url: string;\n description: string;\n algorithms: string[];\n license: string;\n}\n\nexport interface RLMetricPoint {\n step: number;\n reward: number;\n loss: number;\n entropy: number;\n stepsPerSec: number;\n gpuUtil: number;\n}\n\nexport interface RLJob {\n id: string;\n envId: string;\n algoId: string;\n hardware: string;\n status: 'running' | 'succeeded' | 'failed';\n totalSteps: number;\n simulated: boolean;\n progress: number;\n step: number;\n metrics: RLMetricPoint[];\n error?: string;\n deployment?: { kind: string; cogId: string; studioUrl: string; apiUrl: string };\n}\n\nexport const RL_CATEGORY_LABELS: Record<string, string> = {\n 'classic-control': 'Classic control',\n atari: 'Atari',\n mujoco: 'MuJoCo',\n 'llm-rlhf': 'LLM RLHF',\n robotics: 'Robotics sim',\n creative: 'Creative systems',\n};\n\nexport const RL_ENVIRONMENTS: RLEnvironment[] = [\n {\n id: 'cartpole-v1',\n name: 'CartPole-v1',\n category: 'classic-control',\n categoryLabel: RL_CATEGORY_LABELS['classic-control'],\n description: 'Gymnasium classic control: balance a pole on a cart. The hello-world of policy gradients.',\n observation: 'Box(4)',\n action: 'Discrete(2)',\n algorithms: ['ppo', 'dqn'],\n minVramGb: 16,\n startReward: 20,\n targetReward: 500,\n },\n {\n id: 'lunarlander-v3',\n name: 'LunarLander-v3',\n category: 'classic-control',\n categoryLabel: RL_CATEGORY_LABELS['classic-control'],\n description: 'Gymnasium Box2D lander: throttle control with a shaped landing reward.',\n observation: 'Box(8)',\n action: 'Discrete(4)',\n algorithms: ['ppo', 'dqn'],\n minVramGb: 16,\n startReward: -250,\n targetReward: 280,\n },\n {\n id: 'atari-breakout',\n name: 'ALE/Breakout-v5',\n category: 'atari',\n categoryLabel: RL_CATEGORY_LABELS.atari,\n description: 'Atari from pixels with frame stacking; a CNN torso and vectorized envs.',\n observation: 'Box(4,84,84)',\n action: 'Discrete(4)',\n algorithms: ['ppo', 'dqn'],\n minVramGb: 16,\n startReward: 1,\n targetReward: 400,\n },\n {\n id: 'mujoco-halfcheetah',\n name: 'HalfCheetah-v5',\n category: 'mujoco',\n categoryLabel: RL_CATEGORY_LABELS.mujoco,\n description: 'MuJoCo continuous control: 6-joint locomotion, the standard continuous-action benchmark.',\n observation: 'Box(17)',\n action: 'Box(6)',\n algorithms: ['ppo'],\n minVramGb: 16,\n startReward: -300,\n targetReward: 9000,\n },\n {\n id: 'llm-rlhf-tldr',\n name: 'LLM RLHF (TL;DR)',\n category: 'llm-rlhf',\n categoryLabel: RL_CATEGORY_LABELS['llm-rlhf'],\n description: 'GRPO fine-tuning of a small LLM against a programmable reward on summarization prompts.',\n observation: 'prompt tokens',\n action: 'completion tokens',\n algorithms: ['grpo'],\n minVramGb: 24,\n startReward: 0.05,\n targetReward: 0.85,\n },\n {\n id: 'robotics-fetchreach',\n name: 'FetchReach-v3',\n category: 'robotics',\n categoryLabel: RL_CATEGORY_LABELS.robotics,\n description: 'Goal-conditioned robotics sim: move an arm end-effector to a target position.',\n observation: 'Dict(obs, goal)',\n action: 'Box(4)',\n algorithms: ['ppo'],\n minVramGb: 16,\n startReward: -50,\n targetReward: -1.5,\n },\n {\n id: 'appnz-piano-composition-v0',\n name: 'Piano Composition',\n category: 'creative',\n categoryLabel: RL_CATEGORY_LABELS.creative,\n description: 'Compose tonal eighth-note melodies with rewards for harmony, voice leading, rhythmic rests, variety, and cadences.',\n observation: 'MultiDiscrete(13,25,8,5)',\n action: 'Discrete(38)',\n algorithms: ['tabular-q', 'ppo'],\n minVramGb: 0,\n startReward: -20,\n targetReward: 38,\n },\n];\n\nexport const RL_ALGORITHMS: RLAlgorithm[] = [\n {\n id: 'ppo',\n name: 'PPO',\n description: 'Clipped-surrogate proximal policy optimization with GAE; discrete and continuous actions.',\n repo: 'https://github.com/lee101/appnz-rl-ppo-starter',\n },\n {\n id: 'dqn',\n name: 'DQN',\n description: 'Double DQN with a replay buffer and target network for discrete-action environments.',\n repo: 'https://github.com/lee101/appnz-rl-ppo-starter',\n },\n {\n id: 'grpo',\n name: 'GRPO',\n description: 'Group-relative policy optimization for LLMs: sample groups, normalize rewards, clip, KL-regularize.',\n repo: 'https://github.com/lee101/appnz-rl-rlhf-lite',\n },\n {\n id: 'tabular-q',\n name: 'Tabular Q-learning',\n description: 'Tiny deterministic baseline for symbolic piano composition; emits a compact JSON policy.',\n repo: 'https://github.com/lee101/app-site/tree/master/training/music',\n },\n];\n\n// Fallback tiers; live marked-up pricing replaces these from the API.\nexport const RL_GPU_TIERS: RLGpuTier[] = [\n { id: 'gpu-t4', label: 'T4 16GB', gpu: 'T4', vramGb: 16, priceHourText: '$0.23', note: 'cheapest tier for classic control' },\n { id: 'gpu-rtx4090', label: 'RTX 4090 24GB', gpu: 'RTX-4090', vramGb: 24, priceHourText: '$0.41', note: 'default: fast vectorized envs' },\n { id: 'gpu-rtx5090', label: 'RTX 5090 32GB', gpu: 'RTX-5090', vramGb: 32, priceHourText: '$1.07', note: 'Atari / MuJoCo at scale' },\n { id: 'gpu-l40s', label: 'L40S 48GB', gpu: 'L40S', vramGb: 48, priceHourText: '$1.03', note: 'larger RLHF policies' },\n { id: 'gpu-a100', label: 'A100 80GB', gpu: 'A100-80GB', vramGb: 80, priceHourText: '$1.97', note: 'multi-billion-param RLHF' },\n { id: 'gpu-h100', label: 'H100 80GB', gpu: 'H100-80GB', vramGb: 80, priceHourText: '$3.59', note: 'fastest wall-clock training' },\n];\n\nexport const RL_STARTER_REPOS: RLStarterRepo[] = [\n {\n name: 'appnz-rl-ppo-starter',\n url: 'https://github.com/lee101/appnz-rl-ppo-starter',\n description:\n 'Single-file PPO on gymnasium (classic control, Atari, MuJoCo) with cog.yaml, an app.nz policy server, and a serverless deploy manifest.',\n algorithms: ['ppo', 'dqn'],\n license: 'MIT',\n },\n {\n name: 'appnz-rl-rlhf-lite',\n url: 'https://github.com/lee101/appnz-rl-rlhf-lite',\n description:\n 'Minimal GRPO-style RLHF loop on a tiny LLM with programmable rewards, packaged for cog + serverless deploy on app.nz.',\n algorithms: ['grpo'],\n license: 'MIT',\n },\n {\n name: 'appnz-music-rl',\n url: 'https://github.com/lee101/app-site/tree/master/training/music',\n description:\n 'Gymnasium-compatible piano composition environment, Q-learning trainer, R2 policy artifact, and Opus Cog inference.',\n algorithms: ['tabular-q', 'ppo'],\n license: 'MIT',\n },\n];\n\n// Client-side preview curve for signed-out visitors; matches the server's\n// synthetic-metrics shape so the live panel demos without an account.\nexport function previewMetrics(env: RLEnvironment, totalSteps: number, points: number): RLMetricPoint[] {\n const span = env.targetReward - env.startReward;\n const out: RLMetricPoint[] = [];\n for (let i = 1; i <= points; i++) {\n const f = i / 40;\n const noise = Math.sin(i * 12.9898) * 0.5;\n out.push({\n step: Math.round(f * totalSteps),\n reward: env.startReward + span * (1 - Math.exp(-3 * f)) + noise * Math.abs(span) * 0.03 * (1 - f),\n loss: 1.8 * Math.exp(-2.4 * f) + 0.05 + noise * 0.02,\n entropy: 1.1 * (1 - 0.72 * f) + noise * 0.015,\n stepsPerSec: env.category === 'llm-rlhf' ? 14 + noise * 2 : 2400 + noise * 180,\n gpuUtil: (0.62 + 0.3 * f + noise * 0.04) * 100,\n });\n }\n return out;\n}\n\nexport const rlEnvById = (id: string): RLEnvironment | undefined => RL_ENVIRONMENTS.find((e) => e.id === id);\nexport const rlAlgoById = (id: string): RLAlgorithm | undefined => RL_ALGORITHMS.find((a) => a.id === id);\n","import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n Activity,\n ArrowRight,\n BookOpen,\n Boxes,\n Cpu,\n Gauge,\n GitBranch,\n Joystick,\n LineChart,\n Rocket,\n Terminal,\n Zap,\n} from 'lucide-react';\nimport {\n RL_ALGORITHMS,\n RL_CATEGORY_LABELS,\n RL_ENVIRONMENTS,\n RL_GPU_TIERS,\n RL_STARTER_REPOS,\n RLGpuTier,\n RLJob,\n RLMetricPoint,\n previewMetrics,\n rlAlgoById,\n rlEnvById,\n} from './rlData';\n\nconst POLL_MS = 2000;\nconst PREVIEW_TICK_MS = 1200;\nconst PREVIEW_POINTS = 40;\n\nconst categories = Object.keys(RL_CATEGORY_LABELS);\n\nconst fmt = (v: number, digits = 2) =>\n Math.abs(v) >= 1000 ? Math.round(v).toLocaleString() : v.toFixed(digits);\n\nconst Sparkline: React.FC<{ points: RLMetricPoint[]; accessor: (p: RLMetricPoint) => number }> = ({\n points,\n accessor,\n}) => {\n if (points.length < 2) {\n return <div className=\"h-16 rounded-md bg-white/[0.03]\" />;\n }\n const vals = points.map(accessor);\n const min = Math.min(...vals);\n const max = Math.max(...vals);\n const span = max - min || 1;\n const path = vals\n .map((v, i) => `${((i / (vals.length - 1)) * 100).toFixed(2)},${(30 - ((v - min) / span) * 28).toFixed(2)}`)\n .join(' ');\n return (\n <svg viewBox=\"0 0 100 32\" preserveAspectRatio=\"none\" className=\"h-16 w-full\" aria-hidden>\n <polyline points={path} fill=\"none\" stroke=\"rgb(56,189,248)\" strokeWidth=\"1.4\" vectorEffect=\"non-scaling-stroke\" />\n </svg>\n );\n};\n\nconst StatTile: React.FC<{ label: string; value: string; sub?: string }> = ({ label, value, sub }) => (\n <div className=\"rounded-xl border border-white/10 bg-white/[0.03] p-4\">\n <p className=\"text-[10px] font-bold uppercase tracking-[0.16em] text-white/45\">{label}</p>\n <p className=\"mt-1 font-mono text-xl font-bold text-white\">{value}</p>\n {sub ? <p className=\"mt-0.5 text-xs text-white/45\">{sub}</p> : null}\n </div>\n);\n\nexport const RLPage: React.FC = () => {\n const [envId, setEnvId] = useState('cartpole-v1');\n const [algoId, setAlgoId] = useState('ppo');\n const [gpuId, setGpuId] = useState('gpu-rtx4090');\n const [category, setCategory] = useState<string>('all');\n const [gpuTiers, setGpuTiers] = useState<RLGpuTier[]>(RL_GPU_TIERS);\n const [job, setJob] = useState<RLJob | null>(null);\n const [previewMode, setPreviewMode] = useState(false);\n const [previewTick, setPreviewTick] = useState(0);\n const [launching, setLaunching] = useState(false);\n const [deploying, setDeploying] = useState(false);\n const [error, setError] = useState('');\n const panelRef = useRef<HTMLDivElement>(null);\n\n const env = rlEnvById(envId) ?? RL_ENVIRONMENTS[0];\n const algo = rlAlgoById(algoId) ?? RL_ALGORITHMS[0];\n\n const visibleEnvs = useMemo(\n () => (category === 'all' ? RL_ENVIRONMENTS : RL_ENVIRONMENTS.filter((e) => e.category === category)),\n [category],\n );\n const compatibleAlgos = useMemo(() => RL_ALGORITHMS.filter((a) => env.algorithms.includes(a.id)), [env]);\n\n useEffect(() => {\n if (!env.algorithms.includes(algoId)) setAlgoId(env.algorithms[0]);\n }, [env, algoId]);\n\n // Live marked-up GPU pricing from the public catalog.\n useEffect(() => {\n let cancelled = false;\n fetch('/api/rl/environments')\n .then((r) => (r.ok ? r.json() : null))\n .then((data) => {\n if (cancelled || !data?.hardware?.length) return;\n const tiers: RLGpuTier[] = data.hardware.map((h: any) => ({\n id: h.id,\n label: h.label,\n gpu: h.gpu,\n vramGb: h.vramGb,\n priceHourText: h.priceHourText,\n note: RL_GPU_TIERS.find((t) => t.id === h.id)?.note ?? '',\n }));\n setGpuTiers(tiers);\n })\n .catch(() => {});\n return () => {\n cancelled = true;\n };\n }, []);\n\n // Poll a real job.\n useEffect(() => {\n if (!job || previewMode || job.status !== 'running') return;\n const t = setInterval(async () => {\n try {\n const r = await fetch(`/api/rl/jobs/${job.id}`);\n if (!r.ok) return;\n const data = await r.json();\n if (data?.job) setJob(data.job);\n } catch {\n // transient poll failure; next tick retries\n }\n }, POLL_MS);\n return () => clearInterval(t);\n }, [job, previewMode]);\n\n // Signed-out preview: advance a synthetic run client-side.\n useEffect(() => {\n if (!previewMode || !job || job.status !== 'running') return;\n const t = setInterval(() => setPreviewTick((n) => n + 1), PREVIEW_TICK_MS);\n return () => clearInterval(t);\n }, [previewMode, job]);\n\n useEffect(() => {\n if (!previewMode || !job) return;\n const n = Math.min(previewTick + 2, PREVIEW_POINTS);\n const metrics = previewMetrics(env, job.totalSteps, n);\n setJob((prev) =>\n prev\n ? {\n ...prev,\n metrics,\n progress: n / PREVIEW_POINTS,\n step: metrics.length ? metrics[metrics.length - 1].step : 0,\n status: n >= PREVIEW_POINTS ? 'succeeded' : 'running',\n }\n : prev,\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [previewTick, previewMode]);\n\n const launch = useCallback(async () => {\n setLaunching(true);\n setError('');\n setPreviewMode(false);\n try {\n const r = await fetch('/api/rl/jobs', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ envId, algoId, hardware: gpuId }),\n });\n if (r.status === 401) {\n setPreviewMode(true);\n setPreviewTick(0);\n setJob({\n id: 'preview',\n envId,\n algoId,\n hardware: gpuId,\n status: 'running',\n totalSteps: 100000,\n simulated: true,\n progress: 0,\n step: 0,\n metrics: [],\n });\n } else {\n const data = await r.json();\n if (!r.ok || !data?.job) {\n setError(data?.error || 'Could not launch training job');\n } else {\n setJob(data.job);\n }\n }\n panelRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n } catch {\n setError('Could not reach the training API');\n } finally {\n setLaunching(false);\n }\n }, [envId, algoId, gpuId]);\n\n const deploy = useCallback(\n async (target: 'cog' | 'serverless') => {\n if (!job) return;\n if (previewMode) {\n setError('Sign in to deploy trained policies as endpoints.');\n return;\n }\n setDeploying(true);\n setError('');\n try {\n const r = await fetch(`/api/rl/jobs/${job.id}/deploy`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ target }),\n });\n const data = await r.json();\n if (!r.ok || !data?.job) setError(data?.error || 'Deploy failed');\n else setJob(data.job);\n } catch {\n setError('Deploy request failed');\n } finally {\n setDeploying(false);\n }\n },\n [job, previewMode],\n );\n\n const last = job?.metrics.length ? job.metrics[job.metrics.length - 1] : null;\n\n return (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-14 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(56,189,248,0.12),transparent_55%)]\" />\n <div className=\"relative mx-auto grid max-w-[1400px] gap-10 lg:grid-cols-2 lg:items-center\">\n <div className=\"min-w-0\">\n <div className=\"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.18em] text-white/58\">\n <Joystick size={12} className=\"text-sky-400\" />\n Hosted RL\n </div>\n <h1 className=\"mt-6 max-w-[18ch] font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-6xl\">\n Train RL policies on cloud GPUs\n </h1>\n <p className=\"mt-6 max-w-xl text-base leading-8 text-white/72\">\n Pick an environment — gymnasium classic control, Atari, MuJoCo, LLM RLHF, or robotics sim —\n pick a baseline algorithm repo, pick a GPU, and stream training metrics live. When the reward\n curve flattens, deploy the trained policy as a scale-to-zero cog or serverless endpoint.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"#launch\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n Launch a training run <ArrowRight size={16} />\n </a>\n <a href=\"#starters\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n <GitBranch size={16} /> OSS starter repos\n </a>\n </div>\n </div>\n <div className=\"min-w-0 rounded-2xl border border-white/10 bg-white/[0.03] p-4 sm:p-6\">\n <p className=\"flex items-center gap-2 text-xs font-bold uppercase tracking-[0.16em] text-white/45\">\n <Terminal size={14} className=\"text-sky-400\" /> CLI\n </p>\n <pre className=\"mt-4 overflow-x-auto rounded-lg bg-black/50 p-4 font-mono text-[13px] leading-6 text-white/80\">{`app api POST /api/rl/jobs '{\n \"envId\": \"cartpole-v1\",\n \"algoId\": \"ppo\",\n \"hardware\": \"gpu-rtx4090\"\n}'\napp api GET /api/rl/jobs/<job-id> # poll metrics\napp api POST /api/rl/jobs/<job-id>/deploy \\\\\n '{\"target\": \"serverless\"}' # policy endpoint`}</pre>\n <p className=\"mt-3 text-xs leading-6 text-white/45\">\n Per-second GPU billing from the shared credit balance; jobs scale to zero the moment training\n finishes.\n </p>\n </div>\n </div>\n </section>\n\n <section id=\"launch\" className=\"scroll-mt-20 border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">1 · environment</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Pick an environment</h2>\n <div className=\"mt-6 flex flex-wrap gap-2\">\n {['all', ...categories].map((c) => (\n <button\n key={c}\n type=\"button\"\n onClick={() => setCategory(c)}\n className={`rounded-full border px-4 py-1.5 text-xs font-semibold transition ${\n category === c\n ? 'border-sky-400/60 bg-sky-400/15 text-sky-300'\n : 'border-white/10 bg-white/[0.04] text-white/60 hover:border-white/25'\n }`}\n >\n {c === 'all' ? 'All' : RL_CATEGORY_LABELS[c]}\n </button>\n ))}\n </div>\n <div className=\"mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {visibleEnvs.map((e) => (\n <button\n key={e.id}\n type=\"button\"\n onClick={() => setEnvId(e.id)}\n className={`rounded-2xl border p-5 text-left transition ${\n envId === e.id\n ? 'border-sky-400/50 bg-sky-400/[0.08]'\n : 'border-white/10 bg-white/[0.04] hover:border-white/25'\n }`}\n >\n <div className=\"flex items-center justify-between\">\n <span className=\"rounded-full border border-white/10 bg-black/40 px-2.5 py-1 text-[10px] font-bold uppercase tracking-[0.14em] text-white/50\">\n {e.categoryLabel}\n </span>\n {envId === e.id ? <Zap size={14} className=\"text-sky-400\" /> : null}\n </div>\n <h3 className=\"mt-3 font-display text-lg font-bold\">{e.name}</h3>\n <p className=\"mt-1.5 text-sm leading-6 text-white/65\">{e.description}</p>\n <p className=\"mt-3 font-mono text-[11px] text-white/45\">\n obs {e.observation} · act {e.action} · {e.algorithms.map((a) => a.toUpperCase()).join('/')}\n </p>\n </button>\n ))}\n </div>\n\n <p className=\"mt-12 text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">2 · algorithm repo</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Pick a baseline</h2>\n <div className=\"mt-6 grid gap-4 sm:grid-cols-3\">\n {RL_ALGORITHMS.map((a) => {\n const supported = compatibleAlgos.some((c) => c.id === a.id);\n return (\n <button\n key={a.id}\n type=\"button\"\n disabled={!supported}\n onClick={() => setAlgoId(a.id)}\n className={`rounded-2xl border p-5 text-left transition ${\n algoId === a.id && supported\n ? 'border-sky-400/50 bg-sky-400/[0.08]'\n : supported\n ? 'border-white/10 bg-white/[0.04] hover:border-white/25'\n : 'cursor-not-allowed border-white/5 bg-white/[0.02] opacity-45'\n }`}\n >\n <div className=\"flex items-center justify-between\">\n <h3 className=\"font-display text-lg font-bold\">{a.name}</h3>\n <GitBranch size={14} className=\"text-sky-400\" />\n </div>\n <p className=\"mt-1.5 text-sm leading-6 text-white/65\">{a.description}</p>\n <span className=\"mt-3 inline-block font-mono text-[11px] text-white/45\">\n {a.repo.replace('https://github.com/', 'github.com/')}\n </span>\n {!supported ? (\n <p className=\"mt-2 text-[11px] text-white/40\">not supported for {env.name}</p>\n ) : null}\n </button>\n );\n })}\n </div>\n\n <p className=\"mt-12 text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">3 · gpu tier</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Pick a GPU</h2>\n <div className=\"mt-6 grid gap-3 sm:grid-cols-2 lg:grid-cols-3\">\n {gpuTiers.map((g) => {\n const tooSmall = g.vramGb < env.minVramGb;\n return (\n <button\n key={g.id}\n type=\"button\"\n disabled={tooSmall}\n onClick={() => setGpuId(g.id)}\n className={`rounded-xl border p-4 text-left transition ${\n gpuId === g.id && !tooSmall\n ? 'border-sky-400/50 bg-sky-400/[0.08]'\n : tooSmall\n ? 'cursor-not-allowed border-white/5 bg-white/[0.02] opacity-45'\n : 'border-white/10 bg-white/[0.04] hover:border-white/25'\n }`}\n >\n <div className=\"flex items-center justify-between\">\n <span className=\"flex items-center gap-2 font-display text-base font-bold\">\n <Cpu size={14} className=\"text-sky-400\" /> {g.label}\n </span>\n <span className=\"font-mono text-sm text-sky-300\">{g.priceHourText}/hr</span>\n </div>\n <p className=\"mt-1 text-xs text-white/50\">\n {g.vramGb} GB VRAM{g.note ? ` — ${g.note}` : ''}\n {tooSmall ? ` (needs ${env.minVramGb} GB)` : ''}\n </p>\n </button>\n );\n })}\n </div>\n <p className=\"mt-3 text-xs text-white/45\">\n Per-second billing with the platform margin included — the same catalog as{' '}\n <a href=\"/cogs\" className=\"font-semibold text-sky-400 hover:text-sky-300\">Cog Studio</a> and{' '}\n <a href=\"/pricing\" className=\"font-semibold text-sky-400 hover:text-sky-300\">pricing</a>.\n </p>\n\n <div className=\"mt-10 flex flex-wrap items-center gap-4\">\n <button\n type=\"button\"\n onClick={launch}\n disabled={launching}\n className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-8 text-sm font-bold text-black transition hover:bg-sky-300 disabled:opacity-60\"\n >\n <Rocket size={16} /> {launching ? 'Launching…' : `Train ${algo.name} on ${env.name}`}\n </button>\n {error ? <p className=\"text-sm text-rose-400\">{error}</p> : null}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\" ref={panelRef}>\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">live training metrics</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Watch the reward curve climb</h2>\n {!job ? (\n <div className=\"mt-8 flex items-center gap-3 rounded-2xl border border-dashed border-white/15 bg-white/[0.02] p-8 text-white/55\">\n <Activity size={18} className=\"text-sky-400\" />\n <p className=\"text-sm leading-7\">\n Launch a run above to stream reward, loss, entropy, and throughput here — polled live from{' '}\n <code className=\"font-mono text-xs\">/api/rl/jobs/{id}</code>. Signed-out visitors get an\n instant simulated preview.\n </p>\n </div>\n ) : (\n <div className=\"mt-8 rounded-2xl border border-white/10 bg-white/[0.03] p-6\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <p className=\"font-mono text-sm text-white/70\">\n {rlEnvById(job.envId)?.name ?? job.envId} · {rlAlgoById(job.algoId)?.name ?? job.algoId} ·{' '}\n {job.hardware}\n </p>\n <span\n className={`rounded-full border px-3 py-1 text-[10px] font-bold uppercase tracking-[0.16em] ${\n job.status === 'succeeded'\n ? 'border-emerald-400/30 bg-emerald-400/10 text-emerald-300'\n : job.status === 'failed'\n ? 'border-rose-400/30 bg-rose-400/10 text-rose-300'\n : 'border-sky-400/30 bg-sky-400/10 text-sky-300'\n }`}\n >\n {previewMode ? 'preview · ' : job.simulated ? 'simulated · ' : ''}\n {job.status}\n </span>\n </div>\n <div className=\"mt-4 h-2 overflow-hidden rounded-full bg-white/[0.06]\">\n <div\n className=\"h-full rounded-full bg-sky-400 transition-all duration-700\"\n style={{ width: `${Math.round(job.progress * 100)}%` }}\n />\n </div>\n <div className=\"mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatTile label=\"episode reward\" value={last ? fmt(last.reward) : '—'} sub={`target ${fmt(env.targetReward)}`} />\n <StatTile label=\"policy loss\" value={last ? fmt(last.loss, 4) : '—'} />\n <StatTile label=\"steps\" value={job.step.toLocaleString()} sub={`of ${job.totalSteps.toLocaleString()}`} />\n <StatTile\n label=\"throughput\"\n value={last ? `${fmt(last.stepsPerSec, 1)}/s` : '—'}\n sub={last ? `GPU ${fmt(last.gpuUtil, 0)}%` : undefined}\n />\n </div>\n <div className=\"mt-6 grid gap-4 lg:grid-cols-2\">\n <div className=\"rounded-xl border border-white/10 bg-black/30 p-4\">\n <p className=\"flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.16em] text-white/45\">\n <LineChart size={12} className=\"text-sky-400\" /> episode reward\n </p>\n <Sparkline points={job.metrics} accessor={(p) => p.reward} />\n </div>\n <div className=\"rounded-xl border border-white/10 bg-black/30 p-4\">\n <p className=\"flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.16em] text-white/45\">\n <Gauge size={12} className=\"text-sky-400\" /> policy loss\n </p>\n <Sparkline points={job.metrics} accessor={(p) => p.loss} />\n </div>\n </div>\n\n <div className=\"mt-6 rounded-xl border border-white/10 bg-white/[0.02] p-5\">\n <p className=\"flex items-center gap-2 text-xs font-bold uppercase tracking-[0.16em] text-white/45\">\n <Boxes size={14} className=\"text-sky-400\" /> deploy the trained policy\n </p>\n {job.deployment ? (\n <div className=\"mt-3 text-sm leading-7 text-white/70\">\n <p>\n Policy registered as a {job.deployment.kind} endpoint — manage it in{' '}\n <a href={job.deployment.studioUrl} className=\"font-semibold text-sky-400 hover:text-sky-300\">\n Cog Studio\n </a>\n .\n </p>\n <code className=\"mt-2 block overflow-x-auto rounded-md bg-black/50 px-3 py-2 font-mono text-xs text-white/70\">\n POST {job.deployment.apiUrl} {'{\"input\": {\"observation\": \"[0.01, -0.02, 0.03, 0.04]\"}}'}\n </code>\n </div>\n ) : (\n <>\n <p className=\"mt-2 text-sm leading-7 text-white/65\">\n One click packages the policy behind the cog HTTP contract (\n <code className=\"font-mono text-xs\">/predictions</code> on port 5000) and registers it —\n serverless scales to zero in seconds, a cog pod keeps warm state. See{' '}\n <a href=\"/cogs\" className=\"font-semibold text-sky-400 hover:text-sky-300\">/cogs</a> and{' '}\n <code className=\"font-mono text-xs\">docs/BUILDING_COGS.md</code>.\n </p>\n <div className=\"mt-4 flex flex-wrap gap-3\">\n <button\n type=\"button\"\n onClick={() => deploy('serverless')}\n disabled={deploying || job.status !== 'succeeded'}\n className=\"inline-flex h-10 items-center justify-center gap-2 rounded-lg bg-sky-400 px-5 text-sm font-bold text-black transition hover:bg-sky-300 disabled:opacity-50\"\n >\n <Zap size={14} /> Serverless endpoint\n </button>\n <button\n type=\"button\"\n onClick={() => deploy('cog')}\n disabled={deploying || job.status !== 'succeeded'}\n className=\"inline-flex h-10 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-5 text-sm font-bold text-white transition hover:bg-white hover:text-black disabled:opacity-50\"\n >\n <Boxes size={14} /> Cog endpoint\n </button>\n {job.status !== 'succeeded' ? (\n <p className=\"self-center text-xs text-white/45\">available once training completes</p>\n ) : null}\n </div>\n </>\n )}\n </div>\n </div>\n )}\n </div>\n </section>\n\n <section id=\"starters\" className=\"scroll-mt-20 border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">open source</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Starter repos</h2>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n Every baseline on this page is an MIT-licensed repo you can clone, hack, and bring back — each\n ships a clean single-file training loop, a <code className=\"font-mono text-sm\">cog.yaml</code>, an\n app.nz policy server, and a serverless deploy manifest per{' '}\n <code className=\"font-mono text-sm\">docs/BUILDING_COGS.md</code>.\n </p>\n <div className=\"mt-8 grid gap-4 lg:grid-cols-2\">\n {RL_STARTER_REPOS.map((r) => (\n <a\n key={r.name}\n href={r.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"group rounded-2xl border border-white/10 bg-white/[0.04] p-7 transition hover:border-sky-400/40 hover:bg-white/[0.05]\"\n >\n <div className=\"flex items-center justify-between\">\n <GitBranch size={20} className=\"text-sky-400\" />\n <span className=\"rounded-full border border-sky-400/25 bg-sky-400/10 px-3 py-1 text-[10px] font-bold uppercase tracking-[0.16em] text-sky-300\">\n {r.license} · {r.algorithms.map((a) => a.toUpperCase()).join(' + ')}\n </span>\n </div>\n <h3 className=\"mt-5 font-display text-xl font-bold group-hover:text-sky-300\">{r.name}</h3>\n <p className=\"mt-2 text-sm leading-7 text-white/65\">{r.description}</p>\n <span className=\"mt-4 inline-flex items-center gap-1 text-sm font-semibold text-sky-400\">\n {r.url.replace('https://', '')} <ArrowRight size={14} className=\"transition group-hover:translate-x-0.5\" />\n </span>\n </a>\n ))}\n </div>\n <div className=\"mt-6 flex items-start gap-3 rounded-2xl border border-white/10 bg-white/[0.03] p-5\">\n <BookOpen size={18} className=\"mt-0.5 shrink-0 text-sky-400\" />\n <p className=\"text-sm leading-7 text-white/65\">\n Bring your own repo too: any container that trains and then serves the cog HTTP contract can run\n here. Build it with <a href=\"/builds\" className=\"font-semibold text-sky-400 hover:text-sky-300\">hosted builds</a>,\n register it on <a href=\"/cogs\" className=\"font-semibold text-sky-400 hover:text-sky-300\">/cogs</a>, and the\n training metrics API is one POST away.\n </p>\n </div>\n </div>\n </section>\n\n <section className=\"px-4 py-14 sm:px-8 sm:py-20 lg:px-12\">\n <div className=\"relative mx-auto max-w-[1400px] overflow-hidden rounded-3xl border border-white/10 bg-white/[0.03] px-6 py-12 text-center sm:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(56,189,248,0.14),transparent_60%)]\" />\n <div className=\"relative\">\n <h2 className=\"font-display text-2xl font-bold tracking-tight sm:text-4xl\">\n From reward curve to production endpoint\n </h2>\n <p className=\"mx-auto mt-4 max-w-2xl text-[15px] leading-8 text-white/70\">\n Train on per-second billed GPUs, deploy the policy as a scale-to-zero endpoint, and call it from\n anything with an HTTP client.\n </p>\n <div className=\"mt-8 flex flex-wrap items-center justify-center gap-3\">\n <a href=\"#launch\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n <Rocket size={16} /> Launch a run\n </a>\n <a href=\"/cogs\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n <Boxes size={16} /> Cog Studio\n </a>\n <a href=\"/cli\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n <Terminal size={16} /> Install the CLI\n </a>\n </div>\n </div>\n </div>\n </section>\n </main>\n );\n};\n\nexport default RLPage;\n","import React, { useMemo, useState } from 'react';\nimport { ArrowRight, ChevronLeft, CirclePlay, Cpu, Github, Play, Sparkles } from 'lucide-react';\nimport { cx, UI } from '../gitShared';\nimport { cogShowcases, type CogShowcase, type CogShowcaseKind } from './cogShowcaseData';\n\nconst KIND_LABEL: Record<CogShowcaseKind, string> = {\n motion: 'Motion',\n video: 'Video',\n voxel: '3D',\n clean: 'Image',\n depth: 'VFX',\n vector: 'Vector',\n upscale: 'Image',\n stems: 'Audio',\n cutout: 'Image',\n speech: 'Speech',\n text: 'LLM',\n image: 'Image',\n music: 'Music',\n};\n\nconst thumbFor = (cog: CogShowcase) => {\n if (cog.outputMedia && cog.kind !== 'music') return cog.outputMedia;\n if (cog.inputImage) return cog.inputImage;\n return '';\n};\n\nconst promptPreview = (cog: CogShowcase) =>\n String(cog.input.prompt || cog.input.text || cog.input.input || cog.input.style || '').slice(0, 120);\n\nexport const CogExamplesHub: React.FC = () => {\n const [kind, setKind] = useState<'all' | CogShowcaseKind>('all');\n const [query, setQuery] = useState('');\n const kinds = useMemo(() => ['all', ...Array.from(new Set(cogShowcases.map((c) => c.kind)))] as const, []);\n const visible = useMemo(() => {\n const q = query.trim().toLowerCase();\n return cogShowcases.filter((cog) => {\n if (kind !== 'all' && cog.kind !== kind) return false;\n if (!q) return true;\n const hay = [cog.title, cog.template, cog.eyebrow, cog.description, ...cog.tags].join(' ').toLowerCase();\n return q.split(/\\s+/).every((token) => hay.includes(token));\n });\n }, [kind, query]);\n\n return (\n <main className=\"overflow-hidden text-white\">\n <section className=\"relative border-b border-white/8 px-5 pb-12 pt-10 sm:px-8 lg:pb-16 lg:pt-14\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_12%_18%,rgba(34,211,238,.12),transparent_30%),radial-gradient(circle_at_88%_8%,rgba(139,92,246,.12),transparent_28%)]\" />\n <div className=\"relative mx-auto max-w-7xl\">\n <a href=\"/cogs\" className=\"inline-flex items-center gap-2 text-xs font-semibold text-white/45 transition hover:text-white\"><ChevronLeft size={15} /> Cog Studio</a>\n <p className=\"mt-8 text-sm font-bold uppercase tracking-[0.2em] text-cyan-300/80\">Open Cogs</p>\n <h1 className=\"mt-2 max-w-4xl text-balance text-4xl font-black tracking-[-0.045em] sm:text-6xl\">Example recipes with verified defaults</h1>\n <p className=\"mt-5 max-w-3xl text-pretty text-base leading-7 text-white/58 sm:text-lg\">\n Each card links to a canonical input/output showcase. Deploy the same template name with the bundled JSON — HTTP, CLI, desktop, and MCP stay in parity.\n </p>\n </div>\n </section>\n\n <section className=\"mx-auto max-w-7xl px-5 py-10 sm:px-8\">\n <div className=\"mb-6 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between\">\n <div className=\"flex flex-wrap gap-1.5\">\n {kinds.map((value) => (\n <button\n key={value}\n type=\"button\"\n onClick={() => setKind(value)}\n className={cx(\n 'rounded-full border px-3 py-1.5 text-[11px] font-semibold transition-colors',\n kind === value ? 'border-white bg-white text-black' : 'border-white/12 text-white/52 hover:border-white/30 hover:text-white',\n )}\n >\n {value === 'all' ? 'All' : KIND_LABEL[value]}\n </button>\n ))}\n </div>\n <input\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search examples…\"\n aria-label=\"Search Cog examples\"\n className={cx(UI.input, 'h-9 w-full text-xs lg:w-72')}\n />\n </div>\n\n <div className=\"grid gap-5 sm:grid-cols-2 xl:grid-cols-3\">\n {visible.map((cog) => {\n const thumb = thumbFor(cog);\n const isVideo = cog.kind === 'video' && !!cog.outputMedia;\n return (\n <a\n key={cog.slug}\n href={`/cogs/${cog.slug}`}\n className=\"group flex min-h-[320px] flex-col overflow-hidden rounded-2xl border border-white/10 bg-white/[0.02] transition hover:border-white/22 hover:bg-white/[0.045]\"\n >\n <div className=\"relative aspect-[16/10] overflow-hidden bg-black/40\">\n {thumb ? (\n isVideo ? (\n <video src={thumb} muted loop autoPlay playsInline className=\"h-full w-full object-cover transition duration-500 group-hover:scale-[1.02]\" />\n ) : (\n <img src={thumb} alt=\"\" className=\"h-full w-full object-cover transition duration-500 group-hover:scale-[1.02]\" />\n )\n ) : (\n <div className=\"flex h-full items-center justify-center p-6 text-center\">\n <p className=\"text-sm font-semibold leading-6 text-white/70\">{promptPreview(cog)}</p>\n </div>\n )}\n {isVideo && (\n <span className=\"absolute left-3 top-3 inline-flex items-center gap-1 rounded-full border border-white/15 bg-black/60 px-2 py-1 text-[9px] font-bold uppercase tracking-wider text-white/75\">\n <CirclePlay size={11} /> video\n </span>\n )}\n </div>\n <div className=\"flex flex-1 flex-col p-4\">\n <p className=\"text-[10px] font-bold uppercase tracking-[0.16em] text-violet-300/75\">{cog.eyebrow}</p>\n <h2 className=\"mt-1 text-lg font-black tracking-tight\">{cog.title}</h2>\n <p className=\"mt-2 line-clamp-2 text-xs leading-5 text-white/45\">{cog.description}</p>\n <div className=\"mt-auto flex flex-wrap items-center gap-2 pt-4 text-[10px] text-white/40\">\n <span className=\"inline-flex items-center gap-1\"><Cpu size={11} /> {cog.hardware}</span>\n <span className=\"font-mono\">template:{cog.template}</span>\n </div>\n <div className=\"mt-3 flex flex-wrap gap-2\">\n <span className={cx(UI.btn, UI.btnPrimary, 'h-8 px-3 text-[11px]')}><Play size={12} /> View example</span>\n {cog.source && (\n <span\n role=\"link\"\n onClick={(e) => { e.preventDefault(); e.stopPropagation(); window.open(cog.source, '_blank', 'noreferrer'); }}\n className={cx(UI.btn, UI.btnGhost, 'h-8 px-2.5 text-[11px]')}\n >\n <Github size={12} />\n </span>\n )}\n </div>\n </div>\n </a>\n );\n })}\n </div>\n\n {visible.length === 0 && (\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.02] p-10 text-center text-white/45\">\n <Sparkles className=\"mx-auto mb-3 text-white/25\" size={32} />\n No examples match that filter.\n </div>\n )}\n\n <div className=\"mt-12 flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-cyan-300/15 bg-cyan-300/[0.04] p-6\">\n <div>\n <p className=\"text-sm font-bold text-white/85\">Ready to ship your own?</p>\n <p className=\"mt-1 text-xs text-white/45\">Pick a template in Cog Studio, or register any compliant image once and reuse it everywhere.</p>\n </div>\n <a href=\"/cogs\" className={cx(UI.btn, UI.btnOutline, 'h-10 px-4')}>Open Cog Studio <ArrowRight size={14} /></a>\n </div>\n </section>\n </main>\n );\n};\n","import React, { useMemo, useState } from 'react';\nimport {\n ArrowLeft, ArrowRight, Box, Check, ChevronLeft, ChevronRight, CirclePlay, Clock3, Code2,\n Copy, Cpu, Download, ExternalLink, FileAudio, Github, Layers3, Play, Sparkles, TerminalSquare, Waves,\n} from 'lucide-react';\nimport { cx, UI } from '../gitShared';\nimport { cogShowcaseBySlug, cogShowcases, type CogShowcase } from './cogShowcaseData';\n\nconst codeFor = (cog: CogShowcase, surface: 'http' | 'cli' | 'mcp') => {\n const input = JSON.stringify(cog.input);\n if (surface === 'cli') return `app cogs run ${cog.template} \\\\\\n --input '${input}'`;\n if (surface === 'mcp') return JSON.stringify({ name: 'run_cog_template', arguments: { template: cog.template, input: cog.input } }, null, 2);\n return `curl -sX POST https://app.nz/api/cogs/run \\\\\\n -H \"Authorization: Bearer $APP_NZ_KEY\" \\\\\\n -H \"Content-Type: application/json\" \\\\\\n -d '${JSON.stringify({ template: cog.template, input: cog.input })}'`;\n};\n\nconst Waveform = ({ split = false }: { split?: boolean }) => (\n <div className=\"grid w-full gap-3 px-6\">\n {(split ? ['Vocals', 'Instrumental'] : ['Audio output']).map((label, row) => (\n <div key={label} className=\"rounded-xl border border-white/10 bg-black/35 p-3\">\n <div className=\"mb-2 flex items-center justify-between text-[10px] font-bold uppercase tracking-[0.16em] text-white/45\">\n <span>{label}</span><FileAudio size={13} />\n </div>\n <div className=\"flex h-14 items-center gap-[3px] overflow-hidden\">\n {Array.from({ length: 44 }, (_, index) => (\n <span key={index} className={cx('w-1 shrink-0 rounded-full', row ? 'bg-violet-300/75' : 'bg-cyan-300/80')}\n style={{ height: `${12 + ((index * 17 + row * 23) % 42)}px` }} />\n ))}\n </div>\n </div>\n ))}\n </div>\n);\n\nconst MotionPreview = () => (\n <div className=\"relative flex h-full min-h-[320px] items-center justify-center overflow-hidden bg-[radial-gradient(circle_at_50%_45%,rgba(34,211,238,.14),transparent_38%)]\">\n <div className=\"absolute inset-x-12 bottom-[24%] h-px bg-gradient-to-r from-transparent via-cyan-300/30 to-transparent\" />\n <svg viewBox=\"0 0 220 260\" className=\"h-[75%] max-h-[300px] w-auto overflow-visible\" aria-label=\"ARDY pose frame preview\">\n <g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"8\" className=\"text-cyan-200 drop-shadow-[0_0_12px_rgba(34,211,238,.45)]\">\n <circle cx=\"112\" cy=\"38\" r=\"21\" fill=\"rgba(34,211,238,.12)\" />\n <path d=\"M112 62 L105 132 M106 82 L62 112 M106 84 L158 99 M105 132 L70 205 M105 132 L151 201\" />\n </g>\n {[['112','62'],['106','83'],['62','112'],['158','99'],['105','132'],['70','205'],['151','201']].map(([cxv, cyv], i) => <circle key={i} cx={cxv} cy={cyv} r=\"6\" fill=\"#fff\" />)}\n </svg>\n <div className=\"absolute bottom-5 left-5 right-5 flex items-center justify-between font-mono text-[10px] text-cyan-100/55\">\n <span>frame 018 / 040</span><span>20 FPS · 22 joints</span>\n </div>\n </div>\n);\n\nconst ImagePreview = ({ cog }: { cog: CogShowcase }) => {\n const kind = cog.kind;\n const source = cog.outputMedia || cog.inputImage;\n const isCutout = kind === 'cutout';\n const isDepth = kind === 'depth';\n const isVector = kind === 'vector';\n const isUpscale = kind === 'upscale';\n const isClean = kind === 'clean';\n return (\n <div className={cx('relative flex h-full min-h-[320px] items-center justify-center overflow-hidden p-7', isCutout && 'bg-[linear-gradient(45deg,#171717_25%,transparent_25%),linear-gradient(-45deg,#171717_25%,transparent_25%),linear-gradient(45deg,transparent_75%,#171717_75%),linear-gradient(-45deg,transparent_75%,#171717_75%)] bg-[length:28px_28px] bg-[position:0_0,0_14px,14px_-14px,-14px_0px]')}>\n {source ? <img src={source} alt={`${cog.title} output preview`} className={cx(\n 'max-h-[360px] w-full max-w-[420px] rounded-2xl object-contain shadow-2xl transition',\n isUpscale && 'scale-105 contrast-110 saturate-110',\n isVector && 'contrast-125 saturate-150',\n isDepth && 'grayscale contrast-125',\n isCutout && 'drop-shadow-[0_18px_35px_rgba(0,0,0,.45)]',\n )} /> : <div className=\"relative aspect-[2/3] w-full max-w-[260px] overflow-hidden rounded-3xl border border-violet-300/20 bg-[radial-gradient(circle_at_48%_28%,rgba(244,114,182,.7),transparent_15%),radial-gradient(circle_at_55%_45%,rgba(99,102,241,.65),transparent_32%),linear-gradient(155deg,#17132e,#070912_72%)] shadow-[0_30px_90px_rgba(91,33,182,.28)]\">\n <div className=\"absolute inset-x-5 bottom-5 rounded-xl border border-white/10 bg-black/35 p-3 backdrop-blur-md\">\n <div className=\"text-[10px] font-black uppercase tracking-[0.2em] text-violet-200\">Anima render slot</div>\n <div className=\"mt-1 text-xs leading-5 text-white/55\">A generated image appears here after the run completes.</div>\n </div>\n </div>}\n {isDepth && <div className=\"pointer-events-none absolute inset-7 rounded-2xl bg-gradient-to-br from-fuchsia-500/35 via-cyan-300/25 to-blue-900/60 mix-blend-color\" />}\n {isClean && <div className=\"absolute right-[24%] top-[42%] h-20 w-20 rounded-full border border-white/30 bg-cyan-300/15 shadow-[0_0_45px_rgba(34,211,238,.35)] backdrop-blur-md\" />}\n {isVector && <div className=\"absolute bottom-5 right-5 rounded-lg border border-white/15 bg-black/70 px-3 py-2 font-mono text-[10px] text-cyan-200\"><path d="M…" /></div>}\n {kind === 'voxel' && <div className=\"absolute inset-x-[12%] bottom-7 h-20 origin-bottom rotate-x-45 bg-[linear-gradient(rgba(34,211,238,.15)_1px,transparent_1px),linear-gradient(90deg,rgba(34,211,238,.15)_1px,transparent_1px)] bg-[size:20px_20px] [transform:perspective(400px)_rotateX(64deg)]\" />}\n </div>\n );\n};\n\nconst TextPreview = ({ cog }: { cog: CogShowcase }) => (\n <div className=\"flex h-full min-h-[430px] flex-col gap-3 bg-[linear-gradient(160deg,#0b1020,#05070f)] p-6\">\n <div className=\"flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.16em] text-violet-300/75\">\n <Sparkles size={13} /> assistant\n </div>\n <div className=\"min-h-0 flex-1 overflow-auto whitespace-pre-wrap rounded-2xl border border-white/10 bg-black/45 p-5 font-mono text-[12px] leading-6 text-white/80\">\n {cog.outputText || String(cog.input.prompt || '')}\n </div>\n </div>\n);\n\nconst OutputPreview = ({ cog }: { cog: CogShowcase }) => {\n if (cog.kind === 'text') return <TextPreview cog={cog} />;\n if (cog.kind === 'motion') return <MotionPreview />;\n if (cog.kind === 'speech') return <div className=\"flex h-full min-h-[320px] items-center\"><Waveform /></div>;\n if (cog.kind === 'stems') return <div className=\"flex h-full min-h-[320px] items-center\"><Waveform split /></div>;\n if (cog.kind === 'music') return (\n <div className=\"flex h-full min-h-[320px] flex-col items-center justify-center gap-4 p-6\">\n <Waveform />\n {cog.outputMedia && <audio src={cog.outputMedia} controls className=\"w-full max-w-[420px]\" />}\n </div>\n );\n if (cog.kind === 'video' && cog.outputMedia) return (\n <div className=\"relative flex h-full min-h-[430px] items-center justify-center overflow-hidden bg-black\">\n <video src={cog.outputMedia} muted loop autoPlay playsInline controls className=\"h-full max-h-[440px] w-full object-cover\" />\n <span className=\"pointer-events-none absolute left-4 top-4 inline-flex items-center gap-1.5 rounded-full border border-white/15 bg-black/65 px-2.5 py-1 text-[10px] font-bold uppercase tracking-wider text-white/75\"><CirclePlay size={12} /> preview</span>\n </div>\n );\n return <ImagePreview cog={cog} />;\n};\n\nconst InputPreview = ({ cog }: { cog: CogShowcase }) => (\n <div className=\"grid min-h-[430px] grid-rows-[minmax(0,1fr)_auto] bg-white/[0.025]\">\n <div className=\"relative flex min-h-0 flex-col items-center justify-center gap-4 overflow-hidden p-6\">\n {cog.inputImage || cog.inputVideo ? (\n <div className={cx('grid w-full max-w-[560px] gap-3', cog.inputImage && cog.inputVideo && 'grid-cols-2')}>\n {cog.inputImage && <div className=\"min-w-0\"><div className=\"mb-2 text-[9px] font-bold uppercase tracking-[0.15em] text-white/35\">reference image</div><img src={cog.inputImage} alt={`${cog.title} reference input`} className=\"h-[240px] w-full rounded-2xl object-contain shadow-2xl\" /></div>}\n {cog.inputVideo && <div className=\"min-w-0\"><div className=\"mb-2 text-[9px] font-bold uppercase tracking-[0.15em] text-white/35\">driving video</div><video src={cog.inputVideo} controls muted loop playsInline preload=\"metadata\" className=\"h-[240px] w-full rounded-2xl bg-black object-contain shadow-2xl\" /></div>}\n </div>\n ) : cog.kind === 'speech' || cog.kind === 'stems' ? (\n <Waveform />\n ) : (\n <div className=\"max-w-sm text-center\">\n <Sparkles className=\"mx-auto mb-5 text-violet-300\" size={48} />\n <p className=\"text-balance text-xl font-black leading-snug text-white/90\">{String(cog.input.prompt || cog.input.text || cog.input.input || cog.input.style || '')}</p>\n </div>\n )}\n {cog.inputAudio && (\n <div className=\"w-full max-w-[360px] rounded-xl border border-white/10 bg-black/40 p-3\">\n <div className=\"mb-2 flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.16em] text-white/45\">\n <FileAudio size={13} /> driving audio\n </div>\n <audio src={cog.inputAudio} controls className=\"w-full\" />\n </div>\n )}\n {cog.kind === 'clean' && <div className=\"absolute right-[25%] top-[35%] h-20 w-20 rounded-full border-2 border-dashed border-white bg-white/65\" />}\n </div>\n <div className=\"border-t border-white/10 bg-black/25 p-4\">\n <div className=\"grid gap-2 sm:grid-cols-2\">\n {Object.entries(cog.input).slice(0, 6).map(([key, value]) => (\n <div key={key} className=\"min-w-0 rounded-lg border border-white/8 bg-white/[0.035] px-3 py-2\">\n <div className=\"text-[9px] font-bold uppercase tracking-[0.15em] text-white/35\">{key.replaceAll('_', ' ')}</div>\n <div className=\"mt-1 truncate font-mono text-[11px] text-white/72\" title={String(value)}>{String(value)}</div>\n </div>\n ))}\n </div>\n </div>\n </div>\n);\n\nconst SurfaceCode = ({ cog }: { cog: CogShowcase }) => {\n const [surface, setSurface] = useState<'http' | 'cli' | 'mcp'>('http');\n const [copied, setCopied] = useState(false);\n const code = codeFor(cog, surface);\n const copy = async () => {\n await navigator.clipboard?.writeText(code);\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1600);\n };\n return (\n <section className=\"overflow-hidden rounded-2xl border border-white/10 bg-[#080a0e]\">\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-b border-white/10 px-4 py-3\">\n <div className=\"flex gap-1 rounded-lg bg-white/[0.04] p-1\">\n {(['http', 'cli', 'mcp'] as const).map((item) => (\n <button key={item} onClick={() => setSurface(item)} className={cx('rounded-md px-3 py-1.5 text-[11px] font-bold uppercase tracking-wider transition', surface === item ? 'bg-white text-black' : 'text-white/45 hover:text-white')}>\n {item}\n </button>\n ))}\n </div>\n <button onClick={copy} className=\"inline-flex items-center gap-1.5 text-xs text-white/45 hover:text-white\">\n {copied ? <Check size={14} className=\"text-emerald-300\" /> : <Copy size={14} />} {copied ? 'Copied' : 'Copy'}\n </button>\n </div>\n <pre className=\"overflow-x-auto p-5 text-[12px] leading-6 text-cyan-100/78\"><code>{code}</code></pre>\n </section>\n );\n};\n\nexport const CogShowcasePage: React.FC<{ slug: string }> = ({ slug }) => {\n const cog = cogShowcaseBySlug[slug];\n const index = useMemo(() => cog ? cogShowcases.indexOf(cog) : -1, [cog]);\n if (!cog) return (\n <main className=\"mx-auto min-h-[65vh] max-w-4xl px-5 py-24 text-center text-white\">\n <Box size={48} className=\"mx-auto text-white/25\" />\n <h1 className=\"mt-5 text-3xl font-black\">Cog showcase not found</h1>\n <a href=\"/cogs\" className={cx(UI.btn, UI.btnPrimary, 'mt-7')}><ArrowLeft size={15} /> Open Cog Studio</a>\n </main>\n );\n const previous = cogShowcases[(index - 1 + cogShowcases.length) % cogShowcases.length];\n const next = cogShowcases[(index + 1) % cogShowcases.length];\n return (\n <main className=\"overflow-hidden text-white\">\n <section className=\"relative border-b border-white/8 px-5 pb-12 pt-10 sm:px-8 lg:pb-16 lg:pt-14\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_18%_20%,rgba(34,211,238,.14),transparent_28%),radial-gradient(circle_at_82%_10%,rgba(139,92,246,.13),transparent_28%)]\" />\n <div className=\"relative mx-auto max-w-7xl\">\n <a href=\"/cogs/examples\" className=\"inline-flex items-center gap-2 text-xs font-semibold text-white/45 transition hover:text-white\"><ChevronLeft size={15} /> All examples</a>\n <div className=\"mt-8 grid gap-8 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end\">\n <div>\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"rounded-full border border-cyan-300/20 bg-cyan-300/10 px-2.5 py-1 text-[10px] font-black uppercase tracking-[0.18em] text-cyan-200\">Example Cog</span>\n <span className=\"font-mono text-[11px] text-white/35\">template:{cog.template}</span>\n </div>\n <p className=\"mt-6 text-sm font-bold uppercase tracking-[0.2em] text-violet-300/80\">{cog.eyebrow}</p>\n <h1 className=\"mt-2 max-w-4xl text-balance text-4xl font-black tracking-[-0.045em] sm:text-6xl lg:text-7xl\">{cog.title}</h1>\n <p className=\"mt-5 max-w-3xl text-pretty text-base leading-7 text-white/58 sm:text-lg\">{cog.description}</p>\n </div>\n <div className=\"flex flex-wrap gap-2 lg:max-w-[380px] lg:justify-end\">\n <a href={`/cogs?template=${encodeURIComponent(cog.template)}`} className={cx(UI.btn, UI.btnPrimary, 'h-11 px-5')}><Play size={16} /> Deploy & run</a>\n {cog.source && <a href={cog.source} target=\"_blank\" rel=\"noreferrer\" className={cx(UI.btn, UI.btnOutline, 'h-11 px-4')}><Github size={16} /> Source</a>}\n </div>\n </div>\n <div className=\"mt-8 flex flex-wrap gap-2 text-[11px] text-white/55\">\n <span className=\"inline-flex items-center gap-1.5 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5\"><Cpu size={13} /> {cog.hardware}</span>\n <span className=\"inline-flex items-center gap-1.5 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5\"><Clock3 size={13} /> scale to zero</span>\n <span className=\"inline-flex items-center gap-1.5 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5\"><ArrowRight size={13} /> {cog.output}</span>\n {cog.tags.map((tag) => <span key={tag} className=\"rounded-full border border-white/8 px-3 py-1.5 text-white/38\">{tag}</span>)}\n </div>\n </div>\n </section>\n\n <section className=\"mx-auto max-w-7xl px-5 py-12 sm:px-8 lg:py-16\">\n <div className=\"mb-5 flex flex-wrap items-end justify-between gap-3\">\n <div><p className={UI.label}>Canonical example</p><h2 className=\"mt-2 text-2xl font-black tracking-tight sm:text-3xl\">Input and output, side by side</h2></div>\n <p className=\"max-w-md text-right text-xs leading-5 text-white/38\">{cog.outputNote}</p>\n </div>\n <div className=\"grid overflow-hidden rounded-3xl border border-white/12 bg-[#090b0f] shadow-[0_35px_100px_rgba(0,0,0,.45)] lg:grid-cols-2\">\n <div className=\"min-w-0 border-b border-white/10 lg:border-b-0 lg:border-r\">\n <div className=\"flex items-center justify-between border-b border-white/10 px-4 py-3 text-[10px] font-black uppercase tracking-[0.16em] text-white/42\"><span>01 · input</span><Code2 size={14} /></div>\n <InputPreview cog={cog} />\n </div>\n <div className=\"min-w-0\">\n <div className=\"flex items-center justify-between border-b border-white/10 px-4 py-3 text-[10px] font-black uppercase tracking-[0.16em] text-white/42\"><span>02 · {cog.output}</span>{cog.outputFile ? <a href={cog.outputFile} download className=\"inline-flex items-center gap-1.5 rounded-full border border-white/15 bg-white/[0.05] px-2.5 py-1 text-white/70 transition hover:border-white/30 hover:text-white\"><Download size={12} /> download output</a> : <Sparkles size={14} />}</div>\n <OutputPreview cog={cog} />\n </div>\n </div>\n\n <div className=\"mt-14 grid gap-6 lg:grid-cols-[minmax(0,1.2fr)_minmax(280px,.8fr)]\">\n <div className=\"min-w-0\">\n <div className=\"mb-4 flex items-center gap-2\"><TerminalSquare size={17} className=\"text-cyan-300\" /><h2 className=\"text-xl font-black\">Run the same recipe everywhere</h2></div>\n <SurfaceCode cog={cog} />\n </div>\n <aside className=\"min-w-0 rounded-2xl border border-white/10 bg-white/[0.025] p-5\">\n <p className={UI.label}>One deployment contract</p>\n <div className=\"mt-5 space-y-4 text-sm leading-6 text-white/55\">\n <p className=\"flex min-w-0 gap-3 break-words\"><Layers3 size={17} className=\"mt-1 shrink-0 text-violet-300\" /> The browser, Go desktop app, CLI, and MCP tools use the same template name and input object.</p>\n <p className=\"flex min-w-0 gap-3 break-words\"><Waves size={17} className=\"mt-1 shrink-0 text-cyan-300\" /> The first request can wake an idle worker; later requests reuse it until the idle window closes.</p>\n <p className=\"flex min-w-0 gap-3 break-words\"><Check size={17} className=\"mt-1 shrink-0 text-emerald-300\" /> Outputs are returned as durable URLs or structured JSON, never provider pod identifiers.</p>\n </div>\n {cog.upstream && <a href={cog.upstream} target=\"_blank\" rel=\"noreferrer\" className=\"mt-6 inline-flex items-center gap-2 text-xs font-bold text-white/55 hover:text-white\">Upstream model <ExternalLink size={13} /></a>}\n </aside>\n </div>\n\n <nav className=\"mt-14 grid gap-3 border-t border-white/10 pt-8 sm:grid-cols-2\" aria-label=\"More Cog showcases\">\n <a href={`/cogs/${previous.slug}`} className=\"group rounded-2xl border border-white/10 bg-white/[0.02] p-5 transition hover:border-white/20 hover:bg-white/[0.045]\">\n <span className=\"flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-white/32\"><ChevronLeft size={13} /> Previous</span>\n <span className=\"mt-2 block text-lg font-black group-hover:text-cyan-200\">{previous.title}</span>\n </a>\n <a href={`/cogs/${next.slug}`} className=\"group rounded-2xl border border-white/10 bg-white/[0.02] p-5 text-right transition hover:border-white/20 hover:bg-white/[0.045]\">\n <span className=\"flex items-center justify-end gap-1 text-[10px] font-bold uppercase tracking-wider text-white/32\">Next <ChevronRight size={13} /></span>\n <span className=\"mt-2 block text-lg font-black group-hover:text-violet-200\">{next.title}</span>\n </a>\n </nav>\n </section>\n </main>\n );\n};\n","import React from 'react';\nimport { ArrowRight, ArrowUpRight, BarChart3, CheckCircle2, ExternalLink, Gauge, Play, ShieldAlert, Sparkles } from 'lucide-react';\nimport { evalModalities, evalSourceBySlug, evalSources, type EvalLaunch, type EvalSource } from './evalData';\n\nconst surfaceStyle: Record<EvalLaunch['surface'], string> = {\n Gateway: 'border-cyan-300/20 bg-cyan-300/10 text-cyan-100',\n Comfy: 'border-fuchsia-300/20 bg-fuchsia-300/10 text-fuchsia-100',\n Agent: 'border-amber-300/20 bg-amber-300/10 text-amber-100',\n Evals: 'border-emerald-300/20 bg-emerald-300/10 text-emerald-100',\n};\n\nconst SourceCard: React.FC<{ source: EvalSource }> = ({ source }) => (\n <a\n href={`/evals/${source.slug}`}\n className=\"group flex min-h-64 flex-col rounded-2xl border border-white/10 bg-white/[0.025] p-6 transition hover:-translate-y-0.5 hover:border-white/25 hover:bg-white/[0.045]\"\n >\n <div className=\"flex items-start justify-between gap-4\">\n <div>\n <p className=\"text-[11px] font-semibold uppercase tracking-[0.18em] text-white/35\">{source.eyebrow}</p>\n <h2 className=\"mt-2 text-xl font-bold tracking-tight text-white\">{source.name}</h2>\n </div>\n <ArrowUpRight className=\"h-5 w-5 text-white/20 transition group-hover:text-white/70\" />\n </div>\n <p className=\"mt-3 text-sm leading-6 text-white/55\">{source.description}</p>\n <div className=\"mt-4 flex flex-wrap gap-1.5\">\n {source.modalities.map((modality) => (\n <span key={modality} className=\"rounded-full border border-white/10 px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-white/45\">\n {evalModalities.find((item) => item.id === modality)?.label}\n </span>\n ))}\n </div>\n <div className=\"mt-auto flex items-center gap-2 pt-6 text-xs font-semibold text-white/75\">\n {source.launches.length} runnable paths <ArrowRight className=\"h-3.5 w-3.5\" />\n </div>\n </a>\n);\n\nconst LaunchCard: React.FC<{ launch: EvalLaunch }> = ({ launch }) => (\n <a href={launch.href} className=\"group flex flex-col rounded-2xl border border-white/10 bg-black/25 p-5 transition hover:border-white/25 hover:bg-white/[0.04]\">\n <div className=\"flex items-center justify-between gap-3\">\n <span className={`rounded-full border px-2.5 py-1 text-[10px] font-bold uppercase tracking-[0.14em] ${surfaceStyle[launch.surface]}`}>\n {launch.surface}\n </span>\n <Play className=\"h-4 w-4 text-white/25 transition group-hover:text-white/75\" />\n </div>\n <h3 className=\"mt-4 text-base font-bold text-white\">{launch.title}</h3>\n <code className=\"mt-1 text-[11px] text-white/35\">{launch.model}</code>\n <p className=\"mt-3 text-sm leading-6 text-white/55\">{launch.description}</p>\n <div className=\"mt-auto flex flex-wrap gap-1.5 pt-4\">\n {launch.tags.map((tag) => <span key={tag} className=\"text-[10px] text-white/35\">#{tag.replaceAll(' ', '-')}</span>)}\n </div>\n </a>\n);\n\nconst Method: React.FC<{ number: string; title: string; text: string }> = ({ number, title, text }) => (\n <div className=\"relative border-l border-white/10 pb-8 pl-8 last:border-transparent last:pb-0\">\n <span className=\"absolute -left-3.5 top-0 grid h-7 w-7 place-items-center rounded-full border border-white/15 bg-black text-[10px] font-bold text-white/60\">{number}</span>\n <h3 className=\"font-semibold text-white\">{title}</h3>\n <p className=\"mt-1 text-sm leading-6 text-white/50\">{text}</p>\n </div>\n);\n\nconst EvalHub: React.FC = () => (\n <main className=\"overflow-hidden px-4 pb-24 pt-28 sm:px-6\">\n <section className=\"relative mx-auto max-w-6xl\">\n <div className=\"pointer-events-none absolute -left-32 -top-40 h-96 w-96 rounded-full bg-cyan-500/10 blur-[100px]\" />\n <div className=\"pointer-events-none absolute right-0 top-10 h-80 w-80 rounded-full bg-fuchsia-500/10 blur-[110px]\" />\n <header className=\"relative max-w-4xl\">\n <div className=\"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.035] px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.18em] text-white/55\">\n <BarChart3 className=\"h-3.5 w-3.5\" /> Model evals → working inference\n </div>\n <h1 className=\"mt-6 text-4xl font-bold tracking-[-0.04em] text-white sm:text-6xl\">\n A leaderboard is a lead,<br /><span className=\"text-white/45\">not the decision.</span>\n </h1>\n <p className=\"mt-6 max-w-3xl text-lg font-light leading-8 text-white/60\">\n Read independent evidence from Artificial Analysis and other maintained evals, open the exact models we host, then verify the shortlist on your prompts. One flow from public benchmark to production usage.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"#sources\" className=\"inline-flex items-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-bold text-black\">Explore sources <ArrowRight className=\"h-4 w-4\" /></a>\n <a href=\"/tools/bulk-evals\" className=\"inline-flex items-center gap-2 rounded-lg border border-white/15 bg-white/[0.035] px-4 py-2.5 text-sm font-semibold text-white\">Run your eval <Gauge className=\"h-4 w-4\" /></a>\n </div>\n </header>\n\n <section className=\"relative mt-16 grid overflow-hidden rounded-2xl border border-white/10 bg-white/[0.025] md:grid-cols-4\">\n {[\n ['01', 'Find evidence', 'Use live sources, methodology, and uncertainty—not copied score snapshots.'],\n ['02', 'Shortlist models', 'Match the benchmark modality and task distribution to the work you actually have.'],\n ['03', 'Run the model', 'Open hosted gateway inference, a cloud agent, or a tested Comfy GPU workflow.'],\n ['04', 'Keep the regression', 'Turn representative prompts and failures into a repeatable acceptance suite.'],\n ].map(([n, title, text], index) => (\n <div key={n} className={`p-6 ${index ? 'border-t border-white/10 md:border-l md:border-t-0' : ''}`}>\n <p className=\"font-mono text-xs text-emerald-300/70\">{n}</p>\n <h2 className=\"mt-3 font-bold text-white\">{title}</h2>\n <p className=\"mt-2 text-sm leading-6 text-white/45\">{text}</p>\n </div>\n ))}\n </section>\n\n <section id=\"sources\" className=\"relative mt-20 scroll-mt-24\">\n <div className=\"mb-7 flex flex-col justify-between gap-3 sm:flex-row sm:items-end\">\n <div>\n <p className=\"text-xs font-semibold uppercase tracking-[0.18em] text-white/35\">Independent evidence</p>\n <h2 className=\"mt-2 text-3xl font-bold tracking-tight text-white\">Choose the question before the ranking</h2>\n </div>\n <p className=\"max-w-md text-sm leading-6 text-white/45\">Every source below links to its live result and methodology. app.nz does not present old leaderboard values as current facts.</p>\n </div>\n <div className=\"grid gap-4 md:grid-cols-2 lg:grid-cols-3\">\n {evalSources.map((source) => <SourceCard key={source.slug} source={source} />)}\n </div>\n </section>\n\n <section className=\"mt-20 grid gap-8 rounded-3xl border border-white/10 bg-gradient-to-br from-emerald-400/[0.08] to-cyan-400/[0.03] p-7 md:grid-cols-[0.8fr_1.2fr] md:p-10\">\n <div>\n <Sparkles className=\"h-5 w-5 text-emerald-300\" />\n <h2 className=\"mt-4 text-2xl font-bold text-white\">The useful eval loop</h2>\n <p className=\"mt-3 text-sm leading-6 text-white/55\">Public benchmarks are discovery data. Your acceptance suite is deployment data. Keep both, and record model version, provider route, prompt, settings, latency, cost, and failures.</p>\n <a href=\"/blog/from-leaderboards-to-production-evals\" className=\"mt-5 inline-flex items-center gap-2 text-sm font-semibold text-emerald-200\">Read the field guide <ArrowRight className=\"h-4 w-4\" /></a>\n </div>\n <div>\n <Method number=\"1\" title=\"Start wide\" text=\"Use multiple source types: objective tasks, human preference, agentic work, speed, and price.\" />\n <Method number=\"2\" title=\"Run representative work\" text=\"Include normal inputs, hard inputs, policy edges, and known failure cases from production.\" />\n <Method number=\"3\" title=\"Choose cost per accepted output\" text=\"Cheapest per token or GPU-second is irrelevant if retries erase the saving.\" />\n <Method number=\"4\" title=\"Re-run on change\" text=\"Model aliases, provider behavior, workflows, and prompts all change; regression data makes the change visible.\" />\n </div>\n </section>\n </section>\n </main>\n);\n\nconst EvalDetail: React.FC<{ source: EvalSource }> = ({ source }) => (\n <main className=\"px-4 pb-24 pt-28 sm:px-6\">\n <div className=\"mx-auto max-w-6xl\">\n <a href=\"/evals\" className=\"inline-flex items-center gap-2 text-sm font-semibold text-white/45 hover:text-white\"><ArrowRight className=\"h-4 w-4 rotate-180\" /> All eval sources</a>\n <header className=\"mt-8 grid gap-8 lg:grid-cols-[1fr_360px] lg:items-end\">\n <div>\n <p className=\"text-xs font-semibold uppercase tracking-[0.2em] text-emerald-300/70\">{source.operator} · {source.eyebrow}</p>\n <h1 className=\"mt-3 text-4xl font-bold tracking-[-0.04em] text-white sm:text-6xl\">{source.name}</h1>\n <p className=\"mt-5 max-w-3xl text-lg font-light leading-8 text-white/60\">{source.description}</p>\n </div>\n <div className=\"flex flex-col gap-2 sm:flex-row lg:flex-col\">\n <a href={source.href} target=\"_blank\" rel=\"noreferrer\" className=\"inline-flex items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-bold text-black\">Open live leaderboard <ExternalLink className=\"h-4 w-4\" /></a>\n <a href={source.methodologyHref} target=\"_blank\" rel=\"noreferrer\" className=\"inline-flex items-center justify-center gap-2 rounded-lg border border-white/15 bg-white/[0.03] px-4 py-2.5 text-sm font-semibold text-white\">Read methodology <ExternalLink className=\"h-4 w-4\" /></a>\n </div>\n </header>\n\n <section className=\"mt-12 grid gap-4 lg:grid-cols-[1fr_1fr_1fr]\">\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.025] p-6\">\n <CheckCircle2 className=\"h-5 w-5 text-emerald-300\" />\n <h2 className=\"mt-4 font-bold text-white\">What it measures</h2>\n <ul className=\"mt-3 space-y-3 text-sm leading-6 text-white/55\">{source.measures.map((item) => <li key={item} className=\"flex gap-2\"><span className=\"text-emerald-300/70\">•</span>{item}</li>)}</ul>\n </div>\n <div className=\"rounded-2xl border border-cyan-300/10 bg-cyan-300/[0.035] p-6\">\n <Gauge className=\"h-5 w-5 text-cyan-300\" />\n <h2 className=\"mt-4 font-bold text-white\">Use it for</h2>\n <p className=\"mt-3 text-sm leading-6 text-white/55\">{source.usefulFor}</p>\n <p className=\"mt-5 border-t border-white/10 pt-4 text-xs leading-5 text-white/35\">{source.updateNote}</p>\n </div>\n <div className=\"rounded-2xl border border-amber-300/10 bg-amber-300/[0.035] p-6\">\n <ShieldAlert className=\"h-5 w-5 text-amber-300\" />\n <h2 className=\"mt-4 font-bold text-white\">Read with care</h2>\n <p className=\"mt-3 text-sm leading-6 text-white/55\">{source.caution}</p>\n </div>\n </section>\n\n <section className=\"mt-16\">\n <div className=\"flex flex-col justify-between gap-3 sm:flex-row sm:items-end\">\n <div>\n <p className=\"text-xs font-semibold uppercase tracking-[0.18em] text-white/35\">From evidence to usage</p>\n <h2 className=\"mt-2 text-3xl font-bold tracking-tight text-white\">Run the closest available path</h2>\n </div>\n <p className=\"max-w-md text-sm leading-6 text-white/45\">These are availability mappings, not claims that an app.nz route reproduces the source’s score or harness.</p>\n </div>\n <div className=\"mt-7 grid gap-4 md:grid-cols-2 lg:grid-cols-3\">{source.launches.map((launch) => <LaunchCard key={launch.title} launch={launch} />)}</div>\n </section>\n\n <section className=\"mt-16 rounded-2xl border border-white/10 bg-white/[0.025] p-7 sm:flex sm:items-center sm:justify-between sm:gap-8\">\n <div>\n <h2 className=\"text-xl font-bold text-white\">Make the final decision on your data</h2>\n <p className=\"mt-2 max-w-2xl text-sm leading-6 text-white/50\">Keep public evidence as context, then score representative inputs with a frozen rubric. Inspect failures—not only the mean.</p>\n </div>\n <a href=\"/tools/bulk-evals\" className=\"mt-5 inline-flex shrink-0 items-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-bold text-black sm:mt-0\">Build an eval set <ArrowRight className=\"h-4 w-4\" /></a>\n </section>\n </div>\n </main>\n);\n\nexport const EvalsPage: React.FC<{ slug?: string }> = ({ slug }) => {\n if (!slug) return <EvalHub />;\n const source = evalSourceBySlug[slug];\n if (!source) return <EvalHub />;\n return <EvalDetail source={source} />;\n};\n","import React from 'react';\nimport {\n ArrowRight,\n Building2,\n ClipboardList,\n FileCheck,\n Globe2,\n KeyRound,\n Lock,\n Mail,\n Network,\n ScrollText,\n ShieldCheck,\n Users,\n Wallet,\n} from 'lucide-react';\n\ntype Status = 'live' | 'in progress' | 'roadmap' | 'on request';\n\nconst statusStyles: Record<Status, string> = {\n live: 'border-emerald-400/25 bg-emerald-400/10 text-emerald-300',\n 'in progress': 'border-amber-400/25 bg-amber-400/10 text-amber-300',\n roadmap: 'border-white/15 bg-white/[0.06] text-white/55',\n 'on request': 'border-sky-400/25 bg-sky-400/10 text-sky-300',\n};\n\nconst StatusBadge: React.FC<{ status: Status }> = ({ status }) => (\n <span className={`rounded-full border px-3 py-1 text-[10px] font-bold uppercase tracking-[0.16em] ${statusStyles[status]}`}>\n {status}\n </span>\n);\n\nconst capabilities: {\n icon: React.ComponentType<{ size?: number; className?: string }>;\n title: string;\n body: string;\n status: Status;\n href?: string;\n}[] = [\n {\n icon: Users,\n title: 'Organizations, roles, and RBAC',\n body: 'Owner, admin, member, and viewer roles per organization. Invite by email, change roles, remove members — every change lands in the audit log.',\n status: 'live',\n href: '/settings',\n },\n {\n icon: ScrollText,\n title: 'Audit logs',\n body: 'Settings changes, invites, role changes, and membership removals are recorded per user and per org, queryable from the API and the settings surface.',\n status: 'live',\n href: '/settings',\n },\n {\n icon: Wallet,\n title: 'Spend limits',\n body: 'Per-user spend limits are live in settings today; per-workspace limits that cap every member under one budget are on the roadmap.',\n status: 'live',\n href: '/settings',\n },\n {\n icon: KeyRound,\n title: 'API key management',\n body: 'Scoped keys with rotation, plus bring-your-own provider keys for the gateway. Keys are stored hashed; plaintext is shown once at creation.',\n status: 'live',\n href: '/api-keys',\n },\n {\n icon: Lock,\n title: 'SSO / SAML + SCIM',\n body: 'Google and GitHub sign-in are live for everyone. SAML SSO and SCIM directory sync are roadmap items for the contact-sales tier — talk to us if this is a blocker.',\n status: 'roadmap',\n },\n {\n icon: Network,\n title: 'Private networking',\n body: 'Dedicated network segments and private egress between your apps, addons, and agents. Roadmap; today workloads are isolated per container with scoped credentials.',\n status: 'roadmap',\n },\n {\n icon: Globe2,\n title: 'Data residency',\n body: 'A default GPU region (US or EU) is selectable in settings today. Hard residency guarantees that pin data and inference to a jurisdiction are roadmap.',\n status: 'roadmap',\n },\n {\n icon: FileCheck,\n title: 'BAA / DPA',\n body: 'A standard DPA is available on request. BAAs for healthcare workloads are handled case by case on the contact-sales tier.',\n status: 'on request',\n },\n];\n\nconst complianceRows = [\n {\n name: 'SOC 2 Type II',\n status: 'in progress' as Status,\n detail: 'Controls are being implemented and evidence collected; a report is not yet available. We will not claim certification before it exists.',\n },\n {\n name: 'Data processing agreement (DPA)',\n status: 'on request' as Status,\n detail: 'Standard DPA covering GDPR processor obligations, available for any paid plan via enterprise@app.nz.',\n },\n {\n name: 'Data export and deletion',\n status: 'live' as Status,\n detail: 'Self-serve export and account-deletion requests from settings; both are recorded in the audit log.',\n },\n {\n name: 'Subprocessor list',\n status: 'live' as Status,\n detail: 'Published on the security page and kept current as infrastructure changes.',\n },\n];\n\nexport const EnterprisePage: React.FC = () => (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-14 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(56,189,248,0.12),transparent_55%)]\" />\n <div className=\"relative mx-auto grid max-w-[1400px] gap-10 lg:grid-cols-2 lg:items-center\">\n <div>\n <div className=\"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.18em] text-white/58\">\n <Building2 size={12} className=\"text-sky-400\" />\n Enterprise\n </div>\n <h1 className=\"mt-6 max-w-[16ch] font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-6xl\">\n Agent cloud controls your security team can sign off on\n </h1>\n <p className=\"mt-6 max-w-xl text-base leading-8 text-white/72\">\n Organizations with roles and audit trails, spend limits, key management, and a published\n security posture. We label what is live, what is in progress, and what is roadmap — no\n compliance theater.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"mailto:enterprise@app.nz\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n <Mail size={16} /> Talk to us\n </a>\n <a href=\"/security\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n <ShieldCheck size={16} /> Security posture\n </a>\n </div>\n </div>\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.03] p-6\">\n <p className=\"text-xs font-bold uppercase tracking-[0.16em] text-white/45\">What teams get today</p>\n <ul className=\"mt-4 space-y-3\">\n {[\n 'Orgs with owner / admin / member / viewer roles',\n 'Email invites with expiring tokens, audit-logged',\n 'Per-user spend limits and analytics opt-out',\n 'API keys stored hashed, rotatable from /api-keys',\n 'Shared org agent feed: see every run across the team',\n ].map((line) => (\n <li key={line} className=\"flex items-start gap-3 text-sm leading-6 text-white/72\">\n <ShieldCheck size={15} className=\"mt-1 shrink-0 text-emerald-400\" />\n {line}\n </li>\n ))}\n </ul>\n <a href=\"/settings\" className=\"mt-5 inline-flex items-center gap-1 text-sm font-semibold text-sky-400 hover:text-sky-300\">\n Open settings <ArrowRight size={14} />\n </a>\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">capabilities</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Honest feature status, in writing</h2>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n Every card carries its real status. Live means you can use it right now; roadmap means we are\n building it and will scope timelines with you directly.\n </p>\n <div className=\"mt-8 grid gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n {capabilities.map((c) => {\n const Icon = c.icon;\n const inner = (\n <>\n <div className=\"flex items-center justify-between\">\n <Icon size={20} className=\"text-sky-400\" />\n <StatusBadge status={c.status} />\n </div>\n <h3 className=\"mt-4 font-display text-lg font-bold\">{c.title}</h3>\n <p className=\"mt-2 text-sm leading-6 text-white/65\">{c.body}</p>\n </>\n );\n return c.href ? (\n <a key={c.title} href={c.href} className=\"rounded-2xl border border-white/10 bg-white/[0.04] p-5 transition hover:border-sky-400/40\">\n {inner}\n </a>\n ) : (\n <div key={c.title} className=\"rounded-2xl border border-white/10 bg-white/[0.04] p-5\">\n {inner}\n </div>\n );\n })}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">compliance posture</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Where we actually stand</h2>\n <div className=\"mt-8 overflow-x-auto rounded-2xl border border-white/10\">\n <table className=\"w-full min-w-[640px] text-left text-sm\">\n <thead>\n <tr className=\"border-b border-white/10 text-[11px] font-bold uppercase tracking-[0.16em] text-white/45\">\n <th className=\"px-5 py-4\">Item</th>\n <th className=\"px-5 py-4\">Status</th>\n <th className=\"px-5 py-4\">Detail</th>\n </tr>\n </thead>\n <tbody>\n {complianceRows.map((r) => (\n <tr key={r.name} className=\"border-b border-white/5 last:border-0\">\n <td className=\"px-5 py-4 font-semibold text-white/85\">{r.name}</td>\n <td className=\"px-5 py-4\"><StatusBadge status={r.status} /></td>\n <td className=\"px-5 py-4 leading-6 text-white/65\">{r.detail}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <div className=\"mt-6 flex items-start gap-3 rounded-2xl border border-white/10 bg-white/[0.03] p-5\">\n <ClipboardList size={18} className=\"mt-0.5 shrink-0 text-sky-400\" />\n <p className=\"text-sm leading-7 text-white/65\">\n Need a security questionnaire filled in, a DPA countersigned, or a scoped pilot? Email{' '}\n <a href=\"mailto:enterprise@app.nz\" className=\"font-semibold text-sky-400 hover:text-sky-300\">enterprise@app.nz</a>{' '}\n — you talk to the people who run the infrastructure, not a sales layer.\n </p>\n </div>\n </div>\n </section>\n\n <section className=\"px-4 py-14 sm:px-8 sm:py-20 lg:px-12\">\n <div className=\"relative mx-auto max-w-[1400px] overflow-hidden rounded-3xl border border-white/10 bg-white/[0.03] px-6 py-12 text-center sm:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(56,189,248,0.14),transparent_60%)]\" />\n <div className=\"relative\">\n <h2 className=\"font-display text-2xl font-bold tracking-tight sm:text-4xl\">Bring your team; keep your controls</h2>\n <p className=\"mx-auto mt-4 max-w-2xl text-[15px] leading-8 text-white/70\">\n Start with an org and invites today, and tell us which roadmap item unblocks your rollout.\n </p>\n <div className=\"mt-8 flex flex-wrap items-center justify-center gap-3\">\n <a href=\"/settings\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n <Users size={16} /> Create your org\n </a>\n <a href=\"mailto:enterprise@app.nz\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n <Mail size={16} /> enterprise@app.nz\n </a>\n </div>\n </div>\n </div>\n </section>\n </main>\n);\n\nexport default EnterprisePage;\n","import React from 'react';\nimport {\n Boxes,\n Bug,\n Container,\n FileKey2,\n KeyRound,\n Lock,\n Mail,\n ShieldCheck,\n Trash2,\n} from 'lucide-react';\n\nconst pillars = [\n {\n icon: Lock,\n title: 'Encryption in transit',\n body: 'All public endpoints are TLS-only (1.2+, 1.3 preferred) behind the Cloudflare edge. Internal service hops that cross machines run over encrypted tunnels; plaintext HTTP never leaves a host.',\n },\n {\n icon: FileKey2,\n title: 'Encryption at rest',\n body: 'Databases, git repositories, build artifacts, and uploaded assets live on encrypted volumes. Backups are encrypted before they leave the origin machine.',\n },\n {\n icon: KeyRound,\n title: 'Key handling',\n body: 'Platform API keys are stored as salted hashes — plaintext is shown once at creation and cannot be recovered, only rotated. Bring-your-own provider keys and app secrets are injected into workloads at runtime and scrubbed from build and CI logs.',\n },\n {\n icon: Container,\n title: 'Isolation model',\n body: 'Agent runs and app workloads execute in dedicated containers, and provisioned GPU/CPU jobs in per-job VMs on the upstream provider. Each run gets scoped, short-lived credentials; untrusted code is sandboxed with network, filesystem, and time limits.',\n },\n {\n icon: Trash2,\n title: 'Data deletion',\n body: 'Request account deletion or a data export self-serve from settings; both are audit-logged. Deletion removes your account rows, repos, deployments, and stored artifacts, with backups aging out on their normal rotation (30 days or less).',\n },\n {\n icon: ShieldCheck,\n title: 'Access control',\n body: 'Organization RBAC (owner / admin / member / viewer), per-org audit logs, and admin actions gated server-side on every request — never by hiding UI.',\n },\n];\n\nconst subprocessors = [\n { name: 'Hetzner', purpose: 'Compute for hosted apps, agents, and databases', location: 'Germany / Finland / US' },\n { name: 'Cloudflare', purpose: 'Edge network, DNS, TLS termination, tunnels', location: 'Global' },\n { name: 'Google Cloud / Firebase', purpose: 'Sign-in (Google, GitHub, email) and identity tokens', location: 'US / EU' },\n { name: 'Stripe', purpose: 'Payments and billing; card data never touches our servers', location: 'US' },\n { name: 'AWS (SES)', purpose: 'Transactional email (invites, receipts, resets)', location: 'US' },\n { name: 'GitHub', purpose: 'Optional repo integration and the GitHub App webhook', location: 'US' },\n { name: 'RunPod', purpose: 'Serverless GPU execution tier for some workloads', location: 'US / EU' },\n {\n name: 'Model providers (OpenAI, Anthropic, Google, and others)',\n purpose: 'Inference — only for requests you explicitly route to them through the gateway',\n location: 'US / EU',\n },\n];\n\nexport const SecurityPage: React.FC = () => (\n <main className=\"overflow-hidden bg-black text-white\">\n <section className=\"relative border-b border-white/10 px-4 pb-14 pt-24 sm:px-8 lg:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(56,189,248,0.12),transparent_55%)]\" />\n <div className=\"relative mx-auto max-w-[1400px]\">\n <div className=\"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.18em] text-white/58\">\n <ShieldCheck size={12} className=\"text-sky-400\" />\n Security and trust\n </div>\n <h1 className=\"mt-6 max-w-[20ch] font-display text-4xl font-bold leading-[1.05] tracking-tight sm:text-6xl\">\n How app.nz protects your code, data, and keys\n </h1>\n <p className=\"mt-6 max-w-2xl text-base leading-8 text-white/72\">\n The concrete model: what is encrypted, how keys are handled, how workloads are isolated, who our\n subprocessors are, and how to reach us when you find a problem. For feature-level controls, see{' '}\n <a href=\"/enterprise\" className=\"font-semibold text-sky-400 hover:text-sky-300\">enterprise</a>.\n </p>\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <a href=\"mailto:security@app.nz\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-sky-400 px-6 text-sm font-bold text-black transition hover:bg-sky-300\">\n <Bug size={16} /> Report a vulnerability\n </a>\n <a href=\"/enterprise\" className=\"inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-white/12 bg-white/[0.04] px-6 text-sm font-bold text-white transition hover:bg-white hover:text-black\">\n Enterprise controls\n </a>\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">the model</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Six things we hold to</h2>\n <div className=\"mt-8 grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n {pillars.map((p) => {\n const Icon = p.icon;\n return (\n <div key={p.title} className=\"rounded-2xl border border-white/10 bg-white/[0.04] p-6\">\n <Icon size={20} className=\"text-sky-400\" />\n <h3 className=\"mt-4 font-display text-lg font-bold\">{p.title}</h3>\n <p className=\"mt-2 text-sm leading-6 text-white/65\">{p.body}</p>\n </div>\n );\n })}\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">vulnerability reporting</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Found something? Tell us directly</h2>\n <div className=\"mt-8 grid gap-4 lg:grid-cols-2\">\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.03] p-6\">\n <p className=\"flex items-center gap-2 text-xs font-bold uppercase tracking-[0.16em] text-white/45\">\n <Mail size={14} className=\"text-sky-400\" /> Contact\n </p>\n <p className=\"mt-4 text-sm leading-7 text-white/72\">\n Email <a href=\"mailto:security@app.nz\" className=\"font-semibold text-sky-400 hover:text-sky-300\">security@app.nz</a>{' '}\n with reproduction steps and impact. You will get a human response — typically within one\n business day — and status updates until the issue is resolved.\n </p>\n </div>\n <div className=\"rounded-2xl border border-white/10 bg-white/[0.03] p-6\">\n <p className=\"flex items-center gap-2 text-xs font-bold uppercase tracking-[0.16em] text-white/45\">\n <ShieldCheck size={14} className=\"text-sky-400\" /> Safe harbor\n </p>\n <p className=\"mt-4 text-sm leading-7 text-white/72\">\n Good-faith research against your own accounts and data is welcome: no legal action for\n testing that avoids service disruption, other customers' data, and social engineering.\n Give us reasonable time to fix before public disclosure; we credit reporters who want it.\n </p>\n </div>\n </div>\n </div>\n </section>\n\n <section className=\"border-b border-white/10 px-4 py-12 sm:px-8 sm:py-16 lg:px-12\">\n <div className=\"mx-auto max-w-[1400px]\">\n <p className=\"text-xs font-bold uppercase tracking-[0.22em] text-sky-400/90\">subprocessors</p>\n <h2 className=\"mt-3 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Who touches your data, and why</h2>\n <p className=\"mt-5 max-w-3xl text-base leading-8 text-white/72\">\n We keep this list short on purpose. Model providers only see the requests you route to them; the\n gateway never mirrors traffic to providers you did not pick.\n </p>\n <div className=\"mt-8 overflow-x-auto rounded-2xl border border-white/10\">\n <table className=\"w-full min-w-[640px] text-left text-sm\">\n <thead>\n <tr className=\"border-b border-white/10 text-[11px] font-bold uppercase tracking-[0.16em] text-white/45\">\n <th className=\"px-5 py-4\">Subprocessor</th>\n <th className=\"px-5 py-4\">Purpose</th>\n <th className=\"px-5 py-4\">Location</th>\n </tr>\n </thead>\n <tbody>\n {subprocessors.map((s) => (\n <tr key={s.name} className=\"border-b border-white/5 last:border-0\">\n <td className=\"px-5 py-4 font-semibold text-white/85\">{s.name}</td>\n <td className=\"px-5 py-4 leading-6 text-white/65\">{s.purpose}</td>\n <td className=\"px-5 py-4 text-white/55\">{s.location}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n </section>\n\n <section className=\"px-4 py-14 sm:px-8 sm:py-20 lg:px-12\">\n <div className=\"relative mx-auto max-w-[1400px] overflow-hidden rounded-3xl border border-white/10 bg-white/[0.03] px-6 py-12 text-center sm:px-12\">\n <div className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(56,189,248,0.14),transparent_60%)]\" />\n <div className=\"relative\">\n <Boxes size={22} className=\"mx-auto text-sky-400\" />\n <h2 className=\"mt-4 font-display text-2xl font-bold tracking-tight sm:text-4xl\">Questions a table can't answer?</h2>\n <p className=\"mx-auto mt-4 max-w-2xl text-[15px] leading-8 text-white/70\">\n Security questionnaires, DPAs, and architecture walkthroughs go through{' '}\n <a href=\"mailto:enterprise@app.nz\" className=\"font-semibold text-sky-400 hover:text-sky-300\">enterprise@app.nz</a>.\n Vulnerabilities go to <a href=\"mailto:security@app.nz\" className=\"font-semibold text-sky-400 hover:text-sky-300\">security@app.nz</a>.\n </p>\n </div>\n </div>\n </section>\n </main>\n);\n\nexport default SecurityPage;\n","import React, { Suspense } from 'react';\nimport { lazyWithReload as lazy } from './lib/lazyWithReload';\nimport { metaForPath, canonicalPath } from './components/platformPageMeta';\nimport { usePageMeta } from './components/usePageMeta';\nimport { SiteNav } from './components/SiteNav';\nimport { CommandPalette } from './components/CommandPalette';\nimport { SiteFooter } from './components/SiteFooter';\nimport { PlatformHome } from './components/PlatformHome';\nimport { PlatformRoutePage } from './components/PlatformRoutePage';\nimport { PlatformDocs } from './components/PlatformDocs';\nimport { CliPage } from './components/CliPage';\nimport { EndpointDoc } from './components/EndpointDoc';\nimport { GatewayPage } from './components/GatewayPage';\nimport { ModelsDirectory } from './components/ModelsDirectory';\nimport { ModelPage } from './components/ModelPage';\nimport { platformRouteByPath } from './components/platformRoutes';\nimport { SelfTestProbe } from './components/SelfTestProbe';\nimport { UseCaseDirectory } from './components/ai/UseCaseDirectory';\nimport { UseCasePage } from './components/ai/UseCasePage';\nimport AlternativesPage from './components/AlternativesPage';\nimport PromptLibraryPage from './components/PromptLibraryPage';\nimport { InvestorsPage } from './components/investors/InvestorsPage';\nimport { InvestorsVisionPage } from './components/investors/InvestorsVisionPage';\nimport { InvestorsDeepDivePage } from './components/investors/InvestorsDeepDivePage';\nimport { AddonsHubPage } from './components/addons/AddonsHubPage';\nimport { GobedAddonPage } from './components/addons/GobedAddonPage';\nimport { PostgresAddonPage } from './components/addons/PostgresAddonPage';\nimport { PapersShowcasePage } from './components/PapersShowcasePage';\nimport { RLPage } from './components/rl/RLPage';\nimport { CogExamplesHub } from './components/cogs/CogExamplesHub';\nimport { CogShowcasePage } from './components/cogs/CogShowcasePage';\nimport { EvalsPage } from './components/evals/EvalsPage';\nimport { EnterprisePage } from './components/enterprise/EnterprisePage';\nimport { SecurityPage } from './components/enterprise/SecurityPage';\nimport { navigate, useLocationPath } from './lib/router';\n\n// Keep prerendered marketing routes eager so hydration matches server markup.\n// Client-only app/auth/studio surfaces are lazy so the homepage bundle does not\n// include Firebase, editors, repo tooling, or studio code.\nconst AuthSection = lazy(() => import('./components/AuthSection'));\nconst PlatformShell = lazy(() => import('./components/PlatformShell').then((m) => ({ default: m.PlatformShell })));\nconst VisualBench = lazy(() => import('./components/VisualBench').then((m) => ({ default: m.VisualBench })));\nconst VideoEditor = lazy(() => import('./components/VideoEditor').then((m) => ({ default: m.VideoEditor })));\nconst ThreeDEditor = lazy(() => import('./components/threed/ThreeDEditor').then((m) => ({ default: m.ThreeDEditor })));\nconst ModelLibraryPage = lazy(() => import('./components/threed/ModelLibraryPage'));\nconst AnimFlowStudio = lazy(() => import('./components/AnimFlowStudio').then((m) => ({ default: m.AnimFlowStudio })));\nconst ManimAgentPage = lazy(() => import('./components/ManimAgentPage').then((m) => ({ default: m.ManimAgentPage })));\nconst MotionVfxLibraryPage = lazy(() => import('./components/animation/MotionVfxLibraryPage'));\nconst SpatialGalleryPage = lazy(() => import('./components/animation/SpatialGalleryPage'));\nconst AgentStudio = lazy(() => import('./components/AgentStudio').then((m) => ({ default: m.AgentStudio })));\nconst BrowserAgent = lazy(() => import('./components/BrowserAgent').then((m) => ({ default: m.BrowserAgent })));\nconst PackingAgent = lazy(() => import('./components/PackingAgent').then((m) => ({ default: m.PackingAgent })));\nconst SearchPage = lazy(() => import('./components/SearchPage').then((m) => ({ default: m.SearchPage })));\nconst PapersPage = lazy(() => import('./components/PapersPage').then((m) => ({ default: m.PapersPage })));\nconst PaperDetailPage = lazy(() => import('./components/PapersPage').then((m) => ({ default: m.PaperDetailPage })));\nconst AgentSdkPage = lazy(() => import('./components/AgentSdkPage'));\nconst IntegrationsPage = lazy(() => import('./components/IntegrationsPage'));\nconst SchedulersPage = lazy(() => import('./components/SchedulersPage').then((m) => ({ default: m.SchedulersPage })));\nconst AutoAgentsPage = lazy(() => import('./components/AutoAgentsPage').then((m) => ({ default: m.AutoAgentsPage })));\nconst SkillsPage = lazy(() => import('./components/SkillsPage').then((m) => ({ default: m.SkillsPage })));\nconst McpServersPage = lazy(() => import('./components/McpServersPage').then((m) => ({ default: m.McpServersPage })));\nconst DatasetsPage = lazy(() => import('./components/DatasetsPage').then((m) => ({ default: m.DatasetsPage })));\nconst NotebooksPage = lazy(() => import('./components/NotebooksPage').then((m) => ({ default: m.NotebooksPage })));\nconst NotebookPage = lazy(() => import('./components/NotebookPage').then((m) => ({ default: m.NotebookPage })));\nconst DashboardsPage = lazy(() => import('./components/DashboardsPage').then((m) => ({ default: m.DashboardsPage })));\nconst AnalyticsPage = lazy(() => import('./components/AnalyticsPage').then((m) => ({ default: m.AnalyticsPage })));\nconst DashboardPage = lazy(() => import('./components/DashboardPage').then((m) => ({ default: m.DashboardPage })));\nconst DeepResearchPage = lazy(() => import('./components/DeepResearchPage').then((m) => ({ default: m.DeepResearchPage })));\nconst DrawPage = lazy(() => import('./components/DrawPage').then((m) => ({ default: m.DrawPage })));\nconst DiffusionCanvasPage = lazy(() => import('./components/DiffusionCanvasPage'));\nconst LiveDrawPage = lazy(() => import('./components/LiveDrawPage'));\nconst WritePage = lazy(() => import('./components/WritePage').then((m) => ({ default: m.WritePage })));\nconst SheetsPage = lazy(() => import('./components/SheetsPage').then((m) => ({ default: m.SheetsPage })));\nconst ArtifactsPage = lazy(() => import('./components/ArtifactsPage').then((m) => ({ default: m.ArtifactsPage })));\nconst PullsInbox = lazy(() => import('./components/PullsInbox').then((m) => ({ default: m.PullsInbox })));\nconst MailPage = lazy(() => import('./components/MailPage').then((m) => ({ default: m.MailPage })));\nconst Profile = lazy(() => import('./components/Profile').then((m) => ({ default: m.Profile })));\nconst RepoHub = lazy(() => import('./components/RepoHub').then((m) => ({ default: m.RepoHub })));\nconst RepoView = lazy(() => import('./components/RepoView').then((m) => ({ default: m.RepoView })));\nconst CogStudio = lazy(() => import('./components/CogStudio').then((m) => ({ default: m.CogStudio })));\nconst TrainingPage = lazy(() => import('./components/TrainingPage').then((m) => ({ default: m.TrainingPage })));\nconst ComfyStudio = lazy(() => import('./components/ComfyStudio').then((m) => ({ default: m.ComfyStudio })));\nconst BuildStudio = lazy(() => import('./components/BuildStudio').then((m) => ({ default: m.BuildStudio })));\nconst CIPage = lazy(() => import('./components/CIPage').then((m) => ({ default: m.CIPage })));\nconst SiteBuilder = lazy(() => import('./components/SiteBuilder').then((m) => ({ default: m.SiteBuilder })));\nconst AssistantStudio = lazy(() => import('./components/AssistantStudio').then((m) => ({ default: m.AssistantStudio })));\nconst GroupChatStudio = lazy(() => import('./components/GroupChatStudio').then((m) => ({ default: m.GroupChatStudio })));\nconst CharacterGallery = lazy(() => import('./components/CharacterGallery').then((m) => ({ default: m.CharacterGallery })));\nconst Characters3DPage = lazy(() => import('./components/Characters3DPage').then((m) => ({ default: m.Characters3DPage })));\nconst CharacterTalk = lazy(() => import('./components/CharacterTalk').then((m) => ({ default: m.CharacterTalk })));\nconst ArtPage = lazy(() => import('./components/ArtPage').then((m) => ({ default: m.ArtPage })));\nconst MusicPage = lazy(() => import('./components/MusicPage').then((m) => ({ default: m.MusicPage })));\nconst AdminPage = lazy(() => import('./components/AdminPage').then((m) => ({ default: m.AdminPage })));\nconst ToolsHub = lazy(() => import('./components/ToolsHub').then((m) => ({ default: m.ToolsHub })));\nconst ToolPage = lazy(() => import('./components/ToolPage').then((m) => ({ default: m.ToolPage })));\nconst GpuClockerPage = lazy(() => import('./components/tools/GpuClocker').then((m) => ({ default: m.GpuClockerPage })));\nconst FusionPage = lazy(() => import('./components/FusionPage').then((m) => ({ default: m.FusionPage })));\nconst BlogHub = lazy(() => import('./components/BlogHub').then((m) => ({ default: m.BlogHub })));\nconst BlogPost = lazy(() => import('./components/BlogPost').then((m) => ({ default: m.BlogPost })));\nconst TimeSeriesForecastingPage = lazy(() => import('./components/TimeSeriesForecastingPage').then((m) => ({ default: m.TimeSeriesForecastingPage })));\nconst ProvidersApplyPage = lazy(() => import('./components/ProvidersApplyPage').then((m) => ({ default: m.ProvidersApplyPage })));\nconst SpacesIndexPage = lazy(() => import('./components/spaces/SpacesIndexPage'));\nconst SpacePage = lazy(() => import('./components/spaces/SpacePage'));\nconst AudioEditor = lazy(() => import('./components/audio/AudioEditor').then((m) => ({ default: m.AudioEditor })));\nconst ImageEditor = lazy(() => import('./components/image/ImageEditor').then((m) => ({ default: m.ImageEditor })));\nconst SlidesEditor = lazy(() => import('./components/slides/SlidesEditor').then((m) => ({ default: m.SlidesEditor })));\nconst VectorEditor = lazy(() => import('./components/vector/VectorEditor').then((m) => ({ default: m.VectorEditor })));\nconst VideoExtensionTool = lazy(() => import('./components/tools/VideoExtension').then((m) => ({ default: m.VideoExtensionTool })));\nconst TextToImagePage = lazy(() => import('./components/TextToImagePage'));\nconst TextureLibraryPage = lazy(() => import('./components/TextureLibraryPage'));\nconst ImageTo3DPage = lazy(() => import('./components/ImageTo3DPage'));\nconst TextTo3DPage = lazy(() => import('./components/TextTo3DPage'));\nconst PropsStudio = lazy(() => import('./components/props/PropsStudio'));\nconst VRMEditorPage = lazy(() => import('./components/vrm/VRMEditorPage'));\nconst PanoramaWorldStudio = lazy(() => import('./components/worlds/PanoramaWorldStudio'));\nconst FastVFXSpace = lazy(() => import('./components/FastVFXSpace').then((m) => ({ default: m.FastVFXSpace })));\nconst AbotWorldSpace = lazy(() => import('./components/WorldSessionSpace').then((m) => ({ default: m.AbotWorldSpace })));\nconst ArdySpace = lazy(() => import('./components/WorldSessionSpace').then((m) => ({ default: m.ArdySpace })));\nconst MediaServicesSpace = lazy(() => import('./components/MediaServicesSpace').then((m) => ({ default: m.MediaServicesSpace })));\nconst SamMaskAdjustSpace = lazy(() => import('./components/SamMaskAdjustSpace').then((m) => ({ default: m.SamMaskAdjustSpace })));\nconst SplatSpace = lazy(() => import('./components/SplatSpace').then((m) => ({ default: m.SplatSpace })));\nconst FastVideoSpace = lazy(() => import('./components/FastVideoSpace').then((m) => ({ default: m.FastVideoSpace })));\nconst AudioToAudioSpace = lazy(() => import('./components/AudioToAudioSpace').then((m) => ({ default: m.AudioToAudioSpace })));\nconst PlaygroundPage = lazy(() => import('./components/PlaygroundPage'));\nconst TermsPage = lazy(() => import('./components/TermsPage'));\nconst SettingsPage = lazy(() => import('./components/settings/SettingsPage').then((m) => ({ default: m.SettingsPage })));\nconst SocialSchedulerPage = lazy(() => import('./components/social/SocialSchedulerPage').then((m) => ({ default: m.SocialSchedulerPage })));\nconst CreationFeedPage = lazy(() => import('./components/CreationFeedPage'));\nconst DevelopersPage = lazy(() => import('./components/DevelopersPage'));\nconst SkillsMarketPage = lazy(() => import('./components/skills/SkillsMarketPage').then((m) => ({ default: m.SkillsMarketPage })));\nconst PrivacyPage = lazy(() => import('./components/PrivacyPage'));\nconst AppsMarketplacePage = lazy(() => import('./components/AppsMarketplacePage'));\nconst NeonRelayGame = lazy(() => import('./components/games/ArcadeGames').then((m) => ({ default: m.NeonRelayGame })));\nconst OrbitWordsGame = lazy(() => import('./components/games/ArcadeGames').then((m) => ({ default: m.OrbitWordsGame })));\nconst ReWordGame = lazy(() => import('./components/games/ArcadeGames').then((m) => ({ default: m.ReWordGame })));\nconst BigMultiplayerChessGame = lazy(() => import('./components/games/ArcadeGames').then((m) => ({ default: m.BigMultiplayerChessGame })));\nconst WordSmashingGame = lazy(() => import('./components/games/ArcadeGames').then((m) => ({ default: m.WordSmashingGame })));\nconst MultiplicationMasterGame = lazy(() => import('./components/games/ArcadeGames').then((m) => ({ default: m.MultiplicationMasterGame })));\nconst SignalOrchardGame = lazy(() => import('./components/games/SignalOrchardGame'));\nconst CartographersKitchenGame = lazy(() => import('./components/games/CartographersKitchenGame'));\nconst MuseumAfterMidnightGame = lazy(() => import('./components/games/MuseumAfterMidnightGame'));\n\nconst RouteFallback: React.FC = () => <div className=\"min-h-[70vh]\" aria-busy=\"true\" />;\n\n// Marketing wraps every public / auth page with the top nav and the shared\n// SiteFooter (sister-site links + legal), so footer coverage stays consistent\n// across home, platform routes, docs, gateway, and auth pages instead of being\n// inlined on the homepage only. routeKey keys the content region so a client\n// navigation remounts it and replays the route fade-in (these pages are\n// stateless renders, so remounting is free). flex-col + flex-1 keeps the footer\n// pinned to the bottom on short pages.\nconst Marketing: React.FC<{ children: React.ReactNode; routeKey?: string }> = ({ children, routeKey }) => (\n <div className=\"flex min-h-screen flex-col bg-black text-white selection:bg-white selection:text-black\">\n <SiteNav />\n <div key={routeKey} className=\"route-fade flex-1\">\n {children}\n </div>\n <SiteFooter />\n </div>\n);\n\nconst AuthShell: React.FC<{ children: React.ReactNode; routeKey?: string }> = ({ children, routeKey }) => (\n <Marketing routeKey={routeKey}>\n <Suspense fallback={<RouteFallback />}>{children}</Suspense>\n </Marketing>\n);\n\nconst AppShell: React.FC<{ path: string; children: React.ReactNode }> = ({ path, children }) => (\n <Suspense fallback={<RouteFallback />}>\n <PlatformShell path={path}>{children}</PlatformShell>\n </Suspense>\n);\n\nconst AppRoutes: React.FC<{ path?: string }> = ({ path: pathProp }) => {\n // Subscribe to the live location so client-side navigations (pushState via the\n // global router) actually re-render this tree. We can't lean on the root\n // re-rendering the same <App/> element on popstate: React's same-element /\n // same-props bailout skips it, so the route would never update (the URL\n // changed but the page stayed put — notably /signup rendering nothing). On the\n // server `pathProp` is supplied by entry-server and useLocationPath echoes it\n // for deterministic SSR/hydration.\n // Resolve aliases (/signin -> /login, /register -> /signup, ...) and strip any\n // trailing slash up front so every route check below sees the canonical path.\n const locationPath = useLocationPath(pathProp);\n const path = canonicalPath(locationPath);\n React.useEffect(() => {\n const normalizedLocation = locationPath.replace(/\\/$/, '') || '/';\n if (normalizedLocation !== path && typeof window !== 'undefined') {\n navigate(path + window.location.search + window.location.hash, { replace: true });\n }\n }, [locationPath, path]);\n const pageMeta = metaForPath(path);\n usePageMeta(pageMeta.title, pageMeta.description);\n\n if (path === '/login') return <AuthShell routeKey={path}><AuthSection kind=\"login\" /></AuthShell>;\n if (path === '/signup') return <AuthShell routeKey={path}><AuthSection kind=\"register\" /></AuthShell>;\n if (path === '/forgot-password' || path === '/reset-password') return <AuthShell routeKey={path}><AuthSection kind=\"reset\" /></AuthShell>;\n if (path === '/account') return <AuthShell routeKey={path}><AuthSection kind=\"account\" /></AuthShell>;\n if (path === '/api-keys' || path === '/api-keys/') return <AuthShell routeKey={path}><AuthSection kind=\"apiKeys\" /></AuthShell>;\n if (path === '/settings' || path === '/settings/') return <AuthShell routeKey={path}><SettingsPage /></AuthShell>;\n\n const shell = (node: React.ReactNode) => <AppShell path={path}>{node}</AppShell>;\n\n if (path === '/studio' || path === '/studio/' || path === '/video' || path === '/video/') return shell(<VideoEditor />);\n if (path === '/3d-editor' || path === '/3d-editor/' || path === '/3d' || path === '/3d/' || path === '/3d-studio' || path === '/3d-studio/') return shell(<ThreeDEditor />);\n if (path === '/spaces/creator-lab' || path === '/spaces/blender-lab' || path === '/spaces/unreal-lab') return shell(<ThreeDEditor />);\n if (path === '/animflow' || path === '/animflow/' || path === '/animation' || path === '/animation/') return shell(<AnimFlowStudio />);\n if (path === '/manim' || path === '/manim/' || path === '/manim-agent' || path === '/manim-agent/') return shell(<ManimAgentPage />);\n if (path === '/visualbench' || path === '/visualbench/') return shell(<VisualBench />);\n if (path === '/agent' || path === '/agent/') return shell(<AgentStudio />);\n if (path === '/browser-agent' || path === '/browser-agent/') return shell(<BrowserAgent />);\n if (path === '/3d-packing' || path === '/3d-packing/' || path === '/packing' || path === '/packing/') return shell(<PackingAgent />);\n if (path === '/search' || path === '/search/' || path.startsWith('/search/')) return shell(<SearchPage />);\n if (path === '/papers' || path === '/papers/') return shell(<PapersPage />);\n if (path.startsWith('/papers/')) return shell(<PaperDetailPage id={decodeURIComponent(path.replace(/^\\/papers\\//, '').replace(/\\/$/, ''))} />);\n if (path === '/agents-sdk' || path === '/agents-sdk/') return shell(<AgentSdkPage />);\n if (path === '/schedulers' || path === '/schedulers/') return shell(<SchedulersPage />);\n if (path === '/social' || path === '/social/' || path === '/social-scheduler' || path === '/social-scheduler/') return shell(<SocialSchedulerPage />);\n if (path === '/feed' || path === '/feed/' || path === '/explore' || path === '/explore/') return shell(<CreationFeedPage />);\n if (path === '/developers' || path === '/developers/') return shell(<DevelopersPage />);\n if (path === '/auto-agents' || path === '/auto-agents/' || path === '/monitors' || path === '/monitors/') return shell(<AutoAgentsPage />);\n if (path === '/skills/market' || path === '/skills/market/' || path === '/skills-market' || path === '/skills-market/') {\n return (\n <Marketing routeKey={path}>\n <Suspense fallback={<RouteFallback />}>\n <SkillsMarketPage />\n </Suspense>\n </Marketing>\n );\n }\n if (path === '/skills' || path === '/skills/') return shell(<SkillsPage />);\n if (path === '/datasets' || path === '/datasets/' || path.startsWith('/datasets/')) return shell(<DatasetsPage />);\n if (path === '/notebooks' || path === '/notebooks/') return shell(<NotebooksPage />);\n if (path.startsWith('/notebooks/')) {\n const nbSlug = decodeURIComponent(path.replace(/^\\/notebooks\\//, '').replace(/\\/$/, ''));\n return shell(<NotebookPage slug={nbSlug} />);\n }\n if (path === '/analytics' || path === '/analytics/') return shell(<AnalyticsPage />);\n if (path === '/dashboards' || path === '/dashboards/') return shell(<DashboardsPage />);\n if (path.startsWith('/dashboards/')) {\n const dashboardSlug = decodeURIComponent(path.replace(/^\\/dashboards\\//, '').replace(/\\/$/, ''));\n return shell(<DashboardPage slug={dashboardSlug} />);\n }\n if (path === '/deep-research' || path === '/deep-research/' || path === '/research' || path === '/research/') return shell(<DeepResearchPage />);\n if (path === '/draw' || path === '/draw/' || path === '/whiteboard' || path === '/whiteboard/') return shell(<DrawPage />);\n if (path === '/diffusion' || path === '/diffusion/' || path === '/canvas' || path === '/canvas/') return shell(<DiffusionCanvasPage />);\n if (path === '/livedraw' || path === '/livedraw/' || path === '/live-draw' || path === '/live-draw/') return shell(<LiveDrawPage />);\n if (path === '/write' || path === '/write/' || path === '/docs-editor' || path === '/docs-editor/') return shell(<WritePage />);\n if (path === '/sheets' || path === '/sheets/' || path === '/spreadsheet' || path === '/spreadsheet/') return shell(<SheetsPage />);\n if (path === '/audio' || path === '/audio/' || path === '/audio-editor' || path === '/audio-editor/') return shell(<AudioEditor />);\n if (path === '/image' || path === '/image/' || path === '/image-editor' || path === '/image-editor/' || path === '/photo' || path === '/photo/') return shell(<ImageEditor />);\n if (path === '/slides' || path === '/slides/' || path === '/presentation' || path === '/presentation/') return shell(<SlidesEditor />);\n if (path === '/vector' || path === '/vector/' || path === '/svg-editor' || path === '/svg-editor/') return shell(<VectorEditor />);\n if (path === '/artifacts' || path === '/artifacts/' || path === '/library' || path === '/library/') return shell(<ArtifactsPage />);\n if (path === '/pulls' || path === '/pulls/') return shell(<PullsInbox />);\n if (path === '/mail' || path === '/mail/' || path === '/email' || path === '/email/') return shell(<MailPage />);\n\n if (path.startsWith('/u/')) {\n const handle = decodeURIComponent(path.replace(/^\\/u\\//, '').replace(/\\/$/, '').split('/')[0]);\n return shell(<Profile handle={handle} />);\n }\n\n if (path === '/repos' || path === '/repos/') return shell(<RepoHub />);\n if (path.startsWith('/repos/')) return shell(<RepoView />);\n if (path === '/cogs' || path === '/cogs/') return shell(<CogStudio />);\n if (path === '/cogs/examples' || path === '/cogs/examples/') return <Marketing routeKey={path}><CogExamplesHub /></Marketing>;\n if (path.startsWith('/cogs/')) {\n const slug = decodeURIComponent(path.slice('/cogs/'.length).replace(/\\/$/, ''));\n return <Marketing routeKey={path}><CogShowcasePage slug={slug} /></Marketing>;\n }\n if (path === '/training' || path === '/training/' || path === '/fine-tuning' || path === '/fine-tuning/') return shell(<TrainingPage />);\n if (path === '/comfy' || path === '/comfy/') return shell(<ComfyStudio />);\n // One-click deploy badge target: /deploy?image=… (heroku-button style).\n if (path === '/deploy' || path === '/deploy/') return shell(<CogStudio />);\n if (path === '/skills' || path === '/skills/') return shell(<SkillsPage />);\n if (path === '/builds' || path === '/builds/') return shell(<BuildStudio />);\n if (path === '/ci' || path === '/ci/') return shell(<CIPage />);\n if (path === '/sites' || path === '/sites/') return shell(<SiteBuilder />);\n\n if (path === '/assistants' || path === '/assistants/' || path.startsWith('/assistants/')) {\n const slug = path.startsWith('/assistants/')\n ? decodeURIComponent(path.replace(/^\\/assistants\\//, '').replace(/\\/$/, ''))\n : '';\n return shell(<AssistantStudio initialSlug={slug || undefined} />);\n }\n if (path === '/group-chat' || path === '/group-chats' || path === '/groups') return shell(<GroupChatStudio />);\n\n if (path === '/admin' || path === '/admin/') return shell(<AdminPage />);\n if (path === '/characters-3d' || path === '/characters-3d/' || path === '/3d-characters' || path === '/3d-characters/') return shell(<Characters3DPage />);\n if (path.startsWith('/characters-3d/')) {\n const slug = decodeURIComponent(path.replace(/^\\/characters-3d\\//, '').replace(/\\/$/, ''));\n return shell(<CharacterTalk slug={slug} />);\n }\n if (path === '/characters' || path === '/characters/') return shell(<CharacterGallery initialMode=\"characters\" />);\n if (path === '/art' || path === '/art/') return shell(<ArtPage />);\n if (path === '/music' || path === '/music/') return shell(<MusicPage />);\n if (path === '/docs' || path === '/docs/') return <Marketing routeKey={path}><PlatformDocs /></Marketing>;\n if (path.startsWith('/docs/')) {\n // Per-endpoint reference pages at /docs/{slug}. Skip file-like paths\n // (e.g. /docs/architecture.md) so static doc assets still serve.\n const slug = path.replace(/^\\/docs\\//, '').replace(/\\/$/, '');\n if (slug && !slug.includes('/') && !slug.includes('.')) {\n return <Marketing routeKey={path}><EndpointDoc slug={decodeURIComponent(slug)} /></Marketing>;\n }\n }\n if (path === '/cli' || path === '/cli/') return <Marketing routeKey={path}><CliPage /></Marketing>;\n if (path === '/gateway' || path === '/gateway/') return <Marketing routeKey={path}><GatewayPage /></Marketing>;\n // Investor room: eager imports + pure static JSX so prerender bakes real SSR markup.\n if (path === '/investors' || path === '/investors/') return <Marketing routeKey={path}><InvestorsPage /></Marketing>;\n if (path === '/investors/vision' || path === '/investors/vision/') return <Marketing routeKey={path}><InvestorsVisionPage /></Marketing>;\n if (path === '/investors/deep-dive' || path === '/investors/deep-dive/') return <Marketing routeKey={path}><InvestorsDeepDivePage /></Marketing>;\n // Hosted addons: eager marketing pages (gobed GPU vector search, managed Postgres).\n if (path === '/addons' || path === '/addons/') return <Marketing routeKey={path}><AddonsHubPage /></Marketing>;\n if (path === '/addons/gobed' || path === '/addons/gobed/') return <Marketing routeKey={path}><GobedAddonPage /></Marketing>;\n if (path === '/addons/postgres' || path === '/addons/postgres/' || path === '/addons/postgresql' || path === '/addons/postgresql/') return <Marketing routeKey={path}><PostgresAddonPage /></Marketing>;\n if (path === '/rl' || path === '/rl/') return <Marketing routeKey={path}><RLPage /></Marketing>;\n if (path === '/enterprise' || path === '/enterprise/') return <Marketing routeKey={path}><EnterprisePage /></Marketing>;\n if (path === '/security' || path === '/security/') return <Marketing routeKey={path}><SecurityPage /></Marketing>;\n if (path === '/products/papers' || path === '/products/papers/') return <Marketing routeKey={path}><PapersShowcasePage /></Marketing>;\n if (path === '/models' || path === '/models/') return <Marketing routeKey={path}><ModelsDirectory /></Marketing>;\n if (path.startsWith('/models/')) {\n const id = path.replace(/^\\/models\\//, '').replace(/\\/$/, '');\n return <Marketing routeKey={path}><ModelPage modelId={id} /></Marketing>;\n }\n if (path === '/evals' || path === '/evals/') return <Marketing routeKey={path}><EvalsPage /></Marketing>;\n if (path.startsWith('/evals/')) {\n const slug = decodeURIComponent(path.slice('/evals/'.length).split('/')[0]);\n return <Marketing routeKey={path}><EvalsPage slug={slug} /></Marketing>;\n }\n\n const marketingLazy = (node: React.ReactNode) => (\n <Marketing routeKey={path}>\n <Suspense fallback={<RouteFallback />}>{node}</Suspense>\n </Marketing>\n );\n if (path === '/apps' || path === '/apps/') return marketingLazy(<AppsMarketplacePage />);\n if (path === '/games/neon-relay' || path === '/games/neon-relay/') return marketingLazy(<NeonRelayGame />);\n if (path === '/games/orbit-words' || path === '/games/orbit-words/') return marketingLazy(<OrbitWordsGame />);\n if (path === '/games/reword' || path === '/games/reword/') return marketingLazy(<ReWordGame />);\n if (path === '/games/big-multiplayer-chess' || path === '/games/big-multiplayer-chess/') return marketingLazy(<BigMultiplayerChessGame />);\n if (path === '/games/word-smashing' || path === '/games/word-smashing/') return marketingLazy(<WordSmashingGame />);\n if (path === '/games/multiplication-master' || path === '/games/multiplication-master/') return marketingLazy(<MultiplicationMasterGame />);\n if (path === '/games/signal-orchard' || path === '/games/signal-orchard/') return marketingLazy(<SignalOrchardGame />);\n if (path === '/games/cartographers-kitchen' || path === '/games/cartographers-kitchen/') return marketingLazy(<CartographersKitchenGame />);\n if (path === '/games/museum-after-midnight' || path === '/games/museum-after-midnight/') return marketingLazy(<MuseumAfterMidnightGame />);\n if (path === '/integrations' || path === '/integrations/') return marketingLazy(<IntegrationsPage />);\n if (path === '/mcp-servers' || path === '/mcp-servers/' || path === '/mcp' || path === '/mcp/') return marketingLazy(<McpServersPage />);\n if (path === '/gpu-clocker' || path === '/gpu-clocker/') return marketingLazy(<GpuClockerPage />);\n if (path === '/tools' || path === '/tools/') return marketingLazy(<ToolsHub />);\n if (path.startsWith('/tools/')) return marketingLazy(<ToolPage />);\n // /ai use-case pages render eagerly — they are prerendered for SEO and lazy\n // routes would bake only the Suspense fallback.\n if (path === '/ai' || path === '/ai/') return <Marketing routeKey={path}><UseCaseDirectory /></Marketing>;\n if (path.startsWith('/ai/')) {\n const aiSlug = decodeURIComponent(path.slice('/ai/'.length).split('/')[0]);\n return <Marketing routeKey={path}><UseCasePage slug={aiSlug} /></Marketing>;\n }\n if (path === '/video-extension' || path === '/video-extension/') return marketingLazy(<VideoExtensionTool standalone />);\n if (path === '/text-to-image' || path === '/text-to-image/') return marketingLazy(<TextToImagePage />);\n if (path === '/textures' || path === '/textures/') return marketingLazy(<TextureLibraryPage />);\n if (path === '/image-to-3d' || path === '/image-to-3d/') return marketingLazy(<ImageTo3DPage />);\n if (path === '/text-to-3d' || path === '/text-to-3d/') return marketingLazy(<TextTo3DPage />);\n if (path === '/props' || path === '/props/' || path === '/props-studio' || path === '/props-studio/') return marketingLazy(<PropsStudio />);\n if (path === '/vrm-editor' || path === '/vrm-editor/' || path === '/vrm' || path === '/vrm/' || path === '/character-editor' || path === '/character-editor/') return marketingLazy(<VRMEditorPage />);\n if (path === '/animation-library' || path === '/animation-library/') return marketingLazy(<MotionVfxLibraryPage />);\n if (path === '/3d-models' || path === '/3d-models/') return marketingLazy(<ModelLibraryPage />);\n if (path === '/vfx-library' || path === '/vfx-library/') return marketingLazy(<SpatialGalleryPage mode=\"vfx\" />);\n if (path === '/animation-gallery' || path === '/animation-gallery/') return marketingLazy(<SpatialGalleryPage mode=\"motion\" />);\n if (path === '/3d-object-gallery' || path === '/3d-object-gallery/') return marketingLazy(<SpatialGalleryPage mode=\"object\" />);\n if (path === '/image-to-3d-gallery' || path === '/image-to-3d-gallery/') return marketingLazy(<SpatialGalleryPage mode=\"image3d\" />);\n if (path === '/worlds' || path === '/worlds/' || path === '/panorama' || path === '/panorama/' || path === '/360-studio' || path === '/360-studio/') return marketingLazy(<PanoramaWorldStudio />);\n if (path === '/spaces/fast-vfx' || path === '/spaces/fast-vfx/') return marketingLazy(<FastVFXSpace />);\n if (path === '/spaces/abot-world' || path === '/spaces/abot-world/') return marketingLazy(<AbotWorldSpace />);\n if (path === '/spaces/ardy' || path === '/spaces/ardy/') return marketingLazy(<ArdySpace />);\n if (path === '/media-optimizer' || path === '/media-optimizer/' || path === '/image-cdn' || path === '/image-cdn/' || path === '/spaces/media-services' || path === '/spaces/media-services/') return marketingLazy(<MediaServicesSpace />);\n if (path === '/spaces/sam-mask-adjust' || path === '/spaces/sam-mask-adjust/') return marketingLazy(<SamMaskAdjustSpace />);\n if (path === '/spaces/splat' || path === '/spaces/splat/' || path === '/splat' || path === '/splat/') return marketingLazy(<SplatSpace />);\n if (path === '/spaces/fast-video' || path === '/spaces/fast-video/' || path === '/fast-video' || path === '/fast-video/') return marketingLazy(<FastVideoSpace />);\n if (path === '/spaces/audio-to-audio' || path === '/spaces/audio-to-audio/' || path === '/audio-to-audio' || path === '/audio-to-audio/') return marketingLazy(<AudioToAudioSpace />);\n if (path === '/spaces' || path === '/spaces/') return marketingLazy(<SpacesIndexPage />);\n if (path.startsWith('/spaces/')) {\n const slug = path.slice('/spaces/'.length).replace(/\\/$/, '');\n return marketingLazy(<SpacePage slug={slug} />);\n }\n if (path === '/alternatives' || path.startsWith('/alternatives/')) return marketingLazy(<AlternativesPage path={path} />);\n if (path === '/prompts' || path.startsWith('/prompts/')) return <Marketing routeKey={path}><PromptLibraryPage path={path} /></Marketing>;\n if (path === '/terms' || path === '/tos') return marketingLazy(<TermsPage />);\n if (path === '/privacy' || path === '/privacy-policy') return marketingLazy(<PrivacyPage />);\n if (path === '/playground' || path === '/playground/') return marketingLazy(<PlaygroundPage />);\n if (path === '/fusion' || path === '/fusion/') return marketingLazy(<FusionPage />);\n if (path === '/blog' || path === '/blog/') return marketingLazy(<BlogHub />);\n if (path.startsWith('/blog/')) {\n const blogSlug = decodeURIComponent(path.slice('/blog/'.length).split('/')[0]);\n return marketingLazy(<BlogPost slug={blogSlug} />);\n }\n if (path === '/time-series-forecasting' || path === '/time-series-forecasting/') return marketingLazy(<TimeSeriesForecastingPage />);\n if (path === '/download' || path === '/download/') return <Marketing routeKey={path}><main><PlatformHome /></main></Marketing>;\n if (path === '/providers' || path === '/providers/' || path === '/providers/apply' || path === '/providers/apply/') return marketingLazy(<ProvidersApplyPage />);\n\n const platformRoute = platformRouteByPath[path.replace(/\\/$/, '')];\n if (platformRoute) return <Marketing routeKey={path}><PlatformRoutePage route={platformRoute} /></Marketing>;\n\n // GitHub-style top-level handle: a single path segment that matched no known\n // route is treated as a user profile (e.g. /lee101). Profile renders a\n // \"not found\" state when the handle does not resolve.\n const handleMatch = path.replace(/\\/$/, '').match(/^\\/([A-Za-z0-9][A-Za-z0-9_-]*)$/);\n if (handleMatch) return shell(<Profile handle={decodeURIComponent(handleMatch[1])} />);\n\n // GitHub-style pretty repo URL: /<owner>/<name>[/tree|blob|commits|commit|pulls|pull|wiki/...]\n // matched last so every named route above wins; RepoView resolves via /api/repos/lookup\n // and renders its own not-found state for handles that aren't repos.\n const repoMatch = path.match(\n /^\\/([A-Za-z0-9][A-Za-z0-9_-]*)\\/([A-Za-z0-9][A-Za-z0-9._-]*?)(?:\\/(?:tree|blob|commits|commit|pulls|pull|wiki)(?:\\/.*)?)?$/,\n );\n if (repoMatch && !repoMatch[2].endsWith('.git')) return shell(<RepoView />);\n\n return (\n <Marketing routeKey={path}>\n <main>\n <PlatformHome />\n </main>\n </Marketing>\n );\n};\n\nconst App: React.FC<{ path?: string }> = (props) => (\n <>\n <AppRoutes {...props} />\n <CommandPalette />\n <SelfTestProbe />\n </>\n);\n\nexport default App;\n","// Lightweight client-side error reporter.\n//\n// Installs global handlers that POST uncaught errors and unhandled promise\n// rejections to /api/errors/js, where the Go server appends them to\n// monitoring/logs/frontend_error_reports.jsonl. The frontend error monitor then\n// enriches each minified stack frame with source maps and dispatches a codex\n// agent to auto-fix. Reporting is strictly best-effort: it must never throw and\n// must never become its own error source.\n\nexport type ErrorKind = 'error' | 'unhandledrejection' | 'react' | 'manual';\n\nexport interface ErrorReport {\n message: string;\n kind: ErrorKind;\n stack?: string;\n source?: string;\n line?: number;\n column?: number;\n componentStack?: string;\n url: string;\n userAgent: string;\n release?: string;\n ts: string;\n}\n\nconst ENDPOINT = '/api/errors/js';\nconst MAX_REPORTS_PER_SESSION = 25;\nconst seen = new Set<string>();\nlet sent = 0;\n\nfunction fingerprint(r: Pick<ErrorReport, 'kind' | 'message' | 'source' | 'line'>): string {\n return `${r.kind}|${r.message}|${r.source ?? ''}:${r.line ?? ''}`;\n}\n\nfunction send(report: ErrorReport): void {\n const fp = fingerprint(report);\n if (seen.has(fp) || sent >= MAX_REPORTS_PER_SESSION) return;\n seen.add(fp);\n sent += 1;\n try {\n const body = JSON.stringify(report);\n if (typeof navigator !== 'undefined' && typeof navigator.sendBeacon === 'function') {\n navigator.sendBeacon(ENDPOINT, new Blob([body], { type: 'application/json' }));\n } else {\n void fetch(ENDPOINT, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body,\n keepalive: true,\n }).catch(() => {});\n }\n } catch {\n /* swallow — reporting must never throw */\n }\n}\n\n/** Report an error explicitly (used by the React ErrorBoundary, and available for manual use). */\nexport function reportError(\n partial: Partial<ErrorReport> & { message: string; kind: ErrorKind },\n): void {\n if (typeof window === 'undefined') return;\n send({\n url: window.location.href,\n userAgent: navigator.userAgent,\n release: (import.meta as unknown as { env?: Record<string, string> }).env?.VITE_RELEASE,\n ts: new Date().toISOString(),\n ...partial,\n });\n}\n\nlet installed = false;\n\n/** Install global window error / unhandledrejection handlers. Idempotent; no-op during SSR. */\nexport function installErrorReporter(): void {\n if (installed || typeof window === 'undefined') return;\n installed = true;\n\n window.addEventListener('error', (e: ErrorEvent) => {\n // Resource load errors (e.g. <img>) fire ErrorEvent with no `error` and an\n // empty message — skip those to avoid noise.\n if (!e.message && !e.error) return;\n reportError({\n kind: 'error',\n message: e.message || (e.error && e.error.message) || 'Unknown error',\n source: e.filename,\n line: e.lineno,\n column: e.colno,\n stack: e.error?.stack,\n });\n });\n\n window.addEventListener('unhandledrejection', (e: PromiseRejectionEvent) => {\n const reason = e.reason as { message?: string; stack?: string } | undefined;\n reportError({\n kind: 'unhandledrejection',\n message: (reason && (reason.message || String(reason))) || 'Unhandled promise rejection',\n stack: reason?.stack,\n });\n });\n}\n","import React from 'react';\nimport { reportError } from './errorReporter';\n\ninterface Props {\n children: React.ReactNode;\n fallback?: React.ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n}\n\n// ErrorBoundary catches render-time errors anywhere in the tree, reports them\n// (with the React component stack) to /api/errors/js, and shows a minimal\n// fallback instead of an unmounted white screen. It renders no wrapper DOM, so\n// SSR markup is unchanged and hydration stays consistent.\nexport class ErrorBoundary extends React.Component<Props, State> {\n state: State = { hasError: false };\n\n static getDerivedStateFromError(): State {\n return { hasError: true };\n }\n\n componentDidCatch(error: Error, info: React.ErrorInfo): void {\n reportError({\n kind: 'react',\n message: error.message || 'React render error',\n stack: error.stack,\n componentStack: info.componentStack ?? undefined,\n });\n }\n\n render(): React.ReactNode {\n if (this.state.hasError) {\n if (this.props.fallback !== undefined) return this.props.fallback;\n return (\n <div className=\"min-h-screen bg-black text-white flex items-center justify-center p-8\">\n <div className=\"max-w-md text-center\">\n <h1 className=\"text-2xl font-semibold mb-2\">Something went wrong</h1>\n <p className=\"text-white/60 mb-6\">\n The error has been reported automatically. Try reloading the page.\n </p>\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n className=\"px-4 py-2 rounded-lg bg-white text-black font-medium\"\n >\n Reload\n </button>\n </div>\n </div>\n );\n }\n return this.props.children;\n }\n}\n","type MountRoot = Pick<HTMLElement, 'hasAttribute' | 'hasChildNodes'>;\n\n// Client-only routes receive an SEO heading in their prerendered document, but\n// that heading is not React SSR output and must be replaced instead of hydrated.\nexport function shouldHydrateRoot(root: MountRoot, prerenderedPath: boolean): boolean {\n return prerenderedPath && root.hasChildNodes() && !root.hasAttribute('data-client-render');\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport App from './App';\nimport { isPrerenderedPath } from './components/platformPageMeta';\nimport { ErrorBoundary } from './components/ErrorBoundary';\nimport { installErrorReporter } from './components/errorReporter';\nimport { installRouter } from './lib/router';\nimport { shouldHydrateRoot } from './lib/rootMount';\n\n// Capture uncaught errors / rejections and forward them to the backend for the\n// monitoring/ source-map enricher + codex auto-fixer.\ninstallErrorReporter();\n\nconst rootElement = document.getElementById('root');\nif (!rootElement) {\n throw new Error(\"Could not find root element to mount to\");\n}\n\nconst app = (\n <React.StrictMode>\n <ErrorBoundary>\n <App />\n </ErrorBoundary>\n </React.StrictMode>\n);\n\n// Firebase email-action links (password reset) land on the configured action URL\n// — typically the homepage — as ?mode=resetPassword&oobCode=...; without this they\n// fall through to the homepage instead of the reset UI. Normalize them onto\n// /reset-password (preserving the query) before we decide how to mount, so the\n// client-only route does a clean render and ResetPasswordPanel sees the oobCode.\n{\n const q = new URLSearchParams(window.location.search);\n if (window.location.pathname !== '/reset-password' && (q.get('mode') === 'resetPassword' || q.get('oobCode'))) {\n window.history.replaceState(null, '', '/reset-password' + window.location.search);\n }\n}\n\n// Static marketing routes are prerendered to their own dist/<path>/index.html, so\n// the served markup matches the current route and we can hydrate. Interactive\n// routes (/agents, /sites, …) are served the homepage shell, so do a clean client\n// render there to avoid hydration mismatches (React #418).\nconst pathname = window.location.pathname;\n\nlet root: ReactDOM.Root;\nif (shouldHydrateRoot(rootElement, isPrerenderedPath(pathname))) {\n root = ReactDOM.hydrateRoot(rootElement, app);\n} else {\n rootElement.innerHTML = '';\n root = ReactDOM.createRoot(rootElement);\n root.render(app);\n}\n\n// Global pushState routing: installRouter intercepts same-origin link clicks and\n// patches history to emit popstate. AppRoutes subscribes to the location via\n// useLocationPath, so it re-renders itself on every navigation — we deliberately\n// do NOT rely on root.render(app) here, because re-rendering the same <App/>\n// element hits React's same-element bailout and never updates the route.\ninstallRouter();\n"],"file":"assets/index-B9nFKSkv.js"}