gamestage 0.35.36 → 0.35.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.mjs +7 -6
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -105,7 +105,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
105
105
  `+f.slice(K,J),K=J+1),D=te;return le+=`
106
106
  `,f.length-K>A&&D>K?le+=f.slice(K,D)+`
107
107
  `+f.slice(D+1):le+=f.slice(K),le.slice(1)}function Ut(f){let A="",P=0;for(let B=0;B<f.length;P>=65536?B+=2:B++){P=St(f,B);let K=he[P];!K&&ot(P)?(A+=f[B],P>=65536&&(A+=f[B+1])):A+=K||je(P)}return A}function Ro(f,A,P){let B="",K=f.tag;for(let J=0,D=P.length;J<D;J+=1){let te=P[J];f.replacer&&(te=f.replacer.call(P,String(J),te)),(T(f,A,te,!1,!1)||typeof te>"u"&&T(f,A,null,!1,!1))&&(B!==""&&(B+=","+(f.condenseFlow?"":" ")),B+=f.dump)}f.tag=K,f.dump="["+B+"]"}function xn(f,A,P,B){let K="",J=f.tag;for(let D=0,te=P.length;D<te;D+=1){let le=P[D];f.replacer&&(le=f.replacer.call(P,String(D),le)),(T(f,A+1,le,!0,!0,!1,!0)||typeof le>"u"&&T(f,A+1,null,!0,!0,!1,!0))&&((!B||K!=="")&&(K+=Xe(f,A)),f.dump&&s===f.dump.charCodeAt(0)?K+="-":K+="- ",K+=f.dump)}f.tag=J,f.dump=K||"[]"}function se(f,A,P){let B="",K=f.tag,J=Object.keys(P);for(let D=0,te=J.length;D<te;D+=1){let le="";B!==""&&(le+=", "),f.condenseFlow&&(le+='"');let me=J[D],pe=P[me];f.replacer&&(pe=f.replacer.call(P,me,pe)),T(f,A,me,!1,!1)&&(f.dump.length>1024&&(le+="? "),le+=f.dump+(f.condenseFlow?'"':"")+":"+(f.condenseFlow?"":" "),T(f,A,pe,!1,!1)&&(le+=f.dump,B+=le))}f.tag=K,f.dump="{"+B+"}"}function Tt(f,A,P,B){let K="",J=f.tag,D=Object.keys(P);if(f.sortKeys===!0)D.sort();else if(typeof f.sortKeys=="function")D.sort(f.sortKeys);else if(f.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let te=0,le=D.length;te<le;te+=1){let me="";(!B||K!=="")&&(me+=Xe(f,A));let pe=D[te],ge=P[pe];if(f.replacer&&(ge=f.replacer.call(P,pe,ge)),!T(f,A+1,pe,!0,!0,!0))continue;let be=f.tag!==null&&f.tag!=="?"||f.dump&&f.dump.length>1024;be&&(f.dump&&s===f.dump.charCodeAt(0)?me+="?":me+="? "),me+=f.dump,be&&(me+=Xe(f,A)),T(f,A+1,ge,!0,be)&&(f.dump&&s===f.dump.charCodeAt(0)?me+=":":me+=": ",me+=f.dump,K+=me)}f.tag=J,f.dump=K||"{}"}function m(f,A,P){let B=P?f.explicitTypes:f.implicitTypes;for(let K=0,J=B.length;K<J;K+=1){let D=B[K];if((D.instanceOf||D.predicate)&&(!D.instanceOf||typeof A=="object"&&A instanceof D.instanceOf)&&(!D.predicate||D.predicate(A))){if(P?D.multi&&D.representName?f.tag=D.representName(A):f.tag=D.tag:f.tag="?",D.represent){let te=f.styleMap[D.tag]||D.defaultStyle,le;if(r.call(D.represent)==="[object Function]")le=D.represent(A,te);else if(n.call(D.represent,te))le=D.represent[te](A,te);else throw new t("!<"+D.tag+'> tag resolver accepts not "'+te+'" style');f.dump=le}return!0}}return!1}function T(f,A,P,B,K,J,D){f.tag=null,f.dump=P,m(f,P,!1)||m(f,P,!0);let te=r.call(f.dump),le=B;B&&(B=f.flowLevel<0||f.flowLevel>A);let me=te==="[object Object]"||te==="[object Array]",pe,ge;if(me&&(pe=f.duplicates.indexOf(P),ge=pe!==-1),(f.tag!==null&&f.tag!=="?"||ge||f.indent!==2&&A>0)&&(K=!1),ge&&f.usedDuplicates[pe])f.dump="*ref_"+pe;else{if(me&&ge&&!f.usedDuplicates[pe]&&(f.usedDuplicates[pe]=!0),te==="[object Object]")B&&Object.keys(f.dump).length!==0?(Tt(f,A,f.dump,K),ge&&(f.dump="&ref_"+pe+f.dump)):(se(f,A,f.dump),ge&&(f.dump="&ref_"+pe+" "+f.dump));else if(te==="[object Array]")B&&f.dump.length!==0?(f.noArrayIndent&&!D&&A>0?xn(f,A-1,f.dump,K):xn(f,A,f.dump,K),ge&&(f.dump="&ref_"+pe+f.dump)):(Ro(f,A,f.dump),ge&&(f.dump="&ref_"+pe+" "+f.dump));else if(te==="[object String]")f.tag!=="?"&&Po(f,f.dump,A,J,le);else{if(te==="[object Undefined]")return!1;if(f.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+te)}if(f.tag!==null&&f.tag!=="?"){let be=encodeURI(f.tag[0]==="!"?f.tag.slice(1):f.tag).replace(/!/g,"%21");f.tag[0]==="!"?be="!"+be:be.slice(0,18)==="tag:yaml.org,2002:"?be="!!"+be.slice(18):be="!<"+be+">",f.dump=be+" "+f.dump}}return!0}function M(f,A){let P=[],B=[];F(f,P,B);let K=B.length;for(let J=0;J<K;J+=1)A.duplicates.push(P[B[J]]);A.usedDuplicates=new Array(K)}function F(f,A,P){if(f!==null&&typeof f=="object"){let B=A.indexOf(f);if(B!==-1)P.indexOf(B)===-1&&P.push(B);else if(A.push(f),Array.isArray(f))for(let K=0,J=f.length;K<J;K+=1)F(f[K],A,P);else{let K=Object.keys(f);for(let J=0,D=K.length;J<D;J+=1)F(f[K[J]],A,P)}}}function N(f,A){A=A||{};let P=new vn(A);P.noRefs||M(f,P);let B=f;return P.replacer&&(B=P.replacer.call({"":B},"",B)),T(P,0,B,!0,!0)?P.dump+`
