import { randomUUID } from "node:crypto";
import { escapeHtml as esc } from "./html.mjs";
import { communicationAssets, layoutWorkbench } from "./layout-workbench.mjs";
import { embeddedLayout, previewTheme } from "./shell.mjs";
const people = {
mara: ["Mara Lind", "ML", "clay"],
julian: ["Julian Park", "JP", "moss"],
iris: ["Iris Chen", "IC", "sky"],
sofia: ["Sofia Bell", "SB", "rose"],
theo: ["Theo Sato", "TS", "sand"],
you: ["You", "YO", "neutral"],
};
const mail = [
{ id:"proofs", person:"mara", subject:"The Field Notes proofs are in", time:"09:41", date:"Today", preview:"We’ve got the first set back from the printer.", body:["Hi team,", "We’ve got the first set back from the printer. The warm grey stock gives the cover photograph a softer edge. I’d keep it uncoated.", "Can we lock the paper choice before Thursday’s press check?", "Mara"], tag:"Field Notes" },
{ id:"materials", person:"julian", subject:"Material library update", time:"08:26", date:"Today", preview:"Two new finishes for the Arc collection.", body:["Morning,", "Two new finishes for the Arc collection arrived today. I’ve set aside a sample of each on the studio table.", "Drop by when you have a moment. I’d love a second pair of eyes on the brushed finish."], tag:"Materials" },
{ id:"bookings", person:"iris", subject:"November studio bookings", time:"Tue", date:"Tuesday", preview:"Here’s the revised plan for shoot week.", body:["Hi everyone,", "Here’s the revised plan for shoot week. Tuesday is reserved for product stills and Wednesday for the oak series.", "The studio is free again on Thursday afternoon."], tag:"Operations" },
{ id:"packing", person:"sofia", subject:"A note on the new packaging", time:"Mon", date:"Monday", preview:"The test cartons held up on their first trip.", body:["A quick update from dispatch. The test cartons held up on their first trip. All twelve pieces arrived in good order.", "I’ll bring the packing samples to our next review."], tag:"Dispatch" },
{ id:"samples", person:"theo", subject:"Archive shelf inventory", time:"Fri", date:"Friday", preview:"The sample shelf is ready for the handover.", body:["The sample shelf is ready for the handover. I’ve counted each finish and put a reference card in every tray.", "Thanks for helping with the labels."], tag:"Archive" },
];
const channels = [
{ id:"studio-floor", name:"studio-floor", description:"Daily work from the studio", members:["mara","julian","iris"], messages:[
["mara","09:32","The Field Notes proofs are on the big table. Here’s the cover photograph for reference."],
["julian","09:35","I put the oak and graphite samples beside them, so we can check all three together."],
["iris","09:41","I’ll take a look before the press check. Thanks for laying those out!"],
] },
{ id:"design-review", name:"design-review", description:"Materials, finishes and open design questions", members:["iris","theo","mara"], messages:[
["iris","10:12","The brushed finish is catching the light better than yesterday’s sample."],
["theo","10:18","Agreed. I’ll add it to the review tray with the original so we have a direct comparison."],
] },
{ id:"dispatch", name:"dispatch", description:"Shipping, packing and delivery updates", members:["sofia","julian"], messages:[
["sofia","08:15","All twelve pieces arrived safely. The new inserts did their job."],
["julian","08:22","That’s good to hear. Let’s use the same packing for the next run."],
] },
];
const directs = [
{ id:"mara", name:"Mara Lind", description:"Direct conversation", members:["mara"], messages:[["mara","09:14","Could you bring the paper swatches to Thursday’s press check?"]] },
{ id:"theo", name:"Theo Sato", description:"Direct conversation", members:["theo"], messages:[["theo","08:52","The reference cards are ready. I left them on your desk."]] },
];
const rooms = [...channels,...directs];
const paths = {
mail:'',
chat:'',
archive:'',
inbox:'',
download:'',
back:'', send:'',
reply:'', hash:'',
};
function icon(key) {
return ``;
}
function avatar(person, small = false) {
const [,initials,color] = people[person];
return `${initials}`;
}
function appUrl(screen, params = {}, fragment = false) {
const query = new URLSearchParams(Object.entries(params).filter(([,v])=>v));
return (fragment ? "/demo/layouts/" : "/layouts/") + screen + (query.size ? "?" + query : "");
}
function navigate(screen, params) {
const url=esc(appUrl(screen,params));
return `href="${url}" hx-get="${esc(appUrl(screen,params,true))}" hx-push-url="${url}"`;
}
function formAction(screen, action) {
const url = `/demo/layouts/${screen}/${action}`;
return `method="post" action="${url}" hx-post="${url}"`;
}
function hidden(name,value) { return ``; }
function feedback(error) { return `