@blkc-code/render-canvas 0.1.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/draw.d.ts +22 -12
- package/dist/draw.d.ts.map +1 -1
- package/dist/draw.js +374 -273
- package/dist/draw.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/links.d.ts +16 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +75 -0
- package/dist/links.js.map +1 -0
- package/dist/office.d.ts +25 -2
- package/dist/office.d.ts.map +1 -1
- package/dist/office.js +134 -20
- package/dist/office.js.map +1 -1
- package/dist/pack.d.ts +31 -0
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +10 -0
- package/dist/pack.js.map +1 -0
- package/dist/paint.d.ts +15 -0
- package/dist/paint.d.ts.map +1 -0
- package/dist/paint.js +18 -0
- package/dist/paint.js.map +1 -0
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.txt +1 -1
- package/dist/types.d.ts +20 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/world.d.ts +29 -13
- package/dist/world.d.ts.map +1 -1
- package/dist/world.js +150 -72
- package/dist/world.js.map +1 -1
- package/dist/worlds/office-data.d.ts +14 -0
- package/dist/worlds/office-data.d.ts.map +1 -0
- package/dist/worlds/office-data.js +52 -0
- package/dist/worlds/office-data.js.map +1 -0
- package/dist/worlds/office-paint.d.ts +13 -0
- package/dist/worlds/office-paint.d.ts.map +1 -0
- package/dist/worlds/office-paint.js +292 -0
- package/dist/worlds/office-paint.js.map +1 -0
- package/package.json +7 -2
- package/src/draw.ts +352 -272
- package/src/index.ts +4 -1
- package/src/links.ts +76 -0
- package/src/office.ts +142 -21
- package/src/pack.ts +36 -0
- package/src/paint.ts +24 -0
- package/src/runtime.ts +4 -1
- package/src/types.ts +31 -5
- package/src/world.ts +161 -77
- package/src/worlds/office-data.ts +57 -0
- package/src/worlds/office-paint.ts +276 -0
package/dist/pack.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What makes one world different from another. The engine handles walking, seats, time of day
|
|
3
|
+
* and agents, for any world. A world brings this data, plus a painter (see registerPainter).
|
|
4
|
+
*/
|
|
5
|
+
import type { OfficeLayout } from "./types.js";
|
|
6
|
+
export interface ItemSpec {
|
|
7
|
+
w: number;
|
|
8
|
+
h: number;
|
|
9
|
+
solid?: boolean;
|
|
10
|
+
wall?: boolean;
|
|
11
|
+
/** Where someone stands to use it, relative to its corner. */
|
|
12
|
+
spot?: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
/** seat: where an agent works. lounge: where it rests. board: where it reviews. */
|
|
17
|
+
use?: "seat" | "lounge" | "board";
|
|
18
|
+
}
|
|
19
|
+
export interface WorldData {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
words: {
|
|
23
|
+
/** The progress label over the map. */
|
|
24
|
+
quests: string;
|
|
25
|
+
};
|
|
26
|
+
items: Record<string, ItemSpec>;
|
|
27
|
+
layout: Required<Pick<OfficeLayout, "cols" | "rows" | "rooms" | "doors" | "furniture">>;
|
|
28
|
+
}
|
|
29
|
+
export declare function registerWorld(data: WorldData): void;
|
|
30
|
+
export declare const worldData: (id: string | undefined, fallback: WorldData) => WorldData;
|
|
31
|
+
//# sourceMappingURL=pack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../src/pack.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8DAA8D;IAC9D,IAAI,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,mFAAmF;IACnF,GAAG,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,uCAAuC;QACvC,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAChC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC;CACzF;AAID,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAEnD;AAED,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,GAAG,SAAS,EAAE,UAAU,SAAS,KAAG,SAA+C,CAAC"}
|
package/dist/pack.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What makes one world different from another. The engine handles walking, seats, time of day
|
|
3
|
+
* and agents, for any world. A world brings this data, plus a painter (see registerPainter).
|
|
4
|
+
*/
|
|
5
|
+
const worlds = new Map();
|
|
6
|
+
export function registerWorld(data) {
|
|
7
|
+
worlds.set(data.id, data);
|
|
8
|
+
}
|
|
9
|
+
export const worldData = (id, fallback) => (id && worlds.get(id)) || fallback;
|
|
10
|
+
//# sourceMappingURL=pack.js.map
|
package/dist/pack.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../src/pack.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0BH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;AAE5C,MAAM,UAAU,aAAa,CAAC,IAAe;IAC3C,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAsB,EAAE,QAAmB,EAAa,EAAE,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,QAAQ,CAAC"}
|
package/dist/paint.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The small tools every painter uses. */
|
|
2
|
+
export declare const TILE = 16;
|
|
3
|
+
export interface Palette {
|
|
4
|
+
primary: string;
|
|
5
|
+
background: string;
|
|
6
|
+
text: string;
|
|
7
|
+
accent: string;
|
|
8
|
+
}
|
|
9
|
+
export type Ctx = CanvasRenderingContext2D;
|
|
10
|
+
export declare const LABEL_FONT = "bold 7px ui-monospace, Menlo, Consolas, monospace";
|
|
11
|
+
export declare const BODY_FONT = "7px ui-monospace, Menlo, Consolas, monospace";
|
|
12
|
+
export declare const OUTLINE = "#14141f";
|
|
13
|
+
export declare const rect: (c: Ctx, color: string, x: number, y: number, w: number, h: number) => void;
|
|
14
|
+
export declare function shade(color: string, amount: number): string;
|
|
15
|
+
//# sourceMappingURL=paint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paint.d.ts","sourceRoot":"","sources":["../src/paint.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,eAAO,MAAM,IAAI,KAAK,CAAC;AAEvB,MAAM,WAAW,OAAO;IAAG,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAE9F,MAAM,MAAM,GAAG,GAAG,wBAAwB,CAAC;AAE3C,eAAO,MAAM,UAAU,sDAAsD,CAAC;AAC9E,eAAO,MAAM,SAAS,iDAAiD,CAAC;AACxE,eAAO,MAAM,OAAO,YAAY,CAAC;AAEjC,eAAO,MAAM,IAAI,GAAI,GAAG,GAAG,EAAE,OAAO,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,IAGxF,CAAC;AAEF,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAM3D"}
|
package/dist/paint.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The small tools every painter uses. */
|
|
2
|
+
export const TILE = 16;
|
|
3
|
+
export const LABEL_FONT = "bold 7px ui-monospace, Menlo, Consolas, monospace";
|
|
4
|
+
export const BODY_FONT = "7px ui-monospace, Menlo, Consolas, monospace";
|
|
5
|
+
export const OUTLINE = "#14141f";
|
|
6
|
+
export const rect = (c, color, x, y, w, h) => {
|
|
7
|
+
c.fillStyle = color;
|
|
8
|
+
c.fillRect(Math.round(x), Math.round(y), w, h);
|
|
9
|
+
};
|
|
10
|
+
export function shade(color, amount) {
|
|
11
|
+
if (!color.startsWith("#"))
|
|
12
|
+
return color;
|
|
13
|
+
const hex = color.length === 4 ? `#${color[1]}${color[1]}${color[2]}${color[2]}${color[3]}${color[3]}` : color;
|
|
14
|
+
const n = parseInt(hex.slice(1, 7), 16);
|
|
15
|
+
const channel = (shift) => Math.max(0, Math.min(255, ((n >> shift) & 255) + amount));
|
|
16
|
+
return `rgb(${channel(16)},${channel(8)},${channel(0)})`;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=paint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paint.js","sourceRoot":"","sources":["../src/paint.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;AAMvB,MAAM,CAAC,MAAM,UAAU,GAAG,mDAAmD,CAAC;AAC9E,MAAM,CAAC,MAAM,SAAS,GAAG,8CAA8C,CAAC;AACxE,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAM,EAAE,KAAa,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAQ,EAAE;IAC9F,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC;IACpB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,MAAc;IACjD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/G,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IACrG,OAAO,OAAO,OAAO,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAC3D,CAAC"}
|
package/dist/runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var E={desk:{w:3,h:2,spot:{x:1,y:2}},coffee:{w:2,h:1,spot:{x:0,y:1}},water:{w:1,h:1,spot:{x:0,y:1}},sofa:{w:3,h:1,spot:{x:1,y:1}},plant:{w:1,h:1},board:{w:4,h:1,spot:{x:1,y:1}},shelf:{w:2,h:1,spot:{x:0,y:1}},server:{w:1,h:1},table:{w:3,h:2,spot:{x:1,y:2}},rug:{w:4,h:3,solid:!1}},ct=["working","thinking","blocked","reviewing","idle","done","away"],ut=["todo","doing","done"],dt=["wood","carpet","tile"],C={cols:26,rows:17,rooms:[{id:"studio",name:"Studio",x:1,y:3,w:15,h:13,floor:"wood"},{id:"lounge",name:"Lounge",x:17,y:3,w:8,h:6,floor:"carpet"},{id:"quests",name:"Quests",x:17,y:10,w:8,h:6,floor:"tile"}],doors:[{x:16,y:6},{x:16,y:13},{x:23,y:9}],furniture:[{type:"desk",x:2,y:4},{type:"desk",x:7,y:4},{type:"desk",x:12,y:4},{type:"desk",x:2,y:10},{type:"desk",x:7,y:10},{type:"desk",x:12,y:10},{type:"plant",x:1,y:8},{type:"plant",x:15,y:8},{type:"server",x:15,y:15},{type:"server",x:14,y:15},{type:"shelf",x:1,y:15},{type:"coffee",x:19,y:3},{type:"water",x:21,y:3},{type:"sofa",x:22,y:3},{type:"rug",x:20,y:5},{type:"plant",x:24,y:8},{type:"board",x:19,y:10},{type:"table",x:19,y:13},{type:"plant",x:24,y:15}]},A=(t,e)=>typeof t=="number"&&Number.isFinite(t)?Math.floor(t):e,w=(t,e=120)=>typeof t=="string"?t.slice(0,e):"",S=(t,e)=>Array.isArray(t)?t.slice(0,e):[];function V(t){let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return e>>>0}var Y=["#2b1b12","#5a3a22","#a8622d","#d9b36c","#20242e","#7d2f3f","#4a5568","#e5e7eb"],Q=["#f4d3b5","#e8b98f","#c98d62","#9c6644","#6f4530","#4e2f20"],J=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316"],_=(t,e)=>typeof t=="string"&&/^#[0-9a-f]{3,8}$/i.test(t)?t:e,F=(t,e,n)=>n*t.cols+e;function R(t,e,n){return e>=0&&n>=0&&e<t.cols&&n<t.rows&&t.walkable[F(t,e,n)]===!0}function Z(t,e,n){if(!R(t,n.x,n.y))return null;if(e.x===n.x&&e.y===n.y)return[];let i=new Int32Array(t.cols*t.rows).fill(-1),r=F(t,e.x,e.y);i[r]=r;let s=[r];for(let o=0;o<s.length;o++){let a=s[o],u=a%t.cols,l=Math.floor(a/t.cols);if(u===n.x&&l===n.y){let h=[];for(let p=a;p!==r;p=i[p])h.unshift({x:p%t.cols,y:Math.floor(p/t.cols)});return h}for(let[h,p]of[[0,1],[0,-1],[1,0],[-1,0]]){let x=u+h,k=l+p;if(!R(t,x,k))continue;let M=F(t,x,k);i[M]===-1&&(i[M]=a,s.push(M))}}return null}function tt(t,e){let n=w(t?.id,60)||`agent-${e+1}`,i=V(n),r=ct.includes(t?.state)?t.state:"idle";return{id:n,name:w(t?.name,24)||n,role:w(t?.role,40),state:r,task:w(t?.task,120),hair:_(t?.hair,Y[i%Y.length]),skin:_(t?.skin,Q[(i>>>4)%Q.length]),shirt:_(t?.shirt,J[(i>>>8)%J.length]),x:0,y:0,path:[],facing:"down",walking:!1,rest:0,seed:i}}function et(t){return{title:w(t?.title,80),state:ut.includes(t?.state)?t.state:"todo",agent:w(t?.agent,60)}}function B(t={}){let e=Array.isArray(t?.rooms)&&t.rooms.length>0,n=Math.min(Math.max(A(t?.cols,e?20:C.cols),6),64),i=Math.min(Math.max(A(t?.rows,e?14:C.rows),6),40),r=e?S(t.rooms,40):C.rooms,s=e?S(t.doors,60):C.doors,o=Array.isArray(t?.furniture)?S(t.furniture,300):e?[]:C.furniture,a=r.map(c=>{let b=Math.min(Math.max(A(c?.x,0),0),n),y=Math.min(Math.max(A(c?.y,0),0),i);return{name:w(c?.name,24),x:b,y,w:Math.min(Math.max(A(c?.w,0),0),n-b),h:Math.min(Math.max(A(c?.h,0),0),i-y),floor:dt.includes(c?.floor)?c.floor:"wood"}}),u=new Array(n*i).fill(!1),l=(c,b,y)=>{c>=0&&b>=0&&c<n&&b<i&&(u[b*n+c]=y)};for(let c of a)for(let b=c.y;b<c.y+c.h;b++)for(let y=c.x;y<c.x+c.w;y++)l(y,b,!0);let h=s.map(c=>({x:A(c?.x,-1),y:A(c?.y,-1)})).filter(c=>c.x>=0&&c.y>=0);for(let c of h)l(c.x,c.y,!0);let p=o.filter(c=>c&&Object.hasOwn(E,c.type)).map(c=>({type:c.type,x:A(c.x,-99),y:A(c.y,-99)}));for(let c of p){let b=E[c.type];if(b.solid!==!1)for(let y=c.y;y<c.y+b.h;y++)for(let T=c.x;T<c.x+b.w;T++)l(T,y,!1)}let x={cols:n,rows:i,rooms:a,doors:h,furniture:p,walkable:u,agents:S(t?.agents,40).map(tt),tasks:S(t?.tasks,60).map(et),spots:{lounge:[],board:[]}},k=c=>{let b=E[c.type].spot;if(!b)return;let y={x:c.x+b.x,y:c.y+b.y};return R(x,y.x,y.y)?y:void 0},M=p.filter(c=>c.type==="desk").map(k).filter(c=>!!c);for(let c of p){let b=k(c);b&&((c.type==="coffee"||c.type==="sofa"||c.type==="water"||c.type==="shelf")&&x.spots.lounge.push(b),(c.type==="board"||c.type==="table")&&x.spots.board.push(b))}return x.agents.forEach((c,b)=>{c.seat=M[b],nt(x,c)}),x}function ht(t){for(let e=0;e<t.rows;e++)for(let n=0;n<t.cols;n++)if(R(t,n,e))return{x:n,y:e};return{x:0,y:0}}function I(t,e){let n=i=>i.length>0?i[(e.seed+Math.floor(e.rest*1e3))%i.length]:void 0;switch(e.state){case"working":case"thinking":case"blocked":return e.seat??n(t.spots.lounge);case"reviewing":return n(t.spots.board)??e.seat;case"idle":case"done":return n(t.spots.lounge)??e.seat;default:return}}function nt(t,e){let n=I(t,e)??e.seat??ht(t);e.x=n.x,e.y=n.y,e.path=[],e.walking=!1,e.facing=O(e)?"up":"down",e.rest=2+e.seed%50/10}var O=t=>(t.state==="working"||t.state==="thinking"||t.state==="blocked")&&t.seat!==void 0&&t.seat.x===t.x&&t.seat.y===t.y&&t.path.length===0;function ot(t,e,n){if(!n)return;let i={x:Math.round(e.x),y:Math.round(e.y)};e.path=Z(t,i,n)??[]}function D(t,e){for(let n of t.agents)if(n.state!=="away"){if(n.path.length>0){let i=n.path[0],r=i.x-n.x,s=i.y-n.y,o=Math.hypot(r,s),a=3.2*e;Math.abs(r)>Math.abs(s)?n.facing=r>0?"right":"left":s!==0&&(n.facing=s>0?"down":"up"),n.walking=!0,o<=a?(n.x=i.x,n.y=i.y,n.path.shift()):(n.x+=r/o*a,n.y+=s/o*a);continue}n.walking=!1,n.state==="idle"&&(n.rest-=e,n.rest<=0&&(n.seed=V(String(n.seed)),n.rest=3+n.seed%60/10,ot(t,n,I(t,n)))),O(n)&&(n.facing="up")}}function P(t,e){if(Array.isArray(e.tasks)&&(t.tasks=S(e.tasks,60).map(et)),!Array.isArray(e.agents))return;let n=new Map(t.agents.map(r=>[r.id,r])),i=t.furniture.filter(r=>r.type==="desk").map(r=>({x:r.x+1,y:r.y+2})).filter(r=>R(t,r.x,r.y));t.agents=S(e.agents,40).map((r,s)=>{let o=tt(r,s),a=n.get(o.id);return o.seat=i[s],a?(Object.assign(a,{name:o.name,role:o.role,task:o.task,hair:o.hair,skin:o.skin,shirt:o.shirt,seat:o.seat}),a.state!==o.state&&(a.state=o.state,o.state!=="away"&&ot(t,a,I(t,a))),a):(nt(t,o),o)})}function L(t,e,n){let i,r=1/0;for(let s of t.agents){if(s.state==="away")continue;let o=e-(s.x+.5),a=n-(s.y+.1),u=Math.hypot(o,a);Math.abs(o)<.8&&a>-1.6&&a<1.1&&u<r&&(i=s,r=u)}return i}var d=16,f=(t,e,n,i,r,s)=>{t.fillStyle=e,t.fillRect(Math.round(n),Math.round(i),r,s)},bt=["...hhhhhh...","..hhhhhhhh..","..hhhhhhhh..","..hssssssh..","..ssessess..","..ssssssss..","...ssssss..."],pt=["...hhhhhh...","..hhhhhhhh..","..hhhhhhhh..","..hhhhhhhh..","..hhhhhhhh..","..hhhhhhhh..","...ssssss..."],yt=["...hhhhhh...","..hhhhhhhh..","..hhhhhhhh..","..hhssssss..","..hhsssess..","..hsssssss..","...ssssss..."],mt=["..tttttttt..",".tttttttttt.",".stttttttts.",".stTTTTTTts."],xt=["...tttttt...","...tttttt...","...ttsttt...","...TTsTTT..."],gt=["..llllllll..","..lll..lll..","..lll..lll..","..bbb..bbb.."],kt=["..llllllll..","..lll..lll..","..bbb..lll..",".......bbb.."],Mt=["..llllllll..","..lll..lll..","..lll..bbb..","..bbb......."],At=["...llllll...","...lll.lll..","...lll.lll..","...bbb.bbb.."],St=["...llllll...","..lll..lll..",".lll....lll.",".bb......bb."],wt=["...llllll...","...llllll...","....llll....","....bbbb...."];function $(t,e,n,i,r,s=!1){e.forEach((o,a)=>{for(let u=0;u<o.length;u++){let l=o[s?o.length-1-u:u],h=r[l];h&&f(t,h,n+u,i+a,1,1)}})}function Tt(t,e){let n=parseInt(t.slice(1).padEnd(6,t.slice(-1)),16),i=r=>Math.max(0,Math.min(255,(n>>r&255)+e));return`rgb(${i(16)},${i(8)},${i(0)})`}function vt(t,e,n,i){let r=e.x*d+2,s=O(e),o={h:e.hair,s:e.skin,e:"#1a1a24",t:e.shirt,T:Tt(e.shirt,-36),l:"#39415a",b:"#1f2433"},a=Math.floor(n*8+e.seed)%2===0,u=!e.walking&&Math.floor(n*1.5+e.seed%7)%2===0?1:0,l=s?11:15,h=e.y*d+(s?6:-1)-(e.walking&&a?1:0);s&&(f(t,"#1f2937",r+1,e.y*d+3,10,9),f(t,"#374151",r+2,e.y*d+11,8,3),f(t,"#111827",r+5,e.y*d+14,2,2)),t.fillStyle="rgba(0,0,0,0.25)",t.fillRect(Math.round(r+2),Math.round(e.y*d+14),8,2),i&&(t.fillStyle="rgba(255,255,255,0.28)",t.fillRect(Math.round(r-1),Math.round(e.y*d+13),14,4));let p=e.facing==="left"||e.facing==="right",x=p?yt:e.facing==="up"?pt:bt,k=p?xt:mt,M=e.walking?p?a?St:wt:a?kt:Mt:p?At:gt,c=e.facing==="left";if($(t,x,r,h-l+u*0,o,c),$(t,k,r,h-l+x.length,o,c),!s)$(t,M,r,h-l+x.length+k.length,o,c);else if(e.state==="working"){let b=Math.floor(n*9+e.seed)%2;f(t,e.skin,r+1+b,h-l+x.length+3,1,1),f(t,e.skin,r+10-(1-b),h-l+x.length+3,1,1)}}function W(t,e,n,i){f(t,"#111827",e-1,n-1,13,11),f(t,"#ffffff",e,n,11,9),f(t,"#ffffff",e+4,n+9,3,1),f(t,"#111827",e+4,n+10,3,1),i(e,n)}function Et(t,e,n){let i=Math.round(e.x*d+2),r=Math.round(e.y*d-26+(O(e)?8:0)),s=Math.floor(n*2+e.seed%3)%2===0;if(e.state==="blocked")W(t,i,r,(o,a)=>{f(t,s?"#dc2626":"#991b1b",o+5,a+1,2,5),f(t,s?"#dc2626":"#991b1b",o+5,a+7,2,1)});else if(e.state==="thinking"){let o=Math.floor(n*3)%4;W(t,i,r,(a,u)=>{for(let l=0;l<3;l++)f(t,l<o?"#111827":"#d1d5db",a+2+l*3,u+4,2,2)})}else if(e.state==="reviewing"&&!e.walking)W(t,i,r,(o,a)=>{f(t,"#2563eb",o+4,a+1,4,1),f(t,"#2563eb",o+7,a+2,1,2),f(t,"#2563eb",o+5,a+4,2,1),f(t,"#2563eb",o+5,a+5,1,1),f(t,"#2563eb",o+5,a+7,1,1)});else if(e.state==="done"){let o=s?"#f59e0b":"#fbbf24";W(t,i,r,(a,u)=>{f(t,o,a+5,u+1,1,7),f(t,o,a+2,u+3,7,2),f(t,o,a+4,u+2,3,5)})}}function Ot(t,e,n){for(let i=e.y;i<e.y+e.h;i++)for(let r=e.x;r<e.x+e.w;r++){let s=r*d,o=i*d;if(e.floor==="carpet"){f(t,"#4c4f7a",s,o,d,d);for(let a=0;a<6;a++)f(t,"#55588a",s+(r*7+a*5)%15,o+(i*3+a*7)%15,1,1)}else if(e.floor==="tile")f(t,(r+i)%2===0?"#cfd8e3":"#bcc7d4",s,o,d,d),f(t,"#aab5c2",s,o+15,d,1),f(t,"#aab5c2",s+15,o,1,d);else{f(t,"#a06f45",s,o,d,d);let a=i%2===0?0:8;f(t,"#8f6039",s,o+7,d,1),f(t,"#8f6039",s,o+15,d,1),f(t,"#8f6039",s+(a+r*8)%16,o,1,7),f(t,"#ad7c52",s+3,o+3,4,1)}}}var it="#2f3350",Ct="#565c86",Rt="#454a70";function Lt(t,e,n){let i=new Set;for(let r of e.rooms)for(let s=r.y;s<r.y+r.h;s++)for(let o=r.x;o<r.x+r.w;o++)i.add(`${o},${s}`);for(let r of e.doors)i.add(`${r.x},${r.y}`);for(let r=0;r<e.rows;r++)for(let s=0;s<e.cols;s++){if(i.has(`${s},${r}`))continue;let o=s*d,a=r*d;i.has(`${s},${r+1}`)?(f(t,Ct,o,a,d,d),f(t,Rt,o,a+13,d,3),f(t,n.primary,o,a+12,d,1),s%4===3&&r<=3&&(f(t,"#1f2937",o+1,a+1,14,9),f(t,"#8ed0ff",o+2,a+2,12,7),f(t,"#bfe6ff",o+3,a+3,4,2),f(t,"#1f2937",o+8,a+2,1,7))):f(t,it,o,a,d,d)}for(let r of e.doors)f(t,"#6b4a2f",r.x*d,r.y*d,d,d),f(t,"#7c5637",r.x*d+2,r.y*d,12,d)}function Wt(t,e,n,i,r,s,o){if(f(t,"#6b4427",e+1,n+13,46,17),f(t,"#8a5a33",e+1,n+11,46,11),f(t,"#a06c3f",e+1,n+11,46,2),f(t,"#4a2e1a",e+3,n+22,3,9),f(t,"#4a2e1a",e+42,n+22,3,9),f(t,"#111827",e+15,n-1,18,13),f(t,"#374151",e+22,n+12,4,2),i){f(t,"#0f2a2e",e+16,n,16,11);let a=Math.floor(r*3+s%13);for(let u=0;u<4;u++){let l=3+((s>>u)+(a+u)*7)%11;f(t,u%2===0?o.primary:"#7dd3fc",e+17,n+1+u*2.5,l,1)}t.fillStyle="rgba(125,211,252,0.10)",t.fillRect(e+11,n+11,26,8)}else f(t,"#1f2937",e+16,n,16,11),f(t,"#374151",e+18,n+2,3,1);f(t,"#d1d5db",e+17,n+15,14,4),f(t,"#9ca3af",e+18,n+16,12,1),f(t,"#f3f4f6",e+38,n+14,4,4),f(t,o.primary,e+38,n+16,4,1)}function _t(t,e,n,i){f(t,"#2b2118",e,n-11,64,26),f(t,"#d9c29c",e+2,n-9,60,22);let r={todo:"#fde68a",doing:"#93c5fd",done:"#86efac"},s=8;i.tasks.slice(0,s*2).forEach((o,a)=>{let u=a%s,l=Math.floor(a/s);f(t,"#00000033",e+5+u*7,n-6+l*9,6,7),f(t,r[o.state],e+4+u*7,n-7+l*9,6,7),f(t,"#00000040",e+5+u*7,n-5+l*9,4,1)})}function st(t,e,n,i,r){let s=e.x*d,o=e.y*d;switch(e.type){case"desk":{let a=e.x+1,u=e.y+2,l=n.agents.find(h=>h.seat?.x===a&&h.seat?.y===u&&O(h)&&h.state!=="blocked");Wt(t,s,o,!!l,i,l?.seed??0,r);break}case"coffee":f(t,"#374151",s,o+2,32,14),f(t,"#6b7280",s,o+2,32,2),f(t,"#111827",s+4,o-8,14,14),f(t,"#ef4444",s+15,o-5,2,2),f(t,"#f3f4f6",s+8,o+3,5,4),f(t,"#f3f4f6",s+22,o-1,5,5);for(let a=0;a<3;a++)t.fillStyle="rgba(255,255,255,0.45)",t.fillRect(s+9+Math.round(Math.sin(i*2+a)*1.5),o-1-(i*8+a*4)%9,1,2);break;case"water":f(t,"#e5e7eb",s+3,o+3,10,13),f(t,"#7dd3fc",s+4,o-7,8,10),f(t,"#bae6fd",s+5,o-6,2,8),f(t,"#3b82f6",s+5,o+6,2,2);break;case"sofa":f(t,r.primary,s+1,o-6,46,9),f(t,"#00000030",s+1,o+1,46,2),f(t,"#4b5563",s,o+3,48,11),f(t,"#6b7280",s+3,o+3,20,7),f(t,"#6b7280",s+25,o+3,20,7),f(t,"#374151",s,o+12,48,3);break;case"plant":f(t,"#92400e",s+4,o+9,8,7),f(t,"#b45309",s+3,o+8,10,2);for(let[a,u,l,h]of[[6,-3,4,11],[2,0,5,6],[9,1,5,6],[4,-6,3,6],[9,-5,3,5]])f(t,"#15803d",s+a,o+u,l,h);f(t,"#22c55e",s+7,o-3,2,8),f(t,"#22c55e",s+3,o+1,2,3);break;case"board":_t(t,s,o,n);break;case"shelf":f(t,"#5b3a21",s,o-12,32,28);for(let a=0;a<2;a++){f(t,"#3b2413",s+2,o-10+a*13,28,11);for(let u=0;u<8;u++){let l=["#ef4444","#3b82f6","#10b981","#f59e0b","#8b5cf6"][(u*3+a)%5];f(t,l,s+3+u*3,o-8+a*13+u%3,2,9-u%3)}}break;case"server":f(t,"#111827",s+1,o-12,14,28);for(let a=0;a<5;a++){f(t,"#1f2937",s+2,o-11+a*5,12,4);let u=Math.floor(i*3+a*2+e.x)%3!==0;f(t,u?"#22c55e":"#14532d",s+3,o-10+a*5,1,1),f(t,a%2===0?"#f59e0b":"#3b82f6",s+5,o-10+a*5,1,1)}break;case"table":f(t,"#57534e",s+2,o+14,44,14),f(t,"#78716c",s+2,o+3,44,14),f(t,"#a8a29e",s+2,o+3,44,2),f(t,"#f9fafb",s+10,o+6,8,6),f(t,"#f9fafb",s+28,o+8,8,6);break;case"rug":f(t,r.primary,s,o,64,48),t.fillStyle="rgba(0,0,0,0.35)",t.fillRect(s+3,o+3,58,42),f(t,r.primary,s+6,o+6,52,1),f(t,r.primary,s+6,o+41,52,1);break}}function Ft(t,e){t.font="bold 7px ui-monospace, Menlo, Consolas, monospace",t.textBaseline="top";for(let n of e.rooms){if(!n.name)continue;let i=n.name.toUpperCase(),r=n.x*d+3,s=n.y*d-12;t.fillStyle="rgba(0,0,0,0.45)",t.fillText(i,r+1,s+1),t.fillStyle="rgba(255,255,255,0.85)",t.fillText(i,r,s)}}function Bt(t,e,n,i){let r=e.name;t.font="bold 7px ui-monospace, Menlo, Consolas, monospace",t.textBaseline="top";let s=Math.ceil(t.measureText(r).width)+5,o=e.x*d+8,a=Math.round(Math.max(1,Math.min(i-s-1,o-s/2))),u=Math.round(e.y*d+15);t.fillStyle=n?"#ffffff":"rgba(17,24,39,0.82)",t.fillRect(a,u,s,10),t.fillStyle=n?"#111827":"#ffffff",t.fillText(r,a+2.5,u+1.5)}function It(t,e,n){let i=[],r="";for(let s of e.split(/\s+/)){let o=r?`${r} ${s}`:s;t.measureText(o).width>n&&r?(i.push(r),r=s):r=o}return r&&i.push(r),i.slice(0,3)}var rt={working:"Working",thinking:"Thinking",blocked:"Blocked",reviewing:"Reviewing",idle:"On a break",done:"Finished",away:"Away"};function Dt(t,e,n){t.font="7px ui-monospace, Menlo, Consolas, monospace",t.textBaseline="top";let i=It(t,e.task||rt[e.state]||"",104),r=114,s=18+i.length*9+3,o=Math.round(Math.max(2,Math.min(n-r-2,e.x*d+8-r/2))),a=Math.round(Math.max(2,e.y*d-s-22));f(t,"#111827",o-1,a-1,r+2,s+2),f(t,"#ffffff",o,a,r,s),t.fillStyle="#111827",t.font="bold 7px ui-monospace, Menlo, Consolas, monospace",t.fillText(`${e.name}: ${rt[e.state]??""}`.slice(0,26),o+4,a+4),t.fillStyle="#374151",t.font="7px ui-monospace, Menlo, Consolas, monospace",i.forEach((u,l)=>t.fillText(u,o+4,a+15+l*9))}function Pt(t,e,n){if(e.tasks.length===0)return;let i=e.tasks.filter(o=>o.state==="done").length,r=`QUESTS ${i}/${e.tasks.length}`;t.font="bold 7px ui-monospace, Menlo, Consolas, monospace",t.textBaseline="top";let s=96;f(t,"rgba(17,24,39,0.85)",4,4,s,20),t.fillStyle="#ffffff",t.fillText(r,8,6.5),f(t,"#374151",8,16,s-8,4),f(t,n.primary,8,16,Math.round((s-8)*i/e.tasks.length),4)}function at(t,e,n,i,r){let s=e.cols*d;f(t,it,0,0,s,e.rows*d);for(let l of e.rooms)Ot(t,l,i);Lt(t,e,i);for(let l of e.furniture)l.type==="rug"&&st(t,l,e,n,i);let o=[];for(let l of e.furniture)l.type!=="rug"&&o.push({depth:(l.y+E[l.type].h)*d-2,draw:()=>st(t,l,e,n,i)});let a=e.agents.filter(l=>l.state!=="away");for(let l of a)o.push({depth:l.y*d+14,draw:()=>vt(t,l,n,l.id===r)});o.sort((l,h)=>l.depth-h.depth);for(let l of o)l.draw();Ft(t,e);for(let l of a)Bt(t,l,l.id===r,s);for(let l of a)l.id!==r&&Et(t,l,n);Pt(t,e,i);let u=a.find(l=>l.id===r);u&&Dt(t,u,s)}var $t=/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%/]+\)|hsla?\([\d\s.,%/a-z]+\))$/i;function Ht(t){let e=getComputedStyle(t),n=(i,r)=>{let s=e.getPropertyValue(i).trim();return $t.test(s)?s:r};return{primary:n("--blkc-color-primary","#3b82f6"),accent:n("--blkc-color-accent","#f59e0b"),background:n("--blkc-color-background","#1a1a2e"),text:n("--blkc-color-text","#ffffff")}}function H(t,e={},n={}){let i=B(e),r=t.getContext("2d");if(!r)throw new Error("This browser can't draw to a canvas.");let s=r,o=i.cols*d,a=i.rows*d,u=Ht(t),l=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,h,p=0,x=0,k=0,M=0,c=!0,b=!1,y=()=>{s.setTransform(p,0,0,p,0,0),s.imageSmoothingEnabled=!1,at(s,i,x,u,h)},T=()=>{let m=t.getBoundingClientRect().width||o,v=Math.max(1,Math.ceil(m*(typeof devicePixelRatio=="number"?devicePixelRatio:1)/o));v!==p&&(p=v,t.width=o*p,t.height=a*p,y())},U=m=>{if(b)return;if(M=requestAnimationFrame(U),!c){k=m;return}let g=Math.min((m-k)/1e3||0,.1);k=m,x+=g,D(i,g),y()},X=m=>{h=m===h?void 0:m,n.onSelect?.(h),l&&y()},G=m=>{let g=t.getBoundingClientRect();return{x:(m.clientX-g.left)/g.width*i.cols,y:(m.clientY-g.top)/g.height*i.rows}},K=m=>{let{x:g,y:v}=G(m);X(L(i,g,v)?.id)},j=m=>{let{x:g,y:v}=G(m);t.style.cursor=L(i,g,v)?"pointer":"default"};t.addEventListener("pointerdown",K),t.addEventListener("pointermove",j);let q=typeof ResizeObserver=="function"?new ResizeObserver(T):void 0;q?.observe(t);let z=typeof IntersectionObserver=="function"?new IntersectionObserver(m=>{c=m.some(g=>g.isIntersecting)}):void 0;return z?.observe(t),T(),p===0&&(p=1,y()),l||(M=requestAnimationFrame(U)),{world:i,update(m){P(i,m),l&&y()},select:X,destroy(){b=!0,cancelAnimationFrame(M),q?.disconnect(),z?.disconnect(),t.removeEventListener("pointerdown",K),t.removeEventListener("pointermove",j)}}}var lt=new Map;function Nt(t,e){lt.set(t,e)}function Ut(t,e,n){let i=[...n.querySelectorAll("button[data-blkc-agent]")],r=H(t,e,{onSelect(s){for(let o of i)o.setAttribute("aria-pressed",String(o.dataset.blkcAgent===s))}});for(let s of i)s.disabled=!1,s.addEventListener("click",()=>r.select(s.dataset.blkcAgent));return r}Nt("office",Ut);var ft=new WeakSet;function N(t=document){let e=[];for(let n of t.querySelectorAll("canvas[data-blkc-canvas]")){if(ft.has(n))continue;let i=lt.get(n.dataset.blkcCanvas??"");if(!i)continue;let r=n.closest("[data-blkc-canvas-root]")??n.parentElement??n,s=r.querySelector("script[data-blkc-canvas-data]"),o={};try{o=JSON.parse(s?.textContent||"{}")}catch{o={}}ft.add(n);let a=i(n,o,r);e.push({element:n,destroy:()=>a.destroy()})}return e}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>N()):N();})();
|
|
1
|
+
"use strict";(()=>{var q="bold 7px ui-monospace, Menlo, Consolas, monospace",ae="7px ui-monospace, Menlo, Consolas, monospace",E="#14141f",r=(e,t,s,f,a,n)=>{e.fillStyle=t,e.fillRect(Math.round(s),Math.round(f),a,n)};function $(e,t){if(!e.startsWith("#"))return e;let s=e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e,f=parseInt(s.slice(1,7),16),a=n=>Math.max(0,Math.min(255,(f>>n&255)+t));return`rgb(${a(16)},${a(8)},${a(0)})`}var Ee=new Map;function ie(e){Ee.set(e.id,e)}var We=(e,t)=>e&&Ee.get(e)||t;var fe={desk:{w:3,h:2,spot:{x:1,y:2},use:"seat"},coffee:{w:2,h:1,spot:{x:0,y:1},use:"lounge"},water:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},sofa:{w:3,h:1,spot:{x:1,y:1},use:"lounge"},plant:{w:1,h:1},fern:{w:1,h:1},board:{w:4,h:1,spot:{x:1,y:1},use:"board"},whiteboard:{w:3,h:1,spot:{x:1,y:1},use:"board"},shelf:{w:2,h:1,spot:{x:0,y:1},use:"lounge"},server:{w:1,h:1},table:{w:3,h:2,spot:{x:1,y:2},use:"board"},rug:{w:4,h:3,solid:!1},arcade:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},fridge:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},printer:{w:1,h:1,spot:{x:0,y:1}},lamp:{w:1,h:1},beanbag:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},tv:{w:3,h:1,spot:{x:1,y:2},use:"lounge"},vending:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},trophy:{w:1,h:1},clock:{w:1,h:1,solid:!1,wall:!0},poster:{w:1,h:1,solid:!1,wall:!0}},Re={cols:26,rows:17,rooms:[{id:"studio",name:"Studio",x:1,y:3,w:15,h:13,floor:"wood"},{id:"lounge",name:"Lounge",x:17,y:3,w:8,h:6,floor:"carpet"},{id:"quests",name:"Quests",x:17,y:10,w:8,h:6,floor:"tile"}],doors:[{x:16,y:6},{x:16,y:13},{x:23,y:9}],furniture:[{type:"desk",x:2,y:4},{type:"desk",x:7,y:4},{type:"desk",x:12,y:4},{type:"desk",x:2,y:10},{type:"desk",x:7,y:10},{type:"desk",x:12,y:10},{type:"plant",x:1,y:8},{type:"plant",x:15,y:8},{type:"server",x:15,y:15},{type:"server",x:14,y:15},{type:"shelf",x:1,y:15},{type:"coffee",x:19,y:3},{type:"water",x:21,y:3},{type:"sofa",x:22,y:3},{type:"rug",x:20,y:5},{type:"plant",x:24,y:8},{type:"board",x:19,y:10},{type:"table",x:19,y:13},{type:"plant",x:24,y:15}]},le={id:"office",name:"Pixel Office",words:{quests:"QUESTS"},items:fe,layout:Re};var Qe=64,Je=40,Fe=40,Ze=300,Be=60,et=4.5,ce=fe,tt=["working","thinking","blocked","reviewing","idle","done","away"],nt=["todo","doing","done"],ot=["wood","carpet","tile","stone","concrete","grass","hall"];var B=(e,t)=>typeof e=="number"&&Number.isFinite(e)?Math.floor(e):t,P=(e,t=120)=>typeof e=="string"?e.slice(0,t):"",U=(e,t)=>Array.isArray(e)?e.slice(0,t):[];function ze(e){let t=2166136261;for(let s=0;s<e.length;s++)t=Math.imul(t^e.charCodeAt(s),16777619);return t>>>0}var Ie=["#2b1b12","#5a3a22","#a8622d","#d9b36c","#20242e","#7d2f3f","#4a5568","#e5e7eb"],$e=["#f4d3b5","#e8b98f","#c98d62","#9c6644","#6f4530","#4e2f20"],De=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316"],ue=(e,t)=>typeof e=="string"&&/^#[0-9a-f]{3,8}$/i.test(e)?e:t,de=(e,t,s)=>s*e.cols+t;function X(e,t,s){return t>=0&&s>=0&&t<e.cols&&s<e.rows&&e.walkable[de(e,t,s)]===!0}function Y(e,t,s){if(!X(e,s.x,s.y))return null;if(t.x===s.x&&t.y===s.y)return[];let f=new Int32Array(e.cols*e.rows).fill(-1),a=de(e,t.x,t.y);f[a]=a;let n=[a];for(let o=0;o<n.length;o++){let i=n[o],l=i%e.cols,u=Math.floor(i/e.cols);if(l===s.x&&u===s.y){let b=[];for(let w=i;w!==a;w=f[w])b.unshift({x:w%e.cols,y:Math.floor(w/e.cols)});return b}for(let[b,w]of[[0,1],[0,-1],[1,0],[-1,0]]){let x=l+b,y=u+w;if(!X(e,x,y))continue;let O=de(e,x,y);f[O]===-1&&(f[O]=i,n.push(O))}}return null}function _e(e,t){let s=P(e?.id,60)||`agent-${t+1}`,f=ze(s),a=tt.includes(e?.state)?e.state:"idle";return{id:s,name:P(e?.name,24)||s,role:P(e?.role,40),state:a,task:P(e?.task,120),area:P(e?.area,60),party:0,hair:ue(e?.hair,Ie[f%Ie.length]),skin:ue(e?.skin,$e[(f>>>4)%$e.length]),shirt:ue(e?.shirt,De[(f>>>8)%De.length]),x:0,y:0,path:[],facing:"down",walking:!1,rest:0,seed:f}}function Ue(e){return{title:P(e?.title,80),state:nt.includes(e?.state)?e.state:"todo",agent:P(e?.agent,60)}}ie(le);var ee=(e,t)=>e.pack.items[t.type];function Ne(e,t){let s=Array.isArray(e?.rooms)&&e.rooms.length>0,f=Math.min(Math.max(B(e?.cols,s?20:t.layout.cols),6),Qe),a=Math.min(Math.max(B(e?.rows,s?14:t.layout.rows),6),Je),n=s?U(e.rooms,40):t.layout.rooms,o=s?U(e.doors,60):t.layout.doors,i=Array.isArray(e?.furniture)?U(e.furniture,Ze):s?[]:t.layout.furniture,l=n.map((c,h)=>{let M=Math.min(Math.max(B(c?.x,0),0),f),R=Math.min(Math.max(B(c?.y,0),0),a);return{id:P(c?.id,60)||`room-${h+1}`,name:P(c?.name,24),x:M,y:R,w:Math.min(Math.max(B(c?.w,0),0),f-M),h:Math.min(Math.max(B(c?.h,0),0),a-R),floor:ot.includes(c?.floor)?c.floor:"wood",paths:U(c?.paths,20).filter(T=>typeof T=="string").map(T=>T.slice(0,200))}}),u=new Array(f*a).fill(!1),b=(c,h,M)=>{c>=0&&h>=0&&c<f&&h<a&&(u[h*f+c]=M)};for(let c of l)for(let h=c.y;h<c.y+c.h;h++)for(let M=c.x;M<c.x+c.w;M++)b(M,h,!0);let w=o.map(c=>({x:B(c?.x,-1),y:B(c?.y,-1)})).filter(c=>c.x>=0&&c.y>=0);for(let c of w)b(c.x,c.y,!0);let x=i.filter(c=>c&&Object.hasOwn(t.items,c.type)).map(c=>({type:c.type,x:B(c.x,-99),y:B(c.y,-99)}));for(let c of x){let h=t.items[c.type];if(h.solid!==!1)for(let M=c.y;M<c.y+h.h;M++)for(let R=c.x;R<c.x+h.w;R++)b(R,M,!1)}let y=(c,h)=>c>=0&&h>=0&&c<f&&h<a&&u[h*f+c]===!0,O=c=>{let h=t.items[c.type].spot;if(!h)return;let M={x:c.x+h.x,y:c.y+h.y};return y(M.x,M.y)?M:void 0},W=x.filter(c=>t.items[c.type].use==="seat").map(O).filter(c=>!!c),A={lounge:[],board:[]};for(let c of x){let h=O(c);if(!h)continue;let M=t.items[c.type].use;M==="lounge"&&A.lounge.push(h),M==="board"&&A.board.push(h)}let m=U(e?.links,60).map(c=>({from:P(c?.from,60),to:P(c?.to,60)})).filter(c=>c.from&&c.to);return{cols:f,rows:a,rooms:l,doors:w,furniture:x,walkable:u,seats:W,spots:A,links:m}}function be(e={}){let t=We(e?.world,le),s={pack:t,showLinks:!0,...Ne(e,t),agents:U(e?.agents,Fe).map(_e),tasks:U(e?.tasks,Be).map(Ue)};for(let f of s.agents)pe(s,f);return s}function me(e,t){Object.assign(e,Ne(t,e.pack),{routes:void 0});for(let s of e.agents)s.seat=void 0,s.path=[],s.x=Math.round(s.x),s.y=Math.round(s.y),X(e,s.x,s.y)?(Z(e,s),K(e,s,te(e,s))):pe(e,s)}function st(e){for(let t=0;t<e.rows;t++)for(let s=0;s<e.cols;s++)if(X(e,s,t))return{x:s,y:t};return{x:0,y:0}}var He=["working","thinking","blocked"];function Z(e,t){if(!He.includes(t.state)){t.seat=void 0;return}let s=e.rooms.find(o=>o.id===t.area),f=o=>!!s&&o.x>=s.x&&o.x<s.x+s.w&&o.y>=s.y&&o.y<s.y+s.h;if(t.seat&&(!s||f(t.seat)))return;t.seat=void 0;let a=new Set(e.agents.filter(o=>o!==t&&o.seat).map(o=>`${o.seat?.x},${o.seat?.y}`)),n=e.seats.filter(o=>!a.has(`${o.x},${o.y}`));t.seat=s?n.find(f):n[0]}function rt(e){return e.path[e.path.length-1]??{x:Math.round(e.x),y:Math.round(e.y)}}function Pe(e,t,s){let f=new Set(e.agents.filter(a=>a!==t&&a.state!=="away").map(a=>{let n=rt(a);return`${n.x},${n.y}`}));for(let a=0;a<=4;a++)for(let n=-a;n<=a;n++)for(let o=-a;o<=a;o++){if(Math.abs(o)+Math.abs(n)!==a)continue;let i={x:s.x+o,y:s.y+n};if(X(e,i.x,i.y)&&!f.has(`${i.x},${i.y}`)&&Y(e,s,i))return i}return s}function te(e,t){let s=f=>{let a=f.length>0?f[(t.seed+Math.floor(t.rest*1e3))%f.length]:void 0;return a&&Pe(e,t,a)};switch(t.state){case"working":case"thinking":case"blocked":{if(t.seat)return t.seat;let f=e.rooms.find(a=>a.id===t.area);return f&&f.w>0&&f.h>0?Pe(e,t,{x:f.x+(f.w>>1),y:f.y+(f.h>>1)}):s(e.spots.lounge)}case"reviewing":return s(e.spots.board)??t.seat;case"idle":case"done":return s(e.spots.lounge)??t.seat;default:return}}function pe(e,t){Z(e,t);let s=te(e,t)??t.seat??st(e);t.x=s.x,t.y=s.y,t.path=[],t.walking=!1,t.facing=N(t)?"up":"down",t.rest=2+t.seed%50/10}var N=e=>(e.state==="working"||e.state==="thinking"||e.state==="blocked")&&e.seat!==void 0&&e.seat.x===e.x&&e.seat.y===e.y&&e.path.length===0;function K(e,t,s){if(!s)return;let f={x:Math.round(t.x),y:Math.round(t.y)};t.path=Y(e,f,s)??[]}function ye(e,t){for(let s of e.agents)if(s.state!=="away"){if(s.path.length>0){let f=s.path[0],a=f.x-s.x,n=f.y-s.y,o=Math.hypot(a,n),i=et*t;Math.abs(a)>Math.abs(n)?s.facing=a>0?"right":"left":n!==0&&(s.facing=n>0?"down":"up"),s.walking=!0,o<=i?(s.x=f.x,s.y=f.y,s.path.shift()):(s.x+=a/o*i,s.y+=n/o*i);continue}s.walking=!1,s.party>0&&(s.party=Math.max(0,s.party-t)),s.state==="idle"&&(s.rest-=t,s.rest<=0&&(s.seed=ze(String(s.seed)),s.rest=3+s.seed%60/10,K(e,s,te(e,s)))),N(s)&&(s.facing="up")}}function he(e,t){if(Array.isArray(t.tasks)&&(e.tasks=U(t.tasks,Be).map(Ue)),!Array.isArray(t.agents))return;let s=new Map(e.agents.map(n=>[n.id,n])),f=U(t.agents,Fe).map(_e);e.agents=f.map(n=>s.get(n.id)).filter(n=>!!n);let a=f.map(n=>{let o=s.get(n.id);if(!o){pe(e,n),e.agents=[...e.agents,n];let l=e.doors[0],u={x:n.x,y:n.y};return l&&n.state!=="away"&&(n.x=l.x,n.y=l.y,K(e,n,u)),n}Object.assign(o,{name:n.name,role:n.role,task:n.task,hair:n.hair,skin:n.skin,shirt:n.shirt});let i=o.area!==n.area;return o.area=n.area,o.state!==n.state||i?(n.state==="done"&&o.state!=="done"&&(o.party=3),o.state=n.state,Z(e,o),n.state!=="away"&&K(e,o,te(e,o))):He.includes(o.state)&&!o.seat&&(Z(e,o),o.seat&&K(e,o,o.seat)),o});e.agents=a}function ne(e,t,s){let f,a=1/0;for(let n of e.agents){if(n.state==="away")continue;let o=t-(n.x+.5),i=s-(n.y+.1),l=Math.hypot(o,i);Math.abs(o)<.8&&i>-1.6&&i<1.1&&l<a&&(f=n,a=l)}return f}var Xe=["#38bdf8","#f472b6","#fbbf24","#a78bfa","#34d399","#fb7185"];function Ye(e,t){let s=e.rooms.find(i=>i.id===t);if(!s)return;let f=s.x+(s.w>>1),a=s.y+(s.h>>1),n,o=1/0;for(let i=s.y;i<s.y+s.h;i++)for(let l=s.x;l<s.x+s.w;l++){let u=Math.abs(l-f)+Math.abs(i-a);u<o&&X(e,l,i)&&(n={x:l,y:i},o=u)}return n}function ge(e){let t=[];for(let s of e.links){let f=Ye(e,s.from),a=Ye(e,s.to);if(!f||!a)continue;let n=Y(e,f,a);n&&n.length>0&&t.push({from:s.from,to:s.to,points:[f,...n]})}return t}function xe(e,t,s){t.forEach((f,a)=>{let n=Xe[a%Xe.length],o=(a%5-2)*2,i=b=>[b.x*16+8+o,b.y*16+8+o];e.save(),e.lineWidth=2,e.strokeStyle=n,e.globalAlpha=.85,e.setLineDash([6,5]),e.lineDashOffset=-s*14,e.beginPath(),f.points.forEach((b,w)=>{let[x,y]=i(b);w===0?e.moveTo(x,y):e.lineTo(x,y)}),e.stroke(),e.setLineDash([]);let l=f.points[0],u=f.points[f.points.length-1];if(l&&u){let[b,w]=i(l),[x,y]=i(u);e.fillStyle=n,e.fillRect(b-2,w-2,4,4),e.beginPath(),e.arc(x,y,4,0,Math.PI*2),e.fill()}e.restore()})}function at(e,t,s,f,a,n,o,i){if(r(e,"#55351d",t+1,s+22,46,8),r(e,"#6b4427",t+1,s+13,46,10),r(e,"#8a5a33",t+1,s+10,46,12),r(e,"#a87545",t+1,s+10,46,2),r(e,"#3b2413",t+3,s+22,3,9),r(e,"#3b2413",t+42,s+22,3,9),r(e,"#55351d",t+30,s+23,12,7),r(e,"#7c5637",t+31,s+24,10,2),r(e,"#d4a24e",t+35,s+24,2,1),r(e,"#7c5637",t+31,s+27,10,2),r(e,"#d4a24e",t+35,s+27,2,1),r(e,E,t+14,s-3,20,15),r(e,"#374151",t+22,s+12,4,2),r(e,"#4b5563",t+19,s+14,10,1),i)r(e,"#3f0f14",t+15,s-2,18,13),Math.floor(a*2)%2===0&&(r(e,"#ef4444",t+23,s,2,6),r(e,"#ef4444",t+23,s+7,2,2));else if(f){r(e,"#0f2a2e",t+15,s-2,18,13);let l=Math.floor(a*3+n%13);for(let u=0;u<5;u++){let b=3+((n>>u&7)+(l+u)*7)%12;r(e,u%3===0?o.primary:u%3===1?"#7dd3fc":"#fcd34d",t+16+u%2*2,s-1+u*2.2,b,1)}e.fillStyle="rgba(125,211,252,0.12)",e.fillRect(t+10,s+11,28,8)}else r(e,"#1f2937",t+15,s-2,18,13),r(e,"#374151",t+17,s,3,1);r(e,"#d1d5db",t+16,s+15,16,5);for(let l=0;l<2;l++)for(let u=0;u<7;u++)r(e,"#9ca3af",t+17+u*2,s+16+l*2,1,1);r(e,"#e5e7eb",t+34,s+16,3,4),r(e,"#f3f4f6",t+40,s+13,5,5),r(e,o.primary,t+40,s+15,5,1),r(e,"#fde68a",t+4,s+13,7,6),r(e,"#fbbf24",t+5,s+15,5,1)}function it(e,t,s,f){r(e,"#3a2c1e",t,s-12,64,27),r(e,"#d9c29c",t+2,s-10,60,23);for(let o=0;o<40;o++)r(e,"#c9b08a",t+3+o*37%58,s-9+o*13%21,1,1);let a={todo:"#fde68a",doing:"#93c5fd",done:"#86efac"},n=8;f.tasks.slice(0,n*2).forEach((o,i)=>{let l=i%n,u=Math.floor(i/n);r(e,"#00000033",t+5+l*7,s-7+u*10,6,8),r(e,a[o.state],t+4+l*7,s-8+u*10,6,8),r(e,"#ef4444",t+6+l*7,s-8+u*10,2,1),r(e,"#00000040",t+5+l*7,s-5+u*10,4,1),r(e,"#00000040",t+5+l*7,s-3+u*10,3,1)})}function ft(e,t,s,f,a){let n=t.x*16,o=t.y*16;switch(t.type){case"desk":{let i=t.x+1,l=t.y+2,u=s.agents.find(b=>b.seat?.x===i&&b.seat?.y===l&&N(b));at(e,n,o,!!u,f,u?.seed??0,a,u?.state==="blocked");break}case"coffee":r(e,"#374151",n,o+2,32,14),r(e,"#6b7280",n,o+2,32,2),r(e,E,n+4,o-9,15,15),r(e,"#27272a",n+5,o-8,13,13),r(e,Math.floor(f*2)%2?"#ef4444":"#7f1d1d",n+15,o-6,2,2),r(e,"#52525b",n+7,o-6,6,4),r(e,"#f3f4f6",n+8,o+3,5,4),r(e,"#f3f4f6",n+23,o-1,5,5),r(e,"#92400e",n+24,o,3,1);for(let i=0;i<3;i++)e.fillStyle="rgba(255,255,255,0.5)",e.fillRect(n+9+Math.round(Math.sin(f*2+i)*1.5),o-1-(f*8+i*4)%9,1,2);break;case"water":r(e,"#d1d5db",n+3,o+3,10,13),r(e,"#9ca3af",n+3,o+14,10,2),r(e,"#60a5fa",n+4,o-8,8,11),r(e,"#bae6fd",n+5,o-7,2,9),r(e,"#3b82f6",n+5,o+6,2,2),r(e,"#ef4444",n+9,o+6,2,2),Math.floor(f*.4+t.x)%5===0&&r(e,"#e0f2fe",n+8,o-2-f*6%7,1,1);break;case"sofa":r(e,$(a.primary,-60),n+1,o-7,46,11),r(e,$(a.primary,-30),n+2,o-6,44,3),r(e,"#4b5563",n,o+3,48,11),r(e,"#6b7280",n+3,o+3,20,7),r(e,"#6b7280",n+25,o+3,20,7),r(e,"#374151",n,o+12,48,3),r(e,"#374151",n-1,o-2,4,16),r(e,"#374151",n+45,o-2,4,16);break;case"plant":r(e,"#92400e",n+4,o+9,8,7),r(e,"#b45309",n+3,o+8,10,2);for(let[i,l,u,b]of[[6,-3,4,11],[2,0,5,6],[9,1,5,6],[4,-6,3,6],[9,-5,3,5]])r(e,"#15803d",n+i,o+l,u,b);r(e,"#22c55e",n+7,o-3,2,8),r(e,"#22c55e",n+3,o+1,2,3),r(e,"#4ade80",n+10,o-4,1,3);break;case"fern":r(e,"#57534e",n+3,o+10,10,6),r(e,"#78716c",n+2,o+9,12,2);for(let i=0;i<7;i++){let l=i-3;for(let u=0;u<5;u++)r(e,u%2?"#16a34a":"#15803d",n+7+l*(u/2+1),o+8-u*2+Math.abs(l),2,2)}break;case"board":it(e,n,o,s);break;case"whiteboard":r(e,"#9ca3af",n,o-10,48,22),r(e,"#f9fafb",n+2,o-8,44,18),r(e,"#3b82f6",n+5,o-5,14,1),r(e,"#3b82f6",n+5,o-2,9,1),r(e,"#ef4444",n+24,o-6,8,6),r(e,"#f9fafb",n+25,o-5,6,4),r(e,"#10b981",n+8,o+3,20,1),r(e,"#10b981",n+27,o+2,1,3),r(e,"#6b7280",n+2,o+10,44,2);break;case"shelf":r(e,"#5b3a21",n,o-12,32,28);for(let i=0;i<2;i++){r(e,"#3b2413",n+2,o-10+i*13,28,11);for(let l=0;l<8;l++){let u=["#ef4444","#3b82f6","#10b981","#f59e0b","#8b5cf6"][(l*3+i+t.x)%5];r(e,u,n+3+l*3,o-8+i*13+l%3,2,9-l%3),r(e,$(u,40),n+3+l*3,o-6+i*13,2,1)}}break;case"server":r(e,E,n,o-13,16,29),r(e,"#1f2937",n+1,o-12,14,27);for(let i=0;i<5;i++){r(e,"#111827",n+2,o-11+i*5,12,4);let l=Math.floor(f*3+i*2+t.x)%3!==0;r(e,l?"#22c55e":"#14532d",n+3,o-10+i*5,1,1),r(e,i%2===0?"#f59e0b":"#3b82f6",n+5,o-10+i*5,1,1),r(e,"#374151",n+8,o-10+i*5,5,1)}break;case"table":r(e,"#44403c",n+2,o+16,44,12),r(e,"#78716c",n+2,o+3,44,14),r(e,"#a8a29e",n+2,o+3,44,2),r(e,"#f9fafb",n+10,o+6,8,6),r(e,"#f9fafb",n+28,o+8,8,6),r(e,"#1f2937",n+12,o+8,4,1),r(e,"#3b82f6",n+30,o+10,4,1);break;case"rug":r(e,a.primary,n,o,64,48),e.fillStyle="rgba(0,0,0,0.42)",e.fillRect(n+3,o+3,58,42),r(e,a.primary,n+6,o+6,52,1),r(e,a.primary,n+6,o+41,52,1),r(e,a.primary,n+6,o+6,1,36),r(e,a.primary,n+57,o+6,1,36);for(let i=0;i<6;i++)r(e,a.primary,n+12+i*8,o+22,4,4);break;case"arcade":r(e,E,n,o-14,16,30),r(e,"#4c1d95",n+1,o-13,14,28),r(e,"#111827",n+3,o-10,10,9),r(e,["#22c55e","#ec4899","#38bdf8"][Math.floor(f*2)%3],n+4+Math.floor(f*4)%7,o-8+Math.floor(f*3)%5,2,2),r(e,"#f59e0b",n+3,o-13,10,2),r(e,"#27272a",n+2,o+1,12,4),r(e,"#ef4444",n+4,o+2,2,2),r(e,"#3b82f6",n+9,o+2,2,2);break;case"fridge":r(e,E,n+1,o-12,14,28),r(e,"#e5e7eb",n+2,o-11,12,26),r(e,"#9ca3af",n+2,o-3,12,1),r(e,"#6b7280",n+11,o-8,1,3),r(e,"#6b7280",n+11,o,1,5),r(e,"#fde68a",n+4,o-9,3,3),r(e,"#fca5a5",n+5,o+3,3,3);break;case"printer":r(e,"#4b5563",n+2,o+8,12,8),r(e,E,n+1,o-2,14,11),r(e,"#d1d5db",n+2,o-1,12,9),r(e,"#f9fafb",n+4,o-5-(Math.floor(f)%4===0?1:0),8,5),r(e,"#22c55e",n+11,o+1,2,1),r(e,"#9ca3af",n+3,o+5,10,1);break;case"lamp":r(e,"#374151",n+5,o+13,6,3),r(e,"#4b5563",n+7,o-4,2,17),r(e,E,n+2,o-10,12,8),r(e,"#fde68a",n+3,o-9,10,6),r(e,"#fef3c7",n+4,o-8,4,2);break;case"beanbag":r(e,E,n,o+3,16,13),r(e,$(a.primary,-50),n+1,o+4,14,11),r(e,$(a.primary,-20),n+3,o+5,8,4),r(e,"#00000040",n+1,o+13,14,2);break;case"tv":r(e,"#3b2413",n+2,o+8,44,8),r(e,"#5b3a21",n+2,o+8,44,2),r(e,E,n+4,o-14,40,22),r(e,"#0b1120",n+5,o-13,38,20);for(let i=0;i<9;i++){let l=2+(i*5+Math.floor(f*3))%12;r(e,i%3===0?a.primary:i%3===1?"#38bdf8":"#f472b6",n+8+i*4,o+5-l,3,l)}break;case"vending":r(e,E,n,o-14,16,30),r(e,"#b91c1c",n+1,o-13,14,28),r(e,"#0f172a",n+3,o-11,8,16);for(let i=0;i<3;i++)for(let l=0;l<2;l++)r(e,["#fbbf24","#34d399","#60a5fa","#f472b6"][(i+l*2)%4],n+4+l*3,o-10+i*5,2,4);r(e,"#d1d5db",n+12,o-9,2,6),r(e,"#111827",n+3,o+8,10,4);break;case"trophy":r(e,"#6b4427",n+2,o+8,12,8),r(e,"#8a5a33",n+2,o+8,12,2),r(e,"#78350f",n+5,o+5,6,3),r(e,"#f59e0b",n+7,o+1,2,4),r(e,E,n+3,o-8,10,10),r(e,"#fbbf24",n+4,o-7,8,8),r(e,"#fde68a",n+5,o-6,2,5),r(e,"#fbbf24",n+1,o-6,3,1),r(e,"#fbbf24",n+12,o-6,3,1);break;case"clock":{r(e,E,n+3,o+1,10,10),r(e,"#f9fafb",n+4,o+2,8,8),r(e,"#1f2937",n+8,o+3,1,3),r(e,"#1f2937",n+8,o+6,3,1);break}case"poster":{let i=["#7c3aed","#0ea5e9","#db2777","#059669"],l=i[(t.x+t.y)%i.length];r(e,E,n+2,o,12,11),r(e,l,n+3,o+1,10,9),r(e,$(l,60),n+5,o+3,6,3),r(e,"#f9fafb",n+5,o+7,6,1);break}}}var ke={furniture:ft,glow(e,t,s){e.type==="lamp"&&s(e.x*16+8,e.y*16,36,"rgba(253,224,139,0.30)"),(e.type==="arcade"||e.type==="vending"||e.type==="tv")&&s(e.x*16+8,e.y*16,26,"rgba(125,211,252,0.16)"),e.type==="desk"&&t.agents.some(f=>f.seat?.x===e.x+1&&f.seat?.y===e.y+2&&N(f))&&s(e.x*16+24,e.y*16+8,30,"rgba(125,211,252,0.26)")}};var lt=new Map([["office",ke]]);var oe=e=>lt.get(e.pack.id)??ke;function Me(e){return e>=7&&e<17?{sky:"#8ed0ff",sun:"rgba(255,244,214,0.10)",night:0}:e>=17&&e<20?{sky:"#ffae70",sun:"rgba(255,170,110,0.13)",night:.14}:e>=5&&e<7?{sky:"#ffc9a3",sun:"rgba(255,200,170,0.08)",night:.16}:{sky:"#16204a",sun:"rgba(0,0,0,0)",night:.24}}function ut(e,t){e.fillStyle=E;for(let[,s,f,a,n]of t)e.fillRect(Math.round(s)-1,Math.round(f)-1,a+2,n+2);for(let[s,f,a,n,o]of t)r(e,s,f,a,n,o)}function dt(e,t,s,f){let a=t.x*16+2,n=t.y*16+15,o=N(t),i=t.walking,l=t.facing==="left"||t.facing==="right",u=t.facing==="up",b=t.facing==="left",w=Math.floor(s*9+t.seed%5),x=i?w%4:0,y=i&&x%2===1?-1:0,O=!i&&!o&&Math.floor(s*1.4+t.seed%7)%2===0?1:0,W=t.party>0?-Math.abs(Math.round(Math.sin(s*12)*3)):0,A=t.skin,m=t.hair,c=t.shirt,h=$(c,-40),M=$(c,24),R="#39415a",T="#1f2433",D=t.seed%5,H=(t.seed>>>5)%3;e.fillStyle="rgba(0,0,0,0.28)",e.fillRect(Math.round(a+1),Math.round(n-1),10,2),f&&(e.fillStyle="rgba(255,255,255,0.45)",e.fillRect(Math.round(a-2),Math.round(n-2),16,4)),t.state==="blocked"&&(e.fillStyle=Math.floor(s*3)%2===0?"rgba(239,68,68,0.55)":"rgba(239,68,68,0.22)",e.fillRect(Math.round(a-2),Math.round(n-2),16,4));let re=y+W,g=[],L=n-13+re+O*0,S=L-8+O;if(o&&(r(e,"#1f2937",a+1,t.y*16+3,10,9),r(e,"#374151",a+2,t.y*16+11,8,3),r(e,"#111827",a+5,t.y*16+14,2,2)),!o){let v=L+7;if(l){let k=x===1?2:x===3?-2:0;g.push([R,a+4+k,v,3,5],[T,a+4+k+(b?-1:0),v+5,4,1]),g.push([$(R,-12),a+5-k,v,3,5],[T,a+5-k+(b?-1:0),v+5,4,1])}else{let k=x===1?1:0,F=x===3?1:0;g.push([R,a+2,v,3,5-k],[T,a+2,v+5-k,3,1]),g.push([R,a+7,v,3,5-F],[T,a+7,v+5-F,3,1])}}let z=i?x===1?1:x===3?-1:0:0;if(l)g.push([c,a+3,L,6,7],[h,a+3,L+6,6,1]),g.push([h,a+5+z,L+1,2,5],[A,a+5+z,L+6,2,1]);else{g.push([c,a+1,L,10,7],[h,a+1,L+6,10,1]);let v=o&&t.state==="working",k=Math.floor(s*10+t.seed)%2;g.push([h,a-1,L+1+z+(v?-k:0),2,5]),g.push([h,a+11,L+1-z+(v?k-1:0),2,5]),g.push([A,a-1,L+6+z+(v?-k:0),2,1]),g.push([A,a+11,L+6-z+(v?k-1:0),2,1]),!u&&H===2&&g.push(["#f3f4f6",a+4,L,4,3],[t.seed%2?"#ef4444":"#1d4ed8",a+5,L,2,5]),!u&&H===1&&g.push([M,a+3,L,6,2],[h,a+5,L+2,2,4]),u&&H===1&&g.push([M,a+2,L,8,3])}if(g.push([A,a+1,S,10,8]),u)g.push([m,a+1,S,10,7]);else if(l){let v=b?a+7:a+1;g.push([m,a+1,S,10,3],[m,v,S,4,6]);let k=Math.floor(s*.7+t.seed%11)%7===0;g.push([k?$(A,-40):"#1a1a24",b?a+3:a+8,S+4,1,k?1:2])}else{g.push([m,a+1,S,10,3],[m,a+1,S+3,1,2],[m,a+10,S+3,1,2]);let v=Math.floor(s*.7+t.seed%11)%7===0;g.push([v?$(A,-40):"#1a1a24",a+3,S+4,2,v?1:2]),g.push([v?$(A,-40):"#1a1a24",a+7,S+4,2,v?1:2]),g.push([$(A,-28),a+5,S+6,2,1])}if(D===1&&g.push([m,a,S+2,2,8],[m,a+10,S+2,2,8]),D===2&&g.push([m,a+4,S-3,4,3]),D===3&&g.push([m,a+2,S-2,2,2],[m,a+5,S-3,2,3],[m,a+8,S-2,2,2]),D===4&&(g.push([M,a,S-1,12,3]),!u&&!l&&g.push([h,a+1,S+2,10,1]),l&&g.push([h,b?a-2:a+9,S+1,5,1])),ut(e,g),t.party>0){let v=["#f59e0b","#ec4899","#22c55e","#3b82f6","#a855f7"];for(let k=0;k<10;k++){let F=(s*1.1+k*.137)%1,J=k*2.4+t.seed;r(e,v[k%v.length],a+6+Math.cos(J)*(4+F*14),n-22-F*6+F*F*26,2,2)}}}function G(e,t,s,f){r(e,E,t-1,s-1,13,11),r(e,"#ffffff",t,s,11,9),r(e,"#ffffff",t+4,s+9,3,1),r(e,E,t+4,s+10,3,1),f(t,s)}function ct(e,t,s){let f=Math.round(t.x*16+2),a=Math.round(t.y*16-22+(N(t)?2:-2)),n=Math.floor(s*2+t.seed%3)%2===0;if(t.state==="blocked")G(e,f,a,(o,i)=>{r(e,n?"#dc2626":"#991b1b",o+5,i+1,2,5),r(e,n?"#dc2626":"#991b1b",o+5,i+7,2,1)});else if(t.state==="thinking"){let o=Math.floor(s*3)%4;G(e,f,a,(i,l)=>{for(let u=0;u<3;u++)r(e,u<o?"#111827":"#d1d5db",i+2+u*3,l+4,2,2)})}else if(t.state==="reviewing"&&!t.walking)G(e,f,a,(o,i)=>{r(e,"#2563eb",o+4,i+1,4,1),r(e,"#2563eb",o+7,i+2,1,2),r(e,"#2563eb",o+5,i+4,2,1),r(e,"#2563eb",o+5,i+5,1,1),r(e,"#2563eb",o+5,i+7,1,1)});else if(t.state==="done"){let o=n?"#f59e0b":"#fbbf24";G(e,f,a,(i,l)=>{r(e,o,i+5,l+1,1,7),r(e,o,i+2,l+3,7,2),r(e,o,i+4,l+2,3,5)})}else t.state==="idle"&&!t.walking&&t.seed%3===0&&G(e,f,a,(o,i)=>{r(e,"#92400e",o+3,i+3,4,4),r(e,"#d97706",o+3,i+3,4,1),r(e,"#92400e",o+7,i+4,1,2),n&&r(e,"#9ca3af",o+4,i+1,1,1)})}function bt(e,t){for(let s=t.y;s<t.y+t.h;s++)for(let f=t.x;f<t.x+t.w;f++){let a=f*16,n=s*16,o=(f*73+s*151)%17;switch(t.floor){case"carpet":r(e,"#4c4f7a",a,n,16,16);for(let i=0;i<8;i++)r(e,i%2?"#55588a":"#454874",a+(f*7+i*5)%15,n+(s*3+i*7)%15,1,1);break;case"tile":r(e,(f+s)%2===0?"#d6dee8":"#c2ccd8",a,n,16,16),r(e,"#aab5c2",a,n+15,16,1),r(e,"#aab5c2",a+15,n,1,16),r(e,"#e8eef5",a+1,n+1,5,1);break;case"stone":r(e,o%3===0?"#8d93a3":"#9aa0b0",a,n,16,16),r(e,"#7a8090",a,n+15,16,1),r(e,"#7a8090",a+(s%2?7:15),n,1,15),r(e,"#adb3c2",a+2,n+2,3,1);break;case"concrete":r(e,"#6b7280",a,n,16,16);for(let i=0;i<5;i++)r(e,i%2?"#747b89":"#636a78",a+(f*11+i*3)%15,n+(s*5+i*5)%15,1,1);o===3&&r(e,"#596070",a+3,n+8,8,1);break;case"hall":{r(e,"#cfc8b8",a,n,16,16),r(e,"#bdb6a6",a,n+15,16,1),r(e,"#bdb6a6",a+15,n,1,16);let i=t.w>=t.h,l=i?s-t.y:f-t.x,u=i?t.h:t.w;i&&l===0&&r(e,"#7f6a55",a,n+12,16,4),i&&l===u-1&&r(e,"#7f6a55",a,n,16,4),!i&&l===0&&r(e,"#7f6a55",a+12,n,4,16),!i&&l===u-1&&r(e,"#7f6a55",a,n,4,16);break}case"grass":r(e,"#3f8f4f",a,n,16,16);for(let i=0;i<7;i++)r(e,i%3?"#4aa35c":"#347a43",a+(f*5+i*9)%15,n+(s*7+i*3)%14,1,2);break;default:{let i=s%2===0?"#a57448":"#9c6c42";r(e,i,a,n,16,16),r(e,"#8a5d36",a,n+7,16,1),r(e,"#8a5d36",a,n+15,16,1),r(e,"#8a5d36",a+(f*8+(s%2?8:0))%16,n,1,7),r(e,"#8a5d36",a+(f*8+(s%2?0:8))%16,n+8,1,7),r(e,"#b4835a",a+o%9+2,n+3,4,1),r(e,"#b4835a",a+o%7+4,n+11,3,1)}}}}var qe="#2a2d48",mt="#5c628f",V="#4a4f78",pt="#6d74a4";function yt(e,t,s){let f=t*16,a=s*16;r(e,(t+s)%2===0?"#4b8a4f":"#478549",f,a,16,16);let n=(t*73+s*151)%29;for(let o=0;o<4;o++)r(e,"#5a9b5c",f+(t*5+o*7)%15,a+(s*3+o*5)%15,1,2);n===4?(r(e,"#2f6a38",f+3,a+7,10,7),r(e,"#3c7f45",f+5,a+8,5,3)):n===11&&(r(e,"#5b3a22",f+7,a+10,2,5),r(e,"#24592e",f+2,a+1,12,10),r(e,"#2f6f3a",f+4,a+2,7,5))}function ht(e,t,s,f){let a=new Set;for(let o of t.rooms)for(let i=o.y;i<o.y+o.h;i++)for(let l=o.x;l<o.x+o.w;l++)a.add(`${l},${i}`);let n=new Set(t.doors.map(o=>`${o.x},${o.y}`));for(let o=0;o<t.rows;o++)for(let i=0;i<t.cols;i++){let l=`${i},${o}`;if(a.has(l)||n.has(l))continue;let u=i*16,b=o*16,w=(x,y)=>{for(let O=y-1;O<=y+1;O++)for(let W=x-1;W<=x+1;W++)if(a.has(`${W},${O}`)||n.has(`${W},${O}`))return!0;return!1};if(!w(i,o)){yt(e,i,o);continue}a.has(`${i},${o+1}`)?(r(e,mt,u,b,16,16),r(e,pt,u,b,16,1),r(e,V,u,b+12,16,4),r(e,s.primary,u,b+11,16,1),i%4===3&&!w(i,o-1)&&!t.furniture.some(x=>ee(t,x).wall&&x.x===i&&x.y===o)&&(r(e,"#1f2937",u+1,b+1,14,9),r(e,f.sky,u+2,b+2,12,7),r(e,$(f.sky,40),u+3,b+3,4,2),r(e,"#1f2937",u+8,b+2,1,7),f.night>.3&&(r(e,"#fef3c7",u+4,b+3,1,1),r(e,"#fef3c7",u+11,b+5,1,1)))):(r(e,qe,u,b,16,16),a.has(`${i},${o-1}`)&&r(e,"#20233a",u,b,16,3),a.has(`${i-1},${o}`)&&r(e,"#20233a",u,b,2,16),a.has(`${i+1},${o}`)&&r(e,"#20233a",u+14,b,2,16))}for(let o of t.doors){let i=o.x*16,l=o.y*16,u=a.has(`${o.x},${o.y-1}`)||a.has(`${o.x},${o.y+1}`);r(e,"#7c5637",i,l,16,16);for(let b=2;b<16;b+=4)r(e,"#6b4a2f",u?i:i+b,u?l+b:l,u?16:1,u?1:16);u?(r(e,V,i,l,2,16),r(e,V,i+14,l,2,16)):(r(e,V,i,l,16,2),r(e,V,i,l+14,16,2))}}function gt(e,t){e.font=q,e.textBaseline="top";for(let s of t.rooms){if(!s.name)continue;let f=s.name.toUpperCase(),a=Math.ceil(e.measureText(f).width)+6,n=s.x*16+3,o=s.y*16-13;r(e,"#1c1f33",n,o,a,10),r(e,"#2f3350",n+1,o+1,a-2,8),e.fillStyle="#f8fafc",e.fillText(f,n+3,o+1.5)}}function ve(e,t,s,f){r(e,qe,0,0,t.cols*16,t.rows*16);for(let a of t.rooms)bt(e,a);ht(e,t,s,f);for(let a of t.furniture)a.type==="rug"&&oe(t).furniture(e,a,t,0,s);for(let a of t.furniture)ee(t,a).wall&&oe(t).furniture(e,a,t,0,s);if(f.sun!=="rgba(0,0,0,0)"){e.fillStyle=f.sun;for(let a of t.rooms)for(let n=a.x;n<a.x+a.w;n++)n%4===3&&e.fillRect(n*16+2,a.y*16,12,Math.min(a.h,3)*16)}}function xt(e,t,s,f){e.font=q,e.textBaseline="top";let a=Math.ceil(e.measureText(t.name).width)+5,n=Math.round(Math.max(1,Math.min(f-a-1,t.x*16+8-a/2))),o=Math.round(t.y*16+16);e.fillStyle=s?"#ffffff":"rgba(17,24,39,0.82)",e.fillRect(n,o,a,10),e.fillStyle=s?"#111827":"#ffffff",e.fillText(t.name,n+2.5,o+1.5)}function kt(e,t,s){let f=[],a="";for(let n of t.split(/\s+/)){let o=a?`${a} ${n}`:n;e.measureText(o).width>s&&a?(f.push(a),a=n):a=o}return a&&f.push(a),f.slice(0,3)}var je={working:"Working",thinking:"Thinking",blocked:"Blocked",reviewing:"Reviewing",idle:"On a break",done:"Finished",away:"Away"};function Mt(e,t,s){e.font=ae,e.textBaseline="top";let f=s.rooms.find(u=>u.id===t.area),a=kt(e,t.task||je[t.state]||"",110),n=120,o=18+a.length*9+(f?9:0)+3,i=Math.round(Math.max(2,Math.min(s.cols*16-n-2,t.x*16+8-n/2))),l=Math.round(Math.max(2,t.y*16-o-24));r(e,E,i-1,l-1,n+2,o+2),r(e,"#ffffff",i,l,n,o),e.fillStyle="#111827",e.font=q,e.fillText(`${t.name}: ${je[t.state]??""}`.slice(0,28),i+4,l+4),e.fillStyle="#374151",e.font=ae,a.forEach((u,b)=>e.fillText(u,i+4,l+15+b*9)),f&&(e.fillStyle="#6b7280",e.fillText(`In ${f.name}`.slice(0,28),i+4,l+15+a.length*9))}function vt(e,t,s){if(t.tasks.length===0)return;let f=t.tasks.filter(n=>n.state==="done").length;e.font=q,e.textBaseline="top";let a=96;r(e,"rgba(17,24,39,0.85)",4,4,a,20),e.fillStyle="#ffffff",e.fillText(`${t.pack.words.quests} ${f}/${t.tasks.length}`,8,6.5),r(e,"#374151",8,16,a-8,4),r(e,s.primary,8,16,Math.round((a-8)*f/t.tasks.length),4)}function Ke(e,t,s,f,a,n,o){let i=t.cols*16,l=t.rows*16;n?e.drawImage(n,0,0,i,l):ve(e,t,f,a),t.showLinks&&t.links.length>0&&(t.routes??(t.routes=ge(t)),xe(e,t.routes,s));let u=oe(t),b=[];for(let y of t.furniture){let O=ee(t,y);O.solid!==!1&&b.push({depth:(y.y+O.h)*16-2,draw:()=>oe(t).furniture(e,y,t,s,f)})}let w=t.agents.filter(y=>y.state!=="away");for(let y of w)b.push({depth:y.y*16+14,draw:()=>dt(e,y,s,y.id===o)});b.sort((y,O)=>y.depth-O.depth);for(let y of b)y.draw();if(a.night>0){e.fillStyle=`rgba(12,14,48,${a.night})`,e.fillRect(0,0,i,l),e.save(),e.globalCompositeOperation="lighter";let y=(O,W,A,m)=>{let c=e.createRadialGradient(O,W,1,O,W,A);c.addColorStop(0,m),c.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=c,e.fillRect(O-A,W-A,A*2,A*2)};for(let O of t.furniture)u.glow(O,t,y);e.restore()}gt(e,t);for(let y of w)xt(e,y,y.id===o,i);for(let y of w)y.id!==o&&ct(e,y,s);vt(e,t,f);let x=w.find(y=>y.id===o);x&&Mt(e,x,t)}var wt=/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%/]+\)|hsla?\([\d\s.,%/a-z]+\))$/i,we=4;function Ot(e){let t=getComputedStyle(e),s=(f,a)=>{let n=t.getPropertyValue(f).trim();return wt.test(n)?n:a};return{primary:s("--blkc-color-primary","#3b82f6"),accent:s("--blkc-color-accent","#f59e0b"),background:s("--blkc-color-background","#1a1a2e"),text:s("--blkc-color-text","#ffffff")}}function Q(e,t={},s={}){let f=be(t),a=e.getContext("2d");if(!a)throw new Error("This browser can't draw to a canvas.");let n=a,o=Ot(e),i=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,l,u=0,b=0,w=0,x=0,y=!0,O=!1,W=!0,A,m={x:0,y:0,zoom:1},c=new Date().getHours(),h=Me(c),M,R=!0,T=()=>f.cols*16,D=()=>f.rows*16,H=()=>{m.zoom=Math.min(we,Math.max(1,m.zoom)),m.x=Math.min(T()-T()/m.zoom,Math.max(0,m.x)),m.y=Math.min(D()-D()/m.zoom,Math.max(0,m.y))},re=()=>{if(typeof document>"u")return;M??(M=document.createElement("canvas")),M.width=T()*u,M.height=D()*u;let p=M.getContext("2d");p&&(p.setTransform(u,0,0,u,0,0),p.imageSmoothingEnabled=!1,ve(p,f,o,h),R=!1)},g=()=>{R&&re();let p=u*m.zoom;n.setTransform(p,0,0,p,-m.x*p,-m.y*p),n.imageSmoothingEnabled=!1,Ke(n,f,b,o,h,M,l),A?.(n)},L=()=>{let p=e.getBoundingClientRect().width||T(),I=Math.max(1,Math.ceil(p*(typeof devicePixelRatio=="number"?devicePixelRatio:1)/T()));I===u&&e.width===T()*u&&e.height===D()*u||(u=I,e.width=T()*u,e.height=D()*u,R=!0,g())},S=p=>{if(O)return;if(x=requestAnimationFrame(S),!y){w=p;return}let C=Math.min((p-w)/1e3||0,.1);w=p,b+=C,ye(f,C);let I=new Date().getHours();I!==c&&(c=I,h=Me(c),R=!0),g()},z=p=>{l=p===l?void 0:p,s.onSelect?.(l),i&&g()},v=p=>{let C=e.getBoundingClientRect(),I=(p.clientX-C.left)/C.width*(T()/m.zoom)+m.x,_=(p.clientY-C.top)/C.height*(D()/m.zoom)+m.y;return{x:I/16,y:_/16}},k,F=p=>{W&&(k={x:p.clientX,y:p.clientY,moved:!1})},J=p=>{if(!W)return;if(k&&s.camera&&m.zoom>1){let _=e.getBoundingClientRect(),j=p.clientX-k.x,Ce=p.clientY-k.y;if(k.moved||Math.abs(j)+Math.abs(Ce)>3){k.moved=!0,m.x-=j/_.width*(T()/m.zoom),m.y-=Ce/_.height*(D()/m.zoom),k.x=p.clientX,k.y=p.clientY,H(),e.style.cursor="grabbing";return}}let{x:C,y:I}=v(p);e.style.cursor=ne(f,C,I)?"pointer":s.camera&&m.zoom>1?"grab":"default"},Oe=p=>{if(!W)return;let C=k?.moved;if(k=void 0,C)return;let{x:I,y:_}=v(p),j=ne(f,I,_);(j||l)&&z(j?.id??l)},Se=(p,C)=>{if(p===void 0){m.zoom=1,m.x=0,m.y=0;return}let I=C?v(C):{x:m.x/16+T()/m.zoom/16/2,y:m.y/16+D()/m.zoom/16/2};if(m.zoom=Math.min(we,Math.max(1,m.zoom*p)),C){let _=v(C);m.x+=(I.x-_.x)*16,m.y+=(I.y-_.y)*16}else m.x=I.x*16-T()/m.zoom/2,m.y=I.y*16-D()/m.zoom/2;H()},Ae=p=>{p.preventDefault(),Se(p.deltaY<0?1.2:1/1.2,p)};e.addEventListener("pointerdown",F),e.addEventListener("pointermove",J),e.addEventListener("pointerup",Oe),s.camera&&e.addEventListener("wheel",Ae,{passive:!1});let Le=typeof ResizeObserver=="function"?new ResizeObserver(L):void 0;Le?.observe(e);let Te=typeof IntersectionObserver=="function"?new IntersectionObserver(p=>{y=p.some(C=>C.isIntersecting)}):void 0;return Te?.observe(e),L(),u===0&&(u=1,g()),i||(x=requestAnimationFrame(S)),{world:f,update(p){he(f,p),i&&g()},setLayout(p){me(f,p),R=!0,m.zoom=Math.min(m.zoom,we),H(),u=0,L()},select:z,tileAt:v,setOverlay(p){A=p},setLinksVisible(p){f.showLinks=p,i&&g()},setInteractive(p){W=p,k=void 0,p||(e.style.cursor="crosshair")},zoom:Se,destroy(){O=!0,cancelAnimationFrame(x),Le?.disconnect(),Te?.disconnect(),e.removeEventListener("pointerdown",F),e.removeEventListener("pointermove",J),e.removeEventListener("pointerup",Oe),e.removeEventListener("wheel",Ae)}}}var Ve=new Map;function St(e,t){Ve.set(e,t)}function At(e,t,s){let f=[...s.querySelectorAll("button[data-blkc-agent]")],a=Q(e,t,{onSelect(n){for(let o of f)o.setAttribute("aria-pressed",String(o.dataset.blkcAgent===n))}});for(let n of f)n.disabled=!1,n.addEventListener("click",()=>a.select(n.dataset.blkcAgent));return a}St("office",At);var Ge=new WeakSet;function se(e=document){let t=[];for(let s of e.querySelectorAll("canvas[data-blkc-canvas]")){if(Ge.has(s))continue;let f=Ve.get(s.dataset.blkcCanvas??"");if(!f)continue;let a=s.closest("[data-blkc-canvas-root]")??s.parentElement??s,n=a.querySelector("script[data-blkc-canvas-data]"),o={};try{o=JSON.parse(n?.textContent||"{}")}catch{o={}}Ge.add(s);let i=f(s,o,a);t.push({element:s,destroy:()=>i.destroy()})}return t}globalThis.BLKCCanvas={FURNITURE:ce,createOffice:Q,findPath:Y,mountCanvasBlocks:se};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>se()):se();})();
|
|
2
2
|
/**
|
|
3
3
|
* BLKC Render-Canvas.
|
|
4
4
|
*
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAElF,uEAAuE;AACtE,UAAiD,CAAC,UAAU,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;AAEzH,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;IACtC,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAC3E,CAAC;KAAM,CAAC;IACN,iBAAiB,EAAE,CAAC;AACtB,CAAC"}
|
package/dist/runtime.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var E={desk:{w:3,h:2,spot:{x:1,y:2}},coffee:{w:2,h:1,spot:{x:0,y:1}},water:{w:1,h:1,spot:{x:0,y:1}},sofa:{w:3,h:1,spot:{x:1,y:1}},plant:{w:1,h:1},board:{w:4,h:1,spot:{x:1,y:1}},shelf:{w:2,h:1,spot:{x:0,y:1}},server:{w:1,h:1},table:{w:3,h:2,spot:{x:1,y:2}},rug:{w:4,h:3,solid:!1}},ct=["working","thinking","blocked","reviewing","idle","done","away"],ut=["todo","doing","done"],dt=["wood","carpet","tile"],C={cols:26,rows:17,rooms:[{id:"studio",name:"Studio",x:1,y:3,w:15,h:13,floor:"wood"},{id:"lounge",name:"Lounge",x:17,y:3,w:8,h:6,floor:"carpet"},{id:"quests",name:"Quests",x:17,y:10,w:8,h:6,floor:"tile"}],doors:[{x:16,y:6},{x:16,y:13},{x:23,y:9}],furniture:[{type:"desk",x:2,y:4},{type:"desk",x:7,y:4},{type:"desk",x:12,y:4},{type:"desk",x:2,y:10},{type:"desk",x:7,y:10},{type:"desk",x:12,y:10},{type:"plant",x:1,y:8},{type:"plant",x:15,y:8},{type:"server",x:15,y:15},{type:"server",x:14,y:15},{type:"shelf",x:1,y:15},{type:"coffee",x:19,y:3},{type:"water",x:21,y:3},{type:"sofa",x:22,y:3},{type:"rug",x:20,y:5},{type:"plant",x:24,y:8},{type:"board",x:19,y:10},{type:"table",x:19,y:13},{type:"plant",x:24,y:15}]},A=(t,e)=>typeof t=="number"&&Number.isFinite(t)?Math.floor(t):e,w=(t,e=120)=>typeof t=="string"?t.slice(0,e):"",S=(t,e)=>Array.isArray(t)?t.slice(0,e):[];function V(t){let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return e>>>0}var Y=["#2b1b12","#5a3a22","#a8622d","#d9b36c","#20242e","#7d2f3f","#4a5568","#e5e7eb"],Q=["#f4d3b5","#e8b98f","#c98d62","#9c6644","#6f4530","#4e2f20"],J=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316"],_=(t,e)=>typeof t=="string"&&/^#[0-9a-f]{3,8}$/i.test(t)?t:e,F=(t,e,n)=>n*t.cols+e;function R(t,e,n){return e>=0&&n>=0&&e<t.cols&&n<t.rows&&t.walkable[F(t,e,n)]===!0}function Z(t,e,n){if(!R(t,n.x,n.y))return null;if(e.x===n.x&&e.y===n.y)return[];let i=new Int32Array(t.cols*t.rows).fill(-1),r=F(t,e.x,e.y);i[r]=r;let s=[r];for(let o=0;o<s.length;o++){let a=s[o],u=a%t.cols,l=Math.floor(a/t.cols);if(u===n.x&&l===n.y){let h=[];for(let p=a;p!==r;p=i[p])h.unshift({x:p%t.cols,y:Math.floor(p/t.cols)});return h}for(let[h,p]of[[0,1],[0,-1],[1,0],[-1,0]]){let x=u+h,k=l+p;if(!R(t,x,k))continue;let M=F(t,x,k);i[M]===-1&&(i[M]=a,s.push(M))}}return null}function tt(t,e){let n=w(t?.id,60)||`agent-${e+1}`,i=V(n),r=ct.includes(t?.state)?t.state:"idle";return{id:n,name:w(t?.name,24)||n,role:w(t?.role,40),state:r,task:w(t?.task,120),hair:_(t?.hair,Y[i%Y.length]),skin:_(t?.skin,Q[(i>>>4)%Q.length]),shirt:_(t?.shirt,J[(i>>>8)%J.length]),x:0,y:0,path:[],facing:"down",walking:!1,rest:0,seed:i}}function et(t){return{title:w(t?.title,80),state:ut.includes(t?.state)?t.state:"todo",agent:w(t?.agent,60)}}function B(t={}){let e=Array.isArray(t?.rooms)&&t.rooms.length>0,n=Math.min(Math.max(A(t?.cols,e?20:C.cols),6),64),i=Math.min(Math.max(A(t?.rows,e?14:C.rows),6),40),r=e?S(t.rooms,40):C.rooms,s=e?S(t.doors,60):C.doors,o=Array.isArray(t?.furniture)?S(t.furniture,300):e?[]:C.furniture,a=r.map(c=>{let b=Math.min(Math.max(A(c?.x,0),0),n),y=Math.min(Math.max(A(c?.y,0),0),i);return{name:w(c?.name,24),x:b,y,w:Math.min(Math.max(A(c?.w,0),0),n-b),h:Math.min(Math.max(A(c?.h,0),0),i-y),floor:dt.includes(c?.floor)?c.floor:"wood"}}),u=new Array(n*i).fill(!1),l=(c,b,y)=>{c>=0&&b>=0&&c<n&&b<i&&(u[b*n+c]=y)};for(let c of a)for(let b=c.y;b<c.y+c.h;b++)for(let y=c.x;y<c.x+c.w;y++)l(y,b,!0);let h=s.map(c=>({x:A(c?.x,-1),y:A(c?.y,-1)})).filter(c=>c.x>=0&&c.y>=0);for(let c of h)l(c.x,c.y,!0);let p=o.filter(c=>c&&Object.hasOwn(E,c.type)).map(c=>({type:c.type,x:A(c.x,-99),y:A(c.y,-99)}));for(let c of p){let b=E[c.type];if(b.solid!==!1)for(let y=c.y;y<c.y+b.h;y++)for(let T=c.x;T<c.x+b.w;T++)l(T,y,!1)}let x={cols:n,rows:i,rooms:a,doors:h,furniture:p,walkable:u,agents:S(t?.agents,40).map(tt),tasks:S(t?.tasks,60).map(et),spots:{lounge:[],board:[]}},k=c=>{let b=E[c.type].spot;if(!b)return;let y={x:c.x+b.x,y:c.y+b.y};return R(x,y.x,y.y)?y:void 0},M=p.filter(c=>c.type==="desk").map(k).filter(c=>!!c);for(let c of p){let b=k(c);b&&((c.type==="coffee"||c.type==="sofa"||c.type==="water"||c.type==="shelf")&&x.spots.lounge.push(b),(c.type==="board"||c.type==="table")&&x.spots.board.push(b))}return x.agents.forEach((c,b)=>{c.seat=M[b],nt(x,c)}),x}function ht(t){for(let e=0;e<t.rows;e++)for(let n=0;n<t.cols;n++)if(R(t,n,e))return{x:n,y:e};return{x:0,y:0}}function I(t,e){let n=i=>i.length>0?i[(e.seed+Math.floor(e.rest*1e3))%i.length]:void 0;switch(e.state){case"working":case"thinking":case"blocked":return e.seat??n(t.spots.lounge);case"reviewing":return n(t.spots.board)??e.seat;case"idle":case"done":return n(t.spots.lounge)??e.seat;default:return}}function nt(t,e){let n=I(t,e)??e.seat??ht(t);e.x=n.x,e.y=n.y,e.path=[],e.walking=!1,e.facing=O(e)?"up":"down",e.rest=2+e.seed%50/10}var O=t=>(t.state==="working"||t.state==="thinking"||t.state==="blocked")&&t.seat!==void 0&&t.seat.x===t.x&&t.seat.y===t.y&&t.path.length===0;function ot(t,e,n){if(!n)return;let i={x:Math.round(e.x),y:Math.round(e.y)};e.path=Z(t,i,n)??[]}function D(t,e){for(let n of t.agents)if(n.state!=="away"){if(n.path.length>0){let i=n.path[0],r=i.x-n.x,s=i.y-n.y,o=Math.hypot(r,s),a=3.2*e;Math.abs(r)>Math.abs(s)?n.facing=r>0?"right":"left":s!==0&&(n.facing=s>0?"down":"up"),n.walking=!0,o<=a?(n.x=i.x,n.y=i.y,n.path.shift()):(n.x+=r/o*a,n.y+=s/o*a);continue}n.walking=!1,n.state==="idle"&&(n.rest-=e,n.rest<=0&&(n.seed=V(String(n.seed)),n.rest=3+n.seed%60/10,ot(t,n,I(t,n)))),O(n)&&(n.facing="up")}}function P(t,e){if(Array.isArray(e.tasks)&&(t.tasks=S(e.tasks,60).map(et)),!Array.isArray(e.agents))return;let n=new Map(t.agents.map(r=>[r.id,r])),i=t.furniture.filter(r=>r.type==="desk").map(r=>({x:r.x+1,y:r.y+2})).filter(r=>R(t,r.x,r.y));t.agents=S(e.agents,40).map((r,s)=>{let o=tt(r,s),a=n.get(o.id);return o.seat=i[s],a?(Object.assign(a,{name:o.name,role:o.role,task:o.task,hair:o.hair,skin:o.skin,shirt:o.shirt,seat:o.seat}),a.state!==o.state&&(a.state=o.state,o.state!=="away"&&ot(t,a,I(t,a))),a):(nt(t,o),o)})}function L(t,e,n){let i,r=1/0;for(let s of t.agents){if(s.state==="away")continue;let o=e-(s.x+.5),a=n-(s.y+.1),u=Math.hypot(o,a);Math.abs(o)<.8&&a>-1.6&&a<1.1&&u<r&&(i=s,r=u)}return i}var d=16,f=(t,e,n,i,r,s)=>{t.fillStyle=e,t.fillRect(Math.round(n),Math.round(i),r,s)},bt=["...hhhhhh...","..hhhhhhhh..","..hhhhhhhh..","..hssssssh..","..ssessess..","..ssssssss..","...ssssss..."],pt=["...hhhhhh...","..hhhhhhhh..","..hhhhhhhh..","..hhhhhhhh..","..hhhhhhhh..","..hhhhhhhh..","...ssssss..."],yt=["...hhhhhh...","..hhhhhhhh..","..hhhhhhhh..","..hhssssss..","..hhsssess..","..hsssssss..","...ssssss..."],mt=["..tttttttt..",".tttttttttt.",".stttttttts.",".stTTTTTTts."],xt=["...tttttt...","...tttttt...","...ttsttt...","...TTsTTT..."],gt=["..llllllll..","..lll..lll..","..lll..lll..","..bbb..bbb.."],kt=["..llllllll..","..lll..lll..","..bbb..lll..",".......bbb.."],Mt=["..llllllll..","..lll..lll..","..lll..bbb..","..bbb......."],At=["...llllll...","...lll.lll..","...lll.lll..","...bbb.bbb.."],St=["...llllll...","..lll..lll..",".lll....lll.",".bb......bb."],wt=["...llllll...","...llllll...","....llll....","....bbbb...."];function $(t,e,n,i,r,s=!1){e.forEach((o,a)=>{for(let u=0;u<o.length;u++){let l=o[s?o.length-1-u:u],h=r[l];h&&f(t,h,n+u,i+a,1,1)}})}function Tt(t,e){let n=parseInt(t.slice(1).padEnd(6,t.slice(-1)),16),i=r=>Math.max(0,Math.min(255,(n>>r&255)+e));return`rgb(${i(16)},${i(8)},${i(0)})`}function vt(t,e,n,i){let r=e.x*d+2,s=O(e),o={h:e.hair,s:e.skin,e:"#1a1a24",t:e.shirt,T:Tt(e.shirt,-36),l:"#39415a",b:"#1f2433"},a=Math.floor(n*8+e.seed)%2===0,u=!e.walking&&Math.floor(n*1.5+e.seed%7)%2===0?1:0,l=s?11:15,h=e.y*d+(s?6:-1)-(e.walking&&a?1:0);s&&(f(t,"#1f2937",r+1,e.y*d+3,10,9),f(t,"#374151",r+2,e.y*d+11,8,3),f(t,"#111827",r+5,e.y*d+14,2,2)),t.fillStyle="rgba(0,0,0,0.25)",t.fillRect(Math.round(r+2),Math.round(e.y*d+14),8,2),i&&(t.fillStyle="rgba(255,255,255,0.28)",t.fillRect(Math.round(r-1),Math.round(e.y*d+13),14,4));let p=e.facing==="left"||e.facing==="right",x=p?yt:e.facing==="up"?pt:bt,k=p?xt:mt,M=e.walking?p?a?St:wt:a?kt:Mt:p?At:gt,c=e.facing==="left";if($(t,x,r,h-l+u*0,o,c),$(t,k,r,h-l+x.length,o,c),!s)$(t,M,r,h-l+x.length+k.length,o,c);else if(e.state==="working"){let b=Math.floor(n*9+e.seed)%2;f(t,e.skin,r+1+b,h-l+x.length+3,1,1),f(t,e.skin,r+10-(1-b),h-l+x.length+3,1,1)}}function W(t,e,n,i){f(t,"#111827",e-1,n-1,13,11),f(t,"#ffffff",e,n,11,9),f(t,"#ffffff",e+4,n+9,3,1),f(t,"#111827",e+4,n+10,3,1),i(e,n)}function Et(t,e,n){let i=Math.round(e.x*d+2),r=Math.round(e.y*d-26+(O(e)?8:0)),s=Math.floor(n*2+e.seed%3)%2===0;if(e.state==="blocked")W(t,i,r,(o,a)=>{f(t,s?"#dc2626":"#991b1b",o+5,a+1,2,5),f(t,s?"#dc2626":"#991b1b",o+5,a+7,2,1)});else if(e.state==="thinking"){let o=Math.floor(n*3)%4;W(t,i,r,(a,u)=>{for(let l=0;l<3;l++)f(t,l<o?"#111827":"#d1d5db",a+2+l*3,u+4,2,2)})}else if(e.state==="reviewing"&&!e.walking)W(t,i,r,(o,a)=>{f(t,"#2563eb",o+4,a+1,4,1),f(t,"#2563eb",o+7,a+2,1,2),f(t,"#2563eb",o+5,a+4,2,1),f(t,"#2563eb",o+5,a+5,1,1),f(t,"#2563eb",o+5,a+7,1,1)});else if(e.state==="done"){let o=s?"#f59e0b":"#fbbf24";W(t,i,r,(a,u)=>{f(t,o,a+5,u+1,1,7),f(t,o,a+2,u+3,7,2),f(t,o,a+4,u+2,3,5)})}}function Ot(t,e,n){for(let i=e.y;i<e.y+e.h;i++)for(let r=e.x;r<e.x+e.w;r++){let s=r*d,o=i*d;if(e.floor==="carpet"){f(t,"#4c4f7a",s,o,d,d);for(let a=0;a<6;a++)f(t,"#55588a",s+(r*7+a*5)%15,o+(i*3+a*7)%15,1,1)}else if(e.floor==="tile")f(t,(r+i)%2===0?"#cfd8e3":"#bcc7d4",s,o,d,d),f(t,"#aab5c2",s,o+15,d,1),f(t,"#aab5c2",s+15,o,1,d);else{f(t,"#a06f45",s,o,d,d);let a=i%2===0?0:8;f(t,"#8f6039",s,o+7,d,1),f(t,"#8f6039",s,o+15,d,1),f(t,"#8f6039",s+(a+r*8)%16,o,1,7),f(t,"#ad7c52",s+3,o+3,4,1)}}}var it="#2f3350",Ct="#565c86",Rt="#454a70";function Lt(t,e,n){let i=new Set;for(let r of e.rooms)for(let s=r.y;s<r.y+r.h;s++)for(let o=r.x;o<r.x+r.w;o++)i.add(`${o},${s}`);for(let r of e.doors)i.add(`${r.x},${r.y}`);for(let r=0;r<e.rows;r++)for(let s=0;s<e.cols;s++){if(i.has(`${s},${r}`))continue;let o=s*d,a=r*d;i.has(`${s},${r+1}`)?(f(t,Ct,o,a,d,d),f(t,Rt,o,a+13,d,3),f(t,n.primary,o,a+12,d,1),s%4===3&&r<=3&&(f(t,"#1f2937",o+1,a+1,14,9),f(t,"#8ed0ff",o+2,a+2,12,7),f(t,"#bfe6ff",o+3,a+3,4,2),f(t,"#1f2937",o+8,a+2,1,7))):f(t,it,o,a,d,d)}for(let r of e.doors)f(t,"#6b4a2f",r.x*d,r.y*d,d,d),f(t,"#7c5637",r.x*d+2,r.y*d,12,d)}function Wt(t,e,n,i,r,s,o){if(f(t,"#6b4427",e+1,n+13,46,17),f(t,"#8a5a33",e+1,n+11,46,11),f(t,"#a06c3f",e+1,n+11,46,2),f(t,"#4a2e1a",e+3,n+22,3,9),f(t,"#4a2e1a",e+42,n+22,3,9),f(t,"#111827",e+15,n-1,18,13),f(t,"#374151",e+22,n+12,4,2),i){f(t,"#0f2a2e",e+16,n,16,11);let a=Math.floor(r*3+s%13);for(let u=0;u<4;u++){let l=3+((s>>u)+(a+u)*7)%11;f(t,u%2===0?o.primary:"#7dd3fc",e+17,n+1+u*2.5,l,1)}t.fillStyle="rgba(125,211,252,0.10)",t.fillRect(e+11,n+11,26,8)}else f(t,"#1f2937",e+16,n,16,11),f(t,"#374151",e+18,n+2,3,1);f(t,"#d1d5db",e+17,n+15,14,4),f(t,"#9ca3af",e+18,n+16,12,1),f(t,"#f3f4f6",e+38,n+14,4,4),f(t,o.primary,e+38,n+16,4,1)}function _t(t,e,n,i){f(t,"#2b2118",e,n-11,64,26),f(t,"#d9c29c",e+2,n-9,60,22);let r={todo:"#fde68a",doing:"#93c5fd",done:"#86efac"},s=8;i.tasks.slice(0,s*2).forEach((o,a)=>{let u=a%s,l=Math.floor(a/s);f(t,"#00000033",e+5+u*7,n-6+l*9,6,7),f(t,r[o.state],e+4+u*7,n-7+l*9,6,7),f(t,"#00000040",e+5+u*7,n-5+l*9,4,1)})}function st(t,e,n,i,r){let s=e.x*d,o=e.y*d;switch(e.type){case"desk":{let a=e.x+1,u=e.y+2,l=n.agents.find(h=>h.seat?.x===a&&h.seat?.y===u&&O(h)&&h.state!=="blocked");Wt(t,s,o,!!l,i,l?.seed??0,r);break}case"coffee":f(t,"#374151",s,o+2,32,14),f(t,"#6b7280",s,o+2,32,2),f(t,"#111827",s+4,o-8,14,14),f(t,"#ef4444",s+15,o-5,2,2),f(t,"#f3f4f6",s+8,o+3,5,4),f(t,"#f3f4f6",s+22,o-1,5,5);for(let a=0;a<3;a++)t.fillStyle="rgba(255,255,255,0.45)",t.fillRect(s+9+Math.round(Math.sin(i*2+a)*1.5),o-1-(i*8+a*4)%9,1,2);break;case"water":f(t,"#e5e7eb",s+3,o+3,10,13),f(t,"#7dd3fc",s+4,o-7,8,10),f(t,"#bae6fd",s+5,o-6,2,8),f(t,"#3b82f6",s+5,o+6,2,2);break;case"sofa":f(t,r.primary,s+1,o-6,46,9),f(t,"#00000030",s+1,o+1,46,2),f(t,"#4b5563",s,o+3,48,11),f(t,"#6b7280",s+3,o+3,20,7),f(t,"#6b7280",s+25,o+3,20,7),f(t,"#374151",s,o+12,48,3);break;case"plant":f(t,"#92400e",s+4,o+9,8,7),f(t,"#b45309",s+3,o+8,10,2);for(let[a,u,l,h]of[[6,-3,4,11],[2,0,5,6],[9,1,5,6],[4,-6,3,6],[9,-5,3,5]])f(t,"#15803d",s+a,o+u,l,h);f(t,"#22c55e",s+7,o-3,2,8),f(t,"#22c55e",s+3,o+1,2,3);break;case"board":_t(t,s,o,n);break;case"shelf":f(t,"#5b3a21",s,o-12,32,28);for(let a=0;a<2;a++){f(t,"#3b2413",s+2,o-10+a*13,28,11);for(let u=0;u<8;u++){let l=["#ef4444","#3b82f6","#10b981","#f59e0b","#8b5cf6"][(u*3+a)%5];f(t,l,s+3+u*3,o-8+a*13+u%3,2,9-u%3)}}break;case"server":f(t,"#111827",s+1,o-12,14,28);for(let a=0;a<5;a++){f(t,"#1f2937",s+2,o-11+a*5,12,4);let u=Math.floor(i*3+a*2+e.x)%3!==0;f(t,u?"#22c55e":"#14532d",s+3,o-10+a*5,1,1),f(t,a%2===0?"#f59e0b":"#3b82f6",s+5,o-10+a*5,1,1)}break;case"table":f(t,"#57534e",s+2,o+14,44,14),f(t,"#78716c",s+2,o+3,44,14),f(t,"#a8a29e",s+2,o+3,44,2),f(t,"#f9fafb",s+10,o+6,8,6),f(t,"#f9fafb",s+28,o+8,8,6);break;case"rug":f(t,r.primary,s,o,64,48),t.fillStyle="rgba(0,0,0,0.35)",t.fillRect(s+3,o+3,58,42),f(t,r.primary,s+6,o+6,52,1),f(t,r.primary,s+6,o+41,52,1);break}}function Ft(t,e){t.font="bold 7px ui-monospace, Menlo, Consolas, monospace",t.textBaseline="top";for(let n of e.rooms){if(!n.name)continue;let i=n.name.toUpperCase(),r=n.x*d+3,s=n.y*d-12;t.fillStyle="rgba(0,0,0,0.45)",t.fillText(i,r+1,s+1),t.fillStyle="rgba(255,255,255,0.85)",t.fillText(i,r,s)}}function Bt(t,e,n,i){let r=e.name;t.font="bold 7px ui-monospace, Menlo, Consolas, monospace",t.textBaseline="top";let s=Math.ceil(t.measureText(r).width)+5,o=e.x*d+8,a=Math.round(Math.max(1,Math.min(i-s-1,o-s/2))),u=Math.round(e.y*d+15);t.fillStyle=n?"#ffffff":"rgba(17,24,39,0.82)",t.fillRect(a,u,s,10),t.fillStyle=n?"#111827":"#ffffff",t.fillText(r,a+2.5,u+1.5)}function It(t,e,n){let i=[],r="";for(let s of e.split(/\s+/)){let o=r?`${r} ${s}`:s;t.measureText(o).width>n&&r?(i.push(r),r=s):r=o}return r&&i.push(r),i.slice(0,3)}var rt={working:"Working",thinking:"Thinking",blocked:"Blocked",reviewing:"Reviewing",idle:"On a break",done:"Finished",away:"Away"};function Dt(t,e,n){t.font="7px ui-monospace, Menlo, Consolas, monospace",t.textBaseline="top";let i=It(t,e.task||rt[e.state]||"",104),r=114,s=18+i.length*9+3,o=Math.round(Math.max(2,Math.min(n-r-2,e.x*d+8-r/2))),a=Math.round(Math.max(2,e.y*d-s-22));f(t,"#111827",o-1,a-1,r+2,s+2),f(t,"#ffffff",o,a,r,s),t.fillStyle="#111827",t.font="bold 7px ui-monospace, Menlo, Consolas, monospace",t.fillText(`${e.name}: ${rt[e.state]??""}`.slice(0,26),o+4,a+4),t.fillStyle="#374151",t.font="7px ui-monospace, Menlo, Consolas, monospace",i.forEach((u,l)=>t.fillText(u,o+4,a+15+l*9))}function Pt(t,e,n){if(e.tasks.length===0)return;let i=e.tasks.filter(o=>o.state==="done").length,r=`QUESTS ${i}/${e.tasks.length}`;t.font="bold 7px ui-monospace, Menlo, Consolas, monospace",t.textBaseline="top";let s=96;f(t,"rgba(17,24,39,0.85)",4,4,s,20),t.fillStyle="#ffffff",t.fillText(r,8,6.5),f(t,"#374151",8,16,s-8,4),f(t,n.primary,8,16,Math.round((s-8)*i/e.tasks.length),4)}function at(t,e,n,i,r){let s=e.cols*d;f(t,it,0,0,s,e.rows*d);for(let l of e.rooms)Ot(t,l,i);Lt(t,e,i);for(let l of e.furniture)l.type==="rug"&&st(t,l,e,n,i);let o=[];for(let l of e.furniture)l.type!=="rug"&&o.push({depth:(l.y+E[l.type].h)*d-2,draw:()=>st(t,l,e,n,i)});let a=e.agents.filter(l=>l.state!=="away");for(let l of a)o.push({depth:l.y*d+14,draw:()=>vt(t,l,n,l.id===r)});o.sort((l,h)=>l.depth-h.depth);for(let l of o)l.draw();Ft(t,e);for(let l of a)Bt(t,l,l.id===r,s);for(let l of a)l.id!==r&&Et(t,l,n);Pt(t,e,i);let u=a.find(l=>l.id===r);u&&Dt(t,u,s)}var $t=/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%/]+\)|hsla?\([\d\s.,%/a-z]+\))$/i;function Ht(t){let e=getComputedStyle(t),n=(i,r)=>{let s=e.getPropertyValue(i).trim();return $t.test(s)?s:r};return{primary:n("--blkc-color-primary","#3b82f6"),accent:n("--blkc-color-accent","#f59e0b"),background:n("--blkc-color-background","#1a1a2e"),text:n("--blkc-color-text","#ffffff")}}function H(t,e={},n={}){let i=B(e),r=t.getContext("2d");if(!r)throw new Error("This browser can't draw to a canvas.");let s=r,o=i.cols*d,a=i.rows*d,u=Ht(t),l=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,h,p=0,x=0,k=0,M=0,c=!0,b=!1,y=()=>{s.setTransform(p,0,0,p,0,0),s.imageSmoothingEnabled=!1,at(s,i,x,u,h)},T=()=>{let m=t.getBoundingClientRect().width||o,v=Math.max(1,Math.ceil(m*(typeof devicePixelRatio=="number"?devicePixelRatio:1)/o));v!==p&&(p=v,t.width=o*p,t.height=a*p,y())},U=m=>{if(b)return;if(M=requestAnimationFrame(U),!c){k=m;return}let g=Math.min((m-k)/1e3||0,.1);k=m,x+=g,D(i,g),y()},X=m=>{h=m===h?void 0:m,n.onSelect?.(h),l&&y()},G=m=>{let g=t.getBoundingClientRect();return{x:(m.clientX-g.left)/g.width*i.cols,y:(m.clientY-g.top)/g.height*i.rows}},K=m=>{let{x:g,y:v}=G(m);X(L(i,g,v)?.id)},j=m=>{let{x:g,y:v}=G(m);t.style.cursor=L(i,g,v)?"pointer":"default"};t.addEventListener("pointerdown",K),t.addEventListener("pointermove",j);let q=typeof ResizeObserver=="function"?new ResizeObserver(T):void 0;q?.observe(t);let z=typeof IntersectionObserver=="function"?new IntersectionObserver(m=>{c=m.some(g=>g.isIntersecting)}):void 0;return z?.observe(t),T(),p===0&&(p=1,y()),l||(M=requestAnimationFrame(U)),{world:i,update(m){P(i,m),l&&y()},select:X,destroy(){b=!0,cancelAnimationFrame(M),q?.disconnect(),z?.disconnect(),t.removeEventListener("pointerdown",K),t.removeEventListener("pointermove",j)}}}var lt=new Map;function Nt(t,e){lt.set(t,e)}function Ut(t,e,n){let i=[...n.querySelectorAll("button[data-blkc-agent]")],r=H(t,e,{onSelect(s){for(let o of i)o.setAttribute("aria-pressed",String(o.dataset.blkcAgent===s))}});for(let s of i)s.disabled=!1,s.addEventListener("click",()=>r.select(s.dataset.blkcAgent));return r}Nt("office",Ut);var ft=new WeakSet;function N(t=document){let e=[];for(let n of t.querySelectorAll("canvas[data-blkc-canvas]")){if(ft.has(n))continue;let i=lt.get(n.dataset.blkcCanvas??"");if(!i)continue;let r=n.closest("[data-blkc-canvas-root]")??n.parentElement??n,s=r.querySelector("script[data-blkc-canvas-data]"),o={};try{o=JSON.parse(s?.textContent||"{}")}catch{o={}}ft.add(n);let a=i(n,o,r);e.push({element:n,destroy:()=>a.destroy()})}return e}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>N()):N();})();
|
|
1
|
+
"use strict";(()=>{var q="bold 7px ui-monospace, Menlo, Consolas, monospace",ae="7px ui-monospace, Menlo, Consolas, monospace",E="#14141f",r=(e,t,s,f,a,n)=>{e.fillStyle=t,e.fillRect(Math.round(s),Math.round(f),a,n)};function $(e,t){if(!e.startsWith("#"))return e;let s=e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e,f=parseInt(s.slice(1,7),16),a=n=>Math.max(0,Math.min(255,(f>>n&255)+t));return`rgb(${a(16)},${a(8)},${a(0)})`}var Ee=new Map;function ie(e){Ee.set(e.id,e)}var We=(e,t)=>e&&Ee.get(e)||t;var fe={desk:{w:3,h:2,spot:{x:1,y:2},use:"seat"},coffee:{w:2,h:1,spot:{x:0,y:1},use:"lounge"},water:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},sofa:{w:3,h:1,spot:{x:1,y:1},use:"lounge"},plant:{w:1,h:1},fern:{w:1,h:1},board:{w:4,h:1,spot:{x:1,y:1},use:"board"},whiteboard:{w:3,h:1,spot:{x:1,y:1},use:"board"},shelf:{w:2,h:1,spot:{x:0,y:1},use:"lounge"},server:{w:1,h:1},table:{w:3,h:2,spot:{x:1,y:2},use:"board"},rug:{w:4,h:3,solid:!1},arcade:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},fridge:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},printer:{w:1,h:1,spot:{x:0,y:1}},lamp:{w:1,h:1},beanbag:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},tv:{w:3,h:1,spot:{x:1,y:2},use:"lounge"},vending:{w:1,h:1,spot:{x:0,y:1},use:"lounge"},trophy:{w:1,h:1},clock:{w:1,h:1,solid:!1,wall:!0},poster:{w:1,h:1,solid:!1,wall:!0}},Re={cols:26,rows:17,rooms:[{id:"studio",name:"Studio",x:1,y:3,w:15,h:13,floor:"wood"},{id:"lounge",name:"Lounge",x:17,y:3,w:8,h:6,floor:"carpet"},{id:"quests",name:"Quests",x:17,y:10,w:8,h:6,floor:"tile"}],doors:[{x:16,y:6},{x:16,y:13},{x:23,y:9}],furniture:[{type:"desk",x:2,y:4},{type:"desk",x:7,y:4},{type:"desk",x:12,y:4},{type:"desk",x:2,y:10},{type:"desk",x:7,y:10},{type:"desk",x:12,y:10},{type:"plant",x:1,y:8},{type:"plant",x:15,y:8},{type:"server",x:15,y:15},{type:"server",x:14,y:15},{type:"shelf",x:1,y:15},{type:"coffee",x:19,y:3},{type:"water",x:21,y:3},{type:"sofa",x:22,y:3},{type:"rug",x:20,y:5},{type:"plant",x:24,y:8},{type:"board",x:19,y:10},{type:"table",x:19,y:13},{type:"plant",x:24,y:15}]},le={id:"office",name:"Pixel Office",words:{quests:"QUESTS"},items:fe,layout:Re};var Qe=64,Je=40,Fe=40,Ze=300,Be=60,et=4.5,ce=fe,tt=["working","thinking","blocked","reviewing","idle","done","away"],nt=["todo","doing","done"],ot=["wood","carpet","tile","stone","concrete","grass","hall"];var B=(e,t)=>typeof e=="number"&&Number.isFinite(e)?Math.floor(e):t,P=(e,t=120)=>typeof e=="string"?e.slice(0,t):"",U=(e,t)=>Array.isArray(e)?e.slice(0,t):[];function ze(e){let t=2166136261;for(let s=0;s<e.length;s++)t=Math.imul(t^e.charCodeAt(s),16777619);return t>>>0}var Ie=["#2b1b12","#5a3a22","#a8622d","#d9b36c","#20242e","#7d2f3f","#4a5568","#e5e7eb"],$e=["#f4d3b5","#e8b98f","#c98d62","#9c6644","#6f4530","#4e2f20"],De=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316"],ue=(e,t)=>typeof e=="string"&&/^#[0-9a-f]{3,8}$/i.test(e)?e:t,de=(e,t,s)=>s*e.cols+t;function X(e,t,s){return t>=0&&s>=0&&t<e.cols&&s<e.rows&&e.walkable[de(e,t,s)]===!0}function Y(e,t,s){if(!X(e,s.x,s.y))return null;if(t.x===s.x&&t.y===s.y)return[];let f=new Int32Array(e.cols*e.rows).fill(-1),a=de(e,t.x,t.y);f[a]=a;let n=[a];for(let o=0;o<n.length;o++){let i=n[o],l=i%e.cols,u=Math.floor(i/e.cols);if(l===s.x&&u===s.y){let b=[];for(let w=i;w!==a;w=f[w])b.unshift({x:w%e.cols,y:Math.floor(w/e.cols)});return b}for(let[b,w]of[[0,1],[0,-1],[1,0],[-1,0]]){let x=l+b,y=u+w;if(!X(e,x,y))continue;let O=de(e,x,y);f[O]===-1&&(f[O]=i,n.push(O))}}return null}function _e(e,t){let s=P(e?.id,60)||`agent-${t+1}`,f=ze(s),a=tt.includes(e?.state)?e.state:"idle";return{id:s,name:P(e?.name,24)||s,role:P(e?.role,40),state:a,task:P(e?.task,120),area:P(e?.area,60),party:0,hair:ue(e?.hair,Ie[f%Ie.length]),skin:ue(e?.skin,$e[(f>>>4)%$e.length]),shirt:ue(e?.shirt,De[(f>>>8)%De.length]),x:0,y:0,path:[],facing:"down",walking:!1,rest:0,seed:f}}function Ue(e){return{title:P(e?.title,80),state:nt.includes(e?.state)?e.state:"todo",agent:P(e?.agent,60)}}ie(le);var ee=(e,t)=>e.pack.items[t.type];function Ne(e,t){let s=Array.isArray(e?.rooms)&&e.rooms.length>0,f=Math.min(Math.max(B(e?.cols,s?20:t.layout.cols),6),Qe),a=Math.min(Math.max(B(e?.rows,s?14:t.layout.rows),6),Je),n=s?U(e.rooms,40):t.layout.rooms,o=s?U(e.doors,60):t.layout.doors,i=Array.isArray(e?.furniture)?U(e.furniture,Ze):s?[]:t.layout.furniture,l=n.map((c,h)=>{let M=Math.min(Math.max(B(c?.x,0),0),f),R=Math.min(Math.max(B(c?.y,0),0),a);return{id:P(c?.id,60)||`room-${h+1}`,name:P(c?.name,24),x:M,y:R,w:Math.min(Math.max(B(c?.w,0),0),f-M),h:Math.min(Math.max(B(c?.h,0),0),a-R),floor:ot.includes(c?.floor)?c.floor:"wood",paths:U(c?.paths,20).filter(T=>typeof T=="string").map(T=>T.slice(0,200))}}),u=new Array(f*a).fill(!1),b=(c,h,M)=>{c>=0&&h>=0&&c<f&&h<a&&(u[h*f+c]=M)};for(let c of l)for(let h=c.y;h<c.y+c.h;h++)for(let M=c.x;M<c.x+c.w;M++)b(M,h,!0);let w=o.map(c=>({x:B(c?.x,-1),y:B(c?.y,-1)})).filter(c=>c.x>=0&&c.y>=0);for(let c of w)b(c.x,c.y,!0);let x=i.filter(c=>c&&Object.hasOwn(t.items,c.type)).map(c=>({type:c.type,x:B(c.x,-99),y:B(c.y,-99)}));for(let c of x){let h=t.items[c.type];if(h.solid!==!1)for(let M=c.y;M<c.y+h.h;M++)for(let R=c.x;R<c.x+h.w;R++)b(R,M,!1)}let y=(c,h)=>c>=0&&h>=0&&c<f&&h<a&&u[h*f+c]===!0,O=c=>{let h=t.items[c.type].spot;if(!h)return;let M={x:c.x+h.x,y:c.y+h.y};return y(M.x,M.y)?M:void 0},W=x.filter(c=>t.items[c.type].use==="seat").map(O).filter(c=>!!c),A={lounge:[],board:[]};for(let c of x){let h=O(c);if(!h)continue;let M=t.items[c.type].use;M==="lounge"&&A.lounge.push(h),M==="board"&&A.board.push(h)}let m=U(e?.links,60).map(c=>({from:P(c?.from,60),to:P(c?.to,60)})).filter(c=>c.from&&c.to);return{cols:f,rows:a,rooms:l,doors:w,furniture:x,walkable:u,seats:W,spots:A,links:m}}function be(e={}){let t=We(e?.world,le),s={pack:t,showLinks:!0,...Ne(e,t),agents:U(e?.agents,Fe).map(_e),tasks:U(e?.tasks,Be).map(Ue)};for(let f of s.agents)pe(s,f);return s}function me(e,t){Object.assign(e,Ne(t,e.pack),{routes:void 0});for(let s of e.agents)s.seat=void 0,s.path=[],s.x=Math.round(s.x),s.y=Math.round(s.y),X(e,s.x,s.y)?(Z(e,s),K(e,s,te(e,s))):pe(e,s)}function st(e){for(let t=0;t<e.rows;t++)for(let s=0;s<e.cols;s++)if(X(e,s,t))return{x:s,y:t};return{x:0,y:0}}var He=["working","thinking","blocked"];function Z(e,t){if(!He.includes(t.state)){t.seat=void 0;return}let s=e.rooms.find(o=>o.id===t.area),f=o=>!!s&&o.x>=s.x&&o.x<s.x+s.w&&o.y>=s.y&&o.y<s.y+s.h;if(t.seat&&(!s||f(t.seat)))return;t.seat=void 0;let a=new Set(e.agents.filter(o=>o!==t&&o.seat).map(o=>`${o.seat?.x},${o.seat?.y}`)),n=e.seats.filter(o=>!a.has(`${o.x},${o.y}`));t.seat=s?n.find(f):n[0]}function rt(e){return e.path[e.path.length-1]??{x:Math.round(e.x),y:Math.round(e.y)}}function Pe(e,t,s){let f=new Set(e.agents.filter(a=>a!==t&&a.state!=="away").map(a=>{let n=rt(a);return`${n.x},${n.y}`}));for(let a=0;a<=4;a++)for(let n=-a;n<=a;n++)for(let o=-a;o<=a;o++){if(Math.abs(o)+Math.abs(n)!==a)continue;let i={x:s.x+o,y:s.y+n};if(X(e,i.x,i.y)&&!f.has(`${i.x},${i.y}`)&&Y(e,s,i))return i}return s}function te(e,t){let s=f=>{let a=f.length>0?f[(t.seed+Math.floor(t.rest*1e3))%f.length]:void 0;return a&&Pe(e,t,a)};switch(t.state){case"working":case"thinking":case"blocked":{if(t.seat)return t.seat;let f=e.rooms.find(a=>a.id===t.area);return f&&f.w>0&&f.h>0?Pe(e,t,{x:f.x+(f.w>>1),y:f.y+(f.h>>1)}):s(e.spots.lounge)}case"reviewing":return s(e.spots.board)??t.seat;case"idle":case"done":return s(e.spots.lounge)??t.seat;default:return}}function pe(e,t){Z(e,t);let s=te(e,t)??t.seat??st(e);t.x=s.x,t.y=s.y,t.path=[],t.walking=!1,t.facing=N(t)?"up":"down",t.rest=2+t.seed%50/10}var N=e=>(e.state==="working"||e.state==="thinking"||e.state==="blocked")&&e.seat!==void 0&&e.seat.x===e.x&&e.seat.y===e.y&&e.path.length===0;function K(e,t,s){if(!s)return;let f={x:Math.round(t.x),y:Math.round(t.y)};t.path=Y(e,f,s)??[]}function ye(e,t){for(let s of e.agents)if(s.state!=="away"){if(s.path.length>0){let f=s.path[0],a=f.x-s.x,n=f.y-s.y,o=Math.hypot(a,n),i=et*t;Math.abs(a)>Math.abs(n)?s.facing=a>0?"right":"left":n!==0&&(s.facing=n>0?"down":"up"),s.walking=!0,o<=i?(s.x=f.x,s.y=f.y,s.path.shift()):(s.x+=a/o*i,s.y+=n/o*i);continue}s.walking=!1,s.party>0&&(s.party=Math.max(0,s.party-t)),s.state==="idle"&&(s.rest-=t,s.rest<=0&&(s.seed=ze(String(s.seed)),s.rest=3+s.seed%60/10,K(e,s,te(e,s)))),N(s)&&(s.facing="up")}}function he(e,t){if(Array.isArray(t.tasks)&&(e.tasks=U(t.tasks,Be).map(Ue)),!Array.isArray(t.agents))return;let s=new Map(e.agents.map(n=>[n.id,n])),f=U(t.agents,Fe).map(_e);e.agents=f.map(n=>s.get(n.id)).filter(n=>!!n);let a=f.map(n=>{let o=s.get(n.id);if(!o){pe(e,n),e.agents=[...e.agents,n];let l=e.doors[0],u={x:n.x,y:n.y};return l&&n.state!=="away"&&(n.x=l.x,n.y=l.y,K(e,n,u)),n}Object.assign(o,{name:n.name,role:n.role,task:n.task,hair:n.hair,skin:n.skin,shirt:n.shirt});let i=o.area!==n.area;return o.area=n.area,o.state!==n.state||i?(n.state==="done"&&o.state!=="done"&&(o.party=3),o.state=n.state,Z(e,o),n.state!=="away"&&K(e,o,te(e,o))):He.includes(o.state)&&!o.seat&&(Z(e,o),o.seat&&K(e,o,o.seat)),o});e.agents=a}function ne(e,t,s){let f,a=1/0;for(let n of e.agents){if(n.state==="away")continue;let o=t-(n.x+.5),i=s-(n.y+.1),l=Math.hypot(o,i);Math.abs(o)<.8&&i>-1.6&&i<1.1&&l<a&&(f=n,a=l)}return f}var Xe=["#38bdf8","#f472b6","#fbbf24","#a78bfa","#34d399","#fb7185"];function Ye(e,t){let s=e.rooms.find(i=>i.id===t);if(!s)return;let f=s.x+(s.w>>1),a=s.y+(s.h>>1),n,o=1/0;for(let i=s.y;i<s.y+s.h;i++)for(let l=s.x;l<s.x+s.w;l++){let u=Math.abs(l-f)+Math.abs(i-a);u<o&&X(e,l,i)&&(n={x:l,y:i},o=u)}return n}function ge(e){let t=[];for(let s of e.links){let f=Ye(e,s.from),a=Ye(e,s.to);if(!f||!a)continue;let n=Y(e,f,a);n&&n.length>0&&t.push({from:s.from,to:s.to,points:[f,...n]})}return t}function xe(e,t,s){t.forEach((f,a)=>{let n=Xe[a%Xe.length],o=(a%5-2)*2,i=b=>[b.x*16+8+o,b.y*16+8+o];e.save(),e.lineWidth=2,e.strokeStyle=n,e.globalAlpha=.85,e.setLineDash([6,5]),e.lineDashOffset=-s*14,e.beginPath(),f.points.forEach((b,w)=>{let[x,y]=i(b);w===0?e.moveTo(x,y):e.lineTo(x,y)}),e.stroke(),e.setLineDash([]);let l=f.points[0],u=f.points[f.points.length-1];if(l&&u){let[b,w]=i(l),[x,y]=i(u);e.fillStyle=n,e.fillRect(b-2,w-2,4,4),e.beginPath(),e.arc(x,y,4,0,Math.PI*2),e.fill()}e.restore()})}function at(e,t,s,f,a,n,o,i){if(r(e,"#55351d",t+1,s+22,46,8),r(e,"#6b4427",t+1,s+13,46,10),r(e,"#8a5a33",t+1,s+10,46,12),r(e,"#a87545",t+1,s+10,46,2),r(e,"#3b2413",t+3,s+22,3,9),r(e,"#3b2413",t+42,s+22,3,9),r(e,"#55351d",t+30,s+23,12,7),r(e,"#7c5637",t+31,s+24,10,2),r(e,"#d4a24e",t+35,s+24,2,1),r(e,"#7c5637",t+31,s+27,10,2),r(e,"#d4a24e",t+35,s+27,2,1),r(e,E,t+14,s-3,20,15),r(e,"#374151",t+22,s+12,4,2),r(e,"#4b5563",t+19,s+14,10,1),i)r(e,"#3f0f14",t+15,s-2,18,13),Math.floor(a*2)%2===0&&(r(e,"#ef4444",t+23,s,2,6),r(e,"#ef4444",t+23,s+7,2,2));else if(f){r(e,"#0f2a2e",t+15,s-2,18,13);let l=Math.floor(a*3+n%13);for(let u=0;u<5;u++){let b=3+((n>>u&7)+(l+u)*7)%12;r(e,u%3===0?o.primary:u%3===1?"#7dd3fc":"#fcd34d",t+16+u%2*2,s-1+u*2.2,b,1)}e.fillStyle="rgba(125,211,252,0.12)",e.fillRect(t+10,s+11,28,8)}else r(e,"#1f2937",t+15,s-2,18,13),r(e,"#374151",t+17,s,3,1);r(e,"#d1d5db",t+16,s+15,16,5);for(let l=0;l<2;l++)for(let u=0;u<7;u++)r(e,"#9ca3af",t+17+u*2,s+16+l*2,1,1);r(e,"#e5e7eb",t+34,s+16,3,4),r(e,"#f3f4f6",t+40,s+13,5,5),r(e,o.primary,t+40,s+15,5,1),r(e,"#fde68a",t+4,s+13,7,6),r(e,"#fbbf24",t+5,s+15,5,1)}function it(e,t,s,f){r(e,"#3a2c1e",t,s-12,64,27),r(e,"#d9c29c",t+2,s-10,60,23);for(let o=0;o<40;o++)r(e,"#c9b08a",t+3+o*37%58,s-9+o*13%21,1,1);let a={todo:"#fde68a",doing:"#93c5fd",done:"#86efac"},n=8;f.tasks.slice(0,n*2).forEach((o,i)=>{let l=i%n,u=Math.floor(i/n);r(e,"#00000033",t+5+l*7,s-7+u*10,6,8),r(e,a[o.state],t+4+l*7,s-8+u*10,6,8),r(e,"#ef4444",t+6+l*7,s-8+u*10,2,1),r(e,"#00000040",t+5+l*7,s-5+u*10,4,1),r(e,"#00000040",t+5+l*7,s-3+u*10,3,1)})}function ft(e,t,s,f,a){let n=t.x*16,o=t.y*16;switch(t.type){case"desk":{let i=t.x+1,l=t.y+2,u=s.agents.find(b=>b.seat?.x===i&&b.seat?.y===l&&N(b));at(e,n,o,!!u,f,u?.seed??0,a,u?.state==="blocked");break}case"coffee":r(e,"#374151",n,o+2,32,14),r(e,"#6b7280",n,o+2,32,2),r(e,E,n+4,o-9,15,15),r(e,"#27272a",n+5,o-8,13,13),r(e,Math.floor(f*2)%2?"#ef4444":"#7f1d1d",n+15,o-6,2,2),r(e,"#52525b",n+7,o-6,6,4),r(e,"#f3f4f6",n+8,o+3,5,4),r(e,"#f3f4f6",n+23,o-1,5,5),r(e,"#92400e",n+24,o,3,1);for(let i=0;i<3;i++)e.fillStyle="rgba(255,255,255,0.5)",e.fillRect(n+9+Math.round(Math.sin(f*2+i)*1.5),o-1-(f*8+i*4)%9,1,2);break;case"water":r(e,"#d1d5db",n+3,o+3,10,13),r(e,"#9ca3af",n+3,o+14,10,2),r(e,"#60a5fa",n+4,o-8,8,11),r(e,"#bae6fd",n+5,o-7,2,9),r(e,"#3b82f6",n+5,o+6,2,2),r(e,"#ef4444",n+9,o+6,2,2),Math.floor(f*.4+t.x)%5===0&&r(e,"#e0f2fe",n+8,o-2-f*6%7,1,1);break;case"sofa":r(e,$(a.primary,-60),n+1,o-7,46,11),r(e,$(a.primary,-30),n+2,o-6,44,3),r(e,"#4b5563",n,o+3,48,11),r(e,"#6b7280",n+3,o+3,20,7),r(e,"#6b7280",n+25,o+3,20,7),r(e,"#374151",n,o+12,48,3),r(e,"#374151",n-1,o-2,4,16),r(e,"#374151",n+45,o-2,4,16);break;case"plant":r(e,"#92400e",n+4,o+9,8,7),r(e,"#b45309",n+3,o+8,10,2);for(let[i,l,u,b]of[[6,-3,4,11],[2,0,5,6],[9,1,5,6],[4,-6,3,6],[9,-5,3,5]])r(e,"#15803d",n+i,o+l,u,b);r(e,"#22c55e",n+7,o-3,2,8),r(e,"#22c55e",n+3,o+1,2,3),r(e,"#4ade80",n+10,o-4,1,3);break;case"fern":r(e,"#57534e",n+3,o+10,10,6),r(e,"#78716c",n+2,o+9,12,2);for(let i=0;i<7;i++){let l=i-3;for(let u=0;u<5;u++)r(e,u%2?"#16a34a":"#15803d",n+7+l*(u/2+1),o+8-u*2+Math.abs(l),2,2)}break;case"board":it(e,n,o,s);break;case"whiteboard":r(e,"#9ca3af",n,o-10,48,22),r(e,"#f9fafb",n+2,o-8,44,18),r(e,"#3b82f6",n+5,o-5,14,1),r(e,"#3b82f6",n+5,o-2,9,1),r(e,"#ef4444",n+24,o-6,8,6),r(e,"#f9fafb",n+25,o-5,6,4),r(e,"#10b981",n+8,o+3,20,1),r(e,"#10b981",n+27,o+2,1,3),r(e,"#6b7280",n+2,o+10,44,2);break;case"shelf":r(e,"#5b3a21",n,o-12,32,28);for(let i=0;i<2;i++){r(e,"#3b2413",n+2,o-10+i*13,28,11);for(let l=0;l<8;l++){let u=["#ef4444","#3b82f6","#10b981","#f59e0b","#8b5cf6"][(l*3+i+t.x)%5];r(e,u,n+3+l*3,o-8+i*13+l%3,2,9-l%3),r(e,$(u,40),n+3+l*3,o-6+i*13,2,1)}}break;case"server":r(e,E,n,o-13,16,29),r(e,"#1f2937",n+1,o-12,14,27);for(let i=0;i<5;i++){r(e,"#111827",n+2,o-11+i*5,12,4);let l=Math.floor(f*3+i*2+t.x)%3!==0;r(e,l?"#22c55e":"#14532d",n+3,o-10+i*5,1,1),r(e,i%2===0?"#f59e0b":"#3b82f6",n+5,o-10+i*5,1,1),r(e,"#374151",n+8,o-10+i*5,5,1)}break;case"table":r(e,"#44403c",n+2,o+16,44,12),r(e,"#78716c",n+2,o+3,44,14),r(e,"#a8a29e",n+2,o+3,44,2),r(e,"#f9fafb",n+10,o+6,8,6),r(e,"#f9fafb",n+28,o+8,8,6),r(e,"#1f2937",n+12,o+8,4,1),r(e,"#3b82f6",n+30,o+10,4,1);break;case"rug":r(e,a.primary,n,o,64,48),e.fillStyle="rgba(0,0,0,0.42)",e.fillRect(n+3,o+3,58,42),r(e,a.primary,n+6,o+6,52,1),r(e,a.primary,n+6,o+41,52,1),r(e,a.primary,n+6,o+6,1,36),r(e,a.primary,n+57,o+6,1,36);for(let i=0;i<6;i++)r(e,a.primary,n+12+i*8,o+22,4,4);break;case"arcade":r(e,E,n,o-14,16,30),r(e,"#4c1d95",n+1,o-13,14,28),r(e,"#111827",n+3,o-10,10,9),r(e,["#22c55e","#ec4899","#38bdf8"][Math.floor(f*2)%3],n+4+Math.floor(f*4)%7,o-8+Math.floor(f*3)%5,2,2),r(e,"#f59e0b",n+3,o-13,10,2),r(e,"#27272a",n+2,o+1,12,4),r(e,"#ef4444",n+4,o+2,2,2),r(e,"#3b82f6",n+9,o+2,2,2);break;case"fridge":r(e,E,n+1,o-12,14,28),r(e,"#e5e7eb",n+2,o-11,12,26),r(e,"#9ca3af",n+2,o-3,12,1),r(e,"#6b7280",n+11,o-8,1,3),r(e,"#6b7280",n+11,o,1,5),r(e,"#fde68a",n+4,o-9,3,3),r(e,"#fca5a5",n+5,o+3,3,3);break;case"printer":r(e,"#4b5563",n+2,o+8,12,8),r(e,E,n+1,o-2,14,11),r(e,"#d1d5db",n+2,o-1,12,9),r(e,"#f9fafb",n+4,o-5-(Math.floor(f)%4===0?1:0),8,5),r(e,"#22c55e",n+11,o+1,2,1),r(e,"#9ca3af",n+3,o+5,10,1);break;case"lamp":r(e,"#374151",n+5,o+13,6,3),r(e,"#4b5563",n+7,o-4,2,17),r(e,E,n+2,o-10,12,8),r(e,"#fde68a",n+3,o-9,10,6),r(e,"#fef3c7",n+4,o-8,4,2);break;case"beanbag":r(e,E,n,o+3,16,13),r(e,$(a.primary,-50),n+1,o+4,14,11),r(e,$(a.primary,-20),n+3,o+5,8,4),r(e,"#00000040",n+1,o+13,14,2);break;case"tv":r(e,"#3b2413",n+2,o+8,44,8),r(e,"#5b3a21",n+2,o+8,44,2),r(e,E,n+4,o-14,40,22),r(e,"#0b1120",n+5,o-13,38,20);for(let i=0;i<9;i++){let l=2+(i*5+Math.floor(f*3))%12;r(e,i%3===0?a.primary:i%3===1?"#38bdf8":"#f472b6",n+8+i*4,o+5-l,3,l)}break;case"vending":r(e,E,n,o-14,16,30),r(e,"#b91c1c",n+1,o-13,14,28),r(e,"#0f172a",n+3,o-11,8,16);for(let i=0;i<3;i++)for(let l=0;l<2;l++)r(e,["#fbbf24","#34d399","#60a5fa","#f472b6"][(i+l*2)%4],n+4+l*3,o-10+i*5,2,4);r(e,"#d1d5db",n+12,o-9,2,6),r(e,"#111827",n+3,o+8,10,4);break;case"trophy":r(e,"#6b4427",n+2,o+8,12,8),r(e,"#8a5a33",n+2,o+8,12,2),r(e,"#78350f",n+5,o+5,6,3),r(e,"#f59e0b",n+7,o+1,2,4),r(e,E,n+3,o-8,10,10),r(e,"#fbbf24",n+4,o-7,8,8),r(e,"#fde68a",n+5,o-6,2,5),r(e,"#fbbf24",n+1,o-6,3,1),r(e,"#fbbf24",n+12,o-6,3,1);break;case"clock":{r(e,E,n+3,o+1,10,10),r(e,"#f9fafb",n+4,o+2,8,8),r(e,"#1f2937",n+8,o+3,1,3),r(e,"#1f2937",n+8,o+6,3,1);break}case"poster":{let i=["#7c3aed","#0ea5e9","#db2777","#059669"],l=i[(t.x+t.y)%i.length];r(e,E,n+2,o,12,11),r(e,l,n+3,o+1,10,9),r(e,$(l,60),n+5,o+3,6,3),r(e,"#f9fafb",n+5,o+7,6,1);break}}}var ke={furniture:ft,glow(e,t,s){e.type==="lamp"&&s(e.x*16+8,e.y*16,36,"rgba(253,224,139,0.30)"),(e.type==="arcade"||e.type==="vending"||e.type==="tv")&&s(e.x*16+8,e.y*16,26,"rgba(125,211,252,0.16)"),e.type==="desk"&&t.agents.some(f=>f.seat?.x===e.x+1&&f.seat?.y===e.y+2&&N(f))&&s(e.x*16+24,e.y*16+8,30,"rgba(125,211,252,0.26)")}};var lt=new Map([["office",ke]]);var oe=e=>lt.get(e.pack.id)??ke;function Me(e){return e>=7&&e<17?{sky:"#8ed0ff",sun:"rgba(255,244,214,0.10)",night:0}:e>=17&&e<20?{sky:"#ffae70",sun:"rgba(255,170,110,0.13)",night:.14}:e>=5&&e<7?{sky:"#ffc9a3",sun:"rgba(255,200,170,0.08)",night:.16}:{sky:"#16204a",sun:"rgba(0,0,0,0)",night:.24}}function ut(e,t){e.fillStyle=E;for(let[,s,f,a,n]of t)e.fillRect(Math.round(s)-1,Math.round(f)-1,a+2,n+2);for(let[s,f,a,n,o]of t)r(e,s,f,a,n,o)}function dt(e,t,s,f){let a=t.x*16+2,n=t.y*16+15,o=N(t),i=t.walking,l=t.facing==="left"||t.facing==="right",u=t.facing==="up",b=t.facing==="left",w=Math.floor(s*9+t.seed%5),x=i?w%4:0,y=i&&x%2===1?-1:0,O=!i&&!o&&Math.floor(s*1.4+t.seed%7)%2===0?1:0,W=t.party>0?-Math.abs(Math.round(Math.sin(s*12)*3)):0,A=t.skin,m=t.hair,c=t.shirt,h=$(c,-40),M=$(c,24),R="#39415a",T="#1f2433",D=t.seed%5,H=(t.seed>>>5)%3;e.fillStyle="rgba(0,0,0,0.28)",e.fillRect(Math.round(a+1),Math.round(n-1),10,2),f&&(e.fillStyle="rgba(255,255,255,0.45)",e.fillRect(Math.round(a-2),Math.round(n-2),16,4)),t.state==="blocked"&&(e.fillStyle=Math.floor(s*3)%2===0?"rgba(239,68,68,0.55)":"rgba(239,68,68,0.22)",e.fillRect(Math.round(a-2),Math.round(n-2),16,4));let re=y+W,g=[],L=n-13+re+O*0,S=L-8+O;if(o&&(r(e,"#1f2937",a+1,t.y*16+3,10,9),r(e,"#374151",a+2,t.y*16+11,8,3),r(e,"#111827",a+5,t.y*16+14,2,2)),!o){let v=L+7;if(l){let k=x===1?2:x===3?-2:0;g.push([R,a+4+k,v,3,5],[T,a+4+k+(b?-1:0),v+5,4,1]),g.push([$(R,-12),a+5-k,v,3,5],[T,a+5-k+(b?-1:0),v+5,4,1])}else{let k=x===1?1:0,F=x===3?1:0;g.push([R,a+2,v,3,5-k],[T,a+2,v+5-k,3,1]),g.push([R,a+7,v,3,5-F],[T,a+7,v+5-F,3,1])}}let z=i?x===1?1:x===3?-1:0:0;if(l)g.push([c,a+3,L,6,7],[h,a+3,L+6,6,1]),g.push([h,a+5+z,L+1,2,5],[A,a+5+z,L+6,2,1]);else{g.push([c,a+1,L,10,7],[h,a+1,L+6,10,1]);let v=o&&t.state==="working",k=Math.floor(s*10+t.seed)%2;g.push([h,a-1,L+1+z+(v?-k:0),2,5]),g.push([h,a+11,L+1-z+(v?k-1:0),2,5]),g.push([A,a-1,L+6+z+(v?-k:0),2,1]),g.push([A,a+11,L+6-z+(v?k-1:0),2,1]),!u&&H===2&&g.push(["#f3f4f6",a+4,L,4,3],[t.seed%2?"#ef4444":"#1d4ed8",a+5,L,2,5]),!u&&H===1&&g.push([M,a+3,L,6,2],[h,a+5,L+2,2,4]),u&&H===1&&g.push([M,a+2,L,8,3])}if(g.push([A,a+1,S,10,8]),u)g.push([m,a+1,S,10,7]);else if(l){let v=b?a+7:a+1;g.push([m,a+1,S,10,3],[m,v,S,4,6]);let k=Math.floor(s*.7+t.seed%11)%7===0;g.push([k?$(A,-40):"#1a1a24",b?a+3:a+8,S+4,1,k?1:2])}else{g.push([m,a+1,S,10,3],[m,a+1,S+3,1,2],[m,a+10,S+3,1,2]);let v=Math.floor(s*.7+t.seed%11)%7===0;g.push([v?$(A,-40):"#1a1a24",a+3,S+4,2,v?1:2]),g.push([v?$(A,-40):"#1a1a24",a+7,S+4,2,v?1:2]),g.push([$(A,-28),a+5,S+6,2,1])}if(D===1&&g.push([m,a,S+2,2,8],[m,a+10,S+2,2,8]),D===2&&g.push([m,a+4,S-3,4,3]),D===3&&g.push([m,a+2,S-2,2,2],[m,a+5,S-3,2,3],[m,a+8,S-2,2,2]),D===4&&(g.push([M,a,S-1,12,3]),!u&&!l&&g.push([h,a+1,S+2,10,1]),l&&g.push([h,b?a-2:a+9,S+1,5,1])),ut(e,g),t.party>0){let v=["#f59e0b","#ec4899","#22c55e","#3b82f6","#a855f7"];for(let k=0;k<10;k++){let F=(s*1.1+k*.137)%1,J=k*2.4+t.seed;r(e,v[k%v.length],a+6+Math.cos(J)*(4+F*14),n-22-F*6+F*F*26,2,2)}}}function G(e,t,s,f){r(e,E,t-1,s-1,13,11),r(e,"#ffffff",t,s,11,9),r(e,"#ffffff",t+4,s+9,3,1),r(e,E,t+4,s+10,3,1),f(t,s)}function ct(e,t,s){let f=Math.round(t.x*16+2),a=Math.round(t.y*16-22+(N(t)?2:-2)),n=Math.floor(s*2+t.seed%3)%2===0;if(t.state==="blocked")G(e,f,a,(o,i)=>{r(e,n?"#dc2626":"#991b1b",o+5,i+1,2,5),r(e,n?"#dc2626":"#991b1b",o+5,i+7,2,1)});else if(t.state==="thinking"){let o=Math.floor(s*3)%4;G(e,f,a,(i,l)=>{for(let u=0;u<3;u++)r(e,u<o?"#111827":"#d1d5db",i+2+u*3,l+4,2,2)})}else if(t.state==="reviewing"&&!t.walking)G(e,f,a,(o,i)=>{r(e,"#2563eb",o+4,i+1,4,1),r(e,"#2563eb",o+7,i+2,1,2),r(e,"#2563eb",o+5,i+4,2,1),r(e,"#2563eb",o+5,i+5,1,1),r(e,"#2563eb",o+5,i+7,1,1)});else if(t.state==="done"){let o=n?"#f59e0b":"#fbbf24";G(e,f,a,(i,l)=>{r(e,o,i+5,l+1,1,7),r(e,o,i+2,l+3,7,2),r(e,o,i+4,l+2,3,5)})}else t.state==="idle"&&!t.walking&&t.seed%3===0&&G(e,f,a,(o,i)=>{r(e,"#92400e",o+3,i+3,4,4),r(e,"#d97706",o+3,i+3,4,1),r(e,"#92400e",o+7,i+4,1,2),n&&r(e,"#9ca3af",o+4,i+1,1,1)})}function bt(e,t){for(let s=t.y;s<t.y+t.h;s++)for(let f=t.x;f<t.x+t.w;f++){let a=f*16,n=s*16,o=(f*73+s*151)%17;switch(t.floor){case"carpet":r(e,"#4c4f7a",a,n,16,16);for(let i=0;i<8;i++)r(e,i%2?"#55588a":"#454874",a+(f*7+i*5)%15,n+(s*3+i*7)%15,1,1);break;case"tile":r(e,(f+s)%2===0?"#d6dee8":"#c2ccd8",a,n,16,16),r(e,"#aab5c2",a,n+15,16,1),r(e,"#aab5c2",a+15,n,1,16),r(e,"#e8eef5",a+1,n+1,5,1);break;case"stone":r(e,o%3===0?"#8d93a3":"#9aa0b0",a,n,16,16),r(e,"#7a8090",a,n+15,16,1),r(e,"#7a8090",a+(s%2?7:15),n,1,15),r(e,"#adb3c2",a+2,n+2,3,1);break;case"concrete":r(e,"#6b7280",a,n,16,16);for(let i=0;i<5;i++)r(e,i%2?"#747b89":"#636a78",a+(f*11+i*3)%15,n+(s*5+i*5)%15,1,1);o===3&&r(e,"#596070",a+3,n+8,8,1);break;case"hall":{r(e,"#cfc8b8",a,n,16,16),r(e,"#bdb6a6",a,n+15,16,1),r(e,"#bdb6a6",a+15,n,1,16);let i=t.w>=t.h,l=i?s-t.y:f-t.x,u=i?t.h:t.w;i&&l===0&&r(e,"#7f6a55",a,n+12,16,4),i&&l===u-1&&r(e,"#7f6a55",a,n,16,4),!i&&l===0&&r(e,"#7f6a55",a+12,n,4,16),!i&&l===u-1&&r(e,"#7f6a55",a,n,4,16);break}case"grass":r(e,"#3f8f4f",a,n,16,16);for(let i=0;i<7;i++)r(e,i%3?"#4aa35c":"#347a43",a+(f*5+i*9)%15,n+(s*7+i*3)%14,1,2);break;default:{let i=s%2===0?"#a57448":"#9c6c42";r(e,i,a,n,16,16),r(e,"#8a5d36",a,n+7,16,1),r(e,"#8a5d36",a,n+15,16,1),r(e,"#8a5d36",a+(f*8+(s%2?8:0))%16,n,1,7),r(e,"#8a5d36",a+(f*8+(s%2?0:8))%16,n+8,1,7),r(e,"#b4835a",a+o%9+2,n+3,4,1),r(e,"#b4835a",a+o%7+4,n+11,3,1)}}}}var qe="#2a2d48",mt="#5c628f",V="#4a4f78",pt="#6d74a4";function yt(e,t,s){let f=t*16,a=s*16;r(e,(t+s)%2===0?"#4b8a4f":"#478549",f,a,16,16);let n=(t*73+s*151)%29;for(let o=0;o<4;o++)r(e,"#5a9b5c",f+(t*5+o*7)%15,a+(s*3+o*5)%15,1,2);n===4?(r(e,"#2f6a38",f+3,a+7,10,7),r(e,"#3c7f45",f+5,a+8,5,3)):n===11&&(r(e,"#5b3a22",f+7,a+10,2,5),r(e,"#24592e",f+2,a+1,12,10),r(e,"#2f6f3a",f+4,a+2,7,5))}function ht(e,t,s,f){let a=new Set;for(let o of t.rooms)for(let i=o.y;i<o.y+o.h;i++)for(let l=o.x;l<o.x+o.w;l++)a.add(`${l},${i}`);let n=new Set(t.doors.map(o=>`${o.x},${o.y}`));for(let o=0;o<t.rows;o++)for(let i=0;i<t.cols;i++){let l=`${i},${o}`;if(a.has(l)||n.has(l))continue;let u=i*16,b=o*16,w=(x,y)=>{for(let O=y-1;O<=y+1;O++)for(let W=x-1;W<=x+1;W++)if(a.has(`${W},${O}`)||n.has(`${W},${O}`))return!0;return!1};if(!w(i,o)){yt(e,i,o);continue}a.has(`${i},${o+1}`)?(r(e,mt,u,b,16,16),r(e,pt,u,b,16,1),r(e,V,u,b+12,16,4),r(e,s.primary,u,b+11,16,1),i%4===3&&!w(i,o-1)&&!t.furniture.some(x=>ee(t,x).wall&&x.x===i&&x.y===o)&&(r(e,"#1f2937",u+1,b+1,14,9),r(e,f.sky,u+2,b+2,12,7),r(e,$(f.sky,40),u+3,b+3,4,2),r(e,"#1f2937",u+8,b+2,1,7),f.night>.3&&(r(e,"#fef3c7",u+4,b+3,1,1),r(e,"#fef3c7",u+11,b+5,1,1)))):(r(e,qe,u,b,16,16),a.has(`${i},${o-1}`)&&r(e,"#20233a",u,b,16,3),a.has(`${i-1},${o}`)&&r(e,"#20233a",u,b,2,16),a.has(`${i+1},${o}`)&&r(e,"#20233a",u+14,b,2,16))}for(let o of t.doors){let i=o.x*16,l=o.y*16,u=a.has(`${o.x},${o.y-1}`)||a.has(`${o.x},${o.y+1}`);r(e,"#7c5637",i,l,16,16);for(let b=2;b<16;b+=4)r(e,"#6b4a2f",u?i:i+b,u?l+b:l,u?16:1,u?1:16);u?(r(e,V,i,l,2,16),r(e,V,i+14,l,2,16)):(r(e,V,i,l,16,2),r(e,V,i,l+14,16,2))}}function gt(e,t){e.font=q,e.textBaseline="top";for(let s of t.rooms){if(!s.name)continue;let f=s.name.toUpperCase(),a=Math.ceil(e.measureText(f).width)+6,n=s.x*16+3,o=s.y*16-13;r(e,"#1c1f33",n,o,a,10),r(e,"#2f3350",n+1,o+1,a-2,8),e.fillStyle="#f8fafc",e.fillText(f,n+3,o+1.5)}}function ve(e,t,s,f){r(e,qe,0,0,t.cols*16,t.rows*16);for(let a of t.rooms)bt(e,a);ht(e,t,s,f);for(let a of t.furniture)a.type==="rug"&&oe(t).furniture(e,a,t,0,s);for(let a of t.furniture)ee(t,a).wall&&oe(t).furniture(e,a,t,0,s);if(f.sun!=="rgba(0,0,0,0)"){e.fillStyle=f.sun;for(let a of t.rooms)for(let n=a.x;n<a.x+a.w;n++)n%4===3&&e.fillRect(n*16+2,a.y*16,12,Math.min(a.h,3)*16)}}function xt(e,t,s,f){e.font=q,e.textBaseline="top";let a=Math.ceil(e.measureText(t.name).width)+5,n=Math.round(Math.max(1,Math.min(f-a-1,t.x*16+8-a/2))),o=Math.round(t.y*16+16);e.fillStyle=s?"#ffffff":"rgba(17,24,39,0.82)",e.fillRect(n,o,a,10),e.fillStyle=s?"#111827":"#ffffff",e.fillText(t.name,n+2.5,o+1.5)}function kt(e,t,s){let f=[],a="";for(let n of t.split(/\s+/)){let o=a?`${a} ${n}`:n;e.measureText(o).width>s&&a?(f.push(a),a=n):a=o}return a&&f.push(a),f.slice(0,3)}var je={working:"Working",thinking:"Thinking",blocked:"Blocked",reviewing:"Reviewing",idle:"On a break",done:"Finished",away:"Away"};function Mt(e,t,s){e.font=ae,e.textBaseline="top";let f=s.rooms.find(u=>u.id===t.area),a=kt(e,t.task||je[t.state]||"",110),n=120,o=18+a.length*9+(f?9:0)+3,i=Math.round(Math.max(2,Math.min(s.cols*16-n-2,t.x*16+8-n/2))),l=Math.round(Math.max(2,t.y*16-o-24));r(e,E,i-1,l-1,n+2,o+2),r(e,"#ffffff",i,l,n,o),e.fillStyle="#111827",e.font=q,e.fillText(`${t.name}: ${je[t.state]??""}`.slice(0,28),i+4,l+4),e.fillStyle="#374151",e.font=ae,a.forEach((u,b)=>e.fillText(u,i+4,l+15+b*9)),f&&(e.fillStyle="#6b7280",e.fillText(`In ${f.name}`.slice(0,28),i+4,l+15+a.length*9))}function vt(e,t,s){if(t.tasks.length===0)return;let f=t.tasks.filter(n=>n.state==="done").length;e.font=q,e.textBaseline="top";let a=96;r(e,"rgba(17,24,39,0.85)",4,4,a,20),e.fillStyle="#ffffff",e.fillText(`${t.pack.words.quests} ${f}/${t.tasks.length}`,8,6.5),r(e,"#374151",8,16,a-8,4),r(e,s.primary,8,16,Math.round((a-8)*f/t.tasks.length),4)}function Ke(e,t,s,f,a,n,o){let i=t.cols*16,l=t.rows*16;n?e.drawImage(n,0,0,i,l):ve(e,t,f,a),t.showLinks&&t.links.length>0&&(t.routes??(t.routes=ge(t)),xe(e,t.routes,s));let u=oe(t),b=[];for(let y of t.furniture){let O=ee(t,y);O.solid!==!1&&b.push({depth:(y.y+O.h)*16-2,draw:()=>oe(t).furniture(e,y,t,s,f)})}let w=t.agents.filter(y=>y.state!=="away");for(let y of w)b.push({depth:y.y*16+14,draw:()=>dt(e,y,s,y.id===o)});b.sort((y,O)=>y.depth-O.depth);for(let y of b)y.draw();if(a.night>0){e.fillStyle=`rgba(12,14,48,${a.night})`,e.fillRect(0,0,i,l),e.save(),e.globalCompositeOperation="lighter";let y=(O,W,A,m)=>{let c=e.createRadialGradient(O,W,1,O,W,A);c.addColorStop(0,m),c.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=c,e.fillRect(O-A,W-A,A*2,A*2)};for(let O of t.furniture)u.glow(O,t,y);e.restore()}gt(e,t);for(let y of w)xt(e,y,y.id===o,i);for(let y of w)y.id!==o&&ct(e,y,s);vt(e,t,f);let x=w.find(y=>y.id===o);x&&Mt(e,x,t)}var wt=/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%/]+\)|hsla?\([\d\s.,%/a-z]+\))$/i,we=4;function Ot(e){let t=getComputedStyle(e),s=(f,a)=>{let n=t.getPropertyValue(f).trim();return wt.test(n)?n:a};return{primary:s("--blkc-color-primary","#3b82f6"),accent:s("--blkc-color-accent","#f59e0b"),background:s("--blkc-color-background","#1a1a2e"),text:s("--blkc-color-text","#ffffff")}}function Q(e,t={},s={}){let f=be(t),a=e.getContext("2d");if(!a)throw new Error("This browser can't draw to a canvas.");let n=a,o=Ot(e),i=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,l,u=0,b=0,w=0,x=0,y=!0,O=!1,W=!0,A,m={x:0,y:0,zoom:1},c=new Date().getHours(),h=Me(c),M,R=!0,T=()=>f.cols*16,D=()=>f.rows*16,H=()=>{m.zoom=Math.min(we,Math.max(1,m.zoom)),m.x=Math.min(T()-T()/m.zoom,Math.max(0,m.x)),m.y=Math.min(D()-D()/m.zoom,Math.max(0,m.y))},re=()=>{if(typeof document>"u")return;M??(M=document.createElement("canvas")),M.width=T()*u,M.height=D()*u;let p=M.getContext("2d");p&&(p.setTransform(u,0,0,u,0,0),p.imageSmoothingEnabled=!1,ve(p,f,o,h),R=!1)},g=()=>{R&&re();let p=u*m.zoom;n.setTransform(p,0,0,p,-m.x*p,-m.y*p),n.imageSmoothingEnabled=!1,Ke(n,f,b,o,h,M,l),A?.(n)},L=()=>{let p=e.getBoundingClientRect().width||T(),I=Math.max(1,Math.ceil(p*(typeof devicePixelRatio=="number"?devicePixelRatio:1)/T()));I===u&&e.width===T()*u&&e.height===D()*u||(u=I,e.width=T()*u,e.height=D()*u,R=!0,g())},S=p=>{if(O)return;if(x=requestAnimationFrame(S),!y){w=p;return}let C=Math.min((p-w)/1e3||0,.1);w=p,b+=C,ye(f,C);let I=new Date().getHours();I!==c&&(c=I,h=Me(c),R=!0),g()},z=p=>{l=p===l?void 0:p,s.onSelect?.(l),i&&g()},v=p=>{let C=e.getBoundingClientRect(),I=(p.clientX-C.left)/C.width*(T()/m.zoom)+m.x,_=(p.clientY-C.top)/C.height*(D()/m.zoom)+m.y;return{x:I/16,y:_/16}},k,F=p=>{W&&(k={x:p.clientX,y:p.clientY,moved:!1})},J=p=>{if(!W)return;if(k&&s.camera&&m.zoom>1){let _=e.getBoundingClientRect(),j=p.clientX-k.x,Ce=p.clientY-k.y;if(k.moved||Math.abs(j)+Math.abs(Ce)>3){k.moved=!0,m.x-=j/_.width*(T()/m.zoom),m.y-=Ce/_.height*(D()/m.zoom),k.x=p.clientX,k.y=p.clientY,H(),e.style.cursor="grabbing";return}}let{x:C,y:I}=v(p);e.style.cursor=ne(f,C,I)?"pointer":s.camera&&m.zoom>1?"grab":"default"},Oe=p=>{if(!W)return;let C=k?.moved;if(k=void 0,C)return;let{x:I,y:_}=v(p),j=ne(f,I,_);(j||l)&&z(j?.id??l)},Se=(p,C)=>{if(p===void 0){m.zoom=1,m.x=0,m.y=0;return}let I=C?v(C):{x:m.x/16+T()/m.zoom/16/2,y:m.y/16+D()/m.zoom/16/2};if(m.zoom=Math.min(we,Math.max(1,m.zoom*p)),C){let _=v(C);m.x+=(I.x-_.x)*16,m.y+=(I.y-_.y)*16}else m.x=I.x*16-T()/m.zoom/2,m.y=I.y*16-D()/m.zoom/2;H()},Ae=p=>{p.preventDefault(),Se(p.deltaY<0?1.2:1/1.2,p)};e.addEventListener("pointerdown",F),e.addEventListener("pointermove",J),e.addEventListener("pointerup",Oe),s.camera&&e.addEventListener("wheel",Ae,{passive:!1});let Le=typeof ResizeObserver=="function"?new ResizeObserver(L):void 0;Le?.observe(e);let Te=typeof IntersectionObserver=="function"?new IntersectionObserver(p=>{y=p.some(C=>C.isIntersecting)}):void 0;return Te?.observe(e),L(),u===0&&(u=1,g()),i||(x=requestAnimationFrame(S)),{world:f,update(p){he(f,p),i&&g()},setLayout(p){me(f,p),R=!0,m.zoom=Math.min(m.zoom,we),H(),u=0,L()},select:z,tileAt:v,setOverlay(p){A=p},setLinksVisible(p){f.showLinks=p,i&&g()},setInteractive(p){W=p,k=void 0,p||(e.style.cursor="crosshair")},zoom:Se,destroy(){O=!0,cancelAnimationFrame(x),Le?.disconnect(),Te?.disconnect(),e.removeEventListener("pointerdown",F),e.removeEventListener("pointermove",J),e.removeEventListener("pointerup",Oe),e.removeEventListener("wheel",Ae)}}}var Ve=new Map;function St(e,t){Ve.set(e,t)}function At(e,t,s){let f=[...s.querySelectorAll("button[data-blkc-agent]")],a=Q(e,t,{onSelect(n){for(let o of f)o.setAttribute("aria-pressed",String(o.dataset.blkcAgent===n))}});for(let n of f)n.disabled=!1,n.addEventListener("click",()=>a.select(n.dataset.blkcAgent));return a}St("office",At);var Ge=new WeakSet;function se(e=document){let t=[];for(let s of e.querySelectorAll("canvas[data-blkc-canvas]")){if(Ge.has(s))continue;let f=Ve.get(s.dataset.blkcCanvas??"");if(!f)continue;let a=s.closest("[data-blkc-canvas-root]")??s.parentElement??s,n=a.querySelector("script[data-blkc-canvas-data]"),o={};try{o=JSON.parse(n?.textContent||"{}")}catch{o={}}Ge.add(s);let i=f(s,o,a);t.push({element:s,destroy:()=>i.destroy()})}return t}globalThis.BLKCCanvas={FURNITURE:ce,createOffice:Q,findPath:Y,mountCanvasBlocks:se};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>se()):se();})();
|
|
2
2
|
/**
|
|
3
3
|
* BLKC Render-Canvas.
|
|
4
4
|
*
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/** What a Kit writes to describe an office. All of it is plain JSON. */
|
|
2
2
|
export type AgentState = "working" | "thinking" | "blocked" | "reviewing" | "idle" | "done" | "away";
|
|
3
3
|
export type TaskState = "todo" | "doing" | "done";
|
|
4
|
-
export type FloorStyle = "wood" | "carpet" | "tile";
|
|
5
|
-
export type
|
|
4
|
+
export type FloorStyle = "wood" | "carpet" | "tile" | "stone" | "concrete" | "grass" | "hall";
|
|
5
|
+
export type OfficeFurnitureType = "desk" | "coffee" | "sofa" | "plant" | "fern" | "board" | "whiteboard" | "shelf" | "server" | "table" | "rug" | "water" | "arcade" | "fridge" | "printer" | "lamp" | "beanbag" | "tv" | "vending" | "clock" | "poster" | "trophy";
|
|
6
|
+
/** An office item, or whatever else the world defines. */
|
|
7
|
+
export type FurnitureType = OfficeFurnitureType | (string & {});
|
|
6
8
|
export interface OfficeRoom {
|
|
7
9
|
id?: string;
|
|
8
10
|
name?: string;
|
|
@@ -11,6 +13,8 @@ export interface OfficeRoom {
|
|
|
11
13
|
w: number;
|
|
12
14
|
h: number;
|
|
13
15
|
floor?: FloorStyle;
|
|
16
|
+
/** Project folders this room stands for, so agents go there when they work in them. */
|
|
17
|
+
paths?: string[];
|
|
14
18
|
}
|
|
15
19
|
export interface OfficeDoor {
|
|
16
20
|
x: number;
|
|
@@ -27,6 +31,8 @@ export interface OfficeAgent {
|
|
|
27
31
|
role?: string;
|
|
28
32
|
state?: AgentState;
|
|
29
33
|
task?: string;
|
|
34
|
+
/** The id of the room this agent is working in. */
|
|
35
|
+
area?: string;
|
|
30
36
|
/** Character colours. Anything left out is picked from the id. */
|
|
31
37
|
hair?: string;
|
|
32
38
|
skin?: string;
|
|
@@ -37,12 +43,23 @@ export interface OfficeTask {
|
|
|
37
43
|
state?: TaskState;
|
|
38
44
|
agent?: string;
|
|
39
45
|
}
|
|
40
|
-
|
|
46
|
+
/** `from` depends on `to`. */
|
|
47
|
+
export interface OfficeLink {
|
|
48
|
+
from: string;
|
|
49
|
+
to: string;
|
|
50
|
+
}
|
|
51
|
+
export interface OfficeLayout {
|
|
41
52
|
cols?: number;
|
|
42
53
|
rows?: number;
|
|
43
54
|
rooms?: OfficeRoom[];
|
|
44
55
|
doors?: OfficeDoor[];
|
|
45
56
|
furniture?: OfficeFurniture[];
|
|
57
|
+
/** How the rooms' code depends on each other. Drawn as lines between them. */
|
|
58
|
+
links?: OfficeLink[];
|
|
59
|
+
}
|
|
60
|
+
export interface OfficeScene extends OfficeLayout {
|
|
61
|
+
/** Which world to draw. The office if left out or unknown. */
|
|
62
|
+
world?: string;
|
|
46
63
|
agents?: OfficeAgent[];
|
|
47
64
|
tasks?: OfficeTask[];
|
|
48
65
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AACrG,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AACrG,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAC9F,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAC7G,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtH,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEhE,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AACD,MAAM,WAAW,UAAU;IAAG,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;AACpD,MAAM,WAAW,eAAe;IAAG,IAAI,EAAE,aAAa,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;AAC9E,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,UAAU;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;AAEhF,8BAA8B;AAC9B,MAAM,WAAW,UAAU;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;AAExD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;IAC9B,8EAA8E;IAC9E,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB"}
|
package/dist/world.d.ts
CHANGED
|
@@ -2,20 +2,14 @@
|
|
|
2
2
|
* The office as data: which tiles can be walked on, who is where, and where they are
|
|
3
3
|
* heading. Nothing in here touches a canvas, so all of it can be tested.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import { type ItemSpec, type WorldData } from "./pack.js";
|
|
6
|
+
import type { LinkRoute } from "./links.js";
|
|
7
|
+
import type { AgentState, FloorStyle, FurnitureType, OfficeDoor, OfficeFurniture, OfficeLayout, OfficeRoom, OfficeScene, TaskState } from "./types.js";
|
|
6
8
|
export declare const MAX_COLS = 64;
|
|
7
9
|
export declare const MAX_ROWS = 40;
|
|
8
|
-
export declare const WALK_SPEED =
|
|
9
|
-
/**
|
|
10
|
-
export declare const FURNITURE: Record<
|
|
11
|
-
w: number;
|
|
12
|
-
h: number;
|
|
13
|
-
solid?: boolean;
|
|
14
|
-
spot?: {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
10
|
+
export declare const WALK_SPEED = 4.5;
|
|
11
|
+
/** Footprints and uses, for the office. Other worlds bring their own. */
|
|
12
|
+
export declare const FURNITURE: Record<string, ItemSpec>;
|
|
19
13
|
export declare const DEFAULT_LAYOUT: {
|
|
20
14
|
cols: number;
|
|
21
15
|
rows: number;
|
|
@@ -24,12 +18,14 @@ export declare const DEFAULT_LAYOUT: {
|
|
|
24
18
|
furniture: OfficeFurniture[];
|
|
25
19
|
};
|
|
26
20
|
export interface Room {
|
|
21
|
+
id: string;
|
|
27
22
|
name: string;
|
|
28
23
|
x: number;
|
|
29
24
|
y: number;
|
|
30
25
|
w: number;
|
|
31
26
|
h: number;
|
|
32
27
|
floor: FloorStyle;
|
|
28
|
+
paths: string[];
|
|
33
29
|
}
|
|
34
30
|
export interface Item {
|
|
35
31
|
type: FurnitureType;
|
|
@@ -47,6 +43,9 @@ export interface Agent {
|
|
|
47
43
|
role: string;
|
|
48
44
|
state: AgentState;
|
|
49
45
|
task: string;
|
|
46
|
+
area: string;
|
|
47
|
+
/** Seconds of celebration left after finishing something. */
|
|
48
|
+
party: number;
|
|
50
49
|
hair: string;
|
|
51
50
|
skin: string;
|
|
52
51
|
shirt: string;
|
|
@@ -68,6 +67,15 @@ export interface Agent {
|
|
|
68
67
|
seed: number;
|
|
69
68
|
}
|
|
70
69
|
export interface World {
|
|
70
|
+
/** What this world is made of. */
|
|
71
|
+
pack: WorldData;
|
|
72
|
+
links: {
|
|
73
|
+
from: string;
|
|
74
|
+
to: string;
|
|
75
|
+
}[];
|
|
76
|
+
/** Worked out when first drawn, and again when the building changes. */
|
|
77
|
+
routes?: LinkRoute[];
|
|
78
|
+
showLinks: boolean;
|
|
71
79
|
cols: number;
|
|
72
80
|
rows: number;
|
|
73
81
|
rooms: Room[];
|
|
@@ -86,6 +94,10 @@ export interface World {
|
|
|
86
94
|
y: number;
|
|
87
95
|
}[];
|
|
88
96
|
};
|
|
97
|
+
seats: {
|
|
98
|
+
x: number;
|
|
99
|
+
y: number;
|
|
100
|
+
}[];
|
|
89
101
|
}
|
|
90
102
|
export declare function hash(text: string): number;
|
|
91
103
|
export declare function isWalkable(world: World, x: number, y: number): boolean;
|
|
@@ -100,9 +112,13 @@ export declare function findPath(world: World, from: {
|
|
|
100
112
|
x: number;
|
|
101
113
|
y: number;
|
|
102
114
|
}[] | null;
|
|
115
|
+
/** A piece of furniture's spec. Only items in the world's list get into a World. */
|
|
116
|
+
export declare const specOf: (world: Pick<World, "pack">, item: Item) => ItemSpec;
|
|
103
117
|
/** Build a world from a scene. Bad values are dropped or clamped, so it never throws. */
|
|
104
118
|
export declare function createWorld(scene?: OfficeScene): World;
|
|
105
|
-
/**
|
|
119
|
+
/** Change the building while everyone is in it. Anyone left inside a wall or a desk moves. */
|
|
120
|
+
export declare function applyLayout(world: World, layout: OfficeLayout): void;
|
|
121
|
+
/** Where this agent's current state wants it to be. */
|
|
106
122
|
export declare function goalFor(world: World, agent: Agent): {
|
|
107
123
|
x: number;
|
|
108
124
|
y: number;
|
package/dist/world.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../src/world.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAe,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAc,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../src/world.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA4B,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAe,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAc,SAAS,EAAE,MAAM,YAAY,CAAC;AAEhL,eAAO,MAAM,QAAQ,KAAK,CAAC;AAC3B,eAAO,MAAM,QAAQ,KAAK,CAAC;AAI3B,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B,yEAAyE;AACzE,eAAO,MAAM,SAAS,0BAAe,CAAC;AAMtC,eAAO,MAAM,cAAc;;;;;;CAAgB,CAAC;AAM5C,MAAM,WAAW,IAAI;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE;AAClI,MAAM,WAAW,IAAI;IAAG,IAAI,EAAE,aAAa,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;AACnE,MAAM,WAAW,IAAI;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAExE,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjC,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,KAAK;IACpB,kCAAkC;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtC,wEAAwE;IACxE,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,SAAS,EAAE,IAAI,EAAE,CAAC;IAClB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE;QAAE,MAAM,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAAC,KAAK,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;IACjF,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnC;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIzC;AAYD,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,6FAA6F;AAC7F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EAAE,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,IAAI,CA6BtI;AAiCD,oFAAoF;AACpF,eAAO,MAAM,MAAM,GAAI,OAAO,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,IAAI,KAAG,QAAmD,CAAC;AAiEpH,yFAAyF;AACzF,wBAAgB,WAAW,CAAC,KAAK,GAAE,WAAgB,GAAG,KAAK,CAW1D;AAED,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAcpE;AAkDD,uDAAuD;AACvD,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAuBxF;AAaD,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,KAAG,OAEqE,CAAC;AAQ9G,gDAAgD;AAChD,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAoCnD;AAED,6FAA6F;AAC7F,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,IAAI,CAqC5F;AAED,yDAAyD;AACzD,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAc7E"}
|