{"version":3,"sources":["env.mjs"],"sourcesContent":["// WHICH KUBICOR THIS IS: dev, where friends play with test payments, or production, the public game (PLAT-05).\n//\n// Every value that differs between the two lives here and nowhere else, so standing up production means filling in\n// the `prod` entry below rather than hunting through the code for hardcoded project ids. Byte-identical in public/,\n// functions/lib/ and zone-server/lib/ (generate-version-hash.js holds them equal). The page picks its environment by\n// the address it was loaded from, the functions and the zone server by the project they run in.\n//\n// NOTHING HERE IS SECRET. A web app's Firebase config is public by design: it names the project, and the security\n// rules decide what anyone may do. Secret keys live in Secret Manager (functions/payments.js).\n\nconst DEV = Object.freeze({\n  name: 'dev',\n  projectId: 'kubicor-dev-dc525',\n  database: 'kubicor-dev',                 // the NAMED Firestore database, not \"(default)\"\n  site: 'https://dev.kubicor.com',\n  hosts: Object.freeze(['dev.kubicor.com', 'kubicor-dev-dc525.web.app', 'kubicor-dev-dc525.firebaseapp.com']),\n  firebase: Object.freeze({\n    apiKey: 'AIzaSyBBEo3D-tzDmYDc3jVZGAFHY7_65HxHwYM',\n    authDomain: 'kubicor-dev-dc525.firebaseapp.com',\n    projectId: 'kubicor-dev-dc525',\n    storageBucket: 'kubicor-dev-dc525.firebasestorage.app',\n    messagingSenderId: '381329133064',\n    appId: '1:381329133064:web:004d56de2c402947144bbd',\n    measurementId: 'G-QX1CTMX4EF',\n  }),\n  zones: Object.freeze({\n    primary: 'wss://zone-dev.kubicor.com',                   // node + Caddy on a GCE e2-micro\n    standby: 'wss://kubicor-zone-3dcvkgyrea-uc.a.run.app',   // the original Cloud Run service\n  }),\n  // THE CARD RENDERER (card-render/): the game itself, headless, picturing worlds for link previews and thumbnails.\n  cardRender: 'https://kubicor-card-3dcvkgyrea-uc.a.run.app',\n  // …AND WHERE ITS PICTURES ARE KEPT, as anyone fetches them (the owner's play review 2, Oct 24, c4): the cards bucket's own\n  // address. A claim's list thumbnail is at <this>/t1/<world>/<face>-<rev>.png (functions/card-tasks.js thumbPubKey), read\n  // straight from Google's edge while infra.publicPictures is on.\n  cardPictures: 'https://storage.googleapis.com/kubicor-dev-dc525-cards',\n  livePayments: false,                     // a live Stripe key is refused here (functions/payments.js)\n  // WHO EMAIL COMES FROM (Kubicor Emails, Oct 11: the owner chose the root domain, for dev and production alike). No\n  // mailbox answers it: every email says to reply in the game (functions/lib/email-templates.mjs FOOTER_HELP).\n  emailFrom: 'Kubicor <noreply@kubicor.com>',\n  // APP CHECK (PLAT-07). The reCAPTCHA Enterprise site key the page gets its App Check tokens with (public, like the\n  // web config above; `node tools/appcheck.mjs setup` makes it), and whether the callables refuse a call that has no\n  // valid token. Off until `node tools/appcheck.mjs report` shows a week of signed-in calls that all carried one.\n  appCheck: Object.freeze({ siteKey: '6Lfq2s0tAAAAAINs5Hdm5AzzXstz98IcYaQszuBx', enforce: false }),\n  // THE INFRASTRUCTURE SWITCHES (the owner's play review, Oct 23, cost c1, c4, c7, c8). Each is built and tested, and each\n  // waits on a cloud change only the owner may make (a queue, a role, a Cloud Run flag, a deploy order), so each is OFF\n  // here until that change is in place; turning one on is this one line, deployed. RUNBOOK.md \"Infrastructure switches\"\n  // lists what each needs first.\n  infra: Object.freeze({\n    // c1: presence is the zone server's (it writes presence/{uid} when a player joins a world and deletes it when they\n    // leave), and a page writes its own only while it has no socket (parked, on the map), on a lease, not a 5 s beat.\n    presenceOnZone: true,\n    // c4: the Cloud Tasks queue that orders the card renderer's batches (functions/card-tasks.js), so kubicor-card can run\n    // with request-billed CPU. null: the old order, answered at once and drawn after (needs --no-cpu-throttling).\n    cardQueue: 'card-render',\n    // c7: the sweeps are scheduled for the moment something is due (functions/due-tasks.js), the polls kept hourly as a net.\n    dueTasks: true,\n    // c8: the page calls the six grouped services (functions/call-groups.js) instead of one function per call.\n    callGroups: 'only',\n    // c4 (play review 2, Oct 24): thumbnails from the cards bucket's public address (cardPictures above), /render-card only\n    // on a miss. Off until the bucket is readable by anyone (allUsers, roles/storage.legacyObjectReader: get, never list).\n    publicPictures: false,\n  }),\n});\n\n// PRODUCTION: filled in once its Firebase project exists (PLAT-05). Until then every address and every project is\n// treated as dev, which is safe: nothing can reach production data that is not there yet.\nconst PROD = null;\n\nexport const ENVIRONMENTS = Object.freeze({ dev: DEV, prod: PROD });\n\n// The one rule, pure so it can be tested with a production entry that does not exist yet.\nexport function pickEnv(envs, { hostname, projectId } = {}) {\n  const p = envs.prod;\n  if (p && hostname != null && p.hosts.includes(String(hostname).toLowerCase())) return p;\n  if (p && projectId != null && p.projectId === String(projectId)) return p;\n  return envs.dev;          // dev's own addresses, localhost, the emulator's demo project, and anything unknown\n}\nexport const envForHost = (hostname) => pickEnv(ENVIRONMENTS, { hostname });\nexport const envForProject = (projectId) => pickEnv(ENVIRONMENTS, { projectId });\n"],"mappings":"AAUA,MAAM,IAAM,OAAO,OAAO,CACxB,KAAM,MACN,UAAW,oBACX,SAAU,cACV,KAAM,0BACN,MAAO,OAAO,OAAO,CAAC,kBAAmB,4BAA6B,mCAAmC,CAAC,EAC1G,SAAU,OAAO,OAAO,CACtB,OAAQ,0CACR,WAAY,oCACZ,UAAW,oBACX,cAAe,wCACf,kBAAmB,eACnB,MAAO,4CACP,cAAe,cACjB,CAAC,EACD,MAAO,OAAO,OAAO,CACnB,QAAS,6BACT,QAAS,4CACX,CAAC,EAED,WAAY,+CAIZ,aAAc,yDACd,aAAc,GAGd,UAAW,gCAIX,SAAU,OAAO,OAAO,CAAE,QAAS,2CAA4C,QAAS,EAAM,CAAC,EAK/F,MAAO,OAAO,OAAO,CAGnB,eAAgB,GAGhB,UAAW,cAEX,SAAU,GAEV,WAAY,OAGZ,eAAgB,EAClB,CAAC,CACH,CAAC,EAIK,KAAO,KAEN,aAAM,aAAe,OAAO,OAAO,CAAE,IAAK,IAAK,KAAM,IAAK,CAAC,EAG3D,gBAAS,QAAQ,KAAM,CAAE,SAAU,SAAU,EAAI,CAAC,EAAG,CAC1D,MAAM,EAAI,KAAK,KAEf,OADI,GAAK,UAAY,MAAQ,EAAE,MAAM,SAAS,OAAO,QAAQ,EAAE,YAAY,CAAC,GACxE,GAAK,WAAa,MAAQ,EAAE,YAAc,OAAO,SAAS,EAAU,EACjE,KAAK,GACd,CACO,aAAM,WAAc,UAAa,QAAQ,aAAc,CAAE,QAAS,CAAC,EAC7D,cAAiB,WAAc,QAAQ,aAAc,CAAE,SAAU,CAAC","names":[],"file":"env.mjs"}