gamestage 0.65.0 → 0.65.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.mjs +5 -5
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -274,9 +274,9 @@ You scored {points} points.`},pF=Object.keys(PA),NA=c.object({notify_template_su
|
|
|
274
274
|
`))),r=[],n=[];for(let a of Object.keys(e))!a.startsWith(mo)||o.has(a)?r.push(a):o.has(`${GG}${a.slice(mo.length)}`)||n.push(a);return{registered:r,unnamed:n.sort()}}function vo(e){return`The page never names ${e.join(", ")} in full, so deploy cannot find ${e.length===1?"it":"them"} and Studio gets no box: a word the page shows this way reaches fans blank. Name each key in full in the page, e.g. L('label_score') rather than L('score'), and never build a key at runtime. If the page does not use a key, delete it from gamestage.settings.json.`}function bc(e){return`Studio would open with these empty: ${e.join(", ")}. Add each to gamestage.settings.json with the value a fan sees today, and read it from game.presentation rather than keeping it in the page.`}function wc(e){return new Set([...e.matchAll(/var\(\s*--gs-([A-Za-z]+)\s*[,)]/g)].map(t=>t[1]))}var jG,LG,DG,GG,Dk=x(()=>{"use strict";Dt();sm();dm();jG=new Set(["title_font","title_font_weight","title_case"]),LG=/(^|\/)components\/gamestage\//,DG=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;GG="label_taster_"});function Y2(e){return[`The starter was refused, so nobody can create a game from it. ${e.length===1?"One check":`${e.length} checks`} failed:`,...e.map((t,o)=>`${o+1}. ${t.check}: ${t.problem}`),"Fix each one and publish it again."].join(`
|
|
275
275
|
`)}function V2(e){let t=e.replace(/[. ]+$/,"").toLowerCase();return t===".git"||t==="node_modules"}function Z2(e){if(!e||e.includes("\0"))return"is empty or not text";if(e.includes("\\"))return"uses a backslash";if(e.startsWith("/")||/^[A-Za-z]:/.test(e))return"is an absolute path";if(e.split("/").some(t=>t===".."))return"climbs out of the folder with ..";if(e.split("/").some(V2))return"is inside .git or node_modules, which a starter must not carry"}function YG(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),o=-1;for(let l=e.length-22;l>=Math.max(0,e.length-22-65535);l--)if(t.getUint32(l,!0)===101010256){o=l;break}if(o<0||o>=20&&t.getUint32(o-20,!0)===117853008)return;let r=t.getUint16(o+8,!0),n=t.getUint16(o+10,!0);if(r!==n)return;let a=t.getUint32(o+16,!0);if(n===65535||a===4294967295)return;let i=new TextDecoder("utf-8"),s=[];for(let l=0;l<n;l++){if(a+46>e.length||t.getUint32(a,!0)!==33639248)return;let d=t.getUint16(a+4,!0)>>8,u=t.getUint32(a+24,!0),p=t.getUint16(a+28,!0),f=t.getUint16(a+30,!0),g=t.getUint16(a+32,!0),b=t.getUint32(a+38,!0),w=i.decode(e.subarray(a+46,a+46+p)),_=d===3||d===19?b>>>16:0;s.push({name:w,folder:w.endsWith("/"),symlink:(_&61440)===40960,size:u}),a+=46+p+f+g}return s}function um(e){if(e.length>BG)return{ok:!1,problems:[{check:qr,problem:`the zip is ${(e.length/1024/1024).toFixed(1)} MB, and the limit is 25 MB. Leave out build output and large media: publish already leaves node_modules out.`}]};let t=YG(e);if(!t)return{ok:!1,problems:[{check:qr,problem:"the upload is not a zip that can be read. Publish it with gamestage org starter publish <folder>."}]};let o=[],r=t.filter(l=>!l.folder);r.length>qG&&o.push({check:qr,problem:`it holds ${r.length.toLocaleString("en-GB")} files, and the limit is 2,000. Leave out build output: publish already leaves node_modules out.`});let n=r.reduce((l,d)=>l+d.size,0);n>WG&&o.push({check:qr,problem:`it unpacks to ${Math.ceil(n/1024/1024)} MB, and the limit is 100 MB.`});let a=t.filter(l=>l.symlink).map(l=>l.name);a.length&&o.push({check:qr,problem:`it holds ${a.length===1?"a symbolic link":"symbolic links"} (${a.slice(0,5).join(", ")}). Replace each with the file it points to.`});let i=t.flatMap(l=>{let d=Z2(l.name.replace(/\/$/,""));return d?[`${l.name} ${d}`]:[]});if(i.length&&o.push({check:qr,problem:`a path would land outside the folder: ${i.slice(0,5).join("; ")}.`}),o.length)return{ok:!1,problems:o};let s;try{s=j2(e,{filter:l=>!l.name.endsWith("/")})}catch{return{ok:!1,problems:[{check:qr,problem:"the zip is damaged and could not be unpacked. Publish it again."}]}}return{ok:!0,files:new Map(Object.entries(s))}}function ko(e){if(e)try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{return}}function Fk(e){return e.split("/").some(V2)}function K2(e,t,o={}){let r=[],n=o.profile?.consent?.host_owns_consent===!0,a,i=ko(e.get(nn));if(i===void 0)r.push({check:nn,problem:`there is no ${nn} at the root. Add one with name, version, description, framework and formats.`});else{let N;try{N=JSON.parse(i)}catch{N=void 0}let G=HG.safeParse(N);if(G.success)G.data.name!==t.name||G.data.version!==t.version?r.push({check:nn,problem:`it says ${G.data.name}@${G.data.version}, and this is being published as ${t.name}@${t.version}. Make the two agree.`}):(a=G.data,a.build&&!a.out&&r.push({check:nn,problem:"it has a build command and no out folder. Name the folder the build writes, such as dist."}));else{let q=G.error?.issues[0];r.push({check:nn,problem:N===void 0?"it is not valid JSON.":`${q?.path.join(".")||"the file"}: ${q?.message??"is not valid"}.`})}}let s=a?.out?.replace(/^\.\//,"").replace(/\/+$/,""),l=ko(e.get("index.html")),d=s?ko(e.get(`${s}/index.html`)):void 0;if(l===void 0&&d===void 0)r.push({check:"index.html",problem:s?`there is no index.html at the root or in ${s}/.`:"there is no index.html at the root."});else if(l!==void 0&&!a?.build){let N=fc(l);N&&r.push({check:"index.html",problem:`${N[0]} Add the build command and its out folder to ${nn}.`})}let u=[];for(let[N,G]of e)if(!Fk(N)&&(ZG.test(N)||N==="package.json")){let q=ko(G);q!==void 0&&u.push(q)}let p=ko(e.get("gamestage.yaml"))??ko(e.get("gamestage.yml")),f=p===void 0?void 0:mt(p),g=f?.ok===!0&&f.manifest.identity.consent.host_owns_consent===!0||f?.ok===!1&&/host_owns_consent\s*:\s*true/.test(p??""),b=Dr(g,o.profile);b&&r.push({check:"host-owned consent",problem:b.join(" ")});let w=gc(u.join(`
|
|
276
276
|
`),!0,n);w&&r.push({check:"Gamestage client",problem:`${w} Load gamestage.js from the page, or import @monterosa/gamestage.`});let _=ko(e.get(Hn)),I;if(_!==void 0)try{let N=JSON.parse(_);N&&typeof N=="object"&&!Array.isArray(N)&&(I=Object.fromEntries(Object.entries(N).filter(([,G])=>typeof G=="string")))}catch{I=void 0}if(!(_===void 0&&n))if(_===void 0)r.push({check:"consent settings",problem:`there is no ${Hn} at the root. Add consent_brand_name and an https privacy_policy_url, so a fan is told who is asking.`});else if(!I)r.push({check:"consent settings",problem:`${Hn} is not a JSON object of settings.`});else{let N=yc(I,!n);N&&r.push({check:"consent settings",problem:N.join(" ")});let G=im(I);G&&r.push({check:"Monterosa branding",problem:G.join(" ")})}let M=[...e.keys()].filter(N=>/^\.env(\..*)?$/i.test(N.split("/").pop()??""));M.length&&r.push({check:"no .env files",problem:`${M.slice(0,5).join(", ")} ${M.length===1?"is":"are"} in the starter. Every member of your organisation receives these files; take ${M.length===1?"it":"them"} out and say in the README where the values are kept.`});let z=[];for(let[N,G]of e){let q=VG.test(N)||KG.test(N)||JG.test(N);if(Fk(N)||!q||G.length>XG)continue;if(/\.(p12|pfx|gpg)$/i.test(N)){z.push(`${N} (a key store)`);continue}let L=ko(G);if(L===void 0)continue;let j=L.replace(/data:[\w.+-]+\/[\w.+-]+;base64,[A-Za-z0-9+/=]+/g,"data:");for(let Q of nm(j))z.push(`${N} line ${Q.line} (${Q.kind})`)}if(z.length&&r.push({check:"no secrets",problem:`${z.slice(0,10).join(", ")}${z.length>10?`, and ${z.length-10} more`:""} look${z.length===1?"s":""} like a secret. Take the values out and say where they are kept instead.`}),I){let N=[];for(let[se,le]of e){if(Fk(se)||s&&se.startsWith(`${s}/`)||!QG.test(se)||eB.has(se.split("/").pop()??""))continue;let ue=ko(le);ue!==void 0&&N.push({relative:se,text:ue})}let G=N.map(se=>se.text).join(`
|
|
277
|
-
`),q=new Set(zr()),L=[...[...wc(G)].map(se=>`css_variables_${se}`).filter(se=>q.has(se)),...po(G)].filter(se=>!I[se]?.trim());L.length&&r.push({check:Mk,problem:bc(L)});let{unnamed:j}=wo(I,N);j.length&&r.push({check:Mk,problem:vo(j)});let Q=Gr(I,N);Q.length&&r.push({check:Mk,problem:Br(Q)})}return{problems:r,manifest:a}}var nn,BG,qG,WG,HG,one,qr,VG,ZG,KG,JG,XG,QG,eB,Mk,Uk=x(()=>{"use strict";je();Ok();At();om();tc();ju();sm();Dt();Dk();go();ho();nn="gamestage-starter.json",BG=25*1024*1024,qG=2e3,WG=100*1024*1024,HG=c.object({name:c.string(),version:c.string(),description:c.string().min(1).max(280),framework:c.string().min(1).max(40),formats:c.array(c.string().transform(Re),{error:`name the formats this starter app's page plays, from ${bt.join(", ")}, such as ["predict"]`}).min(1,`name the formats this starter app's page plays, from ${bt.join(", ")}, such as ["predict"]`).refine(e=>e.every(t=>bt.includes(t)),`each format must be one of ${bt.join(", ")}`).transform(e=>[...new Set(e)]),build:c.string().min(1).max(200).optional(),out:c.string().min(1).max(200).refine(e=>!Z2(e),"must be a folder inside the starter, such as dist").optional()}),one=c.object({version:c.string(),bytes:c.number().int().positive()});qr="size and paths";VG=/\.(html?|m?js|cjs|jsx|tsx?|mts|cts|vue|svelte|astro|css|scss|json|ya?ml|toml|md|txt|xml|ini|conf|properties|env)$/i,ZG=/\.(html?|m?js|cjs|jsx|tsx?|mts|cts|vue|svelte|astro)$/i,KG=/\.(pem|key|crt|cer|p12|pfx|pub|asc|gpg)$/i,JG=/(^|\/)(\.[^/.]+|[^/.]+)$/,XG=2*1024*1024;QG=/\.(html?|m?js|cjs|jsx|tsx?|mts|cts|vue|svelte|astro|css|scss)$/i,eB=new Set(["gamestage.js","gamestage-player.js"]),Mk="words in gamestage.settings.json"});function Gk(e){let t=e.split("/").pop()??e,o=t.lastIndexOf(".");return o<=0?J2:tB[t.slice(o+1).toLowerCase()]??J2}function mm(e){let t=e/1048576;return t>=1?`${Number.isInteger(t)?t:t.toFixed(1)} MB`:`${Math.ceil(e/1024)} KB`}function Bk(e,t,o){let r=t===void 0?"too big":mm(t);return`${e} is ${r}, and Gamestage takes files up to ${mm(o)} each. Make it smaller and try again.`}var pm,tB,J2,hm=x(()=>{"use strict";pm="post",tB=Object.freeze({html:"text/html; charset=utf-8",css:"text/css; charset=utf-8",js:"text/javascript; charset=utf-8",mjs:"text/javascript; charset=utf-8",json:"application/json; charset=utf-8",webmanifest:"application/manifest+json; charset=utf-8",wasm:"application/wasm",svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",ico:"image/x-icon",mp3:"audio/mpeg",ogg:"audio/ogg",oga:"audio/ogg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mov:"video/quicktime",woff2:"font/woff2",woff:"font/woff",ttf:"font/ttf",otf:"font/otf",glb:"model/gltf-binary"}),J2="application/octet-stream"});function X2(e,t="USD"){let o=t==="USD"?"$":`${t} `;return e===0?`${o}0.00`:e<1e-4?`under ${o}0.0001`:e<.01?`${o}${e.toFixed(4)}`:`${o}${e.toFixed(2)}`}function Q2(e){let t=e.currency==="USD"?"$":`${e.currency} `,o=`${t}${e.inputPerMTok} per million input tokens`,r=e.outputPerMTok?`${t}${e.outputPerMTok} per million output tokens`:"output free";return`${o}, ${r}`}var qk=x(()=>{"use strict"});function fm(e){return eI.test(e)}function tI(e){return e.createdAt+oB}function nI(e,t){return e.stopped||t>=tI(e)}function oI(e,t){if(!e.playing||e.stopped)return e.elapsed;let o="createdAt"in e?Math.min(t,tI(e)):t;return e.elapsed+Math.max(0,o-e.changedAt)/1e3*e.speed}function Wk(e,t){return!nI(e,t)&&oI(e,t)<rB}function rI(e,t){let o=nI(e,t);return{id:e.id,seed:e.seed,speed:e.speed,elapsed:oI(e,t),playing:e.playing&&!o,stopped:o,createdAt:e.createdAt}}var eI,lne,nB,dne,oB,une,rB,gm=x(()=>{"use strict";je();go();eI=/^sim-[0-9a-f]{8}$/;lne=c.object({id:c.string().regex(eI),seed:c.number().int(),speed:c.number().positive(),elapsed:c.number().nonnegative(),changedAt:c.number(),playing:c.boolean(),stopped:c.boolean(),createdAt:c.number(),createdBy:c.string().nullable()}),nB=c.object({seed:c.number().int().min(1).max(9999).default(6),speed:c.number().min(1).max(120).default(30),elapsed:c.number().min(0).max(1e4).default(0)}),dne=c.enum(["pause","play","stop"]),oB=24*36e5,une=10*6e4,rB=6300});var Hk=x(()=>{"use strict"});function aI(e){return e==="requested"||e==="with_monterosa"||e==="with_partner"}function ym(e){if(!e||typeof e!="object")return null;let t=lB.safeParse(e);return t.success?t.data:null}function Yk(e){let t=e&&typeof e=="object"?e:{};return{request:ym(t.request),...typeof t.refused=="string"?{refused:t.refused}:{},...typeof t.code=="string"?{code:t.code}:{},...t.products==="on"||t.products==="off"||t.products==="not_set_up"?{products:t.products}:{}}}function bm(e){if(!e)return{headline:"Not requested.",next:"You can ask for partner products on your result screen. Using them is subject to approval by Monterosa and the retail partner, and to commercial terms agreed with Monterosa."};switch(e.state){case"requested":return{headline:"Requested. Waiting for Monterosa to pick it up.",next:"Monterosa reads your answers, then takes the request to the retail partner. You can still change your answers until then."};case"with_monterosa":return{headline:"With Monterosa.",next:"Monterosa is checking your answers and may email you with questions before taking the request to the retail partner."};case"with_partner":return{headline:"With the retail partner.",next:"The retail partner decides where its products appear. Monterosa tells you when they answer, and agrees commercial terms with you before anything goes live."};case"approved":return{headline:"Approved. Products are switched on for this game.",next:"Fans who win or finish without losing see up to three partner products on the result screen. Use is subject to the commercial terms agreed with Monterosa."};case"declined":return{headline:`Declined.${e.reason?` ${e.reason.replace(/\.?$/,".")}`:""}`,next:"Products stay off for this game. If something has changed, you can ask again."};case"not_wanted":return{headline:"You said you do not want products in this game.",next:"Nobody will ask again. If you change your mind, request them from this page or with `gamestage ads request`."}}}function Vk(e){let t=e.filter(n=>n.state!=="not_wanted"),o=t.filter(n=>aI(n.state)).sort((n,a)=>n.requestedAt.localeCompare(a.requestedAt)),r=t.filter(n=>!aI(n.state)).sort((n,a)=>a.updatedAt.localeCompare(n.updatedAt));return[...o,...r]}var aB,iI,iB,fne,sI,sB,cB,lB,dB,wm=x(()=>{"use strict";je();aB=["requested","with_monterosa","with_partner","approved","declined","not_wanted"],iI=c.enum(aB),iB=["requested","with_monterosa","with_partner","approved","declined"],fne=c.enum(iB);sI=c.object({audience:c.string().trim().min(1,"Say who the game is for.").max(500),wherePlayed:c.string().trim().min(1,"Say where the game is played.").max(500),countries:c.string().trim().min(1,"Say which countries its fans are in.").max(300),prize:c.boolean(),note:c.string().trim().max(1e3).nullable().default(null)}),sB=c.object({kind:c.enum(["creator","operator"]),id:c.string(),email:c.string().nullable().default(null)}),cB=c.object({state:iI,at:c.string(),by:sB,reason:c.string().nullable().default(null)}),lB=c.object({gameId:c.string(),workspaceId:c.string(),gameName:c.string().nullable().default(null),ownerEmail:c.string().nullable().default(null),facts:sI.nullable().default(null),state:iI,reason:c.string().nullable().default(null),requestedAt:c.string(),updatedAt:c.string(),history:c.array(cB).default([])});dB=c.union([c.object({wanted:c.literal(!0).default(!0),facts:sI}),c.object({wanted:c.literal(!1)})])});var mB,cI,pB,vm,kne,km=x(()=>{"use strict";je();_t();Hu();mB=12,cI=12,pB=["espn"],vm=e=>pB.includes(e),kne=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(mB),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()})});function Zk(e,t){if(e.origin==="pull")return{refused:{code:"pulled",message:`${e.name} is pulled from ${e.supplier&&Yu(e.supplier)?.label||e.supplier||"a source"} on a schedule, so removing it would last until the next pull. Switch the source off instead.`},usedBy:[]};let o=t.filter(n=>n.state!=="archived"),r=_m(o,e);return r.length?{refused:{code:"in_use",message:`${r.length===1?"A game reads":`${r.length} games read`} ${e.name}, and its next round would be refused without it.`},usedBy:r}:null}function _m(e,t){return e.filter(o=>o.referenceName===t.name).map(o=>({gameId:o.id,gameName:o.name??"",pinnedDigest:o.referenceDigest??null,stale:!!o.referenceDigest&&o.referenceDigest!==t.digest,roundIds:(o.rounds??[]).map(r=>r.id)}))}var hB,lI,dI,Tne,uI,Ene,Ane,Cne,Ine,One,fB,gB,Pne,Nne,Rne,xm=x(()=>{"use strict";je();_t();lc();hB=c.enum(["push","pull"]),lI=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:hB.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)}),dI=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([])}),Tne=c.object({dataset:lI,usedBy:c.array(dI).default([])}),uI=c.enum(["pushed","pulled","joined","refused","failed"]),Ene=c.object({at:c.string(),event:uI,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)}),Ane=c.object({dataset:c.string().optional(),gameId:c.string().optional(),event:c.array(uI).optional(),since:c.string().optional(),search:c.string().optional(),before:c.string().optional(),limit:c.number().int().positive().max(500).default(100)}),Cne=c.object({datasets:c.array(lI).default([]),unavailable:c.string().nullable().default(null)}),Ine=c.object({name:c.string().min(1),deleted:c.boolean(),digest:c.string().nullable().default(null),refused:c.object({code:c.enum(["in_use","pulled"]),message:c.string()}).nullable().default(null),usedBy:c.array(dI).default([])}),One=c.object({name:c.string().min(1),digest:c.string(),bytes:c.number().int().nonnegative().default(0),url:c.string().min(1),expiresInSeconds:c.number().int().positive()}),fB=c.enum(["running","published","unchanged","refused","not_pulled"]),gB=c.object({name:c.string().min(1),state:fB,requestedAt:c.string(),finishedAt:c.string().optional(),digest:c.string().optional(),entries:c.number().int().nonnegative().optional(),measures:c.array(c.string()).optional(),sampleKeys:c.array(c.string()).optional(),requests:c.number().int().nonnegative().optional(),skipped:c.number().int().nonnegative().optional(),reason:c.string().optional()}),Pne=c.object({name:c.string().min(1),refused:c.literal(!0),message:c.string(),retryAt:c.string(),last:gB.optional()}),Nne=15*6e4,Rne=new Intl.Collator("en",{numeric:!0})});var bB,qne,Kk=x(()=>{"use strict";je();mi();_t();km();xm();bB=c.enum(["game.deleted","operator.request","workspace.closed"]),qne=c.object({kind:c.enum(["engine","workspace"]),target:c.string(),workspaceId:c.string(),gameId:c.string().nullable(),reason:bB,requestedAt:c.string(),dueBy:c.string(),completedAt:c.string().nullable(),attempts:c.number().int(),lastError:c.string().nullable(),deleted:c.number().int(),engine:c.enum(["gamestage","arcade","deduction","quiz"]).optional()})});function kB(e){return`slate-${e+1}`}function Sm(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:kB(o),label:t.label??"",entries:t.entries.map(r=>({key:r.key,label:r.label??""}))}))}}var wB,vB,Xk,_o=x(()=>{"use strict";je();kt();wB=c.object({key:c.string().min(1),label:c.string().default(""),note:c.string().optional()}),vB=c.object({id:c.string().min(1),label:c.string().default(""),entries:c.array(wB).min(1)}),Xk=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(vB).min(1)})});function vc(e){return Lt(e,"draws_allowed")}var Qk,e_=x(()=>{"use strict";Dt();Qk=[{key:"round_solution",label:"The phrase",type:"freetext",description:'The word or phrase a fan solves, e.g. "George Russell". A fan sees one tile per letter, grouped by word, with "What a fan is told" as the hint. Accents and punctuation are kept for the reveal and ignored when marking. Leave it empty for an ordinary board. Never shown to a fan. This is the answer, so it is withheld from the feeds a browser reads.',readBy:"The Engine, which draws letters from it and marks a solve against it.",section:"This round",public:!1},{key:"round_draws",label:"Letters a fan draws",type:"number",description:'With "The phrase": how many letters a fan may draw before they must have solved it. Leave it empty for 3.',readBy:"The Engine.",section:"This round"},{key:"round_draw_order",label:"Order of the letters",type:"list",options:[{name:"The same for every fan",value:"seeded"},{name:"Different for each fan",value:"random"}],default:"seeded",description:'With "The phrase": the same order gives every fan the same letters in the same order, so results compare and can be shared without a spoiler. A different order per fan makes each play its own.',readBy:"The Engine.",section:"This round"}]});function kc(e){return Lt(e,"guesses_allowed")}var mI,pI,hI,fI,gI,yI,t_,$m=x(()=>{"use strict";Dt();mI="round_guess_answer",pI="round_guess_count",hI="round_guess_feedback",fI="round_guess_words",gI="round_guess_clues",yI="round_guess_picture",t_=[{key:mI,label:"The answer",type:"freetext",description:'The word or number a fan guesses, e.g. "ALLOY" or "1966". A whole number makes it a number round, where a fan is told higher or lower; anything else is a word, where a fan sees one tile per letter. Case and accents are ignored when marking. Leave it empty for an ordinary board. Never shown to a fan before they finish. This is the answer, so it is withheld from the feeds a browser reads.',readBy:"The Engine, which marks every guess against it.",section:"This round",public:!1},{key:pI,label:"Guesses a fan gets",type:"number",description:'With "The answer": how many guesses a fan gets, from 1 to 20. A skip spends one. Leave it empty for 6.',readBy:"The Engine.",section:"This round"},{key:hI,label:"What a fan is told after each guess",type:"list",options:[{name:"Each letter's colour (words)",value:"letters"},{name:"Higher or lower (numbers)",value:"higher_lower"},{name:"Only right or wrong",value:"none"}],description:'With "The answer": leave it empty for letter colours on a word and higher or lower on a number.',readBy:"The Engine.",section:"This round"},{key:fI,label:"Accept only real words",type:"list",options:[{name:"Any letters",value:"any"},{name:"Real words only",value:"words"}],default:"any",description:'With a word in "The answer": "Real words only" refuses a guess that is not an English word, without spending it. Works for answers of 4 to 7 letters.',readBy:"The Engine.",section:"This round"},{key:gI,label:"Clues",type:"freetext",description:'With "The answer": one clue per line, or separated by "|". A fan sees the next clue after each wrong guess or skip, in order. Never shown to a fan before they earn it, so it is withheld from the feeds a browser reads.',readBy:"The Engine, which hands each clue to the fan who earned it.",section:"This round",public:!1},{key:yI,label:"Picture",type:"image",description:'With "The answer": a picture a fan guesses from, such as a photograph for guess the year. Shown to every fan from the start, so pick one that does not give the answer away on its own. Leave it empty for none.',readBy:"The game's page, which shows it above the guess.",section:"This round"}]});var _B,xB,SB,n_,Tm=x(()=>{"use strict";kt();_B="hunt_points_by_turn",xB="hunt_points_for_playing",SB="hunt_points_for_correct",n_=[{key:_B,label:"Points by turn",type:"freetext",description:'Points for a correct answer on the first turn, the second, and so on, separated by commas, e.g. "10, 6, 3". A turn is a letter drawn in a solve-the-phrase game, or a guess in a guess game. A correct answer after more turns than you list earns nothing from this box. Leave every points box empty to score the turns left plus one.',readBy:"The control plane, which writes it onto each round for the Engine to score.",section:"Points"},{key:xB,label:"Points for playing",type:"number",description:"Points every fan earns for finishing a round, won or lost. Leave it empty for none.",readBy:"The control plane, which writes it onto each round for the Engine to score.",section:"Points"},{key:SB,label:"Points for a correct answer",type:"number",description:'A flat amount for a correct answer, on top of "Points by turn". Use this alone to give every winner the same. Leave it empty for none.',readBy:"The control plane, which writes it onto each round for the Engine to score.",section:"Points"}]});function wI(e){return e.includes(bI)}var $B,bI,o_,Em=x(()=>{"use strict";kt();$B="push_compare",bI="each_at_least_last",o_=[{key:$B,label:"How picks are judged",type:"list",options:[{name:"Add up: going over the target is out",value:"total"},{name:"Chain: each pick at least the last",value:bI}],default:"total",description:"Add up: a fan's picks are added together and going over the round's target ends the round. Chain: each pick must be worth at least as much as the one before it, the first lower pick ends the round, and the score is how many picks held. A chain round has no target, so leave each round's target empty.",readBy:"The control plane, which writes it onto each round for the Engine to mark.",section:"Rules"}]});function LB(e){let t=vc(e),o=kc(e),r=pv(e),n=hv(e),a=mv(e),i=uv(e),s=dv(e);return jB.filter(l=>CB.has(l)?t:zB.has(l)?o:IB.has(l)?r:OB.has(l)?n:PB.has(l)?a:NB.has(l)?i:RB.has(l)?s:Lt(e,l))}function DB(e){return[...vc(e)||kc(e)?EB:[],...wI(e)?AB:[]]}function _I(e){return[...Ou(e),...LB(e),...DB(e)]}var vI,TB,r_,kI,EB,AB,CB,IB,OB,PB,NB,RB,zB,jB,Am=x(()=>{"use strict";Dt();e_();$m();Tm();Em();Xs();vI="products_about",TB={key:vI,label:"Products about",type:"list",options:[{name:"The answer",value:"answer"},{name:"What the answer belongs to",value:"parent"},{name:"The game's theme",value:"theme"},{name:"No products",value:"none"}],default:"answer",description:`What the shop products shown after a win are about. Usually the answer itself. If the question makes the answer look bad, so that selling it would be a dig, choose what it belongs to, the game's theme, or no products. For example, after "Who is the player that's not yet scored?" offer his club or the league rather than his shirt; after "Which character never wins an argument?" offer the film rather than that character. The theme is the game's "Shop theme" setting.`,readBy:"The game's own page, which asks the shop for products about it after a win or a neutral result.",section:"This round"},r_={hunt:[TB,...Qk,...t_],place:[...av,...iv,...sv,...cv,...lv]},kI={hunt:n_,push:o_},EB=new Set(n_.map(e=>e.key)),AB=o_.map(e=>e.key),CB=new Set(Qk.map(e=>e.key)),IB=new Set(av.map(e=>e.key)),OB=new Set(iv.map(e=>e.key)),PB=new Set(sv.map(e=>e.key)),NB=new Set(cv.map(e=>e.key)),RB=new Set(lv.map(e=>e.key)),zB=new Set(t_.map(e=>e.key)),jB=[...new Set(Object.values(r_).flatMap(e=>(e??[]).map(t=>t.key)))]});var SI,MB,boe,_c=x(()=>{"use strict";je();Qt();_o();kt();Am();$m();SI=xu.safeExtend({answerMeasure:c.string().min(1).optional(),answerRule:Ys.optional()}),MB=c.discriminatedUnion("archetype",[Xk,SI,Fw,Su,$u]),boe=c.object({name:c.string().regex(/^\d{4}-\d{2}-\d{2}$/,"A day is named by its date, e.g. 2026-11-01."),dayStart:c.number().int(),dayEnd:c.number().int(),round:MB,overwrite:c.boolean().optional()}).refine(e=>e.dayEnd>e.dayStart,"A day must end after it starts.")});var a_,$oe,i_=x(()=>{"use strict";je();_t();_o();_c();Qt();a_=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()}),$oe=c.object({measure:c.string().min(1),rule:Ys,prompt:c.string().trim().min(1)})});var Cm=x(()=>{"use strict";Qt();kt();Ws()});var s_=x(()=>{"use strict"});var UB,GB,BB,qB,WB,HB,YB,VB,ZB,KB,JB,XB,QB,e5,t5,n5,o5,Doe,Im=x(()=>{"use strict";Qt();kt();s_();Gs();UB="place_no_mistake_limit",GB="place_no_skip_limit",BB="place_wildcards_allowed",qB="place_deep_cuts",WB="place_deep_cut_bonus",HB="place_deal",YB="place_deal_boxes",VB="place_deal_tiers",ZB="place_deal_multi_fit",KB="place_deal_decoys",JB="place_card_tags",XB="place_deal_pool",QB="place_deal_new_card",e5="place_deal_new_card_limit",t5="place_deal_daily",n5="place_deal_day_starts",o5="place_deal_time_zone",Doe={[BB]:"Wildcards allowed",[qB]:"Deep cuts",[WB]:"Deep cut bonus",[UB]:"No limit on mistakes",[GB]:"No limit on skips",[HB]:"Build the card from lists",[YB]:"Number of boxes",[VB]:"Boxes from each difficulty",[ZB]:"Cards that fit more than one box",[KB]:"Cards that fit no more than one box",[JB]:"Card groups",[XB]:"Only use cards from",[QB]:"Allow New card",[e5]:"New cards per player",[t5]:"New card each day",[n5]:"Day starts at",[o5]:"Time zone"}});var Om=x(()=>{"use strict"});var c_,l_=x(()=>{"use strict";ho();_t();i_();At();_o();_c();Cm();Im();Dt();Om();kt();c_="Studio rounds:"});var a5,wre,gi,vre,d_=x(()=>{"use strict";je();go();a5=["us","eu","dev"],wre=c.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/,"An organisation id is lower case letters, digits and hyphens, such as nba."),gi=c.string().trim().min(1).max(200),vre=c.object({displayName:gi.optional(),studioHost:c.enum(a5).optional(),studioOrg:gi.optional(),spaces:c.array(gi).min(1).max(20).optional(),domains:c.array(gi.toLowerCase()).max(50).optional(),consent:c.enum(["onetrust","ours"]).optional(),identity:gi.optional(),signedAgreement:c.boolean().optional(),playerLogin:c.object({jwksUri:c.string().url().optional(),issuer:c.union([c.string().url(),c.literal("")]).optional(),audience:c.union([gi,c.literal("")]).optional(),playerIdClaim:c.union([c.string().regex(/^[A-Za-z_][A-Za-z0-9_.:-]*$/,"A claim name, such as SubscriberId."),c.literal("")]).optional()}).strict().optional()}).strict()});var xc=x(()=>{"use strict";kt();Qt()});var u_=x(()=>{"use strict";_o();kt()});var Pm=x(()=>{"use strict";_o();kt()});var m_=x(()=>{"use strict"});var Nm=x(()=>{"use strict";xc();_t();_o();u_();Cm();Im();kt();Vs();Pm();m_();_o();Qt();At();Om();Tm();Em();_c();Va()});function p_(e){return AI+e.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function II(e){if(e.startsWith(AI)){for(let[t,o]of Object.entries(CI))if(o.some(r=>p_(r)===e))return t}}function h_(e){let o=Object.values(CI).flat().map(p_).indexOf(e);return o===-1?void 0:o}var AI,CI,Rm,f_=x(()=>{"use strict";AI="label_taster_",CI={"Taster: ringers":["huntFoundLabel","huntFoundState","huntRuledOutState","huntSelectedState","huntChooseLabel","huntNameOne","huntNameMany","huntChecking","huntSelection","huntRules","huntLimits","huntMistakesLeft","huntFeedback","huntRetry","huntAnswers","huntWon","huntFinished","huntRecap","huntBoardPending","huntNextFailed","huntTimed","huntFinishedAction","huntReviewLabel"],"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","bingoChooseNote","bingoWatchNote","bingoResultNote","bingoHitLabel","bingoMissLabel","bingoDetailsLabel"],"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"],"Taster: shop":["shopHeading","shopBadge","shopDisclosure","shopButton","shopLinkDescription","shopCompetition"]};Rm=["tabHow","boardLabel","closeLabel","playAnotherLabel","restartLabel","backLabel"].map(e=>p_(e))});function g5(e){let t=new Map,o=new Map,r=n=>{for(let a of n)if(a.type==="list"&&o.set(a.key,a),a.type==="collection"){let i=t.get(a.key);if(i&&(i.itemLabel!==a.itemLabel||JSON.stringify(i.fieldset??[])!==JSON.stringify(a.fieldset??[])))throw new Error(`The collection "${a.key}" is declared with two different shapes. One key is one declaration; its fieldset and item label must match wherever it appears.`);t.set(a.key,a),r(a.fieldset??[])}};return r(e),[...p5,...Jw.map(f5),...[...t.values()].map(h5),...[...o.values()].map(m5)]}function jm(e){let t=[];for(let o of e){let r=o.public===!1,n={label:o.label,key:o.key,field:NI(o),description:o.description,...o.type==="collection"?{}:{mandatory:o.required===!0},...r?{public:!1,cloneable:!1}:{},...o.default!==void 0?{default:o.default}:{}},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(l=>l.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 y5(e){let t=e.archetypes.map(Re);for(let d of t)if(!OI[d])throw new Error(`No Studio element name for the ${d} archetype. Add one to ARCHETYPE_ELEMENT_NAMES rather than letting Studio show a blank type.`);let o=d=>`${e.urls.baseAppsUrl}/${d}`,r=d=>{if(!e.roundFields)return;let u=zu(d,e.roundFields);return u.ok?u.fields:void 0},n=new Map((t.length===1?r(t[0])??[]:[]).map(d=>[d.key,d])),a=d=>n.get(d.key)??d,i=new Set(e.wording??Zw),s=d=>(r_[Re(d)]??[]).filter(u=>e.wording===void 0||e.wording.includes(u.key)),l=[...Js.filter(d=>!Zw.includes(d.key)||i.has(d.key)),...RA,...[...i].filter(d=>d.startsWith(mo)).sort(b5).map(w5),...[...new Set(t)].flatMap(d=>Xw[d]??[]),...[...new Set(t)].flatMap(d=>(kI[d]??[]).filter(u=>e.wording===void 0||e.wording.includes(u.key)))];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,services:{"lvis-id-custom-tab":{}}},"elements.json":[...t.map(d=>({name:OI[d],content_type:PI(d),derived_from:zm[d]?.derivedFrom??"data",duration:zm[d]?.duration??{mode:"instant"},label:zm[d]?.derivedFrom==="prediction"?"{{question.text}}":"{{element.title}}",custom_fields:jm(r(d)?[...r(d),...s(d)]:[...Za.includes(Re(d))?Ho.filter(u=>u.key==="title"):Ho,...Nu(d),...s(d)]),...zm[d]?.derivedFrom==="prediction"?{label_question:d==="bingo"?"Card":"Question",label_option:d==="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"}]}:{}})),...t.some(d=>Re(d)==="predict")?[{...Ls.scoreline,fields:ev,titleHelp:"How this match is listed on the timeline, so you can tell the matches apart. For example: Arsenal v Chelsea. Fans do not see it."},{...Ls.number,fields:tv,titleHelp:"How this question is listed on the timeline. For example: First goal minute. Fans do not see it."}].map(d=>({name:d.name,content_type:d.contentType,derived_from:"data",duration:{mode:"fixed",default:604800},label:"{{element.title}}",custom_fields:jm([...Ho.filter(u=>u.key==="title").map(u=>({...u,label:"Name on the timeline",description:d.titleHelp})),...d.fields])})):[]],"fields.json":g5([...l,...Kw,...Ho.map(a),...hC().map(a),...Object.values(ov).flat(),...Jw,...ev,...tv,...t.flatMap(s)]),"project_settings.json":{sections:jm(l)},"event_settings.json":{sections:jm([...Kw,...e.live?tC:[],...t.flatMap(d=>ov[d]??[])])}}}function b5(e,t){let o=h_(e),r=h_(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 w5(e){let t=lC(e),o=II(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,...Rm.includes(e)?{required:!0}:{}}}function g_(e){return y5({name:e.gameName,id:e.gameId,wording:e.wording??[],version:`0.0.${e.manifestRevision}`,archetypes:[e.archetype],urls:e.urls,live:e.live??!1,...e.roundFields?{roundFields:e.roundFields}:{}})}var OI,PI,zm,NI,m5,p5,h5,f5,y_=x(()=>{"use strict";Dt();ku();Xs();ec();Am();f_();At();OI=yA,PI=e=>{let t=Re(e);return Ka[t]??`gamestage-${t.replaceAll("_","-")}-element`},zm={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}},quiz:{derivedFrom:"data",duration:{mode:"fixed",default:86400}}},NI=e=>e.type==="collection"||e.type==="list"?e.key:e.type,m5=e=>({key:e.key,type:"list",data:(e.options??[]).map(t=>({name:t.name,value:t.value}))}),p5=[{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},{key:"file",type:"file",localisable:!1}],h5=e=>({key:e.key,type:"collection",...e.itemLabel?{item_label:e.itemLabel}:{},fieldset:(e.fieldset??[]).map(t=>({label:t.label,key:t.key,field:NI(t),...t.description?{description:t.description}:{}}))}),f5=e=>({key:e.key,type:e.type,...e.type==="freetext"||e.type==="wysiwyg"||e.type==="image"?{localisable:!1}:{}})});var b_=x(()=>{"use strict";At()});var v5,$ae,Tae,w_=x(()=>{"use strict";je();v5=c.enum(["waiting-for-dns","issuing-certificate","live","not-pointing","failed"]),$ae=c.object({hostname:c.string(),gameId:c.string(),status:v5,statusSince:c.string(),createdAt:c.string(),waitingSince:c.string(),liveAt:c.string().nullable().default(null),lastCheckedAt:c.string().nullable().default(null),lastSeen:c.string().nullable().default(null),reason:c.string().nullable().default(null),tenantId:c.string().nullable().default(null),verificationToken:c.string().nullable().default(null)}),Tae=72*36e5});var RI=x(()=>{"use strict";Qu();bk();om();Uk();ho();hm();qk();Rs();gm();mi();Hk();wm();Kk();l_();go();d_();go();Zu();_t();km();xm();xc();Nm();y_();b_();w_();Xv();Qv();Qt();mi()});function k5(e){try{return JSON.parse(e)}catch{return{}}}function _5(e,t){if(e.status>=500)return;let o=(e.headers.get("server")??"").toLowerCase(),r=(e.headers.get("content-type")??"").toLowerCase(),n=t.trimStart().slice(0,200).toLowerCase();if(o.includes("amazons3")||n.startsWith("<?xml")&&n.includes("<error>"))return"S3";if(r.includes("text/html")||n.startsWith("<!doctype html")||n.startsWith("<html"))return"a website";if(t.trim()!=="")try{JSON.parse(t);return}catch{return o.includes("cloudfront")?"CloudFront":"something other than an API"}}function LI(e){let t=1e3*2**(e-1),o=t*.2*(Math.random()*2-1);return Math.round(t+o)}function FI(e){let t=e.fetch??globalThis.fetch,o=e.maxAttempts??4,r=e.baseUrl.replace(/\/+$/,"");return async function(a,i,s={}){let l=globalThis.location?.origin,d=new URL(`${r}${i}`,r.startsWith("/")?l:void 0);for(let[p,f]of Object.entries(s.query??{}))if(Array.isArray(f))for(let g of f)d.searchParams.append(p,String(g));else f!=null&&d.searchParams.set(p,String(f));let u;for(let p=1;p<=o;p++){s.signal?.throwIfAborted();let f=typeof e.token=="function"?await e.token():e.token,g;try{g=await t(d,{signal:s.signal,method:a,headers:{...e.headers,...e.workspace?{[h2]:e.workspace}:{},authorization:`Bearer ${f}`,...s.body===void 0?{}:{"content-type":"application/json"}},body:s.body===void 0?void 0:JSON.stringify(s.body)})}catch(M){s.signal?.throwIfAborted();let z=M instanceof Error?M.message:String(M);if(u=new Le(0,"unreachable",`Could not reach the control plane at ${r}: ${z}. Check your connection and run the command again.`,!0),p===o)break;await zI(LI(p));continue}let b=await g.text(),w=_5(g,b);if(w)throw new Le(g.status,Lm,`${r} is not a Gamestage control plane (it answered like ${w}). Set GAMESTAGE_CONTROL_URL to the Space's API address.`,!1);if(g.ok)return b===""?void 0:JSON.parse(b);let _=k5(b);if(u=new Le(g.status,_.error?.code??"unknown",_.error?.message??g.statusText,_.error?.retryable??!1),!u.retryable||p===o)break;let I=Number(g.headers.get("retry-after"));await zI(Number.isFinite(I)&&I>0?I*1e3:LI(p))}throw u??new Le(0,"unknown","Request failed.",!1)}}function UI(e){let t=FI(e);return{listDomains:()=>t("GET","/v1/admin/domains").then(o=>o.domains??[]),checkDomain:o=>t("POST",`/v1/admin/domains/${encodeURIComponent(o)}/check`),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(a2);return i2(r)},getWorkspace:o=>t("GET",`/v1/admin/workspaces/${encodeURIComponent(o)}`),setWorkspaceGrant:(o,r,n)=>t("POST",`/v1/admin/workspaces/${encodeURIComponent(o)}/grants`,{body:{grant:r,change:n}}),getWorkspaceGrants:o=>t("GET",`/v1/admin/workspaces/${encodeURIComponent(o)}/grants`),listOrgProfiles:()=>t("GET","/v1/admin/orgs"),getOrgProfile:o=>t("GET",`/v1/admin/orgs/${encodeURIComponent(o)}`),setOrgProfile:(o,r)=>t("PUT",`/v1/admin/orgs/${encodeURIComponent(o)}`,{body:r}),setWorkspaceCapTrial:(o,r,n)=>t("PUT",`/v1/admin/workspaces/${encodeURIComponent(o)}/trials`,{body:{limit:r,on:n}}),getWorkspaceCapTrials:o=>t("GET",`/v1/admin/workspaces/${encodeURIComponent(o)}/trials`),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"),eraseGame:o=>t("POST",`/v1/admin/games/${encodeURIComponent(o)}/erasure`),closeWorkspace:o=>t("POST",`/v1/admin/workspaces/${encodeURIComponent(o)}/close`),listErasures:()=>t("GET","/v1/admin/erasures").then(o=>o.erasures??[]),getAds:()=>t("GET","/v1/admin/ads"),setAdsConfig:o=>t("PUT","/v1/admin/ads/config",{body:o}),setAdsGame:(o,r)=>t("PUT",`/v1/admin/ads/games/${encodeURIComponent(o)}`,{body:r}),addAdsBlock:(o,r)=>t("POST",`/v1/admin/ads/blocklists/${o}`,{body:r}),removeAdsBlock:(o,r)=>t("POST",`/v1/admin/ads/blocklists/${o}/remove`,{body:{value:r}}),previewAds:o=>t("GET","/v1/admin/ads/preview",{query:{country:o.country,moment:o.moment,club:o.club||void 0,subject:o.subjects?.length?o.subjects.map(r=>`${r.type}:${r.name}`):void 0,game:o.gameId||void 0}}),listAdsRequests:()=>t("GET","/v1/admin/ads/requests").then(o=>Vk((o?.requests??[]).map(ym).filter(r=>r!==null))),moveAdsRequest:(o,r,n)=>t("PUT",`/v1/admin/ads/requests/${encodeURIComponent(o)}`,{body:{state:r,reason:n}}).then(Yk),adsProducts:o=>t("GET","/v1/admin/ads/products",{query:{catalogue:o.catalogue,subject:`${o.subject.type}:${o.subject.name}`}}),adsCriteria:()=>t("GET","/v1/admin/ads/criteria"),sponsorUsage:o=>t("GET","/v1/admin/sponsors",o?{query:{month:o}}:void 0)}}function Yn(e){let t=FI(e),o=["meters","rounds","history","destinations","sections","issues"],r=i=>{let s={...i,containerLabel:i.containerLabel??"Round"};for(let l of o)Array.isArray(s[l])||(s[l]=[]);return s},n=i=>({...i,access:Xu(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:Xu(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 Le)||i.status!==404)throw i;return jI||(jI=!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,l)=>t("POST",`/v1/games/${encodeURIComponent(i)}/uploads`,{body:l?{filename:s,deployId:l,upload:pm}:{filename:s,upload:pm}}),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}}),getDomain:i=>t("GET",`/v1/games/${encodeURIComponent(i)}/domain`),addDomain:(i,s,l)=>t("POST",`/v1/games/${encodeURIComponent(i)}/domain`,{body:{hostname:s,move:l?.move??!1}}),checkDomain:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/domain/check`),removeDomain:i=>t("DELETE",`/v1/games/${encodeURIComponent(i)}/domain`),getAdsRequest:i=>t("GET",`/v1/games/${encodeURIComponent(i)}/ads-request`).then(s=>ym(s?.request)),requestAds:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/ads-request`,{body:s}).then(Yk),listSimulations:()=>t("GET","/v1/live/simulations").then(i=>i?.simulations??[]),startSimulation:i=>t("POST","/v1/live/simulations",{body:i??{}}),changeSimulation:(i,s)=>t("POST",`/v1/live/simulations/${encodeURIComponent(i)}/${s}`),referenceUploadTarget:(i,s)=>t("POST","/v1/reference/uploads",{body:{name:i,digest:s,upload:pm}}),listMembers:async()=>(await t("GET","/v1/workspace/members")).members??[],inviteMember:async i=>(await t("POST","/v1/workspace/members",{body:{email:i}})).member,removeMember:i=>t("DELETE",`/v1/workspace/members/${encodeURIComponent(i)}`),listMyWorkspaces:async()=>(await t("GET","/v1/workspaces")).workspaces??[],listDesignSystems:async()=>(await t("GET","/v1/design-systems")).designSystems??[],publishDesignSystem:(i,s)=>t("POST",`/v1/design-systems/${encodeURIComponent(i)}/versions`,{body:s}),designSystemVersion:async(i,s)=>(await t("GET",`/v1/design-systems/${encodeURIComponent(i)}/versions/${encodeURIComponent(s)}`)).designSystem,async orgProfile(){try{return(await t("GET","/v1/org/profile")).profile}catch(i){if(i instanceof Le&&i.status===404&&i.code==="no_org")return null;throw i}},async orgContext(){try{return(await t("GET","/v1/org/context")).context}catch(i){if(i instanceof Le&&i.status===404&&i.code==="no_context")return null;throw i}},async orgProfileForOperator(){try{return(await t("GET","/v1/org/profile/operator")).profile}catch(i){if(i instanceof Le&&(i.status===403||i.status===404))return null;throw i}},setActiveOrg:i=>t("PUT","/v1/org/active",{body:{org:i}}),async orgAdmins(){let i;try{i=await t("GET","/v1/org/admins")}catch(s){if(s instanceof Le&&s.status===404)return null;throw s}return{organisation:i.organisation??null,admins:Array.isArray(i.admins)?i.admins.filter(s=>typeof s?.email=="string"&&s.email!=="").map(s=>({email:s.email,since:typeof s.since=="string"?s.since:null})):[],youCanChange:i.youCanChange===!0}},orgContextHistory:async()=>(await t("GET","/v1/org/context/history")).revisions??[],setOrgContext:async i=>(await t("PUT","/v1/org/context",{body:{markdown:i}})).revision,orgStarters:async i=>(await t("GET",i?.all?"/v1/org/starters?all=1":"/v1/org/starters")).starters??[],retireOrgStarter:async(i,s)=>(await t("POST",`/v1/org/starters/${encodeURIComponent(i)}/versions/${encodeURIComponent(s)}/retire`)).starter,startOrgStarterUpload:async(i,s)=>(await t("POST",`/v1/org/starters/${encodeURIComponent(i)}/versions`,{body:s})).upload,confirmOrgStarter:async(i,s)=>(await t("POST",`/v1/org/starters/${encodeURIComponent(i)}/versions/${encodeURIComponent(s)}/confirm`)).starter,scaffoldOrgStarter:(i,s)=>t("POST",`/v1/org/starters/${encodeURIComponent(i)}/versions/${encodeURIComponent(s)}/scaffold`),pruneBundle:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/bundle`,{body:{filenames:s}}),bundleFiles:async i=>(await t("GET",`/v1/games/${encodeURIComponent(i)}/files`)).files??[],async getGame(i){try{return r(await t("GET",`/v1/games/${encodeURIComponent(i)}`))}catch(s){if(s instanceof Le&&s.status===404)return;throw s}},setAwake:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/state`,{body:{awake:s}}),setDestination:(i,s,l)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/destinations`,{body:{destination_id:s,enabled:l}}),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`),renameGame:async(i,s)=>{let l=await t("POST",`/v1/games/${encodeURIComponent(i)}/rename`,{body:{name:s}});return{...l,previous:typeof l.previous=="string"?l.previous:"",studio:l.studio??"none"}},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`),async practiceRound(i,s){try{return await t("POST",`/v1/games/${encodeURIComponent(i)}/practice`,{body:{round:s}})}catch(l){throw l instanceof Le&&l.status===404&&!/no such game|no game with id/i.test(l.message)?new Le(404,"not_supported","This control plane cannot serve a practice round yet. It is running a build older than this CLI. Update the CLI's backend, or use an older CLI until it is.",!1):l}},async previewPracticeRound(i,s){try{return await t("POST","/v1/preview/practice",{body:{game:i,round:s}})}catch(l){throw l instanceof Le&&l.status===404&&/unknown resource/i.test(l.message)?new Le(404,"not_supported","This control plane cannot serve a preview round yet. It is running a build older than the connector.",!1):l}},roundSeedCandidates:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/round/candidates`,{body:s}),async seedSeasonDay(i,s){try{return await t("PUT",`/v1/games/${encodeURIComponent(i)}/season/${encodeURIComponent(s.name)}`,{body:{dayStart:s.dayStart,dayEnd:s.dayEnd,round:s.round,...s.overwrite?{overwrite:!0}:{}}})}catch(l){throw l instanceof Le&&l.status===404&&!/no such game|no game with id/i.test(l.message)?new Le(404,"not_supported","This control plane cannot take a season yet. It is running a build older than this CLI.",!1):l}},async seedRound(i,s,l){try{return await t("PUT",`/v1/games/${encodeURIComponent(i)}/round`,{body:{round:s,...l}})}catch(d){throw d instanceof Le&&d.status===404&&!/no such game|no game with id/i.test(d.message)?new Le(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):d}},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 Le&&s.status===404)return;throw s}},async getGameUsage(i){try{return await t("GET",`/v1/games/${encodeURIComponent(i)}/usage`)}catch(s){if(s instanceof Le&&s.status===404)return;throw s}},async getLogs(i,s,l){let{lines:d}=await t("GET",`/v1/games/${encodeURIComponent(i)}/logs`,{query:s,signal:l});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:MI}:{datasets:i.datasets,unavailable:i.unavailable??null}}catch(i){if(i instanceof Le&&i.status===404)return{datasets:[],unavailable:MI};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 Le&&s.status===404)return;throw s}},async previewDataset(i,s,l){try{let d=await t("GET",`/v1/reference/preview/${encodeURIComponent(i)}`,{query:{limit:s,by:l}});return d&&Array.isArray(d.rows)?d:void 0}catch(d){if(d instanceof Le&&d.status===404)return;throw d}},async deleteDataset(i){try{return await t("DELETE",`/v1/reference/datasets/${encodeURIComponent(i)}`)}catch(s){if(s instanceof Le&&s.status===404&&s.code===DI)return;throw s}},async downloadDataset(i){try{let s=await t("GET",`/v1/reference/download/${encodeURIComponent(i)}`);return s?.url?s:void 0}catch(s){if(s instanceof Le&&s.status===404&&s.code===DI)return;throw s}},async runDataset(i){return t("POST",`/v1/reference/runs/${encodeURIComponent(i)}`)},async getDatasetRun(i){try{return await t("GET",`/v1/reference/runs/${encodeURIComponent(i)}`)}catch(s){if(s instanceof Le&&s.status===404&&s.code===x5)return;throw s}},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 Le&&s.status===404)return[];throw s}}}}var Le,Lm,zI,jI,DI,x5,MI,GI=x(()=>{"use strict";hm();Qu();wm();mi();Le=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"}},Lm="not_a_control_plane";zI=e=>new Promise(t=>setTimeout(t,e)),jI=!1;DI="no_such_dataset",x5="no_such_run",MI="This control plane is running a build older than this screen, so it cannot list datasets yet."});function BI(e){return e?`npx gamestage@latest deploy ${e} --dir .`:"npx gamestage@latest deploy"}function nr(e,t){let o=v_.exec(e.trim()),r=v_.exec(t.trim());if(!o||!r)return null;for(let n=1;n<=3;n++){let a=Number(o[n])-Number(r[n]);if(a!==0)return a}return 0}function Wr(e,t){if(!e)return{state:"unknown",current:t};let o=nr(e,t);return o===null?{state:"unknown",current:t}:o<0?{state:"behind",pinned:e,current:t}:o>0?{state:"ahead",pinned:e,current:t}:{state:"current",pinned:e,current:t}}function k_(e){let t=new Set;for(let o of e.matchAll(/\/client\/(\d+\.\d+\.\d+)\/gamestage\.js/g))t.add(o[1]);return[...t].sort((o,r)=>nr(o,r)??0)}function qI(e){let t=[...new Set(e)].filter(o=>v_.test(o));if(t.length!==0)return t.sort((o,r)=>nr(o,r)??0)[0]}function WI(e){return/^ \* Gamestage client (\d+\.\d+\.\d+)\.$/m.exec(e.slice(0,600))?.[1]}var v_,__=x(()=>{"use strict";v_=/^(\d+)\.(\d+)\.(\d+)$/});var HI,Dm,Hr,YI=x(()=>{"use strict";__();HI="x-gamestage-cli",Dm="update_required",Hr="npx gamestage@latest"});var VI=x(()=>{"use strict"});var ZI=x(()=>{"use strict";xc();_t();kt();Va()});function JI(e){let o=(Array.isArray(e["elements.json"])?e["elements.json"]:[]).find(i=>i.content_type===Ka.quiz);if(!o)return`The game's App Spec has no quiz question element (${Ka.quiz}), so a producer has nowhere to write a question.`;let a=(Array.isArray(o.custom_fields)?o.custom_fields:[]).flatMap(i=>[...Array.isArray(i.properties)?i.properties:[],...Array.isArray(i.subsections)?i.subsections.flatMap(s=>Array.isArray(s.properties)?s.properties:[]):[]]).find(i=>i.key===ni);if(!a)return`The quiz question element has no "${ni}" field, so the Quiz Engine has no right answer to mark against. Keep it in round_fields: if the manifest has that block.`;if(a.public!==!1)return`The quiz question element's "${ni}" field is public, so every fan's browser would receive the right answer. It must be public: false.`}var KI,x_=x(()=>{"use strict";Dt();At();Va();kt();KI="The Quiz Engine holds"});var XI=x(()=>{"use strict";Va();At();Pm();Nm();Qt()});function QI(e){if(typeof e!="string")return null;let t=/^([a-z][a-z0-9_-]*):([a-zA-Z0-9][a-zA-Z0-9._-]*)$/.exec(e);return t&&fm(t[2])?null:t&&t[0]===e?{provider:t[1],id:t[2]}:null}var Mm=x(()=>{"use strict";gm()});var eO=x(()=>{"use strict";Mm()});var tO,xce,S_,Sce,nO=x(()=>{"use strict";je();Mm();tO=c.string().regex(/^sportmonks:[1-9]\d*$/).refine(e=>{let t=QI(e);return t!==null&&Number.isSafeInteger(Number(t.id))}),xce=c.array(c.object({fixture:tO,games:c.array(c.object({gameId:c.string().min(1),editionId:c.string().min(1)})),addedAt:c.iso.datetime({offset:!0})})),S_=c.object({home:c.number().int().nonnegative(),away:c.number().int().nonnegative()}),Sce=c.object({fixture:tO,sport:c.literal("football"),status:c.enum(["scheduled","live","finished","void","postponed","unknown"]),statusName:c.string(),regulation:S_.nullable(),currentScore:S_.nullable().optional(),finalScore:S_.nullable(),teams:c.object({home:c.string(),away:c.string()}).optional(),startingAt:c.string().nullable(),readAt:c.iso.datetime({offset:!0}),final:c.boolean(),finishedReads:c.number().int().min(0).max(2),finishedSince:c.iso.datetime({offset:!0}).nullable(),minute:c.number().nonnegative().nullable(),notifyPending:c.boolean()})});var Ece,oO=x(()=>{"use strict";je();Ece=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)})});function cO(e){return{type:"team",name:e.trim()}}function $5(e){return e.normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/ø/gi,"o").toLowerCase().trim()}function dO(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let{teams:t,leagues:o,...r}=e,n={...r};return t!==void 0&&n.scope===void 0&&(n.scope=Array.isArray(t)?t.map(a=>typeof a=="string"?cO(a):a):t),o!==void 0&&n.competitions===void 0&&(n.competitions=o),n}function N5(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let{catalogueClubs:t,...o}=e,r={...o};return t!==void 0&&r.catalogueSubjects===void 0&&(r.catalogueSubjects=Array.isArray(t)?t.map(n=>typeof n=="string"?cO(n):n):t),r}function mO(e,t){return e.expiresAt===null||Date.parse(e.expiresAt)>t.getTime()}function wO(e){return e.getUTCMonth()>=6?e.getUTCFullYear():e.getUTCFullYear()-1}var A_,rO,iO,sO,Sc,Ice,T5,Oce,Fm,C_,lO,$_,E5,Pce,A5,Vn,C5,aO,uO,I5,O5,T_,E_,Nce,P5,Rce,R5,zce,z5,j5,I_,O_,L5,D5,M5,jce,Lce,F5,U5,Dce,Mce,pO,hO,fO,gO,yO,bO,P_,Fce,Uce,vO,kO,N_=x(()=>{"use strict";je();A_={GB:{catalogue:"8085",currency:"GBP",label:"United Kingdom"},US:{catalogue:"5042",currency:"USD",label:"United States"}},rO=c.enum(["GB","US"]),iO=["team","player","competition","event","brand"],sO=c.enum(iO),Sc=c.object({type:sO,name:c.string().trim().min(1).max(120)});Ice=new RegExp(`,(?=\\s*(?:${iO.join("|")})\\s*:)`,"i");T5={"Brighton & Hove Albion":["Brighton","Brighton & Hove Albion FC","Brighton and Hove Albion"]},Oce=new Map(Object.entries(T5).flatMap(([e,t])=>[e,...t].map(o=>[$5(o),e]))),Fm=["collectibles","shirts_kit","training_wear","headwear","accessories","gifts"],C_=c.enum(Fm),lO={collectibles:"Collectibles: trading cards and signed memorabilia",shirts_kit:"Shirts and jerseys",training_wear:"Training and leisure wear",headwear:"Headwear",accessories:"Accessories",gifts:"Gifts"},$_=c.object({value:c.string().trim().min(1).max(200),reason:c.string().trim().min(1).max(500),expiresAt:c.string().datetime().nullable(),addedBy:c.string(),addedAt:c.string()}),E5=["products","players","keywords"],Pce=c.enum(E5),A5=90,Vn={productTypes:c.array(C_),scope:c.array(Sc).max(100),competitions:c.array(c.string().trim().min(1).max(80)).max(50),priceMin:c.number().min(0).nullable(),priceMax:c.number().min(0).nullable(),winPriceMax:c.number().min(0).nullable(),countries:c.array(rO).min(1),defaultCountry:rO,kids:c.boolean()};C5=c.preprocess(dO,c.object(Vn).partial().strict()),aO=c.preprocess(dO,c.object({productTypes:Vn.productTypes.default([...Fm]),scope:Vn.scope.default([]),competitions:Vn.competitions.default([]),priceMin:Vn.priceMin.default(null),priceMax:Vn.priceMax.default(null),winPriceMax:Vn.winPriceMax.default(A5),countries:Vn.countries.default(["GB"]),defaultCountry:Vn.defaultCountry.default("GB"),kids:Vn.kids.default(!1)})),uO=["products","video","betting","lead_generation"],I5=c.enum(uO),O5=c.object({enabled:c.boolean(),adTypes:c.array(I5).max(uO.length).default(["products"]),rules:C5.optional()}),T_={impactRequests:60,jevCalls:1500,askedWithinDays:30},E_=c.object({impactRequests:c.number().int().min(1).max(1e3).default(T_.impactRequests),jevCalls:c.number().int().min(1).max(2e4).default(T_.jevCalls),askedWithinDays:c.number().int().min(1).max(90).default(T_.askedWithinDays)}),Nce=E_.partial().strict(),P5=c.object({at:c.string(),by:c.string(),what:c.string()});Rce=c.preprocess(N5,c.object({killSwitch:c.boolean().default(!1),rules:aO.default(aO.parse({})),games:c.record(c.string(),O5).default({}),catalogueSubjects:c.array(Sc).max(200).default([]),pull:E_.default(E_.parse({})),blocklists:c.object({products:c.array($_).default([]),players:c.array($_).default([]),keywords:c.array($_).default([])}).default({products:[],players:[],keywords:[]}),updatedAt:c.string().nullable().default(null),updatedBy:c.string().nullable().default(null),history:c.array(P5).default([])}));R5=c.object({id:c.string(),catalogue:c.string(),name:c.string(),club:c.string(),league:c.string(),imageUrl:c.string(),url:c.string(),price:c.number(),currency:c.string(),inStock:c.boolean(),ageGroup:c.string().nullable(),type:C_.nullable()}),zce=c.enum(["win","neutral","loss"]),z5=c.object({model:c.string(),ownClub:c.number().nullable(),playerOutsideSquad:c.number(),forChildren:c.number(),aboutNewBaby:c.number(),tactless:c.object({win:c.number(),neutral:c.number()}),appeal:c.object({win:c.number(),neutral:c.number()})}),j5=R5.extend({judgments:z5.nullable()}),I_=40,O_=["incomplete","not_the_subject","out_of_stock","untyped"],L5=c.enum(O_),D5=c.object({name:c.string(),team:c.string(),why:L5}),M5=c.object({incomplete:c.number().optional(),not_the_subject:c.number().optional(),out_of_stock:c.number().optional(),untyped:c.number().optional()}),jce=c.object({catalogue:c.string(),query:c.string().optional(),club:c.string(),subject:Sc.optional(),pulledAt:c.string(),fetched:c.number(),candidates:c.array(j5),dropped:c.array(D5).optional()}),Lce=c.object({pulledAt:c.string().nullable(),impact:c.object({ok:c.boolean(),detail:c.string().nullable()}),jev:c.object({ok:c.boolean(),detail:c.string().nullable()}),catalogues:c.array(c.object({catalogue:c.string(),club:c.string(),fetched:c.number(),candidates:c.number(),judged:c.number(),subject:Sc.optional(),pulledAt:c.string().optional(),query:c.string().optional(),dropped:M5.optional()})),reporting:c.enum(["not_available","available"]).default("not_available"),waiting:c.number().optional()}),F5=c.object({gameId:c.string().min(1).max(120),workspaceId:c.string().min(1).max(120),lastAsked:c.string()}),U5=c.object({subject:Sc,team:c.string().max(120).nullable().default(null),firstAsked:c.string(),lastAsked:c.string(),games:c.array(F5)}),Dce=c.object({updatedAt:c.string().nullable().default(null),subjects:c.array(U5).default([])}),Mce=c.object({pulledAt:c.string().nullable().default(null),source:c.string().default(""),players:c.record(c.string(),c.string()).default({}),ambiguous:c.array(c.string()).default([])}),pO=.5,hO=.5,fO=.5,gO=.5,yO=.4,bO=1.5,P_=3,Fce=c.object({productId:c.string(),name:c.string(),imageUrl:c.string(),price:c.number(),currency:c.string(),link:c.string(),type:C_,reasons:c.array(c.string())}),Uce=c.object({type:sO,name:c.string(),of:c.string().optional()});vO=["other_catalogue","out_of_stock","untyped","type_off","outside_team_scope","outside_competition","below_price","above_price","above_win_price","for_children_named","past_season","wall_decor","blocked_product","blocked_player","blocked_keyword"],kO=["not_judged","not_own_club","tactless","player_outside_squad","about_new_baby","for_children","low_appeal"]});var Kce,$c,G5,Tc,Tn,_O,Jce,Xce,xO=x(()=>{"use strict";N_();Kce={switches:{title:"Whether anything shows",lede:"Checked first, before any product is read."},nightly:{title:"Every night, before any fan",lede:"The nightly pull fetches each team's, player's or competition's products and drops these before Jev judges the rest."},finish:{title:"When a fan finishes",lede:"Applied to every judged product the moment a result screen asks. Counted here after a win, with the settings for every game."},order:{title:"What goes first",lede:`Among the products that pass, these decide the ${P_} at most a fan sees.`},privacy:{title:"Privacy",lede:"What is recorded about a fan who sees the panel."}},$c=e=>`${Math.round(e*100)}%`,G5={GBP:"\xA3",USD:"$"},Tc=(e,t)=>{let o=A_[e.defaultCountry].currency,r=G5[o];return r?`${r}${t}`:`${t} ${o}`},Tn=()=>"Always",_O=e=>!e.kids,Jce=[{id:"kill_switch",stage:"switches",name:"Stops every ad at once",protects:"If anything goes wrong, one switch takes every ad out of every game.",kind:"rule",setting:e=>e.killSwitch?"On":"Off",measure:"kill"},{id:"approved_games",stage:"switches",name:"Only games the retail partner has approved",protects:"A game shows nothing until Monterosa switches products on for it, after the retail partner approves.",kind:"rule",setting:e=>{let t=Object.values(e.games).filter(o=>o.enabled&&o.adTypes.includes("products")).length;return t===0?"No game on":`On in ${t} ${t===1?"game":"games"}`},measure:"games"},{id:"not_after_a_loss",stage:"switches",name:"Nothing after a loss",protects:"A fan who has just lost is never sold to.",kind:"rule",setting:Tn,measure:"none",notCounted:"Not counted: after a loss the page does not ask."},{id:"what_the_game_is_about",stage:"switches",name:"Only what the game is about",protects:"Products are for the players, team or competition the game names, never a guess, and never outside a scope Monterosa set.",kind:"rule",setting:(e,t)=>{let o=[...t.scope.map(r=>r.name),...t.competitions];return o.length===0?"Any the game names":`Only ${o.join(", ")}`},measure:"finish",covers:{finish:["outside_team_scope","outside_competition"]}},{id:"own_country",stage:"switches",name:"The fan's own shop",protects:"Prices and stock come from one country's catalogue, never another country's currency.",kind:"rule",setting:(e,t)=>t.countries.map(o=>A_[o].label).join(", "),measure:"finish",covers:{finish:["other_catalogue"]}},{id:"complete_listing",stage:"nightly",name:"Drops broken listings",protects:"A product with no link, picture or price never reaches a fan.",kind:"rule",setting:Tn,measure:"pull",covers:{pull:["incomplete"]}},{id:"another_team",stage:"nightly",name:"Drops another team's stock",protects:`A search for Arsenal also finds an "Everton v Arsenal" scarf; only the shop's own Arsenal stock is kept.`,kind:"rule",setting:Tn,measure:"pull",covers:{pull:["not_the_subject"]}},{id:"in_stock",stage:"nightly",name:"Drops what is out of stock",protects:"A fan is never sent to something they cannot buy.",kind:"rule",setting:Tn,measure:"pull",covers:{pull:["out_of_stock"],finish:["out_of_stock"]}},{id:"recognised_product",stage:"nightly",name:"Drops products we cannot name",protects:"Anything that is not recognisably a shirt, cap, collectible, gift or similar is left out, so nothing odd slips through.",kind:"rule",setting:Tn,measure:"pull",covers:{pull:["untyped"],finish:["untyped"]}},{id:"judged_per_subject",stage:"nightly",name:"Judges a mix, not the whole shop",protects:`Jev judges up to ${I_} products per team, player or competition each night, one of each type in turn, so sixty shirts never crowd out a cap.`,kind:"rule",setting:()=>`${I_} per team, player or competition`,measure:"unjudged"},{id:"judged_first",stage:"finish",name:"Nothing unjudged",protects:"A product Jev could not judge is never shown.",kind:"rule",setting:Tn,measure:"finish",covers:{finish:["not_judged"]}},{id:"product_types",stage:"finish",name:"Only the product types switched on",protects:"Monterosa chooses which kinds of product a game may show.",kind:"rule",setting:(e,t)=>t.productTypes.length===Fm.length?"All six types":t.productTypes.length===0?"None":t.productTypes.map(o=>lO[o].split(":")[0]).join(", "),measure:"finish",covers:{finish:["type_off"]}},{id:"price",stage:"finish",name:"Keeps to a price range",protects:"Keeps expensive items off the screen of a fan who has just played a free game.",kind:"rule",setting:(e,t)=>t.priceMin===null&&t.priceMax===null?"No limit":t.priceMin===null?`Up to ${Tc(t,t.priceMax)}`:t.priceMax===null?`From ${Tc(t,t.priceMin)}`:`${Tc(t,t.priceMin)} to ${Tc(t,t.priceMax)}`,measure:"finish",covers:{finish:["below_price","above_price"]}},{id:"win_price",stage:"finish",name:"Caps the price on the result screen",protects:"A fan who has just played is offered what most fans buy, a replica shirt rather than a \xA3135 authentic one.",kind:"rule",setting:(e,t)=>t.winPriceMax===null?"No cap":`Up to ${Tc(t,t.winPriceMax)}`,measure:"finish",covers:{finish:["above_win_price"]}},{id:"children_named",stage:"finish",name:"Drops children's products by name",protects:"Anything labelled kids, baby, junior or youth stays off unless Monterosa allows children's products.",kind:"rule",setting:(e,t)=>_O(t)?"On: children's products kept off":"Off: children's products allowed",measure:"finish",covers:{finish:["for_children_named"]}},{id:"past_season",stage:"finish",name:"Drops last season's stock",protects:'A shirt, sticker or card set for a past season ("24-25", or "Topps 2026" in 2026-27) looks stale, though signed and framed collectibles are kept.',kind:"rule",setting:(e,t,o)=>{if(!o)return"Worked out from the date";let r=wO(o);return`Before ${r}-${String((r+1)%100).padStart(2,"0")}, from the date`},measure:"finish",covers:{finish:["past_season"]}},{id:"wall_stickers",stage:"finish",name:"Drops wall stickers",protects:"A fan at a result screen is not shopping for a wall.",kind:"rule",setting:Tn,measure:"finish",covers:{finish:["wall_decor"]}},{id:"blocklists",stage:"finish",name:"Drops what Monterosa has blocked",protects:"Any product, player or word Monterosa blocks, each with a reason and an optional end date.",kind:"rule",setting:(e,t,o)=>{let r=l=>e.blocklists[l].filter(d=>!o||mO(d,o)).length,[n,a,i]=[r("products"),r("players"),r("keywords")];if(n+a+i===0)return"Nothing blocked";let s=(l,d,u)=>`${l} ${l===1?d:u}`;return[s(n,"product","products"),s(a,"player","players"),s(i,"word","words")].join(", ")},measure:"finish",covers:{finish:["blocked_product","blocked_player","blocked_keyword"]}},{id:"rival_club",stage:"finish",name:"Drops a rival club's shirt",protects:"Catches a product filed under the right team that is really for another club's fans.",kind:"judgment",setting:()=>`Below ${$c(pO)} sure it is the club's`,measure:"finish",covers:{finish:["not_own_club"]}},{id:"tactless",stage:"finish",name:"Drops anything tactless",protects:"Gloating, a rival's celebration, a defeat or a sensitive event: anything that would embarrass the brand showing it.",kind:"judgment",setting:()=>`${$c(hO)} sure or more`,measure:"finish",covers:{finish:["tactless"]}},{id:"player_left",stage:"finish",name:"Drops players who have left",protects:"A shirt printed for a player no longer in the club's squad is out of date, though signed memorabilia of a former player is kept.",kind:"judgment",setting:()=>`${$c(fO)} sure or more`,measure:"finish",covers:{finish:["player_outside_squad"]}},{id:"new_baby",stage:"finish",name:"Drops new-baby gifts",protects:"A birth card or a newborn gift is never the right thing after a game.",kind:"judgment",setting:()=>`${$c(yO)} sure or more`,measure:"finish",covers:{finish:["about_new_baby"]}},{id:"children_judged",stage:"finish",name:"Drops what is made for children",protects:"Catches children's products the name does not give away, while children's products are off.",kind:"judgment",setting:(e,t)=>_O(t)?`${$c(gO)} sure or more`:"Off: children's products allowed",measure:"finish",covers:{finish:["for_children"]}},{id:"low_appeal",stage:"finish",name:"Drops what a fan would not want now",protects:"Jev scores how much a fan would want each product after that result, from 0 to 3, and anything lukewarm is left out.",kind:"judgment",setting:()=>`Below ${bO.toFixed(1)} of 3`,measure:"finish",covers:{finish:["low_appeal"]}},{id:"player_first",stage:"order",name:"The game's player first",protects:"A product naming the player the game is about leads, so a fan sees their player's shirt before a mug.",kind:"rule",setting:Tn,measure:"none",notCounted:"Decides the order; drops nothing."},{id:"player_club",stage:"order",name:"A player brings their club",protects:"When a game names only players, their current clubs' products can show too, taken from the Premier League squads and never guessed.",kind:"rule",setting:Tn,measure:"players"},{id:"replica_first",stage:"order",name:"Replica before authentic",protects:"The shirt most fans buy comes before the dearer player-cut version of the same design.",kind:"rule",setting:Tn,measure:"none",notCounted:"Decides the order; drops nothing."},{id:"one_per_design",stage:"order",name:"One of each design",protects:"The same shirt with another name on the back, or in another cut, shows once.",kind:"rule",setting:Tn,measure:"designs"},{id:"variety",stage:"order",name:"A mix on screen",protects:"One of each product type before a second of any, so three shirts never fill the panel when a cap would do, and no second at all when the round names a competition.",kind:"rule",setting:()=>`Up to ${P_} products`,measure:"none",notCounted:"Decides the order; drops nothing."},{id:"consent",stage:"privacy",name:"Counted only with consent",protects:"Showing the panel is recorded only when the fan agreed to marketing and analytics, and a link never carries who the fan is.",kind:"rule",setting:()=>"Marketing and analytics",measure:"none",notCounted:"Decided on the fan's page; nothing is counted here."}],Xce={pull:O_,finish:[...vO,...kO]}});var SO=x(()=>{"use strict";_t()});function $O(e){return e?Ec.find(t=>t.formats.includes(e)):void 0}var Ec,TO=x(()=>{"use strict";lc();Ec=[{id:"typesafe",label:"TypeSafe",signUp:"https://typesafe.ai",purpose:"Pays for Jev, the AI judge that answers fans' questions in your Mystery games. Each question costs a fraction of a cent, charged to your TypeSafe account.",formats:["mystery"]}]});var B5,ale,EO=x(()=>{"use strict";_t();B5="Regular Season,Playoffs,PlayIn",ale=`career-cache.${B5.toLowerCase().replace(/[^a-z]+/g,"-").replace(/^-|-$/g,"")}.json`});function R_(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=It.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:Bu(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 AO(e,t){let o=R_(e);return o.ok&&(await t("copy",e),await t("pointer",e)),o}function CO(e,t){return e?e.filter(o=>!t.scored.includes(o)):[]}var IO=x(()=>{"use strict";_t()});function PO(e){let t=e.replace(/^/,"").trimStart();if(t.startsWith("{")||t.startsWith("[")){let r;try{r=JSON.parse(t)}catch(n){throw new Pt(`It starts like JSON and does not parse: ${n instanceof Error?n.message:String(n)}`)}return V5(r)}let[o]=LO(t);if(!o||!o.records.length)throw new Pt("It is neither JSON nor a CSV with a header row and at least one row of data.");return{...NO("$",o.records,!1),format:"csv"}}function V5(e){if(Yr(e)&&"corpus"in e){let t=It.safeParse(e);if(t.success)return Z5(t.data);let o=t.error.issues[0];return{...OO(e),kind:"invalid-dataset",problem:o?`${o.path.join(".")||"document"}: ${o.message}`:"It does not match the dataset format."}}return OO(e)}function Z5(e){let t=new Set,o=e.measures.map(r=>{let n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,i=0;for(let[s,l]of Object.entries(r.values))t.add(s),i+=1,l<n&&(n=l),l>a&&(a=l);return{key:r.key,label:r.label,count:i,range:i?{min:n,max:a}:null,scale:r.scale??null,scoring:!!r.scoring}});return{format:"json",kind:"dataset",problem:null,dataset:{entities:t.size,measures:o,labelled:Object.keys(e.entries??{}).length,sampleKeys:[...t].slice(0,5)},lists:[],chosen:null,keyCandidates:[],measureCandidates:[],labelCandidates:[],notMeasures:[],codes:[]}}function OO(e){let t=[];if(Gm(e,"$",0,t),!t.length)return{...K5(),kind:"nothing"};let o=[...t].sort((n,a)=>a.list.length-n.list.length||n.list.path.length-a.list.path.length)[0];return{...NO(o.list.path,o.records,o.list.keyed),lists:t.map(n=>n.list)}}function K5(){return{format:"json",kind:"nothing",problem:null,dataset:null,lists:[],chosen:null,keyCandidates:[],measureCandidates:[],labelCandidates:[],notMeasures:[],codes:[]}}function Gm(e,t,o,r){if(o>W5)return;if(Array.isArray(e)){let i=e.filter(Yr);i.length&&i.length>=e.length/2&&(r.push({list:{path:t,length:i.length,keyed:!1},records:i}),Gm(i[0],`${t}[0]`,o+1,r));return}if(!Yr(e))return;let n=Object.entries(e),a=n.filter(([,i])=>Yr(i));if(a.length>=Y5&&a.length>=n.length*.8){let i=a.map(([s,l])=>({"(key)":s,...l}));r.push({list:{path:`${t}{}`,length:i.length,keyed:!0},records:i});return}for(let[i,s]of n)Gm(s,`${t}.${i}`,o+1,r)}function NO(e,t,o){let r=t.slice(0,q5).filter(Yr),n=new Map;for(let w of r)for(let[_,I]of L_(w,"",0)){let M=n.get(_);M||(M=X5(),n.set(_,M)),Q5(M,I)}let a=r.length,i=[...n.entries()].map(([w,_])=>eq(w,_,a)),s=i.filter(w=>{let _=(w.kinds.string??0)+(w.kinds["numeric-string"]??0),I=(w.kinds.number??0)>0&&w.decimals===0;return w.present===a&&w.distinct===a&&a>1&&(_===a||I)}).map(w=>w.name).sort((w,_)=>Um(w)-Um(_)),l=new Set(s.filter((w,_)=>_===0||Um(w)<=3)),d=[],u=[],p=[];for(let w of i)if(!(l.has(w.name)||!w.range)&&!(w.distinct<2||w.coverage<.5)){if(J5(w.name)){p.push(w.name);continue}if(w.range.min<0){d.push({field:w.name,reason:"holds negative numbers, which a dataset cannot store yet (GS-350)"});continue}u.push(w.name)}let f=new Map(i.map(w=>[w.name,w])),g=w=>{let _=f.get(w);return(_.present-(_.kinds.null??0))/Math.max(a,1)};u.sort((w,_)=>g(_)-g(w)||f.get(_).distinct-f.get(w).distinct);let b=i.filter(w=>(w.kinds.string??0)>=a*.9&&w.distinct>=a*.5&&Um(w.name)>3).map(w=>w.name).sort((w,_)=>z_(w)-z_(_));return{format:"json",kind:a?"records":"nothing",problem:null,dataset:null,lists:[{path:e,length:t.length,keyed:o}],chosen:{path:e,length:t.length,keyed:o,fields:i},keyCandidates:s,measureCandidates:u,labelCandidates:b,notMeasures:d,codes:p}}function J5(e){let t=e.split(".").pop().toLowerCase();return/(^|_)(rank|rank_type|code|type|order|id|ids|team|region|position)$/.test(t)}function Um(e){let t=e.split(".").pop().toLowerCase();return t==="(key)"?0:t==="id"?1:/(^|_)id$|id$/i.test(t)?2:/key|code|slug/.test(t)?3:z_(e)<2?5:4}function z_(e){let t=e.split(".").pop().toLowerCase();return/^(display_?name|full_?name|name|web_name|title|label)$/.test(t)?0:/name|title|label/.test(t)?1:2}function X5(){return{present:0,kinds:{},distinct:new Set,min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY,allNumeric:!0,decimals:0,samples:[]}}function Q5(e,t){if(t===void 0)return;e.present+=1;let o,r=null;if(t===null)o="null";else if(typeof t=="number"&&Number.isFinite(t))o="number",r=t;else if(typeof t=="string"){let a=t.trim();RO.test(a)?(o="numeric-string",r=Number(a)):o="string"}else typeof t=="boolean"?o="boolean":Array.isArray(t)?o="array":o="object";if(e.kinds[o]=(e.kinds[o]??0)+1,o==="null")return;let n=typeof t=="object"?JSON.stringify(t):String(t);if(e.distinct.size<1e4&&e.distinct.add(n),e.samples.length<3&&!e.samples.includes(n)&&e.samples.push(n.slice(0,60)),r===null){e.allNumeric=!1;return}e.min=Math.min(e.min,r),e.max=Math.max(e.max,r),e.decimals=Math.max(e.decimals,zO(r))}function zO(e){if(Number.isInteger(e))return 0;let t=String(e),o=t.indexOf(".");return o===-1?0:Math.min(t.length-o-1,6)}function eq(e,t,o){let r=(t.kinds.number??0)+(t.kinds["numeric-string"]??0),n=t.present-(t.kinds.null??0),a=t.allNumeric&&r>0&&r===n;return{name:e,present:t.present,coverage:o?t.present/o:0,kinds:t.kinds,distinct:t.distinct.size,range:a?{min:t.min,max:t.max}:null,decimals:a?t.decimals:0,samples:t.samples}}function L_(e,t,o){let r=[];for(let[n,a]of Object.entries(e)){let i=t?`${t}.${n}`:n;Yr(a)&&o+1<H5?r.push(...L_(a,i,o+1)):r.push([i,a])}return r}function Yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tq(e){let t=[],o=[],r="",n=!1;for(let a=0;a<e.length;a+=1){let i=e[a];if(n){i==='"'&&e[a+1]==='"'?(r+='"',a+=1):i==='"'?n=!1:r+=i;continue}i==='"'&&r===""?n=!0:i===","?(o.push(r),r=""):i===`
|
|
277
|
+
`),q=new Set(zr()),L=[...[...wc(G)].map(se=>`css_variables_${se}`).filter(se=>q.has(se)),...po(G)].filter(se=>!I[se]?.trim());L.length&&r.push({check:Mk,problem:bc(L)});let{unnamed:j}=wo(I,N);j.length&&r.push({check:Mk,problem:vo(j)});let Q=Gr(I,N);Q.length&&r.push({check:Mk,problem:Br(Q)})}return{problems:r,manifest:a}}var nn,BG,qG,WG,HG,one,qr,VG,ZG,KG,JG,XG,QG,eB,Mk,Uk=x(()=>{"use strict";je();Ok();At();om();tc();ju();sm();Dt();Dk();go();ho();nn="gamestage-starter.json",BG=25*1024*1024,qG=2e3,WG=100*1024*1024,HG=c.object({name:c.string(),version:c.string(),description:c.string().min(1).max(280),framework:c.string().min(1).max(40),formats:c.array(c.string().transform(Re),{error:`name the formats this starter app's page plays, from ${bt.join(", ")}, such as ["predict"]`}).min(1,`name the formats this starter app's page plays, from ${bt.join(", ")}, such as ["predict"]`).refine(e=>e.every(t=>bt.includes(t)),`each format must be one of ${bt.join(", ")}`).transform(e=>[...new Set(e)]),build:c.string().min(1).max(200).optional(),out:c.string().min(1).max(200).refine(e=>!Z2(e),"must be a folder inside the starter, such as dist").optional()}),one=c.object({version:c.string(),bytes:c.number().int().positive()});qr="size and paths";VG=/\.(html?|m?js|cjs|jsx|tsx?|mts|cts|vue|svelte|astro|css|scss|json|ya?ml|toml|md|txt|xml|ini|conf|properties|env)$/i,ZG=/\.(html?|m?js|cjs|jsx|tsx?|mts|cts|vue|svelte|astro)$/i,KG=/\.(pem|key|crt|cer|p12|pfx|pub|asc|gpg)$/i,JG=/(^|\/)(\.[^/.]+|[^/.]+)$/,XG=2*1024*1024;QG=/\.(html?|m?js|cjs|jsx|tsx?|mts|cts|vue|svelte|astro|css|scss)$/i,eB=new Set(["gamestage.js","gamestage-player.js"]),Mk="words in gamestage.settings.json"});function Gk(e){let t=e.split("/").pop()??e,o=t.lastIndexOf(".");return o<=0?J2:tB[t.slice(o+1).toLowerCase()]??J2}function mm(e){let t=e/1048576;return t>=1?`${Number.isInteger(t)?t:t.toFixed(1)} MB`:`${Math.ceil(e/1024)} KB`}function Bk(e,t,o){let r=t===void 0?"too big":mm(t);return`${e} is ${r}, and Gamestage takes files up to ${mm(o)} each. Make it smaller and try again.`}var pm,tB,J2,hm=x(()=>{"use strict";pm="post",tB=Object.freeze({html:"text/html; charset=utf-8",css:"text/css; charset=utf-8",js:"text/javascript; charset=utf-8",mjs:"text/javascript; charset=utf-8",json:"application/json; charset=utf-8",webmanifest:"application/manifest+json; charset=utf-8",wasm:"application/wasm",svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",ico:"image/x-icon",mp3:"audio/mpeg",ogg:"audio/ogg",oga:"audio/ogg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mov:"video/quicktime",woff2:"font/woff2",woff:"font/woff",ttf:"font/ttf",otf:"font/otf",glb:"model/gltf-binary"}),J2="application/octet-stream"});function X2(e,t="USD"){let o=t==="USD"?"$":`${t} `;return e===0?`${o}0.00`:e<1e-4?`under ${o}0.0001`:e<.01?`${o}${e.toFixed(4)}`:`${o}${e.toFixed(2)}`}function Q2(e){let t=e.currency==="USD"?"$":`${e.currency} `,o=`${t}${e.inputPerMTok} per million input tokens`,r=e.outputPerMTok?`${t}${e.outputPerMTok} per million output tokens`:"output free";return`${o}, ${r}`}var qk=x(()=>{"use strict"});function fm(e){return eI.test(e)}function tI(e){return e.createdAt+oB}function nI(e,t){return e.stopped||t>=tI(e)}function oI(e,t){if(!e.playing||e.stopped)return e.elapsed;let o="createdAt"in e?Math.min(t,tI(e)):t;return e.elapsed+Math.max(0,o-e.changedAt)/1e3*e.speed}function Wk(e,t){return!nI(e,t)&&oI(e,t)<rB}function rI(e,t){let o=nI(e,t);return{id:e.id,seed:e.seed,speed:e.speed,elapsed:oI(e,t),playing:e.playing&&!o,stopped:o,createdAt:e.createdAt}}var eI,lne,nB,dne,oB,une,rB,gm=x(()=>{"use strict";je();go();eI=/^sim-[0-9a-f]{8}$/;lne=c.object({id:c.string().regex(eI),seed:c.number().int(),speed:c.number().positive(),elapsed:c.number().nonnegative(),changedAt:c.number(),playing:c.boolean(),stopped:c.boolean(),createdAt:c.number(),createdBy:c.string().nullable()}),nB=c.object({seed:c.number().int().min(1).max(9999).default(6),speed:c.number().min(1).max(120).default(30),elapsed:c.number().min(0).max(1e4).default(0)}),dne=c.enum(["pause","play","stop"]),oB=24*36e5,une=10*6e4,rB=6300});var Hk=x(()=>{"use strict"});function aI(e){return e==="requested"||e==="with_monterosa"||e==="with_partner"}function ym(e){if(!e||typeof e!="object")return null;let t=lB.safeParse(e);return t.success?t.data:null}function Yk(e){let t=e&&typeof e=="object"?e:{};return{request:ym(t.request),...typeof t.refused=="string"?{refused:t.refused}:{},...typeof t.code=="string"?{code:t.code}:{},...t.products==="on"||t.products==="off"||t.products==="not_set_up"?{products:t.products}:{}}}function bm(e){if(!e)return{headline:"Not requested.",next:"You can ask for partner products on your result screen. Using them is subject to approval by Monterosa and the retail partner, and to commercial terms agreed with Monterosa."};switch(e.state){case"requested":return{headline:"Requested. Waiting for Monterosa to pick it up.",next:"Monterosa reads your answers, then takes the request to the retail partner. You can still change your answers until then."};case"with_monterosa":return{headline:"With Monterosa.",next:"Monterosa is checking your answers and may email you with questions before taking the request to the retail partner."};case"with_partner":return{headline:"With the retail partner.",next:"The retail partner decides where its products appear. Monterosa tells you when they answer, and agrees commercial terms with you before anything goes live."};case"approved":return{headline:"Approved. Products are switched on for this game.",next:"Fans who win or finish without losing see up to three partner products on the result screen. Use is subject to the commercial terms agreed with Monterosa."};case"declined":return{headline:`Declined.${e.reason?` ${e.reason.replace(/\.?$/,".")}`:""}`,next:"Products stay off for this game. If something has changed, you can ask again."};case"not_wanted":return{headline:"You said you do not want products in this game.",next:"Nobody will ask again. If you change your mind, request them from this page or with `gamestage ads request`."}}}function Vk(e){let t=e.filter(n=>n.state!=="not_wanted"),o=t.filter(n=>aI(n.state)).sort((n,a)=>n.requestedAt.localeCompare(a.requestedAt)),r=t.filter(n=>!aI(n.state)).sort((n,a)=>a.updatedAt.localeCompare(n.updatedAt));return[...o,...r]}var aB,iI,iB,fne,sI,sB,cB,lB,dB,wm=x(()=>{"use strict";je();aB=["requested","with_monterosa","with_partner","approved","declined","not_wanted"],iI=c.enum(aB),iB=["requested","with_monterosa","with_partner","approved","declined"],fne=c.enum(iB);sI=c.object({audience:c.string().trim().min(1,"Say who the game is for.").max(500),wherePlayed:c.string().trim().min(1,"Say where the game is played.").max(500),countries:c.string().trim().min(1,"Say which countries its fans are in.").max(300),prize:c.boolean(),note:c.string().trim().max(1e3).nullable().default(null)}),sB=c.object({kind:c.enum(["creator","operator"]),id:c.string(),email:c.string().nullable().default(null)}),cB=c.object({state:iI,at:c.string(),by:sB,reason:c.string().nullable().default(null)}),lB=c.object({gameId:c.string(),workspaceId:c.string(),gameName:c.string().nullable().default(null),ownerEmail:c.string().nullable().default(null),facts:sI.nullable().default(null),state:iI,reason:c.string().nullable().default(null),requestedAt:c.string(),updatedAt:c.string(),history:c.array(cB).default([])});dB=c.union([c.object({wanted:c.literal(!0).default(!0),facts:sI}),c.object({wanted:c.literal(!1)})])});var mB,cI,pB,vm,kne,km=x(()=>{"use strict";je();_t();Hu();mB=12,cI=12,pB=["espn"],vm=e=>pB.includes(e),kne=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(mB),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()})});function Zk(e,t){if(e.origin==="pull")return{refused:{code:"pulled",message:`${e.name} is pulled from ${e.supplier&&Yu(e.supplier)?.label||e.supplier||"a source"} on a schedule, so removing it would last until the next pull. Switch the source off instead.`},usedBy:[]};let o=t.filter(n=>n.state!=="archived"),r=_m(o,e);return r.length?{refused:{code:"in_use",message:`${r.length===1?"A game reads":`${r.length} games read`} ${e.name}, and its next round would be refused without it.`},usedBy:r}:null}function _m(e,t){return e.filter(o=>o.referenceName===t.name).map(o=>({gameId:o.id,gameName:o.name??"",pinnedDigest:o.referenceDigest??null,stale:!!o.referenceDigest&&o.referenceDigest!==t.digest,roundIds:(o.rounds??[]).map(r=>r.id)}))}var hB,lI,dI,Tne,uI,Ene,Ane,Cne,Ine,One,fB,gB,Pne,Nne,Rne,xm=x(()=>{"use strict";je();_t();lc();hB=c.enum(["push","pull"]),lI=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:hB.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)}),dI=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([])}),Tne=c.object({dataset:lI,usedBy:c.array(dI).default([])}),uI=c.enum(["pushed","pulled","joined","refused","failed"]),Ene=c.object({at:c.string(),event:uI,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)}),Ane=c.object({dataset:c.string().optional(),gameId:c.string().optional(),event:c.array(uI).optional(),since:c.string().optional(),search:c.string().optional(),before:c.string().optional(),limit:c.number().int().positive().max(500).default(100)}),Cne=c.object({datasets:c.array(lI).default([]),unavailable:c.string().nullable().default(null)}),Ine=c.object({name:c.string().min(1),deleted:c.boolean(),digest:c.string().nullable().default(null),refused:c.object({code:c.enum(["in_use","pulled"]),message:c.string()}).nullable().default(null),usedBy:c.array(dI).default([])}),One=c.object({name:c.string().min(1),digest:c.string(),bytes:c.number().int().nonnegative().default(0),url:c.string().min(1),expiresInSeconds:c.number().int().positive()}),fB=c.enum(["running","published","unchanged","refused","not_pulled"]),gB=c.object({name:c.string().min(1),state:fB,requestedAt:c.string(),finishedAt:c.string().optional(),digest:c.string().optional(),entries:c.number().int().nonnegative().optional(),measures:c.array(c.string()).optional(),sampleKeys:c.array(c.string()).optional(),requests:c.number().int().nonnegative().optional(),skipped:c.number().int().nonnegative().optional(),reason:c.string().optional()}),Pne=c.object({name:c.string().min(1),refused:c.literal(!0),message:c.string(),retryAt:c.string(),last:gB.optional()}),Nne=15*6e4,Rne=new Intl.Collator("en",{numeric:!0})});var bB,qne,Kk=x(()=>{"use strict";je();mi();_t();km();xm();bB=c.enum(["game.deleted","operator.request","workspace.closed"]),qne=c.object({kind:c.enum(["engine","workspace"]),target:c.string(),workspaceId:c.string(),gameId:c.string().nullable(),reason:bB,requestedAt:c.string(),dueBy:c.string(),completedAt:c.string().nullable(),attempts:c.number().int(),lastError:c.string().nullable(),deleted:c.number().int(),engine:c.enum(["gamestage","arcade","deduction","quiz"]).optional()})});function kB(e){return`slate-${e+1}`}function Sm(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:kB(o),label:t.label??"",entries:t.entries.map(r=>({key:r.key,label:r.label??""}))}))}}var wB,vB,Xk,_o=x(()=>{"use strict";je();kt();wB=c.object({key:c.string().min(1),label:c.string().default(""),note:c.string().optional()}),vB=c.object({id:c.string().min(1),label:c.string().default(""),entries:c.array(wB).min(1)}),Xk=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(vB).min(1)})});function vc(e){return Lt(e,"draws_allowed")}var Qk,e_=x(()=>{"use strict";Dt();Qk=[{key:"round_solution",label:"The phrase",type:"freetext",description:'The word or phrase a fan solves, e.g. "George Russell". A fan sees one tile per letter, grouped by word, with "What a fan is told" as the hint. Accents and punctuation are kept for the reveal and ignored when marking. Leave it empty for an ordinary board. Never shown to a fan. This is the answer, so it is withheld from the feeds a browser reads.',readBy:"The Engine, which draws letters from it and marks a solve against it.",section:"This round",public:!1},{key:"round_draws",label:"Letters a fan draws",type:"number",description:'With "The phrase": how many letters a fan may draw before they must have solved it. Leave it empty for 3.',readBy:"The Engine.",section:"This round"},{key:"round_draw_order",label:"Order of the letters",type:"list",options:[{name:"The same for every fan",value:"seeded"},{name:"Different for each fan",value:"random"}],default:"seeded",description:'With "The phrase": the same order gives every fan the same letters in the same order, so results compare and can be shared without a spoiler. A different order per fan makes each play its own.',readBy:"The Engine.",section:"This round"}]});function kc(e){return Lt(e,"guesses_allowed")}var mI,pI,hI,fI,gI,yI,t_,$m=x(()=>{"use strict";Dt();mI="round_guess_answer",pI="round_guess_count",hI="round_guess_feedback",fI="round_guess_words",gI="round_guess_clues",yI="round_guess_picture",t_=[{key:mI,label:"The answer",type:"freetext",description:'The word or number a fan guesses, e.g. "ALLOY" or "1966". A whole number makes it a number round, where a fan is told higher or lower; anything else is a word, where a fan sees one tile per letter. Case and accents are ignored when marking. Leave it empty for an ordinary board. Never shown to a fan before they finish. This is the answer, so it is withheld from the feeds a browser reads.',readBy:"The Engine, which marks every guess against it.",section:"This round",public:!1},{key:pI,label:"Guesses a fan gets",type:"number",description:'With "The answer": how many guesses a fan gets, from 1 to 20. A skip spends one. Leave it empty for 6.',readBy:"The Engine.",section:"This round"},{key:hI,label:"What a fan is told after each guess",type:"list",options:[{name:"Each letter's colour (words)",value:"letters"},{name:"Higher or lower (numbers)",value:"higher_lower"},{name:"Only right or wrong",value:"none"}],description:'With "The answer": leave it empty for letter colours on a word and higher or lower on a number.',readBy:"The Engine.",section:"This round"},{key:fI,label:"Accept only real words",type:"list",options:[{name:"Any letters",value:"any"},{name:"Real words only",value:"words"}],default:"any",description:'With a word in "The answer": "Real words only" refuses a guess that is not an English word, without spending it. Works for answers of 4 to 7 letters.',readBy:"The Engine.",section:"This round"},{key:gI,label:"Clues",type:"freetext",description:'With "The answer": one clue per line, or separated by "|". A fan sees the next clue after each wrong guess or skip, in order. Never shown to a fan before they earn it, so it is withheld from the feeds a browser reads.',readBy:"The Engine, which hands each clue to the fan who earned it.",section:"This round",public:!1},{key:yI,label:"Picture",type:"image",description:'With "The answer": a picture a fan guesses from, such as a photograph for guess the year. Shown to every fan from the start, so pick one that does not give the answer away on its own. Leave it empty for none.',readBy:"The game's page, which shows it above the guess.",section:"This round"}]});var _B,xB,SB,n_,Tm=x(()=>{"use strict";kt();_B="hunt_points_by_turn",xB="hunt_points_for_playing",SB="hunt_points_for_correct",n_=[{key:_B,label:"Points by turn",type:"freetext",description:'Points for a correct answer on the first turn, the second, and so on, separated by commas, e.g. "10, 6, 3". A turn is a letter drawn in a solve-the-phrase game, or a guess in a guess game. A correct answer after more turns than you list earns nothing from this box. Leave every points box empty to score the turns left plus one.',readBy:"The control plane, which writes it onto each round for the Engine to score.",section:"Points"},{key:xB,label:"Points for playing",type:"number",description:"Points every fan earns for finishing a round, won or lost. Leave it empty for none.",readBy:"The control plane, which writes it onto each round for the Engine to score.",section:"Points"},{key:SB,label:"Points for a correct answer",type:"number",description:'A flat amount for a correct answer, on top of "Points by turn". Use this alone to give every winner the same. Leave it empty for none.',readBy:"The control plane, which writes it onto each round for the Engine to score.",section:"Points"}]});function wI(e){return e.includes(bI)}var $B,bI,o_,Em=x(()=>{"use strict";kt();$B="push_compare",bI="each_at_least_last",o_=[{key:$B,label:"How picks are judged",type:"list",options:[{name:"Add up: going over the target is out",value:"total"},{name:"Chain: each pick at least the last",value:bI}],default:"total",description:"Add up: a fan's picks are added together and going over the round's target ends the round. Chain: each pick must be worth at least as much as the one before it, the first lower pick ends the round, and the score is how many picks held. A chain round has no target, so leave each round's target empty.",readBy:"The control plane, which writes it onto each round for the Engine to mark.",section:"Rules"}]});function LB(e){let t=vc(e),o=kc(e),r=pv(e),n=hv(e),a=mv(e),i=uv(e),s=dv(e);return jB.filter(l=>CB.has(l)?t:zB.has(l)?o:IB.has(l)?r:OB.has(l)?n:PB.has(l)?a:NB.has(l)?i:RB.has(l)?s:Lt(e,l))}function DB(e){return[...vc(e)||kc(e)?EB:[],...wI(e)?AB:[]]}function _I(e){return[...Ou(e),...LB(e),...DB(e)]}var vI,TB,r_,kI,EB,AB,CB,IB,OB,PB,NB,RB,zB,jB,Am=x(()=>{"use strict";Dt();e_();$m();Tm();Em();Xs();vI="products_about",TB={key:vI,label:"Products about",type:"list",options:[{name:"The answer",value:"answer"},{name:"What the answer belongs to",value:"parent"},{name:"The game's theme",value:"theme"},{name:"No products",value:"none"}],default:"answer",description:`What the shop products shown after a win are about. Usually the answer itself. If the question makes the answer look bad, so that selling it would be a dig, choose what it belongs to, the game's theme, or no products. For example, after "Who is the player that's not yet scored?" offer his club or the league rather than his shirt; after "Which character never wins an argument?" offer the film rather than that character. The theme is the game's "Shop theme" setting.`,readBy:"The game's own page, which asks the shop for products about it after a win or a neutral result.",section:"This round"},r_={hunt:[TB,...Qk,...t_],place:[...av,...iv,...sv,...cv,...lv]},kI={hunt:n_,push:o_},EB=new Set(n_.map(e=>e.key)),AB=o_.map(e=>e.key),CB=new Set(Qk.map(e=>e.key)),IB=new Set(av.map(e=>e.key)),OB=new Set(iv.map(e=>e.key)),PB=new Set(sv.map(e=>e.key)),NB=new Set(cv.map(e=>e.key)),RB=new Set(lv.map(e=>e.key)),zB=new Set(t_.map(e=>e.key)),jB=[...new Set(Object.values(r_).flatMap(e=>(e??[]).map(t=>t.key)))]});var SI,MB,boe,_c=x(()=>{"use strict";je();Qt();_o();kt();Am();$m();SI=xu.safeExtend({answerMeasure:c.string().min(1).optional(),answerRule:Ys.optional()}),MB=c.discriminatedUnion("archetype",[Xk,SI,Fw,Su,$u]),boe=c.object({name:c.string().regex(/^\d{4}-\d{2}-\d{2}$/,"A day is named by its date, e.g. 2026-11-01."),dayStart:c.number().int(),dayEnd:c.number().int(),round:MB,overwrite:c.boolean().optional()}).refine(e=>e.dayEnd>e.dayStart,"A day must end after it starts.")});var a_,$oe,i_=x(()=>{"use strict";je();_t();_o();_c();Qt();a_=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()}),$oe=c.object({measure:c.string().min(1),rule:Ys,prompt:c.string().trim().min(1)})});var Cm=x(()=>{"use strict";Qt();kt();Ws()});var s_=x(()=>{"use strict"});var UB,GB,BB,qB,WB,HB,YB,VB,ZB,KB,JB,XB,QB,e5,t5,n5,o5,Doe,Im=x(()=>{"use strict";Qt();kt();s_();Gs();UB="place_no_mistake_limit",GB="place_no_skip_limit",BB="place_wildcards_allowed",qB="place_deep_cuts",WB="place_deep_cut_bonus",HB="place_deal",YB="place_deal_boxes",VB="place_deal_tiers",ZB="place_deal_multi_fit",KB="place_deal_decoys",JB="place_card_tags",XB="place_deal_pool",QB="place_deal_new_card",e5="place_deal_new_card_limit",t5="place_deal_daily",n5="place_deal_day_starts",o5="place_deal_time_zone",Doe={[BB]:"Wildcards allowed",[qB]:"Deep cuts",[WB]:"Deep cut bonus",[UB]:"No limit on mistakes",[GB]:"No limit on skips",[HB]:"Build the card from lists",[YB]:"Number of boxes",[VB]:"Boxes from each difficulty",[ZB]:"Cards that fit more than one box",[KB]:"Cards that fit no more than one box",[JB]:"Card groups",[XB]:"Only use cards from",[QB]:"Allow New card",[e5]:"New cards per player",[t5]:"New card each day",[n5]:"Day starts at",[o5]:"Time zone"}});var Om=x(()=>{"use strict"});var c_,l_=x(()=>{"use strict";ho();_t();i_();At();_o();_c();Cm();Im();Dt();Om();kt();c_="Studio rounds:"});var a5,wre,gi,vre,d_=x(()=>{"use strict";je();go();a5=["us","eu","dev"],wre=c.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/,"An organisation id is lower case letters, digits and hyphens, such as nba."),gi=c.string().trim().min(1).max(200),vre=c.object({displayName:gi.optional(),studioHost:c.enum(a5).optional(),studioOrg:gi.optional(),spaces:c.array(gi).min(1).max(20).optional(),domains:c.array(gi.toLowerCase()).max(50).optional(),consent:c.enum(["onetrust","ours"]).optional(),identity:gi.optional(),signedAgreement:c.boolean().optional(),playerLogin:c.object({jwksUri:c.string().url().optional(),issuer:c.union([c.string().url(),c.literal("")]).optional(),audience:c.union([gi,c.literal("")]).optional(),playerIdClaim:c.union([c.string().regex(/^[A-Za-z_][A-Za-z0-9_.:-]*$/,"A claim name, such as SubscriberId."),c.literal("")]).optional()}).strict().optional()}).strict()});var xc=x(()=>{"use strict";kt();Qt()});var u_=x(()=>{"use strict";_o();kt()});var Pm=x(()=>{"use strict";_o();kt()});var m_=x(()=>{"use strict"});var Nm=x(()=>{"use strict";xc();_t();_o();u_();Cm();Im();kt();Vs();Pm();m_();_o();Qt();At();Om();Tm();Em();_c();Va()});function p_(e){return AI+e.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function II(e){if(e.startsWith(AI)){for(let[t,o]of Object.entries(CI))if(o.some(r=>p_(r)===e))return t}}function h_(e){let o=Object.values(CI).flat().map(p_).indexOf(e);return o===-1?void 0:o}var AI,CI,Rm,f_=x(()=>{"use strict";AI="label_taster_",CI={"Taster: ringers":["huntFoundLabel","huntFoundState","huntRuledOutState","huntSelectedState","huntChooseLabel","huntNameOne","huntNameMany","huntChecking","huntSelection","huntRules","huntLimits","huntMistakesLeft","huntFeedback","huntRetry","huntAnswers","huntWon","huntFinished","huntRecap","huntBoardPending","huntNextFailed","huntTimed","huntFinishedAction","huntReviewLabel"],"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","bingoChooseNote","bingoWatchNote","bingoResultNote","bingoHitLabel","bingoMissLabel","bingoDetailsLabel"],"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"],"Taster: shop":["shopHeading","shopBadge","shopDisclosure","shopButton","shopLinkDescription","shopCompetition"]};Rm=["tabHow","boardLabel","closeLabel","playAnotherLabel","restartLabel","backLabel"].map(e=>p_(e))});function g5(e){let t=new Map,o=new Map,r=n=>{for(let a of n)if(a.type==="list"&&o.set(a.key,a),a.type==="collection"){let i=t.get(a.key);if(i&&(i.itemLabel!==a.itemLabel||JSON.stringify(i.fieldset??[])!==JSON.stringify(a.fieldset??[])))throw new Error(`The collection "${a.key}" is declared with two different shapes. One key is one declaration; its fieldset and item label must match wherever it appears.`);t.set(a.key,a),r(a.fieldset??[])}};return r(e),[...p5,...Jw.map(f5),...[...t.values()].map(h5),...[...o.values()].map(m5)]}function jm(e){let t=[];for(let o of e){let r=o.public===!1,n={label:o.label,key:o.key,field:NI(o),description:o.description,...o.type==="collection"?{}:{mandatory:o.required===!0},...r?{public:!1,cloneable:!1}:{},...o.default!==void 0?{default:o.default}:{}},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(l=>l.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 y5(e){let t=e.archetypes.map(Re);for(let d of t)if(!OI[d])throw new Error(`No Studio element name for the ${d} archetype. Add one to ARCHETYPE_ELEMENT_NAMES rather than letting Studio show a blank type.`);let o=d=>`${e.urls.baseAppsUrl}/${d}`,r=d=>{if(!e.roundFields)return;let u=zu(d,e.roundFields);return u.ok?u.fields:void 0},n=new Map((t.length===1?r(t[0])??[]:[]).map(d=>[d.key,d])),a=d=>n.get(d.key)??d,i=new Set(e.wording??Zw),s=d=>(r_[Re(d)]??[]).filter(u=>e.wording===void 0||e.wording.includes(u.key)),l=[...Js.filter(d=>!Zw.includes(d.key)||i.has(d.key)),...RA,...[...i].filter(d=>d.startsWith(mo)).sort(b5).map(w5),...[...new Set(t)].flatMap(d=>Xw[d]??[]),...[...new Set(t)].flatMap(d=>(kI[d]??[]).filter(u=>e.wording===void 0||e.wording.includes(u.key)))];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,services:{"lvis-id-custom-tab":{}}},"elements.json":[...t.map(d=>({name:OI[d],content_type:PI(d),derived_from:zm[d]?.derivedFrom??"data",duration:zm[d]?.duration??{mode:"instant"},label:zm[d]?.derivedFrom==="prediction"?"{{question.text}}":"{{element.title}}",custom_fields:jm(r(d)?[...r(d),...s(d)]:[...Za.includes(Re(d))?Ho.filter(u=>u.key==="title"):Ho,...Nu(d),...s(d)]),...zm[d]?.derivedFrom==="prediction"?{label_question:d==="bingo"?"Card":"Question",label_option:d==="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"}]}:{}})),...t.some(d=>Re(d)==="predict")?[{...Ls.scoreline,fields:ev,titleHelp:"How this match is listed on the timeline, so you can tell the matches apart. For example: Arsenal v Chelsea. Fans do not see it."},{...Ls.number,fields:tv,titleHelp:"How this question is listed on the timeline. For example: First goal minute. Fans do not see it."}].map(d=>({name:d.name,content_type:d.contentType,derived_from:"data",duration:{mode:"fixed",default:604800},label:"{{element.title}}",custom_fields:jm([...Ho.filter(u=>u.key==="title").map(u=>({...u,label:"Name on the timeline",description:d.titleHelp})),...d.fields])})):[]],"fields.json":g5([...l,...Kw,...Ho.map(a),...hC().map(a),...Object.values(ov).flat(),...Jw,...ev,...tv,...t.flatMap(s)]),"project_settings.json":{sections:jm(l)},"event_settings.json":{sections:jm([...Kw,...e.live?tC:[],...t.flatMap(d=>ov[d]??[])])}}}function b5(e,t){let o=h_(e),r=h_(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 w5(e){let t=lC(e),o=II(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,...Rm.includes(e)?{required:!0}:{}}}function g_(e){return y5({name:e.gameName,id:e.gameId,wording:e.wording??[],version:`0.0.${e.manifestRevision}`,archetypes:[e.archetype],urls:e.urls,live:e.live??!1,...e.roundFields?{roundFields:e.roundFields}:{}})}var OI,PI,zm,NI,m5,p5,h5,f5,y_=x(()=>{"use strict";Dt();ku();Xs();ec();Am();f_();At();OI=yA,PI=e=>{let t=Re(e);return Ka[t]??`gamestage-${t.replaceAll("_","-")}-element`},zm={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}},quiz:{derivedFrom:"data",duration:{mode:"fixed",default:86400}}},NI=e=>e.type==="collection"||e.type==="list"?e.key:e.type,m5=e=>({key:e.key,type:"list",data:(e.options??[]).map(t=>({name:t.name,value:t.value}))}),p5=[{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},{key:"file",type:"file",localisable:!1}],h5=e=>({key:e.key,type:"collection",...e.itemLabel?{item_label:e.itemLabel}:{},fieldset:(e.fieldset??[]).map(t=>({label:t.label,key:t.key,field:NI(t),...t.description?{description:t.description}:{}}))}),f5=e=>({key:e.key,type:e.type,...e.type==="freetext"||e.type==="wysiwyg"||e.type==="image"?{localisable:!1}:{}})});var b_=x(()=>{"use strict";At()});var v5,$ae,Tae,w_=x(()=>{"use strict";je();v5=c.enum(["waiting-for-dns","issuing-certificate","live","not-pointing","failed"]),$ae=c.object({hostname:c.string(),gameId:c.string(),status:v5,statusSince:c.string(),createdAt:c.string(),waitingSince:c.string(),liveAt:c.string().nullable().default(null),lastCheckedAt:c.string().nullable().default(null),lastSeen:c.string().nullable().default(null),reason:c.string().nullable().default(null),tenantId:c.string().nullable().default(null),verificationToken:c.string().nullable().default(null)}),Tae=72*36e5});var RI=x(()=>{"use strict";Qu();bk();om();Uk();ho();hm();qk();Rs();gm();mi();Hk();wm();Kk();l_();go();d_();go();Zu();_t();km();xm();xc();Nm();y_();b_();w_();Xv();Qv();Qt();mi()});function k5(e){try{return JSON.parse(e)}catch{return{}}}function _5(e,t){if(e.status>=500)return;let o=(e.headers.get("server")??"").toLowerCase(),r=(e.headers.get("content-type")??"").toLowerCase(),n=t.trimStart().slice(0,200).toLowerCase();if(o.includes("amazons3")||n.startsWith("<?xml")&&n.includes("<error>"))return"S3";if(r.includes("text/html")||n.startsWith("<!doctype html")||n.startsWith("<html"))return"a website";if(t.trim()!=="")try{JSON.parse(t);return}catch{return o.includes("cloudfront")?"CloudFront":"something other than an API"}}function LI(e){let t=1e3*2**(e-1),o=t*.2*(Math.random()*2-1);return Math.round(t+o)}function FI(e){let t=e.fetch??globalThis.fetch,o=e.maxAttempts??4,r=e.baseUrl.replace(/\/+$/,"");return async function(a,i,s={}){let l=globalThis.location?.origin,d=new URL(`${r}${i}`,r.startsWith("/")?l:void 0);for(let[p,f]of Object.entries(s.query??{}))if(Array.isArray(f))for(let g of f)d.searchParams.append(p,String(g));else f!=null&&d.searchParams.set(p,String(f));let u;for(let p=1;p<=o;p++){s.signal?.throwIfAborted();let f=typeof e.token=="function"?await e.token():e.token,g;try{g=await t(d,{signal:s.signal,method:a,headers:{...e.headers,...e.workspace?{[h2]:e.workspace}:{},authorization:`Bearer ${f}`,...s.body===void 0?{}:{"content-type":"application/json"}},body:s.body===void 0?void 0:JSON.stringify(s.body)})}catch(M){s.signal?.throwIfAborted();let z=M instanceof Error?M.message:String(M);if(u=new Le(0,"unreachable",`Could not reach the control plane at ${r}: ${z}. Check your connection and run the command again.`,!0),p===o)break;await zI(LI(p));continue}let b=await g.text(),w=_5(g,b);if(w)throw new Le(g.status,Lm,`${r} is not a Gamestage control plane (it answered like ${w}). Set GAMESTAGE_CONTROL_URL to the Space's API address.`,!1);if(g.ok)return b===""?void 0:JSON.parse(b);let _=k5(b);if(u=new Le(g.status,_.error?.code??"unknown",_.error?.message??g.statusText,_.error?.retryable??!1),!u.retryable||p===o)break;let I=Number(g.headers.get("retry-after"));await zI(Number.isFinite(I)&&I>0?I*1e3:LI(p))}throw u??new Le(0,"unknown","Request failed.",!1)}}function UI(e){let t=FI(e);return{listDomains:()=>t("GET","/v1/admin/domains").then(o=>o.domains??[]),checkDomain:o=>t("POST",`/v1/admin/domains/${encodeURIComponent(o)}/check`),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(a2);return i2(r)},getWorkspace:o=>t("GET",`/v1/admin/workspaces/${encodeURIComponent(o)}`),setWorkspaceGrant:(o,r,n)=>t("POST",`/v1/admin/workspaces/${encodeURIComponent(o)}/grants`,{body:{grant:r,change:n}}),getWorkspaceGrants:o=>t("GET",`/v1/admin/workspaces/${encodeURIComponent(o)}/grants`),listOrgProfiles:()=>t("GET","/v1/admin/orgs"),getOrgProfile:o=>t("GET",`/v1/admin/orgs/${encodeURIComponent(o)}`),setOrgProfile:(o,r)=>t("PUT",`/v1/admin/orgs/${encodeURIComponent(o)}`,{body:r}),setWorkspaceCapTrial:(o,r,n)=>t("PUT",`/v1/admin/workspaces/${encodeURIComponent(o)}/trials`,{body:{limit:r,on:n}}),getWorkspaceCapTrials:o=>t("GET",`/v1/admin/workspaces/${encodeURIComponent(o)}/trials`),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"),eraseGame:o=>t("POST",`/v1/admin/games/${encodeURIComponent(o)}/erasure`),closeWorkspace:o=>t("POST",`/v1/admin/workspaces/${encodeURIComponent(o)}/close`),listErasures:()=>t("GET","/v1/admin/erasures").then(o=>o.erasures??[]),getAds:()=>t("GET","/v1/admin/ads"),setAdsConfig:o=>t("PUT","/v1/admin/ads/config",{body:o}),setAdsGame:(o,r)=>t("PUT",`/v1/admin/ads/games/${encodeURIComponent(o)}`,{body:r}),addAdsBlock:(o,r)=>t("POST",`/v1/admin/ads/blocklists/${o}`,{body:r}),removeAdsBlock:(o,r)=>t("POST",`/v1/admin/ads/blocklists/${o}/remove`,{body:{value:r}}),previewAds:o=>t("GET","/v1/admin/ads/preview",{query:{country:o.country,moment:o.moment,club:o.club||void 0,subject:o.subjects?.length?o.subjects.map(r=>`${r.type}:${r.name}`):void 0,game:o.gameId||void 0}}),listAdsRequests:()=>t("GET","/v1/admin/ads/requests").then(o=>Vk((o?.requests??[]).map(ym).filter(r=>r!==null))),moveAdsRequest:(o,r,n)=>t("PUT",`/v1/admin/ads/requests/${encodeURIComponent(o)}`,{body:{state:r,reason:n}}).then(Yk),adsProducts:o=>t("GET","/v1/admin/ads/products",{query:{catalogue:o.catalogue,subject:`${o.subject.type}:${o.subject.name}`}}),adsCriteria:()=>t("GET","/v1/admin/ads/criteria"),sponsorUsage:o=>t("GET","/v1/admin/sponsors",o?{query:{month:o}}:void 0)}}function Yn(e){let t=FI(e),o=["meters","rounds","history","destinations","sections","issues"],r=i=>{let s={...i,containerLabel:i.containerLabel??"Round"};for(let l of o)Array.isArray(s[l])||(s[l]=[]);return s},n=i=>({...i,access:Xu(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:Xu(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 Le)||i.status!==404)throw i;return jI||(jI=!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,l)=>t("POST",`/v1/games/${encodeURIComponent(i)}/uploads`,{body:l?{filename:s,deployId:l,upload:pm}:{filename:s,upload:pm}}),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}}),getDomain:i=>t("GET",`/v1/games/${encodeURIComponent(i)}/domain`),addDomain:(i,s,l)=>t("POST",`/v1/games/${encodeURIComponent(i)}/domain`,{body:{hostname:s,move:l?.move??!1}}),checkDomain:i=>t("POST",`/v1/games/${encodeURIComponent(i)}/domain/check`),removeDomain:i=>t("DELETE",`/v1/games/${encodeURIComponent(i)}/domain`),getAdsRequest:i=>t("GET",`/v1/games/${encodeURIComponent(i)}/ads-request`).then(s=>ym(s?.request)),requestAds:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/ads-request`,{body:s}).then(Yk),listSimulations:()=>t("GET","/v1/live/simulations").then(i=>i?.simulations??[]),startSimulation:i=>t("POST","/v1/live/simulations",{body:i??{}}),changeSimulation:(i,s)=>t("POST",`/v1/live/simulations/${encodeURIComponent(i)}/${s}`),referenceUploadTarget:(i,s)=>t("POST","/v1/reference/uploads",{body:{name:i,digest:s,upload:pm}}),listMembers:async()=>(await t("GET","/v1/workspace/members")).members??[],inviteMember:async i=>(await t("POST","/v1/workspace/members",{body:{email:i}})).member,removeMember:i=>t("DELETE",`/v1/workspace/members/${encodeURIComponent(i)}`),listMyWorkspaces:async()=>(await t("GET","/v1/workspaces")).workspaces??[],listDesignSystems:async()=>(await t("GET","/v1/design-systems")).designSystems??[],publishDesignSystem:(i,s)=>t("POST",`/v1/design-systems/${encodeURIComponent(i)}/versions`,{body:s}),designSystemVersion:async(i,s)=>(await t("GET",`/v1/design-systems/${encodeURIComponent(i)}/versions/${encodeURIComponent(s)}`)).designSystem,async orgProfile(){try{return(await t("GET","/v1/org/profile")).profile}catch(i){if(i instanceof Le&&i.status===404&&i.code==="no_org")return null;throw i}},async orgContext(){try{return(await t("GET","/v1/org/context")).context}catch(i){if(i instanceof Le&&i.status===404&&i.code==="no_context")return null;throw i}},async orgProfileForOperator(){try{return(await t("GET","/v1/org/profile/operator")).profile}catch(i){if(i instanceof Le&&(i.status===403||i.status===404))return null;throw i}},setActiveOrg:i=>t("PUT","/v1/org/active",{body:{org:i}}),async orgAdmins(){let i;try{i=await t("GET","/v1/org/admins")}catch(s){if(s instanceof Le&&s.status===404)return null;throw s}return{organisation:i.organisation??null,admins:Array.isArray(i.admins)?i.admins.filter(s=>typeof s?.email=="string"&&s.email!=="").map(s=>({email:s.email,since:typeof s.since=="string"?s.since:null})):[],youCanChange:i.youCanChange===!0}},orgContextHistory:async()=>(await t("GET","/v1/org/context/history")).revisions??[],setOrgContext:async i=>(await t("PUT","/v1/org/context",{body:{markdown:i}})).revision,orgStarters:async i=>(await t("GET",i?.all?"/v1/org/starters?all=1":"/v1/org/starters")).starters??[],retireOrgStarter:async(i,s)=>(await t("POST",`/v1/org/starters/${encodeURIComponent(i)}/versions/${encodeURIComponent(s)}/retire`)).starter,startOrgStarterUpload:async(i,s)=>(await t("POST",`/v1/org/starters/${encodeURIComponent(i)}/versions`,{body:s})).upload,confirmOrgStarter:async(i,s)=>(await t("POST",`/v1/org/starters/${encodeURIComponent(i)}/versions/${encodeURIComponent(s)}/confirm`)).starter,scaffoldOrgStarter:(i,s)=>t("POST",`/v1/org/starters/${encodeURIComponent(i)}/versions/${encodeURIComponent(s)}/scaffold`),pruneBundle:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/bundle`,{body:{filenames:s}}),bundleFiles:async i=>(await t("GET",`/v1/games/${encodeURIComponent(i)}/files`)).files??[],async getGame(i){try{return r(await t("GET",`/v1/games/${encodeURIComponent(i)}`))}catch(s){if(s instanceof Le&&s.status===404)return;throw s}},setAwake:(i,s)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/state`,{body:{awake:s}}),setDestination:(i,s,l)=>t("PUT",`/v1/games/${encodeURIComponent(i)}/destinations`,{body:{destination_id:s,enabled:l}}),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`),renameGame:async(i,s)=>{let l=await t("POST",`/v1/games/${encodeURIComponent(i)}/rename`,{body:{name:s}});return{...l,previous:typeof l.previous=="string"?l.previous:"",studio:l.studio??"none"}},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`),async practiceRound(i,s){try{return await t("POST",`/v1/games/${encodeURIComponent(i)}/practice`,{body:{round:s}})}catch(l){throw l instanceof Le&&l.status===404&&!/no such game|no game with id/i.test(l.message)?new Le(404,"not_supported","This control plane cannot serve a practice round yet. It is running a build older than this CLI. Update the CLI's backend, or use an older CLI until it is.",!1):l}},async previewPracticeRound(i,s){try{return await t("POST","/v1/preview/practice",{body:{game:i,round:s}})}catch(l){throw l instanceof Le&&l.status===404&&/unknown resource/i.test(l.message)?new Le(404,"not_supported","This control plane cannot serve a preview round yet. It is running a build older than the connector.",!1):l}},roundSeedCandidates:(i,s)=>t("POST",`/v1/games/${encodeURIComponent(i)}/round/candidates`,{body:s}),async seedSeasonDay(i,s){try{return await t("PUT",`/v1/games/${encodeURIComponent(i)}/season/${encodeURIComponent(s.name)}`,{body:{dayStart:s.dayStart,dayEnd:s.dayEnd,round:s.round,...s.overwrite?{overwrite:!0}:{}}})}catch(l){throw l instanceof Le&&l.status===404&&!/no such game|no game with id/i.test(l.message)?new Le(404,"not_supported","This control plane cannot take a season yet. It is running a build older than this CLI.",!1):l}},async seedRound(i,s,l){try{return await t("PUT",`/v1/games/${encodeURIComponent(i)}/round`,{body:{round:s,...l}})}catch(d){throw d instanceof Le&&d.status===404&&!/no such game|no game with id/i.test(d.message)?new Le(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):d}},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 Le&&s.status===404)return;throw s}},async getGameUsage(i){try{return await t("GET",`/v1/games/${encodeURIComponent(i)}/usage`)}catch(s){if(s instanceof Le&&s.status===404)return;throw s}},async getLogs(i,s,l){let{lines:d}=await t("GET",`/v1/games/${encodeURIComponent(i)}/logs`,{query:s,signal:l});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:MI}:{datasets:i.datasets,unavailable:i.unavailable??null}}catch(i){if(i instanceof Le&&i.status===404)return{datasets:[],unavailable:MI};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 Le&&s.status===404)return;throw s}},async previewDataset(i,s,l){try{let d=await t("GET",`/v1/reference/preview/${encodeURIComponent(i)}`,{query:{limit:s,by:l}});return d&&Array.isArray(d.rows)?d:void 0}catch(d){if(d instanceof Le&&d.status===404)return;throw d}},async deleteDataset(i){try{return await t("DELETE",`/v1/reference/datasets/${encodeURIComponent(i)}`)}catch(s){if(s instanceof Le&&s.status===404&&s.code===DI)return;throw s}},async downloadDataset(i){try{let s=await t("GET",`/v1/reference/download/${encodeURIComponent(i)}`);return s?.url?s:void 0}catch(s){if(s instanceof Le&&s.status===404&&s.code===DI)return;throw s}},async runDataset(i){return t("POST",`/v1/reference/runs/${encodeURIComponent(i)}`)},async getDatasetRun(i){try{return await t("GET",`/v1/reference/runs/${encodeURIComponent(i)}`)}catch(s){if(s instanceof Le&&s.status===404&&s.code===x5)return;throw s}},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 Le&&s.status===404)return[];throw s}}}}var Le,Lm,zI,jI,DI,x5,MI,GI=x(()=>{"use strict";hm();Qu();wm();mi();Le=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"}},Lm="not_a_control_plane";zI=e=>new Promise(t=>setTimeout(t,e)),jI=!1;DI="no_such_dataset",x5="no_such_run",MI="This control plane is running a build older than this screen, so it cannot list datasets yet."});function BI(e){return e?`npx gamestage@latest deploy ${e} --dir .`:"npx gamestage@latest deploy"}function nr(e,t){let o=v_.exec(e.trim()),r=v_.exec(t.trim());if(!o||!r)return null;for(let n=1;n<=3;n++){let a=Number(o[n])-Number(r[n]);if(a!==0)return a}return 0}function Wr(e,t){if(!e)return{state:"unknown",current:t};let o=nr(e,t);return o===null?{state:"unknown",current:t}:o<0?{state:"behind",pinned:e,current:t}:o>0?{state:"ahead",pinned:e,current:t}:{state:"current",pinned:e,current:t}}function k_(e){let t=new Set;for(let o of e.matchAll(/\/client\/(\d+\.\d+\.\d+)\/gamestage\.js/g))t.add(o[1]);return[...t].sort((o,r)=>nr(o,r)??0)}function qI(e){let t=[...new Set(e)].filter(o=>v_.test(o));if(t.length!==0)return t.sort((o,r)=>nr(o,r)??0)[0]}function WI(e){return/^ \* Gamestage client (\d+\.\d+\.\d+)\.$/m.exec(e.slice(0,600))?.[1]}var v_,__=x(()=>{"use strict";v_=/^(\d+)\.(\d+)\.(\d+)$/});var HI,Dm,Hr,YI=x(()=>{"use strict";__();HI="x-gamestage-cli",Dm="update_required",Hr="npx gamestage@latest"});var VI=x(()=>{"use strict"});var ZI=x(()=>{"use strict";xc();_t();kt();Va()});function JI(e){let o=(Array.isArray(e["elements.json"])?e["elements.json"]:[]).find(i=>i.content_type===Ka.quiz);if(!o)return`The game's App Spec has no quiz question element (${Ka.quiz}), so a producer has nowhere to write a question.`;let a=(Array.isArray(o.custom_fields)?o.custom_fields:[]).flatMap(i=>[...Array.isArray(i.properties)?i.properties:[],...Array.isArray(i.subsections)?i.subsections.flatMap(s=>Array.isArray(s.properties)?s.properties:[]):[]]).find(i=>i.key===ni);if(!a)return`The quiz question element has no "${ni}" field, so the Quiz Engine has no right answer to mark against. Keep it in round_fields: if the manifest has that block.`;if(a.public!==!1)return`The quiz question element's "${ni}" field is public, so every fan's browser would receive the right answer. It must be public: false.`}var KI,x_=x(()=>{"use strict";Dt();At();Va();kt();KI="The Quiz Engine holds"});var XI=x(()=>{"use strict";Va();At();Pm();Nm();Qt()});function QI(e){if(typeof e!="string")return null;let t=/^([a-z][a-z0-9_-]*):([a-zA-Z0-9][a-zA-Z0-9._-]*)$/.exec(e);return t&&fm(t[2])?null:t&&t[0]===e?{provider:t[1],id:t[2]}:null}var Mm=x(()=>{"use strict";gm()});var eO=x(()=>{"use strict";Mm()});var tO,xce,S_,Sce,nO=x(()=>{"use strict";je();Mm();tO=c.string().regex(/^sportmonks:[1-9]\d*$/).refine(e=>{let t=QI(e);return t!==null&&Number.isSafeInteger(Number(t.id))}),xce=c.array(c.object({fixture:tO,games:c.array(c.object({gameId:c.string().min(1),editionId:c.string().min(1)})),addedAt:c.iso.datetime({offset:!0})})),S_=c.object({home:c.number().int().nonnegative(),away:c.number().int().nonnegative()}),Sce=c.object({fixture:tO,sport:c.literal("football"),status:c.enum(["scheduled","live","finished","void","postponed","unknown"]),statusName:c.string(),regulation:S_.nullable(),currentScore:S_.nullable().optional(),finalScore:S_.nullable(),teams:c.object({home:c.string(),away:c.string()}).optional(),startingAt:c.string().nullable(),readAt:c.iso.datetime({offset:!0}),final:c.boolean(),finishedReads:c.number().int().min(0).max(2),finishedSince:c.iso.datetime({offset:!0}).nullable(),minute:c.number().nonnegative().nullable(),notifyPending:c.boolean()})});var Ece,oO=x(()=>{"use strict";je();Ece=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)})});function cO(e){return{type:"team",name:e.trim()}}function $5(e){return e.normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/ø/gi,"o").toLowerCase().trim()}function dO(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let{teams:t,leagues:o,...r}=e,n={...r};return t!==void 0&&n.scope===void 0&&(n.scope=Array.isArray(t)?t.map(a=>typeof a=="string"?cO(a):a):t),o!==void 0&&n.competitions===void 0&&(n.competitions=o),n}function N5(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let{catalogueClubs:t,...o}=e,r={...o};return t!==void 0&&r.catalogueSubjects===void 0&&(r.catalogueSubjects=Array.isArray(t)?t.map(n=>typeof n=="string"?cO(n):n):t),r}function mO(e,t){return e.expiresAt===null||Date.parse(e.expiresAt)>t.getTime()}function wO(e){return e.getUTCMonth()>=6?e.getUTCFullYear():e.getUTCFullYear()-1}var A_,rO,iO,sO,Sc,Ice,T5,Oce,Fm,C_,lO,$_,E5,Pce,A5,Vn,C5,aO,uO,I5,O5,T_,E_,Nce,P5,Rce,R5,zce,z5,j5,I_,O_,L5,D5,M5,jce,Lce,F5,U5,Dce,Mce,pO,hO,fO,gO,yO,bO,P_,Fce,Uce,vO,kO,N_=x(()=>{"use strict";je();A_={GB:{catalogue:"8085",currency:"GBP",label:"United Kingdom"},US:{catalogue:"5042",currency:"USD",label:"United States"}},rO=c.enum(["GB","US"]),iO=["team","player","competition","event","brand"],sO=c.enum(iO),Sc=c.object({type:sO,name:c.string().trim().min(1).max(120)});Ice=new RegExp(`,(?=\\s*(?:${iO.join("|")})\\s*:)`,"i");T5={"Brighton & Hove Albion":["Brighton","Brighton & Hove Albion FC","Brighton and Hove Albion"]},Oce=new Map(Object.entries(T5).flatMap(([e,t])=>[e,...t].map(o=>[$5(o),e]))),Fm=["collectibles","shirts_kit","training_wear","headwear","accessories","gifts"],C_=c.enum(Fm),lO={collectibles:"Collectibles: trading cards and signed memorabilia",shirts_kit:"Shirts and jerseys",training_wear:"Training and leisure wear",headwear:"Headwear",accessories:"Accessories",gifts:"Gifts"},$_=c.object({value:c.string().trim().min(1).max(200),reason:c.string().trim().min(1).max(500),expiresAt:c.string().datetime().nullable(),addedBy:c.string(),addedAt:c.string()}),E5=["products","players","keywords"],Pce=c.enum(E5),A5=90,Vn={productTypes:c.array(C_),scope:c.array(Sc).max(100),competitions:c.array(c.string().trim().min(1).max(80)).max(50),priceMin:c.number().min(0).nullable(),priceMax:c.number().min(0).nullable(),winPriceMax:c.number().min(0).nullable(),countries:c.array(rO).min(1),defaultCountry:rO,kids:c.boolean()};C5=c.preprocess(dO,c.object(Vn).partial().strict()),aO=c.preprocess(dO,c.object({productTypes:Vn.productTypes.default([...Fm]),scope:Vn.scope.default([]),competitions:Vn.competitions.default([]),priceMin:Vn.priceMin.default(null),priceMax:Vn.priceMax.default(null),winPriceMax:Vn.winPriceMax.default(A5),countries:Vn.countries.default(["GB"]),defaultCountry:Vn.defaultCountry.default("GB"),kids:Vn.kids.default(!1)})),uO=["products","video","betting","lead_generation"],I5=c.enum(uO),O5=c.object({enabled:c.boolean(),adTypes:c.array(I5).max(uO.length).default(["products"]),rules:C5.optional()}),T_={impactRequests:60,jevCalls:1500,askedWithinDays:30},E_=c.object({impactRequests:c.number().int().min(1).max(1e3).default(T_.impactRequests),jevCalls:c.number().int().min(1).max(2e4).default(T_.jevCalls),askedWithinDays:c.number().int().min(1).max(90).default(T_.askedWithinDays)}),Nce=E_.partial().strict(),P5=c.object({at:c.string(),by:c.string(),what:c.string()});Rce=c.preprocess(N5,c.object({killSwitch:c.boolean().default(!1),rules:aO.default(aO.parse({})),games:c.record(c.string(),O5).default({}),catalogueSubjects:c.array(Sc).max(200).default([]),pull:E_.default(E_.parse({})),blocklists:c.object({products:c.array($_).default([]),players:c.array($_).default([]),keywords:c.array($_).default([])}).default({products:[],players:[],keywords:[]}),updatedAt:c.string().nullable().default(null),updatedBy:c.string().nullable().default(null),history:c.array(P5).default([])}));R5=c.object({id:c.string(),catalogue:c.string(),name:c.string(),club:c.string(),league:c.string(),imageUrl:c.string(),url:c.string(),price:c.number(),currency:c.string(),inStock:c.boolean(),ageGroup:c.string().nullable(),type:C_.nullable()}),zce=c.enum(["win","neutral","loss"]),z5=c.object({model:c.string(),ownClub:c.number().nullable(),playerOutsideSquad:c.number(),forChildren:c.number(),aboutNewBaby:c.number(),tactless:c.object({win:c.number(),neutral:c.number()}),appeal:c.object({win:c.number(),neutral:c.number()})}),j5=R5.extend({judgments:z5.nullable()}),I_=40,O_=["incomplete","not_the_subject","out_of_stock","untyped"],L5=c.enum(O_),D5=c.object({name:c.string(),team:c.string(),why:L5}),M5=c.object({incomplete:c.number().optional(),not_the_subject:c.number().optional(),out_of_stock:c.number().optional(),untyped:c.number().optional()}),jce=c.object({catalogue:c.string(),query:c.string().optional(),club:c.string(),subject:Sc.optional(),pulledAt:c.string(),fetched:c.number(),candidates:c.array(j5),dropped:c.array(D5).optional()}),Lce=c.object({pulledAt:c.string().nullable(),impact:c.object({ok:c.boolean(),detail:c.string().nullable()}),jev:c.object({ok:c.boolean(),detail:c.string().nullable()}),catalogues:c.array(c.object({catalogue:c.string(),club:c.string(),fetched:c.number(),candidates:c.number(),judged:c.number(),subject:Sc.optional(),pulledAt:c.string().optional(),query:c.string().optional(),dropped:M5.optional()})),reporting:c.enum(["not_available","available"]).default("not_available"),waiting:c.number().optional()}),F5=c.object({gameId:c.string().min(1).max(120),workspaceId:c.string().min(1).max(120),lastAsked:c.string()}),U5=c.object({subject:Sc,team:c.string().max(120).nullable().default(null),firstAsked:c.string(),lastAsked:c.string(),games:c.array(F5)}),Dce=c.object({updatedAt:c.string().nullable().default(null),subjects:c.array(U5).default([])}),Mce=c.object({pulledAt:c.string().nullable().default(null),source:c.string().default(""),players:c.record(c.string(),c.string()).default({}),ambiguous:c.array(c.string()).default([])}),pO=.5,hO=.5,fO=.5,gO=.5,yO=.4,bO=1.5,P_=3,Fce=c.object({productId:c.string(),name:c.string(),imageUrl:c.string(),price:c.number(),currency:c.string(),link:c.string(),type:C_,reasons:c.array(c.string())}),Uce=c.object({type:sO,name:c.string(),of:c.string().optional()});vO=["other_catalogue","out_of_stock","untyped","type_off","outside_team_scope","outside_competition","below_price","above_price","above_win_price","for_children_named","past_season","wall_decor","blocked_product","blocked_player","blocked_keyword"],kO=["not_judged","not_own_club","tactless","player_outside_squad","about_new_baby","for_children","low_appeal"]});var Kce,$c,G5,Tc,Tn,_O,Jce,Xce,xO=x(()=>{"use strict";N_();Kce={switches:{title:"Whether anything shows",lede:"Checked first, before any product is read."},nightly:{title:"Every night, before any fan",lede:"The nightly pull fetches each team's, player's or competition's products and drops these before Jev judges the rest."},finish:{title:"When a fan finishes",lede:"Applied to every judged product the moment a result screen asks. Counted here after a win, with the settings for every game."},order:{title:"What goes first",lede:`Among the products that pass, these decide the ${P_} at most a fan sees.`},privacy:{title:"Privacy",lede:"What is recorded about a fan who sees the panel."}},$c=e=>`${Math.round(e*100)}%`,G5={GBP:"\xA3",USD:"$"},Tc=(e,t)=>{let o=A_[e.defaultCountry].currency,r=G5[o];return r?`${r}${t}`:`${t} ${o}`},Tn=()=>"Always",_O=e=>!e.kids,Jce=[{id:"kill_switch",stage:"switches",name:"Stops every ad at once",protects:"If anything goes wrong, one switch takes every ad out of every game.",kind:"rule",setting:e=>e.killSwitch?"On":"Off",measure:"kill"},{id:"approved_games",stage:"switches",name:"Only games the retail partner has approved",protects:"A game shows nothing until Monterosa switches products on for it, after the retail partner approves.",kind:"rule",setting:e=>{let t=Object.values(e.games).filter(o=>o.enabled&&o.adTypes.includes("products")).length;return t===0?"No game on":`On in ${t} ${t===1?"game":"games"}`},measure:"games"},{id:"not_after_a_loss",stage:"switches",name:"Nothing after a loss",protects:"A fan who has just lost is never sold to.",kind:"rule",setting:Tn,measure:"none",notCounted:"Not counted: after a loss the page does not ask."},{id:"what_the_game_is_about",stage:"switches",name:"Only what the game is about",protects:"Products are for the players, team or competition the game names, never a guess, and never outside a scope Monterosa set.",kind:"rule",setting:(e,t)=>{let o=[...t.scope.map(r=>r.name),...t.competitions];return o.length===0?"Any the game names":`Only ${o.join(", ")}`},measure:"finish",covers:{finish:["outside_team_scope","outside_competition"]}},{id:"own_country",stage:"switches",name:"The fan's own shop",protects:"Prices and stock come from one country's catalogue, never another country's currency.",kind:"rule",setting:(e,t)=>t.countries.map(o=>A_[o].label).join(", "),measure:"finish",covers:{finish:["other_catalogue"]}},{id:"complete_listing",stage:"nightly",name:"Drops broken listings",protects:"A product with no link, picture or price never reaches a fan.",kind:"rule",setting:Tn,measure:"pull",covers:{pull:["incomplete"]}},{id:"another_team",stage:"nightly",name:"Drops another team's stock",protects:`A search for Arsenal also finds an "Everton v Arsenal" scarf; only the shop's own Arsenal stock is kept.`,kind:"rule",setting:Tn,measure:"pull",covers:{pull:["not_the_subject"]}},{id:"in_stock",stage:"nightly",name:"Drops what is out of stock",protects:"A fan is never sent to something they cannot buy.",kind:"rule",setting:Tn,measure:"pull",covers:{pull:["out_of_stock"],finish:["out_of_stock"]}},{id:"recognised_product",stage:"nightly",name:"Drops products we cannot name",protects:"Anything that is not recognisably a shirt, cap, collectible, gift or similar is left out, so nothing odd slips through.",kind:"rule",setting:Tn,measure:"pull",covers:{pull:["untyped"],finish:["untyped"]}},{id:"judged_per_subject",stage:"nightly",name:"Judges a mix, not the whole shop",protects:`Jev judges up to ${I_} products per team, player or competition each night, one of each type in turn, so sixty shirts never crowd out a cap.`,kind:"rule",setting:()=>`${I_} per team, player or competition`,measure:"unjudged"},{id:"judged_first",stage:"finish",name:"Nothing unjudged",protects:"A product Jev could not judge is never shown.",kind:"rule",setting:Tn,measure:"finish",covers:{finish:["not_judged"]}},{id:"product_types",stage:"finish",name:"Only the product types switched on",protects:"Monterosa chooses which kinds of product a game may show.",kind:"rule",setting:(e,t)=>t.productTypes.length===Fm.length?"All six types":t.productTypes.length===0?"None":t.productTypes.map(o=>lO[o].split(":")[0]).join(", "),measure:"finish",covers:{finish:["type_off"]}},{id:"price",stage:"finish",name:"Keeps to a price range",protects:"Keeps expensive items off the screen of a fan who has just played a free game.",kind:"rule",setting:(e,t)=>t.priceMin===null&&t.priceMax===null?"No limit":t.priceMin===null?`Up to ${Tc(t,t.priceMax)}`:t.priceMax===null?`From ${Tc(t,t.priceMin)}`:`${Tc(t,t.priceMin)} to ${Tc(t,t.priceMax)}`,measure:"finish",covers:{finish:["below_price","above_price"]}},{id:"win_price",stage:"finish",name:"Caps the price on the result screen",protects:"A fan who has just played is offered what most fans buy, a replica shirt rather than a \xA3135 authentic one.",kind:"rule",setting:(e,t)=>t.winPriceMax===null?"No cap":`Up to ${Tc(t,t.winPriceMax)}`,measure:"finish",covers:{finish:["above_win_price"]}},{id:"children_named",stage:"finish",name:"Drops children's products by name",protects:"Anything labelled kids, baby, junior or youth stays off unless Monterosa allows children's products.",kind:"rule",setting:(e,t)=>_O(t)?"On: children's products kept off":"Off: children's products allowed",measure:"finish",covers:{finish:["for_children_named"]}},{id:"past_season",stage:"finish",name:"Drops last season's stock",protects:'A shirt, sticker or card set for a past season ("24-25", or "Topps 2026" in 2026-27) looks stale, though signed and framed collectibles are kept.',kind:"rule",setting:(e,t,o)=>{if(!o)return"Worked out from the date";let r=wO(o);return`Before ${r}-${String((r+1)%100).padStart(2,"0")}, from the date`},measure:"finish",covers:{finish:["past_season"]}},{id:"wall_stickers",stage:"finish",name:"Drops wall stickers",protects:"A fan at a result screen is not shopping for a wall.",kind:"rule",setting:Tn,measure:"finish",covers:{finish:["wall_decor"]}},{id:"blocklists",stage:"finish",name:"Drops what Monterosa has blocked",protects:"Any product, player or word Monterosa blocks, each with a reason and an optional end date.",kind:"rule",setting:(e,t,o)=>{let r=l=>e.blocklists[l].filter(d=>!o||mO(d,o)).length,[n,a,i]=[r("products"),r("players"),r("keywords")];if(n+a+i===0)return"Nothing blocked";let s=(l,d,u)=>`${l} ${l===1?d:u}`;return[s(n,"product","products"),s(a,"player","players"),s(i,"word","words")].join(", ")},measure:"finish",covers:{finish:["blocked_product","blocked_player","blocked_keyword"]}},{id:"rival_club",stage:"finish",name:"Drops a rival club's shirt",protects:"Catches a product filed under the right team that is really for another club's fans.",kind:"judgment",setting:()=>`Below ${$c(pO)} sure it is the club's`,measure:"finish",covers:{finish:["not_own_club"]}},{id:"tactless",stage:"finish",name:"Drops anything tactless",protects:"Gloating, a rival's celebration, a defeat or a sensitive event: anything that would embarrass the brand showing it.",kind:"judgment",setting:()=>`${$c(hO)} sure or more`,measure:"finish",covers:{finish:["tactless"]}},{id:"player_left",stage:"finish",name:"Drops players who have left",protects:"A shirt printed for a player no longer in the club's squad is out of date, though signed memorabilia of a former player is kept.",kind:"judgment",setting:()=>`${$c(fO)} sure or more`,measure:"finish",covers:{finish:["player_outside_squad"]}},{id:"new_baby",stage:"finish",name:"Drops new-baby gifts",protects:"A birth card or a newborn gift is never the right thing after a game.",kind:"judgment",setting:()=>`${$c(yO)} sure or more`,measure:"finish",covers:{finish:["about_new_baby"]}},{id:"children_judged",stage:"finish",name:"Drops what is made for children",protects:"Catches children's products the name does not give away, while children's products are off.",kind:"judgment",setting:(e,t)=>_O(t)?`${$c(gO)} sure or more`:"Off: children's products allowed",measure:"finish",covers:{finish:["for_children"]}},{id:"low_appeal",stage:"finish",name:"Drops what a fan would not want now",protects:"Jev scores how much a fan would want each product after that result, from 0 to 3, and anything lukewarm is left out.",kind:"judgment",setting:()=>`Below ${bO.toFixed(1)} of 3`,measure:"finish",covers:{finish:["low_appeal"]}},{id:"player_first",stage:"order",name:"The game's player first",protects:"A product naming the player the game is about leads, so a fan sees their player's shirt before a mug.",kind:"rule",setting:Tn,measure:"none",notCounted:"Decides the order; drops nothing."},{id:"player_club",stage:"order",name:"A player brings their club",protects:"When a game names only players, their current clubs' products can show too, taken from the Premier League squads and never guessed.",kind:"rule",setting:Tn,measure:"players"},{id:"replica_first",stage:"order",name:"Replica before authentic",protects:"The shirt most fans buy comes before the dearer player-cut version of the same design.",kind:"rule",setting:Tn,measure:"none",notCounted:"Decides the order; drops nothing."},{id:"one_per_design",stage:"order",name:"One of each design",protects:"The same shirt with another name on the back, or in another cut, shows once.",kind:"rule",setting:Tn,measure:"designs"},{id:"variety",stage:"order",name:"A mix on screen",protects:"One of each product type before a second of any, so three shirts never fill the panel when a cap would do, and no second at all when the round names a competition.",kind:"rule",setting:()=>`Up to ${P_} products`,measure:"none",notCounted:"Decides the order; drops nothing."},{id:"consent",stage:"privacy",name:"Counted only with consent",protects:"Showing the panel is recorded only when the fan agreed to marketing and analytics, and a link never carries who the fan is.",kind:"rule",setting:()=>"Marketing and analytics",measure:"none",notCounted:"Decided on the fan's page; nothing is counted here."}],Xce={pull:O_,finish:[...vO,...kO]}});var SO=x(()=>{"use strict";_t()});function $O(e){return e?Ec.find(t=>t.formats.includes(e)):void 0}var Ec,TO=x(()=>{"use strict";lc();Ec=[{id:"typesafe",label:"TypeSafe",signUp:"https://typesafe.ai",purpose:"Pays for Jev, the AI judge that answers fans' questions in your Mystery games. Each question costs a fraction of a cent, charged to your TypeSafe account.",formats:["mystery"]}]});var B5,ale,EO=x(()=>{"use strict";_t();B5="Regular Season,Playoffs,PlayIn",ale=`career-cache.${B5.toLowerCase().replace(/[^a-z]+/g,"-").replace(/^-|-$/g,"")}.json`});function R_(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=It.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:Bu(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 AO(e,t){let o=R_(e);return o.ok&&(await t("copy",e),await t("pointer",e)),o}function CO(e,t){return e?e.filter(o=>!t.scored.includes(o)):[]}var IO=x(()=>{"use strict";_t()});function PO(e){let t=e.replace(/^/,"").trimStart();if(t.startsWith("{")||t.startsWith("[")){let r;try{r=JSON.parse(t)}catch(n){throw new Pt(`It starts like JSON and does not parse: ${n instanceof Error?n.message:String(n)}`)}return V5(r)}let[o]=LO(t);if(!o||!o.records.length)throw new Pt("It is neither JSON nor a CSV with a header row and at least one row of data.");return{...NO("$",o.records,!1),format:"csv"}}function V5(e){if(Yr(e)&&"corpus"in e){let t=It.safeParse(e);if(t.success)return Z5(t.data);let o=t.error.issues[0];return{...OO(e),kind:"invalid-dataset",problem:o?`${o.path.join(".")||"document"}: ${o.message}`:"It does not match the dataset format."}}return OO(e)}function Z5(e){let t=new Set,o=e.measures.map(r=>{let n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,i=0;for(let[s,l]of Object.entries(r.values))t.add(s),i+=1,l<n&&(n=l),l>a&&(a=l);return{key:r.key,label:r.label,count:i,range:i?{min:n,max:a}:null,scale:r.scale??null,scoring:!!r.scoring}});return{format:"json",kind:"dataset",problem:null,dataset:{entities:t.size,measures:o,labelled:Object.keys(e.entries??{}).length,sampleKeys:[...t].slice(0,5)},lists:[],chosen:null,keyCandidates:[],measureCandidates:[],labelCandidates:[],notMeasures:[],codes:[]}}function OO(e){let t=[];if(Gm(e,"$",0,t),!t.length)return{...K5(),kind:"nothing"};let o=[...t].sort((n,a)=>a.list.length-n.list.length||n.list.path.length-a.list.path.length)[0];return{...NO(o.list.path,o.records,o.list.keyed),lists:t.map(n=>n.list)}}function K5(){return{format:"json",kind:"nothing",problem:null,dataset:null,lists:[],chosen:null,keyCandidates:[],measureCandidates:[],labelCandidates:[],notMeasures:[],codes:[]}}function Gm(e,t,o,r){if(o>W5)return;if(Array.isArray(e)){let i=e.filter(Yr);i.length&&i.length>=e.length/2&&(r.push({list:{path:t,length:i.length,keyed:!1},records:i}),Gm(i[0],`${t}[0]`,o+1,r));return}if(!Yr(e))return;let n=Object.entries(e),a=n.filter(([,i])=>Yr(i));if(a.length>=Y5&&a.length>=n.length*.8){let i=a.map(([s,l])=>({"(key)":s,...l}));r.push({list:{path:`${t}{}`,length:i.length,keyed:!0},records:i});return}for(let[i,s]of n)Gm(s,`${t}.${i}`,o+1,r)}function NO(e,t,o){let r=t.slice(0,q5).filter(Yr),n=new Map;for(let w of r)for(let[_,I]of L_(w,"",0)){let M=n.get(_);M||(M=X5(),n.set(_,M)),Q5(M,I)}let a=r.length,i=[...n.entries()].map(([w,_])=>eq(w,_,a)),s=i.filter(w=>{let _=(w.kinds.string??0)+(w.kinds["numeric-string"]??0),I=(w.kinds.number??0)>0&&w.decimals===0;return w.present===a&&w.distinct===a&&a>1&&(_===a||I)}).map(w=>w.name).sort((w,_)=>Um(w)-Um(_)),l=new Set(s.filter((w,_)=>_===0||Um(w)<=3)),d=[],u=[],p=[];for(let w of i)if(!(l.has(w.name)||!w.range)&&!(w.distinct<2||w.coverage<.5)){if(J5(w.name)){p.push(w.name);continue}if(w.range.min<0){d.push({field:w.name,reason:"holds negative numbers, which a dataset cannot store yet"});continue}u.push(w.name)}let f=new Map(i.map(w=>[w.name,w])),g=w=>{let _=f.get(w);return(_.present-(_.kinds.null??0))/Math.max(a,1)};u.sort((w,_)=>g(_)-g(w)||f.get(_).distinct-f.get(w).distinct);let b=i.filter(w=>(w.kinds.string??0)>=a*.9&&w.distinct>=a*.5&&Um(w.name)>3).map(w=>w.name).sort((w,_)=>z_(w)-z_(_));return{format:"json",kind:a?"records":"nothing",problem:null,dataset:null,lists:[{path:e,length:t.length,keyed:o}],chosen:{path:e,length:t.length,keyed:o,fields:i},keyCandidates:s,measureCandidates:u,labelCandidates:b,notMeasures:d,codes:p}}function J5(e){let t=e.split(".").pop().toLowerCase();return/(^|_)(rank|rank_type|code|type|order|id|ids|team|region|position)$/.test(t)}function Um(e){let t=e.split(".").pop().toLowerCase();return t==="(key)"?0:t==="id"?1:/(^|_)id$|id$/i.test(t)?2:/key|code|slug/.test(t)?3:z_(e)<2?5:4}function z_(e){let t=e.split(".").pop().toLowerCase();return/^(display_?name|full_?name|name|web_name|title|label)$/.test(t)?0:/name|title|label/.test(t)?1:2}function X5(){return{present:0,kinds:{},distinct:new Set,min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY,allNumeric:!0,decimals:0,samples:[]}}function Q5(e,t){if(t===void 0)return;e.present+=1;let o,r=null;if(t===null)o="null";else if(typeof t=="number"&&Number.isFinite(t))o="number",r=t;else if(typeof t=="string"){let a=t.trim();RO.test(a)?(o="numeric-string",r=Number(a)):o="string"}else typeof t=="boolean"?o="boolean":Array.isArray(t)?o="array":o="object";if(e.kinds[o]=(e.kinds[o]??0)+1,o==="null")return;let n=typeof t=="object"?JSON.stringify(t):String(t);if(e.distinct.size<1e4&&e.distinct.add(n),e.samples.length<3&&!e.samples.includes(n)&&e.samples.push(n.slice(0,60)),r===null){e.allNumeric=!1;return}e.min=Math.min(e.min,r),e.max=Math.max(e.max,r),e.decimals=Math.max(e.decimals,zO(r))}function zO(e){if(Number.isInteger(e))return 0;let t=String(e),o=t.indexOf(".");return o===-1?0:Math.min(t.length-o-1,6)}function eq(e,t,o){let r=(t.kinds.number??0)+(t.kinds["numeric-string"]??0),n=t.present-(t.kinds.null??0),a=t.allNumeric&&r>0&&r===n;return{name:e,present:t.present,coverage:o?t.present/o:0,kinds:t.kinds,distinct:t.distinct.size,range:a?{min:t.min,max:t.max}:null,decimals:a?t.decimals:0,samples:t.samples}}function L_(e,t,o){let r=[];for(let[n,a]of Object.entries(e)){let i=t?`${t}.${n}`:n;Yr(a)&&o+1<H5?r.push(...L_(a,i,o+1)):r.push([i,a])}return r}function Yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tq(e){let t=[],o=[],r="",n=!1;for(let a=0;a<e.length;a+=1){let i=e[a];if(n){i==='"'&&e[a+1]==='"'?(r+='"',a+=1):i==='"'?n=!1:r+=i;continue}i==='"'&&r===""?n=!0:i===","?(o.push(r),r=""):i===`
|
|
278
278
|
`||i==="\r"?(i==="\r"&&e[a+1]===`
|
|
279
|
-
`&&(a+=1),o.push(r),t.push(o),o=[],r=""):r+=i}return(r!==""||o.length)&&(o.push(r),t.push(o)),t.map(a=>a.map(i=>i.trim()))}function nq(e){return 10**Math.min(Math.max(e,0),6)}function jO(e,t){let o=LO(e);if(!o.length)throw new Pt("There is no list of records in it to build from.");let r=t.list?o.find(f=>f.list.path===t.list):[...o].sort((f,g)=>g.list.length-f.list.length)[0];if(!r)throw new Pt(`No list at ${t.list}. The lists in it are: ${o.map(f=>f.list.path).join(", ")}.`);if(!t.measures.length)throw new Pt("Name at least one field to use as a measure.");let n=r.records.filter(Yr).map(f=>new Map(L_(f,"",0))),a=new Map,i=0;for(let f of n){let g=f.get(t.key),b=g==null?"":String(g).trim();if(!b){i+=1;continue}if(a.has(b))throw new Pt(`${t.key} is "${b}" on more than one record, so it cannot be the key. Choose a field that is different on every record.`);a.set(b,f)}if(!a.size)throw new Pt(`No record has a value in ${t.key}.`);let s=new Map;for(let f of t.measures){let g=j_(f),b=s.get(g);if(b!==void 0)throw new Pt(b===f?`${f} is named twice as a measure. Name each field once.`:`${b} and ${f} would both become the measure "${g}". Use only one of them.`);s.set(g,f)}let l={},d=t.measures.map(f=>{let g=new Map;for(let[_,I]of a){let M=oq(I.get(f));if(M!==null){if(M<0)throw new Pt(`${f} is ${M} for "${_}". A dataset cannot hold negative numbers yet
|
|
279
|
+
`&&(a+=1),o.push(r),t.push(o),o=[],r=""):r+=i}return(r!==""||o.length)&&(o.push(r),t.push(o)),t.map(a=>a.map(i=>i.trim()))}function nq(e){return 10**Math.min(Math.max(e,0),6)}function jO(e,t){let o=LO(e);if(!o.length)throw new Pt("There is no list of records in it to build from.");let r=t.list?o.find(f=>f.list.path===t.list):[...o].sort((f,g)=>g.list.length-f.list.length)[0];if(!r)throw new Pt(`No list at ${t.list}. The lists in it are: ${o.map(f=>f.list.path).join(", ")}.`);if(!t.measures.length)throw new Pt("Name at least one field to use as a measure.");let n=r.records.filter(Yr).map(f=>new Map(L_(f,"",0))),a=new Map,i=0;for(let f of n){let g=f.get(t.key),b=g==null?"":String(g).trim();if(!b){i+=1;continue}if(a.has(b))throw new Pt(`${t.key} is "${b}" on more than one record, so it cannot be the key. Choose a field that is different on every record.`);a.set(b,f)}if(!a.size)throw new Pt(`No record has a value in ${t.key}.`);let s=new Map;for(let f of t.measures){let g=j_(f),b=s.get(g);if(b!==void 0)throw new Pt(b===f?`${f} is named twice as a measure. Name each field once.`:`${b} and ${f} would both become the measure "${g}". Use only one of them.`);s.set(g,f)}let l={},d=t.measures.map(f=>{let g=new Map;for(let[_,I]of a){let M=oq(I.get(f));if(M!==null){if(M<0)throw new Pt(`${f} is ${M} for "${_}". A dataset cannot hold negative numbers yet, so leave ${f} out or shift it so its lowest value is nought.`);g.set(_,M)}}if(!g.size)throw new Pt(`${f} holds no numbers, so it cannot be a measure.`);l[f]=a.size-g.size;let b=0;for(let _ of g.values())b=Math.max(b,zO(_));let w=nq(b);return{key:j_(f),label:rq(f),values:Object.fromEntries([...g].map(([_,I])=>[_,Math.round(I*w)])),...w>1?{scale:w}:{}}}),u=t.label?Object.fromEntries([...a].map(([f,g])=>[f,g.get(t.label)]).filter(([,f])=>typeof f=="string"&&f.trim()!=="").map(([f,g])=>[f,{label:String(g).trim()}])):void 0;return{document:It.parse({corpus:"1",...t.source?{source:t.source}:{},...u&&Object.keys(u).length?{entries:u}:{},measures:d}),skipped:{noKey:i,byMeasure:l}}}function LO(e){let t=e.replace(/^/,"").trimStart();if(t.startsWith("{")||t.startsWith("[")){let a;try{a=JSON.parse(t)}catch(s){throw new Pt(`It starts like JSON and does not parse: ${s instanceof Error?s.message:String(s)}`)}let i=[];return Gm(a,"$",0,i),i}let[o,...r]=tq(t);if(!o||o.length<2)return[];let n=r.filter(a=>a.some(i=>i!=="")).map(a=>Object.fromEntries(o.map((i,s)=>[i,a[s]??""])));return[{list:{path:"$",length:n.length,keyed:!1},records:n}]}function oq(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&RO.test(e.trim())?Number(e.trim()):null}function j_(e){return(e==="(key)"?"key":e.split(".").pop()).replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")||"value"}function rq(e){let t=j_(e).replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var q5,W5,H5,Y5,Pt,RO,DO=x(()=>{"use strict";_t();q5=5e3,W5=5,H5=2,Y5=3;Pt=class extends Error{constructor(t){super(t),this.name="InspectRefused"}};RO=/^-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i});var MO=x(()=>{"use strict"});var FO=x(()=>{"use strict"});var aq,fle,gle,yle,ble,wle,UO=x(()=>{"use strict";je();au();aq="We expect to let you in within one to two weeks.",fle=`${aq} We'll email you when your place is ready.`,gle=c.enum(["unconfirmed","waiting","invited","declined","joined"]),yle=c.enum(["invited","declined"]),ble=c.object({email:c.string().trim().toLowerCase().max(254).email("Enter your work email address."),name:c.string().trim().min(1,"Tell us your name.").max(80).regex(/^[^<>@:/\\]+$/,"Use just your name, with no links or symbols.").refine(e=>!/\.[a-z]{2,}\b/i.test(e),"Use just your name, with no links or symbols."),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 place."}),ageConfirmed:c.literal(!0,{message:`Confirm you are ${18} or older.`}),marketingConsent:c.boolean().optional()}),wle=c.object({token:c.string().trim().min(20).max(200)})});var iq,sq,cq,kle,GO=x(()=>{"use strict";iq="Monterosa",sq="04716325",cq="3B, The Plaza, floor 3, 100 Old Hall Street, Liverpool, L3 9QJ, United Kingdom",kle=`${iq}, ${cq}. Company number ${sq}.`});var lq,BO,Bm,qO,WO,xle,Sle,$le,Tle,Ele,HO=x(()=>{"use strict";lq=e=>{if(e===void 0)return;let t=Number(e);return Number.isFinite(t)&&t>0?t:void 0},BO=e=>typeof process>"u"?void 0:lq(process.env?.[e]),Bm=(e,t,o)=>({burst:BO(t)??e.burst,perMinute:BO(o)??e.perMinute}),qO={player:{burst:300,perMinute:600},publicRoutes:{burst:100,perMinute:300}},WO={player:Bm(qO.player,"GAMESTAGE_RATE_PLAYER_BURST","GAMESTAGE_RATE_PLAYER_PER_MINUTE"),publicRoutes:Bm(qO.publicRoutes,"GAMESTAGE_RATE_PUBLIC_BURST","GAMESTAGE_RATE_PUBLIC_PER_MINUTE")},xle=Bm({burst:120,perMinute:120},"GAMESTAGE_RATE_RECOVERY_GAME_PER_MINUTE","GAMESTAGE_RATE_RECOVERY_GAME_PER_MINUTE"),Sle=Bm({burst:120,perMinute:120},"GAMESTAGE_RATE_SESSION_PER_MINUTE","GAMESTAGE_RATE_SESSION_PER_MINUTE"),$le=WO.player,Tle=WO.publicRoutes,Ele=600*1e3});var YO=x(()=>{"use strict"});var D_=x(()=>{"use strict"});var Rle,zle,jle,Lle,VO=x(()=>{"use strict";je();D_();Rle=c.object({has_code:c.boolean(),issued_at:c.string().nullable()}),zle=c.object({code:c.string(),issued_at:c.string(),replaced:c.boolean()}),jle=c.object({code:c.string().max(120)}),Lle=c.object({token:c.string(),player_id:c.string(),kind:c.literal("anonymous"),previous_player:c.literal("kept")})});var ZO,KO,JO=x(()=>{"use strict";ZO={open:"Your progress",showTitle:"Keep your progress",showDetail:"Save this code. It brings your name, scores and achievements back on another phone or browser. You only see it once.",private:"Keep it private. Anyone with this code can play as you.",replace:"Getting a new code stops the old one working.",get:"Get a recovery code",issueFailed:"That didn't work. Check your connection and try again.",copy:"Copy",copied:"Copied",share:"Share",enterTitle:"I've played before",enterDetail:"Type the recovery code you saved to get your progress back.",submit:"Get my progress back",notRecognised:"That code isn't one we know. Check it against the one you saved.",restored:"Welcome back. Your progress is on this device now.",close:"Close"},KO={recovery_open_label:"open",recovery_show_title:"showTitle",recovery_show_detail:"showDetail",recovery_private_note:"private",recovery_replace_note:"replace",recovery_enter_title:"enterTitle",recovery_enter_detail:"enterDetail",recovery_submit_label:"submit",recovery_not_recognised:"notRecognised",recovery_restored:"restored",recovery_get_label:"get",recovery_issue_failed:"issueFailed",recovery_copy_label:"copy",recovery_copied_label:"copied",recovery_share_label:"share",recovery_close_label:"close"}});var XO=x(()=>{"use strict"});function dq(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 Wm(e){let t=dq(e);return`<meta name="color-scheme" content="${t?"light":"dark"}" ${on} />
|
|
280
280
|
<meta name="theme-color" content="${e}" ${on} />
|
|
281
281
|
<style ${on}>
|
|
282
282
|
/* The game's colour from the first frame, before any script. GS-537. */
|
|
@@ -301,7 +301,7 @@ You scored {points} points.`},pF=Object.keys(PA),NA=c.object({notify_template_su
|
|
|
301
301
|
`)}async function or(e){let t=process.stdout;typeof t.writableLength=="number"&&t.writableLength>0&&await new Promise(o=>{let r=()=>o();t.once("drain",r),t.once("error",r),t.once("close",r)}),process.exit(e)}function S(e,t){if(xi)process.stderr.write(JSON.stringify(CP({ok:!1,error:e,detail:t??[]}),null,2)+`
|
|
302
302
|
`);else{process.stderr.write(`${k.red("Error")} ${rx(e)}
|
|
303
303
|
`);for(let o of t??[])process.stderr.write(` ${rx(o)}
|
|
304
|
-
`)}process.exit(1)}var xi,Pq,_i,k,Nq,Rq,ax,Te=x(()=>{"use strict";xi=!1;Pq=()=>!xi&&process.stdout.isTTY===!0&&!process.env.NO_COLOR,_i=(e,t)=>Pq()?`\x1B[${e}m${t}\x1B[0m`:t,k={bold:e=>_i("1",e),dim:e=>_i("2",e),red:e=>_i("31",e),green:e=>_i("32",e),yellow:e=>_i("33",e),cyan:e=>_i("36",e)};Nq=["admin","adopt","ads","archive","client","create","deploy","dev","doctor","docs","domain","endpoint","formats","graphic","help","inspect","issue","link","list","live","login","logout","logs","look","manifest","open","org","plan","promote","prune","reference","rename","review","round","sources","start","status","suggest","suspend","theme","usage","verify","wake","whoami","workspace"],Rq=/`gamestage ([a-z][a-z-]*)((?: [^`]*)?)`/g});function zq(e=Zm){let[t,o]=e.replace(/^[^\d]*/,"").split(".").map(Number);return[t,o||0]}function IP(e,t=Zm){let[o,r]=zq(t),[n,a]=e.split(".").map(Number);return n>o||n===o&&a>=r}var nt,xo,Zm,rr=x(()=>{"use strict";nt="0.65.
|
|
304
|
+
`)}process.exit(1)}var xi,Pq,_i,k,Nq,Rq,ax,Te=x(()=>{"use strict";xi=!1;Pq=()=>!xi&&process.stdout.isTTY===!0&&!process.env.NO_COLOR,_i=(e,t)=>Pq()?`\x1B[${e}m${t}\x1B[0m`:t,k={bold:e=>_i("1",e),dim:e=>_i("2",e),red:e=>_i("31",e),green:e=>_i("32",e),yellow:e=>_i("33",e),cyan:e=>_i("36",e)};Nq=["admin","adopt","ads","archive","client","create","deploy","dev","doctor","docs","domain","endpoint","formats","graphic","help","inspect","issue","link","list","live","login","logout","logs","look","manifest","open","org","plan","promote","prune","reference","rename","review","round","sources","start","status","suggest","suspend","theme","usage","verify","wake","whoami","workspace"],Rq=/`gamestage ([a-z][a-z-]*)((?: [^`]*)?)`/g});function zq(e=Zm){let[t,o]=e.replace(/^[^\d]*/,"").split(".").map(Number);return[t,o||0]}function IP(e,t=Zm){let[o,r]=zq(t),[n,a]=e.split(".").map(Number);return n>o||n===o&&a>=r}var nt,xo,Zm,rr=x(()=>{"use strict";nt="0.65.1",xo="2026-10-31-4",Zm=">=22.13.0"});function lt(){return{[HI]:nt}}function jq(e){let t=e;return t?.code===Dm||t?.status===426}function Lq(e){let t=e?.trim()||`Update required: this is gamestage ${nt}, and a newer version is needed. Run ${Hr}.`;T()?process.stderr.write(JSON.stringify({ok:!1,code:Dm,error:t,update:{current:nt,command:Hr},detail:[]},null,2)+`
|
|
305
305
|
`):process.stderr.write(`${t}
|
|
306
306
|
`),process.exit(1)}function Ht(e){if(!jq(e))return;let t=e.code===Dm,o=e.message;Lq(t&&typeof o=="string"?o:void 0)}var An=x(()=>{"use strict";ke();Te();rr()});function Dq(e){try{let t=new URL(e).hostname.toLowerCase();return t==="localhost"||t.endsWith(".localhost")||t==="::1"||t.startsWith("127.")}catch{return!1}}function OP(e){return e.GAMESTAGE_TEST_RUN==="1"||e.NODE_TEST_CONTEXT!==void 0}function Kn(e=process.env){return OP(e)?1:void 0}function Km(e=ze,t=process.env){if(OP(t)&&!Dq(e)&&t.GAMESTAGE_ALLOW_REMOTE_TESTS!=="1")return`Refusing to register a test game against non-local control plane ${e}. Use the throwaway local control plane, or set GAMESTAGE_ALLOW_REMOTE_TESTS=1 for a deliberate real-plane run.`}function $i(e=ze){let t=Km(e);t&&S(t)}async function Cn(){let e=await Xe();return e||S("You are not signed in.",["Run `gamestage login`. It creates the account too if you do not have one.","Inspecting, scaffolding and validating a manifest still need no account."]),e}async function pe(){let e=await Cn();return{client:Yn({baseUrl:ze,headers:lt(),maxAttempts:Kn(),workspace:H_(),token:async()=>(await Xe())?.accessToken??e.accessToken}),email:e.email??e.userId??"unknown"}}async function rn(){let e=await Xe().catch(()=>null);if(e)return Yn({baseUrl:ze,headers:lt(),maxAttempts:Kn(),workspace:H_(),token:async()=>(await Xe())?.accessToken??e.accessToken})}async function ar(){await Cn();let e=await rn();if(!e)throw new Error("Signed in, but the session could not be read. Run `gamestage login` again.");return e}async function ct(){let e=await Xe();return e||S("You are not signed in.",["Run `gamestage login`. An operator's command needs an operator's own session."]),{admin:UI({baseUrl:ze,headers:lt(),maxAttempts:Kn(),token:async()=>(await Xe())?.accessToken??e.accessToken}),email:e.email??e.userId??"unknown"}}async function Oc(e){try{let t=await e.getWorkspace(),o=t?.access;return o==="approved"||o==="pending"||o==="refused"?{access:o,workspace:t}:{access:"unreported",workspace:t}}catch(t){Ht(t);let o=t.status,r=t.code;return r===cx?{access:"pending"}:r===Lm?{access:"unknown",problem:"not_a_control_plane",reason:t.message??`${ze} is not a Gamestage control plane.`,detail:["You are signed in, and your token was never checked: the address is wrong, not the token.","The main Space's API is https://api.gamestage.ai, which is the default when GAMESTAGE_CONTROL_URL is unset."]}:o===404||r==="not_found"?{access:"unknown",problem:"no_control_plane",reason:`Nothing is serving a control plane at ${ze}.`,detail:["You are signed in, and deploying will fail until this is pointed somewhere real.","Set GAMESTAGE_CONTROL_URL to your control plane and run this again."]}:o===401||o===403?{access:"unknown",problem:"token_refused",reason:"The control plane refused this account's token.",detail:[`It is at ${ze}.`,"A token from one environment is refused by another, so check which one you signed into."]}:{access:"unknown",problem:"unreachable",reason:`Could not reach the control plane at ${ze}.`,detail:[String(t.message??t),"You are signed in. Deploying will fail until this answers."]}}}function Pc(e){switch(e.access){case"approved":return{ok:!0,status:"approved",access:"approved",heading:"Approved",message:"Your account is approved, so every command works, including deploy.",next:["`gamestage status` shows the workspace, its games and what they are using."]};case"pending":return{ok:!0,status:"pending_approval",access:"pending",code:cx,heading:"On the waitlist",message:"You are registered and your account is on the waitlist. That is the normal path for an account created without an invitation, and a person decides it.",next:["Finish your application at https://gamestage.ai/stage: three questions and the terms. Nobody can approve the account until both are in.","We email you when the account is approved, usually within one to two weeks.","Inspecting a prototype, scaffolding a game and writing a round all work now and need no approval.","`gamestage status` re-checks approval. It never opens the browser again."]};case"refused":return{ok:!0,status:"access_refused",access:"refused",heading:"Access refused",message:"This account has been refused access. Signing in worked, so this is a decision about the account rather than a broken token.",next:["Nothing in the CLI changes this, and running `gamestage login` again will not.","Inspecting, scaffolding and writing a round still work and need no account.",`If you think this is wrong, say so where you registered: ${Je}.`]};case"unreported":return{ok:!0,status:"access_not_reported",access:null,heading:"Signed in",message:"This control plane answered and does not report an access state, so whether this account is approved is not known here.",next:["It predates the access state rather than being broken, so carry on.","A deploy that is refused for approval will say so in its own words."]};default:return{ok:!1,status:e.problem==="no_control_plane"||e.problem==="not_a_control_plane"?e.problem:e.problem==="token_refused"?"token_refused":"control_plane_unreachable",access:null,heading:"Signed in, and the control plane is not usable",message:e.reason,next:e.detail}}}function PP(e){return!e.changed&&e.refused?{ok:!0,status:"refused_by_store",access:e.access,code:e.code,heading:"Not approved",message:e.refused,next:[e.code==="profile_incomplete"?"Nothing was written. When they have finished their application in Stage, run this again.":e.code==="personal_email"?"Nothing was written. Ask them to sign in with their work email, or approve the exception in Stage > Approvals.":"Nothing was written. When they have accepted the terms, run this again."]}:e.changed?e.access==="approved"?{ok:!0,status:"approved",access:"approved",heading:"Approved",message:`${e.workspaceId} was ${e.previous} and is now approved.`,next:["Their next `gamestage status` says approved, and deploy works from then on."]}:{ok:!0,status:"refused",access:"refused",heading:"Refused",message:`${e.workspaceId} was ${e.previous} and is now refused.`,next:["Their next `gamestage status` says refused, and says how to argue with it."]}:{ok:!0,status:"unchanged",access:e.access,heading:"No change",message:`${e.workspaceId} was already ${e.previous}. Nothing was written.`,next:["No audit record either: the trail records transitions, and this was not one."]}}function Ti(e){if(E(e.heading),h(` ${e.message}`),e.next.length){h();for(let t of e.next)v(t)}h()}function NP(e,t,o){let r=i=>{let s=i.trim().toLowerCase();return ii.options.find(l=>l===s||Yo[l].toLowerCase()===s)},n=ii.options.map(i=>`${i} (${Yo[i]})`).join(", "),a=r(t);return a?o===void 0?{request:{workspaceId:e,tier:a}}:!/^\d+$/.test(o)||Number(o)>1e4?{problem:`"${o}" is not a live-game allowance.`,detail:["Give a whole number from 0 to 10000, where 0 means no ceiling.","Nothing has been changed."]}:{request:{workspaceId:e,tier:a,allowance:Number(o)}}:r(e)?{problem:"The workspace comes first and the plan second.",detail:[`Try: ${V(`admin plan ${t} ${e}`)}`,"Nothing has been changed."]}:{problem:`"${t}" is not a plan.`,detail:[`Use one of: ${n}.`,"Nothing has been changed."]}}function Si(e){let t=Yo[e.tier];if(e.liveGameAllowance===void 0)return t;let o=e.liveGameAllowance===0?"no live-game ceiling":`${e.liveGameAllowance} live game${e.liveGameAllowance===1?"":"s"}`;return`${t}, ${o}`}function RP(e){let{request:t,previous:o,result:r,stored:n}=e,a=Si({tier:t.tier,liveGameAllowance:t.allowance}),i={previous:o,stored:n};return r.refused?{...i,status:"refused_by_store",exitCode:1,heading:"Not changed",message:r.refused,next:["Nothing was written."]}:n?n.tier===t.tier&&(t.allowance===void 0||n.liveGameAllowance===t.allowance)?o!==null&&o.tier===n.tier&&o.liveGameAllowance===n.liveGameAllowance?{...i,status:"unchanged",exitCode:0,heading:"No change",message:`${t.workspaceId} was already on ${Si(n)}, and still is.`,next:[sx]}:{...i,status:"set",exitCode:0,heading:"Plan set",message:`${t.workspaceId} is on ${Si(n)}, read back from the control plane after the write.`,next:[sx]}:{...i,status:"not_what_was_asked",exitCode:1,heading:"Not what was asked",message:`${t.workspaceId} was sent ${a} and holds ${Si(n)}. The write reported success, and the stored workspace disagrees with it.`,next:["Run it again to see whether the second read agrees. If it still disagrees, that is a control-plane defect to raise, not an operator mistake."]}:{...i,status:"unconfirmed",exitCode:2,heading:"Sent, and not confirmed",message:`The control plane accepted ${t.workspaceId} moving to ${a}, and could not then be asked what it kept: ${e.unreadable??"no reason given"}.`,next:["Treat the plan as unknown rather than set. Run this again once the control plane answers reads; repeating the same plan is safe.",sx]}}function zP(e){if(E(e.heading),h(` ${e.message}`),h(),$("Before",e.previous?Si(e.previous):"could not be read"),$("Stored now",e.stored?Si(e.stored):"could not be read"),e.next.length){h();for(let t of e.next)v(t)}h()}function Mq(e){let t=e.status,o=e instanceof Error?e.message:"";if(!(t!==404||!/^No game with id\b/.test(o)))return"This workspace has no game by that id: it was never registered, or `create` could not register it. Run `gamestage manifest register gamestage.yaml` in the game's folder, then run this again."}async function ce(e){let t=[],o=e.status,r=e.code;if(Ht(e),r===cx){let{client:a}=await pe(),i=Pc(await Oc(a));i.access==="approved"&&i.next.push("The original command was not completed. Run it again."),T()?A({ok:!1,status:i.status,access:i.access,code:i.code,message:i.message,next:i.next}):Ti(i),process.exit(1)}r===Lm&&S(e instanceof Error?e.message:`${ze} is not a Gamestage control plane.`,["Your session was never checked: the address is wrong, not the token.","Unset GAMESTAGE_CONTROL_URL to use https://api.gamestage.ai, or set it to a Space's API address.",`Code: ${r}`]);let n=Mq(e);n&&t.push(n),o===401?t.push("Your session has expired. Run `gamestage login` again."):o===403&&r===ok||(o===403?t.push("Either your session expired or that is not something this workspace is allowed to do. `gamestage login` rules out the first."):o===429?t.push("You are being rate limited. Wait a moment and try again."):e.retryable&&t.push("This one is worth retrying: the failure was at our end.")),r&&t.push(`Code: ${r}`),t.push(`Control plane: ${ze}`),S(e instanceof Error?e.message:"The control plane call failed.",t)}var ze,cx,sx,He=x(()=>{"use strict";V_();ke();En();Te();Zn();An();ze=process.env.GAMESTAGE_CONTROL_URL??"https://api.gamestage.ai";cx="access_pending";sx="This does not re-provision. A live round keeps the caps it was provisioned with, including its day cap, until the game is deployed again, so a creator refused before this is refused the same way until they redeploy with `gamestage deploy`. That is not this change failing."});var Ai,Zr,pt,$o,Jn,Ye,Xn,Wq,Hq,Yq,Vq,Zq,Kq,Jq,Xq,Qq,e3,t3,Ci,mx,hn=x(()=>{"use strict";Ai=`/**
|
|
307
307
|
* @monterosa/gamestage-player, bundled for a browser.
|
|
@@ -8696,7 +8696,7 @@ data: {}
|
|
|
8696
8696
|
this machine. Stage shows the command with your workspace in it.`))):(h(` Not signed in. ${k.cyan(V("login"))} binds this machine to your account,`),h(" and creates the account if you do not have one."),h(k.dim(" Inspect, create and validate need no account, so start there.")),h(k.dim(` ${V("dev")}, ${V("verify")} and ${V("deploy")} ask you to sign in first.`))),E("Where you are"),o.round_in_manifest)h(` An App Manifest is present, and it still carries a round. ${Oi}`);else if(o.has_manifest&&o.has_round===!1)h(` An App Manifest is present, and there is no practice round in ${Me} yet.`);else if(o.has_manifest&&o.has_round===!0)h(` An App Manifest is present, with a practice round in ${Me}.`);else if(o.has_manifest)h(" An App Manifest is already present.");else if(o.has_package_json||o.html_files.length){let l=[o.has_package_json?"a Node project":null,o.html_files.length?`${o.html_files.length} HTML file(s)`:null].filter(Boolean);h(` Found ${l.join(" and ")}. This looks like a game to inspect.`)}else h(" Nothing here yet. This looks like a fresh start.");if(E("Do this next"),h(` ${k.cyan(n[r].command)}`),h(` ${k.dim(n[r].why)}`),r==="create"||r==="inspect"){h(),h(` ${k.dim("The formats you can build today:")}`);let l=new Set(vR.map(({format:d})=>d));for(let d of bt){let u=`${Bo[d].name} (${d})`;l.has(d)?h(` ${k.cyan(u)} ${k.dim(ra[d])}`):h(` ${k.cyan(u)} ${k.dim("No starter page yet: bring your own page.")}`)}}h(),h(` ${k.dim("Or paste this into Claude Code, Codex, Gemini or Cursor:")}`);for(let l of f7(n[r].prompt,74))h(` ${k.cyan(l)}`);E("Good to know"),h(k.dim(` Inspect, create and validate run anonymously. \`dev\` and \`verify\`
|
|
8697
8697
|
need you signed in, because they run your round through a real
|
|
8698
8698
|
Engine. \`gamestage login\` creates the account if you do not have
|
|
8699
|
-
one yet. ${_C}`)),h()}var qi=class extends Error{};function zz(e){let t=e.what.trim();if(!t)throw new qi("Say what you were trying to build.");if(t.length>2e3)throw new qi(`That is ${t.length} characters and the limit is 2000. Send the shape of the problem; we will ask for the rest.`);let o=(e.closest??"").trim();return{kind:"suggestion",what:t,closest:o||"none",cli_version:e.cliVersion}}function jz(e){return JSON.stringify(e,null,2)}async function Gp(e,t,o=2e3){if(e!==void 0&&e.trim())return e;if(t.isTTY)return e??"";let r=t[Symbol.asyncIterator](),n,a=Symbol("nothing came"),i=await Promise.race([r.next(),new Promise(d=>{n=setTimeout(()=>d(a),o)})]);if(clearTimeout(n),i===a||i.done)return r.return?.().catch(()=>{}),e??"";let s=[Lz(i.value)];for(let d=await r.next();!d.done;d=await r.next())s.push(Lz(d.value));let l=s.join("");return l.trim()?l:e??""}function Lz(e){return typeof e=="string"?e:Buffer.from(e).toString("utf8")}Te();var y7=process.env.GAMESTAGE_SUGGEST_URL??"https://gamestage.ai/api/suggest";async function Dz(e,t,o,r=process.stdin){let n=await Gp(e,r),a;try{a=zz({what:n,closest:t.closest,cliVersion:o})}catch(l){throw l instanceof qi&&S(l.message),l}if(!t.send){if(T()){A({sent:!1,would_send:a});return}E("This is everything that would be sent"),h(),h(jz(a)),h(),v("No manifest, no round, no answers and no source. There is nowhere in that shape to put one."),v(n===e?`Send it with ${V('suggest "..." --send')}.`:`Send it by piping the same text again, with ${V("suggest --send")}.`);return}let i;try{i=await fetch(y7,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)})}catch(l){S("Could not reach Gamestage to send that.",[l instanceof Error?l.message:String(l)])}let s=await i.json().catch(()=>({}));if(i.ok||S(`Gamestage refused that suggestion (${i.status}).`,[s.error?.message??"It said nothing more."]),T()){A({sent:!0,reference:s.reference??null});return}E("Sent"),s.reference&&v(`Reference ${s.reference}. Quote it if you follow up.`),v("Somebody at Monterosa reads these. A format that keeps arriving gets built.")}var Wi=class extends Error{};function Mz(e){let t=e.what.trim();if(!t)throw new Wi("Say what went wrong.");if(t.length>2e3)throw new Wi(`That is ${t.length} characters and the limit is 2000. Send what broke and how to hit it; we will ask for the rest.`);let o=(e.game??"").trim();return{kind:"issue",what:t,game:o||"none",cli_version:e.cliVersion,node_version:e.nodeVersion,platform:e.platform}}function Fz(e){return JSON.stringify(e,null,2)}Te();var b7=process.env.GAMESTAGE_ISSUE_URL??"https://gamestage.ai/api/issue";async function Uz(e,t,o,r=process.stdin){let n=await Gp(e,r),a;try{a=Mz({what:n,game:t.game,cliVersion:o,nodeVersion:process.version,platform:process.platform})}catch(l){throw l instanceof Wi&&S(l.message),l}if(!t.send){if(T()){A({sent:!1,would_send:a});return}E("This is everything that would be sent"),h(),h(Fz(a)),h(),v("No manifest, no round, no answers and no source. There is nowhere in that shape to put one."),v(n===e?`Send it with ${V('issue "..." --send')}.`:`Send it by piping the same text again, with ${V("issue --send")}.`);return}let i;try{i=await fetch(b7,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)})}catch(l){S("Could not reach Gamestage to send that.",[l instanceof Error?l.message:String(l)])}let s=await i.json().catch(()=>({}));if(i.ok||S(`Gamestage refused that report (${i.status}).`,[s.error?.message??"It said nothing more."]),T()){A({sent:!0,reference:s.reference??null});return}E("Reported"),s.reference&&v(`Reference ${s.reference}. Quote it if you follow up.`),v("It is in the backlog now. Somebody at Monterosa reads these.")}ke();He();import{readFile as w7}from"node:fs/promises";import{resolve as v7}from"node:path";Te();async function Gz(e){let t=v7(e),o;try{o=await w7(t,"utf8")}catch{S(`No such file: ${e}`,["Give the path to a JSON file holding the reference data."])}let r;try{r=JSON.parse(o)}catch(a){S(`${e} is not JSON.`,[a instanceof Error?a.message:"Could not parse it."])}let n=It.safeParse(r);if(!n.success){let a=n.error.issues[0];S(`${e} is not valid reference data.`,[a?`${a.path.join(".")||"document"}: ${a.message}`:"No detail.",'It needs `{ "corpus": "1", "measures": [{ "key", "label", "values" }] }`.'])}return{body:o,measures:n.data.measures.map(a=>a.key)}}function k7(e){let t=It.parse(JSON.parse(e));return Object.fromEntries(t.measures.map(o=>[o.key,Object.keys(o.values).length]))}var _7={copy:"immutable copy",pointer:"reference data"};async function x7(e,t,o){try{await Ap(e,t,"application/json",`The ${o}`)}catch(r){if(!(r instanceof no))throw r;r.code==="EntityTooLarge"&&S(r.message),S(`The ${o} upload was refused${r.status?` with ${r.status}`:""}.`,["A signed URL lasts fifteen minutes. Run the push again for a fresh one."])}}async function Bz(e,t,o={}){let{client:r}=await pe(),{body:n}=await Gz(t),a=Bu(n),i=R_(n),s=await r.getDataset(e).catch(()=>{}),l=i.ok?CO(s?.dataset?.scored,i.summary):[];l.length&&!o.dropScoring&&S(`This push would stop ${l.join(", ")} scoring rounds.`,[`The live ${e} gives ${l.join(", ")} a scoring block and ${t} does not.`,"Add the block back, or pass --drop-scoring if removing it is the point."]);let d=await r.referenceUploadTarget(e,a),u=await AO(n,async(g,b)=>{await x7(g==="copy"?d.copy:d.pointer,b,_7[g])});u.ok||S(`${t} is not valid reference data.`,[u.detail??"No detail."]);let{measures:p,counts:f}=u.summary;if(T())return A({ok:!0,name:e,digest:a,measures:p,counts:f,key:d.pointer.key});E("Pushed"),v(`${e} is now the reference data for this workspace`);for(let g of p)v(`${g}: ${f[g].toLocaleString("en-GB")} values`);v(`Digest ${a}, kept so a round can say what it was scored on`),h(),v("A round provisioned from now on uses this. One already in play keeps"),v("the numbers it opened with, which is deliberate.")}async function qz(e,t){let{body:o,measures:r}=await Gz(e),n=k7(o),a=It.parse(JSON.parse(o)),i={};for(let s of a.measures){let l=t.filter(d=>typeof s.values[d]!="number");l.length&&(i[s.key]=l)}if(T())return A({ok:Object.keys(i).length===0,measures:r,counts:n,missing:i});E("Reference data");for(let s of r)v(`${s}: ${n[s].toLocaleString("en-GB")} values`);if(!t.length){h(),v("Pass the keys a round uses to check them: `reference check <file> <key>...`");return}if(h(),!Object.keys(i).length){v(`All ${t.length} key(s) are present in every measure.`);return}for(let[s,l]of Object.entries(i))v(`${s} has no value for ${l.map(d=>`"${d}"`).join(", ")}`);S("A round using those keys would leave them out of their groups, or be refused if that leaves a group without a real choice. They never score as nothing.")}ke();He();An();Te();import{existsSync as z0}from"node:fs";import{readFile as S7,writeFile as Hz}from"node:fs/promises";import{resolve as j0}from"node:path";import{createInterface as $7}from"node:readline/promises";var qp="The Gamestage control plane you are signed in to is older than this command. It arrives with the next deploy of that Space.";async function yr(e,t){try{return await e()}catch(o){if(Ht(o),o instanceof Le&&(o.status===404||o.status===405))return S(`${t} is not available here.`,[qp]);let r=o instanceof Error?o.message:String(o),n=o instanceof Le?` (${o.status})`:"";return S(`${t} was refused${n}: ${r}`,[])}}async function L0(e){let t=await yr(()=>e.listDatasets(),"Listing datasets");return t.unavailable&&S("Gamestage could not read this workspace's datasets.",[t.unavailable]),t}function Yz(e,t){return e.some(o=>o.id===t&&o.state==="archived")}function T7(e){return`${e.name}${e.archived?" (archived)":""}`}function D0(e){return e.origin!=="pull"?"uploaded":`pulled from ${un.find(o=>o.id===e.supplier)?.label??e.supplier??"a source"}`}function E7(e,t){return e.map(o=>{let r=Object.values(o.counts??{});return{name:o.name,from:D0(o),entities:o.counted&&r.length?Math.max(...r):null,measures:o.measures??[],bytes:o.bytes??0,publishedAt:o.publishedAt??null,checkedAt:o.checkedAt??null,failing:!!o.failing,readBy:t?_m(t,o).map(n=>({name:n.gameName||n.gameId,archived:Yz(t,n.gameId)})):null}})}var N0=6;async function Vz(){let{client:e}=await pe(),t=await yr(()=>e.listDatasets(),"Listing datasets");t.unavailable&&S("Gamestage could not read this workspace's datasets.",[t.unavailable]);let o=await e.getWorkspace().then(n=>n.games).catch(()=>null),r=E7(t.datasets,o);if(T())return A({ok:!0,datasets:r});if(!r.length){E("No datasets in this workspace yet"),v("Explore a file or an API first: `gamestage reference inspect <file|url>`"),v("Upload one: `gamestage reference push <name> <file>`"),v("Or switch on a source: `gamestage sources`");return}E(`${r.length} dataset${r.length===1?"":"s"} in this workspace`);for(let n of r){h(),h(` ${k.bold(n.name)}`),v(`${n.from.charAt(0).toUpperCase()}${n.from.slice(1)}${n.failing?", last pull failed":""}`);let a=n.measures.slice(0,N0),i=n.measures.length-a.length;v(`${n.entities===null?"Not counted yet":Bp(n.entities)}, ${n.measures.length} measure${n.measures.length===1?"":"s"}${a.length?`: ${a.join(", ")}${i?`, and ${i} more`:""}`:""}`),v(`${hl(n.bytes)}, published ${ca(n.publishedAt)}`),n.readBy&&v(n.readBy.length?`Read by ${n.readBy.map(T7).join(", ")}`:"No game reads it")}h(),v("`gamestage reference status <name>` for one dataset's detail and the rounds built from it.")}async function Zz(e){let{client:t}=await pe(),o=await yr(()=>t.getDataset(e),"Reading the dataset");if(!o){let l=(await L0(t)).datasets.map(d=>d.name);S(`This workspace holds no dataset called ${e}.`,[l.length?`It holds: ${l.join(", ")}.`:"It holds none yet. `gamestage reference push` uploads one."])}let r=await t.getDataLog({dataset:e,limit:100}).catch(()=>[]),n=await t.getWorkspace().then(s=>s.games).catch(()=>[]),{dataset:a}=o,i=o.usedBy.map(s=>({...s,archived:Yz(n,s.gameId)}));if(T())return A({ok:!0,dataset:a,usedBy:i,log:r});if(E(a.name),$("From",`${D0(a)}${a.failing?", last pull failed":""}`),$("Digest",a.digest||"unknown"),$("Size",hl(a.bytes)),$("Published",ca(a.publishedAt)),$("Last checked",ca(a.checkedAt)),!a.counted)$("Measures","not counted yet");else for(let s of a.measures){let l=a.scored?.includes(s)?", scores rounds":"";$(s,`${Bp(a.counts[s]??0)}${l}`)}h(),h("Games"),i.length||v("No game reads it.");for(let s of i)v(C7(s));h(),h("Rounds built from it"),r.length||v("None yet. A line appears when a game builds a round from it.");for(let s of A7(r).slice(-10)){let l=s.times>1?`, ${s.times} times to ${ca(s.last)}`:"";v(`${ca(s.at)}${l} ${s.ok?"":"refused: "}${s.message||s.event}${s.gameName?` (${s.gameName})`:""}`)}v("Pulls and uploads are not listed here; Published and Last checked above are the latest."),h()}function A7(e){let t=[];for(let o of e){let r=t[t.length-1];r&&r.message===o.message&&r.gameId===o.gameId&&r.ok===o.ok?(r.times+=1,r.last=o.at):t.push({...o,times:1,last:o.at})}return t}function C7(e){let t=e.gameName||e.gameId;return e.archived?`${t} (archived, does not stop a delete)`:e.stale?`${t}, on an older copy until its next round`:t}var I7=12,O7=2e4,R0=25e6;function Kz(e){if(!/^https?:\/\//i.test(e))return e;let t;try{t=new URL(e)}catch{return e}let o=!1;(t.username||t.password)&&(t.username=t.username?"HIDDEN":"",t.password=t.password?"HIDDEN":"",o=!0);for(let r of[...t.searchParams.keys()])/key|token|secret|sig|password|passwd|auth|access|credential|session/i.test(r)&&(t.searchParams.set(r,"HIDDEN"),o=!0);return o?t.toString():e}async function P7(e,t){let o=e.body?.getReader();if(!o)return e.text();let r=[],n=0;for(;;){let{done:a,value:i}=await o.read();if(a)break;n+=i.byteLength,n>R0&&(await o.cancel().catch(()=>{}),S(`${t} sent more than ${hl(R0)}, more than inspect reads.`,["Save a smaller sample to a file and inspect that."])),r.push(i)}return new TextDecoder().decode(Buffer.concat(r))}async function Jz(e,t){if(/^https?:\/\//i.test(e)){let r={};for(let i of t){let s=i.indexOf(":");s<1&&S(`--header needs "Name: value", and got "${i.split(":")[0]}".`),r[i.slice(0,s).trim()]=i.slice(s+1).trim()}let n;try{n=await fetch(e,{headers:r,signal:AbortSignal.timeout(O7)})}catch(i){S(`Could not reach ${new URL(e).host}.`,[i instanceof Error?i.message:String(i)])}n.ok||S(`${new URL(e).host} answered ${n.status}.`,[n.status===401||n.status===403?'It wants a key. Pass it the way that API documents, for example --header "Authorization: Bearer <key>".':"Check the address in a browser first."]);let a=Number(n.headers.get("content-length")??0);return a>R0&&S(`That answer is ${hl(a)}, more than inspect reads.`,["Save a smaller sample to a file and inspect that."]),P7(n,new URL(e).host)}t.length&&S("--header is for an address, not a file.");let o=j0(e);return z0(o)||S(`No such file: ${e}`,["Give a path to a JSON or CSV file, or an https:// address."]),S7(o,"utf8")}async function Xz(e,t){let o=await Jz(e,t.header??[]),r=Kz(e),n;try{n=PO(o)}catch(a){throw a instanceof Pt&&S(`Cannot inspect ${r}.`,[a.message]),a}if(T())return A({ok:!0,source:r,...n,chosen:n.chosen});N7(r,n),r!==e&&(h(),v("The key in the address is shown as HIDDEN. Put it back when you run the command above, or send it with --header."))}function N7(e,t){if(t.kind==="dataset"&&t.dataset){let i=t.dataset;E(`${e} is a Gamestage dataset`),$("Entries",i.entities.toLocaleString("en-GB")),$("Named",`${i.labelled.toLocaleString("en-GB")} have a name a producer reads`);for(let s of i.measures){let l=s.range?`${s.range.min} to ${s.range.max}`:"empty",d=s.scale?`, divided by ${s.scale} to show`:"",u=s.scoring?", scores rounds":"";$(s.key,`${s.count.toLocaleString("en-GB")} values, ${l}${d}${u}`)}i.sampleKeys.length&&$("Keys look like",i.sampleKeys.map(s=>`"${s}"`).join(", ")),h(),v(`Check a round's keys: \`gamestage reference check ${e} <key>...\``),v(`Upload it: \`gamestage reference push <name> ${e}\``);return}if(t.kind==="nothing"||!t.chosen){E(`${e} holds no list of records`),v("A dataset is built from a list: one record per player, team or item, each with the same fields."),v("If the list is further down an API, inspect the address that returns it.");return}t.kind==="invalid-dataset"&&(E(`${e} says it is a dataset and is not a valid one`),v(t.problem??"It does not match the dataset format."),h());let o=t.chosen;E(`${e} holds ${t.lists.length===1?"a list":`${t.lists.length} lists`} of records`);for(let i of t.lists)$(i.path,`${i.length.toLocaleString("en-GB")} records${i.keyed?", keyed by id":""}${i.path===o.path?" (described below)":""}`);h(),h(`Fields of ${o.path}`);for(let i of o.fields.slice(0,40))$(i.name,R7(i));o.fields.length>40&&v(`and ${o.fields.length-40} more; --json lists them all`),h();let r=t.keyCandidates.slice(1).filter(i=>!t.measureCandidates.includes(i)).slice(0,3);$("Key",t.keyCandidates[0]?`${t.keyCandidates[0]}${r.length?` (or ${r.join(", ")})`:""}`:"none: no field is on every record and different on each"),$("Name",t.labelCandidates[0]??"none found");let n=t.measureCandidates.slice(0,I7),a=t.measureCandidates.length-n.length;if($("Measures",n.length?`${n.join(", ")}${a?`, and ${a} more`:""}`:"none: no field holds numbers that count"),t.codes.length&&$("Left out",`${t.codes.length} number${t.codes.length===1?"":"s"} that label rather than count (ranks, ids, types): ${t.codes.slice(0,6).join(", ")}${t.codes.length>6?", ...":""}`),t.notMeasures.length&&$("Negative",`${t.notMeasures.map(i=>i.field).slice(0,6).join(", ")}${t.notMeasures.length>6?", ...":""} hold negative numbers, which a dataset cannot store yet (GS-350)`),(a||t.codes.length>6||t.notMeasures.length>6)&&v("`--json` lists every field."),t.keyCandidates[0]&&t.measureCandidates.length){h();let i=t.lists.length>1?` --list '${o.path}'`:"",s=t.labelCandidates[0]?` --label ${t.labelCandidates[0]}`:"";v("Build a dataset from it, choosing the measures a round should count:"),v(`\`gamestage reference build ${e}${i} --key ${t.keyCandidates[0]} --measure ${t.measureCandidates.slice(0,2).join(" --measure ")}${s} --out dataset.json\``," ")}}function R7(e){let t=Object.entries(e.kinds).sort((a,i)=>i[1]-a[1]).map(([a])=>a==="numeric-string"?"number as text":a).join(" or "),o=e.coverage<1?`, on ${Math.round(e.coverage*100)}%`:"",r=e.range?`, ${e.range.min} to ${e.range.max}`:"",n=e.samples.length?`, e.g. ${e.samples.map(a=>JSON.stringify(a)).join(", ")}`:"";return`${t}${o}${r}${n}`}async function Qz(e,t){t.key||S("Say which field is the key: --key <field>.",["`gamestage reference inspect` suggests one."]),t.measure?.length||S("Name at least one measure: --measure <field>.",["`gamestage reference inspect` lists the fields that hold numbers."]),t.out||S("Say where to write it: --out <file>.");let o=j0(t.out);z0(o)&&!t.force&&S(`${t.out} already exists.`,["Choose another name, or pass --force to replace it."]);let r=await Jz(e,t.header??[]),n;try{n=jO(r,{key:t.key,measures:t.measure,label:t.label,list:t.list,source:t.source})}catch(l){throw l instanceof Pt&&S(`Cannot build a dataset from ${Kz(e)}.`,[l.message]),l}let a=JSON.stringify(n.document,null,2)+`
|
|
8699
|
+
one yet. ${_C}`)),h()}var qi=class extends Error{};function zz(e){let t=e.what.trim();if(!t)throw new qi("Say what you were trying to build.");if(t.length>2e3)throw new qi(`That is ${t.length} characters and the limit is 2000. Send the shape of the problem; we will ask for the rest.`);let o=(e.closest??"").trim();return{kind:"suggestion",what:t,closest:o||"none",cli_version:e.cliVersion}}function jz(e){return JSON.stringify(e,null,2)}async function Gp(e,t,o=2e3){if(e!==void 0&&e.trim())return e;if(t.isTTY)return e??"";let r=t[Symbol.asyncIterator](),n,a=Symbol("nothing came"),i=await Promise.race([r.next(),new Promise(d=>{n=setTimeout(()=>d(a),o)})]);if(clearTimeout(n),i===a||i.done)return r.return?.().catch(()=>{}),e??"";let s=[Lz(i.value)];for(let d=await r.next();!d.done;d=await r.next())s.push(Lz(d.value));let l=s.join("");return l.trim()?l:e??""}function Lz(e){return typeof e=="string"?e:Buffer.from(e).toString("utf8")}Te();var y7=process.env.GAMESTAGE_SUGGEST_URL??"https://gamestage.ai/api/suggest";async function Dz(e,t,o,r=process.stdin){let n=await Gp(e,r),a;try{a=zz({what:n,closest:t.closest,cliVersion:o})}catch(l){throw l instanceof qi&&S(l.message),l}if(!t.send){if(T()){A({sent:!1,would_send:a});return}E("This is everything that would be sent"),h(),h(jz(a)),h(),v("No manifest, no round, no answers and no source. There is nowhere in that shape to put one."),v(n===e?`Send it with ${V('suggest "..." --send')}.`:`Send it by piping the same text again, with ${V("suggest --send")}.`);return}let i;try{i=await fetch(y7,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)})}catch(l){S("Could not reach Gamestage to send that.",[l instanceof Error?l.message:String(l)])}let s=await i.json().catch(()=>({}));if(i.ok||S(`Gamestage refused that suggestion (${i.status}).`,[s.error?.message??"It said nothing more."]),T()){A({sent:!0,reference:s.reference??null});return}E("Sent"),s.reference&&v(`Reference ${s.reference}. Quote it if you follow up.`),v("Somebody at Monterosa reads these. A format that keeps arriving gets built.")}var Wi=class extends Error{};function Mz(e){let t=e.what.trim();if(!t)throw new Wi("Say what went wrong.");if(t.length>2e3)throw new Wi(`That is ${t.length} characters and the limit is 2000. Send what broke and how to hit it; we will ask for the rest.`);let o=(e.game??"").trim();return{kind:"issue",what:t,game:o||"none",cli_version:e.cliVersion,node_version:e.nodeVersion,platform:e.platform}}function Fz(e){return JSON.stringify(e,null,2)}Te();var b7=process.env.GAMESTAGE_ISSUE_URL??"https://gamestage.ai/api/issue";async function Uz(e,t,o,r=process.stdin){let n=await Gp(e,r),a;try{a=Mz({what:n,game:t.game,cliVersion:o,nodeVersion:process.version,platform:process.platform})}catch(l){throw l instanceof Wi&&S(l.message),l}if(!t.send){if(T()){A({sent:!1,would_send:a});return}E("This is everything that would be sent"),h(),h(Fz(a)),h(),v("No manifest, no round, no answers and no source. There is nowhere in that shape to put one."),v(n===e?`Send it with ${V('issue "..." --send')}.`:`Send it by piping the same text again, with ${V("issue --send")}.`);return}let i;try{i=await fetch(b7,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)})}catch(l){S("Could not reach Gamestage to send that.",[l instanceof Error?l.message:String(l)])}let s=await i.json().catch(()=>({}));if(i.ok||S(`Gamestage refused that report (${i.status}).`,[s.error?.message??"It said nothing more."]),T()){A({sent:!0,reference:s.reference??null});return}E("Reported"),s.reference&&v(`Reference ${s.reference}. Quote it if you follow up.`),v("It is in the backlog now. Somebody at Monterosa reads these.")}ke();He();import{readFile as w7}from"node:fs/promises";import{resolve as v7}from"node:path";Te();async function Gz(e){let t=v7(e),o;try{o=await w7(t,"utf8")}catch{S(`No such file: ${e}`,["Give the path to the dataset's JSON file."])}let r;try{r=JSON.parse(o)}catch(a){S(`${e} is not JSON.`,[a instanceof Error?a.message:"Could not parse it."])}let n=It.safeParse(r);if(!n.success){let a=n.error.issues[0];S(`${e} is not a valid dataset.`,[a?`${a.path.join(".")||"document"}: ${a.message}`:"No detail.",'It needs `{ "corpus": "1", "measures": [{ "key", "label", "values" }] }`.'])}return{body:o,measures:n.data.measures.map(a=>a.key)}}function k7(e){let t=It.parse(JSON.parse(e));return Object.fromEntries(t.measures.map(o=>[o.key,Object.keys(o.values).length]))}var _7={copy:"immutable copy",pointer:"dataset"};async function x7(e,t,o){try{await Ap(e,t,"application/json",`The ${o}`)}catch(r){if(!(r instanceof no))throw r;r.code==="EntityTooLarge"&&S(r.message),S(`The ${o} upload was refused${r.status?` with ${r.status}`:""}.`,["A signed URL lasts fifteen minutes. Run the push again for a fresh one."])}}async function Bz(e,t,o={}){let{client:r}=await pe(),{body:n}=await Gz(t),a=Bu(n),i=R_(n),s=await r.getDataset(e).catch(()=>{}),l=i.ok?CO(s?.dataset?.scored,i.summary):[];l.length&&!o.dropScoring&&S(`This push would stop ${l.join(", ")} scoring rounds.`,[`The live ${e} gives ${l.join(", ")} a scoring block and ${t} does not.`,"Add the block back, or pass --drop-scoring if removing it is the point."]);let d=await r.referenceUploadTarget(e,a),u=await AO(n,async(g,b)=>{await x7(g==="copy"?d.copy:d.pointer,b,_7[g])});u.ok||S(`${t} is not a valid dataset.`,[u.detail??"No detail."]);let{measures:p,counts:f}=u.summary;if(T())return A({ok:!0,name:e,digest:a,measures:p,counts:f,key:d.pointer.key});E("Pushed"),v(`${e} now holds this file; any version it held before is replaced`);for(let g of p)v(`${g}: ${f[g].toLocaleString("en-GB")} values`);v(`Digest ${a}, kept so a round can say what it was scored on`),h(),v("A round provisioned from now on uses this. One already in play keeps"),v("the numbers it opened with, which is deliberate.")}async function qz(e,t){let{body:o,measures:r}=await Gz(e),n=k7(o),a=It.parse(JSON.parse(o)),i={};for(let s of a.measures){let l=t.filter(d=>typeof s.values[d]!="number");l.length&&(i[s.key]=l)}if(T())return A({ok:Object.keys(i).length===0,measures:r,counts:n,missing:i});E("Dataset");for(let s of r)v(`${s}: ${n[s].toLocaleString("en-GB")} values`);if(!t.length){h(),v("Pass the keys a round uses to check them: `reference check <file> <key>...`");return}if(h(),!Object.keys(i).length){v(`All ${t.length} key(s) are present in every measure.`);return}for(let[s,l]of Object.entries(i))v(`${s} has no value for ${l.map(d=>`"${d}"`).join(", ")}`);S("A round using those keys would leave them out of their groups, or be refused if that leaves a group without a real choice. They never score as nothing.")}ke();He();An();Te();import{existsSync as z0}from"node:fs";import{readFile as S7,writeFile as Hz}from"node:fs/promises";import{resolve as j0}from"node:path";import{createInterface as $7}from"node:readline/promises";var qp="The Gamestage control plane you are signed in to is older than this command. It arrives with the next deploy of that Space.";async function yr(e,t){try{return await e()}catch(o){if(Ht(o),o instanceof Le&&(o.status===404||o.status===405))return S(`${t} is not available here.`,[qp]);let r=o instanceof Error?o.message:String(o),n=o instanceof Le?` (${o.status})`:"";return S(`${t} was refused${n}: ${r}`,[])}}async function L0(e){let t=await yr(()=>e.listDatasets(),"Listing datasets");return t.unavailable&&S("Gamestage could not read this workspace's datasets.",[t.unavailable]),t}function Yz(e,t){return e.some(o=>o.id===t&&o.state==="archived")}function T7(e){return`${e.name}${e.archived?" (archived)":""}`}function D0(e){return e.origin!=="pull"?"uploaded":`pulled from ${un.find(o=>o.id===e.supplier)?.label??e.supplier??"a source"}`}function E7(e,t){return e.map(o=>{let r=Object.values(o.counts??{});return{name:o.name,from:D0(o),entities:o.counted&&r.length?Math.max(...r):null,measures:o.measures??[],bytes:o.bytes??0,publishedAt:o.publishedAt??null,checkedAt:o.checkedAt??null,failing:!!o.failing,readBy:t?_m(t,o).map(n=>({name:n.gameName||n.gameId,archived:Yz(t,n.gameId)})):null}})}var N0=6;async function Vz(){let{client:e}=await pe(),t=await yr(()=>e.listDatasets(),"Listing datasets");t.unavailable&&S("Gamestage could not read this workspace's datasets.",[t.unavailable]);let o=await e.getWorkspace().then(n=>n.games).catch(()=>null),r=E7(t.datasets,o);if(T())return A({ok:!0,datasets:r});if(!r.length){E("No datasets in this workspace yet"),v("Explore a file or an API first: `gamestage reference inspect <file|url>`"),v("Upload one: `gamestage reference push <name> <file>`"),v("Or switch on a source: `gamestage sources`");return}E(`${r.length} dataset${r.length===1?"":"s"} in this workspace`);for(let n of r){h(),h(` ${k.bold(n.name)}`),v(`${n.from.charAt(0).toUpperCase()}${n.from.slice(1)}${n.failing?", last pull failed":""}`);let a=n.measures.slice(0,N0),i=n.measures.length-a.length;v(`${n.entities===null?"Not counted yet":Bp(n.entities)}, ${n.measures.length} measure${n.measures.length===1?"":"s"}${a.length?`: ${a.join(", ")}${i?`, and ${i} more`:""}`:""}`),v(`${hl(n.bytes)}, published ${ca(n.publishedAt)}`),n.readBy&&v(n.readBy.length?`Read by ${n.readBy.map(T7).join(", ")}`:"No game reads it")}h(),v("`gamestage reference status <name>` for one dataset's detail and the rounds built from it.")}async function Zz(e){let{client:t}=await pe(),o=await yr(()=>t.getDataset(e),"Reading the dataset");if(!o){let l=(await L0(t)).datasets.map(d=>d.name);S(`This workspace holds no dataset called ${e}.`,[l.length?`It holds: ${l.join(", ")}.`:"It holds none yet. `gamestage reference push` uploads one."])}let r=await t.getDataLog({dataset:e,limit:100}).catch(()=>[]),n=await t.getWorkspace().then(s=>s.games).catch(()=>[]),{dataset:a}=o,i=o.usedBy.map(s=>({...s,archived:Yz(n,s.gameId)}));if(T())return A({ok:!0,dataset:a,usedBy:i,log:r});if(E(a.name),$("From",`${D0(a)}${a.failing?", last pull failed":""}`),$("Digest",a.digest||"unknown"),$("Size",hl(a.bytes)),$("Published",ca(a.publishedAt)),$("Last checked",ca(a.checkedAt)),!a.counted)$("Measures","not counted yet");else for(let s of a.measures){let l=a.scored?.includes(s)?", scores rounds":"";$(s,`${Bp(a.counts[s]??0)}${l}`)}h(),h("Games"),i.length||v("No game reads it.");for(let s of i)v(C7(s));h(),h("Rounds built from it"),r.length||v("None yet. A line appears when a game builds a round from it.");for(let s of A7(r).slice(-10)){let l=s.times>1?`, ${s.times} times to ${ca(s.last)}`:"";v(`${ca(s.at)}${l} ${s.ok?"":"refused: "}${s.message||s.event}${s.gameName?` (${s.gameName})`:""}`)}v("Pulls and uploads are not listed here; Published and Last checked above are the latest."),h()}function A7(e){let t=[];for(let o of e){let r=t[t.length-1];r&&r.message===o.message&&r.gameId===o.gameId&&r.ok===o.ok?(r.times+=1,r.last=o.at):t.push({...o,times:1,last:o.at})}return t}function C7(e){let t=e.gameName||e.gameId;return e.archived?`${t} (archived, does not stop a delete)`:e.stale?`${t}, on an older copy until its next round`:t}var I7=12,O7=2e4,R0=25e6;function Kz(e){if(!/^https?:\/\//i.test(e))return e;let t;try{t=new URL(e)}catch{return e}let o=!1;(t.username||t.password)&&(t.username=t.username?"HIDDEN":"",t.password=t.password?"HIDDEN":"",o=!0);for(let r of[...t.searchParams.keys()])/key|token|secret|sig|password|passwd|auth|access|credential|session/i.test(r)&&(t.searchParams.set(r,"HIDDEN"),o=!0);return o?t.toString():e}async function P7(e,t){let o=e.body?.getReader();if(!o)return e.text();let r=[],n=0;for(;;){let{done:a,value:i}=await o.read();if(a)break;n+=i.byteLength,n>R0&&(await o.cancel().catch(()=>{}),S(`${t} sent more than ${hl(R0)}, more than inspect reads.`,["Save a smaller sample to a file and inspect that."])),r.push(i)}return new TextDecoder().decode(Buffer.concat(r))}async function Jz(e,t){if(/^https?:\/\//i.test(e)){let r={};for(let i of t){let s=i.indexOf(":");s<1&&S(`--header needs "Name: value", and got "${i.split(":")[0]}".`),r[i.slice(0,s).trim()]=i.slice(s+1).trim()}let n;try{n=await fetch(e,{headers:r,signal:AbortSignal.timeout(O7)})}catch(i){S(`Could not reach ${new URL(e).host}.`,[i instanceof Error?i.message:String(i)])}n.ok||S(`${new URL(e).host} answered ${n.status}.`,[n.status===401||n.status===403?'It wants a key. Pass it the way that API documents, for example --header "Authorization: Bearer <key>".':"Check the address in a browser first."]);let a=Number(n.headers.get("content-length")??0);return a>R0&&S(`That answer is ${hl(a)}, more than inspect reads.`,["Save a smaller sample to a file and inspect that."]),P7(n,new URL(e).host)}t.length&&S("--header is for an address, not a file.");let o=j0(e);return z0(o)||S(`No such file: ${e}`,["Give a path to a JSON or CSV file, or an https:// address."]),S7(o,"utf8")}async function Xz(e,t){let o=await Jz(e,t.header??[]),r=Kz(e),n;try{n=PO(o)}catch(a){throw a instanceof Pt&&S(`Cannot inspect ${r}.`,[a.message]),a}if(T())return A({ok:!0,source:r,...n,chosen:n.chosen});N7(r,n),r!==e&&(h(),v("The key in the address is shown as HIDDEN. Put it back when you run the command above, or send it with --header."))}function N7(e,t){if(t.kind==="dataset"&&t.dataset){let i=t.dataset;E(`${e} is a Gamestage dataset`),$("Entries",i.entities.toLocaleString("en-GB")),$("Named",`${i.labelled.toLocaleString("en-GB")} have a name a producer reads`);for(let s of i.measures){let l=s.range?`${s.range.min} to ${s.range.max}`:"empty",d=s.scale?`, divided by ${s.scale} to show`:"",u=s.scoring?", scores rounds":"";$(s.key,`${s.count.toLocaleString("en-GB")} values, ${l}${d}${u}`)}i.sampleKeys.length&&$("Keys look like",i.sampleKeys.map(s=>`"${s}"`).join(", ")),h(),v(`Check a round's keys: \`gamestage reference check ${e} <key>...\``),v(`Upload it: \`gamestage reference push <name> ${e}\``);return}if(t.kind==="nothing"||!t.chosen){E(`${e} holds no list of records`),v("A dataset is built from a list: one record per player, team or item, each with the same fields."),v("If the list is further down an API, inspect the address that returns it.");return}t.kind==="invalid-dataset"&&(E(`${e} says it is a dataset and is not a valid one`),v(t.problem??"It does not match the dataset format."),h());let o=t.chosen;E(`${e} holds ${t.lists.length===1?"a list":`${t.lists.length} lists`} of records`);for(let i of t.lists)$(i.path,`${i.length.toLocaleString("en-GB")} records${i.keyed?", keyed by id":""}${i.path===o.path?" (described below)":""}`);h(),h(`Fields of ${o.path}`);for(let i of o.fields.slice(0,40))$(i.name,R7(i));o.fields.length>40&&v(`and ${o.fields.length-40} more; --json lists them all`),h();let r=t.keyCandidates.slice(1).filter(i=>!t.measureCandidates.includes(i)).slice(0,3);$("Key",t.keyCandidates[0]?`${t.keyCandidates[0]}${r.length?` (or ${r.join(", ")})`:""}`:"none: no field is on every record and different on each"),$("Name",t.labelCandidates[0]??"none found");let n=t.measureCandidates.slice(0,I7),a=t.measureCandidates.length-n.length;if($("Measures",n.length?`${n.join(", ")}${a?`, and ${a} more`:""}`:"none: no field holds numbers that count"),t.codes.length&&$("Left out",`${t.codes.length} number${t.codes.length===1?"":"s"} that label rather than count (ranks, ids, types): ${t.codes.slice(0,6).join(", ")}${t.codes.length>6?", ...":""}`),t.notMeasures.length&&$("Negative",`${t.notMeasures.map(i=>i.field).slice(0,6).join(", ")}${t.notMeasures.length>6?", ...":""} hold negative numbers, which a dataset cannot store yet`),(a||t.codes.length>6||t.notMeasures.length>6)&&v("`--json` lists every field."),t.keyCandidates[0]&&t.measureCandidates.length){h();let i=t.lists.length>1?` --list '${o.path}'`:"",s=t.labelCandidates[0]?` --label ${t.labelCandidates[0]}`:"";v("Build a dataset from it, choosing the measures a round should count:"),v(`\`gamestage reference build ${e}${i} --key ${t.keyCandidates[0]} --measure ${t.measureCandidates.slice(0,2).join(" --measure ")}${s} --out dataset.json\``," ")}}function R7(e){let t=Object.entries(e.kinds).sort((a,i)=>i[1]-a[1]).map(([a])=>a==="numeric-string"?"number as text":a).join(" or "),o=e.coverage<1?`, on ${Math.round(e.coverage*100)}%`:"",r=e.range?`, ${e.range.min} to ${e.range.max}`:"",n=e.samples.length?`, e.g. ${e.samples.map(a=>JSON.stringify(a)).join(", ")}`:"";return`${t}${o}${r}${n}`}async function Qz(e,t){t.key||S("Say which field is the key: --key <field>.",["`gamestage reference inspect` suggests one."]),t.measure?.length||S("Name at least one measure: --measure <field>.",["`gamestage reference inspect` lists the fields that hold numbers."]),t.out||S("Say where to write it: --out <file>.");let o=j0(t.out);z0(o)&&!t.force&&S(`${t.out} already exists.`,["Choose another name, or pass --force to replace it."]);let r=await Jz(e,t.header??[]),n;try{n=jO(r,{key:t.key,measures:t.measure,label:t.label,list:t.list,source:t.source})}catch(l){throw l instanceof Pt&&S(`Cannot build a dataset from ${Kz(e)}.`,[l.message]),l}let a=JSON.stringify(n.document,null,2)+`
|
|
8700
8700
|
`;await Hz(o,a);let{document:i,skipped:s}=n;if(T())return A({ok:!0,out:t.out,measures:i.measures.map(l=>({key:l.key,count:Object.keys(l.values).length,scale:l.scale??null})),named:Object.keys(i.entries??{}).length,skipped:s});E(`Wrote ${t.out}`);for(let l of i.measures){let d=l.scale?`, stored \xD7${l.scale} because it has decimals`:"";v(`${l.key}: ${Object.keys(l.values).length.toLocaleString("en-GB")} values${d}`)}i.entries&&v(`${Object.keys(i.entries).length.toLocaleString("en-GB")} entries named from ${t.label}`),s.noKey&&v(`${s.noKey} record(s) had no ${t.key} and were left out`);for(let[l,d]of Object.entries(s.byMeasure))d&&v(`${d} record(s) had no number in ${l}; they have no value for that measure`);h(),v(`Upload it: \`gamestage reference push <name> ${t.out}\``)}async function ej(e,t,o){let r=j0(t??P0(e));z0(r)&&!o.force&&S(`${t??P0(e)} already exists.`,["Give another file name, or pass --force to replace it."]);let{client:n}=await pe();n.downloadDataset||S("Downloading a dataset is not available here.",[qp]);let a=await yr(()=>n.downloadDataset(e),"Downloading the dataset");if(!a){let d=(await L0(n)).datasets.find(u=>u.name===e);d?.origin==="pull"&&S(`${e} is ${D0(d)}, so it cannot be downloaded.`,["Data Gamestage pulls for you is licensed for scoring games, not for taking away. Only data you uploaded can be downloaded."]),S(`This workspace holds no dataset called ${e}.`,["`gamestage reference list` shows what it holds."])}let i;try{i=await fetch(a.url)}catch(l){S("The download link could not be read.",[l instanceof Error?l.message:String(l),"Run the command again for a fresh link."])}i.ok||S(`The download link answered ${i.status}.`,["It lasts five minutes. Run the command again for a fresh one."]);let s=await i.text();if(await Hz(r,s),T())return A({ok:!0,name:e,digest:a.digest,bytes:Buffer.byteLength(s),file:r});E(`Downloaded ${e}`),v(`Written to ${t??P0(e)}, ${hl(Buffer.byteLength(s))}`),v(`Digest ${a.digest}, the copy rounds built from now are scored against`),v("Edit it and `gamestage reference push` it again to replace it.")}function P0(e){let t=e.split("/").pop()||"dataset";return/\.json$/i.test(t)?t:`${t}.json`}async function z7(e,t){if(t)return!0;process.stdin.isTTY||S(`Refusing to remove ${e} without being asked.`,["Nothing has changed.","Re-run with --yes if you mean to remove it."]);let o=$7({input:process.stdin,output:process.stdout});try{return(await o.question(`Remove ${e} from this workspace? Type its name to confirm: `)).trim()===e}finally{o.close()}}async function tj(e,t){let{client:o}=await pe();o.deleteDataset||S("Removing a dataset is not available here.",[qp]);let r=await yr(()=>o.getDataset(e),"Reading the dataset");r||(await L0(o),S(`This workspace holds no dataset called ${e}.`,["`gamestage reference list` shows what it holds."]));let n=await o.getWorkspace().then(i=>i.games).catch(()=>null);if(n){let i=Zk(r.dataset,n);i&&Wz({name:e,deleted:!1,digest:r.dataset.digest,...i})}if(!await z7(e,!!t.yes)){h("Not removed. Nothing has changed.");return}let a=await yr(()=>o.deleteDataset(e),"Removing the dataset");if(a||S(`This workspace holds no dataset called ${e}.`,["It may have been removed already."]),a.deleted||Wz(a),T())return A({ok:!0,...a});E(`Removed ${e}`),v("No new round can be built from it."),v("Rounds already open keep the numbers they opened with.")}var j7=Number(process.env.GAMESTAGE_RUN_POLL_MS)||3e3,L7=15*6e4;async function nj(e,t={}){let{client:o}=await pe();(!o.runDataset||!o.getDatasetRun)&&S("Pulling a dataset now is not available here.",[qp]);let r=await yr(()=>o.runDataset(e),"Asking for a pull");if("refused"in r)return S(r.message,[...r.last?[`The last pull, asked for ${ca(r.last.requestedAt)}, ${D7(r.last)}.`]:[],`\`gamestage reference status ${e}\` shows what it holds now.`]);let n=r;if(n.state==="running"&&t.wait!==!1){let l=t.pollMs??j7,d=Date.now()+(t.waitMs??L7);for(T()||h(`Pulling ${e}. A supplier with many records can take a few minutes.`);n.state==="running"&&Date.now()<d;)await new Promise(u=>setTimeout(u,l)),n=await yr(()=>o.getDatasetRun(e),"Reading the pull")??n}if(n.state==="running"){if(T())return A({ok:!0,run:n});E(`Still pulling ${e}`),v(`Asked for ${ca(n.requestedAt)}. Nothing has changed yet.`),v(`\`gamestage reference status ${e}\` shows when it lands.`);return}if(n.state==="not_pulled"||n.state==="refused")return T()?(A({ok:!1,run:n}),or(1)):S(n.reason??`${e} was not pulled.`,[...n.state==="refused"?["Nothing was written. The data you had stays, and games keep using it."]:[],...n.state==="not_pulled"?["`gamestage reference list` shows what each dataset is from."]:[]]);let a=(n.entries??0)===0;if(T())return A({ok:!a,run:n,...a?{warning:"The pull landed no entries."}:{}}),a?or(1):void 0;E(n.state==="published"?`Pulled ${e}: new figures`:`Pulled ${e}: no change`),$("Digest",n.digest??"unknown"),$("Entries",Bp(n.entries??0));let i=n.measures??[],s=i.length-N0;$("Measures",i.length?`${i.slice(0,N0).join(", ")}${s>0?`, and ${s} more`:""}`:"none"),n.sampleKeys?.length&&$("First keys",n.sampleKeys.join(", ")),$("Requests",String(n.requests??0)),n.skipped&&$("Left out",`${Bp(n.skipped)} the supplier had no figures for`),h(),a&&S("The pull landed no entries, so a round built from it would have nothing to score.",["`gamestage sources status <source>` shows what the source covers for your plan."]),v(n.state==="published"?"Rounds built from now on use these figures. Rounds already open keep theirs.":"The supplier's figures match what was already published, so nothing was rewritten.")}function D7(e){switch(e.state){case"running":return"is still running";case"published":return"landed new figures";case"unchanged":return"found no change";default:return`was not pulled: ${(e.reason??"no reason given").replace(/\.$/,"")}`}}function Wz(e){let t=e.usedBy.map(o=>o.gameName||o.gameId);return S(e.refused?.message??`${e.name} was not removed.`,[...t.length?[`Read by: ${t.join(", ")}.`,"Point those games at another dataset in Studio, or archive them, then remove it."]:[],...e.refused?.code==="pulled"?["`gamestage sources` shows what is switched on, and `gamestage sources disconnect <source>` stops it."]:[]])}function Bp(e){return`${e.toLocaleString("en-GB")} ${e===1?"entry":"entries"}`}function hl(e){return e<1e3?`${e} bytes`:e<1e6?`${(e/1e3).toFixed(1)} KB`:`${(e/1e6).toFixed(1)} MB`}function ca(e){if(!e)return"unknown";let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric",timeZone:"UTC"})}, ${t.toISOString().slice(11,16)} UTC`}ke();He();Te();function M7(e,t){let o=[];for(let{supplier:r,entitlement:n}of e){let a=t.filter(d=>(d.supplier??(d.origin==="push"?"push":void 0))===r.id).map(d=>d.name),i=r.catalogue;if(i?.fetched===!1&&a.length===0)continue;let s=i?.needsKey??!1,l=n.allowed?a.length>0?"connected":s?"available, needs a key":"available":"not available to you";o.push({id:r.id,label:r.label,state:l,...n.allowed?{}:{reason:n.reason??""},offers:i?.offers??r.note,competitions:i?.competitions??[],cost:i?.cost??"",needsKey:s,...i?.signUp?{signUp:i.signUp}:{},licence:i?.licence??r.note,...cc(r)?{caveat:cc(r)}:{},datasets:a})}return o}async function oj(){let{client:e}=await pe(),[t,o]=await Promise.all([e.getWorkspace(),e.listDatasets()]),r=M7(B1(Vu(t),un),o.datasets);if(T())return A({ok:!0,sources:r});E("Where a game's real-world values can come from");for(let n of r)h(),$(n.label,n.state),v(n.offers),n.competitions.length&&v(`Covers: ${n.competitions.join(", ")}`),n.cost&&v(`Cost: ${n.cost}`),v(`Licence: ${n.licence}`),n.caveat&&v(n.caveat),n.datasets.length&&v(`In this workspace: ${n.datasets.join(", ")}`),n.state==="available, needs a key"&&(n.signUp&&v(`Sign up: ${n.signUp}`),v(`Then: \`gamestage sources connect ${n.id}\`, which opens a page for your key. Never paste a key into a chat.`)),n.reason&&v(n.reason);h(),v("Values stay on the server. A fan's browser only ever receives names and results.")}Wo();Yt();Te();import{readFile as F7,writeFile as U7}from"node:fs/promises";var G7=/^live:[^\n]*\n(?:[ \t]+[^\n]*\n|[ \t]*\n(?=[ \t]))*/m;function rj(e,t){let r=(e.endsWith(`
|
|
8701
8701
|
`)?e:`${e}
|
|
8702
8702
|
`).replace(G7,"");if(t===null)return r;let n=r.endsWith(`
|
|
@@ -9221,6 +9221,6 @@ Nothing was uploaded: these are the checks the server runs, run here first.`,[],
|
|
|
9221
9221
|
return out.map((r) => r.words.join(" ")).join("\\n").slice(0, 4000);
|
|
9222
9222
|
})()`),d=await i.run("Math.max(0, document.documentElement.scrollWidth - window.innerWidth)"),u=await i.run("window.__gsLookErrors || []"),p=[...i.pageErrors,...u],f=iV(t.out??".gamestage/look.png");return await oV(aV(f),{recursive:!0}),await rV(f,i.viewportShot?await i.viewportShot():await i.screenshot(r,n)),{url:e,width:r,height:n,screenshot:f,text:l,errors:p,overflowX:d,taps:s}}finally{o||await i.close()}}async function nD(e,t){let o=await lV(e??"http://127.0.0.1:4001",t);if(T()){A({ok:!0,...o});return}E(`Looked at ${o.url}`),$("Screenshot",`${o.screenshot} (${o.width} by ${o.height}). Open it to see the page.`);for(let r of o.taps)$("Pressed",r.pressed?r.target:`${r.target}: nothing on screen matched, so nothing was pressed`);if($("Fits",o.overflowX>0?`no, the page is ${o.overflowX}px wider than the screen`:"yes, nothing scrolls sideways"),o.errors.length===0)$("Errors","none");else{$("Errors",String(o.errors.length));for(let r of o.errors.slice(0,10))h(` ${r}`)}h(),h("On screen:"),h(o.text||"(no text)")}Zn();Te();var oh=[{slug:"introduction",title:"Introduction"},{slug:"setup",title:"Set up Gamestage"},{slug:"how-it-works",title:"How it works"},{slug:"getting-started",title:"Getting started"},{slug:"journey",title:"The journey"},{slug:"game-formats",title:"Game formats"},{slug:"game-design",title:"Design a game fans come back to"},{slug:"migration",title:"Build and deploy"},{slug:"data",title:"Dataset"},{slug:"layout-and-loading",title:"Choose how your game sits on the screen"},{slug:"data-sources",title:"Data sources"},{slug:"live-data",title:"Live data"},{slug:"live-graphics",title:"Live Graphics"},{slug:"theming",title:"Theming"},{slug:"consent",title:"Ask fans for consent"},{slug:"organisation",title:"Your organisation's context, starter apps and themes"},{slug:"app-manifest",title:"App Manifest reference"},{slug:"player-api",title:"Player API reference"},{slug:"cli",title:"CLI reference"},{slug:"endpoints",title:"Schemas and endpoints"},{slug:"gamestage-ui",title:"Gamestage UI"},{slug:"third-party",title:"Third-party tools and assets"},{slug:"custom-domains",title:"Use your own domain"},{slug:"ads",title:"Ads"},{slug:"starter-plan",title:"Plans and limits"},{slug:"attribution",title:"What Gamestage is built on"}],dV={formats:"game-formats",format:"game-formats",design:"game-design",deploy:"migration",start:"getting-started",manifest:"app-manifest",api:"player-api",commands:"cli",plans:"starter-plan",ui:"gamestage-ui"};async function oD(e){if(!e){if(T()){A({ok:!0,chapters:oh.map(a=>({...a,url:`${Je}/docs/${a.slug}`}))});return}E("Documentation");for(let a of oh)h(` ${k.cyan(a.slug.padEnd(20))} ${a.title}`);h(),v(`${k.cyan(V("docs game-formats"))} print a chapter here`),v(`${k.dim(`${Je}/docs`)} the same, in a browser`),h();return}let t=dV[e]??e,o=oh.find(a=>a.slug===t);if(!o)return S(`No chapter called "${e}".`,[...oh.map(a=>`${k.cyan(a.slug.padEnd(20))} ${a.title}`)]);let r=`${Je}/docs/${o.slug}.md`,n;try{let a=await fetch(r,{signal:AbortSignal.timeout(1e4)});if(!a.ok)throw new Error(`the site answered ${a.status}`);n=await a.text()}catch(a){return S(`Could not fetch ${o.title}.`,[`${a.message}. Read it at ${Je}/docs/${o.slug}`])}if(T()){A({ok:!0,chapter:{...o,url:`${Je}/docs/${o.slug}`},markdown:n});return}h(n.trimEnd()),h(),h(k.dim(`${Je}/docs/${o.slug}`))}rr();for(let e of[process.stdout,process.stderr])e.on("error",t=>{throw t.code==="EPIPE"&&process.exit(0),t});var rD,Ce=new Ei,uV=(()=>{let e=bt.map(t=>`${Bo[t].name} (${t})`);return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`})();Ce.name("gamestage").description("Take an agent-built game prototype to a production fan game.\nInspect, create and validate need no account. `dev` and `verify` need\nyou signed in; publishing a game needs that account approved too.").version(nt).option("--json","machine-readable output for agents",!1).hook("preAction",e=>{if(AP(!!e.opts().json),q_(process.env,!!e.opts().json,!!process.stderr.isTTY,nt)&&(rD=W_(nt).catch(()=>{})),e.opts().json&&lP(process.env,nt)){let t=dP(nt);t?ix(B_(t,nt)):W_(nt,uP).then(o=>{o&&ix(B_(o,nt))}).catch(()=>{})}}).hook("postAction",async()=>{let e=await rD;e&&process.stderr.write(`
|
|
9223
9223
|
gamestage ${e} is out; this is ${nt}. Update with: npm install -g gamestage
|
|
9224
|
-
`)});Ce.command("start").description("read the current directory and point at the right next step").action(Rz);Ce.command("doctor").description("check the local environment").action(wz);Ce.command("inspect").alias("adopt").argument("[target]","game file or project directory",".").option("--write [path]","write the generated manifest (default gamestage.yaml)").option("--force","replace an existing manifest, losing whatever it holds",!1).description("read an existing game read-only and produce an inspection report").action(Sz);Ce.command("create").option("--name <name>","game name").option("--format <format>",`how the game is played: ${uV}`).addOption(new In("--archetype <format>").hideHelp()).option("--host <host>","where it runs: fullscreen, article-launch, article-embed or app-webview (default fullscreen)").option("--layout <layout>","how it sits on the screen: screen, canvas, launch, card, page or sheet (default from the host and format)").option("--write [path]","manifest path (default gamestage.yaml)").option("--force","replace files that are already here, losing what they hold",!1).option("--here","write into this folder even when it holds other things (by default a new folder is made)",!1).option("--brand <name>","who runs the game, named when a fan is asked for consent").option("--privacy-url <url>","your privacy policy's address, linked from the consent card").option("--starter <name[@version]>","start from your organisation's starter app (see `org starter list`)").option("--no-starter","start from the format's own page even when your organisation has starter apps").description("start a new game: asks how it is played and what it is called when run by hand (see `formats`)").action(_R);Ce.command("verify").option("--file <path>","the game to verify (index.html)").option("--manifest <path>","the game's manifest (gamestage.yaml)").option("--dir <path>","the directory a deploy would publish (defaults to the game's own)").option("--no-browser","skip the browser proof (exits 2 unless another check fails)").description("run the game against the deployed Engine and prove the migration is done (requires sign-in)").action(e=>n0({...e,noBrowser:e.browser===!1}));Ce.command("review").option("--file <path>","the game's page (index.html)").option("--manifest <path>","the manifest (gamestage.yaml)").description("advice on whether fans will come back: plays the game against the deployed Engine and checks it against the game design rules").action(e=>bz(e));Ce.command("formats").argument("[format]","one format in full, such as hunt").description("what each format is, with a game to play, before you choose one (no account needed)").action(e=>fR(e));Ce.command("client").option("--out <dir>","where to write it, defaulting to the current directory").description("write the player client into your project, as a browser can load it").action(VP);var iD=Ce.command("manifest").description("work with the App Manifest");iD.command("register").argument("[path]","manifest path","gamestage.yaml").description("register an existing manifest with the control plane (requires sign-in)").action(ZR);iD.command("validate").argument("[path]","manifest path","gamestage.yaml").option("--level <level>","require a conformance level (L0-L5)").description("validate a manifest and report its evidenced conformance").action(Kj);Ce.command("status").alias("list").argument("[game]","one game, or the whole workspace when omitted").description("what is deployed, what state it is in, and what caps are near (`list` with no game lists them)").action(UR);Ce.command("open").argument("<game>","game id").argument("[where]","play (default), studio or stage").description("open the game, its Studio project or its Stage page in the browser").action((e,t)=>eD(e,t));Ce.command("look").argument("[url]","the page to look at, by default the one `dev --serve` serves","http://127.0.0.1:4001").option("--tap <target>","press a button or link by its words, label or a CSS selector; repeat to press several in order",(e,t)=>[...t,e],[]).option("--width <px>","screen width","390").option("--height <px>","screen height","844").option("--out <file>","where to save the screenshot",".gamestage/look.png").option("--wait <ms>","how long to let the page settle after loading and after each press","1500").description("open a page at phone size, press things, and save what it looks like: a screenshot, its words and its errors").action((e,t)=>nD(e,t));Ce.command("docs").argument("[chapter]","a chapter, such as game-formats or cli").description("read a documentation chapter in the terminal (no account needed)").action(e=>oD(e));Ce.command("deploy").argument("<game>","game id").option("--revision <revision>","manifest revision being published").option("--hash <hash>","content hash of the snapshot").option("--level <level>","evidenced conformance level (L0-L5)").option("--prize","the game offers a prize (paid tiers only)",!1).option("--file <path>","the game's HTML, uploaded before the deploy gate runs").option("--dir <path>","the game's directory, uploaded with relative paths").option("--manifest <path>","the game's manifest (gamestage.yaml)").option("--notes <text>","what changed, said in the deploy announcement and the game's log").option("--space <id>","the Studio space id to deploy this game's project into").option("--space-org <id>","the Studio organisation that --space belongs to, when it is known").option("--no-check","skip loading the published page in a browser afterwards").option("--allow <path...>","publish a file the deploy gate suspects; it never clears a certain finding").description("publish a snapshot to a playground, and the round it puts on").action(GR);var sS=Ce.command("domain").description("serve a game from your own hostname, such as quiz.myclub.com (Publisher and Enterprise)");sS.command("add").argument("<game>","game id").argument("<hostname>","a subdomain you control, such as quiz.myclub.com").option("--move","take your plan's domain off its other game and put it here",!1).description("add a custom domain to a game, and print the DNS record to create").action((e,t,o)=>nL(e,t,o));sS.command("status").argument("<game>","game id").option("--watch","check every 15 seconds until the domain is live or failed",!1).description("check the domain's DNS record and certificate now").action((e,t)=>oL(e,t));sS.command("remove").argument("<game>","game id").description("stop serving the game from its custom domain; its own address keeps working").action(e=>rL(e));var bl=Ce.command("workspace").description(`share your workspace with up to ${Mr} colleagues, and pick which workspace commands act in`);bl.command("members").description("list the owner, members and invites not yet accepted").action(()=>LP());bl.command("invite").argument("<email>","a colleague's work address").description(`invite a colleague; they join by signing in with that address (owner only). ${g2}`).action(e=>DP(e));bl.command("remove").argument("<email>","a member's address, or an invite to cancel").description("remove a member or cancel an invite; it takes effect on their next request (owner only)").action(e=>MP(e));bl.command("use").argument("[id]","a workspace you are a member of; leave out to list them").option("--own","go back to your own workspace",!1).description("act in a shared workspace from now on, or list the ones you can").action((e,t)=>FP(e,t));bl.command("signal").argument("[state]","on, off or status","status").description("switch Monterosa Analytics (Signal) on or off for this workspace's games, on a paid plan").action(e=>jP(e));var Yi=Ce.command("theme").description("make your own Gamestage UI theme, keep it privately for your organisation, and use it in a game");Yi.command("init").argument("<name>","the theme's name, such as your company's: lowercase letters, numbers and hyphens").option("--dir <path>","where to write it (default <name>-theme)").description("start a theme package: theme.json, tokens.json and an optional overrides.css").action((e,t)=>hL(e,t));Yi.command("check").argument("[dir]","the theme's folder",".").description("run the library's checks: contrast, type scale, unknown and missing roles, overrides").action(e=>fL(e));Yi.command("preview").argument("[dir]","the theme's folder",".").option("--port <port>","the local port to serve on").description("show the main components wearing the theme in a local page, rebuilt as you edit").action((e,t)=>gL(e,t));Yi.command("publish").argument("[dir]","the theme's folder",".").option("--declare-fonts","declare, in your name, that you may use each font in web games",!1).description("check, build and store the theme privately for your organisation, as name@version (organisation admins only)").action((e,t)=>yL(e,t));Yi.command("list").description("your organisation's themes and their versions").action(()=>wL());Yi.command("use").argument("<ref>","the theme, such as acme for its newest version, or acme@1.0.0").option("--manifest <path>","the game's manifest (gamestage.yaml)").description("install a theme into this game, pin its version in gamestage.yaml and wire it into the page").action((e,t)=>vL(e,t));var rh=Ce.command("org").description("your organisation's integration context and starter apps: how a game fits your organisation's app"),sD=rh.command("context").option("--save [path]","write it to a file for your agent to read (default integration.md)").description("print your organisation's integration context, or save it with --save").action(e=>kL(e));sD.command("set").argument("<file>","the Markdown file to publish, such as integration.md").description("publish a new revision for everyone in your organisation (organisation admins only)").action(e=>_L(e));sD.command("history").description("every revision, newest first, with who set it and when").action(()=>xL());var cS=rh.command("starter").description("your organisation's starter apps: a working app in your own stack that new games start from");cS.command("publish").argument("<folder>","the folder holding the app and its gamestage-starter.json").description("check and publish a new version for everyone in your organisation (organisation admins only)").option("--check","run the server's checks on this machine and stop: no sign-in, nothing uploaded or published").action((e,t)=>SL(e,t));cS.command("list").description("every starter app, with its newest version, framework and who published it").option("--all","include retired versions").action(e=>$L(e));cS.command("retire").argument("<name@version>","the exact version, such as web-embed@1.0.0").description("stop create choosing a version; games made from it keep working (organisation admins only)").action(e=>TL(e));rh.command("admins").description("who can change your organisation's integration notes, starter apps and themes").action(()=>EL());rh.command("use").argument("[org]","the customer organisation to work as, such as nba").option("--home","go back to your own organisation's files").description("Monterosa only: choose which customer's integration notes, starter apps and themes you change").action((e,t)=>AL(e,t));var lS=Ce.command("ads").description("ask for partner products on a game's result screen (in preview, subject to approval and commercial terms)");lS.command("request").argument("<game>","game id").option("--audience <text>",'who the game is for, such as "Club fans in the UK, mostly adults"').option("--where <text>",'where it is played, such as "the club app and website"').option("--countries <text>",'the countries its fans are in, such as "United Kingdom, Ireland"').option("--prize","the game has a prize").option("--no-prize","the game has no prize").option("--note <text>","anything else Monterosa should know").description("ask Monterosa and the retail partner to approve products for this game").action((e,t)=>IL(e,t));lS.command("status").argument("<game>","game id").description("where this game's request for products is, and what happens next").action(e=>OL(e));lS.command("skip").argument("<game>","game id").description("record that you do not want products in this game, so you are not asked again").action(e=>PL(e));var Co=Ce.command("reference").description("the private data a round is scored against");Co.command("push").argument("<name>",'the name a producer types in Studio, e.g. "the-limit/careers.json"').argument("<file>","the JSON file holding it").description("upload reference data, and an immutable copy a round can be pinned to").option("--drop-scoring","publish even though a measure that scores rounds today would stop scoring them").action(Bz);Co.command("check").argument("<file>","the JSON file holding it").argument("[keys...]","the keys a round uses, to check they are all present").description("what a round would fail on, before a producer finds out").action(qz);var iS=(e,t=[])=>[...t,e];Co.command("list").description("every dataset this workspace holds, and which games read it").action(Vz);Co.command("status").argument("<name>","the dataset's name, as `reference list` shows it").description("one dataset: where it came from, its measures, the games that read it, and the rounds built from it").action(Zz);Co.command("inspect").argument("<source>","a JSON or CSV file, or an https:// address that returns one").option("--header <header>",'sent with an address, e.g. "Authorization: Bearer <key>"; repeat for more',iS).description("what a file or an API holds, and which fields could be a dataset's key and measures").action(Xz);Co.command("build").argument("<source>","a JSON or CSV file, or an https:// address that returns one").option("--key <field>","the field that names each entry, different on every record").option("--measure <field>","a field holding the numbers a round counts; repeat for more",iS).option("--label <field>","the field holding a name a producer reads, such as a player's name").option("--list <path>","which list of records, as `reference inspect` shows it; the biggest by default").option("--source <text>","one line saying where the data came from, shown when a round reveals it").option("--header <header>","sent with an address; repeat for more",iS).option("--out <file>","where to write the dataset").option("--force","replace the --out file if it exists").description("turn a file or an API's records into a dataset you can push").action(Qz);Co.command("download").argument("<name>","a dataset this workspace uploaded").argument("[file]","where to write it; the dataset's own file name by default").option("--force","replace the file if it exists").description("get back a dataset you uploaded, as the file that was pushed").action(ej);Co.command("run").argument("<name>","a dataset a source pulls, as `reference list` shows it").option("--no-wait","ask for the pull and return, without waiting for it to finish").description("pull a source's dataset now and report its keys and digest, never a value; once every 15 minutes").action((e,t)=>nj(e,t));Co.command("delete").argument("<name>","a dataset this workspace uploaded and no game reads").option("--yes","remove it without asking").description("remove a dataset no game reads; rounds already open keep their numbers").action(tj);var da=Ce.command("live").description("live data: follow a real contest as it happens (switch it on, off, or see which)").helpCommand(!0).option("--manifest <path>","the manifest, default gamestage.yaml").action(e=>cj(e));da.command("on").description("switch live data on in gamestage.yaml; deploy to apply it").option("--provider <provider>","where the contest's live data comes from","sportmonks").option("--manifest <path>","the manifest, default gamestage.yaml").action(e=>ij(e));da.command("off").description("switch live data off in gamestage.yaml; deploy to apply it").option("--manifest <path>","the manifest, default gamestage.yaml").action(e=>sj(e));da.command("simulate").description(`start a made-up match on the live feed, for an edition's "Live contest"`).option("--speed <n>","match seconds per real second, 1 to 120","30").option("--seed <n>","which made-up match: the same seed plays the same goals","6").option("--from <minute>","start at this minute of the match").action(e=>dj(e));da.command("list").description("this workspace's simulations: state, minute, score and speed").action(()=>uj());da.command("pause").description("pause a simulation; every game following it holds").argument("<id>","the simulation, sim- and eight characters").action(e=>Wp(e,"pause"));da.command("play").description("carry on a paused simulation from where it was").argument("<id>","the simulation, sim- and eight characters").action(e=>Wp(e,"play"));da.command("stop").description("end a simulation; the feed publishes full time at its score").argument("<id>","the simulation, sim- and eight characters").action(e=>Wp(e,"stop"));var dS=Ce.command("sources").description("where a game's real-world values can come from, and which you can use now").helpCommand(!0).action(oj);dS.command("connect <source>").description("switch a source on: ESPN with --league, or the link to add your own key for Sportmonks").option("--league <league>","ESPN only: nba, wnba, nfl, mlb or nhl").option("--measures <keys>","ESPN only: comma-separated measures; `sources status espn --league nba` lists them").option("--season <year>","ESPN only: ESPN's year for the season, e.g. 2025; default the current one").option("--name <dataset>","ESPN only: the dataset's name, default espn-<league>").option("--from-op <reference>","keyed sources, at your own terminal only: read the key from 1Password (op://Vault/Item/field); never run by an agent").action((e,t)=>bj(e,t));dS.command("status <source>").description("what is connected for a source; with --league, the measures ESPN offers there").option("--league <league>","ESPN only: list this league's measures").action((e,t)=>kj(e,t));dS.command("disconnect <source>").description("stop a source's scheduled fetches; the data already fetched stays").option("--name <dataset>","ESPN only: which dataset, e.g. espn-nba").action((e,t)=>_j(e,t));var ah=Ce.command("round").description("the round a fan plays, and getting it into Studio");ah.command("push").argument("<game>","game id").option("--manifest <path>","the game's manifest; the round is read from practice/round.yaml beside it","gamestage.yaml").option("--yes","do not ask before replacing what a producer has typed",!1).description("write your round into Studio, where a producer owns it from then on").action(Tj);ah.command("season").argument("<game>","game id").option("--file <path>","the season: a list of dated rounds",q0).option("--manifest <path>","the game's manifest, for its format","gamestage.yaml").option("--overwrite","write over days that already have a round in Studio",!1).option("--dry-run","check the file and say what would be written, without writing",!1).option("--yes","do not ask before writing",!1).description("write a season of rounds into Studio, one edition a day").action(Oj);ah.command("seed").argument("<game>","game id").requiredOption("--count <n>","number of candidate rounds (1\u201380)").option("--measure <key>","dataset measure (required when there are several)").option("--position <position>","filter by position, case-insensitive exact match").option("--team <team>","filter by team, case-insensitive exact match").option("--layout <layout>","grid (cards, the default), pitch (players on a football pitch) or xi (Complete the XI, from a line-up dataset)").option("--dataset <name>","read this dataset of yours instead of the game's own, e.g. sportmonks/premier-league-lineups.json").option("--prompt <text>","the question for xi rounds, with {position} and {team}").option("--dry-run","print candidate rounds without writing",!1).option("--yes","create rounds without asking for consent",!1).description("build rounds from the game's connected dataset and create them in Studio").action(Aj);ah.command("refresh").argument("<game>","game id").description("read Studio and the dataset again now, rather than on the next fan's visit").action(Ej);var Vi=Ce.command("graphic").description("the graphic your game puts on a screen");Vi.command("dev").option("--css <path>","the stylesheet to preview","graphic.css").option("--port <port>","port to serve on","4321").option("--rows <rows>","how many rows to draw","10").option("--bigscreen","draw it as a big screen rather than an overlay",!1).option("--accent <colour>","accent colour, as #rrggbb").option("--renderer <url>","where the Live Graphics renderer is served from","https://monterosa-gamestage.spaces-dev.monterosa.cloud/r/").description("see your stylesheet on the real graphic, on your own machine").action(Bj);Vi.command("templates").description("the screens a graphic can be cut for").action(Zj);Vi.command("create").argument("<game>","game id").option("--template <id>","the screen to cut it for",Hi).option("--consent","confirm the people named agreed to appear on a screen",!1).description("put this game's leaderboard on a screen").action(Hj);Vi.command("list").argument("<game>","game id").description("the graphics this game has, and where to watch them").action(Yj);Vi.command("remove").argument("<game>","game id").argument("<id>","the graphic's id, from `gamestage graphic list`").description("take a graphic off the air").action(Vj);Vi.command("push").argument("<game>","game id").option("--css <path>","the stylesheet to publish","graphic.css").description("hand a producer the address of your stylesheet").action(qj);Ce.command("archive").argument("<game>","game id").description("take a game off the air while retaining its record and files").action(BR);Ce.command("rename").argument("<game>","game id; it never changes").argument("<name>","the new name, in quotes").option("--dir <path>","the game's folder, to check its gamestage.yaml",".").description("give a game a new name in Stage, the CLI and Studio, keeping its id").action((e,t,o)=>RL(e,t,o));Ce.command("promote").argument("<game>","game id").description("approve your own game to move from dev to prod").action(qR);Ce.command("prune").option("--yes","do not ask before deleting",!1).description("remove archived games that never deployed").action(WR);Ce.command("plan").argument("<plan>","runtime, live or enterprise").description("change this workspace's plan and its limits").action(HR);Ce.command("suspend").argument("<game>","game id").description("take a game off the air and free its live slot").action(e=>y0(e,!1));Ce.command("wake").argument("<game>","game id").description("put a suspended game back on the air").action(e=>y0(e,!0));Ce.command("endpoint").argument("<game>","game id").argument("[which]","player, control or playground; all three when omitted").description("print where a deployed game answers").action(KR);Ce.command("logs").argument("<game>","game id").option("--limit <n>","how many lines, newest kept","100").option("--since <iso>","only lines after this timestamp").option("--level <level>","info, warn or error").description("tail a game's runtime log").action(XR);Ce.command("usage").argument("<game>","game id").description("what the game's Jev questions cost: per round, in total, and per fan's game").action(QR);Ce.command("dev").option("--port <port>","local HTTP port","4000").option("--manifest <path>","the game's manifest (gamestage.yaml)").addOption(new In("--fixture").hideHelp()).addOption(new In("--scenario <name>").hideHelp()).addOption(new In("--as <player>").hideHelp()).option("--serve","also serve this directory, so the page has somewhere to open",!1).option("--serve-port <port>","port for the page (with --serve)","4001").description("play your round through the deployed Engine, with your page on this machine (requires sign-in)").action(hz);Ce.command("suggest").description("tell us about a format or feature we do not have (no account needed)").argument("[what]","what you were trying to build, or pipe it in").option("--closest <format>","the format that came nearest, if one did").option("--send","actually send it, having seen what it says",!1).action((e,t)=>Dz(e,t,nt));Ce.command("issue").description("report something that went wrong (no account needed)").argument("[what]","what went wrong, or pipe it in").option("--game <id>","the game it happened on, if it was about one").option("--send","actually send it, having seen what it says",!1).action((e,t)=>Uz(e,t,nt));Ce.command("login").description("sign in, or create an account (needed before dev, verify or deploy)").option("--workspace <id>","the workspace you expect to land in, from the welcome screen").action(e=>Iz(e.workspace));var mV=Ce.command("link").description("connect an account Gamestage needs (requires sign-in)");mV.command("github").description("link your GitHub account, which a first deploy requires").action(Az);var Ut=Ce.command("admin").description("approve, refuse, set the plan or grants of, or close a creator's account (operators only)");Ut.command("approve").argument("<workspace>","workspace id, from the registration alert").description("let this account use the runtime").action(e=>g0(e,"approved"));Ut.command("refuse").argument("<workspace>","workspace id, from the registration alert").description("turn this account down, finally").action(e=>g0(e,"refused"));Ut.command("plan").argument("<workspace>","workspace id").argument("<plan>","runtime (Starter), live (Publisher) or enterprise").option("--live-games <count>","live-game ceiling instead of the plan's own; 0 is none").description("move this account onto a plan, including a paid one").action((e,t,o)=>VR(e,t,o));Ut.command("grant").argument("<workspace>","workspace id").argument("<grant>","org:<id> or org-admin:<id>").description("put a workspace in an organisation, or make it an admin of one").action((e,t)=>rS(e,t,"add"));Ut.command("ungrant").argument("<workspace>","workspace id").argument("<grant>","org:<id> or org-admin:<id>").description("take an organisation grant away from a workspace").action((e,t)=>rS(e,t,"remove"));Ut.command("grants").argument("<workspace>","workspace id").description("list a workspace's grants and the organisation it belongs to").action(e=>GL(e));var uS=Ut.command("org").description("this control plane's customer organisations: their Studio, spaces and domains"),aD=(e,t=[])=>[...t,e];uS.command("list").description("every organisation on this control plane, and whether it is stored yet").action(()=>BL());uS.command("show").argument("<org>","organisation id, such as nba").description("every field of one organisation, and which Studio key it uses").action(e=>qL(e));uS.command("set").argument("<org>","organisation id, such as nba").option("--name <name>","the organisation's name; needed to create one").option("--studio-host <host>","which Studio its organisation is on: us, eu or dev").option("--studio-org <id>","its Studio organisation id").option("--space <id>","a Studio space it owns; repeat for more, the first is the default",aD).option("--domain <domain>","an email domain whose workspaces join it; repeat for more",aD).option("--consent <provider>","whose consent gate its games use: onetrust or ours").option("--identity <ref>","its fan sign-in's reference, such as an Identify project").option("--signed-agreement","its signed agreement with Monterosa covers Gamestage, so its workspaces skip the click-through Terms").option("--no-signed-agreement","take the signed agreement away, so its workspaces accept the Terms again").option("--login-keys <url>","its fan sign-in's public key set (JWKS), which new games' logins are seeded from").option("--login-issuer <url>",'the issuer its fan tokens carry; give "" if they carry none').option("--login-audience <aud>",'the audience its fan tokens carry; give "" to remove it').option("--login-claim <claim>",'the claim its fans are in when it is not sub, such as SubscriberId; give "" to remove it').description("create an organisation or change it, printing what changed").action((e,t)=>WL(e,t));Ut.command("trial").argument("<workspace>","workspace id").argument("<limit>","day_cap, mau, storage or fair_use").argument("<setting>","on or off").description("turn a capping trial on or off for one workspace").action((e,t,o)=>YL(e,t,o));Ut.command("trials").argument("<workspace>","workspace id").description("list what each limit does for a workspace: refuses, or counts").action(e=>VL(e));Ut.command("domains").description("every custom domain, with its game, workspace, status and what DNS last said").action(aL);Ut.command("refresh").argument("<workspace>","workspace id").argument("<dataset>","the dataset's name, e.g. espn-nba").argument("<hours>","fetch every this many hours (1 to 168), or `default` for the creator's own").description("fetch a switched-on source more (or less) often than twice a day").action((e,t,o)=>yj(e,t,o));Ut.command("creator-sync").description("sync every creator into the Resend segment now, and print the counts").action(()=>YR());Ut.command("erase").argument("<game>","the game's id; it must be archived").description("delete one archived game's player data, for a creator's written request").action(e=>ML(e));Ut.command("close").argument("<workspace>","workspace id").description("close an account: take every game off the air and delete its data").action(e=>FL(e));Ut.command("erasures").description("every deletion asked for, what is still in progress and when it is due").action(UL);Ce.command("logout").description("forget the stored session").action(Oz);Ce.command("whoami").description("show who the CLI is signed in as").action(Pz);QL(process.argv)&&(process.stdout.write(`${JSON.stringify(XL(Ce,nt),null,2)}
|
|
9224
|
+
`)});Ce.command("start").description("read the current directory and point at the right next step").action(Rz);Ce.command("doctor").description("check the local environment").action(wz);Ce.command("inspect").alias("adopt").argument("[target]","game file or project directory",".").option("--write [path]","write the generated manifest (default gamestage.yaml)").option("--force","replace an existing manifest, losing whatever it holds",!1).description("read an existing game read-only and produce an inspection report").action(Sz);Ce.command("create").option("--name <name>","game name").option("--format <format>",`how the game is played: ${uV}`).addOption(new In("--archetype <format>").hideHelp()).option("--host <host>","where it runs: fullscreen, article-launch, article-embed or app-webview (default fullscreen)").option("--layout <layout>","how it sits on the screen: screen, canvas, launch, card, page or sheet (default from the host and format)").option("--write [path]","manifest path (default gamestage.yaml)").option("--force","replace files that are already here, losing what they hold",!1).option("--here","write into this folder even when it holds other things (by default a new folder is made)",!1).option("--brand <name>","who runs the game, named when a fan is asked for consent").option("--privacy-url <url>","your privacy policy's address, linked from the consent card").option("--starter <name[@version]>","start from your organisation's starter app (see `org starter list`)").option("--no-starter","start from the format's own page even when your organisation has starter apps").description("start a new game: asks how it is played and what it is called when run by hand (see `formats`)").action(_R);Ce.command("verify").option("--file <path>","the game to verify (index.html)").option("--manifest <path>","the game's manifest (gamestage.yaml)").option("--dir <path>","the directory a deploy would publish (defaults to the game's own)").option("--no-browser","skip the browser proof (exits 2 unless another check fails)").description("run the game against the deployed Engine and prove the migration is done (requires sign-in)").action(e=>n0({...e,noBrowser:e.browser===!1}));Ce.command("review").option("--file <path>","the game's page (index.html)").option("--manifest <path>","the manifest (gamestage.yaml)").description("advice on whether fans will come back: plays the game against the deployed Engine and checks it against the game design rules").action(e=>bz(e));Ce.command("formats").argument("[format]","one format in full, such as hunt").description("what each format is, with a game to play, before you choose one (no account needed)").action(e=>fR(e));Ce.command("client").option("--out <dir>","where to write it, defaulting to the current directory").description("write the player client into your project, as a browser can load it").action(VP);var iD=Ce.command("manifest").description("work with the App Manifest");iD.command("register").argument("[path]","manifest path","gamestage.yaml").description("register an existing manifest with the control plane (requires sign-in)").action(ZR);iD.command("validate").argument("[path]","manifest path","gamestage.yaml").option("--level <level>","require a conformance level (L0-L5)").description("validate a manifest and report its evidenced conformance").action(Kj);Ce.command("status").alias("list").argument("[game]","one game, or the whole workspace when omitted").description("what is deployed, what state it is in, and what caps are near (`list` with no game lists them)").action(UR);Ce.command("open").argument("<game>","game id").argument("[where]","play (default), studio or stage").description("open the game, its Studio project or its Stage page in the browser").action((e,t)=>eD(e,t));Ce.command("look").argument("[url]","the page to look at, by default the one `dev --serve` serves","http://127.0.0.1:4001").option("--tap <target>","press a button or link by its words, label or a CSS selector; repeat to press several in order",(e,t)=>[...t,e],[]).option("--width <px>","screen width","390").option("--height <px>","screen height","844").option("--out <file>","where to save the screenshot",".gamestage/look.png").option("--wait <ms>","how long to let the page settle after loading and after each press","1500").description("open a page at phone size, press things, and save what it looks like: a screenshot, its words and its errors").action((e,t)=>nD(e,t));Ce.command("docs").argument("[chapter]","a chapter, such as game-formats or cli").description("read a documentation chapter in the terminal (no account needed)").action(e=>oD(e));Ce.command("deploy").argument("<game>","game id").option("--revision <revision>","manifest revision being published").option("--hash <hash>","content hash of the snapshot").option("--level <level>","evidenced conformance level (L0-L5)").option("--prize","the game offers a prize (paid tiers only)",!1).option("--file <path>","the game's HTML, uploaded before the deploy gate runs").option("--dir <path>","the game's directory, uploaded with relative paths").option("--manifest <path>","the game's manifest (gamestage.yaml)").option("--notes <text>","what changed, said in the deploy announcement and the game's log").option("--space <id>","the Studio space id to deploy this game's project into").option("--space-org <id>","the Studio organisation that --space belongs to, when it is known").option("--no-check","skip loading the published page in a browser afterwards").option("--allow <path...>","publish a file the deploy gate suspects; it never clears a certain finding").description("publish a snapshot to a playground, and the round it puts on").action(GR);var sS=Ce.command("domain").description("serve a game from your own hostname, such as quiz.myclub.com (Publisher and Enterprise)");sS.command("add").argument("<game>","game id").argument("<hostname>","a subdomain you control, such as quiz.myclub.com").option("--move","take your plan's domain off its other game and put it here",!1).description("add a custom domain to a game, and print the DNS record to create").action((e,t,o)=>nL(e,t,o));sS.command("status").argument("<game>","game id").option("--watch","check every 15 seconds until the domain is live or failed",!1).description("check the domain's DNS record and certificate now").action((e,t)=>oL(e,t));sS.command("remove").argument("<game>","game id").description("stop serving the game from its custom domain; its own address keeps working").action(e=>rL(e));var bl=Ce.command("workspace").description(`share your workspace with up to ${Mr} colleagues, and pick which workspace commands act in`);bl.command("members").description("list the owner, members and invites not yet accepted").action(()=>LP());bl.command("invite").argument("<email>","a colleague's work address").description(`invite a colleague; they join by signing in with that address (owner only). ${g2}`).action(e=>DP(e));bl.command("remove").argument("<email>","a member's address, or an invite to cancel").description("remove a member or cancel an invite; it takes effect on their next request (owner only)").action(e=>MP(e));bl.command("use").argument("[id]","a workspace you are a member of; leave out to list them").option("--own","go back to your own workspace",!1).description("act in a shared workspace from now on, or list the ones you can").action((e,t)=>FP(e,t));bl.command("signal").argument("[state]","on, off or status","status").description("switch Monterosa Analytics (Signal) on or off for this workspace's games, on a paid plan").action(e=>jP(e));var Yi=Ce.command("theme").description("make your own Gamestage UI theme, keep it privately for your organisation, and use it in a game");Yi.command("init").argument("<name>","the theme's name, such as your company's: lowercase letters, numbers and hyphens").option("--dir <path>","where to write it (default <name>-theme)").description("start a theme package: theme.json, tokens.json and an optional overrides.css").action((e,t)=>hL(e,t));Yi.command("check").argument("[dir]","the theme's folder",".").description("run the library's checks: contrast, type scale, unknown and missing roles, overrides").action(e=>fL(e));Yi.command("preview").argument("[dir]","the theme's folder",".").option("--port <port>","the local port to serve on").description("show the main components wearing the theme in a local page, rebuilt as you edit").action((e,t)=>gL(e,t));Yi.command("publish").argument("[dir]","the theme's folder",".").option("--declare-fonts","declare, in your name, that you may use each font in web games",!1).description("check, build and store the theme privately for your organisation, as name@version (organisation admins only)").action((e,t)=>yL(e,t));Yi.command("list").description("your organisation's themes and their versions").action(()=>wL());Yi.command("use").argument("<ref>","the theme, such as acme for its newest version, or acme@1.0.0").option("--manifest <path>","the game's manifest (gamestage.yaml)").description("install a theme into this game, pin its version in gamestage.yaml and wire it into the page").action((e,t)=>vL(e,t));var rh=Ce.command("org").description("your organisation's integration context and starter apps: how a game fits your organisation's app"),sD=rh.command("context").option("--save [path]","write it to a file for your agent to read (default integration.md)").description("print your organisation's integration context, or save it with --save").action(e=>kL(e));sD.command("set").argument("<file>","the Markdown file to publish, such as integration.md").description("publish a new revision for everyone in your organisation (organisation admins only)").action(e=>_L(e));sD.command("history").description("every revision, newest first, with who set it and when").action(()=>xL());var cS=rh.command("starter").description("your organisation's starter apps: a working app in your own stack that new games start from");cS.command("publish").argument("<folder>","the folder holding the app and its gamestage-starter.json").description("check and publish a new version for everyone in your organisation (organisation admins only)").option("--check","run the server's checks on this machine and stop: no sign-in, nothing uploaded or published").action((e,t)=>SL(e,t));cS.command("list").description("every starter app, with its newest version, framework and who published it").option("--all","include retired versions").action(e=>$L(e));cS.command("retire").argument("<name@version>","the exact version, such as web-embed@1.0.0").description("stop create choosing a version; games made from it keep working (organisation admins only)").action(e=>TL(e));rh.command("admins").description("who can change your organisation's integration notes, starter apps and themes").action(()=>EL());rh.command("use").argument("[org]","the customer organisation to work as, such as nba").option("--home","go back to your own organisation's files").description("Monterosa only: choose which customer's integration notes, starter apps and themes you change").action((e,t)=>AL(e,t));var lS=Ce.command("ads").description("ask for partner products on a game's result screen (in preview, subject to approval and commercial terms)");lS.command("request").argument("<game>","game id").option("--audience <text>",'who the game is for, such as "Club fans in the UK, mostly adults"').option("--where <text>",'where it is played, such as "the club app and website"').option("--countries <text>",'the countries its fans are in, such as "United Kingdom, Ireland"').option("--prize","the game has a prize").option("--no-prize","the game has no prize").option("--note <text>","anything else Monterosa should know").description("ask Monterosa and the retail partner to approve products for this game").action((e,t)=>IL(e,t));lS.command("status").argument("<game>","game id").description("where this game's request for products is, and what happens next").action(e=>OL(e));lS.command("skip").argument("<game>","game id").description("record that you do not want products in this game, so you are not asked again").action(e=>PL(e));var Co=Ce.command("reference").description("the private data a round is scored against");Co.command("push").argument("<name>",'the name a producer types in Studio, e.g. "the-limit/careers.json"').argument("<file>","the JSON file holding it").description("upload a dataset, and an immutable copy a round can be pinned to").option("--drop-scoring","publish even though a measure that scores rounds today would stop scoring them").action(Bz);Co.command("check").argument("<file>","the JSON file holding it").argument("[keys...]","the keys a round uses, to check they are all present").description("what a round would fail on, before a producer finds out").action(qz);var iS=(e,t=[])=>[...t,e];Co.command("list").description("every dataset this workspace holds, and which games read it").action(Vz);Co.command("status").argument("<name>","the dataset's name, as `reference list` shows it").description("one dataset: where it came from, its measures, the games that read it, and the rounds built from it").action(Zz);Co.command("inspect").argument("<source>","a JSON or CSV file, or an https:// address that returns one").option("--header <header>",'sent with an address, e.g. "Authorization: Bearer <key>"; repeat for more',iS).description("what a file or an API holds, and which fields could be a dataset's key and measures").action(Xz);Co.command("build").argument("<source>","a JSON or CSV file, or an https:// address that returns one").option("--key <field>","the field that names each entry, different on every record").option("--measure <field>","a field holding the numbers a round counts; repeat for more",iS).option("--label <field>","the field holding a name a producer reads, such as a player's name").option("--list <path>","which list of records, as `reference inspect` shows it; the biggest by default").option("--source <text>","one line saying where the data came from, shown when a round reveals it").option("--header <header>","sent with an address; repeat for more",iS).option("--out <file>","where to write the dataset").option("--force","replace the --out file if it exists").description("turn a file or an API's records into a dataset you can push").action(Qz);Co.command("download").argument("<name>","a dataset this workspace uploaded").argument("[file]","where to write it; the dataset's own file name by default").option("--force","replace the file if it exists").description("get back a dataset you uploaded, as the file that was pushed").action(ej);Co.command("run").argument("<name>","a dataset a source pulls, as `reference list` shows it").option("--no-wait","ask for the pull and return, without waiting for it to finish").description("pull a source's dataset now and report its keys and digest, never a value; once every 15 minutes").action((e,t)=>nj(e,t));Co.command("delete").argument("<name>","a dataset this workspace uploaded and no game reads").option("--yes","remove it without asking").description("remove a dataset no game reads; rounds already open keep their numbers").action(tj);var da=Ce.command("live").description("live data: follow a real contest as it happens (switch it on, off, or see which)").helpCommand(!0).option("--manifest <path>","the manifest, default gamestage.yaml").action(e=>cj(e));da.command("on").description("switch live data on in gamestage.yaml; deploy to apply it").option("--provider <provider>","where the contest's live data comes from","sportmonks").option("--manifest <path>","the manifest, default gamestage.yaml").action(e=>ij(e));da.command("off").description("switch live data off in gamestage.yaml; deploy to apply it").option("--manifest <path>","the manifest, default gamestage.yaml").action(e=>sj(e));da.command("simulate").description(`start a made-up match on the live feed, for an edition's "Live contest"`).option("--speed <n>","match seconds per real second, 1 to 120","30").option("--seed <n>","which made-up match: the same seed plays the same goals","6").option("--from <minute>","start at this minute of the match").action(e=>dj(e));da.command("list").description("this workspace's simulations: state, minute, score and speed").action(()=>uj());da.command("pause").description("pause a simulation; every game following it holds").argument("<id>","the simulation, sim- and eight characters").action(e=>Wp(e,"pause"));da.command("play").description("carry on a paused simulation from where it was").argument("<id>","the simulation, sim- and eight characters").action(e=>Wp(e,"play"));da.command("stop").description("end a simulation; the feed publishes full time at its score").argument("<id>","the simulation, sim- and eight characters").action(e=>Wp(e,"stop"));var dS=Ce.command("sources").description("where a game's real-world values can come from, and which you can use now").helpCommand(!0).action(oj);dS.command("connect <source>").description("switch a source on: ESPN with --league, or the link to add your own key for Sportmonks").option("--league <league>","ESPN only: nba, wnba, nfl, mlb or nhl").option("--measures <keys>","ESPN only: comma-separated measures; `sources status espn --league nba` lists them").option("--season <year>","ESPN only: ESPN's year for the season, e.g. 2025; default the current one").option("--name <dataset>","ESPN only: the dataset's name, default espn-<league>").option("--from-op <reference>","keyed sources, at your own terminal only: read the key from 1Password (op://Vault/Item/field); never run by an agent").action((e,t)=>bj(e,t));dS.command("status <source>").description("what is connected for a source; with --league, the measures ESPN offers there").option("--league <league>","ESPN only: list this league's measures").action((e,t)=>kj(e,t));dS.command("disconnect <source>").description("stop a source's scheduled fetches; the data already fetched stays").option("--name <dataset>","ESPN only: which dataset, e.g. espn-nba").action((e,t)=>_j(e,t));var ah=Ce.command("round").description("the round a fan plays, and getting it into Studio");ah.command("push").argument("<game>","game id").option("--manifest <path>","the game's manifest; the round is read from practice/round.yaml beside it","gamestage.yaml").option("--yes","do not ask before replacing what a producer has typed",!1).description("write your round into Studio, where a producer owns it from then on").action(Tj);ah.command("season").argument("<game>","game id").option("--file <path>","the season: a list of dated rounds",q0).option("--manifest <path>","the game's manifest, for its format","gamestage.yaml").option("--overwrite","write over days that already have a round in Studio",!1).option("--dry-run","check the file and say what would be written, without writing",!1).option("--yes","do not ask before writing",!1).description("write a season of rounds into Studio, one edition a day").action(Oj);ah.command("seed").argument("<game>","game id").requiredOption("--count <n>","number of candidate rounds (1\u201380)").option("--measure <key>","dataset measure (required when there are several)").option("--position <position>","filter by position, case-insensitive exact match").option("--team <team>","filter by team, case-insensitive exact match").option("--layout <layout>","grid (cards, the default), pitch (players on a football pitch) or xi (Complete the XI, from a line-up dataset)").option("--dataset <name>","read this dataset of yours instead of the game's own, e.g. sportmonks/premier-league-lineups.json").option("--prompt <text>","the question for xi rounds, with {position} and {team}").option("--dry-run","print candidate rounds without writing",!1).option("--yes","create rounds without asking for consent",!1).description("build rounds from the game's connected dataset and create them in Studio").action(Aj);ah.command("refresh").argument("<game>","game id").description("read Studio and the dataset again now, rather than on the next fan's visit").action(Ej);var Vi=Ce.command("graphic").description("the graphic your game puts on a screen");Vi.command("dev").option("--css <path>","the stylesheet to preview","graphic.css").option("--port <port>","port to serve on","4321").option("--rows <rows>","how many rows to draw","10").option("--bigscreen","draw it as a big screen rather than an overlay",!1).option("--accent <colour>","accent colour, as #rrggbb").option("--renderer <url>","where the Live Graphics renderer is served from","https://monterosa-gamestage.spaces-dev.monterosa.cloud/r/").description("see your stylesheet on the real graphic, on your own machine").action(Bj);Vi.command("templates").description("the screens a graphic can be cut for").action(Zj);Vi.command("create").argument("<game>","game id").option("--template <id>","the screen to cut it for",Hi).option("--consent","confirm the people named agreed to appear on a screen",!1).description("put this game's leaderboard on a screen").action(Hj);Vi.command("list").argument("<game>","game id").description("the graphics this game has, and where to watch them").action(Yj);Vi.command("remove").argument("<game>","game id").argument("<id>","the graphic's id, from `gamestage graphic list`").description("take a graphic off the air").action(Vj);Vi.command("push").argument("<game>","game id").option("--css <path>","the stylesheet to publish","graphic.css").description("hand a producer the address of your stylesheet").action(qj);Ce.command("archive").argument("<game>","game id").description("take a game off the air while retaining its record and files").action(BR);Ce.command("rename").argument("<game>","game id; it never changes").argument("<name>","the new name, in quotes").option("--dir <path>","the game's folder, to check its gamestage.yaml",".").description("give a game a new name in Stage, the CLI and Studio, keeping its id").action((e,t,o)=>RL(e,t,o));Ce.command("promote").argument("<game>","game id").description("approve your own game to move from dev to prod").action(qR);Ce.command("prune").option("--yes","do not ask before deleting",!1).description("remove archived games that never deployed").action(WR);Ce.command("plan").argument("<plan>","runtime, live or enterprise").description("change this workspace's plan and its limits").action(HR);Ce.command("suspend").argument("<game>","game id").description("take a game off the air and free its live slot").action(e=>y0(e,!1));Ce.command("wake").argument("<game>","game id").description("put a suspended game back on the air").action(e=>y0(e,!0));Ce.command("endpoint").argument("<game>","game id").argument("[which]","player, control or playground; all three when omitted").description("print where a deployed game answers").action(KR);Ce.command("logs").argument("<game>","game id").option("--limit <n>","how many lines, newest kept","100").option("--since <iso>","only lines after this timestamp").option("--level <level>","info, warn or error").description("tail a game's runtime log").action(XR);Ce.command("usage").argument("<game>","game id").description("what the game's Jev questions cost: per round, in total, and per fan's game").action(QR);Ce.command("dev").option("--port <port>","local HTTP port","4000").option("--manifest <path>","the game's manifest (gamestage.yaml)").addOption(new In("--fixture").hideHelp()).addOption(new In("--scenario <name>").hideHelp()).addOption(new In("--as <player>").hideHelp()).option("--serve","also serve this directory, so the page has somewhere to open",!1).option("--serve-port <port>","port for the page (with --serve)","4001").description("play your round through the deployed Engine, with your page on this machine (requires sign-in)").action(hz);Ce.command("suggest").description("tell us about a format or feature we do not have (no account needed)").argument("[what]","what you were trying to build, or pipe it in").option("--closest <format>","the format that came nearest, if one did").option("--send","actually send it, having seen what it says",!1).action((e,t)=>Dz(e,t,nt));Ce.command("issue").description("report something that went wrong (no account needed)").argument("[what]","what went wrong, or pipe it in").option("--game <id>","the game it happened on, if it was about one").option("--send","actually send it, having seen what it says",!1).action((e,t)=>Uz(e,t,nt));Ce.command("login").description("sign in, or create an account (needed before dev, verify or deploy)").option("--workspace <id>","the workspace you expect to land in, from the welcome screen").action(e=>Iz(e.workspace));var mV=Ce.command("link").description("connect an account Gamestage needs (requires sign-in)");mV.command("github").description("link your GitHub account, which a first deploy requires").action(Az);var Ut=Ce.command("admin").description("approve, refuse, set the plan or grants of, or close a creator's account (operators only)");Ut.command("approve").argument("<workspace>","workspace id, from the registration alert").description("let this account use the runtime").action(e=>g0(e,"approved"));Ut.command("refuse").argument("<workspace>","workspace id, from the registration alert").description("turn this account down, finally").action(e=>g0(e,"refused"));Ut.command("plan").argument("<workspace>","workspace id").argument("<plan>","runtime (Starter), live (Publisher) or enterprise").option("--live-games <count>","live-game ceiling instead of the plan's own; 0 is none").description("move this account onto a plan, including a paid one").action((e,t,o)=>VR(e,t,o));Ut.command("grant").argument("<workspace>","workspace id").argument("<grant>","org:<id> or org-admin:<id>").description("put a workspace in an organisation, or make it an admin of one").action((e,t)=>rS(e,t,"add"));Ut.command("ungrant").argument("<workspace>","workspace id").argument("<grant>","org:<id> or org-admin:<id>").description("take an organisation grant away from a workspace").action((e,t)=>rS(e,t,"remove"));Ut.command("grants").argument("<workspace>","workspace id").description("list a workspace's grants and the organisation it belongs to").action(e=>GL(e));var uS=Ut.command("org").description("this control plane's customer organisations: their Studio, spaces and domains"),aD=(e,t=[])=>[...t,e];uS.command("list").description("every organisation on this control plane, and whether it is stored yet").action(()=>BL());uS.command("show").argument("<org>","organisation id, such as nba").description("every field of one organisation, and which Studio key it uses").action(e=>qL(e));uS.command("set").argument("<org>","organisation id, such as nba").option("--name <name>","the organisation's name; needed to create one").option("--studio-host <host>","which Studio its organisation is on: us, eu or dev").option("--studio-org <id>","its Studio organisation id").option("--space <id>","a Studio space it owns; repeat for more, the first is the default",aD).option("--domain <domain>","an email domain whose workspaces join it; repeat for more",aD).option("--consent <provider>","whose consent gate its games use: onetrust or ours").option("--identity <ref>","its fan sign-in's reference, such as an Identify project").option("--signed-agreement","its signed agreement with Monterosa covers Gamestage, so its workspaces skip the click-through Terms").option("--no-signed-agreement","take the signed agreement away, so its workspaces accept the Terms again").option("--login-keys <url>","its fan sign-in's public key set (JWKS), which new games' logins are seeded from").option("--login-issuer <url>",'the issuer its fan tokens carry; give "" if they carry none').option("--login-audience <aud>",'the audience its fan tokens carry; give "" to remove it').option("--login-claim <claim>",'the claim its fans are in when it is not sub, such as SubscriberId; give "" to remove it').description("create an organisation or change it, printing what changed").action((e,t)=>WL(e,t));Ut.command("trial").argument("<workspace>","workspace id").argument("<limit>","day_cap, mau, storage or fair_use").argument("<setting>","on or off").description("turn a capping trial on or off for one workspace").action((e,t,o)=>YL(e,t,o));Ut.command("trials").argument("<workspace>","workspace id").description("list what each limit does for a workspace: refuses, or counts").action(e=>VL(e));Ut.command("domains").description("every custom domain, with its game, workspace, status and what DNS last said").action(aL);Ut.command("refresh").argument("<workspace>","workspace id").argument("<dataset>","the dataset's name, e.g. espn-nba").argument("<hours>","fetch every this many hours (1 to 168), or `default` for the creator's own").description("fetch a switched-on source more (or less) often than twice a day").action((e,t,o)=>yj(e,t,o));Ut.command("creator-sync").description("sync every creator into the Resend segment now, and print the counts").action(()=>YR());Ut.command("erase").argument("<game>","the game's id; it must be archived").description("delete one archived game's player data, for a creator's written request").action(e=>ML(e));Ut.command("close").argument("<workspace>","workspace id").description("close an account: take every game off the air and delete its data").action(e=>FL(e));Ut.command("erasures").description("every deletion asked for, what is still in progress and when it is due").action(UL);Ce.command("logout").description("forget the stored session").action(Oz);Ce.command("whoami").description("show who the CLI is signed in as").action(Pz);QL(process.argv)&&(process.stdout.write(`${JSON.stringify(XL(Ce,nt),null,2)}
|
|
9225
9225
|
`),await or(0));Ce.parseAsync(process.argv).catch(e=>{Ht(e),process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
9226
9226
|
`),process.exit(1)});
|
package/package.json
CHANGED