droidsembly 0.0.0-stage → 0.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.it.md +184 -0
  3. package/README.md +184 -3
  4. package/bin/cubefarm.js +297 -0
  5. package/bin/distribution.d.ts +3 -0
  6. package/bin/distribution.js +48 -0
  7. package/dist/THIRD_PARTY_LICENSES.txt +2542 -0
  8. package/dist/assets/AccessibilitySettings-DSmFk9JC.js +30 -0
  9. package/dist/assets/AccessibilitySettings-HrzBDUTN.css +1 -0
  10. package/dist/assets/AppViewer-alNn4TBB.js +5 -0
  11. package/dist/assets/Balloon-UTs7npGo.js +1 -0
  12. package/dist/assets/Batched-BOgjreKO.js +45 -0
  13. package/dist/assets/Birds-BA2HM-AD.js +1 -0
  14. package/dist/assets/Blimp-CTykuz6B.js +1 -0
  15. package/dist/assets/BufferGeometryUtils-BsmWvcA2.js +1 -0
  16. package/dist/assets/Duck-DH63jUrP.js +1 -0
  17. package/dist/assets/Effects-CNyhhFkE.js +65 -0
  18. package/dist/assets/Fireworks-CJfDJOeb.js +33 -0
  19. package/dist/assets/Helicopter-CW_SP7xP.js +1 -0
  20. package/dist/assets/Hurricane-9WqZGyZg.js +33 -0
  21. package/dist/assets/Kaiju-SpSi_jBg.js +1 -0
  22. package/dist/assets/Meteors-DvjhLfbF.js +1 -0
  23. package/dist/assets/MissionConsole-BEP5CdC8.js +1 -0
  24. package/dist/assets/Office-BBnd6tyn.js +563 -0
  25. package/dist/assets/Office-DMOP02gg.css +1 -0
  26. package/dist/assets/PhotoPanel-DehErnsv.js +1 -0
  27. package/dist/assets/PhotoPanel-v4ANHBsO.css +1 -0
  28. package/dist/assets/PhotoScene-Ce-dzToM.js +115 -0
  29. package/dist/assets/Plane-0nfvzL_c.js +1 -0
  30. package/dist/assets/Pocket-CBoyL0ra.js +2 -0
  31. package/dist/assets/Rainbow-CdcWsmW8.js +28 -0
  32. package/dist/assets/Roof-mkMKniSZ.js +34 -0
  33. package/dist/assets/Shell-BmnZn4UL.js +13 -0
  34. package/dist/assets/Skywriting-06dZPAfg.js +1 -0
  35. package/dist/assets/TerminalView-BrP-ENHg.css +1 -0
  36. package/dist/assets/TerminalView-wlhSixSH.js +17 -0
  37. package/dist/assets/ToyWorld-Cuu9aW-K.js +1 -0
  38. package/dist/assets/Ufo-iHaoe5t1.js +1 -0
  39. package/dist/assets/Whale-DZg88zIX.js +1 -0
  40. package/dist/assets/all-CYErCTCA.js +11 -0
  41. package/dist/assets/billboardLayout-DSKGXPIM.js +1 -0
  42. package/dist/assets/bloomMarks-DariC6lY.js +4231 -0
  43. package/dist/assets/cheerRules-CZGSrxOB.js +1 -0
  44. package/dist/assets/cityLayout-7ckfe3wf.js +1 -0
  45. package/dist/assets/director-CrzFgnoP.js +1 -0
  46. package/dist/assets/dogState-DiOvoobI.js +1 -0
  47. package/dist/assets/doors-BHKj8tkO.js +1 -0
  48. package/dist/assets/gallery-ColCPQQE.js +1 -0
  49. package/dist/assets/gate-BplJKcLG.js +2 -0
  50. package/dist/assets/index-B6qvKFYN.js +10 -0
  51. package/dist/assets/index-COpmc42S.css +1 -0
  52. package/dist/assets/instantReplay-DGiLgvkQ.js +1 -0
  53. package/dist/assets/interact-0qw7BGhL.js +1 -0
  54. package/dist/assets/jsx-runtime-BFUkm7bt.js +1 -0
  55. package/dist/assets/jukeboxSongs-CjbAzAeb.js +1 -0
  56. package/dist/assets/kit-C6ByUQ-Y.js +2 -0
  57. package/dist/assets/mic-B316hcCe.js +1 -0
  58. package/dist/assets/news-CrPol-gz.js +1 -0
  59. package/dist/assets/paint.worker-D95XJ3xX.js +1 -0
  60. package/dist/assets/photoMode-CYxQfgUF.js +1 -0
  61. package/dist/assets/pipeline-BOTOZ69L.js +1215 -0
  62. package/dist/assets/rapier-CXAOW8OC.js +1 -0
  63. package/dist/assets/rig-wAyl3G1G.js +1 -0
  64. package/dist/assets/speechLanguage-BtfdhZNI.js +1 -0
  65. package/dist/assets/store-FA83kfnc.js +5 -0
  66. package/dist/assets/useDayTime-0XsqM14Q.js +1 -0
  67. package/dist/assets/useGraphics-Cif18p7Q.js +1 -0
  68. package/dist/assets/voiceMessages-DtNmUazr.js +1 -0
  69. package/dist/assets/weatherState-ExG1doW-.js +1 -0
  70. package/dist/icons/Sora-OFL.txt +93 -0
  71. package/dist/icons/apple-touch-icon.png +0 -0
  72. package/dist/icons/badge-96.png +0 -0
  73. package/dist/icons/badge.svg +1 -0
  74. package/dist/icons/droid-antenna.svg +29 -0
  75. package/dist/icons/droid-eyes.svg +29 -0
  76. package/dist/icons/droid-shell.svg +29 -0
  77. package/dist/icons/droid-spark.svg +29 -0
  78. package/dist/icons/droid-wire.svg +29 -0
  79. package/dist/icons/favicon-16.png +0 -0
  80. package/dist/icons/favicon-32.png +0 -0
  81. package/dist/icons/favicon.svg +1 -0
  82. package/dist/icons/icon-192.png +0 -0
  83. package/dist/icons/icon-512.png +0 -0
  84. package/dist/icons/icon-maskable-512.png +0 -0
  85. package/dist/icons/icon.svg +29 -0
  86. package/dist/icons/logo-dark.svg +29 -0
  87. package/dist/icons/logo-light.svg +29 -0
  88. package/dist/icons/sora-400.ttf +0 -0
  89. package/dist/icons/sora-700.ttf +0 -0
  90. package/dist/index.html +26 -0
  91. package/dist/manifest.webmanifest +19 -0
  92. package/dist/third-party-licenses.json +1106 -0
  93. package/dist-server/browser-init.js +24 -0
  94. package/dist-server/index.js +20049 -0
  95. package/dist-server/index.js.map +7 -0
  96. package/dist-server/ptyHost.js +234 -0
  97. package/dist-server/ptyHost.js.map +7 -0
  98. package/package.json +98 -6