108
- `:""}return Ty.dump=N,Ty}function YR(){if(O0)return lt;O0=1;let e=HR(),t=KR();function o(r,n){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}return lt.Type=vt(),lt.Schema=R0(),lt.FAILSAFE_SCHEMA=L0(),lt.JSON_SCHEMA=G0(),lt.CORE_SCHEMA=B0(),lt.DEFAULT_SCHEMA=Ey(),lt.load=e.load,lt.loadAll=e.loadAll,lt.dump=t.dump,lt.YAMLException=Ai(),lt.types={binary:H0(),float:U0(),map:j0(),null:D0(),pairs:Y0(),set:V0(),timestamp:q0(),bool:M0(),int:F0(),merge:W0(),omap:K0(),seq:N0(),str:z0()},lt.safeLoad=o("safeLoad","load"),lt.safeLoadAll=o("safeLoadAll","loadAll"),lt.safeDump=o("safeDump","dump"),lt}var lt,El,mo,c0,ry,l0,ay,d0,iy,u0,sy,m0,cy,p0,ly,h0,dy,f0,uy,g0,my,y0,py,b0,hy,v0,fy,w0,gy,k0,yy,_0,by,x0,vy,S0,wy,T0,ky,E0,_y,$0,xy,A0,Sy,C0,I0,Ty,P0,O0,VR,Mt,E3,$3,A3,C3,I3,P3,Z0,O3,R3,z3,N3,j3,L3,D3,Ci=b(()=>{lt={},El={},mo={};Ty={};VR=YR(),Mt=qR(VR),{Type:E3,Schema:$3,FAILSAFE_SCHEMA:A3,JSON_SCHEMA:C3,CORE_SCHEMA:I3,DEFAULT_SCHEMA:P3,load:Z0,loadAll:O3,dump:R3,YAMLException:z3,types:N3,safeLoad:j3,safeLoadAll:L3,safeDump:D3}=Mt});function Pn(e){let t;try{t=Mt.load(e,{schema:JR})}catch(n){return{ok:!1,issues:[{path:"(document)",message:n instanceof Error?n.message:"YAML parse failed"}]}}if(t===null||typeof t!="object")return{ok:!1,issues:[{path:"(document)",message:"Manifest must be a YAML mapping"}]};let o=uo.safeParse(t);if(!o.success)return{ok:!1,issues:XR(o.error)};let r=s0(o.data);return r.length?{ok:!1,issues:r}:{ok:!0,manifest:o.data}}function XR(e){return e.issues.map(t=>({path:t.path.length?t.path.join("."):"(root)",message:t.message}))}function Ii(e){return Mt.dump(e,{indent:2,lineWidth:100,noRefs:!0,sortKeys:!1})}function $l(e,t){return uo.parse({manifest:{schema_version:Ti,revision:0,conformance:"L0"},app:{id:e,title:t,status:"proposed"}})}var ZR,JR,Kr=b(()=>{"use strict";Ci();sn();({merge:ZR}=Mt.types),JR=Mt.CORE_SCHEMA.extend({implicit:[ZR]})});function Ay(e){return QR.map(t=>{let o=e?.assurance?.[t.key];if(o===void 0)return{...t};let r=oy.safeParse(o);if(r.success)return{...t,record:r.data};let n=r.error.issues.map(a=>`${["assurance",t.key,...a.path].join(".")}: ${a.message}`).join("; ");return{...t,problem:n}})}var QR,$y,J0,X0=b(()=>{"use strict";sn();Kr();QR=[{key:"accessibility",label:"Accessibility",command:"npx skills add addyosmani/web-quality-skills@accessibility",about:"A WCAG 2.2 audit skill: runs Lighthouse or axe on the page, then checks what automated tools miss."},{key:"security",label:"Security review",command:"npx skills add getsentry/skills@security-review",about:"Sentry's review skill, built on OWASP guidance. Reports only findings it can trace to input an attacker controls."},{key:"secrets",label:"Secrets",command:"gitleaks detect --source .",about:"The open-source gitleaks scanner: finds API keys and tokens committed to the game. Install it from github.com/gitleaks/gitleaks."},{key:"privacy",label:"Privacy",command:"npx skills add wshobson/agents@gdpr-data-handling",about:"A GDPR skill covering consent, legal basis, data requests and children's data."}],$y="Recorded by the creator, not checked or certified by Monterosa.";J0={passed:"Passed",issues_fixed:"Issues found and fixed",issues_open:"Issues still open"}});function Ct(e,t={}){let o=h=>({id:h.id,level:h.level,requirement:h.requirement,advice:h.advice,owner:h.owner,passed:h.check(e,t)}),r=Cy.filter(h=>h.checkable).map(o),n=Cy.filter(h=>!h.checkable).map(o),a="L0",i=!0;for(let h of Iy){let y=r.filter(I=>I.level===h);y.length>0&&y.every(I=>I.passed)&&i?a=h:i=!1}let s=r.filter(h=>h.level==="L0").every(h=>h.passed),d=co[a]+1,l=Iy[d],u=l?r.filter(h=>h.level===l&&!h.passed):[],p=e.manifest.conformance;return{computed:a,computedName:n0[a],claimed:p,overclaimed:!s||Math.min(co[p],co[Q0])>co[a],results:r,blockers:s?u:r.filter(h=>h.level==="L0"&&!h.passed),ceiling:Q0,advice:n}}function eT(e,t){let r=Ct(e).results.filter(n=>!n.passed&&co[n.level]<=co[t]);return{ok:r.length===0,missing:r}}var Ko,at,Cy,Iy,ez,K3,Q0,Al=b(()=>{"use strict";sn();Ko=(e,t,o)=>{let r=e[t];return ey[r?.status??"missing"]>=ey[o]},at=e=>typeof e=="string"?e.trim().length>0:e!=null,Cy=[{level:"L0",id:"L0.app.identity",checkable:!0,advice:"Give the game a name, and a short id we can use in web addresses.",owner:"creator",requirement:"app.id and app.title are set",check:e=>at(e.app.id)&&at(e.app.title)},{level:"L0",id:"L0.app.status",checkable:!0,advice:"Mark the game as started.",owner:"creator",requirement:"app section is at least proposed",check:e=>Ko(e,"app","proposed")},{level:"L0",id:"L0.schema.version",checkable:!0,advice:"The version of the format this game is described in. Set when the game was created.",owner:"creator",requirement:"manifest.schema_version is set",check:e=>at(e.manifest.schema_version)},{level:"L1",id:"L1.experience.defined",checkable:!0,advice:"Describe the screens in the game.",owner:"creator",requirement:"experience declares a screen graph or at least one player surface",check:e=>at(e.experience.screen_graph)||e.experience.surfaces.length>0},{level:"L1",id:"L1.experience.status",checkable:!0,advice:"Mark the design as started.",owner:"creator",requirement:"experience section is at least proposed",check:e=>Ko(e,"experience","proposed")},{level:"L1",id:"L1.backend.route",checkable:!0,advice:"Choose which engine runs the game: one we manage, or one you bring.",owner:"creator",requirement:"backend.route is chosen, so authority is decided before client code",check:e=>at(e.backend.route)},{level:"L2",id:"L2.backend.pinned",checkable:!0,advice:"Deploy the game. We record which engine answered.",owner:"creator",requirement:"a component is serving this game's rounds",check:(e,t)=>at(t.backendComponent)||at(e.backend.component)&&at(e.backend.version)},{level:"L2",id:"L2.identity.policy",checkable:!0,advice:"Say how a fan signs in. If they don't sign in, say that. Gamestage does not provide sign-in, so this names the one a fan meets.",owner:"creator",requirement:"an identity provider is named",check:e=>at(e.identity.provider)},{level:"L2",id:"L2.measurement.destination",checkable:!0,advice:"Switch on somewhere to send the data, on this game's Integrations tab. This checks the switch is on. Whether events are arriving is a separate question.",owner:"creator",requirement:"an analytics destination is switched on",check:(e,t)=>t.destinationsEnabled===!0||e.measurement.destinations.some(o=>o.enabled)},{level:"L2",id:"L2.platform.identifiers",checkable:!0,advice:"Deploy the game. That puts it on Monterosa's platform and gives you a place to manage content.",owner:"creator",requirement:"the game exists on Interaction Cloud",check:(e,t)=>at(t.platformProject)||at(e.studio_app.spec_url)||at(e.interaction_cloud.project_id)},{level:"L3",id:"L3.deployment.space",checkable:!0,advice:"Deploy the game with a URL.",owner:"creator",requirement:"the game is deployed somewhere a fan can reach",check:(e,t)=>at(t.playgroundUrl)||at(e.deployment.space_spec)&&e.deployment.environments.some(o=>o!=="local")},{level:"L3",id:"L3.surface.declared",checkable:!1,advice:"Say what the person running your game can change: rounds, wording, or both.",owner:"creator",requirement:"a Studio Surface family is declared for operator control",check:e=>at(e.studio_surface.family)},{level:"L3",id:"L3.sections.confirmed",checkable:!1,advice:"Mark which parts you have finished: the play, the scoring, and the hosting.",owner:"creator",requirement:"experience, backend and deployment are all confirmed or better",check:e=>Ko(e,"experience","confirmed")&&Ko(e,"backend","confirmed")&&Ko(e,"deployment","confirmed")},{level:"L4",id:"L4.sections.verified",checkable:!1,advice:"Link proof it works: a play-through recording, or a test result.",owner:"creator",requirement:"experience, backend, identity and deployment are verified with evidence attached",check:e=>["experience","backend","identity","deployment"].every(t=>Ko(e,t,"verified")&&e[t].provenance.length>0)},{level:"L4",id:"L4.operations.runbook",checkable:!1,advice:"Name who to call when it breaks, and link the instructions they follow.",owner:"creator",requirement:"operations declares a support tier and a runbook",check:e=>at(e.operations.support_tier)&&at(e.operations.runbook)},{level:"L5",id:"L5.production.approved",checkable:!1,advice:"Approve the game for prod, and move your workspace onto a paid plan. Monterosa does the second part.",owner:"monterosa",requirement:"the manifest is approved and deployed to a production environment",check:e=>Ko(e,"operations","approved")&&e.deployment.environments.includes("production")}],Iy=["L0","L1","L2","L3","L4","L5"],ez=[{level:"L0",name:"Concept",means:"the game has a name and a description we hold for it"},{level:"L1",name:"Experience built",means:"there is something to play, and scoring runs on our server rather than in the browser"},{level:"L2",name:"Wired to the platform",means:"it is set up on the Monterosa platform, knows who each player is, and sends its numbers to your analytics"},{level:"L3",name:"Fans can reach it",means:"it is deployed at an address a fan can open"},{level:"L4",name:"Production ready",means:"checked with evidence, with someone to call and a page saying what to do if it breaks"},{level:"L5",name:"Operating live",means:"reviewed with you, and running in production"}],K3=new Map(ez.map(e=>[e.level,e])),Q0=[...Iy].reverse().find(e=>Cy.some(t=>t.level===e&&t.checkable))??"L0"});var Py=b(()=>{"use strict";Kr();sn();Al()});var tT=b(()=>{"use strict"});function nT(e,t){let o=e.backend.archetype;if(!o)throw new Error("registerInputFromManifest needs backend.archetype. Run registrationProblems first.");return{id:e.app.id,name:e.app.title,archetype:o,repository:e.app.source?.repository??null,manifestRevision:String(e.manifest.revision),contentHash:t,conformance:Ct(e).computed,offersPrize:e.operations.promotion.offers_prize,containerLabel:e.experience.container_label,sections:Hr.map(r=>({section:r,status:e[r].status}))}}function oT(e,t){let o=[];return t&&e.app.id!==t&&o.push(`This manifest is for the game "${e.app.id}", and you are editing "${t}". A manifest cannot change which game it belongs to: set app.id to "${t}", or register "${e.app.id}" as its own game.`),e.backend.archetype||o.push("This manifest declares no backend.archetype, so there is nothing to register. The control plane keys a game on its archetype and a game without one could never be deployed against."),o}var rT=b(()=>{"use strict";Al();Kr();sn()});var Re,Pi,aT=b(()=>{"use strict";Re={runtime:"/play/v1/games/{game}/runtime",currentRound:"/play/v1/games/{game}/rounds/current",rounds:"/play/v1/games/{game}/rounds",roundsMine:"/play/v1/games/{game}/rounds/mine",nextRound:"/play/v1/games/{game}/rounds/next",round:"/play/v1/games/{game}/rounds/{round}",plays:"/play/v1/games/{game}/rounds/{round}/plays",session:"/play/v1/games/{game}/session",restoreSession:"/play/v1/games/{game}/session/restore",guestToken:"/play/v1/games/{game}/guest-token",roundState:"/play/v1/games/{game}/rounds/{round}/players/me",profile:"/play/v1/games/{game}/players/me/profile",identityOptions:"/play/v1/games/{game}/identity",identity:"/play/v1/games/{game}/players/me/identity",recoveryCode:"/play/v1/games/{game}/players/me/recovery-code",leaderboard:"/play/v1/games/{game}/leaderboard",editionLeaderboard:"/play/v1/games/{game}/leaderboard/edition"},Pi="/play"});function Cl(e,t,o={},r){let n=r?r.slice(0,10):void 0,a=e.last_played_day,i=n?new Date(Date.parse(`${n}T00:00:00Z`)-864e5).toISOString().slice(0,10):void 0,s=n===void 0?e.day_streak:a===n?e.day_streak??1:a===i?(e.day_streak??0)+1:1,d=t==="won"?e.current_streak+1:t==="lost"||t==="partial"?0:e.current_streak;return{...e,played:e.played+1,won:e.won+(t==="won"?1:0),current_streak:d,max_streak:Math.max(e.max_streak,d),exact:(e.exact??0)+(o.exact===!0?1:0),...s===void 0?{}:{day_streak:s},...n?{last_played_day:n}:a?{last_played_day:a}:{},...typeof o.score=="number"?{best_score:Math.max(e.best_score??o.score,o.score)}:e.best_score===void 0?{}:{best_score:e.best_score}}}var iT,Ht,tz,nz,oz,cq,cT,rz,az,lq,iz,dq,uq,mq,lT,sz,cz,pq,lz,dz,hq,sT,fq,gq,yq,dT,Oy=b(()=>{"use strict";Ye();sn();wl();aT();iT="2.0",Ht=c.object({server_time:c.string(),snapshot:c.string()}),tz=c.enum(["at_commit","at_settlement"]),nz=c.enum(["shared","per_player","feed"]),oz=c.object({kind:c.enum(["fixed","local_midnight","feed","continuous"]),timezone:c.string().optional()}),cq=Ht.extend({game:c.string(),api_version:c.literal(iT).default(iT),archetype:lo,marking:tz,challenge_source:nz,schedule:oz,updates:c.object({transport:c.enum(["poll","socket"]),freshness_seconds:c.number().int().positive()}),display:c.record(c.string(),c.unknown()).default({}),identity:c.object({required:c.boolean(),provider:c.string(),anonymous_play:c.boolean().default(!1)}),archive:c.boolean().default(!1),capabilities:c.array(c.string()).default([])}),cT=c.object({accepting_plays:c.boolean(),results_available:c.boolean(),solution_revealed:c.boolean(),closed:c.boolean(),optimistic_play:c.boolean().default(!1)}),rz=Ht.extend({id:c.string(),number:c.number().int().positive().optional(),origin:_i.optional(),version:c.number().int().nonnegative(),can:cT,opens_at:c.string().optional(),locks_at:c.string().optional(),timer_seconds:c.number().int().positive().optional(),challenge_instance_id:c.string().nullable().default(null),challenge:c.record(c.string(),c.unknown()).default({}),solution:c.record(c.string(),c.unknown()).optional()}),az=c.object({id:c.string(),number:c.number().int().positive().optional(),version:c.number().int().nonnegative(),can:cT,opens_at:c.string().optional(),locks_at:c.string().optional(),current:c.boolean().default(!1),theme:c.string().default("")}),lq=Ht.extend({rounds:c.array(az)}),iz=c.object({round_id:c.string(),finished:c.boolean(),score:c.number(),last_played_at:c.string().optional(),outcome:c.enum(["won","lost","partial","incomplete","pending"]).optional()}),dq=Ht.extend({player_id:c.string(),played:c.array(iz)}),uq=Ht.extend({status:c.enum(["ready","exhausted"]),round:rz.optional()}),mq=Ht.extend({token:c.string(),player_id:c.string(),kind:c.literal("anonymous")}),lT=c.object({idempotency_key:c.string().min(8),round_version:c.number().int().nonnegative(),challenge_instance_id:c.string().nullable().default(null),payload:c.record(c.string(),c.unknown()).refine(e=>e.op===void 0||typeof e.op=="string"&&e.op.length>0,{message:"op must be a non-empty string when present",path:["op"]})}),sz=c.enum(["accepted","rejected","duplicate","stale","busy"]),cz=c.object({key:c.string(),verdict:c.enum(["correct","close","wrong","higher","lower","unknown"]),label:c.string().optional()}),pq=Ht.extend({play_id:c.string(),outcome:sz,reason:c.string().optional(),round_version:c.number().int().nonnegative(),retry_after_seconds:c.number().int().positive().optional(),marked:c.boolean().default(!0),feedback:c.array(cz).default([]),round_state:c.lazy(()=>dz).optional()}),lz=c.object({title:c.string(),grid:c.array(c.string()).default([]),text:c.string().optional()}),dz=Ht.extend({player_id:c.string(),round_id:c.string(),started_at:c.string().optional(),attempts_used:c.number().int().nonnegative().default(0),attempts_allowed:c.number().int().nonnegative().optional(),mistakes_used:c.number().int().nonnegative().default(0),mistakes_allowed:c.number().int().nonnegative().optional(),progress:c.record(c.string(),c.unknown()).default({}),score:c.number().default(0),score_revision:c.number().int().nonnegative().default(0),finished:c.boolean().default(!1),outcome:c.enum(["won","lost","partial","incomplete","pending"]).optional(),share:lz.optional()}),hq=Ht.extend({player_id:c.string(),display_name:c.string().optional(),avatar:c.string().optional(),avatar_url:c.string().optional(),played:c.number().int().nonnegative().default(0),won:c.number().int().nonnegative().default(0),current_streak:c.number().int().nonnegative().default(0),max_streak:c.number().int().nonnegative().default(0),exact:c.number().int().nonnegative().optional(),best_score:c.number().optional(),day_streak:c.number().int().nonnegative().optional(),last_played_day:c.string().optional(),distribution:c.record(c.string(),c.number()).default({}),constraints:c.record(c.string(),c.unknown()).default({})});sT=c.object({rank:c.number().int().positive(),player_id:c.string(),display_name:c.string().optional(),avatar:c.string().optional(),avatar_url:c.string().optional(),exact:c.boolean().optional(),score:c.number()}),fq=Ht.extend({round_id:c.string().optional(),scope:c.enum(["round","edition"]).optional(),edition_id:c.string().optional(),order:c.enum(["high_first","low_first"]).default("high_first"),tie_break:c.enum(["earliest_play","fewest_attempts","none"]).default("none"),entries:c.array(sT).default([]),total:c.number().int().nonnegative().default(0),truncated:c.boolean().default(!1),me:sT.optional()}),gq=c.object({error:c.object({code:c.string(),message:c.string(),retryable:c.boolean()})}),yq=Ht.extend({adjectives:c.array(c.string()),animals:c.array(c.string()),avatars:c.array(c.object({id:c.string(),url:c.string()}))}),dT=c.object({name:c.object({adjective:c.string().min(1),animal:c.string().min(1)}).optional(),avatar:c.string().min(1).optional()}).refine(e=>e.name!==void 0||e.avatar!==void 0,{message:"Send a name, an avatar, or both."})});function uT(e){return fz[De(e)]}function mT(e,t){let o=e.op;return typeof o=="string"&&o.length>0?o:uT(t)?.[0]}function pT(e,t){return uT(e)?.includes(t)??!1}function Il(e){return Ry({round_id:e.round_id,round_version:e.round_version,challenge_instance_id:e.challenge_instance_id??null,payload:e.payload})}function Ry(e){if(Array.isArray(e))return`[${e.map(Ry).join(",")}]`;if(e&&typeof e=="object"){let t=e;return`{${Object.keys(t).filter(r=>t[r]!==void 0).sort().map(r=>`${JSON.stringify(r)}:${Ry(t[r])}`).join(",")}}`}return JSON.stringify(e)??"null"}var uz,mz,pz,hz,zy,xq,fz,hT=b(()=>{"use strict";Ye();Tn();Br();uz=c.object({op:c.string().min(1),model:c.string().min(1).optional()}).passthrough(),mz=c.object({op:c.literal("pick"),picks:c.array(c.string())}).passthrough(),pz=c.object({op:c.literal("answer"),answers:c.record(c.string(),c.union([c.string(),c.number()])).optional(),picks:c.array(c.string()).optional()}).passthrough(),hz=c.object({op:c.enum(["deal","reshuffle","lock"]),centre:c.unknown().optional(),board:c.number().int().nonnegative().optional()}).passthrough(),zy=c.object({op:c.literal(Gr),model:c.literal(io).optional(),shotIndex:c.number().int().nonnegative(),aimX:c.number().int().min(bt.aimX.min).max(bt.aimX.max),aimY:c.number().int().min(bt.aimY.min).max(bt.aimY.max),power:c.number().int().min(bt.power.min).max(bt.power.max)}).strict(),xq=c.union([mz,pz,hz,zy,uz]),fz={hunt:["pick"],push:["pick"],group:["pick"],predict:["answer"],bingo:["deal","reshuffle","lock"],shoot:[Gr],place:["place","skip"],mystery:["ask","buy","guess"]}});var fT=b(()=>{"use strict"});var Ny=b(()=>{"use strict";fT()});function wz(e,t){let o=e.trim().toLowerCase();return o?t.some(r=>{let n=r.trim().toLowerCase();return o===n||o.endsWith(`.${n}`)}):!1}function kz(e,t){let o=new Set((e.grants??[]).filter(r=>r.startsWith("org:")).map(r=>r.slice(4)));return t.find(r=>o.has(r.id)?!0:e.domain?wz(e.domain,r.domains):!1)}function vT(e,t){let o=e?.lastIndexOf("@")??-1,r=o>=0?e.slice(o+1).trim().toLowerCase():void 0;if(r)return kz({id:"creator",domain:r},t)}function wT(e,t){let o={kind:"generated_proposal",tool:"org-profile",source_context:`org:${t.id} v${t.version}`},r=t.identity?.player;if(r?.kind==="oidc"&&r.publicConfig.issuer&&r.publicConfig.jwks_uri&&(e.identity.provider="jwt",e.identity.jwt={issuer:r.publicConfig.issuer,jwks_uri:r.publicConfig.jwks_uri,...r.publicConfig.audience?{audience:r.publicConfig.audience}:{}},e.identity.status="proposed",e.identity.provenance=[...e.identity.provenance,o]),e.identity.consent={analytics_requires_consent:t.consent.analytics_requires_consent,...t.consent.provider?{provider:t.consent.provider}:{}},t.analytics.length>0){let n=new Set(e.measurement.destinations.map(a=>a.type));for(let a of t.analytics)n.has(a.type)||(e.measurement.destinations.push({type:a.type,enabled:!0,config:a.config}),n.add(a.type));e.measurement.status="proposed",e.measurement.provenance=[...e.measurement.provenance,o]}t.brand&&(e.experience.design={...e.experience.design,...t.brand.kind==="figma"?{figma_file:t.brand.ref}:{tokens:t.brand.ref}},e.experience.status="proposed",e.experience.provenance=[...e.experience.provenance,o])}var gz,gT,yz,bz,yT,vz,bT,jy,Pl=b(()=>{"use strict";Ye();sn();gz=c.object({kind:c.enum(["figma","tokens","guidelines"]),ref:c.string().min(1)}),gT=c.object({system:c.string().min(1),kind:c.string().min(1),ref:c.string().optional(),publicConfig:c.record(c.string(),c.string()).default({})}),yz=c.object({provider:c.string().optional(),analytics_requires_consent:c.boolean().default(!0)}),bz=c.object({type:ny.shape.type,config:c.record(c.string(),c.string()).default({})}),yT=c.object({kind:c.string().min(1),ref:c.string().min(1)}),vz=c.object({sink:yT.optional(),source:yT.optional()}),bT=c.object({id:c.string().min(1),displayName:c.string().min(1),domains:c.array(c.string()).default([]),version:c.number().int().nonnegative().default(1),brand:gz.optional(),identity:c.object({operator:gT.optional(),player:gT.optional()}).optional(),consent:yz.prefault({}),analytics:c.array(bz).default([]),data:vz.prefault({}),studioOrg:c.string().optional(),studioSpaces:c.array(c.string()).default([]),defaultStudioSpace:c.string().optional(),requiresExplicitSpace:c.boolean().default(!1)});jy=[bT.parse({id:"monterosa",displayName:"Monterosa",domains:["monterosa.co.uk"],studioOrg:"8b545077-7bbc-4255-8710-2ee9ca47b20a",studioSpaces:["8a03789a-f74f-4920-9699-0c59342eb963"],defaultStudioSpace:"8a03789a-f74f-4920-9699-0c59342eb963",brand:{kind:"guidelines",ref:"monterosa-brand-guidelines"},identity:{player:{system:"identify",kind:"oidc",publicConfig:{issuer:"https://accounts.google.com",jwks_uri:"https://www.googleapis.com/oauth2/v3/certs"}}},consent:{analytics_requires_consent:!0},analytics:[{type:"monterosa",config:{}}],data:{source:{kind:"slack-directory",ref:"monterosa-people"},sink:{kind:"delta-share",ref:"monterosa_gameplay"}}}),bT.parse({id:"nba",displayName:"NBA",domains:["nba.com"],studioOrg:"7ba0ec97-ac1f-4e83-bec0-d71e27a5357c",studioSpaces:["76d6efa5-cac5-4664-96e1-f23ac1d07671"],defaultStudioSpace:"76d6efa5-cac5-4664-96e1-f23ac1d07671",brand:{kind:"figma",ref:"nba-brand"},identity:{player:{system:"identify",kind:"custom",ref:"nba-id"}},consent:{provider:"onetrust",analytics_requires_consent:!0},analytics:[{type:"monterosa",config:{}}],data:{sink:{kind:"snowflake",ref:"nba_gameplay"}}})]});function _T(e,t=new Date){let o=typeof t=="string"?Date.parse(t):t.getTime(),r,n=Number.NEGATIVE_INFINITY;for(let a of e.rounds){let i=Date.parse(a.locksAt);Number.isNaN(i)||i>n&&(n=i,r=a)}return r?n>o?{state:"live",round:r}:{state:"stale",round:r,lockedForMs:o-n}:{state:"none"}}function xT(e){if(e.state!=="stale")return null;let t=Math.floor(e.lockedForMs/36e5),o=t<1?`${Math.max(1,Math.floor(e.lockedForMs/6e4))} minutes`:t<48?`${t} hours`:`${Math.floor(t/24)} days`;return`The round this game is serving, ${e.round.label}, locked ${o} ago and nothing has replaced it. Fans are playing a closed round. Run gamestage deploy, or refresh the round, to move it on.`}function $T(e,t=Ol){return e.terms?.version===t}function zl(e){let t=AT.safeParse(e.access);return t.success?t.data:"pending"}function Lz(e){let t=e??null;return!t||typeof t.version!="string"||typeof t.at!="string"?null:{version:t.version,at:t.at}}function Dz(e){let t=e??null;return t&&typeof t.at=="string"?{at:t.at}:null}function CT(e){let t=n=>typeof n=="string"&&n.trim()?n:null,o=e.decision??null,r=o?t(o.state):null;return{workspaceId:t(e.workspaceId)??"unknown",name:t(e.name),ownerEmail:t(e.ownerEmail)??"",company:t(e.company),role:t(e.role),intent:t(e.intent),signals:t(e.signals),registeredAt:t(e.registeredAt)??"",termsVersion:t(e.termsVersion),contactConsent:Lz(e.contactConsent),ageConfirmed:Dz(e.ageConfirmed),personalEmail:e.personalEmail===!0,decision:r==="approved"||r==="refused"?{state:r,at:t(o.at)??t(e.registeredAt)??"",by:t(o.by)??"unknown",reason:t(o.reason)}:null}}function IT(e){return{waiting:e.filter(t=>!t.decision).sort((t,o)=>t.registeredAt.localeCompare(o.registeredAt)),decided:e.filter(t=>t.decision).sort((t,o)=>o.decision.at.localeCompare(t.decision.at))}}function Dy(e){return Bz.includes(e)}function My(e,t){return!e.prodApproval||Dy(t.tier)?"dev":"prod"}function OT(e){return e.filter(t=>t.limit>0&&t.used>=t.limit)}function RT(e){return e.limit<=0?0:Math.min(1,e.used/e.limit)}var Sz,Tz,kT,Ez,$z,Az,Ly,Cz,Iz,ST,Pz,Gq,TT,Oz,Ol,Rl,ET,Rz,zz,AT,Bq,qq,Nz,jz,Mz,Fz,Wq,Hq,Kq,Yq,Vq,Uz,Zq,PT,Jq,Gz,Bz,Nl=b(()=>{"use strict";Tu();Ye();sn();Na();ki();Ny();ki();qt();Pl();Sz=c.enum(["draft","live","sleeping","throttled","expired","archived"]),Tz=c.enum(["scheduled","open","locked","settled"]),kT=c.object({id:c.string(),label:c.string(),used:c.number(),limit:c.number(),unit:c.string()}),Ez=c.object({id:c.string(),label:c.string(),state:Tz,opensAt:c.string(),locksAt:c.string(),settledAt:c.string().nullable(),plays:c.number()}),$z=c.object({id:c.string(),name:c.string(),enabled:c.boolean(),consentRequired:c.boolean(),note:c.string()}),Az=c.object({number:c.number().int().positive(),title:c.string(),openedAt:c.string(),labels:c.array(c.string()).default([]),fromGame:c.boolean().default(!1)}),Ly=c.object({at:c.string(),level:c.enum(["info","warn","error"]),roundId:c.string().nullable(),message:c.string(),dataset:c.string().optional()}),Cz=c.enum(["absent","pending","ready","failed"]),Iz=c.object({state:Cz.default("absent"),url:c.string().nullable().default(null),regenerations:c.number().int().nonnegative().default(0),updatedAt:c.string().nullable().default(null),onProject:c.string().nullable().default(null)});ST=c.object({section:c.string(),status:Qg}),Pz=c.object({instanceId:c.string(),embedSlug:c.string(),template:c.string(),type:c.enum(["leaderboard","qr"]),createdAt:c.string(),consentBy:c.string()}),Gq=c.object({template:c.string().min(1),consent:c.literal(!0)}),TT=c.object({id:c.string(),name:c.string(),containerLabel:c.string().min(1).default(dr),repository:c.string().nullable(),openIssues:c.number().int().nonnegative(),issues:c.array(Az).default([]),archetype:lo,offersPrize:c.boolean().default(!1),state:Sz,prodApproval:c.object({approvedAt:c.string(),approvedBy:c.string()}).nullable().default(null).optional(),archivePrefix:c.string().nullable().default(null),space:c.string().nullable().default(null).optional(),platformSpace:c.string().nullable().default(null).optional(),platformOrg:c.string().nullable().default(null).optional(),platformProject:c.string().nullable().default(null).optional(),platformEvent:c.string().nullable().default(null).optional(),platformElement:c.string().nullable().default(null).optional(),studioUrl:c.string().nullable().default(null).optional(),appSpec:c.object({version:c.string(),shape:c.string(),resource:c.string().nullable().default(null),specUrl:c.string().optional(),wording:c.array(c.string()).optional(),refusal:c.object({at:c.string(),reason:c.string()}).nullable().default(null).optional()}).nullable().default(null).optional(),art:Iz.prefault({}).optional(),graphics:c.array(Pz).optional(),playgroundUrl:c.string().nullable(),playerEndpoint:c.string().nullable(),manifestRevision:c.string(),manifestSource:c.string().optional(),settingsDefaults:c.record(c.string(),c.string()).optional(),conformance:so,contentHash:c.string(),referenceDigest:c.string().optional(),referenceName:c.string().optional(),identity:c.object({issuer:c.string(),jwks_uri:c.string(),audience:c.string().optional()}).optional(),monthlyPlayers:c.number().int().nonnegative().optional(),sections:c.array(ST),meters:c.array(kT),history:c.array(wi),rounds:c.array(Ez),destinations:c.array($z),logs:c.array(Ly),updatedAt:c.string()}),Oz=c.object({login:c.string(),linkedAt:c.string()}),Ol="2026-09-06",Rl="https://gamestage.ai/terms",ET="https://gamestage.ai/stage",Rz=c.object({version:c.string(),acceptedAt:c.string(),by:c.string()});zz=c.object({enabled:c.boolean().default(!1),applicationId:c.string().nullable().default(null),writeKey:c.string().nullable().default(null)}),AT=c.enum(["pending","approved","refused"]),Bq=c.enum(["manual","automatic"]);qq=c.enum(["approved","refused"]),Nz=c.object({company:c.string().trim().min(1,"Tell us your company.").max(120),role:c.string().trim().min(1,"Tell us your role.").max(120),intent:c.string().trim().min(1,"Tell us what you'd like to build.").max(500),contactConsent:c.literal(!0,{message:"Tick the box so we can contact you about your application."}),ageConfirmed:c.literal(!0,{message:`Confirm you are ${18} or older.`})}),jz=c.object({company:c.string().nullish(),role:c.string().nullish(),intent:c.string().nullish(),contactConsent:c.object({version:c.string(),at:c.string()}).nullish(),ageConfirmed:c.object({at:c.string()}).nullish()});Mz=c.object({id:c.string(),name:c.string(),tier:Wr,ownerEmail:c.string(),access:AT.default("pending"),profile:jz.optional(),platformSpace:c.string().optional(),liveGameAllowance:c.number(),supplierGrants:c.array(c.string()).default([]),github:Oz.nullable().default(null),terms:Rz.nullable().default(null),signal:zz.prefault({}),meters:c.array(kT),games:c.array(TT)}),Fz=TT.extend({logs:c.array(Ly).optional()}),Wq=Mz.extend({games:c.array(Fz),gamesTotal:c.number().int().nonnegative(),archivedTotal:c.number().int().nonnegative().default(0)}),Hq=c.object({player:c.string().nullable(),control:c.string().nullable(),playground:c.string().nullable()}),Kq=c.object({id:c.string(),name:c.string(),archetype:lo,repository:c.string().nullable().default(null),manifestRevision:c.string(),contentHash:c.string(),conformance:so,offersPrize:c.boolean().default(!1),sections:c.array(ST).default([]),containerLabel:c.string().min(1).optional()}),Yq=c.object({uploadUrl:c.string(),publicUrl:c.string(),key:c.string(),expiresInSeconds:c.number().int().positive(),cacheControl:c.string().optional(),playerApiOrigin:c.string()}),Vq=c.object({manifestRevision:c.string(),contentHash:c.string(),conformance:so,offersPrize:c.boolean().default(!1),round:Ge.optional(),studioSeed:Ge.optional(),identity:c.object({issuer:c.string(),jwks_uri:c.string(),audience:c.string().optional()}).optional(),wording:c.array(c.string()).optional(),manifestSource:c.string().optional(),settings:c.record(c.string(),c.string()).optional(),notes:c.string().max(500).optional(),studioSpace:c.string().optional(),studioSpaceOrg:c.string().optional()}),Uz=c.object({limit:c.coerce.number().int().positive().max(1e3).default(100),since:c.string().nullable().default(null),level:Ly.shape.level.nullable().default(null)}),Zq=c.enum(["access_pending","terms_not_accepted","personal_email","profile_incomplete","github_not_linked","live_allowance_reached","meter_breached","nothing_to_do","tier_required","operator_required","game_archived","dev_allowance_reached","art_limit_reached","art_unavailable","round_source_unreadable","round_not_seeded","delete_refused","space_required","space_not_permitted"]),PT=c.enum(["workspace.created","workspace.approved","workspace.refused","workspace.profile_updated","github.linked","github.unlinked","terms.accepted","game.registered","game.deployed","game.deploy_refused","round.provisioned","round.provision_failed","round.unchanged","round.seeded","game.platform_provisioned","game.platform_provision_failed","game.app_spec_refused","art.requested","art.generated","art.failed","art.published","game.woken","game.suspended","game.throttled","game.approaching_fair_use","game.archived","game.graphic.added","game.graphic.removed","game.promoted","game.withdrawn","game.deleted","game.deleted","workspace.plan_changed","workspace.plan_refused","engine.integrity_violation","destination.changed","signal.enabled","signal.disabled","source.key_attempt"]),Jq=c.object({id:c.string(),at:c.string(),action:PT,actor:c.object({kind:c.enum(["creator","operator","system"]),id:c.string(),email:c.string().nullable().default(null)}),gameId:c.string().nullable().default(null),correlationId:c.string(),detail:c.record(c.string(),c.unknown()).default({})}),Gz=c.object({limit:c.coerce.number().int().positive().max(1e3).default(100),action:PT.nullable().default(null),actorId:c.string().nullable().default(null),gameId:c.string().nullable().default(null),from:c.string().nullable().default(null),to:c.string().nullable().default(null)}),Bz=["runtime"]});var Fy=b(()=>{"use strict"});var Kt=b(()=>{"use strict"});import{createHash as qz}from"node:crypto";function Hz(e){return qz("sha256").update(e).digest("hex").slice(0,16)}function jl(e){return Hz(e)}var Wz,zt,wt=b(()=>{"use strict";Ye();Kt();qt();Wz=c.object({key:c.string().min(1),label:c.string().default(""),values:c.record(c.string(),c.number().int().nonnegative()),scale:c.number().int().positive().optional(),sources:c.record(c.string(),qr).optional(),scoring:Jg.optional(),tiers:c.array(Zg).min(1).optional()}),zt=c.object({corpus:c.literal("1"),source:c.string().optional(),as_of:c.string().optional(),sources:c.record(c.string(),qr).optional(),facts:c.record(c.string(),c.array(kl)).optional(),entries:c.record(c.string(),c.object({label:c.string().min(1),team:c.string().optional(),position:c.string().optional(),image:c.string().url().startsWith("https://").optional(),age:c.number().int().min(14).max(60).optional(),debut_year:c.number().int().min(1900).max(2100).optional(),facts:c.record(c.string(),c.union([c.string(),c.number(),c.boolean()])).optional()})).optional(),measures:c.array(Wz).min(1)}).superRefine((e,t)=>{let o=e.measures.map(r=>r.key);new Set(o).size!==o.length&&t.addIssue({code:"custom",path:["measures"],message:"Two measures share a key. A round names the measure it is counted on."})})});function Zz(e){return`slate-${e+1}`}function jT(e){return{archetype:"push",theme:e.theme??"",prompt:e.prompt??"",target:e.target,targetLabel:e.targetLabel??"",unit:e.unit??"",slates:e.slates.map((t,o)=>({id:Zz(o),label:t.label??"",entries:t.entries.map(r=>({key:r.key,label:r.label??""}))}))}}var Yz,Vz,Uy,On=b(()=>{"use strict";Ye();Kt();Yz=c.object({key:c.string().min(1),label:c.string().default(""),note:c.string().optional()}),Vz=c.object({id:c.string().min(1),label:c.string().default(""),entries:c.array(Yz).min(1)}),Uy=c.object({archetype:c.literal("push"),measure:c.string().min(1).optional(),theme:c.string().default(""),prompt:c.string().default(""),target:c.number().int().positive().optional(),targetLabel:c.string().default(""),unit:c.string().max(4).default(""),slates:c.array(Vz).min(1)})});var DT,fW,Oi=b(()=>{"use strict";Ye();qt();On();Kt();DT=_l.safeExtend({answerMeasure:c.string().min(1).optional(),answerRule:Si.optional()}),fW=c.discriminatedUnion("archetype",[Uy,DT,Xg,Sl])});var Gy,_W,By=b(()=>{"use strict";Ye();wt();On();Oi();qt();Gy=c.object({count:c.number().int().min(1).max(80),measure:c.string().trim().min(1).optional(),position:c.string().trim().min(1).optional(),team:c.string().trim().min(1).optional(),layout:c.enum(["grid","pitch","xi"]).optional(),dataset:c.string().trim().regex(/^[A-Za-z0-9][A-Za-z0-9._\/-]*\.json$/,"A dataset name, e.g. sportmonks/premier-league-lineups.json").optional(),prompt:c.string().trim().min(1).max(200).optional()}),_W=c.object({measure:c.string().min(1),rule:Si,prompt:c.string().trim().min(1)})});var Ll=b(()=>{"use strict";qt();Kt();Br()});function Ri(){return Dl.filter(e=>e.public!==!1&&e.type!=="collection"&&e.type!=="boolean"&&e.type!=="number").map(e=>e.key)}function FT(e){if(e===null||typeof e!="object"||Array.isArray(e))return["gamestage.settings.json must be one JSON object of field keys to text."];let t=new Set(Ri()),o=[];for(let[r,n]of Object.entries(e)){let a=/^label_[a-z0-9_]+$/.test(r);!t.has(r)&&!a?o.push(`"${r}" is not a Studio field a game can fill. The fields are: ${[...t].join(", ")}, and any label_<key> the page reads.`):typeof n!="string"&&o.push(`"${r}" must be text, and is ${Array.isArray(n)?"a list":typeof n}.`)}return o}function Yo(e,t,o,r){let n=e[0].toUpperCase()+e.slice(1),a=(d,l,u)=>({key:`css_variables_${d}`,label:l,type:"colour",description:u,readBy:`The game's own CSS, as the --gs-${d} custom property.`,section:"Colour Palette",subsection:t,subsectionDescription:o}),i=t.toLowerCase(),s=[a(`${e}MainColour`,`${t} main colour`,"Main: the primary surface.")];return r.variant&&s.push(a(`${e}VariantColour`,`${t} variant colour`,"Variant: overlays, borders and subtle accents.")),s.push(a(`on${n}Colour`,`On ${i} colour`,"On: content sitting on the main and variant surfaces."),a(`${e}ContainerColour`,`${t} container colour`,"Container: the wrapper surface."),a(`on${n}ContainerColour`,`On ${i} container colour`,"On container: content sitting on the container surface.")),s}function Xy(e,t){let o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp([`\\bpresentation\\s*\\.\\s*${o}\\b`,`\\bpresentation\\s*\\[\\s*["']${o}["']\\s*\\]`,`\\b${o}\\s*:`,`[A-Za-z_$][\\w$]*\\s*\\??\\.\\s*${o}\\b`].join("|")).test(e)||t==="primaryColour"&&/\broot\s*:/.test(e)||sN.has(t)&&/\broot\s*:/.test(e)||cN.has(t)&&/data-gs-first-paint/.test(e)||t.startsWith("recovery")&&/\bmountRecovery\s*\(/.test(e)?!0:t==="analyticsUrl"}function Fl(e){return[...qy.filter(t=>Xy(e,Jy[t.key])).map(t=>t.key),...zi(e)]}function zi(e){let t=new Set;for(let o of e.matchAll(/["'`](label_[a-z0-9_]+)["'`]|\b(label_[a-z0-9_]+)\s*:/g)){let r=o[1]??o[2];r&&r!==Ul&&t.add(r)}return[...t].sort()}function GT(e){let t=e.slice(Ul.length).replace(/_/g," ").trim();return{key:e,label:t.charAt(0).toUpperCase()+t.slice(1),type:"freetext",description:"A word this game's page shows. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page.",section:"Wording"}}function Ni(e,t=Qy){return`${t}/fonts/${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}.css`}function Gl(e,t){if(!e)return;let o=Object.keys(MT).find(i=>i.toLowerCase()===e.trim().toLowerCase());if(!o)return;let r=MT[o],n=Number(t);if(!Number.isFinite(n))return{family:o,weight:r[r.length-1]};let a=[...r].sort((i,s)=>Math.abs(i-n)-Math.abs(s-n)||s-i)[0];return{family:o,weight:a}}var qy,Wy,Xz,Dl,Hy,Qz,Ml,eN,Ky,UT,tN,nN,oN,Yy,rN,aN,iN,Vy,Zy,Jy,sN,cN,Ul,MT,Qy,eb,Yr=b(()=>{"use strict";qy=[{key:"play_again_label",required:!0,label:"Play again button",type:"freetext",description:"What the button that starts the next round says, at the end of a finished one. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, on its play-again button.",section:"Wording"},{key:"result_button_label",required:!0,label:"Result link",type:"freetext",description:"What the link back to a finished round says, for a fan who has already played today. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, on its see-your-result link.",section:"Wording"},{key:"share_button_label",required:!0,label:"Share button",type:"freetext",description:"What the share button says at the end of a round. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, on its share button.",section:"Wording"},{key:"margin_over",label:"Went over, in the summary",type:"freetext",description:'What the splash and the share picture say when a fan went over, e.g. "over by {n}". {n} is how far out they were, and where you put it is up to you. Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the returning splash and the share picture.",section:"Wording"},{key:"margin_exact",label:"Landed exactly, in the summary",type:"freetext",description:'What the splash and the share picture say when a fan hit the target exactly, e.g. "exactly on the number". There is no amount to show, so no {n}. Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the returning splash and the share picture.",section:"Wording"},{key:"margin_under",label:"Stayed under, in the summary",type:"freetext",description:'What the splash and the share picture say when a fan finished under, e.g. "{n} short". {n} is how far under they were. Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the returning splash and the share picture.",section:"Wording"},{key:"result_over",label:"Went over, on the result",type:"freetext",description:`What the result screen says when a fan went over, e.g. "Over the limit by {n}". **The game speaking to the fan, so write it in the second person.** Use {n} for the amount, {target} for the target, {rank} for the rank, {player} for the player who took them over, {value} for what that player was worth, and {fact} for that player's note. Filled in from the game when it deploys; what you write here is what fans see.`,readBy:"The game's own page, on the result screen.",section:"Wording"},{key:"result_exact",label:"Landed exactly, on the result",type:"freetext",description:'What the result screen says when a fan hit the target exactly, e.g. "Exactly on the number!". Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the result screen.",section:"Wording"},{key:"result_under",label:"Stayed under, on the result",type:"freetext",description:'What the result screen says when a fan finished under, e.g. "{n} away from the target". Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the result screen.",section:"Wording"},{key:"share_over",label:"Went over, in the shared text",type:"freetext",description:`The sentence a fan pastes when they went over, e.g. "over the limit by {n}." **The fan speaking to a friend, so write it in the first person: "my", never "your".** Use {n} for the amount, {target} for the target, {rank} for the rank, {player} for the player who took them over, {value} for what that player was worth, and {fact} for that player's note. Keep it to one line: the shared text is four lines and this is the first. Filled in from the game when it deploys; what you write here is what fans see.`,readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"share_exact",label:"Landed exactly, in the shared text",type:"freetext",description:'The sentence a fan pastes when they hit the target exactly, e.g. "Exactly on {target}. {rank}." Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"share_under",label:"Stayed under, in the shared text",type:"freetext",description:'The sentence a fan pastes when they finished under, e.g. "{n} short of {target}. {rank}." Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"result_bust_note",label:"Went over: the line about the player",type:"freetext",description:`The line on the result screen naming the player who took a fan over, e.g. "{player} alone was worth {value} of your {target}." **The game speaking to the fan, so second person.** {fact} is that player's own note if the producer wrote one. Filled in from the game when it deploys; what you write here is what fans see.`,readBy:"The game's own page, under the result when a fan went over.",section:"Wording"},{key:"share_bust_note",label:"Went over: the line about the player, shared",type:"freetext",description:'The same line in the text a fan pastes, e.g. "{player} alone was {value} of my {target}." **The fan speaking to a friend, so first person: "my", never "your".** Surname alone reads better here; the full name is on the card. Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"share_dare",label:"The challenge in the shared text",type:"freetext",description:'The last line of the text a fan pastes, aimed at whoever reads it, e.g. "Can you do better?" Filled in from the game when it deploys; what you write here is what fans see. Clear it and the line is not sent.',readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"result_dare",label:"The challenge on the result",type:"freetext",description:'A closing line on the result screen, e.g. "Can you do better?" Filled in from the game when it deploys; what you write here is what fans see. Clear it and the line is not drawn.',readBy:"The game's own page, under the result.",section:"Wording"},{key:"capped_today_note",label:"When today's plays are used up",type:"freetext",description:"What a fan reads when the game has taken all the plays it can take today, and opens again at midnight UTC. A Dev game has a daily limit; a Prod game does not, so this never shows on one. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, when the Engine refuses a play until tomorrow.",section:"Wording"},{key:"splash_gradient_start",label:"Intro screen colour, top",type:"colour",description:"The colour at the top of the intro screen's gradient, also the colour the page paints before anything loads. Leave it empty to use the background colour.",readBy:"The game's intro screen, from its first frame.",section:"Brand"},{key:"splash_gradient_end",label:"Intro screen colour, bottom",type:"colour",description:"The colour at the bottom of the intro screen's gradient. Leave it empty to use the background container colour.",readBy:"The game's intro screen, from its first frame.",section:"Brand"},{key:"splash_play_label",label:"Intro screen button",type:"freetext",description:'What the big button on the intro screen says once the game has loaded. Tapping it starts the game and turns sound and vibration on. Empty says "Play".',readBy:"The game's intro screen.",section:"Wording"},{key:"splash_continue_label",label:"Intro screen button, part way through",type:"freetext",description:`What the intro screen button says when the fan has a round they haven't finished. Empty says "Continue".`,readBy:"The game's intro screen.",section:"Wording"},{key:"splash_error_text",label:"Intro screen, when loading fails",type:"freetext",description:`What the intro screen says if the game can't load. Empty says "The game didn't load. Check your connection and try again."`,readBy:"The game's intro screen.",section:"Wording"},{key:"splash_retry_label",label:"Intro screen, try again button",type:"freetext",description:`The button shown when the game can't load. Empty says "Try again".`,readBy:"The game's intro screen.",section:"Wording"},{key:"recovery_open_label",label:"Recovery button",type:"freetext",description:`The small button that opens a fan's recovery code. Empty says "Your progress".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_show_title",label:"Recovery code, heading",type:"freetext",description:`The heading above a fan's recovery code. Empty says "Keep your progress".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_show_detail",label:"Recovery code, explanation",type:"freetext",description:"The line under that heading. Empty explains that the code brings a fan's name, scores and achievements back on another device, and is shown once.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_private_note",label:"Recovery code, keep it private",type:"freetext",description:"The warning under the code. Empty says anyone with the code can play as the fan.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_replace_note",label:"Recovery code, replacing it",type:"freetext",description:"The warning that a new code stops the old one working.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_enter_title",label:"Restore, heading",type:"freetext",description:`The heading for a fan who has played before. Empty says "I've played before".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_enter_detail",label:"Restore, explanation",type:"freetext",description:"The line under that heading.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_submit_label",label:"Restore, button",type:"freetext",description:`The button that restores a fan's progress from their code. Empty says "Get my progress back".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_not_recognised",label:"Restore, code not recognised",type:"freetext",description:"What a fan reads when their code isn't recognised.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_restored",label:"Restore, done",type:"freetext",description:"What a fan reads once their progress is back.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_get_label",label:"Recovery code, get button",type:"freetext",description:`The button that issues a fan's recovery code. Empty says "Get a recovery code".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_issue_failed",label:"Recovery code, when it fails",type:"freetext",description:`What a fan reads if a code can't be issued. Empty says "That didn't work. Check your connection and try again."`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_copy_label",label:"Recovery code, copy button",type:"freetext",description:'The button that copies the code. Empty says "Copy".',readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_copied_label",label:"Recovery code, copied",type:"freetext",description:'What the page says once the code is copied. Empty says "Copied".',readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_share_label",label:"Recovery code, share button",type:"freetext",description:'The button that shares the code. Empty says "Share".',readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_close_label",label:"Recovery screens, close button",type:"freetext",description:'The button that closes the recovery screens. Empty says "Close".',readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"}];Wy=qy.map(e=>e.key);Xz=[...Yo("background","Background","The app and element background.",{variant:!1}),...Yo("highlight","Highlight","The accent for primary buttons and selected states; a saturated, high-contrast hue.",{variant:!0}),...Yo("positive","Positive","Positive states such as a correct answer or a successful submission; usually green.",{variant:!0}),...Yo("negative","Negative","Negative states such as a wrong answer or an error; usually red.",{variant:!0}),...Yo("primary","Primary","A high-contrast brand colour for the header, footer and some icons; less prominent than Highlight.",{variant:!0}),...Yo("secondary","Secondary","A medium-contrast brand colour for secondary buttons and inactive states.",{variant:!0}),...Yo("tertiary","Tertiary","A low-contrast colour for option buttons and most interactive UI.",{variant:!0})],Dl=[{key:"display_name",label:"Game name",type:"freetext",description:"What a fan sees at the top of the game. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, as its heading and its browser title.",section:"Identity"},{key:"strapline",label:"Strapline",type:"freetext",description:"One line under the name. Filled in from the game when it deploys; what you write here is what fans see. Clear it and the line is not drawn.",readBy:"The game's own page, under the heading.",section:"Identity"},{key:"how_to_play",label:"How to play",type:"freetext",description:"The rules in a fan's words. Shown before they start, and reachable while they play.",readBy:"The game's own page, in its how-to-play panel.",section:"Identity"},{key:"reference_url",label:"Reference data",type:"freetext",description:"A link to JSON holding the data this game draws on, shared by every round. Fetched by the Engine, never sent to a fan's browser. Leave it empty if each round carries everything it needs.",readBy:"The control plane, when it provisions a round.",section:"Content",public:!1},{key:"analytics_url",label:"Analytics endpoint",type:"freetext",description:"Where a copy of what fans do in this game is sent. Leave it empty and nothing is collected. Monterosa will give you the address for your account.",readBy:"The game's own page, which loads the collector and posts to it once a fan has consented.",section:"Content"},{key:"primary_colour",label:"Primary colour",type:"colour",description:"Your brand colour. It is the button a fan presses, and the accent on any Live Graphics graphic this game puts on a screen.",readBy:"The game's own page, as the --gamestage-primary custom property, and the graphic, as its accent.",section:"Brand"},{key:"logo_url",label:"Logo",type:"image",description:"Your mark, shown in the top corner of a graphic on a screen. Leave it empty and the graphic carries no logo. A transparent PNG or an SVG reads best on a dark board.",readBy:"Live Graphics, in the top corner of every graphic for this game.",section:"Brand"},{key:"brand_font_url",label:"Typeface stylesheet",type:"freetext",description:"A stylesheet that loads your typeface, such as a Google Fonts address. Leave it empty to keep the graphic's own face.",readBy:"Live Graphics, which loads it before drawing a graphic.",section:"Brand"},{key:"brand_font_family",label:"Typeface name",type:"freetext",description:`The font-family the stylesheet above provides, such as "Archivo". Set both or neither: a name with no stylesheet falls back to the graphic's own face, and a stylesheet with no name is never used.`,readBy:"Live Graphics, as the face every word on a graphic is set in.",section:"Brand"},{key:"title_font",label:"Title typeface",type:"freetext",description:`The Google Font the game's name is set in at the top of the page, such as "Bebas Neue". It must be one of the families Gamestage offers (Anton, Archivo Black, Bebas Neue, Bungee, Chakra Petch, Fraunces, Oswald, Playfair Display, Russo One and others); any other name is ignored and the game's own title face is used. Leave it empty to keep that face.`,readBy:"The game's own page, on its title, loaded from Google Fonts after the page has drawn.",section:"Brand"},{key:"title_font_weight",label:"Title weight",type:"freetext",description:"How heavy the title is, as a number from 100 to 900 (400 is regular, 700 bold). A weight the typeface does not have becomes the nearest one it does; empty uses its heaviest.",readBy:"The game's own page, on its title.",section:"Brand"},{key:"title_letter_spacing",label:"Title letter spacing",type:"freetext",description:"Space between the title's letters, as a fraction of the type size: 0.08 spreads it out, -0.02 tightens it, empty leaves the typeface's own spacing. Kept between -0.1 and 0.4.",readBy:"The game's own page, on its title.",section:"Brand"},{key:"title_case",label:"Title case",type:"freetext",description:`Type "upper" to show the game's name in capital letters whatever case it is typed in. Leave it empty to show it as typed.`,readBy:"The game's own page, on its title.",section:"Brand"},{key:"title_colour",label:"Title colour",type:"colour",description:"The colour of the game's name. Leave it empty to use the page's own text colour.",readBy:"The game's own page, on its title.",section:"Brand"},{key:"logo_text",label:"Logo text",type:"freetext",description:"How the game's name is drawn as a logo, if different from its name. Put the characters to pick out in square brackets: WAGE[$] draws WAGE$ with the $ in the accent colour. The browser tab, the share text and screen readers still use the game's name. Leave it empty to draw the name.",readBy:"The game's own page, on its title and its intro screen.",section:"Brand"},{key:"logo_accent_colour",label:"Logo accent colour",type:"colour",description:"The colour of the characters in square brackets in the logo text. Leave it empty to use the title colour.",readBy:"The game's own page, on its title and its intro screen.",section:"Brand"},{key:"play_button_label",required:!0,label:"Main button",type:"freetext",description:"What the button that submits a fan's answer says. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, on its submit button.",section:"Wording"},...qy,{key:"consent_brand_name",label:"Consent, who runs the game",type:"freetext",description:'Your brand, named on the consent banner as the one asking, e.g. "Arsenal". Required: a game with no brand name cannot deploy.',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_title",label:"Consent, heading",type:"freetext",description:`The consent card's name, read by a screen reader rather than shown. Empty says "Your privacy".`,readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_detail",label:"Consent, explanation",type:"freetext",description:"The consent message. {brand} is replaced with your brand name. Empty says: {brand} would like to record analytics on how you play, so we can improve the game. We only do this if you agree. Data needed to run the game, such as your scores, is processed on the basis of legitimate interests.",readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_accept_label",label:"Consent, accept button",type:"freetext",description:'Empty says "Accept". The same size as the reject button, filled in your accent colour.',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_reject_label",label:"Consent, reject button",type:"freetext",description:'Empty says "Reject". The same size as the accept button, beside it.',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_choose_label",label:"Consent, choose button",type:"freetext",description:'Opens the list of categories. Empty says "Manage preferences".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_save_label",label:"Consent, save button",type:"freetext",description:'Saves the categories a fan ticked. Empty says "Save my choices".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_analytics_label",label:"Consent, measurement category",type:"freetext",description:'Empty says "Measure how the game is played".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_marketing_label",label:"Consent, marketing category",type:"freetext",description:`Empty says "Offers and news from the game's owner".`,readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_functional_label",label:"Consent, preferences category",type:"freetext",description:'Empty says "Remember my preferences".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_settings_label",label:"Consent, settings link",type:"freetext",description:'The link a fan uses to change their mind later. Empty says "Privacy settings".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_policy_version",label:"Privacy policy version",type:"freetext",description:'Change this when your privacy policy changes, and every fan is asked again. Empty is "1".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"privacy_policy_url",label:"Privacy policy link",type:"freetext",description:`Where the banner's "Privacy policy" link goes. Required: a game with no privacy policy link cannot deploy.`,readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"rank_ladder",label:"Rank names",type:"collection",itemLabel:"{{rank_label}}",description:"What each rank is called, best first. The game decides which rank a fan earned; this is only what it is called. Leave it empty to use the game's own names.",readBy:"The Engine, which awards the rank and returns its name.",section:"Wording",fieldset:[{key:"rank_label",label:"Name",type:"freetext",description:'What a fan sees when they earn this rank, e.g. "Hall of Fame".',readBy:"The Engine, on a finished round.",section:"Wording"}]},{key:"round_selection",label:"How the live round is chosen",type:"freetext",description:"Calendar: the round on today's edition, which a producer prepares. Rotation: one of a pool, chosen by the clock, the same one for everybody playing at that moment. Leave it empty for calendar.",readBy:"The control plane, when it provisions a round.",section:"Content",public:!1},{key:"round_window_seconds",label:"How long a round stays up",type:"number",description:"Under rotation, how many seconds each round is the live one before the next takes over. Leave it empty for a day.",readBy:"The control plane, when it provisions a round.",section:"Content",public:!1},{key:"measure",label:"Measure",type:"freetext",description:'Which column of the reference data a round counts, when it holds more than one, e.g. "points". A round can name its own instead. Leave it empty if the data holds one measure.',readBy:"The control plane, when it joins a round to the reference data.",section:"Content",public:!1},...Xz],Hy=[{key:"edition_name",label:"Edition name",type:"freetext",description:"What a fan sees this edition called. Leave it empty to use the game's own word for its container.",readBy:"The game's own page, wherever it names the round.",section:"This edition"},{key:"edition_strapline",label:"Edition line",type:"freetext",description:"A line for this edition only: a sponsor, a fixture, a date. Leave it empty and the line is not drawn.",readBy:"The game's own page, beside the edition name.",section:"This edition"}],Qz=[{key:"bingo_rows",label:"Board rows",type:"number",description:"How many rows a fan's board has. Leave it empty for 3.",readBy:"The control plane, when it builds the round from this edition.",section:"This edition",public:!1},{key:"bingo_columns",label:"Board columns",type:"number",description:"How many columns a fan's board has. Leave it empty for 3.",readBy:"The control plane, when it builds the round from this edition.",section:"This edition",public:!1},{key:"bingo_centre_mode",label:"Centre cell",type:"freetext",description:'One of "free" (marked for everybody, and does not use a card), "none" (an ordinary cell dealt like any other) or "choice" (the fan picks it). Leave it empty for "free".',readBy:"The control plane, when it builds the round from this edition.",section:"This edition",public:!1},{key:"bingo_shuffle_allowance",label:"Reshuffles allowed",type:"number",description:"How many times a fan may redeal their board before locking it. Leave it empty for 3.",readBy:"The Engine, which refuses a reshuffle once this is spent.",section:"This edition"},{key:"bingo_prompt",label:"What a fan is told",type:"freetext",description:"The line above the board, in a fan's words. Leave it empty to keep the wording the game was built with.",readBy:"The control plane, when it builds the round from this edition.",section:"This edition",public:!1},{key:"bingo_points_per_line",label:"Points per line",type:"number",description:"Awarded once for each completed line. Leave it empty for 10.",readBy:"The Engine, when it scores a settled board.",section:"This edition"},{key:"bingo_points_for_full_board",label:"Points for a full board",type:"number",description:"Awarded once, on top of every line, when the whole board comes in. Leave it empty for 0.",readBy:"The Engine, when it scores a settled board.",section:"This edition"}],Ml=[{key:"title",label:"Round name",type:"freetext",description:"How this round is listed in Studio, so you can tell rounds apart. Gamestage fills it in when it creates the round; change it to anything. Fans do not see it.",readBy:"Studio's timeline label. Nothing a fan loads reads it.",section:"Content",public:!1},{key:"source_url",label:"Content source",type:"freetext",description:"A link to JSON holding this round's content. Fetched by the Engine when the round is provisioned, so it is never sent to a fan's browser and may hold the answers. Leave it empty to use the round in the game's manifest.",readBy:"The control plane, when it provisions the round.",section:"Content",public:!1},{key:"measure",label:"Measure",type:"freetext",description:'Which column of the reference data this round counts, e.g. "assists". Leave it empty to count what the game counts.',readBy:"The control plane, when it joins this round to the reference data.",section:"Content",public:!1},{key:"round_timer_seconds",label:"Time limit",type:"number",description:"How many seconds a fan gets on this round, counted from when they open it: 180 for three minutes. The Engine refuses a play that arrives after it. Leave it empty for a round with no clock.",readBy:"The Engine, which refuses a late play, and the game's own page, which counts it down.",section:"Content"}],eN=[{key:"round_theme",label:"Theme",type:"freetext",description:`What this round is about, in a word or two, e.g. "The Eighties". Shown above the game's name. Leave it empty for a round that is not one of a themed set.`,readBy:"The game's own page, above the title.",section:"This round"},{key:"round_prompt",label:"What a fan is told",type:"freetext",description:"The line above the board, in a fan's words. Leave it empty to keep the wording the game was built with.",readBy:"The game's own page, above the board.",section:"This round"},{key:"round_target",label:"The target",type:"number",description:"The total a fan must get as close to as they can without going over. Public: it is the goal they are set, and the game is unplayable without it.",readBy:"The Engine, which marks against it, and the page, which shows it.",section:"This round"},{key:"round_target_label",label:"What is being counted",type:"freetext",description:'Shown beside the target, e.g. "Career Points".',readBy:"The game's own page, beside the target.",section:"This round"},{key:"round_unit",label:"Unit",type:"freetext",description:'Put in front of every number in this round, e.g. "\xA3". Leave it empty for a round that counts something with no unit, like points.',readBy:"The game's own page, in front of the target, each pick and the total.",section:"This round"},{key:"round_slates",label:"The picks",type:"collection",itemLabel:"{{slate_label}}",description:"One group per pick, in the order a fan plays them. Five groups means five picks.",readBy:"The Engine, which marks against them, and the page, which draws them.",section:"This round",fieldset:[{key:"slate_label",label:"Group",type:"freetext",description:'What a fan sees above the choices, e.g. "1996-97 CHI".',readBy:"The game's own page.",section:"This round"},{key:"slate_entries",label:"Choices",type:"collection",itemLabel:"{{entry_label}}",description:"The choices a fan picks between in this group.",readBy:"The Engine and the page.",section:"This round",fieldset:[{key:"entry_label",label:"Name",type:"freetext",description:'What a fan sees, e.g. "Michael Jordan".',readBy:"The game's own page.",section:"This round"},{key:"entry_key",label:"Reference",type:"freetext",description:`The id this choice has in the game's own data, e.g. "jordami01". It is how the Engine finds what the choice is worth, so it has to match the data the game was deployed with. Never shown to a fan.`,readBy:"The Engine, to look up what this choice is worth.",section:"This round"},{key:"entry_note",label:"Note",type:"freetext",description:'Something worth knowing about this choice, shown to a fan who went over because of it, e.g. "Six rings, six Finals MVPs." Leave it empty and the game works out its own line.',readBy:"The game's own page, on the result when this choice took a fan over.",section:"This round"}]}]}],Ky="Never shown to a fan. This is the answer, so it is withheld from the feeds a browser reads.",UT={key:"round_board",label:"The board",type:"collection",itemLabel:"{{board_item}}",description:"Everything a fan can pick from, in the order they should see it.",readBy:"The Engine, which marks against it, and the page, which draws it.",section:"This round",fieldset:[{key:"board_item",label:"Pick",type:"freetext",description:'One thing a fan can pick, exactly as they should read it, e.g. "Michael Jordan".',readBy:"The game's own page, and the Engine, which marks a pick by it.",section:"This round"},{key:"board_given",label:"Given name",type:"freetext",description:'Optional. When the pick is a person, the first line of their name as a fan reads it, e.g. "Ole Gunnar". Leave empty to split the pick at its first space.',readBy:"The game's own page, which draws a person's name on two lines. The Engine never reads it.",section:"This round"},{key:"board_family",label:"Family name",type:"freetext",description:'Optional. When the pick is a person, the bold second line of their name, e.g. "Solskjaer". Leave empty to split the pick at its first space.',readBy:"The game's own page, which draws a person's name on two lines. The Engine never reads it.",section:"This round"}]},tN=[{key:"round_prompt",label:"What a fan is told",type:"freetext",description:`The line above the board, in a fan's words. Leave it empty to keep the wording the game was built with. Lead with what the fan has to decide, not who the players are: say "a \xA3100m player", never "a goalkeeper", since naming the category gives the answer away. Put the famous name on the board as the trap, not in this line. One line, e.g. "Only one of these players has scored a penalty so far this season." or "Who is the player that's not yet scored?"`,readBy:"The game's own page, above the board.",section:"This round"},UT,{key:"round_targets",label:"The right answers",type:"freetext",description:`The picks that are right, separated by commas, written exactly as they appear on the board, e.g. "Michael Jordan, Larry Bird". ${Ky}`,readBy:"The Engine, to mark a pick.",section:"This round",public:!1}],nN=[{key:"answer_measure",label:"Answer from data",type:"freetext",description:'Leave empty to type the answer yourself. Otherwise the dataset measure the answer is worked out from, e.g. "own_goals", and the board holds dataset keys rather than names.',readBy:"The relay, which works out the answer when the round is provisioned.",section:"This round",public:!1},{key:"answer_rule",label:"Which player is right",type:"freetext",description:'With "Answer from data": highest, lowest, only_nonzero (the one player above zero) or only_zero (the one player on zero). A round where the rule fits more than one player is refused, never guessed.',readBy:"The relay.",section:"This round",public:!1},{key:"reveal_each_guess",label:"Show a wrong guess's figure",type:"freetext",description:'With "Answer from data": "yes" to show a wrong guess its own figure straight away, "no" to show every figure only at the end. Empty means yes.',readBy:"The Engine, when it marks a guess.",section:"This round",public:!1},{key:"round_layout",label:"How the board is drawn",type:"freetext",description:`Empty for cards. "pitch" to draw each player on a football pitch at their position, from the dataset; works with "Answer from data", and a round whose players have no position in the dataset stays as cards. "xi" to draw a team's eleven with one place empty, from "The eleven", and ask who played there.`,readBy:"The relay, which adds each player's position; then the game's page.",section:"This round"},{key:"round_lineup",label:"The eleven",type:"freetext",description:'For "xi" rounds only, written by `gamestage round seed --layout xi`. The team and its starting places as JSON: {"team":"AFC Bournemouth","formation":"4-2-3-1","places":[{"row":1,"column":1,"label":"Djordje Petrovic"},...]}. Row 1 is the goalkeeper. Exactly one place has no "label": that is the gap a fan fills, and its player goes in "The right answers" and on the board.',readBy:"The game's page, which draws it.",section:"This round"},{key:"round_twist",label:"The twist",type:"freetext",description:`One surprising line shown after the round, e.g. "He has also completed more passes than any other defender." ${Ky}`,readBy:"The Engine, which sends it only with a finished result.",section:"This round",public:!1},{key:"round_twist_source",label:"Where the twist is from",type:"freetext",description:'The publication and date, e.g. "Fantasy Premier League, 27 Sep 2026".',readBy:"The Engine, with the twist.",section:"This round",public:!1},{key:"round_twist_url",label:"The twist's link",type:"freetext",description:"A link to where the twist was reported. Optional.",readBy:"The Engine, with the twist.",section:"This round",public:!1}],oN=[{key:"round_prompt",label:"What a fan is told",type:"freetext",description:"The line above the board, in a fan's words. Leave it empty to keep the wording the game was built with.",readBy:"The game's own page, above the board.",section:"This round"},UT,{key:"round_groups",label:"The groups",type:"collection",itemLabel:"{{group_label}}",description:`One per hidden group. ${Ky}`,readBy:"The Engine, to mark a guess and to name a group once it is found.",section:"This round",public:!1,fieldset:[{key:"group_label",label:"What they have in common",type:"freetext",description:'Shown to a fan only once they have found this group, e.g. "1996-97 Bulls".',readBy:"The game's own page, after the group is solved.",section:"This round"},{key:"group_members",label:"Which ones",type:"freetext",description:'The picks in this group, separated by commas, written exactly as they appear on the board, e.g. "Michael Jordan, Scottie Pippen". Every one has to be on the board, and no pick may be in two groups.',readBy:"The Engine, to mark a guess.",section:"This round"}]}],Yy=[{key:"prediction_question",label:"Question",type:"freetext",description:"What a fan is asked to call, in their words.",readBy:"The Engine, when it provisions the round.",section:"Content"},{key:"prediction_option",label:"Option",type:"freetext",description:"One thing a fan can call. Add one per outcome.",readBy:"The Engine, when it provisions the round.",section:"Content"}],rN=[{key:"card_note",label:"What this card means",type:"freetext",description:'A sentence explaining the card, shown when a fan taps it. "Goal in the first 10" might be "A goal is scored by either team inside the first ten minutes." Leave it empty and tapping the card does nothing.',readBy:"The game's own page, on the back of the card a fan taps.",section:"This card",public:!0}],aN=[{key:"round_prompt",label:"What a fan is told",type:"freetext",description:"The line above the goal, in a fan's words. Leave it empty to keep the wording the game was built with.",readBy:"The game's own page, above the goal.",section:"This round"},{key:"shoot_shots_allowed",label:"Shots",type:"number",description:"How many penalties a fan takes, from 1 to 20. Leave it empty for 5.",readBy:"The Engine, which refuses a shot once they are spent.",section:"This round"},{key:"shoot_goals_to_win",label:"Goals to win",type:"number",description:"How many goals count as winning the shootout. Reaching it does not end play: every remaining shot still scores. Leave it empty for 3.",readBy:"The Engine, which decides won or lost after the last shot.",section:"This round"},{key:"shoot_points_per_goal",label:"Points per goal",type:"number",description:"What each goal is worth on the leaderboard. Leave it empty for 100.",readBy:"The Engine, which scores each goal.",section:"This round"},{key:"shoot_difficulty",label:"Keeper",type:"freetext",description:"How good the goalkeeper is: easy_v1, balanced_v1 or hard_v1. Leave it empty for balanced_v1.",readBy:"The Engine, which picks the keeper's speed, reach and reactions from it.",section:"This round"}],iN=[{key:"mystery_answer",label:"The answer",type:"freetext",description:`The player fans are looking for, written exactly as the dataset names him, e.g. "Erling Haaland", or his dataset key. Must be a player in the game's dataset.`,readBy:"The Deduction Engine, as the mystery's subject.",section:"This mystery",public:!1},{key:"mystery_first_clue",label:"Free clue",type:"freetext",description:'The clue every fan starts with, e.g. "He plays for Manchester City." Required, 200 characters at most.',readBy:"The game's own page, as the first clue.",section:"This mystery",public:!0},{key:"mystery_first_clue_field",label:"Free clue is about",type:"freetext",description:"Which dataset field the free clue gives away, so the game narrows the field on it: team, position, nationality, age or any other field the dataset holds. Leave it empty for team.",readBy:"The Deduction Engine, to narrow the field on the free clue.",section:"This mystery",public:!0},{key:"mystery_second_clue",label:"Second clue",type:"freetext",description:'The clue a fan gets when their coins run low, e.g. "He is a forward." Required, 200 characters at most.',readBy:"The game's own page, as the second clue.",section:"This mystery",public:!0},{key:"mystery_second_clue_field",label:"Second clue is about",type:"freetext",description:"Which dataset field the second clue gives away. Must differ from the free clue's. Leave it empty for position.",readBy:"The Deduction Engine, to narrow the field on the second clue.",section:"This mystery",public:!0},{key:"mystery_difficulty",label:"Difficulty",type:"number",description:"1 easy, 2 medium or 3 hard. Leave it empty for 1.",readBy:"The Deduction Engine, which scores a solve by it.",section:"This mystery",public:!0}],Vy={hunt:[...tN,...nN],push:eN,group:oN,predict:[],bingo:rN,shoot:aN,place:[],mystery:iN},Zy={hunt:[],push:[],group:[],predict:[],bingo:Qz,shoot:[],place:[],mystery:[]},Jy={display_name:"displayName",title_font:"titleFont",title_font_weight:"titleFontWeight",title_letter_spacing:"titleLetterSpacing",title_colour:"titleColour",title_case:"titleCase",logo_text:"logoText",logo_accent_colour:"logoAccentColour",splash_gradient_start:"splashGradientStart",splash_gradient_end:"splashGradientEnd",splash_play_label:"splashPlayLabel",splash_continue_label:"splashContinueLabel",splash_error_text:"splashErrorText",splash_retry_label:"splashRetryLabel",consent_brand_name:"consentBrandName",consent_title:"consentTitle",consent_detail:"consentDetail",consent_accept_label:"consentAcceptLabel",consent_reject_label:"consentRejectLabel",consent_choose_label:"consentChooseLabel",consent_save_label:"consentSaveLabel",consent_analytics_label:"consentAnalyticsLabel",consent_marketing_label:"consentMarketingLabel",consent_functional_label:"consentFunctionalLabel",consent_settings_label:"consentSettingsLabel",consent_policy_version:"consentPolicyVersion",privacy_policy_url:"privacyPolicyUrl",recovery_open_label:"recoveryOpenLabel",recovery_show_title:"recoveryShowTitle",recovery_show_detail:"recoveryShowDetail",recovery_private_note:"recoveryPrivateNote",recovery_replace_note:"recoveryReplaceNote",recovery_enter_title:"recoveryEnterTitle",recovery_enter_detail:"recoveryEnterDetail",recovery_submit_label:"recoverySubmitLabel",recovery_not_recognised:"recoveryNotRecognised",recovery_restored:"recoveryRestored",recovery_get_label:"recoveryGetLabel",recovery_issue_failed:"recoveryIssueFailed",recovery_copy_label:"recoveryCopyLabel",recovery_copied_label:"recoveryCopiedLabel",recovery_share_label:"recoveryShareLabel",recovery_close_label:"recoveryCloseLabel",analytics_url:"analyticsUrl",strapline:"strapline",how_to_play:"howToPlay",primary_colour:"primaryColour",play_button_label:"playButtonLabel",play_again_label:"playAgainLabel",result_button_label:"resultButtonLabel",share_button_label:"shareButtonLabel",edition_name:"editionName",edition_strapline:"editionStrapline",margin_over:"marginOver",margin_exact:"marginExact",margin_under:"marginUnder",result_over:"resultOver",result_exact:"resultExact",result_under:"resultUnder",share_over:"shareOver",share_exact:"shareExact",share_under:"shareUnder",result_bust_note:"resultBustNote",share_bust_note:"shareBustNote",capped_today_note:"cappedTodayNote",share_dare:"shareDare",result_dare:"resultDare"},sN=new Set(["titleFont","titleFontWeight","titleLetterSpacing","titleColour","titleCase","logoText","logoAccentColour"]),cN=new Set(["splashGradientStart","splashGradientEnd","splashPlayLabel","splashContinueLabel","splashErrorText","splashRetryLabel","logoText","logoAccentColour"]);Ul="label_";MT={"Abril Fatface":[400],Anton:[400],"Archivo Black":[400],"Bebas Neue":[400],Bungee:[400],"Chakra Petch":[300,400,500,600,700],"DM Serif Display":[400],Fraunces:[400,600,700,900],Oswald:[400,500,600,700],"Playfair Display":[400,700,900],"Russo One":[400],"Space Grotesk":[400,500,700],Teko:[400,500,600,700],Unbounded:[400,700,900]},Qy="https://gamestage.ai";eb=Dl.filter(e=>e.required).map(e=>e.key)});var Bl=b(()=>{"use strict"});var tb=b(()=>{"use strict";wt();By();Tn();On();Oi();Ll();Yr();Bl();Kt()});function dN(e,t){if(/^[A-Z]+s?$/.test(t))return`${e}_${t.toLowerCase()}`;let o=t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase();return o.startsWith(`${e}_`)?o:`${e}_${o}`}function uN(e){let t=e.replace(/Pct$/,"Percent").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(" "),o=t[0]==="avg",r=(o?t.slice(1):t).map((n,a)=>/^[A-Z]{2,}$/.test(n)?n:a===0?n[0].toUpperCase()+n.slice(1):n.toLowerCase());return o?`${r.join(" ")} per game`:r.join(" ")}function ql(e){let t=Rn[e];return t?Object.entries(t.categories).flatMap(([o,r])=>r.map(n=>({key:dN(o,n),label:uN(n),category:o,name:n}))):[]}var Rn,Wl=b(()=>{"use strict";wt();Rn={nba:{sport:"basketball",label:"NBA",categories:{general:["gamesPlayed","avgMinutes","avgFouls","flagrantFouls","technicalFouls","ejections","doubleDouble","tripleDouble","minutes","rebounds","fouls","avgRebounds"],offensive:["avgPoints","avgFieldGoalsMade","avgFieldGoalsAttempted","fieldGoalPct","avgThreePointFieldGoalsMade","avgThreePointFieldGoalsAttempted","threePointFieldGoalPct","avgFreeThrowsMade","avgFreeThrowsAttempted","freeThrowPct","avgAssists","avgTurnovers","points","fieldGoalsMade","fieldGoalsAttempted","threePointFieldGoalsMade","threePointFieldGoalsAttempted","freeThrowsMade","freeThrowsAttempted","assists","turnovers"],defensive:["avgSteals","avgBlocks","steals","blocks"]},defaults:["offensive_points","general_rebounds","offensive_assists","general_games_played"]},wnba:{sport:"basketball",label:"WNBA",categories:{general:["gamesPlayed","avgMinutes","doubleDouble","tripleDouble","PER","avgRebounds"],offensive:["points","avgPoints","avgFieldGoalsMade","avgFieldGoalsAttempted","fieldGoalPct","avgThreePointFieldGoalsMade","avgThreePointFieldGoalsAttempted","threePointFieldGoalPct","avgFreeThrowsMade","avgFreeThrowsAttempted","freeThrowPct","avgAssists","avgTurnovers"],defensive:["avgSteals","avgBlocks"]},defaults:["offensive_points","offensive_avg_points","general_avg_rebounds","general_games_played"]},nfl:{sport:"football",label:"NFL",categories:{general:["gamesPlayed","fumblesForced","fumblesRecovered","fumblesTouchdowns"],passing:["completions","passingAttempts","completionPct","passingYards","yardsPerPassAttempt","passingYardsPerGame","longPassing","passingTouchdowns","interceptions","sacks","sackYardsLost","QBR","QBRating","adjQBR"],rushing:["rushingAttempts","rushingYards","yardsPerRushAttempt","longRushing","rushingBigPlays","rushingTouchdowns","rushingYardsPerGame","rushingFumbles","rushingFumblesLost","rushingFirstDowns"],receiving:["receptions","receivingTargets","receivingYards","yardsPerReception","receivingTouchdowns","longReception","receivingBigPlays","receivingYardsPerGame","receivingFumbles","receivingFumblesLost","receivingYardsAfterCatch","receivingFirstDowns"],defensive:["soloTackles","assistTackles","totalTackles","sacks","sackYards","tacklesForLoss","passesDefended","longInterception"],defensiveinterceptions:["interceptions","interceptionYards","interceptionTouchdowns"],scoring:["rushingTouchdowns","receivingTouchdowns","returnTouchdowns","totalTouchdowns","fieldGoals","kickExtraPoints","totalTwoPointConvs","totalPoints","totalPointsPerGame"],returning:["kickReturns","kickReturnYards","yardsPerKickReturn","longKickReturn","kickReturnTouchdowns","puntReturns","puntReturnYards","yardsPerPuntReturn","longPuntReturn","puntReturnTouchdowns","puntReturnFairCatches"],kicking:["fieldGoalsMade","fieldGoalAttempts","fieldGoalPct","longFieldGoalMade","extraPointsMade","extraPointAttempts","extraPointPct"],punting:["punts","puntYards","longPunt","grossAvgPuntYards","netAvgPuntYards","puntsBlocked","puntsInside20","touchbacks","fairCatches"]},defaults:["passing_yards","rushing_yards","receiving_yards","scoring_total_touchdowns"]},mlb:{sport:"baseball",label:"MLB",categories:{batting:["gamesPlayed","atBats","runs","hits","avg","doubles","triples","homeRuns","RBIs","totalBases","walks","strikeouts","stolenBases","onBasePct","slugAvg","OPS"],pitching:["gamesPlayed","gamesStarted","qualityStarts","ERA","wins","losses","saves","holds","innings","hits","earnedRuns","homeRuns","walks","strikeouts","strikeoutsPerNineInnings","WHIP"],fielding:["gamesPlayed","gamesStarted","fullInningsPlayed","totalChances","putouts","assists","fieldingPct","errors","doublePlays"]},defaults:["batting_home_runs","batting_hits","batting_rbis","pitching_strikeouts"],tablePerCategory:!0},nhl:{sport:"hockey",label:"NHL",categories:{general:["games","plusMinus","shifts","production","wins","losses"],offensive:["goals","assists","points","powerPlayGoals","powerPlayAssists","shotsTotal","shootingPct","gameWinningGoals","faceoffsWon","faceoffsLost","faceoffPercent","shootoutAttempts","shootoutGoals"],defensive:["overtimeLosses","avgGoalsAgainst","shotsAgainst","goalsAgainst","saves","savePct","shutouts"],penalties:["penaltyMinutes"]},defaults:["offensive_goals","offensive_assists","offensive_points","general_games"]}}});var pN,WT,hN,Hl,r8,nb=b(()=>{"use strict";Ye();wt();Wl();pN=12,WT=12,hN=["espn"],Hl=e=>hN.includes(e),r8=c.object({workspace:c.string().min(1),name:c.string().min(1),supplier:c.string().min(1),request:c.object({league:c.string(),season:c.number().int().optional(),measures:c.array(c.string()).min(1)}),refreshHours:c.number().int().positive().default(pN),override:c.object({refreshHours:c.number().int().positive(),by:c.string(),at:c.string()}).optional(),disabled:c.boolean().default(!1),createdAt:c.string(),updatedAt:c.string(),by:c.string()})});var fN,HT,gN,c8,KT,l8,d8,u8,ob=b(()=>{"use strict";Ye();wt();fN=c.enum(["push","pull"]),HT=c.object({workspaceId:c.string().min(1),name:c.string().min(1),key:c.string().min(1),digest:c.string().regex(/^[0-9a-f]{16}$/),measures:c.array(c.string()).default([]),counts:c.record(c.string(),c.number().int().nonnegative()).default({}),scored:c.array(c.string()).optional(),bytes:c.number().int().nonnegative().default(0),origin:fN.default("push"),supplier:c.string().optional(),publishedAt:c.string().nullable().default(null),checkedAt:c.string().nullable().default(null),failing:c.boolean().default(!1),counted:c.boolean().default(!1)}),gN=c.object({gameId:c.string().min(1),gameName:c.string().default(""),pinnedDigest:c.string().nullable().default(null),stale:c.boolean().default(!1),roundIds:c.array(c.string()).default([])}),c8=c.object({dataset:HT,usedBy:c.array(gN).default([])}),KT=c.enum(["pushed","pulled","joined","refused","failed"]),l8=c.object({at:c.string(),event:KT,dataset:c.string().min(1),digest:c.string().nullable().default(null),gameId:c.string().nullable().default(null),gameName:c.string().nullable().default(null),roundId:c.string().nullable().default(null),message:c.string().default(""),ok:c.boolean().default(!0)}),d8=c.object({dataset:c.string().optional(),gameId:c.string().optional(),event:c.array(KT).optional(),since:c.string().optional(),search:c.string().optional(),before:c.string().optional(),limit:c.number().int().positive().max(500).default(100)}),u8=c.object({datasets:c.array(HT).default([]),unavailable:c.string().nullable().default(null)})});var rb=b(()=>{"use strict";Kt();qt()});var ab=b(()=>{"use strict";On();Kt()});var ib=b(()=>{"use strict"});var sb=b(()=>{"use strict";wt();On();ab();Ll();ib();Kt();On();qt();Tn();Bl();Oi()});function cb(e){return YT+e.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function ZT(e){if(e.startsWith(YT)){for(let[t,o]of Object.entries(VT))if(o.some(r=>cb(r)===e))return t}}function lb(e){let o=Object.values(VT).flat().map(cb).indexOf(e);return o===-1?void 0:o}var YT,VT,Kl,db=b(()=>{"use strict";YT="label_taster_",VT={"Taster: board and buttons":["playPrompt","attemptsLabel","mistakesLabel","pickedLabel","scoreLabel","timeLeftLabel","timeUpLabel","nextRoundLabel","oneAwayLabel","runningLabel","spentLabel","underNote","bustFallback","restartLabel","playAnotherLabel","playAnotherBusyLabel","questionCountLabel","yourCallLabel"],"Taster: result and leaderboard":["wonLabel","finishedLabel","pendingLabel","pendingNote","rankLabel","rankUnavailable","rewardLabel","anonymousLabel","derivedNameLabel","boardLabel","boardLoading","boardEmpty","rankedBy","closeLabel"],"Taster: when a play is refused":["refused","refusedClosed","refusedFinished","refusedNoTries","refusedTooManyWrong","refusedNoPicks","refusedIncomplete","refusedOneAtATime","refusedMoved","roundLockedLabel","roundLockedNextLabel","unavailable"],"Taster: loading":["loading","loadingTakingTooLong","loadingReload","loadingConnecting","loadingLookingUp","loadingKits","loadingOpening","loadingStarting","loadingSettings","loadingRound","loadingState","loadingFailedAt","loadingProgressLabel"],"Taster: navigation and page":["eyebrow","tabHome","tabPlay","tabHow","tabsLabel","moreLabel","homeTitle","homeHere","howToPlay","backLabel","footNote","footLink"],"Taster: proofs and the notify demo":["proofsHeading","proofsBlurb","lookLabel","changeLabel","duplicateLabel","busyLabel","payloadNote","needsPlay","notCapped","notifyTitle","notifyMockNote","notifyFieldLabel","notifySubmit","notifyDone"],"Taster: bingo":["bingoDealLabel","bingoDealingLabel","bingoWhichLabel","bingoFlipHint","bingoPreviousLabel","bingoNextLabel","bingoWatchingLabel","bingoOneAwayLabel","bingoLineLabel","bingoCalledLabel","bingoFreeLabel"],"Taster: penalties":["shootOptionsLabel","shootReplayLabel","shootInstruction","shootPitchLabel","shootRetryLabel","shootGoalLabel","shootSavedLabel","shootWideLabel","shootOverLabel","shootFrameLabel","shootGoalsLabel","shootGoalsTally","shootAimLabel","shootPowerLabel","shootPlacedLabel","shootFirmLabel","shootFullLabel","shootZoneTopLeft","shootZoneTopCentre","shootZoneTopRight","shootZoneLowLeft","shootZoneLowCentre","shootZoneLowRight"]};Kl=["tabHow","boardLabel","closeLabel","playAnotherLabel","restartLabel","backLabel"].map(e=>cb(e))});function kN(e){let t=new Map,o=r=>{for(let n of r)if(n.type==="collection"){let a=t.get(n.key);if(a&&(a.itemLabel!==n.itemLabel||JSON.stringify(a.fieldset??[])!==JSON.stringify(n.fieldset??[])))throw new Error(`The collection "${n.key}" is declared with two different shapes. One key is one declaration; its fieldset and item label must match wherever it appears.`);t.set(n.key,n),o(n.fieldset??[])}};return o(e),[...bN,...Yy.map(wN),...[...t.values()].map(vN)]}function ub(e){let t=[];for(let o of e){let r=o.public===!1,n={label:o.label,key:o.key,field:QT(o),description:o.description,...o.type==="collection"?{}:{mandatory:o.required===!0},...r?{public:!1,cloneable:!1}:{}},a=t.find(i=>i.name===o.section);if(a||(a={name:o.section},t.push(a)),o.subsection){let i=a.subsections??=[],s=i.find(d=>d.name===o.subsection);s||(s={name:o.subsection,...o.subsectionDescription?{description:o.subsectionDescription}:{},properties:[]},i.push(s)),s.properties.push(n)}else(a.properties??=[]).push(n)}return t}function _N(e){let t=e.archetypes.map(De);for(let a of t)if(!JT[a])throw new Error(`No Studio element name for the ${a} archetype. Add one to ARCHETYPE_ELEMENT_NAMES rather than letting Studio show a blank type.`);let o=a=>`${e.urls.baseAppsUrl}/${a}`,r=new Set(e.wording??Wy),n=[...Dl.filter(a=>!Wy.includes(a.key)||r.has(a.key)),...[...r].filter(a=>a.startsWith(Ul)).sort(xN).map(SN)];return{"spec.json":{name:e.name,id:e.id,version:e.version,base_apps_url:e.urls.baseAppsUrl,dash_image:e.urls.dashImage,embed_url:e.urls.embedUrl,elements:o("elements.json"),fields:o("fields.json"),project_settings:o("project_settings.json"),event_settings:o("event_settings.json"),schedule:!0,analytics:!0,live_activity:!0,localisation:!1},"elements.json":t.map(a=>({name:JT[a],content_type:XT(a),derived_from:Yl[a]?.derivedFrom??"data",duration:Yl[a]?.duration??{mode:"instant"},label:Yl[a]?.derivedFrom==="prediction"?"{{question.text}}":"{{element.title}}",custom_fields:ub([...Ww.includes(De(a))?Ml.filter(i=>i.key==="title"):Ml,...Vy[De(a)]??[]]),...Yl[a]?.derivedFrom==="prediction"?{label_question:a==="bingo"?"Card":"Question",label_option:a==="bingo"?"Outcome":"Option",reveal_results:{modes:["manual"],default:"manual"},correct_option:{live_update:!0},question:[{label:"Question",key:"text",field:"prediction_question",mandatory:"question"}],option:[{label:"Option",key:"text",field:"prediction_option",mandatory:"option"}]}:{}})),"fields.json":kN([...n,...Hy,...Ml,...Object.values(Vy).flat(),...Object.values(Zy).flat(),...Yy]),"project_settings.json":{sections:ub(n)},"event_settings.json":{sections:ub([...Hy,...t.flatMap(a=>Zy[a]??[])])}}}function xN(e,t){let o=lb(e),r=lb(t);return o===void 0&&r===void 0?e<t?-1:e>t?1:0:o===void 0?-1:r===void 0?1:o-r}function SN(e){let t=GT(e),o=ZT(e);if(!o)return t;let r=e.slice(13).replace(/_/g," ").trim();return{...t,label:r.charAt(0).toUpperCase()+r.slice(1),subsection:o,...Kl.includes(e)?{required:!0}:{}}}function eE(e){return _N({name:e.gameName,id:e.gameId,wording:e.wording??[],version:`0.0.${e.manifestRevision}`,archetypes:[e.archetype],urls:e.urls})}var JT,XT,Yl,QT,bN,vN,wN,mb=b(()=>{"use strict";Yr();db();Tn();JT=Kw,XT=e=>{let t=De(e);return $u[t]??`gamestage-${t.replaceAll("_","-")}-element`},Yl={hunt:{derivedFrom:"data",duration:{mode:"fixed",default:86400}},push:{derivedFrom:"data",duration:{mode:"fixed",default:86400}},group:{derivedFrom:"data",duration:{mode:"fixed",default:86400}},place:{derivedFrom:"data",duration:{mode:"fixed",default:86400}},predict:{derivedFrom:"prediction",duration:{mode:"flexible"}},bingo:{derivedFrom:"prediction",duration:{mode:"flexible"}},shoot:{derivedFrom:"data",duration:{mode:"fixed",default:86400}}},QT=e=>e.type==="collection"?e.key:e.type,bN=[{key:"colour",type:"colour"},{key:"freetext",type:"freetext",localisable:!1},{key:"number",type:"number"},{key:"image",type:"image",width:[1,2e3],height:[1,2e3],file_size:500,localisable:!1},{key:"boolean",type:"boolean"},{key:"wysiwyg",type:"wysiwyg",localisable:!1}],vN=e=>({key:e.key,type:"collection",...e.itemLabel?{item_label:e.itemLabel}:{},fieldset:(e.fieldset??[]).map(t=>({label:t.label,key:t.key,field:QT(t),...t.description?{description:t.description}:{}}))}),wN=e=>({key:e.key,type:e.type,...e.type==="freetext"||e.type==="wysiwyg"||e.type==="image"?{localisable:!1}:{}})});var pb=b(()=>{"use strict";Tn()});var tE=b(()=>{"use strict";Kr();Na();Nl();Fy();tb();Pl();wt();nb();ob();rb();sb();mb();pb();Py();Oy();qt()});function rE(e){let t=1e3*2**(e-1),o=t*.2*(Math.random()*2-1);return Math.round(t+o)}function iE(e){let t=e.fetch??globalThis.fetch,o=e.maxAttempts??4,r=e.baseUrl.replace(/\/+$/,"");return async function(a,i,s={}){let d=globalThis.location?.origin,l=new URL(`${r}${i}`,r.startsWith("/")?d:void 0);for(let[p,h]of Object.entries(s.query??{}))h!=null&&l.searchParams.set(p,String(h));let u;for(let p=1;p<=o;p++){let h=typeof e.token=="function"?await e.token():e.token,y;try{y=await t(l,{method:a,headers:{authorization:`Bearer ${h}`,...s.body===void 0?{}:{"content-type":"application/json"}},body:s.body===void 0?void 0:JSON.stringify(s.body)})}catch(j){let re=j instanceof Error?j.message:String(j);if(u=new dt(0,"unreachable",`Could not reach the control plane at ${r}: ${re}. Check your connection and run the command again.`,!0),p===o)break;await nE(rE(p));continue}if(y.ok)return await y.json();let v=await y.json().catch(()=>({}));if(u=new dt(y.status,v.error?.code??"unknown",v.error?.message??y.statusText,v.error?.retryable??!1),!u.retryable||p===o)break;let I=Number(y.headers.get("retry-after"));await nE(Number.isFinite(I)&&I>0?I*1e3:rE(p))}throw u??new dt(0,"unknown","Request failed.",!1)}}function sE(e){let t=iE(e);return{setDatasetRefresh:(o,r,n)=>t("PUT",`/v1/admin/workspaces/${encodeURIComponent(o)}/datasets/${encodeURIComponent(r)}/refresh`,{body:{hours:n}}),setWorkspaceAccess:(o,r,n,a)=>t("PUT",`/v1/admin/workspaces/${encodeURIComponent(o)}/access`,{body:{access:r,reason:n??null,...a?.allowPersonalEmail?{allowPersonalEmail:!0}:{}}}),async listAccess(){let o=await t("GET","/v1/admin/access"),r=[...o.waiting??[],...o.decided??[]].filter(n=>typeof n=="object"&&n!==null).map(CT);return IT(r)},getWorkspace:o=>t("GET",`/v1/admin/workspaces/${encodeURIComponent(o)}`),setWorkspacePlan:(o,r,n)=>t("PUT",`/v1/admin/workspaces/${encodeURIComponent(o)}/plan`,{body:{tier:r,...n===void 0?{}:{liveGameAllowance:n}}}),runCreatorSync:()=>t("POST","/v1/admin/creator-sync")}}function Vo(e){let t=iE(e),o=["meters","rounds","history","destinations","sections","issues"],r=i=>{let s={...i,containerLabel:i.containerLabel??"Round"};for(let d of o)Array.isArray(s[d])||(s[d]=[]);return s},n=i=>({...i,access:zl(i),terms:i.terms??null,games:(i.games??[]).map(r),gamesTotal:i.gamesTotal??(i.games??[]).length,archivedTotal:i.archivedTotal??(i.games??[]).filter(s=>s.state==="archived").length}),a=i=>({...i,workspace:{...i.workspace,access:zl(i.workspace??{}),games:(i.workspace?.games??[]).map(r)}});return{getWorkspace:async()=>n(await t("GET","/v1/workspace")),getWorkspaceSummary:async()=>{try{return n(await t("GET","/v1/workspace/summary"))}catch(i){if(!(i instanceof dt)||i.status!==404)throw i;return oE||(oE=!0,console.warn("[control-plane] no /v1/workspace/summary, falling back to the full workspace read. If this persists the control plane is behind the site, and every Stage screen is carrying the whole workspace again.")),n(await t("GET","/v1/workspace"))}},linkGitHub:async i=>a(await t("PUT","/v1/workspace/github",{body:{login:i}})),acceptTerms:async i=>a(await t("PUT","/v1/workspace/terms",{body:{version:i}})),setPlan:async i=>a(await t("PUT","/v1/workspace/plan",{body:{tier:i}})),uploadTarget:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/uploads`,{body:{filename:s}}),setPresetArt:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/art/preset`,{body:{preset:s}}),artUploadTarget:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/art/uploads`,{body:{content_type:s}}),setUploadedArt:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/art`,{body:{url:s}}),referenceUploadTarget:(i,s)=>t("POST","/v1/reference/uploads",{body:{name:i,digest:s}}),pruneBundle:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/bundle`,{body:{filenames:s}}),async getGame(i){try{return r(await t("GET",`/v1/games/${encodeURIComponent(i)}`))}catch(s){if(s instanceof dt&&s.status===404)return;throw s}},setAwake:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/state`,{body:{awake:s}}),setDestination:(i,s,d)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/destinations`,{body:{destination_id:s,enabled:d}}),registerGame:i=>t("POST","/v1/games",{body:i}),archiveGame:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/archive`),addGraphic:()=>{throw new Error("A graphic is composed by the control plane, not recorded by a client. Use composeGraphic(gameId, { template, consent: true }).")},composeGraphic:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/graphics`,{body:s}),removeGraphic:(i,s)=>t("DELETE",`/v1/games/${encodeURIComponent(i)}/graphics/${encodeURIComponent(s)}`),promoteGame:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/promote`),withdrawGame:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/withdraw`),deleteGame:i=>t("DELETE",`/v1/games/${encodeURIComponent(i)}`),deploy:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/deploy`,{body:s}),refreshRound:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/round/refresh`),roundSeedCandidates:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/round/candidates`,{body:s}),async seedRound(i,s,d){try{return await t("PUT",`/v1/games/${encodeURIComponent(i)}/round`,{body:{round:s,...d}})}catch(l){throw l instanceof dt&&l.status===404&&!/no such game/i.test(l.message)?new dt(404,"not_supported","This control plane cannot take a round yet. It is running a build older than this CLI, so the round has to go in through Studio until it is updated.",!1):l}},setSignal:async i=>a(await t("PUT","/v1/workspace/signal",{body:{enabled:i}})),setWorkspaceProfile:i=>t("PUT","/v1/workspace/profile",{body:i}),async getEndpoints(i){try{return await t("GET",`/v1/games/${encodeURIComponent(i)}/endpoints`)}catch(s){if(s instanceof dt&&s.status===404)return;throw s}},async getLogs(i,s){let{lines:d}=await t("GET",`/v1/games/${encodeURIComponent(i)}/logs`,{query:s});return d},async getAuditLog(i){let{records:s}=await t("GET","/v1/audit",{query:i});return s},listSourceDatasets:i=>t("GET",`/v1/sources/${encodeURIComponent(i)}/datasets`),switchOnSource:(i,s)=>t("POST",`/v1/sources/${encodeURIComponent(i)}/datasets`,{body:s}),switchOffSource:(i,s)=>t("DELETE",`/v1/sources/${encodeURIComponent(i)}/datasets/${encodeURIComponent(s)}`),async listDatasets(){try{let i=await t("GET","/v1/reference/datasets");return!i||!Array.isArray(i.datasets)?{datasets:[],unavailable:aE}:{datasets:i.datasets,unavailable:i.unavailable??null}}catch(i){if(i instanceof dt&&i.status===404)return{datasets:[],unavailable:aE};throw i}},async getDataset(i){try{let s=await t("GET",`/v1/reference/datasets/${encodeURIComponent(i)}`);return s?.dataset?s:void 0}catch(s){if(s instanceof dt&&s.status===404)return;throw s}},async previewDataset(i,s,d){try{let l=await t("GET",`/v1/reference/preview/${encodeURIComponent(i)}`,{query:{limit:s,by:d}});return l&&Array.isArray(l.rows)?l:void 0}catch(l){if(l instanceof dt&&l.status===404)return;throw l}},async getDataLog(i){try{let s=await t("GET","/v1/reference/log",{query:i});return Array.isArray(s?.lines)?s.lines:[]}catch(s){if(s instanceof dt&&s.status===404)return[];throw s}}}}var dt,nE,oE,aE,cE=b(()=>{"use strict";Nl();dt=class extends Error{status;code;retryable;constructor(t,o,r,n){super(r),this.status=t,this.code=o,this.retryable=n,this.name="ControlPlaneError"}},nE=e=>new Promise(t=>setTimeout(t,e)),oE=!1;aE="This control plane is running a build older than this screen, so it cannot list datasets yet."});function TN(e){if(e.timerSeconds===void 0||!Number.isInteger(e.timerSeconds)||e.timerSeconds<=0||!e.startedAt)return;let t=Date.parse(e.startedAt);if(Number.isFinite(t))return t+e.timerSeconds*1e3}function lE(e,t){let o=TN(e);if(o===void 0)return!1;let r=typeof t=="number"?t:Date.parse(t);return Number.isFinite(r)?r>o:!1}var dE=b(()=>{"use strict"});var uE=b(()=>{"use strict";wt();Kt()});var mE=b(()=>{"use strict";On()});var ji,pE,it,hE,fE,Vr,gE,Li,Vl=b(()=>{"use strict";wt();ji=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.round(e):null,pE=e=>{let t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t*100):null},it=(e,t)=>({fields:[e],label:t,read:o=>ji(o[e])}),hE=270,fE=3,Vr=(e,t)=>({fields:[e,"minutes"],label:`${t} per 90 minutes, in hundredths (at least ${hE} minutes played)`,partial:!0,scale:100,read:o=>{let r=ji(o[e]),n=ji(o.minutes);return r===null||n===null||n<hE?null:Math.round(r*90*100/n)}}),gE=(e,t)=>({fields:[e,"starts"],label:`${t} per start, in hundredths (at least ${fE} starts)`,partial:!0,scale:100,read:o=>{let r=ji(o[e]),n=ji(o.starts);return r===null||n===null||n<fE?null:Math.round(r*100/n)}}),Li={player_price:{...it("now_cost","Price, in tenths of a million"),scale:10},season_points:it("total_points","Points this season"),points_per_game:{fields:["points_per_game"],label:"Points per game, in tenths",scale:10,read:e=>{let t=Number(e.points_per_game);return Number.isFinite(t)&&t>=0?Math.round(t*10):null}},minutes:it("minutes","Minutes played"),starts:it("starts","Starts"),goals:it("goals_scored","Goals"),assists:it("assists","Assists"),own_goals:it("own_goals","Own goals"),penalties_missed:it("penalties_missed","Penalties missed"),penalties_saved:it("penalties_saved","Penalties saved"),yellow_cards:it("yellow_cards","Yellow cards"),red_cards:it("red_cards","Red cards"),saves:it("saves","Saves"),bonus:it("bonus","Bonus points"),tackles:it("tackles","Tackles"),recoveries:it("recoveries","Ball recoveries"),clearances_blocks_interceptions:it("clearances_blocks_interceptions","Clearances, blocks and interceptions"),defensive_contributions:it("defensive_contribution","Defensive contribution points"),expected_goals:{fields:["expected_goals"],label:"Expected goals, in hundredths",scale:100,read:e=>pE(e.expected_goals)},expected_assists:{fields:["expected_assists"],label:"Expected assists, in hundredths",scale:100,read:e=>pE(e.expected_assists)},goals_per_90:Vr("goals_scored","Goals"),assists_per_90:Vr("assists","Assists"),yellow_cards_per_90:Vr("yellow_cards","Yellow cards"),tackles_per_90:Vr("tackles","Tackles"),recoveries_per_90:Vr("recoveries","Ball recoveries"),saves_per_90:Vr("saves","Saves"),bonus_per_start:gE("bonus","Bonus points"),defensive_contributions_per_start:gE("defensive_contribution","Defensive contribution points")}});var hb,yE,dH,fb=b(()=>{"use strict";wt();Vl();hb={clean_sheets:{label:"Clean sheets"},premier_league_appearances:{label:"Premier League appearances, career"},premier_league_goals:{label:"Premier League goals, career"},premier_league_titles:{label:"Premier League titles won"},first_premier_league_season:{label:"First Premier League season, as its start year"}},yE=[...new Set([...Object.keys(Li),...Object.keys(hb)])],dH=[...new Set(["goals","assists","clean_sheets","minutes","starts","yellow_cards","red_cards","penalties_saved","expected_goals","player_price","season_points",...Object.keys(hb)])].filter(e=>e in Li||e in hb)});function Di(e){return e.standing==="unofficial"?gb:void 0}function bE(e){return zn.find(t=>t.id===e)}var EN,$N,AN,gH,gb,zn,yb=b(()=>{"use strict";Vl();Wl();fb();Ye();EN=c.discriminatedUnion("kind",[c.object({kind:c.literal("everyone")}),c.object({kind:c.literal("domains"),domains:c.array(c.string().min(1)).min(1)}),c.object({kind:c.literal("named")})]),$N=c.enum(["licensed","unofficial","creator"]),AN=c.enum(["ours","creator"]),gH=c.object({id:c.string().min(1),label:c.string().min(1),standing:$N,origin:AN,tiers:c.array(c.enum(["runtime","live","enterprise"])).min(1),produces:c.array(c.string()),note:c.string().min(1),catalogue:c.object({offers:c.string().min(1),competitions:c.array(c.string()).default([]),cost:c.string().min(1),needsKey:c.boolean().default(!1),signUp:c.string().url().optional(),licence:c.string().min(1),fetched:c.boolean().optional()}).optional(),audience:EN.optional()}),gb="Requests to this source are made on behalf of you, the game builder. You are responsible for the data you consume, and for securing the legal rights and licence to use it. We recommend using it for testing only, and not launching with it unless you have explicit permission from the data owner.";zn=[{id:"nba",label:"NBA",standing:"licensed",origin:"ours",tiers:["runtime","live","enterprise"],audience:{kind:"domains",domains:["nba.com"]},produces:["career_points","career_rebounds","career_assists","career_games"],note:"The NBA's own data, licensed by the NBA for its own use only. Not available to anyone else. Career totals are the NBA's own figures, not a sum we computed. Not fetched yet.",catalogue:{offers:"NBA players' career totals: points, rebounds, assists, games.",competitions:["NBA"],cost:"For the NBA's own account only.",needsKey:!1,licence:"The NBA's, for the NBA's own use only. Nobody else may use it.",fetched:!1}},{id:"push",label:"Your own data",standing:"creator",origin:"creator",tiers:["runtime","live","enterprise"],produces:[],note:"A file you push with `gamestage reference push`, from your machine or your CI.",catalogue:{offers:"Any values you hold, in a JSON file you push: your squad, your archive, your own licensed feed.",competitions:[],cost:"Free on every plan.",needsKey:!1,licence:"Yours. Your data, or a feed you license: your terms.",fetched:!0}},{id:"fpl",label:"Fantasy Premier League",standing:"unofficial",origin:"ours",tiers:["runtime","live","enterprise"],produces:Object.keys(Li),note:"Free, with no contract behind it, so a prize game wants a licensed source. Prices move weekly and a round in play keeps the ones it opened with.",catalogue:{offers:"Premier League players: FPL price and points, goals, assists, own goals, penalties missed and saved, cards, saves, bonus, tackles, recoveries, defensive contributions, minutes, starts and expected goals and assists, plus per-90 and per-start ratios, with each player's name, club and position. Refreshed daily.",competitions:["Premier League"],cost:"Free on every plan. We fetch it; no key needed.",needsKey:!1,licence:"Unofficial: no contract and no support.",fetched:!0}},{id:"premier-league",label:"The Premier League",standing:"licensed",origin:"ours",tiers:["runtime","live","enterprise"],audience:{kind:"domains",domains:["monterosa.co.uk","premierleague.com"]},produces:yE,note:"The Premier League's own feeds, used with their permission, for Monterosa and the Premier League only. Every current player's season and career record with his photo. Refreshed nightly.",catalogue:{offers:"Every current Premier League player: this season's FPL numbers, career Premier League appearances, goals and titles, first season, previous clubs, nationality, height, preferred foot, set-piece duties and photo. Refreshed nightly.",competitions:["Premier League"],cost:"For Monterosa and the Premier League only.",needsKey:!1,licence:"The Premier League's permission, for their own games. Not ours to offer anyone else."}},{id:"sportmonks",label:"Sportmonks football",standing:"creator",origin:"ours",tiers:["runtime","live","enterprise"],produces:["goals","assists","appearances","minutes","yellow_cards","clean_sheets"],note:"Your own Sportmonks plan and key. We call it on a schedule with your key, and your plan decides which competitions you can use.",catalogue:{offers:"Football players' season statistics for any competition your plan covers: goals, assists, appearances, minutes, cards, clean sheets, with each player's name, team and position.",competitions:[],cost:"Your Sportmonks plan. A free plan covers a few smaller leagues; the Premier League needs a paid one.",needsKey:!0,signUp:"https://www.sportmonks.com/football-api/",licence:"Yours: your Sportmonks plan and its terms. Check they cover this use before a game with a prize."}},{id:"espn",label:"ESPN",standing:"unofficial",origin:"ours",tiers:["runtime","live","enterprise"],produces:[...new Set(Object.keys(Rn).flatMap(e=>ql(e).map(t=>t.key)))],note:"ESPN's openly reachable player statistics, with no contract behind it, so for development and not for a public launch. Refreshed twice a day.",catalogue:{offers:"Season statistics for every player in the NBA, WNBA, NFL, MLB and NHL: points, yards, goals, home runs and dozens more, with each player's name, team and position. Refreshed twice a day.",competitions:["NBA","WNBA","NFL","MLB","NHL"],cost:"Free on every plan. We fetch it; no key needed.",needsKey:!1,licence:"Unofficial: no contract and no support.",fetched:!0}}]});function IN(e,t){let o=e.trim().toLowerCase();return o?t.some(r=>{let n=r.trim().toLowerCase();return o===n||o.endsWith(`.${n}`)}):!1}function vE(e){let t=e.ownerEmail?.lastIndexOf("@")??-1,o=t>=0?e.ownerEmail.slice(t+1).trim().toLowerCase():void 0;return{id:e.id,domain:o||void 0,grants:e.supplierGrants}}function PN(e){return e.audience??CN}function ON(e,t,o=zn){let r=o.find(a=>a.id===t);if(!r)return{allowed:!1,reason:`There is no supplier called "${t}".`};if(e.grants?.includes(t))return{allowed:!0,because:"grant"};let n=PN(r);switch(n.kind){case"everyone":return{allowed:!0,because:"audience"};case"domains":return e.domain&&IN(e.domain,n.domains)?{allowed:!0,because:"audience"}:{allowed:!1,reason:`${r.label} is available to ${n.domains.join(" and ")}. Ask us if you need it.`};case"named":return{allowed:!1,reason:`${r.label} is granted per account. Ask us if you need it.`}}}function wE(e,t=zn){return t.map(o=>({supplier:o,entitlement:ON(e,o.id,t)}))}var CN,kE=b(()=>{"use strict";yb();CN={kind:"everyone"}});var kH,_E=b(()=>{"use strict";Ye();kH=c.object({org:c.string().min(1),game:c.string().min(1),player:c.string().min(1),alias:c.string().optional(),round:c.string().optional(),score:c.number(),outcome:c.string().optional(),at:c.string().min(1)})});var xE=b(()=>{"use strict";wt()});var SE=b(()=>{"use strict";wt()});function bb(e){let t;try{t=JSON.parse(e)}catch(r){return{ok:!1,reason:"That is not JSON.",detail:r instanceof Error?r.message:void 0}}let o=zt.safeParse(t);if(!o.success){let r=o.error.issues[0];return{ok:!1,reason:"That is not valid reference data.",detail:r?`${r.path.join(".")||"document"}: ${r.message}`:void 0}}return{ok:!0,summary:{digest:jl(e),measures:o.data.measures.map(r=>r.key),counts:Object.fromEntries(o.data.measures.map(r=>[r.key,Object.keys(r.values).length])),scored:o.data.measures.filter(r=>r.scoring).map(r=>r.key)}}}async function TE(e,t){let o=bb(e);return o.ok&&(await t("copy",e),await t("pointer",e)),o}function EE(e,t){return e?e.filter(o=>!t.scored.includes(o)):[]}var $E=b(()=>{"use strict";wt()});var AE=b(()=>{"use strict"});var CE=b(()=>{"use strict"});var RN,zN,NN,PH,IE=b(()=>{"use strict";RN="Monterosa",zN="04716325",NN="3B, The Plaza, floor 3, 100 Old Hall Street, Liverpool, L3 9QJ, United Kingdom",PH=`${RN}, ${NN}. Company number ${zN}.`});function Zl(e){let t=[],o=/\[([^\]]*)\]/g,r=0;for(let n of e.matchAll(o))n.index>r&&t.push({text:e.slice(r,n.index),accent:!1}),n[1]&&t.push({text:n[1],accent:!0}),r=n.index+n[0].length;return r<e.length&&t.push({text:e.slice(r),accent:!1}),t.filter(n=>n.text.length>0)}function vb(e){return Zl(e).map(t=>t.text).join("")}var wb=b(()=>{"use strict"});function ho(e){return e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function UN(e){let t=e.length===4?`#${[...e.slice(1)].map(a=>a+a).join("")}`:e,[o,r,n]=[1,3,5].map(a=>{let i=parseInt(t.slice(a,a+2),16)/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4});return .2126*o+.7152*r+.0722*n>.4}function Jl(e,t){return e&&FN.test(e.trim())?e.trim():t}function kb(e){return Zl(e).map(t=>t.accent?`<span class="gs-boot__accent">${ho(t.text)}</span>`:ho(t.text)).join("")}function PE(e){let t=Jl(e.gradientStart,"#101820"),o=Jl(e.gradientEnd,t),r=UN(t),n=Jl(e.titleColour,r?"#101820":"#ffffff"),a=Jl(e.logoAccentColour,n),i=Gl(e.titleFont,e.titleFontWeight),s=Number(e.titleLetterSpacing),d=e.titleLetterSpacing!==void 0&&e.titleLetterSpacing!==""&&Number.isFinite(s)?`${Math.min(.4,Math.max(-.1,s))}em`:"normal",l=["upper","uppercase","capitals","caps"].includes((e.titleCase??"").trim().toLowerCase()),u=e.logoText?.trim()||e.name;return{start:t,end:o,light:r,ink:n,accent:a,font:i,tracking:d,upper:l,logo:u,words:{play:e.playLabel?.trim()||Nn.play,continue:e.continueLabel?.trim()||Nn.continue,error:e.errorText?.trim()||Nn.error,retry:e.retryLabel?.trim()||Nn.retry}}}function GN(e){let t=Math.max(1,[...vb(e)].length);return`min(clamp(56px, 19vw, 132px), calc((100vw - 48px) / ${Math.round(t*.86*100)/100}))`}function BN(e){let t=PE(e),o=t.light?"rgba(16,24,32,.16)":"rgba(255,255,255,.2)",r=t.light?"rgba(16,24,32,.78)":"rgba(255,255,255,.9)",n=t.font&&e.logoFontData&&/^[A-Za-z0-9+/=]+$/.test(e.logoFontData)?e.logoFontData:void 0,a=t.font&&!n?Ni(t.font.family):void 0,i=t.font?`"${t.font.family}", system-ui, sans-serif`:"system-ui, sans-serif",s={font:t.font?{family:t.font.family,weight:t.font.weight}:null,minMs:LN,fontTimeoutMs:DN,maxMs:MN,words:t.words,mark:Cn};return`<meta name="color-scheme" content="${t.light?"light":"dark"}" ${kt} />
108
+ `:""}return Ty.dump=N,Ty}function YR(){if(O0)return lt;O0=1;let e=HR(),t=KR();function o(r,n){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}return lt.Type=vt(),lt.Schema=R0(),lt.FAILSAFE_SCHEMA=L0(),lt.JSON_SCHEMA=G0(),lt.CORE_SCHEMA=B0(),lt.DEFAULT_SCHEMA=Ey(),lt.load=e.load,lt.loadAll=e.loadAll,lt.dump=t.dump,lt.YAMLException=Ai(),lt.types={binary:H0(),float:U0(),map:j0(),null:D0(),pairs:Y0(),set:V0(),timestamp:q0(),bool:M0(),int:F0(),merge:W0(),omap:K0(),seq:N0(),str:z0()},lt.safeLoad=o("safeLoad","load"),lt.safeLoadAll=o("safeLoadAll","loadAll"),lt.safeDump=o("safeDump","dump"),lt}var lt,El,mo,c0,ry,l0,ay,d0,iy,u0,sy,m0,cy,p0,ly,h0,dy,f0,uy,g0,my,y0,py,b0,hy,v0,fy,w0,gy,k0,yy,_0,by,x0,vy,S0,wy,T0,ky,E0,_y,$0,xy,A0,Sy,C0,I0,Ty,P0,O0,VR,Mt,E3,$3,A3,C3,I3,P3,Z0,O3,R3,z3,N3,j3,L3,D3,Ci=b(()=>{lt={},El={},mo={};Ty={};VR=YR(),Mt=qR(VR),{Type:E3,Schema:$3,FAILSAFE_SCHEMA:A3,JSON_SCHEMA:C3,CORE_SCHEMA:I3,DEFAULT_SCHEMA:P3,load:Z0,loadAll:O3,dump:R3,YAMLException:z3,types:N3,safeLoad:j3,safeLoadAll:L3,safeDump:D3}=Mt});function Pn(e){let t;try{t=Mt.load(e,{schema:JR})}catch(n){return{ok:!1,issues:[{path:"(document)",message:n instanceof Error?n.message:"YAML parse failed"}]}}if(t===null||typeof t!="object")return{ok:!1,issues:[{path:"(document)",message:"Manifest must be a YAML mapping"}]};let o=uo.safeParse(t);if(!o.success)return{ok:!1,issues:XR(o.error)};let r=s0(o.data);return r.length?{ok:!1,issues:r}:{ok:!0,manifest:o.data}}function XR(e){return e.issues.map(t=>({path:t.path.length?t.path.join("."):"(root)",message:t.message}))}function Ii(e){return Mt.dump(e,{indent:2,lineWidth:100,noRefs:!0,sortKeys:!1})}function $l(e,t){return uo.parse({manifest:{schema_version:Ti,revision:0,conformance:"L0"},app:{id:e,title:t,status:"proposed"}})}var ZR,JR,Kr=b(()=>{"use strict";Ci();sn();({merge:ZR}=Mt.types),JR=Mt.CORE_SCHEMA.extend({implicit:[ZR]})});function Ay(e){return QR.map(t=>{let o=e?.assurance?.[t.key];if(o===void 0)return{...t};let r=oy.safeParse(o);if(r.success)return{...t,record:r.data};let n=r.error.issues.map(a=>`${["assurance",t.key,...a.path].join(".")}: ${a.message}`).join("; ");return{...t,problem:n}})}var QR,$y,J0,X0=b(()=>{"use strict";sn();Kr();QR=[{key:"accessibility",label:"Accessibility",command:"npx skills add addyosmani/web-quality-skills@accessibility",about:"A WCAG 2.2 audit skill: runs Lighthouse or axe on the page, then checks what automated tools miss."},{key:"security",label:"Security review",command:"npx skills add getsentry/skills@security-review",about:"Sentry's review skill, built on OWASP guidance. Reports only findings it can trace to input an attacker controls."},{key:"secrets",label:"Secrets",command:"gitleaks detect --source .",about:"The open-source gitleaks scanner: finds API keys and tokens committed to the game. Install it from github.com/gitleaks/gitleaks."},{key:"privacy",label:"Privacy",command:"npx skills add wshobson/agents@gdpr-data-handling",about:"A GDPR skill covering consent, legal basis, data requests and children's data."}],$y="Recorded by the creator, not checked or certified by Monterosa.";J0={passed:"Passed",issues_fixed:"Issues found and fixed",issues_open:"Issues still open"}});function Ct(e,t={}){let o=h=>({id:h.id,level:h.level,requirement:h.requirement,advice:h.advice,owner:h.owner,passed:h.check(e,t)}),r=Cy.filter(h=>h.checkable).map(o),n=Cy.filter(h=>!h.checkable).map(o),a="L0",i=!0;for(let h of Iy){let y=r.filter(I=>I.level===h);y.length>0&&y.every(I=>I.passed)&&i?a=h:i=!1}let s=r.filter(h=>h.level==="L0").every(h=>h.passed),d=co[a]+1,l=Iy[d],u=l?r.filter(h=>h.level===l&&!h.passed):[],p=e.manifest.conformance;return{computed:a,computedName:n0[a],claimed:p,overclaimed:!s||Math.min(co[p],co[Q0])>co[a],results:r,blockers:s?u:r.filter(h=>h.level==="L0"&&!h.passed),ceiling:Q0,advice:n}}function eT(e,t){let r=Ct(e).results.filter(n=>!n.passed&&co[n.level]<=co[t]);return{ok:r.length===0,missing:r}}var Ko,at,Cy,Iy,ez,K3,Q0,Al=b(()=>{"use strict";sn();Ko=(e,t,o)=>{let r=e[t];return ey[r?.status??"missing"]>=ey[o]},at=e=>typeof e=="string"?e.trim().length>0:e!=null,Cy=[{level:"L0",id:"L0.app.identity",checkable:!0,advice:"Give the game a name, and a short id we can use in web addresses.",owner:"creator",requirement:"app.id and app.title are set",check:e=>at(e.app.id)&&at(e.app.title)},{level:"L0",id:"L0.app.status",checkable:!0,advice:"Mark the game as started.",owner:"creator",requirement:"app section is at least proposed",check:e=>Ko(e,"app","proposed")},{level:"L0",id:"L0.schema.version",checkable:!0,advice:"The version of the format this game is described in. Set when the game was created.",owner:"creator",requirement:"manifest.schema_version is set",check:e=>at(e.manifest.schema_version)},{level:"L1",id:"L1.experience.defined",checkable:!0,advice:"Describe the screens in the game.",owner:"creator",requirement:"experience declares a screen graph or at least one player surface",check:e=>at(e.experience.screen_graph)||e.experience.surfaces.length>0},{level:"L1",id:"L1.experience.status",checkable:!0,advice:"Mark the design as started.",owner:"creator",requirement:"experience section is at least proposed",check:e=>Ko(e,"experience","proposed")},{level:"L1",id:"L1.backend.route",checkable:!0,advice:"Choose which engine runs the game: one we manage, or one you bring.",owner:"creator",requirement:"backend.route is chosen, so authority is decided before client code",check:e=>at(e.backend.route)},{level:"L2",id:"L2.backend.pinned",checkable:!0,advice:"Deploy the game. We record which engine answered.",owner:"creator",requirement:"a component is serving this game's rounds",check:(e,t)=>at(t.backendComponent)||at(e.backend.component)&&at(e.backend.version)},{level:"L2",id:"L2.identity.policy",checkable:!0,advice:"Say how a fan signs in. If they don't sign in, say that. Gamestage does not provide sign-in, so this names the one a fan meets.",owner:"creator",requirement:"an identity provider is named",check:e=>at(e.identity.provider)},{level:"L2",id:"L2.measurement.destination",checkable:!0,advice:"Switch on somewhere to send the data, on this game's Integrations tab. This checks the switch is on. Whether events are arriving is a separate question.",owner:"creator",requirement:"an analytics destination is switched on",check:(e,t)=>t.destinationsEnabled===!0||e.measurement.destinations.some(o=>o.enabled)},{level:"L2",id:"L2.platform.identifiers",checkable:!0,advice:"Deploy the game. That puts it on Monterosa's platform and gives you a place to manage content.",owner:"creator",requirement:"the game exists on Interaction Cloud",check:(e,t)=>at(t.platformProject)||at(e.studio_app.spec_url)||at(e.interaction_cloud.project_id)},{level:"L3",id:"L3.deployment.space",checkable:!0,advice:"Deploy the game with a URL.",owner:"creator",requirement:"the game is deployed somewhere a fan can reach",check:(e,t)=>at(t.playgroundUrl)||at(e.deployment.space_spec)&&e.deployment.environments.some(o=>o!=="local")},{level:"L3",id:"L3.surface.declared",checkable:!1,advice:"Say what the person running your game can change: rounds, wording, or both.",owner:"creator",requirement:"a Studio Surface family is declared for operator control",check:e=>at(e.studio_surface.family)},{level:"L3",id:"L3.sections.confirmed",checkable:!1,advice:"Mark which parts you have finished: the play, the scoring, and the hosting.",owner:"creator",requirement:"experience, backend and deployment are all confirmed or better",check:e=>Ko(e,"experience","confirmed")&&Ko(e,"backend","confirmed")&&Ko(e,"deployment","confirmed")},{level:"L4",id:"L4.sections.verified",checkable:!1,advice:"Link proof it works: a play-through recording, or a test result.",owner:"creator",requirement:"experience, backend, identity and deployment are verified with evidence attached",check:e=>["experience","backend","identity","deployment"].every(t=>Ko(e,t,"verified")&&e[t].provenance.length>0)},{level:"L4",id:"L4.operations.runbook",checkable:!1,advice:"Name who to call when it breaks, and link the instructions they follow.",owner:"creator",requirement:"operations declares a support tier and a runbook",check:e=>at(e.operations.support_tier)&&at(e.operations.runbook)},{level:"L5",id:"L5.production.approved",checkable:!1,advice:"Approve the game for prod, and move your workspace onto a paid plan. Monterosa does the second part.",owner:"monterosa",requirement:"the manifest is approved and deployed to a production environment",check:e=>Ko(e,"operations","approved")&&e.deployment.environments.includes("production")}],Iy=["L0","L1","L2","L3","L4","L5"],ez=[{level:"L0",name:"Concept",means:"the game has a name and a description we hold for it"},{level:"L1",name:"Experience built",means:"there is something to play, and scoring runs on our server rather than in the browser"},{level:"L2",name:"Wired to the platform",means:"it is set up on the Monterosa platform, knows who each player is, and sends its numbers to your analytics"},{level:"L3",name:"Fans can reach it",means:"it is deployed at an address a fan can open"},{level:"L4",name:"Production ready",means:"checked with evidence, with someone to call and a page saying what to do if it breaks"},{level:"L5",name:"Operating live",means:"reviewed with you, and running in production"}],K3=new Map(ez.map(e=>[e.level,e])),Q0=[...Iy].reverse().find(e=>Cy.some(t=>t.level===e&&t.checkable))??"L0"});var Py=b(()=>{"use strict";Kr();sn();Al()});var tT=b(()=>{"use strict"});function nT(e,t){let o=e.backend.archetype;if(!o)throw new Error("registerInputFromManifest needs backend.archetype. Run registrationProblems first.");return{id:e.app.id,name:e.app.title,archetype:o,repository:e.app.source?.repository??null,manifestRevision:String(e.manifest.revision),contentHash:t,conformance:Ct(e).computed,offersPrize:e.operations.promotion.offers_prize,containerLabel:e.experience.container_label,sections:Hr.map(r=>({section:r,status:e[r].status}))}}function oT(e,t){let o=[];return t&&e.app.id!==t&&o.push(`This manifest is for the game "${e.app.id}", and you are editing "${t}". A manifest cannot change which game it belongs to: set app.id to "${t}", or register "${e.app.id}" as its own game.`),e.backend.archetype||o.push("This manifest declares no backend.archetype, so there is nothing to register. The control plane keys a game on its archetype and a game without one could never be deployed against."),o}var rT=b(()=>{"use strict";Al();Kr();sn()});var Re,Pi,aT=b(()=>{"use strict";Re={runtime:"/play/v1/games/{game}/runtime",currentRound:"/play/v1/games/{game}/rounds/current",rounds:"/play/v1/games/{game}/rounds",roundsMine:"/play/v1/games/{game}/rounds/mine",nextRound:"/play/v1/games/{game}/rounds/next",round:"/play/v1/games/{game}/rounds/{round}",plays:"/play/v1/games/{game}/rounds/{round}/plays",session:"/play/v1/games/{game}/session",restoreSession:"/play/v1/games/{game}/session/restore",guestToken:"/play/v1/games/{game}/guest-token",roundState:"/play/v1/games/{game}/rounds/{round}/players/me",profile:"/play/v1/games/{game}/players/me/profile",identityOptions:"/play/v1/games/{game}/identity",identity:"/play/v1/games/{game}/players/me/identity",recoveryCode:"/play/v1/games/{game}/players/me/recovery-code",leaderboard:"/play/v1/games/{game}/leaderboard",editionLeaderboard:"/play/v1/games/{game}/leaderboard/edition"},Pi="/play"});function Cl(e,t,o={},r){let n=r?r.slice(0,10):void 0,a=e.last_played_day,i=n?new Date(Date.parse(`${n}T00:00:00Z`)-864e5).toISOString().slice(0,10):void 0,s=n===void 0?e.day_streak:a===n?e.day_streak??1:a===i?(e.day_streak??0)+1:1,d=t==="won"?e.current_streak+1:t==="lost"||t==="partial"?0:e.current_streak;return{...e,played:e.played+1,won:e.won+(t==="won"?1:0),current_streak:d,max_streak:Math.max(e.max_streak,d),exact:(e.exact??0)+(o.exact===!0?1:0),...s===void 0?{}:{day_streak:s},...n?{last_played_day:n}:a?{last_played_day:a}:{},...typeof o.score=="number"?{best_score:Math.max(e.best_score??o.score,o.score)}:e.best_score===void 0?{}:{best_score:e.best_score}}}var iT,Ht,tz,nz,oz,cq,cT,rz,az,lq,iz,dq,uq,mq,lT,sz,cz,pq,lz,dz,hq,sT,fq,gq,yq,dT,Oy=b(()=>{"use strict";Ye();sn();wl();aT();iT="2.0",Ht=c.object({server_time:c.string(),snapshot:c.string()}),tz=c.enum(["at_commit","at_settlement"]),nz=c.enum(["shared","per_player","feed"]),oz=c.object({kind:c.enum(["fixed","local_midnight","feed","continuous"]),timezone:c.string().optional()}),cq=Ht.extend({game:c.string(),api_version:c.literal(iT).default(iT),archetype:lo,marking:tz,challenge_source:nz,schedule:oz,updates:c.object({transport:c.enum(["poll","socket"]),freshness_seconds:c.number().int().positive()}),display:c.record(c.string(),c.unknown()).default({}),identity:c.object({required:c.boolean(),provider:c.string(),anonymous_play:c.boolean().default(!1)}),archive:c.boolean().default(!1),capabilities:c.array(c.string()).default([])}),cT=c.object({accepting_plays:c.boolean(),results_available:c.boolean(),solution_revealed:c.boolean(),closed:c.boolean(),optimistic_play:c.boolean().default(!1)}),rz=Ht.extend({id:c.string(),number:c.number().int().positive().optional(),origin:_i.optional(),version:c.number().int().nonnegative(),can:cT,opens_at:c.string().optional(),locks_at:c.string().optional(),timer_seconds:c.number().int().positive().optional(),challenge_instance_id:c.string().nullable().default(null),challenge:c.record(c.string(),c.unknown()).default({}),solution:c.record(c.string(),c.unknown()).optional()}),az=c.object({id:c.string(),number:c.number().int().positive().optional(),version:c.number().int().nonnegative(),can:cT,opens_at:c.string().optional(),locks_at:c.string().optional(),current:c.boolean().default(!1),theme:c.string().default("")}),lq=Ht.extend({rounds:c.array(az)}),iz=c.object({round_id:c.string(),finished:c.boolean(),score:c.number(),last_played_at:c.string().optional(),outcome:c.enum(["won","lost","partial","incomplete","pending"]).optional()}),dq=Ht.extend({player_id:c.string(),played:c.array(iz)}),uq=Ht.extend({status:c.enum(["ready","exhausted"]),round:rz.optional()}),mq=Ht.extend({token:c.string(),player_id:c.string(),kind:c.literal("anonymous")}),lT=c.object({idempotency_key:c.string().min(8),round_version:c.number().int().nonnegative(),challenge_instance_id:c.string().nullable().default(null),payload:c.record(c.string(),c.unknown()).refine(e=>e.op===void 0||typeof e.op=="string"&&e.op.length>0,{message:"op must be a non-empty string when present",path:["op"]})}),sz=c.enum(["accepted","rejected","duplicate","stale","busy"]),cz=c.object({key:c.string(),verdict:c.enum(["correct","close","wrong","higher","lower","unknown"]),label:c.string().optional()}),pq=Ht.extend({play_id:c.string(),outcome:sz,reason:c.string().optional(),round_version:c.number().int().nonnegative(),retry_after_seconds:c.number().int().positive().optional(),marked:c.boolean().default(!0),feedback:c.array(cz).default([]),round_state:c.lazy(()=>dz).optional()}),lz=c.object({title:c.string(),grid:c.array(c.string()).default([]),text:c.string().optional()}),dz=Ht.extend({player_id:c.string(),round_id:c.string(),started_at:c.string().optional(),attempts_used:c.number().int().nonnegative().default(0),attempts_allowed:c.number().int().nonnegative().optional(),mistakes_used:c.number().int().nonnegative().default(0),mistakes_allowed:c.number().int().nonnegative().optional(),progress:c.record(c.string(),c.unknown()).default({}),score:c.number().default(0),score_revision:c.number().int().nonnegative().default(0),finished:c.boolean().default(!1),outcome:c.enum(["won","lost","partial","incomplete","pending"]).optional(),share:lz.optional()}),hq=Ht.extend({player_id:c.string(),display_name:c.string().optional(),avatar:c.string().optional(),avatar_url:c.string().optional(),played:c.number().int().nonnegative().default(0),won:c.number().int().nonnegative().default(0),current_streak:c.number().int().nonnegative().default(0),max_streak:c.number().int().nonnegative().default(0),exact:c.number().int().nonnegative().optional(),best_score:c.number().optional(),day_streak:c.number().int().nonnegative().optional(),last_played_day:c.string().optional(),distribution:c.record(c.string(),c.number()).default({}),constraints:c.record(c.string(),c.unknown()).default({})});sT=c.object({rank:c.number().int().positive(),player_id:c.string(),display_name:c.string().optional(),avatar:c.string().optional(),avatar_url:c.string().optional(),exact:c.boolean().optional(),score:c.number()}),fq=Ht.extend({round_id:c.string().optional(),scope:c.enum(["round","edition"]).optional(),edition_id:c.string().optional(),order:c.enum(["high_first","low_first"]).default("high_first"),tie_break:c.enum(["earliest_play","fewest_attempts","none"]).default("none"),entries:c.array(sT).default([]),total:c.number().int().nonnegative().default(0),truncated:c.boolean().default(!1),me:sT.optional()}),gq=c.object({error:c.object({code:c.string(),message:c.string(),retryable:c.boolean()})}),yq=Ht.extend({adjectives:c.array(c.string()),animals:c.array(c.string()),avatars:c.array(c.object({id:c.string(),url:c.string()}))}),dT=c.object({name:c.object({adjective:c.string().min(1),animal:c.string().min(1)}).optional(),avatar:c.string().min(1).optional()}).refine(e=>e.name!==void 0||e.avatar!==void 0,{message:"Send a name, an avatar, or both."})});function uT(e){return fz[De(e)]}function mT(e,t){let o=e.op;return typeof o=="string"&&o.length>0?o:uT(t)?.[0]}function pT(e,t){return uT(e)?.includes(t)??!1}function Il(e){return Ry({round_id:e.round_id,round_version:e.round_version,challenge_instance_id:e.challenge_instance_id??null,payload:e.payload})}function Ry(e){if(Array.isArray(e))return`[${e.map(Ry).join(",")}]`;if(e&&typeof e=="object"){let t=e;return`{${Object.keys(t).filter(r=>t[r]!==void 0).sort().map(r=>`${JSON.stringify(r)}:${Ry(t[r])}`).join(",")}}`}return JSON.stringify(e)??"null"}var uz,mz,pz,hz,zy,xq,fz,hT=b(()=>{"use strict";Ye();Tn();Br();uz=c.object({op:c.string().min(1),model:c.string().min(1).optional()}).passthrough(),mz=c.object({op:c.literal("pick"),picks:c.array(c.string())}).passthrough(),pz=c.object({op:c.literal("answer"),answers:c.record(c.string(),c.union([c.string(),c.number()])).optional(),picks:c.array(c.string()).optional()}).passthrough(),hz=c.object({op:c.enum(["deal","reshuffle","lock"]),centre:c.unknown().optional(),board:c.number().int().nonnegative().optional()}).passthrough(),zy=c.object({op:c.literal(Gr),model:c.literal(io).optional(),shotIndex:c.number().int().nonnegative(),aimX:c.number().int().min(bt.aimX.min).max(bt.aimX.max),aimY:c.number().int().min(bt.aimY.min).max(bt.aimY.max),power:c.number().int().min(bt.power.min).max(bt.power.max)}).strict(),xq=c.union([mz,pz,hz,zy,uz]),fz={hunt:["pick"],push:["pick"],group:["pick"],predict:["answer"],bingo:["deal","reshuffle","lock"],shoot:[Gr],place:["place","skip"],mystery:["ask","buy","guess"]}});var fT=b(()=>{"use strict"});var Ny=b(()=>{"use strict";fT()});function wz(e,t){let o=e.trim().toLowerCase();return o?t.some(r=>{let n=r.trim().toLowerCase();return o===n||o.endsWith(`.${n}`)}):!1}function kz(e,t){let o=new Set((e.grants??[]).filter(r=>r.startsWith("org:")).map(r=>r.slice(4)));return t.find(r=>o.has(r.id)?!0:e.domain?wz(e.domain,r.domains):!1)}function vT(e,t){let o=e?.lastIndexOf("@")??-1,r=o>=0?e.slice(o+1).trim().toLowerCase():void 0;if(r)return kz({id:"creator",domain:r},t)}function wT(e,t){let o={kind:"generated_proposal",tool:"org-profile",source_context:`org:${t.id} v${t.version}`},r=t.identity?.player;if(r?.kind==="oidc"&&r.publicConfig.issuer&&r.publicConfig.jwks_uri&&(e.identity.provider="jwt",e.identity.jwt={issuer:r.publicConfig.issuer,jwks_uri:r.publicConfig.jwks_uri,...r.publicConfig.audience?{audience:r.publicConfig.audience}:{}},e.identity.status="proposed",e.identity.provenance=[...e.identity.provenance,o]),e.identity.consent={analytics_requires_consent:t.consent.analytics_requires_consent,...t.consent.provider?{provider:t.consent.provider}:{}},t.analytics.length>0){let n=new Set(e.measurement.destinations.map(a=>a.type));for(let a of t.analytics)n.has(a.type)||(e.measurement.destinations.push({type:a.type,enabled:!0,config:a.config}),n.add(a.type));e.measurement.status="proposed",e.measurement.provenance=[...e.measurement.provenance,o]}t.brand&&(e.experience.design={...e.experience.design,...t.brand.kind==="figma"?{figma_file:t.brand.ref}:{tokens:t.brand.ref}},e.experience.status="proposed",e.experience.provenance=[...e.experience.provenance,o])}var gz,gT,yz,bz,yT,vz,bT,jy,Pl=b(()=>{"use strict";Ye();sn();gz=c.object({kind:c.enum(["figma","tokens","guidelines"]),ref:c.string().min(1)}),gT=c.object({system:c.string().min(1),kind:c.string().min(1),ref:c.string().optional(),publicConfig:c.record(c.string(),c.string()).default({})}),yz=c.object({provider:c.string().optional(),analytics_requires_consent:c.boolean().default(!0)}),bz=c.object({type:ny.shape.type,config:c.record(c.string(),c.string()).default({})}),yT=c.object({kind:c.string().min(1),ref:c.string().min(1)}),vz=c.object({sink:yT.optional(),source:yT.optional()}),bT=c.object({id:c.string().min(1),displayName:c.string().min(1),domains:c.array(c.string()).default([]),version:c.number().int().nonnegative().default(1),brand:gz.optional(),identity:c.object({operator:gT.optional(),player:gT.optional()}).optional(),consent:yz.prefault({}),analytics:c.array(bz).default([]),data:vz.prefault({}),studioOrg:c.string().optional(),studioSpaces:c.array(c.string()).default([]),defaultStudioSpace:c.string().optional(),requiresExplicitSpace:c.boolean().default(!1)});jy=[bT.parse({id:"monterosa",displayName:"Monterosa",domains:["monterosa.co.uk"],studioOrg:"8b545077-7bbc-4255-8710-2ee9ca47b20a",studioSpaces:["8a03789a-f74f-4920-9699-0c59342eb963"],defaultStudioSpace:"8a03789a-f74f-4920-9699-0c59342eb963",brand:{kind:"guidelines",ref:"monterosa-brand-guidelines"},identity:{player:{system:"identify",kind:"oidc",publicConfig:{issuer:"https://accounts.google.com",jwks_uri:"https://www.googleapis.com/oauth2/v3/certs"}}},consent:{analytics_requires_consent:!0},analytics:[{type:"monterosa",config:{}}],data:{source:{kind:"slack-directory",ref:"monterosa-people"},sink:{kind:"delta-share",ref:"monterosa_gameplay"}}}),bT.parse({id:"nba",displayName:"NBA",domains:["nba.com"],studioOrg:"7ba0ec97-ac1f-4e83-bec0-d71e27a5357c",studioSpaces:["76d6efa5-cac5-4664-96e1-f23ac1d07671"],defaultStudioSpace:"76d6efa5-cac5-4664-96e1-f23ac1d07671",brand:{kind:"figma",ref:"nba-brand"},identity:{player:{system:"identify",kind:"custom",ref:"nba-id"}},consent:{provider:"onetrust",analytics_requires_consent:!0},analytics:[{type:"monterosa",config:{}}],data:{sink:{kind:"snowflake",ref:"nba_gameplay"}}})]});function _T(e,t=new Date){let o=typeof t=="string"?Date.parse(t):t.getTime(),r,n=Number.NEGATIVE_INFINITY;for(let a of e.rounds){let i=Date.parse(a.locksAt);Number.isNaN(i)||i>n&&(n=i,r=a)}return r?n>o?{state:"live",round:r}:{state:"stale",round:r,lockedForMs:o-n}:{state:"none"}}function xT(e){if(e.state!=="stale")return null;let t=Math.floor(e.lockedForMs/36e5),o=t<1?`${Math.max(1,Math.floor(e.lockedForMs/6e4))} minutes`:t<48?`${t} hours`:`${Math.floor(t/24)} days`;return`The round this game is serving, ${e.round.label}, locked ${o} ago and nothing has replaced it. Fans are playing a closed round. Run gamestage deploy, or refresh the round, to move it on.`}function $T(e,t=Ol){return e.terms?.version===t}function zl(e){let t=AT.safeParse(e.access);return t.success?t.data:"pending"}function Lz(e){let t=e??null;return!t||typeof t.version!="string"||typeof t.at!="string"?null:{version:t.version,at:t.at}}function Dz(e){let t=e??null;return t&&typeof t.at=="string"?{at:t.at}:null}function CT(e){let t=n=>typeof n=="string"&&n.trim()?n:null,o=e.decision??null,r=o?t(o.state):null;return{workspaceId:t(e.workspaceId)??"unknown",name:t(e.name),ownerEmail:t(e.ownerEmail)??"",company:t(e.company),role:t(e.role),intent:t(e.intent),signals:t(e.signals),registeredAt:t(e.registeredAt)??"",termsVersion:t(e.termsVersion),contactConsent:Lz(e.contactConsent),ageConfirmed:Dz(e.ageConfirmed),personalEmail:e.personalEmail===!0,decision:r==="approved"||r==="refused"?{state:r,at:t(o.at)??t(e.registeredAt)??"",by:t(o.by)??"unknown",reason:t(o.reason)}:null}}function IT(e){return{waiting:e.filter(t=>!t.decision).sort((t,o)=>t.registeredAt.localeCompare(o.registeredAt)),decided:e.filter(t=>t.decision).sort((t,o)=>o.decision.at.localeCompare(t.decision.at))}}function Dy(e){return Bz.includes(e)}function My(e,t){return!e.prodApproval||Dy(t.tier)?"dev":"prod"}function OT(e){return e.filter(t=>t.limit>0&&t.used>=t.limit)}function RT(e){return e.limit<=0?0:Math.min(1,e.used/e.limit)}var Sz,Tz,kT,Ez,$z,Az,Ly,Cz,Iz,ST,Pz,Gq,TT,Oz,Ol,Rl,ET,Rz,zz,AT,Bq,qq,Nz,jz,Mz,Fz,Wq,Hq,Kq,Yq,Vq,Uz,Zq,PT,Jq,Gz,Bz,Nl=b(()=>{"use strict";Tu();Ye();sn();Na();ki();Ny();ki();qt();Pl();Sz=c.enum(["draft","live","sleeping","throttled","expired","archived"]),Tz=c.enum(["scheduled","open","locked","settled"]),kT=c.object({id:c.string(),label:c.string(),used:c.number(),limit:c.number(),unit:c.string()}),Ez=c.object({id:c.string(),label:c.string(),state:Tz,opensAt:c.string(),locksAt:c.string(),settledAt:c.string().nullable(),plays:c.number(),edition:c.string().optional()}),$z=c.object({id:c.string(),name:c.string(),enabled:c.boolean(),consentRequired:c.boolean(),note:c.string()}),Az=c.object({number:c.number().int().positive(),title:c.string(),openedAt:c.string(),labels:c.array(c.string()).default([]),fromGame:c.boolean().default(!1)}),Ly=c.object({at:c.string(),level:c.enum(["info","warn","error"]),roundId:c.string().nullable(),message:c.string(),dataset:c.string().optional()}),Cz=c.enum(["absent","pending","ready","failed"]),Iz=c.object({state:Cz.default("absent"),url:c.string().nullable().default(null),regenerations:c.number().int().nonnegative().default(0),updatedAt:c.string().nullable().default(null),onProject:c.string().nullable().default(null)});ST=c.object({section:c.string(),status:Qg}),Pz=c.object({instanceId:c.string(),embedSlug:c.string(),template:c.string(),type:c.enum(["leaderboard","qr"]),createdAt:c.string(),consentBy:c.string()}),Gq=c.object({template:c.string().min(1),consent:c.literal(!0)}),TT=c.object({id:c.string(),name:c.string(),containerLabel:c.string().min(1).default(dr),repository:c.string().nullable(),openIssues:c.number().int().nonnegative(),issues:c.array(Az).default([]),archetype:lo,offersPrize:c.boolean().default(!1),state:Sz,prodApproval:c.object({approvedAt:c.string(),approvedBy:c.string()}).nullable().default(null).optional(),archivePrefix:c.string().nullable().default(null),space:c.string().nullable().default(null).optional(),platformSpace:c.string().nullable().default(null).optional(),platformOrg:c.string().nullable().default(null).optional(),platformProject:c.string().nullable().default(null).optional(),platformEvent:c.string().nullable().default(null).optional(),platformElement:c.string().nullable().default(null).optional(),studioUrl:c.string().nullable().default(null).optional(),appSpec:c.object({version:c.string(),shape:c.string(),resource:c.string().nullable().default(null),specUrl:c.string().optional(),wording:c.array(c.string()).optional(),refusal:c.object({at:c.string(),reason:c.string()}).nullable().default(null).optional()}).nullable().default(null).optional(),art:Iz.prefault({}).optional(),graphics:c.array(Pz).optional(),playgroundUrl:c.string().nullable(),playerEndpoint:c.string().nullable(),manifestRevision:c.string(),manifestSource:c.string().optional(),settingsDefaults:c.record(c.string(),c.string()).optional(),conformance:so,contentHash:c.string(),referenceDigest:c.string().optional(),referenceName:c.string().optional(),identity:c.object({issuer:c.string(),jwks_uri:c.string(),audience:c.string().optional()}).optional(),monthlyPlayers:c.number().int().nonnegative().optional(),sections:c.array(ST),meters:c.array(kT),history:c.array(wi),rounds:c.array(Ez),destinations:c.array($z),logs:c.array(Ly),updatedAt:c.string()}),Oz=c.object({login:c.string(),linkedAt:c.string()}),Ol="2026-09-30",Rl="https://gamestage.ai/terms",ET="https://gamestage.ai/stage",Rz=c.object({version:c.string(),acceptedAt:c.string(),by:c.string()});zz=c.object({enabled:c.boolean().default(!1),applicationId:c.string().nullable().default(null),writeKey:c.string().nullable().default(null)}),AT=c.enum(["pending","approved","refused"]),Bq=c.enum(["manual","automatic"]);qq=c.enum(["approved","refused"]),Nz=c.object({company:c.string().trim().min(1,"Tell us your company.").max(120),role:c.string().trim().min(1,"Tell us your role.").max(120),intent:c.string().trim().min(1,"Tell us what you'd like to build.").max(500),contactConsent:c.literal(!0,{message:"Tick the box so we can contact you about your application."}),ageConfirmed:c.literal(!0,{message:`Confirm you are ${18} or older.`}),marketingConsent:c.boolean().optional()}),jz=c.object({company:c.string().nullish(),role:c.string().nullish(),intent:c.string().nullish(),contactConsent:c.object({version:c.string(),at:c.string()}).nullish(),ageConfirmed:c.object({at:c.string()}).nullish(),marketingConsent:c.object({at:c.string()}).nullish()});Mz=c.object({id:c.string(),name:c.string(),tier:Wr,ownerEmail:c.string(),access:AT.default("pending"),profile:jz.optional(),platformSpace:c.string().optional(),liveGameAllowance:c.number(),supplierGrants:c.array(c.string()).default([]),github:Oz.nullable().default(null),terms:Rz.nullable().default(null),signal:zz.prefault({}),meters:c.array(kT),games:c.array(TT)}),Fz=TT.extend({logs:c.array(Ly).optional()}),Wq=Mz.extend({games:c.array(Fz),gamesTotal:c.number().int().nonnegative(),archivedTotal:c.number().int().nonnegative().default(0)}),Hq=c.object({player:c.string().nullable(),control:c.string().nullable(),playground:c.string().nullable()}),Kq=c.object({id:c.string(),name:c.string(),archetype:lo,repository:c.string().nullable().default(null),manifestRevision:c.string(),contentHash:c.string(),conformance:so,offersPrize:c.boolean().default(!1),sections:c.array(ST).default([]),containerLabel:c.string().min(1).optional()}),Yq=c.object({uploadUrl:c.string(),publicUrl:c.string(),key:c.string(),expiresInSeconds:c.number().int().positive(),cacheControl:c.string().optional(),playerApiOrigin:c.string()}),Vq=c.object({manifestRevision:c.string(),contentHash:c.string(),conformance:so,offersPrize:c.boolean().default(!1),round:Ge.optional(),studioSeed:Ge.optional(),identity:c.object({issuer:c.string(),jwks_uri:c.string(),audience:c.string().optional()}).optional(),wording:c.array(c.string()).optional(),manifestSource:c.string().optional(),settings:c.record(c.string(),c.string()).optional(),notes:c.string().max(500).optional(),studioSpace:c.string().optional(),studioSpaceOrg:c.string().optional()}),Uz=c.object({limit:c.coerce.number().int().positive().max(1e3).default(100),since:c.string().nullable().default(null),level:Ly.shape.level.nullable().default(null)}),Zq=c.enum(["access_pending","terms_not_accepted","personal_email","profile_incomplete","github_not_linked","live_allowance_reached","meter_breached","nothing_to_do","tier_required","operator_required","game_archived","dev_allowance_reached","art_limit_reached","art_unavailable","round_source_unreadable","round_not_seeded","delete_refused","space_required","space_not_permitted"]),PT=c.enum(["workspace.created","workspace.approved","workspace.refused","workspace.profile_updated","github.linked","github.unlinked","terms.accepted","game.registered","game.deployed","game.deploy_refused","round.provisioned","round.provision_failed","round.unchanged","round.seeded","game.platform_provisioned","game.platform_provision_failed","game.app_spec_refused","art.requested","art.generated","art.failed","art.published","game.woken","game.suspended","game.throttled","game.approaching_fair_use","game.archived","game.graphic.added","game.graphic.removed","game.promoted","game.withdrawn","game.deleted","game.deleted","workspace.plan_changed","workspace.plan_refused","engine.integrity_violation","destination.changed","signal.enabled","signal.disabled","source.key_attempt"]),Jq=c.object({id:c.string(),at:c.string(),action:PT,actor:c.object({kind:c.enum(["creator","operator","system"]),id:c.string(),email:c.string().nullable().default(null)}),gameId:c.string().nullable().default(null),correlationId:c.string(),detail:c.record(c.string(),c.unknown()).default({})}),Gz=c.object({limit:c.coerce.number().int().positive().max(1e3).default(100),action:PT.nullable().default(null),actorId:c.string().nullable().default(null),gameId:c.string().nullable().default(null),from:c.string().nullable().default(null),to:c.string().nullable().default(null)}),Bz=["runtime"]});var Fy=b(()=>{"use strict"});var Kt=b(()=>{"use strict"});import{createHash as qz}from"node:crypto";function Hz(e){return qz("sha256").update(e).digest("hex").slice(0,16)}function jl(e){return Hz(e)}var Wz,zt,wt=b(()=>{"use strict";Ye();Kt();qt();Wz=c.object({key:c.string().min(1),label:c.string().default(""),values:c.record(c.string(),c.number().int().nonnegative()),scale:c.number().int().positive().optional(),sources:c.record(c.string(),qr).optional(),scoring:Jg.optional(),tiers:c.array(Zg).min(1).optional()}),zt=c.object({corpus:c.literal("1"),source:c.string().optional(),as_of:c.string().optional(),sources:c.record(c.string(),qr).optional(),facts:c.record(c.string(),c.array(kl)).optional(),entries:c.record(c.string(),c.object({label:c.string().min(1),team:c.string().optional(),position:c.string().optional(),image:c.string().url().startsWith("https://").optional(),age:c.number().int().min(14).max(60).optional(),debut_year:c.number().int().min(1900).max(2100).optional(),facts:c.record(c.string(),c.union([c.string(),c.number(),c.boolean()])).optional()})).optional(),measures:c.array(Wz).min(1)}).superRefine((e,t)=>{let o=e.measures.map(r=>r.key);new Set(o).size!==o.length&&t.addIssue({code:"custom",path:["measures"],message:"Two measures share a key. A round names the measure it is counted on."})})});function Zz(e){return`slate-${e+1}`}function jT(e){return{archetype:"push",theme:e.theme??"",prompt:e.prompt??"",target:e.target,targetLabel:e.targetLabel??"",unit:e.unit??"",slates:e.slates.map((t,o)=>({id:Zz(o),label:t.label??"",entries:t.entries.map(r=>({key:r.key,label:r.label??""}))}))}}var Yz,Vz,Uy,On=b(()=>{"use strict";Ye();Kt();Yz=c.object({key:c.string().min(1),label:c.string().default(""),note:c.string().optional()}),Vz=c.object({id:c.string().min(1),label:c.string().default(""),entries:c.array(Yz).min(1)}),Uy=c.object({archetype:c.literal("push"),measure:c.string().min(1).optional(),theme:c.string().default(""),prompt:c.string().default(""),target:c.number().int().positive().optional(),targetLabel:c.string().default(""),unit:c.string().max(4).default(""),slates:c.array(Vz).min(1)})});var DT,fW,Oi=b(()=>{"use strict";Ye();qt();On();Kt();DT=_l.safeExtend({answerMeasure:c.string().min(1).optional(),answerRule:Si.optional()}),fW=c.discriminatedUnion("archetype",[Uy,DT,Xg,Sl])});var Gy,_W,By=b(()=>{"use strict";Ye();wt();On();Oi();qt();Gy=c.object({count:c.number().int().min(1).max(80),measure:c.string().trim().min(1).optional(),position:c.string().trim().min(1).optional(),team:c.string().trim().min(1).optional(),layout:c.enum(["grid","pitch","xi"]).optional(),dataset:c.string().trim().regex(/^[A-Za-z0-9][A-Za-z0-9._\/-]*\.json$/,"A dataset name, e.g. sportmonks/premier-league-lineups.json").optional(),prompt:c.string().trim().min(1).max(200).optional()}),_W=c.object({measure:c.string().min(1),rule:Si,prompt:c.string().trim().min(1)})});var Ll=b(()=>{"use strict";qt();Kt();Br()});function Ri(){return Dl.filter(e=>e.public!==!1&&e.type!=="collection"&&e.type!=="boolean"&&e.type!=="number").map(e=>e.key)}function FT(e){if(e===null||typeof e!="object"||Array.isArray(e))return["gamestage.settings.json must be one JSON object of field keys to text."];let t=new Set(Ri()),o=[];for(let[r,n]of Object.entries(e)){let a=/^label_[a-z0-9_]+$/.test(r);!t.has(r)&&!a?o.push(`"${r}" is not a Studio field a game can fill. The fields are: ${[...t].join(", ")}, and any label_<key> the page reads.`):typeof n!="string"&&o.push(`"${r}" must be text, and is ${Array.isArray(n)?"a list":typeof n}.`)}return o}function Yo(e,t,o,r){let n=e[0].toUpperCase()+e.slice(1),a=(d,l,u)=>({key:`css_variables_${d}`,label:l,type:"colour",description:u,readBy:`The game's own CSS, as the --gs-${d} custom property.`,section:"Colour Palette",subsection:t,subsectionDescription:o}),i=t.toLowerCase(),s=[a(`${e}MainColour`,`${t} main colour`,"Main: the primary surface.")];return r.variant&&s.push(a(`${e}VariantColour`,`${t} variant colour`,"Variant: overlays, borders and subtle accents.")),s.push(a(`on${n}Colour`,`On ${i} colour`,"On: content sitting on the main and variant surfaces."),a(`${e}ContainerColour`,`${t} container colour`,"Container: the wrapper surface."),a(`on${n}ContainerColour`,`On ${i} container colour`,"On container: content sitting on the container surface.")),s}function Xy(e,t){let o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp([`\\bpresentation\\s*\\.\\s*${o}\\b`,`\\bpresentation\\s*\\[\\s*["']${o}["']\\s*\\]`,`\\b${o}\\s*:`,`[A-Za-z_$][\\w$]*\\s*\\??\\.\\s*${o}\\b`].join("|")).test(e)||t==="primaryColour"&&/\broot\s*:/.test(e)||sN.has(t)&&/\broot\s*:/.test(e)||cN.has(t)&&/data-gs-first-paint/.test(e)||t.startsWith("recovery")&&/\bmountRecovery\s*\(/.test(e)?!0:t==="analyticsUrl"}function Fl(e){return[...qy.filter(t=>Xy(e,Jy[t.key])).map(t=>t.key),...zi(e)]}function zi(e){let t=new Set;for(let o of e.matchAll(/["'`](label_[a-z0-9_]+)["'`]|\b(label_[a-z0-9_]+)\s*:/g)){let r=o[1]??o[2];r&&r!==Ul&&t.add(r)}return[...t].sort()}function GT(e){let t=e.slice(Ul.length).replace(/_/g," ").trim();return{key:e,label:t.charAt(0).toUpperCase()+t.slice(1),type:"freetext",description:"A word this game's page shows. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page.",section:"Wording"}}function Ni(e,t=Qy){return`${t}/fonts/${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}.css`}function Gl(e,t){if(!e)return;let o=Object.keys(MT).find(i=>i.toLowerCase()===e.trim().toLowerCase());if(!o)return;let r=MT[o],n=Number(t);if(!Number.isFinite(n))return{family:o,weight:r[r.length-1]};let a=[...r].sort((i,s)=>Math.abs(i-n)-Math.abs(s-n)||s-i)[0];return{family:o,weight:a}}var qy,Wy,Xz,Dl,Hy,Qz,Ml,eN,Ky,UT,tN,nN,oN,Yy,rN,aN,iN,Vy,Zy,Jy,sN,cN,Ul,MT,Qy,eb,Yr=b(()=>{"use strict";qy=[{key:"play_again_label",required:!0,label:"Play again button",type:"freetext",description:"What the button that starts the next round says, at the end of a finished one. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, on its play-again button.",section:"Wording"},{key:"result_button_label",required:!0,label:"Result link",type:"freetext",description:"What the link back to a finished round says, for a fan who has already played today. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, on its see-your-result link.",section:"Wording"},{key:"share_button_label",required:!0,label:"Share button",type:"freetext",description:"What the share button says at the end of a round. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, on its share button.",section:"Wording"},{key:"margin_over",label:"Went over, in the summary",type:"freetext",description:'What the splash and the share picture say when a fan went over, e.g. "over by {n}". {n} is how far out they were, and where you put it is up to you. Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the returning splash and the share picture.",section:"Wording"},{key:"margin_exact",label:"Landed exactly, in the summary",type:"freetext",description:'What the splash and the share picture say when a fan hit the target exactly, e.g. "exactly on the number". There is no amount to show, so no {n}. Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the returning splash and the share picture.",section:"Wording"},{key:"margin_under",label:"Stayed under, in the summary",type:"freetext",description:'What the splash and the share picture say when a fan finished under, e.g. "{n} short". {n} is how far under they were. Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the returning splash and the share picture.",section:"Wording"},{key:"result_over",label:"Went over, on the result",type:"freetext",description:`What the result screen says when a fan went over, e.g. "Over the limit by {n}". **The game speaking to the fan, so write it in the second person.** Use {n} for the amount, {target} for the target, {rank} for the rank, {player} for the player who took them over, {value} for what that player was worth, and {fact} for that player's note. Filled in from the game when it deploys; what you write here is what fans see.`,readBy:"The game's own page, on the result screen.",section:"Wording"},{key:"result_exact",label:"Landed exactly, on the result",type:"freetext",description:'What the result screen says when a fan hit the target exactly, e.g. "Exactly on the number!". Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the result screen.",section:"Wording"},{key:"result_under",label:"Stayed under, on the result",type:"freetext",description:'What the result screen says when a fan finished under, e.g. "{n} away from the target". Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, on the result screen.",section:"Wording"},{key:"share_over",label:"Went over, in the shared text",type:"freetext",description:`The sentence a fan pastes when they went over, e.g. "over the limit by {n}." **The fan speaking to a friend, so write it in the first person: "my", never "your".** Use {n} for the amount, {target} for the target, {rank} for the rank, {player} for the player who took them over, {value} for what that player was worth, and {fact} for that player's note. Keep it to one line: the shared text is four lines and this is the first. Filled in from the game when it deploys; what you write here is what fans see.`,readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"share_exact",label:"Landed exactly, in the shared text",type:"freetext",description:'The sentence a fan pastes when they hit the target exactly, e.g. "Exactly on {target}. {rank}." Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"share_under",label:"Stayed under, in the shared text",type:"freetext",description:'The sentence a fan pastes when they finished under, e.g. "{n} short of {target}. {rank}." Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"result_bust_note",label:"Went over: the line about the player",type:"freetext",description:`The line on the result screen naming the player who took a fan over, e.g. "{player} alone was worth {value} of your {target}." **The game speaking to the fan, so second person.** {fact} is that player's own note if the producer wrote one. Filled in from the game when it deploys; what you write here is what fans see.`,readBy:"The game's own page, under the result when a fan went over.",section:"Wording"},{key:"share_bust_note",label:"Went over: the line about the player, shared",type:"freetext",description:'The same line in the text a fan pastes, e.g. "{player} alone was {value} of my {target}." **The fan speaking to a friend, so first person: "my", never "your".** Surname alone reads better here; the full name is on the card. Filled in from the game when it deploys; what you write here is what fans see.',readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"share_dare",label:"The challenge in the shared text",type:"freetext",description:'The last line of the text a fan pastes, aimed at whoever reads it, e.g. "Can you do better?" Filled in from the game when it deploys; what you write here is what fans see. Clear it and the line is not sent.',readBy:"The game's own page, in the text the share button copies.",section:"Wording"},{key:"result_dare",label:"The challenge on the result",type:"freetext",description:'A closing line on the result screen, e.g. "Can you do better?" Filled in from the game when it deploys; what you write here is what fans see. Clear it and the line is not drawn.',readBy:"The game's own page, under the result.",section:"Wording"},{key:"capped_today_note",label:"When today's plays are used up",type:"freetext",description:"What a fan reads when the game has taken all the plays it can take today, and opens again at midnight UTC. A Dev game has a daily limit; a Prod game does not, so this never shows on one. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, when the Engine refuses a play until tomorrow.",section:"Wording"},{key:"splash_gradient_start",label:"Intro screen colour, top",type:"colour",description:"The colour at the top of the intro screen's gradient, also the colour the page paints before anything loads. Leave it empty to use the background colour.",readBy:"The game's intro screen, from its first frame.",section:"Brand"},{key:"splash_gradient_end",label:"Intro screen colour, bottom",type:"colour",description:"The colour at the bottom of the intro screen's gradient. Leave it empty to use the background container colour.",readBy:"The game's intro screen, from its first frame.",section:"Brand"},{key:"splash_play_label",label:"Intro screen button",type:"freetext",description:'What the big button on the intro screen says once the game has loaded. Tapping it starts the game and turns sound and vibration on. Empty says "Play".',readBy:"The game's intro screen.",section:"Wording"},{key:"splash_continue_label",label:"Intro screen button, part way through",type:"freetext",description:`What the intro screen button says when the fan has a round they haven't finished. Empty says "Continue".`,readBy:"The game's intro screen.",section:"Wording"},{key:"splash_error_text",label:"Intro screen, when loading fails",type:"freetext",description:`What the intro screen says if the game can't load. Empty says "The game didn't load. Check your connection and try again."`,readBy:"The game's intro screen.",section:"Wording"},{key:"splash_retry_label",label:"Intro screen, try again button",type:"freetext",description:`The button shown when the game can't load. Empty says "Try again".`,readBy:"The game's intro screen.",section:"Wording"},{key:"recovery_open_label",label:"Recovery button",type:"freetext",description:`The small button that opens a fan's recovery code. Empty says "Your progress".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_show_title",label:"Recovery code, heading",type:"freetext",description:`The heading above a fan's recovery code. Empty says "Keep your progress".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_show_detail",label:"Recovery code, explanation",type:"freetext",description:"The line under that heading. Empty explains that the code brings a fan's name, scores and achievements back on another device, and is shown once.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_private_note",label:"Recovery code, keep it private",type:"freetext",description:"The warning under the code. Empty says anyone with the code can play as the fan.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_replace_note",label:"Recovery code, replacing it",type:"freetext",description:"The warning that a new code stops the old one working.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_enter_title",label:"Restore, heading",type:"freetext",description:`The heading for a fan who has played before. Empty says "I've played before".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_enter_detail",label:"Restore, explanation",type:"freetext",description:"The line under that heading.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_submit_label",label:"Restore, button",type:"freetext",description:`The button that restores a fan's progress from their code. Empty says "Get my progress back".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_not_recognised",label:"Restore, code not recognised",type:"freetext",description:"What a fan reads when their code isn't recognised.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_restored",label:"Restore, done",type:"freetext",description:"What a fan reads once their progress is back.",readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_get_label",label:"Recovery code, get button",type:"freetext",description:`The button that issues a fan's recovery code. Empty says "Get a recovery code".`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_issue_failed",label:"Recovery code, when it fails",type:"freetext",description:`What a fan reads if a code can't be issued. Empty says "That didn't work. Check your connection and try again."`,readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_copy_label",label:"Recovery code, copy button",type:"freetext",description:'The button that copies the code. Empty says "Copy".',readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_copied_label",label:"Recovery code, copied",type:"freetext",description:'What the page says once the code is copied. Empty says "Copied".',readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_share_label",label:"Recovery code, share button",type:"freetext",description:'The button that shares the code. Empty says "Share".',readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"},{key:"recovery_close_label",label:"Recovery screens, close button",type:"freetext",description:'The button that closes the recovery screens. Empty says "Close".',readBy:"The game's recovery screens, drawn by mountRecovery. GS-568.",section:"Wording"}];Wy=qy.map(e=>e.key);Xz=[...Yo("background","Background","The app and element background.",{variant:!1}),...Yo("highlight","Highlight","The accent for primary buttons and selected states; a saturated, high-contrast hue.",{variant:!0}),...Yo("positive","Positive","Positive states such as a correct answer or a successful submission; usually green.",{variant:!0}),...Yo("negative","Negative","Negative states such as a wrong answer or an error; usually red.",{variant:!0}),...Yo("primary","Primary","A high-contrast brand colour for the header, footer and some icons; less prominent than Highlight.",{variant:!0}),...Yo("secondary","Secondary","A medium-contrast brand colour for secondary buttons and inactive states.",{variant:!0}),...Yo("tertiary","Tertiary","A low-contrast colour for option buttons and most interactive UI.",{variant:!0})],Dl=[{key:"display_name",label:"Game name",type:"freetext",description:"What a fan sees at the top of the game. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, as its heading and its browser title.",section:"Identity"},{key:"strapline",label:"Strapline",type:"freetext",description:"One line under the name. Filled in from the game when it deploys; what you write here is what fans see. Clear it and the line is not drawn.",readBy:"The game's own page, under the heading.",section:"Identity"},{key:"how_to_play",label:"How to play",type:"freetext",description:"The rules in a fan's words. Shown before they start, and reachable while they play.",readBy:"The game's own page, in its how-to-play panel.",section:"Identity"},{key:"reference_url",label:"Reference data",type:"freetext",description:"A link to JSON holding the data this game draws on, shared by every round. Fetched by the Engine, never sent to a fan's browser. Leave it empty if each round carries everything it needs.",readBy:"The control plane, when it provisions a round.",section:"Content",public:!1},{key:"analytics_url",label:"Analytics endpoint",type:"freetext",description:"Where a copy of what fans do in this game is sent. Leave it empty and nothing is collected. Monterosa will give you the address for your account.",readBy:"The game's own page, which loads the collector and posts to it once a fan has consented.",section:"Content"},{key:"primary_colour",label:"Primary colour",type:"colour",description:"Your brand colour. It is the button a fan presses, and the accent on any Live Graphics graphic this game puts on a screen.",readBy:"The game's own page, as the --gamestage-primary custom property, and the graphic, as its accent.",section:"Brand"},{key:"logo_url",label:"Logo",type:"image",description:"Your mark, shown in the top corner of a graphic on a screen. Leave it empty and the graphic carries no logo. A transparent PNG or an SVG reads best on a dark board.",readBy:"Live Graphics, in the top corner of every graphic for this game.",section:"Brand"},{key:"brand_font_url",label:"Typeface stylesheet",type:"freetext",description:"A stylesheet that loads your typeface, such as a Google Fonts address. Leave it empty to keep the graphic's own face.",readBy:"Live Graphics, which loads it before drawing a graphic.",section:"Brand"},{key:"brand_font_family",label:"Typeface name",type:"freetext",description:`The font-family the stylesheet above provides, such as "Archivo". Set both or neither: a name with no stylesheet falls back to the graphic's own face, and a stylesheet with no name is never used.`,readBy:"Live Graphics, as the face every word on a graphic is set in.",section:"Brand"},{key:"title_font",label:"Title typeface",type:"freetext",description:`The Google Font the game's name is set in at the top of the page, such as "Bebas Neue". It must be one of the families Gamestage offers (Anton, Archivo Black, Bebas Neue, Bungee, Chakra Petch, Fraunces, Oswald, Playfair Display, Russo One and others); any other name is ignored and the game's own title face is used. Leave it empty to keep that face.`,readBy:"The game's own page, on its title, loaded from Google Fonts after the page has drawn.",section:"Brand"},{key:"title_font_weight",label:"Title weight",type:"freetext",description:"How heavy the title is, as a number from 100 to 900 (400 is regular, 700 bold). A weight the typeface does not have becomes the nearest one it does; empty uses its heaviest.",readBy:"The game's own page, on its title.",section:"Brand"},{key:"title_letter_spacing",label:"Title letter spacing",type:"freetext",description:"Space between the title's letters, as a fraction of the type size: 0.08 spreads it out, -0.02 tightens it, empty leaves the typeface's own spacing. Kept between -0.1 and 0.4.",readBy:"The game's own page, on its title.",section:"Brand"},{key:"title_case",label:"Title case",type:"freetext",description:`Type "upper" to show the game's name in capital letters whatever case it is typed in. Leave it empty to show it as typed.`,readBy:"The game's own page, on its title.",section:"Brand"},{key:"title_colour",label:"Title colour",type:"colour",description:"The colour of the game's name. Leave it empty to use the page's own text colour.",readBy:"The game's own page, on its title.",section:"Brand"},{key:"logo_text",label:"Logo text",type:"freetext",description:"How the game's name is drawn as a logo, if different from its name. Put the characters to pick out in square brackets: WAGE[$] draws WAGE$ with the $ in the accent colour. The browser tab, the share text and screen readers still use the game's name. Leave it empty to draw the name.",readBy:"The game's own page, on its title and its intro screen.",section:"Brand"},{key:"logo_accent_colour",label:"Logo accent colour",type:"colour",description:"The colour of the characters in square brackets in the logo text. Leave it empty to use the title colour.",readBy:"The game's own page, on its title and its intro screen.",section:"Brand"},{key:"play_button_label",required:!0,label:"Main button",type:"freetext",description:"What the button that submits a fan's answer says. Filled in from the game when it deploys; what you write here is what fans see.",readBy:"The game's own page, on its submit button.",section:"Wording"},...qy,{key:"consent_brand_name",label:"Consent, who runs the game",type:"freetext",description:'Your brand, named on the consent banner as the one asking, e.g. "Arsenal". Required: a game with no brand name cannot deploy.',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_title",label:"Consent, heading",type:"freetext",description:`The consent card's name, read by a screen reader rather than shown. Empty says "Your privacy".`,readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_detail",label:"Consent, explanation",type:"freetext",description:"The consent message. {brand} is replaced with your brand name. Empty says: {brand} would like to record analytics on how you play, so we can improve the game. We only do this if you agree. Data needed to run the game, such as your scores, is processed on the basis of legitimate interests.",readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_accept_label",label:"Consent, accept button",type:"freetext",description:'Empty says "Accept". The same size as the reject button, filled in your accent colour.',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_reject_label",label:"Consent, reject button",type:"freetext",description:'Empty says "Reject". The same size as the accept button, beside it.',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_choose_label",label:"Consent, choose button",type:"freetext",description:'Opens the list of categories. Empty says "Manage preferences".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_save_label",label:"Consent, save button",type:"freetext",description:'Saves the categories a fan ticked. Empty says "Save my choices".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_analytics_label",label:"Consent, measurement category",type:"freetext",description:'Empty says "Measure how the game is played".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_marketing_label",label:"Consent, marketing category",type:"freetext",description:`Empty says "Offers and news from the game's owner".`,readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_functional_label",label:"Consent, preferences category",type:"freetext",description:'Empty says "Remember my preferences".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_settings_label",label:"Consent, settings link",type:"freetext",description:'The link a fan uses to change their mind later. Empty says "Privacy settings".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"consent_policy_version",label:"Privacy policy version",type:"freetext",description:'Change this when your privacy policy changes, and every fan is asked again. Empty is "1".',readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"privacy_policy_url",label:"Privacy policy link",type:"freetext",description:`Where the banner's "Privacy policy" link goes. Required: a game with no privacy policy link cannot deploy.`,readBy:"The game's consent banner, drawn by mountConsent or the Gamestage UI consent component. GS-575.",section:"Wording"},{key:"rank_ladder",label:"Rank names",type:"collection",itemLabel:"{{rank_label}}",description:"What each rank is called, best first. The game decides which rank a fan earned; this is only what it is called. Leave it empty to use the game's own names.",readBy:"The Engine, which awards the rank and returns its name.",section:"Wording",fieldset:[{key:"rank_label",label:"Name",type:"freetext",description:'What a fan sees when they earn this rank, e.g. "Hall of Fame".',readBy:"The Engine, on a finished round.",section:"Wording"}]},{key:"round_selection",label:"How the live round is chosen",type:"freetext",description:"Calendar: the round on today's edition, which a producer prepares. Rotation: one of a pool, chosen by the clock, the same one for everybody playing at that moment. Leave it empty for calendar.",readBy:"The control plane, when it provisions a round.",section:"Content",public:!1},{key:"round_window_seconds",label:"How long a round stays up",type:"number",description:"Under rotation, how many seconds each round is the live one before the next takes over. Leave it empty for a day.",readBy:"The control plane, when it provisions a round.",section:"Content",public:!1},{key:"measure",label:"Measure",type:"freetext",description:'Which column of the reference data a round counts, when it holds more than one, e.g. "points". A round can name its own instead. Leave it empty if the data holds one measure.',readBy:"The control plane, when it joins a round to the reference data.",section:"Content",public:!1},...Xz],Hy=[{key:"edition_name",label:"Edition name",type:"freetext",description:"What a fan sees this edition called. Leave it empty to use the game's own word for its container.",readBy:"The game's own page, wherever it names the round.",section:"This edition"},{key:"edition_strapline",label:"Edition line",type:"freetext",description:"A line for this edition only: a sponsor, a fixture, a date. Leave it empty and the line is not drawn.",readBy:"The game's own page, beside the edition name.",section:"This edition"}],Qz=[{key:"bingo_rows",label:"Board rows",type:"number",description:"How many rows a fan's board has. Leave it empty for 3.",readBy:"The control plane, when it builds the round from this edition.",section:"This edition",public:!1},{key:"bingo_columns",label:"Board columns",type:"number",description:"How many columns a fan's board has. Leave it empty for 3.",readBy:"The control plane, when it builds the round from this edition.",section:"This edition",public:!1},{key:"bingo_centre_mode",label:"Centre cell",type:"freetext",description:'One of "free" (marked for everybody, and does not use a card), "none" (an ordinary cell dealt like any other) or "choice" (the fan picks it). Leave it empty for "free".',readBy:"The control plane, when it builds the round from this edition.",section:"This edition",public:!1},{key:"bingo_shuffle_allowance",label:"Reshuffles allowed",type:"number",description:"How many times a fan may redeal their board before locking it. Leave it empty for 3.",readBy:"The Engine, which refuses a reshuffle once this is spent.",section:"This edition"},{key:"bingo_prompt",label:"What a fan is told",type:"freetext",description:"The line above the board, in a fan's words. Leave it empty to keep the wording the game was built with.",readBy:"The control plane, when it builds the round from this edition.",section:"This edition",public:!1},{key:"bingo_points_per_line",label:"Points per line",type:"number",description:"Awarded once for each completed line. Leave it empty for 10.",readBy:"The Engine, when it scores a settled board.",section:"This edition"},{key:"bingo_points_for_full_board",label:"Points for a full board",type:"number",description:"Awarded once, on top of every line, when the whole board comes in. Leave it empty for 0.",readBy:"The Engine, when it scores a settled board.",section:"This edition"}],Ml=[{key:"title",label:"Round name",type:"freetext",description:"How this round is listed in Studio, so you can tell rounds apart. Gamestage fills it in when it creates the round; change it to anything. Fans do not see it.",readBy:"Studio's timeline label. Nothing a fan loads reads it.",section:"Content",public:!1},{key:"source_url",label:"Content source",type:"freetext",description:"A link to JSON holding this round's content. Fetched by the Engine when the round is provisioned, so it is never sent to a fan's browser and may hold the answers. Leave it empty to use the round in the game's manifest.",readBy:"The control plane, when it provisions the round.",section:"Content",public:!1},{key:"measure",label:"Measure",type:"freetext",description:'Which column of the reference data this round counts, e.g. "assists". Leave it empty to count what the game counts.',readBy:"The control plane, when it joins this round to the reference data.",section:"Content",public:!1},{key:"round_timer_seconds",label:"Time limit",type:"number",description:"How many seconds a fan gets on this round, counted from when they open it: 180 for three minutes. The Engine refuses a play that arrives after it. Leave it empty for a round with no clock.",readBy:"The Engine, which refuses a late play, and the game's own page, which counts it down.",section:"Content"}],eN=[{key:"round_theme",label:"Theme",type:"freetext",description:`What this round is about, in a word or two, e.g. "The Eighties". Shown above the game's name. Leave it empty for a round that is not one of a themed set.`,readBy:"The game's own page, above the title.",section:"This round"},{key:"round_prompt",label:"What a fan is told",type:"freetext",description:"The line above the board, in a fan's words. Leave it empty to keep the wording the game was built with.",readBy:"The game's own page, above the board.",section:"This round"},{key:"round_target",label:"The target",type:"number",description:"The total a fan must get as close to as they can without going over. Public: it is the goal they are set, and the game is unplayable without it.",readBy:"The Engine, which marks against it, and the page, which shows it.",section:"This round"},{key:"round_target_label",label:"What is being counted",type:"freetext",description:'Shown beside the target, e.g. "Career Points".',readBy:"The game's own page, beside the target.",section:"This round"},{key:"round_unit",label:"Unit",type:"freetext",description:'Put in front of every number in this round, e.g. "\xA3". Leave it empty for a round that counts something with no unit, like points.',readBy:"The game's own page, in front of the target, each pick and the total.",section:"This round"},{key:"round_slates",label:"The picks",type:"collection",itemLabel:"{{slate_label}}",description:"One group per pick, in the order a fan plays them. Five groups means five picks.",readBy:"The Engine, which marks against them, and the page, which draws them.",section:"This round",fieldset:[{key:"slate_label",label:"Group",type:"freetext",description:'What a fan sees above the choices, e.g. "1996-97 CHI".',readBy:"The game's own page.",section:"This round"},{key:"slate_entries",label:"Choices",type:"collection",itemLabel:"{{entry_label}}",description:"The choices a fan picks between in this group.",readBy:"The Engine and the page.",section:"This round",fieldset:[{key:"entry_label",label:"Name",type:"freetext",description:'What a fan sees, e.g. "Michael Jordan".',readBy:"The game's own page.",section:"This round"},{key:"entry_key",label:"Reference",type:"freetext",description:`The id this choice has in the game's own data, e.g. "jordami01". It is how the Engine finds what the choice is worth, so it has to match the data the game was deployed with. Never shown to a fan.`,readBy:"The Engine, to look up what this choice is worth.",section:"This round"},{key:"entry_note",label:"Note",type:"freetext",description:'Something worth knowing about this choice, shown to a fan who went over because of it, e.g. "Six rings, six Finals MVPs." Leave it empty and the game works out its own line.',readBy:"The game's own page, on the result when this choice took a fan over.",section:"This round"}]}]}],Ky="Never shown to a fan. This is the answer, so it is withheld from the feeds a browser reads.",UT={key:"round_board",label:"The board",type:"collection",itemLabel:"{{board_item}}",description:"Everything a fan can pick from, in the order they should see it.",readBy:"The Engine, which marks against it, and the page, which draws it.",section:"This round",fieldset:[{key:"board_item",label:"Pick",type:"freetext",description:'One thing a fan can pick, exactly as they should read it, e.g. "Michael Jordan".',readBy:"The game's own page, and the Engine, which marks a pick by it.",section:"This round"},{key:"board_given",label:"Given name",type:"freetext",description:'Optional. When the pick is a person, the first line of their name as a fan reads it, e.g. "Ole Gunnar". Leave empty to split the pick at its first space.',readBy:"The game's own page, which draws a person's name on two lines. The Engine never reads it.",section:"This round"},{key:"board_family",label:"Family name",type:"freetext",description:'Optional. When the pick is a person, the bold second line of their name, e.g. "Solskjaer". Leave empty to split the pick at its first space.',readBy:"The game's own page, which draws a person's name on two lines. The Engine never reads it.",section:"This round"}]},tN=[{key:"round_prompt",label:"What a fan is told",type:"freetext",description:`The line above the board, in a fan's words. Leave it empty to keep the wording the game was built with. Lead with what the fan has to decide, not who the players are: say "a \xA3100m player", never "a goalkeeper", since naming the category gives the answer away. Put the famous name on the board as the trap, not in this line. One line, e.g. "Only one of these players has scored a penalty so far this season." or "Who is the player that's not yet scored?"`,readBy:"The game's own page, above the board.",section:"This round"},UT,{key:"round_targets",label:"The right answers",type:"freetext",description:`The picks that are right, separated by commas, written exactly as they appear on the board, e.g. "Michael Jordan, Larry Bird". ${Ky}`,readBy:"The Engine, to mark a pick.",section:"This round",public:!1}],nN=[{key:"answer_measure",label:"Answer from data",type:"freetext",description:'Leave empty to type the answer yourself. Otherwise the dataset measure the answer is worked out from, e.g. "own_goals", and the board holds dataset keys rather than names.',readBy:"The relay, which works out the answer when the round is provisioned.",section:"This round",public:!1},{key:"answer_rule",label:"Which player is right",type:"freetext",description:'With "Answer from data": highest, lowest, only_nonzero (the one player above zero) or only_zero (the one player on zero). A round where the rule fits more than one player is refused, never guessed.',readBy:"The relay.",section:"This round",public:!1},{key:"reveal_each_guess",label:"Show a wrong guess's figure",type:"freetext",description:'With "Answer from data": "yes" to show a wrong guess its own figure straight away, "no" to show every figure only at the end. Empty means yes.',readBy:"The Engine, when it marks a guess.",section:"This round",public:!1},{key:"round_layout",label:"How the board is drawn",type:"freetext",description:`Empty for cards. "pitch" to draw each player on a football pitch at their position, from the dataset; works with "Answer from data", and a round whose players have no position in the dataset stays as cards. "xi" to draw a team's eleven with one place empty, from "The eleven", and ask who played there.`,readBy:"The relay, which adds each player's position; then the game's page.",section:"This round"},{key:"round_lineup",label:"The eleven",type:"freetext",description:'For "xi" rounds only, written by `gamestage round seed --layout xi`. The team and its starting places as JSON: {"team":"AFC Bournemouth","formation":"4-2-3-1","places":[{"row":1,"column":1,"label":"Djordje Petrovic"},...]}. Row 1 is the goalkeeper. Exactly one place has no "label": that is the gap a fan fills, and its player goes in "The right answers" and on the board.',readBy:"The game's page, which draws it.",section:"This round"},{key:"round_twist",label:"The twist",type:"freetext",description:`One surprising line shown after the round, e.g. "He has also completed more passes than any other defender." ${Ky}`,readBy:"The Engine, which sends it only with a finished result.",section:"This round",public:!1},{key:"round_twist_source",label:"Where the twist is from",type:"freetext",description:'The publication and date, e.g. "Fantasy Premier League, 27 Sep 2026".',readBy:"The Engine, with the twist.",section:"This round",public:!1},{key:"round_twist_url",label:"The twist's link",type:"freetext",description:"A link to where the twist was reported. Optional.",readBy:"The Engine, with the twist.",section:"This round",public:!1}],oN=[{key:"round_prompt",label:"What a fan is told",type:"freetext",description:"The line above the board, in a fan's words. Leave it empty to keep the wording the game was built with.",readBy:"The game's own page, above the board.",section:"This round"},UT,{key:"round_groups",label:"The groups",type:"collection",itemLabel:"{{group_label}}",description:`One per hidden group. ${Ky}`,readBy:"The Engine, to mark a guess and to name a group once it is found.",section:"This round",public:!1,fieldset:[{key:"group_label",label:"What they have in common",type:"freetext",description:'Shown to a fan only once they have found this group, e.g. "1996-97 Bulls".',readBy:"The game's own page, after the group is solved.",section:"This round"},{key:"group_members",label:"Which ones",type:"freetext",description:'The picks in this group, separated by commas, written exactly as they appear on the board, e.g. "Michael Jordan, Scottie Pippen". Every one has to be on the board, and no pick may be in two groups.',readBy:"The Engine, to mark a guess.",section:"This round"}]}],Yy=[{key:"prediction_question",label:"Question",type:"freetext",description:"What a fan is asked to call, in their words.",readBy:"The Engine, when it provisions the round.",section:"Content"},{key:"prediction_option",label:"Option",type:"freetext",description:"One thing a fan can call. Add one per outcome.",readBy:"The Engine, when it provisions the round.",section:"Content"}],rN=[{key:"card_note",label:"What this card means",type:"freetext",description:'A sentence explaining the card, shown when a fan taps it. "Goal in the first 10" might be "A goal is scored by either team inside the first ten minutes." Leave it empty and tapping the card does nothing.',readBy:"The game's own page, on the back of the card a fan taps.",section:"This card",public:!0}],aN=[{key:"round_prompt",label:"What a fan is told",type:"freetext",description:"The line above the goal, in a fan's words. Leave it empty to keep the wording the game was built with.",readBy:"The game's own page, above the goal.",section:"This round"},{key:"shoot_shots_allowed",label:"Shots",type:"number",description:"How many penalties a fan takes, from 1 to 20. Leave it empty for 5.",readBy:"The Engine, which refuses a shot once they are spent.",section:"This round"},{key:"shoot_goals_to_win",label:"Goals to win",type:"number",description:"How many goals count as winning the shootout. Reaching it does not end play: every remaining shot still scores. Leave it empty for 3.",readBy:"The Engine, which decides won or lost after the last shot.",section:"This round"},{key:"shoot_points_per_goal",label:"Points per goal",type:"number",description:"What each goal is worth on the leaderboard. Leave it empty for 100.",readBy:"The Engine, which scores each goal.",section:"This round"},{key:"shoot_difficulty",label:"Keeper",type:"freetext",description:"How good the goalkeeper is: easy_v1, balanced_v1 or hard_v1. Leave it empty for balanced_v1.",readBy:"The Engine, which picks the keeper's speed, reach and reactions from it.",section:"This round"}],iN=[{key:"mystery_answer",label:"The answer",type:"freetext",description:`The player fans are looking for, written exactly as the dataset names him, e.g. "Erling Haaland", or his dataset key. Must be a player in the game's dataset.`,readBy:"The Deduction Engine, as the mystery's subject.",section:"This mystery",public:!1},{key:"mystery_first_clue",label:"Free clue",type:"freetext",description:'The clue every fan starts with, e.g. "He plays for Manchester City." Required, 200 characters at most.',readBy:"The game's own page, as the first clue.",section:"This mystery",public:!0},{key:"mystery_first_clue_field",label:"Free clue is about",type:"freetext",description:"Which dataset field the free clue gives away, so the game narrows the field on it: team, position, nationality, age or any other field the dataset holds. Leave it empty for team.",readBy:"The Deduction Engine, to narrow the field on the free clue.",section:"This mystery",public:!0},{key:"mystery_second_clue",label:"Second clue",type:"freetext",description:'The clue a fan gets when their coins run low, e.g. "He is a forward." Required, 200 characters at most.',readBy:"The game's own page, as the second clue.",section:"This mystery",public:!0},{key:"mystery_second_clue_field",label:"Second clue is about",type:"freetext",description:"Which dataset field the second clue gives away. Must differ from the free clue's. Leave it empty for position.",readBy:"The Deduction Engine, to narrow the field on the second clue.",section:"This mystery",public:!0},{key:"mystery_difficulty",label:"Difficulty",type:"number",description:"1 easy, 2 medium or 3 hard. Leave it empty for 1.",readBy:"The Deduction Engine, which scores a solve by it.",section:"This mystery",public:!0}],Vy={hunt:[...tN,...nN],push:eN,group:oN,predict:[],bingo:rN,shoot:aN,place:[],mystery:iN},Zy={hunt:[],push:[],group:[],predict:[],bingo:Qz,shoot:[],place:[],mystery:[]},Jy={display_name:"displayName",title_font:"titleFont",title_font_weight:"titleFontWeight",title_letter_spacing:"titleLetterSpacing",title_colour:"titleColour",title_case:"titleCase",logo_text:"logoText",logo_accent_colour:"logoAccentColour",splash_gradient_start:"splashGradientStart",splash_gradient_end:"splashGradientEnd",splash_play_label:"splashPlayLabel",splash_continue_label:"splashContinueLabel",splash_error_text:"splashErrorText",splash_retry_label:"splashRetryLabel",consent_brand_name:"consentBrandName",consent_title:"consentTitle",consent_detail:"consentDetail",consent_accept_label:"consentAcceptLabel",consent_reject_label:"consentRejectLabel",consent_choose_label:"consentChooseLabel",consent_save_label:"consentSaveLabel",consent_analytics_label:"consentAnalyticsLabel",consent_marketing_label:"consentMarketingLabel",consent_functional_label:"consentFunctionalLabel",consent_settings_label:"consentSettingsLabel",consent_policy_version:"consentPolicyVersion",privacy_policy_url:"privacyPolicyUrl",recovery_open_label:"recoveryOpenLabel",recovery_show_title:"recoveryShowTitle",recovery_show_detail:"recoveryShowDetail",recovery_private_note:"recoveryPrivateNote",recovery_replace_note:"recoveryReplaceNote",recovery_enter_title:"recoveryEnterTitle",recovery_enter_detail:"recoveryEnterDetail",recovery_submit_label:"recoverySubmitLabel",recovery_not_recognised:"recoveryNotRecognised",recovery_restored:"recoveryRestored",recovery_get_label:"recoveryGetLabel",recovery_issue_failed:"recoveryIssueFailed",recovery_copy_label:"recoveryCopyLabel",recovery_copied_label:"recoveryCopiedLabel",recovery_share_label:"recoveryShareLabel",recovery_close_label:"recoveryCloseLabel",analytics_url:"analyticsUrl",strapline:"strapline",how_to_play:"howToPlay",primary_colour:"primaryColour",play_button_label:"playButtonLabel",play_again_label:"playAgainLabel",result_button_label:"resultButtonLabel",share_button_label:"shareButtonLabel",edition_name:"editionName",edition_strapline:"editionStrapline",margin_over:"marginOver",margin_exact:"marginExact",margin_under:"marginUnder",result_over:"resultOver",result_exact:"resultExact",result_under:"resultUnder",share_over:"shareOver",share_exact:"shareExact",share_under:"shareUnder",result_bust_note:"resultBustNote",share_bust_note:"shareBustNote",capped_today_note:"cappedTodayNote",share_dare:"shareDare",result_dare:"resultDare"},sN=new Set(["titleFont","titleFontWeight","titleLetterSpacing","titleColour","titleCase","logoText","logoAccentColour"]),cN=new Set(["splashGradientStart","splashGradientEnd","splashPlayLabel","splashContinueLabel","splashErrorText","splashRetryLabel","logoText","logoAccentColour"]);Ul="label_";MT={"Abril Fatface":[400],Anton:[400],"Archivo Black":[400],"Bebas Neue":[400],Bungee:[400],"Chakra Petch":[300,400,500,600,700],"DM Serif Display":[400],Fraunces:[400,600,700,900],Oswald:[400,500,600,700],"Playfair Display":[400,700,900],"Russo One":[400],"Space Grotesk":[400,500,700],Teko:[400,500,600,700],Unbounded:[400,700,900]},Qy="https://gamestage.ai";eb=Dl.filter(e=>e.required).map(e=>e.key)});var Bl=b(()=>{"use strict"});var tb=b(()=>{"use strict";wt();By();Tn();On();Oi();Ll();Yr();Bl();Kt()});function dN(e,t){if(/^[A-Z]+s?$/.test(t))return`${e}_${t.toLowerCase()}`;let o=t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase();return o.startsWith(`${e}_`)?o:`${e}_${o}`}function uN(e){let t=e.replace(/Pct$/,"Percent").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(" "),o=t[0]==="avg",r=(o?t.slice(1):t).map((n,a)=>/^[A-Z]{2,}$/.test(n)?n:a===0?n[0].toUpperCase()+n.slice(1):n.toLowerCase());return o?`${r.join(" ")} per game`:r.join(" ")}function ql(e){let t=Rn[e];return t?Object.entries(t.categories).flatMap(([o,r])=>r.map(n=>({key:dN(o,n),label:uN(n),category:o,name:n}))):[]}var Rn,Wl=b(()=>{"use strict";wt();Rn={nba:{sport:"basketball",label:"NBA",categories:{general:["gamesPlayed","avgMinutes","avgFouls","flagrantFouls","technicalFouls","ejections","doubleDouble","tripleDouble","minutes","rebounds","fouls","avgRebounds"],offensive:["avgPoints","avgFieldGoalsMade","avgFieldGoalsAttempted","fieldGoalPct","avgThreePointFieldGoalsMade","avgThreePointFieldGoalsAttempted","threePointFieldGoalPct","avgFreeThrowsMade","avgFreeThrowsAttempted","freeThrowPct","avgAssists","avgTurnovers","points","fieldGoalsMade","fieldGoalsAttempted","threePointFieldGoalsMade","threePointFieldGoalsAttempted","freeThrowsMade","freeThrowsAttempted","assists","turnovers"],defensive:["avgSteals","avgBlocks","steals","blocks"]},defaults:["offensive_points","general_rebounds","offensive_assists","general_games_played"]},wnba:{sport:"basketball",label:"WNBA",categories:{general:["gamesPlayed","avgMinutes","doubleDouble","tripleDouble","PER","avgRebounds"],offensive:["points","avgPoints","avgFieldGoalsMade","avgFieldGoalsAttempted","fieldGoalPct","avgThreePointFieldGoalsMade","avgThreePointFieldGoalsAttempted","threePointFieldGoalPct","avgFreeThrowsMade","avgFreeThrowsAttempted","freeThrowPct","avgAssists","avgTurnovers"],defensive:["avgSteals","avgBlocks"]},defaults:["offensive_points","offensive_avg_points","general_avg_rebounds","general_games_played"]},nfl:{sport:"football",label:"NFL",categories:{general:["gamesPlayed","fumblesForced","fumblesRecovered","fumblesTouchdowns"],passing:["completions","passingAttempts","completionPct","passingYards","yardsPerPassAttempt","passingYardsPerGame","longPassing","passingTouchdowns","interceptions","sacks","sackYardsLost","QBR","QBRating","adjQBR"],rushing:["rushingAttempts","rushingYards","yardsPerRushAttempt","longRushing","rushingBigPlays","rushingTouchdowns","rushingYardsPerGame","rushingFumbles","rushingFumblesLost","rushingFirstDowns"],receiving:["receptions","receivingTargets","receivingYards","yardsPerReception","receivingTouchdowns","longReception","receivingBigPlays","receivingYardsPerGame","receivingFumbles","receivingFumblesLost","receivingYardsAfterCatch","receivingFirstDowns"],defensive:["soloTackles","assistTackles","totalTackles","sacks","sackYards","tacklesForLoss","passesDefended","longInterception"],defensiveinterceptions:["interceptions","interceptionYards","interceptionTouchdowns"],scoring:["rushingTouchdowns","receivingTouchdowns","returnTouchdowns","totalTouchdowns","fieldGoals","kickExtraPoints","totalTwoPointConvs","totalPoints","totalPointsPerGame"],returning:["kickReturns","kickReturnYards","yardsPerKickReturn","longKickReturn","kickReturnTouchdowns","puntReturns","puntReturnYards","yardsPerPuntReturn","longPuntReturn","puntReturnTouchdowns","puntReturnFairCatches"],kicking:["fieldGoalsMade","fieldGoalAttempts","fieldGoalPct","longFieldGoalMade","extraPointsMade","extraPointAttempts","extraPointPct"],punting:["punts","puntYards","longPunt","grossAvgPuntYards","netAvgPuntYards","puntsBlocked","puntsInside20","touchbacks","fairCatches"]},defaults:["passing_yards","rushing_yards","receiving_yards","scoring_total_touchdowns"]},mlb:{sport:"baseball",label:"MLB",categories:{batting:["gamesPlayed","atBats","runs","hits","avg","doubles","triples","homeRuns","RBIs","totalBases","walks","strikeouts","stolenBases","onBasePct","slugAvg","OPS"],pitching:["gamesPlayed","gamesStarted","qualityStarts","ERA","wins","losses","saves","holds","innings","hits","earnedRuns","homeRuns","walks","strikeouts","strikeoutsPerNineInnings","WHIP"],fielding:["gamesPlayed","gamesStarted","fullInningsPlayed","totalChances","putouts","assists","fieldingPct","errors","doublePlays"]},defaults:["batting_home_runs","batting_hits","batting_rbis","pitching_strikeouts"],tablePerCategory:!0},nhl:{sport:"hockey",label:"NHL",categories:{general:["games","plusMinus","shifts","production","wins","losses"],offensive:["goals","assists","points","powerPlayGoals","powerPlayAssists","shotsTotal","shootingPct","gameWinningGoals","faceoffsWon","faceoffsLost","faceoffPercent","shootoutAttempts","shootoutGoals"],defensive:["overtimeLosses","avgGoalsAgainst","shotsAgainst","goalsAgainst","saves","savePct","shutouts"],penalties:["penaltyMinutes"]},defaults:["offensive_goals","offensive_assists","offensive_points","general_games"]}}});var pN,WT,hN,Hl,r8,nb=b(()=>{"use strict";Ye();wt();Wl();pN=12,WT=12,hN=["espn"],Hl=e=>hN.includes(e),r8=c.object({workspace:c.string().min(1),name:c.string().min(1),supplier:c.string().min(1),request:c.object({league:c.string(),season:c.number().int().optional(),measures:c.array(c.string()).min(1)}),refreshHours:c.number().int().positive().default(pN),override:c.object({refreshHours:c.number().int().positive(),by:c.string(),at:c.string()}).optional(),disabled:c.boolean().default(!1),createdAt:c.string(),updatedAt:c.string(),by:c.string()})});var fN,HT,gN,c8,KT,l8,d8,u8,ob=b(()=>{"use strict";Ye();wt();fN=c.enum(["push","pull"]),HT=c.object({workspaceId:c.string().min(1),name:c.string().min(1),key:c.string().min(1),digest:c.string().regex(/^[0-9a-f]{16}$/),measures:c.array(c.string()).default([]),counts:c.record(c.string(),c.number().int().nonnegative()).default({}),scored:c.array(c.string()).optional(),bytes:c.number().int().nonnegative().default(0),origin:fN.default("push"),supplier:c.string().optional(),publishedAt:c.string().nullable().default(null),checkedAt:c.string().nullable().default(null),failing:c.boolean().default(!1),counted:c.boolean().default(!1)}),gN=c.object({gameId:c.string().min(1),gameName:c.string().default(""),pinnedDigest:c.string().nullable().default(null),stale:c.boolean().default(!1),roundIds:c.array(c.string()).default([])}),c8=c.object({dataset:HT,usedBy:c.array(gN).default([])}),KT=c.enum(["pushed","pulled","joined","refused","failed"]),l8=c.object({at:c.string(),event:KT,dataset:c.string().min(1),digest:c.string().nullable().default(null),gameId:c.string().nullable().default(null),gameName:c.string().nullable().default(null),roundId:c.string().nullable().default(null),message:c.string().default(""),ok:c.boolean().default(!0)}),d8=c.object({dataset:c.string().optional(),gameId:c.string().optional(),event:c.array(KT).optional(),since:c.string().optional(),search:c.string().optional(),before:c.string().optional(),limit:c.number().int().positive().max(500).default(100)}),u8=c.object({datasets:c.array(HT).default([]),unavailable:c.string().nullable().default(null)})});var rb=b(()=>{"use strict";Kt();qt()});var ab=b(()=>{"use strict";On();Kt()});var ib=b(()=>{"use strict"});var sb=b(()=>{"use strict";wt();On();ab();Ll();ib();Kt();On();qt();Tn();Bl();Oi()});function cb(e){return YT+e.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function ZT(e){if(e.startsWith(YT)){for(let[t,o]of Object.entries(VT))if(o.some(r=>cb(r)===e))return t}}function lb(e){let o=Object.values(VT).flat().map(cb).indexOf(e);return o===-1?void 0:o}var YT,VT,Kl,db=b(()=>{"use strict";YT="label_taster_",VT={"Taster: board and buttons":["playPrompt","attemptsLabel","mistakesLabel","pickedLabel","scoreLabel","timeLeftLabel","timeUpLabel","nextRoundLabel","oneAwayLabel","runningLabel","spentLabel","underNote","bustFallback","restartLabel","playAnotherLabel","playAnotherBusyLabel","questionCountLabel","yourCallLabel"],"Taster: result and leaderboard":["wonLabel","finishedLabel","pendingLabel","pendingNote","rankLabel","rankUnavailable","rewardLabel","anonymousLabel","derivedNameLabel","boardLabel","boardLoading","boardEmpty","rankedBy","closeLabel"],"Taster: when a play is refused":["refused","refusedClosed","refusedFinished","refusedNoTries","refusedTooManyWrong","refusedNoPicks","refusedIncomplete","refusedOneAtATime","refusedMoved","roundLockedLabel","roundLockedNextLabel","unavailable"],"Taster: loading":["loading","loadingTakingTooLong","loadingReload","loadingConnecting","loadingLookingUp","loadingKits","loadingOpening","loadingStarting","loadingSettings","loadingRound","loadingState","loadingFailedAt","loadingProgressLabel"],"Taster: navigation and page":["eyebrow","tabHome","tabPlay","tabHow","tabsLabel","moreLabel","homeTitle","homeHere","howToPlay","backLabel","footNote","footLink"],"Taster: proofs and the notify demo":["proofsHeading","proofsBlurb","lookLabel","changeLabel","duplicateLabel","busyLabel","payloadNote","needsPlay","notCapped","notifyTitle","notifyMockNote","notifyFieldLabel","notifySubmit","notifyDone"],"Taster: bingo":["bingoDealLabel","bingoDealingLabel","bingoWhichLabel","bingoFlipHint","bingoPreviousLabel","bingoNextLabel","bingoWatchingLabel","bingoOneAwayLabel","bingoLineLabel","bingoCalledLabel","bingoFreeLabel"],"Taster: penalties":["shootOptionsLabel","shootReplayLabel","shootInstruction","shootPitchLabel","shootRetryLabel","shootGoalLabel","shootSavedLabel","shootWideLabel","shootOverLabel","shootFrameLabel","shootGoalsLabel","shootGoalsTally","shootAimLabel","shootPowerLabel","shootPlacedLabel","shootFirmLabel","shootFullLabel","shootZoneTopLeft","shootZoneTopCentre","shootZoneTopRight","shootZoneLowLeft","shootZoneLowCentre","shootZoneLowRight"]};Kl=["tabHow","boardLabel","closeLabel","playAnotherLabel","restartLabel","backLabel"].map(e=>cb(e))});function kN(e){let t=new Map,o=r=>{for(let n of r)if(n.type==="collection"){let a=t.get(n.key);if(a&&(a.itemLabel!==n.itemLabel||JSON.stringify(a.fieldset??[])!==JSON.stringify(n.fieldset??[])))throw new Error(`The collection "${n.key}" is declared with two different shapes. One key is one declaration; its fieldset and item label must match wherever it appears.`);t.set(n.key,n),o(n.fieldset??[])}};return o(e),[...bN,...Yy.map(wN),...[...t.values()].map(vN)]}function ub(e){let t=[];for(let o of e){let r=o.public===!1,n={label:o.label,key:o.key,field:QT(o),description:o.description,...o.type==="collection"?{}:{mandatory:o.required===!0},...r?{public:!1,cloneable:!1}:{}},a=t.find(i=>i.name===o.section);if(a||(a={name:o.section},t.push(a)),o.subsection){let i=a.subsections??=[],s=i.find(d=>d.name===o.subsection);s||(s={name:o.subsection,...o.subsectionDescription?{description:o.subsectionDescription}:{},properties:[]},i.push(s)),s.properties.push(n)}else(a.properties??=[]).push(n)}return t}function _N(e){let t=e.archetypes.map(De);for(let a of t)if(!JT[a])throw new Error(`No Studio element name for the ${a} archetype. Add one to ARCHETYPE_ELEMENT_NAMES rather than letting Studio show a blank type.`);let o=a=>`${e.urls.baseAppsUrl}/${a}`,r=new Set(e.wording??Wy),n=[...Dl.filter(a=>!Wy.includes(a.key)||r.has(a.key)),...[...r].filter(a=>a.startsWith(Ul)).sort(xN).map(SN)];return{"spec.json":{name:e.name,id:e.id,version:e.version,base_apps_url:e.urls.baseAppsUrl,dash_image:e.urls.dashImage,embed_url:e.urls.embedUrl,elements:o("elements.json"),fields:o("fields.json"),project_settings:o("project_settings.json"),event_settings:o("event_settings.json"),schedule:!0,analytics:!0,live_activity:!0,localisation:!1},"elements.json":t.map(a=>({name:JT[a],content_type:XT(a),derived_from:Yl[a]?.derivedFrom??"data",duration:Yl[a]?.duration??{mode:"instant"},label:Yl[a]?.derivedFrom==="prediction"?"{{question.text}}":"{{element.title}}",custom_fields:ub([...Ww.includes(De(a))?Ml.filter(i=>i.key==="title"):Ml,...Vy[De(a)]??[]]),...Yl[a]?.derivedFrom==="prediction"?{label_question:a==="bingo"?"Card":"Question",label_option:a==="bingo"?"Outcome":"Option",reveal_results:{modes:["manual"],default:"manual"},correct_option:{live_update:!0},question:[{label:"Question",key:"text",field:"prediction_question",mandatory:"question"}],option:[{label:"Option",key:"text",field:"prediction_option",mandatory:"option"}]}:{}})),"fields.json":kN([...n,...Hy,...Ml,...Object.values(Vy).flat(),...Object.values(Zy).flat(),...Yy]),"project_settings.json":{sections:ub(n)},"event_settings.json":{sections:ub([...Hy,...t.flatMap(a=>Zy[a]??[])])}}}function xN(e,t){let o=lb(e),r=lb(t);return o===void 0&&r===void 0?e<t?-1:e>t?1:0:o===void 0?-1:r===void 0?1:o-r}function SN(e){let t=GT(e),o=ZT(e);if(!o)return t;let r=e.slice(13).replace(/_/g," ").trim();return{...t,label:r.charAt(0).toUpperCase()+r.slice(1),subsection:o,...Kl.includes(e)?{required:!0}:{}}}function eE(e){return _N({name:e.gameName,id:e.gameId,wording:e.wording??[],version:`0.0.${e.manifestRevision}`,archetypes:[e.archetype],urls:e.urls})}var JT,XT,Yl,QT,bN,vN,wN,mb=b(()=>{"use strict";Yr();db();Tn();JT=Kw,XT=e=>{let t=De(e);return $u[t]??`gamestage-${t.replaceAll("_","-")}-element`},Yl={hunt:{derivedFrom:"data",duration:{mode:"fixed",default:86400}},push:{derivedFrom:"data",duration:{mode:"fixed",default:86400}},group:{derivedFrom:"data",duration:{mode:"fixed",default:86400}},place:{derivedFrom:"data",duration:{mode:"fixed",default:86400}},predict:{derivedFrom:"prediction",duration:{mode:"flexible"}},bingo:{derivedFrom:"prediction",duration:{mode:"flexible"}},shoot:{derivedFrom:"data",duration:{mode:"fixed",default:86400}}},QT=e=>e.type==="collection"?e.key:e.type,bN=[{key:"colour",type:"colour"},{key:"freetext",type:"freetext",localisable:!1},{key:"number",type:"number"},{key:"image",type:"image",width:[1,2e3],height:[1,2e3],file_size:500,localisable:!1},{key:"boolean",type:"boolean"},{key:"wysiwyg",type:"wysiwyg",localisable:!1}],vN=e=>({key:e.key,type:"collection",...e.itemLabel?{item_label:e.itemLabel}:{},fieldset:(e.fieldset??[]).map(t=>({label:t.label,key:t.key,field:QT(t),...t.description?{description:t.description}:{}}))}),wN=e=>({key:e.key,type:e.type,...e.type==="freetext"||e.type==="wysiwyg"||e.type==="image"?{localisable:!1}:{}})});var pb=b(()=>{"use strict";Tn()});var tE=b(()=>{"use strict";Kr();Na();Nl();Fy();tb();Pl();wt();nb();ob();rb();sb();mb();pb();Py();Oy();qt()});function rE(e){let t=1e3*2**(e-1),o=t*.2*(Math.random()*2-1);return Math.round(t+o)}function iE(e){let t=e.fetch??globalThis.fetch,o=e.maxAttempts??4,r=e.baseUrl.replace(/\/+$/,"");return async function(a,i,s={}){let d=globalThis.location?.origin,l=new URL(`${r}${i}`,r.startsWith("/")?d:void 0);for(let[p,h]of Object.entries(s.query??{}))h!=null&&l.searchParams.set(p,String(h));let u;for(let p=1;p<=o;p++){let h=typeof e.token=="function"?await e.token():e.token,y;try{y=await t(l,{method:a,headers:{authorization:`Bearer ${h}`,...s.body===void 0?{}:{"content-type":"application/json"}},body:s.body===void 0?void 0:JSON.stringify(s.body)})}catch(j){let re=j instanceof Error?j.message:String(j);if(u=new dt(0,"unreachable",`Could not reach the control plane at ${r}: ${re}. Check your connection and run the command again.`,!0),p===o)break;await nE(rE(p));continue}if(y.ok)return await y.json();let v=await y.json().catch(()=>({}));if(u=new dt(y.status,v.error?.code??"unknown",v.error?.message??y.statusText,v.error?.retryable??!1),!u.retryable||p===o)break;let I=Number(y.headers.get("retry-after"));await nE(Number.isFinite(I)&&I>0?I*1e3:rE(p))}throw u??new dt(0,"unknown","Request failed.",!1)}}function sE(e){let t=iE(e);return{setDatasetRefresh:(o,r,n)=>t("PUT",`/v1/admin/workspaces/${encodeURIComponent(o)}/datasets/${encodeURIComponent(r)}/refresh`,{body:{hours:n}}),setWorkspaceAccess:(o,r,n,a)=>t("PUT",`/v1/admin/workspaces/${encodeURIComponent(o)}/access`,{body:{access:r,reason:n??null,...a?.allowPersonalEmail?{allowPersonalEmail:!0}:{}}}),async listAccess(){let o=await t("GET","/v1/admin/access"),r=[...o.waiting??[],...o.decided??[]].filter(n=>typeof n=="object"&&n!==null).map(CT);return IT(r)},getWorkspace:o=>t("GET",`/v1/admin/workspaces/${encodeURIComponent(o)}`),setWorkspacePlan:(o,r,n)=>t("PUT",`/v1/admin/workspaces/${encodeURIComponent(o)}/plan`,{body:{tier:r,...n===void 0?{}:{liveGameAllowance:n}}}),runCreatorSync:()=>t("POST","/v1/admin/creator-sync")}}function Vo(e){let t=iE(e),o=["meters","rounds","history","destinations","sections","issues"],r=i=>{let s={...i,containerLabel:i.containerLabel??"Round"};for(let d of o)Array.isArray(s[d])||(s[d]=[]);return s},n=i=>({...i,access:zl(i),terms:i.terms??null,games:(i.games??[]).map(r),gamesTotal:i.gamesTotal??(i.games??[]).length,archivedTotal:i.archivedTotal??(i.games??[]).filter(s=>s.state==="archived").length}),a=i=>({...i,workspace:{...i.workspace,access:zl(i.workspace??{}),games:(i.workspace?.games??[]).map(r)}});return{getWorkspace:async()=>n(await t("GET","/v1/workspace")),getWorkspaceSummary:async()=>{try{return n(await t("GET","/v1/workspace/summary"))}catch(i){if(!(i instanceof dt)||i.status!==404)throw i;return oE||(oE=!0,console.warn("[control-plane] no /v1/workspace/summary, falling back to the full workspace read. If this persists the control plane is behind the site, and every Stage screen is carrying the whole workspace again.")),n(await t("GET","/v1/workspace"))}},linkGitHub:async i=>a(await t("PUT","/v1/workspace/github",{body:{login:i}})),acceptTerms:async i=>a(await t("PUT","/v1/workspace/terms",{body:{version:i}})),setPlan:async i=>a(await t("PUT","/v1/workspace/plan",{body:{tier:i}})),uploadTarget:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/uploads`,{body:{filename:s}}),setPresetArt:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/art/preset`,{body:{preset:s}}),artUploadTarget:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/art/uploads`,{body:{content_type:s}}),setUploadedArt:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/art`,{body:{url:s}}),referenceUploadTarget:(i,s)=>t("POST","/v1/reference/uploads",{body:{name:i,digest:s}}),pruneBundle:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/bundle`,{body:{filenames:s}}),async getGame(i){try{return r(await t("GET",`/v1/games/${encodeURIComponent(i)}`))}catch(s){if(s instanceof dt&&s.status===404)return;throw s}},setAwake:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/state`,{body:{awake:s}}),setDestination:(i,s,d)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/destinations`,{body:{destination_id:s,enabled:d}}),registerGame:i=>t("POST","/v1/games",{body:i}),archiveGame:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/archive`),addGraphic:()=>{throw new Error("A graphic is composed by the control plane, not recorded by a client. Use composeGraphic(gameId, { template, consent: true }).")},composeGraphic:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/graphics`,{body:s}),removeGraphic:(i,s)=>t("DELETE",`/v1/games/${encodeURIComponent(i)}/graphics/${encodeURIComponent(s)}`),promoteGame:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/promote`),withdrawGame:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/withdraw`),deleteGame:i=>t("DELETE",`/v1/games/${encodeURIComponent(i)}`),deploy:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/deploy`,{body:s}),refreshRound:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/round/refresh`),roundSeedCandidates:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/round/candidates`,{body:s}),async seedRound(i,s,d){try{return await t("PUT",`/v1/games/${encodeURIComponent(i)}/round`,{body:{round:s,...d}})}catch(l){throw l instanceof dt&&l.status===404&&!/no such game/i.test(l.message)?new dt(404,"not_supported","This control plane cannot take a round yet. It is running a build older than this CLI, so the round has to go in through Studio until it is updated.",!1):l}},setSignal:async i=>a(await t("PUT","/v1/workspace/signal",{body:{enabled:i}})),setWorkspaceProfile:i=>t("PUT","/v1/workspace/profile",{body:i}),async getEndpoints(i){try{return await t("GET",`/v1/games/${encodeURIComponent(i)}/endpoints`)}catch(s){if(s instanceof dt&&s.status===404)return;throw s}},async getLogs(i,s){let{lines:d}=await t("GET",`/v1/games/${encodeURIComponent(i)}/logs`,{query:s});return d},async getAuditLog(i){let{records:s}=await t("GET","/v1/audit",{query:i});return s},listSourceDatasets:i=>t("GET",`/v1/sources/${encodeURIComponent(i)}/datasets`),switchOnSource:(i,s)=>t("POST",`/v1/sources/${encodeURIComponent(i)}/datasets`,{body:s}),switchOffSource:(i,s)=>t("DELETE",`/v1/sources/${encodeURIComponent(i)}/datasets/${encodeURIComponent(s)}`),async listDatasets(){try{let i=await t("GET","/v1/reference/datasets");return!i||!Array.isArray(i.datasets)?{datasets:[],unavailable:aE}:{datasets:i.datasets,unavailable:i.unavailable??null}}catch(i){if(i instanceof dt&&i.status===404)return{datasets:[],unavailable:aE};throw i}},async getDataset(i){try{let s=await t("GET",`/v1/reference/datasets/${encodeURIComponent(i)}`);return s?.dataset?s:void 0}catch(s){if(s instanceof dt&&s.status===404)return;throw s}},async previewDataset(i,s,d){try{let l=await t("GET",`/v1/reference/preview/${encodeURIComponent(i)}`,{query:{limit:s,by:d}});return l&&Array.isArray(l.rows)?l:void 0}catch(l){if(l instanceof dt&&l.status===404)return;throw l}},async getDataLog(i){try{let s=await t("GET","/v1/reference/log",{query:i});return Array.isArray(s?.lines)?s.lines:[]}catch(s){if(s instanceof dt&&s.status===404)return[];throw s}}}}var dt,nE,oE,aE,cE=b(()=>{"use strict";Nl();dt=class extends Error{status;code;retryable;constructor(t,o,r,n){super(r),this.status=t,this.code=o,this.retryable=n,this.name="ControlPlaneError"}},nE=e=>new Promise(t=>setTimeout(t,e)),oE=!1;aE="This control plane is running a build older than this screen, so it cannot list datasets yet."});function TN(e){if(e.timerSeconds===void 0||!Number.isInteger(e.timerSeconds)||e.timerSeconds<=0||!e.startedAt)return;let t=Date.parse(e.startedAt);if(Number.isFinite(t))return t+e.timerSeconds*1e3}function lE(e,t){let o=TN(e);if(o===void 0)return!1;let r=typeof t=="number"?t:Date.parse(t);return Number.isFinite(r)?r>o:!1}var dE=b(()=>{"use strict"});var uE=b(()=>{"use strict";wt();Kt()});var mE=b(()=>{"use strict";On()});var ji,pE,it,hE,fE,Vr,gE,Li,Vl=b(()=>{"use strict";wt();ji=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.round(e):null,pE=e=>{let t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t*100):null},it=(e,t)=>({fields:[e],label:t,read:o=>ji(o[e])}),hE=270,fE=3,Vr=(e,t)=>({fields:[e,"minutes"],label:`${t} per 90 minutes, in hundredths (at least ${hE} minutes played)`,partial:!0,scale:100,read:o=>{let r=ji(o[e]),n=ji(o.minutes);return r===null||n===null||n<hE?null:Math.round(r*90*100/n)}}),gE=(e,t)=>({fields:[e,"starts"],label:`${t} per start, in hundredths (at least ${fE} starts)`,partial:!0,scale:100,read:o=>{let r=ji(o[e]),n=ji(o.starts);return r===null||n===null||n<fE?null:Math.round(r*100/n)}}),Li={player_price:{...it("now_cost","Price, in tenths of a million"),scale:10},season_points:it("total_points","Points this season"),points_per_game:{fields:["points_per_game"],label:"Points per game, in tenths",scale:10,read:e=>{let t=Number(e.points_per_game);return Number.isFinite(t)&&t>=0?Math.round(t*10):null}},minutes:it("minutes","Minutes played"),starts:it("starts","Starts"),goals:it("goals_scored","Goals"),assists:it("assists","Assists"),own_goals:it("own_goals","Own goals"),penalties_missed:it("penalties_missed","Penalties missed"),penalties_saved:it("penalties_saved","Penalties saved"),yellow_cards:it("yellow_cards","Yellow cards"),red_cards:it("red_cards","Red cards"),saves:it("saves","Saves"),bonus:it("bonus","Bonus points"),tackles:it("tackles","Tackles"),recoveries:it("recoveries","Ball recoveries"),clearances_blocks_interceptions:it("clearances_blocks_interceptions","Clearances, blocks and interceptions"),defensive_contributions:it("defensive_contribution","Defensive contribution points"),expected_goals:{fields:["expected_goals"],label:"Expected goals, in hundredths",scale:100,read:e=>pE(e.expected_goals)},expected_assists:{fields:["expected_assists"],label:"Expected assists, in hundredths",scale:100,read:e=>pE(e.expected_assists)},goals_per_90:Vr("goals_scored","Goals"),assists_per_90:Vr("assists","Assists"),yellow_cards_per_90:Vr("yellow_cards","Yellow cards"),tackles_per_90:Vr("tackles","Tackles"),recoveries_per_90:Vr("recoveries","Ball recoveries"),saves_per_90:Vr("saves","Saves"),bonus_per_start:gE("bonus","Bonus points"),defensive_contributions_per_start:gE("defensive_contribution","Defensive contribution points")}});var hb,yE,dH,fb=b(()=>{"use strict";wt();Vl();hb={clean_sheets:{label:"Clean sheets"},premier_league_appearances:{label:"Premier League appearances, career"},premier_league_goals:{label:"Premier League goals, career"},premier_league_titles:{label:"Premier League titles won"},first_premier_league_season:{label:"First Premier League season, as its start year"}},yE=[...new Set([...Object.keys(Li),...Object.keys(hb)])],dH=[...new Set(["goals","assists","clean_sheets","minutes","starts","yellow_cards","red_cards","penalties_saved","expected_goals","player_price","season_points",...Object.keys(hb)])].filter(e=>e in Li||e in hb)});function Di(e){return e.standing==="unofficial"?gb:void 0}function bE(e){return zn.find(t=>t.id===e)}var EN,$N,AN,gH,gb,zn,yb=b(()=>{"use strict";Vl();Wl();fb();Ye();EN=c.discriminatedUnion("kind",[c.object({kind:c.literal("everyone")}),c.object({kind:c.literal("domains"),domains:c.array(c.string().min(1)).min(1)}),c.object({kind:c.literal("named")})]),$N=c.enum(["licensed","unofficial","creator"]),AN=c.enum(["ours","creator"]),gH=c.object({id:c.string().min(1),label:c.string().min(1),standing:$N,origin:AN,tiers:c.array(c.enum(["runtime","live","enterprise"])).min(1),produces:c.array(c.string()),note:c.string().min(1),catalogue:c.object({offers:c.string().min(1),competitions:c.array(c.string()).default([]),cost:c.string().min(1),needsKey:c.boolean().default(!1),signUp:c.string().url().optional(),licence:c.string().min(1),fetched:c.boolean().optional()}).optional(),audience:EN.optional()}),gb="Requests to this source are made on behalf of you, the game builder. You are responsible for the data you consume, and for securing the legal rights and licence to use it. We recommend using it for testing only, and not launching with it unless you have explicit permission from the data owner.";zn=[{id:"nba",label:"NBA",standing:"licensed",origin:"ours",tiers:["runtime","live","enterprise"],audience:{kind:"domains",domains:["nba.com"]},produces:["career_points","career_rebounds","career_assists","career_games"],note:"The NBA's own data, licensed by the NBA for its own use only. Not available to anyone else. Career totals are the NBA's own figures, not a sum we computed. Not fetched yet.",catalogue:{offers:"NBA players' career totals: points, rebounds, assists, games.",competitions:["NBA"],cost:"For the NBA's own account only.",needsKey:!1,licence:"The NBA's, for the NBA's own use only. Nobody else may use it.",fetched:!1}},{id:"push",label:"Your own data",standing:"creator",origin:"creator",tiers:["runtime","live","enterprise"],produces:[],note:"A file you push with `gamestage reference push`, from your machine or your CI.",catalogue:{offers:"Any values you hold, in a JSON file you push: your squad, your archive, your own licensed feed.",competitions:[],cost:"Free on every plan.",needsKey:!1,licence:"Yours. Your data, or a feed you license: your terms.",fetched:!0}},{id:"fpl",label:"Fantasy Premier League",standing:"unofficial",origin:"ours",tiers:["runtime","live","enterprise"],produces:Object.keys(Li),note:"Free, with no contract behind it, so a prize game wants a licensed source. Prices move weekly and a round in play keeps the ones it opened with.",catalogue:{offers:"Premier League players: FPL price and points, goals, assists, own goals, penalties missed and saved, cards, saves, bonus, tackles, recoveries, defensive contributions, minutes, starts and expected goals and assists, plus per-90 and per-start ratios, with each player's name, club and position. Refreshed daily.",competitions:["Premier League"],cost:"Free on every plan. We fetch it; no key needed.",needsKey:!1,licence:"Unofficial: no contract and no support.",fetched:!0}},{id:"premier-league",label:"The Premier League",standing:"licensed",origin:"ours",tiers:["runtime","live","enterprise"],audience:{kind:"domains",domains:["monterosa.co.uk","premierleague.com"]},produces:yE,note:"The Premier League's own feeds, used with their permission, for Monterosa and the Premier League only. Every current player's season and career record with his photo. Refreshed nightly.",catalogue:{offers:"Every current Premier League player: this season's FPL numbers, career Premier League appearances, goals and titles, first season, previous clubs, nationality, height, preferred foot, set-piece duties and photo. Refreshed nightly.",competitions:["Premier League"],cost:"For Monterosa and the Premier League only.",needsKey:!1,licence:"The Premier League's permission, for their own games. Not ours to offer anyone else."}},{id:"sportmonks",label:"Sportmonks football",standing:"creator",origin:"ours",tiers:["runtime","live","enterprise"],produces:["goals","assists","appearances","minutes","yellow_cards","clean_sheets"],note:"Your own Sportmonks plan and key. We call it on a schedule with your key, and your plan decides which competitions you can use.",catalogue:{offers:"Football players' season statistics for any competition your plan covers: goals, assists, appearances, minutes, cards, clean sheets, with each player's name, team and position.",competitions:[],cost:"Your Sportmonks plan. A free plan covers a few smaller leagues; the Premier League needs a paid one.",needsKey:!0,signUp:"https://www.sportmonks.com/football-api/",licence:"Yours: your Sportmonks plan and its terms. Check they cover this use before a game with a prize."}},{id:"espn",label:"ESPN",standing:"unofficial",origin:"ours",tiers:["runtime","live","enterprise"],produces:[...new Set(Object.keys(Rn).flatMap(e=>ql(e).map(t=>t.key)))],note:"ESPN's openly reachable player statistics, with no contract behind it, so for development and not for a public launch. Refreshed twice a day.",catalogue:{offers:"Season statistics for every player in the NBA, WNBA, NFL, MLB and NHL: points, yards, goals, home runs and dozens more, with each player's name, team and position. Refreshed twice a day.",competitions:["NBA","WNBA","NFL","MLB","NHL"],cost:"Free on every plan. We fetch it; no key needed.",needsKey:!1,licence:"Unofficial: no contract and no support.",fetched:!0}}]});function IN(e,t){let o=e.trim().toLowerCase();return o?t.some(r=>{let n=r.trim().toLowerCase();return o===n||o.endsWith(`.${n}`)}):!1}function vE(e){let t=e.ownerEmail?.lastIndexOf("@")??-1,o=t>=0?e.ownerEmail.slice(t+1).trim().toLowerCase():void 0;return{id:e.id,domain:o||void 0,grants:e.supplierGrants}}function PN(e){return e.audience??CN}function ON(e,t,o=zn){let r=o.find(a=>a.id===t);if(!r)return{allowed:!1,reason:`There is no supplier called "${t}".`};if(e.grants?.includes(t))return{allowed:!0,because:"grant"};let n=PN(r);switch(n.kind){case"everyone":return{allowed:!0,because:"audience"};case"domains":return e.domain&&IN(e.domain,n.domains)?{allowed:!0,because:"audience"}:{allowed:!1,reason:`${r.label} is available to ${n.domains.join(" and ")}. Ask us if you need it.`};case"named":return{allowed:!1,reason:`${r.label} is granted per account. Ask us if you need it.`}}}function wE(e,t=zn){return t.map(o=>({supplier:o,entitlement:ON(e,o.id,t)}))}var CN,kE=b(()=>{"use strict";yb();CN={kind:"everyone"}});var kH,_E=b(()=>{"use strict";Ye();kH=c.object({org:c.string().min(1),game:c.string().min(1),player:c.string().min(1),alias:c.string().optional(),round:c.string().optional(),score:c.number(),outcome:c.string().optional(),at:c.string().min(1)})});var xE=b(()=>{"use strict";wt()});var SE=b(()=>{"use strict";wt()});function bb(e){let t;try{t=JSON.parse(e)}catch(r){return{ok:!1,reason:"That is not JSON.",detail:r instanceof Error?r.message:void 0}}let o=zt.safeParse(t);if(!o.success){let r=o.error.issues[0];return{ok:!1,reason:"That is not valid reference data.",detail:r?`${r.path.join(".")||"document"}: ${r.message}`:void 0}}return{ok:!0,summary:{digest:jl(e),measures:o.data.measures.map(r=>r.key),counts:Object.fromEntries(o.data.measures.map(r=>[r.key,Object.keys(r.values).length])),scored:o.data.measures.filter(r=>r.scoring).map(r=>r.key)}}}async function TE(e,t){let o=bb(e);return o.ok&&(await t("copy",e),await t("pointer",e)),o}function EE(e,t){return e?e.filter(o=>!t.scored.includes(o)):[]}var $E=b(()=>{"use strict";wt()});var AE=b(()=>{"use strict"});var CE=b(()=>{"use strict"});var RN,zN,NN,PH,IE=b(()=>{"use strict";RN="Monterosa",zN="04716325",NN="3B, The Plaza, floor 3, 100 Old Hall Street, Liverpool, L3 9QJ, United Kingdom",PH=`${RN}, ${NN}. Company number ${zN}.`});function Zl(e){let t=[],o=/\[([^\]]*)\]/g,r=0;for(let n of e.matchAll(o))n.index>r&&t.push({text:e.slice(r,n.index),accent:!1}),n[1]&&t.push({text:n[1],accent:!0}),r=n.index+n[0].length;return r<e.length&&t.push({text:e.slice(r),accent:!1}),t.filter(n=>n.text.length>0)}function vb(e){return Zl(e).map(t=>t.text).join("")}var wb=b(()=>{"use strict"});function ho(e){return e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function UN(e){let t=e.length===4?`#${[...e.slice(1)].map(a=>a+a).join("")}`:e,[o,r,n]=[1,3,5].map(a=>{let i=parseInt(t.slice(a,a+2),16)/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4});return .2126*o+.7152*r+.0722*n>.4}function Jl(e,t){return e&&FN.test(e.trim())?e.trim():t}function kb(e){return Zl(e).map(t=>t.accent?`<span class="gs-boot__accent">${ho(t.text)}</span>`:ho(t.text)).join("")}function PE(e){let t=Jl(e.gradientStart,"#101820"),o=Jl(e.gradientEnd,t),r=UN(t),n=Jl(e.titleColour,r?"#101820":"#ffffff"),a=Jl(e.logoAccentColour,n),i=Gl(e.titleFont,e.titleFontWeight),s=Number(e.titleLetterSpacing),d=e.titleLetterSpacing!==void 0&&e.titleLetterSpacing!==""&&Number.isFinite(s)?`${Math.min(.4,Math.max(-.1,s))}em`:"normal",l=["upper","uppercase","capitals","caps"].includes((e.titleCase??"").trim().toLowerCase()),u=e.logoText?.trim()||e.name;return{start:t,end:o,light:r,ink:n,accent:a,font:i,tracking:d,upper:l,logo:u,words:{play:e.playLabel?.trim()||Nn.play,continue:e.continueLabel?.trim()||Nn.continue,error:e.errorText?.trim()||Nn.error,retry:e.retryLabel?.trim()||Nn.retry}}}function GN(e){let t=Math.max(1,[...vb(e)].length);return`min(clamp(56px, 19vw, 132px), calc((100vw - 48px) / ${Math.round(t*.86*100)/100}))`}function BN(e){let t=PE(e),o=t.light?"rgba(16,24,32,.16)":"rgba(255,255,255,.2)",r=t.light?"rgba(16,24,32,.78)":"rgba(255,255,255,.9)",n=t.font&&e.logoFontData&&/^[A-Za-z0-9+/=]+$/.test(e.logoFontData)?e.logoFontData:void 0,a=t.font&&!n?Ni(t.font.family):void 0,i=t.font?`"${t.font.family}", system-ui, sans-serif`:"system-ui, sans-serif",s={font:t.font?{family:t.font.family,weight:t.font.weight}:null,minMs:LN,fontTimeoutMs:DN,maxMs:MN,words:t.words,mark:Cn};return`<meta name="color-scheme" content="${t.light?"light":"dark"}" ${kt} />
109
109
  <meta name="theme-color" content="${t.start}" ${kt} />