@@ -0,0 +1 @@
1
+ .games-list .game-card:first-of-type{margin-top:4px}.games-blurb{margin:0 2px 12px;line-height:1.45}.games-blurb kbd{font-size:.72rem}.game-card{width:100%;font-family:var(--font);color:var(--ink);text-align:left;border:2.5px solid var(--ink);box-shadow:0 3px 0 var(--ink);cursor:pointer;background:#fff;border-radius:16px;align-items:center;gap:12px;margin-bottom:12px;padding:10px 12px 10px 10px;transition:transform 60ms,box-shadow 60ms;display:flex}.game-card:hover{box-shadow:0 4px 0 var(--ink);transform:translateY(-1px)}.game-card:active{box-shadow:0 1px 0 var(--ink);transform:translateY(2px)}.game-thumb{border:2px solid var(--ink);background:color-mix(in srgb, var(--game) 22%, #fff);border-radius:12px;flex:none}.game-card-text{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.game-card-text b{font-size:1.05rem}.game-card-what{color:var(--muted);font-size:.78rem;font-weight:500}.game-card-status{text-overflow:ellipsis;white-space:nowrap;font-size:.78rem;font-weight:600;overflow:hidden}.game-card-go{color:#fff;background:var(--game);border:2px solid var(--ink);text-shadow:0 1px #00000040;border-radius:50%;flex:none;place-items:center;width:30px;height:30px;font-size:.8rem;display:grid}.game{-webkit-user-select:none;user-select:none;flex-direction:column;flex:1;min-height:0;display:flex}.game-head{background:#fff;border-bottom:2px solid #1f1d2b14;align-items:center;gap:8px;padding:8px 10px;display:flex}.game-back{font-family:var(--font);color:var(--ink);cursor:pointer;background:0 0;border:2px solid #1f1d2b4d;border-radius:9px;padding:3px 9px 3px 6px;font-size:.82rem;font-weight:600}.game-back:hover{border-color:var(--ink)}.game-title{color:var(--ink);background:color-mix(in srgb, var(--game) 45%, #fff);border:2px solid var(--ink);border-radius:999px;padding:2px 10px;font-size:.95rem}.game-head-right{align-items:center;min-width:0;margin-left:auto;display:flex}.game-mini{width:32px;height:28px;color:var(--ink);border:2px solid var(--ink);box-shadow:0 2px 0 var(--ink);cursor:pointer;background:#fff;border-radius:9px;font-size:.85rem;line-height:1}.game-mini:active{box-shadow:none;transform:translateY(2px)}.game-chip{text-overflow:ellipsis;white-space:nowrap;border:2px solid var(--ink);background:#fff3b0;border-radius:999px;padding:2px 9px;font-size:.78rem;font-weight:600;overflow:hidden}.game-canvas-wrap{flex:1;justify-content:center;align-items:center;min-height:0;padding:6px 8px;display:flex;overflow:hidden}.game-canvas{touch-action:none;cursor:pointer}.game-keys{text-align:center;color:var(--muted);padding:2px 10px 8px;font-size:.7rem;line-height:1.7}.game-keys kbd{font-size:.66rem}.game-pads{justify-content:center;align-items:center;gap:7px;padding:2px 10px 8px;display:flex}.game-pad-gap{width:10px}.game-pad{width:46px;height:42px;font-family:var(--font);color:var(--ink);border:2.5px solid var(--ink);box-shadow:0 3px 0 var(--ink);cursor:pointer;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;background:#fff;border-radius:12px;place-items:center;padding:0;font-size:1.15rem;line-height:1;display:grid}.game-pad:active{box-shadow:0 1px 0 var(--ink);background:#f3f0ff;transform:translateY(2px)}.game-pad-round{background:#eadcff;border-radius:50%;width:46px;height:46px}.game-pad-hot{background:#ffc93c}.game-dpad{grid-template-columns:repeat(3,46px);grid-template-areas:".up.""left down right";justify-content:center;gap:5px 7px;padding:0 10px 6px;display:grid}.game-dpad .game-pad{height:38px}.game-pad-up{grid-area:up}.game-pad-left{grid-area:left}.game-pad-right{grid-area:right}.game-pad-down{grid-area:down}.pet-say{border:2.5px solid var(--ink);min-height:2.3em;box-shadow:0 3px 0 var(--ink);background:#fff;border-radius:14px;align-items:center;margin:10px 14px 2px;padding:7px 12px;font-size:.85rem;font-weight:600;line-height:1.3;display:flex;position:relative}.pet-say:after{content:"";border-right:2.5px solid var(--ink);border-bottom:2.5px solid var(--ink);background:#fff;width:12px;height:12px;position:absolute;bottom:-9px;left:50%;transform:translate(-50%)rotate(45deg)}.pet .game-canvas-wrap{padding-top:10px}.pet-bars{gap:5px;padding:2px 16px 6px;display:grid}.pet-bar{grid-template-columns:82px 1fr;align-items:center;font-size:.8rem;font-weight:600;display:grid}.pet-meter{border:2px solid var(--ink);background:#eef0f6;border-radius:999px;height:13px;overflow:hidden}.pet-meter i{border-right:2px solid var(--ink);border-radius:999px;height:100%;transition:width .5s ease-out;display:block}.pet-bar-low .pet-meter{animation:1s ease-in-out infinite pet-low}@keyframes pet-low{50%{border-color:var(--bad);box-shadow:0 0 0 2px #ef476f59}}.pet-actions{grid-template-columns:repeat(4,1fr);gap:6px;padding:4px 12px 6px;display:grid}.pet-act{flex-direction:column;align-items:center;gap:1px;padding:5px 2px;display:flex}.pet-act-icon{font-size:1.25rem;line-height:1.2}.pet-unbox{grid-column:1/-1;margin:4px 0 12px}.phone-access{min-width:0}.settings-grid>.phone-access{grid-column:1/-1}.phone-access p{overflow-wrap:anywhere}.phone-access ol{padding-left:1.4em}.phone-access li{margin:.8em 0}.phone-access .term{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%;min-height:0}.phone-access .seg{flex-wrap:wrap;align-self:flex-start;max-width:100%;display:inline-flex}.phone-access-blocked{margin:.5rem 0}@media (width<=900px){.settings-grid{grid-template-columns:minmax(0,1fr)}}@font-face{font-family:Sora;font-style:normal;font-weight:400;font-display:swap;src:url(/icons/sora-400.ttf)format("truetype")}@font-face{font-family:Sora;font-style:normal;font-weight:700;font-display:swap;src:url(/icons/sora-700.ttf)format("truetype")}.brand-lockup{color:#101925;justify-content:center;align-items:center;gap:12px;margin:12px auto 18px;display:flex}.brand-icon{aspect-ratio:152/170;vertical-align:middle;flex-shrink:0;width:40px;display:inline-block;position:relative}.brand-icon img{width:100%;height:100%;display:block}.brand-lockup>.brand-icon{width:94px}.brand-type{text-align:left;min-width:0;font-family:Sora,sans-serif}.brand-name{letter-spacing:-.06em;white-space:nowrap;font-size:clamp(1.35rem,4.8vw,2.4rem);font-weight:700}.brand-name span{color:#007eaf}.brand-payoff{margin-top:6px;font-size:clamp(.6rem,2vw,.85rem);line-height:1.5}.brand-parts,.brand-part{position:absolute;inset:0}.brand-assemble .brand-static{animation:2.2s step-end both brand-final}.brand-assemble .brand-parts{animation:2.2s step-end both brand-parts}.brand-shell{animation:.65s .25s both brand-reveal}.brand-eyes{animation:.4s .8s both brand-reveal}.brand-antenna{animation:.4s 1.15s both brand-reveal}.brand-spark{animation:.6s 1.55s both brand-spark}.brand-wire{animation:1s both brand-wire}@keyframes brand-reveal{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@keyframes brand-spark{0%,to{opacity:0}35%,65%{opacity:1}}@keyframes brand-wire{0%{opacity:.7}to{opacity:0}}@keyframes brand-final{0%{visibility:hidden}to{visibility:visible}}@keyframes brand-parts{0%{visibility:visible}to{visibility:hidden}}[data-reduce-motion] .brand-icon *,[data-reduce-motion] .brand-icon .brand-static{visibility:visible;animation:none}[data-reduce-motion] .brand-icon .brand-parts{display:none}@media (prefers-reduced-motion:reduce){.brand-icon *{visibility:visible!important;animation:none!important}.brand-icon .brand-parts{display:none}}@media (width<=420px){.brand-lockup{gap:8px}.brand-lockup>.brand-icon{width:64px}}
@@ -0,0 +1,5 @@
1
+ import{a as e,l as t,s as n,t as r,u as i}from"./jsx-runtime-BFUkm7bt.js";import{Bt as a,Gt as o,Ht as s,Jt as c,Kt as l,Rt as u,Vt as d,Wt as f,Xt as p,Yt as m,Zt as h,c as g,p as _,qt as v,zt as y}from"./store-FA83kfnc.js";import{c as b,o as x,s as S}from"./index-B6qvKFYN.js";import{L as C,N as w,h as T,m as E,p as D}from"./AccessibilitySettings-DSmFk9JC.js";var O=i(n(),1),k=3e4,A=e(()=>({channels:{}}));function j(e){let t=A(t=>t.channels[e]),n=_(t=>t.repos.find(t=>t.id===e)?.pulls);return o(t,n??[])}function M(e,t){if(_.getState().replaying){_.getState().pushToast(`info`,`▶ Replaying: the PR theatre is live only. Press Esc to go back to the live office.`);return}A.setState(n=>({channels:{...n.channels,[e]:t}})),!(t==null||_.getState().prPreviews[g(e,t)])&&b.startPrPreview(e,t).catch(()=>void 0)}var N=(()=>{try{return crypto.randomUUID()}catch{return`viewer-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`}})();function ee(e,t){(0,O.useEffect)(()=>{let n=()=>void b.watchPreview(N,t==null?null:e,t).catch(()=>void 0);n();let r=setInterval(n,k);return()=>clearInterval(r)},[e,t]),(0,O.useEffect)(()=>()=>void b.watchPreview(N,null,null).catch(()=>void 0),[])}typeof window<`u`&&!Object.getOwnPropertyDescriptor(window,`__swarmPreviews`)&&Object.defineProperty(window,"__swarmPreviews",{configurable:!0,get:()=>{let e=_.getState(),t=A.getState().channels;return{main:e.repos.map(e=>({repoId:e.id,floor:e.floor,status:e.preview.status,url:e.preview.url,ref:e.preview.ref,port:e.preview.port,channel:o(t[e.id],e.pulls)})),prs:Object.values(e.prPreviews).map(e=>({repoId:e.repoId,pr:e.pr,status:e.status,url:e.url,port:e.port,commit:e.commit,watched:e.watched,idleSec:Math.round((Date.now()-e.viewedAt)/1e3),error:e.error}))}}});var P=16e3,F=e=>Object.entries(e).reduce((e,[t,n])=>e+t.length+n.length+2,0);function I(e){let t=F(e);if(t<=16e3)return null;let n=e=>e.toLocaleString(`en-US`);return`The preview env is ${n(t)} characters (${n(Object.keys(e).length)} variables, each counted as KEY=value), over the ${n(P)} a floor's preview may take. Keep only the variables the app needs to run.`}var L=t({AppViewer:()=>oe,PreviewPill:()=>W,PreviewSettings:()=>q}),R=r(),z={unconfigured:`not set up`,stopped:`stopped`,preparing:`checking out`,installing:`installing`,starting:`starting`,running:`running`,error:`error`},B=[`preparing`,`installing`,`starting`,`running`],V=[{status:`preparing`,label:`Check out the code`},{status:`installing`,label:`Install dependencies`},{status:`starting`,label:`Start the app`}],H=`desktop`,U=12e3;function W({status:e}){let t=S();return(0,R.jsx)(`span`,{className:`status status-${e}`,children:t(z[e])})}var G=e=>Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
2
+ `);function K(e){let t={},n=e.split(/\r?\n/);for(let e=0;e<n.length;e++){let r=n[e].trim();if(!r||r.startsWith(`#`))continue;let i=r.indexOf(`=`),a=i>0?r.slice(0,i).trim():``;if(!a)return{env:t,error:`Line ${e+1}: write it as KEY=value.`};if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(a))return{env:t,error:`Line ${e+1}: “${a}” is not a valid variable name.`};t[a]=r.slice(i+1).trim()}return{env:t,error:null}}function q({repo:e,saveLabel:t=`Save`,onSaved:n}){let r=S(),i={command:e.previewConfig.command??``,env:G(e.previewConfig.env)},[a,o]=(0,O.useState)(i.command),[s,c]=(0,O.useState)(i.env),[l,u]=(0,O.useState)(!1),[d,f]=(0,O.useState)(null);(0,O.useEffect)(()=>{o(i.command),c(i.env)},[i.command,i.env]);let p=a.trim()!==i.command||s.trim()!==i.env,m=e.preview.status===`unconfigured`,h=F(K(s).env);return(0,R.jsxs)(`form`,{className:`preview-form`,onSubmit:async t=>{t.preventDefault();let r=K(s);if(r.error)return f(r.error);let i=I(r.env);if(i)return f(i);f(null),u(!0);try{await b.updateRepo(e.id,{previewCommand:a.trim()||null,previewEnv:r.env}),n?.()}catch(e){f(e.message)}finally{u(!1)}},children:[(0,R.jsxs)(`label`,{className:`field`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(x,{children:`Run command`})}),(0,R.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:r(m?`e.g. python -m http.server {port}`:`Auto-detected: npm run dev, else npm start, else npm run preview`),spellCheck:!1})]}),(0,R.jsxs)(`label`,{className:`field`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(x,{children:`Environment (KEY=value, one per line)`})}),(0,R.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:3,placeholder:`API_URL=http://localhost:{port}/api
3
+ DATA_DIR={tmp}`,spellCheck:!1})]}),(0,R.jsxs)(`p`,{className:`muted small`,children:[(0,R.jsx)(x,{children:`Runs from the repo root in the floor’s own preview worktree.`}),` `,(0,R.jsx)(`code`,{children:`{port}`}),` `,r(`is this floor’s port ({port}) and`,{port:e.preview.port}),` `,(0,R.jsx)(`code`,{children:`PORT`}),` `,(0,R.jsx)(x,{children:`is always set;`}),` `,(0,R.jsx)(`code`,{children:`{tmp}`}),` `,(0,R.jsx)(x,{children:`is a scratch folder.`}),!m&&r(` Leave the command empty to use the auto-detected npm script.`)]}),h>12800&&(0,R.jsx)(`p`,{className:`muted small`,children:r(`Environment: {count} of {max} characters (each variable counts as KEY=value).`,{count:h.toLocaleString(),max:16e3.toLocaleString()})}),d&&(0,R.jsxs)(`div`,{className:`term-error`,children:[`⚠️ `,d]}),(0,R.jsxs)(`div`,{className:`row`,children:[(0,R.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:l||!p&&!n||m&&!a.trim(),children:r(l?`Saving…`:t)}),p&&(0,R.jsx)(`button`,{type:`button`,className:`btn btn-small btn-ghost`,onClick:()=>{o(i.command),c(i.env),f(null)},children:(0,R.jsx)(x,{children:`Undo changes`})})]})]})}var J=`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals allow-downloads allow-pointer-lock`;function Y({repo:e,preview:t,label:n,src:r,width:i,reloads:a,busy:o,onStart:s,frameRef:c,compact:l}){let u=S(),[d,f]=(0,O.useState)(!1),[p,m]=(0,O.useState)(!1),[h,g]=(0,O.useState)(!1),_=t.status===`running`&&!!r,v=`${r}|${t.startedAt}|${a}`;if((0,O.useEffect)(()=>{if(f(!1),m(!1),!_)return;let e=setTimeout(()=>m(!0),U);return()=>clearTimeout(e)},[v,_]),_)return(0,R.jsxs)(`div`,{className:`app-stage ${i===`phone`?`app-stage-phone`:``}`,children:[(0,R.jsx)(`iframe`,{ref:c,className:`app-frame`,src:r,title:u(`{repo} app ({label})`,{repo:e.fullName.split(`/`)[1],label:n}),sandbox:J,allow:`clipboard-read; clipboard-write; fullscreen; autoplay`,onLoad:()=>f(!0),onError:()=>m(!0)},v),p&&!d&&(0,R.jsxs)(`div`,{className:`app-frame-hint`,role:`status`,children:[(0,R.jsx)(`b`,{children:(0,R.jsx)(x,{children:`The app isn’t showing up here.`})}),` `,(0,R.jsx)(x,{children:`It may refuse to be shown inside another page (X-Frame-Options or a CSP frame-ancestors rule).`}),` `,(0,R.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,children:(0,R.jsx)(x,{children:`Open it in a new tab ↗`})})]})]});if(B.includes(t.status)){let e=V.findIndex(e=>e.status===t.status);return(0,R.jsxs)(`div`,{className:`app-state ${l?`app-state-compact`:``}`,role:`status`,children:[(0,R.jsx)(`div`,{className:`app-state-icon app-spin`,children:`⚙️`}),(0,R.jsx)(`h3`,{children:u(`Starting {label}…`,{label:n})}),(0,R.jsx)(`ol`,{className:`app-steps`,children:V.map((n,r)=>(0,R.jsxs)(`li`,{className:r<e?`app-step-done`:r===e?`app-step-now`:``,children:[r<e?`✓`:r===e?`●`:`○`,` `,u(n.label),n.status===`starting`&&t.port?u(` on port {port}`,{port:t.port}):``]},n.status))}),t.logTail.length>0&&(0,R.jsx)(`pre`,{className:`term app-log`,children:t.logTail.slice(-8).join(`
4
+ `)})]})}return t.status===`error`?(0,R.jsxs)(`div`,{className:`app-state app-state-left ${l?`app-state-compact`:``}`,children:[(0,R.jsx)(`h3`,{children:u(`⚠️ {label} didn’t run`,{label:n})}),(0,R.jsx)(`div`,{className:`term-error`,children:t.error??u(`The app stopped unexpectedly.`)}),(0,R.jsx)(`pre`,{className:`term app-log`,"aria-label":u(`Last output`),children:t.logTail.length?t.logTail.join(`
5
+ `):u(`(no output)`)}),(0,R.jsxs)(`div`,{className:`row wrap`,children:[(0,R.jsx)(`button`,{className:`btn btn-good`,disabled:o,onClick:s,children:(0,R.jsx)(x,{children:`↻ Try again`})}),(0,R.jsx)(`button`,{className:`btn`,"aria-expanded":h,onClick:()=>g(e=>!e),children:(0,R.jsx)(x,{children:`⚙️ Run settings`})})]}),h&&(0,R.jsx)(q,{repo:e})]}):t.status===`unconfigured`?(0,R.jsxs)(`div`,{className:`app-state app-state-left`,children:[(0,R.jsx)(`h3`,{children:(0,R.jsx)(x,{children:`🛠️ How should the office run this app?`})}),(0,R.jsxs)(`p`,{className:`muted`,children:[t.error??u(`This floor has no package.json to fall back on.`),` `,(0,R.jsx)(x,{children:`Give it a command that serves the app on the floor’s port.`})]}),(0,R.jsx)(q,{repo:e,saveLabel:`Save & start`,onSaved:s})]}):(0,R.jsxs)(`div`,{className:`app-state ${l?`app-state-compact`:``}`,children:[(0,R.jsx)(`div`,{className:`app-state-icon`,children:`🖥️`}),(0,R.jsx)(`h3`,{children:u(`{label} isn’t running`,{label:n})}),(0,R.jsx)(`p`,{className:`muted`,children:t.pr?u(`Start it to try the PR’s head right here, beside {branch}. It runs from a worktree of its own and stops after a while unwatched.`,{branch:e.defaultBranch}):u(`Start it to use it right here. It runs from the floor’s own preview worktree on port {port}.`,{port:t.port})}),(0,R.jsx)(`button`,{className:`btn btn-good`,disabled:o,onClick:s,children:u(`▶ Start {label}`,{label:n})}),!t.pr&&!l&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,"aria-expanded":h,onClick:()=>g(e=>!e),children:(0,R.jsx)(x,{children:`⚙️ Run settings`})}),h&&(0,R.jsx)(`div`,{className:`app-state-left app-settings`,children:(0,R.jsx)(q,{repo:e})})]})]})}function te({repo:e,channel:t,onPick:n}){let r=S(),i=_(e=>e.prPreviews),o=_(e=>e.qa),c=s(e.pulls);return(0,R.jsxs)(`div`,{className:`channels`,role:`tablist`,"aria-label":r(`Channels`),children:[(0,R.jsxs)(`button`,{role:`tab`,"aria-selected":t==null,className:`channel ${t==null?`channel-on`:``}`,onClick:()=>n(null),title:r(`The floor’s app on {branch}`,{branch:e.defaultBranch}),children:[(0,R.jsx)(`span`,{className:`led led-${d(e.preview.status)}`,"aria-hidden":!0}),` `,e.defaultBranch]}),c.map(r=>{let s=a(r,o[g(e.id,r.number)]);return(0,R.jsxs)(`button`,{role:`tab`,"aria-selected":t===r.number,className:`channel ${t===r.number?`channel-on`:``}`,onClick:()=>n(r.number),title:s,children:[(0,R.jsx)(`span`,{className:`led led-${d(i[g(e.id,r.number)]?.status)}`,"aria-hidden":!0}),` `,s]},r.number)}),c.length===0&&(0,R.jsx)(`span`,{className:`muted small channels-empty`,children:r(`No open PRs: each one gets a channel here, to try it running beside {branch}.`,{branch:e.defaultBranch})})]})}var X={passing:`✅ passing`,failing:`❌ failing`,pending:`⏳ running`,none:`none`},Z={pass:`✅`,fail:`❌`,skip:`⏭️`};function ne({repo:e,pull:t,qa:n}){let r=S(),i=n?.shots??[];return(0,R.jsxs)(`aside`,{className:`qa-side`,"aria-label":r(`PR #{number}: checks and QA`,{number:t.number}),children:[(0,R.jsxs)(`h4`,{className:`qa-side-title`,children:[(0,R.jsxs)(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,children:[`PR #`,t.number,` ↗`]}),` `,t.title]}),(0,R.jsxs)(`div`,{className:`qa-side-meta small`,children:[(0,R.jsxs)(`span`,{children:[`+`,t.additions,` −`,t.deletions]}),(0,R.jsxs)(`a`,{href:`${t.url}/checks`,target:`_blank`,rel:`noreferrer`,children:[(0,R.jsx)(x,{children:`Checks:`}),` `,r(X[t.checks])]}),t.isDraft&&(0,R.jsx)(`span`,{children:(0,R.jsx)(x,{children:`draft`})})]}),t.failedChecks.length>0&&(0,R.jsx)(`ul`,{className:`qa-failed small`,children:t.failedChecks.map(e=>(0,R.jsx)(`li`,{children:e.url?(0,R.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[`❌ `,e.name]}):`❌ ${e.name}`},e.name))}),n?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`qa-side-status`,children:[(0,R.jsx)(`span`,{className:`qa-badge qa-badge-${n.status}`,children:(0,R.jsx)(x,{children:n.managerRequested&&(n.status===`failed`||n.status===`fixing`)?`Manager-requested changes`:u[n.status]})}),(0,R.jsx)(`span`,{className:`muted small`,children:r(`round {number}`,{number:n.round})}),n.commentUrl&&(0,R.jsx)(`a`,{className:`small`,href:n.commentUrl,target:`_blank`,rel:`noreferrer`,children:(0,R.jsx)(x,{children:`Full report ↗`})})]}),n.summary?(0,R.jsx)(C,{className:`qa-summary`,text:n.summary}):(0,R.jsx)(`p`,{className:`muted small`,children:r(n.status===`testing`?`QA is testing it now.`:`No QA report yet.`)}),n.checks.length>0&&(0,R.jsx)(`ul`,{className:`qa-checks`,children:n.checks.map((e,t)=>(0,R.jsxs)(`li`,{className:`qa-check qa-check-${e.result}`,children:[(0,R.jsx)(`span`,{"aria-label":r(e.result),children:Z[e.result]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`b`,{children:e.name}),e.details&&(0,R.jsx)(`div`,{className:`muted small`,children:e.details})]})]},t))}),i.length>0&&(0,R.jsx)(`div`,{className:`qa-shots`,children:i.map((r,i)=>{let a=m(e.id,t.number,i,n.updatedAt);return(0,R.jsxs)(`a`,{className:`qa-shot`,href:a,target:`_blank`,rel:`noreferrer`,title:r.page??r.caption,children:[(0,R.jsx)(`img`,{src:a,alt:r.caption,loading:`lazy`}),(0,R.jsx)(`span`,{className:`small`,children:r.caption})]},i)})})]}):(0,R.jsx)(`p`,{className:`muted small`,children:(0,R.jsx)(x,{children:`QA hasn’t tested this PR yet.`})})]})}var Q=!0;function $(e,t,n,r){let[i,a]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(a(null),!r||n.status!==`running`)return;let i=!0;return b.previewSync(e,t).then(e=>i&&a(e.url)).catch(()=>void 0),()=>{i=!1}},[e,t,r,n.status,n.startedAt]),i}function re({repo:e,main:t,pr:n,width:r,reloads:i,busy:a,onStartMain:o,onStartPr:s}){let c=S(),[u,d]=(0,O.useState)(`/`),[m,g]=(0,O.useState)(`/`),[_,v]=(0,O.useState)(0),[b,C]=(0,O.useState)(Q),[w,T]=(0,O.useState)({main:null,pr:null}),E={main:(0,O.useRef)(null),pr:(0,O.useRef)(null)},D=(0,O.useRef)({main:0,pr:0}),k=(0,O.useRef)(l()),A={main:$(e.id,null,t,b),pr:$(e.id,n.pr,n,b)};(0,O.useEffect)(()=>{let e=e=>{let t=e.data;if(!t||t.cubefarmSync!==`scroll`&&t.cubefarmSync!==`path`)return;let n=e.source&&e.source===E.main.current?.contentWindow?`main`:e.source&&e.source===E.pr.current?.contentWindow?`pr`:null;if(!n)return;let r=n===`main`?`pr`:`main`;if(typeof t.path==`string`&&T(e=>e[n]===t.path?e:{...e,[n]:t.path}),!b)return;let i=E[r].current?.contentWindow,a=Date.now();t.cubefarmSync===`scroll`&&a>D.current[n]?(D.current[r]=a+250,i?.postMessage({cubefarmSyncTo:`scroll`,x:t.x,y:t.y},`*`)):t.cubefarmSync===`path`&&typeof t.path==`string`&&h(k.current,n,t.path,a)&&i?.postMessage({cubefarmSyncTo:`path`,path:t.path},`*`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[b]);let j=(e,t)=>e.url?y(p(b&&A[t]||e.url,location),u):null,M=(t,n)=>(0,R.jsxs)(`div`,{className:`compare-label`,children:[(0,R.jsx)(`b`,{children:n===`main`?e.defaultBranch:t.ref}),t.commit&&(0,R.jsx)(`code`,{children:t.commit}),w[n]&&(0,R.jsx)(`span`,{className:`muted`,children:w[n]}),b&&w[n]!==null&&(0,R.jsx)(`span`,{className:`compare-synced`,children:(0,R.jsx)(x,{children:`⇅ synced`})})]});return(0,R.jsxs)(`div`,{className:`compare`,children:[(0,R.jsxs)(`form`,{className:`compare-bar`,onSubmit:e=>{e.preventDefault();let t=f(m);g(t),d(t),v(e=>e+1)},children:[(0,R.jsxs)(`label`,{className:`compare-path`,children:[(0,R.jsx)(`span`,{className:`muted small`,children:(0,R.jsx)(x,{children:`Path`})}),(0,R.jsx)(`input`,{value:m,onChange:e=>g(e.target.value),spellCheck:!1,"aria-label":c(`Path to open on both sides`)})]}),(0,R.jsx)(`button`,{className:`btn btn-small`,children:(0,R.jsx)(x,{children:`Open on both`})}),(0,R.jsxs)(`label`,{className:`toggle small`,title:c(`Shows each side through the office so it can follow the other’s scrolling and links. Works for plain web pages that scroll the page itself.`),children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>{Q=e.target.checked,C(e.target.checked),T({main:null,pr:null}),k.current=l()}}),` `,(0,R.jsx)(x,{children:`Sync scrolling`})]})]}),(0,R.jsxs)(`div`,{className:`compare-sides`,children:[(0,R.jsxs)(`div`,{className:`compare-side`,children:[M(t,`main`),(0,R.jsx)(Y,{repo:e,preview:t,label:e.defaultBranch,src:j(t,`main`),width:r,reloads:i+_,busy:a,onStart:o,frameRef:E.main,compact:!0})]}),(0,R.jsxs)(`div`,{className:`compare-side`,children:[M(n,`pr`),(0,R.jsx)(Y,{repo:e,preview:n,label:n.ref??c(`the PR`),src:j(n,`pr`),width:r,reloads:i+_,busy:a,onStart:s,frameRef:E.pr,compact:!0})]})]})]})}var ie=!1,ae=!0;function oe({repoId:e,pr:t}){let n=S(),r=_(t=>t.repos.find(t=>t.id===e)),i=_(e=>e.prPreviews),a=_(e=>e.qa),o=j(e),[s,l]=(0,O.useState)(H),[u,d]=(0,O.useState)(ie),[f,m]=(0,O.useState)(ae),[h,y]=(0,O.useState)(!1),[C,k]=(0,O.useState)(0),[A,N]=(0,O.useState)(!1),P=T(E()),F=(0,O.useRef)(null);if((0,O.useEffect)(()=>{t!==void 0&&M(e,t)},[e,t]),ee(e,o),(0,O.useEffect)(()=>{F.current?.querySelector(`button`)?.focus()},[]),(0,O.useEffect)(()=>{v(location)||navigator.serviceWorker?.register(`/preview/sw.js`,{scope:`/preview/`}).catch(()=>void 0)},[]),!r)return(0,R.jsx)(w,{title:`App`,children:(0,R.jsx)(`p`,{className:`muted`,children:(0,R.jsx)(x,{children:`This floor no longer exists.`})})});let I=async e=>{y(!0);try{await e()}catch{}finally{y(!1)}},L=r.preview,z=o==null?null:c(i[g(r.id,o)],o),V=z??L,U=o==null?void 0:r.pulls.find(e=>e.number===o),G=()=>I(()=>b.startPreview(r.id)),K=(e=!1)=>o!=null&&I(()=>b.startPrPreview(r.id,o,e)),q=e=>{H=e,l(e)},J=B.includes(V.status),X=o==null?r.defaultBranch:`PR #${o}`,Z=r.fullName.split(`/`)[1],Q=u&&z!=null;return(0,R.jsxs)(w,{wide:!0,className:`panel-app`,accent:r.color,title:(0,R.jsxs)(`span`,{className:`app-title`,children:[(0,R.jsxs)(`span`,{className:`app-title-name`,children:[`🖥️ `,Z]}),(0,R.jsx)(W,{status:V.status}),V.ref&&V.status!==`stopped`&&V.status!==`unconfigured`&&(0,R.jsxs)(`span`,{className:`muted small app-title-ref`,children:[V.ref,V.commit?` · ${V.commit}`:``]})]}),children:[(0,R.jsxs)(`div`,{ref:F,children:[(0,R.jsx)(te,{repo:r,channel:o,onPick:e=>M(r.id,e)}),(0,R.jsxs)(`div`,{className:`app-toolbar`,role:`toolbar`,"aria-label":n(`App controls`),children:[(0,R.jsx)(`button`,{className:`btn btn-small`,disabled:P,"aria-expanded":A||P,onClick:()=>N(e=>!e),children:(0,R.jsx)(x,{children:`📱 Phone access`})}),J?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{className:`btn btn-small`,disabled:h,onClick:()=>void(o==null?G():K(!0)),title:n(o==null?`Restart {label}`:`Restart {label} from the PR’s latest commit`,{label:X}),children:(0,R.jsx)(x,{children:`↻ Restart`})}),(0,R.jsx)(`button`,{className:`btn btn-small btn-bad`,disabled:h,onClick:()=>void I(()=>o==null?b.stopPreview(r.id):b.stopPrPreview(r.id,o)),children:(0,R.jsx)(x,{children:`■ Stop`})})]}):(0,R.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:h||V.status===`unconfigured`,onClick:()=>void(o==null?G():K()),children:(0,R.jsx)(x,{children:`▶ Start`})}),z&&(0,R.jsx)(`button`,{className:`btn btn-small ${Q?`btn-on`:``}`,"aria-pressed":Q,onClick:()=>{ie=!u,d(!u)},title:n(`{branch} on the left, PR #{number} on the right`,{branch:r.defaultBranch,number:o??`?`}),children:n(`⇆ Compare with {branch}`,{branch:r.defaultBranch})}),(0,R.jsx)(`button`,{className:`btn btn-small`,disabled:V.status!==`running`&&!(Q&&L.status===`running`),onClick:()=>k(e=>e+1),title:n(`Reload the app`),children:(0,R.jsx)(x,{children:`⟳ Reload`})}),(0,R.jsxs)(`div`,{className:`seg`,role:`group`,"aria-label":n(`Viewport width`),children:[(0,R.jsx)(`button`,{className:`seg-btn ${s===`desktop`?`seg-on`:``}`,"aria-pressed":s===`desktop`,onClick:()=>q(`desktop`),children:`🖥 Desktop`}),(0,R.jsx)(`button`,{className:`seg-btn ${s===`phone`?`seg-on`:``}`,"aria-pressed":s===`phone`,onClick:()=>q(`phone`),title:n(`390px wide`),children:(0,R.jsx)(x,{children:`📱 Phone`})})]}),(0,R.jsx)(`span`,{className:`spacer`}),z&&(0,R.jsx)(`button`,{className:`btn btn-small ${f?`btn-on`:``}`,"aria-pressed":f,onClick:()=>{ae=!f,m(!f)},children:`📋 QA`}),V.url&&!P?(0,R.jsx)(`a`,{className:`btn btn-small`,href:p(V.url,location),target:`_blank`,rel:`noreferrer`,children:(0,R.jsx)(x,{children:`Open in new tab ↗`})}):(0,R.jsx)(`button`,{className:`btn btn-small`,disabled:!0,children:(0,R.jsx)(x,{children:`Open in new tab ↗`})})]})]}),(A||P)&&(0,R.jsx)(D,{blocked:P}),(0,R.jsxs)(`div`,{className:`app-body`,children:[(0,R.jsx)(`div`,{className:`app-main`,children:P?(0,R.jsx)(`p`,{className:`muted`,children:(0,R.jsx)(x,{children:`The preview is hidden until this browser can route its assets securely. Your running app has not been stopped.`})}):Q?(0,R.jsx)(re,{repo:r,main:L,pr:z,width:s,reloads:C,busy:h,onStartMain:()=>void G(),onStartPr:()=>void K()}):(0,R.jsx)(Y,{repo:r,preview:V,label:X,src:V.url&&p(V.url,location),width:s,reloads:C,busy:h,onStart:()=>void(o==null?G():K())})}),z&&f&&U&&(0,R.jsx)(ne,{repo:r,pull:U,qa:a[g(r.id,U.number)]})]}),V.status===`running`&&(0,R.jsxs)(`p`,{className:`muted small app-foot`,children:[(0,R.jsx)(x,{children:`Blank, or “refused to connect”? The app may block being framed: use`}),` `,(0,R.jsx)(`b`,{children:(0,R.jsx)(x,{children:`Open in new tab`})}),`. `,(0,R.jsx)(x,{children:`Keys typed in the app stay in the app, so`}),` `,(0,R.jsx)(`kbd`,{children:`Esc`}),` `,(0,R.jsx)(x,{children:`only closes this panel when focus is outside it;`}),` `,(0,R.jsx)(`b`,{children:`✕`}),` `,(0,R.jsx)(x,{children:`always does.`}),z&&n(` A PR preview stops after a while with nobody watching it, and when its PR merges or closes.`)]})]})}export{M as a,q as i,L as n,j as o,W as r,oe as t};
@@ -0,0 +1 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{f as r}from"./bloomMarks-DariC6lY.js";import{a as i}from"./director-CrzFgnoP.js";import{i as a,r as o}from"./Office-BBnd6tyn.js";import{a as s,i as c,l,n as u,o as d,r as f}from"./kit-C6ByUQ-Y.js";var p=n(e(),1),m=t(),h=10,g=[[`#e63946`,`#f1faee`,`#ffb703`],[`#2a9d8f`,`#e9c46a`,`#f4a261`],[`#7209b7`,`#f72585`,`#4cc9f0`]];function _({run:e,elevation:t}){let n=(0,p.useRef)(null),_=(0,p.useRef)(null),v=d(e.side),y=(0,p.useMemo)(()=>{let n=i(e.seed);return{dir:n()<.5?1:-1,x:v*(105+n()*35),y:u(t)+18+n()*8,palette:g[Math.floor(n()*g.length)],burns:{next:3+n()*3,until:0}}},[e.seed,v,t]);return r(()=>{let r=e.t,i=n.current;if(!i)return;let l=r/e.seconds,u=y.x+Math.sin(r*.13)*4,d=y.y+l*12+Math.sin(r*.4)*.8,f=s(-y.dir*160,y.dir*160,l);if(i.position.set(u,d,f),i.rotation.z=Math.sin(r*.5)*.04,i.rotation.y=r*.05,r>=y.burns.next){y.burns.until=r+1.4,y.burns.next=r+6+Math.random()*5;let n=o(u,d-t,f,90);a(`burner`,{gain:n.gain*c(r,e.seconds,4),pan:n.pan})}if(_.current){let e=r<y.burns.until;_.current.visible=e,e&&_.current.scale.set(1,.8+Math.sin(r*40)*.25,1)}}),(0,m.jsxs)(`group`,{ref:n,children:[Array.from({length:h},(e,t)=>(0,m.jsx)(`mesh`,{material:l(y.palette[t%y.palette.length]),position:[0,15,0],scale:[1,1.15,1],children:(0,m.jsx)(`sphereGeometry`,{args:[9,3,14,t*Math.PI*2/h,Math.PI*2/h]})},t)),(0,m.jsx)(`mesh`,{material:l(y.palette[0],{side:2}),position:[0,4.6,0],children:(0,m.jsx)(`cylinderGeometry`,{args:[4.4,1.4,4,16,1,!0]})}),[0,1,2,3].map(e=>{let t=e*Math.PI/2+Math.PI/4;return(0,m.jsx)(`mesh`,{material:l(`#6b4a33`),position:[Math.cos(t)*1.1,1.5,Math.sin(t)*1.1],children:(0,m.jsx)(`cylinderGeometry`,{args:[.04,.04,2.4,4]})},e)}),(0,m.jsx)(`mesh`,{material:l(`#a1683a`),position:[0,-.3,0],children:(0,m.jsx)(`boxGeometry`,{args:[2,1.3,2]})}),(0,m.jsx)(`mesh`,{ref:_,material:f(`#ffb347`,{add:!0}),position:[0,3.1,0],visible:!1,children:(0,m.jsx)(`coneGeometry`,{args:[.5,2.2,10]})})]})}export{_ as default};
@@ -0,0 +1,45 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{Bt as r,Ft as i,G as a,O as o,P as s,Pt as c,Tt as l,U as u,bt as d,et as f,f as p,g as m,j as h,nt as g,q as _,z as v,zt as y}from"./bloomMarks-DariC6lY.js";import{n as b}from"./BufferGeometryUtils-BsmWvcA2.js";import{B as x,I as S,L as C,R as w,U as T}from"./rig-wAyl3G1G.js";var E=n(e(),1),D=new Map;function O(e,t={}){let n={geometry:e,shading:t.shading??`toon`,outline:t.outline??0,crease:t.crease??0,castShadow:t.castShadow??!1,receiveShadow:t.receiveShadow??!1,material:t.material},r=`${e.uuid}|${n.shading}|${n.outline}|${n.crease}|${+n.castShadow}${+n.receiveShadow}|${n.material?.uuid??``}`,i=D.get(r);return i||(i={key:r,...n},D.set(r,i)),i}function k(e){let t=e.parent;if(!t)return!1;for(;t;){if(!t.visible)return!1;t=t.parent}return!0}var A=16,j=class{look;set;materials;mesh;outline=null;slots=[];outlineGeometry=null;morphN=-1;constructor(e,t,n){this.look=e,this.set=t,this.materials=n,this.mesh=this.make(A),e.outline&&(this.outlineGeometry=e.crease?b(e.geometry,e.crease):e.geometry,this.outline=this.makeOutline(A))}make(e){let t=new _(this.look.geometry,this.look.material??this.materials[this.look.shading],e);t.instanceMatrix.setUsage(s),t.instanceColor=new a(new Float32Array(e*3),3).setUsage(s),t.count=0,t.castShadow=this.look.castShadow&&this.set.shadows,t.receiveShadow=this.look.receiveShadow,t.frustumCulled=!1,t.matrixAutoUpdate=!1,t.raycast=()=>void 0;let n=this.look.geometry.morphAttributes.position?.length??0;return n&&(t.morphTexture=new h(new Float32Array((n+1)*e),n+1,e,d,v)),this.set.root.add(t),t}makeOutline(e){let t=new _(this.outlineGeometry,this.materials.outline(this.look.outline),e);return t.instanceMatrix.setUsage(s),t.count=0,t.frustumCulled=!1,t.matrixAutoUpdate=!1,t.raycast=()=>void 0,this.set.root.add(t),t}add(e){this.slots.push(e);let t=this.mesh.instanceMatrix.count;this.slots.length<=t||(this.mesh.removeFromParent(),this.mesh.dispose(),this.mesh=this.make(t*2),this.morphN=-1,this.outline&&=(this.outline.removeFromParent(),this.outline.dispose(),this.makeOutline(t*2)))}remove(e){let t=this.slots.indexOf(e);t<0||(this.slots[t]=this.slots[this.slots.length-1],this.slots.pop())}sync(e,t){let n=this.mesh,r=n.instanceMatrix.array,i=n.instanceColor.array,a=this.outline,o=a?a.instanceMatrix.array:null,s=n.morphTexture?n.morphTexture.image.data:null,c=s?n.morphTexture.image.width:0,l=this.look.geometry.morphTargetsRelative,u=0,d=0,f=!1;for(let n of this.slots){if(!k(n.obj))continue;let a=n.obj.matrixWorld.elements;if(r.set(a,u*16),i[u*3]=n.color.r,i[u*3+1]=n.color.g,i[u*3+2]=n.color.b,s){let e=n.obj.morphTargetInfluences,t=0;for(let n=1;n<c;n++){let r=e?.[n-1]??0;s[u*c+n]!==r&&(f=!0),s[u*c+n]=r,t+=r}s[u*c]=l?1:1-t}if(u++,o){let n=a[12]-(e?.x??a[12]),r=a[13]-(e?.y??a[13]),i=a[14]-(e?.z??a[14]);n*n+r*r+i*i<=t&&o.set(a,d++*16)}}n.count=u,n.instanceMatrix.needsUpdate=!0,n.instanceColor.needsUpdate=!0,n.morphTexture&&(f||u!==this.morphN)&&(n.morphTexture.needsUpdate=!0),this.morphN=u,a&&(a.count=d,a.instanceMatrix.needsUpdate=!0)}dispose(){this.mesh.removeFromParent(),this.mesh.dispose(),this.outline?.removeFromParent(),this.outline?.dispose(),this.outlineGeometry&&this.outlineGeometry!==this.look.geometry&&this.outlineGeometry.dispose()}},M=class{materials;root=new u;camera=null;outlineRange=1/0;shadows=!0;batches=new Map;eye=new r;constructor(e){this.materials=e,this.root.name=`batches`}add(e,t,n){let r=this.batches.get(e.key);r||(r=new j(e,this,this.materials),this.batches.set(e.key,r));let i={obj:t,color:new o(n)};r.add(i);let a=r;return{setColor:e=>void i.color.set(e),remove:()=>a.remove(i)}}sync(){let e=this.camera?this.eye.setFromMatrixPosition(this.camera.matrixWorld):null,t=this.outlineRange*this.outlineRange;for(let n of this.batches.values())n.sync(e,t)}stats(){let e=0,t=0;for(let n of this.batches.values())e+=n.mesh.count,t+=n.outline?.count??0;return{batches:this.batches.size,instances:e,outlined:t}}dispose(){for(let e of this.batches.values())e.dispose();this.batches.clear()}};function N(e,t,n,r){var a=class extends l{constructor(a){super({vertexShader:t,fragmentShader:n,...a});for(let t in e)this.uniforms[t]=new c(e[t]),Object.defineProperty(this,t,{get(){return this.uniforms[t].value},set(e){this.uniforms[t].value=e}});this.uniforms=i.clone(this.uniforms),r?.(this)}};return a.key=f.generateUUID(),a}function P(e,t,n,r){let i=new g(r?b(t.geometry,r):t.geometry,n);return e.add(i),i}function F(e,t){let n=e.children[0];n&&(t&&n.geometry.dispose(),e.remove(n))}var I=t(),L=N({screenspace:!1,color:new o(`black`),opacity:1,thickness:.05,size:new y},`#include <common>
2
+ #include <morphtarget_pars_vertex>
3
+ #include <skinning_pars_vertex>
4
+ #include <clipping_planes_pars_vertex>
5
+ uniform float thickness;
6
+ uniform bool screenspace;
7
+ uniform vec2 size;
8
+ void main() {
9
+ #if defined (USE_SKINNING)
10
+ #include <beginnormal_vertex>
11
+ #include <morphnormal_vertex>
12
+ #include <skinbase_vertex>
13
+ #include <skinnormal_vertex>
14
+ #include <defaultnormal_vertex>
15
+ #endif
16
+ #include <begin_vertex>
17
+ #include <morphtarget_vertex>
18
+ #include <skinning_vertex>
19
+ #include <project_vertex>
20
+ #include <clipping_planes_vertex>
21
+ vec4 tNormal = vec4(normal, 0.0);
22
+ vec4 tPosition = vec4(transformed, 1.0);
23
+ #ifdef USE_INSTANCING
24
+ tNormal = instanceMatrix * tNormal;
25
+ tPosition = instanceMatrix * tPosition;
26
+ #endif
27
+ if (screenspace) {
28
+ vec3 newPosition = tPosition.xyz + tNormal.xyz * thickness;
29
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
30
+ } else {
31
+ vec4 clipPosition = projectionMatrix * modelViewMatrix * tPosition;
32
+ vec4 clipNormal = projectionMatrix * modelViewMatrix * tNormal;
33
+ vec2 offset = normalize(clipNormal.xy) * thickness / size * clipPosition.w * 2.0;
34
+ clipPosition.xy += offset;
35
+ gl_Position = clipPosition;
36
+ }
37
+ }`,`uniform vec3 color;
38
+ uniform float opacity;
39
+ #include <clipping_planes_pars_fragment>
40
+ void main(){
41
+ #include <clipping_planes_fragment>
42
+ gl_FragColor = vec4(color, opacity);
43
+ #include <tonemapping_fragment>
44
+ #include <colorspace_fragment>
45
+ }`),R=new Map;function z(e){let t=R.get(e);return t||(t=new L({side:1}),t.thickness=e,t.color.set(V),R.set(e,t)),t}function B(e){for(let t of R.values())e.getDrawingBufferSize(t.size)}var V=`#1f1d2b`;function H({color:e=`black`,thickness:t=.05,angle:n=Math.PI}){let r=(0,E.useRef)(null),[i]=(0,E.useState)(()=>new L({side:1,clipping:!0})),a=m(e=>e.gl),o=(0,E.useRef)(null);return(0,E.useLayoutEffect)(()=>{let e=r.current,t=e?.parent;if(!e||!t?.geometry)return;let a=o.current;a&&a.group===e&&a.geometry===t.geometry&&a.angle===n||(a&&F(a.group,a.angle),P(e,t,i,n),o.current={group:e,geometry:t.geometry,angle:n})}),(0,E.useLayoutEffect)(()=>{i.thickness=t,i.color.set(e),a.getDrawingBufferSize(i.size)}),(0,E.useLayoutEffect)(()=>()=>{let e=o.current;o.current=null,e&&F(e.group,e.angle),i.dispose()},[i]),(0,I.jsx)(`group`,{ref:r})}var U={toon:w,glow:S,glowNight:C,outline:z},W=(0,E.createContext)(null),G=()=>(0,E.useContext)(W),K=new Set;function q(){for(let e of K)e.still.sync(),e.moving.sync()}typeof window<`u`&&!Object.getOwnPropertyDescriptor(window,`__swarmBatches`)&&Object.defineProperty(window,"__swarmBatches",{get:()=>[...K].map(e=>({still:e.still.stats(),moving:e.moving.stats()}))});var J=typeof location<`u`&&/[?&]batch=off\b/.test(location.search);function Y(e){return J?(0,I.jsx)(I.Fragment,{children:e.children}):(0,I.jsx)(X,{...e})}function X({children:e,shadows:t=!0,outlineRange:n=24}){let r=m(e=>e.gl),i=m(e=>e.scene),a=(0,E.useMemo)(()=>{let e=new M(U);return e.root.userData.moving=!0,{still:new M(U),moving:e}},[]);return a.still.outlineRange=a.moving.outlineRange=n,a.still.shadows=a.moving.shadows=t,(0,E.useLayoutEffect)(()=>(K.add(a),i.onBeforeRender=q,()=>{K.delete(a),a.still.dispose(),a.moving.dispose()}),[a,i]),p(({camera:e})=>{a.still.camera=a.moving.camera=e,B(r)}),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`primitive`,{object:a.still.root}),(0,I.jsx)(`primitive`,{object:a.moving.root}),(0,I.jsx)(W.Provider,{value:a,children:e})]})}function Z(e){let t=G();return t?(0,I.jsx)(te,{sets:t,...e}):(0,I.jsx)(Q,{...e})}function Q({look:e,color:t,position:n,rotation:r,scale:i,ref:a}){let o=e.material??(e.shading===`toon`?T(t):x(t,e.shading===`glowNight`?`night`:`always`));return(0,I.jsx)(`mesh`,{ref:a,geometry:e.geometry,material:o,position:n,rotation:r,scale:i,castShadow:e.castShadow,receiveShadow:e.receiveShadow,children:e.outline>0&&(0,I.jsx)(H,{thickness:e.outline,color:`#1f1d2b`,angle:e.crease})})}var $={standIn:!0};function ee(e){for(let t=e;t;t=t.parent)if(t.userData.person||t.userData.moving)return!0;return!1}function te({sets:e,look:t,color:n,position:r,rotation:i,scale:a,ref:o}){let s=(0,E.useRef)(null),c=(0,E.useRef)(null);(0,E.useLayoutEffect)(()=>{if(!s.current)return;let r=(ee(s.current)?e.moving:e.still).add(t,s.current,n);return c.current=r,()=>{r.remove(),c.current=null}},[e,t]),(0,E.useLayoutEffect)(()=>c.current?.setColor(n),[n]);let l=(0,E.useCallback)(e=>{s.current=e,typeof o==`function`?o(e):o&&(o.current=e)},[o]);return(0,I.jsx)(`mesh`,{ref:l,geometry:t.geometry,position:r,rotation:i,scale:a,visible:!1,userData:$})}function ne({geometry:e,color:t,outline:n=0,castShadow:r=!1,...i}){return(0,I.jsx)(Z,{look:O(e,{outline:n,castShadow:r}),color:t,...i})}export{H as a,G as i,Z as n,O as o,ne as r,Y as t};
@@ -0,0 +1 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{ba as r}from"./store-FA83kfnc.js";import{Bt as i,F as a,f as o,gt as s,tt as c}from"./bloomMarks-DariC6lY.js";import{a as l}from"./director-CrzFgnoP.js";import{i as u,n as d,r as f}from"./Office-BBnd6tyn.js";import{a as p,i as m,l as h,n as g,o as _}from"./kit-C6ByUQ-Y.js";var v=n(e(),1),y=t(),b=26,x=new i(1,1,1),S=22;function C({run:e,elevation:t}){let n=(0,v.useRef)(null),C=(0,v.useRef)(null),w=(0,v.useRef)(null),T=_(e.side),E=(0,v.useMemo)(()=>{let n=l(e.seed),i=n()<.5?1:-1,a=Array.from({length:b},()=>({dx:(n()-.5)*5,dy:(n()-.5)*3.5,dz:(n()-.5)*11,phase:n()*6.28,rate:10+n()*4,wob:n()*6.28}));return{dir:i,x:T*(r+7+n()*5),y:g(t)+1+n()*2.5,birds:a}},[e.seed,T,t]),D=(0,v.useMemo)(()=>({body:new c,wing:new c,tmp:new c,q:new s,e:new a,p:new i,shape:new i(1,.85,1.8),chirpAt:1}),[]),O=(0,v.useMemo)(()=>({flap:null}),[]);(0,v.useEffect)(()=>(O.flap=d(`flap`),()=>O.flap?.stop(.6)),[O]),o(()=>{let r=e.t,i=n.current,a=C.current,o=w.current;if(!i||!a||!o)return;let s=Math.min(1,r/S),c=p(-E.dir*95,E.dir*95,s),l=E.y+Math.sin(s*Math.PI*2)*2.5,d=E.x-T*Math.sin(s*Math.PI)*3,h=E.dir>0?0:Math.PI;for(let e=0;e<b;e++){let t=E.birds[e],n=Math.sin(r*1.7+t.wob);D.p.set(d+t.dx+n*.6,l+t.dy+Math.sin(r*2.3+t.wob)*.5,c+t.dz),D.e.set(.08*n,h+.15*n,.2*n),D.q.setFromEuler(D.e),D.body.compose(D.p,D.q,D.shape),i.setMatrixAt(e,D.body),D.body.compose(D.p,D.q,x);let s=.15+Math.sin(r*t.rate+t.phase)*.55;D.wing.makeRotationZ(-s).premultiply(D.body),a.setMatrixAt(e,D.wing.multiply(D.tmp.makeTranslation(-.26,0,0))),D.wing.makeRotationZ(s).premultiply(D.body),o.setMatrixAt(e,D.wing.multiply(D.tmp.makeTranslation(.26,0,0)))}i.instanceMatrix.needsUpdate=!0,a.instanceMatrix.needsUpdate=!0,o.instanceMatrix.needsUpdate=!0;let g=f(d,l-t,c,25),_=m(r,24,2);O.flap?.set(g.gain*_,g.pan),r>=D.chirpAt&&r<S&&(D.chirpAt=r+.7+Math.random()*1.6,u(`chirps`,{gain:g.gain*_,pan:g.pan+(Math.random()-.5)*.4}))});let k=h(`#3d405b`);return(0,y.jsxs)(`group`,{children:[(0,y.jsx)(`instancedMesh`,{ref:n,args:[void 0,void 0,b],material:k,frustumCulled:!1,children:(0,y.jsx)(`sphereGeometry`,{args:[.1,8,6]})}),(0,y.jsx)(`instancedMesh`,{ref:C,args:[void 0,void 0,b],material:k,frustumCulled:!1,children:(0,y.jsx)(`boxGeometry`,{args:[.48,.015,.16]})}),(0,y.jsx)(`instancedMesh`,{ref:w,args:[void 0,void 0,b],material:k,frustumCulled:!1,children:(0,y.jsx)(`boxGeometry`,{args:[.48,.015,.16]})})]})}export{C as default};
@@ -0,0 +1 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{p as r}from"./store-FA83kfnc.js";import{Ct as i,f as a,pt as o,st as s,w as c}from"./bloomMarks-DariC6lY.js";import{a as l}from"./director-CrzFgnoP.js";import{n as u,r as d}from"./Office-BBnd6tyn.js";import{a as f,i as p,l as m,n as h,o as g}from"./kit-C6ByUQ-Y.js";import{t as _}from"./news-CrPol-gz.js";var v=n(e(),1),y=t(),b={w:46,h:6,segments:40};function x(e){let t=document.createElement(`canvas`);t.width=2048,t.height=256;let n=t.getContext(`2d`);n.fillStyle=`#fffaf0`,n.fillRect(0,0,t.width,t.height),n.strokeStyle=`#e63946`,n.lineWidth=18,n.strokeRect(9,9,t.width-18,t.height-18),n.fillStyle=`#1f1d2b`,n.textAlign=`center`,n.textBaseline=`middle`;let r=170;do n.font=`bold ${r}px "Segoe UI", "Apple Color Emoji", "Segoe UI Emoji", sans-serif`;while(n.measureText(e).width>t.width-120&&(r-=8)>60);n.fillText(e,t.width/2,t.height/2+8);let a=new c(t);return a.colorSpace=i,a.anisotropy=8,a}function S({run:e,elevation:t}){let n=(0,v.useRef)(null),i=(0,v.useRef)(null),c=g(e.side),S=(0,v.useMemo)(()=>{let n=l(e.seed),i=r.getState(),a=_(i.repos,Date.now(),i.settings.companyName,n()),o=n()<.5?1:-1,s=-c*o*Math.PI/2;return{dir:o,x:c*(95+n()*20),y:h(t)+11+n()*5,text:a,turn:s,along:-Math.sin(s)}},[e.seed,c,t]),C=(0,v.useMemo)(()=>{let e=new o(b.w,b.h,b.segments,1),t=Float32Array.from(e.attributes.position.array),n=x(S.text);return{geo:e,base:t,map:n,mat:new s({map:n,side:2,fog:!1})}},[S.text]);(0,v.useEffect)(()=>()=>{C.geo.dispose(),C.map.dispose(),C.mat.dispose()},[C]);let w=(0,v.useMemo)(()=>({engine:null}),[]);(0,v.useEffect)(()=>(w.engine=u(`engine`),()=>w.engine?.stop(1.2)),[w]),a(()=>{let r=e.t,a=n.current;if(!a)return;let o=f(-S.dir*200,S.dir*200,r/e.seconds),s=S.y+Math.sin(r*.35)*.7;a.position.set(S.x,s,o),a.rotation.y=S.dir>0?0:Math.PI,a.rotation.x=Math.sin(r*.3)*.02;let c=i.current?.children;if(c)for(let e=0;e<c.length;e++)c[e].rotation.z=r*14;let l=C.geo.attributes.position,u=l.array;for(let e=0;e<l.count;e++){let t=.5-C.base[e*3]*S.along/b.w;u[e*3+2]=Math.sin(r*3.2-t*7)*t*1.1}l.needsUpdate=!0;let m=d(S.x,s-t,o,110);w.engine?.set(m.gain*p(r,e.seconds,4),m.pan)});let T=m(`#dfe3ea`),E=m(`#e63946`);return(0,y.jsxs)(`group`,{ref:n,children:[(0,y.jsx)(`mesh`,{material:T,scale:[6,6,21],children:(0,y.jsx)(`sphereGeometry`,{args:[1,24,16]})}),(0,y.jsx)(`mesh`,{material:E,scale:[6.05,1.1,18],position:[0,.2,0],children:(0,y.jsx)(`sphereGeometry`,{args:[1,24,8]})}),[0,1,2,3].map(e=>(0,y.jsx)(`mesh`,{material:E,position:[0,0,-18],"rotation-z":e*Math.PI/2,children:(0,y.jsx)(`boxGeometry`,{args:[.4,9,4]})},e)),(0,y.jsx)(`mesh`,{material:m(`#495057`),position:[0,-6.4,2],children:(0,y.jsx)(`boxGeometry`,{args:[2.2,1.6,5]})}),(0,y.jsx)(`group`,{ref:i,children:[-1.6,1.6].map(e=>(0,y.jsx)(`mesh`,{material:m(`#2b2d42`),position:[e,-6.4,-.8],children:(0,y.jsx)(`boxGeometry`,{args:[.2,2.6,.12]})},e))}),(0,y.jsx)(`mesh`,{material:m(`#2b2d42`),position:[0,-3,-26],"rotation-x":Math.PI/2-.25,children:(0,y.jsx)(`cylinderGeometry`,{args:[.05,.05,12,4]})}),(0,y.jsx)(`mesh`,{geometry:C.geo,material:C.mat,position:[0,-5,-32-b.w/2],"rotation-y":S.turn})]})}export{S as default};
@@ -0,0 +1 @@
1
+ import{C as e,S as t}from"./bloomMarks-DariC6lY.js";function n(t,n=!1){let i=t[0].index!==null,a=new Set(Object.keys(t[0].attributes)),o=new Set(Object.keys(t[0].morphAttributes)),s={},c={},l=t[0].morphTargetsRelative,u=new e,d=0;for(let e=0;e<t.length;++e){let r=t[e],f=0;if(i!==(r.index!==null))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.`),null;for(let t in r.attributes){if(!a.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure "`+t+`" attribute exists among all geometries, or in none of them.`),null;s[t]===void 0&&(s[t]=[]),s[t].push(r.attributes[t]),f++}if(f!==a.size)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. Make sure all geometries have the same number of attributes.`),null;if(l!==r.morphTargetsRelative)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphTargetsRelative must be consistent throughout all geometries.`),null;for(let t in r.morphAttributes){if(!o.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphAttributes must be consistent throughout all geometries.`),null;c[t]===void 0&&(c[t]=[]),c[t].push(r.morphAttributes[t])}if(n){let t;if(i)t=r.index.count;else if(r.attributes.position!==void 0)t=r.attributes.position.count;else return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. The geometry must have either an index or a position attribute`),null;u.addGroup(d,t,e),d+=t}}if(i){let e=0,n=[];for(let r=0;r<t.length;++r){let i=t[r].index;for(let t=0;t<i.count;++t)n.push(i.getX(t)+e);e+=t[r].attributes.position.count}u.setIndex(n)}for(let e in s){let t=r(s[e]);if(!t)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` attribute.`),null;u.setAttribute(e,t)}for(let e in c){let t=c[e][0].length;if(t!==0){u.morphAttributes=u.morphAttributes||{},u.morphAttributes[e]=[];for(let n=0;n<t;++n){let t=[];for(let r=0;r<c[e].length;++r)t.push(c[e][r][n]);let i=r(t);if(!i)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` morphAttribute.`),null;u.morphAttributes[e].push(i)}}}return u}function r(e){let n,r,i,a=-1,o=0;for(let t=0;t<e.length;++t){let s=e[t];if(n===void 0&&(n=s.array.constructor),n!==s.array.constructor)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.`),null;if(r===void 0&&(r=s.itemSize),r!==s.itemSize)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.`),null;if(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.`),null;if(a===-1&&(a=s.gpuType),a!==s.gpuType)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.`),null;o+=s.count*r}let s=new n(o),c=new t(s,r,i),l=0;for(let t=0;t<e.length;++t){let n=e[t];if(n.isInterleavedBufferAttribute){let e=l/r;for(let t=0,i=n.count;t<i;t++)for(let i=0;i<r;i++){let r=n.getComponent(t,i);c.setComponent(t+e,i,r)}}else s.set(n.array,l);l+=n.count*r}return a!==void 0&&(c.gpuType=a),c}function i(e,n=Math.PI/3){let r=e.index?e.toNonIndexed():e,i=r.attributes.position,a=i.count,o;if(i.isBufferAttribute===!0&&i.itemSize===3&&i.normalized===!1)o=i.array;else{o=new Float64Array(a*3);for(let e=0;e<a;e++)o[3*e+0]=i.getX(e),o[3*e+1]=i.getY(e),o[3*e+2]=i.getZ(e)}let s=Math.cos(n),c=(1+1e-10)*100,l=a/3,u=new Float64Array(l*3);for(let e=0;e<l;e++){let t=9*e,n=o[t+0],r=o[t+1],i=o[t+2],a=o[t+3],s=o[t+4],c=o[t+5],l=o[t+6],d=o[t+7],f=o[t+8],p=l-a,m=d-s,h=f-c,g=n-a,_=r-s,v=i-c,y=m*v-h*_,b=h*g-p*v,x=p*_-m*g,S=1/(Math.sqrt(y*y+b*b+x*x)||1);u[3*e+0]=y*S,u[3*e+1]=b*S,u[3*e+2]=x*S}let d=new Int32Array(a),f=new Float64Array(a*3),p=1;for(;p<a*2;)p<<=1;let m=p-1,h=new Int32Array(p),g=0;for(let e=0;e<a;e++){let t=3*e,n=Math.trunc(o[t+0]*c),r=Math.trunc(o[t+1]*c),i=Math.trunc(o[t+2]*c),a=(Math.imul(n,73856093)^Math.imul(r,19349663)^Math.imul(i,83492791))&m;for(;;){let t=h[a];if(t===0){let t=3*g;f[t+0]=n,f[t+1]=r,f[t+2]=i,h[a]=g+1,d[e]=g++;break}let o=3*(t-1);if(f[o+0]===n&&f[o+1]===r&&f[o+2]===i){d[e]=t-1;break}a=a+1&m}}let _=new Int32Array(g+1);for(let e=0;e<a;e++)_[d[e]+1]++;for(let e=0;e<g;e++)_[e+1]+=_[e];let v=new Int32Array(a),y=_.slice(0,g);for(let e=0;e<l;e++){let t=3*e;v[y[d[t+0]]++]=e,v[y[d[t+1]]++]=e,v[y[d[t+2]]++]=e}let b=new Float32Array(a*3);for(let e=0;e<l;e++){let t=3*e,n=u[t+0],r=u[t+1],i=u[t+2];for(let e=0;e<3;e++){let a=t+e,o=d[a],c=0,l=0,f=0;for(let e=_[o],t=_[o+1];e<t;e++){let t=3*v[e],a=u[t+0],o=u[t+1],d=u[t+2];n*a+r*o+i*d>s&&(c+=a,l+=o,f+=d)}let p=1/(Math.sqrt(c*c+l*l+f*f)||1);b[3*a+0]=c*p,b[3*a+1]=l*p,b[3*a+2]=f*p}}return r.setAttribute(`normal`,new t(b,3,!1)),r}export{i as n,n as t};
@@ -0,0 +1 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{f as r}from"./bloomMarks-DariC6lY.js";import{a as i}from"./director-CrzFgnoP.js";import{i as a,r as o}from"./Office-BBnd6tyn.js";import{a as s,i as c,l,n as u,o as d}from"./kit-C6ByUQ-Y.js";var f=n(e(),1),p=t(),m=22;function h({run:e,elevation:t}){let n=(0,f.useRef)(null),h=d(e.side),g=(0,f.useMemo)(()=>{let n=i(e.seed);return{dir:n()<.5?1:-1,x:h*(115+n()*30),y:u(t)+6+n()*6,next:4+n()*4}},[e.seed,h,t]);r(()=>{let r=e.t,i=n.current;if(!i)return;let l=s(-g.dir*175,g.dir*175,r/e.seconds),u=g.y+Math.sin(r*.8)*1.6;if(i.position.set(g.x+Math.sin(r*.21)*6,u,l),i.rotation.set(Math.sin(r*.9)*.05,(g.dir>0?0:Math.PI)+Math.sin(r*.33)*.5,Math.sin(r*.7)*.06),r>=g.next){g.next=r+7+Math.random()*6;let n=o(i.position.x,u-t,l,110);a(`squeak`,{gain:n.gain*c(r,e.seconds,3),pan:n.pan,pitch:.8+Math.random()*.3})}});let _=l(`#ffd23f`),v=l(`#ff8c1a`),y=l(`#1f1d2b`);return(0,p.jsx)(`group`,{ref:n,children:(0,p.jsxs)(`group`,{scale:m,children:[(0,p.jsx)(`mesh`,{material:_,scale:[1,.78,1.25],children:(0,p.jsx)(`sphereGeometry`,{args:[.5,22,16]})}),(0,p.jsx)(`mesh`,{material:_,position:[0,.18,-.6],"rotation-x":-.9,children:(0,p.jsx)(`coneGeometry`,{args:[.2,.4,14]})}),[-1,1].map(e=>(0,p.jsx)(`mesh`,{material:_,position:[e*.44,.08,-.05],scale:[.35,.6,1],children:(0,p.jsx)(`sphereGeometry`,{args:[.3,14,10]})},e)),(0,p.jsx)(`mesh`,{material:_,position:[0,.58,.36],children:(0,p.jsx)(`sphereGeometry`,{args:[.32,20,14]})}),(0,p.jsx)(`mesh`,{material:v,position:[0,.5,.68],scale:[1.1,.42,1],children:(0,p.jsx)(`sphereGeometry`,{args:[.16,14,10]})}),[-1,1].map(e=>(0,p.jsxs)(`group`,{children:[(0,p.jsx)(`mesh`,{material:y,position:[e*.14,.68,.6],children:(0,p.jsx)(`sphereGeometry`,{args:[.05,10,8]})}),(0,p.jsx)(`mesh`,{material:l(`#ffffff`),position:[e*.13,.7,.645],children:(0,p.jsx)(`sphereGeometry`,{args:[.015,6,4]})})]},e))]})})}export{h as default};
@@ -0,0 +1,65 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{Jr as r,dn as i}from"./store-FA83kfnc.js";import{Ht as a,O as o,Tt as s,f as c,g as l,it as u,pt as d,rt as f,tt as p,ut as m,w as h}from"./bloomMarks-DariC6lY.js";import{a as g,c as _,n as v}from"./useGraphics-Cif18p7Q.js";import{a as y}from"./gate-BplJKcLG.js";import{createPipeline as b,t as x}from"./pipeline-BOTOZ69L.js";var S=n(e(),1),C={name:`HorizontalBlurShader`,uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
2
+
3
+ varying vec2 vUv;
4
+
5
+ void main() {
6
+
7
+ vUv = uv;
8
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
9
+
10
+ }`,fragmentShader:`
11
+
12
+ uniform sampler2D tDiffuse;
13
+ uniform float h;
14
+
15
+ varying vec2 vUv;
16
+
17
+ void main() {
18
+
19
+ vec4 sum = vec4( 0.0 );
20
+
21
+ sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
22
+ sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
23
+ sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
24
+ sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
25
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
26
+ sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
27
+ sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
28
+ sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
29
+ sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
30
+
31
+ gl_FragColor = sum;
32
+
33
+ }`},w={name:`VerticalBlurShader`,uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
34
+
35
+ varying vec2 vUv;
36
+
37
+ void main() {
38
+
39
+ vUv = uv;
40
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
41
+
42
+ }`,fragmentShader:`
43
+
44
+ uniform sampler2D tDiffuse;
45
+ uniform float v;
46
+
47
+ varying vec2 vUv;
48
+
49
+ void main() {
50
+
51
+ vec4 sum = vec4( 0.0 );
52
+
53
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
54
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
55
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
56
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
57
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
58
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
59
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
60
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
61
+ sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
62
+
63
+ gl_FragColor = sum;
64
+
65
+ }`},T=t(),E=1.1,D=[1024,768],O=8e3,k=.45,A=48,j=()=>null;function M(){let e=new u;return e.onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace(`vec4( vec3( 1.0 - fragCoordZ ), opacity );`,`vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * 0.85 );`)},e}function N(e){if(e.userData.person||e.userData.moving||e.userData.contactShadow)return!0;let t=e.material;return e.isPoints||e.isSprite?!0:!!t&&!Array.isArray(t)&&t.transparent&&!t.depthWrite}function P(){let e=l(e=>e.gl),t=l(e=>e.scene),n=(0,S.useMemo)(()=>{let e=new a(D[0],D[1]),t=new a(D[0],D[1],{depthBuffer:!1});e.texture.generateMipmaps=t.texture.generateMipmaps=!1;let n=new m(-16,16,12,-12,0,E);n.position.set(0,-.005,0),n.up.set(0,0,1),n.lookAt(0,1,0),n.updateMatrixWorld(),e.texture.repeat.set(1,-1),e.texture.offset.set(0,1);let r=new s(C),i=new s(w);r.depthTest=i.depthTest=!1;let o=new x(r);return{target:e,blurTarget:t,camera:n,depth:M(),quad:o,h:r,v:i,hidden:[]}},[]);(0,S.useEffect)(()=>()=>{for(let e of[n.target,n.blurTarget,n.depth,n.quad,n.h,n.v])e.dispose()},[n]);let r=t=>{let{quad:r,h:i,v:a,target:o,blurTarget:s}=n;r.material=i,i.uniforms.tDiffuse.value=o.texture,i.uniforms.h.value=t/D[0],e.setRenderTarget(s),r.render(e),r.material=a,a.uniforms.tDiffuse.value=s.texture,a.uniforms.v.value=t/D[1],e.setRenderTarget(o),r.render(e)},i=(0,S.useRef)(-1/0);return c(()=>{let a=performance.now();if(a-i.current<O)return;i.current=a;let{hidden:s,target:c,camera:l,depth:u}=n;t.traverse(e=>{e.visible&&N(e)&&(e.visible=!1,s.push(e))});let d=t.background,f=t.overrideMaterial,p=e.shadowMap.autoUpdate,m=e.getRenderTarget(),h=e.autoClear,g=e.getClearAlpha(),_=e.getClearColor(new o);t.background=null,t.overrideMaterial=u,e.shadowMap.autoUpdate=!1;try{e.setRenderTarget(c),e.setClearColor(0,0),e.clear(!0,!0,!1),e.autoClear=!1,e.render(t,l),r(3),r(1.2)}finally{for(let e of s)e.visible=!0;s.length=0,t.background=d,t.overrideMaterial=f,e.shadowMap.autoUpdate=p,e.autoClear=h,e.setClearColor(_,g),e.setRenderTarget(m)}}),(0,T.jsxs)(`mesh`,{rotation:[-Math.PI/2,0,0],position:[0,.008,0],raycast:j,userData:{contactShadow:!0},renderOrder:-1,children:[(0,T.jsx)(`planeGeometry`,{args:[32,24]}),(0,T.jsx)(`meshBasicMaterial`,{map:n.target.texture,transparent:!0,opacity:k,depthWrite:!1,toneMapped:!1,fog:!1})]})}function F(){let e=document.createElement(`canvas`);e.width=e.height=64;let t=e.getContext(`2d`),n=t.createRadialGradient(32,32,0,32,32,32);return n.addColorStop(0,`rgba(0,0,0,0.38)`),n.addColorStop(.55,`rgba(0,0,0,0.2)`),n.addColorStop(1,`rgba(0,0,0,0)`),t.fillStyle=n,t.fillRect(0,0,64,64),new h(e)}function I(){let e=(0,S.useRef)(null),t=(0,S.useMemo)(()=>({geometry:new d(1,1).rotateX(-Math.PI/2),material:new f({map:F(),transparent:!0,depthWrite:!1,toneMapped:!1,fog:!1}),m:new p}),[]);return(0,S.useEffect)(()=>()=>{t.geometry.dispose(),t.material.map?.dispose(),t.material.dispose()},[t]),c(()=>{let n=e.current;if(!n)return;let r=0;for(let e of i().values()){if(r>=A)break;let i=.62+.2*e.sit;t.m.makeScale(i,1,i).setPosition(e.x,.009,e.z),n.setMatrixAt(r++,t.m)}n.count=r,n.instanceMatrix.needsUpdate=!0}),(0,T.jsx)(`instancedMesh`,{ref:e,args:[t.geometry,t.material,A],frustumCulled:!1,raycast:j,userData:{contactShadow:!0}})}function L(){return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(P,{}),(0,T.jsx)(I,{})]})}var R=new Map,z=null,B,V=4e3,H=6e4;function U(e,t,n,r){clearTimeout(B),z??={autoClear:e.autoClear,autoReset:e.info.autoReset};let i=R.get(r);if(i&&i.scene===t&&i.camera===n)return i.pipe;i?.pipe.drop();let a=b(e,t,n,r);return R.set(r,{scene:t,camera:n,pipe:a}),a}function W(e){z&&=(e.autoClear=z.autoClear,e.info.autoReset=z.autoReset,null),e.setRenderTarget(null),clearTimeout(B),B=setTimeout(()=>{for(let e of R.values())e.pipe.drop();R.clear()},H)}function G({tier:e}){let t=l(e=>e.gl),n=l(e=>e.scene),i=l(e=>e.camera),a=l(e=>e.size),o=l(e=>e.viewport.dpr),[s,u]=(0,S.useState)(null),d=(0,S.useRef)(!1),f=(0,S.useRef)({at:0,done:!1});return(0,S.useLayoutEffect)(()=>{let r=U(t,n,i,e);return d.current=!1,u(r),()=>{_(null),g(`low`)}},[t,n,i,e]),(0,S.useEffect)(()=>()=>W(t),[t]),(0,S.useLayoutEffect)(()=>s?.setSize(a.width,a.height),[s,a,o]),(0,S.useEffect)(()=>{if(!s)return;let e=setInterval(()=>_(s.stats()),1e3);return()=>clearInterval(e)},[s]),c((o,c)=>{if(!y()){if(!s){t.render(n,i);return}try{let o=f.current;if(!o.done&&o.at&&performance.now()>=o.at){o.done=!0;let s=e===`high`?`medium`:`high`;if(!R.has(s)){let e=performance.now(),o=U(t,n,i,s);o.setSize(a.width,a.height),o.render(c),r(`warmup`,`${s} effects built in ${Math.round(performance.now()-e)} ms`)}}s.render(c)}catch(e){v(`they stopped with an error`,e),t.render(n,i);return}d.current||(d.current=!0,f.current.at||(f.current.at=performance.now()+V),_(s.stats()),g(e))}},1),e===`high`?(0,T.jsx)(L,{}):null}export{G as default};
@@ -0,0 +1,33 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{C as r,O as i,P as a,S as o,Tt as s,et as c,f as l,g as u,i as d,mt as f}from"./bloomMarks-DariC6lY.js";import{a as p}from"./director-CrzFgnoP.js";import{i as m,r as h}from"./Office-BBnd6tyn.js";import{n as g,o as _}from"./kit-C6ByUQ-Y.js";var v=n(e(),1),y=t(),b=2400,x=-6,S=[`position`,`aVel`,`aColor`,`aTime`,`aSize`],C=[`#ff595e`,`#ffca3a`,`#8ac926`,`#1982c4`,`#ff70a6`,`#ffffff`,`#c77dff`,`#4cc9f0`],w=`
2
+ attribute vec3 aVel;
3
+ attribute vec3 aColor;
4
+ attribute vec2 aTime; // start, life
5
+ attribute float aSize;
6
+ uniform float uTime;
7
+ uniform float uScale;
8
+ varying vec3 vColor;
9
+ varying float vFade;
10
+ void main() {
11
+ float age = uTime - aTime.x;
12
+ if (age < 0.0 || age > aTime.y) {
13
+ gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
14
+ gl_PointSize = 0.0;
15
+ return;
16
+ }
17
+ // air drag slows the sparks, then gravity takes them
18
+ float drag = (1.0 - exp(-1.6 * age)) / 1.6;
19
+ vec3 p = position + aVel * drag + vec3(0.0, ${x.toFixed(1)} * 0.5 * age * age, 0.0);
20
+ vec4 mv = modelViewMatrix * vec4(p, 1.0);
21
+ gl_Position = projectionMatrix * mv;
22
+ float k = age / aTime.y;
23
+ vFade = (1.0 - k * k) * (0.75 + 0.25 * sin(age * 30.0 + aSize * 50.0));
24
+ vColor = aColor;
25
+ gl_PointSize = aSize * uScale / max(1.0, -mv.z);
26
+ }`,T=`
27
+ varying vec3 vColor;
28
+ varying float vFade;
29
+ void main() {
30
+ float r = length(gl_PointCoord - 0.5);
31
+ float a = (1.0 - smoothstep(0.1, 0.5, r)) * vFade;
32
+ gl_FragColor = vec4(vColor * (1.0 + (1.0 - smoothstep(0.0, 0.2, r))), a);
33
+ }`;function E({run:e,elevation:t}){let n=u(e=>e.gl),E=_(e.side),D=(0,v.useMemo)(()=>{let n=p(e.seed),c=[],l=(e,r=!1)=>{let a=n()<.2?`willow`:n()<.35?`ring`:`sphere`,o=C[Math.floor(n()*C.length)];c.push({at:e,x:E*(140+n()*90),y:g(t)+22+n()*30,z:(n()-.5)*260,shape:a,color:new i(a===`willow`?`#ffcf6b`:o),color2:new i(n()<.4?C[Math.floor(n()*C.length)]:o),sparks:r?140:70+Math.floor(n()*50),done:!1})};for(let t=2;t<e.seconds-12;t+=.9+n()*1.3)l(t);for(let t=0;t<9;t++)l(e.seconds-11+t*.35+n()*.2,!0);c.sort((e,t)=>e.at-t.at);let u=new r,m=e=>new o(new Float32Array(b*e),e).setUsage(a);u.setAttribute(`position`,m(3)),u.setAttribute(`aVel`,m(3)),u.setAttribute(`aColor`,m(3)),u.setAttribute(`aTime`,m(2)),u.setAttribute(`aSize`,m(1)),u.attributes.aTime.array.fill(-1e3);let h=d(new s({vertexShader:w,fragmentShader:T,transparent:!0,depthWrite:!1,blending:2,uniforms:{uTime:{value:0},uScale:{value:400}}})),_=new f(u,h);return _.frustumCulled=!1,_.renderOrder=5,{launches:c,geo:u,mat:h,points:_,next:0,slot:0,rnd:p(e.seed+1)}},[e.seed,e.seconds,E,t]);(0,v.useEffect)(()=>()=>{D.geo.dispose(),D.mat.dispose()},[D]);let O=(e,t,n,r,i,a,o,s,c,l)=>{let u=D.slot;D.slot=(D.slot+1)%b;let d=D.geo.attributes,f=d.position.array,p=d.aVel.array,m=d.aColor.array,h=d.aTime.array;f[u*3]=e,f[u*3+1]=t,f[u*3+2]=n,p[u*3]=r,p[u*3+1]=i,p[u*3+2]=a,m[u*3]=o.r,m[u*3+1]=o.g,m[u*3+2]=o.b,h[u*2]=s,h[u*2+1]=c,d.aSize.array[u]=l};return l(({camera:r})=>{let i=e.t,a=r;D.mat.uniforms.uTime.value=i,D.mat.uniforms.uScale.value=n.domElement.height*.5/Math.tan(c.degToRad(a.fov/2));let o=!1;for(;D.next<D.launches.length&&D.launches[D.next].at<=i;){let e=D.launches[D.next++],n=1.5+D.rnd()*.4,i=e.at+n,a=(e.y-.5*x*n*n)/((1-Math.exp(-1.6*n))/1.6);for(let t=0;t<6;t++)O(e.x,0,e.z,0,a,0,e.color,e.at+t*.04,n-t*.04,t?.9:1.6);let s=D.rnd;for(let t=0;t<e.sparks;t++){let n,r,a;if(e.shape===`ring`){let i=t/e.sparks*Math.PI*2;n=Math.cos(i)*.25,r=Math.cos(i)*.9,a=Math.sin(i)}else{let e=s()*2-1,t=s()*Math.PI*2,i=Math.sqrt(1-e*e);n=Math.cos(t)*i,r=e,a=Math.sin(t)*i}let o=e.shape===`willow`?14:25+s()*6;O(e.x,e.y,e.z,n*o,r*o+(e.shape===`willow`?3:0),a*o,t%2?e.color2:e.color,i,e.shape===`willow`?3.6:2+s()*.6,e.shape===`willow`?2.4:3.2)}o=!0;let c=h(e.x,e.y-t,e.z,220);m(`launch`,{gain:c.gain,pan:c.pan,pitch:.85+D.rnd()*.3});let l=Math.hypot(e.x-r.position.x,e.y-t-r.position.y,e.z-r.position.z)/343;m(`boom`,{gain:c.gain,pan:c.pan,delay:n+l}),e.shape!==`ring`&&m(`crackle`,{gain:c.gain*.8,pan:c.pan,delay:n+l+.5})}if(o)for(let e of S)D.geo.attributes[e].needsUpdate=!0}),(0,y.jsx)(`primitive`,{object:D.points})}export{E as default};
@@ -0,0 +1 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{Va as r,Vo as i,p as a}from"./store-FA83kfnc.js";import{Bt as o,f as s}from"./bloomMarks-DariC6lY.js";import{a as c}from"./director-CrzFgnoP.js";import{n as l,r as u}from"./Office-BBnd6tyn.js";import{a as d,c as f,i as p,l as m,n as h,o as g,s as _}from"./kit-C6ByUQ-Y.js";var v=n(e(),1),y=t(),b=8,x=19,S={approach:20,over:27,down:31,lift:42,up:46},C=1.62*1.6;function w({run:e,elevation:t}){let n=(0,v.useRef)(null),w=(0,v.useRef)(null),T=(0,v.useRef)(null),E=g(e.side),D=(0,v.useMemo)(()=>{let n=c(e.seed),s=a.getState(),l=s.repos.reduce((e,t)=>Math.max(e,t.floor),0),u=s.floor===-1||n()<.5,d={x:r.x,y:i(l)+C,z:r.z};return{cx:E*(85+n()*20),cz:(n()-.5)*40,radius:42+n()*10,y:h(t)+9+n()*8,dir:n()<.5?1:-1,phase:n()*Math.PI*2,far:{x:E*420,z:(n()-.5)*500},land:u,pad:d,from:new o,fromSet:!1,heading:0}},[e.seed,E,t]),O=(0,v.useMemo)(()=>({rotor:null,prev:new o,first:!0,spin:0}),[]);(0,v.useEffect)(()=>(O.rotor=l(`rotor`),()=>O.rotor?.stop(1)),[O]),s((r,i)=>{let a=e.t,o=n.current;if(!o)return;let s=D.phase+D.dir*(a*Math.PI*2)/x,c=D.cx+Math.cos(s)*D.radius,l=D.cz+Math.sin(s)*D.radius,m=D.y,h=_(a/b),g=_((a-(e.seconds-b))/b);c=d(D.far.x,c,h),l=d(-D.far.z,l,h),m+=(1-h)*40;let v=0;if(D.land&&a>=S.approach&&a<e.seconds-b){D.fromSet||D.from.set(c,m,l),D.fromSet=!0;let e=D.pad.y+14,t=f(a,S.approach,S.over);c=d(D.from.x,D.pad.x,t),l=d(D.from.z,D.pad.z,t),m=d(D.from.y,e,t),m=d(m,D.pad.y,f(a,S.over,S.down)-f(a,S.lift,S.up)),v=f(a,S.down-.5,S.down)*(1-f(a,S.lift,S.lift+1))}D.land&&a>=e.seconds-b&&(c=D.pad.x,l=D.pad.z,m=D.pad.y+14),c=d(c,D.far.x,g),l=d(l,D.far.z,g),m+=g*40,O.first&&O.prev.set(c,m,l),O.first=!1;let y=c-O.prev.x,C=l-O.prev.z;y*y+C*C>1e-5&&(D.heading=Math.atan2(y,C)),o.rotation.y=D.heading;let E=D.land?1-f(a,S.approach,S.approach+3)+f(a,e.seconds-b,e.seconds-b+2):1;o.rotation.z=-D.dir*.22*h*(1-g)*Math.min(1,E),o.rotation.x=.12*(1-v),o.position.set(c,m,l),O.prev.set(c,m,l),O.spin+=Math.min(i,.1)*(31-22*v),w.current&&(w.current.rotation.y=O.spin),T.current&&(T.current.rotation.x=O.spin*1.3);let k=u(c,m-t,l,60);O.rotor?.set(k.gain*p(a,e.seconds,2)*(1-.6*v),k.pan,1-.35*v)});let k=m(`#d62828`),A=m(`#2b2d42`);return(0,y.jsxs)(`group`,{ref:n,scale:1.6,children:[(0,y.jsx)(`mesh`,{material:k,scale:[1,.95,1.5],children:(0,y.jsx)(`sphereGeometry`,{args:[1.6,14,10]})}),(0,y.jsx)(`mesh`,{material:m(`#8ecae6`),position:[0,.35,1.25],scale:[1,.7,.8],children:(0,y.jsx)(`sphereGeometry`,{args:[1.05,12,8]})}),(0,y.jsx)(`mesh`,{material:k,position:[0,.3,-3.2],"rotation-x":Math.PI/2,children:(0,y.jsx)(`cylinderGeometry`,{args:[.28,.45,4.2,8]})}),(0,y.jsx)(`mesh`,{material:m(`#f1faee`),position:[0,1,-5.1],children:(0,y.jsx)(`boxGeometry`,{args:[.15,1.4,.9]})}),(0,y.jsx)(`mesh`,{ref:T,material:A,position:[.2,.9,-5.2],children:(0,y.jsx)(`boxGeometry`,{args:[.05,1.6,.18]})}),[-.9,.9].map(e=>(0,y.jsx)(`mesh`,{material:A,position:[e,-1.55,0],children:(0,y.jsx)(`boxGeometry`,{args:[.12,.12,3.4]})},e)),(0,y.jsx)(`mesh`,{material:A,position:[0,1.55,0],children:(0,y.jsx)(`cylinderGeometry`,{args:[.18,.18,.5,8]})}),(0,y.jsxs)(`group`,{ref:w,position:[0,1.85,0],children:[(0,y.jsx)(`mesh`,{material:A,children:(0,y.jsx)(`boxGeometry`,{args:[11,.06,.35]})}),(0,y.jsx)(`mesh`,{material:A,"rotation-y":Math.PI/2,children:(0,y.jsx)(`boxGeometry`,{args:[11,.06,.35]})})]})]})}export{w as default};
@@ -0,0 +1,33 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{Bt as r,D as i,O as a,Tt as o,f as s,nt as c}from"./bloomMarks-DariC6lY.js";import{n as l}from"./weatherState-ExG1doW-.js";import{a as u}from"./director-CrzFgnoP.js";import{n as d,r as f}from"./Office-BBnd6tyn.js";import{i as p,o as m}from"./kit-C6ByUQ-Y.js";var h=n(e(),1),g=t(),_=`
2
+ varying vec2 vP;
3
+ void main() {
4
+ vP = position.xy;
5
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
6
+ }`,v=`
7
+ uniform float uTime;
8
+ uniform float uFade;
9
+ uniform float uRadius;
10
+ uniform vec3 uLit;
11
+ uniform vec3 uShade;
12
+ varying vec2 vP;
13
+ float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
14
+ float noise(vec2 p) {
15
+ vec2 i = floor(p);
16
+ vec2 f = fract(p);
17
+ f = f * f * (3.0 - 2.0 * f);
18
+ return mix(mix(hash(i), hash(i + vec2(1.0, 0.0)), f.x), mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), f.x), f.y);
19
+ }
20
+ void main() {
21
+ float r = length(vP) / uRadius;
22
+ float a = atan(vP.y, vP.x);
23
+ // two arms winding in to a clear eye, turning slowly anticlockwise
24
+ float arms = sin(a * 2.0 + log(max(r, 0.02)) * 7.0 - uTime * 0.25);
25
+ float cloud = smoothstep(-0.3, 0.6, arms + noise(vP * 0.02 + uTime * 0.02) * 0.8 - 0.3);
26
+ float eye = smoothstep(0.05, 0.12, r);
27
+ float edge = 1.0 - smoothstep(0.75, 1.0, r);
28
+ float wall = 1.0 - smoothstep(0.1, 0.22, abs(r - 0.15));
29
+ float alpha = clamp((cloud * 0.8 + wall * 0.6) * eye * edge, 0.0, 1.0) * uFade * 0.85;
30
+ vec3 col = mix(uShade, uLit, cloud * 0.7 + 0.3 * smoothstep(0.2, 0.9, r));
31
+ gl_FragColor = vec4(col, alpha);
32
+ #include <colorspace_fragment>
33
+ }`,y=new a(`#eef1f6`),b=new a(`#7d8794`),x=22,S={kind:`heavy-rain`,wind:1};function C({run:e}){let t=m(e.side),n=(0,h.useMemo)(()=>{let n=u(e.seed),a=new i(230,96),s=new o({vertexShader:_,fragmentShader:v,transparent:!0,depthWrite:!1,side:2,uniforms:{uTime:{value:0},uFade:{value:0},uRadius:{value:230},uLit:{value:y.clone()},uShade:{value:b.clone()}}}),l=new c(a,s);return l.position.set(t*(320+n()*30),140,(n()-.5)*120),l.rotation.set(-Math.PI/2,0,0),l.rotateOnWorldAxis(new r(0,0,1),t*.95),l.renderOrder=1,l.frustumCulled=!1,{geo:a,mat:s,mesh:l}},[e.seed,t]),a=(0,h.useMemo)(()=>({gale:null}),[]);return(0,h.useEffect)(()=>(a.gale=d(`gale`),()=>{l(null),a.gale?.stop(2),n.geo.dispose(),n.mat.dispose()}),[n,a]),s(()=>{let t=e.t;n.mat.uniforms.uTime.value=t,n.mat.uniforms.uFade.value=p(t,e.seconds,15),l(t<e.seconds-x?S:null);let r=f(n.mesh.position.x,0,n.mesh.position.z,300);a.gale?.set(Math.max(.4,r.gain)*p(t,e.seconds,10),r.pan*.5)}),(0,g.jsx)(`primitive`,{object:n.mesh})}export{C as default};
@@ -0,0 +1 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{Lo as r}from"./store-FA83kfnc.js";import{v as i,y as a}from"./index-B6qvKFYN.js";import{f as o}from"./bloomMarks-DariC6lY.js";import{a as s}from"./director-CrzFgnoP.js";import{o as c}from"./cityLayout-7ckfe3wf.js";import{dn as l,i as u,r as d,un as f}from"./Office-BBnd6tyn.js";import{c as p,l as m,o as h,t as g}from"./kit-C6ByUQ-Y.js";import{n as _}from"./billboardLayout-DSKGXPIM.js";var v=n(e(),1),y=t(),b=70,x=1.15,S=4.6,C=[9,33,62],w=2.6,T=9e4;function E({run:e,elevation:t}){let n=(0,v.useRef)(null),E=(0,v.useRef)(null),D=(0,v.useRef)(null),O=(0,v.useRef)([]),k=(0,v.useRef)([]),A=(0,v.useRef)(null),j=(0,v.useRef)(null),M=h(e.side),N=(0,v.useMemo)(()=>{let t=s(e.seed),n=t()<.5?1:-1,r=f().map((e,t)=>({...e,i:t})).filter(e=>M*e.x>_.max+10&&M*e.x<260&&Math.abs(e.z)<160),i=e=>Math.abs(M*e.x-175)+Math.abs(e.z)*.8;r.sort((e,t)=>i(e)-i(t));let a=r[0]??null,o=a?c():null,l=a&&o?o.cylinders[a.cylinder]:null;return{dir:n,x:a?a.x+M*19:M*190,z0:(a?a.z:(t()-.5)*60)-n*S*40,tower:a,tankR:l?l.w/2:1.5}},[e.seed,M]),P=(0,v.useMemo)(()=>({shake:0,lastStep:-1,roared:-1,knocked:-1,crashed:!1}),[]);(0,v.useEffect)(()=>{let e=N.tower;return()=>{e&&P.knocked>=0?setTimeout(()=>l(e.i,!1),T):e&&l(e.i,!1)}},[N,P]),o(({camera:o},s)=>{let c=e.t,f=n.current;if(!f)return;let m=N.z0+N.dir*S*c,h=c/x*Math.PI,_=0,v=-1;for(let e=0;e<C.length;e++)_=Math.max(_,p(c,C[e],C[e]+.4)*(1-p(c,C[e]+w-.5,C[e]+w))),c>=C[e]&&c<C[e]+.5&&(v=e);let y=1-_*.8;f.position.set(N.x,Math.abs(Math.sin(h))*.7*y,m),f.rotation.set(0,(N.dir>0?0:Math.PI)-M*N.dir*.35,Math.sin(h)*.04*y);for(let e=0;e<2;e++){let t=O.current[e];t&&(t.rotation.x=Math.sin(h+e*Math.PI)*.45*y);let n=k.current[e];n&&(n.rotation.x=-.6-_*1.2+Math.sin(h*2+e)*.15)}A.current&&(A.current.rotation.y=Math.sin(h*.5)*.35);let T=E.current;if(T){let e=N.tower&&P.knocked>=0?p(c,P.knocked+.6,P.knocked+1.4)*(1-p(c,P.knocked+4,P.knocked+5)):0;T.rotation.set(-_*.55+e*.15,-M*N.dir*.3+Math.sin(c*.4)*.25+e*-M*N.dir*.6,e*.25)}D.current&&(D.current.scale.y=.25+_*1.6);let F=Math.floor(c/x);if(F!==P.lastStep&&y>.5){P.lastStep=F;let e=d(N.x,-t,m,200);u(`stomp`,{gain:e.gain,pan:e.pan,pitch:.9+Math.random()*.2}),P.shake=1}if(v>=0&&P.roared!==v){P.roared=v;let e=d(N.x,b*.9-t,m,200);u(`roar`,{gain:e.gain,pan:e.pan})}P.shake*=Math.exp(-6*Math.min(.1,s)),P.shake>.01&&i().cameraShake&&!a()&&r(o.position.x)&&(o.rotation.x+=P.shake*.0035*Math.sin(c*41),o.rotation.z+=P.shake*.0025*Math.sin(c*33));let I=N.tower,L=j.current;if(I&&L&&(P.knocked<0&&N.dir*(m-I.z)>-7&&(P.knocked=c,l(I.i,!0)),L.visible=P.knocked>=0,P.knocked>=0)){let e=g((c-P.knocked)/1.3);if(L.rotation.z=M*Math.PI*.5*e*e-(e>=1?M*.06*Math.sin((c-P.knocked-1.3)*12)*Math.exp(-(c-P.knocked-1.3)*4):0),e>=1&&!P.crashed){P.crashed=!0;let e=d(I.x,I.y-t,I.z,180);u(`crash`,{gain:e.gain,pan:e.pan})}}});let F=m(`#6abf69`),I=m(`#f6e7a1`),L=m(`#ff9f1c`),R=m(`#1f1d2b`),z=m(`#ffffff`);return(0,y.jsxs)(`group`,{children:[(0,y.jsx)(`group`,{ref:n,children:(0,y.jsxs)(`group`,{scale:b,children:[(0,y.jsx)(`mesh`,{material:F,position:[0,.5,0],scale:[1,1.25,1.1],children:(0,y.jsx)(`sphereGeometry`,{args:[.28,20,14]})}),(0,y.jsx)(`mesh`,{material:I,position:[0,.47,.13],scale:[.85,1.15,.7],children:(0,y.jsx)(`sphereGeometry`,{args:[.22,16,12]})}),[0,1].map(e=>(0,y.jsxs)(`group`,{ref:t=>void(O.current[e]=t),position:[e?.13:-.13,.3,0],children:[(0,y.jsx)(`mesh`,{material:F,position:[0,-.14,0],children:(0,y.jsx)(`cylinderGeometry`,{args:[.085,.1,.3,10]})}),(0,y.jsx)(`mesh`,{material:F,position:[0,-.29,.04],scale:[1,.5,1.4],children:(0,y.jsx)(`sphereGeometry`,{args:[.1,10,8]})})]},e)),[0,1].map(e=>(0,y.jsx)(`group`,{ref:t=>void(k.current[e]=t),position:[e?.22:-.22,.64,.1],children:(0,y.jsx)(`mesh`,{material:F,position:[0,-.05,.06],"rotation-x":.6,children:(0,y.jsx)(`capsuleGeometry`,{args:[.035,.1,4,8]})})},e)),(0,y.jsx)(`group`,{ref:A,position:[0,.36,-.24],children:[0,1,2,3].map(e=>(0,y.jsx)(`mesh`,{material:F,position:[0,-e*.05,-.1-e*.12],scale:1-e*.2,children:(0,y.jsx)(`sphereGeometry`,{args:[.12,12,8]})},e))}),[0,1,2,3,4].map(e=>(0,y.jsx)(`mesh`,{material:L,position:[0,.84-e*.12,-.1-e*.06],"rotation-x":-.5-e*.12,scale:1-e*.12,children:(0,y.jsx)(`coneGeometry`,{args:[.05,.12,6]})},e)),(0,y.jsxs)(`group`,{ref:E,position:[0,.86,.1],children:[(0,y.jsx)(`mesh`,{material:F,children:(0,y.jsx)(`sphereGeometry`,{args:[.17,18,14]})}),(0,y.jsx)(`mesh`,{material:F,position:[0,-.04,.15],scale:[1,.72,1.15],children:(0,y.jsx)(`sphereGeometry`,{args:[.11,14,10]})}),[-1,1].map(e=>(0,y.jsxs)(`group`,{children:[(0,y.jsx)(`mesh`,{material:z,position:[e*.075,.06,.12],children:(0,y.jsx)(`sphereGeometry`,{args:[.055,12,10]})}),(0,y.jsx)(`mesh`,{material:R,position:[e*.075,.065,.168],children:(0,y.jsx)(`sphereGeometry`,{args:[.027,10,8]})}),(0,y.jsx)(`mesh`,{material:m(`#ff8fab`),position:[e*.11,-.03,.12],scale:[1,.6,.4],children:(0,y.jsx)(`sphereGeometry`,{args:[.03,8,6]})})]},e)),(0,y.jsx)(`mesh`,{ref:D,material:m(`#7a1f3d`),position:[0,-.08,.255],scale:[1,.25,.5],children:(0,y.jsx)(`sphereGeometry`,{args:[.06,12,8]})})]})]})}),N.tower&&(0,y.jsx)(`group`,{ref:j,position:[N.tower.x-M*N.tankR,N.tower.y,N.tower.z],visible:!1,children:(0,y.jsxs)(`group`,{position:[M*N.tankR,0,0],children:[(0,y.jsx)(`mesh`,{material:m(`#5e4a3c`),position:[0,.8,0],children:(0,y.jsx)(`boxGeometry`,{args:[2.6,1.6,2.6]})}),(0,y.jsx)(`mesh`,{material:m(`#a0704a`),position:[0,3.1,0],children:(0,y.jsx)(`cylinderGeometry`,{args:[1.5,1.5,3,12]})}),(0,y.jsx)(`mesh`,{material:m(`#6b4a33`),position:[0,5.3,0],children:(0,y.jsx)(`coneGeometry`,{args:[1.8,1.4,12]})})]})})]})}export{E as default};
@@ -0,0 +1 @@
1
+ import{s as e,t,u as n}from"./jsx-runtime-BFUkm7bt.js";import{Bt as r,f as i,gt as a}from"./bloomMarks-DariC6lY.js";import{a as o}from"./director-CrzFgnoP.js";import{i as s,r as c}from"./Office-BBnd6tyn.js";import{i as l,n as u,o as d,r as f}from"./kit-C6ByUQ-Y.js";var p=n(e(),1),m=t(),h=14,g=new r(0,1,0);function _({run:e,elevation:t}){let n=(0,p.useRef)(null),_=d(e.side),v=(0,p.useMemo)(()=>({meteors:Array.from({length:h},()=>({born:-10,life:0,x:0,y:0,z:0,dir:new r,speed:0,size:1})),next:1,rnd:o(e.seed),q:new a,back:new r}),[e.seed]);return i(()=>{let r=e.t,i=v.rnd;for(;r>=v.next&&r<e.seconds-3;){let n=v.meteors.find(e=>r-e.born>e.life),a=.9+2.2*Math.exp(-(((r/e.seconds-.55)/.12)**2));if(v.next+=-Math.log(1-i()*.98)/a*1.4,n&&(n.born=r,n.life=.7+i()*.8,n.x=_*(180+i()*140),n.y=u(t)+50+i()*120,n.z=(i()-.5)*420,n.dir.set(-_*i()*.3,-.35-i()*.35,i()<.5?1:-1).normalize(),n.speed=110+i()*80,n.size=.6+i()*.8,i()<.3)){let i=c(n.x,n.y-t,n.z,200);s(`whoosh`,{gain:i.gain*l(r,e.seconds,4),pan:i.pan})}}let a=n.current?.children;if(a)for(let e=0;e<h;e++){let t=v.meteors[e],n=a[e],i=r-t.born;if(n.visible=i>=0&&i<t.life,!n.visible)continue;let o=i/t.life,s=Math.min(i*t.speed,30+t.size*10)*(1-o*.5),c=t.x+t.dir.x*t.speed*i,l=t.y+t.dir.y*t.speed*i,u=t.z+t.dir.z*t.speed*i;n.position.set(c-t.dir.x*s/2,l-t.dir.y*s/2,u-t.dir.z*s/2),n.quaternion.copy(v.q.setFromUnitVectors(g,v.back.copy(t.dir).negate()));let d=t.size*(1-o*o);n.scale.set(d,Math.max(.01,s),d)}}),(0,m.jsx)(`group`,{ref:n,children:Array.from({length:h},(e,t)=>(0,m.jsx)(`mesh`,{material:f(`#dfe9ff`,{opacity:.85,add:!0}),visible:!1,frustumCulled:!1,children:(0,m.jsx)(`coneGeometry`,{args:[.9,1,6,1,!0]})},t))})}export{_ as default};
@@ -0,0 +1 @@
1
+ import{l as e,s as t,t as n,u as r}from"./jsx-runtime-BFUkm7bt.js";import{Xo as i,Yo as a,Zo as o,es as s,hs as c,p as l}from"./store-FA83kfnc.js";import{c as u,l as d,o as f,s as p}from"./index-B6qvKFYN.js";var m=r(t(),1),h=n();function g(){let e=l(e=>e.usage.observations),t=l(e=>e.agents),n=l(e=>e.settings.language),r=p(),i=e=>e===null?r(`Not available`):e.toLocaleString(n,{maximumFractionDigits:6});return(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:(0,h.jsx)(f,{children:`Observed AI usage`})}),(0,h.jsx)(`p`,{className:`muted small`,children:(0,h.jsx)(f,{children:`Latest 200 observations. Status rows are cumulative session counters, not additional consumption. Reported costs are not subscription charges or remaining quota.`})}),e?.length?[...e].reverse().map(e=>(0,h.jsxs)(`div`,{className:`card`,style:{overflowWrap:`anywhere`},children:[(0,h.jsxs)(`b`,{children:[e.agentId?t[e.agentId]?.name??e.agentId:`—`,` · `,e.tool]}),(0,h.jsxs)(`div`,{children:[e.provider??r(`Not available`),` / `,e.model??r(`Not available`)]}),(0,h.jsxs)(`div`,{className:`small`,children:[(0,h.jsx)(f,{children:`Input tokens`}),`: `,i(e.input),` · `,(0,h.jsx)(f,{children:`Output tokens`}),`: `,i(e.output)]}),(0,h.jsxs)(`div`,{className:`small`,children:[(0,h.jsx)(f,{children:`Reasoning tokens`}),`: `,i(e.reasoning),` · `,(0,h.jsx)(f,{children:`Cache read / write`}),`: `,i(e.cacheRead),` / `,i(e.cacheWrite)]}),(0,h.jsxs)(`div`,{className:`small`,children:[(0,h.jsx)(f,{children:`Reported cost (USD)`}),`: `,i(e.costUsd),` · `,(0,h.jsx)(f,{children:`Remaining quota`}),`: `,(0,h.jsx)(f,{children:`Not available`})]}),(0,h.jsxs)(`div`,{className:`muted small`,children:[new Date(e.at).toLocaleString(n),` · `,e.source]}),(0,h.jsxs)(`div`,{className:`muted small`,children:[(0,h.jsx)(f,{children:`Last observation`}),`: `,e.observedAt?new Date(e.observedAt).toLocaleString(n):r(`Not available`)]})]},JSON.stringify([e.tool,e.sessionId,e.id]))):(0,h.jsx)(`p`,{className:`muted small`,children:(0,h.jsx)(f,{children:`No usage observations received yet.`})})]})}function _({resume:e}){let t=l(e=>e.usage.resources);return(0,h.jsx)(`div`,{children:t?.map(t=>(0,h.jsx)(v,{resource:t,resume:e},t.key))})}function v({resource:e,resume:t}){let n=p(),r=l(e=>e.agents),i=l(e=>e.settings.language),o=l(e=>e.demo),[s,c]=(0,m.useState)(e.group??``),[g,_]=(0,m.useState)(!1),v={idle:`Idle`,preparing:`Setting up`,working:`Working`,done:`Finished`,error:`Needs help`,stopped:`Stopped`},y=e=>e===null?n(`Not available`):new Date(e).toLocaleString(i),b=async()=>{if(await d({icon:`🔗`,tone:`warn`,title:n(`Confirm shared quota`),body:(0,h.jsx)(`p`,{children:(0,h.jsx)(f,{children:`Use the same label only when these connections share a quota. This does not change provider, model or billing mode.`})}),confirm:n(`Confirm shared quota`)})){_(!0);try{await u.setUsageGroup(e.key,s)}catch{}finally{_(!1)}}};return(0,h.jsxs)(`section`,{className:`card`,style:{overflowWrap:`anywhere`,minWidth:0},"aria-label":`${e.tool} ${e.provider??``}`,children:[(0,h.jsxs)(`div`,{className:`row wrap`,children:[(0,h.jsxs)(`b`,{children:[e.tool,` · `,e.provider??n(`Provider not reported`)]}),(0,h.jsx)(`span`,{className:`pill`,children:n(e.state===`paused`?`Paused`:e.state===`pacing`?`Pacing`:`No active limit signal`)})]}),(0,h.jsxs)(`div`,{children:[e.model??n(`Model not reported`),` · `,n(e.access===`api`?`API`:e.access===`subscription`?`Subscription`:`Access mode not reported`)]}),e.group&&(0,h.jsxs)(`div`,{className:`small`,children:[(0,h.jsx)(f,{children:`Shared quota`}),`: `,e.group]}),(0,h.jsx)(`div`,{className:`muted small`,children:(0,h.jsx)(f,{children:e.observedAt===null?`Configured selection; awaiting session telemetry`:`Observed connection`})}),(0,h.jsxs)(`div`,{className:`small`,children:[(0,h.jsx)(f,{children:`Running sessions`}),`: `,e.running,` · `,(0,h.jsx)(f,{children:`Last observation`}),`: `,y(e.observedAt)]}),(0,h.jsxs)(`div`,{className:`small`,children:[(0,h.jsx)(f,{children:`Last quota signal`}),`: `,y(e.warning?.at??null),` · `,(0,h.jsx)(f,{children:`Reported reset`}),`: `,y(e.warning?.resetsAt??null)]}),e.until!==null&&(0,h.jsxs)(`div`,{className:`small`,children:[(0,h.jsx)(f,{children:`Next scheduling check`}),`: `,y(e.until)]}),e.warning?.pct==null?(0,h.jsxs)(`div`,{className:`muted small`,children:[(0,h.jsx)(f,{children:`Remaining quota`}),`: `,(0,h.jsx)(f,{children:`Not available`})]}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(f,{children:`Reported usage`}),`: `,e.warning.pct,`% `,(0,h.jsx)(`meter`,{min:0,max:100,value:e.warning.pct,"aria-label":n(`Reported usage`)})]}),(0,h.jsx)(`ul`,{children:e.agentIds.map(e=>{let t=r[e];return(0,h.jsxs)(`li`,{children:[t?.name??e,` · `,t?.role===`ceo`?`CEO`:t?.repoId||`—`,` · `,t?n(v[t.status]??t.status):`—`,t?.startedAt?` · ${a((t.endedAt??Date.now())-t.startedAt)}`:``]},e)})}),(0,h.jsxs)(`div`,{className:`row wrap`,children:[(0,h.jsx)(`button`,{className:`btn btn-small`,disabled:e.state!==`pacing`,onClick:()=>t(e.key),children:(0,h.jsx)(f,{children:`Resume this quota`})}),o&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`button`,{className:`btn btn-small`,onClick:()=>void u.simulateUsage(`warning`,e.agentIds[0]).catch(()=>void 0),children:(0,h.jsx)(f,{children:`Simulate a usage warning`})}),(0,h.jsx)(`button`,{className:`btn btn-small`,onClick:()=>void u.simulateUsage(`limit`,e.agentIds[0]).catch(()=>void 0),children:(0,h.jsx)(f,{children:`Simulate reaching the limit`})})]})]}),(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:(0,h.jsx)(f,{children:`Quota association`})}),(0,h.jsx)(`p`,{className:`muted small`,children:(0,h.jsx)(f,{children:`Without an identified account or confirmed association, limits stay isolated. OAuth alone does not identify a subscription.`})}),(0,h.jsxs)(`label`,{children:[(0,h.jsx)(f,{children:`Confirmed shared quota label`}),(0,h.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),maxLength:64,style:{width:`100%`,boxSizing:`border-box`}})]}),(0,h.jsx)(`button`,{className:`btn btn-small`,disabled:g||s===(e.group??``),onClick:()=>void b(),children:(0,h.jsx)(f,{children:`Save quota association`})})]})]})}function y(e,t,n){if(n!==`it`)return e.text;let r=e.kind===`pr`&&e.prNumber!==null?`PR #${e.prNumber} needs you`:e.kind===`agent`&&t?`${t} is stuck on an error`:null;return!r||!(e.text===r||e.text.startsWith(r+`: `))?e.text:(e.kind===`pr`?c(n,`PR #{number} needs you`,{number:e.prNumber}):c(n,`{name} is stuck on an error`,{name:t}))+e.text.slice(r.length)}function b(e,t,n,r){if(!e.startsWith(t)||!e.endsWith(n))return null;let i=/^(\d+) (minute|minutes|hours)$/.exec(e.slice(t.length,-n.length));return i?c(r,`{count} ${i[2]}`,{count:i[1]}):null}function x(e,t,n){if(n!==`it`)return e.text;let r=t??`Someone`,i={name:t??c(n,`Someone`),task:e.prNumber===null?`#${e.issueNumber}`:`PR #${e.prNumber}`,issue:e.issueNumber??`?`,pr:e.prNumber??`?`},a=(e,t={})=>c(n,e,{...i,...t});if(e.kind===`quiet`){let t=b(e.text,`${r} has been quiet for `,` on ${i.task}, even after a nudge. Stop them, or put the work back in line?`,n);if(t)return a(`{name} has been quiet for {duration} on {task}, even after a nudge. Stop them, or put the work back in line?`,{duration:t})}else if(e.kind===`preparing`){let t=b(e.text,`${r} has been setting up a desk for ${i.task} for `,`. Put the work back in line?`,n);if(t)return a(`{name} has been setting up a desk for {task} for {duration}. Put the work back in line?`,{duration:t})}else if(e.kind===`stale`){if(e.text===`${r}'s last task ${i.task} is already merged. Clear the desk?`)return a(`{name}’s last task {task} is already merged. Clear the desk?`);if(e.text===`${r}'s last task ${i.task} is already closed. Clear the desk?`)return a(`{name}’s last task {task} is already closed. Clear the desk?`)}else if(e.kind===`qa-orphan`){if(e.text===`PR #${e.prNumber} is marked as in QA, but nobody is testing it. Test it again?`)return a(`PR #{pr} is marked as in QA, but nobody is testing it. Test it again?`)}else if(e.kind===`fix-orphan`){if(e.text===`PR #${e.prNumber} is waiting for a fix, but ${e.agentId?`${r} is on something else`:`nobody is on it`}. Hand it to a free agent?`)return a(e.agentId?`PR #{pr} is waiting for a fix, but {name} is on something else. Hand it to a free agent?`:`PR #{pr} is waiting for a fix, but nobody is on it. Hand it to a free agent?`)}else if(e.kind===`unclosed`){let t=b(e.text,`Issue #${e.issueNumber} is still open, but PR #${e.prNumber}, which closes it, was merged `,` ago. Close it?`,n);if(t)return a(`Issue #{issue} is still open, but PR #{pr}, which closes it, was merged {duration} ago. Close it?`,{duration:t})}return e.text}var S=e({OpsTab:()=>P,UsageCard:()=>T,confirmResume:()=>w});async function C(e){try{return await e()}catch{return}}async function w(e){let{usage:t,settings:n}=l.getState(),r=(e,t)=>c(n.language,e,t),i=t.resources?.filter(e=>e.state===`pacing`)??[],a=e?i.find(t=>t.key===e):i.length===1?i[0]:void 0;if(!a){l.getState().openOverlay({kind:`manager`,tab:`ops`,card:`usage`});return}document.pointerLockElement&&document.exitPointerLock(),await d({icon:`⏩`,tone:`warn`,title:r(`Resume full speed?`),body:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[a.tool,` · `,a.provider??r(`Provider not reported`),` · `,a.group??a.model]}),(0,h.jsx)(`p`,{children:r(`Resume only this quota. Hard limits cannot be cleared early; other quotas are unchanged.`)})]}),confirm:r(`Resume full speed`)})&&await C(()=>u.resumeFullSpeed(a.key))}function T({hot:e}){let t=l(e=>e.settings.language),n=l(e=>e.usage),r=s(n,Date.now(),t);return(0,h.jsxs)(`div`,{id:`ops-card-usage`,className:`card usage-card usage-${r.tone} ${e?`ops-card-hot`:``}`,children:[(0,h.jsxs)(`div`,{className:`row wrap`,children:[(0,h.jsx)(`b`,{children:(0,h.jsx)(f,{children:`🤖 AI usage`})}),(0,h.jsx)(`span`,{className:`pill usage-pill-${r.tone}`,children:r.state})]}),(0,h.jsx)(`p`,{className:`muted small`,children:(0,h.jsx)(f,{children:`Limits apply only to the affected quota. Warnings pace new issues; hard limits also hold QA, fixes and CEO jobs. Running sessions continue. Missing data does not mean unlimited usage.`})}),(0,h.jsx)(_,{resume:e=>void w(e)}),(0,h.jsx)(g,{})]})}function E({alarm:e,repo:t,hot:n}){let r=p(),i=l(e=>e.settings.language),a=l(t=>e.agentId?t.agents[e.agentId]?.name:void 0),o=l(e=>e.openOverlay),s=l(e=>e.goToFloor),c=e.prNumber===null?void 0:t?.pulls.find(t=>t.number===e.prNumber);return(0,h.jsxs)(`div`,{id:`ops-card-${e.id}`,className:`card floor-card alarm-card ${n?`ops-card-hot`:``}`,style:{"--accent":t?.color??`#ef476f`},children:[(0,h.jsxs)(`div`,{className:`row`,children:[(0,h.jsx)(`span`,{className:`floor-badge`,children:e.floor}),(0,h.jsxs)(`div`,{className:`grow`,children:[(0,h.jsxs)(`b`,{children:[`🚨 `,y(e,a,i)]}),(0,h.jsxs)(`div`,{className:`muted small`,children:[t?.fullName??e.repoId,c?` · ${c.title}`:``,` · `,r(`since {time}`,{time:new Date(e.since).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]})]})]}),(0,h.jsxs)(`div`,{className:`row wrap`,children:[e.kind===`pr`&&e.prNumber!==null?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`button`,{className:`btn btn-small`,onClick:()=>o({kind:`kanban`,repoId:e.repoId}),children:(0,h.jsx)(f,{children:`📋 Open the Kanban`})}),(0,h.jsx)(`button`,{className:`btn btn-small btn-good`,onClick:()=>void C(()=>u.sendToQa(e.repoId,e.prNumber)),children:(0,h.jsx)(f,{children:`Retry QA`})}),(0,h.jsx)(`button`,{className:`btn btn-small`,title:r(`Hand it to its author, or any free agent, with QA’s findings`),onClick:()=>void C(()=>u.sendBack(e.repoId,e.prNumber)),children:(0,h.jsx)(f,{children:`Send back for a fix`})}),c&&(0,h.jsx)(`a`,{className:`small`,href:c.url,target:`_blank`,rel:`noreferrer`,children:(0,h.jsx)(f,{children:`PR on GitHub ↗`})})]}):e.agentId&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`button`,{className:`btn btn-small`,onClick:()=>o({kind:`terminal`,agentId:e.agentId}),children:(0,h.jsx)(f,{children:`Terminal`})}),(0,h.jsx)(`button`,{className:`btn btn-small btn-good`,title:r(`Clear their desk so they take new work`),onClick:()=>void C(()=>u.reset(e.agentId)),children:(0,h.jsx)(f,{children:`Clear desk`})})]}),(0,h.jsx)(`span`,{className:`spacer`}),(0,h.jsx)(`button`,{className:`btn btn-small btn-ghost`,onClick:()=>s(e.floor),children:r(`Visit floor {floor}`,{floor:e.floor})})]})]})}var D={clear:[`↺ Clear desk`,`Clear their desk so they take new work`],stop:[`■ Stop`,`Stop their session`],requeue:[`↩ Requeue`,`Stop them and put the work back in line, without a strike`],"retry-qa":[`Retry QA`,`Queue the PR for a fresh QA run`],"send-back":[`Send back for a fix`,`Hand the PR to its author, or any free agent`],"close-issue":[`Close issue`,`Close the issue on GitHub as completed`]};async function O(e,t){let n=(e,t)=>c(l.getState().settings.language,e,t);t===`close-issue`&&(document.pointerLockElement&&document.exitPointerLock(),!await d({icon:`🩺`,tone:`warn`,title:n(`Close issue #{number}?`,{number:e.issueNumber??`?`}),body:(0,h.jsx)(`p`,{children:n(`It’s closed on GitHub as completed, with a comment saying PR #{number} resolved it.`,{number:e.prNumber??`?`})}),confirm:n(`Close issue`)}))||await C(()=>u.doctorFix(e.id,t))}function k({finding:e,repo:t}){let n=p(),r=l(e=>e.settings.language),i=l(t=>e.agentId?t.agents[e.agentId]?.name:void 0),a=l(e=>e.openOverlay);return(0,h.jsxs)(`div`,{id:`ops-card-doctor-${e.id}`,className:`card floor-card alarm-card doctor-card`,style:{"--accent":t?.color??`#7c6cf0`},children:[(0,h.jsxs)(`div`,{className:`row`,children:[(0,h.jsx)(`span`,{className:`floor-badge`,children:t?.floor??`?`}),(0,h.jsxs)(`div`,{className:`grow`,children:[(0,h.jsxs)(`b`,{children:[`🩺 `,x(e,i,r)]}),(0,h.jsxs)(`div`,{className:`muted small`,children:[t?.fullName??e.repoId,` · `,n(`since {time}`,{time:new Date(e.since).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]})]})]}),(0,h.jsxs)(`div`,{className:`row wrap`,children:[e.fixes.map((t,r)=>(0,h.jsx)(`button`,{className:`btn btn-small ${r===0?`btn-good`:``}`,title:n(D[t][1]),onClick:()=>void O(e,t),children:n(D[t][0])},t)),e.agentId&&(0,h.jsx)(`button`,{className:`btn btn-small`,onClick:()=>a({kind:`terminal`,agentId:e.agentId}),children:(0,h.jsx)(f,{children:`Terminal`})}),(0,h.jsx)(`span`,{className:`spacer`}),(0,h.jsx)(`button`,{className:`btn btn-small btn-ghost`,title:n(`Hide it until it goes away`),onClick:()=>void C(()=>u.doctorIgnore(e.id)),children:(0,h.jsx)(f,{children:`Ignore`})})]})]})}async function A(e){let t=await C(()=>u.demoDoctor(e));t&&l.getState().pushToast(`info`,t.text)}function j({hot:e}){let t=p(),n=l(e=>e.doctor),r=l(e=>e.repos),i=l(e=>e.demo);return(0,h.jsxs)(`div`,{id:`ops-card-doctor`,className:e?`ops-card-hot`:``,children:[(0,h.jsxs)(`h3`,{className:`section`,children:[(0,h.jsx)(f,{children:`🩺 Office doctor`}),` `,n.length>0&&(0,h.jsx)(`span`,{className:`badge`,children:n.length})]}),n.length===0&&(0,h.jsx)(`p`,{className:`muted small`,children:(0,h.jsx)(f,{children:`Nothing stuck. Every minute the watchdog nudges quiet sessions, frees stuck desks and puts orphaned work back in line by itself; what it can’t safely fix shows up here.`})}),n.map(e=>(0,h.jsx)(k,{finding:e,repo:r.find(t=>t.id===e.repoId)},e.id)),i&&(0,h.jsxs)(`div`,{className:`row wrap`,children:[(0,h.jsx)(`span`,{className:`muted small`,children:`Demo:`}),(0,h.jsx)(`button`,{className:`btn btn-small btn-ghost`,title:t(`Restart with desks gone and work finished on GitHub meanwhile`),onClick:()=>void A(`restart`),children:(0,h.jsx)(f,{children:`Simulate a restart`})}),(0,h.jsx)(`button`,{className:`btn btn-small btn-ghost`,title:t(`Someone’s session goes quiet for 20 minutes`),onClick:()=>void A(`stuck`),children:(0,h.jsx)(f,{children:`Make a session stuck`})}),(0,h.jsx)(`button`,{className:`btn btn-small btn-ghost`,title:t(`Ten more minutes pass for the stuck sessions`),onClick:()=>void A(`later`),children:(0,h.jsx)(f,{children:`10 minutes later`})}),(0,h.jsx)(`button`,{className:`btn btn-small btn-ghost`,title:t(`A merged PR whose issue was never closed`),onClick:()=>void A(`unclosed`),children:(0,h.jsx)(f,{children:`Leave an issue open`})})]})]})}var M=[[`Ready to start`,e=>String(e.ready),`Backlog issues that can start now`],[`Building`,e=>String(e.building)],[`In QA`,e=>String(e.inQa)],[`Fixing`,e=>String(e.fixing),`Back with an agent: QA findings, checks or a conflict`],[`To merge`,e=>String(e.toMerge)],[`Needs you`,e=>`${e.needsYou}${e.triage?` (+${e.triage} 🧭)`:``}`,`🧭: the CEO is looking first`],[`Merged today`,(e,t)=>t(`{count} ({hour} last hour)`,{count:e.mergedToday,hour:e.mergedHour})],[`Lead time`,e=>a(e.leadMs),`Median issue → merge over the last 24 hours`],[`QA wait`,e=>a(e.qaWaitMs),`Median wait for a free agent over the last 24 hours`],[`CI`,e=>e.ciRuns?`${i(e.ciPass)} · ${a(e.ciMs)}`:`—`,`GitHub’s checks over 7 days: pass rate · median time`],[`Team`,(e,t)=>t(`{busy} busy · {idle} idle`,{busy:e.busy,idle:e.idle})+(e.errors?t(` · errors: {count}`,{count:e.errors}):``)],[`Cost today`,e=>`~${o(e.costToday)}`,`An estimate from finished sessions’ reported cost`]];function N(){let e=p(),t=l(e=>e.ops),n=l(e=>e.repos),r=[...t.floors.map(e=>{let t=n.find(t=>t.id===e.repoId);return[`${e.floor} · ${t?.fullName.split(`/`)[1]??e.repoId}`,t?.color??`#ccc`,e]}),[e(`All floors`),`#1f1d2b`,t.total]];return(0,h.jsxs)(`div`,{className:`ops-table-wrap`,children:[(0,h.jsxs)(`table`,{className:`ops-table`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`th`,{}),r.map(([e,t])=>(0,h.jsx)(`th`,{style:{"--accent":t},className:`ops-col`,children:e},e))]})}),(0,h.jsx)(`tbody`,{children:M.map(([t,n,i])=>(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`th`,{title:i?e(i):void 0,children:e(t)}),r.map(([t,,r])=>(0,h.jsx)(`td`,{children:n(r,e)},t))]},t))})]}),t.ceoCostToday>0&&(0,h.jsx)(`div`,{className:`muted small`,children:e(`The CEO’s sessions today: ~{cost} (in All floors’ cost).`,{cost:o(t.ceoCostToday)})})]})}function P({card:e}){let t=l(e=>e.ops.alarms),n=l(e=>e.repos);return(0,m.useEffect)(()=>{e&&document.getElementById(`ops-card-${e}`)?.scrollIntoView({block:`center`})},[e]),(0,h.jsxs)(`div`,{className:`tab-grid`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(T,{hot:e===`usage`}),(0,h.jsxs)(`h3`,{className:`section`,children:[(0,h.jsx)(f,{children:`🚨 Needs you`}),` `,t.length>0&&(0,h.jsx)(`span`,{className:`badge`,children:t.length})]}),t.length===0&&(0,h.jsx)(`p`,{className:`muted small`,children:(0,h.jsx)(f,{children:`All clear. The beacon on the lobby’s mission control wall spins when a PR needs you or an agent has been stuck on an error for 10 minutes.`})}),t.map(t=>(0,h.jsx)(E,{alarm:t,repo:n.find(e=>e.id===t.repoId),hot:t.id===e},t.id)),(0,h.jsx)(j,{hot:e===`doctor`})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h3`,{className:`section`,children:(0,h.jsx)(f,{children:`🛰️ The numbers`})}),(0,h.jsx)(N,{})]})]})}export{P as n,w as r,S as t};