110
110
  `+(a?`<link rel="preconnect" href="${Qy}" crossorigin ${kt} />
111
111
  <link rel="stylesheet" href="${a}" media="print" onload="this.media='all'" id="gs-boot-font" ${kt} />
@@ -7894,7 +7894,7 @@ function createConsentState(options) {
7894
7894
  };
7895
7895
  const readStored = () => {
7896
7896
  try {
7897
- const raw = storage2()?.getItem(storageKey(options.game));
7897
+ const raw = storage2()?.getItem(storageKey(options.scope?.trim() || options.game));
7898
7898
  if (!raw) return null;
7899
7899
  const record = parseConsentRecord(JSON.parse(raw));
7900
7900
  if (!record || record.source !== "fan" || record.policyVersion !== policyVersion) return null;
@@ -7958,7 +7958,7 @@ function createConsentState(options) {
7958
7958
  const record = consentRecord(categories, "fan", { policyVersion, at: now3() });
7959
7959
  stored = record;
7960
7960
  try {
7961
- storage2()?.setItem(storageKey(options.game), JSON.stringify(record));
7961
+ storage2()?.setItem(storageKey(options.scope?.trim() || options.game), JSON.stringify(record));
7962
7962
  } catch {
7963
7963
  }
7964
7964
  try {
@@ -9582,6 +9582,7 @@ async function start(options = {}) {
9582
9582
  platform,
9583
9583
  policy,
9584
9584
  game,
9585
+ scope: options.consentScope,
9585
9586
  policyVersion: platform.presentation?.consentPolicyVersion
9586
9587
  });
9587
9588
  settingsConsentReading = consentReading;
@@ -9871,7 +9872,7 @@ export {
9871
9872
  titleTreatment,
9872
9873
  tokenOf
9873
9874
  };
9874
- `,cn="e0db7da5971d19d4",Ke="gamestage.js",XE="0.66.26",VN=`<!doctype html>
9875
+ `,cn="26ec75ab5adad009",Ke="gamestage.js",XE="0.66.27",VN=`<!doctype html>
9875
9876
  <html lang="en">
9876
9877
  <head>
9877
9878
  <meta charset="utf-8" />
@@ -14251,7 +14252,7 @@ Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[t]?this._life
14251
14252
  `),this.outputHelp({error:!0}));let r=o||{},n=r.exitCode||1,a=r.code||"commander.error";this._exit(n,a,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in Ee.env){let o=t.attributeName();(this.getOptionValue(o)===void 0||["default","config","env"].includes(this.getOptionValueSource(o)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,Ee.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Es(this.options),o=r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter(r=>r.implied!==void 0&&o(r.attributeName())&&t.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(n=>!o(n)).forEach(n=>{this.setOptionValueWithSource(n,r.implied[n],"implied")})})}missingArgument(t){let o=`error: missing required argument '${t}'`;this.error(o,{code:"commander.missingArgument"})}optionMissingArgument(t){let o=`error: option '${t.flags}' argument missing`;this.error(o,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let o=`error: required option '${t.flags}' not specified`;this.error(o,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,o){let r=i=>{let s=i.attributeName(),d=this.getOptionValue(s),l=this.options.find(p=>p.negate&&s===p.attributeName()),u=this.options.find(p=>!p.negate&&s===p.attributeName());return l&&(l.presetArg===void 0&&d===!1||l.presetArg!==void 0&&d===l.presetArg)?l:u||i},n=i=>{let s=r(i),d=s.attributeName();return this.getOptionValueSource(d)==="env"?`environment variable '${s.envVar}'`:`option '${s.flags}'`},a=`error: ${n(t)} cannot be used with ${n(o)}`;this.error(a,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let o="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],a=this;do{let i=a.createHelp().visibleOptions(a).filter(s=>s.long).map(s=>s.long);n=n.concat(i),a=a.parent}while(a&&!a._enablePositionalOptions);o=xu(t,n)}let r=`error: unknown option '${t}'${o}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let o=this.registeredArguments.length,r=o===1?"":"s",n=t.length,a=this.parent?` for '${this.name()}'`:"",i=t.join(", "),s=`error: too many arguments${a}. Expected ${o} argument${r} but got ${n}: ${i}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],o="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(a=>{n.push(a.name()),a.alias()&&n.push(a.alias())}),o=xu(t,n)}let r=`error: unknown command '${t}'${o}`;this.error(r,{code:"commander.unknownCommand"})}version(t,o,r){if(t===void 0)return this._version;this._version=t,o=o||"-V, --version",r=r||"output the version number";let n=this.createOption(o,r);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${t}
14252
14253
  `),this._exit(0,"commander.version",t)}),this}description(t,o){return t===void 0&&o===void 0?this._description:(this._description=t,o&&(this._argsDescription=o),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let o=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(o=this.commands[this.commands.length-1]),t===o._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(t);if(r){let n=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return o._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(o=>this.alias(o)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let o=this.registeredArguments.map(r=>Ts(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?o:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=Sn.basename(t,Sn.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let o=this.createHelp(),r=this._getOutputContext(t);o.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});let n=o.formatHelp(this,o);return r.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(t){t=t||{};let o=!!t.error,r,n,a;return o?(r=s=>this._outputConfiguration.writeErr(s),n=this._outputConfiguration.getErrHasColors(),a=this._outputConfiguration.getErrHelpWidth()):(r=s=>this._outputConfiguration.writeOut(s),n=this._outputConfiguration.getOutHasColors(),a=this._outputConfiguration.getOutHelpWidth()),{error:o,write:s=>(n||(s=this._outputConfiguration.stripColor(s)),r(s)),hasColors:n,helpWidth:a}}outputHelp(t){let o;typeof t=="function"&&(o=t,t=void 0);let r=this._getOutputContext(t),n={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach(i=>i.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let a=this.helpInformation({error:r.error});if(o&&(a=o(a),typeof a!="string"&&!Buffer.isBuffer(a)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(a),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(i=>i.emit("afterAllHelp",n))}helpOption(t,o){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",o??"display help for command"),(t||o)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let o=Number(Ee.exitCode??0);o===0&&t&&typeof t!="function"&&t.error&&(o=1),this._exit(o,"commander.help","(outputHelp)")}addHelpText(t,o){let r=["beforeAll","before","after","afterAll"];if(!r.includes(t))throw new Error(`Unexpected value for position to addHelpText.
14253
14254
  Expecting one of '${r.join("', '")}'`);let n=`${t}Help`;return this.on(n,a=>{let i;typeof o=="function"?i=o({error:a.error,command:a.command}):i=o,i&&a.write(`${i}
14254
- `)}),this}_outputHelpIfRequested(t){let o=this._getHelpOption();o&&t.find(n=>o.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Uw(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let o,r="127.0.0.1",n="9229",a;return(a=t.match(/^(--inspect(-brk)?)$/))!==null?o=a[1]:(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(o=a[1],/^\d+$/.test(a[3])?n=a[3]:r=a[3]):(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(o=a[1],r=a[3],n=a[4]),o&&n!=="0"?`${o}=${r}:${parseInt(n)+1}`:t})}function Gw(){if(Ee.env.NO_COLOR||Ee.env.FORCE_COLOR==="0"||Ee.env.FORCE_COLOR==="false")return!1;if(Ee.env.FORCE_COLOR||Ee.env.CLICOLOR_FORCE!==void 0)return!0}var XU=new lr;we();ln();Ae();import{mkdir as rj,readFile as aj,writeFile as ij}from"node:fs/promises";import{dirname as sj,join as cj,relative as lj,resolve as dj}from"node:path";async function uj(e,t){let o;try{o=await aj(e,"utf8")}catch{return"absent"}return o===t?"same":"different"}async function e$(e,t,o){let r=cj(e,t),n=await uj(r,o);try{await rj(sj(r),{recursive:!0}),await ij(r,o,"utf8")}catch{throw R(`Cannot write ${r}.`),new Error("unreachable")}return{where:lj(process.cwd(),r)||t,state:n}}async function t$(e){let t=dj(e.out??"."),o=await e$(t,Ke,Yt),r=await e$(t,st,Jr),n=`import { start } from "./${Ke}";`,a=`import { createPlayerClient, newIdempotencyKey } from "./${st}";`,i=o.state==="same"&&r.state==="same";if(U())return X({ok:!0,status:i?"unchanged":"written",files:[{path:o.where,digest:cn,import:n},{path:r.where,digest:Jo,import:a}],path:o.where,digest:cn,import:n});L(i?"Already current":"Wrote the Gamestage client"),O("Library",`${o.where} (${cn})`),O("Player client",`${r.where} (${Jo})`),g(),k(`Import it: ${w.cyan(n)}`),k(`The player API on its own: ${w.cyan(a)}`),(o.state==="different"||r.state==="different")&&k("An earlier copy was replaced. It is generated, so nothing of yours was in it."),g()}Zt();To();we();ln();vo();import{mkdir as rC,readdir as iC,stat as $6,writeFile as aC}from"node:fs/promises";import{join as A6}from"node:path";import{createInterface as C6}from"node:readline/promises";import{createHash as I6}from"node:crypto";var xt="0.35.36",ys="2026-09-29-6",eu=">=22.13.0";function b6(e=eu){let[t,o]=e.replace(/^[^\d]*/,"").split(".").map(Number);return[t,o||0]}function X2(e,t=eu){let[o,r]=b6(t),[n,a]=e.split(".").map(Number);return n>o||n===o&&a>=r}import{randomUUID as v6}from"node:crypto";var w6=/-[0-9a-f]{4}$/;function tu(e){return`${e}-${v6().replace(/-/g,"").slice(0,4)}`}function Q2(e){return w6.test(e)}mt();var Un="favicon.svg",bs=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
14255
+ `)}),this}_outputHelpIfRequested(t){let o=this._getHelpOption();o&&t.find(n=>o.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Uw(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let o,r="127.0.0.1",n="9229",a;return(a=t.match(/^(--inspect(-brk)?)$/))!==null?o=a[1]:(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(o=a[1],/^\d+$/.test(a[3])?n=a[3]:r=a[3]):(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(o=a[1],r=a[3],n=a[4]),o&&n!=="0"?`${o}=${r}:${parseInt(n)+1}`:t})}function Gw(){if(Ee.env.NO_COLOR||Ee.env.FORCE_COLOR==="0"||Ee.env.FORCE_COLOR==="false")return!1;if(Ee.env.FORCE_COLOR||Ee.env.CLICOLOR_FORCE!==void 0)return!0}var XU=new lr;we();ln();Ae();import{mkdir as rj,readFile as aj,writeFile as ij}from"node:fs/promises";import{dirname as sj,join as cj,relative as lj,resolve as dj}from"node:path";async function uj(e,t){let o;try{o=await aj(e,"utf8")}catch{return"absent"}return o===t?"same":"different"}async function e$(e,t,o){let r=cj(e,t),n=await uj(r,o);try{await rj(sj(r),{recursive:!0}),await ij(r,o,"utf8")}catch{throw R(`Cannot write ${r}.`),new Error("unreachable")}return{where:lj(process.cwd(),r)||t,state:n}}async function t$(e){let t=dj(e.out??"."),o=await e$(t,Ke,Yt),r=await e$(t,st,Jr),n=`import { start } from "./${Ke}";`,a=`import { createPlayerClient, newIdempotencyKey } from "./${st}";`,i=o.state==="same"&&r.state==="same";if(U())return X({ok:!0,status:i?"unchanged":"written",files:[{path:o.where,digest:cn,import:n},{path:r.where,digest:Jo,import:a}],path:o.where,digest:cn,import:n});L(i?"Already current":"Wrote the Gamestage client"),O("Library",`${o.where} (${cn})`),O("Player client",`${r.where} (${Jo})`),g(),k(`Import it: ${w.cyan(n)}`),k(`The player API on its own: ${w.cyan(a)}`),(o.state==="different"||r.state==="different")&&k("An earlier copy was replaced. It is generated, so nothing of yours was in it."),g()}Zt();To();we();ln();vo();import{mkdir as rC,readdir as iC,stat as $6,writeFile as aC}from"node:fs/promises";import{join as A6}from"node:path";import{createInterface as C6}from"node:readline/promises";import{createHash as I6}from"node:crypto";var xt="0.35.37",ys="2026-09-29-6",eu=">=22.13.0";function b6(e=eu){let[t,o]=e.replace(/^[^\d]*/,"").split(".").map(Number);return[t,o||0]}function X2(e,t=eu){let[o,r]=b6(t),[n,a]=e.split(".").map(Number);return n>o||n===o&&a>=r}import{randomUUID as v6}from"node:crypto";var w6=/-[0-9a-f]{4}$/;function tu(e){return`${e}-${v6().replace(/-/g,"").slice(0,4)}`}function Q2(e){return w6.test(e)}mt();var Un="favicon.svg",bs=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
14255
14256
  <rect width="32" height="32" rx="7" fill="#1b1c1f"/>
14256
14257
  <path d="m12 8 12 8-12 8Z" fill="#fff"/>
14257
14258
  </svg>
@@ -14311,7 +14312,7 @@ const logo=document.getElementById("logo");
14311
14312
  let size=160;
14312
14313
  while(logo.scrollWidth>600&&size>40){size-=4;logo.style.fontSize=size+"px";}
14313
14314
  document.fonts.ready.then(()=>{while(logo.scrollWidth>600&&size>40){size-=4;logo.style.fontSize=size+"px";}document.body.dataset.ready="1";});
14314
- </script></body></html>`}async function lC(e,t,o=()=>hn()){let r;try{r=await o()}catch(a){return{png:null,reason:a instanceof Error?a.message:String(a)}}if(r.status!=="available")return{png:null,reason:r.detail};let n=r.browser;try{return await n.navigate(`data:text/html;base64,${Buffer.from(D6(e,t)).toString("base64")}`),await n.waitForSelector("body[data-ready]",1e4).catch(()=>{}),{png:await n.screenshot(1200,630)}}catch(a){return{png:null,reason:a instanceof Error?a.message:String(a)}}finally{await n.close()}}ew();Jd();Zt();qd();Ae();nr();function ks(e,t){if(!e.refused)return!1;if(U())return X({ok:!0,status:"refused",action:t,code:e.code,reason:e.refused,...e.candidateSpaces?{candidateSpaces:e.candidateSpaces}:{},game:e.game}),!0;if(L("Not done"),g(` ${e.refused}`),e.candidateSpaces&&e.candidateSpaces.length>0){g(),g(" Spaces you can deploy into:");for(let o of e.candidateSpaces)g(` --space ${o.spaceId} (${o.org})`)}return g(),!0}function Tw(e,t){if(e.state==="archived")return{stage:"dev",reason:"archived, so it serves nobody"};if(!t)return{stage:null,reason:"this control plane did not report your workspace's plan"};let o=My(e,{tier:t});if(o==="prod")return{stage:o};let r=!!e.prodApproval,n=!Dy(t);return!r&&!n?{stage:o,reason:"waiting on your approval, run `gamestage promote`, and on your workspace's plan, which only Monterosa can move"}:r?{stage:o,reason:"approved, but your workspace's plan does not carry prod yet, which only Monterosa can move"}:{stage:o,reason:"waiting on your approval, run `gamestage promote`"}}function hC(e,t=e.playgroundUrl,o,r){if(O("Game",`${e.name} (${e.id})`),O("State",r?`${e.state}, ${r}`:e.state),o!==void 0){let{stage:n,reason:a}=Tw(e,o);O("Serving",n==="prod"?"prod":`dev: ${a}`)}O("Build stage",e.conformance),O("Revision",`${e.manifestRevision} (${e.contentHash})`),t&&O("Playground",t),e.playerEndpoint&&O("Player API",e.playerEndpoint),O("Manage",pa(e.id)),e.studioUrl&&O("Studio",e.studioUrl),O("Docs",d2(e.archetype))}async function fC(e){let{client:t,email:o}=await _e(),r=await Ud(t),n=ss(r);if(n.ok||R(n.message,n.next),n.access==="pending"||n.access==="refused"){if(U())return X({ok:!0,status:n.status,access:n.access,...n.code?{code:n.code}:{},message:n.message,next:n.next,email:o});L("Your account"),O("Signed in as",o),O("Access",n.access),ya(n);return}try{if(e){let l=await t.getGame(e);l||R(...EC(e));let u=await t.getWorkspaceSummary().then(y=>y.tier).catch(()=>{}),{stage:p,reason:h}=Tw(l,u);if(U())return X({ok:!0,stage:p,...h?{stageReason:h}:{},roundLine:su(l)[0],game:l});L(l.name),hC(l,void 0,u),u===void 0&&O("Serving",`unchecked: ${h}`),g();for(let y of su(l))g(y);if(l.meters.length){g();for(let y of l.meters){let v=Math.round(RT(y)*100);O(y.label,`${y.used} of ${y.limit}${y.unit} (${v}%)`)}}g();return}let a="workspace"in r&&r.workspace?r.workspace:await t.getWorkspace(),i=a.games.length,s=typeof a.gamesTotal=="number"?a.gamesTotal:void 0;if(U())return X({ok:!0,status:n.status,access:n.access,games_total:s??null,games_shown:i,workspace:{...a,games:a.games.map(l=>{let{stage:u,reason:p}=Tw(l,a.tier);return{...l,stage:u,...p?{stageReason:p}:{}}})}});if(L(a.name),O("Signed in as",o),O("Access",n.access??"not reported by this control plane"),O("Tier",a.tier),O("Games",s===void 0?`${i} listed, and this control plane does not report a total`:`${s} ${s===1?"game":"games"}`),g(),s===0){k("No games yet. `gamestage create` or `gamestage inspect .` starts one."),g();return}for(let l of a.games)O(l.name,`${l.state}${l.playgroundUrl?"":" (never deployed)"}`);s!==void 0&&i<s&&(g(),k(`Showing ${i} of ${s} games.`));let d=OT(a.meters);if(d.length){g(),L("At a cap");for(let l of d)k(`${l.label}: ${l.used} of ${l.limit}${l.unit}`)}g()}catch(a){Ne(a)}}async function U6(e,t){let o;try{o=await yn(e,"utf8")}catch{t&&R(`Cannot read ${e}.`);return}let r=Ve(o);if(!r.ok){R(Vt(e,r.issues),r.issues.map(a=>`${a.path} ${a.message}`));return}let n=await Xo(e);return{...n.ok?{round:n.round}:{},...r.ok&&r.manifest.backend.archetype?{archetype:r.manifest.backend.archetype}:{}}}var iu="Replace this in Studio";function G6(e){return e==="predict"?{studioSeed:Ge.parse({archetype:e,number:1,prompt:`${iu}: the question`,options:[1,2].map(t=>({key:`option-${t}`,label:`${iu}: option ${t}`})),open:!1})}:e==="bingo"?{studioSeed:Ge.parse({archetype:e,number:1,prompt:iu,rows:3,columns:3,centreMode:"free",lineTypes:["row","column","diagonal"],cardPool:Array.from({length:9},(t,o)=>({key:`card-${o+1}`,label:`${iu}: card ${o+1}`})),open:!1})}:{}}function su(e){let t=e.studioUrl??pa(e.id),o=e.rounds??[],r=o.find(n=>n.state==="open")??o[o.length-1];return r?[`Round: Studio, edition ${r.label}`,` ${t}`]:["No round yet: add one in Studio",` ${t}`]}async function B6(e){try{let t=await wa(Zd(e));return Fl(t.map(o=>o.text).join(`
14315
+ </script></body></html>`}async function lC(e,t,o=()=>hn()){let r;try{r=await o()}catch(a){return{png:null,reason:a instanceof Error?a.message:String(a)}}if(r.status!=="available")return{png:null,reason:r.detail};let n=r.browser;try{return await n.navigate(`data:text/html;base64,${Buffer.from(D6(e,t)).toString("base64")}`),await n.waitForSelector("body[data-ready]",1e4).catch(()=>{}),{png:await n.screenshot(1200,630)}}catch(a){return{png:null,reason:a instanceof Error?a.message:String(a)}}finally{await n.close()}}ew();Jd();Zt();qd();Ae();nr();function ks(e,t){if(!e.refused)return!1;if(U())return X({ok:!0,status:"refused",action:t,code:e.code,reason:e.refused,...e.candidateSpaces?{candidateSpaces:e.candidateSpaces}:{},game:e.game}),!0;if(L("Not done"),g(` ${e.refused}`),e.candidateSpaces&&e.candidateSpaces.length>0){g(),g(" Spaces you can deploy into:");for(let o of e.candidateSpaces)g(` --space ${o.spaceId} (${o.org})`)}return g(),!0}function Tw(e,t){if(e.state==="archived")return{stage:"dev",reason:"archived, so it serves nobody"};if(!t)return{stage:null,reason:"this control plane did not report your workspace's plan"};let o=My(e,{tier:t});if(o==="prod")return{stage:o};let r=!!e.prodApproval,n=!Dy(t);return!r&&!n?{stage:o,reason:"waiting on your approval, run `gamestage promote`, and on your workspace's plan, which only Monterosa can move"}:r?{stage:o,reason:"approved, but your workspace's plan does not carry prod yet, which only Monterosa can move"}:{stage:o,reason:"waiting on your approval, run `gamestage promote`"}}function hC(e,t=e.playgroundUrl,o,r){if(O("Game",`${e.name} (${e.id})`),O("State",r?`${e.state}, ${r}`:e.state),o!==void 0){let{stage:n,reason:a}=Tw(e,o);O("Serving",n==="prod"?"prod":`dev: ${a}`)}O("Build stage",e.conformance),O("Revision",`${e.manifestRevision} (${e.contentHash})`),t&&O("Playground",t),e.playerEndpoint&&O("Player API",e.playerEndpoint),O("Manage",pa(e.id)),e.studioUrl&&O("Studio",e.studioUrl),O("Docs",d2(e.archetype))}async function fC(e){let{client:t,email:o}=await _e(),r=await Ud(t),n=ss(r);if(n.ok||R(n.message,n.next),n.access==="pending"||n.access==="refused"){if(U())return X({ok:!0,status:n.status,access:n.access,...n.code?{code:n.code}:{},message:n.message,next:n.next,email:o});L("Your account"),O("Signed in as",o),O("Access",n.access),ya(n);return}try{if(e){let l=await t.getGame(e);l||R(...EC(e));let u=await t.getWorkspaceSummary().then(y=>y.tier).catch(()=>{}),{stage:p,reason:h}=Tw(l,u);if(U())return X({ok:!0,stage:p,...h?{stageReason:h}:{},roundLine:su(l)[0],game:l});L(l.name),hC(l,void 0,u),u===void 0&&O("Serving",`unchecked: ${h}`),g();for(let y of su(l))g(y);if(l.meters.length){g();for(let y of l.meters){let v=Math.round(RT(y)*100);O(y.label,`${y.used} of ${y.limit}${y.unit} (${v}%)`)}}g();return}let a="workspace"in r&&r.workspace?r.workspace:await t.getWorkspace(),i=a.games.length,s=typeof a.gamesTotal=="number"?a.gamesTotal:void 0;if(U())return X({ok:!0,status:n.status,access:n.access,games_total:s??null,games_shown:i,workspace:{...a,games:a.games.map(l=>{let{stage:u,reason:p}=Tw(l,a.tier);return{...l,stage:u,...p?{stageReason:p}:{}}})}});if(L(a.name),O("Signed in as",o),O("Access",n.access??"not reported by this control plane"),O("Tier",a.tier),O("Games",s===void 0?`${i} listed, and this control plane does not report a total`:`${s} ${s===1?"game":"games"}`),g(),s===0){k("No games yet. `gamestage create` or `gamestage inspect .` starts one."),g();return}for(let l of a.games)O(l.name,`${l.state}${l.playgroundUrl?"":" (never deployed)"}`);s!==void 0&&i<s&&(g(),k(`Showing ${i} of ${s} games.`));let d=OT(a.meters);if(d.length){g(),L("At a cap");for(let l of d)k(`${l.label}: ${l.used} of ${l.limit}${l.unit}`)}g()}catch(a){Ne(a)}}async function U6(e,t){let o;try{o=await yn(e,"utf8")}catch{t&&R(`Cannot read ${e}.`);return}let r=Ve(o);if(!r.ok){R(Vt(e,r.issues),r.issues.map(a=>`${a.path} ${a.message}`));return}let n=await Xo(e);return{...n.ok?{round:n.round}:{},...r.ok&&r.manifest.backend.archetype?{archetype:r.manifest.backend.archetype}:{}}}var iu="Replace this in Studio";function G6(e){return e==="predict"?{studioSeed:Ge.parse({archetype:e,number:1,prompt:`${iu}: the question`,options:[1,2].map(t=>({key:`option-${t}`,label:`${iu}: option ${t}`})),open:!1})}:e==="bingo"?{studioSeed:Ge.parse({archetype:e,number:1,prompt:iu,rows:3,columns:3,centreMode:"free",lineTypes:["row","column","diagonal"],cardPool:Array.from({length:9},(t,o)=>({key:`card-${o+1}`,label:`${iu}: card ${o+1}`})),open:!1})}:{}}function su(e){let t=e.studioUrl??pa(e.id),o=e.rounds??[],r=o.find(a=>a.state==="open")??o[o.length-1];if(!r)return["No round yet: add one in Studio",` ${t}`];let n=typeof r.edition=="string"&&r.edition.trim()?r.edition.trim():void 0;return n?[`Round: Studio, edition ${n}`,` ${t}`]:[`Round: Studio, round "${r.label}"`,` ${t}`]}async function B6(e){try{let t=await wa(Zd(e));return Fl(t.map(o=>o.text).join(`
14315
14316
  `))}catch{return}}async function uC(e){try{let t=Ve(await yn(e,"utf8"));return t.ok?t.manifest.app.title:void 0}catch{return}}async function q6(e){let t=Gl(e.titleFont,e.titleFontWeight);if(!t)return;let o=[...new Set([..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 $&!?.,'-:+#@",...e.logoText??"",...e.name??""])].filter(a=>a!=="["&&a!=="]").join(""),r=`https://fonts.googleapis.com/css2?family=${t.family.replace(/ /g,"+")}:wght@${t.weight}&text=${encodeURIComponent(o)}`,n="Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36";try{let a=await fetch(r,{headers:{"user-agent":n},signal:AbortSignal.timeout(8e3)});if(!a.ok)return;let i=/url\((https:[^)]+)\)\s*format\(['"]woff2['"]\)/.exec(await a.text())?.[1];if(!i)return;let s=await fetch(i,{signal:AbortSignal.timeout(8e3)});if(!s.ok)return;let d=Buffer.from(await s.arrayBuffer());return d.length>0&&d.length<6e4?d.toString("base64"):void 0}catch{return}}function gC(e,t){return!t||!e.includes(kt)?e:Zr(e,t)}async function W6(e){try{let t=await yn(e,"utf8");return`c${pC("sha256").update(t).digest("hex").slice(0,8)}`}catch{return"local"}}async function H6(e){try{return await yn(e,"utf8")}catch{return}}async function K6(e){try{let t=Ve(await yn(e,"utf8"));return t.ok?Ct(t.manifest).computed:"L0"}catch{return"L0"}}function Y6(e){if(e.manifest)return e.manifest;let t=e.dir??(e.file?xw(e.file):void 0);return t&&(dC(ww(t,"gamestage.yaml"))||dC(ww(t,Ln)))?ww(t,"gamestage.yaml"):"gamestage.yaml"}async function V6(e){try{let t=Ve(await yn(e,"utf8"));if(!t.ok)return;let o=t.manifest.identity.jwt;return o?{issuer:o.issuer,jwks_uri:o.jwks_uri,...o.audience?{audience:o.audience}:{}}:void 0}catch{return}}async function yC(e,t){t.file&&t.dir&&R("Choose either --file or --dir for a deploy, not both.");let{client:o}=await _e(),r=Y6(t),n=await U6(r,!!t.manifest),a=n?.round,i=await dn(r);if(i.problems.length>0&&R(`${Ln} cannot be used as it is.`,i.problems),t.file||t.dir){let l=Sw(t.dir??xw(t.file)),u=nd(i.settings,await wa(Zd(l)));u.length>0&&R("This game's page keeps its own copy of settings that live in Studio.",[od(u)])}if((t.file||t.dir)&&await a4(i.settings,r),t.file||t.dir){let l=Sw(t.dir??xw(t.file)),u=Hd(await wa(Zd(l)));u.length>0&&R("This game loads a font from a third party.",[Kd(u)])}let s=Mi(i.settings??{},await uC(r)??e);s.logoFontData=await q6(s);let d={settings:i.settings??{},fallbackTitle:await uC(r)??e};try{let l,u=_=>r4(e,_,r,t.check!==!1),p={...a?{round:a}:{},...t.allow?.length?{allow:t.allow}:{}};t.file?l=await J6(o,e,t.file,p,s,u,d):t.dir&&(l=await o4(o,e,t.dir,p,s,u,d));let h=t.revision??await W6(r),y=await o.deploy(e,{manifestRevision:h,contentHash:t.hash??`sha256:${h}`,conformance:t.level??await K6(r),...await H6(r).then(_=>_===void 0?{}:{manifestSource:_}),...i.settings?{settings:i.settings}:{},offersPrize:!!t.prize,...G6(n?.archetype),...await V6(r).then(_=>_===void 0?{}:{identity:_}),...t.notes?.trim()?{notes:t.notes.trim()}:{},...t.space?.trim()?{studioSpace:t.space.trim()}:{},...t.spaceOrg?.trim()?{studioSpaceOrg:t.spaceOrg.trim()}:{},...t.dir?{wording:await B6(t.dir)}:{}});if(ks(y,"deploy"))return;let v=null,I=await cs(o,y.game);if(U())return X({ok:!0,status:"deployed",...I?{sourceWarning:I}:{},roundProvisioned:v,roundSource:(y.game.rounds?.length??0)>0?"studio":"none",roundLine:su(y.game)[0],game:l?{...y.game,playgroundUrl:l}:y.game});let j=Vn(y.game.containerLabel),re=Vn(y.game.containerLabel,{lower:!0}),ee=v===null&&(y.game.rounds?.length??0)===0;L("Deployed"),hC(y.game,l,void 0,ee?`with no ${re} yet`:void 0),g(),ls(I),y.game.appSpec?.refusal&&(L("But Studio would not take the game's settings"),g(` ${y.game.appSpec.refusal.reason}`),g(),k("The game is live and playing. What is stale is what a producer sees in Studio, so they may be editing boxes that no longer match the game."),k("Deploy again once it is fixed; nothing else needs doing."),g());let G=Q6(y.game.logs);if(G&&(L("Studio did not take the game"),g(` ${G}`),g(),k("The game's files are online, but it has no Studio project, so there is nowhere to write a round yet."),k(`Deploy again once it is fixed. \`${oe(`logs ${e}`)}\` shows it again.`),g(),process.exitCode=1,ee))return;if(ee){for(let _ of e4(y.game,re,j))g(_);g();return}await X6(l??y.game.playgroundUrl,y.game.playerEndpoint,e,t.check===!1,y.game.archetype);for(let _ of su(y.game))g(_);g(),k("Share the playground URL. It sleeps when idle and wakes on a request."),g()}catch(l){Ne(l)}}async function bC(e){let{client:t}=await _e();try{let o=await t.archiveGame(e);if(ks(o,"archive"))return;if(U()){X({ok:!0,status:"archived",game:o.game});return}L("Archived"),O("Game",`${o.game.name} (${o.game.id})`),g(),k("Taken off the air. Its record and files are retained outside the served bundle."),g()}catch(o){Ne(o)}}async function vC(e){let{client:t}=await _e();try{let o=await t.promoteGame(e);if(ks(o,"promote"))return;let r=await t.getWorkspace(),n=My(o.game,r),a=await cs(t,o.game);if(U()){X({ok:!0,status:"promoted",stage:n,...a?{sourceWarning:a}:{},game:o.game});return}L("Approved"),O("Game",`${o.game.name} (${o.game.id})`),g(),n==="prod"?k("Live. Your workspace's plan already carries prod."):k("Approved, but still serving dev: reaching fans on prod also needs your workspace on a paid plan, which only Monterosa can do. Talk to us and this takes effect with no further action from you."),g(),ls(a)}catch(o){let r=o.status,n=o instanceof Error?o.message:"";if(r===404&&/unknown action/i.test(n)){if(U()){X({ok:!1,status:"unavailable",code:"not_deployed",reason:"This control plane does not have promotion yet."});return}L("Not yet"),g(" This control plane does not have promotion yet."),g(),k("Your game is untouched and still serving dev."),k("Your `gamestage` is ahead of the deployed service. Try again once it catches up."),g();return}Ne(o)}}async function wC(e){let{client:t}=await _e();try{let r=(await t.getWorkspace()).games.filter(i=>i.state==="archived"&&!i.playgroundUrl&&!i.playerEndpoint&&!i.space);if(r.length===0){g("Nothing to remove. Every archived game here was deployed at some point.");return}if(!U()){L(`${r.length} archived games that never deployed`);let i=new Map;for(let s of r)i.set(s.name,(i.get(s.name)??0)+1);for(let[s,d]of[...i].sort((l,u)=>u[1]-l[1]))k(d>1?`${s} x${d}`:s);g(),k("A live game, or one that ever deployed, is refused by the server."),g()}if(!e.yes){process.stdin.isTTY||R("Refusing to delete without being asked.",["Nothing has changed. Re-run with `--yes` if you mean it."]);let i=M6({input:process.stdin,output:process.stdout});try{if((await i.question(`Delete ${r.length} records permanently? Type yes to go ahead: `)).trim().toLowerCase()!=="yes"){g("Nothing was deleted.");return}}finally{i.close()}}let n=0,a=[];for(let i of r){let s=await t.deleteGame(i.id);s.refused?a.push(`${i.name}: ${s.refused}`):n+=1}if(X({removed:n,refused:a.length}),!U()){L("Removed"),k(`${n} records gone.`);for(let i of a)k(i);g()}}catch(o){Ne(o)}}async function kC(e){let{client:t}=await _e();try{let{workspace:o,refused:r,code:n}=await t.setPlan(e);if(r){if(U()){X({ok:!0,status:"refused",action:"plan",code:n,reason:r,workspace:o});return}L("Not done"),g(` ${r}`),g();return}if(U())return X({ok:!0,workspace:o});L("Plan changed"),O("Plan",o.tier),O("Live games",String(o.liveGameAllowance||"Contracted")),g()}catch(o){Ne(o)}}async function Ew(e,t){let{admin:o,email:r}=await ga();try{let n=await o.setWorkspaceAccess(e,t),a=u2(n);if(U())return X({ok:!0,status:a.status,changed:n.changed,workspace_id:n.workspaceId,access:n.access,previous:n.previous,message:a.message});ya(a),n.changed&&(O("Decided by",r),g())}catch(n){Ne(n)}}async function _C(){let{admin:e}=await ga();try{let t=await e.runCreatorSync();if(U())return X({ok:!0,counts:t});L("Creator sync");for(let[o,r]of Object.entries(t??{}))O(o,String(r))}catch(t){let o=t instanceof Error?t.message:String(t);R(`The creator sync did not run: ${o}`,["It needs the Resend key in the control plane and an operator account."])}}async function xC(e,t,o){let r=m2(e,t,o.liveGames);"problem"in r&&R(r.problem,r.detail);let{request:n}=r,{admin:a,email:i}=await ga(),s=async()=>{try{let d=await a.getWorkspace(n.workspaceId);return{reading:{tier:d.tier,liveGameAllowance:d.liveGameAllowance}}}catch(d){let l=d.status,u=d instanceof Error?d.message:String(d);return l===404&&/unknown resource/i.test(u)?{reading:null,why:"this control plane has no operator read route, so it was deployed before GS-509 and needs a Space deploy"}:{reading:null,why:l?`${l}, ${u}`:u}}};try{let d=await s(),l=await a.setWorkspacePlan(n.workspaceId,n.tier,n.allowance),u=await s(),p=p2({request:n,previous:d.reading,result:{refused:l?.refused,code:l?.code},stored:u.reading,unreadable:u.why});if(p.exitCode!==0&&(process.exitCode=p.exitCode),U())return X({ok:p.exitCode!==1,status:p.status,workspace_id:n.workspaceId,asked:{tier:n.tier,live_game_allowance:n.allowance??null},previous:p.previous,stored:p.stored,reprovisioned:!1,code:l?.code??null,message:p.message,next:p.next});h2(p),p.status==="set"&&(O("Decided by",i),g())}catch(d){Ne(d)}}async function SC(e){let t;try{t=await yn(e,"utf8")}catch{return R(`Cannot read ${e}`,["`gamestage inspect . --write` or `gamestage create` writes one."])}let o=Ve(t);if(!o.ok)return R(Vt(e,o.issues),[...o.issues.map(i=>`${w.cyan(i.path)} ${i.message}`),"",`${w.cyan(oe(`manifest validate ${e}`))} the full report`]);let r=o.manifest,n=oT(r);if(n.length)return R(`${e} cannot be registered.`,[...n,"","Add `backend.archetype`, and the round that goes with it."]);let{client:a}=await _e();fa();try{let i=await a.registerGame(nT(r,`sha256:${pC("sha256").update(t).digest("hex")}`));if(ks(i,"register"))return;if(U()){X({ok:!0,status:"registered",game:i.game});return}L("Registered"),O("Game",`${i.game.name} (${i.game.id})`),O("State",i.game.state),O("Conformance",i.game.conformance),g(),k(`${w.cyan(oe(`deploy ${i.game.id} --dir .`))} publish it`),g()}catch(i){Ne(i)}}async function $w(e,t){let{client:o}=await _e();try{let r=await o.setAwake(e,t);if(ks(r,t?"wake":"suspend"))return;if(U()){X({ok:!0,status:r.game.state,game:r.game});return}L(t?"Awake":"Suspended"),O("Game",`${r.game.name} (${r.game.id})`),O("State",r.game.state),g(),k(t?"It is taking plays again.":"It is off the air and its live slot is free. `gamestage wake` puts it back."),g()}catch(r){Ne(r)}}async function TC(e,t){let{client:o}=await _e();try{let r=await o.getEndpoints(e);if(r||R(...EC(e)),U())return X({ok:!0,endpoints:r});if(t==="player"||t==="control"||t==="playground"){let n=r[t];n||R(`No ${t} endpoint yet.`,["Deploy the game first: `gamestage deploy "+e+"`."]),g(n);return}L("Endpoints"),O("Player",r.player??"not deployed"),O("Control",r.control??"not deployed"),O("Playground",r.playground??"not deployed"),g()}catch(r){Ne(r)}}function EC(e){let t=/[A-Z\s]/.test(e);return[`No game with the id "${e}" in this workspace.`,t?["That looks like a game's name. Every command takes the id, which is","the name in lower case plus four characters, e.g. my-game-a3c9.","`gamestage status` lists them, and `create` prints one when it makes it."]:["`gamestage status` lists the games in this workspace and their ids."]]}async function $C(e,t){let{client:o}=await _e();try{let r=await o.getLogs(e,{limit:t.limit?Number(t.limit):100,since:t.since??null,level:t.level??null}),n=await o.getGame(e).catch(()=>{}),a=n?_T(n):{state:"none"},i=xT(a);if(U())return X({ok:!0,lines:r,freshness:a});if(i&&(L("This game is serving a closed round"),g(),k(i),g()),r.length===0){L("No log lines"),g(),k("Nothing yet, or everything is older than the tier's retention."),g();return}for(let s of r){let d=s.roundId?` [${s.roundId}]`:"";g(`${s.at} ${s.level.padEnd(5)}${d} ${s.message}`)}}catch(r){Ne(r)}}function kw(e=XE,t=xt){return t==="0.0.0-dev"&&process.env.GAMESTAGE_TEST_RUN?"0.0.0-test":(t==="0.0.0-dev"&&R("This is a development build of the CLI, so it cannot pin a client version.",["A deployed page imports the Gamestage client from a published version, and","this build is not one. Deploying anyway would point the game at",`${Ze}/client/0.0.0-dev/gamestage.js, which does not exist.`,"",`${w.cyan("npm run build:cli")} build the bundle, then deploy with public/cli.mjs`,`${w.cyan("npx gamestage@latest deploy ...")} or use the published CLI`]),e)}function mC(e,t,o=Ze){let r=`${o}/client/${t}/${Ke}`;return e.replace(/(["'])\.?\/?gamestage\.js\1/g,(n,a)=>`${a}${r}${a}`)}function AC(e,t,o){let r=`<script>
14316
14317
  // Written by \`gamestage deploy\`. Where this game's Engine answers.
14317
14318
  window.GAMESTAGE_API = ${JSON.stringify(t)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gamestage",
3
- "version": "0.35.36",
3
+ "version": "0.35.37",
4
4
  "description": "Take a browser game to production: answers, scoring, locks and settlement behind a server the player cannot edit.",
5
5
  "bin": {
6
6
  "gamestage": "./cli.mjs"